@vellira-ui/tokens 2.100.1 → 2.102.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 CHANGED
@@ -23,31 +23,37 @@ pnpm add @vellira-ui/tokens
23
23
 
24
24
  ## Usage
25
25
 
26
+ Choose a named theme explicitly:
27
+
26
28
  ```ts
27
- import {
28
- darkTheme,
29
- highContrastTheme,
30
- lightTheme,
31
- theme,
32
- } from '@vellira-ui/tokens';
33
-
34
- theme.semantic.surface.default;
35
- theme.semantic.text.primary;
36
- theme.semantic.border.default;
37
- theme.semantic.status.success.fg;
38
-
39
- theme.components.button.primary.solid.default.bg;
40
- theme.components.input.default.bg;
41
-
42
- theme.tokens.typography.family.regular;
43
- theme.tokens.spacing[4];
44
- theme.tokens.radius.md;
45
-
46
- lightTheme.name;
47
- darkTheme.name;
48
- highContrastTheme.name;
29
+ import { darkTheme, highContrastTheme, lightTheme } from '@vellira-ui/tokens';
30
+
31
+ darkTheme.semantic.surface.default;
32
+ darkTheme.semantic.surface.panel;
33
+ darkTheme.semantic.text.primary;
34
+ darkTheme.semantic.border.default;
35
+ darkTheme.semantic.status.success.fg;
36
+
37
+ darkTheme.components.button.primary.solid.default.bg;
38
+ darkTheme.components.input.default.bg;
39
+
40
+ darkTheme.tokens.typography.family.regular;
41
+ darkTheme.tokens.spacing[4];
42
+ darkTheme.tokens.radius.md;
43
+
44
+ lightTheme.name; // 'light'
45
+ darkTheme.name; // 'dark'
46
+ highContrastTheme.name; // 'high-contrast'
49
47
  ```
50
48
 
49
+ There is no implicit current/default JavaScript theme object. The historical
50
+ `theme` export is a deprecated partial view of `darkTheme`; use `darkTheme`
51
+ directly. The compatibility export is scheduled for removal in Vellira 3.0.0.
52
+
53
+ The generated Web CSS separately uses Light values for `:root`, so pages without
54
+ a theme attribute have a deterministic browser fallback. That CSS default does
55
+ not make `lightTheme` an implicit JavaScript default.
56
+
51
57
  ## Semantic Tokens
52
58
 
53
59
  The package provides semantic groups that describe intent instead of coupling
@@ -62,7 +68,6 @@ Current semantic groups include:
62
68
  - `focus`
63
69
  - `icons`
64
70
  - `menu`
65
- - `navigation`
66
71
  - `overlay`
67
72
  - `shadow`
68
73
  - `skeleton`
@@ -73,18 +78,23 @@ Current semantic groups include:
73
78
  Example:
74
79
 
75
80
  ```ts
76
- theme.semantic.surface.default;
77
- theme.semantic.surface.elevated;
81
+ darkTheme.semantic.surface.canvas;
82
+ darkTheme.semantic.surface.panel;
83
+ darkTheme.semantic.surface.elevated;
78
84
 
79
- theme.semantic.text.primary;
80
- theme.semantic.text.secondary;
85
+ darkTheme.semantic.text.primary;
86
+ darkTheme.semantic.text.secondary;
81
87
 
82
- theme.semantic.border.default;
88
+ darkTheme.semantic.border.default;
83
89
 
84
- theme.semantic.status.success.fg;
85
- theme.semantic.status.error.fg;
90
+ darkTheme.semantic.status.success.fg;
91
+ darkTheme.semantic.status.error.fg;
86
92
  ```
87
93
 
94
+ `surface.canvas` is the application/root backdrop, `surface.panel` is bounded
95
+ neutral container/chrome, and `surface.elevated` is reserved for genuinely
96
+ raised or floating layers.
97
+
88
98
  Using semantic tokens instead of raw palette values keeps component styling
89
99
  consistent across renderers and themes.
90
100
 
@@ -94,12 +104,12 @@ Component tokens define renderer-neutral values for component states and
94
104
  surfaces.
95
105
 
96
106
  ```ts
97
- theme.components.button.primary.solid.default.bg;
98
- theme.components.input.focus.border;
99
- theme.components.dropdown.content.bg;
100
- theme.components.popover.content.bg;
101
- theme.components.modal.content.bg;
102
- theme.components.tooltip.content.bg;
107
+ darkTheme.components.button.primary.solid.default.bg;
108
+ darkTheme.components.input.focus.border;
109
+ darkTheme.components.dropdown.content.bg;
110
+ darkTheme.components.popover.content.bg;
111
+ darkTheme.components.modal.content.bg;
112
+ darkTheme.components.tooltip.content.bg;
103
113
  ```
