@stackoverflow/stacks 2.0.0-rc.1 → 2.0.0-rc.3
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/README.md +5 -0
- package/dist/css/stacks.css +631 -581
- package/dist/css/stacks.min.css +1 -1
- package/dist/js/stacks.js +265 -110
- package/dist/js/stacks.min.js +1 -1
- package/lib/atomic/typography.less +4 -0
- package/lib/components/activity-indicator/activity-indicator.a11y.test.ts +1 -1
- package/lib/components/activity-indicator/activity-indicator.less +17 -4
- package/lib/components/anchor/anchor.visual.test.ts +1 -5
- package/lib/components/avatar/avatar.visual.test.ts +1 -4
- package/lib/components/badge/badge.a11y.test.ts +2 -2
- package/lib/components/badge/badge.less +21 -29
- package/lib/components/block-link/block-link.less +5 -4
- package/lib/components/button/button.a11y.test.ts +2 -5
- package/lib/components/button/button.less +28 -58
- package/lib/components/button/button.visual.test.ts +2 -5
- package/lib/components/card/card.less +8 -0
- package/lib/components/description/description.a11y.test.ts +1 -0
- package/lib/components/description/description.less +1 -1
- package/lib/components/expandable/expandable.a11y.test.ts +27 -0
- package/lib/components/expandable/expandable.visual.test.ts +27 -0
- package/lib/components/input-icon/input-icon.less +1 -1
- package/lib/components/input-message/input-message.less +4 -3
- package/lib/components/input_textarea/input_textarea.less +1 -1
- package/lib/components/label/label.less +4 -14
- package/lib/components/link-preview/link-preview.a11y.test.ts +48 -0
- package/lib/components/link-preview/link-preview.less +13 -4
- package/lib/components/link-preview/link-preview.visual.test.ts +52 -0
- package/lib/components/notice/notice.a11y.test.ts +17 -0
- package/lib/components/notice/notice.less +45 -82
- package/lib/components/notice/notice.visual.test.ts +26 -0
- package/lib/components/page-title/page-title.less +1 -1
- package/lib/components/pagination/pagination.a11y.test.ts +20 -0
- package/lib/components/pagination/pagination.less +2 -2
- package/lib/components/pagination/pagination.visual.test.ts +26 -0
- package/lib/components/post-summary/post-summary.less +7 -7
- package/lib/components/progress-bar/progress-bar.less +2 -2
- package/lib/components/prose/prose.less +1 -1
- package/lib/components/sidebar-widget/sidebar-widget.less +3 -3
- package/lib/components/spinner/spinner.a11y.test.ts +15 -0
- package/lib/components/spinner/spinner.visual.test.ts +43 -0
- package/lib/components/tag/tag.less +23 -23
- package/lib/components/toast/toast.a11y.test.ts +30 -0
- package/lib/components/toast/toast.visual.test.ts +10 -6
- package/lib/components/toggle-switch/toggle-switch.less +2 -5
- package/lib/components/uploader/uploader.less +19 -13
- package/lib/components/user-card/user-card.less +1 -1
- package/lib/exports/color-sets.less +127 -78
- package/lib/exports/theme.less +7 -7
- package/lib/input-utils.less +1 -1
- package/lib/test/axe-apca/README.md +19 -0
- package/lib/test/axe-apca/src/axe-apca.test.ts +77 -1
- package/lib/test/axe-apca/src/axe-apca.ts +16 -8
- package/lib/test/test-utils.ts +7 -3
- package/package.json +12 -12
|
@@ -12,6 +12,13 @@ type Color = {
|
|
|
12
12
|
toHexString: () => string;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
type ConformanceLevel = "bronze" | "silver" | "custom";
|
|
16
|
+
|
|
17
|
+
type ConformanceThresholdFn = (
|
|
18
|
+
fontSize: string,
|
|
19
|
+
fontWeight: string
|
|
20
|
+
) => number | null;
|
|
21
|
+
|
|
15
22
|
declare module "axe-core" {
|
|
16
23
|
const commons: {
|
|
17
24
|
color: {
|
|
@@ -89,10 +96,7 @@ const getAPCABronzeThreshold = (fontSize: string): number | null => {
|
|
|
89
96
|
|
|
90
97
|
const generateColorContrastAPCAConformanceCheck = (
|
|
91
98
|
conformanceLevel: string,
|
|
92
|
-
conformanceThresholdFn:
|
|
93
|
-
fontSize: string,
|
|
94
|
-
fontWeight: string
|
|
95
|
-
) => number | null
|
|
99
|
+
conformanceThresholdFn: ConformanceThresholdFn
|
|
96
100
|
): Check => ({
|
|
97
101
|
id: `color-contrast-apca-${conformanceLevel}-conformance`,
|
|
98
102
|
metadata: {
|
|
@@ -188,15 +192,19 @@ const colorContrastAPCABronzeConformanceCheck =
|
|
|
188
192
|
const colorContrastAPCASilverRule = generateColorContrastAPCARule("silver");
|
|
189
193
|
const colorContrastAPCABronzeRule = generateColorContrastAPCARule("bronze");
|
|
190
194
|
|
|
191
|
-
const registerAxeAPCA = (
|
|
195
|
+
const registerAxeAPCA = (
|
|
196
|
+
conformanceLevel: ConformanceLevel,
|
|
197
|
+
customConformanceThresholdFn?: ConformanceThresholdFn
|
|
198
|
+
) => {
|
|
192
199
|
axe.configure({
|
|
193
200
|
rules: [generateColorContrastAPCARule(conformanceLevel)],
|
|
194
201
|
checks: [
|
|
195
202
|
generateColorContrastAPCAConformanceCheck(
|
|
196
203
|
conformanceLevel,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
204
|
+
customConformanceThresholdFn ||
|
|
205
|
+
(conformanceLevel === "silver"
|
|
206
|
+
? getAPCASilverPlusThreshold
|
|
207
|
+
: getAPCABronzeThreshold)
|
|
200
208
|
),
|
|
201
209
|
],
|
|
202
210
|
});
|
package/lib/test/test-utils.ts
CHANGED
|
@@ -5,7 +5,11 @@ import type { TemplateResult } from "lit-html";
|
|
|
5
5
|
import axe from "axe-core";
|
|
6
6
|
import registerAxeAPCA from "./axe-apca";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const customConformanceThresholdFn = (fontSize: string): number | null => {
|
|
9
|
+
return parseFloat(fontSize) >= 32 ? 45 : 60;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
registerAxeAPCA("custom", customConformanceThresholdFn);
|
|
9
13
|
|
|
10
14
|
const colorThemes = ["dark", "light"];
|
|
11
15
|
const baseThemes = ["", "highcontrast"];
|
|
@@ -325,10 +329,10 @@ const runComponentTest = ({
|
|
|
325
329
|
axe.configure({
|
|
326
330
|
rules: [
|
|
327
331
|
// for non-high contrast, we disable WCAG 2.1 AA (4.5:1)
|
|
328
|
-
// and use APCA
|
|
332
|
+
// and use a Stacks-specific APCA custom level instead
|
|
329
333
|
{ id: "color-contrast", enabled: false },
|
|
330
334
|
{
|
|
331
|
-
id: "color-contrast-apca-
|
|
335
|
+
id: "color-contrast-apca-custom",
|
|
332
336
|
enabled: !highcontrast,
|
|
333
337
|
},
|
|
334
338
|
// for high contrast, we check against WCAG 2.1 AAA (7:1)
|
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.0.0-rc.
|
|
8
|
+
"version": "2.0.0-rc.3",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
11
|
"lib"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@hotwired/stimulus": "^3.2.
|
|
42
|
+
"@hotwired/stimulus": "^3.2.2",
|
|
43
43
|
"@popperjs/core": "^2.11.8"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -54,39 +54,39 @@
|
|
|
54
54
|
"@testing-library/user-event": "^14.4.3",
|
|
55
55
|
"@types/cssbeautify": "^0.3.2",
|
|
56
56
|
"@types/less": "^3.0.3",
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
58
|
-
"@typescript-eslint/parser": "^6.
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^6.5.0",
|
|
58
|
+
"@typescript-eslint/parser": "^6.6.0",
|
|
59
59
|
"@web/dev-server-esbuild": "^0.4.1",
|
|
60
60
|
"@web/dev-server-rollup": "^0.5.2",
|
|
61
|
-
"@web/test-runner": "^0.17.
|
|
61
|
+
"@web/test-runner": "^0.17.1",
|
|
62
62
|
"@web/test-runner-playwright": "^0.10.1",
|
|
63
63
|
"@web/test-runner-visual-regression": "^0.8.2",
|
|
64
64
|
"apca-w3": "^0.1.9",
|
|
65
|
-
"concurrently": "^8.2.
|
|
65
|
+
"concurrently": "^8.2.1",
|
|
66
66
|
"css-loader": "^6.8.1",
|
|
67
67
|
"cssbeautify": "^0.3.1",
|
|
68
68
|
"cssnano": "^6.0.1",
|
|
69
69
|
"docsearch.js": "^2.6.3",
|
|
70
70
|
"eleventy-plugin-highlightjs": "^1.1.0",
|
|
71
71
|
"eleventy-plugin-nesting-toc": "^1.3.0",
|
|
72
|
-
"eslint": "^8.
|
|
73
|
-
"eslint-config-prettier": "^
|
|
72
|
+
"eslint": "^8.48.0",
|
|
73
|
+
"eslint-config-prettier": "^9.0.0",
|
|
74
74
|
"eslint-plugin-no-unsanitized": "^4.0.2",
|
|
75
|
-
"jquery": "^3.7.
|
|
75
|
+
"jquery": "^3.7.1",
|
|
76
76
|
"less-loader": "^11.1.3",
|
|
77
77
|
"list.js": "^2.3.1",
|
|
78
78
|
"markdown-it": "^13.0.1",
|
|
79
79
|
"mini-css-extract-plugin": "^2.7.6",
|
|
80
80
|
"postcss-less": "^6.0.0",
|
|
81
81
|
"postcss-loader": "^7.3.3",
|
|
82
|
-
"prettier": "^3.0.
|
|
82
|
+
"prettier": "^3.0.3",
|
|
83
83
|
"rollup-plugin-postcss": "^4.0.2",
|
|
84
|
-
"stylelint": "^15.10.
|
|
84
|
+
"stylelint": "^15.10.3",
|
|
85
85
|
"stylelint-config-recommended": "^13.0.0",
|
|
86
86
|
"stylelint-config-standard": "^34.0.0",
|
|
87
87
|
"terser-webpack-plugin": "^5.3.9",
|
|
88
88
|
"ts-loader": "^9.4.4",
|
|
89
|
-
"typescript": "^5.
|
|
89
|
+
"typescript": "^5.2.2",
|
|
90
90
|
"vitest": "^0.33.0",
|
|
91
91
|
"webpack": "^5.88.2",
|
|
92
92
|
"webpack-cli": "^5.1.4",
|