creevey 0.9.0-non-webpack.0 → 0.9.0-non-webpack.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 (56) hide show
  1. package/lib/cjs/client/addon/Manager.js +121 -275
  2. package/lib/cjs/client/addon/components/Addon.js +17 -38
  3. package/lib/cjs/client/addon/components/Icons.js +10 -6
  4. package/lib/cjs/client/addon/components/Panel.js +17 -13
  5. package/lib/cjs/client/addon/components/TestSelect.js +11 -9
  6. package/lib/cjs/client/addon/components/Tools.js +21 -40
  7. package/lib/cjs/client/addon/decorator.js +1 -1
  8. package/lib/cjs/client/addon/index.js +2 -2
  9. package/lib/cjs/client/addon/preset.js +11 -30
  10. package/lib/cjs/client/addon/register.js +45 -73
  11. package/lib/cjs/client/addon/utils.js +1 -1
  12. package/lib/cjs/client/addon/withCreevey.js +153 -360
  13. package/lib/cjs/client/shared/components/ImagesView/BlendView.js +23 -21
  14. package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +21 -17
  15. package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +42 -64
  16. package/lib/cjs/client/shared/components/ImagesView/SlideView.js +35 -48
  17. package/lib/cjs/client/shared/components/ImagesView/SwapView.js +24 -43
  18. package/lib/cjs/client/shared/components/ImagesView/index.js +5 -5
  19. package/lib/cjs/client/shared/components/PageFooter/PageFooter.js +12 -8
  20. package/lib/cjs/client/shared/components/PageFooter/Paging.js +14 -18
  21. package/lib/cjs/client/shared/components/PageHeader/ImagePreview.js +22 -18
  22. package/lib/cjs/client/shared/components/PageHeader/PageHeader.js +42 -67
  23. package/lib/cjs/client/shared/components/ResultsPage.js +38 -68
  24. package/lib/cjs/client/shared/creeveyClientApi.js +55 -86
  25. package/lib/cjs/client/shared/helpers.js +123 -194
  26. package/lib/cjs/client/shared/viewMode.js +4 -4
  27. package/lib/cjs/shared/index.js +26 -14
  28. package/lib/cjs/shared/serializeRegExp.js +5 -4
  29. package/lib/esm/client/addon/Manager.js +121 -275
  30. package/lib/esm/client/addon/components/Addon.js +15 -34
  31. package/lib/esm/client/addon/components/Icons.js +10 -6
  32. package/lib/esm/client/addon/components/Panel.js +17 -13
  33. package/lib/esm/client/addon/components/TestSelect.js +11 -9
  34. package/lib/esm/client/addon/components/Tools.js +19 -36
  35. package/lib/esm/client/addon/decorator.js +1 -1
  36. package/lib/esm/client/addon/preset.js +9 -24
  37. package/lib/esm/client/addon/register.js +42 -70
  38. package/lib/esm/client/addon/utils.js +1 -1
  39. package/lib/esm/client/addon/withCreevey.js +148 -357
  40. package/lib/esm/client/shared/components/ImagesView/BlendView.js +21 -17
  41. package/lib/esm/client/shared/components/ImagesView/ImagesView.js +21 -17
  42. package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +40 -60
  43. package/lib/esm/client/shared/components/ImagesView/SlideView.js +33 -44
  44. package/lib/esm/client/shared/components/ImagesView/SwapView.js +22 -39
  45. package/lib/esm/client/shared/components/PageFooter/PageFooter.js +12 -8
  46. package/lib/esm/client/shared/components/PageFooter/Paging.js +14 -18
  47. package/lib/esm/client/shared/components/PageHeader/ImagePreview.js +22 -18
  48. package/lib/esm/client/shared/components/PageHeader/PageHeader.js +37 -60
  49. package/lib/esm/client/shared/components/ResultsPage.js +36 -64
  50. package/lib/esm/client/shared/creeveyClientApi.js +57 -88
  51. package/lib/esm/client/shared/helpers.js +123 -194
  52. package/lib/esm/client/shared/viewMode.js +4 -4
  53. package/lib/esm/shared/index.js +26 -14
  54. package/lib/esm/shared/serializeRegExp.js +5 -4
  55. package/package.json +1 -1
  56. package/preset.js +1 -1
