creevey 0.9.0-beta.2 → 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.
- package/AUTHORS +15 -15
- package/CHANGELOG.md +1275 -1275
- package/LICENSE +21 -21
- package/README.md +7 -0
- package/addon/README.md +3 -0
- package/addon/package.json +4 -0
- package/docs/config.md +212 -212
- package/docs/grid.md +10 -10
- package/docs/tests.md +63 -63
- package/jest.config.js +6 -0
- package/lib/cjs/client/addon/Manager.js +123 -271
- package/lib/cjs/client/addon/components/Addon.js +17 -38
- package/lib/cjs/client/addon/components/Icons.js +12 -8
- package/lib/cjs/client/addon/components/Panel.js +17 -13
- package/lib/cjs/client/addon/components/TestSelect.js +11 -9
- package/lib/cjs/client/addon/components/Tools.js +21 -40
- package/lib/cjs/client/addon/decorator.js +1 -1
- package/lib/cjs/client/addon/index.js +31 -0
- package/lib/cjs/client/addon/preset.js +13 -32
- package/lib/cjs/client/addon/register.js +46 -70
- package/lib/cjs/client/addon/utils.js +1 -1
- package/lib/cjs/client/addon/withCreevey.js +164 -344
- package/lib/cjs/client/shared/components/ImagesView/BlendView.js +23 -21
- package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +22 -18
- package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +42 -64
- package/lib/cjs/client/shared/components/ImagesView/SlideView.js +35 -48
- package/lib/cjs/client/shared/components/ImagesView/SwapView.js +24 -43
- package/lib/cjs/client/shared/components/ImagesView/index.js +9 -9
- package/lib/cjs/client/shared/components/PageFooter/PageFooter.js +12 -8
- package/lib/cjs/client/shared/components/PageFooter/Paging.js +14 -18
- package/lib/cjs/client/shared/components/PageHeader/ImagePreview.js +22 -18
- package/lib/cjs/client/shared/components/PageHeader/PageHeader.js +42 -67
- package/lib/cjs/client/shared/components/ResultsPage.js +39 -69
- package/lib/cjs/client/shared/creeveyClientApi.js +55 -82
- package/lib/cjs/client/shared/helpers.js +143 -214
- package/lib/cjs/client/shared/viewMode.js +5 -5
- package/lib/cjs/client/web/142.js +2 -0
- package/lib/cjs/client/web/142.js.LICENSE.txt +12 -0
- package/lib/cjs/client/web/32.js +1 -0
- package/lib/cjs/client/web/551.js +1 -0
- package/lib/cjs/client/web/566.js +2 -0
- package/lib/cjs/client/web/566.js.LICENSE.txt +31 -0
- package/lib/cjs/client/web/691.js +2 -0
- package/lib/cjs/client/web/691.js.LICENSE.txt +8 -0
- package/lib/cjs/client/web/725.js +1 -0
- package/lib/cjs/client/web/index.html +19 -19
- package/lib/cjs/client/web/main.js +2 -38
- package/lib/cjs/client/web/main.js.LICENSE.txt +49 -0
- package/lib/cjs/creevey.js +3 -5
- package/lib/cjs/index.js +4 -4
- package/lib/cjs/server/config.js +1 -1
- package/lib/cjs/server/docker.js +3 -7
- package/lib/cjs/server/index.js +1 -1
- package/lib/cjs/server/loaders/babel/creevey-plugin.js +1 -3
- package/lib/cjs/server/loaders/babel/helpers.js +13 -23
- package/lib/cjs/server/loaders/babel/register.js +1 -3
- package/lib/cjs/server/loaders/webpack/compile.js +31 -24
- package/lib/cjs/server/loaders/webpack/creevey-loader.js +10 -5
- package/lib/cjs/server/loaders/webpack/dummy-hmr.js +2 -7
- package/lib/cjs/server/loaders/webpack/mdx-loader.js +1 -1
- package/lib/cjs/server/loaders/webpack/start.js +1 -1
- package/lib/cjs/server/logger.js +2 -1
- package/lib/cjs/server/master/index.js +2 -2
- package/lib/cjs/server/master/pool.js +9 -18
- package/lib/cjs/server/master/runner.js +53 -66
- package/lib/cjs/server/master/server.js +2 -2
- package/lib/cjs/server/messages.js +8 -10
- package/lib/cjs/server/selenium/browser.js +23 -31
- package/lib/cjs/server/selenium/selenoid.js +5 -7
- package/lib/cjs/server/stories.js +9 -20
- package/lib/cjs/server/storybook/entry.js +5 -3
- package/lib/cjs/server/storybook/helpers.js +15 -21
- package/lib/cjs/server/storybook/providers/browser.js +5 -9
- package/lib/cjs/server/storybook/providers/nodejs.js +4 -4
- package/lib/cjs/server/update.js +1 -5
- package/lib/cjs/server/utils.js +13 -15
- package/lib/cjs/server/worker/reporter.js +8 -20
- package/lib/cjs/server/worker/worker.js +6 -16
- package/lib/cjs/shared/index.js +101 -0
- package/lib/cjs/shared/serializeRegExp.js +42 -0
- package/lib/cjs/types.js +6 -6
- package/lib/esm/client/addon/Manager.js +123 -271
- package/lib/esm/client/addon/components/Addon.js +15 -34
- package/lib/esm/client/addon/components/Icons.js +11 -7
- package/lib/esm/client/addon/components/Panel.js +17 -13
- package/lib/esm/client/addon/components/TestSelect.js +11 -9
- package/lib/esm/client/addon/components/Tools.js +19 -36
- package/lib/esm/client/addon/decorator.js +1 -1
- package/lib/esm/client/addon/index.js +2 -0
- package/lib/esm/client/addon/preset.js +10 -25
- package/lib/esm/client/addon/register.js +42 -66
- package/lib/esm/client/addon/utils.js +1 -1
- package/lib/esm/client/addon/withCreevey.js +157 -341
- package/lib/esm/client/shared/components/ImagesView/BlendView.js +21 -17
- package/lib/esm/client/shared/components/ImagesView/ImagesView.js +21 -17
- package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +40 -60
- package/lib/esm/client/shared/components/ImagesView/SlideView.js +33 -44
- package/lib/esm/client/shared/components/ImagesView/SwapView.js +22 -39
- package/lib/esm/client/shared/components/PageFooter/PageFooter.js +12 -8
- package/lib/esm/client/shared/components/PageFooter/Paging.js +14 -18
- package/lib/esm/client/shared/components/PageHeader/ImagePreview.js +22 -18
- package/lib/esm/client/shared/components/PageHeader/PageHeader.js +37 -60
- package/lib/esm/client/shared/components/ResultsPage.js +36 -64
- package/lib/esm/client/shared/creeveyClientApi.js +57 -84
- package/lib/esm/client/shared/helpers.js +127 -198
- package/lib/esm/client/shared/viewMode.js +4 -4
- package/lib/esm/creevey.js +3 -5
- package/lib/esm/index.js +1 -3
- package/lib/esm/server/docker.js +2 -2
- package/lib/esm/server/index.js +1 -1
- package/lib/esm/server/loaders/babel/creevey-plugin.js +1 -3
- package/lib/esm/server/loaders/babel/helpers.js +12 -22
- package/lib/esm/server/loaders/babel/register.js +1 -3
- package/lib/esm/server/loaders/webpack/compile.js +31 -24
- package/lib/esm/server/loaders/webpack/creevey-loader.js +9 -4
- package/lib/esm/server/loaders/webpack/dummy-hmr.js +2 -6
- package/lib/esm/server/loaders/webpack/start.js +1 -1
- package/lib/esm/server/master/index.js +2 -2
- package/lib/esm/server/master/pool.js +7 -18
- package/lib/esm/server/master/runner.js +53 -66
- package/lib/esm/server/master/server.js +2 -2
- package/lib/esm/server/messages.js +3 -5
- package/lib/esm/server/selenium/browser.js +20 -28
- package/lib/esm/server/selenium/selenoid.js +4 -6
- package/lib/esm/server/stories.js +9 -20
- package/lib/esm/server/storybook/entry.js +4 -2
- package/lib/esm/server/storybook/helpers.js +7 -15
- package/lib/esm/server/storybook/providers/browser.js +4 -5
- package/lib/esm/server/storybook/providers/nodejs.js +3 -3
- package/lib/esm/server/update.js +1 -5
- package/lib/esm/server/utils.js +5 -9
- package/lib/esm/server/worker/reporter.js +8 -20
- package/lib/esm/server/worker/worker.js +6 -16
- package/lib/esm/shared/index.js +78 -0
- package/lib/esm/shared/serializeRegExp.js +24 -0
- 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 +8 -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/index.d.ts +2 -0
- package/lib/types/client/addon/preset.d.ts +23 -24
- package/lib/types/client/addon/readyForCapture.d.ts +6 -6
- 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 -24
- package/lib/types/client/shared/components/ImagesView/BlendView.d.ts +3 -3
- package/lib/types/client/shared/components/ImagesView/ImagesView.d.ts +24 -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 +8 -9
- package/lib/types/client/shared/components/PageFooter/Paging.d.ts +7 -8
- package/lib/types/client/shared/components/PageHeader/ImagePreview.d.ts +12 -12
- package/lib/types/client/shared/components/PageHeader/PageHeader.d.ts +16 -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 +11 -12
- package/lib/types/client/web/CreeveyContext.d.ts +11 -11
- package/lib/types/client/web/CreeveyLoader.d.ts +2 -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 +12 -13
- package/lib/types/client/web/CreeveyView/SideBar/SuiteLink.d.ts +33 -33
- package/lib/types/client/web/CreeveyView/SideBar/TestLink.d.ts +7 -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 +0 -1
- 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 +4 -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 +10 -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 -7
- package/lib/types/server/master/pool.d.ts +31 -31
- 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 -27
- package/lib/types/server/selenium/browser.d.ts +17 -17
- 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 -4
- package/lib/types/server/storybook/providers/hybrid.d.ts +4 -4
- package/lib/types/server/storybook/providers/nodejs.d.ts +9 -9
- package/lib/types/server/testsFiles/parser.d.ts +12 -12
- package/lib/types/server/testsFiles/register.d.ts +2 -2
- package/lib/types/server/update.d.ts +2 -2
- package/lib/types/server/utils.d.ts +20 -20
- package/lib/types/server/worker/chai-image.d.ts +6 -6
- package/lib/types/server/worker/helpers.d.ts +8 -8
- 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 → shared/index.d.ts} +7 -16
- package/lib/types/shared/serializeRegExp.d.ts +9 -0
- package/lib/types/types.d.ts +490 -489
- package/package.json +115 -102
- package/preset.js +9 -9
- package/types/babel__register.d.ts +1 -1
- package/types/chai.d.ts +12 -12
- package/types/event-source-polyfill.d.ts +6 -6
- package/types/mdx.d.ts +3 -2
- package/types/mocha.d.ts +20 -20
- package/types/png.d.ts +4 -4
- package/lib/cjs/client/web/1.js +0 -13
- package/lib/cjs/client/web/2.js +0 -1
- package/lib/cjs/shared.js +0 -124
- package/lib/esm/shared.js +0 -93
- package/storybook-static/stories.json +0 -21
@@ -15,8 +15,10 @@ var _components = require("@storybook/components");
|
|
15
15
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
const Container = (0, _theming.withTheme)(_theming.styled.div(_ref => {
|
19
|
+
let {
|
20
|
+
theme
|
21
|
+
} = _ref;
|
20
22
|
return {
|
21
23
|
display: 'flex',
|
22
24
|
padding: '20px',
|
@@ -24,16 +26,18 @@ var Container = (0, _theming.withTheme)(_theming.styled.div(function (_ref) {
|
|
24
26
|
background: theme.background.content
|
25
27
|
};
|
26
28
|
}));
|
27
|
-
|
29
|
+
const StyledButton = (0, _theming.styled)(_components.Button)({
|
28
30
|
transform: 'none'
|
29
31
|
});
|
30
32
|
|
31
33
|
function PageFooter(_ref2) {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
let {
|
35
|
+
canApprove,
|
36
|
+
retriesCount,
|
37
|
+
retry,
|
38
|
+
onRetryChange,
|
39
|
+
onApprove
|
40
|
+
} = _ref2;
|
37
41
|
return /*#__PURE__*/_react.default.createElement(Container, null, /*#__PURE__*/_react.default.createElement(_Paging.Paging, {
|
38
42
|
activePage: retry,
|
39
43
|
onPageChange: onRetryChange,
|
@@ -15,13 +15,13 @@ var _theming = require("@storybook/theming");
|
|
15
15
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
17
|
|
18
|
-
|
18
|
+
const StyledButton = (0, _theming.styled)(_components.Button)({
|
19
19
|
transform: 'none',
|
20
20
|
marginLeft: '8px'
|
21
21
|
});
|
22
22
|
|
23
23
|
function Paging(props) {
|
24
|
-
|
24
|
+
const renderItem = (item, index) => {
|
25
25
|
switch (item) {
|
26
26
|
case '.':
|
27
27
|
{
|
@@ -33,13 +33,11 @@ function Paging(props) {
|
|
33
33
|
|
34
34
|
case 'forward':
|
35
35
|
{
|
36
|
-
|
36
|
+
const disabled = props.activePage === props.pagesCount;
|
37
37
|
return /*#__PURE__*/_react.default.createElement(StyledButton, {
|
38
38
|
outline: true,
|
39
39
|
disabled: disabled,
|
40
|
-
onClick: disabled ? _types.noop :
|
41
|
-
return goToPage(props.activePage + 1);
|
42
|
-
},
|
40
|
+
onClick: disabled ? _types.noop : () => goToPage(props.activePage + 1),
|
43
41
|
key: "forward"
|
44
42
|
}, /*#__PURE__*/_react.default.createElement("span", null, "Next ", /*#__PURE__*/_react.default.createElement(_components.Icons, {
|
45
43
|
icon: "arrowright"
|
@@ -52,15 +50,13 @@ function Paging(props) {
|
|
52
50
|
outline: true,
|
53
51
|
secondary: props.activePage === item,
|
54
52
|
key: item,
|
55
|
-
onClick:
|
56
|
-
return goToPage(item);
|
57
|
-
}
|
53
|
+
onClick: () => goToPage(item)
|
58
54
|
}, item);
|
59
55
|
}
|
60
56
|
}
|
61
57
|
};
|
62
58
|
|
63
|
-
|
59
|
+
const goToPage = pageNumber => {
|
64
60
|
if (1 <= pageNumber && pageNumber !== props.activePage && pageNumber <= props.pagesCount) {
|
65
61
|
props.onPageChange(pageNumber);
|
66
62
|
}
|
@@ -70,19 +66,19 @@ function Paging(props) {
|
|
70
66
|
}
|
71
67
|
|
72
68
|
function getItems(active, total) {
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
69
|
+
const result = [];
|
70
|
+
const left = Math.max(Math.min(active - 2, total - 4), 1);
|
71
|
+
const right = Math.min(Math.max(5, active + 2), total);
|
72
|
+
const hasLeftDots = left > 3;
|
73
|
+
const from = hasLeftDots ? left : 1;
|
74
|
+
const hasRightDots = right < total - 2;
|
75
|
+
const to = hasRightDots ? right : total;
|
80
76
|
|
81
77
|
if (hasLeftDots) {
|
82
78
|
result.push(1, '.');
|
83
79
|
}
|
84
80
|
|
85
|
-
for (
|
81
|
+
for (let i = from; i <= to; ++i) {
|
86
82
|
result.push(i);
|
87
83
|
}
|
88
84
|
|
@@ -11,11 +11,13 @@ var _theming = require("@storybook/theming");
|
|
11
11
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
const IMG_SIZE = 64;
|
15
|
+
const DIAG_LENGTH = (2 * (IMG_SIZE - 8) ** 2) ** (1 / 2);
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
const Button = _theming.styled.button(_ref => {
|
18
|
+
let {
|
19
|
+
borderColor
|
20
|
+
} = _ref;
|
19
21
|
return {
|
20
22
|
appearance: 'none',
|
21
23
|
background: 'none',
|
@@ -33,10 +35,12 @@ var Button = _theming.styled.button(function (_ref) {
|
|
33
35
|
};
|
34
36
|
});
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
const Image = (0, _theming.withTheme)(_theming.styled.img(_ref2 => {
|
39
|
+
let {
|
40
|
+
hasBorder,
|
41
|
+
backgroundColor,
|
42
|
+
theme
|
43
|
+
} = _ref2;
|
40
44
|
return {
|
41
45
|
maxHeight: "".concat(IMG_SIZE, "px"),
|
42
46
|
width: "".concat(IMG_SIZE, "px"),
|
@@ -53,17 +57,17 @@ var Image = (0, _theming.withTheme)(_theming.styled.img(function (_ref2) {
|
|
53
57
|
}
|
54
58
|
};
|
55
59
|
}));
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
const ImagePreview = (0, _theming.withTheme)(_ref3 => {
|
61
|
+
let {
|
62
|
+
isActive,
|
63
|
+
onClick,
|
64
|
+
imageName,
|
65
|
+
url,
|
66
|
+
theme,
|
67
|
+
error
|
68
|
+
} = _ref3;
|
63
69
|
|
64
|
-
|
65
|
-
return onClick(imageName);
|
66
|
-
};
|
70
|
+
const handleClick = () => onClick(imageName);
|
67
71
|
|
68
72
|
return /*#__PURE__*/_react.default.createElement(Button, {
|
69
73
|
onClick: handleClick,
|
@@ -1,7 +1,5 @@
|
|
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
3
|
Object.defineProperty(exports, "__esModule", {
|
6
4
|
value: true
|
7
5
|
});
|
@@ -19,28 +17,18 @@ var _ImagePreview = require("./ImagePreview");
|
|
19
17
|
|
20
18
|
var _viewMode = require("../../viewMode");
|
21
19
|
|
22
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
23
|
-
|
24
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
|
-
|
26
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
27
|
-
|
28
|
-
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."); }
|
29
|
-
|
30
|
-
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); }
|
31
|
-
|
32
|
-
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; }
|
33
|
-
|
34
|
-
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; }
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
35
21
|
|
36
|
-
function
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
37
23
|
|
38
|
-
|
24
|
+
const Container = _theming.styled.div({
|
39
25
|
margin: '24px 44px 0'
|
40
26
|
});
|
41
27
|
|
42
|
-
|
43
|
-
|
28
|
+
const ErrorContainer = (0, _theming.withTheme)(_theming.styled.div(_ref => {
|
29
|
+
let {
|
30
|
+
theme
|
31
|
+
} = _ref;
|
44
32
|
return {
|
45
33
|
marginTop: '8px',
|
46
34
|
padding: '8px',
|
@@ -62,20 +50,22 @@ var ErrorContainer = (0, _theming.withTheme)(_theming.styled.div(function (_ref)
|
|
62
50
|
};
|
63
51
|
}));
|
64
52
|
|
65
|
-
|
53
|
+
const H1 = _theming.styled.h1({
|
66
54
|
margin: 0,
|
67
55
|
marginBottom: '8px'
|
68
56
|
});
|
69
57
|
|
70
|
-
|
71
|
-
|
58
|
+
const HeaderDivider = (0, _theming.withTheme)(_theming.styled.span(_ref2 => {
|
59
|
+
let {
|
60
|
+
theme
|
61
|
+
} = _ref2;
|
72
62
|
return {
|
73
63
|
padding: '0 8px',
|
74
64
|
color: theme.color.mediumdark
|
75
65
|
};
|
76
66
|
}));
|
77
67
|
|
78
|
-
|
68
|
+
const ImagesEntriesContainer = _theming.styled.div({
|
79
69
|
display: 'flex',
|
80
70
|
margin: '16px 0 8px'
|
81
71
|
});
|
@@ -83,44 +73,31 @@ var ImagesEntriesContainer = _theming.styled.div({
|
|
83
73
|
function PageHeader(_ref3) {
|
84
74
|
var _, _imageEntires$, _images$imageName;
|
85
75
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
var handleViewModeChange = function handleViewModeChange(mode) {
|
109
|
-
return onViewModeChange(mode);
|
110
|
-
};
|
111
|
-
|
112
|
-
var error = errorMessage || imagesWithError.includes(imageName) ? ((_images$imageName = images[imageName]) === null || _images$imageName === void 0 ? void 0 : _images$imageName.error) || errorMessage : null;
|
113
|
-
return showTitle || error || imageEntires.length > 1 || showViewModes ? /*#__PURE__*/_react.default.createElement(Container, null, showTitle && /*#__PURE__*/_react.default.createElement(H1, null, title.flatMap(function (token) {
|
114
|
-
return [token, /*#__PURE__*/_react.default.createElement(HeaderDivider, {
|
115
|
-
key: token
|
116
|
-
}, "/")];
|
117
|
-
}).slice(0, -1)), error && /*#__PURE__*/_react.default.createElement(ErrorContainer, null, /*#__PURE__*/_react.default.createElement(_components.Icons, {
|
76
|
+
let {
|
77
|
+
title,
|
78
|
+
images = {},
|
79
|
+
errorMessage,
|
80
|
+
showViewModes,
|
81
|
+
showTitle,
|
82
|
+
viewMode,
|
83
|
+
imagesWithError = [],
|
84
|
+
onImageChange,
|
85
|
+
onViewModeChange
|
86
|
+
} = _ref3;
|
87
|
+
const imageEntires = Object.entries(images);
|
88
|
+
const [imageName, setImageName] = (0, _react.useState)((_ = ((_imageEntires$ = imageEntires[0]) !== null && _imageEntires$ !== void 0 ? _imageEntires$ : [])[0]) !== null && _ !== void 0 ? _ : '');
|
89
|
+
|
90
|
+
const handleImageChange = name => (setImageName(name), onImageChange(name));
|
91
|
+
|
92
|
+
const handleViewModeChange = mode => onViewModeChange(mode);
|
93
|
+
|
94
|
+
const error = errorMessage || imagesWithError.includes(imageName) ? ((_images$imageName = images[imageName]) === null || _images$imageName === void 0 ? void 0 : _images$imageName.error) || errorMessage : null;
|
95
|
+
return showTitle || error || imageEntires.length > 1 || showViewModes ? /*#__PURE__*/_react.default.createElement(Container, null, showTitle && /*#__PURE__*/_react.default.createElement(H1, null, title.flatMap(token => [token, /*#__PURE__*/_react.default.createElement(HeaderDivider, {
|
96
|
+
key: token
|
97
|
+
}, "/")]).slice(0, -1)), error && /*#__PURE__*/_react.default.createElement(ErrorContainer, null, /*#__PURE__*/_react.default.createElement(_components.Icons, {
|
118
98
|
icon: "closeAlt"
|
119
|
-
}), /*#__PURE__*/_react.default.createElement("pre", null, error)), imageEntires.length > 1 ? /*#__PURE__*/_react.default.createElement(ImagesEntriesContainer, null, imageEntires.map(
|
120
|
-
|
121
|
-
name = _ref5[0],
|
122
|
-
image = _ref5[1];
|
123
|
-
|
99
|
+
}), /*#__PURE__*/_react.default.createElement("pre", null, error)), imageEntires.length > 1 ? /*#__PURE__*/_react.default.createElement(ImagesEntriesContainer, null, imageEntires.map(_ref4 => {
|
100
|
+
let [name, image] = _ref4;
|
124
101
|
return /*#__PURE__*/_react.default.createElement(_ImagePreview.ImagePreview, {
|
125
102
|
key: name,
|
126
103
|
imageName: name,
|
@@ -134,11 +111,9 @@ function PageHeader(_ref3) {
|
|
134
111
|
actions: {
|
135
112
|
onSelect: handleViewModeChange
|
136
113
|
}
|
137
|
-
}, _viewMode.viewModes.map(
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
});
|
143
|
-
}))) : null;
|
114
|
+
}, _viewMode.viewModes.map(x => /*#__PURE__*/_react.default.createElement("div", {
|
115
|
+
key: x,
|
116
|
+
id: x,
|
117
|
+
title: x
|
118
|
+
})))) : null;
|
144
119
|
}
|
@@ -1,12 +1,10 @@
|
|
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
3
|
Object.defineProperty(exports, "__esModule", {
|
6
4
|
value: true
|
7
5
|
});
|
8
|
-
exports.ResultsPageInternal = ResultsPageInternal;
|
9
6
|
exports.ResultsPage = void 0;
|
7
|
+
exports.ResultsPageInternal = ResultsPageInternal;
|
10
8
|
|
11
9
|
var _react = _interopRequireWildcard(require("react"));
|
12
10
|
|
@@ -24,23 +22,11 @@ var _components = require("@storybook/components");
|
|
24
22
|
|
25
23
|
var _viewMode = require("../viewMode");
|
26
24
|
|
27
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
28
|
-
|
29
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
30
|
-
|
31
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
25
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
32
26
|
|
33
|
-
function
|
27
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
34
28
|
|
35
|
-
|
36
|
-
|
37
|
-
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; }
|
38
|
-
|
39
|
-
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; }
|
40
|
-
|
41
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
42
|
-
|
43
|
-
var Wrapper = _theming.styled.div({
|
29
|
+
const Wrapper = _theming.styled.div({
|
44
30
|
width: '100%',
|
45
31
|
height: '100%',
|
46
32
|
boxSizing: 'border-box',
|
@@ -48,8 +34,10 @@ var Wrapper = _theming.styled.div({
|
|
48
34
|
flexDirection: 'column'
|
49
35
|
});
|
50
36
|
|
51
|
-
|
52
|
-
|
37
|
+
const ImagesViewContainer = _theming.styled.div(_ref => {
|
38
|
+
let {
|
39
|
+
theme
|
40
|
+
} = _ref;
|
53
41
|
return {
|
54
42
|
background: theme.base == 'light' ? theme.color.mediumlight : theme.color.darker,
|
55
43
|
flexGrow: 1,
|
@@ -57,27 +45,28 @@ var ImagesViewContainer = _theming.styled.div(function (_ref) {
|
|
57
45
|
};
|
58
46
|
});
|
59
47
|
|
60
|
-
|
48
|
+
const HeaderContainer = _theming.styled.div({
|
61
49
|
position: 'sticky',
|
62
50
|
top: 0,
|
63
51
|
zIndex: 1
|
64
52
|
});
|
65
53
|
|
66
|
-
|
54
|
+
const BodyContainer = _theming.styled.div({
|
67
55
|
flexGrow: 1
|
68
56
|
});
|
69
57
|
|
70
|
-
|
58
|
+
const FooterContainer = _theming.styled.div({
|
71
59
|
position: 'sticky',
|
72
60
|
bottom: 0,
|
73
61
|
zIndex: 1
|
74
62
|
});
|
75
63
|
|
76
|
-
|
77
|
-
|
78
|
-
|
64
|
+
const Container = _theming.styled.div(_ref2 => {
|
65
|
+
let {
|
66
|
+
height = '100vh'
|
67
|
+
} = _ref2;
|
79
68
|
return {
|
80
|
-
height
|
69
|
+
height,
|
81
70
|
width: '100%',
|
82
71
|
overflowY: 'hidden',
|
83
72
|
display: 'flex',
|
@@ -88,53 +77,34 @@ var Container = _theming.styled.div(function (_ref2) {
|
|
88
77
|
function ResultsPageInternal(_ref3) {
|
89
78
|
var _results, _Object$keys$, _result$images, _result$images2;
|
90
79
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
112
|
-
imageName = _useState4[0],
|
113
|
-
setImageName = _useState4[1];
|
114
|
-
|
115
|
-
var _useState5 = (0, _react.useState)((0, _viewMode.getViewMode)()),
|
116
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
117
|
-
viewMode = _useState6[0],
|
118
|
-
setViewMode = _useState6[1];
|
119
|
-
|
120
|
-
(0, _react.useEffect)(function () {
|
121
|
-
return setRetry(results.length);
|
122
|
-
}, [results.length]);
|
123
|
-
var url = (0, _helpers.getImageUrl)(path, imageName);
|
124
|
-
var image = (_result$images2 = result.images) === null || _result$images2 === void 0 ? void 0 : _result$images2[imageName];
|
125
|
-
var canApprove = Boolean(image && approved[imageName] != retry - 1 && result.status != 'success');
|
126
|
-
var hasDiffAndExpect = canApprove && Boolean((image === null || image === void 0 ? void 0 : image.diff) && image.expect);
|
127
|
-
var imagesWithError = result.images ? Object.keys(result.images).filter(function (imageName) {
|
80
|
+
let {
|
81
|
+
id,
|
82
|
+
path,
|
83
|
+
results = [],
|
84
|
+
approved = {},
|
85
|
+
theme,
|
86
|
+
onImageApprove,
|
87
|
+
showTitle = false,
|
88
|
+
height
|
89
|
+
} = _ref3;
|
90
|
+
const [retry, setRetry] = (0, _react.useState)(results.length);
|
91
|
+
const result = (_results = results[retry - 1]) !== null && _results !== void 0 ? _results : {};
|
92
|
+
const [imageName, setImageName] = (0, _react.useState)((_Object$keys$ = Object.keys((_result$images = result.images) !== null && _result$images !== void 0 ? _result$images : {})[0]) !== null && _Object$keys$ !== void 0 ? _Object$keys$ : '');
|
93
|
+
const [viewMode, setViewMode] = (0, _react.useState)((0, _viewMode.getViewMode)());
|
94
|
+
(0, _react.useEffect)(() => setRetry(results.length), [results.length]);
|
95
|
+
const url = (0, _helpers.getImageUrl)(path, imageName);
|
96
|
+
const image = (_result$images2 = result.images) === null || _result$images2 === void 0 ? void 0 : _result$images2[imageName];
|
97
|
+
const canApprove = Boolean(image && approved[imageName] != retry - 1 && result.status != 'success');
|
98
|
+
const hasDiffAndExpect = canApprove && Boolean((image === null || image === void 0 ? void 0 : image.diff) && image.expect);
|
99
|
+
const imagesWithError = result.images ? Object.keys(result.images).filter(imageName => {
|
128
100
|
var _imageName;
|
129
101
|
|
130
102
|
return result.status != 'success' && approved[imageName] != retry - 1 && ((_imageName = (result.images || {})[imageName]) === null || _imageName === void 0 ? void 0 : _imageName.error) != null;
|
131
103
|
}) : [];
|
132
104
|
|
133
|
-
|
134
|
-
return onImageApprove(id, retry - 1, imageName);
|
135
|
-
};
|
105
|
+
const handleApprove = () => onImageApprove(id, retry - 1, imageName);
|
136
106
|
|
137
|
-
|
107
|
+
const handleChangeViewMode = mode => {
|
138
108
|
localStorage.setItem(_viewMode.VIEW_MODE_KEY, mode);
|
139
109
|
setViewMode(mode);
|
140
110
|
};
|
@@ -169,5 +139,5 @@ function ResultsPageInternal(_ref3) {
|
|
169
139
|
})) : null);
|
170
140
|
}
|
171
141
|
|
172
|
-
|
142
|
+
const ResultsPage = (0, _theming.withTheme)(ResultsPageInternal);
|
173
143
|
exports.ResultsPage = ResultsPage;
|