@stackoverflow/stacks 3.0.0-beta.14 → 3.0.0-beta.16

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 (34) hide show
  1. package/dist/css/stacks.css +4679 -4864
  2. package/dist/css/stacks.min.css +1 -1
  3. package/lib/atomic/flex.less +6 -34
  4. package/lib/atomic/height.less +22 -0
  5. package/lib/atomic/positioning.less +34 -0
  6. package/lib/atomic/sizing.less +76 -0
  7. package/lib/atomic/spacing.less +35 -75
  8. package/lib/atomic/width.less +27 -0
  9. package/lib/base/body.less +2 -4
  10. package/lib/base/internal.less +3 -5
  11. package/lib/base/reset-normalize.less +1 -1
  12. package/lib/components/avatar/avatar.less +2 -2
  13. package/lib/components/badge/badge.less +2 -2
  14. package/lib/components/banner/banner.less +1 -1
  15. package/lib/components/button/button.less +1 -1
  16. package/lib/components/button-group/button-group.less +1 -1
  17. package/lib/components/code-block/code-block.less +1 -1
  18. package/lib/components/input-icon/input-icon.less +1 -1
  19. package/lib/components/notice/notice.less +82 -73
  20. package/lib/components/popover/popover.less +5 -5
  21. package/lib/components/post-summary/post-summary.less +5 -5
  22. package/lib/components/progress-bar/progress-bar.less +1 -1
  23. package/lib/components/prose/prose.less +5 -5
  24. package/lib/components/sidebar-widget/sidebar-widget.less +2 -2
  25. package/lib/components/toast/toast.less +1 -2
  26. package/lib/components/topbar/topbar.less +4 -4
  27. package/lib/components/user-card/user-card.less +88 -96
  28. package/lib/exports/constants-helpers.less +0 -4
  29. package/lib/exports/constants-type.less +18 -36
  30. package/lib/exports/mixins.less +71 -0
  31. package/lib/stacks-static.less +4 -1
  32. package/package.json +1 -1
  33. package/lib/atomic/width-height.less +0 -194
  34. package/lib/exports/spacing-mixins.less +0 -67
@@ -88,48 +88,30 @@
88
88
  Menlo, Monaco, Consolas, // A few sensible system font choices
89
89
  monospace; // The final fallback for rendering in monospace.
90
90
 
91
- html,
91
+ html {
92
+ font-size: 100%;
93
+ }
94
+
92
95
  body {
93
96
  --ff-sans: @ff-sans;
94
97
  --ff-serif: @ff-serif;
95
98
  --ff-mono: @ff-mono;
96
99
  --theme-body-font-family: var(--ff-sans);
97
100
 
98
- // ============================================================================
99
- // $ FONT SIZES (fs-)
100
- // Base font-size is 13px.
101
- // ----------------------------------------------------------------------------
102
- --fs-fine: 12px;
103
- --fs-caption: 13px;
104
- --fs-body1: 14px;
105
-
106
- // Relative to the root element
107
- --fs-body2: 1.143rem; // 16px
108
- --fs-body3: 1.286rem; // 18px
109
- --fs-subheading: 1.429rem; // 20px
110
- --fs-title: 1.571rem; // 22px
111
- --fs-headline1: 2rem; // 28px
112
- --fs-headline2: 2.571rem; // 36px
113
- --fs-display1: 3.286rem; // 46px
114
- --fs-display2: 4.143rem; // 58px
115
- --fs-display3: 5.143rem; // 72px
116
- --fs-display4: 7.143rem; // 100px
117
-
118
- // Relative to the parent
119
- --fs-body2-relative: 1.143rem; // 16px
120
- --fs-body3-relative: 1.286rem; // 18px
121
- --fs-subheading-relative: 1.429rem; // 20px
122
- --fs-title-relative: 1.571rem; // 22px
123
- --fs-headline1-relative: 2rem; // 28px
124
- --fs-headline2-relative: 2.571rem; // 36px
125
- --fs-display1-relative: 3.286rem; // 46px
126
- --fs-display2-relative: 4.143rem; // 58px
127
- --fs-display3-relative: 5.143rem; // 72px
128
- --fs-display4-relative: 7.143rem; // 100px
129
-
130
- // this value is not using spacing units because the calc involved results
131
- // in unexpected sizing. I'm not sure why, honestly.
132
- --fs-base: 14px;
101
+ // All rem values are relative to the font size applied to <html> (16px by default).
102
+ --fs-fine: 0.75rem; // 12px
103
+ --fs-caption: 0.8125rem; // 13px
104
+ --fs-body1: 0.875rem; // 14px (base font size applied to <body>)
105
+ --fs-body2: 1rem; // 16px
106
+ --fs-body3: 1.125rem; // 18px
107
+ --fs-subheading: 1.25rem; // 20px
108
+ --fs-title: 1.375rem; // 22px
109
+ --fs-headline1: 1.75rem; // 28px
110
+ --fs-headline2: 2.25rem; // 36px
111
+ --fs-display1: 2.875rem; // 46px
112
+ --fs-display2: 3.625rem; // 58px
113
+ --fs-display3: 4.5rem; // 72px
114
+ --fs-display4: 6.25rem; // 100px
133
115
 
134
116
  // ============================================================================
135
117
  // $ LINE HEIGHT (lh-)
@@ -268,6 +268,77 @@
268
268
  }
