@adobe/spectrum-tokens 13.10.1 → 13.11.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 +49 -150
- package/dist/json/drover.json +7 -0
- package/dist/json/variables.json +1591 -6
- package/package.json +1 -1
- package/schemas/token-types/token.json +3 -0
- package/schemas/token-types/typography.json +32 -0
- package/src/color-aliases.json +1 -1
- package/src/color-palette.json +1 -1
- package/src/icons.json +1 -1
- package/src/layout-component.json +19 -3
- package/src/layout.json +75 -0
- package/src/semantic-color-palette.json +1 -1
- package/src/typography.json +167 -2
- package/schemas/component.json +0 -29
- package/schemas/components/action-bar.json +0 -18
- package/schemas/components/action-button.json +0 -62
- package/schemas/components/action-group.json +0 -69
- package/schemas/components/alert-banner.json +0 -29
- package/schemas/components/alert-dialog.json +0 -42
- package/schemas/components/avatar.json +0 -30
- package/schemas/components/badge.json +0 -50
- package/schemas/components/body.json +0 -25
- package/schemas/components/bottom-navigation-android.json +0 -37
- package/schemas/components/breadcrumbs.json +0 -18
- package/schemas/components/button-group.json +0 -28
- package/schemas/components/button.json +0 -60
- package/schemas/components/checkbox-group.json +0 -53
- package/schemas/components/checkbox.json +0 -52
- package/schemas/components/close-button.json +0 -35
- package/schemas/components/code.json +0 -21
- package/schemas/components/color-area.json +0 -64
- package/schemas/components/color-loupe.json +0 -21
- package/schemas/components/color-slider.json +0 -52
- package/schemas/components/color-wheel.json +0 -47
- package/schemas/components/combo-box.json +0 -84
- package/schemas/components/contextual-help.json +0 -64
- package/schemas/components/detail.json +0 -26
- package/schemas/components/divider.json +0 -23
- package/schemas/components/field-label.json +0 -39
- package/schemas/components/heading.json +0 -29
- package/schemas/components/help-text.json +0 -35
- package/schemas/components/in-line-alert.json +0 -25
- package/schemas/components/link.json +0 -32
- package/schemas/components/menu.json +0 -65
- package/schemas/components/meter.json +0 -37
- package/schemas/components/picker.json +0 -85
- package/schemas/components/popover.json +0 -65
- package/schemas/components/progress-bar.json +0 -50
- package/schemas/components/progress-circle.json +0 -41
- package/schemas/components/radio-group.json +0 -62
- package/schemas/components/rating.json +0 -31
- package/schemas/components/scroll-zoom-bar.json +0 -44
- package/schemas/components/side-navigation.json +0 -18
- package/schemas/components/slider.json +0 -74
- package/schemas/components/status-light.json +0 -44
- package/schemas/components/swatch-group.json +0 -38
- package/schemas/components/swatch.json +0 -45
- package/schemas/components/switch.json +0 -42
- package/schemas/components/tab-bar-ios.json +0 -37
- package/schemas/components/tabs.json +0 -32
- package/schemas/components/tag.json +0 -41
- package/schemas/components/text-area.json +0 -98
- package/schemas/components/text-field.json +0 -86
- package/schemas/components/toast.json +0 -29
- package/schemas/components/tooltip.json +0 -50
- package/schemas/components/tray.json +0 -17
- package/schemas/components/tree-view.json +0 -50
- package/schemas/types/component-size.json +0 -8
- package/schemas/types/hex-color.json +0 -8
- package/schemas/types/typography-classification.json +0 -9
- package/schemas/types/typography-script.json +0 -9
- package/schemas/types/workflow-icon.json +0 -901
- package/test/componentSchemaValidator.test.js +0 -74
- package/test/schemaValidator.test.js +0 -74
|
@@ -1,74 +0,0 @@
|
|
|
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 test from "ava";
|
|
14
|
-
import Ajv from "ajv/dist/2020.js";
|
|
15
|
-
import addFormats from "ajv-formats";
|
|
16
|
-
import { glob } from "glob";
|
|
17
|
-
import { readFile } from "fs/promises";
|
|
18
|
-
|
|
19
|
-
const readJSON = async (filePath) =>
|
|
20
|
-
JSON.parse(await readFile(filePath, "utf8"));
|
|
21
|
-
const componentSchema = await readJSON("schemas/component.json");
|
|
22
|
-
|
|
23
|
-
const fileNames = await glob("schemas/components/*.json");
|
|
24
|
-
const files = await Promise.all(
|
|
25
|
-
fileNames.map(async (fileName) => {
|
|
26
|
-
return { fileName, json: await readJSON(fileName) };
|
|
27
|
-
}),
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
const ajv = new Ajv();
|
|
31
|
-
addFormats(ajv);
|
|
32
|
-
ajv.addMetaSchema(componentSchema);
|
|
33
|
-
const schemaFiles = await glob("schemas/types/*.json");
|
|
34
|
-
for (const schemaFile of schemaFiles) {
|
|
35
|
-
const schema = await readJSON(schemaFile);
|
|
36
|
-
ajv.addSchema(schema);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
for (const keyword of Object.keys(componentSchema.properties)) {
|
|
40
|
-
ajv.addKeyword({ keyword, metaSchema: componentSchema.properties[keyword] });
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
test("component schema should be valid", async (t) => {
|
|
44
|
-
const valid = ajv.validateSchema(componentSchema);
|
|
45
|
-
t.true(valid);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test("Every component schema should validate against the definition", (t) => {
|
|
49
|
-
let valid = true;
|
|
50
|
-
for (const file of files) {
|
|
51
|
-
if (!ajv.validateSchema(file.json)) {
|
|
52
|
-
valid = false;
|
|
53
|
-
console.log(`${file.fileName} failed validation`);
|
|
54
|
-
console.log(ajv.errors);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
t.true(valid);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
test("component examples should validate against the definition", (t) => {
|
|
61
|
-
let valid = true;
|
|
62
|
-
for (const file of files) {
|
|
63
|
-
const validate = ajv.compile(file.json);
|
|
64
|
-
if (!Object.hasOwn(file.json, "examples")) file.json.examples = [];
|
|
65
|
-
for (const example of file.json.examples) {
|
|
66
|
-
if (!validate(example)) {
|
|
67
|
-
valid = false;
|
|
68
|
-
console.log(`${file.fileName} failed validation`);
|
|
69
|
-
console.log(validate.errors);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
t.true(valid);
|
|
74
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
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 test from "ava";
|
|
14
|
-
import Ajv from "ajv/dist/2020.js";
|
|
15
|
-
import addFormats from "ajv-formats";
|
|
16
|
-
import { glob } from "glob";
|
|
17
|
-
import { readFile } from "fs/promises";
|
|
18
|
-
|
|
19
|
-
const readJSON = async (filePath) =>
|
|
20
|
-
JSON.parse(await readFile(filePath, "utf8"));
|
|
21
|
-
const componentSchema = await readJSON("schemas/component.json");
|
|
22
|
-
|
|
23
|
-
const fileNames = await glob("schemas/components/*.json");
|
|
24
|
-
const files = await Promise.all(
|
|
25
|
-
fileNames.map(async (fileName) => {
|
|
26
|
-
return { fileName, json: await readJSON(fileName) };
|
|
27
|
-
}),
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
const ajv = new Ajv();
|
|
31
|
-
addFormats(ajv);
|
|
32
|
-
ajv.addMetaSchema(componentSchema);
|
|
33
|
-
const schemaFiles = await glob("schemas/types/*.json");
|
|
34
|
-
for (const schemaFile of schemaFiles) {
|
|
35
|
-
const schema = await readJSON(schemaFile);
|
|
36
|
-
ajv.addSchema(schema);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
for (const keyword of Object.keys(componentSchema.properties)) {
|
|
40
|
-
ajv.addKeyword({ keyword, metaSchema: componentSchema.properties[keyword] });
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
test("component schema should be valid", async (t) => {
|
|
44
|
-
const valid = ajv.validateSchema(componentSchema);
|
|
45
|
-
t.true(valid);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test("Every component schema should validate against the definition", (t) => {
|
|
49
|
-
let valid = true;
|
|
50
|
-
for (const file of files) {
|
|
51
|
-
if (!ajv.validateSchema(file.json)) {
|
|
52
|
-
valid = false;
|
|
53
|
-
console.log(`${file.fileName} failed validation`);
|
|
54
|
-
console.log(ajv.errors);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
t.true(valid);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
test("component examples should validate against the definition", (t) => {
|
|
61
|
-
let valid = true;
|
|
62
|
-
for (const file of files) {
|
|
63
|
-
const validate = ajv.compile(file.json);
|
|
64
|
-
if (!Object.hasOwn(file.json, "examples")) file.json.examples = [];
|
|
65
|
-
for (const example of file.json.examples) {
|
|
66
|
-
if (!validate(example)) {
|
|
67
|
-
valid = false;
|
|
68
|
-
console.log(`${file.fileName} failed validation`);
|
|
69
|
-
console.log(validate.errors);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
t.true(valid);
|
|
74
|
-
});
|