@stackoverflow/stacks 2.7.3 → 2.7.4
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/LICENSE.MD +9 -9
- package/README.md +158 -180
- package/dist/css/stacks.css +6 -0
- package/dist/js/stacks.min.js +1 -1
- package/lib/atomic/border.less +139 -139
- package/lib/atomic/color.less +36 -36
- package/lib/atomic/flex.less +426 -426
- package/lib/atomic/gap.less +44 -44
- package/lib/atomic/grid.less +139 -139
- package/lib/atomic/misc.less +374 -374
- package/lib/atomic/spacing.less +98 -98
- package/lib/atomic/typography.less +266 -264
- package/lib/atomic/width-height.less +194 -194
- package/lib/base/body.less +44 -44
- package/lib/base/configuration-static.less +61 -61
- package/lib/base/fieldset.less +5 -5
- package/lib/base/icon.less +11 -11
- package/lib/base/internal.less +220 -220
- package/lib/base/reset-meyer.less +64 -64
- package/lib/base/reset-normalize.less +449 -449
- package/lib/base/reset.less +20 -20
- package/lib/components/activity-indicator/activity-indicator.less +53 -53
- package/lib/components/avatar/avatar.less +108 -108
- package/lib/components/award-bling/award-bling.less +31 -31
- package/lib/components/banner/banner.less +44 -44
- package/lib/components/banner/banner.ts +149 -149
- package/lib/components/block-link/block-link.less +82 -82
- package/lib/components/breadcrumbs/breadcrumbs.less +41 -41
- package/lib/components/button-group/button-group.less +82 -82
- package/lib/components/card/card.less +37 -37
- package/lib/components/check-control/check-control.less +17 -17
- package/lib/components/check-group/check-group.less +19 -19
- package/lib/components/checkbox_radio/checkbox_radio.less +159 -159
- package/lib/components/code-block/code-block.fixtures.ts +88 -88
- package/lib/components/code-block/code-block.less +116 -116
- package/lib/components/description/description.less +9 -9
- package/lib/components/empty-state/empty-state.less +16 -16
- package/lib/components/expandable/expandable.less +118 -118
- package/lib/components/input-fill/input-fill.less +35 -35
- package/lib/components/input-icon/input-icon.less +45 -45
- package/lib/components/input-message/input-message.less +49 -49
- package/lib/components/label/label.less +110 -110
- package/lib/components/link-preview/link-preview.less +148 -148
- package/lib/components/menu/menu.less +41 -41
- package/lib/components/modal/modal.less +118 -118
- package/lib/components/modal/modal.ts +383 -383
- package/lib/components/navigation/navigation.less +136 -136
- package/lib/components/navigation/navigation.ts +128 -128
- package/lib/components/page-title/page-title.less +51 -51
- package/lib/components/popover/popover.less +159 -159
- package/lib/components/popover/popover.ts +651 -651
- package/lib/components/post-summary/post-summary.less +457 -457
- package/lib/components/progress-bar/progress-bar.less +291 -291
- package/lib/components/prose/prose.less +452 -452
- package/lib/components/select/select.less +138 -138
- package/lib/components/spinner/spinner.less +103 -103
- package/lib/components/table/table.ts +296 -296
- package/lib/components/table-container/table-container.less +4 -4
- package/lib/components/tag/tag.less +186 -186
- package/lib/components/toast/toast.less +35 -35
- package/lib/components/toast/toast.ts +357 -357
- package/lib/components/toggle-switch/toggle-switch.less +104 -104
- package/lib/components/topbar/topbar.less +553 -553
- package/lib/components/uploader/uploader.less +205 -205
- package/lib/components/user-card/user-card.less +129 -129
- package/lib/controllers.ts +33 -33
- package/lib/exports/color-mixins.less +283 -283
- package/lib/exports/constants-helpers.less +108 -108
- package/lib/exports/constants-type.less +155 -155
- package/lib/exports/exports.less +15 -15
- package/lib/exports/mixins.less +334 -333
- package/lib/exports/spacing-mixins.less +67 -67
- package/lib/index.ts +32 -32
- package/lib/input-utils.less +41 -41
- package/lib/stacks-dynamic.less +24 -24
- package/lib/stacks-static.less +93 -93
- package/lib/stacks.less +13 -13
- package/lib/test/assertions.ts +36 -36
- package/lib/test/less-test-utils.ts +28 -28
- package/lib/test/open-wc-testing-patch.d.ts +26 -26
- package/lib/tsconfig.build.json +4 -4
- package/lib/tsconfig.json +17 -17
- package/package.json +26 -22
package/lib/exports/mixins.less
CHANGED
|
@@ -1,333 +1,334 @@
|
|
|
1
|
-
/* stylelint-disable indentation */
|
|
2
|
-
//
|
|
3
|
-
// STACK OVERFLOW
|
|
4
|
-
// MIXINS
|
|
5
|
-
//
|
|
6
|
-
// This CSS comes from Stacks, our CSS & Pattern library for rapidly building
|
|
7
|
-
// Stack Overflow. For documentation of all these classes and how to contribute,
|
|
8
|
-
// visit https://stackoverflow.design/
|
|
9
|
-
//
|
|
10
|
-
// ============================================================================
|
|
11
|
-
// $ Clearfix
|
|
12
|
-
// -----------------------------------------------------------------------------
|
|
13
|
-
.clearfix() {
|
|
14
|
-
&:before,
|
|
15
|
-
&:after {
|
|
16
|
-
content: "";
|
|
17
|
-
display: table;
|
|
18
|
-
}
|
|
19
|
-
&:after { clear: both; }
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// ============================================================================
|
|
23
|
-
// -- LIGHTMODE
|
|
24
|
-
// .light-mode-forced ensures light color scheme is used in .theme-light__forced
|
|
25
|
-
//
|
|
26
|
-
// .light-mode-forced({ color: var(--black-600) });
|
|
27
|
-
//
|
|
28
|
-
// ---------------------------------------------------------------------------
|
|
29
|
-
|
|
30
|
-
.light-mode-forced(@rules) {
|
|
31
|
-
.theme-light__forced &,
|
|
32
|
-
body.theme-system .theme-light__forced &,
|
|
33
|
-
body.theme-dark .theme-light__forced & {
|
|
34
|
-
@rules();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// ===========================================================================
|
|
39
|
-
// -- DARKMODE
|
|
40
|
-
// .darkmode renders a dark mode override behind the
|
|
41
|
-
// prefers-color-scheme: dark media query and .theme-system. It also
|
|
42
|
-
// renders the same rules outside of the media query with .theme-dark
|
|
43
|
-
//
|
|
44
|
-
// Usage example:
|
|
45
|
-
//
|
|
46
|
-
// .dark-mode({ background-color: var(--black-100); });
|
|
47
|
-
//
|
|
48
|
-
// ---------------------------------------------------------------------------
|
|
49
|
-
|
|
50
|
-
.dark-mode(@rules) {
|
|
51
|
-
body.theme-system & {
|
|
52
|
-
@media (prefers-color-scheme: dark) {
|
|
53
|
-
@rules();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
body.theme-dark &,
|
|
58
|
-
.theme-dark__forced &,
|
|
59
|
-
body.theme-system .theme-dark__forced & {
|
|
60
|
-
@rules();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// ===========================================================================
|
|
65
|
-
// -- HIGHCONTRAST
|
|
66
|
-
// .highcontrast-mode renders a high contrast mode override for .theme-highcontrast
|
|
67
|
-
//
|
|
68
|
-
// Usage example:
|
|
69
|
-
//
|
|
70
|
-
// .highcontrast-mode({ background-color: var(--black-100); });
|
|
71
|
-
//
|
|
72
|
-
// ---------------------------------------------------------------------------
|
|
73
|
-
|
|
74
|
-
.highcontrast-mode(@rules) {
|
|
75
|
-
body.theme-highcontrast & {
|
|
76
|
-
@rules();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.highcontrast-dark-mode(@rules) {
|
|
81
|
-
body.theme-highcontrast.theme-system & {
|
|
82
|
-
@media (prefers-color-scheme: dark) {
|
|
83
|
-
@rules();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
body.theme-highcontrast.theme-dark & {
|
|
87
|
-
@rules();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// ===========================================================================
|
|
92
|
-
// -- FONT FACE
|
|
93
|
-
// Used to load hosted, custom webfonts. You must provide the font's
|
|
94
|
-
// full file path in the mixin. All modern browsers the WOFF file format.
|
|
95
|
-
// Will automatically add various local()s to try using already-installed
|
|
96
|
-
// fonts before downloading.
|
|
97
|
-
// ---------------------------------------------------------------------------
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
font-
|
|
102
|
-
font-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* @
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
//
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
//
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
//
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
@
|
|
156
|
-
@
|
|
157
|
-
@
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
var(~"--@{color-prefix}-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
@
|
|
178
|
-
@
|
|
179
|
-
|
|
180
|
-
calc(var(~"--@{color-prefix}-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
@
|
|
196
|
-
@
|
|
197
|
-
@
|
|
198
|
-
@
|
|
199
|
-
|
|
200
|
-
calc(@
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
calc(var(~"--@{color-prefix}-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
var(~"--@{color-prefix}-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
//
|
|
222
|
-
//
|
|
223
|
-
//
|
|
224
|
-
//
|
|
225
|
-
// (@styles
|
|
226
|
-
//
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
//
|
|
272
|
-
//
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
-webkit-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
//
|
|
295
|
-
//
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
//
|
|
302
|
-
//
|
|
303
|
-
//
|
|
304
|
-
//
|
|
305
|
-
//
|
|
306
|
-
//
|
|
307
|
-
// -
|
|
308
|
-
// -
|
|
309
|
-
// -
|
|
310
|
-
//
|
|
311
|
-
//
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
@
|
|
316
|
-
@weight-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
@
|
|
323
|
-
@postfix-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
1
|
+
/* stylelint-disable indentation */
|
|
2
|
+
//
|
|
3
|
+
// STACK OVERFLOW
|
|
4
|
+
// MIXINS
|
|
5
|
+
//
|
|
6
|
+
// This CSS comes from Stacks, our CSS & Pattern library for rapidly building
|
|
7
|
+
// Stack Overflow. For documentation of all these classes and how to contribute,
|
|
8
|
+
// visit https://stackoverflow.design/
|
|
9
|
+
//
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// $ Clearfix
|
|
12
|
+
// -----------------------------------------------------------------------------
|
|
13
|
+
.clearfix() {
|
|
14
|
+
&:before,
|
|
15
|
+
&:after {
|
|
16
|
+
content: "";
|
|
17
|
+
display: table;
|
|
18
|
+
}
|
|
19
|
+
&:after { clear: both; }
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// -- LIGHTMODE
|
|
24
|
+
// .light-mode-forced ensures light color scheme is used in .theme-light__forced
|
|
25
|
+
//
|
|
26
|
+
// .light-mode-forced({ color: var(--black-600) });
|
|
27
|
+
//
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
|
|
30
|
+
.light-mode-forced(@rules) {
|
|
31
|
+
.theme-light__forced &,
|
|
32
|
+
body.theme-system .theme-light__forced &,
|
|
33
|
+
body.theme-dark .theme-light__forced & {
|
|
34
|
+
@rules();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ===========================================================================
|
|
39
|
+
// -- DARKMODE
|
|
40
|
+
// .darkmode renders a dark mode override behind the
|
|
41
|
+
// prefers-color-scheme: dark media query and .theme-system. It also
|
|
42
|
+
// renders the same rules outside of the media query with .theme-dark
|
|
43
|
+
//
|
|
44
|
+
// Usage example:
|
|
45
|
+
//
|
|
46
|
+
// .dark-mode({ background-color: var(--black-100); });
|
|
47
|
+
//
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
|
|
50
|
+
.dark-mode(@rules) {
|
|
51
|
+
body.theme-system & {
|
|
52
|
+
@media (prefers-color-scheme: dark) {
|
|
53
|
+
@rules();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
body.theme-dark &,
|
|
58
|
+
.theme-dark__forced &,
|
|
59
|
+
body.theme-system .theme-dark__forced & {
|
|
60
|
+
@rules();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ===========================================================================
|
|
65
|
+
// -- HIGHCONTRAST
|
|
66
|
+
// .highcontrast-mode renders a high contrast mode override for .theme-highcontrast
|
|
67
|
+
//
|
|
68
|
+
// Usage example:
|
|
69
|
+
//
|
|
70
|
+
// .highcontrast-mode({ background-color: var(--black-100); });
|
|
71
|
+
//
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
|
|
74
|
+
.highcontrast-mode(@rules) {
|
|
75
|
+
body.theme-highcontrast & {
|
|
76
|
+
@rules();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.highcontrast-dark-mode(@rules) {
|
|
81
|
+
body.theme-highcontrast.theme-system & {
|
|
82
|
+
@media (prefers-color-scheme: dark) {
|
|
83
|
+
@rules();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
body.theme-highcontrast.theme-dark & {
|
|
87
|
+
@rules();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// ===========================================================================
|
|
92
|
+
// -- FONT FACE
|
|
93
|
+
// Used to load hosted, custom webfonts. You must provide the font's
|
|
94
|
+
// full file path in the mixin. All modern browsers the WOFF file format.
|
|
95
|
+
// Will automatically add various local()s to try using already-installed
|
|
96
|
+
// fonts before downloading.
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
/* stylelint-disable at-rule-descriptor-value-no-unknown */
|
|
99
|
+
.font-face(@family, @path, @weight, @style) {
|
|
100
|
+
@font-face {
|
|
101
|
+
font-family: "@{family}";
|
|
102
|
+
font-style: @style;
|
|
103
|
+
font-weight: @weight;
|
|
104
|
+
& when (@style=italic) {
|
|
105
|
+
#stacks-internals #font-face-src(@family, @path, @weight, " Italic");
|
|
106
|
+
}
|
|
107
|
+
& when not (@style=italic) {
|
|
108
|
+
#stacks-internals #font-face-src(@family, @path, @weight, "");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/* stylelint-enable at-rule-descriptor-value-no-unknown */
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Focus styles for the given context.
|
|
116
|
+
*
|
|
117
|
+
* Usage example:
|
|
118
|
+
* .focus-styles(true, true);
|
|
119
|
+
*
|
|
120
|
+
* @inset: boolean - whether the focus style be placed inside the element.
|
|
121
|
+
* @border: boolean - whether the element's border color change to match the focus style.
|
|
122
|
+
*/
|
|
123
|
+
.focus-styles(@inset: false, @border: false) {
|
|
124
|
+
& when not (@inset) and not (@border) {
|
|
125
|
+
box-shadow: 0 0 0 var(--su-static2) var(--focus-neutral), 0 0 0 var(--su-static4) var(--focus-theme);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
& when not (@inset) and (@border) {
|
|
129
|
+
border-color: var(--focus-neutral) !important;
|
|
130
|
+
box-shadow: 0 0 0 var(--su-static1) var(--focus-neutral), 0 0 0 calc(var(--su-static4) - var(--su-static1)) var(--focus-theme);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
& when (@inset) and not (@border) {
|
|
134
|
+
box-shadow: inset 0 0 0 var(--su-static2) var(--focus-theme), inset 0 0 0 var(--su-static4) var(--focus-neutral);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
& when (@inset) and (@border) {
|
|
138
|
+
border-color: var(--focus-theme) !important;
|
|
139
|
+
box-shadow: inset 0 0 0 var(--su-static1) var(--focus-theme), inset 0 0 0 calc(var(--su-static4) - var(--su-static1)) var(--focus-neutral);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// We include a 2px transparent outline to ensure Windows High Contrast Forced Color Mode
|
|
143
|
+
// includes outlines as expected See https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/
|
|
144
|
+
outline: var(--su-static2) solid transparent !important;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// =============================================================================
|
|
148
|
+
// -- COLORS
|
|
149
|
+
// The following mixins let us do color math on the browser. They take a
|
|
150
|
+
// color prefix, and they expect the different values to be stored in
|
|
151
|
+
// --{prefix}-h, --{prefix}-s and --{prefix}-l
|
|
152
|
+
// -----------------------------------------------------------------------------
|
|
153
|
+
|
|
154
|
+
.load-color-variables(@amount) {
|
|
155
|
+
@amountDecimal: (@amount / 100);
|
|
156
|
+
@amountPercentage: @amount * 1%;
|
|
157
|
+
@complementDecimal: 1 - @amountDecimal;
|
|
158
|
+
@additionDecimal: 1 + @amountDecimal;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.assemble-color(@color-prefix) {
|
|
162
|
+
@result: hsl(var(~"--@{color-prefix}-h"),
|
|
163
|
+
var(~"--@{color-prefix}-s"),
|
|
164
|
+
var(~"--@{color-prefix}-l"));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Increase the lightness of a color in the HSL color space by an absolute amount.
|
|
168
|
+
.native-lighten(@color-prefix, @amount) {
|
|
169
|
+
.load-color-variables(@amount);
|
|
170
|
+
@result: hsl(var(~"--@{color-prefix}-h"),
|
|
171
|
+
var(~"--@{color-prefix}-s"),
|
|
172
|
+
calc(var(~"--@{color-prefix}-l") + @amountPercentage));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Decrease the lightness and saturation of a color in the HSL color space by absolute amounts.
|
|
176
|
+
.native-darken-desaturate(@color-prefix, @darken-amount, @desaturate-amount) {
|
|
177
|
+
@darkenAmountPercentage: .load-color-variables(@darken-amount)[@amountPercentage];
|
|
178
|
+
@desaturateAmountPercentage: .load-color-variables(@desaturate-amount)[@amountPercentage];
|
|
179
|
+
@result: hsl(var(~"--@{color-prefix}-h"),
|
|
180
|
+
calc(var(~"--@{color-prefix}-s") - @desaturateAmountPercentage),
|
|
181
|
+
calc(var(~"--@{color-prefix}-l") - @darkenAmountPercentage));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
// Decrease the lightness of a color in the HSL color space by an absolute amount.
|
|
186
|
+
.native-darken(@color-prefix, @amount) {
|
|
187
|
+
.load-color-variables(@amount);
|
|
188
|
+
@result: hsl(var(~"--@{color-prefix}-h"),
|
|
189
|
+
var(~"--@{color-prefix}-s"),
|
|
190
|
+
calc(var(~"--@{color-prefix}-l") - @amountPercentage));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Mix color with white in variable proportion
|
|
194
|
+
.native-tint(@color-prefix, @amount) {
|
|
195
|
+
.load-color-variables(@amount);
|
|
196
|
+
@ramount: 255 * @amountDecimal;
|
|
197
|
+
@gamount: 255 * @amountDecimal;
|
|
198
|
+
@bamount: 255 * @amountDecimal;
|
|
199
|
+
@result: rgb(calc(@ramount + var(~"--@{color-prefix}-r") * @complementDecimal),
|
|
200
|
+
calc(@gamount + var(~"--@{color-prefix}-g") * @complementDecimal),
|
|
201
|
+
calc(@bamount + var(~"--@{color-prefix}-b") * @complementDecimal));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Mix color with black in variable proportion
|
|
205
|
+
.native-shade(@color-prefix, @amount) {
|
|
206
|
+
.load-color-variables(@amount);
|
|
207
|
+
@result: rgb(calc(var(~"--@{color-prefix}-r") * @complementDecimal),
|
|
208
|
+
calc(var(~"--@{color-prefix}-g") * @complementDecimal),
|
|
209
|
+
calc(var(~"--@{color-prefix}-b") * @complementDecimal));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Set the absolute opacity of a color.
|
|
213
|
+
.native-fade(@color-prefix, @amount) {
|
|
214
|
+
.load-color-variables(@amount);
|
|
215
|
+
@result: hsla(var(~"--@{color-prefix}-h"),
|
|
216
|
+
var(~"--@{color-prefix}-s"),
|
|
217
|
+
var(~"--@{color-prefix}-l"),
|
|
218
|
+
@amountDecimal);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// =============================================================================
|
|
222
|
+
// -- SIZE STYLES
|
|
223
|
+
// The following mixins let us generate pseudo-private custom properties
|
|
224
|
+
// for common sizes. They expect a size (@size), a prefix for the custom
|
|
225
|
+
// property (@prefix), and an array of comma-separates abbreviated styles
|
|
226
|
+
// (@styles).
|
|
227
|
+
// -----------------------------------------------------------------------------
|
|
228
|
+
|
|
229
|
+
.size-styles(@size, @prefix, @styles, @index: length(@styles)) {
|
|
230
|
+
& when (@index > 0) {
|
|
231
|
+
@style: extract(@styles, @index);
|
|
232
|
+
|
|
233
|
+
// xs
|
|
234
|
+
& when (@size = xs) and (@style = fs) {
|
|
235
|
+
--_@{prefix}-fs: var(--fs-fine);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// sm
|
|
239
|
+
& when (@size = sm) and (@style = fs) {
|
|
240
|
+
--_@{prefix}-fs: var(--fs-caption);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// md
|
|
244
|
+
& when (@size = md) and (@style = br) {
|
|
245
|
+
--_@{prefix}-br: calc(var(--br-sm) + var(--su-static1));
|
|
246
|
+
}
|
|
247
|
+
& when (@size = md) and (@style = fs) {
|
|
248
|
+
--_@{prefix}-fs: var(--fs-body3);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// lg
|
|
252
|
+
& when (@size = lg) and (@style = br) {
|
|
253
|
+
--_@{prefix}-br: calc(var(--br-sm) + var(--su-static1));
|
|
254
|
+
}
|
|
255
|
+
& when (@size = lg) and (@style = fs) {
|
|
256
|
+
--_@{prefix}-fs: var(--fs-title);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// xl
|
|
260
|
+
& when (@size = xl) and (@style = br) {
|
|
261
|
+
--_@{prefix}-br: var(--br-md);
|
|
262
|
+
}
|
|
263
|
+
& when (@size = xl) and (@style = fs) {
|
|
264
|
+
--_@{prefix}-fs: var(--fs-headline1);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.size-styles(@size, @prefix, @styles, @index: @index - 1);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// =============================================================================
|
|
272
|
+
// -- WEBKIT AUTOFILL
|
|
273
|
+
// -----------------------------------------------------------------------------
|
|
274
|
+
.webkit-autofill() {
|
|
275
|
+
&:-webkit-autofill {
|
|
276
|
+
&:focus {
|
|
277
|
+
border-color: var(--blue-400);
|
|
278
|
+
// Since the box shadow is overwritten to show a background, we have to re-add the focus outline
|
|
279
|
+
-webkit-box-shadow: 0 0 0 1000px var(--blue-200) inset, 0 0 0 var(--su-static4) var(--focus-ring);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
-webkit-box-shadow: 0 0 0 1000px var(--theme-secondary-200) inset; // This acts as a background color by stretching an inset box shadow across the input
|
|
283
|
+
-webkit-text-fill-color: var(--black);
|
|
284
|
+
border-color: var(--blue-400);
|
|
285
|
+
transition: background-color 0s 50000s; // A hack to infinitely delay background styles that come from the browser.
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
&::-webkit-contacts-auto-fill-button {
|
|
289
|
+
background-color: var(--black); // In Safari, make the autocomplete button darkmode-aware
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// ===========================================================================
|
|
295
|
+
// Internals only beyond this point -- helpers for .font-face()
|
|
296
|
+
// ---------------------------------------------------------------------------
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
#stacks-internals() {
|
|
300
|
+
|
|
301
|
+
// Generate all common variants for local names that this font face may have.
|
|
302
|
+
// The CSS spec (Font Module Level 3, Section 4.3) says to use "only the Postscript
|
|
303
|
+
// name or the full font name".
|
|
304
|
+
// For example, given the family "Comic Sans MS", weight 800, italic, we're
|
|
305
|
+
// trying these local names:
|
|
306
|
+
//
|
|
307
|
+
// - Comic Sans MS Extra Bold Italic
|
|
308
|
+
// - ComicSansMS-ExtraBoldItalic
|
|
309
|
+
// - Comic Sans MS 800 Italic
|
|
310
|
+
// - ComicSansMS-800Italic
|
|
311
|
+
//
|
|
312
|
+
// For the weight 400 we also include the un-weight-postfixed name ("Comic Sans MS Italic").
|
|
313
|
+
|
|
314
|
+
#font-face-src(@family, @path, @weight, @style-postfix) {
|
|
315
|
+
@index: round(@weight/100);
|
|
316
|
+
@weight-names: "Thin", "Extra Light", "Light", "Regular", "Medium", "Semi Bold", "Bold", "Extra Bold", "Black";
|
|
317
|
+
@weight-name: extract(@weight-names, @index);
|
|
318
|
+
#stacks-internals #font-face-src-postfix(@family, @path, "@{weight-name}", @weight, @style-postfix);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
#font-face-src-postfix(@family, @path, @postfix-name, @postfix-number, @style-postfix) {
|
|
322
|
+
@family-nospace: replace(@family, " ", "");
|
|
323
|
+
@postfix-name-nospace: replace("@{postfix-name}@{style-postfix}", " ", "");
|
|
324
|
+
@postfix-number-nospace: replace("@{postfix-number}@{style-postfix}", " ", "");
|
|
325
|
+
|
|
326
|
+
& when (@postfix-name="Regular") {
|
|
327
|
+
src: local("@{family} @{postfix-name}@{style-postfix}"), local("@{family-nospace}-@{postfix-name-nospace}"), local("@{family} @{postfix-number}@{style-postfix}"), local("@{family-nospace}-@{postfix-number-nospace}"), local("@{family}@{style-postfix}"), @path format("woff");
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
& when not (@postfix-name="Regular") {
|
|
331
|
+
src: local("@{family} @{postfix-name}@{style-postfix}"), local("@{family-nospace}-@{postfix-name-nospace}"), local("@{family} @{postfix-number}@{style-postfix}"), local("@{family-nospace}-@{postfix-number-nospace}"), @path format("woff");
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|