@stackoverflow/stacks 2.2.0 → 2.3.1

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 +2719 -1174
  2. package/dist/css/stacks.min.css +1 -1
  3. package/lib/atomic/__snapshots__/spacing.less.test.ts.snap +1928 -0
  4. package/lib/atomic/spacing.less +59 -303
  5. package/lib/atomic/spacing.less.test.ts +12 -0
  6. package/lib/components/block-link/block-link.less +6 -2
  7. package/lib/components/button/button.a11y.test.ts +14 -18
  8. package/lib/components/button/button.less +10 -17
  9. package/lib/components/button/button.test.setup.ts +36 -0
  10. package/lib/components/button/button.visual.test.ts +3 -33
  11. package/lib/components/button-group/button-group.a11y.test.ts +12 -0
  12. package/lib/components/button-group/button-group.less +49 -50
  13. package/lib/components/button-group/button-group.test.setup.ts +77 -0
  14. package/lib/components/button-group/button-group.visual.test.ts +7 -0
  15. package/lib/components/input_textarea/input_textarea.less +3 -1
  16. package/lib/components/notice/notice.a11y.test.ts +1 -1
  17. package/lib/components/notice/notice.less +105 -76
  18. package/lib/components/notice/notice.visual.test.ts +2 -2
  19. package/lib/components/pagination/pagination.less +5 -1
  20. package/lib/components/post-summary/post-summary.a11y.test.ts +25 -0
  21. package/lib/components/post-summary/post-summary.less +2 -1
  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/select/select.less +5 -1
  25. package/lib/components/topbar/topbar.less +366 -335
  26. package/lib/components/topbar/topbar.visual.test.ts +28 -0
  27. package/lib/components/uploader/uploader.less +5 -1
  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 +15 -15
@@ -10,6 +10,7 @@ import {
10
10
  IconSearch,
11
11
  IconStackExchange,
12
12
  } from "@stackoverflow/stacks-icons/icons";
13
+ import { html } from "@open-w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jzvXfvF+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
  });
@@ -90,10 +90,14 @@
90
90
 
91
91
  & &--input {
92
92
  &:focus:focus-visible + .s-uploader--container {
93
- background-color: var(--_up-bg-focus);
94
93
  .focus-styles();
95
94
  }
96
95
 
96
+ &:focus:focus-visible + .s-uploader--container,
97
+ .s-uploader--container.focus {
98
+ background-color: var(--_up-bg-focus);
99
+ }
100
+
97
101
  cursor: pointer;
98
102
  height: 100%;
99
103
  inset: 0;
@@ -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.2.0",
8
+ "version": "2.3.1",
9
9
  "files": [
10
10
  "dist",
11
11
  "lib"
@@ -47,49 +47,49 @@
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.1",
51
- "@stackoverflow/stacks-icons": "^6.0.1",
50
+ "@stackoverflow/stacks-editor": "^0.10.3",
51
+ "@stackoverflow/stacks-icons": "^6.0.2",
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.2.0",
58
+ "@typescript-eslint/parser": "^7.2.0",
59
59
  "@web/dev-server-esbuild": "^1.0.2",
60
60
  "@web/dev-server-rollup": "^0.6.1",
61
- "@web/test-runner": "^0.18.0",
61
+ "@web/test-runner": "^0.18.1",
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.1.0",
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",
87
87
  "stylelint-config-standard": "^36.0.0",
88
88
  "terser-webpack-plugin": "^5.3.10",
89
89
  "ts-loader": "^9.5.1",
90
- "typescript": "^5.3.3",
91
- "vitest": "^1.2.2",
92
- "webpack": "^5.90.1",
90
+ "typescript": "^5.4.2",
91
+ "vitest": "^1.4.0",
92
+ "webpack": "^5.90.3",
93
93
  "webpack-cli": "^5.1.4",
94
94
  "webpack-merge": "^5.10.0"
95
95
  },