@@ -1,37 +1,3 @@
1
- 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); }
2
-
3
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
-
5
- 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."); }
6
-
7
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
8
-
9
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
-
11
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
12
-
13
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
-
15
- 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); }
16
-
17
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
18
-
19
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
20
-
21
- 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; }
22
-
23
- 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; }
24
-
25
- 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); } }
26
-
27
- 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); }); }; }
28
-
29
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
30
-
31
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
32
-
33
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
34
-
35
1
  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; }
36
2
 
37
3
  import { SET_STORIES, STORY_RENDERED } from '@storybook/core-events';
@@ -41,12 +7,8 @@ import { initCreeveyClientApi } from '../shared/creeveyClientApi';
41
7
  import { calcStatus } from '../shared/helpers';
42
8
  import { ADDON_ID } from './register';
43
9
  import { getEmojiByTestStatus } from './utils';
44
- export var CreeveyManager = /*#__PURE__*/function () {
45
- function CreeveyManager(storybookApi) {
46
- var _this = this;
47
-
48
- _classCallCheck(this, CreeveyManager);
49
-
10
+ export class CreeveyManager {
11
+ constructor(storybookApi) {
50
12
  _defineProperty(this, "storyId", '');
51
13
 
52
14
  _defineProperty(this, "activeBrowser", '');
@@ -69,60 +31,38 @@ export var CreeveyManager = /*#__PURE__*/function () {
69
31
 
70
32
  _defineProperty(this, "changeTestListeners", []);
71
33
 
72
- _defineProperty(this, "initAll", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
73
- return _regeneratorRuntime().wrap(function _callee$(_context) {
74
- while (1) {
75
- switch (_context.prev = _context.next) {
76
- case 0:
77
- _this.storybookApi.on(STORY_RENDERED, _this.onStoryRendered);
78
-
79
- _this.storybookApi.on(SET_STORIES, _this.onSetStories);
80
-
81
- _context.next = 4;
82
- return initCreeveyClientApi();
83
-
84
- case 4:
85
- _this.creeveyApi = _context.sent;
86
-
87
- _this.creeveyApi.onUpdate(_this.handleCreeveyUpdate);
88
-
89
- _context.next = 8;
90
- return _this.creeveyApi.status;
91
-
92
- case 8:
93
- _this.status = _context.sent;
94
-
95
- case 9:
96
- case "end":
97
- return _context.stop();
98
- }
99
- }
100
- }, _callee);
101
- })));
34
+ _defineProperty(this, "initAll", async () => {
35
+ this.storybookApi.on(STORY_RENDERED, this.onStoryRendered);
36
+ this.storybookApi.on(SET_STORIES, this.onSetStories);
37
+ this.creeveyApi = await initCreeveyClientApi();
38
+ this.creeveyApi.onUpdate(this.handleCreeveyUpdate);
39
+ this.status = await this.creeveyApi.status;
40
+ });
102
41
 
103
- _defineProperty(this, "handleCreeveyUpdate", function (update) {
104
- var tests = update.tests,
105
- _update$removedTests = update.removedTests,
106
- removedTests = _update$removedTests === void 0 ? [] : _update$removedTests,
107
- isRunning = update.isRunning;
42
+ _defineProperty(this, "handleCreeveyUpdate", update => {
43
+ const {
44
+ tests,
45
+ removedTests = [],
46
+ isRunning
47
+ } = update;
108
48
 
109
49
  if (isDefined(isRunning)) {
110
- _this.status.isRunning = isRunning;
50
+ this.status.isRunning = isRunning;
111
51
  }
112
52
 
113
53
  if (isDefined(tests)) {
114
- var prevTests = _this.status.tests;
115
- var prevStories = _this.stories || {};
116
- Object.values(tests).filter(isDefined).forEach(function (update) {
117
- var _test$results;
118
-
119
- var id = update.id,
120
- skip = update.skip,
121
- status = update.status,
122
- results = update.results,
123
- approved = update.approved,
124
- storyId = update.storyId;
125
- var test = prevTests[id];
54
+ const prevTests = this.status.tests;
55
+ const prevStories = this.stories || {};
56
+ Object.values(tests).filter(isDefined).forEach(update => {
57
+ const {
58
+ id,
59
+ skip,
60
+ status,
61
+ results,
62
+ approved,
63
+ storyId
64
+ } = update;
65
+ const test = prevTests[id];
126
66
 
127
67
  if (!test) {
128
68
  return prevTests[id] = update;
@@ -134,269 +74,175 @@ export var CreeveyManager = /*#__PURE__*/function () {
134
74
  test.status = status;
135
75
 
136
76
  if (isDefined(storyId) && isDefined(prevStories[storyId])) {
137
- var story = prevStories[storyId];
138
-
139
- var storyStatus = _this.getStoryTests(storyId);
140
-
141
- var oldStatus = storyStatus.map(function (x) {
142
- return x.id === id ? status : x.status;
143
- }).reduce(function (oldStatus, newStatus) {
144
- return calcStatus(oldStatus, newStatus);
145
- }, undefined);
146
- story.name = _this.addStatusToStoryName(story.name, calcStatus(oldStatus, status), skip || false);
77
+ const story = prevStories[storyId];
78
+ const storyStatus = this.getStoryTests(storyId);
79
+ const oldStatus = storyStatus.map(x => x.id === id ? status : x.status).reduce((oldStatus, newStatus) => calcStatus(oldStatus, newStatus), undefined);
80
+ story.name = this.addStatusToStoryName(story.name, calcStatus(oldStatus, status), skip || false);
147
81
  }
148
82
  }
149
83
 
150
- if (isDefined(results)) test.results ? (_test$results = test.results).push.apply(_test$results, _toConsumableArray(results)) : test.results = results;
84
+ if (isDefined(results)) test.results ? test.results.push(...results) : test.results = results;
151
85
 
152
86
  if (isDefined(approved)) {
153
- Object.entries(approved).forEach(function (_ref2) {
154
- var _ref3 = _slicedToArray(_ref2, 2),
155
- image = _ref3[0],
156
- retry = _ref3[1];
157
-
87
+ Object.entries(approved).forEach(_ref => {
88
+ let [image, retry] = _ref;
158
89
  return retry !== undefined && test && ((test.approved = (test === null || test === void 0 ? void 0 : test.approved) || {})[image] = retry);
159
90
  });
160
91
  }
161
92
  });
162
- removedTests.forEach(function (_ref4) {
163
- var id = _ref4.id;
93
+ removedTests.forEach(_ref2 => {
94
+ let {
95
+ id
96
+ } = _ref2;
164
97
  return delete prevTests[id];
165
98
  });
166
- _this.status.tests = prevTests;
167
- _this.stories = prevStories;
168
-
169
- _this.setPanelsTitle();
170
-
171
- void _this.storybookApi.setStories(_this.stories);
99
+ this.status.tests = prevTests;
100
+ this.stories = prevStories;
101
+ this.setPanelsTitle();
102
+ void this.storybookApi.setStories(this.stories);
172
103
  }
173
104
 
174
- _this.updateStatusListeners.forEach(function (x) {
175
- return x(update);
176
- });
105
+ this.updateStatusListeners.forEach(x => x(update));
177
106
  });
178
107
 
179
- _defineProperty(this, "getCurrentTest", function () {
180
- return _this.status.tests[_this.selectedTestId];
108
+ _defineProperty(this, "getCurrentTest", () => {
109
+ return this.status.tests[this.selectedTestId];
181
110
  });
182
111
 
183
- _defineProperty(this, "onStoryRendered", function (storyId) {
184
- if (_this.storyId === '') void _this.addStatusesToSideBar();
112
+ _defineProperty(this, "onStoryRendered", storyId => {
113
+ if (this.storyId === '') void this.addStatusesToSideBar();
185
114
 
186
- if (_this.storyId !== storyId) {
115
+ if (this.storyId !== storyId) {
187
116
  var _this$getTestsByStory, _this$getTestsByStory2;
188
117
 
189
- _this.storyId = storyId;
190
- _this.selectedTestId = (_this$getTestsByStory = (_this$getTestsByStory2 = _this.getTestsByStoryIdAndBrowser(_this.activeBrowser)[0]) === null || _this$getTestsByStory2 === void 0 ? void 0 : _this$getTestsByStory2.id) !== null && _this$getTestsByStory !== void 0 ? _this$getTestsByStory : '';
191
-
192
- _this.setPanelsTitle();
193
-
194
- _this.changeTestListeners.forEach(function (x) {
195
- return x(_this.selectedTestId);
196
- });
118
+ this.storyId = storyId;
119
+ this.selectedTestId = (_this$getTestsByStory = (_this$getTestsByStory2 = this.getTestsByStoryIdAndBrowser(this.activeBrowser)[0]) === null || _this$getTestsByStory2 === void 0 ? void 0 : _this$getTestsByStory2.id) !== null && _this$getTestsByStory !== void 0 ? _this$getTestsByStory : '';
120
+ this.setPanelsTitle();
121
+ this.changeTestListeners.forEach(x => x(this.selectedTestId));
197
122
  }
198
123
  });
199
124
 
200
- _defineProperty(this, "onStart", function () {
125
+ _defineProperty(this, "onStart", () => {
201
126
  var _this$creeveyApi;
202
127
 
203
- (_this$creeveyApi = _this.creeveyApi) === null || _this$creeveyApi === void 0 ? void 0 : _this$creeveyApi.start([_this.selectedTestId]);
128
+ (_this$creeveyApi = this.creeveyApi) === null || _this$creeveyApi === void 0 ? void 0 : _this$creeveyApi.start([this.selectedTestId]);
204
129
  });
205
130
 
206
- _defineProperty(this, "onStop", function () {
131
+ _defineProperty(this, "onStop", () => {
207
132
  var _this$creeveyApi2;
208
133
 
209
- (_this$creeveyApi2 = _this.creeveyApi) === null || _this$creeveyApi2 === void 0 ? void 0 : _this$creeveyApi2.stop();
134
+ (_this$creeveyApi2 = this.creeveyApi) === null || _this$creeveyApi2 === void 0 ? void 0 : _this$creeveyApi2.stop();
210
135
  });
211
136
 
212
- _defineProperty(this, "onImageApprove", function (id, retry, image) {
137
+ _defineProperty(this, "onImageApprove", (id, retry, image) => {
213
138
  var _this$creeveyApi3;
214
139
 
215
- return (_this$creeveyApi3 = _this.creeveyApi) === null || _this$creeveyApi3 === void 0 ? void 0 : _this$creeveyApi3.approve(id, retry, image);
140
+ return (_this$creeveyApi3 = this.creeveyApi) === null || _this$creeveyApi3 === void 0 ? void 0 : _this$creeveyApi3.approve(id, retry, image);
216
141
  });
217
142
 
218
- _defineProperty(this, "onStartAllStoryTests", function () {
143
+ _defineProperty(this, "onStartAllStoryTests", () => {
219
144
  var _this$creeveyApi4;
220
145
 
221
- var ids = Object.values(_this.status.tests).filter(isDefined).filter(function (x) {
222
- return x.storyId === _this.storyId;
223
- }).map(function (x) {
224
- return x.id;
225
- });
226
- (_this$creeveyApi4 = _this.creeveyApi) === null || _this$creeveyApi4 === void 0 ? void 0 : _this$creeveyApi4.start(ids);
146
+ const ids = Object.values(this.status.tests).filter(isDefined).filter(x => x.storyId === this.storyId).map(x => x.id);
147
+ (_this$creeveyApi4 = this.creeveyApi) === null || _this$creeveyApi4 === void 0 ? void 0 : _this$creeveyApi4.start(ids);
227
148
  });
228
149
 
229
- _defineProperty(this, "onStartAllTests", function () {
150
+ _defineProperty(this, "onStartAllTests", () => {
230
151
  var _this$creeveyApi5;
231
152
 
232
- var ids = Object.values(_this.status.tests).filter(isDefined).map(function (x) {
233
- return x.id;
234
- });
235
- (_this$creeveyApi5 = _this.creeveyApi) === null || _this$creeveyApi5 === void 0 ? void 0 : _this$creeveyApi5.start(ids);
153
+ const ids = Object.values(this.status.tests).filter(isDefined).map(x => x.id);
154
+ (_this$creeveyApi5 = this.creeveyApi) === null || _this$creeveyApi5 === void 0 ? void 0 : _this$creeveyApi5.start(ids);
236
155
  });
237
156
 
238
- _defineProperty(this, "onSetStories", function (data) {
239
- var stories = data.v ? denormalizeStoryParameters(data) : data.stories;
240
- _this.stories = stories;
157
+ _defineProperty(this, "onSetStories", data => {
158
+ const stories = data.v ? denormalizeStoryParameters(data) : data.stories;
159
+ this.stories = stories;
241
160
  });
242
161
 
243
- _defineProperty(this, "setActiveBrowser", function (browser) {
162
+ _defineProperty(this, "setActiveBrowser", browser => {
244
163
  var _this$getTestsByStory3, _this$getTestsByStory4;
245
164
 
246
- _this.activeBrowser = browser;
247
- _this.selectedTestId = (_this$getTestsByStory3 = (_this$getTestsByStory4 = _this.getTestsByStoryIdAndBrowser(_this.activeBrowser)[0]) === null || _this$getTestsByStory4 === void 0 ? void 0 : _this$getTestsByStory4.id) !== null && _this$getTestsByStory3 !== void 0 ? _this$getTestsByStory3 : '';
248
-
249
- _this.changeTestListeners.forEach(function (x) {
250
- return x(_this.selectedTestId);
251
- });
165
+ this.activeBrowser = browser;
166
+ this.selectedTestId = (_this$getTestsByStory3 = (_this$getTestsByStory4 = this.getTestsByStoryIdAndBrowser(this.activeBrowser)[0]) === null || _this$getTestsByStory4 === void 0 ? void 0 : _this$getTestsByStory4.id) !== null && _this$getTestsByStory3 !== void 0 ? _this$getTestsByStory3 : '';
167
+ this.changeTestListeners.forEach(x => x(this.selectedTestId));
252
168
  });
253
169
 
254
- _defineProperty(this, "setSelectedTestId", function (testId) {
255
- _this.selectedTestId = testId;
256
-
257
- _this.changeTestListeners.forEach(function (x) {
258
- return x(_this.selectedTestId);
259
- });
170
+ _defineProperty(this, "setSelectedTestId", testId => {
171
+ this.selectedTestId = testId;
172
+ this.changeTestListeners.forEach(x => x(this.selectedTestId));
260
173
  });
261
174
 
262
- _defineProperty(this, "getStoryTests", function (storyId) {
263
- if (!_this.status || !_this.status.tests) return [];
264
- return Object.values(_this.status.tests).filter(function (result) {
265
- return (result === null || result === void 0 ? void 0 : result.storyId) === storyId;
266
- }).filter(isDefined);
175
+ _defineProperty(this, "getStoryTests", storyId => {
176
+ if (!this.status || !this.status.tests) return [];
177
+ return Object.values(this.status.tests).filter(result => (result === null || result === void 0 ? void 0 : result.storyId) === storyId).filter(isDefined);
267
178
  });
268
179
 
269
- _defineProperty(this, "getBrowsers", function () {
270
- return _this.status.browsers;
180
+ _defineProperty(this, "getBrowsers", () => {
181
+ return this.status.browsers;
271
182
  });
272
183
 
273
- _defineProperty(this, "getTestsByStoryIdAndBrowser", function (browser) {
274
- return Object.values(_this.status.tests).filter(function (x) {
275
- return (x === null || x === void 0 ? void 0 : x.browser) === browser && x.storyId === _this.storyId;
276
- }).filter(isDefined);
184
+ _defineProperty(this, "getTestsByStoryIdAndBrowser", browser => {
185
+ return Object.values(this.status.tests).filter(x => (x === null || x === void 0 ? void 0 : x.browser) === browser && x.storyId === this.storyId).filter(isDefined);
277
186
  });
278
187
 
279
- _defineProperty(this, "getTabTitle", function (browser) {
280
- var tests = _this.getTestsByStoryIdAndBrowser(browser);
281
-
282
- var browserStatus = tests.map(function (x) {
283
- return x && x.status;
284
- }).reduce(function (oldStatus, newStatus) {
285
- return calcStatus(oldStatus, newStatus);
286
- }, undefined);
287
- var browserSkip = tests.length > 0 ? tests.every(function (x) {
288
- return x && x.skip;
289
- }) : false;
290
- var emojiStatus = getEmojiByTestStatus(browserStatus, browserSkip);
188
+ _defineProperty(this, "getTabTitle", browser => {
189
+ const tests = this.getTestsByStoryIdAndBrowser(browser);
190
+ const browserStatus = tests.map(x => x && x.status).reduce((oldStatus, newStatus) => calcStatus(oldStatus, newStatus), undefined);
191
+ const browserSkip = tests.length > 0 ? tests.every(x => x && x.skip) : false;
192
+ const emojiStatus = getEmojiByTestStatus(browserStatus, browserSkip);
291
193
  return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', "Creevey/").concat(browser);
292
194
  });
293
195
 
294
- _defineProperty(this, "setPanelsTitle", function () {
196
+ _defineProperty(this, "setPanelsTitle", () => {
295
197
  var _this$storybookApi;
296
198
 
297
- var panels = (_this$storybookApi = _this.storybookApi) === null || _this$storybookApi === void 0 ? void 0 : _this$storybookApi.getPanels();
199
+ const panels = (_this$storybookApi = this.storybookApi) === null || _this$storybookApi === void 0 ? void 0 : _this$storybookApi.getPanels();
298
200
  if (!panels) return;
299
- var firstPanelBrowser = _this.activeBrowser;
201
+ let firstPanelBrowser = this.activeBrowser;
300
202
 
301
- for (var p in panels) {
203
+ for (const p in panels) {
302
204
  var _panel$id;
303
205
 
304
- var panel = panels[p];
206
+ const panel = panels[p];
305
207
 
306
208
  if (((_panel$id = panel.id) === null || _panel$id === void 0 ? void 0 : _panel$id.indexOf(ADDON_ID)) === 0 && panel.paramKey) {
307
- panel.title = _this.getTabTitle(panel.paramKey);
209
+ panel.title = this.getTabTitle(panel.paramKey);
308
210
  if (!firstPanelBrowser) firstPanelBrowser = panel.paramKey;
309
211
  }
310
212
  }
311
213
 
312
- _this.storybookApi.setSelectedPanel("".concat(ADDON_ID, "/panel/").concat(firstPanelBrowser));
214
+ this.storybookApi.setSelectedPanel("".concat(ADDON_ID, "/panel/").concat(firstPanelBrowser));
313
215
  });
314
216
 
315
217
  this.storybookApi = storybookApi;
316
218
  }
317
219
 
318
- _createClass(CreeveyManager, [{
319
- key: "onUpdateStatus",
320
- value: function onUpdateStatus(listener) {
321
- var _this2 = this;
322
-
323
- this.updateStatusListeners.push(listener);
324
- return function () {
325
- return void (_this2.updateStatusListeners = _this2.updateStatusListeners.filter(function (x) {
326
- return x != listener;
327
- }));
328
- };
329
- }
330
- }, {
331
- key: "onChangeTest",
332
- value: function onChangeTest(listener) {
333
- var _this3 = this;
334
-
335
- this.changeTestListeners.push(listener);
336
- return function () {
337
- return void (_this3.changeTestListeners = _this3.changeTestListeners.filter(function (x) {
338
- return x != listener;
339
- }));
340
- };
341
- }
342
- }, {
343
- key: "addStatusesToSideBar",
344
- value: function () {
345
- var _addStatusesToSideBar = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
346
- var _this4 = this;
347
-
348
- var stories;
349
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
350
- while (1) {
351
- switch (_context2.prev = _context2.next) {
352
- case 0:
353
- if (Object.keys(this.stories).length) {
354
- _context2.next = 2;
355
- break;
356
- }
357
-
358
- return _context2.abrupt("return");
359
-
360
- case 2:
361
- stories = this.stories;
362
- Object.keys(this.stories).forEach(function (storyId) {
363
- var storyStatus = _this4.getStoryTests(storyId);
364
-
365
- var status = storyStatus.map(function (x) {
366
- return x.status;
367
- }).reduce(function (oldStatus, newStatus) {
368
- return calcStatus(oldStatus, newStatus);
369
- }, undefined);
370
- var skip = storyStatus.length > 0 ? storyStatus.every(function (x) {
371
- return x.skip;
372
- }) : false;
373
- _this4.stories[storyId].name = _this4.addStatusToStoryName(stories[storyId].name, status, skip);
374
- });
375
- _context2.next = 6;
376
- return this.storybookApi.setStories(this.stories);
377
-
378
- case 6:
379
- case "end":
380
- return _context2.stop();
381
- }
382
- }
383
- }, _callee2, this);
384
- }));
220
+ onUpdateStatus(listener) {
221
+ this.updateStatusListeners.push(listener);
222
+ return () => void (this.updateStatusListeners = this.updateStatusListeners.filter(x => x != listener));
223
+ }
385
224
 
386
- function addStatusesToSideBar() {
387
- return _addStatusesToSideBar.apply(this, arguments);
388
- }
225
+ onChangeTest(listener) {
226
+ this.changeTestListeners.push(listener);
227
+ return () => void (this.changeTestListeners = this.changeTestListeners.filter(x => x != listener));
228
+ }
229
+
230
+ async addStatusesToSideBar() {
231
+ if (!Object.keys(this.stories).length) return;
232
+ const stories = this.stories;
233
+ Object.keys(this.stories).forEach(storyId => {
234
+ const storyStatus = this.getStoryTests(storyId);
235
+ const status = storyStatus.map(x => x.status).reduce((oldStatus, newStatus) => calcStatus(oldStatus, newStatus), undefined);
236
+ const skip = storyStatus.length > 0 ? storyStatus.every(x => x.skip) : false;
237
+ this.stories[storyId].name = this.addStatusToStoryName(stories[storyId].name, status, skip);
238
+ });
239
+ await this.storybookApi.setStories(this.stories);
240
+ }
241
+
242
+ addStatusToStoryName(name, status, skip) {
243
+ name = name.replace(/^(❌|✔|🟡|🕗|⏸) /, '');
244
+ const emojiStatus = getEmojiByTestStatus(status, skip);
245
+ return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', " ").concat(name);
246
+ }
389
247
 
390
- return addStatusesToSideBar;
391
- }()
392
- }, {
393
- key: "addStatusToStoryName",
394
- value: function addStatusToStoryName(name, status, skip) {
395
- name = name.replace(/^(❌|✔|🟡|🕗|⏸) /, '');
396
- var emojiStatus = getEmojiByTestStatus(status, skip);
397
- return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', " ").concat(name);
398
- }
399
- }]);
400
-
401
- return CreeveyManager;
402
- }();
248
+ }
@@ -1,50 +1,31 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
- 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."); }
4
-
5
- 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); }
6
-
7
- 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; }
8
-
9
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
11
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
1
  import { Placeholder } from '@storybook/components';
14
2
  import React, { useEffect, useState } from 'react';
15
3
  import { Panel } from './Panel';
16
- export var Addon = function Addon(_ref) {
17
- var active = _ref.active,
18
- browser = _ref.browser,
19
- manager = _ref.manager;
20
-
21
- var _useState = useState([]),
22
- _useState2 = _slicedToArray(_useState, 2),
23
- tests = _useState2[0],
24
- setTests = _useState2[1];
25
-
26
- var _useState3 = useState(manager.selectedTestId),
27
- _useState4 = _slicedToArray(_useState3, 2),
28
- selectedTestId = _useState4[0],
29
- setSelectedTestId = _useState4[1];
30
-
31
- useEffect(function () {
4
+ export const Addon = _ref => {
5
+ let {
6
+ active,
7
+ browser,
8
+ manager
9
+ } = _ref;
10
+ const [tests, setTests] = useState([]);
11
+ const [selectedTestId, setSelectedTestId] = useState(manager.selectedTestId);
12
+ useEffect(() => {
32
13
  if (active) {
33
14
  manager.setActiveBrowser(browser);
34
- var browserTests = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
15
+ const browserTests = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
35
16
  setTests(browserTests);
36
17
  }
37
18
  }, [active, browser, manager]);
38
- useEffect(function () {
39
- var unsubscribe = manager.onChangeTest(function (testId) {
19
+ useEffect(() => {
20
+ const unsubscribe = manager.onChangeTest(testId => {
40
21
  setSelectedTestId(testId);
41
- var status = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
22
+ const status = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
42
23
  setTests(status);
43
24
  });
44
25
  return unsubscribe;
45
26
  }, [manager]);
46
- useEffect(function () {
47
- var unsubscribe = manager.onUpdateStatus(function () {
27
+ useEffect(() => {
28
+ const unsubscribe = manager.onUpdateStatus(() => {
48
29
  setTests(manager.getTestsByStoryIdAndBrowser(manager.activeBrowser));
49
30
  });
50
31
  return unsubscribe;
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
- export var NextIcon = function NextIcon(_ref) {
3
- var width = _ref.width,
4
- height = _ref.height;
2
+ export const NextIcon = _ref => {
3
+ let {
4
+ width,
5
+ height
6
+ } = _ref;
5
7
  return /*#__PURE__*/React.createElement("svg", {
6
8
  version: "1.1",
7
9
  width: width,
@@ -12,9 +14,11 @@ export var NextIcon = function NextIcon(_ref) {
12
14
  fill: "currentColor"
13
15
  }));
14
16
  };
15
- export var ForwardIcon = function ForwardIcon(_ref2) {
16
- var width = _ref2.width,
17
- height = _ref2.height;
17
+ export const ForwardIcon = _ref2 => {
18
+ let {
19
+ width,
20
+ height
21
+ } = _ref2;
18
22
  return /*#__PURE__*/React.createElement("svg", {
19
23
  version: "1.1",
20
24
  width: width,