@sublimee/tokens 0.1.1 → 0.1.10

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.
Files changed (3) hide show
  1. package/AI_INDEX.md +48 -0
  2. package/README.md +53 -324
  3. package/package.json +3 -2
package/AI_INDEX.md ADDED
@@ -0,0 +1,48 @@
1
+ # @sublimee/tokens AI Index
2
+
3
+ Token-efficient entry point for AI agents reading the installed npm package.
4
+
5
+ ## Use This Package For
6
+
7
+ - semantic theme vocabulary,
8
+ - color, spacing, radius, shadow, and motion tokens,
9
+ - type-safe token-name references.
10
+
11
+ ## First Move
12
+
13
+ ```tsx
14
+ import "@sublimee/tokens/tokens.css";
15
+ ```
16
+
17
+ ## Core Rule
18
+
19
+ Tokens describe purpose, not appearance.
20
+
21
+ Prefer semantic names like:
22
+ - `surface-0`
23
+ - `text-primary`
24
+ - `interactive-accent`
25
+
26
+ ## Primary Surfaces
27
+
28
+ - [src/tokens.css](./src/tokens.css) for the token values
29
+ - [src/index.ts](./src/index.ts) for exported token-name types
30
+ - [README.md](./README.md) for usage guidance
31
+
32
+ ## Typical Next Step
33
+
34
+ Override semantic custom properties instead of rewriting component styles:
35
+
36
+ ```css
37
+ :root {
38
+ --sublime-color-interactive-accent: #ec4899;
39
+ --sublime-radius-button: 9999px;
40
+ }
41
+ ```
42
+
43
+ ## Non-Goals
44
+
45
+ Do not assume:
46
+ - this package provides UI components,
47
+ - hardcoded brand colors should replace semantic token usage,
48
+ - dark mode should be solved separately from the token system.
package/README.md CHANGED
@@ -1,369 +1,98 @@
1
1
  # @sublimee/tokens
2
2
 
3
- The semantic design token system for Sublime. Define your aesthetic once, use it everywhere.
3
+ AI-first package doc for the Sublime semantic token layer.
4
4
 
5
- ## Installation
5
+ If you are an AI agent reading the installed npm package directly, start with [AI_INDEX.md](./AI_INDEX.md).
6
6
 
7
- ```bash
8
- pnpm add @sublimee/tokens
9
- ```
7
+ ## Use This Package When
10
8
 
11
- ## Quick Start
9
+ - you need the shared semantic design vocabulary,
10
+ - you want to theme Sublime components,
11
+ - you want stable color and motion names instead of hardcoded aesthetics.
12
12
 
13
- ```css
14
- /* In your app's global CSS */
15
- @import "@sublimee/tokens";
16
-
17
- /* Override with your brand (optional) */
18
- :root {
19
- --sublime-color-interactive-accent: #ec4899;
20
- --sublime-radius-button: 9999px;
21
- }
22
- ```
13
+ ## First Move
23
14
 
24
15
  ```tsx
25
- // Use in components
26
- <button className="bg-[var(--sublime-color-surface-1)] text-[var(--sublime-color-text-primary)]">
27
- Click me
28
- </button>
16
+ import "@sublimee/tokens/tokens.css";
29
17
  ```
30
18
 
31
- ---
32
-
33
- ## Philosophy
34
-
35
- **"Describe purpose, not appearance."**
36
-
37
- Traditional approaches hardcode values:
38
- ```css
39
- /* Bad: Hardcoded, breaks in dark mode */
40
- .button { background: white; color: black; }
41
- ```
19
+ or
42
20
 
