@stackoverflow/stacks 3.0.0-beta.3 → 3.0.0-beta.30
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/controllers.d.ts +0 -2
- package/dist/css/stacks.css +14245 -15086
- package/dist/css/stacks.min.css +1 -1
- package/dist/js/stacks.js +0 -364
- package/dist/js/stacks.min.js +1 -1
- package/lib/atomic/backgrounds.less +67 -0
- package/lib/atomic/border-radius.less +38 -0
- package/lib/atomic/borders.less +73 -0
- package/lib/atomic/box-shadow.less +29 -0
- package/lib/atomic/box-sizing.less +3 -0
- package/lib/atomic/current-color.less +2 -0
- package/lib/atomic/cursors.less +8 -0
- package/lib/atomic/display.less +15 -0
- package/lib/atomic/flex.less +6 -34
- package/lib/atomic/floats.less +20 -0
- package/lib/atomic/gap.less +2 -0
- package/lib/atomic/grid.less +2 -0
- package/lib/atomic/height.less +22 -0
- package/lib/atomic/interactivity.less +45 -0
- package/lib/atomic/lists.less +29 -0
- package/lib/atomic/margin.less +48 -0
- package/lib/atomic/object-fit.less +9 -0
- package/lib/atomic/opacity.less +54 -0
- package/lib/atomic/outline.less +11 -0
- package/lib/atomic/overflow.less +17 -0
- package/lib/atomic/padding.less +12 -0
- package/lib/atomic/positioning.less +41 -0
- package/lib/atomic/sizing.less +51 -0
- package/lib/atomic/transitions.less +20 -0
- package/lib/atomic/truncation.less +58 -0
- package/lib/atomic/typography.less +71 -137
- package/lib/atomic/vertical-alignment.less +9 -0
- package/lib/atomic/visibility.less +18 -0
- package/lib/atomic/width.less +27 -0
- package/lib/atomic/z-index.less +12 -0
- package/lib/base/body.less +2 -4
- package/lib/base/configuration-static.less +3 -3
- package/lib/base/internal.less +3 -5
- package/lib/base/reset-normalize.less +3 -3
- package/lib/components/activity-indicator/activity-indicator.less +4 -20
- package/lib/components/anchor/anchor.less +28 -39
- package/lib/components/avatar/avatar.less +20 -19
- package/lib/components/badge/badge.less +227 -167
- package/lib/components/banner/banner.less +12 -11
- package/lib/components/bling/bling.less +47 -10
- package/lib/components/button/button.less +300 -380
- package/lib/components/checkbox_radio/checkbox_radio.less +195 -113
- package/lib/components/code-block/code-block.fixtures.ts +2 -2
- package/lib/components/code-block/code-block.less +2 -3
- package/lib/components/description/description.less +17 -2
- package/lib/components/empty-state/empty-state.less +17 -6
- package/lib/components/form-group/form-group.less +38 -0
- package/lib/components/input-fill/input-fill.less +3 -3
- package/lib/components/input-icon/input-icon.less +3 -3
- package/lib/components/input-message/input-message.less +1 -0
- package/lib/components/input_textarea/input_textarea.less +71 -58
- package/lib/components/label/label.less +12 -56
- package/lib/components/link/link.less +44 -98
- package/lib/components/loader/loader.less +88 -0
- package/lib/components/menu/menu.less +89 -19
- package/lib/components/modal/modal.less +10 -10
- package/lib/components/navigation/navigation.less +77 -42
- package/lib/components/notice/notice.less +90 -75
- package/lib/components/pagination/pagination.less +50 -42
- package/lib/components/popover/popover.less +9 -11
- package/lib/components/post-summary/post-summary.less +225 -385
- package/lib/components/prose/prose.less +49 -35
- package/lib/components/select/select.less +46 -41
- package/lib/components/sidebar-widget/sidebar-widget.less +26 -196
- package/lib/components/table/table.less +48 -22
- package/lib/components/tag/tag.less +25 -6
- package/lib/components/toast/toast.less +4 -2
- package/lib/components/toggle-switch/toggle-switch.less +15 -19
- package/lib/components/user-card/user-card.less +129 -92
- package/lib/components/vote/vote.less +134 -0
- package/lib/controllers.ts +0 -2
- package/lib/exports/color-sets.less +108 -81
- package/lib/exports/constants-helpers.less +9 -13
- package/lib/exports/constants-type.less +18 -36
- package/lib/exports/mixins.less +92 -272
- package/lib/index.ts +0 -4
- package/lib/stacks-static.less +44 -30
- package/lib/test/visual-test-utils.ts +42 -10
- package/lib/tsconfig.json +1 -1
- package/package.json +1 -1
- package/dist/components/expandable/expandable.d.ts +0 -17
- package/dist/components/uploader/uploader.d.ts +0 -48
- package/lib/atomic/border.less +0 -121
- package/lib/atomic/misc.less +0 -374
- package/lib/atomic/spacing.less +0 -98
- package/lib/atomic/width-height.less +0 -194
- package/lib/components/block-link/block-link.less +0 -82
- package/lib/components/breadcrumbs/breadcrumbs.less +0 -41
- package/lib/components/button-group/button-group.less +0 -81
- package/lib/components/card/card.less +0 -37
- package/lib/components/check-control/check-control.less +0 -17
- package/lib/components/check-group/check-group.less +0 -19
- package/lib/components/expandable/expandable.less +0 -119
- package/lib/components/expandable/expandable.ts +0 -238
- package/lib/components/link-preview/link-preview.less +0 -148
- package/lib/components/page-title/page-title.less +0 -51
- package/lib/components/progress-bar/progress-bar.less +0 -292
- package/lib/components/skeleton/skeleton.less +0 -73
- package/lib/components/spinner/spinner.less +0 -103
- package/lib/components/topbar/topbar.less +0 -553
- package/lib/components/uploader/uploader.less +0 -205
- package/lib/components/uploader/uploader.ts +0 -207
- package/lib/exports/spacing-mixins.less +0 -67
package/lib/exports/mixins.less
CHANGED
|
@@ -1,52 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
1
|
+
// COLOR MODE OVERRIDES
|
|
2
|
+
/**
|
|
3
|
+
* Applies styles rules when dark mode is active.
|
|
4
|
+
*
|
|
5
|
+
* Usage example:
|
|
6
|
+
* .dark-mode({ background-color: var(--black-100); });
|
|
7
|
+
*/
|
|
50
8
|
.dark-mode(@rules) {
|
|
51
9
|
body.theme-system & {
|
|
52
10
|
@media (prefers-color-scheme: dark) {
|
|
@@ -61,22 +19,24 @@
|
|
|
61
19
|
}
|
|
62
20
|
}
|
|
63
21
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// .highcontrast-mode({ background-color: var(--black-100); });
|
|
71
|
-
//
|
|
72
|
-
// ---------------------------------------------------------------------------
|
|
73
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Applies styles rules when high contrast mode is active.
|
|
24
|
+
*
|
|
25
|
+
* Usage example:
|
|
26
|
+
* .highcontrast-mode({ background-color: var(--black-100); });
|
|
27
|
+
*/
|
|
74
28
|
.highcontrast-mode(@rules) {
|
|
75
29
|
body.theme-highcontrast & {
|
|
76
30
|
@rules();
|
|
77
31
|
}
|
|
78
32
|
}
|
|
79
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Applies styles rules when high contrast and dark mode is active.
|
|
36
|
+
*
|
|
37
|
+
* Usage example:
|
|
38
|
+
* .highcontrast-dark-mode({ background-color: var(--black-100); });
|
|
39
|
+
*/
|
|
80
40
|
.highcontrast-dark-mode(@rules) {
|
|
81
41
|
body.theme-highcontrast.theme-system & {
|
|
82
42
|
@media (prefers-color-scheme: dark) {
|
|
@@ -88,31 +48,9 @@
|
|
|
88
48
|
}
|
|
89
49
|
}
|
|
90
50
|
|
|
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
|
-
|
|
51
|
+
// FOCUS STYLES
|
|
114
52
|
/**
|
|
115
|
-
*
|
|
53
|
+
* Applies focus styles for the given context.
|
|
116
54
|
*
|
|
117
55
|
* Usage example:
|
|
118
56
|
* .focus-styles(true, true);
|
|
@@ -122,213 +60,95 @@
|
|
|
122
60
|
*/
|
|
123
61
|
.focus-styles(@inset: false, @border: false) {
|
|
124
62
|
& when not (@inset) and not (@border) {
|
|
125
|
-
box-shadow: 0 0 0 var(--
|
|
63
|
+
box-shadow: 0 0 0 var(--su2) var(--focus-neutral), 0 0 0 var(--su4) var(--focus-theme);
|
|
126
64
|
}
|
|
127
65
|
|
|
128
66
|
& when not (@inset) and (@border) {
|
|
129
67
|
border-color: var(--focus-neutral) !important;
|
|
130
|
-
box-shadow: 0 0 0 var(--
|
|
68
|
+
box-shadow: 0 0 0 var(--su1) var(--focus-neutral), 0 0 0 var(--su3) var(--focus-theme);
|
|
131
69
|
}
|
|
132
70
|
|
|
133
71
|
& when (@inset) and not (@border) {
|
|
134
|
-
box-shadow: inset 0 0 0 var(--
|
|
72
|
+
box-shadow: inset 0 0 0 var(--su2) var(--focus-theme), inset 0 0 0 var(--su4) var(--focus-neutral);
|
|
135
73
|
}
|
|
136
74
|
|
|
137
75
|
& when (@inset) and (@border) {
|
|
138
76
|
border-color: var(--focus-theme) !important;
|
|
139
|
-
box-shadow: inset 0 0 0 var(--
|
|
77
|
+
box-shadow: inset 0 0 0 var(--su1) var(--focus-theme), inset 0 0 0 var(--su3) var(--focus-neutral);
|
|
140
78
|
}
|
|
141
79
|
|
|
142
80
|
// We include a 2px transparent outline to ensure Windows High Contrast Forced Color Mode
|
|
143
81
|
// 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(--
|
|
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"));
|
|
82
|
+
outline: var(--su2) solid transparent !important;
|
|
165
83
|
}
|
|
166
84
|
|
|
167
|
-
//
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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-md) + var(--su-static1));
|
|
85
|
+
// SIZING
|
|
86
|
+
/**
|
|
87
|
+
* Generate base and responsive atomic sizing classes.
|
|
88
|
+
*
|
|
89
|
+
* Usage example:
|
|
90
|
+
* .generate-sizing('.m', margin, true);
|
|
91
|
+
* .generate-sizing('.ml', margin-left, true, percent);
|
|
92
|
+
* .generate-sizing('.mx'; margin-left, margin-right; true);
|
|
93
|
+
* .generate-sizing('.pr', padding-right);
|
|
94
|
+
*
|
|
95
|
+
* @param {string} prefix - What prefix to generate (e.g. `.m`, `.pr`, etc).
|
|
96
|
+
* @param {string|list} properties - What CSS properties to generate (e.g. `margin`, `margin-right, margin-left`, etc).
|
|
97
|
+
* @param {list} values - List of values to generate classes for.
|
|
98
|
+
* @param {string} [type='px'] - What set of values to generate. Options: `px` | `percent`.
|
|
99
|
+
* @param {boolean} [responsive=false] - Whether to generate responsive variants.
|
|
100
|
+
* @param {boolean} [negative=false] - Whether to generate negative value classes.
|
|
101
|
+
*/
|
|
102
|
+
.generate-sizing(@prefix, @properties, @values, @type: 'px', @responsive: false, @negative: false) {
|
|
103
|
+
#stacks-internals #build-classes(
|
|
104
|
+
@prefix,
|
|
105
|
+
{
|
|
106
|
+
.template(@value) {
|
|
107
|
+
each(@properties, #(@prop) {
|
|
108
|
+
& when (@type = 'px') and (@negative = false) {
|
|
109
|
+
@{prop}: var(~"--su@{value}") !important;
|
|
110
|
+
}
|
|
111
|
+
& when (@type = 'px') and (@negative = true) {
|
|
112
|
+
@{prop}: var(~"--sun@{value}") !important;
|
|
113
|
+
}
|
|
114
|
+
& when (@type = 'percent') and (@negative = false) {
|
|
115
|
+
@{prop}: ~"@{value}% !important";
|
|
116
|
+
}
|
|
117
|
+
& when (@type = 'percent') and (@negative = true) {
|
|
118
|
+
@{prop}: ~"-@{value}% !important";
|
|
119
|
+
}
|
|
120
|
+
});
|
|
246
121
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
// lg
|
|
252
|
-
& when (@size = lg) and (@style = br) {
|
|
253
|
-
--_@{prefix}-br: calc(var(--br-md) + 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
|
-
}
|
|
122
|
+
},
|
|
123
|
+
@values,
|
|
124
|
+
@responsive
|
|
125
|
+
);
|
|
269
126
|
}
|
|
270
127
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
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
|
-
}
|
|
128
|
+
/**
|
|
129
|
+
* Generate atomic sizing classes using predefined SU (spacing unit) values.
|
|
130
|
+
*
|
|
131
|
+
* Generates 12 utility classes (numbered 1-12) that map to specific SU values:
|
|
132
|
+
* 128, 256, 344, 448, 512, 640, 768, 848, 960, 1024, 1120, 1280.
|
|
133
|
+
*
|
|
134
|
+
* Usage example:
|
|
135
|
+
* .generate-su-sizing('.ws', width);
|
|
136
|
+
* .generate-su-sizing('.hs', height);
|
|
137
|
+
* .generate-su-sizing('.wmn', min-width);
|
|
138
|
+
*
|
|
139
|
+
* @param {string} prefix - Class prefix to generate (e.g. `.ws`, `.hs`, `.wmn`).
|
|
140
|
+
* @param {string} property - CSS property to set (e.g. `width`, `height`, `min-width`).
|
|
141
|
+
*/
|
|
142
|
+
.generate-su-sizing(@prefix, @property) {
|
|
143
|
+
@su-values: 128, 256, 344, 448, 512, 640, 768, 848, 960, 1024, 1120, 1280;
|
|
144
|
+
#stacks-internals #build-classes(
|
|
145
|
+
@prefix,
|
|
146
|
+
{
|
|
147
|
+
.template(@value) {
|
|
148
|
+
@su-value: extract(@su-values, @value);
|
|
149
|
+
@{property}: var(~"--su@{su-value}") !important;
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
1 2 3 4 5 6 7 8 9 10 11 12
|
|
153
|
+
);
|
|
334
154
|
}
|
package/lib/index.ts
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
import "./stacks.less";
|
|
2
2
|
import {
|
|
3
3
|
BannerController,
|
|
4
|
-
ExpandableController,
|
|
5
4
|
ModalController,
|
|
6
5
|
PopoverController,
|
|
7
6
|
TableController,
|
|
8
7
|
TabListController,
|
|
9
8
|
ToastController,
|
|
10
9
|
TooltipController,
|
|
11
|
-
UploaderController,
|
|
12
10
|
} from "./controllers";
|
|
13
11
|
import { application, StacksApplication } from "./stacks";
|
|
14
12
|
|
|
15
13
|
// register all built-in controllers
|
|
16
14
|
application.register("s-banner", BannerController);
|
|
17
|
-
application.register("s-expandable-control", ExpandableController);
|
|
18
15
|
application.register("s-modal", ModalController);
|
|
19
16
|
application.register("s-toast", ToastController);
|
|
20
17
|
application.register("s-navigation-tablist", TabListController);
|
|
21
18
|
application.register("s-popover", PopoverController);
|
|
22
19
|
application.register("s-table", TableController);
|
|
23
20
|
application.register("s-tooltip", TooltipController);
|
|
24
|
-
application.register("s-uploader", UploaderController);
|
|
25
21
|
|
|
26
22
|
// finalize the application to guard our controller namespace
|
|
27
23
|
StacksApplication.finalize();
|
package/lib/stacks-static.less
CHANGED
|
@@ -5,68 +5,82 @@
|
|
|
5
5
|
@import "base/icon.less";
|
|
6
6
|
@import "input-utils.less";
|
|
7
7
|
|
|
8
|
-
//
|
|
8
|
+
// LESS CONSTANTS AND MIXINS
|
|
9
|
+
@import "exports/exports.less";
|
|
10
|
+
|
|
11
|
+
// CUSTOM PROPERTIES
|
|
12
|
+
@import "atomic/sizing.less";
|
|
13
|
+
|
|
14
|
+
// FOUNDATIONAL CLASSES
|
|
15
|
+
@import "atomic/color.less";
|
|
16
|
+
@import "atomic/typography.less";
|
|
17
|
+
|
|
18
|
+
// ATOMIC CLASSES
|
|
19
|
+
@import "atomic/backgrounds.less";
|
|
20
|
+
@import "atomic/borders.less";
|
|
21
|
+
@import "atomic/border-radius.less";
|
|
22
|
+
@import "atomic/box-shadow.less";
|
|
23
|
+
@import "atomic/box-sizing.less";
|
|
24
|
+
@import "atomic/current-color.less";
|
|
25
|
+
@import "atomic/cursors.less";
|
|
26
|
+
@import "atomic/display.less";
|
|
27
|
+
@import "atomic/flex.less";
|
|
28
|
+
@import "atomic/floats.less";
|
|
29
|
+
@import "atomic/gap.less";
|
|
30
|
+
@import "atomic/grid.less";
|
|
31
|
+
@import "atomic/height.less";
|
|
32
|
+
@import "atomic/interactivity.less";
|
|
33
|
+
@import "atomic/lists.less";
|
|
34
|
+
@import "atomic/margin.less";
|
|
35
|
+
@import "atomic/object-fit.less";
|
|
36
|
+
@import "atomic/opacity.less";
|
|
37
|
+
@import "atomic/outline.less";
|
|
38
|
+
@import "atomic/overflow.less";
|
|
39
|
+
@import "atomic/padding.less";
|
|
40
|
+
@import "atomic/positioning.less";
|
|
41
|
+
@import "atomic/truncation.less";
|
|
42
|
+
@import "atomic/vertical-alignment.less";
|
|
43
|
+
@import "atomic/visibility.less";
|
|
44
|
+
@import "atomic/width.less";
|
|
45
|
+
@import "atomic/z-index.less";
|
|
46
|
+
|
|
47
|
+
// COMPONENTS
|
|
9
48
|
@import "components/activity-indicator/activity-indicator.less";
|
|
10
49
|
@import "components/anchor/anchor.less";
|
|
11
50
|
@import "components/avatar/avatar.less";
|
|
12
51
|
@import "components/badge/badge.less";
|
|
13
52
|
@import "components/banner/banner.less";
|
|
14
53
|
@import "components/bling/bling.less";
|
|
15
|
-
@import "components/block-link/block-link.less";
|
|
16
|
-
@import "components/breadcrumbs/breadcrumbs.less";
|
|
17
54
|
@import "components/button/button.less";
|
|
18
|
-
@import "components/button-group/button-group.less";
|
|
19
|
-
@import "components/card/card.less";
|
|
20
|
-
@import "components/check-control/check-control.less";
|
|
21
|
-
@import "components/check-group/check-group.less";
|
|
22
55
|
@import "components/checkbox_radio/checkbox_radio.less";
|
|
56
|
+
@import "components/form-group/form-group.less";
|
|
23
57
|
@import "components/code-block/code-block.less";
|
|
24
58
|
@import "components/description/description.less";
|
|
25
59
|
@import "components/empty-state/empty-state.less";
|
|
26
|
-
@import "components/expandable/expandable.less";
|
|
27
60
|
@import "components/input_textarea/input_textarea.less";
|
|
28
61
|
@import "components/input-fill/input-fill.less";
|
|
29
62
|
@import "components/input-icon/input-icon.less";
|
|
30
63
|
@import "components/input-message/input-message.less";
|
|
31
64
|
@import "components/label/label.less";
|
|
32
65
|
@import "components/link/link.less";
|
|
33
|
-
@import "components/
|
|
66
|
+
@import "components/loader/loader.less";
|
|
34
67
|
@import "components/menu/menu.less";
|
|
35
68
|
@import "components/modal/modal.less";
|
|
36
69
|
@import "components/navigation/navigation.less";
|
|
37
70
|
@import "components/notice/notice.less";
|
|
38
|
-
@import "components/page-title/page-title.less";
|
|
39
71
|
@import "components/pagination/pagination.less";
|
|
40
72
|
@import "components/popover/popover.less";
|
|
41
73
|
@import "components/post-summary/post-summary.less";
|
|
42
|
-
@import "components/progress-bar/progress-bar.less";
|
|
43
74
|
@import "components/prose/prose.less";
|
|
44
75
|
@import "components/select/select.less";
|
|
45
76
|
@import "components/sidebar-widget/sidebar-widget.less";
|
|
46
|
-
@import "components/skeleton/skeleton.less";
|
|
47
|
-
@import "components/spinner/spinner.less";
|
|
48
77
|
@import "components/table/table.less";
|
|
49
78
|
@import "components/table-container/table-container.less";
|
|
50
79
|
@import "components/tag/tag.less";
|
|
51
80
|
@import "components/toast/toast.less";
|
|
52
81
|
@import "components/toggle-switch/toggle-switch.less";
|
|
53
|
-
@import "components/topbar/topbar.less";
|
|
54
|
-
@import "components/uploader/uploader.less";
|
|
55
82
|
@import "components/user-card/user-card.less";
|
|
56
|
-
|
|
57
|
-
// LESS CONSTANTS AND MIXINS
|
|
58
|
-
@import "exports/exports.less";
|
|
59
|
-
|
|
60
|
-
// -- ATOMIC CLASSES
|
|
61
|
-
@import "atomic/border.less";
|
|
62
|
-
@import "atomic/color.less";
|
|
63
|
-
@import "atomic/flex.less";
|
|
64
|
-
@import "atomic/gap.less";
|
|
65
|
-
@import "atomic/grid.less";
|
|
66
|
-
@import "atomic/spacing.less";
|
|
67
|
-
@import "atomic/typography.less";
|
|
68
|
-
@import "atomic/misc.less";
|
|
69
|
-
@import "atomic/width-height.less";
|
|
83
|
+
@import "components/vote/vote.less";
|
|
70
84
|
|
|
71
85
|
/* stylelint-disable */
|
|
72
86
|
#stacks-internals #screen-lg({
|
|
@@ -91,4 +105,4 @@
|
|
|
91
105
|
|
|
92
106
|
// CONFIG
|
|
93
107
|
@import "base/configuration-static.less";
|
|
94
|
-
@import "base/internal.less";
|
|
108
|
+
@import "base/internal.less";
|
|
@@ -23,6 +23,7 @@ const scheduleVisualTest = ({
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
let retryAttempts = 3;
|
|
26
|
+
let lastError: Error | null = null;
|
|
26
27
|
|
|
27
28
|
do {
|
|
28
29
|
await fixture(element);
|
|
@@ -37,21 +38,22 @@ const scheduleVisualTest = ({
|
|
|
37
38
|
return;
|
|
38
39
|
} catch (error) {
|
|
39
40
|
const e = error as Error;
|
|
40
|
-
|
|
41
|
-
//
|
|
42
|
-
if (
|
|
43
|
-
retryAttempts > 0 &&
|
|
44
|
-
!e.message.includes("Visual diff failed.")
|
|
45
|
-
) {
|
|
46
|
-
retryAttempts--;
|
|
47
|
-
continue;
|
|
48
|
-
} else {
|
|
41
|
+
lastError = e;
|
|
42
|
+
// if the error is a visual diff failure, fail immediately
|
|
43
|
+
if (e.message.includes("Visual diff failed.")) {
|
|
49
44
|
throw e;
|
|
50
45
|
}
|
|
46
|
+
// otherwise retry (to prevent flaky tests due to snapshot capturing)
|
|
47
|
+
retryAttempts--;
|
|
51
48
|
} finally {
|
|
52
49
|
el.remove();
|
|
53
50
|
}
|
|
54
51
|
} while (retryAttempts > 0);
|
|
52
|
+
|
|
53
|
+
// If we exhausted all retries without success, throw the last error
|
|
54
|
+
if (lastError) {
|
|
55
|
+
throw lastError;
|
|
56
|
+
}
|
|
55
57
|
});
|
|
56
58
|
};
|
|
57
59
|
|
|
@@ -60,4 +62,34 @@ const runVisualTests = (args: VisualTestArgs) => {
|
|
|
60
62
|
testVariations.forEach(scheduleVisualTest);
|
|
61
63
|
};
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
const replaceHtml = (
|
|
66
|
+
componentTemplateResult: unknown,
|
|
67
|
+
textToReplace: string,
|
|
68
|
+
replacementHtml: string
|
|
69
|
+
) => {
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
|
+
const component = componentTemplateResult as any;
|
|
72
|
+
if (!Array.isArray(component.strings) || !Array.isArray(component.values)) {
|
|
73
|
+
throw new Error("Expected Lit TemplateResult type");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Replace placeholder with actual icon in the Lit template
|
|
77
|
+
const originalStrings = component.strings;
|
|
78
|
+
const updatedStrings = originalStrings.map((str: string) =>
|
|
79
|
+
str.replace(textToReplace, replacementHtml)
|
|
80
|
+
);
|
|
81
|
+
// Create a proper TemplateStringsArray with raw property
|
|
82
|
+
Object.defineProperty(updatedStrings, "raw", {
|
|
83
|
+
value: updatedStrings.map((str: string) => str),
|
|
84
|
+
enumerable: false,
|
|
85
|
+
});
|
|
86
|
+
// Reconstruct the template with updated strings and original values
|
|
87
|
+
const updatedComponent = {
|
|
88
|
+
...component,
|
|
89
|
+
strings: updatedStrings,
|
|
90
|
+
values: component.values,
|
|
91
|
+
};
|
|
92
|
+
return updatedComponent;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export { runVisualTests, replaceHtml };
|
package/lib/tsconfig.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackoverflow/stacks",
|
|
3
3
|
"description": "Stack Overflow’s CSS and Design Pattern Library. Stacks is an atomic CSS library with classes and components for rapidly building Stack Overflow.",
|
|
4
|
-
"version": "3.0.0-beta.
|
|
4
|
+
"version": "3.0.0-beta.30",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"lib",
|