269
269
  }
270
270
 
271
+ /**
272
+ * Generate base and responsive atomic sizing classes.
273
+ *
274
+ * Usage example:
275
+ * .generate-sizing('.m', margin, true);
276
+ * .generate-sizing('.ml', margin-left, true, percent);
277
+ * .generate-sizing('.mx'; margin-left, margin-right; true);
278
+ * .generate-sizing('.pr', padding-right);
279
+ *
280
+ * @param {string} prefix - What prefix to generate (e.g. `.m`, `.pr`, etc).
281
+ * @param {string|list} properties - What CSS properties to generate (e.g. `margin`, `margin-right, margin-left`, etc).
282
+ * @param {list} values - List of values to generate classes for.
283
+ * @param {string} [type='px'] - What set of values to generate. Options: `px` | `percent`.
284
+ * @param {boolean} [responsive=false] - Whether to generate responsive variants.
285
+ * @param {boolean} [negative=false] - Whether to generate negative value classes.
286
+ */
287
+ .generate-sizing(@prefix, @properties, @values, @type: 'px', @responsive: false, @negative: false) {
288
+ #stacks-internals #build-classes(
289
+ @prefix,
290
+ {
291
+ .template(@value) {
292
+ each(@properties, #(@prop) {
293
+ & when (@type = 'px') and (@negative = false) {
294
+ @{prop}: var(~"--su@{value}") !important;
295
+ }
296
+ & when (@type = 'px') and (@negative = true) {
297
+ @{prop}: var(~"--sun@{value}") !important;
298
+ }
299
+ & when (@type = 'percent') and (@negative = false) {
300
+ @{prop}: ~"@{value}% !important";
301
+ }
302
+ & when (@type = 'percent') and (@negative = true) {
303
+ @{prop}: ~"-@{value}% !important";
304
+ }
305
+ });
306
+ }
307
+ },
308
+ @values,
309
+ @responsive
310
+ );
311
+ }
312
+
313
+
314
+ /**
315
+ * Generate atomic sizing classes using predefined SU (spacing unit) values.
316
+ *
317
+ * Generates 12 utility classes (numbered 1-12) that map to specific SU values:
318
+ * 128, 256, 344, 448, 512, 640, 768, 848, 960, 1024, 1120, 1280.
319
+ *
320
+ * Usage example:
321
+ * .generate-su-sizing('.ws', width);
322
+ * .generate-su-sizing('.hs', height);
323
+ * .generate-su-sizing('.wmn', min-width);
324
+ *
325
+ * @param {string} prefix - Class prefix to generate (e.g. `.ws`, `.hs`, `.wmn`).
326
+ * @param {string} property - CSS property to set (e.g. `width`, `height`, `min-width`).
327
+ */
328
+ .generate-su-sizing(@prefix, @property) {
329
+ @su-values: 128, 256, 344, 448, 512, 640, 768, 848, 960, 1024, 1120, 1280;
330
+ #stacks-internals #build-classes(
331
+ @prefix,
332
+ {
333
+ .template(@value) {
334
+ @su-value: extract(@su-values, @value);
335
+ @{property}: var(~"--su@{su-value}") !important;
336
+ }
337
+ },
338
+ 1 2 3 4 5 6 7 8 9 10 11 12
339
+ );
340
+ }
341
+
271
342
  // =============================================================================
