@stackoverflow/stacks 2.1.1 → 2.3.0

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 (31) hide show
  1. package/dist/css/stacks.css +2242 -774
  2. package/dist/css/stacks.min.css +1 -1
  3. package/lib/atomic/__snapshots__/misc.less.test.ts.snap +893 -0
  4. package/lib/atomic/__snapshots__/spacing.less.test.ts.snap +1928 -0
  5. package/lib/atomic/misc.less +30 -0
  6. package/lib/atomic/misc.less.test.ts +12 -0
  7. package/lib/atomic/spacing.less +59 -303
  8. package/lib/atomic/spacing.less.test.ts +12 -0
  9. package/lib/components/badge/badge.a11y.test.ts +59 -18
  10. package/lib/components/badge/badge.less +16 -1
  11. package/lib/components/badge/badge.visual.test.ts +44 -16
  12. package/lib/components/button/button.a11y.test.ts +14 -18
  13. package/lib/components/button/button.less +16 -22
  14. package/lib/components/button/button.test.setup.ts +36 -0
  15. package/lib/components/button/button.visual.test.ts +3 -33
  16. package/lib/components/button-group/button-group.a11y.test.ts +12 -0
  17. package/lib/components/button-group/button-group.less +43 -49
  18. package/lib/components/button-group/button-group.test.setup.ts +77 -0
  19. package/lib/components/button-group/button-group.visual.test.ts +7 -0
  20. package/lib/components/input_textarea/input_textarea.less +3 -1
  21. package/lib/components/post-summary/post-summary.a11y.test.ts +25 -0
  22. package/lib/components/post-summary/post-summary.test.setup.ts +435 -0
  23. package/lib/components/post-summary/post-summary.visual.test.ts +17 -0
  24. package/lib/components/topbar/topbar.less +365 -335
  25. package/lib/components/topbar/topbar.visual.test.ts +28 -0
  26. package/lib/exports/__snapshots__/color.less.test.ts.snap +24 -24
  27. package/lib/exports/color-sets.less +12 -12
  28. package/lib/exports/spacing-mixins.less +67 -0
  29. package/lib/tsconfig.build.json +1 -1
  30. package/lib/tsconfig.json +3 -3
  31. package/package.json +13 -13
@@ -10,6 +10,7 @@ import {
10
10
  IconSearch,
11
11
  IconStackExchange,
12
12
  } from "@stackoverflow/stacks-icons/icons";
13
+ import { html } from "@open-wc/testing";
13
14
 
14
15
  const base64Image =
15
16
  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATwAAAE8CAMAAABq2/00AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABhQTFRF/3IA/////44y/8OS/+fU//Xs/6tn/9e2EhvbMQAABH9JREFUeNrs3e1y2ygAhWELJHH/d7zuJpN1XAnxoe408Ly/6xnnHXEOIEwfDwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/gbAGEhrZl2VloY20PIk8tAzZbfkXA7eeuHyysVfdFMsXiY66ptiWF8Re05BdxF7HkBV7PUNW7FVx4E7sVSwrDjBw2+pC7NWwHtkTe3ULM7En9v6O2ONF7Ik9sSf2IPbEntgTexB7t8feTsynniD2Oh6tXex1hFoUe02kaxVi72JMZs+Rib0LLdkXFGLvaECWjkOxdxVmUex1rB6S2Kss2lcytSH2LnVkakPsXQ7E8xwTe5fuMrUh9vKj8CP4xN7lNOXc3mnwib1M2X7Z28VeS93mg0/sFZTG6WCMVSE51fqsYL4s9jpqQ+yV1caxErHXUxtir6c2xF5HbYRF7LXXhtjrqQ2x11MbYu9tLG4VtSH2empD7BUNxpPaSGKvPPh2sdcxX45i78baEHs18+X32hB7NfPl99oQex21MVHsxViaR8W1MU3s/XpMSvWF0tqYJfY+BmMq01dcG+scP6/6enTK9BW+1J0j9l5aYN0rP5BzM0XsbSUnAlpqY4LYezexFeRSbpslH3uDXdF64OG6est258PohXE8BK+7o6g29rJTQsPt1F3qK9qdTwMP2Wz2X1Vv0UvdbeQ53nl2Xesr2Z0Pww7Zs5lsafWW1MY+6JDNxv5/+kLb5/fXfzLirRdhKSGnr6A2tkGvJoxLGZnqva6NkAbdgA+pUN9a+QuWYYPu+98ee/W1/PJgoMG7lek7nW3UHiEdbKpcqu+kO2L9b4aG0rcWjt5jfWf2Z7kCeE891XtSG/O86A5d+tbZj1h0VW+c/ja90FG9uxMCFdWb/+SkZ1Oaq/d1vjzvXfvF+tLp+aiZT5S1Vm90lrFj02B3bW1d9X7T92u+7Aq9qk2D+Fob/v/Myu7YostC76xe9K966evfr5+7ekuXHVy1V6+R275pEMd3kPbGB+Syeod/8D7Sf41NBvPdMf7a4uXpaTGY0zd+4r0vDlKtwdPqHf/BOzzf8zQYqvRtcz54mXfUNUVyUL0T7AhcrBbKY/C36p1geVEy1y00+F3fBA9eKFxnlRXJa/XOcKxnqeF6Pv1VvTPc7RuXai6K5LN6Z9hQSUsb2Rh86pviUultaScTg/sMD15YeqmcT8/bFx1Foi/umk9P3hcMfqTenrabBT5j8DGTwHivwelOCTwNrnfJm/Ol2U0GZ74WdE+dBn9+Z/z2J9UZ7IjB7dZv8gPl9RRJIq89BiN57QZ38trn04G8k62E6xjcHuQ1D+JEXrvBnbz2+XQgr30+/SCveT69ktceg4m8doOBvDG/CXnkkTezvOXPQB555JFHHnnkkUceeeSRRx555JFHHnnkkWcnmTzyyCOPPPLII4888sgjjzzfhDzyyCOPPPL+9Ff+eyCPPPLII4888sgjjzzyyCOPPPLII4888sgDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPy//CPAAPiZOI3BPDFQAAAAAElFTkSuQmCC";
