@vanilla-bean/components 1.0.1 → 1.1.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/components/Menu/Menu.js +3 -3
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/theme/.test.js +19 -3
- package/theme/README.md +7 -0
- package/theme/button.js +1 -1
- package/theme/colors.js +10 -3
- package/theme/fonts.js +3 -3
- package/theme/input.js +3 -3
- package/theme/page.js +6 -0
- package/theme/scrollbar.js +7 -3
- package/theme/table.js +2 -2
- package/Component/README.md +0 -455
- package/Elem/README.md +0 -373
- package/styled/README.md +0 -329
package/components/Menu/Menu.js
CHANGED
|
@@ -18,12 +18,12 @@ const StyledList = styled(
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
&:hover, &:focus, &:focus-visible, & a:hover, & a:focus, & a:focus-visible {
|
|
21
|
-
color: ${colors.light(colors.
|
|
22
|
-
border-color: ${colors.light(colors.
|
|
21
|
+
color: ${colors.light(colors.selected)} !important;
|
|
22
|
+
border-color: ${colors.light(colors.selected)};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
&:focus-visible, & a:focus-visible {
|
|
26
|
-
outline: 2px solid ${colors.light(colors.
|
|
26
|
+
outline: 2px solid ${colors.light(colors.selected)};
|
|
27
27
|
outline-offset: -2px;
|
|
28
28
|
}
|
|
29
29
|
}
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
package/theme/.test.js
CHANGED
|
@@ -2,11 +2,14 @@ import { TinyColor } from '@ctrl/tinycolor';
|
|
|
2
2
|
import theme from '.';
|
|
3
3
|
|
|
4
4
|
const ORIGINAL_BLUE = 'hsl(209, 55%, 45%)';
|
|
5
|
+
const ORIGINAL_YELLOW = 'hsl(44, 55%, 45%)';
|
|
5
6
|
const ORIGINAL_GRAY = 'hsl(0, 0%, 45%)';
|
|
6
7
|
|
|
7
8
|
afterEach(() => {
|
|
8
9
|
theme.colors.blue = new TinyColor(ORIGINAL_BLUE);
|
|
10
|
+
theme.colors.yellow = new TinyColor(ORIGINAL_YELLOW);
|
|
9
11
|
theme.colors.gray = new TinyColor(ORIGINAL_GRAY);
|
|
12
|
+
theme.colors.selected = undefined;
|
|
10
13
|
});
|
|
11
14
|
|
|
12
15
|
describe('theme colors', () => {
|
|
@@ -21,6 +24,19 @@ describe('theme colors', () => {
|
|
|
21
24
|
theme.colors.gray = new TinyColor('hsl(200, 30%, 45%)');
|
|
22
25
|
expect(theme.colors.white.toString()).not.toBe(before);
|
|
23
26
|
});
|
|
27
|
+
|
|
28
|
+
test('selected follows yellow — updates when yellow is reassigned', () => {
|
|
29
|
+
const custom = new TinyColor('hsl(120, 55%, 45%)');
|
|
30
|
+
theme.colors.yellow = custom;
|
|
31
|
+
expect(theme.colors.selected.toString()).toBe(custom.toString());
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('selected can be assigned independently of yellow', () => {
|
|
35
|
+
const custom = new TinyColor('hsl(280, 55%, 45%)');
|
|
36
|
+
theme.colors.selected = custom;
|
|
37
|
+
expect(theme.colors.selected.toString()).toBe(custom.toString());
|
|
38
|
+
expect(theme.colors.yellow.toString()).toBe(new TinyColor(ORIGINAL_YELLOW).toString());
|
|
39
|
+
});
|
|
24
40
|
});
|
|
25
41
|
|
|
26
42
|
describe('theme lazy strings', () => {
|
|
@@ -32,19 +48,19 @@ describe('theme lazy strings', () => {
|
|
|
32
48
|
|
|
33
49
|
test('theme.table reflects a color mutation', () => {
|
|
34
50
|
const before = theme.table;
|
|
35
|
-
theme.colors.
|
|
51
|
+
theme.colors.yellow = new TinyColor('hsl(120, 55%, 45%)');
|
|
36
52
|
expect(theme.table).not.toBe(before);
|
|
37
53
|
});
|
|
38
54
|
|
|
39
55
|
test('theme.scrollbar reflects a color mutation', () => {
|
|
40
56
|
const custom = new TinyColor('hsl(120, 55%, 45%)');
|
|
41
|
-
theme.colors.
|
|
57
|
+
theme.colors.yellow = custom;
|
|
42
58
|
expect(theme.scrollbar).toContain(custom.toString());
|
|
43
59
|
});
|
|
44
60
|
|
|
45
61
|
test('theme.input reflects a color mutation', () => {
|
|
46
62
|
const custom = new TinyColor('hsl(120, 55%, 45%)');
|
|
47
|
-
theme.colors.
|
|
63
|
+
theme.colors.yellow = custom;
|
|
48
64
|
expect(theme.input).toContain(custom.toString());
|
|
49
65
|
});
|
|
50
66
|
|
package/theme/README.md
CHANGED
|
@@ -284,6 +284,12 @@ colors.black; // Pure black - text on light backgrounds
|
|
|
284
284
|
colors.superWhite; // #fefefe - slightly warmer white
|
|
285
285
|
colors.vantablack; // #0a0a0a - rich black alternative
|
|
286
286
|
|
|
287
|
+
// Semantic accent - the "focused/selected/active" color (focus outlines,
|
|
288
|
+
// ::selection, hover highlights, checked controls, scrollbar thumbs).
|
|
289
|
+
// Follows colors.yellow unless assigned its own color:
|
|
290
|
+
colors.selected;
|
|
291
|
+
theme.colors.selected = new TinyColor('#3d7aed'); // decouple from yellow
|
|
292
|
+
|
|
287
293
|
// Accessibility functions
|
|
288
294
|
colors.mostReadable(baseColor, [colors.white, colors.black]);
|
|
289
295
|
// Returns the highest contrast color for optimal readability
|
|
@@ -566,6 +572,7 @@ interface ColorSystem {
|
|
|
566
572
|
transparent: TinyColor;
|
|
567
573
|
white: TinyColor;
|
|
568
574
|
black: TinyColor;
|
|
575
|
+
selected: TinyColor;
|
|
569
576
|
superWhite: TinyColor;
|
|
570
577
|
vantablack: TinyColor;
|
|
571
578
|
|
package/theme/button.js
CHANGED
|
@@ -6,7 +6,7 @@ export default ({ colors, fonts }) => `
|
|
|
6
6
|
text-decoration: none;
|
|
7
7
|
color: ${colors.white};
|
|
8
8
|
background-color: ${colors.blue};
|
|
9
|
-
outline-color: ${colors.lighter(colors.
|
|
9
|
+
outline-color: ${colors.lighter(colors.selected)};
|
|
10
10
|
text-align: center;
|
|
11
11
|
position: relative;
|
|
12
12
|
white-space: nowrap;
|
package/theme/colors.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { TinyColor, random, readability, isReadable, mostReadable } from '@ctrl/tinycolor';
|
|
2
2
|
|
|
3
|
+
let selectedOverride;
|
|
4
|
+
|
|
3
5
|
const colors = {
|
|
4
6
|
random,
|
|
5
7
|
readability,
|
|
6
8
|
isReadable,
|
|
7
9
|
mostReadable,
|
|
8
10
|
|
|
9
|
-
// Base colors — plain writable properties so theme.colors.X = new TinyColor(...) works
|
|
10
11
|
orange: new TinyColor('hsl(29, 55%, 45%)'),
|
|
11
12
|
gray: new TinyColor('hsl(0, 0%, 45%)'),
|
|
12
13
|
yellow: new TinyColor('hsl(44, 55%, 45%)'),
|
|
@@ -20,12 +21,18 @@ const colors = {
|
|
|
20
21
|
superWhite: new TinyColor('hsl(0, 100%, 100%)'),
|
|
21
22
|
vantablack: new TinyColor('hsl(0, 0%, 0%)'),
|
|
22
23
|
|
|
23
|
-
// Derived — getters so they recompute when gray is reassigned
|
|
24
24
|
get white() {
|
|
25
25
|
return colors.whiteish();
|
|
26
26
|
},
|
|
27
27
|
get black() {
|
|
28
|
-
return colors.
|
|
28
|
+
return colors.gray.darken(45);
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
get selected() {
|
|
32
|
+
return selectedOverride ?? colors.yellow;
|
|
33
|
+
},
|
|
34
|
+
set selected(color) {
|
|
35
|
+
selectedOverride = color;
|
|
29
36
|
},
|
|
30
37
|
|
|
31
38
|
whiteish: (color = colors.gray) => color.lighten(45),
|
package/theme/fonts.js
CHANGED
|
@@ -8,7 +8,7 @@ const fontAwesome = `
|
|
|
8
8
|
font-variant: normal;
|
|
9
9
|
text-rendering: auto;
|
|
10
10
|
line-height: 1;
|
|
11
|
-
font-family: 'Font Awesome
|
|
11
|
+
font-family: 'Font Awesome 7 Free';
|
|
12
12
|
font-weight: 400;
|
|
13
13
|
`;
|
|
14
14
|
|
|
@@ -27,13 +27,13 @@ export default {
|
|
|
27
27
|
fontAwesomeBrands: `
|
|
28
28
|
${fontAwesome}
|
|
29
29
|
|
|
30
|
-
font-family: 'Font Awesome
|
|
30
|
+
font-family: 'Font Awesome 7 Brands';
|
|
31
31
|
font-weight: normal;
|
|
32
32
|
`,
|
|
33
33
|
fontAwesomeSolid: `
|
|
34
34
|
${fontAwesome}
|
|
35
35
|
|
|
36
|
-
font-weight:
|
|
36
|
+
font-weight: 900;
|
|
37
37
|
`,
|
|
38
38
|
kodeMono: `
|
|
39
39
|
font-family: 'Kode Mono Variable', monospace;
|
package/theme/input.js
CHANGED
|
@@ -31,7 +31,7 @@ export const checkbox = ({ colors }) => `
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
&:checked:before {
|
|
34
|
-
box-shadow: inset 1em 1em ${colors.
|
|
34
|
+
box-shadow: inset 1em 1em ${colors.selected};
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
&:focus {
|
|
@@ -47,9 +47,9 @@ export default ({ colors }) => `
|
|
|
47
47
|
box-sizing: border-box;
|
|
48
48
|
width: 100%;
|
|
49
49
|
color: ${colors.light(colors.red)};
|
|
50
|
-
accent-color: ${colors.
|
|
50
|
+
accent-color: ${colors.selected};
|
|
51
51
|
background-color: ${colors.black};
|
|
52
|
-
outline-color: ${colors.lighter(colors.
|
|
52
|
+
outline-color: ${colors.lighter(colors.selected)};
|
|
53
53
|
padding: 2px 4px;
|
|
54
54
|
|
|
55
55
|
&:disabled {
|
package/theme/page.js
CHANGED
|
@@ -9,6 +9,7 @@ import _table from './table';
|
|
|
9
9
|
export default theme => `
|
|
10
10
|
html {
|
|
11
11
|
height: 100%;
|
|
12
|
+
color-scheme: ${colors.black.isDark() ? 'dark' : 'light'};
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
body {
|
|
@@ -25,6 +26,11 @@ export default theme => `
|
|
|
25
26
|
margin: 0;
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
::selection {
|
|
30
|
+
background: ${colors.lighter(colors.selected)};
|
|
31
|
+
color: ${colors.black};
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
* {
|
|
29
35
|
touch-action: manipulation;
|
|
30
36
|
-webkit-text-size-adjust: none;
|
package/theme/scrollbar.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export default ({ colors }) => `
|
|
2
|
+
html {
|
|
3
|
+
scrollbar-color: ${colors.alpha(colors.selected, 0.6)} ${colors.white.setAlpha(0.06)};
|
|
4
|
+
}
|
|
5
|
+
|
|
2
6
|
::-webkit-scrollbar {
|
|
3
7
|
width: 24px;
|
|
4
8
|
height: 24px;
|
|
@@ -10,15 +14,15 @@ export default ({ colors }) => `
|
|
|
10
14
|
}
|
|
11
15
|
::-webkit-scrollbar-thumb {
|
|
12
16
|
background: ${colors.white.setAlpha(0.06)};
|
|
13
|
-
-webkit-box-shadow: inset 0 0 2px 1px ${colors.
|
|
17
|
+
-webkit-box-shadow: inset 0 0 2px 1px ${colors.selected};
|
|
14
18
|
border-radius: 12px;
|
|
15
19
|
}
|
|
16
20
|
::-webkit-scrollbar-thumb:hover {
|
|
17
21
|
background: ${colors.white.setAlpha(0.09)};
|
|
18
|
-
-webkit-box-shadow: inset 0 0 3px 1px ${colors.
|
|
22
|
+
-webkit-box-shadow: inset 0 0 3px 1px ${colors.selected};
|
|
19
23
|
}
|
|
20
24
|
::-webkit-scrollbar-thumb:active {
|
|
21
25
|
background: ${colors.white.setAlpha(0.12)};
|
|
22
|
-
-webkit-box-shadow: inset 0 0 4px 2px ${colors.
|
|
26
|
+
-webkit-box-shadow: inset 0 0 4px 2px ${colors.selected};
|
|
23
27
|
}
|
|
24
28
|
`;
|
package/theme/table.js
CHANGED
|
@@ -42,12 +42,12 @@ export default ({ colors }) => `
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
tr:hover {
|
|
45
|
-
background-color: ${colors.blackish(colors.
|
|
45
|
+
background-color: ${colors.blackish(colors.selected)};
|
|
46
46
|
color: ${colors.lighter(colors.gray)};
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
td:hover, th:hover {
|
|
50
|
-
background-color: ${colors.
|
|
50
|
+
background-color: ${colors.selected.darken(32)};
|
|
51
51
|
color: ${colors.white};
|
|
52
52
|
}
|
|
53
53
|
`;
|