@storybook/addon-a11y 6.5.7 → 7.0.0-alpha.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.
- package/dist/cjs/a11yRunner.js +30 -14
- package/dist/cjs/components/A11yContext.js +1 -1
- package/dist/esm/a11yHighlight.js +14 -21
- package/dist/esm/a11yRunner.js +65 -168
- package/dist/esm/components/A11YPanel.js +65 -103
- package/dist/esm/components/A11yContext.js +38 -97
- 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 +17 -17
- package/dist/esm/highlight.js +10 -10
- package/dist/esm/index.js +10 -9
- package/dist/esm/manager.js +19 -25
- package/dist/{ts3.9 → types}/a11yHighlight.d.ts +0 -0
- 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 -0
- package/dist/{ts3.9 → types}/highlight.d.ts +0 -0
- package/dist/{ts3.9 → types}/index.d.ts +0 -0
- package/dist/{ts3.9 → types}/manager.d.ts +0 -0
- package/dist/{ts3.9 → types}/params.d.ts +0 -0
- package/dist/{ts3.9 → types}/preview.d.ts +0 -0
- package/package.json +11 -20
- 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/cjs/a11yRunner.js
CHANGED
|
@@ -2,28 +2,42 @@
|
|
|
2
2
|
|
|
3
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
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.symbol.iterator.js");
|
|
10
|
+
|
|
5
11
|
require("core-js/modules/es.array.iterator.js");
|
|
6
12
|
|
|
7
13
|
require("core-js/modules/es.string.iterator.js");
|
|
8
14
|
|
|
9
|
-
require("core-js/modules/es.weak-map.js");
|
|
10
|
-
|
|
11
15
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
12
16
|
|
|
13
|
-
require("core-js/modules/es.
|
|
17
|
+
require("core-js/modules/es.symbol.async-iterator.js");
|
|
14
18
|
|
|
15
|
-
require("core-js/modules/es.symbol.js");
|
|
19
|
+
require("core-js/modules/es.symbol.to-string-tag.js");
|
|
16
20
|
|
|
17
|
-
require("core-js/modules/es.
|
|
21
|
+
require("core-js/modules/es.json.to-string-tag.js");
|
|
18
22
|
|
|
19
|
-
require("core-js/modules/es.
|
|
23
|
+
require("core-js/modules/es.math.to-string-tag.js");
|
|
24
|
+
|
|
25
|
+
require("core-js/modules/es.object.get-prototype-of.js");
|
|
26
|
+
|
|
27
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
28
|
+
|
|
29
|
+
require("core-js/modules/es.function.name.js");
|
|
30
|
+
|
|
31
|
+
require("core-js/modules/es.array.slice.js");
|
|
32
|
+
|
|
33
|
+
require("core-js/modules/es.weak-map.js");
|
|
34
|
+
|
|
35
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
20
36
|
|
|
21
37
|
require("core-js/modules/es.object.to-string.js");
|
|
22
38
|
|
|
23
39
|
require("core-js/modules/es.promise.js");
|
|
24
40
|
|
|
25
|
-
require("regenerator-runtime/runtime.js");
|
|
26
|
-
|
|
27
41
|
var _global = _interopRequireDefault(require("global"));
|
|
28
42
|
|
|
29
43
|
var _addons = require("@storybook/addons");
|
|
@@ -36,6 +50,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
36
50
|
|
|
37
51
|
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; }
|
|
38
52
|
|
|
53
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
54
|
+
|
|
39
55
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
40
56
|
|
|
41
57
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -59,10 +75,10 @@ var activeStoryId;
|
|
|
59
75
|
*/
|
|
60
76
|
|
|
61
77
|
var handleRequest = /*#__PURE__*/function () {
|
|
62
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/
|
|
78
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(storyId) {
|
|
63
79
|
var _yield$getParams, manual;
|
|
64
80
|
|
|
65
|
-
return
|
|
81
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
66
82
|
while (1) {
|
|
67
83
|
switch (_context.prev = _context.next) {
|
|
68
84
|
case 0:
|
|
@@ -95,10 +111,10 @@ var handleRequest = /*#__PURE__*/function () {
|
|
|
95
111
|
}();
|
|
96
112
|
|
|
97
113
|
var run = /*#__PURE__*/function () {
|
|
98
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/
|
|
114
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(storyId) {
|
|
99
115
|
var input, axe, _input$element, element, config, _input$options, options, htmlElement, result;
|
|
100
116
|
|
|
101
|
-
return
|
|
117
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
102
118
|
while (1) {
|
|
103
119
|
switch (_context2.prev = _context2.next) {
|
|
104
120
|
case 0:
|
|
@@ -179,10 +195,10 @@ var run = /*#__PURE__*/function () {
|
|
|
179
195
|
|
|
180
196
|
|
|
181
197
|
var getParams = /*#__PURE__*/function () {
|
|
182
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/
|
|
198
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(storyId) {
|
|
183
199
|
var _ref4, parameters;
|
|
184
200
|
|
|
185
|
-
return
|
|
201
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
186
202
|
while (1) {
|
|
187
203
|
switch (_context3.prev = _context3.next) {
|
|
188
204
|
case 0:
|
|
@@ -61,7 +61,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
61
61
|
|
|
62
62
|
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; }
|
|
63
63
|
|
|
64
|
-
function _extends() { _extends = Object.assign
|
|
64
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
65
65
|
|
|
66
66
|
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; }
|
|
67
67
|
|
|
@@ -1,41 +1,34 @@
|
|
|
1
|
-
import "core-js/modules/es.array.from.js";
|
|
2
|
-
import "core-js/modules/es.string.iterator.js";
|
|
3
|
-
import "core-js/modules/es.array.iterator.js";
|
|
4
|
-
import "core-js/modules/es.object.to-string.js";
|
|
5
|
-
import "core-js/modules/es.set.js";
|
|
6
|
-
import "core-js/modules/web.dom-collections.iterator.js";
|
|
7
|
-
import "core-js/modules/es.array.join.js";
|
|
8
|
-
import "core-js/modules/es.array.map.js";
|
|
9
|
-
import "core-js/modules/es.array.concat.js";
|
|
10
1
|
import global from 'global';
|
|
11
2
|
import { addons } from '@storybook/addons';
|
|
12
3
|
import { STORY_CHANGED } from '@storybook/core-events';
|
|
13
4
|
import { EVENTS, HIGHLIGHT_STYLE_ID } from './constants';
|
|
14
5
|
import { highlightStyle } from './highlight';
|
|
15
|
-
|
|
6
|
+
const {
|
|
7
|
+
document
|
|
8
|
+
} = global;
|
|
16
9
|
|
|
17
10
|
if (module && module.hot && module.hot.decline) {
|
|
18
11
|
module.hot.decline();
|
|
19
12
|
}
|
|
20
13
|
|
|
21
|
-
|
|
14
|
+
const channel = addons.getChannel();
|
|
22
15
|
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
const highlight = infos => {
|
|
17
|
+
const id = HIGHLIGHT_STYLE_ID;
|
|
25
18
|
resetHighlight(); // Make sure there are no duplicated selectors
|
|
26
19
|
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
const elements = Array.from(new Set(infos.elements));
|
|
21
|
+
const sheet = document.createElement('style');
|
|
29
22
|
sheet.setAttribute('id', id);
|
|
30
|
-
sheet.innerHTML = elements.map(
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
sheet.innerHTML = elements.map(target => `${target}{
|
|
24
|
+
${highlightStyle(infos.color)}
|
|
25
|
+
}`).join(' ');
|
|
33
26
|
document.head.appendChild(sheet);
|
|
34
27
|
};
|
|
35
28
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
const resetHighlight = () => {
|
|
30
|
+
const id = HIGHLIGHT_STYLE_ID;
|
|
31
|
+
const sheetToBeRemoved = document.getElementById(id);
|
|
39
32
|
|
|
40
33
|
if (sheetToBeRemoved) {
|
|
41
34
|
sheetToBeRemoved.parentNode.removeChild(sheetToBeRemoved);
|
package/dist/esm/a11yRunner.js
CHANGED
|
@@ -1,194 +1,91 @@
|
|
|
1
|
-
import "core-js/modules/es.object.to-string.js";
|
|
2
|
-
import "core-js/modules/es.promise.js";
|
|
3
|
-
import "regenerator-runtime/runtime.js";
|
|
4
|
-
|
|
5
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
6
|
-
|
|
7
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
|
-
|
|
9
1
|
import global from 'global';
|
|
10
2
|
import { addons } from '@storybook/addons';
|
|
11
3
|
import { EVENTS } from './constants';
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
const {
|
|
5
|
+
document,
|
|
6
|
+
window: globalWindow
|
|
7
|
+
} = global;
|
|
14
8
|
|
|
15
9
|
if (module && module.hot && module.hot.decline) {
|
|
16
10
|
module.hot.decline();
|
|
17
11
|
}
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
const channel = addons.getChannel(); // Holds axe core running state
|
|
20
14
|
|
|
21
|
-
|
|
15
|
+
let active = false; // Holds latest story we requested a run
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
let activeStoryId;
|
|
24
18
|
/**
|
|
25
19
|
* Handle A11yContext events.
|
|
26
20
|
* Because the event are sent without manual check, we split calls
|
|
27
21
|
*/
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
23
|
+
const handleRequest = async storyId => {
|
|
24
|
+
const {
|
|
25
|
+
manual
|
|
26
|
+
} = await getParams(storyId);
|
|
27
|
+
|
|
28
|
+
if (!manual) {
|
|
29
|
+
await run(storyId);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const run = async storyId => {
|
|
34
|
+
activeStoryId = storyId;
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const input = await getParams(storyId);
|
|
38
|
+
|
|
39
|
+
if (!active) {
|
|
40
|
+
active = true;
|
|
41
|
+
channel.emit(EVENTS.RUNNING);
|
|
42
|
+
const axe = (await import('axe-core')).default;
|
|
43
|
+
const {
|
|
44
|
+
element = '#root',
|
|
45
|
+
config,
|
|
46
|
+
options = {}
|
|
47
|
+
} = input;
|
|
48
|
+
const htmlElement = document.querySelector(element);
|
|
49
|
+
axe.reset();
|
|
50
|
+
|
|
51
|
+
if (config) {
|
|
52
|
+
axe.configure(config);
|
|
56
53
|
}
|
|
57
|
-
}, _callee);
|
|
58
|
-
}));
|
|
59
|
-
|
|
60
|
-
return function handleRequest(_x) {
|
|
61
|
-
return _ref.apply(this, arguments);
|
|
62
|
-
};
|
|
63
|
-
}();
|
|
64
|
-
|
|
65
|
-
var run = /*#__PURE__*/function () {
|
|
66
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(storyId) {
|
|
67
|
-
var input, axe, _input$element, element, config, _input$options, options, htmlElement, result;
|
|
68
|
-
|
|
69
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
70
|
-
while (1) {
|
|
71
|
-
switch (_context2.prev = _context2.next) {
|
|
72
|
-
case 0:
|
|
73
|
-
activeStoryId = storyId;
|
|
74
|
-
_context2.prev = 1;
|
|
75
|
-
_context2.next = 4;
|
|
76
|
-
return getParams(storyId);
|
|
77
|
-
|
|
78
|
-
case 4:
|
|
79
|
-
input = _context2.sent;
|
|
80
|
-
|
|
81
|
-
if (active) {
|
|
82
|
-
_context2.next = 19;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
active = true;
|
|
87
|
-
channel.emit(EVENTS.RUNNING);
|
|
88
|
-
_context2.next = 10;
|
|
89
|
-
return import('axe-core');
|
|
90
|
-
|
|
91
|
-
case 10:
|
|
92
|
-
axe = _context2.sent.default;
|
|
93
|
-
_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;
|
|
94
|
-
htmlElement = document.querySelector(element);
|
|
95
|
-
axe.reset();
|
|
96
54
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
55
|
+
const result = await axe.run(htmlElement, options); // It's possible that we requested a new run on a different story.
|
|
56
|
+
// Unfortunately, axe doesn't support a cancel method to abort current run.
|
|
57
|
+
// We check if the story we run against is still the current one,
|
|
58
|
+
// if not, trigger a new run using the current story
|
|
100
59
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// It's possible that we requested a new run on a different story.
|
|
108
|
-
// Unfortunately, axe doesn't support a cancel method to abort current run.
|
|
109
|
-
// We check if the story we run against is still the current one,
|
|
110
|
-
// if not, trigger a new run using the current story
|
|
111
|
-
if (activeStoryId === storyId) {
|
|
112
|
-
channel.emit(EVENTS.RESULT, result);
|
|
113
|
-
} else {
|
|
114
|
-
active = false;
|
|
115
|
-
run(activeStoryId);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
case 19:
|
|
119
|
-
_context2.next = 24;
|
|
120
|
-
break;
|
|
121
|
-
|
|
122
|
-
case 21:
|
|
123
|
-
_context2.prev = 21;
|
|
124
|
-
_context2.t0 = _context2["catch"](1);
|
|
125
|
-
channel.emit(EVENTS.ERROR, _context2.t0);
|
|
126
|
-
|
|
127
|
-
case 24:
|
|
128
|
-
_context2.prev = 24;
|
|
129
|
-
active = false;
|
|
130
|
-
return _context2.finish(24);
|
|
131
|
-
|
|
132
|
-
case 27:
|
|
133
|
-
case "end":
|
|
134
|
-
return _context2.stop();
|
|
135
|
-
}
|
|
60
|
+
if (activeStoryId === storyId) {
|
|
61
|
+
channel.emit(EVENTS.RESULT, result);
|
|
62
|
+
} else {
|
|
63
|
+
active = false;
|
|
64
|
+
run(activeStoryId);
|
|
136
65
|
}
|
|
137
|
-
}
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
}
|
|
66
|
+
}
|
|
67
|
+
} catch (error) {
|
|
68
|
+
channel.emit(EVENTS.ERROR, error);
|
|
69
|
+
} finally {
|
|
70
|
+
active = false;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
144
73
|
/** Returns story parameters or default ones. */
|
|
145
74
|
|
|
146
75
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
case 2:
|
|
161
|
-
_context3.t0 = _context3.sent;
|
|
162
|
-
|
|
163
|
-
if (_context3.t0) {
|
|
164
|
-
_context3.next = 5;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
_context3.t0 = {};
|
|
169
|
-
|
|
170
|
-
case 5:
|
|
171
|
-
_ref4 = _context3.t0;
|
|
172
|
-
parameters = _ref4.parameters;
|
|
173
|
-
return _context3.abrupt("return", parameters.a11y || {
|
|
174
|
-
config: {},
|
|
175
|
-
options: {
|
|
176
|
-
restoreScroll: true
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
case 8:
|
|
181
|
-
case "end":
|
|
182
|
-
return _context3.stop();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}, _callee3);
|
|
186
|
-
}));
|
|
187
|
-
|
|
188
|
-
return function getParams(_x3) {
|
|
189
|
-
return _ref3.apply(this, arguments);
|
|
76
|
+
const getParams = async storyId => {
|
|
77
|
+
const {
|
|
78
|
+
parameters
|
|
79
|
+
} = (await globalWindow.__STORYBOOK_STORY_STORE__.loadStory({
|
|
80
|
+
storyId
|
|
81
|
+
})) || {};
|
|
82
|
+
return parameters.a11y || {
|
|
83
|
+
config: {},
|
|
84
|
+
options: {
|
|
85
|
+
restoreScroll: true
|
|
86
|
+
}
|
|
190
87
|
};
|
|
191
|
-
}
|
|
88
|
+
};
|
|
192
89
|
|
|
193
90
|
channel.on(EVENTS.REQUEST, handleRequest);
|
|
194
91
|
channel.on(EVENTS.MANUAL, run);
|