@stackoverflow/stacks 2.7.1 → 2.7.3

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.
@@ -1,78 +1,85 @@
1
- .s-anchors {
2
- // CUSTOM PROPERTIED DEFINED WITHIN VARIANTS
3
- // --_an-a-fc
4
- // --_an-a-fc-hover
5
- // --_an-a-fc-visited
6
- // --_an-a-fc-hover-visited
7
-
8
- // MODIFIERS
9
- &&__underlined {
10
- a:not(.s-link),
11
- .s-btn.s-btn__link {
12
- text-decoration: underline;
13
- }
14
- }
15
-
16
- // VARIANTS
17
- &&__danger,
18
- &&__grayscale,
19
- &&__inherit,
20
- &&__muted {
21
- --_an-a-fc-hover-visited: var(--_an-a-fc-hover);
22
- }
23
-
24
- &&__danger {
25
- --_an-a-fc: var(--red-400);
26
- --_an-a-fc-hover: var(--red-500);
27
- --_an-a-fc-visited: var(--red-600);
28
- }
29
-
30
- &&__default {
31
- --_an-a-fc: var(--theme-link-color, var(--theme-secondary-400));
32
- --_an-a-fc-hover: var(--theme-link-color-hover, var(--theme-secondary-500));
33
- --_an-a-fc-visited: var(--theme-link-color-visited, var(--purple-500));
34
- --_an-a-fc-hover-visited: var(--theme-link-color-hover, var(--purple-600));
35
- }
36
-
37
- &&__grayscale {
38
- --_an-a-fc: var(--black-500);
39
- --_an-a-fc-hover: var(--black-600);
40
- --_an-a-fc-visited: var(--black-400);
41
- }
42
-
43
- &&__inherit {
44
- --_an-a-fc: inherit;
45
- --_an-a-fc-hover: inherit;
46
- --_an-a-fc-visited: inherit;
47
- }
48
-
49
- &&__muted {
50
- --_an-a-fc: var(--black-400);
51
- --_an-a-fc-hover: var(--black-500);
52
- --_an-a-fc-visited: var(--black-600);
53
- }
54
-
55
- &&__danger,
56
- &&__default,
57
- &&__grayscale,
58
- &&__inherit,
59
- &&__muted {
60
- a:not(.s-link),
61
- .s-btn.s-btn__link {
62
- &:active,
63
- &:hover {
64
- color: var(--_an-a-fc-hover);
65
- }
66
-
67
- color: var(--_an-a-fc, inherit);
68
- }
69
-
70
- a:not(.s-link):visited {
71
- &:hover {
72
- color: var(--_an-a-fc-hover-visited, inherit);
73
- }
74
-
75
- color: var(--_an-a-fc-visited, inherit);
76
- }
77
- }
78
- }
1
+ .s-anchors {
2
+ // CUSTOM PROPERTIED DEFINED WITHIN VARIANTS
3
+ // --_an-a-fc
4
+ // --_an-a-fc-hover
5
+ // --_an-a-fc-visited
6
+ // --_an-a-fc-hover-visited
7
+
8
+ // MODIFIERS
9
+ &&__underlined {
10
+ a:not(.s-link),
11
+ .s-btn.s-btn__link {
12
+ text-decoration: underline;
13
+ }
14
+ }
15
+
16
+ // VARIANTS
17
+ &&__danger,
18
+ &&__grayscale,
19
+ &&__inherit,
20
+ &&__muted {
21
+ --_an-a-fc-hover-visited: var(--_an-a-fc-hover);
22
+ }
23
+
24
+ &&__danger {
25
+ --_an-a-fc: var(--red-400);
26
+ --_an-a-fc-hover: var(--red-500);
27
+ --_an-a-fc-visited: var(--red-600);
28
+ }
29
+
30
+ &&__default {
31
+ --_an-a-fc: var(--theme-link-color, var(--theme-secondary-400));
32
+ --_an-a-fc-hover: var(--theme-link-color-hover, var(--theme-secondary-500));
33
+ --_an-a-fc-visited: var(--theme-link-color-visited, var(--purple-500));
34
+ --_an-a-fc-hover-visited: var(--theme-link-color-hover, var(--purple-600));
35
+ }
36
+
37
+ &&__grayscale {
38
+ --_an-a-fc: var(--black-500);
39
+ --_an-a-fc-hover: var(--black-600);
40
+ --_an-a-fc-visited: var(--black-400);
41
+ }
42
+
43
+ &&__inherit {
44
+ a:not(.s-link):not(.s-btn),
45
+ .s-btn.s-btn__link {
46
+ // This ensures inherited colors are applied instead of generic link colors targeting `a`
47
+ // See lib/components/link/link.less
48
+ color: var(--_an-a-fc) !important;
49
+ }
50
+
51
+ --_an-a-fc: inherit;
52
+ --_an-a-fc-hover: inherit;
53
+ --_an-a-fc-visited: inherit;
54
+ }
55
+
56
+ &&__muted {
57
+ --_an-a-fc: var(--black-400);
58
+ --_an-a-fc-hover: var(--black-500);
59
+ --_an-a-fc-visited: var(--black-600);
60
+ }
61
+
62
+ &&__danger,
63
+ &&__default,
64
+ &&__grayscale,
65
+ &&__inherit,
66
+ &&__muted {
67
+ a:not(.s-link),
68
+ .s-btn.s-btn__link {
69
+ &:active,
70
+ &:hover {
71
+ color: var(--_an-a-fc-hover);
72
+ }
73
+
74
+ color: var(--_an-a-fc, inherit);
75
+ }
76
+
77
+ a:not(.s-link):visited {
78
+ &:hover {
79
+ color: var(--_an-a-fc-hover-visited, inherit);
80
+ }
81
+
82
+ color: var(--_an-a-fc-visited, inherit);
83
+ }
84
+ }
85
+ }
@@ -1,19 +1,25 @@
1
1
  // TODO we *really* shouldn't be apply styles directly onto `<a>` like this, but
