@sofya-ds/tokens 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/index.cjs +521 -59
- package/dist/index.d.cts +37 -3
- package/dist/index.d.ts +37 -3
- package/dist/index.js +517 -59
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -31,7 +31,11 @@ __export(index_exports, {
|
|
|
31
31
|
resolveTheme: () => resolveTheme,
|
|
32
32
|
sofyaBrandPalette: () => sofyaBrandPalette,
|
|
33
33
|
sofyaColorPalette: () => sofyaColorPalette,
|
|
34
|
+
sofyaGapNames: () => sofyaGapNames,
|
|
35
|
+
sofyaMeasureNames: () => sofyaMeasureNames,
|
|
36
|
+
sofyaRhythmNames: () => sofyaRhythmNames,
|
|
34
37
|
sofyaSemanticColorHex: () => sofyaSemanticColorHex,
|
|
38
|
+
sofyaSpaceNames: () => sofyaSpaceNames,
|
|
35
39
|
sofyaSurfaceNames: () => sofyaSurfaceNames,
|
|
36
40
|
sofyaTextStyleNames: () => sofyaTextStyleNames,
|
|
37
41
|
themePresetNames: () => themePresetNames,
|
|
@@ -40,16 +44,94 @@ __export(index_exports, {
|
|
|
40
44
|
});
|
|
41
45
|
module.exports = __toCommonJS(index_exports);
|
|
42
46
|
var sofyaTextStyleNames = [
|
|
47
|
+
"display-xl",
|
|
48
|
+
"display-lg",
|
|
49
|
+
"heading-xl",
|
|
50
|
+
"heading-lg",
|
|
51
|
+
"heading-md",
|
|
43
52
|
"h1",
|
|
44
53
|
"h2",
|
|
45
54
|
"h3",
|
|
46
55
|
"h4",
|
|
47
56
|
"h5",
|
|
57
|
+
"encounter-title",
|
|
58
|
+
"title-md",
|
|
59
|
+
"title-sm",
|
|
60
|
+
"body-lg",
|
|
61
|
+
"body-md",
|
|
62
|
+
"body-sm",
|
|
48
63
|
"body",
|
|
64
|
+
"label-md",
|
|
65
|
+
"section-label",
|
|
66
|
+
"eyebrow-md",
|
|
67
|
+
"overline-md",
|
|
68
|
+
"sidebar-title",
|
|
69
|
+
"sidebar-title-regular",
|
|
70
|
+
"sidebar-title-strong",
|
|
71
|
+
"sidebar-label",
|
|
72
|
+
"sidebar-label-strong",
|
|
73
|
+
"sidebar-body",
|
|
74
|
+
"sidebar-tag",
|
|
75
|
+
"encounter-chip",
|
|
76
|
+
"encounter-history",
|
|
77
|
+
"caption",
|
|
78
|
+
"eyebrow",
|
|
49
79
|
"tiny",
|
|
50
|
-
"extra-tiny"
|
|
80
|
+
"extra-tiny",
|
|
81
|
+
"code-sm"
|
|
51
82
|
];
|
|
52
|
-
var sofyaSurfaceNames = [
|
|
83
|
+
var sofyaSurfaceNames = [
|
|
84
|
+
"appBackground",
|
|
85
|
+
"auth",
|
|
86
|
+
"card",
|
|
87
|
+
"dataTable",
|
|
88
|
+
"dialog",
|
|
89
|
+
"documentCard",
|
|
90
|
+
"documentCardSelected",
|
|
91
|
+
"focus",
|
|
92
|
+
"mainContent",
|
|
93
|
+
"panel",
|
|
94
|
+
"proseDialog",
|
|
95
|
+
"rightPanel",
|
|
96
|
+
"sidebar"
|
|
97
|
+
];
|
|
98
|
+
var sofyaSpaceNames = [
|
|
99
|
+
"0",
|
|
100
|
+
"0-5",
|
|
101
|
+
"1",
|
|
102
|
+
"1-5",
|
|
103
|
+
"2",
|
|
104
|
+
"2-5",
|
|
105
|
+
"3",
|
|
106
|
+
"4",
|
|
107
|
+
"5",
|
|
108
|
+
"6",
|
|
109
|
+
"8",
|
|
110
|
+
"10",
|
|
111
|
+
"12",
|
|
112
|
+
"16"
|
|
113
|
+
];
|
|
114
|
+
var sofyaGapNames = [
|
|
115
|
+
"tight",
|
|
116
|
+
"compact",
|
|
117
|
+
"default",
|
|
118
|
+
"comfortable",
|
|
119
|
+
"section",
|
|
120
|
+
"page"
|
|
121
|
+
];
|
|
122
|
+
var sofyaRhythmNames = [
|
|
123
|
+
"labelToControl",
|
|
124
|
+
"controlToHelp",
|
|
125
|
+
"titleToDescription",
|
|
126
|
+
"titleToBody",
|
|
127
|
+
"fieldset",
|
|
128
|
+
"fieldsetCompact",
|
|
129
|
+
"group",
|
|
130
|
+
"groupCompact",
|
|
131
|
+
"paragraphFlow",
|
|
132
|
+
"sectionContent"
|
|
133
|
+
];
|
|
134
|
+
var sofyaMeasureNames = ["reading", "compact", "wide"];
|
|
53
135
|
var sharedTypography = {
|
|
54
136
|
sans: '"Schibsted Grotesk", "Avenir Next", "Segoe UI", sans-serif',
|
|
55
137
|
display: '"Schibsted Grotesk", "Avenir Next", "Segoe UI", sans-serif',
|
|
@@ -237,6 +319,41 @@ function createFocusShadow(color) {
|
|
|
237
319
|
}
|
|
238
320
|
function createTextStyleScale(typography) {
|
|
239
321
|
return {
|
|
322
|
+
"display-xl": {
|
|
323
|
+
fontFamily: typography.display,
|
|
324
|
+
fontSize: "60px",
|
|
325
|
+
fontWeight: "400",
|
|
326
|
+
lineHeight: "64px",
|
|
327
|
+
letterSpacing: "-0.02em"
|
|
328
|
+
},
|
|
329
|
+
"display-lg": {
|
|
330
|
+
fontFamily: typography.display,
|
|
331
|
+
fontSize: "48px",
|
|
332
|
+
fontWeight: "400",
|
|
333
|
+
lineHeight: "52px",
|
|
334
|
+
letterSpacing: "-0.02em"
|
|
335
|
+
},
|
|
336
|
+
"heading-xl": {
|
|
337
|
+
fontFamily: typography.display,
|
|
338
|
+
fontSize: "36px",
|
|
339
|
+
fontWeight: "500",
|
|
340
|
+
lineHeight: "40px",
|
|
341
|
+
letterSpacing: "-0.01em"
|
|
342
|
+
},
|
|
343
|
+
"heading-lg": {
|
|
344
|
+
fontFamily: typography.display,
|
|
345
|
+
fontSize: "30px",
|
|
346
|
+
fontWeight: "500",
|
|
347
|
+
lineHeight: "36px",
|
|
348
|
+
letterSpacing: "-0.01em"
|
|
349
|
+
},
|
|
350
|
+
"heading-md": {
|
|
351
|
+
fontFamily: typography.display,
|
|
352
|
+
fontSize: "24px",
|
|
353
|
+
fontWeight: "600",
|
|
354
|
+
lineHeight: "30px",
|
|
355
|
+
letterSpacing: "-0.01em"
|
|
356
|
+
},
|
|
240
357
|
h1: {
|
|
241
358
|
fontFamily: typography.display,
|
|
242
359
|
fontSize: "48px",
|
|
@@ -272,6 +389,48 @@ function createTextStyleScale(typography) {
|
|
|
272
389
|
lineHeight: "23px",
|
|
273
390
|
letterSpacing: "0"
|
|
274
391
|
},
|
|
392
|
+
"encounter-title": {
|
|
393
|
+
fontFamily: typography.display,
|
|
394
|
+
fontSize: "22px",
|
|
395
|
+
fontWeight: "500",
|
|
396
|
+
lineHeight: "28px",
|
|
397
|
+
letterSpacing: "-0.022px"
|
|
398
|
+
},
|
|
399
|
+
"title-md": {
|
|
400
|
+
fontFamily: typography.display,
|
|
401
|
+
fontSize: "20px",
|
|
402
|
+
fontWeight: "500",
|
|
403
|
+
lineHeight: "28px",
|
|
404
|
+
letterSpacing: "0"
|
|
405
|
+
},
|
|
406
|
+
"title-sm": {
|
|
407
|
+
fontFamily: typography.display,
|
|
408
|
+
fontSize: "16px",
|
|
409
|
+
fontWeight: "500",
|
|
410
|
+
lineHeight: "24px",
|
|
411
|
+
letterSpacing: "0"
|
|
412
|
+
},
|
|
413
|
+
"body-lg": {
|
|
414
|
+
fontFamily: typography.sans,
|
|
415
|
+
fontSize: "18px",
|
|
416
|
+
fontWeight: "400",
|
|
417
|
+
lineHeight: "28px",
|
|
418
|
+
letterSpacing: "0"
|
|
419
|
+
},
|
|
420
|
+
"body-md": {
|
|
421
|
+
fontFamily: typography.sans,
|
|
422
|
+
fontSize: "16px",
|
|
423
|
+
fontWeight: "400",
|
|
424
|
+
lineHeight: "24px",
|
|
425
|
+
letterSpacing: "0"
|
|
426
|
+
},
|
|
427
|
+
"body-sm": {
|
|
428
|
+
fontFamily: typography.sans,
|
|
429
|
+
fontSize: "14px",
|
|
430
|
+
fontWeight: "400",
|
|
431
|
+
lineHeight: "20px",
|
|
432
|
+
letterSpacing: "0"
|
|
433
|
+
},
|
|
275
434
|
body: {
|
|
276
435
|
fontFamily: typography.sans,
|
|
277
436
|
fontSize: "16px",
|
|
@@ -279,6 +438,111 @@ function createTextStyleScale(typography) {
|
|
|
279
438
|
lineHeight: "26px",
|
|
280
439
|
letterSpacing: "0"
|
|
281
440
|
},
|
|
441
|
+
"label-md": {
|
|
442
|
+
fontFamily: typography.sans,
|
|
443
|
+
fontSize: "14px",
|
|
444
|
+
fontWeight: "500",
|
|
445
|
+
lineHeight: "20px",
|
|
446
|
+
letterSpacing: "0"
|
|
447
|
+
},
|
|
448
|
+
"section-label": {
|
|
449
|
+
fontFamily: typography.sans,
|
|
450
|
+
fontSize: "14px",
|
|
451
|
+
fontWeight: "600",
|
|
452
|
+
lineHeight: "18px",
|
|
453
|
+
letterSpacing: "0"
|
|
454
|
+
},
|
|
455
|
+
"eyebrow-md": {
|
|
456
|
+
fontFamily: typography.sans,
|
|
457
|
+
fontSize: "14px",
|
|
458
|
+
fontWeight: "500",
|
|
459
|
+
lineHeight: "20px",
|
|
460
|
+
letterSpacing: "0.08em"
|
|
461
|
+
},
|
|
462
|
+
"overline-md": {
|
|
463
|
+
fontFamily: typography.sans,
|
|
464
|
+
fontSize: "14px",
|
|
465
|
+
fontWeight: "500",
|
|
466
|
+
lineHeight: "20px",
|
|
467
|
+
letterSpacing: "0"
|
|
468
|
+
},
|
|
469
|
+
"sidebar-title": {
|
|
470
|
+
fontFamily: typography.sans,
|
|
471
|
+
fontSize: "14px",
|
|
472
|
+
fontWeight: "500",
|
|
473
|
+
lineHeight: "18px",
|
|
474
|
+
letterSpacing: "0.014px"
|
|
475
|
+
},
|
|
476
|
+
"sidebar-title-regular": {
|
|
477
|
+
fontFamily: typography.sans,
|
|
478
|
+
fontSize: "14px",
|
|
479
|
+
fontWeight: "400",
|
|
480
|
+
lineHeight: "18px",
|
|
481
|
+
letterSpacing: "0.014px"
|
|
482
|
+
},
|
|
483
|
+
"sidebar-title-strong": {
|
|
484
|
+
fontFamily: typography.sans,
|
|
485
|
+
fontSize: "14px",
|
|
486
|
+
fontWeight: "600",
|
|
487
|
+
lineHeight: "18px",
|
|
488
|
+
letterSpacing: "0.014px"
|
|
489
|
+
},
|
|
490
|
+
"sidebar-label": {
|
|
491
|
+
fontFamily: typography.sans,
|
|
492
|
+
fontSize: "12px",
|
|
493
|
+
fontWeight: "500",
|
|
494
|
+
lineHeight: "18px",
|
|
495
|
+
letterSpacing: "0.36px"
|
|
496
|
+
},
|
|
497
|
+
"sidebar-label-strong": {
|
|
498
|
+
fontFamily: typography.sans,
|
|
499
|
+
fontSize: "12px",
|
|
500
|
+
fontWeight: "600",
|
|
501
|
+
lineHeight: "18px",
|
|
502
|
+
letterSpacing: "0.36px"
|
|
503
|
+
},
|
|
504
|
+
"sidebar-body": {
|
|
505
|
+
fontFamily: typography.sans,
|
|
506
|
+
fontSize: "12px",
|
|
507
|
+
fontWeight: "400",
|
|
508
|
+
lineHeight: "18px",
|
|
509
|
+
letterSpacing: "0.012px"
|
|
510
|
+
},
|
|
511
|
+
"sidebar-tag": {
|
|
512
|
+
fontFamily: typography.sans,
|
|
513
|
+
fontSize: "13px",
|
|
514
|
+
fontWeight: "500",
|
|
515
|
+
lineHeight: "20px",
|
|
516
|
+
letterSpacing: "0.013px"
|
|
517
|
+
},
|
|
518
|
+
"encounter-chip": {
|
|
519
|
+
fontFamily: typography.sans,
|
|
520
|
+
fontSize: "13px",
|
|
521
|
+
fontWeight: "500",
|
|
522
|
+
lineHeight: "20px",
|
|
523
|
+
letterSpacing: "0"
|
|
524
|
+
},
|
|
525
|
+
"encounter-history": {
|
|
526
|
+
fontFamily: typography.sans,
|
|
527
|
+
fontSize: "12px",
|
|
528
|
+
fontWeight: "600",
|
|
529
|
+
lineHeight: "18px",
|
|
530
|
+
letterSpacing: "0.012px"
|
|
531
|
+
},
|
|
532
|
+
caption: {
|
|
533
|
+
fontFamily: typography.sans,
|
|
534
|
+
fontSize: "12px",
|
|
535
|
+
fontWeight: "400",
|
|
536
|
+
lineHeight: "16px",
|
|
537
|
+
letterSpacing: "0"
|
|
538
|
+
},
|
|
539
|
+
eyebrow: {
|
|
540
|
+
fontFamily: typography.sans,
|
|
541
|
+
fontSize: "12px",
|
|
542
|
+
fontWeight: "600",
|
|
543
|
+
lineHeight: "16px",
|
|
544
|
+
letterSpacing: "0.08em"
|
|
545
|
+
},
|
|
282
546
|
tiny: {
|
|
283
547
|
fontFamily: typography.sans,
|
|
284
548
|
fontSize: "14px",
|
|
@@ -292,11 +556,32 @@ function createTextStyleScale(typography) {
|
|
|
292
556
|
fontWeight: "400",
|
|
293
557
|
lineHeight: "18px",
|
|
294
558
|
letterSpacing: "0.012px"
|
|
559
|
+
},
|
|
560
|
+
"code-sm": {
|
|
561
|
+
fontFamily: typography.mono,
|
|
562
|
+
fontSize: "13px",
|
|
563
|
+
fontWeight: "400",
|
|
564
|
+
lineHeight: "20px",
|
|
565
|
+
letterSpacing: "0"
|
|
295
566
|
}
|
|
296
567
|
};
|
|
297
568
|
}
|
|
298
569
|
function createSurfaceScale(colors, radii, shadows) {
|
|
299
570
|
return {
|
|
571
|
+
appBackground: {
|
|
572
|
+
background: colors.background,
|
|
573
|
+
borderColor: colors.background,
|
|
574
|
+
borderWidth: "0",
|
|
575
|
+
radius: "0",
|
|
576
|
+
shadow: "none"
|
|
577
|
+
},
|
|
578
|
+
auth: {
|
|
579
|
+
background: colors.background,
|
|
580
|
+
borderColor: colors.background,
|
|
581
|
+
borderWidth: "0",
|
|
582
|
+
radius: radii.xl,
|
|
583
|
+
shadow: "none"
|
|
584
|
+
},
|
|
300
585
|
card: {
|
|
301
586
|
background: colors.card,
|
|
302
587
|
borderColor: colors.subtle,
|
|
@@ -304,11 +589,32 @@ function createSurfaceScale(colors, radii, shadows) {
|
|
|
304
589
|
radius: radii.xl,
|
|
305
590
|
shadow: "none"
|
|
306
591
|
},
|
|
307
|
-
|
|
592
|
+
dataTable: {
|
|
308
593
|
background: colors.card,
|
|
309
594
|
borderColor: colors.subtle,
|
|
310
595
|
borderWidth: "1px",
|
|
311
|
-
radius: radii.
|
|
596
|
+
radius: radii.md,
|
|
597
|
+
shadow: "none"
|
|
598
|
+
},
|
|
599
|
+
dialog: {
|
|
600
|
+
background: colors.card,
|
|
601
|
+
borderColor: colors.subtle,
|
|
602
|
+
borderWidth: "1px",
|
|
603
|
+
radius: radii.xl,
|
|
604
|
+
shadow: "none"
|
|
605
|
+
},
|
|
606
|
+
documentCard: {
|
|
607
|
+
background: colors.card,
|
|
608
|
+
borderColor: colors.subtle,
|
|
609
|
+
borderWidth: "1px",
|
|
610
|
+
radius: radii.md,
|
|
611
|
+
shadow: "none"
|
|
612
|
+
},
|
|
613
|
+
documentCardSelected: {
|
|
614
|
+
background: colors.muted,
|
|
615
|
+
borderColor: colors.subtle,
|
|
616
|
+
borderWidth: "1px",
|
|
617
|
+
radius: radii.md,
|
|
312
618
|
shadow: "none"
|
|
313
619
|
},
|
|
314
620
|
focus: {
|
|
@@ -317,6 +623,102 @@ function createSurfaceScale(colors, radii, shadows) {
|
|
|
317
623
|
borderWidth: "1px",
|
|
318
624
|
radius: radii.sm,
|
|
319
625
|
shadow: shadows.focus
|
|
626
|
+
},
|
|
627
|
+
mainContent: {
|
|
628
|
+
background: colors.background,
|
|
629
|
+
borderColor: colors.background,
|
|
630
|
+
borderWidth: "0",
|
|
631
|
+
radius: "0",
|
|
632
|
+
shadow: "none"
|
|
633
|
+
},
|
|
634
|
+
panel: {
|
|
635
|
+
background: colors.card,
|
|
636
|
+
borderColor: colors.subtle,
|
|
637
|
+
borderWidth: "1px",
|
|
638
|
+
radius: radii.sm,
|
|
639
|
+
shadow: "none"
|
|
640
|
+
},
|
|
641
|
+
proseDialog: {
|
|
642
|
+
background: colors.card,
|
|
643
|
+
borderColor: colors.subtle,
|
|
644
|
+
borderWidth: "1px",
|
|
645
|
+
radius: radii.xl,
|
|
646
|
+
shadow: "none"
|
|
647
|
+
},
|
|
648
|
+
rightPanel: {
|
|
649
|
+
background: colors.background,
|
|
650
|
+
borderColor: colors.subtle,
|
|
651
|
+
borderWidth: "1px",
|
|
652
|
+
radius: radii.xl,
|
|
653
|
+
shadow: "none"
|
|
654
|
+
},
|
|
655
|
+
sidebar: {
|
|
656
|
+
background: colors.background,
|
|
657
|
+
borderColor: colors.subtle,
|
|
658
|
+
borderWidth: "0",
|
|
659
|
+
radius: "0",
|
|
660
|
+
shadow: "none"
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
function createSpacingScale() {
|
|
665
|
+
return {
|
|
666
|
+
space: {
|
|
667
|
+
"0": "0rem",
|
|
668
|
+
"0-5": "0.125rem",
|
|
669
|
+
"1": "0.25rem",
|
|
670
|
+
"1-5": "0.375rem",
|
|
671
|
+
"2": "0.5rem",
|
|
672
|
+
"2-5": "0.625rem",
|
|
673
|
+
"3": "0.75rem",
|
|
674
|
+
"4": "1rem",
|
|
675
|
+
"5": "1.25rem",
|
|
676
|
+
"6": "1.5rem",
|
|
677
|
+
"8": "2rem",
|
|
678
|
+
"10": "2.5rem",
|
|
679
|
+
"12": "3rem",
|
|
680
|
+
"16": "4rem"
|
|
681
|
+
},
|
|
682
|
+
gap: {
|
|
683
|
+
tight: "0.375rem",
|
|
684
|
+
compact: "0.5rem",
|
|
685
|
+
default: "0.75rem",
|
|
686
|
+
comfortable: "1rem",
|
|
687
|
+
section: "2rem",
|
|
688
|
+
page: "3rem"
|
|
689
|
+
},
|
|
690
|
+
rhythm: {
|
|
691
|
+
labelToControl: "0.5rem",
|
|
692
|
+
controlToHelp: "0.5rem",
|
|
693
|
+
titleToDescription: "0.5rem",
|
|
694
|
+
titleToBody: "0.5rem",
|
|
695
|
+
fieldset: "1.5rem",
|
|
696
|
+
fieldsetCompact: "0.75rem",
|
|
697
|
+
group: "1.5rem",
|
|
698
|
+
groupCompact: "1rem",
|
|
699
|
+
paragraphFlow: "1.5rem",
|
|
700
|
+
sectionContent: "2rem"
|
|
701
|
+
},
|
|
702
|
+
measure: {
|
|
703
|
+
reading: "65ch",
|
|
704
|
+
compact: "60ch",
|
|
705
|
+
wide: "72ch"
|
|
706
|
+
},
|
|
707
|
+
control: {
|
|
708
|
+
xs: "2rem",
|
|
709
|
+
sm: "2.25rem",
|
|
710
|
+
md: "2.5rem",
|
|
711
|
+
lg: "2.75rem"
|
|
712
|
+
},
|
|
713
|
+
iconButton: {
|
|
714
|
+
sm: "2rem",
|
|
715
|
+
md: "2.5rem",
|
|
716
|
+
lg: "3rem"
|
|
717
|
+
},
|
|
718
|
+
layout: {
|
|
719
|
+
sidebarWidth: "18.75rem",
|
|
720
|
+
rightRailWidth: "4.625rem",
|
|
721
|
+
proseDialogWidth: "53.125rem"
|
|
320
722
|
}
|
|
321
723
|
};
|
|
322
724
|
}
|
|
@@ -342,6 +744,38 @@ function mergeSurfaceScale(baseScale, overrides) {
|
|
|
342
744
|
])
|
|
343
745
|
);
|
|
344
746
|
}
|
|
747
|
+
function mergeSpacingScale(baseScale, overrides) {
|
|
748
|
+
return {
|
|
749
|
+
space: {
|
|
750
|
+
...baseScale.space,
|
|
751
|
+
...overrides?.space
|
|
752
|
+
},
|
|
753
|
+
gap: {
|
|
754
|
+
...baseScale.gap,
|
|
755
|
+
...overrides?.gap
|
|
756
|
+
},
|
|
757
|
+
rhythm: {
|
|
758
|
+
...baseScale.rhythm,
|
|
759
|
+
...overrides?.rhythm
|
|
760
|
+
},
|
|
761
|
+
measure: {
|
|
762
|
+
...baseScale.measure,
|
|
763
|
+
...overrides?.measure
|
|
764
|
+
},
|
|
765
|
+
control: {
|
|
766
|
+
...baseScale.control,
|
|
767
|
+
...overrides?.control
|
|
768
|
+
},
|
|
769
|
+
iconButton: {
|
|
770
|
+
...baseScale.iconButton,
|
|
771
|
+
...overrides?.iconButton
|
|
772
|
+
},
|
|
773
|
+
layout: {
|
|
774
|
+
...baseScale.layout,
|
|
775
|
+
...overrides?.layout
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
}
|
|
345
779
|
var sofyaColors = createColorScale(sofyaSemanticColorHex);
|
|
346
780
|
var sofyaRadii = {
|
|
347
781
|
sm: "0.5rem",
|
|
@@ -458,7 +892,8 @@ var sofyaTheme = {
|
|
|
458
892
|
shadows: sofyaShadows,
|
|
459
893
|
typography: sharedTypography,
|
|
460
894
|
textStyles: createTextStyleScale(sharedTypography),
|
|
461
|
-
surfaces: createSurfaceScale(sofyaColors, sofyaRadii, sofyaShadows)
|
|
895
|
+
surfaces: createSurfaceScale(sofyaColors, sofyaRadii, sofyaShadows),
|
|
896
|
+
spacing: createSpacingScale()
|
|
462
897
|
};
|
|
463
898
|
var oceanTheme = {
|
|
464
899
|
name: "ocean",
|
|
@@ -467,7 +902,8 @@ var oceanTheme = {
|
|
|
467
902
|
shadows: oceanShadows,
|
|
468
903
|
typography: sharedTypography,
|
|
469
904
|
textStyles: createTextStyleScale(sharedTypography),
|
|
470
|
-
surfaces: createSurfaceScale(oceanColors, oceanRadii, oceanShadows)
|
|
905
|
+
surfaces: createSurfaceScale(oceanColors, oceanRadii, oceanShadows),
|
|
906
|
+
spacing: createSpacingScale()
|
|
471
907
|
};
|
|
472
908
|
var midnightTheme = {
|
|
473
909
|
name: "midnight",
|
|
@@ -476,7 +912,8 @@ var midnightTheme = {
|
|
|
476
912
|
shadows: midnightShadows,
|
|
477
913
|
typography: sharedTypography,
|
|
478
914
|
textStyles: createTextStyleScale(sharedTypography),
|
|
479
|
-
surfaces: createSurfaceScale(midnightColors, midnightRadii, midnightShadows)
|
|
915
|
+
surfaces: createSurfaceScale(midnightColors, midnightRadii, midnightShadows),
|
|
916
|
+
spacing: createSpacingScale()
|
|
480
917
|
};
|
|
481
918
|
var themePresets = {
|
|
482
919
|
sofya: sofyaTheme,
|
|
@@ -500,7 +937,8 @@ function mergeTheme(baseTheme, overrides) {
|
|
|
500
937
|
shadows: { ...baseTheme.shadows },
|
|
501
938
|
typography: { ...baseTheme.typography },
|
|
502
939
|
textStyles: mergeTextStyleScale(baseTheme.textStyles),
|
|
503
|
-
surfaces: mergeSurfaceScale(baseTheme.surfaces)
|
|
940
|
+
surfaces: mergeSurfaceScale(baseTheme.surfaces),
|
|
941
|
+
spacing: mergeSpacingScale(baseTheme.spacing)
|
|
504
942
|
};
|
|
505
943
|
}
|
|
506
944
|
const colors = {
|
|
@@ -528,6 +966,7 @@ function mergeTheme(baseTheme, overrides) {
|
|
|
528
966
|
createSurfaceScale(colors, radii, shadows),
|
|
529
967
|
overrides.surfaces
|
|
530
968
|
);
|
|
969
|
+
const spacing = mergeSpacingScale(createSpacingScale(), overrides.spacing);
|
|
531
970
|
return {
|
|
532
971
|
name: overrides.name ?? baseTheme.name,
|
|
533
972
|
colors,
|
|
@@ -535,7 +974,8 @@ function mergeTheme(baseTheme, overrides) {
|
|
|
535
974
|
shadows,
|
|
536
975
|
typography,
|
|
537
976
|
textStyles,
|
|
538
|
-
surfaces
|
|
977
|
+
surfaces,
|
|
978
|
+
spacing
|
|
539
979
|
};
|
|
540
980
|
}
|
|
541
981
|
function resolveTheme(preset = defaultTheme, overrides) {
|
|
@@ -553,6 +993,71 @@ function themeDecorativeCssVariables(theme) {
|
|
|
553
993
|
"--sofya-logo-soft": `hsl(${theme.colors.primary} / 0.45)`
|
|
554
994
|
};
|
|
555
995
|
}
|
|
996
|
+
function toCssTokenName(name) {
|
|
997
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
998
|
+
}
|
|
999
|
+
function textStyleCssVariables(textStyles) {
|
|
1000
|
+
return Object.fromEntries(
|
|
1001
|
+
sofyaTextStyleNames.flatMap((name) => {
|
|
1002
|
+
const cssName = toCssTokenName(name);
|
|
1003
|
+
const style = textStyles[name];
|
|
1004
|
+
return [
|
|
1005
|
+
[`--sofya-text-${cssName}-font-family`, style.fontFamily],
|
|
1006
|
+
[`--sofya-text-${cssName}-font-size`, style.fontSize],
|
|
1007
|
+
[`--sofya-text-${cssName}-font-weight`, style.fontWeight],
|
|
1008
|
+
[`--sofya-text-${cssName}-line-height`, style.lineHeight],
|
|
1009
|
+
[`--sofya-text-${cssName}-letter-spacing`, style.letterSpacing]
|
|
1010
|
+
];
|
|
1011
|
+
})
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1014
|
+
function surfaceCssVariables(surfaces) {
|
|
1015
|
+
return Object.fromEntries(
|
|
1016
|
+
sofyaSurfaceNames.flatMap((name) => {
|
|
1017
|
+
const cssName = toCssTokenName(name);
|
|
1018
|
+
const surface = surfaces[name];
|
|
1019
|
+
return [
|
|
1020
|
+
[`--sofya-surface-${cssName}-background`, surface.background],
|
|
1021
|
+
[`--sofya-surface-${cssName}-border-color`, surface.borderColor],
|
|
1022
|
+
[`--sofya-surface-${cssName}-border-width`, surface.borderWidth],
|
|
1023
|
+
[`--sofya-surface-${cssName}-radius`, surface.radius],
|
|
1024
|
+
[`--sofya-surface-${cssName}-shadow`, surface.shadow]
|
|
1025
|
+
];
|
|
1026
|
+
})
|
|
1027
|
+
);
|
|
1028
|
+
}
|
|
1029
|
+
function spacingCssVariables(spacing) {
|
|
1030
|
+
return {
|
|
1031
|
+
...Object.fromEntries(
|
|
1032
|
+
sofyaSpaceNames.map((name) => [`--sofya-space-${name}`, spacing.space[name]])
|
|
1033
|
+
),
|
|
1034
|
+
...Object.fromEntries(
|
|
1035
|
+
sofyaGapNames.map((name) => [`--sofya-gap-${name}`, spacing.gap[name]])
|
|
1036
|
+
),
|
|
1037
|
+
...Object.fromEntries(
|
|
1038
|
+
sofyaRhythmNames.map((name) => [
|
|
1039
|
+
`--sofya-rhythm-${toCssTokenName(name)}`,
|
|
1040
|
+
spacing.rhythm[name]
|
|
1041
|
+
])
|
|
1042
|
+
),
|
|
1043
|
+
...Object.fromEntries(
|
|
1044
|
+
sofyaMeasureNames.map((name) => [
|
|
1045
|
+
`--sofya-measure-${name}`,
|
|
1046
|
+
spacing.measure[name]
|
|
1047
|
+
])
|
|
1048
|
+
),
|
|
1049
|
+
"--sofya-control-height-xs": spacing.control.xs,
|
|
1050
|
+
"--sofya-control-height-sm": spacing.control.sm,
|
|
1051
|
+
"--sofya-control-height-md": spacing.control.md,
|
|
1052
|
+
"--sofya-control-height-lg": spacing.control.lg,
|
|
1053
|
+
"--sofya-icon-button-size-sm": spacing.iconButton.sm,
|
|
1054
|
+
"--sofya-icon-button-size-md": spacing.iconButton.md,
|
|
1055
|
+
"--sofya-icon-button-size-lg": spacing.iconButton.lg,
|
|
1056
|
+
"--sofya-layout-sidebar-width": spacing.layout.sidebarWidth,
|
|
1057
|
+
"--sofya-layout-right-rail-width": spacing.layout.rightRailWidth,
|
|
1058
|
+
"--sofya-layout-prose-dialog-width": spacing.layout.proseDialogWidth
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
556
1061
|
function themeToCssVariables(theme) {
|
|
557
1062
|
const textStyles = Object.fromEntries(
|
|
558
1063
|
sofyaTextStyleNames.map((name) => [name, resolveTextStyle(name, theme)])
|
|
@@ -604,56 +1109,9 @@ function themeToCssVariables(theme) {
|
|
|
604
1109
|
"--sofya-font-sans": theme.typography.sans,
|
|
605
1110
|
"--sofya-font-display": theme.typography.display,
|
|
606
1111
|
"--sofya-font-mono": theme.typography.mono,
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
"--sofya-text-h1-line-height": textStyles.h1.lineHeight,
|
|
611
|
-
"--sofya-text-h1-letter-spacing": textStyles.h1.letterSpacing,
|
|
612
|
-
"--sofya-text-h2-font-family": textStyles.h2.fontFamily,
|
|
613
|
-
"--sofya-text-h2-font-size": textStyles.h2.fontSize,
|
|
614
|
-
"--sofya-text-h2-font-weight": textStyles.h2.fontWeight,
|
|
615
|
-
"--sofya-text-h2-line-height": textStyles.h2.lineHeight,
|
|
616
|
-
"--sofya-text-h2-letter-spacing": textStyles.h2.letterSpacing,
|
|
617
|
-
"--sofya-text-h3-font-family": textStyles.h3.fontFamily,
|
|
618
|
-
"--sofya-text-h3-font-size": textStyles.h3.fontSize,
|
|
619
|
-
"--sofya-text-h3-font-weight": textStyles.h3.fontWeight,
|
|
620
|
-
"--sofya-text-h3-line-height": textStyles.h3.lineHeight,
|
|
621
|
-
"--sofya-text-h3-letter-spacing": textStyles.h3.letterSpacing,
|
|
622
|
-
"--sofya-text-h4-font-family": textStyles.h4.fontFamily,
|
|
623
|
-
"--sofya-text-h4-font-size": textStyles.h4.fontSize,
|
|
624
|
-
"--sofya-text-h4-font-weight": textStyles.h4.fontWeight,
|
|
625
|
-
"--sofya-text-h4-line-height": textStyles.h4.lineHeight,
|
|
626
|
-
"--sofya-text-h4-letter-spacing": textStyles.h4.letterSpacing,
|
|
627
|
-
"--sofya-text-h5-font-family": textStyles.h5.fontFamily,
|
|
628
|
-
"--sofya-text-h5-font-size": textStyles.h5.fontSize,
|
|
629
|
-
"--sofya-text-h5-font-weight": textStyles.h5.fontWeight,
|
|
630
|
-
"--sofya-text-h5-line-height": textStyles.h5.lineHeight,
|
|
631
|
-
"--sofya-text-h5-letter-spacing": textStyles.h5.letterSpacing,
|
|
632
|
-
"--sofya-text-body-font-family": textStyles.body.fontFamily,
|
|
633
|
-
"--sofya-text-body-font-size": textStyles.body.fontSize,
|
|
634
|
-
"--sofya-text-body-font-weight": textStyles.body.fontWeight,
|
|
635
|
-
"--sofya-text-body-line-height": textStyles.body.lineHeight,
|
|
636
|
-
"--sofya-text-body-letter-spacing": textStyles.body.letterSpacing,
|
|
637
|
-
"--sofya-text-tiny-font-family": textStyles.tiny.fontFamily,
|
|
638
|
-
"--sofya-text-tiny-font-size": textStyles.tiny.fontSize,
|
|
639
|
-
"--sofya-text-tiny-font-weight": textStyles.tiny.fontWeight,
|
|
640
|
-
"--sofya-text-tiny-line-height": textStyles.tiny.lineHeight,
|
|
641
|
-
"--sofya-text-tiny-letter-spacing": textStyles.tiny.letterSpacing,
|
|
642
|
-
"--sofya-surface-card-background": surfaces.card.background,
|
|
643
|
-
"--sofya-surface-card-border-color": surfaces.card.borderColor,
|
|
644
|
-
"--sofya-surface-card-border-width": surfaces.card.borderWidth,
|
|
645
|
-
"--sofya-surface-card-radius": surfaces.card.radius,
|
|
646
|
-
"--sofya-surface-card-shadow": surfaces.card.shadow,
|
|
647
|
-
"--sofya-surface-panel-background": surfaces.panel.background,
|
|
648
|
-
"--sofya-surface-panel-border-color": surfaces.panel.borderColor,
|
|
649
|
-
"--sofya-surface-panel-border-width": surfaces.panel.borderWidth,
|
|
650
|
-
"--sofya-surface-panel-radius": surfaces.panel.radius,
|
|
651
|
-
"--sofya-surface-panel-shadow": surfaces.panel.shadow,
|
|
652
|
-
"--sofya-surface-focus-background": surfaces.focus.background,
|
|
653
|
-
"--sofya-surface-focus-border-color": surfaces.focus.borderColor,
|
|
654
|
-
"--sofya-surface-focus-border-width": surfaces.focus.borderWidth,
|
|
655
|
-
"--sofya-surface-focus-radius": surfaces.focus.radius,
|
|
656
|
-
"--sofya-surface-focus-shadow": surfaces.focus.shadow
|
|
1112
|
+
...textStyleCssVariables(textStyles),
|
|
1113
|
+
...surfaceCssVariables(surfaces),
|
|
1114
|
+
...spacingCssVariables(theme.spacing)
|
|
657
1115
|
};
|
|
658
1116
|
}
|
|
659
1117
|
function createWhitelabelTheme(overrides, preset = defaultTheme) {
|
|
@@ -672,7 +1130,11 @@ function createWhitelabelTheme(overrides, preset = defaultTheme) {
|
|
|
672
1130
|
resolveTheme,
|
|
673
1131
|
sofyaBrandPalette,
|
|
674
1132
|
sofyaColorPalette,
|
|
1133
|
+
sofyaGapNames,
|
|
1134
|
+
sofyaMeasureNames,
|
|
1135
|
+
sofyaRhythmNames,
|
|
675
1136
|
sofyaSemanticColorHex,
|
|
1137
|
+
sofyaSpaceNames,
|
|
676
1138
|
sofyaSurfaceNames,
|
|
677
1139
|
sofyaTextStyleNames,
|
|
678
1140
|
themePresetNames,
|