@@ -185,4 +186,31 @@ describe("topbar", () => {
185
186
  children: topbars,
186
187
  variants: ["dark variant", "light variant"], // `variant` added to make file labeling clearer
187
188
  });
189
+
190
+ // Custom theme variables
191
+ runVisualTests({
192
+ baseClass: "s-topbar",
193
+ children: {
194
+ themed: topbars.default,
195
+ },
196
+ template: ({ component, testid }) => html`
197
+ <div data-testid="${testid}">
198
+ <style type="text/css">
199
+ .s-topbar {
200
+ --theme-topbar-accent-border: red;
201
+ --theme-topbar-background-color: green;
202
+ --theme-topbar-bottom-border: blue;
203
+ --theme-topbar-height: 80px;
204
+ --theme-topbar-item-color: yellow;
205
+ --theme-topbar-search-background: pink;
206
+ --theme-topbar-search-border: purple;
207
+ --theme-topbar-search-placeholder: white;
208
+ --theme-topbar-select-background: lightblue;
209
+ --theme-topbar-select-color: magenta;
210
+ }
211
+ </style>
212
+ ${component}
213
+ </div>
214
+ `,
215
+ });
188
216
  });
@@ -249,12 +249,12 @@ body:not(.theme-highcontrast):not(.theme-dark) .theme-dark__forced .themed {
249
249
  --yellow-400: hsl(43, 90%, 75%);
250
250
  --yellow-500: hsl(43, 90%, 82%);
251
251
  --yellow-600: hsl(43, 90%, 91%);
252
- --purple-100: hsl(237, 43%, 37%);
253
- --purple-200: hsl(237, 51%, 52%);
254
- --purple-300: hsl(237, 63%, 62%);
255
- --purple-400: hsl(237, 89%, 83%);
256
- --purple-500: hsl(237, 89%, 89%);
257
- --purple-600: hsl(237, 89%, 94%);
252
+ --purple-100: hsl(237, 26%, 23%);
253
+ --purple-200: hsl(237, 26%, 44%);
254
+ --purple-300: hsl(237, 26%, 56%);
255
+ --purple-400: hsl(237, 98%, 87%);
256
+ --purple-500: hsl(237, 98%, 92%);
257
+ --purple-600: hsl(237, 98%, 96%);
258
258
  --gold-100: hsl(45, 29%, 24%);
259
259
  --gold-200: hsl(45, 47%, 37%);
260
260
  --gold-300: hsl(45, 92%, 62%);
@@ -382,12 +382,12 @@ body:not(.theme-highcontrast):not(.theme-dark) .theme-dark__forced .themed {
382
382
  --yellow-400: hsl(43, 90%, 75%);
383
383
  --yellow-500: hsl(43, 90%, 82%);
384
384
  --yellow-600: hsl(43, 90%, 91%);
385
- --purple-100: hsl(237, 43%, 37%);
386
- --purple-200: hsl(237, 51%, 52%);
387
- --purple-300: hsl(237, 63%, 62%);
388
- --purple-400: hsl(237, 89%, 83%);
389
- --purple-500: hsl(237, 89%, 89%);
390
- --purple-600: hsl(237, 89%, 94%);
385
+ --purple-100: hsl(237, 26%, 23%);
386
+ --purple-200: hsl(237, 26%, 44%);
387
+ --purple-300: hsl(237, 26%, 56%);
388
+ --purple-400: hsl(237, 98%, 87%);
389
+ --purple-500: hsl(237, 98%, 92%);
390
+ --purple-600: hsl(237, 98%, 96%);
391
391
  --gold-100: hsl(45, 29%, 24%);
392
392
  --gold-200: hsl(45, 47%, 37%);
393
393
  --gold-300: hsl(45, 92%, 62%);
@@ -630,12 +630,12 @@ body.theme-highcontrast:not(.theme-dark) .theme-dark__forced {
630
630
  --yellow-400: hsl(43, 75%, 75%);
631
631
  --yellow-500: hsl(48, 74%, 91%);
632
632
  --yellow-600: hsl(44, 74%, 91%);
633
- --purple-100: hsl(237, 24%, 23%);
634
- --purple-200: hsl(237, 24%, 23%);
635
- --purple-300: hsl(237, 60%, 82%);
636
- --purple-400: hsl(237, 60%, 82%);
637
- --purple-500: hsl(237, 62%, 96%);
638
- --purple-600: hsl(237, 62%, 96%);
633
+ --purple-100: hsl(237, 26%, 23%);
634
+ --purple-200: hsl(237, 26%, 23%);
635
+ --purple-300: hsl(237, 98%, 87%);
636
+ --purple-400: hsl(237, 98%, 87%);
637
+ --purple-500: hsl(237, 98%, 96%);
638
+ --purple-600: hsl(237, 98%, 96%);
639
639
  --gold-100: hsl(45, 22%, 25%);
640
640
  --gold-200: hsl(45, 22%, 25%);
641
641
  --gold-300: hsl(45, 92%, 62%);
@@ -745,12 +745,12 @@ body.theme-highcontrast:not(.theme-dark) .theme-dark__forced {
745
745
  --yellow-400: hsl(43, 75%, 75%);
746
746
  --yellow-500: hsl(48, 74%, 91%);
747
747
  --yellow-600: hsl(44, 74%, 91%);
748
- --purple-100: hsl(237, 24%, 23%);
749
- --purple-200: hsl(237, 24%, 23%);
750
- --purple-300: hsl(237, 60%, 82%);
751
- --purple-400: hsl(237, 60%, 82%);
752
- --purple-500: hsl(237, 62%, 96%);
753
- --purple-600: hsl(237, 62%, 96%);
748
+ --purple-100: hsl(237, 26%, 23%);
749
+ --purple-200: hsl(237, 26%, 23%);
750
+ --purple-300: hsl(237, 98%, 87%);
751
+ --purple-400: hsl(237, 98%, 87%);
752
+ --purple-500: hsl(237, 98%, 96%);
753
+ --purple-600: hsl(237, 98%, 96%);
754
754
  --gold-100: hsl(45, 22%, 25%);
755
755
  --gold-200: hsl(45, 22%, 25%);
756
756
  --gold-300: hsl(45, 92%, 62%);
@@ -264,12 +264,12 @@
264
264
  600: hsl(237, 50%, 32%);
265
265
  }
266
266
  .set-purple-dark() {
267
- 100: hsl(237, 43%, 37%);
268
- 200: hsl(237, 51%, 52%);
269
- 300: hsl(237, 63%, 62%);
270
- 400: hsl(237, 89%, 83%);
271
- 500: hsl(237, 89%, 89%);
272
- 600: hsl(237, 89%, 94%);
267
+ 100: hsl(237, 26%, 23%);
268
+ 200: hsl(237, 26%, 44%);
269
+ 300: hsl(237, 26%, 56%);
270
+ 400: hsl(237, 98%, 87%);
271
+ 500: hsl(237, 98%, 92%);
272
+ 600: hsl(237, 98%, 96%);
273
273
  }
274
274
  .set-purple-hc() {
275
275
  100: hsl(237, 83%, 98%);
@@ -280,12 +280,12 @@
280
280
  600: hsl(237, 50%, 32%);
281
281
  }
282
282
  .set-purple-hc-dark() {
283
- 100: hsl(237, 24%, 23%);
284
- 200: hsl(237, 24%, 23%);
285
- 300: hsl(237, 60%, 82%);
286
- 400: hsl(237, 60%, 82%);
287
- 500: hsl(237, 62%, 96%);
288
- 600: hsl(237, 62%, 96%);
283
+ 100: hsl(237, 26%, 23%);
284
+ 200: hsl(237, 26%, 23%);
285
+ 300: hsl(237, 98%, 87%);
286
+ 400: hsl(237, 98%, 87%);
287
+ 500: hsl(237, 98%, 96%);
288
+ 600: hsl(237, 98%, 96%);
289
289
  }
290
290
 
291
291
  // gold
@@ -0,0 +1,67 @@
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
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "extends": "./tsconfig.json",
3
- "exclude": ["test/**/*.ts", "**/*.test.ts"]
3
+ "exclude": ["test/**/*.ts", "**/*.test.ts", "**/*.setup.ts"]
4
4
  }
package/lib/tsconfig.json CHANGED
@@ -10,8 +10,8 @@
10
10
  "declaration": true,
11
11
  "allowSyntheticDefaultImports": true,
12
12
  "paths": {
13
- "@open-wc/testing": ["./test/open-wc-testing-patch.d.ts"],
14
- },
13
+ "@open-wc/testing": ["./test/open-wc-testing-patch.d.ts"]
14
+ }
15
15
  },
