@billabex/ui-tokens 0.0.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.
@@ -0,0 +1,7 @@
1
+ export type { ColorToken, DimensionToken, TypographyToken, ShadowToken, RadiusToken, RgbComponents, HslComponents, TokenScale, TokenGroup, } from "./types.js";
2
+ export { color, dimension, shadow } from "./utils.js";
3
+ export { colors, spacing, padding, radii, shadows, typography, } from "./tokens/primitive.js";
4
+ export { bg, text, action, status, border } from "./tokens/semantic.js";
5
+ export * as primitive from "./tokens/primitive.js";
6
+ export * as semantic from "./tokens/semantic.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,UAAU,EACV,UAAU,GACX,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGtD,OAAO,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,KAAK,EACL,OAAO,EACP,UAAU,GACX,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGxE,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,275 @@
1
+ function m(r) {
2
+ const o = r.replace("#", "");
3
+ return {
4
+ r: parseInt(o.slice(0, 2), 16),
5
+ g: parseInt(o.slice(2, 4), 16),
6
+ b: parseInt(o.slice(4, 6), 16)
7
+ };
8
+ }
9
+ function S(r, o, s) {
10
+ const l = r / 255, a = o / 255, c = s / 255, i = Math.max(l, a, c), u = Math.min(l, a, c), b = (i + u) / 2;
11
+ if (i === u)
12
+ return { h: 0, s: 0, l: Math.round(b * 100) };
13
+ const f = i - u, p = b > 0.5 ? f / (2 - i - u) : f / (i + u);
14
+ let g = 0;
15
+ return i === l ? g = ((a - c) / f + (a < c ? 6 : 0)) / 6 : i === a ? g = ((c - l) / f + 2) / 6 : g = ((l - a) / f + 4) / 6, {
16
+ h: Math.round(g * 360),
17
+ s: Math.round(p * 100),
18
+ l: Math.round(b * 100)
19
+ };
20
+ }
21
+ function $(r) {
22
+ const o = r.replace("#", "");
23
+ return o.length === 8 ? parseInt(o.slice(6, 8), 16) / 255 : 1;
24
+ }
25
+ function n(r) {
26
+ const { r: o, g: s, b: l } = m(r), a = S(o, s, l);
27
+ return Object.freeze({
28
+ hex: r,
29
+ rgb: Object.freeze({ r: o, g: s, b: l }),
30
+ hsl: Object.freeze(a),
31
+ rgba(c) {
32
+ return `rgba(${o}, ${s}, ${l}, ${c})`;
33
+ },
34
+ hsla(c) {
35
+ return `hsla(${a.h}, ${a.s}%, ${a.l}%, ${c})`;
36
+ },
37
+ toString() {
38
+ return r;
39
+ }
40
+ });
41
+ }
42
+ function e(r) {
43
+ return Object.freeze({
44
+ value: r,
45
+ px: `${r}px`,
46
+ rem: `${r / 16}rem`,
47
+ toString() {
48
+ return `${r}px`;
49
+ }
50
+ });
51
+ }
52
+ function h(r, o, s, l, a) {
53
+ const c = $(a), i = `#${a.replace("#", "").slice(0, 6)}`, u = n(i), { r: b, g: f, b: p } = u.rgb, g = `${r}px ${o}px ${s}px ${l}px rgba(${b}, ${f}, ${p}, ${Number(c.toFixed(2))})`;
54
+ return Object.freeze({
55
+ offsetX: r,
56
+ offsetY: o,
57
+ blur: s,
58
+ spread: l,
59
+ color: u,
60
+ css: g,
61
+ toString() {
62
+ return g;
63
+ }
64
+ });
65
+ }
66
+ const t = {
67
+ /** Pure solids */
68
+ solid: {
69
+ white: n("#ffffff"),
70
+ black: n("#000000")
71
+ },
72
+ /** Warm neutral palette — the core Billabex tone */
73
+ neutral: {
74
+ 50: n("#fdfcfb"),
75
+ 100: n("#fcfaf8"),
76
+ 200: n("#f5f0eb"),
77
+ 300: n("#e3dbd2"),
78
+ 400: n("#9c8e82"),
79
+ 500: n("#534840"),
80
+ 600: n("#3d3530"),
81
+ 700: n("#1c1917")
82
+ },
83
+ /** Gold accent palette */
84
+ gold: {
85
+ 100: n("#fef7e6"),
86
+ 300: n("#f0d68a"),
87
+ 500: n("#d4a853")
88
+ },
89
+ /** Terracotta / link color */
90
+ terracotta: {
91
+ 400: n("#b5634b"),
92
+ 500: n("#9c5340")
93
+ },
94
+ /** Status colors */
95
+ green: {
96
+ 50: n("#e3f5eb"),
97
+ 600: n("#067647")
98
+ },
99
+ orange: {
100
+ 50: n("#fff1c6"),
101
+ 500: n("#f99307")
102
+ },
103
+ red: {
104
+ 50: n("#fde9e7"),
105
+ 600: n("#d92d20")
106
+ },
107
+ blue: {
108
+ 50: n("#e8ecf2"),
109
+ 700: n("#1e4a8a")
110
+ }
111
+ }, x = {
112
+ /** 4px */
113
+ xs: e(4),
114
+ /** 6px */
115
+ sm: e(6),
116
+ /** 8px */
117
+ md: e(8),
118
+ /** 12px */
119
+ lg: e(12),
120
+ /** 16px */
121
+ xl: e(16),
122
+ /** 24px */
123
+ "2xl": e(24),
124
+ /** 32px */
125
+ "3xl": e(32),
126
+ /** 48px */
127
+ "4xl": e(48)
128
+ }, y = {
129
+ card: e(16),
130
+ page: e(24)
131
+ }, z = {
132
+ none: e(0),
133
+ xs: e(4),
134
+ sm: e(8),
135
+ md: e(12),
136
+ lg: e(16),
137
+ full: e(9999)
138
+ }, H = {
139
+ sm: h(0, 2, 8, 0, "#1C1C1A14"),
140
+ md: h(0, 6, 16, -2, "#1C1C1A1A"),
141
+ lg: h(0, 12, 28, -6, "#1C1C1A1F")
142
+ }, d = "Nunito, sans-serif", j = {
143
+ display: {
144
+ fontFamily: d,
145
+ fontWeight: 600,
146
+ fontSize: e(32),
147
+ lineHeight: e(40),
148
+ letterSpacing: e(0)
149
+ },
150
+ headlineLg: {
151
+ fontFamily: d,
152
+ fontWeight: 600,
153
+ fontSize: e(20),
154
+ lineHeight: e(28),
155
+ letterSpacing: e(0)
156
+ },
157
+ headlineSm: {
158
+ fontFamily: d,
159
+ fontWeight: 600,
160
+ fontSize: e(16),
161
+ lineHeight: e(24),
162
+ letterSpacing: e(0)
163
+ },
164
+ body: {
165
+ fontFamily: d,
166
+ fontWeight: 400,
167
+ fontSize: e(14),
168
+ lineHeight: e(20),
169
+ letterSpacing: e(0)
170
+ },
171
+ bodySm: {
172
+ fontFamily: d,
173
+ fontWeight: 400,
174
+ fontSize: e(13),
175
+ lineHeight: e(18),
176
+ letterSpacing: e(0)
177
+ },
178
+ caption: {
179
+ fontFamily: d,
180
+ fontWeight: 500,
181
+ fontSize: e(12),
182
+ lineHeight: e(16),
183
+ letterSpacing: e(0)
184
+ }
185
+ }, C = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
186
+ __proto__: null,
187
+ colors: t,
188
+ padding: y,
189
+ radii: z,
190
+ shadows: H,
191
+ spacing: x,
192
+ typography: j
193
+ }, Symbol.toStringTag, { value: "Module" })), O = {
194
+ /** Default page / card background */
195
+ default: t.solid.white,
196
+ /** Subtle background for secondary surfaces */
197
+ subtle: t.neutral[100],
198
+ /** Muted background for tertiary surfaces, hover states */
199
+ muted: t.neutral[200],
200
+ /** Inverse background (dark) */
201
+ inverse: t.neutral[700],
202
+ /** Brand-tinted background */
203
+ brand: t.blue[50],
204
+ /** Accent background (warm) */
205
+ accent: t.neutral[200]
206
+ }, M = {
207
+ /** Primary text — headings, body */
208
+ primary: t.neutral[700],
209
+ /** Secondary text — descriptions, labels */
210
+ secondary: t.neutral[500],
211
+ /** Tertiary text — placeholders, disabled */
212
+ tertiary: t.neutral[400],
213
+ /** Text on inverse/dark backgrounds */
214
+ inverse: t.solid.white,
215
+ /** Link text */
216
+ link: t.terracotta[400],
217
+ /** Link hover text */
218
+ linkHover: t.terracotta[500]
219
+ }, _ = {
220
+ /** Primary action background */
221
+ primary: t.neutral[700],
222
+ /** Primary action hover */
223
+ primaryHover: t.neutral[600],
224
+ /** Primary action pressed */
225
+ primaryPressed: t.neutral[500],
226
+ /** Secondary action background */
227
+ secondary: t.neutral[200],
228
+ /** Secondary action hover */
229
+ secondaryHover: t.neutral[300],
230
+ /** Destructive action */
231
+ destructive: t.red[600]
232
+ }, w = {
233
+ success: t.green[600],
234
+ successSubtle: t.green[50],
235
+ warning: t.orange[500],
236
+ warningSubtle: t.orange[50],
237
+ error: t.red[600],
238
+ errorSubtle: t.red[50],
239
+ info: t.blue[700],
240
+ infoSubtle: t.blue[50]
241
+ }, v = {
242
+ /** Default border */
243
+ default: t.neutral[300],
244
+ /** Subtle border */
245
+ subtle: t.neutral[200],
246
+ /** Focused / active border */
247
+ focus: t.neutral[700],
248
+ /** Error border */
249
+ error: t.red[600]
250
+ }, W = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
251
+ __proto__: null,
252
+ action: _,
253
+ bg: O,
254
+ border: v,
255
+ status: w,
256
+ text: M
257
+ }, Symbol.toStringTag, { value: "Module" }));
258
+ export {
259
+ _ as action,
260
+ O as bg,
261
+ v as border,
262
+ n as color,
263
+ t as colors,
264
+ e as dimension,
265
+ y as padding,
266
+ C as primitive,
267
+ z as radii,
268
+ W as semantic,
269
+ h as shadow,
270
+ H as shadows,
271
+ x as spacing,
272
+ w as status,
273
+ M as text,
274
+ j as typography
275
+ };
@@ -0,0 +1,3 @@
1
+ export { colors, spacing, padding, radii, shadows, typography, } from "./primitive.js";
2
+ export { bg, text, action, status, border } from "./semantic.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,KAAK,EACL,OAAO,EACP,UAAU,GACX,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,127 @@
1
+ import type { ColorToken, DimensionToken, ShadowToken } from "../types.js";
2
+ export declare const colors: {
3
+ /** Pure solids */
4
+ readonly solid: {
5
+ readonly white: ColorToken;
6
+ readonly black: ColorToken;
7
+ };
8
+ /** Warm neutral palette — the core Billabex tone */
9
+ readonly neutral: {
10
+ readonly 50: ColorToken;
11
+ readonly 100: ColorToken;
12
+ readonly 200: ColorToken;
13
+ readonly 300: ColorToken;
14
+ readonly 400: ColorToken;
15
+ readonly 500: ColorToken;
16
+ readonly 600: ColorToken;
17
+ readonly 700: ColorToken;
18
+ };
19
+ /** Gold accent palette */
20
+ readonly gold: {
21
+ readonly 100: ColorToken;
22
+ readonly 300: ColorToken;
23
+ readonly 500: ColorToken;
24
+ };
25
+ /** Terracotta / link color */
26
+ readonly terracotta: {
27
+ readonly 400: ColorToken;
28
+ readonly 500: ColorToken;
29
+ };
30
+ /** Status colors */
31
+ readonly green: {
32
+ readonly 50: ColorToken;
33
+ readonly 600: ColorToken;
34
+ };
35
+ readonly orange: {
36
+ readonly 50: ColorToken;
37
+ readonly 500: ColorToken;
38
+ };
39
+ readonly red: {
40
+ readonly 50: ColorToken;
41
+ readonly 600: ColorToken;
42
+ };
43
+ readonly blue: {
44
+ readonly 50: ColorToken;
45
+ readonly 700: ColorToken;
46
+ };
47
+ };
48
+ export declare const spacing: {
49
+ /** 4px */
50
+ readonly xs: DimensionToken;
51
+ /** 6px */
52
+ readonly sm: DimensionToken;
53
+ /** 8px */
54
+ readonly md: DimensionToken;
55
+ /** 12px */
56
+ readonly lg: DimensionToken;
57
+ /** 16px */
58
+ readonly xl: DimensionToken;
59
+ /** 24px */
60
+ readonly "2xl": DimensionToken;
61
+ /** 32px */
62
+ readonly "3xl": DimensionToken;
63
+ /** 48px */
64
+ readonly "4xl": DimensionToken;
65
+ };
66
+ export declare const padding: {
67
+ readonly card: DimensionToken;
68
+ readonly page: DimensionToken;
69
+ };
70
+ export declare const radii: {
71
+ readonly none: DimensionToken;
72
+ readonly xs: DimensionToken;
73
+ readonly sm: DimensionToken;
74
+ readonly md: DimensionToken;
75
+ readonly lg: DimensionToken;
76
+ readonly full: DimensionToken;
77
+ };
78
+ export declare const shadows: {
79
+ readonly sm: ShadowToken;
80
+ readonly md: ShadowToken;
81
+ readonly lg: ShadowToken;
82
+ };
83
+ export declare const typography: {
84
+ readonly display: {
85
+ readonly fontFamily: "Nunito, sans-serif";
86
+ readonly fontWeight: 600;
87
+ readonly fontSize: DimensionToken;
88
+ readonly lineHeight: DimensionToken;
89
+ readonly letterSpacing: DimensionToken;
90
+ };
91
+ readonly headlineLg: {
92
+ readonly fontFamily: "Nunito, sans-serif";
93
+ readonly fontWeight: 600;
94
+ readonly fontSize: DimensionToken;
95
+ readonly lineHeight: DimensionToken;
96
+ readonly letterSpacing: DimensionToken;
97
+ };
98
+ readonly headlineSm: {
99
+ readonly fontFamily: "Nunito, sans-serif";
100
+ readonly fontWeight: 600;
101
+ readonly fontSize: DimensionToken;
102
+ readonly lineHeight: DimensionToken;
103
+ readonly letterSpacing: DimensionToken;
104
+ };
105
+ readonly body: {
106
+ readonly fontFamily: "Nunito, sans-serif";
107
+ readonly fontWeight: 400;
108
+ readonly fontSize: DimensionToken;
109
+ readonly lineHeight: DimensionToken;
110
+ readonly letterSpacing: DimensionToken;
111
+ };
112
+ readonly bodySm: {
113
+ readonly fontFamily: "Nunito, sans-serif";
114
+ readonly fontWeight: 400;
115
+ readonly fontSize: DimensionToken;
116
+ readonly lineHeight: DimensionToken;
117
+ readonly letterSpacing: DimensionToken;
118
+ };
119
+ readonly caption: {
120
+ readonly fontFamily: "Nunito, sans-serif";
121
+ readonly fontWeight: 500;
122
+ readonly fontSize: DimensionToken;
123
+ readonly lineHeight: DimensionToken;
124
+ readonly letterSpacing: DimensionToken;
125
+ };
126
+ };
127
+ //# sourceMappingURL=primitive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitive.d.ts","sourceRoot":"","sources":["../../src/tokens/primitive.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EAEd,WAAW,EAEZ,MAAM,aAAa,CAAC;AAOrB,eAAO,MAAM,MAAM;IACjB,kBAAkB;;;;;IAMlB,oDAAoD;;;;;;;;;;;IAYpD,0BAA0B;;;;;;IAO1B,8BAA8B;;;;;IAM9B,oBAAoB;;;;;;;;;;;;;;;;;CAoBsE,CAAC;AAM7F,eAAO,MAAM,OAAO;IAClB,UAAU;;IAEV,UAAU;;IAEV,UAAU;;IAEV,WAAW;;IAEX,WAAW;;IAEX,WAAW;;IAEX,WAAW;;IAEX,WAAW;;CAEsC,CAAC;AAMpD,eAAO,MAAM,OAAO;;;CAG+B,CAAC;AAMpD,eAAO,MAAM,KAAK;;;;;;;CAO8B,CAAC;AAMjD,eAAO,MAAM,OAAO;;;;CAI4B,CAAC;AAQjD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2C6B,CAAC"}
@@ -0,0 +1,64 @@
1
+ import type { ColorToken } from "../types.js";
2
+ export declare const bg: {
3
+ /** Default page / card background */
4
+ readonly default: ColorToken;
5
+ /** Subtle background for secondary surfaces */
6
+ readonly subtle: ColorToken;
7
+ /** Muted background for tertiary surfaces, hover states */
8
+ readonly muted: ColorToken;
9
+ /** Inverse background (dark) */
10
+ readonly inverse: ColorToken;
11
+ /** Brand-tinted background */
12
+ readonly brand: ColorToken;
13
+ /** Accent background (warm) */
14
+ readonly accent: ColorToken;
15
+ };
16
+ export declare const text: {
17
+ /** Primary text — headings, body */
18
+ readonly primary: ColorToken;
19
+ /** Secondary text — descriptions, labels */
20
+ readonly secondary: ColorToken;
21
+ /** Tertiary text — placeholders, disabled */
22
+ readonly tertiary: ColorToken;
23
+ /** Text on inverse/dark backgrounds */
24
+ readonly inverse: ColorToken;
25
+ /** Link text */
26
+ readonly link: ColorToken;
27
+ /** Link hover text */
28
+ readonly linkHover: ColorToken;
29
+ };
30
+ export declare const action: {
31
+ /** Primary action background */
32
+ readonly primary: ColorToken;
33
+ /** Primary action hover */
34
+ readonly primaryHover: ColorToken;
35
+ /** Primary action pressed */
36
+ readonly primaryPressed: ColorToken;
37
+ /** Secondary action background */
38
+ readonly secondary: ColorToken;
39
+ /** Secondary action hover */
40
+ readonly secondaryHover: ColorToken;
41
+ /** Destructive action */
42
+ readonly destructive: ColorToken;
43
+ };
44
+ export declare const status: {
45
+ readonly success: ColorToken;
46
+ readonly successSubtle: ColorToken;
47
+ readonly warning: ColorToken;
48
+ readonly warningSubtle: ColorToken;
49
+ readonly error: ColorToken;
50
+ readonly errorSubtle: ColorToken;
51
+ readonly info: ColorToken;
52
+ readonly infoSubtle: ColorToken;
53
+ };
54
+ export declare const border: {
55
+ /** Default border */
56
+ readonly default: ColorToken;
57
+ /** Subtle border */
58
+ readonly subtle: ColorToken;
59
+ /** Focused / active border */
60
+ readonly focus: ColorToken;
61
+ /** Error border */
62
+ readonly error: ColorToken;
63
+ };
64
+ //# sourceMappingURL=semantic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../src/tokens/semantic.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAO9C,eAAO,MAAM,EAAE;IACb,qCAAqC;;IAErC,+CAA+C;;IAE/C,2DAA2D;;IAE3D,gCAAgC;;IAEhC,8BAA8B;;IAE9B,+BAA+B;;CAEc,CAAC;AAMhD,eAAO,MAAM,IAAI;IACf,oCAAoC;;IAEpC,4CAA4C;;IAE5C,6CAA6C;;IAE7C,uCAAuC;;IAEvC,gBAAgB;;IAEhB,sBAAsB;;CAEuB,CAAC;AAMhD,eAAO,MAAM,MAAM;IACjB,gCAAgC;;IAEhC,2BAA2B;;IAE3B,6BAA6B;;IAE7B,kCAAkC;;IAElC,6BAA6B;;IAE7B,yBAAyB;;CAEoB,CAAC;AAMhD,eAAO,MAAM,MAAM;;;;;;;;;CAS4B,CAAC;AAMhD,eAAO,MAAM,MAAM;IACjB,qBAAqB;;IAErB,oBAAoB;;IAEpB,8BAA8B;;IAE9B,mBAAmB;;CAE0B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tokens.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.test.d.ts","sourceRoot":"","sources":["../src/tokens.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * RGB color components (0-255)
3
+ */
4
+ export interface RgbComponents {
5
+ readonly r: number;
6
+ readonly g: number;
7
+ readonly b: number;
8
+ }
9
+ /**
10
+ * HSL color components
11
+ */
12
+ export interface HslComponents {
13
+ readonly h: number;
14
+ readonly s: number;
15
+ readonly l: number;
16
+ }
17
+ /**
18
+ * A color token with rich conversion methods.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * import { semantic } from '@billabex/ui-tokens'
23
+ *
24
+ * semantic.bg.default.hex // '#ffffff'
25
+ * semantic.bg.default.rgb // { r: 255, g: 255, b: 255 }
26
+ * semantic.bg.default.rgba(0.5) // 'rgba(255, 255, 255, 0.5)'
27
+ * semantic.bg.default.hsl // { h: 0, s: 0, l: 100 }
28
+ * `${semantic.bg.default}` // '#ffffff' (via toString)
29
+ * ```
30
+ */
31
+ export interface ColorToken {
32
+ /** Hex string (e.g. '#1c1917') */
33
+ readonly hex: string;
34
+ /** RGB components (0-255) */
35
+ readonly rgb: RgbComponents;
36
+ /** HSL components (h: 0-360, s: 0-100, l: 0-100) */
37
+ readonly hsl: HslComponents;
38
+ /** Returns `rgba(r, g, b, alpha)` string */
39
+ rgba(alpha: number): string;
40
+ /** Returns `hsla(h, s%, l%, alpha)` string */
41
+ hsla(alpha: number): string;
42
+ /** Returns hex when coerced to string */
43
+ toString(): string;
44
+ }
45
+ /**
46
+ * A dimension token (spacing, sizing, border-width...).
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * import { primitive } from '@billabex/ui-tokens'
51
+ *
52
+ * primitive.spacing.md.value // 8
53
+ * primitive.spacing.md.px // '8px'
54
+ * primitive.spacing.md.rem // '0.5rem'
55
+ * `${primitive.spacing.md}` // '8px' (via toString)
56
+ * ```
57
+ */
58
+ export interface DimensionToken {
59
+ /** Raw numeric value (in pixels) */
60
+ readonly value: number;
61
+ /** Pixel string (e.g. '8px') */
62
+ readonly px: string;
63
+ /** Rem string based on 16px root (e.g. '0.5rem') */
64
+ readonly rem: string;
65
+ /** Returns px string when coerced to string */
66
+ toString(): string;
67
+ }
68
+ /**
69
+ * A typography token representing a complete text style.
70
+ */
71
+ export interface TypographyToken {
72
+ readonly fontFamily: string;
73
+ readonly fontWeight: number;
74
+ readonly fontSize: DimensionToken;
75
+ readonly lineHeight: DimensionToken;
76
+ readonly letterSpacing: DimensionToken;
77
+ }
78
+ /**
79
+ * A shadow token representing a box-shadow.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * primitive.shadow.sm.css // '0px 2px 8px 0px rgba(28, 28, 26, 0.08)'
84
+ * ```
85
+ */
86
+ export interface ShadowToken {
87
+ readonly offsetX: number;
88
+ readonly offsetY: number;
89
+ readonly blur: number;
90
+ readonly spread: number;
91
+ readonly color: ColorToken;
92
+ /** Full CSS box-shadow string */
93
+ readonly css: string;
94
+ /** Returns CSS string when coerced to string */
95
+ toString(): string;
96
+ }
97
+ /**
98
+ * A radius token (border-radius).
99
+ */
100
+ export interface RadiusToken extends DimensionToken {
101
+ }
102
+ /** A record of named tokens of a given type */
103
+ export type TokenScale<T> = Readonly<Record<string, T>>;
104
+ /** Nested token group (allows grouping like colors.neutral.100) */
105
+ export interface TokenGroup<T> {
106
+ readonly [key: string]: T | TokenGroup<T>;
107
+ }
108
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,UAAU;IACzB,kCAAkC;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,oDAAoD;IACpD,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,4CAA4C;IAC5C,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,8CAA8C;IAC9C,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,yCAAyC;IACzC,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,cAAc;IAC7B,oCAAoC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,iCAAiC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,cAAc;CAAG;AAMtD,+CAA+C;AAC/C,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;AAExD,mEAAmE;AACnE,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;CAC3C"}
@@ -0,0 +1,36 @@
1
+ import type { ColorToken, DimensionToken, ShadowToken } from "./types.js";
2
+ /**
3
+ * Create a ColorToken from a hex string.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const primary = color('#1c1917')
8
+ * primary.hex // '#1c1917'
9
+ * primary.rgb // { r: 28, g: 25, b: 23 }
10
+ * primary.rgba(0.5) // 'rgba(28, 25, 23, 0.5)'
11
+ * ```
12
+ */
13
+ export declare function color(hex: string): ColorToken;
14
+ /**
15
+ * Create a DimensionToken from a pixel value.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const md = dimension(8)
20
+ * md.value // 8
21
+ * md.px // '8px'
22
+ * md.rem // '0.5rem'
23
+ * ```
24
+ */
25
+ export declare function dimension(value: number): DimensionToken;
26
+ /**
27
+ * Create a ShadowToken from individual shadow properties.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const sm = shadow(0, 2, 8, 0, '#1C1C1A14')
32
+ * sm.css // '0px 2px 8px 0px rgba(28, 28, 26, 0.08)'
33
+ * ```
34
+ */
35
+ export declare function shadow(offsetX: number, offsetY: number, blur: number, spread: number, colorHex: string): ShadowToken;
36
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EAGd,WAAW,EACZ,MAAM,YAAY,CAAC;AAuDpB;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAkB7C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CASvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CACpB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,WAAW,CAmBb"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@billabex/ui-tokens",
3
+ "version": "0.0.0",
4
+ "description": "Design tokens for the Billabex design system — framework-agnostic, Figma Token Studio compatible",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "./tokens.json": "./tokens.json"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "tokens.json"
21
+ ],
22
+ "scripts": {
23
+ "build": "vite build && tsc --emitDeclarationOnly",
24
+ "build:figma": "tsx scripts/build-figma.ts",
25
+ "test": "vitest run",
26
+ "test:watch": "vitest",
27
+ "clean": "rm -rf dist",
28
+ "lint": "tsc --noEmit",
29
+ "prepare": "pnpm build:figma"
30
+ },
31
+ "devDependencies": {
32
+ "tsx": "^4.19.0",
33
+ "vite": "^6.0.0",
34
+ "vite-plugin-dts": "^4.3.0",
35
+ "vitest": "^3.0.0"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "license": "MIT",
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "https://github.com/billabex/lingot.git",
44
+ "directory": "packages/ui-tokens"
45
+ },
46
+ "sideEffects": false
47
+ }
package/tokens.json ADDED
@@ -0,0 +1,424 @@
1
+ {
2
+ "global": {
3
+ "color": {
4
+ "solid": {
5
+ "white": {
6
+ "$value": "#ffffff",
7
+ "$type": "color"
8
+ },
9
+ "black": {
10
+ "$value": "#000000",
11
+ "$type": "color"
12
+ }
13
+ },
14
+ "neutral": {
15
+ "50": {
16
+ "$value": "#fdfcfb",
17
+ "$type": "color"
18
+ },
19
+ "100": {
20
+ "$value": "#fcfaf8",
21
+ "$type": "color"
22
+ },
23
+ "200": {
24
+ "$value": "#f5f0eb",
25
+ "$type": "color"
26
+ },
27
+ "300": {
28
+ "$value": "#e3dbd2",
29
+ "$type": "color"
30
+ },
31
+ "400": {
32
+ "$value": "#9c8e82",
33
+ "$type": "color"
34
+ },
35
+ "500": {
36
+ "$value": "#534840",
37
+ "$type": "color"
38
+ },
39
+ "600": {
40
+ "$value": "#3d3530",
41
+ "$type": "color"
42
+ },
43
+ "700": {
44
+ "$value": "#1c1917",
45
+ "$type": "color"
46
+ }
47
+ },
48
+ "gold": {
49
+ "100": {
50
+ "$value": "#fef7e6",
51
+ "$type": "color"
52
+ },
53
+ "300": {
54
+ "$value": "#f0d68a",
55
+ "$type": "color"
56
+ },
57
+ "500": {
58
+ "$value": "#d4a853",
59
+ "$type": "color"
60
+ }
61
+ },
62
+ "terracotta": {
63
+ "300": {
64
+ "$value": "#eee3de",
65
+ "$type": "color"
66
+ },
67
+ "400": {
68
+ "$value": "#b5634b",
69
+ "$type": "color"
70
+ },
71
+ "500": {
72
+ "$value": "#9c5340",
73
+ "$type": "color"
74
+ }
75
+ },
76
+ "green": {
77
+ "50": {
78
+ "$value": "#e3f5eb",
79
+ "$type": "color"
80
+ },
81
+ "600": {
82
+ "$value": "#067647",
83
+ "$type": "color"
84
+ }
85
+ },
86
+ "orange": {
87
+ "50": {
88
+ "$value": "#fff1c6",
89
+ "$type": "color"
90
+ },
91
+ "500": {
92
+ "$value": "#f99307",
93
+ "$type": "color"
94
+ }
95
+ },
96
+ "red": {
97
+ "50": {
98
+ "$value": "#fde9e7",
99
+ "$type": "color"
100
+ },
101
+ "600": {
102
+ "$value": "#d92d20",
103
+ "$type": "color"
104
+ }
105
+ },
106
+ "blue": {
107
+ "50": {
108
+ "$value": "#e8ecf2",
109
+ "$type": "color"
110
+ },
111
+ "700": {
112
+ "$value": "#1e4a8a",
113
+ "$type": "color"
114
+ }
115
+ }
116
+ },
117
+ "spacing": {
118
+ "xs": {
119
+ "$value": "4px",
120
+ "$type": "dimension"
121
+ },
122
+ "sm": {
123
+ "$value": "6px",
124
+ "$type": "dimension"
125
+ },
126
+ "md": {
127
+ "$value": "8px",
128
+ "$type": "dimension"
129
+ },
130
+ "lg": {
131
+ "$value": "12px",
132
+ "$type": "dimension"
133
+ },
134
+ "xl": {
135
+ "$value": "16px",
136
+ "$type": "dimension"
137
+ },
138
+ "2xl": {
139
+ "$value": "24px",
140
+ "$type": "dimension"
141
+ },
142
+ "3xl": {
143
+ "$value": "32px",
144
+ "$type": "dimension"
145
+ },
146
+ "4xl": {
147
+ "$value": "48px",
148
+ "$type": "dimension"
149
+ },
150
+ "5xl": {
151
+ "$value": "64px",
152
+ "$type": "dimension"
153
+ }
154
+ },
155
+ "padding": {
156
+ "card": {
157
+ "$value": "16px",
158
+ "$type": "dimension"
159
+ },
160
+ "page": {
161
+ "$value": "24px",
162
+ "$type": "dimension"
163
+ }
164
+ },
165
+ "radius": {
166
+ "none": {
167
+ "$value": "0px",
168
+ "$type": "dimension"
169
+ },
170
+ "xs": {
171
+ "$value": "4px",
172
+ "$type": "dimension"
173
+ },
174
+ "sm": {
175
+ "$value": "8px",
176
+ "$type": "dimension"
177
+ },
178
+ "md": {
179
+ "$value": "12px",
180
+ "$type": "dimension"
181
+ },
182
+ "lg": {
183
+ "$value": "16px",
184
+ "$type": "dimension"
185
+ },
186
+ "full": {
187
+ "$value": "9999px",
188
+ "$type": "dimension"
189
+ }
190
+ },
191
+ "shadow": {
192
+ "sm": {
193
+ "$value": {
194
+ "offsetX": "0px",
195
+ "offsetY": "2px",
196
+ "blur": "8px",
197
+ "spread": "0px",
198
+ "color": "rgba(28, 28, 26, 1)"
199
+ },
200
+ "$type": "shadow"
201
+ },
202
+ "md": {
203
+ "$value": {
204
+ "offsetX": "0px",
205
+ "offsetY": "6px",
206
+ "blur": "16px",
207
+ "spread": "-2px",
208
+ "color": "rgba(28, 28, 26, 1)"
209
+ },
210
+ "$type": "shadow"
211
+ },
212
+ "lg": {
213
+ "$value": {
214
+ "offsetX": "0px",
215
+ "offsetY": "12px",
216
+ "blur": "28px",
217
+ "spread": "-6px",
218
+ "color": "rgba(28, 28, 26, 1)"
219
+ },
220
+ "$type": "shadow"
221
+ }
222
+ },
223
+ "typography": {
224
+ "display": {
225
+ "$value": {
226
+ "fontFamily": "Nunito, sans-serif",
227
+ "fontWeight": 600,
228
+ "fontSize": "32px",
229
+ "lineHeight": "40px",
230
+ "letterSpacing": "0px"
231
+ },
232
+ "$type": "typography"
233
+ },
234
+ "headlineLg": {
235
+ "$value": {
236
+ "fontFamily": "Nunito, sans-serif",
237
+ "fontWeight": 600,
238
+ "fontSize": "20px",
239
+ "lineHeight": "28px",
240
+ "letterSpacing": "0px"
241
+ },
242
+ "$type": "typography"
243
+ },
244
+ "headlineSm": {
245
+ "$value": {
246
+ "fontFamily": "Nunito, sans-serif",
247
+ "fontWeight": 600,
248
+ "fontSize": "16px",
249
+ "lineHeight": "24px",
250
+ "letterSpacing": "0px"
251
+ },
252
+ "$type": "typography"
253
+ },
254
+ "body": {
255
+ "$value": {
256
+ "fontFamily": "Nunito, sans-serif",
257
+ "fontWeight": 400,
258
+ "fontSize": "14px",
259
+ "lineHeight": "20px",
260
+ "letterSpacing": "0px"
261
+ },
262
+ "$type": "typography"
263
+ },
264
+ "bodySm": {
265
+ "$value": {
266
+ "fontFamily": "Nunito, sans-serif",
267
+ "fontWeight": 400,
268
+ "fontSize": "13px",
269
+ "lineHeight": "18px",
270
+ "letterSpacing": "0px"
271
+ },
272
+ "$type": "typography"
273
+ },
274
+ "caption": {
275
+ "$value": {
276
+ "fontFamily": "Nunito, sans-serif",
277
+ "fontWeight": 500,
278
+ "fontSize": "12px",
279
+ "lineHeight": "16px",
280
+ "letterSpacing": "0px"
281
+ },
282
+ "$type": "typography"
283
+ }
284
+ }
285
+ },
286
+ "semantic": {
287
+ "bg": {
288
+ "default": {
289
+ "$value": "{global.color.solid.white}",
290
+ "$type": "color"
291
+ },
292
+ "subtle": {
293
+ "$value": "{global.color.neutral.100}",
294
+ "$type": "color"
295
+ },
296
+ "muted": {
297
+ "$value": "{global.color.neutral.200}",
298
+ "$type": "color"
299
+ },
300
+ "inverse": {
301
+ "$value": "{global.color.neutral.700}",
302
+ "$type": "color"
303
+ },
304
+ "brand": {
305
+ "$value": "{global.color.blue.50}",
306
+ "$type": "color"
307
+ },
308
+ "accent": {
309
+ "$value": "{global.color.terracotta.300}",
310
+ "$type": "color"
311
+ }
312
+ },
313
+ "text": {
314
+ "primary": {
315
+ "$value": "{global.color.neutral.700}",
316
+ "$type": "color"
317
+ },
318
+ "secondary": {
319
+ "$value": "{global.color.neutral.500}",
320
+ "$type": "color"
321
+ },
322
+ "tertiary": {
323
+ "$value": "{global.color.neutral.400}",
324
+ "$type": "color"
325
+ },
326
+ "inverse": {
327
+ "$value": "{global.color.solid.white}",
328
+ "$type": "color"
329
+ },
330
+ "link": {
331
+ "$value": "{global.color.terracotta.400}",
332
+ "$type": "color"
333
+ },
334
+ "linkHover": {
335
+ "$value": "{global.color.terracotta.500}",
336
+ "$type": "color"
337
+ }
338
+ },
339
+ "action": {
340
+ "primary": {
341
+ "$value": "{global.color.neutral.700}",
342
+ "$type": "color"
343
+ },
344
+ "primaryHover": {
345
+ "$value": "{global.color.neutral.600}",
346
+ "$type": "color"
347
+ },
348
+ "primaryPressed": {
349
+ "$value": "{global.color.neutral.500}",
350
+ "$type": "color"
351
+ },
352
+ "secondary": {
353
+ "$value": "{global.color.neutral.200}",
354
+ "$type": "color"
355
+ },
356
+ "secondaryHover": {
357
+ "$value": "{global.color.neutral.300}",
358
+ "$type": "color"
359
+ },
360
+ "destructive": {
361
+ "$value": "{global.color.red.600}",
362
+ "$type": "color"
363
+ }
364
+ },
365
+ "status": {
366
+ "success": {
367
+ "$value": "{global.color.green.600}",
368
+ "$type": "color"
369
+ },
370
+ "successSubtle": {
371
+ "$value": "{global.color.green.50}",
372
+ "$type": "color"
373
+ },
374
+ "warning": {
375
+ "$value": "{global.color.orange.500}",
376
+ "$type": "color"
377
+ },
378
+ "warningSubtle": {
379
+ "$value": "{global.color.orange.50}",
380
+ "$type": "color"
381
+ },
382
+ "error": {
383
+ "$value": "{global.color.red.600}",
384
+ "$type": "color"
385
+ },
386
+ "errorSubtle": {
387
+ "$value": "{global.color.red.50}",
388
+ "$type": "color"
389
+ },
390
+ "info": {
391
+ "$value": "{global.color.blue.700}",
392
+ "$type": "color"
393
+ },
394
+ "infoSubtle": {
395
+ "$value": "{global.color.blue.50}",
396
+ "$type": "color"
397
+ }
398
+ },
399
+ "border": {
400
+ "default": {
401
+ "$value": "{global.color.neutral.300}",
402
+ "$type": "color"
403
+ },
404
+ "subtle": {
405
+ "$value": "{global.color.neutral.200}",
406
+ "$type": "color"
407
+ },
408
+ "focus": {
409
+ "$value": "{global.color.neutral.700}",
410
+ "$type": "color"
411
+ },
412
+ "error": {
413
+ "$value": "{global.color.red.600}",
414
+ "$type": "color"
415
+ }
416
+ }
417
+ },
418
+ "$metadata": {
419
+ "tokenSetOrder": [
420
+ "global",
421
+ "semantic"
422
+ ]
423
+ }
424
+ }