@storybook/addon-a11y 6.4.0-beta.21 → 6.4.0-beta.22

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.
@@ -1,5 +1,23 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ require("core-js/modules/es.weak-map.js");
6
+
7
+ require("core-js/modules/es.string.iterator.js");
8
+
9
+ require("core-js/modules/es.array.iterator.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
+
3
21
  require("core-js/modules/es.promise.js");
4
22
 
5
23
  require("core-js/modules/es.object.to-string.js");
@@ -8,14 +26,16 @@ require("regenerator-runtime/runtime.js");
8
26
 
9
27
  var _global = _interopRequireDefault(require("global"));
10
28
 
11
- var _axeCore = _interopRequireDefault(require("axe-core"));
12
-
13
29
  var _addons = require("@storybook/addons");
14
30
 
15
31
  var _constants = require("./constants");
16
32
 
17
33
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
34
 
35
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
36
+
37
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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
+
19
39
  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); } }
20
40
 
21
41
  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); }); }; }
@@ -82,7 +102,7 @@ var handleRequest = /*#__PURE__*/function () {
82
102
 
83
103
  var run = /*#__PURE__*/function () {
84
104
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(storyId) {
85
- var input, _input$element, element, config, _input$options, options, result;
105
+ var input, axe, _input$element, element, config, _input$options, options, result;
86
106
 
87
107
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
88
108
  while (1) {
@@ -97,24 +117,30 @@ var run = /*#__PURE__*/function () {
97
117
  input = _context2.sent;
98
118
 
99
119
  if (active) {
100
- _context2.next = 15;
120
+ _context2.next = 18;
101
121
  break;
102
122
  }
103
123
 
104
124
  active = true;
105
125
  channel.emit(_constants.EVENTS.RUNNING);
106
- _input$element = input.element, element = _input$element === void 0 ? getElement() : _input$element, config = input.config, _input$options = input.options, options = _input$options === void 0 ? {} : _input$options;
126
+ _context2.next = 10;
127
+ return Promise.resolve().then(function () {
128
+ return _interopRequireWildcard(require('axe-core'));
129
+ });
107
130
 
108
- _axeCore.default.reset();
131
+ case 10:
132
+ axe = _context2.sent;
133
+ _input$element = input.element, element = _input$element === void 0 ? getElement() : _input$element, config = input.config, _input$options = input.options, options = _input$options === void 0 ? {} : _input$options;
134
+ axe.reset();
109
135
 
110
136
  if (config) {
111
- _axeCore.default.configure(config);
137
+ axe.configure(config);
112
138
  }
113
139
 
114
- _context2.next = 13;
115
- return _axeCore.default.run(element, options);
140
+ _context2.next = 16;
141
+ return axe.run(element, options);
116
142
 
117
- case 13:
143
+ case 16:
118
144
  result = _context2.sent;
119
145
 
120
146
  // It's possible that we requested a new run on a different story.
@@ -128,26 +154,26 @@ var run = /*#__PURE__*/function () {
128
154
  run(activeStoryId);
129
155
  }
130
156
 
131
- case 15:
132
- _context2.next = 20;
157
+ case 18:
158
+ _context2.next = 23;
133
159
  break;
134
160
 
135
- case 17:
136
- _context2.prev = 17;
161
+ case 20:
162
+ _context2.prev = 20;
137
163
  _context2.t0 = _context2["catch"](1);
138
164
  channel.emit(_constants.EVENTS.ERROR, _context2.t0);
139
165
 
140
- case 20:
141
- _context2.prev = 20;
166
+ case 23:
167
+ _context2.prev = 23;
142
168
  active = false;
143
- return _context2.finish(20);
169
+ return _context2.finish(23);
144
170
 
145
- case 23:
171
+ case 26:
146
172
  case "end":
147
173
  return _context2.stop();
148
174
  }
149
175
  }
150
- }, _callee2, null, [[1, 17, 20, 23]]);
176
+ }, _callee2, null, [[1, 20, 23, 26]]);
151
177
  }));
152
178
 
