creevey 0.8.0-beta.0 → 0.9.0-beta.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.
- package/CHANGELOG.md +5 -9
- package/lib/cjs/client/web/main.js +6 -6
- package/lib/types/cli.d.ts +1 -1
- package/lib/types/client/addon/Manager.d.ts +37 -37
- package/lib/types/client/addon/components/Addon.d.ts +8 -8
- package/lib/types/client/addon/components/Icons.d.ts +7 -7
- package/lib/types/client/addon/components/Panel.d.ts +9 -9
- package/lib/types/client/addon/components/TestSelect.d.ts +9 -9
- package/lib/types/client/addon/components/Tools.d.ts +6 -6
- package/lib/types/client/addon/decorator.d.ts +1 -1
- package/lib/types/client/addon/preset.d.ts +24 -22
- package/lib/types/client/addon/readyForCapture.d.ts +6 -0
- package/lib/types/client/addon/register.d.ts +3 -3
- package/lib/types/client/addon/utils.d.ts +2 -2
- package/lib/types/client/addon/withCreevey.d.ts +24 -13
- package/lib/types/client/shared/components/ImagesView/BlendView.d.ts +3 -3
- package/lib/types/client/shared/components/ImagesView/ImagesView.d.ts +25 -25
- package/lib/types/client/shared/components/ImagesView/SideBySideView.d.ts +3 -3
- package/lib/types/client/shared/components/ImagesView/SlideView.d.ts +3 -3
- package/lib/types/client/shared/components/ImagesView/SwapView.d.ts +3 -3
- package/lib/types/client/shared/components/ImagesView/index.d.ts +5 -5
- package/lib/types/client/shared/components/PageFooter/PageFooter.d.ts +9 -9
- package/lib/types/client/shared/components/PageFooter/Paging.d.ts +8 -8
- package/lib/types/client/shared/components/PageHeader/ImagePreview.d.ts +12 -12
- package/lib/types/client/shared/components/PageHeader/PageHeader.d.ts +17 -17
- package/lib/types/client/shared/components/ResultsPage.d.ts +18 -18
- package/lib/types/client/shared/creeveyClientApi.d.ts +9 -9
- package/lib/types/client/shared/helpers.d.ts +46 -46
- package/lib/types/client/shared/viewMode.d.ts +4 -4
- package/lib/types/client/web/CreeveyApp.d.ts +12 -12
- package/lib/types/client/web/CreeveyContext.d.ts +11 -11
- package/lib/types/client/web/CreeveyLoader.d.ts +3 -3
- package/lib/types/client/web/CreeveyView/SideBar/Checkbox.d.ts +19 -19
- package/lib/types/client/web/CreeveyView/SideBar/Search.d.ts +6 -6
- package/lib/types/client/web/CreeveyView/SideBar/SideBar.d.ts +14 -14
- package/lib/types/client/web/CreeveyView/SideBar/SideBarHeader.d.ts +13 -13
- package/lib/types/client/web/CreeveyView/SideBar/SuiteLink.d.ts +33 -33
- package/lib/types/client/web/CreeveyView/SideBar/TestLink.d.ts +8 -8
- package/lib/types/client/web/CreeveyView/SideBar/TestStatusIcon.d.ts +10 -10
- package/lib/types/client/web/CreeveyView/SideBar/TestsStatus.d.ts +9 -9
- package/lib/types/client/web/CreeveyView/SideBar/Toggle.d.ts +6 -6
- package/lib/types/client/web/CreeveyView/SideBar/index.d.ts +1 -1
- package/lib/types/client/web/KeyboardEventsContext.d.ts +13 -13
- package/lib/types/client/web/index.d.ts +4 -4
- package/lib/types/creevey.d.ts +1 -1
- package/lib/types/index.d.ts +4 -2
- package/lib/types/server/config.d.ts +4 -4
- package/lib/types/server/docker.d.ts +7 -7
- package/lib/types/server/extract.d.ts +2 -2
- package/lib/types/server/index.d.ts +2 -2
- package/lib/types/server/loaders/babel/creevey-plugin.d.ts +1 -1
- package/lib/types/server/loaders/babel/helpers.d.ts +19 -19
- package/lib/types/server/loaders/babel/register.d.ts +5 -5
- package/lib/types/server/loaders/hooks/mdx.d.ts +1 -1
- package/lib/types/server/loaders/hooks/svelte.d.ts +1 -1
- package/lib/types/server/loaders/webpack/compile.d.ts +2 -2
- package/lib/types/server/loaders/webpack/creevey-loader.d.ts +2 -2
- package/lib/types/server/loaders/webpack/dummy-hmr.d.ts +10 -10
- package/lib/types/server/loaders/webpack/mdx-loader.d.ts +6 -6
- package/lib/types/server/loaders/webpack/start.d.ts +1 -1
- package/lib/types/server/logger.d.ts +6 -6
- package/lib/types/server/master/api.d.ts +7 -7
- package/lib/types/server/master/index.d.ts +3 -3
- package/lib/types/server/master/master.d.ts +7 -6
- package/lib/types/server/master/pool.d.ts +31 -30
- package/lib/types/server/master/runner.d.ts +26 -26
- package/lib/types/server/master/server.d.ts +2 -2
- package/lib/types/server/messages.d.ts +27 -18
- package/lib/types/server/selenium/browser.d.ts +17 -14
- package/lib/types/server/selenium/index.d.ts +2 -2
- package/lib/types/server/selenium/selenoid.d.ts +3 -3
- package/lib/types/server/stories.d.ts +8 -8
- package/lib/types/server/storybook/entry.d.ts +18 -18
- package/lib/types/server/storybook/helpers.d.ts +24 -24
- package/lib/types/server/storybook/providers/browser.d.ts +4 -0
- package/lib/types/server/storybook/providers/hybrid.d.ts +4 -0
- package/lib/types/server/storybook/providers/nodejs.d.ts +9 -0
- package/lib/types/server/testsFiles/parser.d.ts +12 -0
- package/lib/types/server/testsFiles/register.d.ts +2 -0
- package/lib/types/server/update.d.ts +2 -2
- package/lib/types/server/utils.d.ts +20 -19
- package/lib/types/server/worker/chai-image.d.ts +6 -6
- package/lib/types/server/worker/helpers.d.ts +8 -7
- package/lib/types/server/worker/index.d.ts +1 -1
- package/lib/types/server/worker/reporter.d.ts +8 -8
- package/lib/types/server/worker/worker.d.ts +4 -4
- package/lib/types/shared.d.ts +16 -4
- package/lib/types/types.d.ts +489 -459
- package/package.json +16 -7
- package/storybook-static/stories.json +21 -0
- package/types/mocha.d.ts +1 -0
- package/lib/cjs/cli.js +0 -5
- package/lib/cjs/client/addon/Manager.js +0 -413
- package/lib/cjs/client/addon/components/Addon.js +0 -76
- package/lib/cjs/client/addon/components/Icons.js +0 -42
- package/lib/cjs/client/addon/components/Panel.js +0 -68
- package/lib/cjs/client/addon/components/TestSelect.js +0 -63
- package/lib/cjs/client/addon/components/Tools.js +0 -114
- package/lib/cjs/client/addon/decorator.js +0 -11
- package/lib/cjs/client/addon/preset.js +0 -80
- package/lib/cjs/client/addon/register.js +0 -96
- package/lib/cjs/client/addon/utils.js +0 -38
- package/lib/cjs/client/addon/withCreevey.js +0 -284
- package/lib/cjs/client/shared/components/ImagesView/BlendView.js +0 -85
- package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +0 -88
- package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +0 -176
- package/lib/cjs/client/shared/components/ImagesView/SlideView.js +0 -178
- package/lib/cjs/client/shared/components/ImagesView/SwapView.js +0 -110
- package/lib/cjs/client/shared/components/ImagesView/index.js +0 -45
- package/lib/cjs/client/shared/components/PageFooter/PageFooter.js +0 -46
- package/lib/cjs/client/shared/components/PageFooter/Paging.js +0 -98
- package/lib/cjs/client/shared/components/PageHeader/ImagePreview.js +0 -78
- package/lib/cjs/client/shared/components/PageHeader/PageHeader.js +0 -144
- package/lib/cjs/client/shared/components/ResultsPage.js +0 -173
- package/lib/cjs/client/shared/creeveyClientApi.js +0 -103
- package/lib/cjs/client/shared/helpers.js +0 -482
- package/lib/cjs/client/shared/viewMode.js +0 -17
- package/lib/cjs/client/web/index.html +0 -19
- package/lib/cjs/creevey.js +0 -71
- package/lib/cjs/index.js +0 -44
- package/lib/cjs/server/config.js +0 -92
- package/lib/cjs/server/docker.js +0 -150
- package/lib/cjs/server/extract.js +0 -43
- package/lib/cjs/server/index.js +0 -85
- package/lib/cjs/server/loaders/babel/creevey-plugin.js +0 -88
- package/lib/cjs/server/loaders/babel/helpers.js +0 -479
- package/lib/cjs/server/loaders/babel/register.js +0 -126
- package/lib/cjs/server/loaders/hooks/mdx.js +0 -30
- package/lib/cjs/server/loaders/hooks/svelte.js +0 -65
- package/lib/cjs/server/loaders/webpack/compile.js +0 -286
- package/lib/cjs/server/loaders/webpack/creevey-loader.js +0 -174
- package/lib/cjs/server/loaders/webpack/dummy-hmr.js +0 -44
- package/lib/cjs/server/loaders/webpack/mdx-loader.js +0 -72
- package/lib/cjs/server/loaders/webpack/start.js +0 -41
- package/lib/cjs/server/logger.js +0 -47
- package/lib/cjs/server/master/api.js +0 -71
- package/lib/cjs/server/master/index.js +0 -152
- package/lib/cjs/server/master/master.js +0 -56
- package/lib/cjs/server/master/pool.js +0 -206
- package/lib/cjs/server/master/runner.js +0 -294
- package/lib/cjs/server/master/server.js +0 -57
- package/lib/cjs/server/messages.js +0 -154
- package/lib/cjs/server/selenium/browser.js +0 -582
- package/lib/cjs/server/selenium/index.js +0 -31
- package/lib/cjs/server/selenium/selenoid.js +0 -174
- package/lib/cjs/server/stories.js +0 -167
- package/lib/cjs/server/storybook/entry.js +0 -68
- package/lib/cjs/server/storybook/helpers.js +0 -165
- package/lib/cjs/server/storybook/nodejs-provider.js +0 -220
- package/lib/cjs/server/update.js +0 -83
- package/lib/cjs/server/utils.js +0 -178
- package/lib/cjs/server/worker/chai-image.js +0 -142
- package/lib/cjs/server/worker/helpers.js +0 -73
- package/lib/cjs/server/worker/index.js +0 -15
- package/lib/cjs/server/worker/reporter.js +0 -120
- package/lib/cjs/server/worker/worker.js +0 -266
- package/lib/cjs/shared.js +0 -35
- package/lib/cjs/types.js +0 -69
- package/lib/esm/cli.js +0 -4
- package/lib/esm/client/addon/Manager.js +0 -397
- package/lib/esm/client/addon/components/Addon.js +0 -58
- package/lib/esm/client/addon/components/Icons.js +0 -27
- package/lib/esm/client/addon/components/Panel.js +0 -49
- package/lib/esm/client/addon/components/TestSelect.js +0 -49
- package/lib/esm/client/addon/components/Tools.js +0 -91
- package/lib/esm/client/addon/decorator.js +0 -2
- package/lib/esm/client/addon/preset.js +0 -55
- package/lib/esm/client/addon/register.js +0 -75
- package/lib/esm/client/addon/utils.js +0 -31
- package/lib/esm/client/addon/withCreevey.js +0 -270
- package/lib/esm/client/shared/components/ImagesView/BlendView.js +0 -64
- package/lib/esm/client/shared/components/ImagesView/ImagesView.js +0 -65
- package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +0 -152
- package/lib/esm/client/shared/components/ImagesView/SlideView.js +0 -154
- package/lib/esm/client/shared/components/ImagesView/SwapView.js +0 -89
- package/lib/esm/client/shared/components/ImagesView/index.js +0 -5
- package/lib/esm/client/shared/components/PageFooter/PageFooter.js +0 -32
- package/lib/esm/client/shared/components/PageFooter/Paging.js +0 -84
- package/lib/esm/client/shared/components/PageHeader/ImagePreview.js +0 -64
- package/lib/esm/client/shared/components/PageHeader/PageHeader.js +0 -120
- package/lib/esm/client/shared/components/ResultsPage.js +0 -143
- package/lib/esm/client/shared/creeveyClientApi.js +0 -94
- package/lib/esm/client/shared/helpers.js +0 -424
- package/lib/esm/client/shared/viewMode.js +0 -6
- package/lib/esm/creevey.js +0 -56
- package/lib/esm/index.js +0 -4
- package/lib/esm/server/config.js +0 -71
- package/lib/esm/server/docker.js +0 -123
- package/lib/esm/server/extract.js +0 -30
- package/lib/esm/server/index.js +0 -65
- package/lib/esm/server/loaders/babel/creevey-plugin.js +0 -74
- package/lib/esm/server/loaders/babel/helpers.js +0 -462
- package/lib/esm/server/loaders/babel/register.js +0 -105
- package/lib/esm/server/loaders/hooks/mdx.js +0 -15
- package/lib/esm/server/loaders/hooks/svelte.js +0 -49
- package/lib/esm/server/loaders/webpack/compile.js +0 -263
- package/lib/esm/server/loaders/webpack/creevey-loader.js +0 -153
- package/lib/esm/server/loaders/webpack/dummy-hmr.js +0 -36
- package/lib/esm/server/loaders/webpack/mdx-loader.js +0 -58
- package/lib/esm/server/loaders/webpack/start.js +0 -27
- package/lib/esm/server/logger.js +0 -20
- package/lib/esm/server/master/api.js +0 -60
- package/lib/esm/server/master/index.js +0 -131
- package/lib/esm/server/master/master.js +0 -37
- package/lib/esm/server/master/pool.js +0 -187
- package/lib/esm/server/master/runner.js +0 -272
- package/lib/esm/server/master/server.js +0 -37
- package/lib/esm/server/messages.js +0 -128
- package/lib/esm/server/selenium/browser.js +0 -554
- package/lib/esm/server/selenium/index.js +0 -2
- package/lib/esm/server/selenium/selenoid.js +0 -151
- package/lib/esm/server/stories.js +0 -147
- package/lib/esm/server/storybook/entry.js +0 -44
- package/lib/esm/server/storybook/helpers.js +0 -106
- package/lib/esm/server/storybook/nodejs-provider.js +0 -200
- package/lib/esm/server/update.js +0 -65
- package/lib/esm/server/utils.js +0 -141
- package/lib/esm/server/worker/chai-image.js +0 -130
- package/lib/esm/server/worker/helpers.js +0 -64
- package/lib/esm/server/worker/index.js +0 -1
- package/lib/esm/server/worker/reporter.js +0 -98
- package/lib/esm/server/worker/worker.js +0 -236
- package/lib/esm/shared.js +0 -22
- package/lib/esm/types.js +0 -40
- package/lib/types/server/storybook/nodejs-provider.d.ts +0 -5
@@ -1,55 +0,0 @@
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
2
|
-
|
3
|
-
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."); }
|
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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
8
|
-
|
9
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
10
|
-
|
11
|
-
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; }
|
12
|
-
|
13
|
-
import path from 'path';
|
14
|
-
import { exec } from 'shelljs';
|
15
|
-
import { DefinePlugin as FallbackDefinePlugin } from 'webpack';
|
16
|
-
import { isStorybookVersionLessThan, resolveFromStorybookCore, resolveFromStorybookCoreServer } from '../../server/storybook/helpers';
|
17
|
-
export function config() {
|
18
|
-
var entry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
19
|
-
return [].concat(_toConsumableArray(entry), [require.resolve('./decorator')]);
|
20
|
-
}
|
21
|
-
export function managerEntries() {
|
22
|
-
var entry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
23
|
-
return [].concat(_toConsumableArray(entry), [require.resolve('./register')]);
|
24
|
-
}
|
25
|
-
export function managerWebpack(config, options) {
|
26
|
-
var _options$presets$appl, _options$presets;
|
27
|
-
|
28
|
-
// TODO How to execute with non-webpack bundlers
|
29
|
-
if (options.configType == 'PRODUCTION' && !isStorybookVersionLessThan(6, 2) && options.skipExtract != true) {
|
30
|
-
var args = [];
|
31
|
-
if (options.creeveyPreExtract) args.push("--require \"".concat(options.creeveyPreExtract, "\""));
|
32
|
-
args.push(path.join(__dirname, '../../cli'));
|
33
|
-
args.push("--extract \"".concat(options.outputDir, "\""));
|
34
|
-
if (options.creeveyConfigPath) args.push("--config \"".concat(options.creeveyConfigPath, "\""));
|
35
|
-
exec("node ".concat(args.join(' ')), {
|
36
|
-
async: true
|
37
|
-
});
|
38
|
-
}
|
39
|
-
|
40
|
-
return ((_options$presets$appl = (_options$presets = options.presets) === null || _options$presets === void 0 ? void 0 : _options$presets.apply('webpackInstance')) !== null && _options$presets$appl !== void 0 ? _options$presets$appl : Promise.resolve(undefined)).then(function (webpack) {
|
41
|
-
return webpack !== null && webpack !== void 0 ? webpack : import(isStorybookVersionLessThan(6, 2) ? resolveFromStorybookCore('webpack') : resolveFromStorybookCoreServer('webpack'));
|
42
|
-
}).then(function (webpack) {
|
43
|
-
var _config$plugins, _options$creeveyPort;
|
44
|
-
|
45
|
-
var _ref = webpack !== null && webpack !== void 0 ? webpack : {},
|
46
|
-
_ref$DefinePlugin = _ref.DefinePlugin,
|
47
|
-
DefinePlugin = _ref$DefinePlugin === void 0 ? FallbackDefinePlugin : _ref$DefinePlugin;
|
48
|
-
|
49
|
-
(_config$plugins = config.plugins) === null || _config$plugins === void 0 ? void 0 : _config$plugins.push(new DefinePlugin({
|
50
|
-
__CREEVEY_SERVER_PORT__: (_options$creeveyPort = options.creeveyPort) !== null && _options$creeveyPort !== void 0 ? _options$creeveyPort : 3000,
|
51
|
-
__CREEVEY_CLIENT_PORT__: options.clientPort
|
52
|
-
}));
|
53
|
-
return config;
|
54
|
-
});
|
55
|
-
}
|
@@ -1,75 +0,0 @@
|
|
1
|
-
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); } }
|
2
|
-
|
3
|
-
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); }); }; }
|
4
|
-
|
5
|
-
import { addons, types } from '@storybook/addons';
|
6
|
-
import React from 'react';
|
7
|
-
import { Addon } from './components/Addon';
|
8
|
-
import { Tools } from './components/Tools';
|
9
|
-
import { CreeveyManager } from './Manager';
|
10
|
-
export var ADDON_ID = 'creevey';
|
11
|
-
addons.register(ADDON_ID, function (api) {
|
12
|
-
void registerCreeveyPanels(api);
|
13
|
-
});
|
14
|
-
export function registerCreeveyPanels(_x) {
|
15
|
-
return _registerCreeveyPanels.apply(this, arguments);
|
16
|
-
}
|
17
|
-
|
18
|
-
function _registerCreeveyPanels() {
|
19
|
-
_registerCreeveyPanels = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(storybookApi) {
|
20
|
-
var manager, browsers;
|
21
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
22
|
-
while (1) {
|
23
|
-
switch (_context.prev = _context.next) {
|
24
|
-
case 0:
|
25
|
-
manager = new CreeveyManager(storybookApi);
|
26
|
-
addons.addPanel("".concat(ADDON_ID, "/panel/run"), {
|
27
|
-
title: "Creevey/Run",
|
28
|
-
match: function match(_ref) {
|
29
|
-
var viewMode = _ref.viewMode;
|
30
|
-
return !!(viewMode && /^story$/.exec(viewMode));
|
31
|
-
},
|
32
|
-
type: types.TOOL,
|
33
|
-
// eslint-disable-next-line react/display-name
|
34
|
-
render: function render() {
|
35
|
-
return /*#__PURE__*/React.createElement(Tools, {
|
36
|
-
manager: manager
|
37
|
-
});
|
38
|
-
}
|
39
|
-
});
|
40
|
-
_context.next = 4;
|
41
|
-
return manager.initAll();
|
42
|
-
|
43
|
-
case 4:
|
44
|
-
browsers = manager.getBrowsers();
|
45
|
-
browsers.forEach(function (browser) {
|
46
|
-
var panelId = "".concat(ADDON_ID, "/panel/").concat(browser);
|
47
|
-
var title = manager.getTabTitle(browser);
|
48
|
-
addons.addPanel(panelId, {
|
49
|
-
title: title,
|
50
|
-
type: types.PANEL,
|
51
|
-
paramKey: browser,
|
52
|
-
// NOTE key = PANEL_ID needs to correct render button in addons panel
|
53
|
-
// eslint-disable-next-line react/display-name
|
54
|
-
render: function render(_ref2) {
|
55
|
-
var active = _ref2.active,
|
56
|
-
key = _ref2.key;
|
57
|
-
return /*#__PURE__*/React.createElement(Addon, {
|
58
|
-
active: active,
|
59
|
-
key: key,
|
60
|
-
manager: manager,
|
61
|
-
browser: browser
|
62
|
-
});
|
63
|
-
}
|
64
|
-
});
|
65
|
-
});
|
66
|
-
|
67
|
-
case 6:
|
68
|
-
case "end":
|
69
|
-
return _context.stop();
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}, _callee);
|
73
|
-
}));
|
74
|
-
return _registerCreeveyPanels.apply(this, arguments);
|
75
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
export function getEmojiByTestStatus(status) {
|
2
|
-
var skip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
3
|
-
|
4
|
-
switch (status) {
|
5
|
-
case 'failed':
|
6
|
-
{
|
7
|
-
return '❌';
|
8
|
-
}
|
9
|
-
|
10
|
-
case 'success':
|
11
|
-
{
|
12
|
-
return '✔';
|
13
|
-
}
|
14
|
-
|
15
|
-
case 'running':
|
16
|
-
{
|
17
|
-
return '🟡';
|
18
|
-
}
|
19
|
-
|
20
|
-
case 'pending':
|
21
|
-
{
|
22
|
-
return '🕗';
|
23
|
-
}
|
24
|
-
|
25
|
-
default:
|
26
|
-
{
|
27
|
-
if (skip) return '⏸';
|
28
|
-
return '';
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
@@ -1,270 +0,0 @@
|
|
1
|
-
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); } }
|
2
|
-
|
3
|
-
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); }); }; }
|
4
|
-
|
5
|
-
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); }
|
6
|
-
|
7
|
-
import * as Events from '@storybook/core-events';
|
8
|
-
import * as polyfill from 'event-source-polyfill';
|
9
|
-
import { addons, makeDecorator } from '@storybook/addons';
|
10
|
-
import { isObject, noop } from '../../types';
|
11
|
-
|
12
|
-
if ((typeof process === "undefined" ? "undefined" : _typeof(process)) != 'object' || typeof process.version != 'string') {
|
13
|
-
// NOTE If you don't use babel-polyfill or any other polyfills that add EventSource for IE11
|
14
|
-
// You don't get hot reload in IE11. So put polyfill for that to better UX
|
15
|
-
// Don't load in nodejs environment
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
17
|
-
var NativeEventSource = polyfill.NativeEventSource,
|
18
|
-
EventSourcePolyfill = polyfill.EventSourcePolyfill; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
19
|
-
|
20
|
-
window.EventSource = NativeEventSource || EventSourcePolyfill;
|
21
|
-
}
|
22
|
-
|
23
|
-
var disableAnimationsStyles = "\n*,\n*:hover,\n*::before,\n*::after {\n animation-delay: -0.0001ms !important;\n animation-duration: 0s !important;\n animation-play-state: paused !important;\n cursor: none !important;\n caret-color: transparent !important;\n transition: 0s !important;\n}\n";
|
24
|
-
|
25
|
-
function resetCurrentStory(_x) {
|
26
|
-
return _resetCurrentStory.apply(this, arguments);
|
27
|
-
}
|
28
|
-
|
29
|
-
function _resetCurrentStory() {
|
30
|
-
_resetCurrentStory = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(channel) {
|
31
|
-
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
32
|
-
while (1) {
|
33
|
-
switch (_context3.prev = _context3.next) {
|
34
|
-
case 0:
|
35
|
-
setTimeout(function () {
|
36
|
-
return channel.emit(Events.SET_CURRENT_STORY, {
|
37
|
-
storyId: true,
|
38
|
-
name: '',
|
39
|
-
kind: ''
|
40
|
-
});
|
41
|
-
}, 0);
|
42
|
-
return _context3.abrupt("return", new Promise(function (resolve) {
|
43
|
-
return channel.once(Events.STORY_MISSING, resolve);
|
44
|
-
}));
|
45
|
-
|
46
|
-
case 2:
|
47
|
-
case "end":
|
48
|
-
return _context3.stop();
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}, _callee3);
|
52
|
-
}));
|
53
|
-
return _resetCurrentStory.apply(this, arguments);
|
54
|
-
}
|
55
|
-
|
56
|
-
function catchRenderError(channel) {
|
57
|
-
var rejectCallback;
|
58
|
-
var promise = new Promise(function (_resolve, reject) {
|
59
|
-
return rejectCallback = reject;
|
60
|
-
});
|
61
|
-
|
62
|
-
function errorHandler(_ref) {
|
63
|
-
var title = _ref.title,
|
64
|
-
description = _ref.description;
|
65
|
-
rejectCallback({
|
66
|
-
message: title,
|
67
|
-
stack: description
|
68
|
-
});
|
69
|
-
}
|
70
|
-
|
71
|
-
function exceptionHandler(exception) {
|
72
|
-
rejectCallback(exception);
|
73
|
-
}
|
74
|
-
|
75
|
-
function removeHandlers() {
|
76
|
-
channel.off(Events.STORY_ERRORED, errorHandler);
|
77
|
-
channel.off(Events.STORY_THREW_EXCEPTION, errorHandler);
|
78
|
-
}
|
79
|
-
|
80
|
-
channel.once(Events.STORY_ERRORED, errorHandler);
|
81
|
-
channel.once(Events.STORY_THREW_EXCEPTION, exceptionHandler);
|
82
|
-
return Object.assign(promise, {
|
83
|
-
cancel: removeHandlers
|
84
|
-
});
|
85
|
-
}
|
86
|
-
|
87
|
-
function waitForStoryRendered(channel) {
|
88
|
-
var resolveCallback;
|
89
|
-
var promise = new Promise(function (resolve) {
|
90
|
-
return resolveCallback = resolve;
|
91
|
-
});
|
92
|
-
|
93
|
-
function renderHandler() {
|
94
|
-
resolveCallback();
|
95
|
-
}
|
96
|
-
|
97
|
-
function removeHandlers() {
|
98
|
-
channel.off(Events.STORY_RENDERED, renderHandler);
|
99
|
-
}
|
100
|
-
|
101
|
-
channel.once(Events.STORY_RENDERED, renderHandler);
|
102
|
-
return Object.assign(promise, {
|
103
|
-
cancel: removeHandlers
|
104
|
-
});
|
105
|
-
}
|
106
|
-
|
107
|
-
function waitForFontsLoaded() {
|
108
|
-
if (!document.fonts) return;
|
109
|
-
var areFontsLoading = Array.from(document.fonts).some(function (font) {
|
110
|
-
return font.status == 'loading';
|
111
|
-
});
|
112
|
-
|
113
|
-
if (areFontsLoading) {
|
114
|
-
return new Promise(function (resolve) {
|
115
|
-
var fontsLoadedHandler = function fontsLoadedHandler() {
|
116
|
-
document.fonts.removeEventListener('loadingdone', fontsLoadedHandler);
|
117
|
-
resolve();
|
118
|
-
};
|
119
|
-
|
120
|
-
document.fonts.addEventListener('loadingdone', fontsLoadedHandler);
|
121
|
-
});
|
122
|
-
}
|
123
|
-
}
|
124
|
-
|
125
|
-
export function withCreevey() {
|
126
|
-
var currentStory = '';
|
127
|
-
var isAnimationDisabled = false;
|
128
|
-
|
129
|
-
function disableAnimation() {
|
130
|
-
isAnimationDisabled = true;
|
131
|
-
var style = document.createElement('style');
|
132
|
-
var textNode = document.createTextNode(disableAnimationsStyles);
|
133
|
-
style.setAttribute('type', 'text/css');
|
134
|
-
style.appendChild(textNode);
|
135
|
-
document.head.appendChild(style);
|
136
|
-
}
|
137
|
-
|
138
|
-
function selectStory(_x2, _x3, _x4, _x5, _x6) {
|
139
|
-
return _selectStory.apply(this, arguments);
|
140
|
-
}
|
141
|
-
|
142
|
-
function _selectStory() {
|
143
|
-
_selectStory = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(storyId, kind, name, shouldWaitForReady, callback) {
|
144
|
-
var channel, waitForReady, renderPromise, errorPromise, _reason$stack, errorMessage;
|
145
|
-
|
146
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
147
|
-
while (1) {
|
148
|
-
switch (_context2.prev = _context2.next) {
|
149
|
-
case 0:
|
150
|
-
if (!isAnimationDisabled) disableAnimation();
|
151
|
-
channel = addons.getChannel();
|
152
|
-
waitForReady = shouldWaitForReady ? new Promise(function (resolve) {
|
153
|
-
return window.__CREEVEY_SET_READY_FOR_CAPTURE__ = resolve;
|
154
|
-
}) : Promise.resolve();
|
155
|
-
|
156
|
-
if (!(storyId == currentStory)) {
|
157
|
-
_context2.next = 8;
|
158
|
-
break;
|
159
|
-
}
|
160
|
-
|
161
|
-
_context2.next = 6;
|
162
|
-
return resetCurrentStory(channel);
|
163
|
-
|
164
|
-
case 6:
|
165
|
-
_context2.next = 9;
|
166
|
-
break;
|
167
|
-
|
168
|
-
case 8:
|
169
|
-
currentStory = storyId;
|
170
|
-
|
171
|
-
case 9:
|
172
|
-
renderPromise = waitForStoryRendered(channel);
|
173
|
-
errorPromise = catchRenderError(channel);
|
174
|
-
setTimeout(function () {
|
175
|
-
return channel.emit(Events.SET_CURRENT_STORY, {
|
176
|
-
storyId: storyId,
|
177
|
-
name: name,
|
178
|
-
kind: kind
|
179
|
-
});
|
180
|
-
}, 0);
|
181
|
-
_context2.prev = 12;
|
182
|
-
_context2.next = 15;
|
183
|
-
return Promise.race([_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
184
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
185
|
-
while (1) {
|
186
|
-
switch (_context.prev = _context.next) {
|
187
|
-
case 0:
|
188
|
-
_context.next = 2;
|
189
|
-
return renderPromise;
|
190
|
-
|
191
|
-
case 2:
|
192
|
-
_context.next = 4;
|
193
|
-
return waitForFontsLoaded();
|
194
|
-
|
195
|
-
case 4:
|
196
|
-
_context.next = 6;
|
197
|
-
return waitForReady;
|
198
|
-
|
199
|
-
case 6:
|
200
|
-
case "end":
|
201
|
-
return _context.stop();
|
202
|
-
}
|
203
|
-
}
|
204
|
-
}, _callee);
|
205
|
-
}))(), errorPromise]);
|
206
|
-
|
207
|
-
case 15:
|
208
|
-
callback();
|
209
|
-
_context2.next = 22;
|
210
|
-
break;
|
211
|
-
|
212
|
-
case 18:
|
213
|
-
_context2.prev = 18;
|
214
|
-
_context2.t0 = _context2["catch"](12);
|
215
|
-
// NOTE Event `STORY_THREW_EXCEPTION` triggered only in react and vue frameworks and return Error instance
|
216
|
-
// NOTE Event `STORY_ERRORED` return error-like object without `name` field
|
217
|
-
errorMessage = _context2.t0 instanceof Error ? (_reason$stack = _context2.t0.stack) !== null && _reason$stack !== void 0 ? _reason$stack : _context2.t0.message : isObject(_context2.t0) ? "".concat(_context2.t0.message, "\n ").concat(_context2.t0.stack) : _context2.t0;
|
218
|
-
callback(errorMessage);
|
219
|
-
|
220
|
-
case 22:
|
221
|
-
_context2.prev = 22;
|
222
|
-
renderPromise.cancel();
|
223
|
-
errorPromise.cancel();
|
224
|
-
return _context2.finish(22);
|
225
|
-
|
226
|
-
case 26:
|
227
|
-
case "end":
|
228
|
-
return _context2.stop();
|
229
|
-
}
|
230
|
-
}
|
231
|
-
}, _callee2, null, [[12, 18, 22, 26]]);
|
232
|
-
}));
|
233
|
-
return _selectStory.apply(this, arguments);
|
234
|
-
}
|
235
|
-
|
236
|
-
function updateGlobals(globals) {
|
237
|
-
addons.getChannel().emit(Events.UPDATE_GLOBALS, {
|
238
|
-
globals: globals
|
239
|
-
});
|
240
|
-
}
|
241
|
-
|
242
|
-
function insertIgnoreStyles(ignoreSelectors) {
|
243
|
-
var stylesElement = document.createElement('style');
|
244
|
-
stylesElement.setAttribute('type', 'text/css');
|
245
|
-
document.head.appendChild(stylesElement);
|
246
|
-
ignoreSelectors.forEach(function (selector) {
|
247
|
-
stylesElement.innerHTML += "\n ".concat(selector, " {\n background: #000 !important;\n box-shadow: none !important;\n text-shadow: none !important;\n outline: 0 !important;\n color: rgba(0,0,0,0) !important;\n }\n ").concat(selector, " *, ").concat(selector, "::before, ").concat(selector, "::after {\n visibility: hidden !important;\n }\n ");
|
248
|
-
});
|
249
|
-
return stylesElement;
|
250
|
-
}
|
251
|
-
|
252
|
-
function removeIgnoreStyles(ignoreStyles) {
|
253
|
-
var _ignoreStyles$parentN;
|
254
|
-
|
255
|
-
(_ignoreStyles$parentN = ignoreStyles.parentNode) === null || _ignoreStyles$parentN === void 0 ? void 0 : _ignoreStyles$parentN.removeChild(ignoreStyles);
|
256
|
-
}
|
257
|
-
|
258
|
-
window.__CREEVEY_SELECT_STORY__ = selectStory;
|
259
|
-
window.__CREEVEY_UPDATE_GLOBALS__ = updateGlobals;
|
260
|
-
window.__CREEVEY_INSERT_IGNORE_STYLES__ = insertIgnoreStyles;
|
261
|
-
window.__CREEVEY_REMOVE_IGNORE_STYLES__ = removeIgnoreStyles;
|
262
|
-
window.__CREEVEY_SET_READY_FOR_CAPTURE__ = noop;
|
263
|
-
return makeDecorator({
|
264
|
-
name: 'withCreevey',
|
265
|
-
parameterName: 'creevey',
|
266
|
-
wrapper: function wrapper(getStory, context) {
|
267
|
-
return getStory(context);
|
268
|
-
}
|
269
|
-
});
|
270
|
-
}
|
@@ -1,64 +0,0 @@
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
2
|
-
import { getBorderColor, themeBorderColors } from './ImagesView';
|
3
|
-
import { styled, withTheme } from '@storybook/theming';
|
4
|
-
import { useApplyScale, useCalcScale, useLoadImages } from '../../helpers';
|
5
|
-
var Container = styled.div({
|
6
|
-
position: 'relative',
|
7
|
-
display: 'flex',
|
8
|
-
filter: 'invert(100%)'
|
9
|
-
});
|
10
|
-
var ImageContainer = styled.div({
|
11
|
-
position: 'absolute',
|
12
|
-
width: '100%',
|
13
|
-
height: '100%',
|
14
|
-
display: 'flex'
|
15
|
-
});
|
16
|
-
var Image = styled.img(function (_ref) {
|
17
|
-
var borderColor = _ref.borderColor;
|
18
|
-
return {
|
19
|
-
boxSizing: 'border-box',
|
20
|
-
border: "1px solid ".concat(borderColor),
|
21
|
-
maxWidth: '100%',
|
22
|
-
filter: 'invert(100%)'
|
23
|
-
};
|
24
|
-
});
|
25
|
-
var ActualImage = styled(Image)({
|
26
|
-
mixBlendMode: 'difference'
|
27
|
-
});
|
28
|
-
var DiffImage = styled(Image)({
|
29
|
-
opacity: '0'
|
30
|
-
});
|
31
|
-
export var BlendView = withTheme(function (_ref2) {
|
32
|
-
var actual = _ref2.actual,
|
33
|
-
diff = _ref2.diff,
|
34
|
-
expect = _ref2.expect,
|
35
|
-
theme = _ref2.theme;
|
36
|
-
var expectImageRef = useRef(null);
|
37
|
-
var diffImageRef = useRef(null);
|
38
|
-
var actualImageRef = useRef(null);
|
39
|
-
var loaded = useLoadImages(expect, diff, actual);
|
40
|
-
var scale = useCalcScale(diffImageRef, loaded);
|
41
|
-
useApplyScale(expectImageRef, scale, loaded);
|
42
|
-
useApplyScale(actualImageRef, scale, loaded);
|
43
|
-
useEffect(function () {
|
44
|
-
var _window$__CREEVEY_SET, _window;
|
45
|
-
|
46
|
-
if (loaded) (_window$__CREEVEY_SET = (_window = window).__CREEVEY_SET_READY_FOR_CAPTURE__) === null || _window$__CREEVEY_SET === void 0 ? void 0 : _window$__CREEVEY_SET.call(_window);
|
47
|
-
}, [loaded]);
|
48
|
-
return /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(ImageContainer, null, /*#__PURE__*/React.createElement(Image, {
|
49
|
-
ref: expectImageRef,
|
50
|
-
borderColor: getBorderColor(theme, themeBorderColors.expect),
|
51
|
-
alt: "expect",
|
52
|
-
src: expect
|
53
|
-
})), /*#__PURE__*/React.createElement(DiffImage, {
|
54
|
-
ref: diffImageRef,
|
55
|
-
borderColor: 'transparent',
|
56
|
-
alt: "diff",
|
57
|
-
src: diff
|
58
|
-
}), /*#__PURE__*/React.createElement(ImageContainer, null, /*#__PURE__*/React.createElement(ActualImage, {
|
59
|
-
ref: actualImageRef,
|
60
|
-
borderColor: getBorderColor(theme, themeBorderColors.actual),
|
61
|
-
alt: "actual",
|
62
|
-
src: actual
|
63
|
-
})));
|
64
|
-
});
|
@@ -1,65 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { SideBySideView } from './SideBySideView';
|
3
|
-
import { SwapView } from './SwapView';
|
4
|
-
import { SlideView } from './SlideView';
|
5
|
-
import { BlendView } from './BlendView';
|
6
|
-
import { styled, withTheme } from '@storybook/theming';
|
7
|
-
export var themeBorderColors = {
|
8
|
-
actual: 'negative',
|
9
|
-
expect: 'positive',
|
10
|
-
diff: 'secondary'
|
11
|
-
};
|
12
|
-
|
13
|
-
var isColor = function isColor(theme, color) {
|
14
|
-
return color in theme.color;
|
15
|
-
};
|
16
|
-
|
17
|
-
export function getBorderColor(theme, color) {
|
18
|
-
return isColor(theme, color) ? theme.color[color] : color;
|
19
|
-
}
|
20
|
-
var views = {
|
21
|
-
'side-by-side': SideBySideView,
|
22
|
-
swap: SwapView,
|
23
|
-
slide: SlideView,
|
24
|
-
blend: BlendView
|
25
|
-
};
|
26
|
-
var Container = styled.div({
|
27
|
-
height: '100%',
|
28
|
-
display: 'flex',
|
29
|
-
textAlign: 'center',
|
30
|
-
alignItems: 'center',
|
31
|
-
justifyContent: 'center',
|
32
|
-
padding: '0 20px'
|
33
|
-
});
|
34
|
-
var ImageLink = styled.a({
|
35
|
-
lineHeight: 0
|
36
|
-
});
|
37
|
-
var ActualImage = withTheme(styled.img(function (_ref) {
|
38
|
-
var theme = _ref.theme;
|
39
|
-
return {
|
40
|
-
border: "1px solid ".concat(getBorderColor(theme, themeBorderColors.expect)),
|
41
|
-
maxWidth: '100%'
|
42
|
-
};
|
43
|
-
}));
|
44
|
-
export function ImagesView(_ref2) {
|
45
|
-
var url = _ref2.url,
|
46
|
-
image = _ref2.image,
|
47
|
-
canApprove = _ref2.canApprove,
|
48
|
-
mode = _ref2.mode;
|
49
|
-
var ViewComponent = views[mode];
|
50
|
-
var actual = image.actual,
|
51
|
-
diff = image.diff,
|
52
|
-
expect = image.expect;
|
53
|
-
return /*#__PURE__*/React.createElement(Container, null, canApprove && diff && expect ? /*#__PURE__*/React.createElement(ViewComponent, {
|
54
|
-
actual: "".concat(url, "/").concat(actual),
|
55
|
-
diff: "".concat(url, "/").concat(diff),
|
56
|
-
expect: "".concat(url, "/").concat(expect)
|
57
|
-
}) : /*#__PURE__*/React.createElement(ImageLink, {
|
58
|
-
href: "".concat(url, "/").concat(actual),
|
59
|
-
target: "_blank",
|
60
|
-
rel: "noopener noreferrer"
|
61
|
-
}, /*#__PURE__*/React.createElement(ActualImage, {
|
62
|
-
alt: "actual",
|
63
|
-
src: "".concat(url, "/").concat(actual)
|
64
|
-
})));
|
65
|
-
}
|