43
- Sublime uses semantic tokens:
44
21
  ```css
45
- /* Good: Adapts to theme context */
46
- .button {
47
- background: var(--sublime-color-surface-1);
48
- color: var(--sublime-color-text-primary);
49
- }
50
- ```
51
-
52
- Tokens describe **what something is**, not **how it looks**:
53
- - `surface-1` = elevated container (could be white in light mode, gray-900 in dark)
54
- - `text-primary` = main text (could be black in light mode, white in dark)
55
- - `interactive-accent` = brand color for CTAs (your pink, their blue, etc.)
56
-
57
- ---
58
-
59
- ## Token Categories
60
-
61
- ### Colors (`--sublime-color-*`)
62
-
63
- #### Surface Colors
64
- Background colors for containers, cards, pages.
65
-
66
- | Token | Purpose |
67
- |-------|---------|
68
- | `--sublime-color-surface-0` | Page background (base layer) |
69
- | `--sublime-color-surface-1` | Elevated surfaces (cards, modals) |
70
- | `--sublime-color-surface-2` | Higher elevation |
71
- | `--sublime-color-surface-inset` | Depressed surfaces (inputs, wells) |
72
-
73
- Each has hover/active states:
74
- - `--sublime-color-surface-1-hover`
75
- - `--sublime-color-surface-1-active`
76
-
77
- #### Text Colors
78
- Content colors by emphasis level.
79
-
80
- | Token | Purpose |
81
- |-------|---------|
82
- | `--sublime-color-text-primary` | Headings, important text |
83
- | `--sublime-color-text-secondary` | Body text, descriptions |
84
- | `--sublime-color-text-muted` | Captions, placeholders |
85
- | `--sublime-color-text-disabled` | Disabled state |
86
- | `--sublime-color-text-accent` | Links, highlights |
87
-
88
- Each has an `-inverse` variant for use on dark surfaces.
89
-
90
- #### Border Colors
91
- Dividers, outlines, input borders.
92
-
93
- | Token | Purpose |
94
- |-------|---------|
95
- | `--sublime-color-border-primary` | Main borders |
96
- | `--sublime-color-border-secondary` | Subtle dividers |
97
- | `--sublime-color-border-accent` | Focused/active states |
98
- | `--sublime-color-border-error` | Error states |
99
-
100
- #### Interactive Colors
101
- Buttons, links, controls.
102
-
103
- | Token | Purpose |
104
- |-------|---------|
105
- | `--sublime-color-interactive-primary` | High-emphasis actions |
106
- | `--sublime-color-interactive-secondary` | Medium-emphasis actions |
107
- | `--sublime-color-interactive-ghost` | Low-emphasis actions |
108
- | `--sublime-color-interactive-accent` | Brand color actions |
109
-
110
- Each has hover, active, and text variants:
111
- - `--sublime-color-interactive-primary-hover`
112
- - `--sublime-color-interactive-primary-active`
113
- - `--sublime-color-interactive-primary-text`
114
-
115
- #### Status Colors
116
- Feedback states.
117
-
118
- | Token | Purpose |
119
- |-------|---------|
120
- | `--sublime-color-status-error` | Errors, destructive actions |
121
- | `--sublime-color-status-warning` | Warnings, cautions |
122
- | `--sublime-color-status-success` | Success, confirmations |
123
- | `--sublime-color-status-info` | Information, tips |
124
-
125
- Each has hover and background variants.
126
-
127
- #### Focus & Selection
128
-
129
- | Token | Purpose |
130
- |-------|---------|
131
- | `--sublime-color-focus-ring` | Keyboard focus indicator |
132
- | `--sublime-color-focus-ring-offset` | Ring background |
133
- | `--sublime-color-selection-bg` | Text selection background |
134
- | `--sublime-color-selection-text` | Selected text color |
135
-
136
- #### Overlays
137
-
138
- | Token | Purpose |
139
- |-------|---------|
140
- | `--sublime-color-overlay-light` | Light backdrops |
141
- | `--sublime-color-overlay-dark` | Dark backdrops |
142
- | `--sublime-color-overlay-scrim` | Modal overlays |
143
-
144
- ### Spacing (`--sublime-space-*`)
145
-
146
- Base-4 spacing scale:
147
-
148
- ```
149
- --sublime-space-1: 0.25rem (4px)
150
- --sublime-space-2: 0.5rem (8px)
151
- --sublime-space-3: 0.75rem (12px)
152
- --sublime-space-4: 1rem (16px)
153
- --sublime-space-6: 1.5rem (24px)
154
- --sublime-space-8: 2rem (32px)
155
- ```
156
-
157
- Component-specific aliases:
158
- - `--sublime-space-button-x`
159
- - `--sublime-space-button-y`
160
- - `--sublime-space-card-padding`
161
-
162
- ### Shadows (`--sublime-shadow-*`)
163
-
164
- Elevation system:
165
-
166
- ```
167
- --sublime-shadow-xs (subtle)
168
- --sublime-shadow-sm (cards)
169
- --sublime-shadow-md (elevated cards)
170
- --sublime-shadow-lg (modals)
171
- --sublime-shadow-xl (dialogs)
172
- ```
173
-
174
- Component-specific aliases:
175
- - `--sublime-shadow-button`
176
- - `--sublime-shadow-card`
177
- - `--sublime-shadow-focus-ring`
178
-
179
- ### Border Radius (`--sublime-radius-*`)
180
-
181
- ```
182
- --sublime-radius-sm (4px)
183
- --sublime-radius-md (6px)
184
- --sublime-radius-lg (8px)
185
- --sublime-radius-xl (12px)
186
- --sublime-radius-2xl (16px)
187
- --sublime-radius-full (pill/circle)
188
- ```
189
-
190
- Component-specific aliases:
191
- - `--sublime-radius-button`
192
- - `--sublime-radius-card`
193
- - `--sublime-radius-input`
194
-
195
- ### Typography (`--sublime-font-*`)
196
-
197
- ```
198
- --sublime-font-family-sans
199
- --sublime-font-family-mono
200
-
201
- --sublime-font-size-xs (12px)
202
- --sublime-font-size-sm (14px)
203
- --sublime-font-size-md (16px)
204
- --sublime-font-size-lg (18px)
205
- --sublime-font-size-xl (20px)
206
-
207
- --sublime-font-weight-medium
208
- --sublime-font-weight-semibold
209
- --sublime-font-weight-bold
210
-
211
- --sublime-line-height-tight
212
- --sublime-line-height-normal
213
- --sublime-line-height-relaxed
214
- ```
215
-
216
- ### Animation (`--sublime-duration-*`, `--sublime-ease-*`)
217
-
218
- ```
219
- --sublime-duration-fast: 100ms
220
- --sublime-duration-normal: 150ms
221
- --sublime-duration-slow: 200ms
222
-
223
- --sublime-ease-out: cubic-bezier(0, 0, 0.2, 1)
224
- --sublime-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1)
22
+ @import "@sublimee/tokens/tokens.css";
225
23
  ```