104
114
 
105
115
  Color-like component tokens may use either colors or the literal `transparent`
@@ -117,12 +127,51 @@ Examples:
117
127
 
118
128
  ```css
119
129
  --color-mono-0
120
- --surface-default
130
+ --surface-canvas
131
+ --surface-panel
121
132
  --text-primary
122
133
  --border-default
123
134
  --button-primary-solid-default-bg
124
135
  ```
125
136
 
137
+ Canonical token-path types describe only the current renderer-neutral token
138
+ contract. During Vellira 2.x, a bounded set of legacy CSS variables is still
139
+ generated for migration compatibility. Those aliases remain in the generated
140
+ CSS-variable name unions because they are actually emitted, but they are not
141
+ canonical `TokenPath`/`ComponentTokenPath` entries and new code must not adopt
142
+ them.
143
+
144
+ The compatibility aliases, replacements, migration evidence, and removal
145
+ release are tracked in
146
+ `src/platform-output/component-token-web-compatibility.ts`. They are scheduled
147
+ for removal in Vellira 3.0.0.
148
+
149
+ ## Public API deprecation policy
150
+
151
+ Public token/theme cleanup follows one bounded policy:
152
+
153
+ - named theme objects are canonical (`lightTheme`, `darkTheme`,
154
+ `highContrastTheme`);
155
+ - deprecated root exports preserve their existing behavior during the 2.x
156
+ compatibility window and name a canonical replacement;
157
+ - deprecated Web CSS variables remain platform-output aliases only and do not
158
+ re-enter canonical token-path unions;
159
+ - every alias has migration/preservation evidence and an explicit removal
160
+ boundary;
161
+ - Token Architecture Normalization V1 removes these compatibility aliases at
162
+ Vellira 3.0.0 unless a separately reviewed policy revision supersedes it.
163
+
164
+ The machine-readable contract lives in `src/public-api-policy.ts`. The detailed
165
+ architecture note is `docs/architecture/token-public-api-v1.md`.
166
+
167
+ ## React and React Native
168
+
169
+ The shared theme/token source is renderer-neutral. React/Web consumers can use
170
+ named theme objects or generated CSS variables. React Native consumes the same
171
+ canonical component intent and resolves platform representation through the
172
+ native output adapter; renderer-specific token branches are not part of the
173
+ public canonical component contract.
174
+
126
175
  ## Documentation
127
176
 
128
177
  - [Design Tokens](https://docs.vellira.dev/design-system/tokens)
@@ -170,8 +219,8 @@ The preservation contract covers the complete current public visual surface:
170
219
  overlay primitives and control-size values;
171
220
  - generated Web CSS variable names together with their serialized values, using
172
221
  the same serializer as the published `@vellira-ui/tokens/css` artifact;
173
- - the current React Native output contract, which consumes the canonical theme
174
- objects directly until a dedicated native platform adapter is introduced.
222
+ - the current React Native output contract derived from canonical component
223
+ intents and platform adapters.
175
224
 
176
225
  Normal token changes must not regenerate the baseline just to make a failure
177
226
  disappear. Instead, record the change in
@@ -28,6 +28,7 @@
28
28
  --z-index-modal: 1000;
29
29
  --z-index-toast: 1100;
30
30
  --font-family-base: 'Vellira Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
31
+ --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
31
32
  --font-family-extra-light: VelliraSans-ExtraLight;
32
33
  --font-family-regular: VelliraSans-Regular;
33
34
  --font-family-medium: VelliraSans-Medium;
@@ -38,6 +39,7 @@
38
39
  --font-weight-regular: 400;
39
40
  --font-weight-medium: 500;
40
41
  --font-weight-semibold: 600;
42
+ --font-weight-bold: 700;
41
43
  --font-size-xs: 12px;
42
44
  --font-size-sm: 14px;
43
45
  --font-size-md: 16px;
@@ -193,6 +193,7 @@ export declare const darkTheme: {
193
193
  readonly typography: {
194
194
  readonly family: {
195
195
  readonly base: "'Vellira Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
196
+ readonly mono: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace";
196
197
  readonly extraLight: "VelliraSans-ExtraLight";
197
198
  readonly regular: "VelliraSans-Regular";
198
199
  readonly medium: "VelliraSans-Medium";
@@ -213,6 +214,7 @@ export declare const darkTheme: {
213
214
  readonly regular: "400";
214
215
  readonly medium: "500";
215
216
  readonly semibold: "600";
217
+ readonly bold: "700";
216
218
  };
217
219
  readonly lineHeight: {
218
220
  readonly xs: 16;
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/dark/theme.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAEhD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYZ,CAAC"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/dark/theme.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAEhD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYZ,CAAC"}