@astryxdesign/theme-matcha 0.7.6-canary.a587813 → 0.7.6-canary.a64fd1e
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/package.json +18 -4
- package/dist/matchaColorMapping.test.d.ts +0 -2
- package/dist/matchaColorMapping.test.d.ts.map +0 -1
- package/dist/matchaPalettes.test.d.ts +0 -2
- package/dist/matchaPalettes.test.d.ts.map +0 -1
- package/dist/matchaTheme.spacing.test.d.ts +0 -2
- package/dist/matchaTheme.spacing.test.d.ts.map +0 -1
- package/dist/matchaTheme.test.d.ts +0 -2
- package/dist/matchaTheme.test.d.ts.map +0 -1
- package/src/matchaColorMapping.test.ts +0 -48
- package/src/matchaPalettes.test.ts +0 -50
- package/src/matchaTheme.spacing.test.ts +0 -46
- package/src/matchaTheme.test.ts +0 -77
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/theme-matcha",
|
|
3
|
-
"version": "0.7.6-canary.
|
|
3
|
+
"version": "0.7.6-canary.a64fd1e",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Earthy greens with a calm, organic feel. Naturalistic and grounded, great for wellness or content-first apps.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -51,20 +51,34 @@
|
|
|
51
51
|
"src",
|
|
52
52
|
"fonts.css",
|
|
53
53
|
"fonts.css.d.ts",
|
|
54
|
-
"palette.config.json"
|
|
54
|
+
"palette.config.json",
|
|
55
|
+
"!**/*.test.*",
|
|
56
|
+
"!**/*.spec.js",
|
|
57
|
+
"!**/*.spec.jsx",
|
|
58
|
+
"!**/*.spec.mjs",
|
|
59
|
+
"!**/*.spec.cjs",
|
|
60
|
+
"!**/*.spec.ts",
|
|
61
|
+
"!**/*.spec.tsx",
|
|
62
|
+
"!**/*.spec.mts",
|
|
63
|
+
"!**/*.spec.cts",
|
|
64
|
+
"!**/*.spec.d.ts",
|
|
65
|
+
"!**/__tests__/**",
|
|
66
|
+
"!**/__mocks__/**",
|
|
67
|
+
"!**/*.bench.*"
|
|
55
68
|
],
|
|
56
69
|
"dependencies": {
|
|
57
70
|
"lucide-react": "^1.18.0"
|
|
58
71
|
},
|
|
59
72
|
"peerDependencies": {
|
|
60
|
-
"@astryxdesign/core": "0.7.6-canary.
|
|
73
|
+
"@astryxdesign/core": "0.7.6-canary.a64fd1e",
|
|
61
74
|
"react": ">=19"
|
|
62
75
|
},
|
|
63
76
|
"devDependencies": {
|
|
64
|
-
"@astryxdesign/cli": "0.7.6-canary.
|
|
77
|
+
"@astryxdesign/cli": "0.7.6-canary.a64fd1e"
|
|
65
78
|
},
|
|
66
79
|
"module": "./dist/source.mjs",
|
|
67
80
|
"scripts": {
|
|
81
|
+
"api:report": "node ../../../scripts/api-report/cli.mjs --package .",
|
|
68
82
|
"build": "node ../../../scripts/clean-dist.mjs && node ../../../scripts/generate-matcha-palette-refs.mjs --check && astryx theme build src/matchaTheme.ts -o dist/theme.css --icons-specifier ./icons.mjs && tsup && tsc --project tsconfig.build.json && node ../../../scripts/check-fully-specified.mjs"
|
|
69
83
|
}
|
|
70
84
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matchaColorMapping.test.d.ts","sourceRoot":"","sources":["../src/matchaColorMapping.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matchaPalettes.test.d.ts","sourceRoot":"","sources":["../src/matchaPalettes.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matchaTheme.spacing.test.d.ts","sourceRoot":"","sources":["../src/matchaTheme.spacing.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matchaTheme.test.d.ts","sourceRoot":"","sources":["../src/matchaTheme.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
import {readFileSync} from 'node:fs';
|
|
4
|
-
import {describe, expect, it} from 'vitest';
|
|
5
|
-
import {matchaTheme} from './matchaTheme';
|
|
6
|
-
|
|
7
|
-
const source = readFileSync(
|
|
8
|
-
new URL('./matchaTheme.ts', import.meta.url),
|
|
9
|
-
'utf8',
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
describe('matcha color token mapping completeness', () => {
|
|
13
|
-
it('does not redefine the data-visualization color system', () => {
|
|
14
|
-
expect(
|
|
15
|
-
Object.keys(matchaTheme.tokens).filter(name =>
|
|
16
|
-
name.startsWith('--color-data-'),
|
|
17
|
-
),
|
|
18
|
-
).toEqual([]);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('keeps every root color value concrete', () => {
|
|
22
|
-
for (const [name, value] of Object.entries(matchaTheme.tokens)) {
|
|
23
|
-
if (!name.startsWith('--color-')) {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
expect(typeof value, name).toBe('string');
|
|
27
|
-
expect(value, name).toMatch(
|
|
28
|
-
/^(?:transparent|#[0-9a-f]{6}(?:[0-9a-f]{2})?|light-dark\(#[0-9a-f]{6}(?:[0-9a-f]{2})?, #[0-9a-f]{6}(?:[0-9a-f]{2})?\)|color-mix\(.+\)|var\(.+\))$/i,
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('imports only the selected runtime palette projection', () => {
|
|
34
|
-
const relativeImports = [...source.matchAll(/from ['"](\.[^'"]+)['"]/g)]
|
|
35
|
-
.map(match => match[1])
|
|
36
|
-
.sort();
|
|
37
|
-
expect(relativeImports).toEqual([
|
|
38
|
-
'./icons',
|
|
39
|
-
'./matchaPaletteRefs.generated',
|
|
40
|
-
]);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('uses no one-off color literals in the maintained theme source', () => {
|
|
44
|
-
expect(source).not.toMatch(
|
|
45
|
-
/#[0-9a-f]{3,8}\b|\brgba?\(|\bhsl[a]?\(|\boklch\(|\bblack\b|\bwhite\b/i,
|
|
46
|
-
);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
import {describe, expect, it} from 'vitest';
|
|
4
|
-
import {matchaPalettes} from './matchaPalettes';
|
|
5
|
-
|
|
6
|
-
const stops = [
|
|
7
|
-
0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95,
|
|
8
|
-
100,
|
|
9
|
-
] as const;
|
|
10
|
-
const families = [
|
|
11
|
-
'neutral',
|
|
12
|
-
'blue',
|
|
13
|
-
'cyan',
|
|
14
|
-
'green',
|
|
15
|
-
'orange',
|
|
16
|
-
'pink',
|
|
17
|
-
'purple',
|
|
18
|
-
'red',
|
|
19
|
-
'teal',
|
|
20
|
-
'yellow',
|
|
21
|
-
] as const;
|
|
22
|
-
|
|
23
|
-
describe('matcha palette artifact', () => {
|
|
24
|
-
it('exposes complete reviewed light and dark ramps', () => {
|
|
25
|
-
expect(new Set(Object.keys(matchaPalettes))).toEqual(
|
|
26
|
-
new Set(['black', 'white', ...families]),
|
|
27
|
-
);
|
|
28
|
-
for (const familyName of families) {
|
|
29
|
-
const family = matchaPalettes[familyName];
|
|
30
|
-
for (const mode of ['light', 'dark'] as const) {
|
|
31
|
-
for (const stop of stops) {
|
|
32
|
-
expect(family[mode][stop]).toMatch(/^#[0-9a-f]{6}$/i);
|
|
33
|
-
}
|
|
34
|
-
expect(family[mode][0]).toBe('#000000');
|
|
35
|
-
expect(family[mode][100]).toBe('#ffffff');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('keeps Matcha semantic, categorical, and Tea Gold values exact', () => {
|
|
41
|
-
expect(matchaPalettes.neutral.light[20]).toBe('#3e481d');
|
|
42
|
-
expect(matchaPalettes.neutral.light[40]).toBe('#707e46');
|
|
43
|
-
expect(matchaPalettes.neutral.light[75]).toBe('#c0cba9');
|
|
44
|
-
expect(matchaPalettes.neutral.light[95]).toBe('#f0f0e0');
|
|
45
|
-
expect(matchaPalettes.neutral.dark[5]).toBe('#12140e');
|
|
46
|
-
expect(matchaPalettes.neutral.dark[75]).toBe('#c0cba9');
|
|
47
|
-
expect(matchaPalettes.yellow.light[80]).toBe('#f2c000');
|
|
48
|
-
expect(matchaPalettes.yellow.dark[85]).toBe('#f6d066');
|
|
49
|
-
});
|
|
50
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
import {describe, expect, it} from 'vitest';
|
|
4
|
-
import {matchaTheme} from './matchaTheme';
|
|
5
|
-
|
|
6
|
-
const ROOT_FONT_SIZE_PX = 16;
|
|
7
|
-
|
|
8
|
-
// The pixel values these steps had before they moved to rem.
|
|
9
|
-
const previousPx: Record<string, number> = {
|
|
10
|
-
'--spacing-0-5': 3,
|
|
11
|
-
'--spacing-1': 6,
|
|
12
|
-
'--spacing-1-5': 9,
|
|
13
|
-
'--spacing-2': 12,
|
|
14
|
-
'--spacing-3': 18,
|
|
15
|
-
'--spacing-4': 24,
|
|
16
|
-
'--spacing-5': 30,
|
|
17
|
-
'--spacing-6': 36,
|
|
18
|
-
'--spacing-7': 42,
|
|
19
|
-
'--spacing-8': 48,
|
|
20
|
-
'--spacing-9': 54,
|
|
21
|
-
'--spacing-10': 60,
|
|
22
|
-
'--spacing-11': 66,
|
|
23
|
-
'--spacing-12': 72,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
describe('matcha spacing steps', () => {
|
|
27
|
-
const tokens = matchaTheme.tokens as Record<string, string>;
|
|
28
|
-
const spacingSteps = Object.entries(tokens).filter(([name]) =>
|
|
29
|
-
name.startsWith('--spacing-'),
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
it('are rem, so they follow the root font size', () => {
|
|
33
|
-
expect(spacingSteps.length).toBe(Object.keys(previousPx).length);
|
|
34
|
-
for (const [name, value] of spacingSteps) {
|
|
35
|
-
expect(value, name).toMatch(/^\d+(\.\d+)?rem$/);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('keep their previous pixel values at the default 16px root', () => {
|
|
40
|
-
for (const [name, px] of Object.entries(previousPx)) {
|
|
41
|
-
expect(Number.parseFloat(tokens[name]) * ROOT_FONT_SIZE_PX, name).toBe(
|
|
42
|
-
px,
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
});
|
package/src/matchaTheme.test.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
import {describe, expect, it} from 'vitest';
|
|
4
|
-
import {resolveThemeTokens} from '@astryxdesign/core/theme';
|
|
5
|
-
import {matchaPalettes} from './matchaPalettes';
|
|
6
|
-
import {matchaTheme} from './matchaTheme';
|
|
7
|
-
|
|
8
|
-
const categoricalFamilies = [
|
|
9
|
-
'blue',
|
|
10
|
-
'cyan',
|
|
11
|
-
'green',
|
|
12
|
-
'orange',
|
|
13
|
-
'pink',
|
|
14
|
-
'purple',
|
|
15
|
-
'red',
|
|
16
|
-
'teal',
|
|
17
|
-
] as const;
|
|
18
|
-
|
|
19
|
-
describe('matcha palette mapping', () => {
|
|
20
|
-
it.each(['light', 'dark'] as const)(
|
|
21
|
-
'maps the neutral surface ladder in %s mode',
|
|
22
|
-
mode => {
|
|
23
|
-
const tokens = resolveThemeTokens(matchaTheme, {mode});
|
|
24
|
-
const ramp = matchaPalettes.neutral[mode];
|
|
25
|
-
expect(tokens['--color-background-body']).toBe(
|
|
26
|
-
ramp[mode === 'light' ? 95 : 5],
|
|
27
|
-
);
|
|
28
|
-
expect(tokens['--color-background-surface']).toBe(
|
|
29
|
-
ramp[mode === 'light' ? 100 : 10],
|
|
30
|
-
);
|
|
31
|
-
expect(tokens['--color-background-card']).toBe(
|
|
32
|
-
ramp[mode === 'light' ? 100 : 15],
|
|
33
|
-
);
|
|
34
|
-
expect(tokens['--color-text-primary']).toBe(
|
|
35
|
-
ramp[mode === 'light' ? 20 : 75],
|
|
36
|
-
);
|
|
37
|
-
expect(tokens['--color-text-secondary']).toBe(
|
|
38
|
-
ramp[mode === 'light' ? 40 : 60],
|
|
39
|
-
);
|
|
40
|
-
},
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
it.each(['light', 'dark'] as const)(
|
|
44
|
-
'maps categorical roles to reviewed %s stops',
|
|
45
|
-
mode => {
|
|
46
|
-
const tokens = resolveThemeTokens(matchaTheme, {mode});
|
|
47
|
-
for (const family of categoricalFamilies) {
|
|
48
|
-
const ramp = matchaPalettes[family][mode];
|
|
49
|
-
const backgroundStop =
|
|
50
|
-
mode === 'light' || family === 'blue' || family === 'cyan' ? 50 : 70;
|
|
51
|
-
expect(tokens[`--color-background-${family}`]).toBe(
|
|
52
|
-
`${ramp[backgroundStop]}33`,
|
|
53
|
-
);
|
|
54
|
-
expect(tokens[`--color-border-${family}`]).toBe(
|
|
55
|
-
ramp[mode === 'light' ? 50 : 70],
|
|
56
|
-
);
|
|
57
|
-
expect(tokens[`--color-icon-${family}`]).toBe(
|
|
58
|
-
ramp[mode === 'light' ? 50 : 70],
|
|
59
|
-
);
|
|
60
|
-
expect(tokens[`--color-text-${family}`]).toBe(
|
|
61
|
-
ramp[mode === 'light' ? 35 : 75],
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
it('maps warning and syntax roles to the reviewed Tea Gold ramp', () => {
|
|
68
|
-
const light = resolveThemeTokens(matchaTheme, {mode: 'light'});
|
|
69
|
-
const dark = resolveThemeTokens(matchaTheme, {mode: 'dark'});
|
|
70
|
-
expect(light['--color-warning']).toBe(matchaPalettes.yellow.light[80]);
|
|
71
|
-
expect(dark['--color-warning']).toBe(matchaPalettes.yellow.dark[85]);
|
|
72
|
-
expect(light['--color-syntax-number']).toBe(
|
|
73
|
-
matchaPalettes.yellow.light[45],
|
|
74
|
-
);
|
|
75
|
-
expect(dark['--color-syntax-number']).toBe(matchaPalettes.yellow.dark[75]);
|
|
76
|
-
});
|
|
77
|
-
});
|