@adobe/spectrum-tokens 13.0.0-beta.9 → 13.1.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/CHANGELOG.md +9324 -0
- package/README.md +4 -0
- package/dist/json/drover.json +1006 -242
- package/dist/json/variables.json +16945 -7107
- package/index.js +60 -0
- package/moon.yml +2 -2
- package/package.json +13 -8
- package/schemas/token-types/alias.json +1 -0
- package/schemas/token-types/color-set.json +4 -3
- package/schemas/token-types/color.json +1 -0
- package/schemas/token-types/dimension.json +1 -0
- package/schemas/token-types/font-family.json +1 -0
- package/schemas/token-types/font-size.json +1 -0
- package/schemas/token-types/font-style.json +1 -0
- package/schemas/token-types/font-weight.json +1 -0
- package/schemas/token-types/gradient-stop.json +27 -0
- package/schemas/token-types/multiplier.json +2 -1
- package/schemas/token-types/opacity.json +1 -0
- package/schemas/token-types/scale-set.json +7 -0
- package/schemas/token-types/system-set.json +83 -0
- package/schemas/token-types/text-align.json +27 -0
- package/schemas/token-types/text-transform.json +1 -0
- package/schemas/token-types/token.json +14 -2
- package/src/color-aliases.json +669 -97
- package/src/color-component.json +286 -18
- package/src/color-palette.json +736 -347
- package/src/icons.json +974 -20
- package/src/layout-component.json +4686 -896
- package/src/layout.json +411 -171
- package/src/semantic-color-palette.json +125 -1
- package/src/typography.json +299 -90
- package/tasks/addIds.js +7 -9
- package/tasks/addPrivate.js +22 -0
- package/tasks/buildManifest.js +1 -1
- package/tasks/buildSpectrumTokens.js +1 -1
- package/tasks/deprecateExpress.js +1 -1
- package/tasks/diff.js +19 -5
- package/tasks/lib/augmentExpressTokens.js +1 -1
- package/test/checkComponentProps.js +29 -0
- package/test/checkId.test.js +1 -37
- package/test/checkManifest.test.js +1 -1
- package/test/checkPrivate.js +22 -0
- package/test/checkSetsUnique.js +54 -0
- package/test/checkUniqueTokenNames.js +32 -0
- package/test/componentSchemaValidator.test.js +1 -1
- package/test/deprecateExpress.test.js +1 -1
- package/test/drover.test.js +1 -1
- package/test/schemaValidator.test.js +1 -1
- package/test/schemaValidators/alias.test.js +1 -1
- package/test/snapshots/deprecateExpress.test.js.md +1 -1
- package/test/snapshots/deprecateExpress.test.js.snap +0 -0
- package/test/tokenSchemaValidator.test.js +1 -1
package/index.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { glob } from "glob";
|
|
14
|
+
|
|
15
|
+
import { resolve } from "path";
|
|
16
|
+
import { readFile } from "fs/promises";
|
|
17
|
+
import * as url from "url";
|
|
18
|
+
import { writeFile } from "fs/promises";
|
|
19
|
+
import { format } from "prettier";
|
|
20
|
+
|
|
21
|
+
export const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
22
|
+
|
|
23
|
+
export const tokenFileNames = await glob(
|
|
24
|
+
`${resolve(__dirname, "./src")}/**/*.json`,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export const readJson = async (fileName) =>
|
|
28
|
+
JSON.parse(await readFile(fileName, "utf8"));
|
|
29
|
+
|
|
30
|
+
export const writeJson = async (fileName, jsonData) => {
|
|
31
|
+
await writeFile(
|
|
32
|
+
fileName,
|
|
33
|
+
await format(JSON.stringify(jsonData), { parser: "json-stringify" }),
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const isDeprecated = (token) =>
|
|
38
|
+
(Object.hasOwn(token, "deprecated") && token.deprecated == true) ||
|
|
39
|
+
(Object.hasOwn(token, "sets") &&
|
|
40
|
+
Object.values(token.sets).every(
|
|
41
|
+
(setValue) =>
|
|
42
|
+
Object.hasOwn(setValue, "deprecated") && setValue.deprecated == true,
|
|
43
|
+
));
|
|
44
|
+
|
|
45
|
+
export const getFileTokens = async (tokenFileName) =>
|
|
46
|
+
await readJson(resolve(__dirname, "src", tokenFileName));
|
|
47
|
+
|
|
48
|
+
export const getAllTokens = async () => {
|
|
49
|
+
return await Promise.all(tokenFileNames.map(getFileTokens)).then(
|
|
50
|
+
(tokenFileDataAr) => {
|
|
51
|
+
return tokenFileDataAr.reduce(
|
|
52
|
+
(tokenDataAcc, tokenFileData) => ({
|
|
53
|
+
...tokenDataAcc,
|
|
54
|
+
...tokenFileData,
|
|
55
|
+
}),
|
|
56
|
+
{},
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
};
|
package/moon.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright 2024 Adobe. All rights reserved.
|
|
2
2
|
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License. You may obtain a copy
|
|
4
4
|
# of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
8
|
# OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
9
|
# governing permissions and limitations under the License.
|
|
10
|
-
|
|
10
|
+
$schema: "https://moonrepo.dev/schemas/project.json"
|
|
11
11
|
fileGroups:
|
|
12
12
|
sources:
|
|
13
13
|
- "src/**/*"
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spectrum-tokens",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.1.0",
|
|
4
4
|
"description": "Design tokens for Spectrum, Adobe's design system",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "index.js",
|
|
7
7
|
"tokens": "dist/json/variables.json",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -17,16 +17,21 @@
|
|
|
17
17
|
"bugs": {
|
|
18
18
|
"url": "https://github.com/adobe/spectrum-tokens/issues"
|
|
19
19
|
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"provenance": true
|
|
22
|
+
},
|
|
20
23
|
"homepage": "https://github.com/adobe/spectrum-tokens/tree/main/packages/tokens#readme",
|
|
21
24
|
"devDependencies": {
|
|
22
|
-
"ajv": "^8.
|
|
23
|
-
"ajv-formats": "^
|
|
25
|
+
"ajv": "^8.17.1",
|
|
26
|
+
"ajv-formats": "^3.0.1",
|
|
24
27
|
"deep-object-diff": "^1.1.9",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
28
|
+
"find-duplicated-property-keys": "^1.2.9",
|
|
29
|
+
"glob": "^11.0.0",
|
|
30
|
+
"style-dictionary": "^3.9.2",
|
|
27
31
|
"style-dictionary-sets": "^2.3.0",
|
|
28
|
-
"tar": "^
|
|
29
|
-
"tmp-promise": "^3.0.3"
|
|
32
|
+
"tar": "^7.4.3",
|
|
33
|
+
"tmp-promise": "^3.0.3",
|
|
34
|
+
"@adobe/token-diff-generator": "1.3.0"
|
|
30
35
|
},
|
|
31
36
|
"scripts": {}
|
|
32
37
|
}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/color.json"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
-
"required": ["light", "dark"
|
|
31
|
+
"required": ["light", "dark"]
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"properties": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/alias.json"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
"required": ["light", "dark"
|
|
45
|
+
"required": ["light", "dark"]
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
"properties": {
|
|
@@ -56,11 +56,12 @@
|
|
|
56
56
|
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/opacity.json"
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
|
-
"required": ["light", "dark"
|
|
59
|
+
"required": ["light", "dark"]
|
|
60
60
|
}
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"component": {},
|
|
64
|
+
"private": {},
|
|
64
65
|
"deprecated": {},
|
|
65
66
|
"deprecated_comment": {},
|
|
66
67
|
"uuid": {}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"pattern": "^rgba\\((([0-1]?[0-9]?[0-9]?|2[0-4][0-9]|25[0-5]),\\s?){3}(0|1|0?\\.\\d+)\\)|rgb\\(([0-1]?[0-9]?[0-9]?|2[0-4][0-9]|25[0-5]){1,3}(,\\s?\\d{1,3}%?){2}\\)$"
|
|
19
19
|
},
|
|
20
20
|
"component": {},
|
|
21
|
+
"private": {},
|
|
21
22
|
"deprecated": {},
|
|
22
23
|
"deprecated_comment": {},
|
|
23
24
|
"uuid": {}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/gradient-stop.json",
|
|
4
|
+
"title": "Color Stop",
|
|
5
|
+
"description": "Gradient stop positions, being a ratio along the gradient's axis. Start is 0, end is 1.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"allOf": [
|
|
8
|
+
{
|
|
9
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/token.json"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"properties": {
|
|
13
|
+
"$schema": {
|
|
14
|
+
"const": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/gradient-stop.json"
|
|
15
|
+
},
|
|
16
|
+
"value": {
|
|
17
|
+
"type": "number",
|
|
18
|
+
"minimum": 0,
|
|
19
|
+
"maximum": 1
|
|
20
|
+
},
|
|
21
|
+
"component": {},
|
|
22
|
+
"private": {},
|
|
23
|
+
"deprecated": {},
|
|
24
|
+
"deprecated_comment": {},
|
|
25
|
+
"uuid": {}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
"const": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/multiplier.json"
|
|
15
15
|
},
|
|
16
16
|
"value": {
|
|
17
|
-
"type": "
|
|
17
|
+
"type": "number",
|
|
18
18
|
"pattern": "^(?:\\d+\\.?\\d*)|(?:\\.?\\d+)$"
|
|
19
19
|
},
|
|
20
20
|
"component": {},
|
|
21
|
+
"private": {},
|
|
21
22
|
"deprecated": {},
|
|
22
23
|
"deprecated_comment": {},
|
|
23
24
|
"uuid": {}
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/alias.json"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/multiplier.json"
|
|
29
32
|
}
|
|
30
33
|
]
|
|
31
34
|
},
|
|
@@ -39,6 +42,9 @@
|
|
|
39
42
|
},
|
|
40
43
|
{
|
|
41
44
|
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/alias.json"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/multiplier.json"
|
|
42
48
|
}
|
|
43
49
|
]
|
|
44
50
|
}
|
|
@@ -46,6 +52,7 @@
|
|
|
46
52
|
"required": ["mobile", "desktop"]
|
|
47
53
|
},
|
|
48
54
|
"component": {},
|
|
55
|
+
"private": {},
|
|
49
56
|
"deprecated": {},
|
|
50
57
|
"deprecated_comment": {},
|
|
51
58
|
"uuid": {}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/system-set.json",
|
|
4
|
+
"title": "System set",
|
|
5
|
+
"description": "A set that contains tokens that change based on system.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"allOf": [
|
|
8
|
+
{
|
|
9
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/set.json"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"properties": {
|
|
13
|
+
"$schema": {
|
|
14
|
+
"const": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/system-set.json"
|
|
15
|
+
},
|
|
16
|
+
"sets": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"anyOf": [
|
|
19
|
+
{
|
|
20
|
+
"properties": {
|
|
21
|
+
"spectrum": {
|
|
22
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/token.json"
|
|
23
|
+
},
|
|
24
|
+
"express": {
|
|
25
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/token.json"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": ["spectrum", "express"]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"properties": {
|
|
32
|
+
"spectrum": {
|
|
33
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/alias.json"
|
|
34
|
+
},
|
|
35
|
+
"express": {
|
|
36
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/alias.json"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"required": ["spectrum", "express"]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"properties": {
|
|
43
|
+
"spectrum": {
|
|
44
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/color-set.json"
|
|
45
|
+
},
|
|
46
|
+
"express": {
|
|
47
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/color-set.json"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"required": ["spectrum", "express"]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"properties": {
|
|
54
|
+
"spectrum": {
|
|
55
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/scale-set.json"
|
|
56
|
+
},
|
|
57
|
+
"express": {
|
|
58
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/scale-set.json"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"required": ["spectrum", "express"]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"properties": {
|
|
65
|
+
"spectrum": {
|
|
66
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/dimension.json"
|
|
67
|
+
},
|
|
68
|
+
"express": {
|
|
69
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/scale-set.json"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"required": ["spectrum", "express"]
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"component": {},
|
|
77
|
+
"private": {},
|
|
78
|
+
"deprecated": {},
|
|
79
|
+
"deprecated_comment": {},
|
|
80
|
+
"uuid": {}
|
|
81
|
+
},
|
|
82
|
+
"required": ["sets"]
|
|
83
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/text-align.json",
|
|
4
|
+
"title": "Text align",
|
|
5
|
+
"description": "Sets the horizontal alignment of the inline-level content inside a block element",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"allOf": [
|
|
8
|
+
{
|
|
9
|
+
"$ref": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/token.json"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"properties": {
|
|
13
|
+
"$schema": {
|
|
14
|
+
"const": "https://opensource.adobe.com/spectrum-tokens/schemas/token-types/text-align.json"
|
|
15
|
+
},
|
|
16
|
+
"value": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"enum": ["start", "center", "end"],
|
|
19
|
+
"default": "start"
|
|
20
|
+
},
|
|
21
|
+
"component": {},
|
|
22
|
+
"private": {},
|
|
23
|
+
"deprecated": {},
|
|
24
|
+
"deprecated_comment": {},
|
|
25
|
+
"uuid": {}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -6,13 +6,25 @@
|
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"value": {
|
|
9
|
-
"
|
|
9
|
+
"anyOf": [
|
|
10
|
+
{
|
|
11
|
+
"type": "number"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"type": "string"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
10
17
|
},
|
|
11
18
|
"component": {
|
|
12
19
|
"type": "string"
|
|
13
20
|
},
|
|
21
|
+
"private": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"default": false
|
|
24
|
+
},
|
|
14
25
|
"deprecated": {
|
|
15
|
-
"type": "boolean"
|
|
26
|
+
"type": "boolean",
|
|
27
|
+
"default": false
|
|
16
28
|
},
|
|
17
29
|
"deprecated_comment": {
|
|
18
30
|
"type": "string"
|