@digdir/designsystemet 1.6.1 → 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 +44 -317
- 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 +211 -416
- 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 +5 -5
- package/dist/src/tokens/create/generators/$designsystemet.js +5 -5
- 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 +6 -10
- package/dist/src/tokens/create.d.ts.map +1 -1
- package/dist/src/tokens/create.js +33 -293
- package/dist/src/tokens/format.js +38 -299
- package/dist/src/tokens/index.js +38 -299
- package/dist/src/tokens/process/output/declarations.js +5 -5
- package/dist/src/tokens/process/output/theme.js +5 -5
- package/dist/src/tokens/template/design-tokens/semantic/color.base.template.js +1 -1
- package/package.json +5 -5
- package/dist/color.base.template-M7BHS4OV.json +0 -286
|
@@ -11,6 +11,12 @@ import { fromError } from "zod-validation-error";
|
|
|
11
11
|
|
|
12
12
|
// src/colors/colorMetadata.ts
|
|
13
13
|
import * as R from "ramda";
|
|
14
|
+
var baseColors = {
|
|
15
|
+
info: "#0A71C0",
|
|
16
|
+
success: "#068718",
|
|
17
|
+
warning: "#EA9B1B",
|
|
18
|
+
danger: "#C01B1B"
|
|
19
|
+
};
|
|
14
20
|
var colorMetadata = {
|
|
15
21
|
"background-default": {
|
|
16
22
|
number: 1,
|
|
@@ -255,6 +261,7 @@ var colorMetadata = {
|
|
|
255
261
|
};
|
|
256
262
|
var colorMetadataByNumber = R.indexBy((metadata) => metadata.number, Object.values(colorMetadata));
|
|
257
263
|
var colorNames = Object.keys(colorMetadata);
|
|
264
|
+
var baseColorNames = Object.keys(baseColors);
|
|
258
265
|
|
|
259
266
|
// src/colors/theme.ts
|
|
260
267
|
import chroma2 from "chroma-js";
|
|
@@ -275,18 +282,7 @@ var convertToHex = (color) => {
|
|
|
275
282
|
};
|
|
276
283
|
|
|
277
284
|
// src/colors/theme.ts
|
|
278
|
-
var RESERVED_COLORS = [
|
|
279
|
-
"neutral",
|
|
280
|
-
"success",
|
|
281
|
-
"warning",
|
|
282
|
-
"danger",
|
|
283
|
-
"info",
|
|
284
|
-
"blue",
|
|
285
|
-
"green",
|
|
286
|
-
"orange",
|
|
287
|
-
"purple",
|
|
288
|
-
"red"
|
|
289
|
-
];
|
|
285
|
+
var RESERVED_COLORS = ["neutral", "success", "warning", "danger", "info"];
|
|
290
286
|
|
|
291
287
|
// src/tokens/create/defaults.ts
|
|
292
288
|
import * as R3 from "ramda";
|
|
@@ -328,10 +324,12 @@ var colorModeOverrideSchema = z.object({
|
|
|
328
324
|
light: colorSchema.optional(),
|
|
329
325
|
dark: colorSchema.optional()
|
|
330
326
|
}).describe('Override values for semantic color tokens like "background-subtle", "border-default", etc.');
|
|
331
|
-
var colorWeightOverrideSchema = z.partialRecord(z.enum(colorNames), colorModeOverrideSchema).describe('The name of the color to add overrides for, e.g. "accent"');
|
|
327
|
+
var colorWeightOverrideSchema = z.partialRecord(z.enum([...colorNames]), colorModeOverrideSchema).describe('The name of the color to add overrides for, e.g. "accent"');
|
|
332
328
|
var semanticColorOverrideSchema = z.record(z.string(), colorWeightOverrideSchema).describe("An object with color names as keys");
|
|
329
|
+
var severityColorOverrideSchema = z.partialRecord(z.enum(baseColorNames), colorSchema.describe("A hex color, which is used for creating a color scale")).optional().describe("An object with severity color names as keys");
|
|
333
330
|
var overridesSchema = z.object({
|
|
334
|
-
colors: semanticColorOverrideSchema.optional()
|
|
331
|
+
colors: semanticColorOverrideSchema.optional(),
|
|
332
|
+
severity: severityColorOverrideSchema.optional()
|
|
335
333
|
}).describe("Overrides for generated design tokens. Currently only supports colors defined in your theme").optional();
|
|
336
334
|
var themeSchema = z.object({
|
|
337
335
|
colors: z.object({
|
|
@@ -321,7 +321,6 @@ function generateColorSchemesGroup(colorSchemes, themes) {
|
|
|
321
321
|
(scheme) => ({
|
|
322
322
|
...colorSchemeDefaults[scheme],
|
|
323
323
|
selectedTokenSets: Object.fromEntries([
|
|
324
|
-
[`primitives/modes/color-scheme/${scheme}/global`, TokenSetStatus.ENABLED],
|
|
325
324
|
...themes.map((theme) => [`primitives/modes/color-scheme/${scheme}/${theme}`, TokenSetStatus.ENABLED])
|
|
326
325
|
]),
|
|
327
326
|
group: "Color scheme"
|
|
@@ -1399,12 +1398,12 @@ import * as R4 from "ramda";
|
|
|
1399
1398
|
// src/colors/colorMetadata.ts
|
|
1400
1399
|
import * as R2 from "ramda";
|
|
1401
1400
|
var baseColors = {
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
red: "#C01B1B"
|
|
1401
|
+
info: "#0A71C0",
|
|
1402
|
+
success: "#068718",
|
|
1403
|
+
warning: "#EA9B1B",
|
|
1404
|
+
danger: "#C01B1B"
|
|
1407
1405
|
};
|
|
1406
|
+
var dsLinkColor = "#663299";
|
|
1408
1407
|
var colorMetadata = {
|
|
1409
1408
|
"background-default": {
|
|
1410
1409
|
number: 1,
|
|
@@ -1649,6 +1648,7 @@ var colorMetadata = {
|
|
|
1649
1648
|
};
|
|
1650
1649
|
var colorMetadataByNumber = R2.indexBy((metadata) => metadata.number, Object.values(colorMetadata));
|
|
1651
1650
|
var colorNames = Object.keys(colorMetadata);
|
|
1651
|
+
var baseColorNames = Object.keys(baseColors);
|
|
1652
1652
|
|
|
1653
1653
|
// src/colors/theme.ts
|
|
1654
1654
|
import chroma2 from "chroma-js";
|
|
@@ -1774,27 +1774,24 @@ var generateColorScheme = (themeName, colorScheme2, colors, overrides) => {
|
|
|
1774
1774
|
colors.support
|
|
1775
1775
|
);
|
|
1776
1776
|
const neutral = generateColor(generateColorScale(colors.neutral, colorScheme2), createColorOverrides("neutral"));
|
|
1777
|
+
const baseColorsWithOverrides = {
|
|
1778
|
+
...baseColors,
|
|
1779
|
+
...overrides?.severity
|
|
1780
|
+
};
|
|
1781
|
+
const globalColors = R4.mapObjIndexed(
|
|
1782
|
+
(color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
|
|
1783
|
+
baseColorsWithOverrides
|
|
1784
|
+
);
|
|
1785
|
+
const linkColor = generateColor(generateColorScale(dsLinkColor, colorScheme2));
|
|
1777
1786
|
return {
|
|
1778
1787
|
[themeName]: {
|
|
1779
1788
|
...main,
|
|
1780
1789
|
...support,
|
|
1781
|
-
neutral
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
const blueScale = generateColorScale(baseColors.blue, colorScheme2);
|
|
1787
|
-
const greenScale = generateColorScale(baseColors.green, colorScheme2);
|
|
1788
|
-
const orangeScale = generateColorScale(baseColors.orange, colorScheme2);
|
|
1789
|
-
const purpleScale = generateColorScale(baseColors.purple, colorScheme2);
|
|
1790
|
-
const redScale = generateColorScale(baseColors.red, colorScheme2);
|
|
1791
|
-
return {
|
|
1792
|
-
global: {
|
|
1793
|
-
blue: generateColor(blueScale),
|
|
1794
|
-
green: generateColor(greenScale),
|
|
1795
|
-
orange: generateColor(orangeScale),
|
|
1796
|
-
purple: generateColor(purpleScale),
|
|
1797
|
-
red: generateColor(redScale)
|
|
1790
|
+
neutral,
|
|
1791
|
+
...globalColors,
|
|
1792
|
+
link: {
|
|
1793
|
+
visited: linkColor[12]
|
|
1794
|
+
}
|
|
1798
1795
|
}
|
|
1799
1796
|
};
|
|
1800
1797
|
};
|
|
@@ -1805,270 +1802,6 @@ import * as R5 from "ramda";
|
|
|
1805
1802
|
// src/tokens/template/design-tokens/semantic/color.base.template.json with { type: 'json' }
|
|
1806
1803
|
var color_base_template_default = {
|
|
1807
1804
|
color: {
|
|
1808
|
-
success: {
|
|
1809
|
-
"background-default": {
|
|
1810
|
-
$type: "color",
|
|
1811
|
-
$value: "{global.green.1}"
|
|
1812
|
-
},
|
|
1813
|
-
"background-tinted": {
|
|
1814
|
-
$type: "color",
|
|
1815
|
-
$value: "{global.green.2}"
|
|
1816
|
-
},
|
|
1817
|
-
"surface-default": {
|
|
1818
|
-
$type: "color",
|
|
1819
|
-
$value: "{global.green.3}"
|
|
1820
|
-
},
|
|
1821
|
-
"surface-tinted": {
|
|
1822
|
-
$type: "color",
|
|
1823
|
-
$value: "{global.green.4}"
|
|
1824
|
-
},
|
|
1825
|
-
"surface-hover": {
|
|
1826
|
-
$type: "color",
|
|
1827
|
-
$value: "{global.green.5}"
|
|
1828
|
-
},
|
|
1829
|
-
"surface-active": {
|
|
1830
|
-
$type: "color",
|
|
1831
|
-
$value: "{global.green.6}"
|
|
1832
|
-
},
|
|
1833
|
-
"border-subtle": {
|
|
1834
|
-
$type: "color",
|
|
1835
|
-
$value: "{global.green.7}"
|
|
1836
|
-
},
|
|
1837
|
-
"border-default": {
|
|
1838
|
-
$type: "color",
|
|
1839
|
-
$value: "{global.green.8}"
|
|
1840
|
-
},
|
|
1841
|
-
"border-strong": {
|
|
1842
|
-
$type: "color",
|
|
1843
|
-
$value: "{global.green.9}"
|
|
1844
|
-
},
|
|
1845
|
-
"text-subtle": {
|
|
1846
|
-
$type: "color",
|
|
1847
|
-
$value: "{global.green.10}"
|
|
1848
|
-
},
|
|
1849
|
-
"text-default": {
|
|
1850
|
-
$type: "color",
|
|
1851
|
-
$value: "{global.green.11}"
|
|
1852
|
-
},
|
|
1853
|
-
"base-default": {
|
|
1854
|
-
$type: "color",
|
|
1855
|
-
$value: "{global.green.12}"
|
|
1856
|
-
},
|
|
1857
|
-
"base-hover": {
|
|
1858
|
-
$type: "color",
|
|
1859
|
-
$value: "{global.green.13}"
|
|
1860
|
-
},
|
|
1861
|
-
"base-active": {
|
|
1862
|
-
$type: "color",
|
|
1863
|
-
$value: "{global.green.14}"
|
|
1864
|
-
},
|
|
1865
|
-
"base-contrast-subtle": {
|
|
1866
|
-
$type: "color",
|
|
1867
|
-
$value: "{global.green.15}"
|
|
1868
|
-
},
|
|
1869
|
-
"base-contrast-default": {
|
|
1870
|
-
$type: "color",
|
|
1871
|
-
$value: "{global.green.16}"
|
|
1872
|
-
}
|
|
1873
|
-
},
|
|
1874
|
-
danger: {
|
|
1875
|
-
"background-default": {
|
|
1876
|
-
$type: "color",
|
|
1877
|
-
$value: "{global.red.1}"
|
|
1878
|
-
},
|
|
1879
|
-
"background-tinted": {
|
|
1880
|
-
$type: "color",
|
|
1881
|
-
$value: "{global.red.2}"
|
|
1882
|
-
},
|
|
1883
|
-
"surface-default": {
|
|
1884
|
-
$type: "color",
|
|
1885
|
-
$value: "{global.red.3}"
|
|
1886
|
-
},
|
|
1887
|
-
"surface-tinted": {
|
|
1888
|
-
$type: "color",
|
|
1889
|
-
$value: "{global.red.4}"
|
|
1890
|
-
},
|
|
1891
|
-
"surface-hover": {
|
|
1892
|
-
$type: "color",
|
|
1893
|
-
$value: "{global.red.5}"
|
|
1894
|
-
},
|
|
1895
|
-
"surface-active": {
|
|
1896
|
-
$type: "color",
|
|
1897
|
-
$value: "{global.red.6}"
|
|
1898
|
-
},
|
|
1899
|
-
"border-subtle": {
|
|
1900
|
-
$type: "color",
|
|
1901
|
-
$value: "{global.red.7}"
|
|
1902
|
-
},
|
|
1903
|
-
"border-default": {
|
|
1904
|
-
$type: "color",
|
|
1905
|
-
$value: "{global.red.8}"
|
|
1906
|
-
},
|
|
1907
|
-
"border-strong": {
|
|
1908
|
-
$type: "color",
|
|
1909
|
-
$value: "{global.red.9}"
|
|
1910
|
-
},
|
|
1911
|
-
"text-subtle": {
|
|
1912
|
-
$type: "color",
|
|
1913
|
-
$value: "{global.red.10}"
|
|
1914
|
-
},
|
|
1915
|
-
"text-default": {
|
|
1916
|
-
$type: "color",
|
|
1917
|
-
$value: "{global.red.11}"
|
|
1918
|
-
},
|
|
1919
|
-
"base-default": {
|
|
1920
|
-
$type: "color",
|
|
1921
|
-
$value: "{global.red.12}"
|
|
1922
|
-
},
|
|
1923
|
-
"base-hover": {
|
|
1924
|
-
$type: "color",
|
|
1925
|
-
$value: "{global.red.13}"
|
|
1926
|
-
},
|
|
1927
|
-
"base-active": {
|
|
1928
|
-
$type: "color",
|
|
1929
|
-
$value: "{global.red.14}"
|
|
1930
|
-
},
|
|
1931
|
-
"base-contrast-subtle": {
|
|
1932
|
-
$type: "color",
|
|
1933
|
-
$value: "{global.red.15}"
|
|
1934
|
-
},
|
|
1935
|
-
"base-contrast-default": {
|
|
1936
|
-
$type: "color",
|
|
1937
|
-
$value: "{global.red.16}"
|
|
1938
|
-
}
|
|
1939
|
-
},
|
|
1940
|
-
info: {
|
|
1941
|
-
"background-default": {
|
|
1942
|
-
$type: "color",
|
|
1943
|
-
$value: "{global.blue.1}"
|
|
1944
|
-
},
|
|
1945
|
-
"background-tinted": {
|
|
1946
|
-
$type: "color",
|
|
1947
|
-
$value: "{global.blue.2}"
|
|
1948
|
-
},
|
|
1949
|
-
"surface-default": {
|
|
1950
|
-
$type: "color",
|
|
1951
|
-
$value: "{global.blue.3}"
|
|
1952
|
-
},
|
|
1953
|
-
"surface-tinted": {
|
|
1954
|
-
$type: "color",
|
|
1955
|
-
$value: "{global.blue.4}"
|
|
1956
|
-
},
|
|
1957
|
-
"surface-hover": {
|
|
1958
|
-
$type: "color",
|
|
1959
|
-
$value: "{global.blue.5}"
|
|
1960
|
-
},
|
|
1961
|
-
"surface-active": {
|
|
1962
|
-
$type: "color",
|
|
1963
|
-
$value: "{global.blue.6}"
|
|
1964
|
-
},
|
|
1965
|
-
"border-subtle": {
|
|
1966
|
-
$type: "color",
|
|
1967
|
-
$value: "{global.blue.7}"
|
|
1968
|
-
},
|
|
1969
|
-
"border-default": {
|
|
1970
|
-
$type: "color",
|
|
1971
|
-
$value: "{global.blue.8}"
|
|
1972
|
-
},
|
|
1973
|
-
"border-strong": {
|
|
1974
|
-
$type: "color",
|
|
1975
|
-
$value: "{global.blue.9}"
|
|
1976
|
-
},
|
|
1977
|
-
"text-subtle": {
|
|
1978
|
-
$type: "color",
|
|
1979
|
-
$value: "{global.blue.10}"
|
|
1980
|
-
},
|
|
1981
|
-
"text-default": {
|
|
1982
|
-
$type: "color",
|
|
1983
|
-
$value: "{global.blue.11}"
|
|
1984
|
-
},
|
|
1985
|
-
"base-default": {
|
|
1986
|
-
$type: "color",
|
|
1987
|
-
$value: "{global.blue.12}"
|
|
1988
|
-
},
|
|
1989
|
-
"base-hover": {
|
|
1990
|
-
$type: "color",
|
|
1991
|
-
$value: "{global.blue.13}"
|
|
1992
|
-
},
|
|
1993
|
-
"base-active": {
|
|
1994
|
-
$type: "color",
|
|
1995
|
-
$value: "{global.blue.14}"
|
|
1996
|
-
},
|
|
1997
|
-
"base-contrast-subtle": {
|
|
1998
|
-
$type: "color",
|
|
1999
|
-
$value: "{global.blue.15}"
|
|
2000
|
-
},
|
|
2001
|
-
"base-contrast-default": {
|
|
2002
|
-
$type: "color",
|
|
2003
|
-
$value: "{global.blue.16}"
|
|
2004
|
-
}
|
|
2005
|
-
},
|
|
2006
|
-
warning: {
|
|
2007
|
-
"background-default": {
|
|
2008
|
-
$type: "color",
|
|
2009
|
-
$value: "{global.orange.1}"
|
|
2010
|
-
},
|
|
2011
|
-
"background-tinted": {
|
|
2012
|
-
$type: "color",
|
|
2013
|
-
$value: "{global.orange.2}"
|
|
2014
|
-
},
|
|
2015
|
-
"surface-default": {
|
|
2016
|
-
$type: "color",
|
|
2017
|
-
$value: "{global.orange.3}"
|
|
2018
|
-
},
|
|
2019
|
-
"surface-tinted": {
|
|
2020
|
-
$type: "color",
|
|
2021
|
-
$value: "{global.orange.4}"
|
|
2022
|
-
},
|
|
2023
|
-
"surface-hover": {
|
|
2024
|
-
$type: "color",
|
|
2025
|
-
$value: "{global.orange.5}"
|
|
2026
|
-
},
|
|
2027
|
-
"surface-active": {
|
|
2028
|
-
$type: "color",
|
|
2029
|
-
$value: "{global.orange.6}"
|
|
2030
|
-
},
|
|
2031
|
-
"border-subtle": {
|
|
2032
|
-
$type: "color",
|
|
2033
|
-
$value: "{global.orange.7}"
|
|
2034
|
-
},
|
|
2035
|
-
"border-default": {
|
|
2036
|
-
$type: "color",
|
|
2037
|
-
$value: "{global.orange.8}"
|
|
2038
|
-
},
|
|
2039
|
-
"border-strong": {
|
|
2040
|
-
$type: "color",
|
|
2041
|
-
$value: "{global.orange.9}"
|
|
2042
|
-
},
|
|
2043
|
-
"text-subtle": {
|
|
2044
|
-
$type: "color",
|
|
2045
|
-
$value: "{global.orange.10}"
|
|
2046
|
-
},
|
|
2047
|
-
"text-default": {
|
|
2048
|
-
$type: "color",
|
|
2049
|
-
$value: "{global.orange.11}"
|
|
2050
|
-
},
|
|
2051
|
-
"base-default": {
|
|
2052
|
-
$type: "color",
|
|
2053
|
-
$value: "{global.orange.12}"
|
|
2054
|
-
},
|
|
2055
|
-
"base-hover": {
|
|
2056
|
-
$type: "color",
|
|
2057
|
-
$value: "{global.orange.13}"
|
|
2058
|
-
},
|
|
2059
|
-
"base-active": {
|
|
2060
|
-
$type: "color",
|
|
2061
|
-
$value: "{global.orange.14}"
|
|
2062
|
-
},
|
|
2063
|
-
"base-contrast-subtle": {
|
|
2064
|
-
$type: "color",
|
|
2065
|
-
$value: "{global.orange.15}"
|
|
2066
|
-
},
|
|
2067
|
-
"base-contrast-default": {
|
|
2068
|
-
$type: "color",
|
|
2069
|
-
$value: "{global.orange.16}"
|
|
2070
|
-
}
|
|
2071
|
-
},
|
|
2072
1805
|
focus: {
|
|
2073
1806
|
inner: {
|
|
2074
1807
|
$type: "color",
|
|
@@ -2084,7 +1817,7 @@ var color_base_template_default = {
|
|
|
2084
1817
|
color: {
|
|
2085
1818
|
visited: {
|
|
2086
1819
|
$type: "color",
|
|
2087
|
-
$value: "{
|
|
1820
|
+
$value: "{color.link.visited}"
|
|
2088
1821
|
}
|
|
2089
1822
|
}
|
|
2090
1823
|
}
|
|
@@ -2227,7 +1960,7 @@ var color_template_default2 = {
|
|
|
2227
1960
|
};
|
|
2228
1961
|
|
|
2229
1962
|
// src/tokens/create/generators/semantic.ts
|
|
2230
|
-
var generateSemantic = (colors) => {
|
|
1963
|
+
var generateSemantic = (colors, _themeName) => {
|
|
2231
1964
|
const mainColorNames = Object.keys(colors.main);
|
|
2232
1965
|
const supportColorNames = Object.keys(colors.support);
|
|
2233
1966
|
const modes = {
|
|
@@ -2261,7 +1994,8 @@ var generateSemantic = (colors) => {
|
|
|
2261
1994
|
}
|
|
2262
1995
|
}
|
|
2263
1996
|
const customColors = [...mainColorNames, "neutral", ...supportColorNames];
|
|
2264
|
-
const
|
|
1997
|
+
const allColors = [...customColors, ...baseColorNames];
|
|
1998
|
+
const semanticColorTokens = allColors.map(
|
|
2265
1999
|
(colorName) => [
|
|
2266
2000
|
colorName,
|
|
2267
2001
|
R5.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), color_template_default)
|
|
@@ -2412,7 +2146,7 @@ var theme_template_default = {
|
|
|
2412
2146
|
var generateTheme = (colors, themeName, borderRadius) => {
|
|
2413
2147
|
const mainColorNames = Object.keys(colors.main);
|
|
2414
2148
|
const supportColorNames = Object.keys(colors.support);
|
|
2415
|
-
const customColors = [...mainColorNames, "neutral", ...supportColorNames];
|
|
2149
|
+
const customColors = [...mainColorNames, "neutral", ...supportColorNames, ...baseColorNames];
|
|
2416
2150
|
const themeColorTokens = Object.fromEntries(
|
|
2417
2151
|
customColors.map(
|
|
2418
2152
|
(colorName) => [
|
|
@@ -2425,7 +2159,13 @@ var generateTheme = (colors, themeName, borderRadius) => {
|
|
|
2425
2159
|
const themeFile = {
|
|
2426
2160
|
color: {
|
|
2427
2161
|
...themeColorTokens,
|
|
2428
|
-
...themeBaseFileColor
|
|
2162
|
+
...themeBaseFileColor,
|
|
2163
|
+
link: {
|
|
2164
|
+
visited: {
|
|
2165
|
+
$type: "color",
|
|
2166
|
+
$value: `{${themeName}.link.visited}`
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2429
2169
|
},
|
|
2430
2170
|
...remainingThemeFile
|
|
2431
2171
|
};
|
|
@@ -2481,7 +2221,7 @@ var generateTypography = (themeName, { fontFamily }) => {
|
|
|
2481
2221
|
var createTokens = async (opts) => {
|
|
2482
2222
|
const { colors, typography: typography2, name, borderRadius, overrides } = opts;
|
|
2483
2223
|
const colorSchemes = ["light", "dark"];
|
|
2484
|
-
const semantic2 = generateSemantic(colors);
|
|
2224
|
+
const semantic2 = generateSemantic(colors, name);
|
|
2485
2225
|
const tokenSets = new Map([
|
|
2486
2226
|
...getDefaultTokens([
|
|
2487
2227
|
"primitives/globals",
|
|
@@ -2496,7 +2236,6 @@ var createTokens = async (opts) => {
|
|
|
2496
2236
|
[`primitives/modes/typography/primary/${name}`, generateTypography(name, typography2)],
|
|
2497
2237
|
[`primitives/modes/typography/secondary/${name}`, generateTypography(name, typography2)],
|
|
2498
2238
|
...colorSchemes.flatMap((scheme) => [
|
|
2499
|
-
[`primitives/modes/color-scheme/${scheme}/global`, generateColorGlobal(scheme)],
|
|
2500
2239
|
[`primitives/modes/color-scheme/${scheme}/${name}`, generateColorScheme(name, scheme, colors, overrides)]
|
|
2501
2240
|
]),
|
|
2502
2241
|
[`themes/${name}`, generateTheme(colors, name, borderRadius)],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-template.d.ts","sourceRoot":"","sources":["../../../src/scripts/update-template.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"update-template.d.ts","sourceRoot":"","sources":["../../../src/scripts/update-template.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,eAAe,qBAwF3B,CAAC"}
|