@digdir/designsystemet 1.11.1 → 1.12.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/bin/config.js +24 -4
- package/dist/bin/designsystemet.js +909 -1220
- package/dist/src/colors/index.js +27 -1
- package/dist/src/colors/types.d.ts +24 -21
- package/dist/src/colors/types.d.ts.map +1 -1
- package/dist/src/colors/types.js +27 -0
- package/dist/src/config.js +24 -4
- package/dist/src/index.js +815 -1119
- package/dist/src/scripts/createJsonSchema.js +24 -4
- package/dist/src/scripts/update-preview-tokens.d.ts.map +1 -1
- package/dist/src/scripts/update-preview-tokens.js +1356 -1662
- package/dist/src/tokens/build.js +4 -5
- package/dist/src/tokens/create/generators/$designsystemet.js +4 -5
- package/dist/src/tokens/create/generators/$metadata.d.ts +2 -2
- package/dist/src/tokens/create/generators/$metadata.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/$metadata.js +3 -7
- package/dist/src/tokens/create/generators/$themes.d.ts +17 -2
- package/dist/src/tokens/create/generators/$themes.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/$themes.js +3 -3
- package/dist/src/tokens/create/generators/primitives/color-scheme.d.ts +5 -0
- package/dist/src/tokens/create/generators/primitives/color-scheme.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/{color.js → primitives/color-scheme.js} +29 -6
- package/dist/src/tokens/create/generators/primitives/globals.d.ts +3 -0
- package/dist/src/tokens/create/generators/primitives/globals.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/primitives/globals.js +148 -0
- package/dist/src/tokens/create/generators/primitives/size.d.ts +4 -0
- package/dist/src/tokens/create/generators/primitives/size.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/primitives/size.js +157 -0
- package/dist/src/tokens/create/generators/primitives/typography.d.ts +4 -0
- package/dist/src/tokens/create/generators/primitives/typography.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/primitives/typography.js +220 -0
- package/dist/src/tokens/create/generators/semantic/color-modes.d.ts +8 -0
- package/dist/src/tokens/create/generators/semantic/color-modes.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/semantic/color-modes.js +61 -0
- package/dist/src/tokens/create/generators/semantic/color.d.ts +5 -0
- package/dist/src/tokens/create/generators/semantic/color.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/{semantic.js → semantic/color.js} +50 -194
- package/dist/src/tokens/create/generators/semantic/style.d.ts +3 -0
- package/dist/src/tokens/create/generators/semantic/style.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/semantic/style.js +384 -0
- package/dist/src/tokens/create/generators/{theme.d.ts → themes/theme.d.ts} +1 -1
- package/dist/src/tokens/create/generators/themes/theme.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/{theme.js → themes/theme.js} +87 -129
- package/dist/src/tokens/create/write.d.ts.map +1 -1
- package/dist/src/tokens/create/write.js +13 -17
- package/dist/src/tokens/create.d.ts +1 -1
- package/dist/src/tokens/create.d.ts.map +1 -1
- package/dist/src/tokens/create.js +1340 -1647
- package/dist/src/tokens/format.d.ts.map +1 -1
- package/dist/src/tokens/format.js +1360 -1667
- package/dist/src/tokens/index.js +1360 -1667
- package/dist/src/tokens/process/output/declarations.js +4 -5
- package/dist/src/tokens/process/output/theme.js +4 -5
- package/dist/src/tokens/types.d.ts +7 -0
- package/dist/src/tokens/types.d.ts.map +1 -1
- package/package.json +5 -6
- package/dist/color.base.template-Z7YWN2TF.json +0 -22
- package/dist/color.template-LMPUQ72A.json +0 -66
- package/dist/color.template-XQNSHLTU.json +0 -66
- package/dist/global-Y35YADVH.json +0 -100
- package/dist/globals-76VAFMDF.json +0 -143
- package/dist/large-CIIHO7AY.json +0 -96
- package/dist/large-UUOZ6DYI.json +0 -16
- package/dist/medium-OQ7S7P4P.json +0 -16
- package/dist/medium-VSB2S4X3.json +0 -96
- package/dist/small-AEXJ6U7Z.json +0 -96
- package/dist/small-ZY4KOJWX.json +0 -16
- package/dist/src/scripts/update-template.d.ts +0 -2
- package/dist/src/scripts/update-template.d.ts.map +0 -1
- package/dist/src/scripts/update-template.js +0 -1366
- package/dist/src/tokens/create/defaults.d.ts +0 -7
- package/dist/src/tokens/create/defaults.d.ts.map +0 -1
- package/dist/src/tokens/create/defaults.js +0 -998
- package/dist/src/tokens/create/generators/color.d.ts +0 -5
- package/dist/src/tokens/create/generators/color.d.ts.map +0 -1
- package/dist/src/tokens/create/generators/semantic.d.ts +0 -32
- package/dist/src/tokens/create/generators/semantic.d.ts.map +0 -1
- package/dist/src/tokens/create/generators/theme.d.ts.map +0 -1
- package/dist/src/tokens/create/generators/typography.d.ts +0 -3
- package/dist/src/tokens/create/generators/typography.d.ts.map +0 -1
- package/dist/src/tokens/create/generators/typography.js +0 -33
- package/dist/src/tokens/template/design-tokens/primitives/globals.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/size/global.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/size/large.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/size/medium.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/size/small.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/large.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/medium.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/small.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/typography/typography.template.js +0 -5
- package/dist/src/tokens/template/design-tokens/semantic/color.base.template.js +0 -5
- package/dist/src/tokens/template/design-tokens/semantic/color.template.js +0 -5
- package/dist/src/tokens/template/design-tokens/semantic/modes/color.template.js +0 -5
- package/dist/src/tokens/template/design-tokens/semantic/style.js +0 -5
- package/dist/src/tokens/template/design-tokens/themes/theme.base.template.js +0 -5
- package/dist/src/tokens/template/design-tokens/themes/theme.template.js +0 -5
- package/dist/style-FP5XVCUD.json +0 -378
- package/dist/theme.base.template-Y4RMFBQY.json +0 -55
- package/dist/theme.template-CTQRNOMO.json +0 -66
- package/dist/typography.template-4N5YLH7F.json +0 -22
|
@@ -199,9 +199,9 @@ async function createHash(text, algo = "SHA-1") {
|
|
|
199
199
|
(byte) => byte.toString(16).padStart(2, "0")
|
|
200
200
|
).join("");
|
|
201
201
|
}
|
|
202
|
-
async function generate$Themes(colorSchemes, themes, colors) {
|
|
202
|
+
async function generate$Themes(colorSchemes, themes, colors, sizeModes2) {
|
|
203
203
|
return [
|
|
204
|
-
...generateSizeGroup(),
|
|
204
|
+
...generateSizeGroup(sizeModes2),
|
|
205
205
|
...await generateThemesGroup(themes),
|
|
206
206
|
...generateTypographyGroup(themes),
|
|
207
207
|
...generateColorSchemesGroup(colorSchemes, themes),
|
|
@@ -210,7 +210,7 @@ async function generate$Themes(colorSchemes, themes, colors) {
|
|
|
210
210
|
...await generateColorGroup("support", colors)
|
|
211
211
|
];
|
|
212
212
|
}
|
|
213
|
-
function generateSizeGroup() {
|
|
213
|
+
function generateSizeGroup(_sizes) {
|
|
214
214
|
return [
|
|
215
215
|
{
|
|
216
216
|
id: "8b2c8cc86611a34b135cb22948666779361fd729",
|
|
@@ -357,1662 +357,1501 @@ function generateTypographyGroup(themes) {
|
|
|
357
357
|
];
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
-
// src/tokens/create/
|
|
361
|
-
import * as
|
|
360
|
+
// src/tokens/create/generators/primitives/color-scheme.ts
|
|
361
|
+
import * as R4 from "ramda";
|
|
362
362
|
|
|
363
|
-
// src/
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
363
|
+
// src/colors/colorMetadata.ts
|
|
364
|
+
import * as R from "ramda";
|
|
365
|
+
var baseColors = {
|
|
366
|
+
info: "#0A71C0",
|
|
367
|
+
success: "#068718",
|
|
368
|
+
warning: "#EA9B1B",
|
|
369
|
+
danger: "#C01B1B"
|
|
370
|
+
};
|
|
371
|
+
var dsLinkColor = "#663299";
|
|
372
|
+
var colorMetadata = {
|
|
373
|
+
"background-default": {
|
|
374
|
+
number: 1,
|
|
375
|
+
name: "background-default",
|
|
376
|
+
group: "background",
|
|
377
|
+
displayName: "Background Default",
|
|
378
|
+
description: {
|
|
379
|
+
long: "Background Default er den mest n\xF8ytrale bakgrunnsfargen.",
|
|
380
|
+
short: "Standard bakgrunnsfarge."
|
|
369
381
|
},
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
382
|
+
luminance: {
|
|
383
|
+
light: 1,
|
|
384
|
+
dark: 9e-3,
|
|
385
|
+
contrast: 1e-3
|
|
373
386
|
}
|
|
374
387
|
},
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
blur: "1",
|
|
384
|
-
spread: "0"
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
x: "0",
|
|
388
|
-
y: "1",
|
|
389
|
-
blur: "2",
|
|
390
|
-
spread: "0",
|
|
391
|
-
color: "rgba(0,0,0,0.12)"
|
|
392
|
-
}
|
|
393
|
-
]
|
|
388
|
+
"background-tinted": {
|
|
389
|
+
number: 2,
|
|
390
|
+
name: "background-tinted",
|
|
391
|
+
group: "background",
|
|
392
|
+
displayName: "Background Tinted",
|
|
393
|
+
description: {
|
|
394
|
+
long: "Background Tinted er en bakgrunnsfarge som har et hint av farge i seg.",
|
|
395
|
+
short: "Bakgrunn med et hint av farge i seg."
|
|
394
396
|
},
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
blur: "2",
|
|
410
|
-
spread: "0"
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
x: "0",
|
|
414
|
-
y: "2",
|
|
415
|
-
blur: "4",
|
|
416
|
-
spread: "0",
|
|
417
|
-
color: "rgba(0,0,0,0.1)"
|
|
418
|
-
}
|
|
419
|
-
]
|
|
397
|
+
luminance: {
|
|
398
|
+
light: 0.9,
|
|
399
|
+
dark: 0.014,
|
|
400
|
+
contrast: 65e-4
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
"surface-default": {
|
|
404
|
+
number: 3,
|
|
405
|
+
name: "surface-default",
|
|
406
|
+
group: "surface",
|
|
407
|
+
displayName: "Surface Default",
|
|
408
|
+
description: {
|
|
409
|
+
long: "Surface Default brukes p\xE5 flater som ligger opp\xE5 bakgrunnsfargene. Dette er den mest n\xF8ytrale surface fargen.",
|
|
410
|
+
short: "Standardfarge for overflater / komponenter."
|
|
420
411
|
},
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
blur: "4",
|
|
436
|
-
spread: "0"
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
x: "0",
|
|
440
|
-
y: "4",
|
|
441
|
-
blur: "8",
|
|
442
|
-
spread: "0",
|
|
443
|
-
color: "rgba(0,0,0,0.12)"
|
|
444
|
-
}
|
|
445
|
-
]
|
|
412
|
+
luminance: {
|
|
413
|
+
light: 1,
|
|
414
|
+
dark: 0.021,
|
|
415
|
+
contrast: 0.015
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
"surface-tinted": {
|
|
419
|
+
number: 4,
|
|
420
|
+
name: "surface-tinted",
|
|
421
|
+
group: "surface",
|
|
422
|
+
displayName: "Surface Tinted",
|
|
423
|
+
description: {
|
|
424
|
+
long: "Surface Tinted brukes p\xE5 flater som ligger opp\xE5 bakgrunnsfargene. Denne har et hint av farge i seg.",
|
|
425
|
+
short: "Overflater / komponenter med et hint av farge i seg."
|
|
446
426
|
},
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
blur: "5",
|
|
462
|
-
spread: "0"
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
x: "0",
|
|
466
|
-
y: "6",
|
|
467
|
-
blur: "12",
|
|
468
|
-
spread: "0",
|
|
469
|
-
color: "rgba(0,0,0,0.14)"
|
|
470
|
-
}
|
|
471
|
-
]
|
|
427
|
+
luminance: {
|
|
428
|
+
light: 0.81,
|
|
429
|
+
dark: 0.027,
|
|
430
|
+
contrast: 0.015
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
"surface-hover": {
|
|
434
|
+
number: 5,
|
|
435
|
+
name: "surface-hover",
|
|
436
|
+
group: "surface",
|
|
437
|
+
displayName: "Surface Hover",
|
|
438
|
+
description: {
|
|
439
|
+
long: "Surface Hover brukes p\xE5 interaktive flater som ligger opp\xE5 bakgrunnsfargene i en hover state.",
|
|
440
|
+
short: "Hover-farge til overflater / komponenter."
|
|
472
441
|
},
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
color: "rgba(0,0,0,0.12)",
|
|
478
|
-
x: "0",
|
|
479
|
-
y: "0",
|
|
480
|
-
blur: "1",
|
|
481
|
-
spread: "0"
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
color: "rgba(0,0,0,0.16)",
|
|
485
|
-
x: "0",
|
|
486
|
-
y: "4",
|
|
487
|
-
blur: "8",
|
|
488
|
-
spread: "0"
|
|
489
|
-
},
|
|
490
|
-
{
|
|
491
|
-
x: "0",
|
|
492
|
-
y: "12",
|
|
493
|
-
blur: "24",
|
|
494
|
-
spread: "0",
|
|
495
|
-
color: "rgba(0,0,0,0.16)"
|
|
496
|
-
}
|
|
497
|
-
]
|
|
442
|
+
luminance: {
|
|
443
|
+
light: 0.7,
|
|
444
|
+
dark: 0.036,
|
|
445
|
+
contrast: 0.028
|
|
498
446
|
}
|
|
499
447
|
},
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
448
|
+
"surface-active": {
|
|
449
|
+
number: 6,
|
|
450
|
+
name: "surface-active",
|
|
451
|
+
group: "surface",
|
|
452
|
+
displayName: "Surface Active",
|
|
453
|
+
description: {
|
|
454
|
+
long: "Surface Active brukes p\xE5 interaktive flater som ligger opp\xE5 bakgrunnsfargene i en active state.",
|
|
455
|
+
short: "Active-farge til overflater / komponenter."
|
|
456
|
+
},
|
|
457
|
+
luminance: {
|
|
458
|
+
light: 0.59,
|
|
459
|
+
dark: 0.056,
|
|
460
|
+
contrast: 0.045
|
|
504
461
|
}
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
462
|
+
},
|
|
463
|
+
"border-subtle": {
|
|
464
|
+
number: 7,
|
|
465
|
+
name: "border-subtle",
|
|
466
|
+
group: "border",
|
|
467
|
+
displayName: "Border Subtle",
|
|
468
|
+
description: {
|
|
469
|
+
long: "Border Subtle er den lyseste border-fargen og brukes for \xE5 skille elementer fra hverandre.",
|
|
470
|
+
short: "Border-farge med lav kontrast til dekorativ bruk (skillelinjer)."
|
|
514
471
|
},
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
472
|
+
luminance: {
|
|
473
|
+
light: 0.5,
|
|
474
|
+
dark: 0.08,
|
|
475
|
+
contrast: 0.26
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
"border-default": {
|
|
479
|
+
number: 8,
|
|
480
|
+
name: "border-default",
|
|
481
|
+
group: "border",
|
|
482
|
+
displayName: "Border Default",
|
|
483
|
+
description: {
|
|
484
|
+
long: "Border Default er en border-farge som brukes n\xE5r man \xF8nsker god kontrast mot bakgrunnsfargene.",
|
|
485
|
+
short: "Standard border-farge til skjemakomponenter og meningsb\xE6rende elementer."
|
|
518
486
|
},
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
"3": {
|
|
524
|
-
$type: "dimension",
|
|
525
|
-
$value: "floor({_size.unit} * 3)"
|
|
526
|
-
},
|
|
527
|
-
"4": {
|
|
528
|
-
$type: "dimension",
|
|
529
|
-
$value: "floor({_size.unit} * 4)"
|
|
530
|
-
},
|
|
531
|
-
"5": {
|
|
532
|
-
$type: "dimension",
|
|
533
|
-
$value: "floor({_size.unit} * 5)"
|
|
534
|
-
},
|
|
535
|
-
"6": {
|
|
536
|
-
$type: "dimension",
|
|
537
|
-
$value: "floor({_size.unit} * 6)"
|
|
538
|
-
},
|
|
539
|
-
"7": {
|
|
540
|
-
$type: "dimension",
|
|
541
|
-
$value: "floor({_size.unit} * 7)"
|
|
542
|
-
},
|
|
543
|
-
"8": {
|
|
544
|
-
$type: "dimension",
|
|
545
|
-
$value: "floor({_size.unit} * 8)"
|
|
546
|
-
},
|
|
547
|
-
"9": {
|
|
548
|
-
$type: "dimension",
|
|
549
|
-
$value: "floor({_size.unit} * 9)"
|
|
550
|
-
},
|
|
551
|
-
"10": {
|
|
552
|
-
$type: "dimension",
|
|
553
|
-
$value: "floor({_size.unit} * 10)"
|
|
554
|
-
},
|
|
555
|
-
"11": {
|
|
556
|
-
$type: "dimension",
|
|
557
|
-
$value: "floor({_size.unit} * 11)"
|
|
558
|
-
},
|
|
559
|
-
"12": {
|
|
560
|
-
$type: "dimension",
|
|
561
|
-
$value: "floor({_size.unit} * 12)"
|
|
562
|
-
},
|
|
563
|
-
"13": {
|
|
564
|
-
$type: "dimension",
|
|
565
|
-
$value: "floor({_size.unit} * 13)"
|
|
566
|
-
},
|
|
567
|
-
"14": {
|
|
568
|
-
$type: "dimension",
|
|
569
|
-
$value: "floor({_size.unit} * 14)"
|
|
570
|
-
},
|
|
571
|
-
"15": {
|
|
572
|
-
$type: "dimension",
|
|
573
|
-
$value: "floor({_size.unit} * 15)"
|
|
574
|
-
},
|
|
575
|
-
"18": {
|
|
576
|
-
$type: "dimension",
|
|
577
|
-
$value: "floor({_size.unit} * 18)"
|
|
578
|
-
},
|
|
579
|
-
"22": {
|
|
580
|
-
$type: "dimension",
|
|
581
|
-
$value: "floor({_size.unit} * 22)"
|
|
582
|
-
},
|
|
583
|
-
"26": {
|
|
584
|
-
$type: "dimension",
|
|
585
|
-
$value: "floor({_size.unit} * 26)"
|
|
586
|
-
},
|
|
587
|
-
"30": {
|
|
588
|
-
$type: "dimension",
|
|
589
|
-
$value: "floor({_size.unit} * 30)"
|
|
590
|
-
},
|
|
591
|
-
"mode-font-size": {
|
|
592
|
-
$type: "number",
|
|
593
|
-
$value: "{size._mode-font-size}"
|
|
594
|
-
},
|
|
595
|
-
base: {
|
|
596
|
-
$type: "number",
|
|
597
|
-
$value: "{size._base}"
|
|
598
|
-
},
|
|
599
|
-
step: {
|
|
600
|
-
$type: "number",
|
|
601
|
-
$value: "{size._step}"
|
|
602
|
-
},
|
|
603
|
-
unit: {
|
|
604
|
-
$type: "number",
|
|
605
|
-
$value: "{_size.step} / {_size.base} * {_size.mode-font-size}"
|
|
487
|
+
luminance: {
|
|
488
|
+
light: 0.19,
|
|
489
|
+
dark: 0.22,
|
|
490
|
+
contrast: 0.4
|
|
606
491
|
}
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
},
|
|
617
|
-
_base: {
|
|
618
|
-
$type: "dimension",
|
|
619
|
-
$value: "18"
|
|
492
|
+
},
|
|
493
|
+
"border-strong": {
|
|
494
|
+
number: 9,
|
|
495
|
+
name: "border-strong",
|
|
496
|
+
group: "border",
|
|
497
|
+
displayName: "Border Strong",
|
|
498
|
+
description: {
|
|
499
|
+
long: "Border Strong er den m\xF8rkeste border-fargen og brukes n\xE5r man \xF8nsker en veldig tydelig og sterk border.",
|
|
500
|
+
short: "Border-farge med h\xF8y kontrast for ekstra synlighet."
|
|
620
501
|
},
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
502
|
+
luminance: {
|
|
503
|
+
light: 0.11,
|
|
504
|
+
dark: 0.39,
|
|
505
|
+
contrast: 0.6
|
|
624
506
|
}
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
},
|
|
635
|
-
_base: {
|
|
636
|
-
$type: "dimension",
|
|
637
|
-
$value: "18"
|
|
507
|
+
},
|
|
508
|
+
"text-subtle": {
|
|
509
|
+
number: 10,
|
|
510
|
+
name: "text-subtle",
|
|
511
|
+
group: "text",
|
|
512
|
+
displayName: "Text Subtle",
|
|
513
|
+
description: {
|
|
514
|
+
long: "Text Subtle er den lyseste tekstfargen og brukes p\xE5 tekst som skal v\xE6re litt mindre synlig eller for \xE5 skape variasjon i typografien.",
|
|
515
|
+
short: "Tekst- og ikonfarge med lavere kontrast."
|
|
638
516
|
},
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
517
|
+
luminance: {
|
|
518
|
+
light: 0.11,
|
|
519
|
+
dark: 0.39,
|
|
520
|
+
contrast: 0.57
|
|
642
521
|
}
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
},
|
|
653
|
-
_base: {
|
|
654
|
-
$type: "dimension",
|
|
655
|
-
$value: "18"
|
|
522
|
+
},
|
|
523
|
+
"text-default": {
|
|
524
|
+
number: 11,
|
|
525
|
+
name: "text-default",
|
|
526
|
+
group: "text",
|
|
527
|
+
displayName: "Text Default",
|
|
528
|
+
description: {
|
|
529
|
+
long: "Text Default er den m\xF8rkeste tekstfargen og brukes p\xE5 tekst som skal v\xE6re mest synlig. Denne fargen b\xF8r brukes p\xE5 mesteparten av teksten p\xE5 en side.",
|
|
530
|
+
short: "Tekst- og ikonfarge med h\xF8y kontrast og god synlighet."
|
|
656
531
|
},
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
|
|
664
|
-
// src/tokens/template/design-tokens/primitives/modes/typography/size/large.json with { type: 'json' }
|
|
665
|
-
var large_default2 = {
|
|
666
|
-
"line-height": {
|
|
667
|
-
sm: {
|
|
668
|
-
$type: "lineHeights",
|
|
669
|
-
$value: "130%"
|
|
670
|
-
},
|
|
671
|
-
md: {
|
|
672
|
-
$type: "lineHeights",
|
|
673
|
-
$value: "150%"
|
|
674
|
-
},
|
|
675
|
-
lg: {
|
|
676
|
-
$type: "lineHeights",
|
|
677
|
-
$value: "170%"
|
|
532
|
+
luminance: {
|
|
533
|
+
light: 0.0245,
|
|
534
|
+
dark: 0.84,
|
|
535
|
+
contrast: 0.86
|
|
678
536
|
}
|
|
679
537
|
},
|
|
680
|
-
"
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
},
|
|
689
|
-
"3": {
|
|
690
|
-
$type: "fontSizes",
|
|
691
|
-
$value: "18"
|
|
692
|
-
},
|
|
693
|
-
"4": {
|
|
694
|
-
$type: "fontSizes",
|
|
695
|
-
$value: "21"
|
|
696
|
-
},
|
|
697
|
-
"5": {
|
|
698
|
-
$type: "fontSizes",
|
|
699
|
-
$value: "24"
|
|
700
|
-
},
|
|
701
|
-
"6": {
|
|
702
|
-
$type: "fontSizes",
|
|
703
|
-
$value: "30"
|
|
704
|
-
},
|
|
705
|
-
"7": {
|
|
706
|
-
$type: "fontSizes",
|
|
707
|
-
$value: "36"
|
|
708
|
-
},
|
|
709
|
-
"8": {
|
|
710
|
-
$type: "fontSizes",
|
|
711
|
-
$value: "48"
|
|
712
|
-
},
|
|
713
|
-
"9": {
|
|
714
|
-
$type: "fontSizes",
|
|
715
|
-
$value: "60"
|
|
538
|
+
"base-default": {
|
|
539
|
+
number: 12,
|
|
540
|
+
name: "base-default",
|
|
541
|
+
group: "base",
|
|
542
|
+
displayName: "Base Default",
|
|
543
|
+
description: {
|
|
544
|
+
long: "Base Default fargen f\xE5r den samme hex koden som fargen som er valgt i verkt\xF8yet. Brukes ofte som farge p\xE5 viktige elementer og p\xE5 flater som skal fange brukerens oppmerksomhet.",
|
|
545
|
+
short: "Standardfarge for solide bakgrunner."
|
|
716
546
|
},
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
547
|
+
luminance: {
|
|
548
|
+
light: 1,
|
|
549
|
+
dark: 1,
|
|
550
|
+
contrast: 1
|
|
720
551
|
}
|
|
721
552
|
},
|
|
722
|
-
"
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
},
|
|
731
|
-
"3": {
|
|
732
|
-
$type: "letterSpacing",
|
|
733
|
-
$value: "-0.25%"
|
|
734
|
-
},
|
|
735
|
-
"4": {
|
|
736
|
-
$type: "letterSpacing",
|
|
737
|
-
$value: "-0.15%"
|
|
738
|
-
},
|
|
739
|
-
"5": {
|
|
740
|
-
$type: "letterSpacing",
|
|
741
|
-
$value: "0%"
|
|
553
|
+
"base-hover": {
|
|
554
|
+
number: 13,
|
|
555
|
+
name: "base-hover",
|
|
556
|
+
group: "base",
|
|
557
|
+
displayName: "Base Hover",
|
|
558
|
+
description: {
|
|
559
|
+
long: "Base Hover brukes som hover farge p\xE5 elementer som bruker Base Default fargen.",
|
|
560
|
+
short: "Hover-farge for solide bakgrunner."
|
|
742
561
|
},
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
562
|
+
luminance: {
|
|
563
|
+
light: 1,
|
|
564
|
+
dark: 1,
|
|
565
|
+
contrast: 1
|
|
566
|
+
}
|
|
567
|
+
},
|
|
568
|
+
"base-active": {
|
|
569
|
+
number: 14,
|
|
570
|
+
name: "base-active",
|
|
571
|
+
group: "base",
|
|
572
|
+
displayName: "Base Active",
|
|
573
|
+
description: {
|
|
574
|
+
long: "Base Active brukes som active farge p\xE5 elementer som bruker Base Default fargen.",
|
|
575
|
+
short: "Active-farge for solide bakgrunner."
|
|
746
576
|
},
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
577
|
+
luminance: {
|
|
578
|
+
light: 1,
|
|
579
|
+
dark: 1,
|
|
580
|
+
contrast: 1
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
"base-contrast-subtle": {
|
|
584
|
+
number: 15,
|
|
585
|
+
name: "base-contrast-subtle",
|
|
586
|
+
group: "base",
|
|
587
|
+
displayName: "Contrast Subtle",
|
|
588
|
+
description: {
|
|
589
|
+
long: "Contrast Subtle brukes som en viktig meningsb\xE6rende farge opp\xE5 Base Default fargen.",
|
|
590
|
+
short: "Farge med god kontrast mot Base-default."
|
|
750
591
|
},
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
592
|
+
luminance: {
|
|
593
|
+
light: 1,
|
|
594
|
+
dark: 1,
|
|
595
|
+
contrast: 1
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
"base-contrast-default": {
|
|
599
|
+
number: 16,
|
|
600
|
+
name: "base-contrast-default",
|
|
601
|
+
group: "base",
|
|
602
|
+
displayName: "Contrast Default",
|
|
603
|
+
description: {
|
|
604
|
+
long: "Contrast Default brukes som en viktig meningsb\xE6rende farge opp\xE5 alle Base fargane.",
|
|
605
|
+
short: "Farge med god kontrast mot Base-default og Base-hover."
|
|
754
606
|
},
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
607
|
+
luminance: {
|
|
608
|
+
light: 1,
|
|
609
|
+
dark: 1,
|
|
610
|
+
contrast: 1
|
|
758
611
|
}
|
|
759
612
|
}
|
|
760
613
|
};
|
|
614
|
+
var colorMetadataByNumber = R.indexBy((metadata) => metadata.number, Object.values(colorMetadata));
|
|
615
|
+
var colorNames = Object.keys(colorMetadata);
|
|
616
|
+
var baseColorNames = Object.keys(baseColors);
|
|
761
617
|
|
|
762
|
-
// src/
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
$value: "12"
|
|
782
|
-
},
|
|
783
|
-
"2": {
|
|
784
|
-
$type: "fontSizes",
|
|
785
|
-
$value: "14"
|
|
786
|
-
},
|
|
787
|
-
"3": {
|
|
788
|
-
$type: "fontSizes",
|
|
789
|
-
$value: "16"
|
|
790
|
-
},
|
|
791
|
-
"4": {
|
|
792
|
-
$type: "fontSizes",
|
|
793
|
-
$value: "18"
|
|
794
|
-
},
|
|
795
|
-
"5": {
|
|
796
|
-
$type: "fontSizes",
|
|
797
|
-
$value: "21"
|
|
798
|
-
},
|
|
799
|
-
"6": {
|
|
800
|
-
$type: "fontSizes",
|
|
801
|
-
$value: "24"
|
|
802
|
-
},
|
|
803
|
-
"7": {
|
|
804
|
-
$type: "fontSizes",
|
|
805
|
-
$value: "30"
|
|
806
|
-
},
|
|
807
|
-
"8": {
|
|
808
|
-
$type: "fontSizes",
|
|
809
|
-
$value: "36"
|
|
810
|
-
},
|
|
811
|
-
"9": {
|
|
812
|
-
$type: "fontSizes",
|
|
813
|
-
$value: "48"
|
|
814
|
-
},
|
|
815
|
-
"10": {
|
|
816
|
-
$type: "fontSizes",
|
|
817
|
-
$value: "60"
|
|
818
|
-
}
|
|
819
|
-
},
|
|
820
|
-
"letter-spacing": {
|
|
821
|
-
"1": {
|
|
822
|
-
$type: "letterSpacing",
|
|
823
|
-
$value: "-1%"
|
|
824
|
-
},
|
|
825
|
-
"2": {
|
|
826
|
-
$type: "letterSpacing",
|
|
827
|
-
$value: "-0.5%"
|
|
828
|
-
},
|
|
829
|
-
"3": {
|
|
830
|
-
$type: "letterSpacing",
|
|
831
|
-
$value: "-0.25%"
|
|
832
|
-
},
|
|
833
|
-
"4": {
|
|
834
|
-
$type: "letterSpacing",
|
|
835
|
-
$value: "-0.15%"
|
|
836
|
-
},
|
|
837
|
-
"5": {
|
|
838
|
-
$type: "letterSpacing",
|
|
839
|
-
$value: "0%"
|
|
840
|
-
},
|
|
841
|
-
"6": {
|
|
842
|
-
$type: "letterSpacing",
|
|
843
|
-
$value: "0.15%"
|
|
844
|
-
},
|
|
845
|
-
"7": {
|
|
846
|
-
$type: "letterSpacing",
|
|
847
|
-
$value: "0.25%"
|
|
848
|
-
},
|
|
849
|
-
"8": {
|
|
850
|
-
$type: "letterSpacing",
|
|
851
|
-
$value: "0.5%"
|
|
852
|
-
},
|
|
853
|
-
"9": {
|
|
854
|
-
$type: "letterSpacing",
|
|
855
|
-
$value: "1.5%"
|
|
856
|
-
}
|
|
857
|
-
}
|
|
618
|
+
// src/colors/theme.ts
|
|
619
|
+
import chroma2 from "chroma-js";
|
|
620
|
+
import * as R2 from "ramda";
|
|
621
|
+
|
|
622
|
+
// src/colors/utils.ts
|
|
623
|
+
import chroma from "chroma-js";
|
|
624
|
+
import Colorjs from "colorjs.io";
|
|
625
|
+
import { Hsluv } from "hsluv";
|
|
626
|
+
var getLuminanceFromLightness = (lightness) => {
|
|
627
|
+
const conv = new Hsluv();
|
|
628
|
+
conv.hsluv_l = lightness;
|
|
629
|
+
conv.hsluvToHex();
|
|
630
|
+
return chroma(conv.hex).luminance();
|
|
631
|
+
};
|
|
632
|
+
var getLightnessFromHex = (hex) => {
|
|
633
|
+
const conv = new Hsluv();
|
|
634
|
+
conv.hex = hex;
|
|
635
|
+
conv.hexToHsluv();
|
|
636
|
+
return conv.hsluv_l;
|
|
858
637
|
};
|
|
859
638
|
|
|
860
|
-
// src/
|
|
861
|
-
var
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
"
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
"
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
"
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
"
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
"10": {
|
|
914
|
-
$type: "fontSizes",
|
|
915
|
-
$value: "48"
|
|
916
|
-
}
|
|
917
|
-
},
|
|
918
|
-
"letter-spacing": {
|
|
919
|
-
"1": {
|
|
920
|
-
$type: "letterSpacing",
|
|
921
|
-
$value: "-1%"
|
|
922
|
-
},
|
|
923
|
-
"2": {
|
|
924
|
-
$type: "letterSpacing",
|
|
925
|
-
$value: "-0.5%"
|
|
926
|
-
},
|
|
927
|
-
"3": {
|
|
928
|
-
$type: "letterSpacing",
|
|
929
|
-
$value: "-0.25%"
|
|
930
|
-
},
|
|
931
|
-
"4": {
|
|
932
|
-
$type: "letterSpacing",
|
|
933
|
-
$value: "-0.15%"
|
|
934
|
-
},
|
|
935
|
-
"5": {
|
|
936
|
-
$type: "letterSpacing",
|
|
937
|
-
$value: "0%"
|
|
938
|
-
},
|
|
939
|
-
"6": {
|
|
940
|
-
$type: "letterSpacing",
|
|
941
|
-
$value: "0.15%"
|
|
942
|
-
},
|
|
943
|
-
"7": {
|
|
944
|
-
$type: "letterSpacing",
|
|
945
|
-
$value: "0.25%"
|
|
946
|
-
},
|
|
947
|
-
"8": {
|
|
948
|
-
$type: "letterSpacing",
|
|
949
|
-
$value: "0.5%"
|
|
950
|
-
},
|
|
951
|
-
"9": {
|
|
952
|
-
$type: "letterSpacing",
|
|
953
|
-
$value: "1.5%"
|
|
954
|
-
}
|
|
639
|
+
// src/colors/theme.ts
|
|
640
|
+
var generateColorScale = (color, colorScheme2) => {
|
|
641
|
+
let interpolationColor = color;
|
|
642
|
+
if (colorScheme2 === "dark") {
|
|
643
|
+
const [L, C, H] = chroma2(color).oklch();
|
|
644
|
+
const chromaModifier = 0.7;
|
|
645
|
+
interpolationColor = chroma2(L, C * chromaModifier, H, "oklch").hex();
|
|
646
|
+
}
|
|
647
|
+
const colors = R2.mapObjIndexed((colorData) => {
|
|
648
|
+
const luminance = colorData.luminance[colorScheme2];
|
|
649
|
+
return {
|
|
650
|
+
...colorData,
|
|
651
|
+
hex: chroma2(interpolationColor).luminance(luminance).hex()
|
|
652
|
+
};
|
|
653
|
+
}, colorMetadata);
|
|
654
|
+
const baseColors2 = generateBaseColors(color, colorScheme2);
|
|
655
|
+
colors["base-default"] = { ...colors["base-default"], hex: baseColors2.default };
|
|
656
|
+
colors["base-hover"] = { ...colors["base-hover"], hex: baseColors2.hover };
|
|
657
|
+
colors["base-active"] = { ...colors["base-active"], hex: baseColors2.active };
|
|
658
|
+
colors["base-contrast-subtle"] = {
|
|
659
|
+
...colors["base-contrast-subtle"],
|
|
660
|
+
hex: generateColorContrast(baseColors2.default, "subtle")
|
|
661
|
+
};
|
|
662
|
+
colors["base-contrast-default"] = {
|
|
663
|
+
...colors["base-contrast-default"],
|
|
664
|
+
hex: generateColorContrast(baseColors2.default, "default")
|
|
665
|
+
};
|
|
666
|
+
return Object.values(colors);
|
|
667
|
+
};
|
|
668
|
+
var generateBaseColors = (color, colorScheme2) => {
|
|
669
|
+
let colorLightness = getLightnessFromHex(color);
|
|
670
|
+
if (colorScheme2 !== "light") {
|
|
671
|
+
colorLightness = colorLightness <= 30 ? 70 : 100 - colorLightness;
|
|
672
|
+
}
|
|
673
|
+
const modifier = colorLightness <= 30 || colorLightness >= 49 && colorLightness <= 65 ? -8 : 8;
|
|
674
|
+
const calculateLightness = (base, mod) => base - mod;
|
|
675
|
+
return {
|
|
676
|
+
default: colorScheme2 === "light" ? color : chroma2(color).luminance(getLuminanceFromLightness(colorLightness)).hex(),
|
|
677
|
+
hover: chroma2(color).luminance(getLuminanceFromLightness(calculateLightness(colorLightness, modifier))).hex(),
|
|
678
|
+
active: chroma2(color).luminance(getLuminanceFromLightness(calculateLightness(colorLightness, modifier * 2))).hex()
|
|
679
|
+
};
|
|
680
|
+
};
|
|
681
|
+
var generateColorContrast = (color, type) => {
|
|
682
|
+
if (type === "default") {
|
|
683
|
+
return chroma2.contrast(color, "#ffffff") >= chroma2.contrast(color, "#000000") ? "#ffffff" : "#000000";
|
|
684
|
+
}
|
|
685
|
+
if (type === "subtle") {
|
|
686
|
+
const contrastWhite = chroma2.contrast(color, "#ffffff");
|
|
687
|
+
const contrastBlack = chroma2.contrast(color, "#000000");
|
|
688
|
+
const lightness = getLightnessFromHex(color);
|
|
689
|
+
const modifier = lightness <= 40 || lightness >= 60 ? 60 : 50;
|
|
690
|
+
const targetLightness = contrastWhite >= contrastBlack ? lightness + modifier : lightness - modifier;
|
|
691
|
+
return chroma2(color).luminance(getLuminanceFromLightness(targetLightness)).hex();
|
|
955
692
|
}
|
|
693
|
+
return color;
|
|
956
694
|
};
|
|
957
695
|
|
|
958
|
-
// src/
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
696
|
+
// src/colors/types.ts
|
|
697
|
+
import * as R3 from "ramda";
|
|
698
|
+
var semanticColorMap = {
|
|
699
|
+
"background-default": 1,
|
|
700
|
+
"background-tinted": 2,
|
|
701
|
+
"surface-default": 3,
|
|
702
|
+
"surface-tinted": 4,
|
|
703
|
+
"surface-hover": 5,
|
|
704
|
+
"surface-active": 6,
|
|
705
|
+
"border-subtle": 7,
|
|
706
|
+
"border-default": 8,
|
|
707
|
+
"border-strong": 9,
|
|
708
|
+
"text-subtle": 10,
|
|
709
|
+
"text-default": 11,
|
|
710
|
+
"base-default": 12,
|
|
711
|
+
"base-hover": 13,
|
|
712
|
+
"base-active": 14,
|
|
713
|
+
"base-contrast-subtle": 15,
|
|
714
|
+
"base-contrast-default": 16
|
|
715
|
+
};
|
|
716
|
+
var semanticColorNames = R3.keys(semanticColorMap);
|
|
717
|
+
var semanticColorNumbers = R3.values(semanticColorMap);
|
|
718
|
+
|
|
719
|
+
// src/tokens/create/generators/primitives/color-scheme.ts
|
|
720
|
+
var generateColor = (colorArray, overrides) => {
|
|
721
|
+
const obj = {};
|
|
722
|
+
const $type = "color";
|
|
723
|
+
for (const index in colorArray) {
|
|
724
|
+
const position = Number(index) + 1;
|
|
725
|
+
const overrideValue = overrides?.[position];
|
|
726
|
+
obj[position] = {
|
|
727
|
+
$type,
|
|
728
|
+
$value: overrideValue || colorArray[index].hex
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
return obj;
|
|
732
|
+
};
|
|
733
|
+
var generateColorScheme = (themeName, colorScheme2, colors, overrides) => {
|
|
734
|
+
const createColorOverrides = (colorName) => {
|
|
735
|
+
if (!overrides?.colors || !(colorName in overrides.colors)) {
|
|
736
|
+
return void 0;
|
|
737
|
+
}
|
|
738
|
+
const colorOverrides = overrides.colors[colorName];
|
|
739
|
+
const positionOverrides = {};
|
|
740
|
+
Object.entries(colorOverrides).forEach(([semanticTokenName, modeOverrides]) => {
|
|
741
|
+
const position = colorMetadata[semanticTokenName].number;
|
|
742
|
+
if (position) {
|
|
743
|
+
let overrideValue;
|
|
744
|
+
if (colorScheme2 === "light" && modeOverrides.light) {
|
|
745
|
+
overrideValue = modeOverrides.light;
|
|
746
|
+
} else if (colorScheme2 === "dark" && modeOverrides.dark) {
|
|
747
|
+
overrideValue = modeOverrides.dark;
|
|
1010
748
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
$type: "typography",
|
|
1014
|
-
$value: {
|
|
1015
|
-
fontFamily: "{font-family}",
|
|
1016
|
-
fontWeight: "{font-weight.medium}",
|
|
1017
|
-
lineHeight: "{line-height.sm}",
|
|
1018
|
-
fontSize: "{font-size.5}",
|
|
1019
|
-
letterSpacing: "{letter-spacing.6}"
|
|
749
|
+
if (overrideValue) {
|
|
750
|
+
positionOverrides[position] = overrideValue;
|
|
1020
751
|
}
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
return Object.keys(positionOverrides).length > 0 ? positionOverrides : void 0;
|
|
755
|
+
};
|
|
756
|
+
const main = R4.mapObjIndexed(
|
|
757
|
+
(color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
|
|
758
|
+
colors.main
|
|
759
|
+
);
|
|
760
|
+
const support = R4.mapObjIndexed(
|
|
761
|
+
(color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
|
|
762
|
+
colors.support
|
|
763
|
+
);
|
|
764
|
+
const neutralColorScale = generateColorScale(colors.neutral, colorScheme2);
|
|
765
|
+
const neutral = generateColor(neutralColorScale, createColorOverrides("neutral"));
|
|
766
|
+
const baseColorsWithOverrides = {
|
|
767
|
+
...baseColors,
|
|
768
|
+
...overrides?.severity
|
|
769
|
+
};
|
|
770
|
+
const globalColors = R4.mapObjIndexed(
|
|
771
|
+
(color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
|
|
772
|
+
baseColorsWithOverrides
|
|
773
|
+
);
|
|
774
|
+
const linkColor = generateColor(generateColorScale(dsLinkColor, colorScheme2));
|
|
775
|
+
const defaultLinkVisited = linkColor[12];
|
|
776
|
+
const linkOverride = overrides?.linkVisited?.[colorScheme2] ? { $type: "color", $value: overrides.linkVisited[colorScheme2] } : void 0;
|
|
777
|
+
const defaultFocusInner = neutralColorScale[0].hex;
|
|
778
|
+
const defaultFocusOuter = neutralColorScale[10].hex;
|
|
779
|
+
const focusInnerOverride = overrides?.focus?.inner?.[colorScheme2];
|
|
780
|
+
const focusOuterOverride = overrides?.focus?.outer?.[colorScheme2];
|
|
781
|
+
return {
|
|
782
|
+
[themeName]: {
|
|
783
|
+
...main,
|
|
784
|
+
...support,
|
|
785
|
+
neutral,
|
|
786
|
+
...globalColors,
|
|
787
|
+
link: {
|
|
788
|
+
visited: linkOverride || defaultLinkVisited
|
|
1021
789
|
},
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
790
|
+
focus: {
|
|
791
|
+
inner: {
|
|
792
|
+
$type: "color",
|
|
793
|
+
$value: focusInnerOverride || defaultFocusInner
|
|
794
|
+
},
|
|
795
|
+
outer: {
|
|
796
|
+
$type: "color",
|
|
797
|
+
$value: focusOuterOverride || defaultFocusOuter
|
|
1030
798
|
}
|
|
1031
799
|
}
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
// src/tokens/create/generators/primitives/globals.ts
|
|
805
|
+
var globals = {
|
|
806
|
+
"border-width": {
|
|
807
|
+
"1": {
|
|
808
|
+
$type: "borderWidth",
|
|
809
|
+
$value: "1px"
|
|
1032
810
|
},
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
$type: "typography",
|
|
1056
|
-
$value: {
|
|
1057
|
-
fontFamily: "{font-family}",
|
|
1058
|
-
fontWeight: "{font-weight.regular}",
|
|
1059
|
-
lineHeight: "{line-height.md}",
|
|
1060
|
-
fontSize: "{font-size.4}",
|
|
1061
|
-
letterSpacing: "{letter-spacing.8}"
|
|
1062
|
-
}
|
|
1063
|
-
},
|
|
1064
|
-
sm: {
|
|
1065
|
-
$type: "typography",
|
|
1066
|
-
$value: {
|
|
1067
|
-
fontFamily: "{font-family}",
|
|
1068
|
-
fontWeight: "{font-weight.regular}",
|
|
1069
|
-
lineHeight: "{line-height.md}",
|
|
1070
|
-
fontSize: "{font-size.3}",
|
|
1071
|
-
letterSpacing: "{letter-spacing.7}"
|
|
1072
|
-
}
|
|
1073
|
-
},
|
|
1074
|
-
xs: {
|
|
1075
|
-
$type: "typography",
|
|
1076
|
-
$value: {
|
|
1077
|
-
fontFamily: "{font-family}",
|
|
1078
|
-
fontWeight: "{font-weight.regular}",
|
|
1079
|
-
lineHeight: "{line-height.md}",
|
|
1080
|
-
fontSize: "{font-size.2}",
|
|
1081
|
-
letterSpacing: "{letter-spacing.6}"
|
|
811
|
+
"3": {
|
|
812
|
+
$type: "borderWidth",
|
|
813
|
+
$value: "3px"
|
|
814
|
+
}
|
|
815
|
+
},
|
|
816
|
+
shadow: {
|
|
817
|
+
"100": {
|
|
818
|
+
$type: "boxShadow",
|
|
819
|
+
$value: [
|
|
820
|
+
{
|
|
821
|
+
color: "rgba(0,0,0,0.16)",
|
|
822
|
+
x: "0",
|
|
823
|
+
y: "0",
|
|
824
|
+
blur: "1",
|
|
825
|
+
spread: "0"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
x: "0",
|
|
829
|
+
y: "1",
|
|
830
|
+
blur: "2",
|
|
831
|
+
spread: "0",
|
|
832
|
+
color: "rgba(0,0,0,0.12)"
|
|
1082
833
|
}
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
834
|
+
]
|
|
835
|
+
},
|
|
836
|
+
"200": {
|
|
837
|
+
$type: "boxShadow",
|
|
838
|
+
$value: [
|
|
839
|
+
{
|
|
840
|
+
color: "rgba(0,0,0,0.15)",
|
|
841
|
+
x: "0",
|
|
842
|
+
y: "0",
|
|
843
|
+
blur: "1",
|
|
844
|
+
spread: "0"
|
|
1094
845
|
},
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
fontSize: "{font-size.5}",
|
|
1102
|
-
letterSpacing: "{letter-spacing.8}"
|
|
1103
|
-
}
|
|
846
|
+
{
|
|
847
|
+
color: "rgba(0,0,0,0.12)",
|
|
848
|
+
x: "0",
|
|
849
|
+
y: "1",
|
|
850
|
+
blur: "2",
|
|
851
|
+
spread: "0"
|
|
1104
852
|
},
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
853
|
+
{
|
|
854
|
+
x: "0",
|
|
855
|
+
y: "2",
|
|
856
|
+
blur: "4",
|
|
857
|
+
spread: "0",
|
|
858
|
+
color: "rgba(0,0,0,0.1)"
|
|
859
|
+
}
|
|
860
|
+
]
|
|
861
|
+
},
|
|
862
|
+
"300": {
|
|
863
|
+
$type: "boxShadow",
|
|
864
|
+
$value: [
|
|
865
|
+
{
|
|
866
|
+
color: "rgba(0,0,0,0.14)",
|
|
867
|
+
x: "0",
|
|
868
|
+
y: "0",
|
|
869
|
+
blur: "1",
|
|
870
|
+
spread: "0"
|
|
1114
871
|
},
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
fontSize: "{font-size.3}",
|
|
1122
|
-
letterSpacing: "{letter-spacing.7}"
|
|
1123
|
-
}
|
|
872
|
+
{
|
|
873
|
+
color: "rgba(0,0,0,0.12)",
|
|
874
|
+
x: "0",
|
|
875
|
+
y: "2",
|
|
876
|
+
blur: "4",
|
|
877
|
+
spread: "0"
|
|
1124
878
|
},
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
fontSize: "{font-size.2}",
|
|
1132
|
-
letterSpacing: "{letter-spacing.6}"
|
|
1133
|
-
}
|
|
879
|
+
{
|
|
880
|
+
x: "0",
|
|
881
|
+
y: "4",
|
|
882
|
+
blur: "8",
|
|
883
|
+
spread: "0",
|
|
884
|
+
color: "rgba(0,0,0,0.12)"
|
|
1134
885
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
886
|
+
]
|
|
887
|
+
},
|
|
888
|
+
"400": {
|
|
889
|
+
$type: "boxShadow",
|
|
890
|
+
$value: [
|
|
891
|
+
{
|
|
892
|
+
color: "rgba(0,0,0,0.13)",
|
|
893
|
+
x: "0",
|
|
894
|
+
y: "0",
|
|
895
|
+
blur: "1",
|
|
896
|
+
spread: "0"
|
|
1146
897
|
},
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
fontSize: "{font-size.5}",
|
|
1154
|
-
letterSpacing: "{letter-spacing.8}"
|
|
1155
|
-
}
|
|
898
|
+
{
|
|
899
|
+
color: "rgba(0,0,0,0.13)",
|
|
900
|
+
x: "0",
|
|
901
|
+
y: "3",
|
|
902
|
+
blur: "5",
|
|
903
|
+
spread: "0"
|
|
1156
904
|
},
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
905
|
+
{
|
|
906
|
+
x: "0",
|
|
907
|
+
y: "6",
|
|
908
|
+
blur: "12",
|
|
909
|
+
spread: "0",
|
|
910
|
+
color: "rgba(0,0,0,0.14)"
|
|
911
|
+
}
|
|
912
|
+
]
|
|
913
|
+
},
|
|
914
|
+
"500": {
|
|
915
|
+
$type: "boxShadow",
|
|
916
|
+
$value: [
|
|
917
|
+
{
|
|
918
|
+
color: "rgba(0,0,0,0.12)",
|
|
919
|
+
x: "0",
|
|
920
|
+
y: "0",
|
|
921
|
+
blur: "1",
|
|
922
|
+
spread: "0"
|
|
1166
923
|
},
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
fontSize: "{font-size.3}",
|
|
1174
|
-
letterSpacing: "{letter-spacing.7}"
|
|
1175
|
-
}
|
|
924
|
+
{
|
|
925
|
+
color: "rgba(0,0,0,0.16)",
|
|
926
|
+
x: "0",
|
|
927
|
+
y: "4",
|
|
928
|
+
blur: "8",
|
|
929
|
+
spread: "0"
|
|
1176
930
|
},
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
fontSize: "{font-size.2}",
|
|
1184
|
-
letterSpacing: "{letter-spacing.6}"
|
|
1185
|
-
}
|
|
931
|
+
{
|
|
932
|
+
x: "0",
|
|
933
|
+
y: "12",
|
|
934
|
+
blur: "24",
|
|
935
|
+
spread: "0",
|
|
936
|
+
color: "rgba(0,0,0,0.16)"
|
|
1186
937
|
}
|
|
1187
|
-
|
|
938
|
+
]
|
|
1188
939
|
}
|
|
1189
940
|
},
|
|
1190
941
|
opacity: {
|
|
1191
|
-
|
|
942
|
+
"30": {
|
|
1192
943
|
$type: "opacity",
|
|
1193
|
-
$value: "
|
|
1194
|
-
}
|
|
1195
|
-
},
|
|
1196
|
-
"border-width": {
|
|
1197
|
-
default: {
|
|
1198
|
-
$type: "borderWidth",
|
|
1199
|
-
$value: "{border-width.1}"
|
|
1200
|
-
},
|
|
1201
|
-
focus: {
|
|
1202
|
-
$type: "borderWidth",
|
|
1203
|
-
$value: "{border-width.3}"
|
|
944
|
+
$value: "30%"
|
|
1204
945
|
}
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
$
|
|
1214
|
-
|
|
1215
|
-
md: {
|
|
1216
|
-
$type: "boxShadow",
|
|
1217
|
-
$value: "{shadow.300}"
|
|
946
|
+
}
|
|
947
|
+
};
|
|
948
|
+
var generateGlobals = () => globals;
|
|
949
|
+
|
|
950
|
+
// src/tokens/create/generators/primitives/size.ts
|
|
951
|
+
var global = {
|
|
952
|
+
_size: {
|
|
953
|
+
"0": {
|
|
954
|
+
$type: "dimension",
|
|
955
|
+
$value: "floor({_size.unit} * 0)"
|
|
1218
956
|
},
|
|
1219
|
-
|
|
1220
|
-
$type: "
|
|
1221
|
-
$value: "{
|
|
957
|
+
"1": {
|
|
958
|
+
$type: "dimension",
|
|
959
|
+
$value: "floor({_size.unit} * 1)"
|
|
1222
960
|
},
|
|
1223
|
-
|
|
1224
|
-
$type: "boxShadow",
|
|
1225
|
-
$value: "{shadow.500}"
|
|
1226
|
-
}
|
|
1227
|
-
},
|
|
1228
|
-
"border-radius": {
|
|
1229
|
-
sm: {
|
|
961
|
+
"2": {
|
|
1230
962
|
$type: "dimension",
|
|
1231
|
-
$value: "{
|
|
963
|
+
$value: "floor({_size.unit} * 2)"
|
|
1232
964
|
},
|
|
1233
|
-
|
|
965
|
+
"3": {
|
|
1234
966
|
$type: "dimension",
|
|
1235
|
-
$value: "{
|
|
967
|
+
$value: "floor({_size.unit} * 3)"
|
|
1236
968
|
},
|
|
1237
|
-
|
|
969
|
+
"4": {
|
|
1238
970
|
$type: "dimension",
|
|
1239
|
-
$value: "{
|
|
971
|
+
$value: "floor({_size.unit} * 4)"
|
|
1240
972
|
},
|
|
1241
|
-
|
|
973
|
+
"5": {
|
|
1242
974
|
$type: "dimension",
|
|
1243
|
-
$value: "{
|
|
975
|
+
$value: "floor({_size.unit} * 5)"
|
|
1244
976
|
},
|
|
1245
|
-
|
|
977
|
+
"6": {
|
|
1246
978
|
$type: "dimension",
|
|
1247
|
-
$value: "{
|
|
979
|
+
$value: "floor({_size.unit} * 6)"
|
|
1248
980
|
},
|
|
1249
|
-
|
|
981
|
+
"7": {
|
|
1250
982
|
$type: "dimension",
|
|
1251
|
-
$value: "{
|
|
1252
|
-
}
|
|
1253
|
-
},
|
|
1254
|
-
size: {
|
|
1255
|
-
"0": {
|
|
1256
|
-
$type: "dimension",
|
|
1257
|
-
$value: "{_size.0}"
|
|
1258
|
-
},
|
|
1259
|
-
"1": {
|
|
1260
|
-
$type: "dimension",
|
|
1261
|
-
$value: "{_size.1}"
|
|
1262
|
-
},
|
|
1263
|
-
"2": {
|
|
1264
|
-
$type: "dimension",
|
|
1265
|
-
$value: "{_size.2}"
|
|
1266
|
-
},
|
|
1267
|
-
"3": {
|
|
1268
|
-
$type: "dimension",
|
|
1269
|
-
$value: "{_size.3}"
|
|
1270
|
-
},
|
|
1271
|
-
"4": {
|
|
1272
|
-
$type: "dimension",
|
|
1273
|
-
$value: "{_size.4}"
|
|
1274
|
-
},
|
|
1275
|
-
"5": {
|
|
1276
|
-
$type: "dimension",
|
|
1277
|
-
$value: "{_size.5}"
|
|
1278
|
-
},
|
|
1279
|
-
"6": {
|
|
1280
|
-
$type: "dimension",
|
|
1281
|
-
$value: "{_size.6}"
|
|
1282
|
-
},
|
|
1283
|
-
"7": {
|
|
1284
|
-
$type: "dimension",
|
|
1285
|
-
$value: "{_size.7}"
|
|
983
|
+
$value: "floor({_size.unit} * 7)"
|
|
1286
984
|
},
|
|
1287
985
|
"8": {
|
|
1288
986
|
$type: "dimension",
|
|
1289
|
-
$value: "{_size.8
|
|
987
|
+
$value: "floor({_size.unit} * 8)"
|
|
1290
988
|
},
|
|
1291
989
|
"9": {
|
|
1292
990
|
$type: "dimension",
|
|
1293
|
-
$value: "{_size.9
|
|
991
|
+
$value: "floor({_size.unit} * 9)"
|
|
1294
992
|
},
|
|
1295
993
|
"10": {
|
|
1296
994
|
$type: "dimension",
|
|
1297
|
-
$value: "{_size.10
|
|
995
|
+
$value: "floor({_size.unit} * 10)"
|
|
1298
996
|
},
|
|
1299
997
|
"11": {
|
|
1300
998
|
$type: "dimension",
|
|
1301
|
-
$value: "{_size.11
|
|
999
|
+
$value: "floor({_size.unit} * 11)"
|
|
1302
1000
|
},
|
|
1303
1001
|
"12": {
|
|
1304
1002
|
$type: "dimension",
|
|
1305
|
-
$value: "{_size.12
|
|
1003
|
+
$value: "floor({_size.unit} * 12)"
|
|
1306
1004
|
},
|
|
1307
1005
|
"13": {
|
|
1308
1006
|
$type: "dimension",
|
|
1309
|
-
$value: "{_size.13
|
|
1007
|
+
$value: "floor({_size.unit} * 13)"
|
|
1310
1008
|
},
|
|
1311
1009
|
"14": {
|
|
1312
1010
|
$type: "dimension",
|
|
1313
|
-
$value: "{_size.14
|
|
1011
|
+
$value: "floor({_size.unit} * 14)"
|
|
1314
1012
|
},
|
|
1315
1013
|
"15": {
|
|
1316
1014
|
$type: "dimension",
|
|
1317
|
-
$value: "{_size.15
|
|
1015
|
+
$value: "floor({_size.unit} * 15)"
|
|
1318
1016
|
},
|
|
1319
1017
|
"18": {
|
|
1320
1018
|
$type: "dimension",
|
|
1321
|
-
$value: "{_size.18
|
|
1019
|
+
$value: "floor({_size.unit} * 18)"
|
|
1322
1020
|
},
|
|
1323
1021
|
"22": {
|
|
1324
1022
|
$type: "dimension",
|
|
1325
|
-
$value: "{_size.22
|
|
1023
|
+
$value: "floor({_size.unit} * 22)"
|
|
1326
1024
|
},
|
|
1327
1025
|
"26": {
|
|
1328
1026
|
$type: "dimension",
|
|
1329
|
-
$value: "{_size.26
|
|
1027
|
+
$value: "floor({_size.unit} * 26)"
|
|
1330
1028
|
},
|
|
1331
1029
|
"30": {
|
|
1332
1030
|
$type: "dimension",
|
|
1333
|
-
$value: "{_size.30
|
|
1031
|
+
$value: "floor({_size.unit} * 30)"
|
|
1032
|
+
},
|
|
1033
|
+
"mode-font-size": {
|
|
1034
|
+
$type: "number",
|
|
1035
|
+
$value: "{size._mode-font-size}"
|
|
1036
|
+
},
|
|
1037
|
+
base: {
|
|
1038
|
+
$type: "number",
|
|
1039
|
+
$value: "{size._base}"
|
|
1040
|
+
},
|
|
1041
|
+
step: {
|
|
1042
|
+
$type: "number",
|
|
1043
|
+
$value: "{size._step}"
|
|
1044
|
+
},
|
|
1045
|
+
unit: {
|
|
1046
|
+
$type: "number",
|
|
1047
|
+
$value: "{_size.step} / {_size.base} * {_size.mode-font-size}"
|
|
1334
1048
|
}
|
|
1335
1049
|
}
|
|
1336
1050
|
};
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
return [tokenPath, defaultTokens[tokenPath]];
|
|
1353
|
-
};
|
|
1354
|
-
|
|
1355
|
-
// src/tokens/create/generators/color.ts
|
|
1356
|
-
import * as R4 from "ramda";
|
|
1357
|
-
|
|
1358
|
-
// src/colors/colorMetadata.ts
|
|
1359
|
-
import * as R2 from "ramda";
|
|
1360
|
-
var baseColors = {
|
|
1361
|
-
info: "#0A71C0",
|
|
1362
|
-
success: "#068718",
|
|
1363
|
-
warning: "#EA9B1B",
|
|
1364
|
-
danger: "#C01B1B"
|
|
1365
|
-
};
|
|
1366
|
-
var dsLinkColor = "#663299";
|
|
1367
|
-
var colorMetadata = {
|
|
1368
|
-
"background-default": {
|
|
1369
|
-
number: 1,
|
|
1370
|
-
name: "background-default",
|
|
1371
|
-
group: "background",
|
|
1372
|
-
displayName: "Background Default",
|
|
1373
|
-
description: {
|
|
1374
|
-
long: "Background Default er den mest n\xF8ytrale bakgrunnsfargen.",
|
|
1375
|
-
short: "Standard bakgrunnsfarge."
|
|
1376
|
-
},
|
|
1377
|
-
luminance: {
|
|
1378
|
-
light: 1,
|
|
1379
|
-
dark: 9e-3,
|
|
1380
|
-
contrast: 1e-3
|
|
1051
|
+
var sizeModes = {
|
|
1052
|
+
large: {
|
|
1053
|
+
size: {
|
|
1054
|
+
"_mode-font-size": {
|
|
1055
|
+
$type: "dimension",
|
|
1056
|
+
$value: "21"
|
|
1057
|
+
},
|
|
1058
|
+
_base: {
|
|
1059
|
+
$type: "dimension",
|
|
1060
|
+
$value: "18"
|
|
1061
|
+
},
|
|
1062
|
+
_step: {
|
|
1063
|
+
$type: "dimension",
|
|
1064
|
+
$value: "4"
|
|
1065
|
+
}
|
|
1381
1066
|
}
|
|
1382
1067
|
},
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1068
|
+
medium: {
|
|
1069
|
+
size: {
|
|
1070
|
+
"_mode-font-size": {
|
|
1071
|
+
$type: "dimension",
|
|
1072
|
+
$value: "18"
|
|
1073
|
+
},
|
|
1074
|
+
_base: {
|
|
1075
|
+
$type: "dimension",
|
|
1076
|
+
$value: "18"
|
|
1077
|
+
},
|
|
1078
|
+
_step: {
|
|
1079
|
+
$type: "dimension",
|
|
1080
|
+
$value: "4"
|
|
1081
|
+
}
|
|
1396
1082
|
}
|
|
1397
1083
|
},
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1084
|
+
small: {
|
|
1085
|
+
size: {
|
|
1086
|
+
"_mode-font-size": {
|
|
1087
|
+
$type: "dimension",
|
|
1088
|
+
$value: "16"
|
|
1089
|
+
},
|
|
1090
|
+
_base: {
|
|
1091
|
+
$type: "dimension",
|
|
1092
|
+
$value: "18"
|
|
1093
|
+
},
|
|
1094
|
+
_step: {
|
|
1095
|
+
$type: "dimension",
|
|
1096
|
+
$value: "4"
|
|
1097
|
+
}
|
|
1411
1098
|
}
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
var generateSize = (size2) => sizeModes[size2];
|
|
1102
|
+
var generateSizeGlobal = () => global;
|
|
1103
|
+
|
|
1104
|
+
// src/tokens/create/generators/primitives/typography.ts
|
|
1105
|
+
var generateTypography = (themeName, { fontFamily }) => ({
|
|
1106
|
+
[themeName]: {
|
|
1107
|
+
"font-family": {
|
|
1108
|
+
$type: "fontFamilies",
|
|
1109
|
+
$value: fontFamily
|
|
1421
1110
|
},
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1111
|
+
"font-weight": {
|
|
1112
|
+
medium: {
|
|
1113
|
+
$type: "fontWeights",
|
|
1114
|
+
$value: "Medium"
|
|
1115
|
+
},
|
|
1116
|
+
semibold: {
|
|
1117
|
+
$type: "fontWeights",
|
|
1118
|
+
$value: "Semi bold"
|
|
1119
|
+
},
|
|
1120
|
+
regular: {
|
|
1121
|
+
$type: "fontWeights",
|
|
1122
|
+
$value: "Regular"
|
|
1123
|
+
}
|
|
1426
1124
|
}
|
|
1125
|
+
}
|
|
1126
|
+
});
|
|
1127
|
+
var generateFontSizes = (size2) => fontSizes[size2];
|
|
1128
|
+
var lineHeights = {
|
|
1129
|
+
sm: {
|
|
1130
|
+
$type: "lineHeights",
|
|
1131
|
+
$value: "130%"
|
|
1132
|
+
},
|
|
1133
|
+
md: {
|
|
1134
|
+
$type: "lineHeights",
|
|
1135
|
+
$value: "150%"
|
|
1136
|
+
},
|
|
1137
|
+
lg: {
|
|
1138
|
+
$type: "lineHeights",
|
|
1139
|
+
$value: "170%"
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
var letterSpacings = {
|
|
1143
|
+
"1": {
|
|
1144
|
+
$type: "letterSpacing",
|
|
1145
|
+
$value: "-1%"
|
|
1427
1146
|
},
|
|
1428
|
-
"
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
group: "surface",
|
|
1432
|
-
displayName: "Surface Hover",
|
|
1433
|
-
description: {
|
|
1434
|
-
long: "Surface Hover brukes p\xE5 interaktive flater som ligger opp\xE5 bakgrunnsfargene i en hover state.",
|
|
1435
|
-
short: "Hover-farge til overflater / komponenter."
|
|
1436
|
-
},
|
|
1437
|
-
luminance: {
|
|
1438
|
-
light: 0.7,
|
|
1439
|
-
dark: 0.036,
|
|
1440
|
-
contrast: 0.028
|
|
1441
|
-
}
|
|
1147
|
+
"2": {
|
|
1148
|
+
$type: "letterSpacing",
|
|
1149
|
+
$value: "-0.5%"
|
|
1442
1150
|
},
|
|
1443
|
-
"
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
group: "surface",
|
|
1447
|
-
displayName: "Surface Active",
|
|
1448
|
-
description: {
|
|
1449
|
-
long: "Surface Active brukes p\xE5 interaktive flater som ligger opp\xE5 bakgrunnsfargene i en active state.",
|
|
1450
|
-
short: "Active-farge til overflater / komponenter."
|
|
1451
|
-
},
|
|
1452
|
-
luminance: {
|
|
1453
|
-
light: 0.59,
|
|
1454
|
-
dark: 0.056,
|
|
1455
|
-
contrast: 0.045
|
|
1456
|
-
}
|
|
1151
|
+
"3": {
|
|
1152
|
+
$type: "letterSpacing",
|
|
1153
|
+
$value: "-0.25%"
|
|
1457
1154
|
},
|
|
1458
|
-
"
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
group: "border",
|
|
1462
|
-
displayName: "Border Subtle",
|
|
1463
|
-
description: {
|
|
1464
|
-
long: "Border Subtle er den lyseste border-fargen og brukes for \xE5 skille elementer fra hverandre.",
|
|
1465
|
-
short: "Border-farge med lav kontrast til dekorativ bruk (skillelinjer)."
|
|
1466
|
-
},
|
|
1467
|
-
luminance: {
|
|
1468
|
-
light: 0.5,
|
|
1469
|
-
dark: 0.08,
|
|
1470
|
-
contrast: 0.26
|
|
1471
|
-
}
|
|
1155
|
+
"4": {
|
|
1156
|
+
$type: "letterSpacing",
|
|
1157
|
+
$value: "-0.15%"
|
|
1472
1158
|
},
|
|
1473
|
-
"
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1159
|
+
"5": {
|
|
1160
|
+
$type: "letterSpacing",
|
|
1161
|
+
$value: "0%"
|
|
1162
|
+
},
|
|
1163
|
+
"6": {
|
|
1164
|
+
$type: "letterSpacing",
|
|
1165
|
+
$value: "0.15%"
|
|
1166
|
+
},
|
|
1167
|
+
"7": {
|
|
1168
|
+
$type: "letterSpacing",
|
|
1169
|
+
$value: "0.25%"
|
|
1170
|
+
},
|
|
1171
|
+
"8": {
|
|
1172
|
+
$type: "letterSpacing",
|
|
1173
|
+
$value: "0.5%"
|
|
1174
|
+
},
|
|
1175
|
+
"9": {
|
|
1176
|
+
$type: "letterSpacing",
|
|
1177
|
+
$value: "1.5%"
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
var fontSizes = {
|
|
1181
|
+
large: {
|
|
1182
|
+
"line-height": lineHeights,
|
|
1183
|
+
"font-size": {
|
|
1184
|
+
"1": {
|
|
1185
|
+
$type: "fontSizes",
|
|
1186
|
+
$value: "13"
|
|
1187
|
+
},
|
|
1188
|
+
"2": {
|
|
1189
|
+
$type: "fontSizes",
|
|
1190
|
+
$value: "16"
|
|
1191
|
+
},
|
|
1192
|
+
"3": {
|
|
1193
|
+
$type: "fontSizes",
|
|
1194
|
+
$value: "18"
|
|
1195
|
+
},
|
|
1196
|
+
"4": {
|
|
1197
|
+
$type: "fontSizes",
|
|
1198
|
+
$value: "21"
|
|
1199
|
+
},
|
|
1200
|
+
"5": {
|
|
1201
|
+
$type: "fontSizes",
|
|
1202
|
+
$value: "24"
|
|
1203
|
+
},
|
|
1204
|
+
"6": {
|
|
1205
|
+
$type: "fontSizes",
|
|
1206
|
+
$value: "30"
|
|
1207
|
+
},
|
|
1208
|
+
"7": {
|
|
1209
|
+
$type: "fontSizes",
|
|
1210
|
+
$value: "36"
|
|
1211
|
+
},
|
|
1212
|
+
"8": {
|
|
1213
|
+
$type: "fontSizes",
|
|
1214
|
+
$value: "48"
|
|
1215
|
+
},
|
|
1216
|
+
"9": {
|
|
1217
|
+
$type: "fontSizes",
|
|
1218
|
+
$value: "60"
|
|
1219
|
+
},
|
|
1220
|
+
"10": {
|
|
1221
|
+
$type: "fontSizes",
|
|
1222
|
+
$value: "72"
|
|
1223
|
+
}
|
|
1481
1224
|
},
|
|
1482
|
-
|
|
1483
|
-
light: 0.19,
|
|
1484
|
-
dark: 0.22,
|
|
1485
|
-
contrast: 0.4
|
|
1486
|
-
}
|
|
1225
|
+
"letter-spacing": letterSpacings
|
|
1487
1226
|
},
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1227
|
+
medium: {
|
|
1228
|
+
"line-height": lineHeights,
|
|
1229
|
+
"font-size": {
|
|
1230
|
+
"1": {
|
|
1231
|
+
$type: "fontSizes",
|
|
1232
|
+
$value: "12"
|
|
1233
|
+
},
|
|
1234
|
+
"2": {
|
|
1235
|
+
$type: "fontSizes",
|
|
1236
|
+
$value: "14"
|
|
1237
|
+
},
|
|
1238
|
+
"3": {
|
|
1239
|
+
$type: "fontSizes",
|
|
1240
|
+
$value: "16"
|
|
1241
|
+
},
|
|
1242
|
+
"4": {
|
|
1243
|
+
$type: "fontSizes",
|
|
1244
|
+
$value: "18"
|
|
1245
|
+
},
|
|
1246
|
+
"5": {
|
|
1247
|
+
$type: "fontSizes",
|
|
1248
|
+
$value: "21"
|
|
1249
|
+
},
|
|
1250
|
+
"6": {
|
|
1251
|
+
$type: "fontSizes",
|
|
1252
|
+
$value: "24"
|
|
1253
|
+
},
|
|
1254
|
+
"7": {
|
|
1255
|
+
$type: "fontSizes",
|
|
1256
|
+
$value: "30"
|
|
1257
|
+
},
|
|
1258
|
+
"8": {
|
|
1259
|
+
$type: "fontSizes",
|
|
1260
|
+
$value: "36"
|
|
1261
|
+
},
|
|
1262
|
+
"9": {
|
|
1263
|
+
$type: "fontSizes",
|
|
1264
|
+
$value: "48"
|
|
1265
|
+
},
|
|
1266
|
+
"10": {
|
|
1267
|
+
$type: "fontSizes",
|
|
1268
|
+
$value: "60"
|
|
1269
|
+
}
|
|
1496
1270
|
},
|
|
1497
|
-
|
|
1498
|
-
light: 0.11,
|
|
1499
|
-
dark: 0.39,
|
|
1500
|
-
contrast: 0.6
|
|
1501
|
-
}
|
|
1271
|
+
"letter-spacing": letterSpacings
|
|
1502
1272
|
},
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
}
|
|
1547
|
-
},
|
|
1548
|
-
"base-hover": {
|
|
1549
|
-
number: 13,
|
|
1550
|
-
name: "base-hover",
|
|
1551
|
-
group: "base",
|
|
1552
|
-
displayName: "Base Hover",
|
|
1553
|
-
description: {
|
|
1554
|
-
long: "Base Hover brukes som hover farge p\xE5 elementer som bruker Base Default fargen.",
|
|
1555
|
-
short: "Hover-farge for solide bakgrunner."
|
|
1556
|
-
},
|
|
1557
|
-
luminance: {
|
|
1558
|
-
light: 1,
|
|
1559
|
-
dark: 1,
|
|
1560
|
-
contrast: 1
|
|
1561
|
-
}
|
|
1562
|
-
},
|
|
1563
|
-
"base-active": {
|
|
1564
|
-
number: 14,
|
|
1565
|
-
name: "base-active",
|
|
1566
|
-
group: "base",
|
|
1567
|
-
displayName: "Base Active",
|
|
1568
|
-
description: {
|
|
1569
|
-
long: "Base Active brukes som active farge p\xE5 elementer som bruker Base Default fargen.",
|
|
1570
|
-
short: "Active-farge for solide bakgrunner."
|
|
1571
|
-
},
|
|
1572
|
-
luminance: {
|
|
1573
|
-
light: 1,
|
|
1574
|
-
dark: 1,
|
|
1575
|
-
contrast: 1
|
|
1576
|
-
}
|
|
1577
|
-
},
|
|
1578
|
-
"base-contrast-subtle": {
|
|
1579
|
-
number: 15,
|
|
1580
|
-
name: "base-contrast-subtle",
|
|
1581
|
-
group: "base",
|
|
1582
|
-
displayName: "Contrast Subtle",
|
|
1583
|
-
description: {
|
|
1584
|
-
long: "Contrast Subtle brukes som en viktig meningsb\xE6rende farge opp\xE5 Base Default fargen.",
|
|
1585
|
-
short: "Farge med god kontrast mot Base-default."
|
|
1586
|
-
},
|
|
1587
|
-
luminance: {
|
|
1588
|
-
light: 1,
|
|
1589
|
-
dark: 1,
|
|
1590
|
-
contrast: 1
|
|
1591
|
-
}
|
|
1592
|
-
},
|
|
1593
|
-
"base-contrast-default": {
|
|
1594
|
-
number: 16,
|
|
1595
|
-
name: "base-contrast-default",
|
|
1596
|
-
group: "base",
|
|
1597
|
-
displayName: "Contrast Default",
|
|
1598
|
-
description: {
|
|
1599
|
-
long: "Contrast Default brukes som en viktig meningsb\xE6rende farge opp\xE5 alle Base fargane.",
|
|
1600
|
-
short: "Farge med god kontrast mot Base-default og Base-hover."
|
|
1273
|
+
small: {
|
|
1274
|
+
"line-height": lineHeights,
|
|
1275
|
+
"font-size": {
|
|
1276
|
+
"1": {
|
|
1277
|
+
$type: "fontSizes",
|
|
1278
|
+
$value: "11"
|
|
1279
|
+
},
|
|
1280
|
+
"2": {
|
|
1281
|
+
$type: "fontSizes",
|
|
1282
|
+
$value: "13"
|
|
1283
|
+
},
|
|
1284
|
+
"3": {
|
|
1285
|
+
$type: "fontSizes",
|
|
1286
|
+
$value: "14"
|
|
1287
|
+
},
|
|
1288
|
+
"4": {
|
|
1289
|
+
$type: "fontSizes",
|
|
1290
|
+
$value: "16"
|
|
1291
|
+
},
|
|
1292
|
+
"5": {
|
|
1293
|
+
$type: "fontSizes",
|
|
1294
|
+
$value: "18"
|
|
1295
|
+
},
|
|
1296
|
+
"6": {
|
|
1297
|
+
$type: "fontSizes",
|
|
1298
|
+
$value: "21"
|
|
1299
|
+
},
|
|
1300
|
+
"7": {
|
|
1301
|
+
$type: "fontSizes",
|
|
1302
|
+
$value: "24"
|
|
1303
|
+
},
|
|
1304
|
+
"8": {
|
|
1305
|
+
$type: "fontSizes",
|
|
1306
|
+
$value: "30"
|
|
1307
|
+
},
|
|
1308
|
+
"9": {
|
|
1309
|
+
$type: "fontSizes",
|
|
1310
|
+
$value: "36"
|
|
1311
|
+
},
|
|
1312
|
+
"10": {
|
|
1313
|
+
$type: "fontSizes",
|
|
1314
|
+
$value: "48"
|
|
1315
|
+
}
|
|
1601
1316
|
},
|
|
1602
|
-
|
|
1603
|
-
light: 1,
|
|
1604
|
-
dark: 1,
|
|
1605
|
-
contrast: 1
|
|
1606
|
-
}
|
|
1317
|
+
"letter-spacing": letterSpacings
|
|
1607
1318
|
}
|
|
1608
1319
|
};
|
|
1609
|
-
var colorMetadataByNumber = R2.indexBy((metadata) => metadata.number, Object.values(colorMetadata));
|
|
1610
|
-
var colorNames = Object.keys(colorMetadata);
|
|
1611
|
-
var baseColorNames = Object.keys(baseColors);
|
|
1612
|
-
|
|
1613
|
-
// src/colors/theme.ts
|
|
1614
|
-
import chroma2 from "chroma-js";
|
|
1615
|
-
import * as R3 from "ramda";
|
|
1616
|
-
|
|
1617
|
-
// src/colors/utils.ts
|
|
1618
|
-
import chroma from "chroma-js";
|
|
1619
|
-
import Colorjs from "colorjs.io";
|
|
1620
|
-
import { Hsluv } from "hsluv";
|
|
1621
|
-
var getLuminanceFromLightness = (lightness) => {
|
|
1622
|
-
const conv = new Hsluv();
|
|
1623
|
-
conv.hsluv_l = lightness;
|
|
1624
|
-
conv.hsluvToHex();
|
|
1625
|
-
return chroma(conv.hex).luminance();
|
|
1626
|
-
};
|
|
1627
|
-
var getLightnessFromHex = (hex) => {
|
|
1628
|
-
const conv = new Hsluv();
|
|
1629
|
-
conv.hex = hex;
|
|
1630
|
-
conv.hexToHsluv();
|
|
1631
|
-
return conv.hsluv_l;
|
|
1632
|
-
};
|
|
1633
1320
|
|
|
1634
|
-
// src/
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
const colors = R3.mapObjIndexed((colorData) => {
|
|
1643
|
-
const luminance = colorData.luminance[colorScheme2];
|
|
1644
|
-
return {
|
|
1645
|
-
...colorData,
|
|
1646
|
-
hex: chroma2(interpolationColor).luminance(luminance).hex()
|
|
1647
|
-
};
|
|
1648
|
-
}, colorMetadata);
|
|
1649
|
-
const baseColors2 = generateBaseColors(color, colorScheme2);
|
|
1650
|
-
colors["base-default"] = { ...colors["base-default"], hex: baseColors2.default };
|
|
1651
|
-
colors["base-hover"] = { ...colors["base-hover"], hex: baseColors2.hover };
|
|
1652
|
-
colors["base-active"] = { ...colors["base-active"], hex: baseColors2.active };
|
|
1653
|
-
colors["base-contrast-subtle"] = {
|
|
1654
|
-
...colors["base-contrast-subtle"],
|
|
1655
|
-
hex: generateColorContrast(baseColors2.default, "subtle")
|
|
1656
|
-
};
|
|
1657
|
-
colors["base-contrast-default"] = {
|
|
1658
|
-
...colors["base-contrast-default"],
|
|
1659
|
-
hex: generateColorContrast(baseColors2.default, "default")
|
|
1660
|
-
};
|
|
1661
|
-
return Object.values(colors);
|
|
1662
|
-
};
|
|
1663
|
-
var generateBaseColors = (color, colorScheme2) => {
|
|
1664
|
-
let colorLightness = getLightnessFromHex(color);
|
|
1665
|
-
if (colorScheme2 !== "light") {
|
|
1666
|
-
colorLightness = colorLightness <= 30 ? 70 : 100 - colorLightness;
|
|
1667
|
-
}
|
|
1668
|
-
const modifier = colorLightness <= 30 || colorLightness >= 49 && colorLightness <= 65 ? -8 : 8;
|
|
1669
|
-
const calculateLightness = (base, mod) => base - mod;
|
|
1321
|
+
// src/tokens/create/generators/semantic/color.ts
|
|
1322
|
+
import * as R5 from "ramda";
|
|
1323
|
+
var generateSemanticColors = (colors, _themeName) => {
|
|
1324
|
+
const mainColorNames = Object.keys(colors.main);
|
|
1325
|
+
const supportColorNames = Object.keys(colors.support);
|
|
1326
|
+
const customColors = [...mainColorNames, "neutral", ...supportColorNames];
|
|
1327
|
+
const allColors = [...customColors, ...baseColorNames];
|
|
1328
|
+
const semanticColorTokens = allColors.map((colorName) => [colorName, generateColorScaleTokens(colorName)]);
|
|
1670
1329
|
return {
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1330
|
+
...baseColorTemplate,
|
|
1331
|
+
color: {
|
|
1332
|
+
...Object.fromEntries(semanticColorTokens),
|
|
1333
|
+
...baseColorTemplate.color
|
|
1334
|
+
}
|
|
1674
1335
|
};
|
|
1675
1336
|
};
|
|
1676
|
-
var
|
|
1677
|
-
|
|
1678
|
-
|
|
1337
|
+
var baseColorTemplate = {
|
|
1338
|
+
color: {
|
|
1339
|
+
focus: {
|
|
1340
|
+
inner: {
|
|
1341
|
+
$type: "color",
|
|
1342
|
+
$value: "{color.focus.inner-color}"
|
|
1343
|
+
},
|
|
1344
|
+
outer: {
|
|
1345
|
+
$type: "color",
|
|
1346
|
+
$value: "{color.focus.outer-color}"
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
},
|
|
1350
|
+
link: {
|
|
1351
|
+
color: {
|
|
1352
|
+
visited: {
|
|
1353
|
+
$type: "color",
|
|
1354
|
+
$value: "{color.link.visited}"
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1679
1357
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1358
|
+
};
|
|
1359
|
+
var generateColorScaleTokens = (colorName) => {
|
|
1360
|
+
const colorScale = {};
|
|
1361
|
+
for (const [colorSemantic, colorNumber] of R5.toPairs(semanticColorMap)) {
|
|
1362
|
+
colorScale[colorSemantic] = {
|
|
1363
|
+
$type: "color",
|
|
1364
|
+
$value: `{color.${colorName}.${colorNumber}}`
|
|
1365
|
+
};
|
|
1687
1366
|
}
|
|
1688
|
-
return
|
|
1367
|
+
return colorScale;
|
|
1689
1368
|
};
|
|
1690
1369
|
|
|
1691
|
-
// src/tokens/create/generators/color.ts
|
|
1692
|
-
var
|
|
1693
|
-
const
|
|
1694
|
-
const
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1370
|
+
// src/tokens/create/generators/semantic/color-modes.ts
|
|
1371
|
+
var generateColorModes = (colors, _themeName) => {
|
|
1372
|
+
const mainColorNames = Object.keys(colors.main);
|
|
1373
|
+
const supportColorNames = Object.keys(colors.support);
|
|
1374
|
+
const modes = {
|
|
1375
|
+
"main-color": {},
|
|
1376
|
+
"support-color": {}
|
|
1377
|
+
};
|
|
1378
|
+
const categories = [
|
|
1379
|
+
["main-color", mainColorNames],
|
|
1380
|
+
["support-color", supportColorNames]
|
|
1381
|
+
];
|
|
1382
|
+
for (const [colorCategory2, colorNames2] of categories) {
|
|
1383
|
+
for (const colorName of colorNames2) {
|
|
1384
|
+
const category = colorCategory2.replace("-color", "");
|
|
1385
|
+
const customColorTokens = {
|
|
1386
|
+
color: {
|
|
1387
|
+
[category]: generateColorScaleTokens2(colorName)
|
|
1388
|
+
}
|
|
1389
|
+
};
|
|
1390
|
+
modes[colorCategory2][colorName] = customColorTokens;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
return modes;
|
|
1394
|
+
};
|
|
1395
|
+
var generateColorScaleTokens2 = (colorName) => {
|
|
1396
|
+
const colorScale = {};
|
|
1397
|
+
for (const colorSemantic of semanticColorNames) {
|
|
1398
|
+
colorScale[colorSemantic] = {
|
|
1399
|
+
$type: "color",
|
|
1400
|
+
$value: `{color.${colorName}.${colorSemantic}}`
|
|
1701
1401
|
};
|
|
1702
1402
|
}
|
|
1703
|
-
return
|
|
1403
|
+
return colorScale;
|
|
1704
1404
|
};
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1405
|
+
|
|
1406
|
+
// src/tokens/create/generators/semantic/style.ts
|
|
1407
|
+
function generateSemanticStyle() {
|
|
1408
|
+
return {
|
|
1409
|
+
typography: {
|
|
1410
|
+
heading: {
|
|
1411
|
+
"2xl": {
|
|
1412
|
+
$type: "typography",
|
|
1413
|
+
$value: {
|
|
1414
|
+
fontFamily: "{font-family}",
|
|
1415
|
+
fontWeight: "{font-weight.medium}",
|
|
1416
|
+
lineHeight: "{line-height.sm}",
|
|
1417
|
+
fontSize: "{font-size.10}",
|
|
1418
|
+
letterSpacing: "{letter-spacing.1}"
|
|
1419
|
+
}
|
|
1420
|
+
},
|
|
1421
|
+
xl: {
|
|
1422
|
+
$type: "typography",
|
|
1423
|
+
$value: {
|
|
1424
|
+
fontFamily: "{font-family}",
|
|
1425
|
+
fontWeight: "{font-weight.medium}",
|
|
1426
|
+
lineHeight: "{line-height.sm}",
|
|
1427
|
+
fontSize: "{font-size.9}",
|
|
1428
|
+
letterSpacing: "{letter-spacing.1}"
|
|
1429
|
+
}
|
|
1430
|
+
},
|
|
1431
|
+
lg: {
|
|
1432
|
+
$type: "typography",
|
|
1433
|
+
$value: {
|
|
1434
|
+
fontFamily: "{font-family}",
|
|
1435
|
+
fontWeight: "{font-weight.medium}",
|
|
1436
|
+
lineHeight: "{line-height.sm}",
|
|
1437
|
+
fontSize: "{font-size.8}",
|
|
1438
|
+
letterSpacing: "{letter-spacing.2}"
|
|
1439
|
+
}
|
|
1440
|
+
},
|
|
1441
|
+
md: {
|
|
1442
|
+
$type: "typography",
|
|
1443
|
+
$value: {
|
|
1444
|
+
fontFamily: "{font-family}",
|
|
1445
|
+
fontWeight: "{font-weight.medium}",
|
|
1446
|
+
lineHeight: "{line-height.sm}",
|
|
1447
|
+
fontSize: "{font-size.7}",
|
|
1448
|
+
letterSpacing: "{letter-spacing.3}"
|
|
1449
|
+
}
|
|
1450
|
+
},
|
|
1451
|
+
sm: {
|
|
1452
|
+
$type: "typography",
|
|
1453
|
+
$value: {
|
|
1454
|
+
fontFamily: "{font-family}",
|
|
1455
|
+
fontWeight: "{font-weight.medium}",
|
|
1456
|
+
lineHeight: "{line-height.sm}",
|
|
1457
|
+
fontSize: "{font-size.6}",
|
|
1458
|
+
letterSpacing: "{letter-spacing.5}"
|
|
1459
|
+
}
|
|
1460
|
+
},
|
|
1461
|
+
xs: {
|
|
1462
|
+
$type: "typography",
|
|
1463
|
+
$value: {
|
|
1464
|
+
fontFamily: "{font-family}",
|
|
1465
|
+
fontWeight: "{font-weight.medium}",
|
|
1466
|
+
lineHeight: "{line-height.sm}",
|
|
1467
|
+
fontSize: "{font-size.5}",
|
|
1468
|
+
letterSpacing: "{letter-spacing.6}"
|
|
1469
|
+
}
|
|
1470
|
+
},
|
|
1471
|
+
"2xs": {
|
|
1472
|
+
$type: "typography",
|
|
1473
|
+
$value: {
|
|
1474
|
+
fontFamily: "{font-family}",
|
|
1475
|
+
fontWeight: "{font-weight.medium}",
|
|
1476
|
+
lineHeight: "{line-height.sm}",
|
|
1477
|
+
fontSize: "{font-size.4}",
|
|
1478
|
+
letterSpacing: "{letter-spacing.6}"
|
|
1479
|
+
}
|
|
1720
1480
|
}
|
|
1721
|
-
|
|
1722
|
-
|
|
1481
|
+
},
|
|
1482
|
+
body: {
|
|
1483
|
+
xl: {
|
|
1484
|
+
$type: "typography",
|
|
1485
|
+
$value: {
|
|
1486
|
+
fontFamily: "{font-family}",
|
|
1487
|
+
fontWeight: "{font-weight.regular}",
|
|
1488
|
+
lineHeight: "{line-height.md}",
|
|
1489
|
+
fontSize: "{font-size.6}",
|
|
1490
|
+
letterSpacing: "{letter-spacing.8}"
|
|
1491
|
+
}
|
|
1492
|
+
},
|
|
1493
|
+
lg: {
|
|
1494
|
+
$type: "typography",
|
|
1495
|
+
$value: {
|
|
1496
|
+
fontFamily: "{font-family}",
|
|
1497
|
+
fontWeight: "{font-weight.regular}",
|
|
1498
|
+
lineHeight: "{line-height.md}",
|
|
1499
|
+
fontSize: "{font-size.5}",
|
|
1500
|
+
letterSpacing: "{letter-spacing.8}"
|
|
1501
|
+
}
|
|
1502
|
+
},
|
|
1503
|
+
md: {
|
|
1504
|
+
$type: "typography",
|
|
1505
|
+
$value: {
|
|
1506
|
+
fontFamily: "{font-family}",
|
|
1507
|
+
fontWeight: "{font-weight.regular}",
|
|
1508
|
+
lineHeight: "{line-height.md}",
|
|
1509
|
+
fontSize: "{font-size.4}",
|
|
1510
|
+
letterSpacing: "{letter-spacing.8}"
|
|
1511
|
+
}
|
|
1512
|
+
},
|
|
1513
|
+
sm: {
|
|
1514
|
+
$type: "typography",
|
|
1515
|
+
$value: {
|
|
1516
|
+
fontFamily: "{font-family}",
|
|
1517
|
+
fontWeight: "{font-weight.regular}",
|
|
1518
|
+
lineHeight: "{line-height.md}",
|
|
1519
|
+
fontSize: "{font-size.3}",
|
|
1520
|
+
letterSpacing: "{letter-spacing.7}"
|
|
1521
|
+
}
|
|
1522
|
+
},
|
|
1523
|
+
xs: {
|
|
1524
|
+
$type: "typography",
|
|
1525
|
+
$value: {
|
|
1526
|
+
fontFamily: "{font-family}",
|
|
1527
|
+
fontWeight: "{font-weight.regular}",
|
|
1528
|
+
lineHeight: "{line-height.md}",
|
|
1529
|
+
fontSize: "{font-size.2}",
|
|
1530
|
+
letterSpacing: "{letter-spacing.6}"
|
|
1531
|
+
}
|
|
1532
|
+
},
|
|
1533
|
+
short: {
|
|
1534
|
+
xl: {
|
|
1535
|
+
$type: "typography",
|
|
1536
|
+
$value: {
|
|
1537
|
+
fontFamily: "{font-family}",
|
|
1538
|
+
fontWeight: "{font-weight.regular}",
|
|
1539
|
+
lineHeight: "{line-height.sm}",
|
|
1540
|
+
fontSize: "{font-size.6}",
|
|
1541
|
+
letterSpacing: "{letter-spacing.8}"
|
|
1542
|
+
}
|
|
1543
|
+
},
|
|
1544
|
+
lg: {
|
|
1545
|
+
$type: "typography",
|
|
1546
|
+
$value: {
|
|
1547
|
+
fontFamily: "{font-family}",
|
|
1548
|
+
fontWeight: "{font-weight.regular}",
|
|
1549
|
+
lineHeight: "{line-height.sm}",
|
|
1550
|
+
fontSize: "{font-size.5}",
|
|
1551
|
+
letterSpacing: "{letter-spacing.8}"
|
|
1552
|
+
}
|
|
1553
|
+
},
|
|
1554
|
+
md: {
|
|
1555
|
+
$type: "typography",
|
|
1556
|
+
$value: {
|
|
1557
|
+
fontFamily: "{font-family}",
|
|
1558
|
+
fontWeight: "{font-weight.regular}",
|
|
1559
|
+
lineHeight: "{line-height.sm}",
|
|
1560
|
+
fontSize: "{font-size.4}",
|
|
1561
|
+
letterSpacing: "{letter-spacing.8}"
|
|
1562
|
+
}
|
|
1563
|
+
},
|
|
1564
|
+
sm: {
|
|
1565
|
+
$type: "typography",
|
|
1566
|
+
$value: {
|
|
1567
|
+
fontFamily: "{font-family}",
|
|
1568
|
+
fontWeight: "{font-weight.regular}",
|
|
1569
|
+
lineHeight: "{line-height.sm}",
|
|
1570
|
+
fontSize: "{font-size.3}",
|
|
1571
|
+
letterSpacing: "{letter-spacing.7}"
|
|
1572
|
+
}
|
|
1573
|
+
},
|
|
1574
|
+
xs: {
|
|
1575
|
+
$type: "typography",
|
|
1576
|
+
$value: {
|
|
1577
|
+
fontFamily: "{font-family}",
|
|
1578
|
+
fontWeight: "{font-weight.regular}",
|
|
1579
|
+
lineHeight: "{line-height.sm}",
|
|
1580
|
+
fontSize: "{font-size.2}",
|
|
1581
|
+
letterSpacing: "{letter-spacing.6}"
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
},
|
|
1585
|
+
long: {
|
|
1586
|
+
xl: {
|
|
1587
|
+
$type: "typography",
|
|
1588
|
+
$value: {
|
|
1589
|
+
fontFamily: "{font-family}",
|
|
1590
|
+
fontWeight: "{font-weight.regular}",
|
|
1591
|
+
lineHeight: "{line-height.lg}",
|
|
1592
|
+
fontSize: "{font-size.6}",
|
|
1593
|
+
letterSpacing: "{letter-spacing.8}"
|
|
1594
|
+
}
|
|
1595
|
+
},
|
|
1596
|
+
lg: {
|
|
1597
|
+
$type: "typography",
|
|
1598
|
+
$value: {
|
|
1599
|
+
fontFamily: "{font-family}",
|
|
1600
|
+
fontWeight: "{font-weight.regular}",
|
|
1601
|
+
lineHeight: "{line-height.lg}",
|
|
1602
|
+
fontSize: "{font-size.5}",
|
|
1603
|
+
letterSpacing: "{letter-spacing.8}"
|
|
1604
|
+
}
|
|
1605
|
+
},
|
|
1606
|
+
md: {
|
|
1607
|
+
$type: "typography",
|
|
1608
|
+
$value: {
|
|
1609
|
+
fontFamily: "{font-family}",
|
|
1610
|
+
fontWeight: "{font-weight.regular}",
|
|
1611
|
+
lineHeight: "{line-height.lg}",
|
|
1612
|
+
fontSize: "{font-size.4}",
|
|
1613
|
+
letterSpacing: "{letter-spacing.8}"
|
|
1614
|
+
}
|
|
1615
|
+
},
|
|
1616
|
+
sm: {
|
|
1617
|
+
$type: "typography",
|
|
1618
|
+
$value: {
|
|
1619
|
+
fontFamily: "{font-family}",
|
|
1620
|
+
fontWeight: "{font-weight.regular}",
|
|
1621
|
+
lineHeight: "{line-height.lg}",
|
|
1622
|
+
fontSize: "{font-size.3}",
|
|
1623
|
+
letterSpacing: "{letter-spacing.7}"
|
|
1624
|
+
}
|
|
1625
|
+
},
|
|
1626
|
+
xs: {
|
|
1627
|
+
$type: "typography",
|
|
1628
|
+
$value: {
|
|
1629
|
+
fontFamily: "{font-family}",
|
|
1630
|
+
fontWeight: "{font-weight.regular}",
|
|
1631
|
+
lineHeight: "{line-height.lg}",
|
|
1632
|
+
fontSize: "{font-size.2}",
|
|
1633
|
+
letterSpacing: "{letter-spacing.6}"
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1723
1636
|
}
|
|
1724
1637
|
}
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1638
|
+
},
|
|
1639
|
+
opacity: {
|
|
1640
|
+
disabled: {
|
|
1641
|
+
$type: "opacity",
|
|
1642
|
+
$value: "{opacity.30}"
|
|
1643
|
+
}
|
|
1644
|
+
},
|
|
1645
|
+
"border-width": {
|
|
1646
|
+
default: {
|
|
1647
|
+
$type: "borderWidth",
|
|
1648
|
+
$value: "{border-width.1}"
|
|
1649
|
+
},
|
|
1650
|
+
focus: {
|
|
1651
|
+
$type: "borderWidth",
|
|
1652
|
+
$value: "{border-width.3}"
|
|
1653
|
+
}
|
|
1654
|
+
},
|
|
1655
|
+
shadow: {
|
|
1656
|
+
xs: {
|
|
1657
|
+
$type: "boxShadow",
|
|
1658
|
+
$value: "{shadow.100}"
|
|
1659
|
+
},
|
|
1660
|
+
sm: {
|
|
1661
|
+
$type: "boxShadow",
|
|
1662
|
+
$value: "{shadow.200}"
|
|
1663
|
+
},
|
|
1664
|
+
md: {
|
|
1665
|
+
$type: "boxShadow",
|
|
1666
|
+
$value: "{shadow.300}"
|
|
1667
|
+
},
|
|
1668
|
+
lg: {
|
|
1669
|
+
$type: "boxShadow",
|
|
1670
|
+
$value: "{shadow.400}"
|
|
1671
|
+
},
|
|
1672
|
+
xl: {
|
|
1673
|
+
$type: "boxShadow",
|
|
1674
|
+
$value: "{shadow.500}"
|
|
1675
|
+
}
|
|
1676
|
+
},
|
|
1677
|
+
"border-radius": {
|
|
1678
|
+
sm: {
|
|
1679
|
+
$type: "dimension",
|
|
1680
|
+
$value: "{border-radius.1}"
|
|
1681
|
+
},
|
|
1682
|
+
md: {
|
|
1683
|
+
$type: "dimension",
|
|
1684
|
+
$value: "{border-radius.2}"
|
|
1685
|
+
},
|
|
1686
|
+
lg: {
|
|
1687
|
+
$type: "dimension",
|
|
1688
|
+
$value: "{border-radius.3}"
|
|
1689
|
+
},
|
|
1690
|
+
xl: {
|
|
1691
|
+
$type: "dimension",
|
|
1692
|
+
$value: "{border-radius.4}"
|
|
1693
|
+
},
|
|
1694
|
+
default: {
|
|
1695
|
+
$type: "dimension",
|
|
1696
|
+
$value: "{border-radius.5}"
|
|
1697
|
+
},
|
|
1698
|
+
full: {
|
|
1699
|
+
$type: "dimension",
|
|
1700
|
+
$value: "{border-radius.6}"
|
|
1701
|
+
}
|
|
1702
|
+
},
|
|
1703
|
+
size: {
|
|
1704
|
+
"0": {
|
|
1705
|
+
$type: "dimension",
|
|
1706
|
+
$value: "{_size.0}"
|
|
1707
|
+
},
|
|
1708
|
+
"1": {
|
|
1709
|
+
$type: "dimension",
|
|
1710
|
+
$value: "{_size.1}"
|
|
1711
|
+
},
|
|
1712
|
+
"2": {
|
|
1713
|
+
$type: "dimension",
|
|
1714
|
+
$value: "{_size.2}"
|
|
1715
|
+
},
|
|
1716
|
+
"3": {
|
|
1717
|
+
$type: "dimension",
|
|
1718
|
+
$value: "{_size.3}"
|
|
1719
|
+
},
|
|
1720
|
+
"4": {
|
|
1721
|
+
$type: "dimension",
|
|
1722
|
+
$value: "{_size.4}"
|
|
1723
|
+
},
|
|
1724
|
+
"5": {
|
|
1725
|
+
$type: "dimension",
|
|
1726
|
+
$value: "{_size.5}"
|
|
1727
|
+
},
|
|
1728
|
+
"6": {
|
|
1729
|
+
$type: "dimension",
|
|
1730
|
+
$value: "{_size.6}"
|
|
1731
|
+
},
|
|
1732
|
+
"7": {
|
|
1733
|
+
$type: "dimension",
|
|
1734
|
+
$value: "{_size.7}"
|
|
1735
|
+
},
|
|
1736
|
+
"8": {
|
|
1737
|
+
$type: "dimension",
|
|
1738
|
+
$value: "{_size.8}"
|
|
1739
|
+
},
|
|
1740
|
+
"9": {
|
|
1741
|
+
$type: "dimension",
|
|
1742
|
+
$value: "{_size.9}"
|
|
1743
|
+
},
|
|
1744
|
+
"10": {
|
|
1745
|
+
$type: "dimension",
|
|
1746
|
+
$value: "{_size.10}"
|
|
1747
|
+
},
|
|
1748
|
+
"11": {
|
|
1749
|
+
$type: "dimension",
|
|
1750
|
+
$value: "{_size.11}"
|
|
1751
|
+
},
|
|
1752
|
+
"12": {
|
|
1753
|
+
$type: "dimension",
|
|
1754
|
+
$value: "{_size.12}"
|
|
1755
|
+
},
|
|
1756
|
+
"13": {
|
|
1757
|
+
$type: "dimension",
|
|
1758
|
+
$value: "{_size.13}"
|
|
1759
|
+
},
|
|
1760
|
+
"14": {
|
|
1761
|
+
$type: "dimension",
|
|
1762
|
+
$value: "{_size.14}"
|
|
1763
|
+
},
|
|
1764
|
+
"15": {
|
|
1765
|
+
$type: "dimension",
|
|
1766
|
+
$value: "{_size.15}"
|
|
1767
|
+
},
|
|
1768
|
+
"18": {
|
|
1769
|
+
$type: "dimension",
|
|
1770
|
+
$value: "{_size.18}"
|
|
1771
|
+
},
|
|
1772
|
+
"22": {
|
|
1773
|
+
$type: "dimension",
|
|
1774
|
+
$value: "{_size.22}"
|
|
1775
|
+
},
|
|
1776
|
+
"26": {
|
|
1777
|
+
$type: "dimension",
|
|
1778
|
+
$value: "{_size.26}"
|
|
1779
|
+
},
|
|
1780
|
+
"30": {
|
|
1781
|
+
$type: "dimension",
|
|
1782
|
+
$value: "{_size.30}"
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1741
1785
|
};
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
// src/tokens/create/generators/themes/theme.ts
|
|
1789
|
+
import * as R6 from "ramda";
|
|
1790
|
+
var generateTheme = (colors, themeName, borderRadius) => {
|
|
1791
|
+
const mainColorNames = Object.keys(colors.main);
|
|
1792
|
+
const supportColorNames = Object.keys(colors.support);
|
|
1793
|
+
const customColors = [...mainColorNames, "neutral", ...supportColorNames, ...baseColorNames];
|
|
1794
|
+
const themeColorTokens = Object.fromEntries(
|
|
1795
|
+
customColors.map((colorName) => [colorName, generateColorScaleTokens3(colorName, themeName)])
|
|
1745
1796
|
);
|
|
1746
|
-
const
|
|
1747
|
-
const
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
const focusInnerOverride = overrides?.focus?.inner?.[colorScheme2];
|
|
1752
|
-
const focusOuterOverride = overrides?.focus?.outer?.[colorScheme2];
|
|
1753
|
-
return {
|
|
1754
|
-
[themeName]: {
|
|
1755
|
-
...main,
|
|
1756
|
-
...support,
|
|
1757
|
-
neutral,
|
|
1758
|
-
...globalColors,
|
|
1797
|
+
const { color: themeBaseFileColor, ...remainingThemeFile } = generateBase(themeName);
|
|
1798
|
+
const themeFile = {
|
|
1799
|
+
color: {
|
|
1800
|
+
...themeColorTokens,
|
|
1801
|
+
...themeBaseFileColor,
|
|
1759
1802
|
link: {
|
|
1760
|
-
visited:
|
|
1803
|
+
visited: {
|
|
1804
|
+
$type: "color",
|
|
1805
|
+
$value: `{${themeName}.link.visited}`
|
|
1806
|
+
}
|
|
1761
1807
|
},
|
|
1762
1808
|
focus: {
|
|
1763
|
-
inner: {
|
|
1809
|
+
"inner-color": {
|
|
1764
1810
|
$type: "color",
|
|
1765
|
-
$value:
|
|
1811
|
+
$value: `{${themeName}.focus.inner}`
|
|
1766
1812
|
},
|
|
1767
|
-
outer: {
|
|
1813
|
+
"outer-color": {
|
|
1768
1814
|
$type: "color",
|
|
1769
|
-
$value:
|
|
1815
|
+
$value: `{${themeName}.focus.outer}`
|
|
1770
1816
|
}
|
|
1771
1817
|
}
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
};
|
|
1775
|
-
|
|
1776
|
-
// src/tokens/create/generators/semantic.ts
|
|
1777
|
-
import * as R5 from "ramda";
|
|
1778
|
-
|
|
1779
|
-
// src/tokens/template/design-tokens/semantic/color.base.template.json with { type: 'json' }
|
|
1780
|
-
var color_base_template_default = {
|
|
1781
|
-
color: {
|
|
1782
|
-
focus: {
|
|
1783
|
-
inner: {
|
|
1784
|
-
$type: "color",
|
|
1785
|
-
$value: "{color.focus.inner-color}"
|
|
1786
|
-
},
|
|
1787
|
-
outer: {
|
|
1788
|
-
$type: "color",
|
|
1789
|
-
$value: "{color.focus.outer-color}"
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
},
|
|
1793
|
-
link: {
|
|
1794
|
-
color: {
|
|
1795
|
-
visited: {
|
|
1796
|
-
$type: "color",
|
|
1797
|
-
$value: "{color.link.visited}"
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1801
|
-
};
|
|
1802
|
-
|
|
1803
|
-
// src/tokens/template/design-tokens/semantic/color.template.json with { type: 'json' }
|
|
1804
|
-
var color_template_default = {
|
|
1805
|
-
"background-default": {
|
|
1806
|
-
$type: "color",
|
|
1807
|
-
$value: "{color.<color>.1}"
|
|
1808
|
-
},
|
|
1809
|
-
"background-tinted": {
|
|
1810
|
-
$type: "color",
|
|
1811
|
-
$value: "{color.<color>.2}"
|
|
1812
|
-
},
|
|
1813
|
-
"surface-default": {
|
|
1814
|
-
$type: "color",
|
|
1815
|
-
$value: "{color.<color>.3}"
|
|
1816
|
-
},
|
|
1817
|
-
"surface-tinted": {
|
|
1818
|
-
$type: "color",
|
|
1819
|
-
$value: "{color.<color>.4}"
|
|
1820
|
-
},
|
|
1821
|
-
"surface-hover": {
|
|
1822
|
-
$type: "color",
|
|
1823
|
-
$value: "{color.<color>.5}"
|
|
1824
|
-
},
|
|
1825
|
-
"surface-active": {
|
|
1826
|
-
$type: "color",
|
|
1827
|
-
$value: "{color.<color>.6}"
|
|
1828
|
-
},
|
|
1829
|
-
"border-subtle": {
|
|
1830
|
-
$type: "color",
|
|
1831
|
-
$value: "{color.<color>.7}"
|
|
1832
|
-
},
|
|
1833
|
-
"border-default": {
|
|
1834
|
-
$type: "color",
|
|
1835
|
-
$value: "{color.<color>.8}"
|
|
1836
|
-
},
|
|
1837
|
-
"border-strong": {
|
|
1838
|
-
$type: "color",
|
|
1839
|
-
$value: "{color.<color>.9}"
|
|
1840
|
-
},
|
|
1841
|
-
"text-subtle": {
|
|
1842
|
-
$type: "color",
|
|
1843
|
-
$value: "{color.<color>.10}"
|
|
1844
|
-
},
|
|
1845
|
-
"text-default": {
|
|
1846
|
-
$type: "color",
|
|
1847
|
-
$value: "{color.<color>.11}"
|
|
1848
|
-
},
|
|
1849
|
-
"base-default": {
|
|
1850
|
-
$type: "color",
|
|
1851
|
-
$value: "{color.<color>.12}"
|
|
1852
|
-
},
|
|
1853
|
-
"base-hover": {
|
|
1854
|
-
$type: "color",
|
|
1855
|
-
$value: "{color.<color>.13}"
|
|
1856
|
-
},
|
|
1857
|
-
"base-active": {
|
|
1858
|
-
$type: "color",
|
|
1859
|
-
$value: "{color.<color>.14}"
|
|
1860
|
-
},
|
|
1861
|
-
"base-contrast-subtle": {
|
|
1862
|
-
$type: "color",
|
|
1863
|
-
$value: "{color.<color>.15}"
|
|
1864
|
-
},
|
|
1865
|
-
"base-contrast-default": {
|
|
1866
|
-
$type: "color",
|
|
1867
|
-
$value: "{color.<color>.16}"
|
|
1868
|
-
}
|
|
1869
|
-
};
|
|
1870
|
-
|
|
1871
|
-
// src/tokens/template/design-tokens/semantic/modes/color.template.json with { type: 'json' }
|
|
1872
|
-
var color_template_default2 = {
|
|
1873
|
-
"background-default": {
|
|
1874
|
-
$type: "color",
|
|
1875
|
-
$value: "{color.<color>.background-default}"
|
|
1876
|
-
},
|
|
1877
|
-
"background-tinted": {
|
|
1878
|
-
$type: "color",
|
|
1879
|
-
$value: "{color.<color>.background-tinted}"
|
|
1880
|
-
},
|
|
1881
|
-
"surface-default": {
|
|
1882
|
-
$type: "color",
|
|
1883
|
-
$value: "{color.<color>.surface-default}"
|
|
1884
|
-
},
|
|
1885
|
-
"surface-tinted": {
|
|
1886
|
-
$type: "color",
|
|
1887
|
-
$value: "{color.<color>.surface-tinted}"
|
|
1888
|
-
},
|
|
1889
|
-
"surface-hover": {
|
|
1890
|
-
$type: "color",
|
|
1891
|
-
$value: "{color.<color>.surface-hover}"
|
|
1892
|
-
},
|
|
1893
|
-
"surface-active": {
|
|
1894
|
-
$type: "color",
|
|
1895
|
-
$value: "{color.<color>.surface-active}"
|
|
1896
|
-
},
|
|
1897
|
-
"border-subtle": {
|
|
1898
|
-
$type: "color",
|
|
1899
|
-
$value: "{color.<color>.border-subtle}"
|
|
1900
|
-
},
|
|
1901
|
-
"border-default": {
|
|
1902
|
-
$type: "color",
|
|
1903
|
-
$value: "{color.<color>.border-default}"
|
|
1904
|
-
},
|
|
1905
|
-
"border-strong": {
|
|
1906
|
-
$type: "color",
|
|
1907
|
-
$value: "{color.<color>.border-strong}"
|
|
1908
|
-
},
|
|
1909
|
-
"text-subtle": {
|
|
1910
|
-
$type: "color",
|
|
1911
|
-
$value: "{color.<color>.text-subtle}"
|
|
1912
|
-
},
|
|
1913
|
-
"text-default": {
|
|
1914
|
-
$type: "color",
|
|
1915
|
-
$value: "{color.<color>.text-default}"
|
|
1916
|
-
},
|
|
1917
|
-
"base-default": {
|
|
1918
|
-
$type: "color",
|
|
1919
|
-
$value: "{color.<color>.base-default}"
|
|
1920
|
-
},
|
|
1921
|
-
"base-hover": {
|
|
1922
|
-
$type: "color",
|
|
1923
|
-
$value: "{color.<color>.base-hover}"
|
|
1924
|
-
},
|
|
1925
|
-
"base-active": {
|
|
1926
|
-
$type: "color",
|
|
1927
|
-
$value: "{color.<color>.base-active}"
|
|
1928
|
-
},
|
|
1929
|
-
"base-contrast-subtle": {
|
|
1930
|
-
$type: "color",
|
|
1931
|
-
$value: "{color.<color>.base-contrast-subtle}"
|
|
1932
|
-
},
|
|
1933
|
-
"base-contrast-default": {
|
|
1934
|
-
$type: "color",
|
|
1935
|
-
$value: "{color.<color>.base-contrast-default}"
|
|
1936
|
-
}
|
|
1937
|
-
};
|
|
1938
|
-
|
|
1939
|
-
// src/tokens/create/generators/semantic.ts
|
|
1940
|
-
var generateSemantic = (colors, _themeName) => {
|
|
1941
|
-
const mainColorNames = Object.keys(colors.main);
|
|
1942
|
-
const supportColorNames = Object.keys(colors.support);
|
|
1943
|
-
const modes = {
|
|
1944
|
-
"main-color": {},
|
|
1945
|
-
"support-color": {}
|
|
1818
|
+
},
|
|
1819
|
+
...remainingThemeFile
|
|
1946
1820
|
};
|
|
1947
|
-
const
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
color: {
|
|
1956
|
-
[category]: JSON.parse(
|
|
1957
|
-
JSON.stringify(
|
|
1958
|
-
color_template_default2,
|
|
1959
|
-
(key, value) => {
|
|
1960
|
-
if (key === "$value") {
|
|
1961
|
-
return value.replace("<color>", colorName);
|
|
1962
|
-
}
|
|
1963
|
-
return value;
|
|
1964
|
-
},
|
|
1965
|
-
2
|
|
1966
|
-
)
|
|
1967
|
-
)
|
|
1821
|
+
const baseBorderRadius = R6.lensPath(["border-radius", "base", "$value"]);
|
|
1822
|
+
const updatedThemeFile = R6.set(baseBorderRadius, String(borderRadius), themeFile);
|
|
1823
|
+
const token = JSON.parse(
|
|
1824
|
+
JSON.stringify(
|
|
1825
|
+
updatedThemeFile,
|
|
1826
|
+
(key, value) => {
|
|
1827
|
+
if (key === "$value") {
|
|
1828
|
+
return value.replace("<theme>", themeName);
|
|
1968
1829
|
}
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
const customColors = [...mainColorNames, "neutral", ...supportColorNames];
|
|
1974
|
-
const allColors = [...customColors, ...baseColorNames];
|
|
1975
|
-
const semanticColorTokens = allColors.map(
|
|
1976
|
-
(colorName) => [
|
|
1977
|
-
colorName,
|
|
1978
|
-
R5.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), color_template_default)
|
|
1979
|
-
]
|
|
1830
|
+
return value;
|
|
1831
|
+
},
|
|
1832
|
+
2
|
|
1833
|
+
)
|
|
1980
1834
|
);
|
|
1981
|
-
|
|
1982
|
-
...color_base_template_default,
|
|
1983
|
-
color: {
|
|
1984
|
-
...Object.fromEntries(semanticColorTokens),
|
|
1985
|
-
...color_base_template_default.color
|
|
1986
|
-
}
|
|
1987
|
-
};
|
|
1988
|
-
return {
|
|
1989
|
-
modes,
|
|
1990
|
-
color
|
|
1991
|
-
};
|
|
1835
|
+
return token;
|
|
1992
1836
|
};
|
|
1993
|
-
|
|
1994
|
-
// src/tokens/create/generators/theme.ts
|
|
1995
|
-
import * as R6 from "ramda";
|
|
1996
|
-
|
|
1997
|
-
// src/tokens/template/design-tokens/themes/theme.base.template.json with { type: 'json' }
|
|
1998
|
-
var theme_base_template_default = {
|
|
1837
|
+
var generateBase = (themeName) => ({
|
|
1999
1838
|
color: {},
|
|
2000
1839
|
"font-family": {
|
|
2001
1840
|
$type: "fontFamilies",
|
|
2002
|
-
$value:
|
|
1841
|
+
$value: `{${themeName}.font-family}`
|
|
2003
1842
|
},
|
|
2004
1843
|
"font-weight": {
|
|
2005
1844
|
medium: {
|
|
2006
1845
|
$type: "fontWeights",
|
|
2007
|
-
$value:
|
|
1846
|
+
$value: `{${themeName}.font-weight.medium}`
|
|
2008
1847
|
},
|
|
2009
1848
|
semibold: {
|
|
2010
1849
|
$type: "fontWeights",
|
|
2011
|
-
$value:
|
|
1850
|
+
$value: `{${themeName}.font-weight.semibold}`
|
|
2012
1851
|
},
|
|
2013
1852
|
regular: {
|
|
2014
1853
|
$type: "fontWeights",
|
|
2015
|
-
$value:
|
|
1854
|
+
$value: `{${themeName}.font-weight.regular}`
|
|
2016
1855
|
}
|
|
2017
1856
|
},
|
|
2018
1857
|
"border-radius": {
|
|
@@ -2049,176 +1888,30 @@ var theme_base_template_default = {
|
|
|
2049
1888
|
$value: "4"
|
|
2050
1889
|
}
|
|
2051
1890
|
}
|
|
2052
|
-
};
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
"2": {
|
|
2061
|
-
$type: "color",
|
|
2062
|
-
$value: "{<theme>.<color>.2}"
|
|
2063
|
-
},
|
|
2064
|
-
"3": {
|
|
2065
|
-
$type: "color",
|
|
2066
|
-
$value: "{<theme>.<color>.3}"
|
|
2067
|
-
},
|
|
2068
|
-
"4": {
|
|
2069
|
-
$type: "color",
|
|
2070
|
-
$value: "{<theme>.<color>.4}"
|
|
2071
|
-
},
|
|
2072
|
-
"5": {
|
|
2073
|
-
$type: "color",
|
|
2074
|
-
$value: "{<theme>.<color>.5}"
|
|
2075
|
-
},
|
|
2076
|
-
"6": {
|
|
2077
|
-
$type: "color",
|
|
2078
|
-
$value: "{<theme>.<color>.6}"
|
|
2079
|
-
},
|
|
2080
|
-
"7": {
|
|
2081
|
-
$type: "color",
|
|
2082
|
-
$value: "{<theme>.<color>.7}"
|
|
2083
|
-
},
|
|
2084
|
-
"8": {
|
|
2085
|
-
$type: "color",
|
|
2086
|
-
$value: "{<theme>.<color>.8}"
|
|
2087
|
-
},
|
|
2088
|
-
"9": {
|
|
2089
|
-
$type: "color",
|
|
2090
|
-
$value: "{<theme>.<color>.9}"
|
|
2091
|
-
},
|
|
2092
|
-
"10": {
|
|
2093
|
-
$type: "color",
|
|
2094
|
-
$value: "{<theme>.<color>.10}"
|
|
2095
|
-
},
|
|
2096
|
-
"11": {
|
|
2097
|
-
$type: "color",
|
|
2098
|
-
$value: "{<theme>.<color>.11}"
|
|
2099
|
-
},
|
|
2100
|
-
"12": {
|
|
2101
|
-
$type: "color",
|
|
2102
|
-
$value: "{<theme>.<color>.12}"
|
|
2103
|
-
},
|
|
2104
|
-
"13": {
|
|
2105
|
-
$type: "color",
|
|
2106
|
-
$value: "{<theme>.<color>.13}"
|
|
2107
|
-
},
|
|
2108
|
-
"14": {
|
|
2109
|
-
$type: "color",
|
|
2110
|
-
$value: "{<theme>.<color>.14}"
|
|
2111
|
-
},
|
|
2112
|
-
"15": {
|
|
2113
|
-
$type: "color",
|
|
2114
|
-
$value: "{<theme>.<color>.15}"
|
|
2115
|
-
},
|
|
2116
|
-
"16": {
|
|
2117
|
-
$type: "color",
|
|
2118
|
-
$value: "{<theme>.<color>.16}"
|
|
2119
|
-
}
|
|
2120
|
-
};
|
|
2121
|
-
|
|
2122
|
-
// src/tokens/create/generators/theme.ts
|
|
2123
|
-
var generateTheme = (colors, themeName, borderRadius) => {
|
|
2124
|
-
const mainColorNames = Object.keys(colors.main);
|
|
2125
|
-
const supportColorNames = Object.keys(colors.support);
|
|
2126
|
-
const customColors = [...mainColorNames, "neutral", ...supportColorNames, ...baseColorNames];
|
|
2127
|
-
const themeColorTokens = Object.fromEntries(
|
|
2128
|
-
customColors.map(
|
|
2129
|
-
(colorName) => [
|
|
2130
|
-
colorName,
|
|
2131
|
-
R6.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), theme_template_default)
|
|
2132
|
-
]
|
|
2133
|
-
)
|
|
2134
|
-
);
|
|
2135
|
-
const { color: themeBaseFileColor, ...remainingThemeFile } = theme_base_template_default;
|
|
2136
|
-
const themeFile = {
|
|
2137
|
-
color: {
|
|
2138
|
-
...themeColorTokens,
|
|
2139
|
-
...themeBaseFileColor,
|
|
2140
|
-
link: {
|
|
2141
|
-
visited: {
|
|
2142
|
-
$type: "color",
|
|
2143
|
-
$value: `{${themeName}.link.visited}`
|
|
2144
|
-
}
|
|
2145
|
-
},
|
|
2146
|
-
focus: {
|
|
2147
|
-
"inner-color": {
|
|
2148
|
-
$type: "color",
|
|
2149
|
-
$value: `{${themeName}.focus.inner}`
|
|
2150
|
-
},
|
|
2151
|
-
"outer-color": {
|
|
2152
|
-
$type: "color",
|
|
2153
|
-
$value: `{${themeName}.focus.outer}`
|
|
2154
|
-
}
|
|
2155
|
-
}
|
|
2156
|
-
},
|
|
2157
|
-
...remainingThemeFile
|
|
2158
|
-
};
|
|
2159
|
-
const baseBorderRadius = R6.lensPath(["border-radius", "base", "$value"]);
|
|
2160
|
-
const updatedThemeFile = R6.set(baseBorderRadius, String(borderRadius), themeFile);
|
|
2161
|
-
const token = JSON.parse(
|
|
2162
|
-
JSON.stringify(
|
|
2163
|
-
updatedThemeFile,
|
|
2164
|
-
(key, value) => {
|
|
2165
|
-
if (key === "$value") {
|
|
2166
|
-
return value.replace("<theme>", themeName);
|
|
2167
|
-
}
|
|
2168
|
-
return value;
|
|
2169
|
-
},
|
|
2170
|
-
2
|
|
2171
|
-
)
|
|
2172
|
-
);
|
|
2173
|
-
return token;
|
|
2174
|
-
};
|
|
2175
|
-
|
|
2176
|
-
// src/tokens/template/design-tokens/primitives/modes/typography/typography.template.json with { type: 'json' }
|
|
2177
|
-
var typography_template_default = {
|
|
2178
|
-
"<theme>": {
|
|
2179
|
-
"font-family": {
|
|
2180
|
-
$type: "fontFamilies",
|
|
2181
|
-
$value: "<font-family>"
|
|
2182
|
-
},
|
|
2183
|
-
"font-weight": {
|
|
2184
|
-
medium: {
|
|
2185
|
-
$type: "fontWeights",
|
|
2186
|
-
$value: "Medium"
|
|
2187
|
-
},
|
|
2188
|
-
semibold: {
|
|
2189
|
-
$type: "fontWeights",
|
|
2190
|
-
$value: "Semi bold"
|
|
2191
|
-
},
|
|
2192
|
-
regular: {
|
|
2193
|
-
$type: "fontWeights",
|
|
2194
|
-
$value: "Regular"
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
1891
|
+
});
|
|
1892
|
+
var generateColorScaleTokens3 = (colorName, themeName) => {
|
|
1893
|
+
const colorScale = {};
|
|
1894
|
+
for (const [_, colorNumber] of R6.toPairs(semanticColorMap)) {
|
|
1895
|
+
colorScale[colorNumber] = {
|
|
1896
|
+
$type: "color",
|
|
1897
|
+
$value: `{${themeName}.${colorName}.${colorNumber}}`
|
|
1898
|
+
};
|
|
2197
1899
|
}
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
// src/tokens/create/generators/typography.ts
|
|
2201
|
-
var generateTypography = (themeName, { fontFamily }) => {
|
|
2202
|
-
return JSON.parse(
|
|
2203
|
-
JSON.stringify(typography_template_default).replaceAll(/<font-family>/g, fontFamily).replaceAll(/<theme>/g, themeName)
|
|
2204
|
-
);
|
|
1900
|
+
return colorScale;
|
|
2205
1901
|
};
|
|
2206
1902
|
|
|
2207
1903
|
// src/tokens/create.ts
|
|
2208
|
-
var createTokens = async (
|
|
2209
|
-
const { colors, typography: typography2, name, borderRadius, overrides } =
|
|
1904
|
+
var createTokens = async (theme) => {
|
|
1905
|
+
const { colors, typography: typography2, name, borderRadius, overrides } = theme;
|
|
2210
1906
|
const colorSchemes = ["light", "dark"];
|
|
2211
|
-
const
|
|
1907
|
+
const sizeModes2 = ["small", "medium", "large"];
|
|
2212
1908
|
const tokenSets = new Map([
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
"primitives/modes/typography/size/small",
|
|
2220
|
-
"primitives/modes/typography/size/medium",
|
|
2221
|
-
"primitives/modes/typography/size/large"
|
|
1909
|
+
["primitives/globals", generateGlobals()],
|
|
1910
|
+
...sizeModes2.map((size2) => [`primitives/modes/size/${size2}`, generateSize(size2)]),
|
|
1911
|
+
["primitives/modes/size/global", generateSizeGlobal()],
|
|
1912
|
+
...sizeModes2.map((size2) => [
|
|
1913
|
+
`primitives/modes/typography/size/${size2}`,
|
|
1914
|
+
generateFontSizes(size2)
|
|
2222
1915
|
]),
|
|
2223
1916
|
[`primitives/modes/typography/primary/${name}`, generateTypography(name, typography2)],
|
|
2224
1917
|
[`primitives/modes/typography/secondary/${name}`, generateTypography(name, typography2)],
|
|
@@ -2226,12 +1919,12 @@ var createTokens = async (opts) => {
|
|
|
2226
1919
|
[`primitives/modes/color-scheme/${scheme}/${name}`, generateColorScheme(name, scheme, colors, overrides)]
|
|
2227
1920
|
]),
|
|
2228
1921
|
[`themes/${name}`, generateTheme(colors, name, borderRadius)],
|
|
2229
|
-
["semantic/color",
|
|
1922
|
+
["semantic/color", generateSemanticColors(colors, name)],
|
|
2230
1923
|
// maps out semantic modes, ieg 'semantic/modes/main-color/accent', and 'semantic/modes/support-color/brand1'
|
|
2231
|
-
...Object.entries(
|
|
1924
|
+
...Object.entries(generateColorModes(colors, name)).flatMap(
|
|
2232
1925
|
([mode, colors2]) => Object.entries(colors2).map(([key, colorSet]) => [`semantic/modes/${mode}/${key}`, colorSet])
|
|
2233
1926
|
),
|
|
2234
|
-
|
|
1927
|
+
[`semantic/style`, generateSemanticStyle()]
|
|
2235
1928
|
]);
|
|
2236
1929
|
return { tokenSets };
|
|
2237
1930
|
};
|
|
@@ -3106,8 +2799,8 @@ var getMultidimensionalThemes = (processed$themes, dimensions) => {
|
|
|
3106
2799
|
const grouped$themes = groupThemes(processed$themes);
|
|
3107
2800
|
const permutations = permutateThemes(grouped$themes);
|
|
3108
2801
|
const ALL_DEPENDENT_ON = ["theme"];
|
|
3109
|
-
const
|
|
3110
|
-
const nonDependentKeys =
|
|
2802
|
+
const keys3 = R19.keys(grouped$themes);
|
|
2803
|
+
const nonDependentKeys = keys3.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
|
|
3111
2804
|
if (verboseLogging) {
|
|
3112
2805
|
console.log(pc.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
|
|
3113
2806
|
console.log(pc.cyan(` (ignoring permutations for ${nonDependentKeys})`));
|
|
@@ -3368,10 +3061,10 @@ async function processPlatform(options) {
|
|
|
3368
3061
|
console.log(`
|
|
3369
3062
|
\u{1F3A8} Using ${pc2.blue(buildOptions.defaultColor)} as default color`);
|
|
3370
3063
|
}
|
|
3371
|
-
const
|
|
3372
|
-
buildOptions.sizeModes =
|
|
3064
|
+
const sizeModes2 = processed$themes.filter((x) => x.group === "size").map((x) => x.name);
|
|
3065
|
+
buildOptions.sizeModes = sizeModes2;
|
|
3373
3066
|
if (!buildOptions.defaultSize) {
|
|
3374
|
-
const defaultSize = R21.head(
|
|
3067
|
+
const defaultSize = R21.head(sizeModes2);
|
|
3375
3068
|
buildOptions.defaultSize = defaultSize;
|
|
3376
3069
|
}
|
|
3377
3070
|
if (buildOptions.defaultSize) {
|
|
@@ -3510,7 +3203,8 @@ var toPreviewToken = (tokens) => tokens.map(({ token, formatted }) => {
|
|
|
3510
3203
|
});
|
|
3511
3204
|
var formatTheme = async (themeConfig) => {
|
|
3512
3205
|
const { tokenSets } = await createTokens(themeConfig);
|
|
3513
|
-
const
|
|
3206
|
+
const sizeModes2 = ["small", "medium", "large"];
|
|
3207
|
+
const $themes = await generate$Themes(["dark", "light"], [themeConfig.name], themeConfig.colors, sizeModes2);
|
|
3514
3208
|
const processed$themes = $themes.map(processThemeObject);
|
|
3515
3209
|
await processPlatform({
|
|
3516
3210
|
type: "format",
|