@astryxdesign/theme-gothic 0.7.6-canary.f73623d → 0.7.6-canary.f899313

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/theme-gothic",
3
- "version": "0.7.6-canary.f73623d",
3
+ "version": "0.7.6-canary.f899313",
4
4
  "displayName": "Gothic Theme",
5
5
  "private": false,
6
6
  "description": "Deep blue-grays and a signature display serif. Dramatic and editorial, for surfaces that want to be remembered.",
@@ -52,17 +52,30 @@
52
52
  "src",
53
53
  "fonts.css",
54
54
  "fonts.css.d.ts",
55
- "palette.config.json"
55
+ "palette.config.json",
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.f73623d",
74
+ "@astryxdesign/core": "0.7.6-canary.f899313",
62
75
  "react": ">=19"
63
76
  },
64
77
  "devDependencies": {
65
- "@astryxdesign/cli": "0.7.6-canary.f73623d"
78
+ "@astryxdesign/cli": "0.7.6-canary.f899313"
66
79
  },
67
80
  "module": "./dist/source.mjs",
68
81
  "scripts": {
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=gothicColorMapping.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gothicColorMapping.test.d.ts","sourceRoot":"","sources":["../src/gothicColorMapping.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=gothicPalettes.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gothicPalettes.test.d.ts","sourceRoot":"","sources":["../src/gothicPalettes.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=gothicTheme.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gothicTheme.test.d.ts","sourceRoot":"","sources":["../src/gothicTheme.test.ts"],"names":[],"mappings":""}
@@ -1,43 +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 {gothicTheme} from './gothicTheme';
6
-
7
- const source = readFileSync(
8
- new URL('./gothicTheme.ts', import.meta.url),
9
- 'utf8',
10
- );
11
-
12
- const maintainedThemeSource = source.slice(
13
- 0,
14
- source.indexOf('/**\n * Frozen released compatibility palettes'),
15
- );
16
-
17
- describe('gothic color token mapping completeness', () => {
18
- it('does not redefine the data-visualization color system', () => {
19
- expect(
20
- Object.keys(gothicTheme.tokens).filter(name =>
21
- name.startsWith('--color-data-'),
22
- ),
23
- ).toEqual([]);
24
- });
25
-
26
- it('keeps every root color value concrete', () => {
27
- for (const [name, value] of Object.entries(gothicTheme.tokens)) {
28
- if (!name.startsWith('--color-')) {
29
- continue;
30
- }
31
- expect(typeof value, name).toBe('string');
32
- expect(value, name).toMatch(
33
- /^(?:transparent|#[0-9a-f]{6}(?:[0-9a-f]{2})?)$/i,
34
- );
35
- }
36
- });
37
-
38
- it('uses no one-off color literals in the maintained theme source', () => {
39
- expect(maintainedThemeSource).not.toMatch(
40
- /#[0-9a-f]{3,8}\b|\brgba?\(|\bhsl[a]?\(|\boklch\(|\bblack\b|\bwhite\b/i,
41
- );
42
- });
43
- });
@@ -1,63 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- import {describe, expect, it} from 'vitest';
4
- import {palette as gothicModePalettes} from './gothicPalettes.generated';
5
- import {gothicPalettes} from './gothicTheme';
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
-
12
- const families = [
13
- 'neutral',
14
- 'blue',
15
- 'cyan',
16
- 'green',
17
- 'orange',
18
- 'pink',
19
- 'purple',
20
- 'red',
21
- 'teal',
22
- 'yellow',
23
- ] as const;
24
-
25
- describe('gothic palette artifact', () => {
26
- it('preserves the existing public shape with every reviewed dark stop', () => {
27
- expect(Object.keys(gothicPalettes)).toEqual(families);
28
- for (const familyName of families) {
29
- const family = gothicPalettes[familyName];
30
- expect(typeof family.hue).toBe('number');
31
- expect(typeof family.chroma).toBe('number');
32
- for (const stop of stops) {
33
- expect(family[stop]).toMatch(/^#[0-9a-f]{6}$/i);
34
- }
35
- expect(family[0]).toBe('#000000');
36
- expect(family[100]).toBe('#ffffff');
37
- }
38
- });
39
-
40
- it('keeps Gothic semantic, categorical, and syntax anchors exact', () => {
41
- expect(gothicPalettes.neutral[10]).toBe('#101314');
42
- expect(gothicPalettes.neutral[20]).toBe('#24292D');
43
- expect(gothicPalettes.neutral[40]).toBe('#495056');
44
- expect(gothicPalettes.neutral[75]).toBe('#96A0AB');
45
- expect(gothicPalettes.neutral[95]).toBe('#E8F1F6');
46
-
47
- expect(gothicModePalettes.purple.dark[80]).toBe('#c39adb');
48
- expect(gothicModePalettes.green.dark[70]).toBe('#a3c987');
49
- expect(gothicModePalettes.blue.dark[65]).toBe('#8aa1d8');
50
- expect(gothicModePalettes.yellow.dark[65]).toBe('#e6b85e');
51
- expect(gothicModePalettes.yellow.dark[70]).toBe('#dec074');
52
- expect(gothicModePalettes.pink.dark[65]).toBe('#d97580');
53
- expect(gothicModePalettes.teal.dark[70]).toBe('#7cc5b3');
54
-
55
- for (const familyName of families.filter(family => family !== 'neutral')) {
56
- const family = gothicModePalettes[familyName].dark;
57
- expect(family[20]).toMatch(/^#[0-9a-f]{6}$/i);
58
- expect(family[30]).toMatch(/^#[0-9a-f]{6}$/i);
59
- expect(family[60]).toMatch(/^#[0-9a-f]{6}$/i);
60
- expect(family[75]).toMatch(/^#[0-9a-f]{6}$/i);
61
- }
62
- });
63
- });
@@ -1,98 +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 gothicModePalettes} from './gothicPalettes.generated';
6
- import {gothicTheme} from './gothicTheme';
7
-
8
- const categoricalFamilies = [
9
- 'blue',
10
- 'cyan',
11
- 'green',
12
- 'orange',
13
- 'pink',
14
- 'purple',
15
- 'red',
16
- 'teal',
17
- 'yellow',
18
- ] as const;
19
-
20
- function linearize(channel: number): number {
21
- const value = channel / 255;
22
- return value <= 0.04045
23
- ? value / 12.92
24
- : Math.pow((value + 0.055) / 1.055, 2.4);
25
- }
26
-
27
- function luminance(color: string): number {
28
- const [red, green, blue] = [1, 3, 5].map(index =>
29
- Number.parseInt(color.slice(index, index + 2), 16),
30
- );
31
- return (
32
- 0.2126 * linearize(red) +
33
- 0.7152 * linearize(green) +
34
- 0.0722 * linearize(blue)
35
- );
36
- }
37
-
38
- function contrast(foreground: string, background: string): number {
39
- const [lighter, darker] = [luminance(foreground), luminance(background)].sort(
40
- (left, right) => right - left,
41
- );
42
- return (lighter + 0.05) / (darker + 0.05);
43
- }
44
-
45
- describe('gothic palette mapping', () => {
46
- it('keeps the theme dark-only and maps its neutral surface ladder', () => {
47
- const tokens = resolveThemeTokens(gothicTheme, {mode: 'dark'});
48
- const neutral = gothicModePalettes.neutral.dark;
49
-
50
- expect(tokens['--color-background-body']).toBe(neutral[10]);
51
- expect(tokens['--color-background-surface']).toBe(neutral[10]);
52
- expect(tokens['--color-background-card']).toBe(neutral[15]);
53
- expect(tokens['--color-background-popover']).toBe(neutral[20]);
54
- expect(tokens['--color-text-primary']).toBe(neutral[95]);
55
- expect(tokens['--color-text-secondary']).toBe(neutral[75]);
56
- });
57
-
58
- it('maps syntax roles to reviewed jewel-tone anchors with AA comments', () => {
59
- const tokens = resolveThemeTokens(gothicTheme, {mode: 'dark'});
60
- expect(tokens).toMatchObject({
61
- '--color-syntax-keyword': gothicModePalettes.purple.dark[80],
62
- '--color-syntax-string': gothicModePalettes.green.dark[70],
63
- '--color-syntax-comment': gothicModePalettes.neutral.dark[65],
64
- '--color-syntax-number': gothicModePalettes.yellow.dark[70],
65
- '--color-syntax-function': gothicModePalettes.blue.dark[65],
66
- '--color-syntax-type': gothicModePalettes.purple.dark[80],
67
- '--color-syntax-constant': gothicModePalettes.yellow.dark[65],
68
- '--color-syntax-tag': gothicModePalettes.pink.dark[65],
69
- '--color-syntax-attribute': gothicModePalettes.yellow.dark[70],
70
- '--color-syntax-property': gothicModePalettes.teal.dark[70],
71
- '--color-syntax-added-marker': gothicModePalettes.green.dark[70],
72
- '--color-syntax-removed-marker': gothicModePalettes.pink.dark[65],
73
- });
74
- expect(
75
- contrast(
76
- gothicModePalettes.neutral.dark[65],
77
- gothicModePalettes.neutral.dark[10],
78
- ),
79
- 'syntax comment text',
80
- ).toBeGreaterThanOrEqual(4.5);
81
- });
82
-
83
- it('maps every categorical role to the reviewed pattern with AA text', () => {
84
- const tokens = resolveThemeTokens(gothicTheme, {mode: 'dark'});
85
- for (const family of categoricalFamilies) {
86
- const ramp = gothicModePalettes[family].dark;
87
- const textStop = family === 'pink' || family === 'yellow' ? 15 : 20;
88
- expect(tokens[`--color-background-${family}`]).toBe(ramp[75]);
89
- expect(tokens[`--color-border-${family}`]).toBe(ramp[60]);
90
- expect(tokens[`--color-icon-${family}`]).toBe(ramp[30]);
91
- expect(tokens[`--color-text-${family}`]).toBe(ramp[textStop]);
92
- expect(
93
- contrast(ramp[textStop], ramp[75]),
94
- `${family} categorical text`,
95
- ).toBeGreaterThanOrEqual(4.5);
96
- }
97
- });
98
- });