226
24
 
227
- Component-specific aliases:
228
- - `--sublime-transition-button`
229
- - `--sublime-transition-color`
230
- - `--sublime-transition-transform`
231
-
232
- ---
25
+ ## Core Rule
233
26
 
234
- ## Dark Mode
27
+ Tokens describe purpose, not appearance.
235
28
 
236
- All color tokens have dark variants that activate via:
29
+ Prefer:
30
+ - `surface-0`
31
+ - `text-primary`
32
+ - `interactive-accent`
237
33
 
238
- 1. `.dark` class on ancestor
239
- 2. `[data-theme="dark"]` attribute on ancestor
240
- 3. `prefers-color-scheme: dark` media query (fallback)
241
-
242
- ```css
243
- /* Automatic dark mode */
244
- <html class="dark">
245
- <body class="bg-[var(--sublime-color-surface-0)]">
246
- <!-- All components render in dark mode -->
247
- </body>
248
- </html>
249
- ```
34
+ Avoid:
35
+ - hardcoded brand colors inside reusable library work
36
+ - aesthetic names that do not explain role
250
37
 
251
- ---
38
+ ## Primary Token Families
252
39
 
253
- ## Customization
40
+ - `--sublime-color-*`
41
+ - `--sublime-space-*`
42
+ - `--sublime-shadow-*`
43
+ - `--sublime-radius-*`
44
+ - `--sublime-font-*`
45
+ - `--sublime-duration-*`
46
+ - `--sublime-ease-*`
47
+ - `--sublime-transition-*`
254
48
 
255
- ### Method 1: Override Specific Tokens
49
+ ## Typical Use
256
50
 
