@adobe/spectrum-tokens 14.14.0 → 14.15.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 +52 -0
- package/naming-exceptions.json +294 -0
- package/package.json +1 -1
- package/snapshots/validation-snapshot.json +343 -0
- package/src/color-component.json +5 -5
- package/src/layout-component.json +62 -62
- package/src/layout.json +1 -0
- package/src/typography.json +16 -0
- package/test/checkComponentProps.js +24 -4
|
@@ -10,9 +10,30 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import { readFileSync } from "node:fs";
|
|
13
14
|
import test from "ava";
|
|
14
15
|
import { getFileTokens } from "../index.js";
|
|
15
16
|
|
|
17
|
+
// Anatomy sub-part tokens (e.g. tab-item-*) keep their legacy key (the
|
|
18
|
+
// sub-part name) but carry their real parent component (e.g. "tabs"), so the
|
|
19
|
+
// key no longer starts with the component value. The cascade source of
|
|
20
|
+
// truth (packages/design-data/tokens/*.tokens.json) declares this explicitly
|
|
21
|
+
// via a pinned `legacyKey` alongside `anatomy`; read that exact set instead
|
|
22
|
+
// of loosely matching any anatomy-registry id prefix, since many ids (icon,
|
|
23
|
+
// label, field, item, ...) also legitimately prefix unrelated component keys.
|
|
24
|
+
const cascadeDecomposedKeys = new Set(
|
|
25
|
+
["color-component.tokens.json", "layout-component.tokens.json"].flatMap(
|
|
26
|
+
(file) =>
|
|
27
|
+
JSON.parse(
|
|
28
|
+
readFileSync(
|
|
29
|
+
new URL(`../../design-data/tokens/${file}`, import.meta.url),
|
|
30
|
+
),
|
|
31
|
+
)
|
|
32
|
+
.filter((t) => t.name?.anatomy && t.name?.legacyKey)
|
|
33
|
+
.map((t) => t.name.legacyKey),
|
|
34
|
+
),
|
|
35
|
+
);
|
|
36
|
+
|
|
16
37
|
test("ensure all component tokens are have component data", async (t) => {
|
|
17
38
|
const tokenData = {
|
|
18
39
|
...(await getFileTokens("color-component.json")),
|
|
@@ -20,10 +41,9 @@ test("ensure all component tokens are have component data", async (t) => {
|
|
|
20
41
|
...(await getFileTokens("icons.json")),
|
|
21
42
|
};
|
|
22
43
|
const result = Object.keys(tokenData).filter((tokenName) => {
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
);
|
|
44
|
+
if (cascadeDecomposedKeys.has(tokenName)) return false;
|
|
45
|
+
const { component } = tokenData[tokenName];
|
|
46
|
+
return !component || tokenName.indexOf(component) != 0;
|
|
27
47
|
});
|
|
28
48
|
t.deepEqual(result, []);
|
|
29
49
|
});
|