2
2
  // it's tech debt that'll take some doing in consumer's code to pay down.
3
3
  a {
4
- &:visited {
5
- // We're target these specific selectors to avoid affecting the visited state of stacks components
6
- // not specified here. See for https://github.com/StackExchange/Stacks/pull/1740#discussion_r1698389312
7
- // TODO remove .post-tag, .badge, .badge-tag reference once core no longer requires them
8
- &:not([class*="s-"]):not(.post-tag):not(.badge):not(.badge-tag),
9
- &.s-link,
10
- &.s-sidebarwidget--action,
11
- &.s-user-card--link {
12
- &:hover {
13
- color: var(--_li-fc-hover-visited);
14
- }
4
+ // We're target these specific selectors to avoid affecting the visited state of stacks components
5
+ // not specified here. See for https://github.com/StackExchange/Stacks/pull/1740#discussion_r1698389312
6
+ // TODO remove .post-tag, .badge, .badge-tag reference once core no longer requires them
7
+ &:not([class*="s-"]):not(.post-tag):not(.badge):not(.badge-tag),
8
+ &.s-sidebarwidget--action,
9
+ &.s-user-card--link {
10
+ // Use --_an-a-* (.s-anchors a) custom properties when they're defined.
11
+ // Otherwise, use the default link colors.
12
+ &:active,
13
+ &:hover {
14
+ color: var(--_an-a-fc-hover, var(--_li-fc-hover));
15
+ }
16
+
17
+ &:visited {
18
+ color: var(--_an-a-fc-visited, var(--_li-fc-visited));
19
+ }
15
20
 
16
- color: var(--_li-fc-visited);
21
+ &:hover:visited {
22
+ color: var(--_an-a-fc-hover-visited, var(--_li-fc-hover-visited));
17
23
  }
18
24
  }
19
25
  }
@@ -103,12 +109,6 @@ a,
103
109
  pointer-events: none;
104
110
  }
105
111
 
106
- // INTERACTION
107
- &:active,
108
- &:hover {
109
- --_li-fc: var(--_li-fc-hover);
110
- }
111
-
112
112
  color: var(--_li-fc);
113
113
  cursor: pointer;
114
114
  text-decoration: none;
@@ -133,4 +133,17 @@ a,
133
133
  p & {
134
134
  text-decoration: underline;
135
135
  }
136
+
137
+ // INTERACTION
138
+ &:active,
139
+ &:hover {
140
+ --_li-fc: var(--_li-fc-hover);
141
+ }
142
+ &:visited {
143
+ color: var(--_li-fc-visited);
144
+ }
145
+
146
+ &:hover:visited {
147
+ color: var(--_li-fc-hover-visited);
148
+ }
136
149
  }
