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