1 | 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); }
|
2 |
|
3 | import "core-js/modules/es.object.is.js";
|
4 | import "core-js/modules/es.object.keys.js";
|
5 | import "core-js/modules/es.object.assign.js";
|
6 | import "core-js/modules/es.symbol.js";
|
7 | import "core-js/modules/es.symbol.description.js";
|
8 | import "core-js/modules/es.object.to-string.js";
|
9 | import "core-js/modules/es.symbol.iterator.js";
|
10 | import "core-js/modules/es.string.iterator.js";
|
11 | import "core-js/modules/es.array.iterator.js";
|
12 | import "core-js/modules/web.dom-collections.iterator.js";
|
13 |
|
14 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
15 |
|
16 | import React, { useMemo } from 'react';
|
17 | import sizeMe from 'react-sizeme';
|
18 | import { Symbols } from '@storybook/components';
|
19 | import { Route } from '@storybook/router';
|
20 | import { Global, createGlobal, styled } from '@storybook/theming';
|
21 | import { Mobile } from './components/layout/mobile';
|
22 | import { Desktop } from './components/layout/desktop';
|
23 | import Sidebar from './containers/sidebar';
|
24 | import Preview from './containers/preview';
|
25 | import Panel from './containers/panel';
|
26 | import Notifications from './containers/notifications';
|
27 | import SettingsPages from './settings';
|
28 | var View = styled.div({
|
29 | position: 'fixed',
|
30 | overflow: 'hidden',
|
31 | height: '100vh',
|
32 | width: '100vw'
|
33 | });
|
34 | var App = React.memo(function (_ref) {
|
35 | var viewMode = _ref.viewMode,
|
36 | docsOnly = _ref.docsOnly,
|
37 | layout = _ref.layout,
|
38 | panelCount = _ref.panelCount,
|
39 | _ref$size = _ref.size,
|
40 | width = _ref$size.width,
|
41 | height = _ref$size.height;
|
42 | var content;
|
43 | var props = useMemo(function () {
|
44 | return {
|
45 | Sidebar: Sidebar,
|
46 | Preview: Preview,
|
47 | Panel: Panel,
|
48 | Notifications: Notifications,
|
49 | pages: [{
|
50 | key: 'settings',
|
51 | render: function render() {
|
52 | return React.createElement(SettingsPages, null);
|
53 | },
|
54 | route: function (_ref2) {
|
55 | var children = _ref2.children;
|
56 | return React.createElement(Route, {
|
57 | path: "/settings",
|
58 | startsWith: true
|
59 | }, children);
|
60 | }
|
61 | }]
|
62 | };
|
63 | }, []);
|
64 |
|
65 | if (!width || !height) {
|
66 | content = React.createElement("div", null);
|
67 | } else if (width < 600) {
|
68 | content = React.createElement(Mobile, _extends({}, props, {
|
69 | viewMode: viewMode,
|
70 | options: layout,
|
71 | docsOnly: docsOnly
|
72 | }));
|
73 | } else {
|
74 | content = React.createElement(Desktop, _extends({}, props, {
|
75 | viewMode: viewMode,
|
76 | options: layout,
|
77 | docsOnly: docsOnly,
|
78 | width: width,
|
79 | height: height,
|
80 | panelCount: panelCount
|
81 | }));
|
82 | }
|
83 |
|
84 | return React.createElement(View, null, React.createElement(Global, {
|
85 | styles: createGlobal
|
86 | }), React.createElement(Symbols, {
|
87 | icons: ['folder', 'component', 'document', 'bookmarkhollow']
|
88 | }), content);
|
89 | },
|
90 | function (prevProps, nextProps) {
|
91 | if (Object.is(prevProps, nextProps)) return true;
|
92 | if (_typeof(prevProps) !== 'object' || prevProps === null) return false;
|
93 | if (_typeof(nextProps) !== 'object' || nextProps === null) return false;
|
94 | var keysA = Object.keys(prevProps);
|
95 | var keysB = Object.keys(nextProps);
|
96 | if (keysA.length !== keysB.length) return false;
|
97 |
|
98 | for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) {
|
99 | var key = _keysA[_i];
|
100 |
|
101 | if (key === 'size') {
|
102 |
|
103 |
|
104 | if (prevProps[key].width !== nextProps[key].width) return false;
|
105 | if (prevProps[key].height !== nextProps[key].height) return false;
|
106 | } else {
|
107 | if (!Object.prototype.hasOwnProperty.call(nextProps, key)) return false;
|
108 | if (!Object.is(prevProps[key], nextProps[key])) return false;
|
109 | }
|
110 | }
|
111 |
|
112 | return true;
|
113 | });
|
114 | var SizedApp = sizeMe({
|
115 | monitorHeight: true
|
116 | })(App);
|
117 | App.displayName = 'App';
|
118 | export default SizedApp; |
\ | No newline at end of file |