@digdir/designsystemet 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/configs/test-tokens.config.json +9 -0
- package/dist/bin/config.js +12 -14
- package/dist/bin/designsystemet.js +46 -319
- package/dist/color.base.template-QGZJKXMN.json +22 -0
- package/dist/config.schema.json +23 -7
- package/dist/src/colors/colorMetadata.d.ts +2 -0
- package/dist/src/colors/colorMetadata.d.ts.map +1 -1
- package/dist/src/colors/colorMetadata.js +8 -5
- package/dist/src/colors/index.js +9 -17
- package/dist/src/colors/theme.d.ts.map +1 -1
- package/dist/src/colors/theme.js +14 -18
- package/dist/src/colors/types.d.ts +1 -1
- package/dist/src/colors/types.d.ts.map +1 -1
- package/dist/src/config.d.ts +18 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +12 -14
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +213 -418
- package/dist/src/scripts/createJsonSchema.js +12 -14
- package/dist/src/scripts/update-preview-tokens.js +33 -294
- package/dist/src/scripts/update-template.d.ts.map +1 -1
- package/dist/src/scripts/update-template.js +349 -71
- package/dist/src/tokens/build.js +7 -7
- package/dist/src/tokens/create/generators/$designsystemet.js +7 -7
- package/dist/src/tokens/create/generators/$metadata.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/$metadata.js +1 -4
- package/dist/src/tokens/create/generators/$themes.js +0 -1
- package/dist/src/tokens/create/generators/color.d.ts +0 -1
- package/dist/src/tokens/create/generators/color.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/color.js +20 -23
- package/dist/src/tokens/create/generators/semantic.d.ts +1 -265
- package/dist/src/tokens/create/generators/semantic.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/semantic.js +261 -270
- package/dist/src/tokens/create/generators/theme.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/theme.js +265 -5
- package/dist/src/tokens/create/write.js +8 -12
- package/dist/src/tokens/create.d.ts.map +1 -1
- package/dist/src/tokens/create.js +33 -293
- package/dist/src/tokens/format.js +40 -301
- package/dist/src/tokens/index.js +40 -301
- package/dist/src/tokens/process/output/declarations.js +7 -7
- package/dist/src/tokens/process/output/theme.js +7 -7
- package/dist/src/tokens/template/design-tokens/semantic/color.base.template.js +1 -1
- package/package.json +7 -7
- package/dist/color.base.template-M7BHS4OV.json +0 -286
|
@@ -999,12 +999,12 @@ import * as R4 from "ramda";
|
|
|
999
999
|
// src/colors/colorMetadata.ts
|
|
1000
1000
|
import * as R2 from "ramda";
|
|
1001
1001
|
var baseColors = {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
red: "#C01B1B"
|
|
1002
|
+
info: "#0A71C0",
|
|
1003
|
+
success: "#068718",
|
|
1004
|
+
warning: "#EA9B1B",
|
|
1005
|
+
danger: "#C01B1B"
|
|
1007
1006
|
};
|
|
1007
|
+
var dsLinkColor = "#663299";
|
|
1008
1008
|
var colorMetadata = {
|
|
1009
1009
|
"background-default": {
|
|
1010
1010
|
number: 1,
|
|
@@ -1249,6 +1249,7 @@ var colorMetadata = {
|
|
|
1249
1249
|
};
|
|
1250
1250
|
var colorMetadataByNumber = R2.indexBy((metadata) => metadata.number, Object.values(colorMetadata));
|
|
1251
1251
|
var colorNames = Object.keys(colorMetadata);
|
|
1252
|
+
var baseColorNames = Object.keys(baseColors);
|
|
1252
1253
|
|
|
1253
1254
|
// src/colors/theme.ts
|
|
1254
1255
|
import chroma2 from "chroma-js";
|
|
@@ -1374,27 +1375,24 @@ var generateColorScheme = (themeName, colorScheme, colors, overrides) => {
|
|
|
1374
1375
|
colors.support
|
|
1375
1376
|
);
|
|
1376
1377
|
const neutral = generateColor(generateColorScale(colors.neutral, colorScheme), createColorOverrides("neutral"));
|
|
1378
|
+
const baseColorsWithOverrides = {
|
|
1379
|
+
...baseColors,
|
|
1380
|
+
...overrides?.severity
|
|
1381
|
+
};
|
|
1382
|
+
const globalColors = R4.mapObjIndexed(
|
|
1383
|
+
(color, colorName) => generateColor(generateColorScale(color, colorScheme), createColorOverrides(colorName)),
|
|
1384
|
+
baseColorsWithOverrides
|
|
1385
|
+
);
|
|
1386
|
+
const linkColor = generateColor(generateColorScale(dsLinkColor, colorScheme));
|
|
1377
1387
|
return {
|
|
1378
1388
|
[themeName]: {
|
|
1379
1389
|
...main,
|
|
1380
1390
|
...support,
|
|
1381
|
-
neutral
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
const blueScale = generateColorScale(baseColors.blue, colorScheme);
|
|
1387
|
-
const greenScale = generateColorScale(baseColors.green, colorScheme);
|
|
1388
|
-
const orangeScale = generateColorScale(baseColors.orange, colorScheme);
|
|
1389
|
-
const purpleScale = generateColorScale(baseColors.purple, colorScheme);
|
|
1390
|
-
const redScale = generateColorScale(baseColors.red, colorScheme);
|
|
1391
|
-
return {
|
|
1392
|
-
global: {
|
|
1393
|
-
blue: generateColor(blueScale),
|
|
1394
|
-
green: generateColor(greenScale),
|
|
1395
|
-
orange: generateColor(orangeScale),
|
|
1396
|
-
purple: generateColor(purpleScale),
|
|
1397
|
-
red: generateColor(redScale)
|
|
1391
|
+
neutral,
|
|
1392
|
+
...globalColors,
|
|
1393
|
+
link: {
|
|
1394
|
+
visited: linkColor[12]
|
|
1395
|
+
}
|
|
1398
1396
|
}
|
|
1399
1397
|
};
|
|
1400
1398
|
};
|
|
@@ -1405,270 +1403,6 @@ import * as R5 from "ramda";
|
|
|
1405
1403
|
// src/tokens/template/design-tokens/semantic/color.base.template.json with { type: 'json' }
|
|
1406
1404
|
var color_base_template_default = {
|
|
1407
1405
|
color: {
|
|
1408
|
-
success: {
|
|
1409
|
-
"background-default": {
|
|
1410
|
-
$type: "color",
|
|
1411
|
-
$value: "{global.green.1}"
|
|
1412
|
-
},
|
|
1413
|
-
"background-tinted": {
|
|
1414
|
-
$type: "color",
|
|
1415
|
-
$value: "{global.green.2}"
|
|
1416
|
-
},
|
|
1417
|
-
"surface-default": {
|
|
1418
|
-
$type: "color",
|
|
1419
|
-
$value: "{global.green.3}"
|
|
1420
|
-
},
|
|
1421
|
-
"surface-tinted": {
|
|
1422
|
-
$type: "color",
|
|
1423
|
-
$value: "{global.green.4}"
|
|
1424
|
-
},
|
|
1425
|
-
"surface-hover": {
|
|
1426
|
-
$type: "color",
|
|
1427
|
-
$value: "{global.green.5}"
|
|
1428
|
-
},
|
|
1429
|
-
"surface-active": {
|
|
1430
|
-
$type: "color",
|
|
1431
|
-
$value: "{global.green.6}"
|
|
1432
|
-
},
|
|
1433
|
-
"border-subtle": {
|
|
1434
|
-
$type: "color",
|
|
1435
|
-
$value: "{global.green.7}"
|
|
1436
|
-
},
|
|
1437
|
-
"border-default": {
|
|
1438
|
-
$type: "color",
|
|
1439
|
-
$value: "{global.green.8}"
|
|
1440
|
-
},
|
|
1441
|
-
"border-strong": {
|
|
1442
|
-
$type: "color",
|
|
1443
|
-
$value: "{global.green.9}"
|
|
1444
|
-
},
|
|
1445
|
-
"text-subtle": {
|
|
1446
|
-
$type: "color",
|
|
1447
|
-
$value: "{global.green.10}"
|
|
1448
|
-
},
|
|
1449
|
-
"text-default": {
|
|
1450
|
-
$type: "color",
|
|
1451
|
-
$value: "{global.green.11}"
|
|
1452
|
-
},
|
|
1453
|
-
"base-default": {
|
|
1454
|
-
$type: "color",
|
|
1455
|
-
$value: "{global.green.12}"
|
|
1456
|
-
},
|
|
1457
|
-
"base-hover": {
|
|
1458
|
-
$type: "color",
|
|
1459
|
-
$value: "{global.green.13}"
|
|
1460
|
-
},
|
|
1461
|
-
"base-active": {
|
|
1462
|
-
$type: "color",
|
|
1463
|
-
$value: "{global.green.14}"
|
|
1464
|
-
},
|
|
1465
|
-
"base-contrast-subtle": {
|
|
1466
|
-
$type: "color",
|
|
1467
|
-
$value: "{global.green.15}"
|
|
1468
|
-
},
|
|
1469
|
-
"base-contrast-default": {
|
|
1470
|
-
$type: "color",
|
|
1471
|
-
$value: "{global.green.16}"
|
|
1472
|
-
}
|
|
1473
|
-
},
|
|
1474
|
-
danger: {
|
|
1475
|
-
"background-default": {
|
|
1476
|
-
$type: "color",
|
|
1477
|
-
$value: "{global.red.1}"
|
|
1478
|
-
},
|
|
1479
|
-
"background-tinted": {
|
|
1480
|
-
$type: "color",
|
|
1481
|
-
$value: "{global.red.2}"
|
|
1482
|
-
},
|
|
1483
|
-
"surface-default": {
|
|
1484
|
-
$type: "color",
|
|
1485
|
-
$value: "{global.red.3}"
|
|
1486
|
-
},
|
|
1487
|
-
"surface-tinted": {
|
|
1488
|
-
$type: "color",
|
|
1489
|
-
$value: "{global.red.4}"
|
|
1490
|
-
},
|
|
1491
|
-
"surface-hover": {
|
|
1492
|
-
$type: "color",
|
|
1493
|
-
$value: "{global.red.5}"
|
|
1494
|
-
},
|
|
1495
|
-
"surface-active": {
|
|
1496
|
-
$type: "color",
|
|
1497
|
-
$value: "{global.red.6}"
|
|
1498
|
-
},
|
|
1499
|
-
"border-subtle": {
|
|
1500
|
-
$type: "color",
|
|
1501
|
-
$value: "{global.red.7}"
|
|
1502
|
-
},
|
|
1503
|
-
"border-default": {
|
|
1504
|
-
$type: "color",
|
|
1505
|
-
$value: "{global.red.8}"
|
|
1506
|
-
},
|
|
1507
|
-
"border-strong": {
|
|
1508
|
-
$type: "color",
|
|
1509
|
-
$value: "{global.red.9}"
|
|
1510
|
-
},
|
|
1511
|
-
"text-subtle": {
|
|
1512
|
-
$type: "color",
|
|
1513
|
-
$value: "{global.red.10}"
|
|
1514
|
-
},
|
|
1515
|
-
"text-default": {
|
|
1516
|
-
$type: "color",
|
|
1517
|
-
$value: "{global.red.11}"
|
|
1518
|
-
},
|
|
1519
|
-
"base-default": {
|
|
1520
|
-
$type: "color",
|
|
1521
|
-
$value: "{global.red.12}"
|
|
1522
|
-
},
|
|
1523
|
-
"base-hover": {
|
|
1524
|
-
$type: "color",
|
|
1525
|
-
$value: "{global.red.13}"
|
|
1526
|
-
},
|
|
1527
|
-
"base-active": {
|
|
1528
|
-
$type: "color",
|
|
1529
|
-
$value: "{global.red.14}"
|
|
1530
|
-
},
|
|
1531
|
-
"base-contrast-subtle": {
|
|
1532
|
-
$type: "color",
|
|
1533
|
-
$value: "{global.red.15}"
|
|
1534
|
-
},
|
|
1535
|
-
"base-contrast-default": {
|
|
1536
|
-
$type: "color",
|
|
1537
|
-
$value: "{global.red.16}"
|
|
1538
|
-
}
|
|
1539
|
-
},
|
|
1540
|
-
info: {
|
|
1541
|
-
"background-default": {
|
|
1542
|
-
$type: "color",
|
|
1543
|
-
$value: "{global.blue.1}"
|
|
1544
|
-
},
|
|
1545
|
-
"background-tinted": {
|
|
1546
|
-
$type: "color",
|
|
1547
|
-
$value: "{global.blue.2}"
|
|
1548
|
-
},
|
|
1549
|
-
"surface-default": {
|
|
1550
|
-
$type: "color",
|
|
1551
|
-
$value: "{global.blue.3}"
|
|
1552
|
-
},
|
|
1553
|
-
"surface-tinted": {
|
|
1554
|
-
$type: "color",
|
|
1555
|
-
$value: "{global.blue.4}"
|
|
1556
|
-
},
|
|
1557
|
-
"surface-hover": {
|
|
1558
|
-
$type: "color",
|
|
1559
|
-
$value: "{global.blue.5}"
|
|
1560
|
-
},
|
|
1561
|
-
"surface-active": {
|
|
1562
|
-
$type: "color",
|
|
1563
|
-
$value: "{global.blue.6}"
|
|
1564
|
-
},
|
|
1565
|
-
"border-subtle": {
|
|
1566
|
-
$type: "color",
|
|
1567
|
-
$value: "{global.blue.7}"
|
|
1568
|
-
},
|
|
1569
|
-
"border-default": {
|
|
1570
|
-
$type: "color",
|
|
1571
|
-
$value: "{global.blue.8}"
|
|
1572
|
-
},
|
|
1573
|
-
"border-strong": {
|
|
1574
|
-
$type: "color",
|
|
1575
|
-
$value: "{global.blue.9}"
|
|
1576
|
-
},
|
|
1577
|
-
"text-subtle": {
|
|
1578
|
-
$type: "color",
|
|
1579
|
-
$value: "{global.blue.10}"
|
|
1580
|
-
},
|
|
1581
|
-
"text-default": {
|
|
1582
|
-
$type: "color",
|
|
1583
|
-
$value: "{global.blue.11}"
|
|
1584
|
-
},
|
|
1585
|
-
"base-default": {
|
|
1586
|
-
$type: "color",
|
|
1587
|
-
$value: "{global.blue.12}"
|
|
1588
|
-
},
|
|
1589
|
-
"base-hover": {
|
|
1590
|
-
$type: "color",
|
|
1591
|
-
$value: "{global.blue.13}"
|
|
1592
|
-
},
|
|
1593
|
-
"base-active": {
|
|
1594
|
-
$type: "color",
|
|
1595
|
-
$value: "{global.blue.14}"
|
|
1596
|
-
},
|
|
1597
|
-
"base-contrast-subtle": {
|
|
1598
|
-
$type: "color",
|
|
1599
|
-
$value: "{global.blue.15}"
|
|
1600
|
-
},
|
|
1601
|
-
"base-contrast-default": {
|
|
1602
|
-
$type: "color",
|
|
1603
|
-
$value: "{global.blue.16}"
|
|
1604
|
-
}
|
|
1605
|
-
},
|
|
1606
|
-
warning: {
|
|
1607
|
-
"background-default": {
|
|
1608
|
-
$type: "color",
|
|
1609
|
-
$value: "{global.orange.1}"
|
|
1610
|
-
},
|
|
1611
|
-
"background-tinted": {
|
|
1612
|
-
$type: "color",
|
|
1613
|
-
$value: "{global.orange.2}"
|
|
1614
|
-
},
|
|
1615
|
-
"surface-default": {
|
|
1616
|
-
$type: "color",
|
|
1617
|
-
$value: "{global.orange.3}"
|
|
1618
|
-
},
|
|
1619
|
-
"surface-tinted": {
|
|
1620
|
-
$type: "color",
|
|
1621
|
-
$value: "{global.orange.4}"
|
|
1622
|
-
},
|
|
1623
|
-
"surface-hover": {
|
|
1624
|
-
$type: "color",
|
|
1625
|
-
$value: "{global.orange.5}"
|
|
1626
|
-
},
|
|
1627
|
-
"surface-active": {
|
|
1628
|
-
$type: "color",
|
|
1629
|
-
$value: "{global.orange.6}"
|
|
1630
|
-
},
|
|
1631
|
-
"border-subtle": {
|
|
1632
|
-
$type: "color",
|
|
1633
|
-
$value: "{global.orange.7}"
|
|
1634
|
-
},
|
|
1635
|
-
"border-default": {
|
|
1636
|
-
$type: "color",
|
|
1637
|
-
$value: "{global.orange.8}"
|
|
1638
|
-
},
|
|
1639
|
-
"border-strong": {
|
|
1640
|
-
$type: "color",
|
|
1641
|
-
$value: "{global.orange.9}"
|
|
1642
|
-
},
|
|
1643
|
-
"text-subtle": {
|
|
1644
|
-
$type: "color",
|
|
1645
|
-
$value: "{global.orange.10}"
|
|
1646
|
-
},
|
|
1647
|
-
"text-default": {
|
|
1648
|
-
$type: "color",
|
|
1649
|
-
$value: "{global.orange.11}"
|
|
1650
|
-
},
|
|
1651
|
-
"base-default": {
|
|
1652
|
-
$type: "color",
|
|
1653
|
-
$value: "{global.orange.12}"
|
|
1654
|
-
},
|
|
1655
|
-
"base-hover": {
|
|
1656
|
-
$type: "color",
|
|
1657
|
-
$value: "{global.orange.13}"
|
|
1658
|
-
},
|
|
1659
|
-
"base-active": {
|
|
1660
|
-
$type: "color",
|
|
1661
|
-
$value: "{global.orange.14}"
|
|
1662
|
-
},
|
|
1663
|
-
"base-contrast-subtle": {
|
|
1664
|
-
$type: "color",
|
|
1665
|
-
$value: "{global.orange.15}"
|
|
1666
|
-
},
|
|
1667
|
-
"base-contrast-default": {
|
|
1668
|
-
$type: "color",
|
|
1669
|
-
$value: "{global.orange.16}"
|
|
1670
|
-
}
|
|
1671
|
-
},
|
|
1672
1406
|
focus: {
|
|
1673
1407
|
inner: {
|
|
1674
1408
|
$type: "color",
|
|
@@ -1684,7 +1418,7 @@ var color_base_template_default = {
|
|
|
1684
1418
|
color: {
|
|
1685
1419
|
visited: {
|
|
1686
1420
|
$type: "color",
|
|
1687
|
-
$value: "{
|
|
1421
|
+
$value: "{color.link.visited}"
|
|
1688
1422
|
}
|
|
1689
1423
|
}
|
|
1690
1424
|
}
|
|
@@ -1827,7 +1561,7 @@ var color_template_default2 = {
|
|
|
1827
1561
|
};
|
|
1828
1562
|
|
|
1829
1563
|
// src/tokens/create/generators/semantic.ts
|
|
1830
|
-
var generateSemantic = (colors) => {
|
|
1564
|
+
var generateSemantic = (colors, _themeName) => {
|
|
1831
1565
|
const mainColorNames = Object.keys(colors.main);
|
|
1832
1566
|
const supportColorNames = Object.keys(colors.support);
|
|
1833
1567
|
const modes = {
|
|
@@ -1861,7 +1595,8 @@ var generateSemantic = (colors) => {
|
|
|
1861
1595
|
}
|
|
1862
1596
|
}
|
|
1863
1597
|
const customColors = [...mainColorNames, "neutral", ...supportColorNames];
|
|
1864
|
-
const
|
|
1598
|
+
const allColors = [...customColors, ...baseColorNames];
|
|
1599
|
+
const semanticColorTokens = allColors.map(
|
|
1865
1600
|
(colorName) => [
|
|
1866
1601
|
colorName,
|
|
1867
1602
|
R5.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), color_template_default)
|
|
@@ -2012,7 +1747,7 @@ var theme_template_default = {
|
|
|
2012
1747
|
var generateTheme = (colors, themeName, borderRadius) => {
|
|
2013
1748
|
const mainColorNames = Object.keys(colors.main);
|
|
2014
1749
|
const supportColorNames = Object.keys(colors.support);
|
|
2015
|
-
const customColors = [...mainColorNames, "neutral", ...supportColorNames];
|
|
1750
|
+
const customColors = [...mainColorNames, "neutral", ...supportColorNames, ...baseColorNames];
|
|
2016
1751
|
const themeColorTokens = Object.fromEntries(
|
|
2017
1752
|
customColors.map(
|
|
2018
1753
|
(colorName) => [
|
|
@@ -2025,7 +1760,13 @@ var generateTheme = (colors, themeName, borderRadius) => {
|
|
|
2025
1760
|
const themeFile = {
|
|
2026
1761
|
color: {
|
|
2027
1762
|
...themeColorTokens,
|
|
2028
|
-
...themeBaseFileColor
|
|
1763
|
+
...themeBaseFileColor,
|
|
1764
|
+
link: {
|
|
1765
|
+
visited: {
|
|
1766
|
+
$type: "color",
|
|
1767
|
+
$value: `{${themeName}.link.visited}`
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
2029
1770
|
},
|
|
2030
1771
|
...remainingThemeFile
|
|
2031
1772
|
};
|
|
@@ -2097,7 +1838,7 @@ var cliOptions = {
|
|
|
2097
1838
|
var createTokens = async (opts) => {
|
|
2098
1839
|
const { colors, typography, name, borderRadius, overrides } = opts;
|
|
2099
1840
|
const colorSchemes = ["light", "dark"];
|
|
2100
|
-
const semantic = generateSemantic(colors);
|
|
1841
|
+
const semantic = generateSemantic(colors, name);
|
|
2101
1842
|
const tokenSets = new Map([
|
|
2102
1843
|
...getDefaultTokens([
|
|
2103
1844
|
"primitives/globals",
|
|
@@ -2112,7 +1853,6 @@ var createTokens = async (opts) => {
|
|
|
2112
1853
|
[`primitives/modes/typography/primary/${name}`, generateTypography(name, typography)],
|
|
2113
1854
|
[`primitives/modes/typography/secondary/${name}`, generateTypography(name, typography)],
|
|
2114
1855
|
...colorSchemes.flatMap((scheme) => [
|
|
2115
|
-
[`primitives/modes/color-scheme/${scheme}/global`, generateColorGlobal(scheme)],
|
|
2116
1856
|
[`primitives/modes/color-scheme/${scheme}/${name}`, generateColorScheme(name, scheme, colors, overrides)]
|
|
2117
1857
|
]),
|
|
2118
1858
|
[`themes/${name}`, generateTheme(colors, name, borderRadius)],
|