@vinyasa/tokens 1.0.15
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/dist/cjs/index.cjs +254 -0
- package/dist/esm/VinyasaProvider.d.ts +11 -0
- package/dist/esm/contract.css.d.ts +28 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +161 -0
- package/dist/esm/primitives.d.ts +53 -0
- package/dist/esm/theme.d.ts +30 -0
- package/dist/esm/themes.d.ts +4 -0
- package/package.json +59 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
VinyasaProvider: ()=>VinyasaProvider,
|
|
32
|
+
createTheme: ()=>createTheme,
|
|
33
|
+
defaultTheme: ()=>defaultTheme,
|
|
34
|
+
resolveBaseTheme: ()=>resolveBaseTheme,
|
|
35
|
+
themeContract: ()=>themeContract,
|
|
36
|
+
useVinyasaTheme: ()=>useVinyasaTheme
|
|
37
|
+
});
|
|
38
|
+
var themeContract = {
|
|
39
|
+
primary: 'var(--vinyasa-primary)',
|
|
40
|
+
onPrimary: 'var(--vinyasa-on-primary)',
|
|
41
|
+
secondary: 'var(--vinyasa-secondary)',
|
|
42
|
+
onSecondary: 'var(--vinyasa-on-secondary)',
|
|
43
|
+
tertiary: 'var(--vinyasa-tertiary)',
|
|
44
|
+
onTertiary: 'var(--vinyasa-on-tertiary)',
|
|
45
|
+
error: 'var(--vinyasa-error)',
|
|
46
|
+
onError: 'var(--vinyasa-on-error)',
|
|
47
|
+
focus: 'var(--vinyasa-focus)',
|
|
48
|
+
space1: 'var(--vinyasa-space1)',
|
|
49
|
+
space2: 'var(--vinyasa-space2)',
|
|
50
|
+
space3: 'var(--vinyasa-space3)',
|
|
51
|
+
space4: 'var(--vinyasa-space4)',
|
|
52
|
+
space5: 'var(--vinyasa-space5)',
|
|
53
|
+
space6: 'var(--vinyasa-space6)',
|
|
54
|
+
radiusSm: 'var(--vinyasa-radius-sm)',
|
|
55
|
+
radiusMd: 'var(--vinyasa-radius-md)',
|
|
56
|
+
radiusFull: 'var(--vinyasa-radius-full)',
|
|
57
|
+
fontSizeSm: 'var(--vinyasa-font-size-sm)',
|
|
58
|
+
fontSizeMd: 'var(--vinyasa-font-size-md)',
|
|
59
|
+
fontWeightRegular: 'var(--vinyasa-font-weight-regular)',
|
|
60
|
+
fontWeightSemibold: 'var(--vinyasa-font-weight-semibold)',
|
|
61
|
+
lineHeightTight: 'var(--vinyasa-line-height-tight)',
|
|
62
|
+
lineHeightNormal: 'var(--vinyasa-line-height-normal)',
|
|
63
|
+
motionDurationFast: 'var(--vinyasa-motion-duration-fast)',
|
|
64
|
+
motionEasingStandard: 'var(--vinyasa-motion-easing-standard)'
|
|
65
|
+
};
|
|
66
|
+
const gray = {
|
|
67
|
+
50: '#f9fafb',
|
|
68
|
+
100: '#f3f4f6',
|
|
69
|
+
200: '#e5e7eb',
|
|
70
|
+
300: '#d1d5db',
|
|
71
|
+
400: '#9ca3af',
|
|
72
|
+
500: '#6b7280',
|
|
73
|
+
600: '#4b5563',
|
|
74
|
+
700: '#374151',
|
|
75
|
+
800: '#1f2937',
|
|
76
|
+
900: '#111827'
|
|
77
|
+
};
|
|
78
|
+
const blue = {
|
|
79
|
+
100: '#dbeafe',
|
|
80
|
+
500: '#2563eb',
|
|
81
|
+
700: '#1d4ed8'
|
|
82
|
+
};
|
|
83
|
+
const indigo = {
|
|
84
|
+
600: '#4f46e5'
|
|
85
|
+
};
|
|
86
|
+
const red = {
|
|
87
|
+
100: '#fee2e2',
|
|
88
|
+
600: '#dc2626'
|
|
89
|
+
};
|
|
90
|
+
const space = {
|
|
91
|
+
1: '0.25rem',
|
|
92
|
+
2: '0.5rem',
|
|
93
|
+
3: '0.625rem',
|
|
94
|
+
4: '1rem',
|
|
95
|
+
5: '1.25rem',
|
|
96
|
+
6: '1.5rem'
|
|
97
|
+
};
|
|
98
|
+
const radius = {
|
|
99
|
+
sm: '0.25rem',
|
|
100
|
+
md: '0.5rem',
|
|
101
|
+
full: '9999px'
|
|
102
|
+
};
|
|
103
|
+
const fontSize = {
|
|
104
|
+
sm: '0.875rem',
|
|
105
|
+
md: '1rem'
|
|
106
|
+
};
|
|
107
|
+
const fontWeight = {
|
|
108
|
+
regular: '400',
|
|
109
|
+
semibold: '600'
|
|
110
|
+
};
|
|
111
|
+
const lineHeight = {
|
|
112
|
+
tight: '1',
|
|
113
|
+
normal: '1.5'
|
|
114
|
+
};
|
|
115
|
+
const motion = {
|
|
116
|
+
durationFast: '150ms',
|
|
117
|
+
easingStandard: 'ease'
|
|
118
|
+
};
|
|
119
|
+
function _define_property(obj, key, value) {
|
|
120
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
121
|
+
value: value,
|
|
122
|
+
enumerable: true,
|
|
123
|
+
configurable: true,
|
|
124
|
+
writable: true
|
|
125
|
+
});
|
|
126
|
+
else obj[key] = value;
|
|
127
|
+
return obj;
|
|
128
|
+
}
|
|
129
|
+
function _object_spread(target) {
|
|
130
|
+
for(var i = 1; i < arguments.length; i++){
|
|
131
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
132
|
+
var ownKeys = Object.keys(source);
|
|
133
|
+
if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
134
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
135
|
+
}));
|
|
136
|
+
ownKeys.forEach(function(key) {
|
|
137
|
+
_define_property(target, key, source[key]);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return target;
|
|
141
|
+
}
|
|
142
|
+
const defaultTheme = {
|
|
143
|
+
primary: indigo["600"],
|
|
144
|
+
onPrimary: '#ffffff',
|
|
145
|
+
secondary: gray["100"],
|
|
146
|
+
onSecondary: gray["900"],
|
|
147
|
+
tertiary: blue["100"],
|
|
148
|
+
onTertiary: blue["700"],
|
|
149
|
+
error: red["600"],
|
|
150
|
+
onError: '#ffffff',
|
|
151
|
+
focus: blue["500"],
|
|
152
|
+
space1: space["1"],
|
|
153
|
+
space2: space["2"],
|
|
154
|
+
space3: space["3"],
|
|
155
|
+
space4: space["4"],
|
|
156
|
+
space5: space["5"],
|
|
157
|
+
space6: space["6"],
|
|
158
|
+
radiusSm: radius.sm,
|
|
159
|
+
radiusMd: radius.md,
|
|
160
|
+
radiusFull: radius.full,
|
|
161
|
+
fontSizeSm: fontSize.sm,
|
|
162
|
+
fontSizeMd: fontSize.md,
|
|
163
|
+
fontWeightRegular: fontWeight.regular,
|
|
164
|
+
fontWeightSemibold: fontWeight.semibold,
|
|
165
|
+
lineHeightTight: lineHeight.tight,
|
|
166
|
+
lineHeightNormal: lineHeight.normal,
|
|
167
|
+
motionDurationFast: motion.durationFast,
|
|
168
|
+
motionEasingStandard: motion.easingStandard
|
|
169
|
+
};
|
|
170
|
+
const createTheme = (overrides = {})=>_object_spread({}, defaultTheme, overrides);
|
|
171
|
+
const themes = {
|
|
172
|
+
light: {
|
|
173
|
+
normal: defaultTheme
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
const resolveBaseTheme = (colorScheme, contrast)=>{
|
|
177
|
+
var _themes_colorScheme;
|
|
178
|
+
const theme = null == (_themes_colorScheme = themes[colorScheme]) ? void 0 : _themes_colorScheme[contrast];
|
|
179
|
+
if (!theme) {
|
|
180
|
+
if ('production' !== process.env.NODE_ENV) console.warn(`[vinyasa] no theme values for colorScheme="${colorScheme}" contrast="${contrast}" yet; falling back to light/normal.`);
|
|
181
|
+
return defaultTheme;
|
|
182
|
+
}
|
|
183
|
+
return theme;
|
|
184
|
+
};
|
|
185
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
186
|
+
const dynamic_namespaceObject = require("@vanilla-extract/dynamic");
|
|
187
|
+
const external_react_namespaceObject = require("react");
|
|
188
|
+
function VinyasaProvider_define_property(obj, key, value) {
|
|
189
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
190
|
+
value: value,
|
|
191
|
+
enumerable: true,
|
|
192
|
+
configurable: true,
|
|
193
|
+
writable: true
|
|
194
|
+
});
|
|
195
|
+
else obj[key] = value;
|
|
196
|
+
return obj;
|
|
197
|
+
}
|
|
198
|
+
function VinyasaProvider_object_spread(target) {
|
|
199
|
+
for(var i = 1; i < arguments.length; i++){
|
|
200
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
201
|
+
var ownKeys = Object.keys(source);
|
|
202
|
+
if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
203
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
204
|
+
}));
|
|
205
|
+
ownKeys.forEach(function(key) {
|
|
206
|
+
VinyasaProvider_define_property(target, key, source[key]);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
return target;
|
|
210
|
+
}
|
|
211
|
+
const ThemeContext = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)(defaultTheme);
|
|
212
|
+
const useVinyasaTheme = ()=>(0, external_react_namespaceObject.useContext)(ThemeContext);
|
|
213
|
+
const VinyasaProvider = ({ theme, colorScheme = 'light', contrast = 'normal', children })=>{
|
|
214
|
+
const base = (0, external_react_namespaceObject.useMemo)(()=>resolveBaseTheme(colorScheme, contrast), [
|
|
215
|
+
colorScheme,
|
|
216
|
+
contrast
|
|
217
|
+
]);
|
|
218
|
+
const resolvedTheme = (0, external_react_namespaceObject.useMemo)(()=>VinyasaProvider_object_spread({}, base, theme), [
|
|
219
|
+
base,
|
|
220
|
+
theme
|
|
221
|
+
]);
|
|
222
|
+
const cssVars = (0, external_react_namespaceObject.useMemo)(()=>(0, dynamic_namespaceObject.assignInlineVars)(themeContract, resolvedTheme), [
|
|
223
|
+
resolvedTheme
|
|
224
|
+
]);
|
|
225
|
+
const style = VinyasaProvider_object_spread({
|
|
226
|
+
display: 'contents'
|
|
227
|
+
}, cssVars);
|
|
228
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ThemeContext.Provider, {
|
|
229
|
+
value: resolvedTheme,
|
|
230
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
231
|
+
style: style,
|
|
232
|
+
"data-vinyasa-color-scheme": colorScheme,
|
|
233
|
+
"data-vinyasa-contrast": contrast,
|
|
234
|
+
children: children
|
|
235
|
+
})
|
|
236
|
+
});
|
|
237
|
+
};
|
|
238
|
+
exports.VinyasaProvider = __webpack_exports__.VinyasaProvider;
|
|
239
|
+
exports.createTheme = __webpack_exports__.createTheme;
|
|
240
|
+
exports.defaultTheme = __webpack_exports__.defaultTheme;
|
|
241
|
+
exports.resolveBaseTheme = __webpack_exports__.resolveBaseTheme;
|
|
242
|
+
exports.themeContract = __webpack_exports__.themeContract;
|
|
243
|
+
exports.useVinyasaTheme = __webpack_exports__.useVinyasaTheme;
|
|
244
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
245
|
+
"VinyasaProvider",
|
|
246
|
+
"createTheme",
|
|
247
|
+
"defaultTheme",
|
|
248
|
+
"resolveBaseTheme",
|
|
249
|
+
"themeContract",
|
|
250
|
+
"useVinyasaTheme"
|
|
251
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
252
|
+
Object.defineProperty(exports, '__esModule', {
|
|
253
|
+
value: true
|
|
254
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type VinyasaTheme } from './theme';
|
|
3
|
+
import { type ColorScheme, type Contrast } from './themes';
|
|
4
|
+
export declare const useVinyasaTheme: () => VinyasaTheme;
|
|
5
|
+
export interface VinyasaProviderProps {
|
|
6
|
+
theme?: Partial<VinyasaTheme>;
|
|
7
|
+
colorScheme?: ColorScheme;
|
|
8
|
+
contrast?: Contrast;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const VinyasaProvider: ({ theme, colorScheme, contrast, children, }: VinyasaProviderProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const themeContract: {
|
|
2
|
+
primary: `var(--${string})`;
|
|
3
|
+
onPrimary: `var(--${string})`;
|
|
4
|
+
secondary: `var(--${string})`;
|
|
5
|
+
onSecondary: `var(--${string})`;
|
|
6
|
+
tertiary: `var(--${string})`;
|
|
7
|
+
onTertiary: `var(--${string})`;
|
|
8
|
+
error: `var(--${string})`;
|
|
9
|
+
onError: `var(--${string})`;
|
|
10
|
+
focus: `var(--${string})`;
|
|
11
|
+
space1: `var(--${string})`;
|
|
12
|
+
space2: `var(--${string})`;
|
|
13
|
+
space3: `var(--${string})`;
|
|
14
|
+
space4: `var(--${string})`;
|
|
15
|
+
space5: `var(--${string})`;
|
|
16
|
+
space6: `var(--${string})`;
|
|
17
|
+
radiusSm: `var(--${string})`;
|
|
18
|
+
radiusMd: `var(--${string})`;
|
|
19
|
+
radiusFull: `var(--${string})`;
|
|
20
|
+
fontSizeSm: `var(--${string})`;
|
|
21
|
+
fontSizeMd: `var(--${string})`;
|
|
22
|
+
fontWeightRegular: `var(--${string})`;
|
|
23
|
+
fontWeightSemibold: `var(--${string})`;
|
|
24
|
+
lineHeightTight: `var(--${string})`;
|
|
25
|
+
lineHeightNormal: `var(--${string})`;
|
|
26
|
+
motionDurationFast: `var(--${string})`;
|
|
27
|
+
motionEasingStandard: `var(--${string})`;
|
|
28
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { themeContract } from './contract.css';
|
|
2
|
+
export { createTheme, defaultTheme, type VinyasaTheme } from './theme';
|
|
3
|
+
export { resolveBaseTheme, type ColorScheme, type Contrast } from './themes';
|
|
4
|
+
export { VinyasaProvider, useVinyasaTheme, type VinyasaProviderProps } from './VinyasaProvider';
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
3
|
+
import { createContext, useContext, useMemo } from "react";
|
|
4
|
+
var themeContract = {
|
|
5
|
+
primary: 'var(--vinyasa-primary)',
|
|
6
|
+
onPrimary: 'var(--vinyasa-on-primary)',
|
|
7
|
+
secondary: 'var(--vinyasa-secondary)',
|
|
8
|
+
onSecondary: 'var(--vinyasa-on-secondary)',
|
|
9
|
+
tertiary: 'var(--vinyasa-tertiary)',
|
|
10
|
+
onTertiary: 'var(--vinyasa-on-tertiary)',
|
|
11
|
+
error: 'var(--vinyasa-error)',
|
|
12
|
+
onError: 'var(--vinyasa-on-error)',
|
|
13
|
+
focus: 'var(--vinyasa-focus)',
|
|
14
|
+
space1: 'var(--vinyasa-space1)',
|
|
15
|
+
space2: 'var(--vinyasa-space2)',
|
|
16
|
+
space3: 'var(--vinyasa-space3)',
|
|
17
|
+
space4: 'var(--vinyasa-space4)',
|
|
18
|
+
space5: 'var(--vinyasa-space5)',
|
|
19
|
+
space6: 'var(--vinyasa-space6)',
|
|
20
|
+
radiusSm: 'var(--vinyasa-radius-sm)',
|
|
21
|
+
radiusMd: 'var(--vinyasa-radius-md)',
|
|
22
|
+
radiusFull: 'var(--vinyasa-radius-full)',
|
|
23
|
+
fontSizeSm: 'var(--vinyasa-font-size-sm)',
|
|
24
|
+
fontSizeMd: 'var(--vinyasa-font-size-md)',
|
|
25
|
+
fontWeightRegular: 'var(--vinyasa-font-weight-regular)',
|
|
26
|
+
fontWeightSemibold: 'var(--vinyasa-font-weight-semibold)',
|
|
27
|
+
lineHeightTight: 'var(--vinyasa-line-height-tight)',
|
|
28
|
+
lineHeightNormal: 'var(--vinyasa-line-height-normal)',
|
|
29
|
+
motionDurationFast: 'var(--vinyasa-motion-duration-fast)',
|
|
30
|
+
motionEasingStandard: 'var(--vinyasa-motion-easing-standard)'
|
|
31
|
+
};
|
|
32
|
+
const gray = {
|
|
33
|
+
50: '#f9fafb',
|
|
34
|
+
100: '#f3f4f6',
|
|
35
|
+
200: '#e5e7eb',
|
|
36
|
+
300: '#d1d5db',
|
|
37
|
+
400: '#9ca3af',
|
|
38
|
+
500: '#6b7280',
|
|
39
|
+
600: '#4b5563',
|
|
40
|
+
700: '#374151',
|
|
41
|
+
800: '#1f2937',
|
|
42
|
+
900: '#111827'
|
|
43
|
+
};
|
|
44
|
+
const blue = {
|
|
45
|
+
100: '#dbeafe',
|
|
46
|
+
500: '#2563eb',
|
|
47
|
+
700: '#1d4ed8'
|
|
48
|
+
};
|
|
49
|
+
const indigo = {
|
|
50
|
+
600: '#4f46e5'
|
|
51
|
+
};
|
|
52
|
+
const red = {
|
|
53
|
+
100: '#fee2e2',
|
|
54
|
+
600: '#dc2626'
|
|
55
|
+
};
|
|
56
|
+
const space = {
|
|
57
|
+
1: '0.25rem',
|
|
58
|
+
2: '0.5rem',
|
|
59
|
+
3: '0.625rem',
|
|
60
|
+
4: '1rem',
|
|
61
|
+
5: '1.25rem',
|
|
62
|
+
6: '1.5rem'
|
|
63
|
+
};
|
|
64
|
+
const radius = {
|
|
65
|
+
sm: '0.25rem',
|
|
66
|
+
md: '0.5rem',
|
|
67
|
+
full: '9999px'
|
|
68
|
+
};
|
|
69
|
+
const fontSize = {
|
|
70
|
+
sm: '0.875rem',
|
|
71
|
+
md: '1rem'
|
|
72
|
+
};
|
|
73
|
+
const fontWeight = {
|
|
74
|
+
regular: '400',
|
|
75
|
+
semibold: '600'
|
|
76
|
+
};
|
|
77
|
+
const lineHeight = {
|
|
78
|
+
tight: '1',
|
|
79
|
+
normal: '1.5'
|
|
80
|
+
};
|
|
81
|
+
const motion = {
|
|
82
|
+
durationFast: '150ms',
|
|
83
|
+
easingStandard: 'ease'
|
|
84
|
+
};
|
|
85
|
+
const defaultTheme = {
|
|
86
|
+
primary: indigo["600"],
|
|
87
|
+
onPrimary: '#ffffff',
|
|
88
|
+
secondary: gray["100"],
|
|
89
|
+
onSecondary: gray["900"],
|
|
90
|
+
tertiary: blue["100"],
|
|
91
|
+
onTertiary: blue["700"],
|
|
92
|
+
error: red["600"],
|
|
93
|
+
onError: '#ffffff',
|
|
94
|
+
focus: blue["500"],
|
|
95
|
+
space1: space["1"],
|
|
96
|
+
space2: space["2"],
|
|
97
|
+
space3: space["3"],
|
|
98
|
+
space4: space["4"],
|
|
99
|
+
space5: space["5"],
|
|
100
|
+
space6: space["6"],
|
|
101
|
+
radiusSm: radius.sm,
|
|
102
|
+
radiusMd: radius.md,
|
|
103
|
+
radiusFull: radius.full,
|
|
104
|
+
fontSizeSm: fontSize.sm,
|
|
105
|
+
fontSizeMd: fontSize.md,
|
|
106
|
+
fontWeightRegular: fontWeight.regular,
|
|
107
|
+
fontWeightSemibold: fontWeight.semibold,
|
|
108
|
+
lineHeightTight: lineHeight.tight,
|
|
109
|
+
lineHeightNormal: lineHeight.normal,
|
|
110
|
+
motionDurationFast: motion.durationFast,
|
|
111
|
+
motionEasingStandard: motion.easingStandard
|
|
112
|
+
};
|
|
113
|
+
const createTheme = (overrides = {})=>({
|
|
114
|
+
...defaultTheme,
|
|
115
|
+
...overrides
|
|
116
|
+
});
|
|
117
|
+
const themes = {
|
|
118
|
+
light: {
|
|
119
|
+
normal: defaultTheme
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const resolveBaseTheme = (colorScheme, contrast)=>{
|
|
123
|
+
const theme = themes[colorScheme]?.[contrast];
|
|
124
|
+
if (!theme) {
|
|
125
|
+
if ('production' !== process.env.NODE_ENV) console.warn(`[vinyasa] no theme values for colorScheme="${colorScheme}" contrast="${contrast}" yet; falling back to light/normal.`);
|
|
126
|
+
return defaultTheme;
|
|
127
|
+
}
|
|
128
|
+
return theme;
|
|
129
|
+
};
|
|
130
|
+
const ThemeContext = /*#__PURE__*/ createContext(defaultTheme);
|
|
131
|
+
const useVinyasaTheme = ()=>useContext(ThemeContext);
|
|
132
|
+
const VinyasaProvider = ({ theme, colorScheme = 'light', contrast = 'normal', children })=>{
|
|
133
|
+
const base = useMemo(()=>resolveBaseTheme(colorScheme, contrast), [
|
|
134
|
+
colorScheme,
|
|
135
|
+
contrast
|
|
136
|
+
]);
|
|
137
|
+
const resolvedTheme = useMemo(()=>({
|
|
138
|
+
...base,
|
|
139
|
+
...theme
|
|
140
|
+
}), [
|
|
141
|
+
base,
|
|
142
|
+
theme
|
|
143
|
+
]);
|
|
144
|
+
const cssVars = useMemo(()=>assignInlineVars(themeContract, resolvedTheme), [
|
|
145
|
+
resolvedTheme
|
|
146
|
+
]);
|
|
147
|
+
const style = {
|
|
148
|
+
display: 'contents',
|
|
149
|
+
...cssVars
|
|
150
|
+
};
|
|
151
|
+
return /*#__PURE__*/ jsx(ThemeContext.Provider, {
|
|
152
|
+
value: resolvedTheme,
|
|
153
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
154
|
+
style: style,
|
|
155
|
+
"data-vinyasa-color-scheme": colorScheme,
|
|
156
|
+
"data-vinyasa-contrast": contrast,
|
|
157
|
+
children: children
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
export { VinyasaProvider, createTheme, defaultTheme, resolveBaseTheme, themeContract, useVinyasaTheme };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const gray: {
|
|
2
|
+
readonly 50: "#f9fafb";
|
|
3
|
+
readonly 100: "#f3f4f6";
|
|
4
|
+
readonly 200: "#e5e7eb";
|
|
5
|
+
readonly 300: "#d1d5db";
|
|
6
|
+
readonly 400: "#9ca3af";
|
|
7
|
+
readonly 500: "#6b7280";
|
|
8
|
+
readonly 600: "#4b5563";
|
|
9
|
+
readonly 700: "#374151";
|
|
10
|
+
readonly 800: "#1f2937";
|
|
11
|
+
readonly 900: "#111827";
|
|
12
|
+
};
|
|
13
|
+
export declare const blue: {
|
|
14
|
+
readonly 100: "#dbeafe";
|
|
15
|
+
readonly 500: "#2563eb";
|
|
16
|
+
readonly 700: "#1d4ed8";
|
|
17
|
+
};
|
|
18
|
+
export declare const indigo: {
|
|
19
|
+
readonly 600: "#4f46e5";
|
|
20
|
+
};
|
|
21
|
+
export declare const red: {
|
|
22
|
+
readonly 100: "#fee2e2";
|
|
23
|
+
readonly 600: "#dc2626";
|
|
24
|
+
};
|
|
25
|
+
export declare const space: {
|
|
26
|
+
readonly 1: "0.25rem";
|
|
27
|
+
readonly 2: "0.5rem";
|
|
28
|
+
readonly 3: "0.625rem";
|
|
29
|
+
readonly 4: "1rem";
|
|
30
|
+
readonly 5: "1.25rem";
|
|
31
|
+
readonly 6: "1.5rem";
|
|
32
|
+
};
|
|
33
|
+
export declare const radius: {
|
|
34
|
+
readonly sm: "0.25rem";
|
|
35
|
+
readonly md: "0.5rem";
|
|
36
|
+
readonly full: "9999px";
|
|
37
|
+
};
|
|
38
|
+
export declare const fontSize: {
|
|
39
|
+
readonly sm: "0.875rem";
|
|
40
|
+
readonly md: "1rem";
|
|
41
|
+
};
|
|
42
|
+
export declare const fontWeight: {
|
|
43
|
+
readonly regular: "400";
|
|
44
|
+
readonly semibold: "600";
|
|
45
|
+
};
|
|
46
|
+
export declare const lineHeight: {
|
|
47
|
+
readonly tight: "1";
|
|
48
|
+
readonly normal: "1.5";
|
|
49
|
+
};
|
|
50
|
+
export declare const motion: {
|
|
51
|
+
readonly durationFast: "150ms";
|
|
52
|
+
readonly easingStandard: "ease";
|
|
53
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface VinyasaTheme {
|
|
2
|
+
primary: string;
|
|
3
|
+
onPrimary: string;
|
|
4
|
+
secondary: string;
|
|
5
|
+
onSecondary: string;
|
|
6
|
+
tertiary: string;
|
|
7
|
+
onTertiary: string;
|
|
8
|
+
error: string;
|
|
9
|
+
onError: string;
|
|
10
|
+
focus: string;
|
|
11
|
+
space1: string;
|
|
12
|
+
space2: string;
|
|
13
|
+
space3: string;
|
|
14
|
+
space4: string;
|
|
15
|
+
space5: string;
|
|
16
|
+
space6: string;
|
|
17
|
+
radiusSm: string;
|
|
18
|
+
radiusMd: string;
|
|
19
|
+
radiusFull: string;
|
|
20
|
+
fontSizeSm: string;
|
|
21
|
+
fontSizeMd: string;
|
|
22
|
+
fontWeightRegular: string;
|
|
23
|
+
fontWeightSemibold: string;
|
|
24
|
+
lineHeightTight: string;
|
|
25
|
+
lineHeightNormal: string;
|
|
26
|
+
motionDurationFast: string;
|
|
27
|
+
motionEasingStandard: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const defaultTheme: VinyasaTheme;
|
|
30
|
+
export declare const createTheme: (overrides?: Partial<VinyasaTheme>) => VinyasaTheme;
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vinyasa/tokens",
|
|
3
|
+
"version": "1.0.15",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.css"
|
|
8
|
+
],
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"!dist/**/*.map",
|
|
12
|
+
"!dist/**/__test__/**",
|
|
13
|
+
"!dist/**/*.test.d.ts"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/cjs/index.cjs",
|
|
19
|
+
"module": "./dist/esm/index.js",
|
|
20
|
+
"types": "./dist/esm/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/esm/index.d.ts",
|
|
24
|
+
"import": "./dist/esm/index.js",
|
|
25
|
+
"require": "./dist/cjs/index.cjs",
|
|
26
|
+
"default": "./dist/esm/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./package.json": "./package.json"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
32
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@vanilla-extract/css": "^1.21.0",
|
|
36
|
+
"@vanilla-extract/dynamic": "^2.1.5"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@rsbuild/plugin-react": "^2.1.0",
|
|
40
|
+
"@rslib/core": "^0.23.1",
|
|
41
|
+
"@types/node": "^26.0.1",
|
|
42
|
+
"@types/react": "^19.0.0",
|
|
43
|
+
"@vanilla-extract/vite-plugin": "^5.2.3",
|
|
44
|
+
"@vanilla-extract/webpack-plugin": "^2.3.27",
|
|
45
|
+
"typescript": "^5.7.3"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "rslib build && node ../../scripts/postbuild-package.mjs",
|
|
49
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
50
|
+
"lint": "eslint --config ../../configs/eslint.config.mjs src/**/*.{ts,tsx} --ignore-pattern src/**/__test__/**",
|
|
51
|
+
"lint:fix": "eslint --config ../../configs/eslint.config.mjs src/**/*.{ts,tsx} --ignore-pattern src/**/__test__/** --fix",
|
|
52
|
+
"format": "prettier . --config ../../configs/prettier.config.json --ignore-path ../../configs/.prettierignore --write",
|
|
53
|
+
"format:check": "prettier . --config ../../configs/prettier.config.json --ignore-path ../../configs/.prettierignore --check",
|
|
54
|
+
"test": "vitest run --config vitest.config.ts",
|
|
55
|
+
"test:watch": "vitest --config vitest.config.ts",
|
|
56
|
+
"test:coverage": "vitest run --config vitest.config.ts --coverage",
|
|
57
|
+
"pack:check": "npm pack --dry-run"
|
|
58
|
+
}
|
|
59
|
+
}
|