@storybook/addon-a11y 6.5.9 → 7.0.0-alpha.10
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/dist/cjs/a11yRunner.js +68 -193
- package/dist/cjs/components/A11YPanel.js +71 -122
- package/dist/cjs/components/A11yContext.js +48 -128
- package/dist/cjs/components/ColorFilters.js +53 -75
- package/dist/cjs/components/Report/Elements.js +35 -75
- package/dist/cjs/components/Report/HighlightToggle.js +20 -70
- package/dist/cjs/components/Report/Info.js +6 -9
- package/dist/cjs/components/Report/Item.js +53 -102
- package/dist/cjs/components/Report/Rules.js +30 -37
- package/dist/cjs/components/Report/Tags.js +16 -20
- package/dist/cjs/components/Report/index.js +15 -42
- package/dist/cjs/components/Tabs.js +82 -116
- package/dist/cjs/components/VisionSimulator.js +65 -131
- package/dist/cjs/constants.js +15 -19
- package/dist/cjs/index.js +12 -32
- package/dist/cjs/manager.js +19 -25
- package/dist/cjs/preview.js +1 -3
- package/dist/esm/a11yRunner.js +65 -168
- package/dist/esm/components/A11YPanel.js +65 -103
- package/dist/esm/components/A11yContext.js +46 -105
- package/dist/esm/components/ColorFilters.js +49 -51
- package/dist/esm/components/Report/Elements.js +34 -62
- package/dist/esm/components/Report/HighlightToggle.js +20 -58
- package/dist/esm/components/Report/Info.js +6 -7
- package/dist/esm/components/Report/Item.js +49 -81
- package/dist/esm/components/Report/Rules.js +30 -34
- package/dist/esm/components/Report/Tags.js +15 -18
- package/dist/esm/components/Report/index.js +11 -16
- package/dist/esm/components/Tabs.js +77 -89
- package/dist/esm/components/VisionSimulator.js +62 -108
- package/dist/esm/constants.js +14 -17
- package/dist/esm/index.js +10 -10
- package/dist/esm/manager.js +19 -25
- package/dist/esm/preview.js +1 -2
- package/dist/{ts3.9 → types}/a11yRunner.d.ts +0 -0
- package/dist/{ts3.9 → types}/components/A11YPanel.d.ts +0 -0
- package/dist/{ts3.9 → types}/components/A11yContext.d.ts +0 -0
- package/dist/{ts3.9 → types}/components/ColorFilters.d.ts +0 -0
- package/dist/{ts3.9 → types}/components/Report/Elements.d.ts +0 -0
- package/dist/{ts3.9 → types}/components/Report/HighlightToggle.d.ts +0 -0
- package/dist/{ts3.9 → types}/components/Report/Info.d.ts +0 -0
- package/dist/{ts3.9 → types}/components/Report/Item.d.ts +0 -0
- package/dist/{ts3.9 → types}/components/Report/Rules.d.ts +0 -0
- package/dist/{ts3.9 → types}/components/Report/Tags.d.ts +0 -0
- package/dist/{ts3.9 → types}/components/Report/index.d.ts +0 -0
- package/dist/{ts3.9 → types}/components/Tabs.d.ts +0 -0
- package/dist/{ts3.9 → types}/components/VisionSimulator.d.ts +0 -0
- package/dist/{ts3.9 → types}/constants.d.ts +0 -2
- package/dist/{ts3.9 → types}/index.d.ts +0 -1
- package/dist/{ts3.9 → types}/manager.d.ts +0 -0
- package/dist/{ts3.9 → types}/params.d.ts +0 -0
- package/dist/types/preview.d.ts +1 -0
- package/package.json +12 -21
- package/dist/cjs/a11yHighlight.js +0 -64
- package/dist/cjs/highlight.js +0 -22
- package/dist/esm/a11yHighlight.js +0 -46
- package/dist/esm/highlight.js +0 -10
- package/dist/modern/a11yHighlight.js +0 -39
- package/dist/modern/a11yRunner.js +0 -91
- package/dist/modern/components/A11YPanel.js +0 -155
- package/dist/modern/components/A11yContext.js +0 -93
- package/dist/modern/components/ColorFilters.js +0 -50
- package/dist/modern/components/Report/Elements.js +0 -57
- package/dist/modern/components/Report/HighlightToggle.js +0 -57
- package/dist/modern/components/Report/Info.js +0 -23
- package/dist/modern/components/Report/Item.js +0 -89
- package/dist/modern/components/Report/Rules.js +0 -95
- package/dist/modern/components/Report/Tags.js +0 -22
- package/dist/modern/components/Report/index.js +0 -14
- package/dist/modern/components/Tabs.js +0 -117
- package/dist/modern/components/VisionSimulator.js +0 -143
- package/dist/modern/constants.js +0 -18
- package/dist/modern/highlight.js +0 -10
- package/dist/modern/index.js +0 -21
- package/dist/modern/manager.js +0 -37
- package/dist/modern/params.js +0 -1
- package/dist/modern/preview.js +0 -2
- package/dist/ts3.4/a11yHighlight.d.ts +0 -1
- package/dist/ts3.4/a11yRunner.d.ts +0 -1
- package/dist/ts3.4/components/A11YPanel.d.ts +0 -7
- package/dist/ts3.4/components/A11yContext.d.ts +0 -23
- package/dist/ts3.4/components/ColorFilters.d.ts +0 -2
- package/dist/ts3.4/components/Report/Elements.d.ts +0 -9
- package/dist/ts3.4/components/Report/HighlightToggle.d.ts +0 -8
- package/dist/ts3.4/components/Report/Info.d.ts +0 -7
- package/dist/ts3.4/components/Report/Item.d.ts +0 -8
- package/dist/ts3.4/components/Report/Rules.d.ts +0 -13
- package/dist/ts3.4/components/Report/Tags.d.ts +0 -7
- package/dist/ts3.4/components/Report/index.d.ts +0 -9
- package/dist/ts3.4/components/Tabs.d.ts +0 -13
- package/dist/ts3.4/components/VisionSimulator.d.ts +0 -15
- package/dist/ts3.4/constants.d.ts +0 -12
- package/dist/ts3.4/highlight.d.ts +0 -6
- package/dist/ts3.4/index.d.ts +0 -5
- package/dist/ts3.4/manager.d.ts +0 -1
- package/dist/ts3.4/params.d.ts +0 -12
- package/dist/ts3.4/preview.d.ts +0 -2
- package/dist/ts3.9/a11yHighlight.d.ts +0 -1
- package/dist/ts3.9/highlight.d.ts +0 -6
- package/dist/ts3.9/preview.d.ts +0 -2
package/dist/cjs/a11yRunner.js
CHANGED
|
@@ -1,29 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.string.iterator.js");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.weak-map.js");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.symbol.js");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.symbol.description.js");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.symbol.iterator.js");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.object.to-string.js");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.promise.js");
|
|
24
|
-
|
|
25
|
-
require("regenerator-runtime/runtime.js");
|
|
26
|
-
|
|
27
3
|
var _global = _interopRequireDefault(require("global"));
|
|
28
4
|
|
|
29
5
|
var _addons = require("@storybook/addons");
|
|
@@ -32,197 +8,96 @@ var _constants = require("./constants");
|
|
|
32
8
|
|
|
33
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
10
|
|
|
35
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
|
36
|
-
|
|
37
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
38
12
|
|
|
39
|
-
function
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
40
14
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
15
|
+
const {
|
|
16
|
+
document,
|
|
17
|
+
window: globalWindow
|
|
18
|
+
} = _global.default;
|
|
45
19
|
|
|
46
20
|
if (module && module.hot && module.hot.decline) {
|
|
47
21
|
module.hot.decline();
|
|
48
22
|
}
|
|
49
23
|
|
|
50
|
-
|
|
24
|
+
const channel = _addons.addons.getChannel(); // Holds axe core running state
|
|
51
25
|
|
|
52
26
|
|
|
53
|
-
|
|
27
|
+
let active = false; // Holds latest story we requested a run
|
|
54
28
|
|
|
55
|
-
|
|
29
|
+
let activeStoryId;
|
|
56
30
|
/**
|
|
57
31
|
* Handle A11yContext events.
|
|
58
32
|
* Because the event are sent without manual check, we split calls
|
|
59
33
|
*/
|
|
60
34
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
35
|
+
const handleRequest = async storyId => {
|
|
36
|
+
const {
|
|
37
|
+
manual
|
|
38
|
+
} = await getParams(storyId);
|
|
39
|
+
|
|
40
|
+
if (!manual) {
|
|
41
|
+
await run(storyId);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const run = async storyId => {
|
|
46
|
+
activeStoryId = storyId;
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const input = await getParams(storyId);
|
|
50
|
+
|
|
51
|
+
if (!active) {
|
|
52
|
+
active = true;
|
|
53
|
+
channel.emit(_constants.EVENTS.RUNNING);
|
|
54
|
+
const axe = (await Promise.resolve().then(() => _interopRequireWildcard(require('axe-core')))).default;
|
|
55
|
+
const {
|
|
56
|
+
element = '#root',
|
|
57
|
+
config,
|
|
58
|
+
options = {}
|
|
59
|
+
} = input;
|
|
60
|
+
const htmlElement = document.querySelector(element);
|
|
61
|
+
axe.reset();
|
|
62
|
+
|
|
63
|
+
if (config) {
|
|
64
|
+
axe.configure(config);
|
|
88
65
|
}
|
|
89
|
-
}, _callee);
|
|
90
|
-
}));
|
|
91
66
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var run = /*#__PURE__*/function () {
|
|
98
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(storyId) {
|
|
99
|
-
var input, axe, _input$element, element, config, _input$options, options, htmlElement, result;
|
|
100
|
-
|
|
101
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
102
|
-
while (1) {
|
|
103
|
-
switch (_context2.prev = _context2.next) {
|
|
104
|
-
case 0:
|
|
105
|
-
activeStoryId = storyId;
|
|
106
|
-
_context2.prev = 1;
|
|
107
|
-
_context2.next = 4;
|
|
108
|
-
return getParams(storyId);
|
|
109
|
-
|
|
110
|
-
case 4:
|
|
111
|
-
input = _context2.sent;
|
|
112
|
-
|
|
113
|
-
if (active) {
|
|
114
|
-
_context2.next = 19;
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
active = true;
|
|
119
|
-
channel.emit(_constants.EVENTS.RUNNING);
|
|
120
|
-
_context2.next = 10;
|
|
121
|
-
return Promise.resolve().then(function () {
|
|
122
|
-
return _interopRequireWildcard(require('axe-core'));
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
case 10:
|
|
126
|
-
axe = _context2.sent.default;
|
|
127
|
-
_input$element = input.element, element = _input$element === void 0 ? '#root' : _input$element, config = input.config, _input$options = input.options, options = _input$options === void 0 ? {} : _input$options;
|
|
128
|
-
htmlElement = document.querySelector(element);
|
|
129
|
-
axe.reset();
|
|
130
|
-
|
|
131
|
-
if (config) {
|
|
132
|
-
axe.configure(config);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
_context2.next = 17;
|
|
136
|
-
return axe.run(htmlElement, options);
|
|
137
|
-
|
|
138
|
-
case 17:
|
|
139
|
-
result = _context2.sent;
|
|
140
|
-
|
|
141
|
-
// It's possible that we requested a new run on a different story.
|
|
142
|
-
// Unfortunately, axe doesn't support a cancel method to abort current run.
|
|
143
|
-
// We check if the story we run against is still the current one,
|
|
144
|
-
// if not, trigger a new run using the current story
|
|
145
|
-
if (activeStoryId === storyId) {
|
|
146
|
-
channel.emit(_constants.EVENTS.RESULT, result);
|
|
147
|
-
} else {
|
|
148
|
-
active = false;
|
|
149
|
-
run(activeStoryId);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
case 19:
|
|
153
|
-
_context2.next = 24;
|
|
154
|
-
break;
|
|
155
|
-
|
|
156
|
-
case 21:
|
|
157
|
-
_context2.prev = 21;
|
|
158
|
-
_context2.t0 = _context2["catch"](1);
|
|
159
|
-
channel.emit(_constants.EVENTS.ERROR, _context2.t0);
|
|
160
|
-
|
|
161
|
-
case 24:
|
|
162
|
-
_context2.prev = 24;
|
|
163
|
-
active = false;
|
|
164
|
-
return _context2.finish(24);
|
|
165
|
-
|
|
166
|
-
case 27:
|
|
167
|
-
case "end":
|
|
168
|
-
return _context2.stop();
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}, _callee2, null, [[1, 21, 24, 27]]);
|
|
172
|
-
}));
|
|
67
|
+
const result = await axe.run(htmlElement, options); // It's possible that we requested a new run on a different story.
|
|
68
|
+
// Unfortunately, axe doesn't support a cancel method to abort current run.
|
|
69
|
+
// We check if the story we run against is still the current one,
|
|
70
|
+
// if not, trigger a new run using the current story
|
|
173
71
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
72
|
+
if (activeStoryId === storyId) {
|
|
73
|
+
channel.emit(_constants.EVENTS.RESULT, result);
|
|
74
|
+
} else {
|
|
75
|
+
active = false;
|
|
76
|
+
run(activeStoryId);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
} catch (error) {
|
|
80
|
+
channel.emit(_constants.EVENTS.ERROR, error);
|
|
81
|
+
} finally {
|
|
82
|
+
active = false;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
178
85
|
/** Returns story parameters or default ones. */
|
|
179
86
|
|
|
180
87
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
case 2:
|
|
195
|
-
_context3.t0 = _context3.sent;
|
|
196
|
-
|
|
197
|
-
if (_context3.t0) {
|
|
198
|
-
_context3.next = 5;
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
_context3.t0 = {};
|
|
203
|
-
|
|
204
|
-
case 5:
|
|
205
|
-
_ref4 = _context3.t0;
|
|
206
|
-
parameters = _ref4.parameters;
|
|
207
|
-
return _context3.abrupt("return", parameters.a11y || {
|
|
208
|
-
config: {},
|
|
209
|
-
options: {
|
|
210
|
-
restoreScroll: true
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
case 8:
|
|
215
|
-
case "end":
|
|
216
|
-
return _context3.stop();
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}, _callee3);
|
|
220
|
-
}));
|
|
221
|
-
|
|
222
|
-
return function getParams(_x3) {
|
|
223
|
-
return _ref3.apply(this, arguments);
|
|
88
|
+
const getParams = async storyId => {
|
|
89
|
+
const {
|
|
90
|
+
parameters
|
|
91
|
+
} = (await globalWindow.__STORYBOOK_STORY_STORE__.loadStory({
|
|
92
|
+
storyId
|
|
93
|
+
})) || {};
|
|
94
|
+
return parameters.a11y || {
|
|
95
|
+
config: {},
|
|
96
|
+
options: {
|
|
97
|
+
restoreScroll: true
|
|
98
|
+
}
|
|
224
99
|
};
|
|
225
|
-
}
|
|
100
|
+
};
|
|
226
101
|
|
|
227
102
|
channel.on(_constants.EVENTS.REQUEST, handleRequest);
|
|
228
103
|
channel.on(_constants.EVENTS.MANUAL, run);
|
|
@@ -1,33 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol.js");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.symbol.description.js");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.object.to-string.js");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.symbol.iterator.js");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.array.iterator.js");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.string.iterator.js");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.array.slice.js");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.function.name.js");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.array.from.js");
|
|
24
|
-
|
|
25
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
26
|
-
|
|
27
|
-
require("core-js/modules/es.weak-map.js");
|
|
28
|
-
|
|
29
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
30
|
-
|
|
31
3
|
Object.defineProperty(exports, "__esModule", {
|
|
32
4
|
value: true
|
|
33
5
|
});
|
|
@@ -49,25 +21,11 @@ var _A11yContext = require("./A11yContext");
|
|
|
49
21
|
|
|
50
22
|
var _constants = require("../constants");
|
|
51
23
|
|
|
52
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
|
53
|
-
|
|
54
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
55
|
-
|
|
56
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
57
|
-
|
|
58
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
59
|
-
|
|
60
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
61
|
-
|
|
62
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
63
|
-
|
|
64
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
65
25
|
|
|
66
|
-
function
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
67
27
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var RuleType;
|
|
28
|
+
let RuleType;
|
|
71
29
|
exports.RuleType = RuleType;
|
|
72
30
|
|
|
73
31
|
(function (RuleType) {
|
|
@@ -76,116 +34,107 @@ exports.RuleType = RuleType;
|
|
|
76
34
|
RuleType[RuleType["INCOMPLETION"] = 2] = "INCOMPLETION";
|
|
77
35
|
})(RuleType || (exports.RuleType = RuleType = {}));
|
|
78
36
|
|
|
79
|
-
|
|
37
|
+
const Icon = (0, _theming.styled)(_components.Icons)({
|
|
80
38
|
height: 12,
|
|
81
39
|
width: 12,
|
|
82
40
|
marginRight: 4
|
|
83
41
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
var Centered = _theming.styled.span({
|
|
42
|
+
const RotatingIcon = (0, _theming.styled)(Icon)(({
|
|
43
|
+
theme
|
|
44
|
+
}) => ({
|
|
45
|
+
animation: `${theme.animation.rotate360} 1s linear infinite;`
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
const Passes = _theming.styled.span(({
|
|
49
|
+
theme
|
|
50
|
+
}) => ({
|
|
51
|
+
color: theme.color.positive
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
const Violations = _theming.styled.span(({
|
|
55
|
+
theme
|
|
56
|
+
}) => ({
|
|
57
|
+
color: theme.color.negative
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
const Incomplete = _theming.styled.span(({
|
|
61
|
+
theme
|
|
62
|
+
}) => ({
|
|
63
|
+
color: theme.color.warning
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
const Centered = _theming.styled.span({
|
|
113
67
|
display: 'flex',
|
|
114
68
|
alignItems: 'center',
|
|
115
69
|
justifyContent: 'center',
|
|
116
70
|
height: '100%'
|
|
117
71
|
});
|
|
118
72
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
73
|
+
const A11YPanel = () => {
|
|
74
|
+
const {
|
|
75
|
+
manual
|
|
76
|
+
} = (0, _api.useParameter)('a11y', {
|
|
123
77
|
manual: false
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
var _useState = (0, _react.useState)(manual ? 'manual' : 'initial'),
|
|
128
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
129
|
-
status = _useState2[0],
|
|
130
|
-
setStatus = _useState2[1];
|
|
78
|
+
});
|
|
79
|
+
const [status, setStatus] = (0, _react.useState)(manual ? 'manual' : 'initial');
|
|
131
80
|
|
|
132
|
-
|
|
133
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
134
|
-
error = _React$useState2[0],
|
|
135
|
-
setError = _React$useState2[1];
|
|
81
|
+
const [error, setError] = _react.default.useState(undefined);
|
|
136
82
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
83
|
+
const {
|
|
84
|
+
setResults,
|
|
85
|
+
results
|
|
86
|
+
} = (0, _A11yContext.useA11yContext)();
|
|
87
|
+
const {
|
|
88
|
+
storyId
|
|
89
|
+
} = (0, _api.useStorybookState)();
|
|
140
90
|
|
|
141
|
-
|
|
142
|
-
storyId = _useStorybookState.storyId;
|
|
143
|
-
|
|
144
|
-
_react.default.useEffect(function () {
|
|
91
|
+
_react.default.useEffect(() => {
|
|
145
92
|
setStatus(manual ? 'manual' : 'initial');
|
|
146
93
|
}, [manual]);
|
|
147
94
|
|
|
148
|
-
|
|
95
|
+
const handleResult = axeResults => {
|
|
149
96
|
setStatus('ran');
|
|
150
97
|
setResults(axeResults);
|
|
151
|
-
setTimeout(
|
|
98
|
+
setTimeout(() => {
|
|
152
99
|
if (status === 'ran') {
|
|
153
100
|
setStatus('ready');
|
|
154
101
|
}
|
|
155
102
|
}, 900);
|
|
156
103
|
};
|
|
157
104
|
|
|
158
|
-
|
|
105
|
+
const handleRun = (0, _react.useCallback)(() => {
|
|
159
106
|
setStatus('running');
|
|
160
107
|
}, []);
|
|
161
|
-
|
|
108
|
+
const handleError = (0, _react.useCallback)(err => {
|
|
162
109
|
setStatus('error');
|
|
163
110
|
setError(err);
|
|
164
111
|
}, []);
|
|
165
|
-
|
|
166
|
-
|
|
112
|
+
const emit = (0, _api.useChannel)({
|
|
113
|
+
[_constants.EVENTS.RUNNING]: handleRun,
|
|
114
|
+
[_constants.EVENTS.RESULT]: handleResult,
|
|
115
|
+
[_constants.EVENTS.ERROR]: handleError
|
|
116
|
+
});
|
|
117
|
+
const handleManual = (0, _react.useCallback)(() => {
|
|
167
118
|
setStatus('running');
|
|
168
119
|
emit(_constants.EVENTS.MANUAL, storyId);
|
|
169
120
|
}, [storyId]);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
incomplete = results.incomplete,
|
|
188
|
-
violations = results.violations;
|
|
121
|
+
const manualActionItems = (0, _react.useMemo)(() => [{
|
|
122
|
+
title: 'Run test',
|
|
123
|
+
onClick: handleManual
|
|
124
|
+
}], [handleManual]);
|
|
125
|
+
const readyActionItems = (0, _react.useMemo)(() => [{
|
|
126
|
+
title: status === 'ready' ? 'Rerun tests' : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Icon, {
|
|
127
|
+
inline: true,
|
|
128
|
+
icon: "check"
|
|
129
|
+
}), " Tests completed"),
|
|
130
|
+
onClick: handleManual
|
|
131
|
+
}], [status, handleManual]);
|
|
132
|
+
const tabs = (0, _react.useMemo)(() => {
|
|
133
|
+
const {
|
|
134
|
+
passes,
|
|
135
|
+
incomplete,
|
|
136
|
+
violations
|
|
137
|
+
} = results;
|
|
189
138
|
return [{
|
|
190
139
|
label: /*#__PURE__*/_react.default.createElement(Violations, null, violations.length, " Violations"),
|
|
191
140
|
panel: /*#__PURE__*/_react.default.createElement(_Report.Report, {
|