@sofya-ds/tokens 0.1.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/dist/index.js ADDED
@@ -0,0 +1,584 @@
1
+ // src/index.ts
2
+ var sofyaTextStyleNames = ["h1", "h2", "h3", "h4", "body", "tiny"];
3
+ var sofyaSurfaceNames = ["card", "panel", "focus"];
4
+ var sharedTypography = {
5
+ sans: '"Schibsted Grotesk", "Avenir Next", "Segoe UI", sans-serif',
6
+ display: '"Schibsted Grotesk", "Avenir Next", "Segoe UI", sans-serif',
7
+ mono: '"JetBrains Mono", "SFMono-Regular", monospace'
8
+ };
9
+ var sofyaBrandPalette = {
10
+ neutrals: {
11
+ 50: "#F2EFF9",
12
+ 100: "#FFFFFF",
13
+ 200: "#F6F5F8",
14
+ 600: "#CCCCCC",
15
+ 700: "#8B8A8C",
16
+ 800: "#202021",
17
+ 900: "#000000"
18
+ },
19
+ tags: {
20
+ navy: "#222B4C",
21
+ blue: "#1976D2",
22
+ violet: "#7B5DC1",
23
+ magenta: "#B55CAF",
24
+ red: "#C83A32",
25
+ brick: "#B55C5C",
26
+ sand: "#B5905C",
27
+ green: "#1CCC6B"
28
+ },
29
+ agent: {
30
+ pink: "#FFD7F7",
31
+ sky: "#E7F5FB",
32
+ lavender: "#F0E8ED",
33
+ mint: "#E8F5F0",
34
+ green: "#E2F5E5"
35
+ },
36
+ gradients: {
37
+ brand: {
38
+ angle: "135deg",
39
+ from: "#C075BF",
40
+ via: "#8F74CC",
41
+ to: "#5B76D9"
42
+ },
43
+ ocean: {
44
+ angle: "90deg",
45
+ from: "#5BADA8",
46
+ to: "#396DC9"
47
+ }
48
+ }
49
+ };
50
+ var sofyaColorPalette = {
51
+ neutrals: sofyaBrandPalette.neutrals,
52
+ tags: sofyaBrandPalette.tags,
53
+ agentCodes: sofyaBrandPalette.agent,
54
+ gradients: sofyaBrandPalette.gradients
55
+ };
56
+ function normalizeHex(hex) {
57
+ const value = hex.replace("#", "").trim();
58
+ if (value.length === 3) {
59
+ return value.split("").map((char) => `${char}${char}`).join("");
60
+ }
61
+ if (value.length === 6) {
62
+ return value;
63
+ }
64
+ throw new Error(`Unsupported hex color: ${hex}`);
65
+ }
66
+ function hexToHslChannels(hex) {
67
+ const normalizedHex = normalizeHex(hex);
68
+ const red = Number.parseInt(normalizedHex.slice(0, 2), 16) / 255;
69
+ const green = Number.parseInt(normalizedHex.slice(2, 4), 16) / 255;
70
+ const blue = Number.parseInt(normalizedHex.slice(4, 6), 16) / 255;
71
+ const max = Math.max(red, green, blue);
72
+ const min = Math.min(red, green, blue);
73
+ const delta = max - min;
74
+ let hue = 0;
75
+ if (delta !== 0) {
76
+ if (max === red) {
77
+ hue = (green - blue) / delta % 6;
78
+ } else if (max === green) {
79
+ hue = (blue - red) / delta + 2;
80
+ } else {
81
+ hue = (red - green) / delta + 4;
82
+ }
83
+ }
84
+ hue = Math.round((hue * 60 + 360) % 360);
85
+ const lightness = (max + min) / 2;
86
+ const saturation = delta === 0 ? 0 : delta / (1 - Math.abs(2 * lightness - 1));
87
+ return `${hue} ${Math.round(saturation * 100)}% ${Math.round(lightness * 100)}%`;
88
+ }
89
+ function gradientToCss(token) {
90
+ const stops = token.via ? `${token.from} 0%, ${token.via} 50%, ${token.to} 100%` : `${token.from} 0%, ${token.to} 100%`;
91
+ return `linear-gradient(${token.angle}, ${stops})`;
92
+ }
93
+ function brandPaletteToCssVariables(palette = sofyaBrandPalette) {
94
+ return {
95
+ "--sofya-neutral-50": palette.neutrals[50],
96
+ "--sofya-neutral-100": palette.neutrals[100],
97
+ "--sofya-neutral-200": palette.neutrals[200],
98
+ "--sofya-neutral-600": palette.neutrals[600],
99
+ "--sofya-neutral-700": palette.neutrals[700],
100
+ "--sofya-neutral-800": palette.neutrals[800],
101
+ "--sofya-neutral-900": palette.neutrals[900],
102
+ "--sofya-tag-navy": palette.tags.navy,
103
+ "--sofya-tag-blue": palette.tags.blue,
104
+ "--sofya-tag-violet": palette.tags.violet,
105
+ "--sofya-tag-magenta": palette.tags.magenta,
106
+ "--sofya-tag-red": palette.tags.red,
107
+ "--sofya-tag-brick": palette.tags.brick,
108
+ "--sofya-tag-sand": palette.tags.sand,
109
+ "--sofya-tag-green": palette.tags.green,
110
+ "--sofya-agent-pink": palette.agent.pink,
111
+ "--sofya-agent-sky": palette.agent.sky,
112
+ "--sofya-agent-lavender": palette.agent.lavender,
113
+ "--sofya-agent-mint": palette.agent.mint,
114
+ "--sofya-agent-green": palette.agent.green,
115
+ "--sofya-gradient-brand-from": palette.gradients.brand.from,
116
+ "--sofya-gradient-brand-via": palette.gradients.brand.via ?? palette.gradients.brand.to,
117
+ "--sofya-gradient-brand-to": palette.gradients.brand.to,
118
+ "--sofya-gradient-brand": gradientToCss(palette.gradients.brand),
119
+ "--sofya-gradient-ocean-from": palette.gradients.ocean.from,
120
+ "--sofya-gradient-ocean-to": palette.gradients.ocean.to,
121
+ "--sofya-gradient-ocean": gradientToCss(palette.gradients.ocean)
122
+ };
123
+ }
124
+ var sofyaSemanticColorHex = {
125
+ background: sofyaBrandPalette.neutrals[50],
126
+ foreground: sofyaBrandPalette.neutrals[800],
127
+ card: sofyaBrandPalette.neutrals[100],
128
+ cardForeground: sofyaBrandPalette.neutrals[800],
129
+ popover: sofyaBrandPalette.neutrals[100],
130
+ popoverForeground: sofyaBrandPalette.neutrals[800],
131
+ primary: sofyaBrandPalette.tags.blue,
132
+ primaryForeground: sofyaBrandPalette.neutrals[100],
133
+ secondary: sofyaBrandPalette.neutrals[200],
134
+ secondaryForeground: sofyaBrandPalette.neutrals[800],
135
+ muted: sofyaBrandPalette.neutrals[200],
136
+ mutedForeground: sofyaBrandPalette.neutrals[700],
137
+ accent: sofyaBrandPalette.tags.magenta,
138
+ accentForeground: sofyaBrandPalette.neutrals[100],
139
+ destructive: sofyaBrandPalette.tags.red,
140
+ destructiveForeground: sofyaBrandPalette.neutrals[100],
141
+ success: sofyaBrandPalette.tags.green,
142
+ successForeground: sofyaBrandPalette.neutrals[900],
143
+ warning: sofyaBrandPalette.tags.sand,
144
+ warningForeground: sofyaBrandPalette.neutrals[900],
145
+ border: sofyaBrandPalette.neutrals[600],
146
+ input: sofyaBrandPalette.neutrals[600],
147
+ ring: sofyaBrandPalette.tags.blue,
148
+ focus: sofyaBrandPalette.tags.blue,
149
+ subtle: sofyaBrandPalette.neutrals[600],
150
+ buttonGradientFrom: sofyaBrandPalette.gradients.brand.from,
151
+ buttonGradientTo: sofyaBrandPalette.gradients.brand.to
152
+ };
153
+ function createColorScale(hexColors) {
154
+ return {
155
+ background: hexToHslChannels(hexColors.background),
156
+ foreground: hexToHslChannels(hexColors.foreground),
157
+ card: hexToHslChannels(hexColors.card),
158
+ cardForeground: hexToHslChannels(hexColors.cardForeground),
159
+ popover: hexToHslChannels(hexColors.popover),
160
+ popoverForeground: hexToHslChannels(hexColors.popoverForeground),
161
+ primary: hexToHslChannels(hexColors.primary),
162
+ primaryForeground: hexToHslChannels(hexColors.primaryForeground),
163
+ secondary: hexToHslChannels(hexColors.secondary),
164
+ secondaryForeground: hexToHslChannels(hexColors.secondaryForeground),
165
+ muted: hexToHslChannels(hexColors.muted),
166
+ mutedForeground: hexToHslChannels(hexColors.mutedForeground),
167
+ accent: hexToHslChannels(hexColors.accent),
168
+ accentForeground: hexToHslChannels(hexColors.accentForeground),
169
+ destructive: hexToHslChannels(hexColors.destructive),
170
+ destructiveForeground: hexToHslChannels(hexColors.destructiveForeground),
171
+ success: hexToHslChannels(hexColors.success),
172
+ successForeground: hexToHslChannels(hexColors.successForeground),
173
+ warning: hexToHslChannels(hexColors.warning),
174
+ warningForeground: hexToHslChannels(hexColors.warningForeground),
175
+ border: hexToHslChannels(hexColors.border),
176
+ input: hexToHslChannels(hexColors.input),
177
+ ring: hexToHslChannels(hexColors.ring),
178
+ focus: hexToHslChannels(hexColors.focus),
179
+ subtle: hexToHslChannels(hexColors.subtle),
180
+ buttonGradientFrom: hexToHslChannels(hexColors.buttonGradientFrom),
181
+ buttonGradientTo: hexToHslChannels(hexColors.buttonGradientTo)
182
+ };
183
+ }
184
+ function createFocusShadow(color) {
185
+ return `0 0 0 1px hsl(${color} / 0.42), 0 12px 28px -16px hsl(${color} / 0.28), 0 0 18px 0 hsl(${color} / 0.24)`;
186
+ }
187
+ function createTextStyleScale(typography) {
188
+ return {
189
+ h1: {
190
+ fontFamily: typography.display,
191
+ fontSize: "60px",
192
+ fontWeight: "500",
193
+ lineHeight: "1",
194
+ letterSpacing: "0"
195
+ },
196
+ h2: {
197
+ fontFamily: typography.display,
198
+ fontSize: "30px",
199
+ fontWeight: "500",
200
+ lineHeight: "1",
201
+ letterSpacing: "0"
202
+ },
203
+ h3: {
204
+ fontFamily: typography.display,
205
+ fontSize: "24px",
206
+ fontWeight: "600",
207
+ lineHeight: "30px",
208
+ letterSpacing: "0"
209
+ },
210
+ h4: {
211
+ fontFamily: typography.display,
212
+ fontSize: "16px",
213
+ fontWeight: "500",
214
+ lineHeight: "24px",
215
+ letterSpacing: "0"
216
+ },
217
+ body: {
218
+ fontFamily: typography.sans,
219
+ fontSize: "14px",
220
+ fontWeight: "400",
221
+ lineHeight: "26px",
222
+ letterSpacing: "0"
223
+ },
224
+ tiny: {
225
+ fontFamily: typography.sans,
226
+ fontSize: "12px",
227
+ fontWeight: "400",
228
+ lineHeight: "1",
229
+ letterSpacing: "0"
230
+ }
231
+ };
232
+ }
233
+ function createSurfaceScale(colors, radii, shadows) {
234
+ return {
235
+ card: {
236
+ background: colors.card,
237
+ borderColor: colors.subtle,
238
+ borderWidth: "1px",
239
+ radius: radii.xl,
240
+ shadow: "none"
241
+ },
242
+ panel: {
243
+ background: colors.card,
244
+ borderColor: colors.subtle,
245
+ borderWidth: "1px",
246
+ radius: radii.sm,
247
+ shadow: "none"
248
+ },
249
+ focus: {
250
+ background: colors.card,
251
+ borderColor: colors.focus,
252
+ borderWidth: "1px",
253
+ radius: radii.sm,
254
+ shadow: shadows.focus
255
+ }
256
+ };
257
+ }
258
+ function mergeTextStyleScale(baseScale, overrides) {
259
+ return Object.fromEntries(
260
+ sofyaTextStyleNames.map((name) => [
261
+ name,
262
+ {
263
+ ...baseScale[name],
264
+ ...overrides?.[name]
265
+ }
266
+ ])
267
+ );
268
+ }
269
+ function mergeSurfaceScale(baseScale, overrides) {
270
+ return Object.fromEntries(
271
+ sofyaSurfaceNames.map((name) => [
272
+ name,
273
+ {
274
+ ...baseScale[name],
275
+ ...overrides?.[name]
276
+ }
277
+ ])
278
+ );
279
+ }
280
+ var sofyaColors = createColorScale(sofyaSemanticColorHex);
281
+ var sofyaRadii = {
282
+ sm: "0.5rem",
283
+ md: "0.8rem",
284
+ lg: "1.15rem",
285
+ xl: "2rem",
286
+ full: "9999px"
287
+ };
288
+ var sofyaShadows = {
289
+ sm: `0 10px 30px -18px hsl(${hexToHslChannels(sofyaBrandPalette.tags.violet)} / 0.18)`,
290
+ md: `0 18px 56px -26px hsl(${hexToHslChannels(sofyaBrandPalette.tags.violet)} / 0.38)`,
291
+ lg: `0 24px 80px -38px hsl(${hexToHslChannels(sofyaBrandPalette.tags.violet)} / 0.3)`,
292
+ xl: `0 32px 100px -48px hsl(${hexToHslChannels(sofyaBrandPalette.tags.violet)} / 0.36)`,
293
+ focus: createFocusShadow(sofyaColors.focus)
294
+ };
295
+ var oceanColors = {
296
+ background: "204 60% 97%",
297
+ foreground: "215 45% 12%",
298
+ card: "0 0% 100%",
299
+ cardForeground: "215 45% 12%",
300
+ popover: "0 0% 100%",
301
+ popoverForeground: "215 45% 12%",
302
+ primary: "212 89% 53%",
303
+ primaryForeground: "210 40% 98%",
304
+ secondary: "197 43% 89%",
305
+ secondaryForeground: "216 41% 16%",
306
+ muted: "196 38% 92%",
307
+ mutedForeground: "215 18% 40%",
308
+ accent: "183 78% 42%",
309
+ accentForeground: "187 100% 96%",
310
+ destructive: "0 72% 52%",
311
+ destructiveForeground: "0 0% 98%",
312
+ success: "160 84% 31%",
313
+ successForeground: "0 0% 98%",
314
+ warning: "40 94% 54%",
315
+ warningForeground: "24 10% 10%",
316
+ border: "200 35% 84%",
317
+ input: "200 35% 84%",
318
+ ring: "212 89% 53%",
319
+ focus: "212 89% 53%",
320
+ subtle: "200 35% 84%",
321
+ buttonGradientFrom: "212 89% 53%",
322
+ buttonGradientTo: "183 78% 42%"
323
+ };
324
+ var oceanRadii = {
325
+ sm: "0.55rem",
326
+ md: "0.9rem",
327
+ lg: "1.2rem",
328
+ xl: "1.6rem",
329
+ full: "9999px"
330
+ };
331
+ var oceanShadows = {
332
+ sm: "0 12px 32px -18px hsl(212 89% 53% / 0.28)",
333
+ md: "0 22px 62px -26px hsl(212 89% 53% / 0.42)",
334
+ lg: "0 28px 86px -36px hsl(212 89% 53% / 0.4)",
335
+ xl: "0 34px 110px -44px hsl(212 89% 53% / 0.48)",
336
+ focus: createFocusShadow(oceanColors.focus)
337
+ };
338
+ var midnightColors = {
339
+ background: "223 47% 9%",
340
+ foreground: "210 40% 98%",
341
+ card: "224 43% 12%",
342
+ cardForeground: "210 40% 98%",
343
+ popover: "224 43% 12%",
344
+ popoverForeground: "210 40% 98%",
345
+ primary: "191 92% 49%",
346
+ primaryForeground: "223 47% 9%",
347
+ secondary: "217 33% 19%",
348
+ secondaryForeground: "210 40% 98%",
349
+ muted: "217 33% 16%",
350
+ mutedForeground: "215 18% 73%",
351
+ accent: "171 72% 43%",
352
+ accentForeground: "176 100% 97%",
353
+ destructive: "0 78% 63%",
354
+ destructiveForeground: "0 0% 98%",
355
+ success: "155 74% 44%",
356
+ successForeground: "223 47% 9%",
357
+ warning: "38 92% 58%",
358
+ warningForeground: "24 10% 10%",
359
+ border: "217 33% 22%",
360
+ input: "217 33% 22%",
361
+ ring: "191 92% 49%",
362
+ focus: "191 92% 49%",
363
+ subtle: "217 33% 22%",
364
+ buttonGradientFrom: "191 92% 49%",
365
+ buttonGradientTo: "171 72% 43%"
366
+ };
367
+ var midnightRadii = {
368
+ sm: "0.5rem",
369
+ md: "0.85rem",
370
+ lg: "1.2rem",
371
+ xl: "1.75rem",
372
+ full: "9999px"
373
+ };
374
+ var midnightShadows = {
375
+ sm: "0 18px 38px -24px hsl(191 92% 49% / 0.3)",
376
+ md: "0 26px 70px -28px hsl(191 92% 49% / 0.42)",
377
+ lg: "0 32px 90px -40px hsl(191 92% 49% / 0.42)",
378
+ xl: "0 40px 120px -48px hsl(191 92% 49% / 0.5)",
379
+ focus: createFocusShadow(midnightColors.focus)
380
+ };
381
+ var sofyaTheme = {
382
+ name: "sofya",
383
+ colors: sofyaColors,
384
+ radii: sofyaRadii,
385
+ shadows: sofyaShadows,
386
+ typography: sharedTypography,
387
+ textStyles: createTextStyleScale(sharedTypography),
388
+ surfaces: createSurfaceScale(sofyaColors, sofyaRadii, sofyaShadows)
389
+ };
390
+ var oceanTheme = {
391
+ name: "ocean",
392
+ colors: oceanColors,
393
+ radii: oceanRadii,
394
+ shadows: oceanShadows,
395
+ typography: sharedTypography,
396
+ textStyles: createTextStyleScale(sharedTypography),
397
+ surfaces: createSurfaceScale(oceanColors, oceanRadii, oceanShadows)
398
+ };
399
+ var midnightTheme = {
400
+ name: "midnight",
401
+ colors: midnightColors,
402
+ radii: midnightRadii,
403
+ shadows: midnightShadows,
404
+ typography: sharedTypography,
405
+ textStyles: createTextStyleScale(sharedTypography),
406
+ surfaces: createSurfaceScale(midnightColors, midnightRadii, midnightShadows)
407
+ };
408
+ var themePresets = {
409
+ sofya: sofyaTheme,
410
+ ocean: oceanTheme,
411
+ midnight: midnightTheme
412
+ };
413
+ var themePresetNames = Object.keys(themePresets);
414
+ var defaultTheme = themePresets.sofya;
415
+ function resolveTextStyle(name, theme = defaultTheme) {
416
+ return { ...theme.textStyles[name] };
417
+ }
418
+ function resolveSurfaceToken(name, theme = defaultTheme) {
419
+ return { ...theme.surfaces[name] };
420
+ }
421
+ function mergeTheme(baseTheme, overrides) {
422
+ if (!overrides) {
423
+ return {
424
+ ...baseTheme,
425
+ colors: { ...baseTheme.colors },
426
+ radii: { ...baseTheme.radii },
427
+ shadows: { ...baseTheme.shadows },
428
+ typography: { ...baseTheme.typography },
429
+ textStyles: mergeTextStyleScale(baseTheme.textStyles),
430
+ surfaces: mergeSurfaceScale(baseTheme.surfaces)
431
+ };
432
+ }
433
+ const colors = {
434
+ ...baseTheme.colors,
435
+ ...overrides.colors
436
+ };
437
+ const radii = {
438
+ ...baseTheme.radii,
439
+ ...overrides.radii
440
+ };
441
+ const shadows = {
442
+ ...baseTheme.shadows,
443
+ ...overrides.shadows,
444
+ focus: overrides.shadows?.focus ?? createFocusShadow(colors.focus)
445
+ };
446
+ const typography = {
447
+ ...baseTheme.typography,
448
+ ...overrides.typography
449
+ };
450
+ const textStyles = mergeTextStyleScale(createTextStyleScale(typography), overrides.textStyles);
451
+ const surfaces = mergeSurfaceScale(createSurfaceScale(colors, radii, shadows), overrides.surfaces);
452
+ return {
453
+ name: overrides.name ?? baseTheme.name,
454
+ colors,
455
+ radii,
456
+ shadows,
457
+ typography,
458
+ textStyles,
459
+ surfaces
460
+ };
461
+ }
462
+ function resolveTheme(preset = defaultTheme, overrides) {
463
+ const baseTheme = typeof preset === "string" ? themePresets[preset] : preset;
464
+ return mergeTheme(baseTheme, overrides);
465
+ }
466
+ function themeToCssVariables(theme) {
467
+ const textStyles = Object.fromEntries(
468
+ sofyaTextStyleNames.map((name) => [name, resolveTextStyle(name, theme)])
469
+ );
470
+ const surfaces = Object.fromEntries(
471
+ sofyaSurfaceNames.map((name) => [name, resolveSurfaceToken(name, theme)])
472
+ );
473
+ return {
474
+ ...brandPaletteToCssVariables(),
475
+ "--sofya-background": theme.colors.background,
476
+ "--sofya-foreground": theme.colors.foreground,
477
+ "--sofya-card": theme.colors.card,
478
+ "--sofya-card-foreground": theme.colors.cardForeground,
479
+ "--sofya-popover": theme.colors.popover,
480
+ "--sofya-popover-foreground": theme.colors.popoverForeground,
481
+ "--sofya-primary": theme.colors.primary,
482
+ "--sofya-primary-foreground": theme.colors.primaryForeground,
483
+ "--sofya-secondary": theme.colors.secondary,
484
+ "--sofya-secondary-foreground": theme.colors.secondaryForeground,
485
+ "--sofya-muted": theme.colors.muted,
486
+ "--sofya-muted-foreground": theme.colors.mutedForeground,
487
+ "--sofya-accent": theme.colors.accent,
488
+ "--sofya-accent-foreground": theme.colors.accentForeground,
489
+ "--sofya-destructive": theme.colors.destructive,
490
+ "--sofya-destructive-foreground": theme.colors.destructiveForeground,
491
+ "--sofya-success": theme.colors.success,
492
+ "--sofya-success-foreground": theme.colors.successForeground,
493
+ "--sofya-warning": theme.colors.warning,
494
+ "--sofya-warning-foreground": theme.colors.warningForeground,
495
+ "--sofya-border": theme.colors.border,
496
+ "--sofya-input": theme.colors.input,
497
+ "--sofya-ring": theme.colors.ring,
498
+ "--sofya-focus": theme.colors.focus,
499
+ "--sofya-subtle": theme.colors.subtle,
500
+ "--sofya-surface-default": theme.colors.card,
501
+ "--sofya-button-gradient-from": theme.colors.buttonGradientFrom,
502
+ "--sofya-button-gradient-to": theme.colors.buttonGradientTo,
503
+ "--sofya-radius-sm": theme.radii.sm,
504
+ "--sofya-radius-md": theme.radii.md,
505
+ "--sofya-radius-lg": theme.radii.lg,
506
+ "--sofya-radius-xl": theme.radii.xl,
507
+ "--sofya-radius-full": theme.radii.full,
508
+ "--sofya-shadow-sm": theme.shadows.sm,
509
+ "--sofya-shadow-md": theme.shadows.md,
510
+ "--sofya-shadow-lg": theme.shadows.lg,
511
+ "--sofya-shadow-xl": theme.shadows.xl,
512
+ "--sofya-shadow-focus": theme.shadows.focus,
513
+ "--sofya-font-sans": theme.typography.sans,
514
+ "--sofya-font-display": theme.typography.display,
515
+ "--sofya-font-mono": theme.typography.mono,
516
+ "--sofya-text-h1-font-family": textStyles.h1.fontFamily,
517
+ "--sofya-text-h1-font-size": textStyles.h1.fontSize,
518
+ "--sofya-text-h1-font-weight": textStyles.h1.fontWeight,
519
+ "--sofya-text-h1-line-height": textStyles.h1.lineHeight,
520
+ "--sofya-text-h1-letter-spacing": textStyles.h1.letterSpacing,
521
+ "--sofya-text-h2-font-family": textStyles.h2.fontFamily,
522
+ "--sofya-text-h2-font-size": textStyles.h2.fontSize,
523
+ "--sofya-text-h2-font-weight": textStyles.h2.fontWeight,
524
+ "--sofya-text-h2-line-height": textStyles.h2.lineHeight,
525
+ "--sofya-text-h2-letter-spacing": textStyles.h2.letterSpacing,
526
+ "--sofya-text-h3-font-family": textStyles.h3.fontFamily,
527
+ "--sofya-text-h3-font-size": textStyles.h3.fontSize,
528
+ "--sofya-text-h3-font-weight": textStyles.h3.fontWeight,
529
+ "--sofya-text-h3-line-height": textStyles.h3.lineHeight,
530
+ "--sofya-text-h3-letter-spacing": textStyles.h3.letterSpacing,
531
+ "--sofya-text-h4-font-family": textStyles.h4.fontFamily,
532
+ "--sofya-text-h4-font-size": textStyles.h4.fontSize,
533
+ "--sofya-text-h4-font-weight": textStyles.h4.fontWeight,
534
+ "--sofya-text-h4-line-height": textStyles.h4.lineHeight,
535
+ "--sofya-text-h4-letter-spacing": textStyles.h4.letterSpacing,
536
+ "--sofya-text-body-font-family": textStyles.body.fontFamily,
537
+ "--sofya-text-body-font-size": textStyles.body.fontSize,
538
+ "--sofya-text-body-font-weight": textStyles.body.fontWeight,
539
+ "--sofya-text-body-line-height": textStyles.body.lineHeight,
540
+ "--sofya-text-body-letter-spacing": textStyles.body.letterSpacing,
541
+ "--sofya-text-tiny-font-family": textStyles.tiny.fontFamily,
542
+ "--sofya-text-tiny-font-size": textStyles.tiny.fontSize,
543
+ "--sofya-text-tiny-font-weight": textStyles.tiny.fontWeight,
544
+ "--sofya-text-tiny-line-height": textStyles.tiny.lineHeight,
545
+ "--sofya-text-tiny-letter-spacing": textStyles.tiny.letterSpacing,
546
+ "--sofya-surface-card-background": surfaces.card.background,
547
+ "--sofya-surface-card-border-color": surfaces.card.borderColor,
548
+ "--sofya-surface-card-border-width": surfaces.card.borderWidth,
549
+ "--sofya-surface-card-radius": surfaces.card.radius,
550
+ "--sofya-surface-card-shadow": surfaces.card.shadow,
551
+ "--sofya-surface-panel-background": surfaces.panel.background,
552
+ "--sofya-surface-panel-border-color": surfaces.panel.borderColor,
553
+ "--sofya-surface-panel-border-width": surfaces.panel.borderWidth,
554
+ "--sofya-surface-panel-radius": surfaces.panel.radius,
555
+ "--sofya-surface-panel-shadow": surfaces.panel.shadow,
556
+ "--sofya-surface-focus-background": surfaces.focus.background,
557
+ "--sofya-surface-focus-border-color": surfaces.focus.borderColor,
558
+ "--sofya-surface-focus-border-width": surfaces.focus.borderWidth,
559
+ "--sofya-surface-focus-radius": surfaces.focus.radius,
560
+ "--sofya-surface-focus-shadow": surfaces.focus.shadow
561
+ };
562
+ }
563
+ function createWhitelabelTheme(overrides, preset = defaultTheme) {
564
+ return resolveTheme(preset, overrides);
565
+ }
566
+ export {
567
+ brandPaletteToCssVariables,
568
+ createWhitelabelTheme,
569
+ defaultTheme,
570
+ gradientToCss,
571
+ hexToHslChannels,
572
+ mergeTheme,
573
+ resolveSurfaceToken,
574
+ resolveTextStyle,
575
+ resolveTheme,
576
+ sofyaBrandPalette,
577
+ sofyaColorPalette,
578
+ sofyaSemanticColorHex,
579
+ sofyaSurfaceNames,
580
+ sofyaTextStyleNames,
581
+ themePresetNames,
582
+ themePresets,
583
+ themeToCssVariables
584
+ };
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@sofya-ds/tokens",
3
+ "version": "0.1.0",
4
+ "description": "Official Sofya design tokens, theme presets and semantic color helpers.",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "keywords": [
20
+ "sofya",
21
+ "design-system",
22
+ "tokens",
23
+ "theme"
24
+ ],
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://dev.azure.com/sofya-ai/sofya.med/_git/sofya.design.system"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "scripts": {
33
+ "build": "tsup src/index.ts --format esm,cjs --dts --clean",
34
+ "typecheck": "tsc --noEmit"
35
+ }
36
+ }