257
51
  ```css
258
- @import "@sublimee/tokens";
52
+ @import "@sublimee/tokens/tokens.css";
259
53
 
260
54
  :root {
261
- /* Your brand pink */
262
55
  --sublime-color-interactive-accent: #ec4899;
263
- --sublime-color-interactive-accent-hover: #db2777;
264
-
265
- /* Pill-shaped buttons */
266
56
  --sublime-radius-button: 9999px;
267
-
268
- /* Softer shadows */
269
- --sublime-shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.08);
270
- }
271
-
272
- .dark {
273
- /* Lighter accent in dark mode for contrast */
274
- --sublime-color-interactive-accent: #f472b6;
275
57
  }
276
58
  ```
277
59
 
278
- ### Method 2: Complete Theme Override
279
-
280
- Replace all tokens for a completely custom aesthetic:
281
-
282
- ```css
283
- @import "@sublimee/tokens"; /* Import defaults first */
284
-
285
- :root {
286
- /* Then override everything */
287
- --sublime-color-surface-0: #fafaf9;
288
- --sublime-color-surface-1: #ffffff;
289
- /* ... etc */
290
- }
291
- ```
292
-
293
- ### Method 3: Component-Specific Overrides
294
-
295
- ```css
296
- /* Only change buttons */
297
- .btn-custom {
298
- --sublime-color-interactive-primary: #your-color;
299
- }
300
- ```
301
-
302
- ---
303
-
304
- ## Usage with Tailwind
305
-
306
- ### Arbitrary Values
307
-
308
60
  ```tsx
309
- <button className="bg-[var(--sublime-color-surface-1)]">
310
- Click
311
- </button>
312
- ```
313
-
314
- ### Custom Utilities (Recommended)
315
-
316
- Add to your Tailwind config:
317
-
318
- ```js
319
- // tailwind.config.js
320
- module.exports = {
321
- theme: {
322
- extend: {
323
- colors: {
324
- sublime: {
325
- surface: {
326
- 0: 'var(--sublime-color-surface-0)',
327
- 1: 'var(--sublime-color-surface-1)',
328
- },
329
- text: {
330
- primary: 'var(--sublime-color-text-primary)',
331
- },
332
- },
333
- },
334
- },
335
- },
336
- };
337
- ```
338
-
339
- Then use:
340
-
341
- ```tsx
342
- <button className="bg-sublime-surface-1 text-sublime-text-primary">
343
- Click
61
+ <button
62
+ className="bg-[var(--sublime-color-surface-1)] text-[var(--sublime-color-text-primary)]"
63
+ >
64
+ Click me
344
65
  </button>
345
66
  ```
346
67
 
347
- ---
68
+ ## Task Routing
348
69
 
349
- ## Token Reference Table
70
+ ### Brand customization
350
71
 
351
- See [TOKENS.md](./TOKENS.md) for the complete token reference.
72
+ Override semantic custom properties instead of rewriting component styles.
352
73
 
353
- ---
74
+ ### Dark mode
354
75
 
355
- ## TypeScript
76
+ Use the token system's theme handling through:
77
+ - `.dark` on an ancestor,
78
+ - `[data-theme="dark"]` on an ancestor,
79
+ - or system preference as fallback.
356
80
 
357
- Token names can be typed for IDE autocomplete:
81
+ ### Type-safe token references
358
82
 
359
83
  ```tsx
360
- import type { SublimeColorToken, SublimeSpaceToken } from '@sublimee/tokens';
361
-
362
- // Token names as string literals for type safety
363
- const color: SublimeColorToken = '--sublime-color-surface-1';
84
+ import type {
85
+ SublimeColorToken,
86
+ SublimeSpaceToken,
87
+ SublimeToken,
88
+ } from "@sublimee/tokens";
364
89
  ```
365
90
 
366
- ---
91
+ ## Role In The System
92
+
93
+ This package does not provide UI on its own.
94
+
95
+ Its job is to let the UI packages ship strong defaults that stay customizable without drifting away from the system.
367
96
 
368
97
  ## License
369
98
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sublimee/tokens",
3
- "version": "0.1.1",
3
+ "version": "0.1.10",
4
4
  "description": "Semantic design tokens for Sublime",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -8,7 +8,8 @@
8
8
  "style": "./dist/tokens.css",
9
9
  "files": [
10
10
  "dist",
11
- "src"
11
+ "src",
12
+ "AI_INDEX.md"
12
13
  ],
13
14
  "exports": {
14
15
  ".": {