272
343
  // -- WEBKIT AUTOFILL
273
344
  // -----------------------------------------------------------------------------
@@ -63,10 +63,13 @@
63
63
  @import "atomic/flex.less";
64
64
  @import "atomic/gap.less";
65
65
  @import "atomic/grid.less";
66
+ @import "atomic/height.less";
67
+ @import "atomic/positioning.less";
66
68
  @import "atomic/spacing.less";
69
+ @import "atomic/sizing.less";
67
70
  @import "atomic/typography.less";
68
71
  @import "atomic/misc.less";
69
- @import "atomic/width-height.less";
72
+ @import "atomic/width.less";
70
73
 
71
74
  /* stylelint-disable */
72
75
  #stacks-internals #screen-lg({
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.14",
4
+ "version": "3.0.0-beta.16",
5
5
  "files": [
6
6
  "dist",
7
7
  "lib",
@@ -1,194 +0,0 @@
1
- //
2
- // STACK OVERFLOW
3
- // WIDTH & HEIGHT
4
- //
5
- // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
6
- // Stack Overflow. For documentation of all these classes and how to contribute,
7
- // visit https://stackoverflow.design/
8
- //
9
- // • WIDTH
10
- // • PERCENTAGE
11
- // • STATIC
12
- // • MAX-WIDTH
13
- // • MIN-WIDTH
14
- // • HEIGHT
15
- // • PERCENTAGE
16
- // • STATIC
17
- // • MAX-HEIGHT
18
- // • MIN-HEIGHT
19
- //
20
- // ============================================================================
21
- // $ WIDTH
22
- // ----------------------------------------------------------------------------
23
- // $$ PERCENTAGE AND VIEWPORT UNITS
24
- .w0 { width: 0 !important; }
25
- .w10 { width: 10% !important; }
26
- .w20 { width: 20% !important; }
27
- #stacks-internals #responsify('.w25', { width: 25% !important; });
28
- .w30 { width: 30% !important; }
29
- #stacks-internals #responsify('.w33', { width: 33.33333% !important; });
30
- .w40 { width: 40% !important; }
31
- #stacks-internals #responsify('.w50', { width: 50% !important; });
32
- .w60 { width: 60% !important; }
33
- #stacks-internals #responsify('.w66', { width: 66.66667% !important; });
34
- .w70 { width: 70% !important; }
35
- #stacks-internals #responsify('.w75', { width: 75% !important; });
36
- .w80 { width: 80% !important; }
37
- .w90 { width: 90% !important; }
38
- #stacks-internals #responsify('.w100', { width: 100% !important; });
39
- #stacks-internals #responsify('.w-auto', { width: auto !important; });
40
- #stacks-internals #responsify('.w-screen', { width: 100vw !important; });
41
-
42
- // $$ STATIC
43
- .ws0,
44
- .w0 { width: 0 !important; }
45
- .ws1 { width: var(--s-step) !important; }
46
- .ws2 { width: calc(var(--s-step) * 2) !important; }
47
- .ws3 { width: calc(var(--s-step) * 3) !important; }
48
- .ws4 { width: calc(var(--s-step) * 4) !important; }
49
- .ws5 { width: calc(var(--s-step) * 5) !important; }
50
- .ws6 { width: calc(var(--s-step) * 6) !important; }
51
- .ws7 { width: calc(var(--s-step) * 7) !important; }
52
- .ws8 { width: calc(var(--s-step) * 8) !important; }
53
- .ws9 { width: calc(var(--s-step) * 9) !important; }
54
- .ws10 { width: calc(var(--s-step) * 10) !important; }
55
- .ws11 { width: calc(var(--s-step) * 11) !important; }
56
- .ws12 { width: var(--s-full) !important; }
57
-
58
- // $$ SPACING UNITS
59
- .w2 { width: var(--su-static2) !important; }
60
- .w4 { width: var(--su-static4) !important; }
61
- .w6 { width: var(--su-static6) !important; }
62
- .w8 { width: var(--su-static8) !important; }
63
- .w12 { width: var(--su-static12) !important; }
64
- .w16 { width: var(--su-static16) !important; }
65
- .w24 { width: var(--su-static24) !important; }
66
- .w32 { width: var(--su-static32) !important; }
67
- .w48 { width: var(--su-static48) !important; }
68
- .w64 { width: var(--su-static64) !important; }
69
- .w96 { width: var(--su-static96) !important; }
70
- .w128 { width: var(--su-static128) !important; }
71
-
72
- // ============================================================================
73
- // $ MAX-WIDTH
74
- // ----------------------------------------------------------------------------
75
- .wmx0 { max-width: 0 !important; }
76
- .wmx1 { max-width: var(--s-step) !important; }
77
- .wmx2 { max-width: calc(var(--s-step) * 2) !important; }
78
- .wmx25 { max-width: 25% !important; }
79
- .wmx3 { max-width: calc(var(--s-step) * 3) !important; }
80
- .wmx4 { max-width: calc(var(--s-step) * 4) !important; }
81
- .wmx5 { max-width: calc(var(--s-step) * 5) !important; }
82
- .wmx50 { max-width: 50% !important; }
83
- .wmx6 { max-width: calc(var(--s-step) * 6) !important; }
84
- .wmx7 { max-width: calc(var(--s-step) * 7) !important; }
85
- .wmx75 { max-width: 75% !important; }
86
- .wmx8 { max-width: calc(var(--s-step) * 8) !important; }
87
- .wmx9 { max-width: calc(var(--s-step) * 9) !important; }
88
- .wmx10 { max-width: calc(var(--s-step) * 10) !important; }
89
- .wmx11 { max-width: calc(var(--s-step) * 11) !important; }
90
- .wmx12 { max-width: var(--s-full) !important; }
91
- #stacks-internals #responsify('.wmx100', { max-width: 100% !important; });
92
- #stacks-internals #responsify('.wmx-initial', { max-width: initial !important; });
93
- #stacks-internals #responsify('.wmx-screen', { max-width: 100vw !important; });
94
-
95
- // ============================================================================
96
- // $ MIN-WIDTH
97
- // ----------------------------------------------------------------------------
98
- .wmn0 { min-width: 0 !important; }
99
- .wmn1 { min-width: var(--s-step) !important; }
100
- .wmn2 { min-width: calc(var(--s-step) * 2) !important; }
101
- .wmn25 { min-width: 25% !important; }
102
- .wmn3 { min-width: calc(var(--s-step) * 3) !important; }
103
- .wmn4 { min-width: calc(var(--s-step) * 4) !important; }
104
- .wmn5 { min-width: calc(var(--s-step) * 5) !important; }
105
- .wmn50 { min-width: 50% !important; }
106
- .wmn6 { min-width: calc(var(--s-step) * 6) !important; }
107
- .wmn7 { min-width: calc(var(--s-step) * 7) !important; }
108
- .wmn75 { min-width: 75% !important; }
109
- .wmn8 { min-width: calc(var(--s-step) * 8) !important; }
110
- .wmn9 { min-width: calc(var(--s-step) * 9) !important; }
111
- .wmn10 { min-width: calc(var(--s-step) * 10) !important; }
112
- .wmn11 { min-width: calc(var(--s-step) * 11) !important; }
113
- .wmn12 { min-width: var(--s-full) !important; }
114
- #stacks-internals #responsify('.wmn100', { min-width: 100% !important; });
115
- #stacks-internals #responsify('.wmn-initial', { min-width: initial !important; });
116
-
117
- // ============================================================================
118
- // $ HEIGHT
119
- // ----------------------------------------------------------------------------
120
- // $$ PERCENTAGE AND VIEWPORT UNITS
121
- .h0 { height: 0 !important; }
122
- #stacks-internals #responsify('.h100', { height: 100% !important; });
123
- #stacks-internals #responsify('.h-auto', { height: auto !important; });
124
- #stacks-internals #responsify('.h-screen', { height: 100vh !important; });
125
-
126
- // $$ STATIC
127
- .hs0,
128
- .h0 { height: 0 !important; }
129
- .hs1 { height: var(--s-step) !important; }
130
- .hs2 { height: calc(var(--s-step) * 2) !important; }
131
- .hs3 { height: calc(var(--s-step) * 3) !important; }
132
- .hs4 { height: calc(var(--s-step) * 4) !important; }
133
- .hs5 { height: calc(var(--s-step) * 5) !important; }
134
- .hs6 { height: calc(var(--s-step) * 6) !important; }
135
- .hs7 { height: calc(var(--s-step) * 7) !important; }
136
- .hs8 { height: calc(var(--s-step) * 8) !important; }
137
- .hs9 { height: calc(var(--s-step) * 9) !important; }
138
- .hs10 { height: calc(var(--s-step) * 10) !important; }
139
- .hs11 { height: calc(var(--s-step) * 11) !important; }
140
- .hs12 { height: var(--s-full) !important; }
141
-
142
- // $$ SPACING UNITS
143
- .h2 { height: var(--su-static2) !important; }
144
- .h4 { height: var(--su-static4) !important; }
145
- .h6 { height: var(--su-static6) !important; }
146
- .h8 { height: var(--su-static8) !important; }
147
- .h12 { height: var(--su-static12) !important; }
148
- .h16 { height: var(--su-static16) !important; }
149
- .h24 { height: var(--su-static24) !important; }
150
- .h32 { height: var(--su-static32) !important; }
151
- .h48 { height: var(--su-static48) !important; }
152
- .h64 { height: var(--su-static64) !important; }
153
- .h96 { height: var(--su-static96) !important; }
154
- .h128 { height: var(--su-static128) !important; }
155
-
156
- // ============================================================================
157
- // $ MAX-HEIGHT
158
- // ----------------------------------------------------------------------------
159
- .hmx0 { max-height: 0 !important; }
160
- .hmx1 { max-height: var(--s-step) !important; }
161
- .hmx2 { max-height: calc(var(--s-step) * 2) !important; }
162
- .hmx3 { max-height: calc(var(--s-step) * 3) !important; }
163
- .hmx4 { max-height: calc(var(--s-step) * 4) !important; }
164
- .hmx5 { max-height: calc(var(--s-step) * 5) !important; }
165
- .hmx6 { max-height: calc(var(--s-step) * 6) !important; }
166
- .hmx7 { max-height: calc(var(--s-step) * 7) !important; }
167
- .hmx8 { max-height: calc(var(--s-step) * 8) !important; }
168
- .hmx9 { max-height: calc(var(--s-step) * 9) !important; }
169
- .hmx10 { max-height: calc(var(--s-step) * 10) !important; }
170
- .hmx11 { max-height: calc(var(--s-step) * 11) !important; }
171
- .hmx12 { max-height: var(--s-full) !important; }
172
- #stacks-internals #responsify('.hmx100', { max-height: 100% !important; });
173
- #stacks-internals #responsify('.hmx-initial', { max-height: initial !important; });
174
- #stacks-internals #responsify('.hmx-screen', { max-height: 100vh !important; });
175
-
176
- // ============================================================================
177
- // $ MIN-HEIGHT
178
- // ----------------------------------------------------------------------------
179
- .hmn0 { min-height: 0 !important; }
180
- .hmn1 { min-height: var(--s-step) !important; }
181
- .hmn2 { min-height: calc(var(--s-step) * 2) !important; }
182
- .hmn3 { min-height: calc(var(--s-step) * 3) !important; }
183
- .hmn4 { min-height: calc(var(--s-step) * 4) !important; }
184
- .hmn5 { min-height: calc(var(--s-step) * 5) !important; }
185
- .hmn6 { min-height: calc(var(--s-step) * 6) !important; }
186
- .hmn7 { min-height: calc(var(--s-step) * 7) !important; }
187
- .hmn8 { min-height: calc(var(--s-step) * 8) !important; }
188
- .hmn9 { min-height: calc(var(--s-step) * 9) !important; }
189
- .hmn10 { min-height: calc(var(--s-step) * 10) !important; }
190
- .hmn11 { min-height: calc(var(--s-step) * 11) !important; }
191
- .hmn12 { min-height: var(--s-full) !important; }
192
- #stacks-internals #responsify('.hmn100', { min-height: 100% !important; });
193
- #stacks-internals #responsify('.hmn-initial', { min-height: initial !important; });
194
- #stacks-internals #responsify('.hmn-screen', { min-height: 100vh !important; });
@@ -1,67 +0,0 @@
1
- /**
2
- * Generate base and responsive atomic spacing classes.
3
- *
4
- * Usage example:
5
- * .generate-spacing('.m', margin, true);
6
- * .generate-spacing('.ml', margin-left, true, percent);
7
- * .generate-spacing('.mx'; margin-left, margin-right; true);
8
- * .generate-spacing('.pr', padding-right);
9
- *
10
- * @prefix - (required) What prefix to generate (e.g. `.m`, `.pr`, etc).
11
- * @properties - (required) What CSS properties to generate (e.g. `margin`, `margin-right, margin-left`, etc).
12
- * @includeNegative: bool - Boolean to include generation of negative value classes.
13
- * @type: px | percent - What set of value to generate.
14
- */
15
- .generate-spacing(@prefix, @properties, @includeNegative: false, @type: px) {
16
- & when (@type = px) {
17
- #stacks-internals #build-classes(
18
- responsive,
19
- @prefix,
20
- { .template(@value) {
21
- each(@properties, #(@prop) {
22
- @{prop}: var(~"--su@{value}") !important;
23
- })
24
- } },
25
- 0 1 2 4 6 8 12 16 24 32 48 64 96 128
26
- );
27
-
28
- & when (@includeNegative = true) {
29
- #stacks-internals #build-classes(
30
- responsive,
31
- ~"@{prefix}n",
32
- { .template(@value) {
33
- each(@properties, #(@prop) {
34
- @{prop}: calc(var(~"--su@{value}") * -1) !important;
35
- })
36
- } },
37
- 1 2 4 6 8 12 16 24 32 48 64 96 128
38
- );
39
- }
40
- }
41
-
42
- & when (@type = percent) {
43
- #stacks-internals #build-classes(
44
- responsive,
45
- @prefix,
46
- { .template(@value) {
47
- each(@properties, #(@prop) {
48
- @{prop}: @value !important;
49
- })
50
- } },
51
- 50% 100%
52
- );
53
-
54
- & when (@includeNegative = true) {
55
- #stacks-internals #build-classes(
56
- responsive,
57
- ~"@{prefix}n",
58
- { .template(@value) {
59
- each(@properties, #(@prop) {
60
- @{prop}: -@value !important;
61
- })
62
- } },
63
- 50% 100%
64
- );
65
- }
66
- }
67
- }