@@ -1,195 +1,195 @@
1
- /**
2
- * Generate color variables with a given color name
3
- *
4
- * Usage example:
5
- * .generate-variant-variables(purple, important);
6
- *
7
- * @colorName - The name of the color to use to construct variables values
8
- * @modifier - Modifier name to determine variable values for that modifier
9
- */
10
- .generate-variant-variables(@colorName: "", @modifier: "") {
11
- & when (@modifier = "") {
12
- --_no-bc: ~"var(--@{colorName}-300)";
13
- --_no-bg: ~"var(--@{colorName}-100)";
14
- --_no-btn-bg-active: ~"var(--@{colorName}-200)";
15
- --_no-btn-bg-focus: ~"var(--@{colorName}-200)";
16
- --_no-btn-fc: ~"var(--@{colorName}-500)";
17
- --_no-code-bc: ~"var(--@{colorName}-300)";
18
- --_no-code-bg: ~"var(--@{colorName}-200)";
19
- }
20
-
21
- & when (@modifier = important) {
22
- --_no-bc: var(--_no-bg);
23
- --_no-bg: ~"var(--@{colorName}-400)";
24
- --_no-fc: var(--white);
25
- --_no-btn-bg-active: ~"var(--@{colorName}-500)";
26
- --_no-btn-bg-focus: ~"var(--@{colorName}-500)";
27
- --_no-btn-fc: ~"var(--@{colorName}-100)";
28
- --_no-code-bc: ~"var(--@{colorName}-300)";
29
- --_no-code-bg: ~"var(--@{colorName}-500)";
30
-
31
- .highcontrast-mode({
32
- --_no-bg: ~"var(--@{colorName}-500)";
33
- });
34
- }
35
- }
36
-
37
- /**
38
- * Generate styles for a notice-based component
39
- *
40
- * Usage example:
41
- * .construct-notice-component(s-banner);
42
- *
43
- * @baseClass - The base class name for the notice component
44
- */
45
- .construct-notice-component(@baseClass) {
46
- --_no-bc: var(--black-225);
47
- --_no-bg: var(--black-100);
48
- --_no-fc: var(--black-500);
49
- --_no-btn-bg-active: var(--black-250);
50
- --_no-btn-bg-focus: var(--black-225);
51
- --_no-btn-fc: var(--_no-fc);
52
- --_no-code-bc: var(--black-300);
53
- --_no-code-bg: var(--black-200);
54
- --_no-code-fc: var(--_no-fc);
55
-
56
- // CONTEXTUAL STYLES
57
- .dark-mode({
58
- --_no-bc: var(--_no-bg);
59
- });
60
-
61
- .highcontrast-mode({
62
- &,
63
- &.@{baseClass}__danger,
64
- &.@{baseClass}__info,
65
- &.@{baseClass}__success,
66
- &.@{baseClass}__warning {
67
- --_no-code-bc: var(--black-400);
68
- --_no-code-bg: var(--white);
69
- --_no-code-fc: var(--black);
70
-
71
- &.@{baseClass}__important {
72
- --_no-code-bc: var(--black-200);
73
- --_no-code-bg: var(--black);
74
- --_no-code-fc: var(--white);
75
- }
76
- }
77
- });
78
-
79
- // MODIFIERS
80
- &__important:not(.@{baseClass}__danger):not(.@{baseClass}__info):not(.@{baseClass}__success):not(.@{baseClass}__warning) {
81
- --_no-bc: var(--_no-bg);
82
- --_no-bg: var(--black-500);
83
- --_no-fc: var(--white);
84
- --_no-btn-bg-focus: var(--black-600);
85
- --_no-btn-bg-active: var(--black-600);
86
- --_no-btn-fc: var(--_no-fc);
87
- --_no-code-bc: var(--black-300);
88
- --_no-code-bg: var(--black-600);
89
- }
90
-
91
- // VARIANTS
92
- &__danger {
93
- &:not(.@{baseClass}__important) {
94
- .generate-variant-variables(red);
95
- }
96
-
97
- &.@{baseClass}__important {
98
- .generate-variant-variables(red, important);
99
- }
100
- }
101
-
102
- &__info {
103
- &:not(.@{baseClass}__important) {
104
- .generate-variant-variables(theme-secondary);
105
- }
106
-
107
- &.@{baseClass}__important {
108
- .generate-variant-variables(theme-secondary, important);
109
- }
110
- }
111
-
112
- &__success {
113
- &:not(.@{baseClass}__important) {
114
- .generate-variant-variables(green);
115
- }
116
-
117
- &.@{baseClass}__important {
118
- .generate-variant-variables(green, important);
119
- }
120
- }
121
-
122
- &__warning {
123
- &:not(.@{baseClass}__important) {
124
- .generate-variant-variables(yellow);
125
- --_no-btn-fc: var(--yellow-600);
126
- }
127
-
128
- &.@{baseClass}__important {
129
- --_no-bc: var(--_no-bg);
130
- --_no-bg: var(--yellow-400);
131
- --_no-fc: var(--black);
132
- --_no-btn-fc: var(--_no-fc);
133
- --_no-btn-bg-active: var(--yellow-300);
134
- --_no-btn-bg-focus: var(--yellow-300);
135
- --_no-code-bc: var(--yellow-500);
136
- --_no-code-bg: var(--yellow-300);
137
-
138
- .dark-mode({
139
- --_no-fc: var(--white);
140
- --_no-code-bc: var(--yellow-300);
141
- --_no-code-bg: var(--yellow-500);
142
- });
143
-
144
- .highcontrast-mode({
145
- --_no-bg: var(--yellow-500);
146
- --_no-fc: var(--white);
147
- --_no-btn-bg-active: transparent;
148
- --_no-btn-bg-focus: transparent;
149
- });
150
- }
151
- }
152
-
153
- // CHILD ELEMENTS
154
- code {
155
- background-color: var(--_no-code-bg);
156
- color: var(--_no-code-fc);
157
- outline: var(--su-static1) solid var(--_no-code-bc);
158
-
159
- border-radius: var(--br-sm);
160
- padding-left: var(--su2);
161
- padding-right: var(--su2);
162
- }
163
-
164
- & &--btn {
165
- // TODO: decouple .s-notice--btn from .s-btn
166
- &:active {
167
- background-color: var(--_no-btn-bg-active, inherit) !important;
168
- }
169
-
170
- &:focus-visible,
171
- &:hover,
172
- &.focus-inset-bordered {
173
- background-color: var(--_no-btn-bg-focus, inherit) !important;
174
- }
175
-
176
- color: var(--_no-btn-fc, inherit) !important;
177
- padding: var(--su8);
178
- }
179
-
180
- // STYLES MODIFIED BY COMPONENT-SPECIFIC CUSTOM PROPERTIES
181
- background: var(--_no-bg);
182
- border-color: var(--_no-bc);
183
- color: var(--_no-fc);
184
-
185
- border-style: solid;
186
- font-size: var(--fs-body1);
187
- }
188
-
189
- .s-notice {
190
- .construct-notice-component(s-notice);
191
-
192
- border-radius: var(--br-md);
193
- border-width: var(--su-static1);
194
- padding: var(--su16);
195
- }
1
+ /**
2
+ * Generate color variables with a given color name
3
+ *
4
+ * Usage example:
5
+ * .generate-variant-variables(purple, important);
6
+ *
7
+ * @colorName - The name of the color to use to construct variables values
8
+ * @modifier - Modifier name to determine variable values for that modifier
9
+ */
10
+ .generate-variant-variables(@colorName: "", @modifier: "") {
11
+ & when (@modifier = "") {
12
+ --_no-bc: ~"var(--@{colorName}-300)";
13
+ --_no-bg: ~"var(--@{colorName}-100)";
14
+ --_no-btn-bg-active: ~"var(--@{colorName}-200)";
15
+ --_no-btn-bg-focus: ~"var(--@{colorName}-200)";
16
+ --_no-btn-fc: ~"var(--@{colorName}-500)";
17
+ --_no-code-bc: ~"var(--@{colorName}-300)";
18
+ --_no-code-bg: ~"var(--@{colorName}-200)";
19
+ }
20
+
21
+ & when (@modifier = important) {
22
+ --_no-bc: var(--_no-bg);
23
+ --_no-bg: ~"var(--@{colorName}-400)";
24
+ --_no-fc: var(--white);
25
+ --_no-btn-bg-active: ~"var(--@{colorName}-500)";
26
+ --_no-btn-bg-focus: ~"var(--@{colorName}-500)";
27
+ --_no-btn-fc: ~"var(--@{colorName}-100)";
28
+ --_no-code-bc: ~"var(--@{colorName}-300)";
29
+ --_no-code-bg: ~"var(--@{colorName}-500)";
30
+
31
+ .highcontrast-mode({
32
+ --_no-bg: ~"var(--@{colorName}-500)";
33
+ });
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Generate styles for a notice-based component
39
+ *
40
+ * Usage example:
41
+ * .construct-notice-component(s-banner);
42
+ *
43
+ * @baseClass - The base class name for the notice component
44
+ */
45
+ .construct-notice-component(@baseClass) {
46
+ --_no-bc: var(--black-225);
47
+ --_no-bg: var(--black-100);
48
+ --_no-fc: var(--black-500);
49
+ --_no-btn-bg-active: var(--black-250);
50
+ --_no-btn-bg-focus: var(--black-225);
51
+ --_no-btn-fc: var(--_no-fc);
52
+ --_no-code-bc: var(--black-300);
53
+ --_no-code-bg: var(--black-200);
54
+ --_no-code-fc: var(--_no-fc);
55
+
56
+ // CONTEXTUAL STYLES
57
+ .dark-mode({
58
+ --_no-bc: var(--_no-bg);
59
+ });
60
+
61
+ .highcontrast-mode({
62
+ &,
63
+ &.@{baseClass}__danger,
64
+ &.@{baseClass}__info,
65
+ &.@{baseClass}__success,
66
+ &.@{baseClass}__warning {
67
+ --_no-code-bc: var(--black-400);
68
+ --_no-code-bg: var(--white);
69
+ --_no-code-fc: var(--black);
70
+
71
+ &.@{baseClass}__important {
72
+ --_no-code-bc: var(--black-200);
73
+ --_no-code-bg: var(--black);
74
+ --_no-code-fc: var(--white);
75
+ }
76
+ }
77
+ });
78
+
79
+ // MODIFIERS
80
+ &__important:not(.@{baseClass}__danger):not(.@{baseClass}__info):not(.@{baseClass}__success):not(.@{baseClass}__warning) {
81
+ --_no-bc: var(--_no-bg);
82
+ --_no-bg: var(--black-500);
83
+ --_no-fc: var(--white);
84
+ --_no-btn-bg-focus: var(--black-600);
85
+ --_no-btn-bg-active: var(--black-600);
86
+ --_no-btn-fc: var(--_no-fc);
87
+ --_no-code-bc: var(--black-300);
88
+ --_no-code-bg: var(--black-600);
89
+ }
90
+
91
+ // VARIANTS
92
+ &__danger {
93
+ &:not(.@{baseClass}__important) {
94
+ .generate-variant-variables(red);
95
+ }
96
+
97
+ &.@{baseClass}__important {
98
+ .generate-variant-variables(red, important);
99
+ }
100
+ }
101
+
102
+ &__info {
103
+ &:not(.@{baseClass}__important) {
104
+ .generate-variant-variables(theme-secondary);
105
+ }
106
+
107
+ &.@{baseClass}__important {
108
+ .generate-variant-variables(theme-secondary, important);
109
+ }
110
+ }
111
+
112
+ &__success {
113
+ &:not(.@{baseClass}__important) {
114
+ .generate-variant-variables(green);
115
+ }
116
+
117
+ &.@{baseClass}__important {
118
+ .generate-variant-variables(green, important);
119
+ }
120
+ }
121
+
122
+ &__warning {
123
+ &:not(.@{baseClass}__important) {
124
+ .generate-variant-variables(yellow);
125
+ --_no-btn-fc: var(--yellow-600);
126
+ }
127
+
128
+ &.@{baseClass}__important {
129
+ --_no-bc: var(--_no-bg);
130
+ --_no-bg: var(--yellow-400);
131
+ --_no-fc: var(--black);
132
+ --_no-btn-fc: var(--_no-fc);
133
+ --_no-btn-bg-active: var(--yellow-300);
134
+ --_no-btn-bg-focus: var(--yellow-300);
135
+ --_no-code-bc: var(--yellow-500);
136
+ --_no-code-bg: var(--yellow-300);
137
+
138
+ .dark-mode({
139
+ --_no-fc: var(--white);
140
+ --_no-code-bc: var(--yellow-300);
141
+ --_no-code-bg: var(--yellow-500);
142
+ });
143
+
144
+ .highcontrast-mode({
145
+ --_no-bg: var(--yellow-500);
146
+ --_no-fc: var(--white);
147
+ --_no-btn-bg-active: transparent;
148
+ --_no-btn-bg-focus: transparent;
149
+ });
150
+ }
151
+ }
152
+
153
+ // CHILD ELEMENTS
154
+ code {
155
+ background-color: var(--_no-code-bg);
156
+ color: var(--_no-code-fc);
157
+ outline: var(--su-static1) solid var(--_no-code-bc);
158
+
159
+ border-radius: var(--br-sm);
160
+ padding-left: var(--su2);
161
+ padding-right: var(--su2);
162
+ }
163
+
164
+ & &--btn {
165
+ // TODO: decouple .s-notice--btn from .s-btn
166
+ &:active {
167
+ background-color: var(--_no-btn-bg-active, inherit) !important;
168
+ }
169
+
170
+ &:focus-visible,
171
+ &:hover,
172
+ &.focus-inset-bordered {
173
+ background-color: var(--_no-btn-bg-focus, inherit) !important;
174
+ }
175
+
176
+ color: var(--_no-btn-fc, inherit) !important;
177
+ padding: var(--su8);
178
+ }
179
+
180
+ // STYLES MODIFIED BY COMPONENT-SPECIFIC CUSTOM PROPERTIES
181
+ background: var(--_no-bg);
182
+ border-color: var(--_no-bc);
183
+ color: var(--_no-fc);
184
+
185
+ border-style: solid;
186
+ font-size: var(--fs-body1);
187
+ }
188
+
189
+ .s-notice {
190
+ .construct-notice-component(s-notice);
191
+
192
+ border-radius: var(--br-md);
193
+ border-width: var(--su-static1);
194
+ padding: var(--su16);
195
+ }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "https://github.com/StackExchange/Stacks.git"
7
7
  },
8
- "version": "2.7.1",
8
+ "version": "2.7.3",
9
9
  "files": [
10
10
  "dist",
11
11
  "lib",