@vinyasa/tokens 1.0.16 → 1.0.17

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
@@ -1,6 +1,6 @@
1
1
  # @vinyasa/tokens
2
2
 
3
- The shared design-token and theming foundation for `@vinyasa/*` components: a color/spacing/typography/motion contract plus a `VinyasaProvider` that resolves and injects real values at runtime.
3
+ The shared design-token and theming foundation for `@vinyasa/*` components: color, spacing, radius, typography, motion, focus rings, opacity, shadows, elevation, blur, and z-index tokens, plus static breakpoint/grid values and a `VinyasaProvider` that resolves and injects the themeable tokens at runtime.
4
4
 
5
5
  ## Installation
6
6
 
@@ -31,7 +31,10 @@ function App() {
31
31
  Values are organized in three tiers:
32
32
 
33
33
  1. **Primitives** (`primitives.ts`) — raw, numeric-keyed scales with no meaning attached: `gray[900]`, `blue[500]`, `space[3]`.
34
- 2. **Semantic contract** (`themeContract`, exported from this package) — a flat, brand-role naming tier: `primary`/`onPrimary`, `secondary`/`onSecondary`, `tertiary`/`onTertiary`, `error`/`onError`, plus `focus`, spacing (`space1`–`space6`), radii, font size/weight, line height, motion timing, and `borderWidthThin`. This is what a component's own `.css.ts` file imports and references — never the primitives directly.
34
+ 2. **Semantic contract** (`themeContract`, exported from this package) — a flat, brand-role naming tier covering colors (`primary`/`onPrimary`, `secondary`/`onSecondary`, `tertiary`/`onTertiary`, `error`/`onError`, `focus`), spacing (`space1`–`space6`), radii, border width, typography (font family/size/weight/letter-spacing/line-height), motion (duration/easing), focus rings, opacity, shadows, elevation, blur, and z-index. This is what a component's own `.css.ts` file imports and references — never the primitives directly.
35
+
36
+ `breakpoints` and `grid` (from `layout.ts`) are the one exception — they're exported as plain static values, **not** part of `themeContract`. CSS custom properties can't appear inside `@media` query conditions (`@media (min-width: var(--x))` is invalid in every browser), so responsive breakpoints can never be runtime-themed the way colors or spacing can. Consume them as literals directly in your own component's build-time `@media` blocks.
37
+
35
38
  3. **Runtime theme** (`defaultTheme`, `createTheme`, `VinyasaProvider`) — the actual values, injected as CSS custom properties at render time (via `@vanilla-extract/dynamic`), not baked into a static stylesheet. This is what makes overriding a value a runtime prop, not a rebuild.
36
39
 
37
40
  ### Overriding values
@@ -69,13 +72,13 @@ function Component() {
69
72
  }
70
73
  ```
71
74
 
72
- ### `colorScheme` and `contrast`
75
+ ### `colorScheme`, `contrast`, and `density`
73
76
 
74
77
  ```tsx
75
- <VinyasaProvider colorScheme="light" contrast="normal">
78
+ <VinyasaProvider colorScheme="light" contrast="normal" density="comfortable">
76
79
  ```
77
80
 
78
- Only `light`/`normal` values are authored today. The registry these resolve from (`resolveBaseTheme`) is structured so adding `dark` or `high`-contrast values later is purely additive — no changes to the contract, the provider, or any component that consumes it. Requesting an unshipped combination falls back to `light`/`normal` with a console warning in development.
81
+ Only `light`/`normal`/`comfortable` values are authored today. `colorScheme`/`contrast` resolve together via `resolveBaseTheme`; `density` resolves separately via `resolveDensitySpacing` (it only ever varies the `space1`–`space6` keys, applied as an overlay after the base theme and before any explicit `theme` override) since color and spacing don't vary together. Both are structured so adding `dark`/`high`-contrast values or a `compact`/`spacious` spacing scale later is purely additive — no changes to the contract, the provider, or any component that consumes it. Requesting an unshipped combination falls back to the default with a console warning in development.
79
82
 
80
83
  ## Consuming the contract in your own component
81
84
 
@@ -98,15 +101,17 @@ export const root = style({
98
101
 
99
102
  ## API
100
103
 
101
- | Export | Description |
102
- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
103
- | `VinyasaProvider` | React component. Props: `theme?`, `colorScheme?`, `contrast?`, `children`. |
104
- | `useVinyasaTheme()` | Hook returning the currently resolved `VinyasaTheme` object. |
105
- | `themeContract` | The token contract — import as `vars` in a component's `.css.ts` file. |
106
- | `defaultTheme` | The default (light/normal) theme values object. |
107
- | `createTheme(overrides)` | Merges a partial theme onto `defaultTheme`, returning a full `VinyasaTheme`. |
108
- | `resolveBaseTheme(colorScheme, contrast)` | Looks up the base theme for a scheme/contrast pair, with a dev-mode fallback warning. |
109
- | `VinyasaTheme`, `ColorScheme`, `Contrast`, `VinyasaProviderProps` | Types. |
104
+ | Export | Description |
105
+ | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
106
+ | `VinyasaProvider` | React component. Props: `theme?`, `colorScheme?`, `contrast?`, `density?`, `children`. |
107
+ | `useVinyasaTheme()` | Hook returning the currently resolved `VinyasaTheme` object. |
108
+ | `themeContract` | The token contract — import as `vars` in a component's `.css.ts` file. |
109
+ | `defaultTheme` | The default (light/normal/comfortable) theme values object. |
110
+ | `createTheme(overrides)` | Merges a partial theme onto `defaultTheme`, returning a full `VinyasaTheme`. |
111
+ | `resolveBaseTheme(colorScheme, contrast)` | Looks up the base theme for a scheme/contrast pair, with a dev-mode fallback warning. |
112
+ | `resolveDensitySpacing(density)` | Looks up the `space1`–`space6` overlay for a density, with a dev-mode fallback warning. |
113
+ | `breakpoints`, `grid` | Static layout values (not themeable — see above). From `layout.ts`. |
114
+ | `VinyasaTheme`, `ColorScheme`, `Contrast`, `Density`, `VinyasaProviderProps` | Types. |
110
115
 
111
116
  ## Development
112
117
 
@@ -29,9 +29,12 @@ var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
30
  __webpack_require__.d(__webpack_exports__, {
31
31
  VinyasaProvider: ()=>VinyasaProvider,
32
+ breakpoints: ()=>breakpoints,
32
33
  createTheme: ()=>createTheme,
33
34
  defaultTheme: ()=>defaultTheme,
35
+ grid: ()=>grid,
34
36
  resolveBaseTheme: ()=>resolveBaseTheme,
37
+ resolveDensitySpacing: ()=>resolveDensitySpacing,
35
38
  themeContract: ()=>themeContract,
36
39
  useVinyasaTheme: ()=>useVinyasaTheme
37
40
  });
@@ -55,14 +58,49 @@ var themeContract = {
55
58
  radiusMd: 'var(--vinyasa-radius-md)',
56
59
  radiusFull: 'var(--vinyasa-radius-full)',
57
60
  borderWidthThin: 'var(--vinyasa-border-width-thin)',
61
+ fontFamilySans: 'var(--vinyasa-font-family-sans)',
62
+ fontFamilyMono: 'var(--vinyasa-font-family-mono)',
63
+ fontSizeXs: 'var(--vinyasa-font-size-xs)',
58
64
  fontSizeSm: 'var(--vinyasa-font-size-sm)',
59
65
  fontSizeMd: 'var(--vinyasa-font-size-md)',
66
+ fontSizeLg: 'var(--vinyasa-font-size-lg)',
67
+ fontSizeXl: 'var(--vinyasa-font-size-xl)',
60
68
  fontWeightRegular: 'var(--vinyasa-font-weight-regular)',
69
+ fontWeightMedium: 'var(--vinyasa-font-weight-medium)',
61
70
  fontWeightSemibold: 'var(--vinyasa-font-weight-semibold)',
71
+ fontWeightBold: 'var(--vinyasa-font-weight-bold)',
72
+ letterSpacingTight: 'var(--vinyasa-letter-spacing-tight)',
73
+ letterSpacingNormal: 'var(--vinyasa-letter-spacing-normal)',
74
+ letterSpacingWide: 'var(--vinyasa-letter-spacing-wide)',
62
75
  lineHeightTight: 'var(--vinyasa-line-height-tight)',
63
76
  lineHeightNormal: 'var(--vinyasa-line-height-normal)',
77
+ lineHeightLoose: 'var(--vinyasa-line-height-loose)',
78
+ motionDurationInstant: 'var(--vinyasa-motion-duration-instant)',
64
79
  motionDurationFast: 'var(--vinyasa-motion-duration-fast)',
65
- motionEasingStandard: 'var(--vinyasa-motion-easing-standard)'
80
+ motionDurationNormal: 'var(--vinyasa-motion-duration-normal)',
81
+ motionDurationSlow: 'var(--vinyasa-motion-duration-slow)',
82
+ motionEasingStandard: 'var(--vinyasa-motion-easing-standard)',
83
+ motionEasingIn: 'var(--vinyasa-motion-easing-in)',
84
+ motionEasingOut: 'var(--vinyasa-motion-easing-out)',
85
+ motionEasingInOut: 'var(--vinyasa-motion-easing-in-out)',
86
+ focusRingWidth: 'var(--vinyasa-focus-ring-width)',
87
+ focusRingOffset: 'var(--vinyasa-focus-ring-offset)',
88
+ opacityDisabled: 'var(--vinyasa-opacity-disabled)',
89
+ opacityHover: 'var(--vinyasa-opacity-hover)',
90
+ shadowSm: 'var(--vinyasa-shadow-sm)',
91
+ shadowMd: 'var(--vinyasa-shadow-md)',
92
+ shadowLg: 'var(--vinyasa-shadow-lg)',
93
+ elevationRaised: 'var(--vinyasa-elevation-raised)',
94
+ elevationOverlay: 'var(--vinyasa-elevation-overlay)',
95
+ elevationModal: 'var(--vinyasa-elevation-modal)',
96
+ blurSm: 'var(--vinyasa-blur-sm)',
97
+ blurMd: 'var(--vinyasa-blur-md)',
98
+ blurLg: 'var(--vinyasa-blur-lg)',
99
+ zIndexDropdown: 'var(--vinyasa-z-index-dropdown)',
100
+ zIndexOverlay: 'var(--vinyasa-z-index-overlay)',
101
+ zIndexModal: 'var(--vinyasa-z-index-modal)',
102
+ zIndexToast: 'var(--vinyasa-z-index-toast)',
103
+ zIndexTooltip: 'var(--vinyasa-z-index-tooltip)'
66
104
  };
67
105
  const gray = {
68
106
  50: '#f9fafb',
@@ -104,21 +142,67 @@ const radius = {
104
142
  const borderWidth = {
105
143
  thin: '1px'
106
144
  };
145
+ const fontFamily = {
146
+ sans: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",
147
+ mono: "ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace"
148
+ };
107
149
  const fontSize = {
150
+ xs: '0.75rem',
108
151
  sm: '0.875rem',
109
- md: '1rem'
152
+ md: '1rem',
153
+ lg: '1.125rem',
154
+ xl: '1.25rem'
110
155
  };
111
156
  const fontWeight = {
112
157
  regular: '400',
113
- semibold: '600'
158
+ medium: '500',
159
+ semibold: '600',
160
+ bold: '700'
161
+ };
162
+ const letterSpacing = {
163
+ tight: '-0.01em',
164
+ normal: '0',
165
+ wide: '0.02em'
114
166
  };
115
167
  const lineHeight = {
116
168
  tight: '1',
117
- normal: '1.5'
169
+ normal: '1.5',
170
+ loose: '1.75'
118
171
  };
119
172
  const motion = {
173
+ durationInstant: '100ms',
120
174
  durationFast: '150ms',
121
- easingStandard: 'ease'
175
+ durationNormal: '250ms',
176
+ durationSlow: '400ms',
177
+ easingStandard: 'ease',
178
+ easingIn: 'ease-in',
179
+ easingOut: 'ease-out',
180
+ easingInOut: 'ease-in-out'
181
+ };
182
+ const focusRing = {
183
+ width: '2px',
184
+ offset: '2px'
185
+ };
186
+ const opacity = {
187
+ disabled: '0.5',
188
+ hover: '0.92'
189
+ };
190
+ const shadow = {
191
+ sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
192
+ md: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)',
193
+ lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)'
194
+ };
195
+ const primitives_blur = {
196
+ sm: '4px',
197
+ md: '8px',
198
+ lg: '16px'
199
+ };
200
+ const zIndex = {
201
+ dropdown: '1000',
202
+ overlay: '1100',
203
+ modal: '1200',
204
+ toast: '1300',
205
+ tooltip: '1400'
122
206
  };
123
207
  function _define_property(obj, key, value) {
124
208
  if (key in obj) Object.defineProperty(obj, key, {
@@ -163,14 +247,49 @@ const defaultTheme = {
163
247
  radiusMd: radius.md,
164
248
  radiusFull: radius.full,
165
249
  borderWidthThin: borderWidth.thin,
250
+ fontFamilySans: fontFamily.sans,
251
+ fontFamilyMono: fontFamily.mono,
252
+ fontSizeXs: fontSize.xs,
166
253
  fontSizeSm: fontSize.sm,
167
254
  fontSizeMd: fontSize.md,
255
+ fontSizeLg: fontSize.lg,
256
+ fontSizeXl: fontSize.xl,
168
257
  fontWeightRegular: fontWeight.regular,
258
+ fontWeightMedium: fontWeight.medium,
169
259
  fontWeightSemibold: fontWeight.semibold,
260
+ fontWeightBold: fontWeight.bold,
261
+ letterSpacingTight: letterSpacing.tight,
262
+ letterSpacingNormal: letterSpacing.normal,
263
+ letterSpacingWide: letterSpacing.wide,
170
264
  lineHeightTight: lineHeight.tight,
171
265
  lineHeightNormal: lineHeight.normal,
266
+ lineHeightLoose: lineHeight.loose,
267
+ motionDurationInstant: motion.durationInstant,
172
268
  motionDurationFast: motion.durationFast,
173
- motionEasingStandard: motion.easingStandard
269
+ motionDurationNormal: motion.durationNormal,
270
+ motionDurationSlow: motion.durationSlow,
271
+ motionEasingStandard: motion.easingStandard,
272
+ motionEasingIn: motion.easingIn,
273
+ motionEasingOut: motion.easingOut,
274
+ motionEasingInOut: motion.easingInOut,
275
+ focusRingWidth: focusRing.width,
276
+ focusRingOffset: focusRing.offset,
277
+ opacityDisabled: opacity.disabled,
278
+ opacityHover: opacity.hover,
279
+ shadowSm: shadow.sm,
280
+ shadowMd: shadow.md,
281
+ shadowLg: shadow.lg,
282
+ elevationRaised: shadow.sm,
283
+ elevationOverlay: shadow.md,
284
+ elevationModal: shadow.lg,
285
+ blurSm: primitives_blur.sm,
286
+ blurMd: primitives_blur.md,
287
+ blurLg: primitives_blur.lg,
288
+ zIndexDropdown: zIndex.dropdown,
289
+ zIndexOverlay: zIndex.overlay,
290
+ zIndexModal: zIndex.modal,
291
+ zIndexToast: zIndex.toast,
292
+ zIndexTooltip: zIndex.tooltip
174
293
  };
175
294
  const createTheme = (overrides = {})=>_object_spread({}, defaultTheme, overrides);
176
295
  const themes = {
@@ -187,6 +306,35 @@ const resolveBaseTheme = (colorScheme, contrast)=>{
187
306
  }
188
307
  return theme;
189
308
  };
309
+ const comfortableSpacing = {
310
+ space1: defaultTheme.space1,
311
+ space2: defaultTheme.space2,
312
+ space3: defaultTheme.space3,
313
+ space4: defaultTheme.space4,
314
+ space5: defaultTheme.space5,
315
+ space6: defaultTheme.space6
316
+ };
317
+ const density_densitySpacing = {
318
+ comfortable: comfortableSpacing
319
+ };
320
+ const resolveDensitySpacing = (density)=>{
321
+ const spacing = density_densitySpacing[density];
322
+ if (!spacing) {
323
+ if ('production' !== process.env.NODE_ENV) console.warn(`[vinyasa] no spacing values for density="${density}" yet; falling back to comfortable.`);
324
+ return comfortableSpacing;
325
+ }
326
+ return spacing;
327
+ };
328
+ const breakpoints = {
329
+ sm: '640px',
330
+ md: '768px',
331
+ lg: '1024px',
332
+ xl: '1280px'
333
+ };
334
+ const grid = {
335
+ columns: 12,
336
+ containerMaxWidth: '1280px'
337
+ };
190
338
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
191
339
  const dynamic_namespaceObject = require("@vanilla-extract/dynamic");
192
340
  const external_react_namespaceObject = require("react");
@@ -215,13 +363,17 @@ function VinyasaProvider_object_spread(target) {
215
363
  }
216
364
  const ThemeContext = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)(defaultTheme);
217
365
  const useVinyasaTheme = ()=>(0, external_react_namespaceObject.useContext)(ThemeContext);
218
- const VinyasaProvider = ({ theme, colorScheme = 'light', contrast = 'normal', children })=>{
366
+ const VinyasaProvider = ({ theme, colorScheme = 'light', contrast = 'normal', density = 'comfortable', children })=>{
219
367
  const base = (0, external_react_namespaceObject.useMemo)(()=>resolveBaseTheme(colorScheme, contrast), [
220
368
  colorScheme,
221
369
  contrast
222
370
  ]);
223
- const resolvedTheme = (0, external_react_namespaceObject.useMemo)(()=>VinyasaProvider_object_spread({}, base, theme), [
371
+ const densitySpacing = (0, external_react_namespaceObject.useMemo)(()=>resolveDensitySpacing(density), [
372
+ density
373
+ ]);
374
+ const resolvedTheme = (0, external_react_namespaceObject.useMemo)(()=>VinyasaProvider_object_spread({}, base, densitySpacing, theme), [
224
375
  base,
376
+ densitySpacing,
225
377
  theme
226
378
  ]);
227
379
  const cssVars = (0, external_react_namespaceObject.useMemo)(()=>(0, dynamic_namespaceObject.assignInlineVars)(themeContract, resolvedTheme), [
@@ -236,21 +388,28 @@ const VinyasaProvider = ({ theme, colorScheme = 'light', contrast = 'normal', ch
236
388
  style: style,
237
389
  "data-vinyasa-color-scheme": colorScheme,
238
390
  "data-vinyasa-contrast": contrast,
391
+ "data-vinyasa-density": density,
239
392
  children: children
240
393
  })
241
394
  });
242
395
  };
243
396
  exports.VinyasaProvider = __webpack_exports__.VinyasaProvider;
397
+ exports.breakpoints = __webpack_exports__.breakpoints;
244
398
  exports.createTheme = __webpack_exports__.createTheme;
245
399
  exports.defaultTheme = __webpack_exports__.defaultTheme;
400
+ exports.grid = __webpack_exports__.grid;
246
401
  exports.resolveBaseTheme = __webpack_exports__.resolveBaseTheme;
402
+ exports.resolveDensitySpacing = __webpack_exports__.resolveDensitySpacing;
247
403
  exports.themeContract = __webpack_exports__.themeContract;
248
404
  exports.useVinyasaTheme = __webpack_exports__.useVinyasaTheme;
249
405
  for(var __rspack_i in __webpack_exports__)if (-1 === [
250
406
  "VinyasaProvider",
407
+ "breakpoints",
251
408
  "createTheme",
252
409
  "defaultTheme",
410
+ "grid",
253
411
  "resolveBaseTheme",
412
+ "resolveDensitySpacing",
254
413
  "themeContract",
255
414
  "useVinyasaTheme"
256
415
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
@@ -1,4 +1,5 @@
1
1
  import { type ReactNode } from 'react';
2
+ import { type Density } from './density';
2
3
  import { type VinyasaTheme } from './theme';
3
4
  import { type ColorScheme, type Contrast } from './themes';
4
5
  export declare const useVinyasaTheme: () => VinyasaTheme;
@@ -6,6 +7,7 @@ export interface VinyasaProviderProps {
6
7
  theme?: Partial<VinyasaTheme>;
7
8
  colorScheme?: ColorScheme;
8
9
  contrast?: Contrast;
10
+ density?: Density;
9
11
  children: ReactNode;
10
12
  }
11
- export declare const VinyasaProvider: ({ theme, colorScheme, contrast, children, }: VinyasaProviderProps) => import("react").JSX.Element;
13
+ export declare const VinyasaProvider: ({ theme, colorScheme, contrast, density, children, }: VinyasaProviderProps) => import("react").JSX.Element;
@@ -18,12 +18,47 @@ export declare const themeContract: {
18
18
  radiusMd: `var(--${string})`;
19
19
  radiusFull: `var(--${string})`;
20
20
  borderWidthThin: `var(--${string})`;
21
+ fontFamilySans: `var(--${string})`;
22
+ fontFamilyMono: `var(--${string})`;
23
+ fontSizeXs: `var(--${string})`;
21
24
  fontSizeSm: `var(--${string})`;
22
25
  fontSizeMd: `var(--${string})`;
26
+ fontSizeLg: `var(--${string})`;
27
+ fontSizeXl: `var(--${string})`;
23
28
  fontWeightRegular: `var(--${string})`;
29
+ fontWeightMedium: `var(--${string})`;
24
30
  fontWeightSemibold: `var(--${string})`;
31
+ fontWeightBold: `var(--${string})`;
32
+ letterSpacingTight: `var(--${string})`;
33
+ letterSpacingNormal: `var(--${string})`;
34
+ letterSpacingWide: `var(--${string})`;
25
35
  lineHeightTight: `var(--${string})`;
26
36
  lineHeightNormal: `var(--${string})`;
37
+ lineHeightLoose: `var(--${string})`;
38
+ motionDurationInstant: `var(--${string})`;
27
39
  motionDurationFast: `var(--${string})`;
40
+ motionDurationNormal: `var(--${string})`;
41
+ motionDurationSlow: `var(--${string})`;
28
42
  motionEasingStandard: `var(--${string})`;
43
+ motionEasingIn: `var(--${string})`;
44
+ motionEasingOut: `var(--${string})`;
45
+ motionEasingInOut: `var(--${string})`;
46
+ focusRingWidth: `var(--${string})`;
47
+ focusRingOffset: `var(--${string})`;
48
+ opacityDisabled: `var(--${string})`;
49
+ opacityHover: `var(--${string})`;
50
+ shadowSm: `var(--${string})`;
51
+ shadowMd: `var(--${string})`;
52
+ shadowLg: `var(--${string})`;
53
+ elevationRaised: `var(--${string})`;
54
+ elevationOverlay: `var(--${string})`;
55
+ elevationModal: `var(--${string})`;
56
+ blurSm: `var(--${string})`;
57
+ blurMd: `var(--${string})`;
58
+ blurLg: `var(--${string})`;
59
+ zIndexDropdown: `var(--${string})`;
60
+ zIndexOverlay: `var(--${string})`;
61
+ zIndexModal: `var(--${string})`;
62
+ zIndexToast: `var(--${string})`;
63
+ zIndexTooltip: `var(--${string})`;
29
64
  };
@@ -0,0 +1,5 @@
1
+ import { type VinyasaTheme } from './theme';
2
+ export type Density = 'compact' | 'comfortable' | 'spacious';
3
+ type DensitySpacing = Pick<VinyasaTheme, 'space1' | 'space2' | 'space3' | 'space4' | 'space5' | 'space6'>;
4
+ export declare const resolveDensitySpacing: (density: Density) => DensitySpacing;
5
+ export {};
@@ -1,4 +1,6 @@
1
1
  export { themeContract } from './contract.css';
2
2
  export { createTheme, defaultTheme, type VinyasaTheme } from './theme';
3
3
  export { resolveBaseTheme, type ColorScheme, type Contrast } from './themes';
4
+ export { resolveDensitySpacing, type Density } from './density';
5
+ export { breakpoints, grid } from './layout';
4
6
  export { VinyasaProvider, useVinyasaTheme, type VinyasaProviderProps } from './VinyasaProvider';
package/dist/esm/index.js CHANGED
@@ -21,14 +21,49 @@ var themeContract = {
21
21
  radiusMd: 'var(--vinyasa-radius-md)',
22
22
  radiusFull: 'var(--vinyasa-radius-full)',
23
23
  borderWidthThin: 'var(--vinyasa-border-width-thin)',
24
+ fontFamilySans: 'var(--vinyasa-font-family-sans)',
25
+ fontFamilyMono: 'var(--vinyasa-font-family-mono)',
26
+ fontSizeXs: 'var(--vinyasa-font-size-xs)',
24
27
  fontSizeSm: 'var(--vinyasa-font-size-sm)',
25
28
  fontSizeMd: 'var(--vinyasa-font-size-md)',
29
+ fontSizeLg: 'var(--vinyasa-font-size-lg)',
30
+ fontSizeXl: 'var(--vinyasa-font-size-xl)',
26
31
  fontWeightRegular: 'var(--vinyasa-font-weight-regular)',
32
+ fontWeightMedium: 'var(--vinyasa-font-weight-medium)',
27
33
  fontWeightSemibold: 'var(--vinyasa-font-weight-semibold)',
34
+ fontWeightBold: 'var(--vinyasa-font-weight-bold)',
35
+ letterSpacingTight: 'var(--vinyasa-letter-spacing-tight)',
36
+ letterSpacingNormal: 'var(--vinyasa-letter-spacing-normal)',
37
+ letterSpacingWide: 'var(--vinyasa-letter-spacing-wide)',
28
38
  lineHeightTight: 'var(--vinyasa-line-height-tight)',
29
39
  lineHeightNormal: 'var(--vinyasa-line-height-normal)',
40
+ lineHeightLoose: 'var(--vinyasa-line-height-loose)',
41
+ motionDurationInstant: 'var(--vinyasa-motion-duration-instant)',
30
42
  motionDurationFast: 'var(--vinyasa-motion-duration-fast)',
31
- motionEasingStandard: 'var(--vinyasa-motion-easing-standard)'
43
+ motionDurationNormal: 'var(--vinyasa-motion-duration-normal)',
44
+ motionDurationSlow: 'var(--vinyasa-motion-duration-slow)',
45
+ motionEasingStandard: 'var(--vinyasa-motion-easing-standard)',
46
+ motionEasingIn: 'var(--vinyasa-motion-easing-in)',
47
+ motionEasingOut: 'var(--vinyasa-motion-easing-out)',
48
+ motionEasingInOut: 'var(--vinyasa-motion-easing-in-out)',
49
+ focusRingWidth: 'var(--vinyasa-focus-ring-width)',
50
+ focusRingOffset: 'var(--vinyasa-focus-ring-offset)',
51
+ opacityDisabled: 'var(--vinyasa-opacity-disabled)',
52
+ opacityHover: 'var(--vinyasa-opacity-hover)',
53
+ shadowSm: 'var(--vinyasa-shadow-sm)',
54
+ shadowMd: 'var(--vinyasa-shadow-md)',
55
+ shadowLg: 'var(--vinyasa-shadow-lg)',
56
+ elevationRaised: 'var(--vinyasa-elevation-raised)',
57
+ elevationOverlay: 'var(--vinyasa-elevation-overlay)',
58
+ elevationModal: 'var(--vinyasa-elevation-modal)',
59
+ blurSm: 'var(--vinyasa-blur-sm)',
60
+ blurMd: 'var(--vinyasa-blur-md)',
61
+ blurLg: 'var(--vinyasa-blur-lg)',
62
+ zIndexDropdown: 'var(--vinyasa-z-index-dropdown)',
63
+ zIndexOverlay: 'var(--vinyasa-z-index-overlay)',
64
+ zIndexModal: 'var(--vinyasa-z-index-modal)',
65
+ zIndexToast: 'var(--vinyasa-z-index-toast)',
66
+ zIndexTooltip: 'var(--vinyasa-z-index-tooltip)'
32
67
  };
33
68
  const gray = {
34
69
  50: '#f9fafb',
@@ -70,21 +105,67 @@ const radius = {
70
105
  const borderWidth = {
71
106
  thin: '1px'
72
107
  };
108
+ const fontFamily = {
109
+ sans: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",
110
+ mono: "ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace"
111
+ };
73
112
  const fontSize = {
113
+ xs: '0.75rem',
74
114
  sm: '0.875rem',
75
- md: '1rem'
115
+ md: '1rem',
116
+ lg: '1.125rem',
117
+ xl: '1.25rem'
76
118
  };
77
119
  const fontWeight = {
78
120
  regular: '400',
79
- semibold: '600'
121
+ medium: '500',
122
+ semibold: '600',
123
+ bold: '700'
124
+ };
125
+ const letterSpacing = {
126
+ tight: '-0.01em',
127
+ normal: '0',
128
+ wide: '0.02em'
80
129
  };
81
130
  const lineHeight = {
82
131
  tight: '1',
83
- normal: '1.5'
132
+ normal: '1.5',
133
+ loose: '1.75'
84
134
  };
85
135
  const motion = {
136
+ durationInstant: '100ms',
86
137
  durationFast: '150ms',
87
- easingStandard: 'ease'
138
+ durationNormal: '250ms',
139
+ durationSlow: '400ms',
140
+ easingStandard: 'ease',
141
+ easingIn: 'ease-in',
142
+ easingOut: 'ease-out',
143
+ easingInOut: 'ease-in-out'
144
+ };
145
+ const focusRing = {
146
+ width: '2px',
147
+ offset: '2px'
148
+ };
149
+ const opacity = {
150
+ disabled: '0.5',
151
+ hover: '0.92'
152
+ };
153
+ const shadow = {
154
+ sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
155
+ md: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)',
156
+ lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)'
157
+ };
158
+ const primitives_blur = {
159
+ sm: '4px',
160
+ md: '8px',
161
+ lg: '16px'
162
+ };
163
+ const zIndex = {
164
+ dropdown: '1000',
165
+ overlay: '1100',
166
+ modal: '1200',
167
+ toast: '1300',
168
+ tooltip: '1400'
88
169
  };
89
170
  const defaultTheme = {
90
171
  primary: indigo["600"],
@@ -106,14 +187,49 @@ const defaultTheme = {
106
187
  radiusMd: radius.md,
107
188
  radiusFull: radius.full,
108
189
  borderWidthThin: borderWidth.thin,
190
+ fontFamilySans: fontFamily.sans,
191
+ fontFamilyMono: fontFamily.mono,
192
+ fontSizeXs: fontSize.xs,
109
193
  fontSizeSm: fontSize.sm,
110
194
  fontSizeMd: fontSize.md,
195
+ fontSizeLg: fontSize.lg,
196
+ fontSizeXl: fontSize.xl,
111
197
  fontWeightRegular: fontWeight.regular,
198
+ fontWeightMedium: fontWeight.medium,
112
199
  fontWeightSemibold: fontWeight.semibold,
200
+ fontWeightBold: fontWeight.bold,
201
+ letterSpacingTight: letterSpacing.tight,
202
+ letterSpacingNormal: letterSpacing.normal,
203
+ letterSpacingWide: letterSpacing.wide,
113
204
  lineHeightTight: lineHeight.tight,
114
205
  lineHeightNormal: lineHeight.normal,
206
+ lineHeightLoose: lineHeight.loose,
207
+ motionDurationInstant: motion.durationInstant,
115
208
  motionDurationFast: motion.durationFast,
116
- motionEasingStandard: motion.easingStandard
209
+ motionDurationNormal: motion.durationNormal,
210
+ motionDurationSlow: motion.durationSlow,
211
+ motionEasingStandard: motion.easingStandard,
212
+ motionEasingIn: motion.easingIn,
213
+ motionEasingOut: motion.easingOut,
214
+ motionEasingInOut: motion.easingInOut,
215
+ focusRingWidth: focusRing.width,
216
+ focusRingOffset: focusRing.offset,
217
+ opacityDisabled: opacity.disabled,
218
+ opacityHover: opacity.hover,
219
+ shadowSm: shadow.sm,
220
+ shadowMd: shadow.md,
221
+ shadowLg: shadow.lg,
222
+ elevationRaised: shadow.sm,
223
+ elevationOverlay: shadow.md,
224
+ elevationModal: shadow.lg,
225
+ blurSm: primitives_blur.sm,
226
+ blurMd: primitives_blur.md,
227
+ blurLg: primitives_blur.lg,
228
+ zIndexDropdown: zIndex.dropdown,
229
+ zIndexOverlay: zIndex.overlay,
230
+ zIndexModal: zIndex.modal,
231
+ zIndexToast: zIndex.toast,
232
+ zIndexTooltip: zIndex.tooltip
117
233
  };
118
234
  const createTheme = (overrides = {})=>({
119
235
  ...defaultTheme,
@@ -132,18 +248,52 @@ const resolveBaseTheme = (colorScheme, contrast)=>{
132
248
  }
133
249
  return theme;
134
250
  };
251
+ const comfortableSpacing = {
252
+ space1: defaultTheme.space1,
253
+ space2: defaultTheme.space2,
254
+ space3: defaultTheme.space3,
255
+ space4: defaultTheme.space4,
256
+ space5: defaultTheme.space5,
257
+ space6: defaultTheme.space6
258
+ };
259
+ const density_densitySpacing = {
260
+ comfortable: comfortableSpacing
261
+ };
262
+ const resolveDensitySpacing = (density)=>{
263
+ const spacing = density_densitySpacing[density];
264
+ if (!spacing) {
265
+ if ('production' !== process.env.NODE_ENV) console.warn(`[vinyasa] no spacing values for density="${density}" yet; falling back to comfortable.`);
266
+ return comfortableSpacing;
267
+ }
268
+ return spacing;
269
+ };
270
+ const breakpoints = {
271
+ sm: '640px',
272
+ md: '768px',
273
+ lg: '1024px',
274
+ xl: '1280px'
275
+ };
276
+ const grid = {
277
+ columns: 12,
278
+ containerMaxWidth: '1280px'
279
+ };
135
280
  const ThemeContext = /*#__PURE__*/ createContext(defaultTheme);
136
281
  const useVinyasaTheme = ()=>useContext(ThemeContext);
137
- const VinyasaProvider = ({ theme, colorScheme = 'light', contrast = 'normal', children })=>{
282
+ const VinyasaProvider = ({ theme, colorScheme = 'light', contrast = 'normal', density = 'comfortable', children })=>{
138
283
  const base = useMemo(()=>resolveBaseTheme(colorScheme, contrast), [
139
284
  colorScheme,
140
285
  contrast
141
286
  ]);
287
+ const densitySpacing = useMemo(()=>resolveDensitySpacing(density), [
288
+ density
289
+ ]);
142
290
  const resolvedTheme = useMemo(()=>({
143
291
  ...base,
292
+ ...densitySpacing,
144
293
  ...theme
145
294
  }), [
146
295
  base,
296
+ densitySpacing,
147
297
  theme
148
298
  ]);
149
299
  const cssVars = useMemo(()=>assignInlineVars(themeContract, resolvedTheme), [
@@ -159,8 +309,9 @@ const VinyasaProvider = ({ theme, colorScheme = 'light', contrast = 'normal', ch
159
309
  style: style,
160
310
  "data-vinyasa-color-scheme": colorScheme,
161
311
  "data-vinyasa-contrast": contrast,
312
+ "data-vinyasa-density": density,
162
313
  children: children
163
314
  })
164
315
  });
165
316
  };
166
- export { VinyasaProvider, createTheme, defaultTheme, resolveBaseTheme, themeContract, useVinyasaTheme };
317
+ export { VinyasaProvider, breakpoints, createTheme, defaultTheme, grid, resolveBaseTheme, resolveDensitySpacing, themeContract, useVinyasaTheme };
@@ -0,0 +1,10 @@
1
+ export declare const breakpoints: {
2
+ readonly sm: "640px";
3
+ readonly md: "768px";
4
+ readonly lg: "1024px";
5
+ readonly xl: "1280px";
6
+ };
7
+ export declare const grid: {
8
+ readonly columns: 12;
9
+ readonly containerMaxWidth: "1280px";
10
+ };
@@ -38,19 +38,65 @@ export declare const radius: {
38
38
  export declare const borderWidth: {
39
39
  readonly thin: "1px";
40
40
  };
41
+ export declare const fontFamily: {
42
+ readonly sans: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif";
43
+ readonly mono: "ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace";
44
+ };
41
45
  export declare const fontSize: {
46
+ readonly xs: "0.75rem";
42
47
  readonly sm: "0.875rem";
43
48
  readonly md: "1rem";
49
+ readonly lg: "1.125rem";
50
+ readonly xl: "1.25rem";
44
51
  };
45
52
  export declare const fontWeight: {
46
53
  readonly regular: "400";
54
+ readonly medium: "500";
47
55
  readonly semibold: "600";
56
+ readonly bold: "700";
57
+ };
58
+ export declare const letterSpacing: {
59
+ readonly tight: "-0.01em";
60
+ readonly normal: "0";
61
+ readonly wide: "0.02em";
48
62
  };
49
63
  export declare const lineHeight: {
50
64
  readonly tight: "1";
51
65
  readonly normal: "1.5";
66
+ readonly loose: "1.75";
52
67
  };
53
68
  export declare const motion: {
69
+ readonly durationInstant: "100ms";
54
70
  readonly durationFast: "150ms";
71
+ readonly durationNormal: "250ms";
72
+ readonly durationSlow: "400ms";
55
73
  readonly easingStandard: "ease";
74
+ readonly easingIn: "ease-in";
75
+ readonly easingOut: "ease-out";
76
+ readonly easingInOut: "ease-in-out";
77
+ };
78
+ export declare const focusRing: {
79
+ readonly width: "2px";
80
+ readonly offset: "2px";
81
+ };
82
+ export declare const opacity: {
83
+ readonly disabled: "0.5";
84
+ readonly hover: "0.92";
85
+ };
86
+ export declare const shadow: {
87
+ readonly sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)";
88
+ readonly md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)";
89
+ readonly lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)";
90
+ };
91
+ export declare const blur: {
92
+ readonly sm: "4px";
93
+ readonly md: "8px";
94
+ readonly lg: "16px";
95
+ };
96
+ export declare const zIndex: {
97
+ readonly dropdown: "1000";
98
+ readonly overlay: "1100";
99
+ readonly modal: "1200";
100
+ readonly toast: "1300";
101
+ readonly tooltip: "1400";
56
102
  };
@@ -18,14 +18,49 @@ export interface VinyasaTheme {
18
18
  radiusMd: string;
19
19
  radiusFull: string;
20
20
  borderWidthThin: string;
21
+ fontFamilySans: string;
22
+ fontFamilyMono: string;
23
+ fontSizeXs: string;
21
24
  fontSizeSm: string;
22
25
  fontSizeMd: string;
26
+ fontSizeLg: string;
27
+ fontSizeXl: string;
23
28
  fontWeightRegular: string;
29
+ fontWeightMedium: string;
24
30
  fontWeightSemibold: string;
31
+ fontWeightBold: string;
32
+ letterSpacingTight: string;
33
+ letterSpacingNormal: string;
34
+ letterSpacingWide: string;
25
35
  lineHeightTight: string;
26
36
  lineHeightNormal: string;
37
+ lineHeightLoose: string;
38
+ motionDurationInstant: string;
27
39
  motionDurationFast: string;
40
+ motionDurationNormal: string;
41
+ motionDurationSlow: string;
28
42
  motionEasingStandard: string;
43
+ motionEasingIn: string;
44
+ motionEasingOut: string;
45
+ motionEasingInOut: string;
46
+ focusRingWidth: string;
47
+ focusRingOffset: string;
48
+ opacityDisabled: string;
49
+ opacityHover: string;
50
+ shadowSm: string;
51
+ shadowMd: string;
52
+ shadowLg: string;
53
+ elevationRaised: string;
54
+ elevationOverlay: string;
55
+ elevationModal: string;
56
+ blurSm: string;
57
+ blurMd: string;
58
+ blurLg: string;
59
+ zIndexDropdown: string;
60
+ zIndexOverlay: string;
61
+ zIndexModal: string;
62
+ zIndexToast: string;
63
+ zIndexTooltip: string;
29
64
  }
30
65
  export declare const defaultTheme: VinyasaTheme;
31
66
  export declare const createTheme: (overrides?: Partial<VinyasaTheme>) => VinyasaTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vinyasa/tokens",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": [