@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.
Files changed (108) hide show
  1. package/dist/controllers.d.ts +0 -2
  2. package/dist/css/stacks.css +14245 -15086
  3. package/dist/css/stacks.min.css +1 -1
  4. package/dist/js/stacks.js +0 -364
  5. package/dist/js/stacks.min.js +1 -1
  6. package/lib/atomic/backgrounds.less +67 -0
  7. package/lib/atomic/border-radius.less +38 -0
  8. package/lib/atomic/borders.less +73 -0
  9. package/lib/atomic/box-shadow.less +29 -0
  10. package/lib/atomic/box-sizing.less +3 -0
  11. package/lib/atomic/current-color.less +2 -0
  12. package/lib/atomic/cursors.less +8 -0
  13. package/lib/atomic/display.less +15 -0
  14. package/lib/atomic/flex.less +6 -34
  15. package/lib/atomic/floats.less +20 -0
  16. package/lib/atomic/gap.less +2 -0
  17. package/lib/atomic/grid.less +2 -0
  18. package/lib/atomic/height.less +22 -0
  19. package/lib/atomic/interactivity.less +45 -0
  20. package/lib/atomic/lists.less +29 -0
  21. package/lib/atomic/margin.less +48 -0
  22. package/lib/atomic/object-fit.less +9 -0
  23. package/lib/atomic/opacity.less +54 -0
  24. package/lib/atomic/outline.less +11 -0
  25. package/lib/atomic/overflow.less +17 -0
  26. package/lib/atomic/padding.less +12 -0
  27. package/lib/atomic/positioning.less +41 -0
  28. package/lib/atomic/sizing.less +51 -0
  29. package/lib/atomic/transitions.less +20 -0
  30. package/lib/atomic/truncation.less +58 -0
  31. package/lib/atomic/typography.less +71 -137
  32. package/lib/atomic/vertical-alignment.less +9 -0
  33. package/lib/atomic/visibility.less +18 -0
  34. package/lib/atomic/width.less +27 -0
  35. package/lib/atomic/z-index.less +12 -0
  36. package/lib/base/body.less +2 -4
  37. package/lib/base/configuration-static.less +3 -3
  38. package/lib/base/internal.less +3 -5
  39. package/lib/base/reset-normalize.less +3 -3
  40. package/lib/components/activity-indicator/activity-indicator.less +4 -20
  41. package/lib/components/anchor/anchor.less +28 -39
  42. package/lib/components/avatar/avatar.less +20 -19
  43. package/lib/components/badge/badge.less +227 -167
  44. package/lib/components/banner/banner.less +12 -11
  45. package/lib/components/bling/bling.less +47 -10
  46. package/lib/components/button/button.less +300 -380
  47. package/lib/components/checkbox_radio/checkbox_radio.less +195 -113
  48. package/lib/components/code-block/code-block.fixtures.ts +2 -2
  49. package/lib/components/code-block/code-block.less +2 -3
  50. package/lib/components/description/description.less +17 -2
  51. package/lib/components/empty-state/empty-state.less +17 -6
  52. package/lib/components/form-group/form-group.less +38 -0
  53. package/lib/components/input-fill/input-fill.less +3 -3
  54. package/lib/components/input-icon/input-icon.less +3 -3
  55. package/lib/components/input-message/input-message.less +1 -0
  56. package/lib/components/input_textarea/input_textarea.less +71 -58
  57. package/lib/components/label/label.less +12 -56
  58. package/lib/components/link/link.less +44 -98
  59. package/lib/components/loader/loader.less +88 -0
  60. package/lib/components/menu/menu.less +89 -19
  61. package/lib/components/modal/modal.less +10 -10
  62. package/lib/components/navigation/navigation.less +77 -42
  63. package/lib/components/notice/notice.less +90 -75
  64. package/lib/components/pagination/pagination.less +50 -42
  65. package/lib/components/popover/popover.less +9 -11
  66. package/lib/components/post-summary/post-summary.less +225 -385
  67. package/lib/components/prose/prose.less +49 -35
  68. package/lib/components/select/select.less +46 -41
  69. package/lib/components/sidebar-widget/sidebar-widget.less +26 -196
  70. package/lib/components/table/table.less +48 -22
  71. package/lib/components/tag/tag.less +25 -6
  72. package/lib/components/toast/toast.less +4 -2
  73. package/lib/components/toggle-switch/toggle-switch.less +15 -19
  74. package/lib/components/user-card/user-card.less +129 -92
  75. package/lib/components/vote/vote.less +134 -0
  76. package/lib/controllers.ts +0 -2
  77. package/lib/exports/color-sets.less +108 -81
  78. package/lib/exports/constants-helpers.less +9 -13
  79. package/lib/exports/constants-type.less +18 -36
  80. package/lib/exports/mixins.less +92 -272
  81. package/lib/index.ts +0 -4
  82. package/lib/stacks-static.less +44 -30
  83. package/lib/test/visual-test-utils.ts +42 -10
  84. package/lib/tsconfig.json +1 -1
  85. package/package.json +1 -1
  86. package/dist/components/expandable/expandable.d.ts +0 -17
  87. package/dist/components/uploader/uploader.d.ts +0 -48
  88. package/lib/atomic/border.less +0 -121
  89. package/lib/atomic/misc.less +0 -374
  90. package/lib/atomic/spacing.less +0 -98
  91. package/lib/atomic/width-height.less +0 -194
  92. package/lib/components/block-link/block-link.less +0 -82
  93. package/lib/components/breadcrumbs/breadcrumbs.less +0 -41
  94. package/lib/components/button-group/button-group.less +0 -81
  95. package/lib/components/card/card.less +0 -37
  96. package/lib/components/check-control/check-control.less +0 -17
  97. package/lib/components/check-group/check-group.less +0 -19
  98. package/lib/components/expandable/expandable.less +0 -119
  99. package/lib/components/expandable/expandable.ts +0 -238
  100. package/lib/components/link-preview/link-preview.less +0 -148
  101. package/lib/components/page-title/page-title.less +0 -51
  102. package/lib/components/progress-bar/progress-bar.less +0 -292
  103. package/lib/components/skeleton/skeleton.less +0 -73
  104. package/lib/components/spinner/spinner.less +0 -103
  105. package/lib/components/topbar/topbar.less +0 -553
  106. package/lib/components/uploader/uploader.less +0 -205
  107. package/lib/components/uploader/uploader.ts +0 -207
  108. package/lib/exports/spacing-mixins.less +0 -67