16
- "include": ["**/*.ts"],
16
+ "include": ["**/*.ts"]
17
17
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "https://github.com/StackExchange/Stacks.git"
7
7
  },
8
- "version": "2.1.1",
8
+ "version": "2.3.0",
9
9
  "files": [
10
10
  "dist",
11
11
  "lib"
@@ -47,40 +47,40 @@
47
47
  "@open-wc/testing": "^4.0.0",
48
48
  "@rollup/plugin-commonjs": "^25.0.7",
49
49
  "@rollup/plugin-replace": "^5.0.5",
50
- "@stackoverflow/stacks-editor": "^0.10.0",
51
- "@stackoverflow/stacks-icons": "^6.0.0",
50
+ "@stackoverflow/stacks-editor": "^0.10.2",
51
+ "@stackoverflow/stacks-icons": "^6.0.1",
52
52
  "@testing-library/dom": "^9.3.4",
53
53
  "@testing-library/user-event": "^14.5.2",
54
54
  "@types/cssbeautify": "^0.3.5",
55
55
  "@types/less": "^3.0.6",
56
56
  "@types/mocha": "^10.0.6",
57
- "@typescript-eslint/eslint-plugin": "^6.20.0",
58
- "@typescript-eslint/parser": "^6.21.0",
57
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
58
+ "@typescript-eslint/parser": "^7.1.0",
59
59
  "@web/dev-server-esbuild": "^1.0.2",
60
60
  "@web/dev-server-rollup": "^0.6.1",
61
61
  "@web/test-runner": "^0.18.0",
62
62
  "@web/test-runner-playwright": "^0.11.0",
63
63
  "@web/test-runner-visual-regression": "^0.9.0",
64
64
  "apca-check": "^0.1.0",
65
- "colorjs.io": "^0.4.5",
65
+ "colorjs.io": "^0.5.0",
66
66
  "concurrently": "^8.2.2",
67
67
  "css-loader": "^6.10.0",
68
68
  "cssbeautify": "^0.3.1",
69
- "cssnano": "^6.0.3",
69
+ "cssnano": "^6.0.5",
70
70
  "docsearch.js": "^2.6.3",
71
71
  "eleventy-plugin-highlightjs": "^1.1.0",
72
72
  "eleventy-plugin-nesting-toc": "^1.3.0",
73
- "eslint": "^8.56.0",
73
+ "eslint": "^8.57.0",
74
74
  "eslint-config-prettier": "^9.1.0",
75
75
  "eslint-plugin-no-unsanitized": "^4.0.2",
76
76
  "jquery": "^3.7.1",
77
77
  "less-loader": "^12.2.0",
78
78
  "list.js": "^2.3.1",
79
79
  "markdown-it": "^14.0.0",
80
- "mini-css-extract-plugin": "^2.8.0",
80
+ "mini-css-extract-plugin": "^2.8.1",
81
81
  "postcss-less": "^6.0.0",
82
- "postcss-loader": "^8.0.0",
83
- "prettier": "^3.2.4",
82
+ "postcss-loader": "^8.1.1",
83
+ "prettier": "^3.2.5",
84
84
  "rollup-plugin-postcss": "^4.0.2",
85
85
  "stylelint": "^16.2.1",
86
86
  "stylelint-config-recommended": "^14.0.0",
@@ -88,8 +88,8 @@
88
88
  "terser-webpack-plugin": "^5.3.10",
89
89
  "ts-loader": "^9.5.1",
90
90
  "typescript": "^5.3.3",
91
- "vitest": "^1.2.2",
92
- "webpack": "^5.90.1",
91
+ "vitest": "^1.3.1",
92
+ "webpack": "^5.90.3",
93
93
  "webpack-cli": "^5.1.4",
94
94
  "webpack-merge": "^5.10.0"
95
95
  },