153
179
  return function run(_x2) {
@@ -7,7 +7,6 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
7
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
8
 
9
9
  import global from 'global';
10
- import axe from 'axe-core';
11
10
  import { addons } from '@storybook/addons';
12
11
  import { EVENTS } from './constants';
13
12
  var document = global.document,
@@ -71,7 +70,7 @@ var handleRequest = /*#__PURE__*/function () {
71
70
 
72
71
  var run = /*#__PURE__*/function () {
73
72
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(storyId) {
74
- var input, _input$element, element, config, _input$options, options, result;
73
+ var input, axe, _input$element, element, config, _input$options, options, result;
75
74
 
76
75
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
77
76
  while (1) {
@@ -86,12 +85,17 @@ var run = /*#__PURE__*/function () {
86
85
  input = _context2.sent;
87
86
 
88
87
  if (active) {
89
- _context2.next = 15;
88
+ _context2.next = 18;
90
89
  break;
91
90
  }
92
91
 
93
92
  active = true;
94
93
  channel.emit(EVENTS.RUNNING);
94
+ _context2.next = 10;
95
+ return import('axe-core');
96
+
97
+ case 10:
98
+ axe = _context2.sent;
95
99
  _input$element = input.element, element = _input$element === void 0 ? getElement() : _input$element, config = input.config, _input$options = input.options, options = _input$options === void 0 ? {} : _input$options;
96
100
  axe.reset();
97
101
 
@@ -99,10 +103,10 @@ var run = /*#__PURE__*/function () {
99
103
  axe.configure(config);
100
104
  }
101
105
 
102
- _context2.next = 13;
106
+ _context2.next = 16;
103
107
  return axe.run(element, options);
104
108
 
105
- case 13:
109
+ case 16:
106
110
  result = _context2.sent;
107
111
 
108
112
  // It's possible that we requested a new run on a different story.
@@ -116,26 +120,26 @@ var run = /*#__PURE__*/function () {
116
120
  run(activeStoryId);
117
121
  }
118
122
 
119
- case 15:
120
- _context2.next = 20;
123
+ case 18:
124
+ _context2.next = 23;
121
125
  break;
122
126
 
123
- case 17:
124
- _context2.prev = 17;
127
+ case 20:
128
+ _context2.prev = 20;
125
129
  _context2.t0 = _context2["catch"](1);
126
130
  channel.emit(EVENTS.ERROR, _context2.t0);
127
131
 
128
- case 20:
129
- _context2.prev = 20;
132
+ case 23:
133
+ _context2.prev = 23;
130
134
  active = false;
131
- return _context2.finish(20);
135
+ return _context2.finish(23);
132
136
 
133
- case 23:
137
+ case 26:
134
138
  case "end":
135
139
  return _context2.stop();
136
140
  }
137
141
  }
138
- }, _callee2, null, [[1, 17, 20, 23]]);
142
+ }, _callee2, null, [[1, 20, 23, 26]]);
139
143
  }));
140
144
 
141
145
  return function run(_x2) {
@@ -1,5 +1,4 @@
1
1
  import global from 'global';
2
- import axe from 'axe-core';
3
2
  import { addons } from '@storybook/addons';
4
3
  import { EVENTS } from './constants';
5
4
  const {
@@ -46,6 +45,7 @@ const run = async storyId => {
46
45
  if (!active) {
47
46
  active = true;
48
47
  channel.emit(EVENTS.RUNNING);
48
+ const axe = await import('axe-core');
49
49
  const {
50
50
  element = getElement(),
51
51
  config,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-a11y",
3
- "version": "6.4.0-beta.21",
3
+ "version": "6.4.0-beta.22",
4
4
  "description": "Test component compliance with web accessibility standards",
5
5
  "keywords": [
6
6
  "a11y",
@@ -45,14 +45,14 @@
45
45
  "prepare": "node ../../scripts/prepare.js"
46
46
  },
47
47
  "dependencies": {
48
- "@storybook/addons": "6.4.0-beta.21",
49
- "@storybook/api": "6.4.0-beta.21",
50
- "@storybook/channels": "6.4.0-beta.21",
51
- "@storybook/client-logger": "6.4.0-beta.21",
52
- "@storybook/components": "6.4.0-beta.21",
53
- "@storybook/core-events": "6.4.0-beta.21",
48
+ "@storybook/addons": "6.4.0-beta.22",
49
+ "@storybook/api": "6.4.0-beta.22",
50
+ "@storybook/channels": "6.4.0-beta.22",
51
+ "@storybook/client-logger": "6.4.0-beta.22",
52
+ "@storybook/components": "6.4.0-beta.22",
53
+ "@storybook/core-events": "6.4.0-beta.22",
54
54
  "@storybook/csf": "0.0.2--canary.87bc651.0",
55
- "@storybook/theming": "6.4.0-beta.21",
55
+ "@storybook/theming": "6.4.0-beta.22",
56
56
  "axe-core": "^4.2.0",
57
57
  "core-js": "^3.8.2",
58
58
  "global": "^4.4.0",
@@ -81,7 +81,7 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "eb83ef6aefb6791324e2c70567bdc128cef09d92",
84
+ "gitHead": "680a207c0b7d5daee89633349c7320a3ac29b3c6",
85
85
  "sbmodern": "dist/modern/index.js",
86
86
  "storybook": {
87
87
  "displayName": "Accessibility",