@astryxdesign/theme-y2k 0.7.6-canary.5cd7a15 → 0.7.6-canary.6224efd
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/dist/theme.css +9 -0
- package/dist/y2k.js +9 -0
- package/package.json +17 -4
- package/dist/y2kColorMapping.test.d.ts +0 -2
- package/dist/y2kColorMapping.test.d.ts.map +0 -1
- package/dist/y2kPalettes.test.d.ts +0 -2
- package/dist/y2kPalettes.test.d.ts.map +0 -1
- package/dist/y2kTheme.spacing.test.d.ts +0 -2
- package/dist/y2kTheme.spacing.test.d.ts.map +0 -1
- package/dist/y2kTheme.test.d.ts +0 -2
- package/dist/y2kTheme.test.d.ts.map +0 -1
- package/src/__snapshots__/y2kPalettes.test.ts.snap +0 -256
- package/src/y2kColorMapping.test.ts +0 -77
- package/src/y2kPalettes.test.ts +0 -68
- package/src/y2kTheme.spacing.test.ts +0 -42
- package/src/y2kTheme.test.ts +0 -73
package/dist/theme.css
CHANGED
|
@@ -156,6 +156,15 @@
|
|
|
156
156
|
--duration-slow-min: 480ms;
|
|
157
157
|
--duration-slow: 600ms;
|
|
158
158
|
--duration-slow-max: 750ms;
|
|
159
|
+
--_astryx-pre-tempo-duration-fast-min: 80ms;
|
|
160
|
+
--_astryx-pre-tempo-duration-fast: 100ms;
|
|
161
|
+
--_astryx-pre-tempo-duration-fast-max: 125ms;
|
|
162
|
+
--_astryx-pre-tempo-duration-medium-min: 200ms;
|
|
163
|
+
--_astryx-pre-tempo-duration-medium: 250ms;
|
|
164
|
+
--_astryx-pre-tempo-duration-medium-max: 315ms;
|
|
165
|
+
--_astryx-pre-tempo-duration-slow-min: 480ms;
|
|
166
|
+
--_astryx-pre-tempo-duration-slow: 600ms;
|
|
167
|
+
--_astryx-pre-tempo-duration-slow-max: 750ms;
|
|
159
168
|
--font-family-body: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
160
169
|
--font-family-heading: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
161
170
|
--font-family-code: "JetBrains Mono", "SF Mono", Monaco, Consolas, monospace;
|
package/dist/y2k.js
CHANGED
|
@@ -88,6 +88,15 @@ export const y2kTheme = {
|
|
|
88
88
|
"--duration-slow-min": "480ms",
|
|
89
89
|
"--duration-slow": "600ms",
|
|
90
90
|
"--duration-slow-max": "750ms",
|
|
91
|
+
"--_astryx-pre-tempo-duration-fast-min": "80ms",
|
|
92
|
+
"--_astryx-pre-tempo-duration-fast": "100ms",
|
|
93
|
+
"--_astryx-pre-tempo-duration-fast-max": "125ms",
|
|
94
|
+
"--_astryx-pre-tempo-duration-medium-min": "200ms",
|
|
95
|
+
"--_astryx-pre-tempo-duration-medium": "250ms",
|
|
96
|
+
"--_astryx-pre-tempo-duration-medium-max": "315ms",
|
|
97
|
+
"--_astryx-pre-tempo-duration-slow-min": "480ms",
|
|
98
|
+
"--_astryx-pre-tempo-duration-slow": "600ms",
|
|
99
|
+
"--_astryx-pre-tempo-duration-slow-max": "750ms",
|
|
91
100
|
"--font-family-body": "Poppins, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif",
|
|
92
101
|
"--font-family-heading": "Poppins, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif",
|
|
93
102
|
"--font-family-code": "\"JetBrains Mono\", \"SF Mono\", Monaco, Consolas, monospace",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/theme-y2k",
|
|
3
|
-
"version": "0.7.6-canary.
|
|
3
|
+
"version": "0.7.6-canary.6224efd",
|
|
4
4
|
"displayName": "Y2K Theme",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Hot pinks, lime greens, and Poppins. Bubbly, playful, and unmistakably retro.",
|
|
@@ -52,17 +52,30 @@
|
|
|
52
52
|
"src",
|
|
53
53
|
"palette.config.json",
|
|
54
54
|
"fonts.css",
|
|
55
|
-
"fonts.css.d.ts"
|
|
55
|
+
"fonts.css.d.ts",
|
|
56
|
+
"!**/*.test.*",
|
|
57
|
+
"!**/*.spec.js",
|
|
58
|
+
"!**/*.spec.jsx",
|
|
59
|
+
"!**/*.spec.mjs",
|
|
60
|
+
"!**/*.spec.cjs",
|
|
61
|
+
"!**/*.spec.ts",
|
|
62
|
+
"!**/*.spec.tsx",
|
|
63
|
+
"!**/*.spec.mts",
|
|
64
|
+
"!**/*.spec.cts",
|
|
65
|
+
"!**/*.spec.d.ts",
|
|
66
|
+
"!**/__tests__/**",
|
|
67
|
+
"!**/__mocks__/**",
|
|
68
|
+
"!**/*.bench.*"
|
|
56
69
|
],
|
|
57
70
|
"dependencies": {
|
|
58
71
|
"lucide-react": "^1.18.0"
|
|
59
72
|
},
|
|
60
73
|
"peerDependencies": {
|
|
61
|
-
"@astryxdesign/core": "0.7.6-canary.
|
|
74
|
+
"@astryxdesign/core": "0.7.6-canary.6224efd",
|
|
62
75
|
"react": ">=19"
|
|
63
76
|
},
|
|
64
77
|
"devDependencies": {
|
|
65
|
-
"@astryxdesign/cli": "0.7.6-canary.
|
|
78
|
+
"@astryxdesign/cli": "0.7.6-canary.6224efd"
|
|
66
79
|
},
|
|
67
80
|
"module": "./dist/source.mjs",
|
|
68
81
|
"scripts": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"y2kColorMapping.test.d.ts","sourceRoot":"","sources":["../src/y2kColorMapping.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"y2kPalettes.test.d.ts","sourceRoot":"","sources":["../src/y2kPalettes.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"y2kTheme.spacing.test.d.ts","sourceRoot":"","sources":["../src/y2kTheme.spacing.test.ts"],"names":[],"mappings":""}
|
package/dist/y2kTheme.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"y2kTheme.test.d.ts","sourceRoot":"","sources":["../src/y2kTheme.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`Y2K palette artifact > matches the complete released legacy object 1`] = `
|
|
4
|
-
{
|
|
5
|
-
"blue": {
|
|
6
|
-
"0": "#000000",
|
|
7
|
-
"10": "#002244",
|
|
8
|
-
"100": "#ffffff",
|
|
9
|
-
"15": "#002c4d",
|
|
10
|
-
"20": "#003759",
|
|
11
|
-
"25": "#004266",
|
|
12
|
-
"30": "#004e74",
|
|
13
|
-
"35": "#005a83",
|
|
14
|
-
"40": "#006693",
|
|
15
|
-
"45": "#0073a3",
|
|
16
|
-
"5": "#001939",
|
|
17
|
-
"50": "#0080b4",
|
|
18
|
-
"55": "#008ec4",
|
|
19
|
-
"60": "#0e9bd2",
|
|
20
|
-
"65": "#2fa8e0",
|
|
21
|
-
"70": "#45b6ef",
|
|
22
|
-
"75": "#57c3fd",
|
|
23
|
-
"80": "#7ed0ff",
|
|
24
|
-
"85": "#a3dbff",
|
|
25
|
-
"90": "#c4e7ff",
|
|
26
|
-
"95": "#e1f3ff",
|
|
27
|
-
"chroma": 40,
|
|
28
|
-
"hue": 250,
|
|
29
|
-
},
|
|
30
|
-
"cyan": {
|
|
31
|
-
"0": "#000000",
|
|
32
|
-
"10": "#00261f",
|
|
33
|
-
"100": "#ffffff",
|
|
34
|
-
"15": "#003029",
|
|
35
|
-
"20": "#003b34",
|
|
36
|
-
"25": "#00473f",
|
|
37
|
-
"30": "#00534a",
|
|
38
|
-
"35": "#005f56",
|
|
39
|
-
"40": "#006c62",
|
|
40
|
-
"45": "#00796f",
|
|
41
|
-
"5": "#001e14",
|
|
42
|
-
"50": "#00867b",
|
|
43
|
-
"55": "#0f9488",
|
|
44
|
-
"60": "#29a195",
|
|
45
|
-
"65": "#3bafa2",
|
|
46
|
-
"70": "#4cbcb0",
|
|
47
|
-
"75": "#5bcabd",
|
|
48
|
-
"80": "#6ad8cb",
|
|
49
|
-
"85": "#79e7d9",
|
|
50
|
-
"90": "#87f5e7",
|
|
51
|
-
"95": "#a6fff5",
|
|
52
|
-
"chroma": 35,
|
|
53
|
-
"hue": 185,
|
|
54
|
-
},
|
|
55
|
-
"green": {
|
|
56
|
-
"0": "#000000",
|
|
57
|
-
"10": "#132200",
|
|
58
|
-
"100": "#ffffff",
|
|
59
|
-
"15": "#152d00",
|
|
60
|
-
"20": "#173900",
|
|
61
|
-
"25": "#1e4500",
|
|
62
|
-
"30": "#285100",
|
|
63
|
-
"35": "#355d00",
|
|
64
|
-
"40": "#426900",
|
|
65
|
-
"45": "#4f7600",
|
|
66
|
-
"5": "#061800",
|
|
67
|
-
"50": "#5c830b",
|
|
68
|
-
"55": "#69901d",
|
|
69
|
-
"60": "#779d2c",
|
|
70
|
-
"65": "#84aa39",
|
|
71
|
-
"70": "#92b847",
|
|
72
|
-
"75": "#a0c654",
|
|
73
|
-
"80": "#aed461",
|
|
74
|
-
"85": "#bce26e",
|
|
75
|
-
"90": "#caf07b",
|
|
76
|
-
"95": "#d9fe89",
|
|
77
|
-
"chroma": 60,
|
|
78
|
-
"hue": 120,
|
|
79
|
-
},
|
|
80
|
-
"neutral": {
|
|
81
|
-
"0": "#000000",
|
|
82
|
-
"10": "#221a10",
|
|
83
|
-
"100": "#ffffff",
|
|
84
|
-
"15": "#2d241b",
|
|
85
|
-
"20": "#382f25",
|
|
86
|
-
"25": "#433a30",
|
|
87
|
-
"30": "#4f453b",
|
|
88
|
-
"35": "#5b5146",
|
|
89
|
-
"40": "#675d52",
|
|
90
|
-
"45": "#73695e",
|
|
91
|
-
"5": "#190f00",
|
|
92
|
-
"50": "#80756a",
|
|
93
|
-
"55": "#8d8276",
|
|
94
|
-
"60": "#9a8f83",
|
|
95
|
-
"65": "#a79c90",
|
|
96
|
-
"70": "#b5a99d",
|
|
97
|
-
"75": "#c3b7ab",
|
|
98
|
-
"80": "#d1c5b8",
|
|
99
|
-
"85": "#dfd2c6",
|
|
100
|
-
"90": "#ede0d4",
|
|
101
|
-
"95": "#fbefe2",
|
|
102
|
-
"chroma": 8,
|
|
103
|
-
"hue": 75,
|
|
104
|
-
},
|
|
105
|
-
"orange": {
|
|
106
|
-
"0": "#000000",
|
|
107
|
-
"10": "#420500",
|
|
108
|
-
"100": "#ffffff",
|
|
109
|
-
"15": "#520b00",
|
|
110
|
-
"20": "#601700",
|
|
111
|
-
"25": "#6d2400",
|
|
112
|
-
"30": "#7b3000",
|
|
113
|
-
"35": "#893c00",
|
|
114
|
-
"40": "#984800",
|
|
115
|
-
"45": "#a75409",
|
|
116
|
-
"5": "#340000",
|
|
117
|
-
"50": "#b66019",
|
|
118
|
-
"55": "#c56d26",
|
|
119
|
-
"60": "#d47a33",
|
|
120
|
-
"65": "#e48740",
|
|
121
|
-
"70": "#f3944c",
|
|
122
|
-
"75": "#ffa25c",
|
|
123
|
-
"80": "#ffb682",
|
|
124
|
-
"85": "#ffc9a3",
|
|
125
|
-
"90": "#ffdbc3",
|
|
126
|
-
"95": "#ffede1",
|
|
127
|
-
"chroma": 60,
|
|
128
|
-
"hue": 60,
|
|
129
|
-
},
|
|
130
|
-
"pink": {
|
|
131
|
-
"0": "#000000",
|
|
132
|
-
"10": "#490027",
|
|
133
|
-
"100": "#ffffff",
|
|
134
|
-
"15": "#560032",
|
|
135
|
-
"20": "#64003d",
|
|
136
|
-
"25": "#711248",
|
|
137
|
-
"30": "#7f2154",
|
|
138
|
-
"35": "#8c2f60",
|
|
139
|
-
"40": "#9a3c6c",
|
|
140
|
-
"45": "#a84979",
|
|
141
|
-
"5": "#3d001d",
|
|
142
|
-
"50": "#b75685",
|
|
143
|
-
"55": "#c56392",
|
|
144
|
-
"60": "#d371a0",
|
|
145
|
-
"65": "#e27ead",
|
|
146
|
-
"70": "#f18bbb",
|
|
147
|
-
"75": "#ff99c8",
|
|
148
|
-
"80": "#ffaed3",
|
|
149
|
-
"85": "#ffc3de",
|
|
150
|
-
"90": "#ffd7e9",
|
|
151
|
-
"95": "#ffebf4",
|
|
152
|
-
"chroma": 45,
|
|
153
|
-
"hue": 350,
|
|
154
|
-
},
|
|
155
|
-
"purple": {
|
|
156
|
-
"0": "#000000",
|
|
157
|
-
"10": "#11144b",
|
|
158
|
-
"100": "#ffffff",
|
|
159
|
-
"15": "#1f1e57",
|
|
160
|
-
"20": "#2c2864",
|
|
161
|
-
"25": "#393370",
|
|
162
|
-
"30": "#453e7d",
|
|
163
|
-
"35": "#524a8a",
|
|
164
|
-
"40": "#5f5697",
|
|
165
|
-
"45": "#6c62a4",
|
|
166
|
-
"5": "#020840",
|
|
167
|
-
"50": "#796eb2",
|
|
168
|
-
"55": "#867bc0",
|
|
169
|
-
"60": "#9387ce",
|
|
170
|
-
"65": "#a194dc",
|
|
171
|
-
"70": "#afa2ea",
|
|
172
|
-
"75": "#bdaff8",
|
|
173
|
-
"80": "#cbbeff",
|
|
174
|
-
"85": "#d9ceff",
|
|
175
|
-
"90": "#e6deff",
|
|
176
|
-
"95": "#f3eeff",
|
|
177
|
-
"chroma": 40,
|
|
178
|
-
"hue": 300,
|
|
179
|
-
},
|
|
180
|
-
"red": {
|
|
181
|
-
"0": "#000000",
|
|
182
|
-
"10": "#540000",
|
|
183
|
-
"100": "#ffffff",
|
|
184
|
-
"15": "#620002",
|
|
185
|
-
"20": "#700012",
|
|
186
|
-
"25": "#7f001b",
|
|
187
|
-
"30": "#8e1126",
|
|
188
|
-
"35": "#9c2330",
|
|
189
|
-
"40": "#ab313b",
|
|
190
|
-
"45": "#ba3f47",
|
|
191
|
-
"5": "#480000",
|
|
192
|
-
"50": "#c94d52",
|
|
193
|
-
"55": "#d95b5e",
|
|
194
|
-
"60": "#e8686b",
|
|
195
|
-
"65": "#f87677",
|
|
196
|
-
"70": "#ff8787",
|
|
197
|
-
"75": "#ff9d9b",
|
|
198
|
-
"80": "#ffb2af",
|
|
199
|
-
"85": "#ffc6c3",
|
|
200
|
-
"90": "#ffd9d7",
|
|
201
|
-
"95": "#ffeceb",
|
|
202
|
-
"chroma": 55,
|
|
203
|
-
"hue": 25,
|
|
204
|
-
},
|
|
205
|
-
"teal": {
|
|
206
|
-
"0": "#000000",
|
|
207
|
-
"10": "#00240f",
|
|
208
|
-
"100": "#ffffff",
|
|
209
|
-
"15": "#002f1a",
|
|
210
|
-
"20": "#003a24",
|
|
211
|
-
"25": "#00462f",
|
|
212
|
-
"30": "#00513a",
|
|
213
|
-
"35": "#115e45",
|
|
214
|
-
"40": "#226a51",
|
|
215
|
-
"45": "#30775d",
|
|
216
|
-
"5": "#001d00",
|
|
217
|
-
"50": "#3d8469",
|
|
218
|
-
"55": "#4a9175",
|
|
219
|
-
"60": "#589e82",
|
|
220
|
-
"65": "#65ab8f",
|
|
221
|
-
"70": "#72b99c",
|
|
222
|
-
"75": "#7fc7a9",
|
|
223
|
-
"80": "#8dd5b7",
|
|
224
|
-
"85": "#9be3c5",
|
|
225
|
-
"90": "#a9f2d3",
|
|
226
|
-
"95": "#b6ffe1",
|
|
227
|
-
"chroma": 30,
|
|
228
|
-
"hue": 165,
|
|
229
|
-
},
|
|
230
|
-
"yellow": {
|
|
231
|
-
"0": "#000000",
|
|
232
|
-
"10": "#301800",
|
|
233
|
-
"100": "#ffffff",
|
|
234
|
-
"15": "#3b2200",
|
|
235
|
-
"20": "#472c00",
|
|
236
|
-
"25": "#533700",
|
|
237
|
-
"30": "#604200",
|
|
238
|
-
"35": "#6d4d00",
|
|
239
|
-
"40": "#7b5900",
|
|
240
|
-
"45": "#896500",
|
|
241
|
-
"5": "#270c00",
|
|
242
|
-
"50": "#977100",
|
|
243
|
-
"55": "#a67e00",
|
|
244
|
-
"60": "#b58b01",
|
|
245
|
-
"65": "#c39819",
|
|
246
|
-
"70": "#d2a52a",
|
|
247
|
-
"75": "#e2b239",
|
|
248
|
-
"80": "#f1c047",
|
|
249
|
-
"85": "#ffcd55",
|
|
250
|
-
"90": "#ffde9b",
|
|
251
|
-
"95": "#ffeecf",
|
|
252
|
-
"chroma": 65,
|
|
253
|
-
"hue": 85,
|
|
254
|
-
},
|
|
255
|
-
}
|
|
256
|
-
`;
|
|
@@ -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 {palette as y2kModePalettes} from './y2kPalettes.generated';
|
|
6
|
-
import {y2kTheme} from './y2kTheme';
|
|
7
|
-
|
|
8
|
-
const categoricalFamilies = [
|
|
9
|
-
'cyan',
|
|
10
|
-
'green',
|
|
11
|
-
'orange',
|
|
12
|
-
'pink',
|
|
13
|
-
'purple',
|
|
14
|
-
'red',
|
|
15
|
-
'teal',
|
|
16
|
-
'yellow',
|
|
17
|
-
] as const;
|
|
18
|
-
|
|
19
|
-
describe('Y2K palette mapping', () => {
|
|
20
|
-
it('preserves the periwinkle body and uses reviewed neutral surfaces', () => {
|
|
21
|
-
const light = resolveThemeTokens(y2kTheme, {mode: 'light'});
|
|
22
|
-
const dark = resolveThemeTokens(y2kTheme, {mode: 'dark'});
|
|
23
|
-
expect(light['--color-background-body']).toBe(
|
|
24
|
-
y2kModePalettes.accent.light[80],
|
|
25
|
-
);
|
|
26
|
-
expect(dark['--color-background-body']).toBe(
|
|
27
|
-
y2kModePalettes.neutral.dark[5],
|
|
28
|
-
);
|
|
29
|
-
expect(light['--color-text-primary']).toBe(
|
|
30
|
-
y2kModePalettes.neutral.light[15],
|
|
31
|
-
);
|
|
32
|
-
expect(dark['--color-text-primary']).toBe(y2kModePalettes.neutral.dark[95]);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('maps neon Green and success to the shared Green family', () => {
|
|
36
|
-
const light = resolveThemeTokens(y2kTheme, {mode: 'light'});
|
|
37
|
-
const dark = resolveThemeTokens(y2kTheme, {mode: 'dark'});
|
|
38
|
-
expect(light['--color-success']).toBe(y2kModePalettes.green.light[80]);
|
|
39
|
-
expect(dark['--color-success']).toBe(y2kModePalettes.green.dark[80]);
|
|
40
|
-
expect(light['--color-background-green']).toBe(
|
|
41
|
-
y2kModePalettes.green.light[80],
|
|
42
|
-
);
|
|
43
|
-
expect(dark['--color-background-green']).toBe(
|
|
44
|
-
y2kModePalettes.green.dark[80],
|
|
45
|
-
);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('keeps Blue airy while increasing its electric saturation', () => {
|
|
49
|
-
const light = resolveThemeTokens(y2kTheme, {mode: 'light'});
|
|
50
|
-
const dark = resolveThemeTokens(y2kTheme, {mode: 'dark'});
|
|
51
|
-
expect(light['--color-background-blue']).toBe(
|
|
52
|
-
y2kModePalettes.blue.light[85],
|
|
53
|
-
);
|
|
54
|
-
expect(dark['--color-background-blue']).toBe(y2kModePalettes.blue.dark[85]);
|
|
55
|
-
expect(light['--color-border-blue']).toBe(y2kModePalettes.blue.light[75]);
|
|
56
|
-
expect(dark['--color-text-blue']).toBe(y2kModePalettes.blue.dark[20]);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it.each(['light', 'dark'] as const)(
|
|
60
|
-
'maps the remaining categorical roles to reviewed %s stops',
|
|
61
|
-
mode => {
|
|
62
|
-
const tokens = resolveThemeTokens(y2kTheme, {mode});
|
|
63
|
-
for (const family of categoricalFamilies) {
|
|
64
|
-
const ramp = y2kModePalettes[family][mode];
|
|
65
|
-
expect(tokens[`--color-background-${family}`]).toMatch(
|
|
66
|
-
/^#[0-9a-f]{6}$/i,
|
|
67
|
-
);
|
|
68
|
-
expect(tokens[`--color-border-${family}`]).toMatch(/^#[0-9a-f]{6}$/i);
|
|
69
|
-
expect(tokens[`--color-icon-${family}`]).toMatch(/^#[0-9a-f]{6}$/i);
|
|
70
|
-
expect(Object.values(ramp)).toContain(
|
|
71
|
-
tokens[`--color-background-${family}`],
|
|
72
|
-
);
|
|
73
|
-
expect(Object.values(ramp)).toContain(tokens[`--color-text-${family}`]);
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
);
|
|
77
|
-
});
|
package/src/y2kPalettes.test.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
import {describe, expect, it} from 'vitest';
|
|
4
|
-
import {palette as y2kModePalettes} from './y2kPalettes.generated';
|
|
5
|
-
import {y2kPalettes} from './y2kPalettes';
|
|
6
|
-
|
|
7
|
-
const stops = [
|
|
8
|
-
0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95,
|
|
9
|
-
100,
|
|
10
|
-
] as const;
|
|
11
|
-
const families = [
|
|
12
|
-
'neutral',
|
|
13
|
-
'accent',
|
|
14
|
-
'blue',
|
|
15
|
-
'cyan',
|
|
16
|
-
'green',
|
|
17
|
-
'orange',
|
|
18
|
-
'pink',
|
|
19
|
-
'purple',
|
|
20
|
-
'red',
|
|
21
|
-
'teal',
|
|
22
|
-
'yellow',
|
|
23
|
-
] as const;
|
|
24
|
-
|
|
25
|
-
const relativeLuminance = (hex: string): number => {
|
|
26
|
-
const channels = hex
|
|
27
|
-
.slice(1)
|
|
28
|
-
.match(/.{2}/g)!
|
|
29
|
-
.map(channel => Number.parseInt(channel, 16) / 255)
|
|
30
|
-
.map(channel =>
|
|
31
|
-
channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4,
|
|
32
|
-
);
|
|
33
|
-
return channels[0] * 0.2126 + channels[1] * 0.7152 + channels[2] * 0.0722;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
describe('Y2K palette artifact', () => {
|
|
37
|
-
it('contains complete monotonic light and dark ramps', () => {
|
|
38
|
-
expect(new Set(Object.keys(y2kModePalettes))).toEqual(new Set(families));
|
|
39
|
-
for (const familyName of families) {
|
|
40
|
-
const family = y2kModePalettes[familyName];
|
|
41
|
-
for (const mode of ['light', 'dark'] as const) {
|
|
42
|
-
const values = stops.map(stop => family[mode][stop]);
|
|
43
|
-
expect(values.every(value => /^#[0-9a-f]{6}$/i.test(value))).toBe(true);
|
|
44
|
-
expect(values[0]).toBe('#000000');
|
|
45
|
-
expect(values.at(-1)).toBe('#ffffff');
|
|
46
|
-
const luminance = values.map(relativeLuminance);
|
|
47
|
-
expect(
|
|
48
|
-
luminance.every(
|
|
49
|
-
(value, index) => index === 0 || value > luminance[index - 1],
|
|
50
|
-
),
|
|
51
|
-
).toBe(true);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('keeps Y2K signature colors exact', () => {
|
|
57
|
-
expect(y2kModePalettes.accent.light[80]).toBe('#cccffa');
|
|
58
|
-
expect(y2kModePalettes.green.light[80]).toBe('#c5e17a');
|
|
59
|
-
expect(y2kModePalettes.green.dark[80]).toBe('#c5e17a');
|
|
60
|
-
expect(y2kModePalettes.blue.light[20]).toBe('#003454');
|
|
61
|
-
expect(y2kModePalettes.blue.light[75]).toBe('#70c1ff');
|
|
62
|
-
expect(y2kModePalettes.blue.light[85]).toBe('#addbff');
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('matches the complete released legacy object', () => {
|
|
66
|
-
expect(y2kPalettes).toMatchSnapshot();
|
|
67
|
-
});
|
|
68
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
import {describe, expect, it} from 'vitest';
|
|
4
|
-
import {y2kTheme} from './y2kTheme';
|
|
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
|
-
};
|
|
21
|
-
|
|
22
|
-
describe('y2k spacing steps', () => {
|
|
23
|
-
const tokens = y2kTheme.tokens as Record<string, string>;
|
|
24
|
-
const spacingSteps = Object.entries(tokens).filter(([name]) =>
|
|
25
|
-
name.startsWith('--spacing-'),
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
it('are rem, so they follow the root font size', () => {
|
|
29
|
-
expect(spacingSteps.length).toBe(Object.keys(previousPx).length);
|
|
30
|
-
for (const [name, value] of spacingSteps) {
|
|
31
|
-
expect(value, name).toMatch(/^\d+(\.\d+)?rem$/);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('keep their previous pixel values at the default 16px root', () => {
|
|
36
|
-
for (const [name, px] of Object.entries(previousPx)) {
|
|
37
|
-
expect(Number.parseFloat(tokens[name]) * ROOT_FONT_SIZE_PX, name).toBe(
|
|
38
|
-
px,
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
});
|
package/src/y2kTheme.test.ts
DELETED
|
@@ -1,73 +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 {generateThemeCSS} from '@astryxdesign/core/theme';
|
|
6
|
-
import {palette as y2kModePalettes} from './y2kPalettes.generated';
|
|
7
|
-
import {y2kTheme} from './y2kTheme';
|
|
8
|
-
|
|
9
|
-
function luminance(color: string): number {
|
|
10
|
-
const channels = [1, 3, 5]
|
|
11
|
-
.map(index => Number.parseInt(color.slice(index, index + 2), 16) / 255)
|
|
12
|
-
.map(channel =>
|
|
13
|
-
channel <= 0.04045
|
|
14
|
-
? channel / 12.92
|
|
15
|
-
: Math.pow((channel + 0.055) / 1.055, 2.4),
|
|
16
|
-
);
|
|
17
|
-
return channels[0] * 0.2126 + channels[1] * 0.7152 + channels[2] * 0.0722;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function contrast(foreground: string, background: string): number {
|
|
21
|
-
const [lighter, darker] = [luminance(foreground), luminance(background)].sort(
|
|
22
|
-
(left, right) => right - left,
|
|
23
|
-
);
|
|
24
|
-
return (lighter + 0.05) / (darker + 0.05);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const source = readFileSync(new URL('./y2kTheme.ts', import.meta.url), 'utf8');
|
|
28
|
-
|
|
29
|
-
describe('y2k secondary ComplexSelector', () => {
|
|
30
|
-
it('keeps the hover fill off a disabled trigger in either form', () => {
|
|
31
|
-
expect(generateThemeCSS(y2kTheme).component).toMatch(
|
|
32
|
-
/:hover:not\(:has\(> ?:is\(:disabled, ?\[aria-disabled="true"\]\)\)\)/,
|
|
33
|
-
);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe('Y2K color token mapping completeness', () => {
|
|
38
|
-
it('does not redefine the data-visualization color system', () => {
|
|
39
|
-
expect(
|
|
40
|
-
Object.keys(y2kTheme.tokens).filter(name =>
|
|
41
|
-
name.startsWith('--color-data-'),
|
|
42
|
-
),
|
|
43
|
-
).toEqual([]);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('keeps every root color value concrete', () => {
|
|
47
|
-
for (const [name, value] of Object.entries(y2kTheme.tokens)) {
|
|
48
|
-
if (!name.startsWith('--color-')) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
expect(typeof value, name).toBe('string');
|
|
52
|
-
expect(value, name).toMatch(
|
|
53
|
-
/^(?: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,
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('uses no one-off color literals in the maintained theme source', () => {
|
|
59
|
-
expect(source).not.toMatch(
|
|
60
|
-
/#[0-9a-f]{3,8}\b|\brgba?\(|\bhsl[a]?\(|\boklch\(|\bblack\b|\bwhite\b/i,
|
|
61
|
-
);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('keeps the necessary dark control outline above non-text contrast', () => {
|
|
65
|
-
const outline = y2kModePalettes.neutral.dark[45];
|
|
66
|
-
const surface = y2kModePalettes.neutral.dark[10];
|
|
67
|
-
|
|
68
|
-
expect(y2kTheme.tokens['--color-border-emphasized']).toBe(
|
|
69
|
-
`light-dark(${y2kModePalettes.neutral.light[20]}, ${outline})`,
|
|
70
|
-
);
|
|
71
|
-
expect(contrast(outline, surface)).toBeGreaterThanOrEqual(3);
|
|
72
|
-
});
|
|
73
|
-
});
|