@@ -1,52 +1,10 @@
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
-
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
- // -- 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
-
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
- * Focus styles for the given context.
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(--su-static2) var(--focus-neutral), 0 0 0 var(--su-static4) var(--focus-theme);
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(--su-static1) var(--focus-neutral), 0 0 0 calc(var(--su-static4) - var(--su-static1)) var(--focus-theme);
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(--su-static2) var(--focus-theme), inset 0 0 0 var(--su-static4) var(--focus-neutral);
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(--su-static1) var(--focus-theme), inset 0 0 0 calc(var(--su-static4) - var(--su-static1)) var(--focus-neutral);
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(--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"));
82
+ outline: var(--su2) solid transparent !important;
165
83
  }
166
84
 
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-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
- & 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-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
- // -- 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
- }
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();
@@ -5,68 +5,82 @@
5
5
  @import "base/icon.less";
6
6
  @import "input-utils.less";
7
7
 
8
- // -- COMPONENTS
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/link-preview/link-preview.less";
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
- // if the error is not a visual diff failure, retry
41
- // this is to prevent flaky tests due to snapshot capturing
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
- export { runVisualTests };
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
@@ -5,7 +5,7 @@
5
5
  "lib": ["dom", "es6", "dom.iterable", "scripthost"],
6
6
  "outDir": "../dist",
7
7
  "sourceMap": true,
8
- "moduleResolution": "node",
8
+ "moduleResolution": "bundler",
9
9
  "skipLibCheck": true,
10
10
  "declaration": true,
11
11
  "allowSyntheticDefaultImports": true,
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.3",
4
+ "version": "3.0.0-beta.30",
5
5
  "files": [
6
6
  "dist",
7
7
  "lib",