react-cosmos-ui 6.0.0-alpha.13 → 6.0.0-alpha.14
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/dist/{plugins/ContentOverlay/shared.d.ts → components/ContentOverlay.d.ts} +2 -4
- package/dist/{plugins/ContentOverlay/shared.js → components/ContentOverlay.js} +7 -2
- package/dist/components/DelayedLoading.d.ts +7 -0
- package/dist/components/DelayedLoading.js +12 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/playground.bundle.js +485 -482
- package/dist/playground.bundle.js.map +1 -1
- package/dist/playground.js +7 -1
- package/dist/plugins/FixtureSearch/FixtureSearchHeader.d.ts +2 -2
- package/dist/plugins/FixtureSearch/FixtureSearchHeader.js +2 -2
- package/dist/plugins/FixtureSearch/index.js +2 -1
- package/dist/plugins/FixtureTree/FixtureTreeContainer.d.ts +1 -2
- package/dist/plugins/FixtureTree/FixtureTreeContainer.js +1 -3
- package/dist/plugins/FixtureTree/index.js +1 -1
- package/dist/plugins/RendererCore/index.js +8 -3
- package/dist/plugins/RendererCore/spec.d.ts +3 -1
- package/dist/plugins/RendererPreview/RendererOverlay/RendererNotResponding.js +110 -0
- package/dist/plugins/RendererPreview/RendererOverlay/RendererOverlay.d.ts +7 -0
- package/dist/plugins/RendererPreview/RendererOverlay/RendererOverlay.js +12 -0
- package/dist/plugins/RendererPreview/RendererOverlay/WaitingForRenderer.d.ts +1 -0
- package/dist/plugins/RendererPreview/RendererOverlay/WaitingForRenderer.js +28 -0
- package/dist/plugins/RendererPreview/RendererPreview.d.ts +3 -0
- package/dist/plugins/RendererPreview/RendererPreview.js +10 -4
- package/dist/plugins/RendererPreview/index.js +1 -1
- package/dist/plugins/RendererPreview/shared.d.ts +1 -3
- package/dist/plugins/ResponsivePreview/ResponsivePreview/ResponsivePreview.d.ts +1 -2
- package/dist/plugins/ResponsivePreview/ResponsivePreview/ResponsivePreview.js +2 -2
- package/dist/plugins/ResponsivePreview/index.js +2 -3
- package/dist/plugins/Root/GlobalHeader.d.ts +1 -4
- package/dist/plugins/Root/GlobalHeader.js +2 -23
- package/dist/plugins/Root/HomeOverlay/HomeOverlay.d.ts +7 -0
- package/dist/plugins/Root/HomeOverlay/HomeOverlay.js +6 -0
- package/dist/plugins/{ContentOverlay → Root/HomeOverlay}/KeyShortcut.js +2 -2
- package/dist/plugins/{ContentOverlay → Root/HomeOverlay}/NoFixtureSelected.js +5 -5
- package/dist/plugins/Root/HomeOverlay/WelcomeCosmos.js +159 -0
- package/dist/plugins/Root/HomeOverlay/welcomeDismiss.d.ts +7 -0
- package/dist/plugins/{ContentOverlay → Root/HomeOverlay}/welcomeDismiss.js +6 -4
- package/dist/plugins/Root/Root.d.ts +4 -3
- package/dist/plugins/Root/Root.js +9 -10
- package/dist/plugins/Root/index.js +5 -4
- package/dist/plugins/Root/panelOpen.js +0 -5
- package/dist/plugins/pluginEntry.d.ts +0 -1
- package/dist/plugins/pluginEntry.js +0 -1
- package/dist/style/vars.d.ts +1 -0
- package/dist/style/vars.js +1 -0
- package/dist/testHelpers/pluginMocks.d.ts +0 -2
- package/dist/testHelpers/pluginMocks.js +0 -1
- package/package.json +3 -3
- package/dist/plugins/ContentOverlay/ContentOverlay.d.ts +0 -13
- package/dist/plugins/ContentOverlay/ContentOverlay.js +0 -34
- package/dist/plugins/ContentOverlay/RendererNotResponding.js +0 -109
- package/dist/plugins/ContentOverlay/WelcomeCosmos.js +0 -158
- package/dist/plugins/ContentOverlay/cosmos.decorator.d.ts +0 -5
- package/dist/plugins/ContentOverlay/cosmos.decorator.js +0 -13
- package/dist/plugins/ContentOverlay/index.d.ts +0 -2
- package/dist/plugins/ContentOverlay/index.js +0 -19
- package/dist/plugins/ContentOverlay/spec.d.ts +0 -3
- package/dist/plugins/ContentOverlay/spec.js +0 -1
- package/dist/plugins/ContentOverlay/welcomeDismiss.d.ts +0 -7
- package/dist/plugins/RendererCore/isValidFixtureSelected.d.ts +0 -2
- package/dist/plugins/RendererCore/isValidFixtureSelected.js +0 -17
- /package/dist/plugins/{ContentOverlay → RendererPreview/RendererOverlay}/RendererNotResponding.d.ts +0 -0
- /package/dist/plugins/{ContentOverlay → Root/HomeOverlay}/KeyShortcut.d.ts +0 -0
- /package/dist/plugins/{ContentOverlay → Root/HomeOverlay}/NoFixtureSelected.d.ts +0 -0
- /package/dist/plugins/{ContentOverlay → Root/HomeOverlay}/WelcomeCosmos.d.ts +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { IllustrationContainer, NoWrap, OverlayBody, OverlayContainer, SecondaryButton, TextContainer, } from '../../../components/ContentOverlay.js';
|
|
4
|
+
import { AstronautIllustration } from '../../../components/illustrations/Astronaut.js';
|
|
5
|
+
import { screenGrey1, screenGrey3, screenGrey5, screenPrimary1, screenPrimary2, screenPrimary3, } from '../../../style/colors.js';
|
|
6
|
+
export function WelcomeCosmos({ onDismissWelcome }) {
|
|
7
|
+
return (React.createElement(OverlayContainer, { "data-testid": "welcome" },
|
|
8
|
+
React.createElement(OverlayBody, null,
|
|
9
|
+
React.createElement(TextContainer, null,
|
|
10
|
+
React.createElement(Header, null,
|
|
11
|
+
"Welcome to ",
|
|
12
|
+
React.createElement(NoWrap, null, "React Cosmos")),
|
|
13
|
+
React.createElement(List, null,
|
|
14
|
+
React.createElement("li", null,
|
|
15
|
+
React.createElement(Bullet, null),
|
|
16
|
+
React.createElement("span", null,
|
|
17
|
+
React.createElement(Link, { href: "https://github.com/react-cosmos/react-cosmos/tree/main/docs", rel: "noopener noreferrer", target: "_blank" },
|
|
18
|
+
React.createElement("strong", null, "Read the docs")),
|
|
19
|
+
' ',
|
|
20
|
+
"to get the most out of React Cosmos.",
|
|
21
|
+
React.createElement("br", null),
|
|
22
|
+
"Chat with us on",
|
|
23
|
+
' ',
|
|
24
|
+
React.createElement(Link, { href: "https://discord.gg/3X95VgfnW5", rel: "noopener noreferrer", target: "_blank" }, "Discord"),
|
|
25
|
+
". Report detailed issues on",
|
|
26
|
+
' ',
|
|
27
|
+
React.createElement(Link, { href: "https://github.com/react-cosmos/react-cosmos/issues", rel: "noopener noreferrer", target: "_blank" }, "GitHub"),
|
|
28
|
+
".")),
|
|
29
|
+
React.createElement("li", null,
|
|
30
|
+
React.createElement(Bullet, null),
|
|
31
|
+
React.createElement("span", null,
|
|
32
|
+
React.createElement(Link, { href: "https://github.com/users/skidding/sponsorship", rel: "noopener noreferrer", target: "_blank" },
|
|
33
|
+
React.createElement("strong", null, "Become a Sponsor")),
|
|
34
|
+
' ',
|
|
35
|
+
"to invest in the future of React Cosmos.",
|
|
36
|
+
React.createElement("br", null),
|
|
37
|
+
`Don't worry if you can't. `,
|
|
38
|
+
React.createElement(Highlight, null, "React Cosmos will always be free.")))),
|
|
39
|
+
React.createElement(Paragraph, null,
|
|
40
|
+
React.createElement(ActionLink, { href: "https://forms.gle/yvoie73Rfo6Zy7no7", rel: "noopener noreferrer", target: "_blank" }, "share your feedback"),
|
|
41
|
+
React.createElement(SecondaryButton, { onClick: onDismissWelcome }, "hide this screen"))),
|
|
42
|
+
React.createElement(IllustrationContainer, null,
|
|
43
|
+
React.createElement(AstronautIllustration, { title: "astronaut" })))));
|
|
44
|
+
}
|
|
45
|
+
const Header = styled.h1 `
|
|
46
|
+
position: relative;
|
|
47
|
+
margin: 0 0 64px 0;
|
|
48
|
+
color: ${screenPrimary2};
|
|
49
|
+
font-size: 30px;
|
|
50
|
+
font-weight: 700;
|
|
51
|
+
line-height: 1.2em;
|
|
52
|
+
text-transform: uppercase;
|
|
53
|
+
letter-spacing: 0.015em;
|
|
54
|
+
|
|
55
|
+
::after {
|
|
56
|
+
content: '';
|
|
57
|
+
position: absolute;
|
|
58
|
+
bottom: -12px;
|
|
59
|
+
left: 0;
|
|
60
|
+
width: 64px;
|
|
61
|
+
height: 3px;
|
|
62
|
+
background: ${screenPrimary2};
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
const Paragraph = styled.p `
|
|
66
|
+
margin: 16px 0;
|
|
67
|
+
|
|
68
|
+
:last-child {
|
|
69
|
+
margin-bottom: 0;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
const List = styled.ul `
|
|
73
|
+
margin: 0 0 48px 0;
|
|
74
|
+
padding: 0;
|
|
75
|
+
list-style: none;
|
|
76
|
+
|
|
77
|
+
li {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: row;
|
|
80
|
+
align-items: flex-start;
|
|
81
|
+
margin-bottom: 24px;
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
const Bullet = styled.span `
|
|
85
|
+
flex-shrink: 0;
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: flex-end;
|
|
89
|
+
box-sizing: border-box;
|
|
90
|
+
position: relative;
|
|
91
|
+
width: 32px;
|
|
92
|
+
height: 32px;
|
|
93
|
+
margin: 6px 16px 0 0;
|
|
94
|
+
padding: 0 0 0 0;
|
|
95
|
+
border-radius: 100%;
|
|
96
|
+
font-size: 18px;
|
|
97
|
+
font-weight: 600;
|
|
98
|
+
background: ${screenGrey5};
|
|
99
|
+
color: ${screenGrey3};
|
|
100
|
+
|
|
101
|
+
::after {
|
|
102
|
+
position: absolute;
|
|
103
|
+
content: '';
|
|
104
|
+
width: 6px;
|
|
105
|
+
height: 6px;
|
|
106
|
+
top: 13px;
|
|
107
|
+
left: 13px;
|
|
108
|
+
border-radius: 100%;
|
|
109
|
+
background: ${screenGrey3};
|
|
110
|
+
transform: rotate(0deg);
|
|
111
|
+
}
|
|
112
|
+
`;
|
|
113
|
+
const Link = styled.a `
|
|
114
|
+
color: ${screenGrey1};
|
|
115
|
+
`;
|
|
116
|
+
const Highlight = styled.span `
|
|
117
|
+
padding: 2px 4px;
|
|
118
|
+
border-radius: 2px;
|
|
119
|
+
background: rgba(255, 255, 200, 0.88);
|
|
120
|
+
color: black;
|
|
121
|
+
`;
|
|
122
|
+
const actionLinkHeight = 36;
|
|
123
|
+
const ActionLink = styled.a `
|
|
124
|
+
display: inline-block;
|
|
125
|
+
height: ${actionLinkHeight}px;
|
|
126
|
+
padding: 0 16px;
|
|
127
|
+
background: ${screenPrimary3};
|
|
128
|
+
color: #fff;
|
|
129
|
+
border-radius: 5px;
|
|
130
|
+
font-size: 12px;
|
|
131
|
+
font-weight: 700;
|
|
132
|
+
line-height: ${actionLinkHeight}px;
|
|
133
|
+
text-transform: uppercase;
|
|
134
|
+
letter-spacing: 0.1em;
|
|
135
|
+
text-decoration: none;
|
|
136
|
+
transform: translate3d(0, 0, 0);
|
|
137
|
+
animation: pulse 10s ease-out infinite;
|
|
138
|
+
outline: none;
|
|
139
|
+
|
|
140
|
+
:focus {
|
|
141
|
+
box-shadow: 0 0 0px 2px ${screenPrimary1};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
::-moz-focus-inner {
|
|
145
|
+
border: 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@keyframes pulse {
|
|
149
|
+
21.25% {
|
|
150
|
+
background: ${screenPrimary3};
|
|
151
|
+
}
|
|
152
|
+
25% {
|
|
153
|
+
background: ${screenPrimary2};
|
|
154
|
+
}
|
|
155
|
+
30% {
|
|
156
|
+
background: ${screenPrimary3};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
`;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RootContext } from '../shared.js';
|
|
2
|
+
export declare const WELCOME_DISMISS_STORAGE_KEY = "welcomeDismissedAt";
|
|
3
|
+
export declare function useWelcomeDismiss(context: RootContext): {
|
|
4
|
+
isWelcomeDismissed: () => boolean;
|
|
5
|
+
onDismissWelcome: () => void;
|
|
6
|
+
onShowWelcome: () => void;
|
|
7
|
+
};
|
|
@@ -4,13 +4,15 @@ const SHOW_AGAIN_IN = 90 * 86400 * 1000; // ~3 months
|
|
|
4
4
|
export function useWelcomeDismiss(context) {
|
|
5
5
|
const { getMethodsOf } = context;
|
|
6
6
|
const storage = getMethodsOf('storage');
|
|
7
|
-
const welcomeDismissedAt = storage.getItem(WELCOME_DISMISS_STORAGE_KEY) || 0;
|
|
8
|
-
// Show welcome screen again after a while
|
|
9
|
-
const welcomeDismissed = welcomeDismissedAt > Date.now() - SHOW_AGAIN_IN;
|
|
10
7
|
const onDismissWelcome = React.useCallback(() => storage.setItem(WELCOME_DISMISS_STORAGE_KEY, Date.now()), [storage]);
|
|
11
8
|
const onShowWelcome = React.useCallback(() => storage.setItem(WELCOME_DISMISS_STORAGE_KEY, 0), [storage]);
|
|
9
|
+
function isWelcomeDismissed() {
|
|
10
|
+
const welcomeDismissedAt = storage.getItem(WELCOME_DISMISS_STORAGE_KEY) || 0;
|
|
11
|
+
// Show welcome screen again after a while
|
|
12
|
+
return welcomeDismissedAt > Date.now() - SHOW_AGAIN_IN;
|
|
13
|
+
}
|
|
12
14
|
return {
|
|
13
|
-
|
|
15
|
+
isWelcomeDismissed,
|
|
14
16
|
onDismissWelcome,
|
|
15
17
|
onShowWelcome,
|
|
16
18
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { FixtureId, FixtureState, FlatFixtureTreeItem, StateUpdater } from 'react-cosmos-core';
|
|
2
2
|
type Props = {
|
|
3
|
-
storageCacheReady: boolean;
|
|
4
3
|
fixtureItems: FlatFixtureTreeItem[];
|
|
5
4
|
selectedFixtureId: FixtureId | null;
|
|
6
5
|
rendererConnected: boolean;
|
|
7
|
-
validFixtureSelected: boolean;
|
|
8
6
|
fixtureState: FixtureState;
|
|
9
7
|
navOpen: boolean;
|
|
10
8
|
panelOpen: boolean;
|
|
@@ -23,6 +21,9 @@ type Props = {
|
|
|
23
21
|
onFixtureStateChange: (stateUpdater: StateUpdater<FixtureState>) => void;
|
|
24
22
|
setNavWidth: (width: number) => unknown;
|
|
25
23
|
setPanelWidth: (width: number) => unknown;
|
|
24
|
+
welcomeDismissed: boolean;
|
|
25
|
+
onDismissWelcome: () => unknown;
|
|
26
|
+
onShowWelcome: () => unknown;
|
|
26
27
|
};
|
|
27
|
-
export declare function Root({
|
|
28
|
+
export declare function Root({ fixtureItems, selectedFixtureId, rendererConnected, fixtureState, navOpen, panelOpen, navWidth, panelWidth, sidePanelRowOrder, globalActionOrder, globalOrder, navRowOrder, fixtureActionOrder, rendererActionOrder, onToggleNav, onTogglePanel, onFixtureSelect, onFixtureClose, onFixtureStateChange, setNavWidth, setPanelWidth, welcomeDismissed, onDismissWelcome, onShowWelcome, }: Props): JSX.Element;
|
|
28
29
|
export {};
|
|
@@ -5,9 +5,10 @@ import { useDrag } from '../../hooks/useDrag.js';
|
|
|
5
5
|
import { NavRowSlot } from '../../slots/NavRowSlot.js';
|
|
6
6
|
import { grey32, grey8, white10 } from '../../style/colors.js';
|
|
7
7
|
import { GlobalHeader } from './GlobalHeader.js';
|
|
8
|
+
import { HomeOverlay } from './HomeOverlay/HomeOverlay.js';
|
|
8
9
|
import { RendererHeader } from './RendererHeader.js';
|
|
9
10
|
import { SidePanel } from './SidePanel.js';
|
|
10
|
-
export function Root({
|
|
11
|
+
export function Root({ fixtureItems, selectedFixtureId, rendererConnected, fixtureState, navOpen, panelOpen, navWidth, panelWidth, sidePanelRowOrder, globalActionOrder, globalOrder, navRowOrder, fixtureActionOrder, rendererActionOrder, onToggleNav, onTogglePanel, onFixtureSelect, onFixtureClose, onFixtureStateChange, setNavWidth, setPanelWidth, welcomeDismissed, onDismissWelcome, onShowWelcome, }) {
|
|
11
12
|
const navDrag = useDrag({
|
|
12
13
|
value: navWidth,
|
|
13
14
|
onChange: setNavWidth,
|
|
@@ -17,29 +18,27 @@ export function Root({ storageCacheReady, fixtureItems, selectedFixtureId, rende
|
|
|
17
18
|
reverse: true,
|
|
18
19
|
onChange: setPanelWidth,
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
-
return React.createElement(Container, null);
|
|
22
|
-
}
|
|
23
|
-
const showNav = rendererConnected && (navOpen || !validFixtureSelected);
|
|
21
|
+
const showNav = navOpen || !selectedFixtureId;
|
|
24
22
|
const dragging = navDrag.dragging || panelDrag.dragging;
|
|
25
23
|
// z-indexes are set here on purpose to show the layer hierarchy at a glance
|
|
26
24
|
return (React.createElement(Container, { dragging: dragging },
|
|
27
25
|
showNav && (React.createElement(Draggable, { style: { width: navWidth, zIndex: 2 } },
|
|
28
|
-
React.createElement(Nav, null,
|
|
26
|
+
React.createElement(Nav, null,
|
|
27
|
+
React.createElement(NavRowSlot, { slotProps: { onCloseNav: onToggleNav }, plugOrder: navRowOrder })),
|
|
29
28
|
navDrag.dragging && React.createElement(DragOverlay, null),
|
|
30
29
|
React.createElement(NavDragHandle, { ref: navDrag.dragElRef }))),
|
|
31
30
|
React.createElement(MainContainer, { key: "main", style: { zIndex: 1 } },
|
|
32
|
-
!
|
|
31
|
+
!selectedFixtureId && (React.createElement(GlobalHeader, { rendererConnected: rendererConnected, globalActionOrder: globalActionOrder })),
|
|
33
32
|
React.createElement(RendererContainer, { key: "rendererContainer" },
|
|
34
|
-
selectedFixtureId &&
|
|
33
|
+
selectedFixtureId && (React.createElement(RendererHeader, { fixtureItems: fixtureItems, fixtureId: selectedFixtureId, navOpen: navOpen, panelOpen: panelOpen, fixtureActionOrder: fixtureActionOrder, rendererActionOrder: rendererActionOrder, onOpenNav: onToggleNav, onTogglePanel: onTogglePanel, onFixtureSelect: onFixtureSelect, onClose: onFixtureClose })),
|
|
35
34
|
React.createElement(RendererBody, { key: "rendererBody" },
|
|
36
35
|
React.createElement(Slot, { name: "rendererPreview" }),
|
|
37
36
|
dragging && React.createElement(DragOverlay, null),
|
|
38
|
-
|
|
37
|
+
selectedFixtureId && panelOpen && (React.createElement(ControlPanelContainer, { style: { width: panelWidth, zIndex: 3 } },
|
|
39
38
|
React.createElement(SidePanel, { fixtureId: selectedFixtureId, fixtureState: fixtureState, sidePanelRowOrder: sidePanelRowOrder, onFixtureStateChange: onFixtureStateChange }),
|
|
40
39
|
panelDrag.dragging && React.createElement(DragOverlay, null),
|
|
41
40
|
React.createElement(PanelDragHandle, { ref: panelDrag.dragElRef })))),
|
|
42
|
-
React.createElement(
|
|
41
|
+
!selectedFixtureId && (React.createElement(HomeOverlay, { welcomeDismissed: welcomeDismissed, onDismissWelcome: onDismissWelcome, onShowWelcome: onShowWelcome })))),
|
|
43
42
|
React.createElement("div", { style: { zIndex: 4 } },
|
|
44
43
|
React.createElement(ArraySlot, { name: "global", plugOrder: globalOrder }))));
|
|
45
44
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { createFixtureTree, flattenFixtureTree } from 'react-cosmos-core';
|
|
3
3
|
import { createPlugin } from 'react-plugin';
|
|
4
|
+
import { useWelcomeDismiss } from './HomeOverlay/welcomeDismiss.js';
|
|
4
5
|
import { isNavOpen, openNav } from './navOpen.js';
|
|
5
6
|
import { getNavWidthApi } from './navWidth.js';
|
|
6
7
|
import { isPanelOpen, openPanel } from './panelOpen.js';
|
|
@@ -41,14 +42,14 @@ plug('root', ({ pluginContext }) => {
|
|
|
41
42
|
const fixtureItems = useFixtureItems(pluginContext);
|
|
42
43
|
const onToggleNav = useOpenNav(pluginContext);
|
|
43
44
|
const onTogglePanel = useOpenPanel(pluginContext);
|
|
45
|
+
const welcomeDismiss = useWelcomeDismiss(pluginContext);
|
|
44
46
|
const { storageCacheReady } = getState();
|
|
45
|
-
if (!storageCacheReady)
|
|
46
|
-
return
|
|
47
|
-
}
|
|
47
|
+
if (!storageCacheReady)
|
|
48
|
+
return null;
|
|
48
49
|
const { navWidth, setNavWidth } = getNavWidthApi(pluginContext);
|
|
49
50
|
const { panelWidth, setPanelWidth } = getPanelWidthApi(pluginContext);
|
|
50
51
|
const { sidePanelRowOrder, globalActionOrder, globalOrder, navRowOrder, fixtureActionOrder, rendererActionOrder, } = getConfig();
|
|
51
|
-
return (React.createElement(Root, {
|
|
52
|
+
return (React.createElement(Root, { fixtureItems: fixtureItems, selectedFixtureId: router.getSelectedFixtureId(), rendererConnected: rendererCore.isRendererConnected(), fixtureState: rendererCore.getFixtureState(), navOpen: isNavOpen(pluginContext), panelOpen: isPanelOpen(pluginContext), navWidth: navWidth, panelWidth: panelWidth, sidePanelRowOrder: sidePanelRowOrder, globalActionOrder: globalActionOrder, globalOrder: globalOrder, navRowOrder: navRowOrder, fixtureActionOrder: fixtureActionOrder, rendererActionOrder: rendererActionOrder, onToggleNav: onToggleNav, onTogglePanel: onTogglePanel, onFixtureSelect: router.selectFixture, onFixtureClose: router.unselectFixture, onFixtureStateChange: rendererCore.setFixtureState, setNavWidth: setNavWidth, setPanelWidth: setPanelWidth, welcomeDismissed: welcomeDismiss.isWelcomeDismissed(), onDismissWelcome: welcomeDismiss.onDismissWelcome, onShowWelcome: welcomeDismiss.onShowWelcome }));
|
|
52
53
|
});
|
|
53
54
|
export { register };
|
|
54
55
|
if (process.env.NODE_ENV !== 'test')
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
export const PANEL_OPEN_STORAGE_KEY = 'sidePanelOpen';
|
|
2
2
|
const PANEL_OPEN_DEFAULT = true;
|
|
3
3
|
export function isPanelOpen(context) {
|
|
4
|
-
const { getMethodsOf } = context;
|
|
5
|
-
const rendererCore = getMethodsOf('rendererCore');
|
|
6
|
-
if (!rendererCore.isValidFixtureSelected()) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
4
|
const storage = context.getMethodsOf('storage');
|
|
10
5
|
const open = storage.getItem(PANEL_OPEN_STORAGE_KEY);
|
|
11
6
|
return typeof open === 'boolean' ? open : PANEL_OPEN_DEFAULT;
|
package/dist/style/vars.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const fontFamily = "-apple-system, BlinkMacSystemFont, Ubuntu, 'Helvetica Neue', Helvetica, sans-serif";
|
|
2
2
|
export declare const quick = 0.32;
|
|
3
|
+
export declare const rendererBg = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='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 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E\")";
|
package/dist/style/vars.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export const fontFamily = `-apple-system, BlinkMacSystemFont, Ubuntu, 'Helvetica Neue', Helvetica, sans-serif`;
|
|
2
2
|
export const quick = 0.32;
|
|
3
|
+
export const rendererBg = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23f1f1f1' fill-opacity='0.4'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v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zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`;
|
|
@@ -38,7 +38,6 @@ export declare function getRendererCoreMethods(): {
|
|
|
38
38
|
getFixtures(): import("react-cosmos-core").FixtureList;
|
|
39
39
|
getFixtureState(): import("react-cosmos-core").FixtureState;
|
|
40
40
|
isRendererConnected(): boolean;
|
|
41
|
-
isValidFixtureSelected(): boolean;
|
|
42
41
|
setFixtureState(stateUpdater: import("react-cosmos-core").StateUpdater<import("react-cosmos-core").FixtureState>): void;
|
|
43
42
|
selectPrimaryRenderer(primaryRendererId: string): void;
|
|
44
43
|
receiveResponse(msg: import("react-cosmos-core").MessageType): void;
|
|
@@ -82,7 +81,6 @@ export declare function mockRendererCore(methods?: MethodsOf<RendererCoreSpec>):
|
|
|
82
81
|
getFixtures: jest.Mock<any, any, any> | ((context: import("react-plugin").PluginContext<RendererCoreSpec>) => import("react-cosmos-core").FixtureList);
|
|
83
82
|
getFixtureState: jest.Mock<any, any, any> | ((context: import("react-plugin").PluginContext<RendererCoreSpec>) => import("react-cosmos-core").FixtureState);
|
|
84
83
|
isRendererConnected: jest.Mock<any, any, any> | ((context: import("react-plugin").PluginContext<RendererCoreSpec>) => boolean);
|
|
85
|
-
isValidFixtureSelected: jest.Mock<any, any, any> | ((context: import("react-plugin").PluginContext<RendererCoreSpec>) => boolean);
|
|
86
84
|
setFixtureState: jest.Mock<any, any, any> | ((context: import("react-plugin").PluginContext<RendererCoreSpec>, stateUpdater: import("react-cosmos-core").StateUpdater<import("react-cosmos-core").FixtureState>) => void);
|
|
87
85
|
selectPrimaryRenderer: jest.Mock<any, any, any> | ((context: import("react-plugin").PluginContext<RendererCoreSpec>, primaryRendererId: string) => void);
|
|
88
86
|
receiveResponse: jest.Mock<any, any, any> | ((context: import("react-plugin").PluginContext<RendererCoreSpec>, msg: import("react-cosmos-core").MessageType) => void);
|
|
@@ -75,7 +75,6 @@ export function mockRendererCore(methods = {}) {
|
|
|
75
75
|
getFixtures: jest.fn(),
|
|
76
76
|
getFixtureState: jest.fn(),
|
|
77
77
|
isRendererConnected: jest.fn(),
|
|
78
|
-
isValidFixtureSelected: jest.fn(),
|
|
79
78
|
setFixtureState: jest.fn(),
|
|
80
79
|
selectPrimaryRenderer: jest.fn(),
|
|
81
80
|
receiveResponse: jest.fn(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cosmos-ui",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.14",
|
|
4
4
|
"description": "React Cosmos UI",
|
|
5
5
|
"repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos-ui",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"lodash-es": "^4.17.21",
|
|
18
|
-
"react-cosmos-core": "6.0.0-alpha.
|
|
18
|
+
"react-cosmos-core": "6.0.0-alpha.14"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"fuzzaldrin-plus": "^0.6.0",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"react-plugin": "^3.0.0-alpha.4",
|
|
24
24
|
"styled-components": "^5.3.8"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "ed13194534675df091da3ceaef4202572ddeed12"
|
|
27
27
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { RuntimeStatus, UrlStatus } from '../RendererPreview/shared.js';
|
|
2
|
-
type Props = {
|
|
3
|
-
fixtureSelected: boolean;
|
|
4
|
-
validFixtureSelected: boolean;
|
|
5
|
-
rendererConnected: boolean;
|
|
6
|
-
rendererPreviewUrlStatus: UrlStatus;
|
|
7
|
-
rendererPreviewRuntimeStatus: RuntimeStatus;
|
|
8
|
-
welcomeDismissed: boolean;
|
|
9
|
-
onDismissWelcome: () => unknown;
|
|
10
|
-
onShowWelcome: () => unknown;
|
|
11
|
-
};
|
|
12
|
-
export declare function ContentOverlay({ fixtureSelected, validFixtureSelected, rendererConnected, rendererPreviewUrlStatus, rendererPreviewRuntimeStatus, welcomeDismissed, onDismissWelcome, onShowWelcome, }: Props): JSX.Element | null;
|
|
13
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { NoFixtureSelected } from './NoFixtureSelected.js';
|
|
3
|
-
import { RendererNotResponding } from './RendererNotResponding.js';
|
|
4
|
-
import { ContentContainer, OverlayContainer } from './shared.js';
|
|
5
|
-
import { WelcomeCosmos } from './WelcomeCosmos.js';
|
|
6
|
-
export function ContentOverlay({ fixtureSelected, validFixtureSelected, rendererConnected, rendererPreviewUrlStatus, rendererPreviewRuntimeStatus, welcomeDismissed, onDismissWelcome, onShowWelcome, }) {
|
|
7
|
-
if (rendererPreviewUrlStatus === 'error') {
|
|
8
|
-
return (React.createElement(OverlayContainer, { "data-testid": "rendererNotResponding" },
|
|
9
|
-
React.createElement(RendererNotResponding, null)));
|
|
10
|
-
}
|
|
11
|
-
if (validFixtureSelected || rendererPreviewRuntimeStatus === 'error') {
|
|
12
|
-
// Usually the content overlay is only hidden when a valid fixture is
|
|
13
|
-
// selected. However, when the renderer is in error state, we also hide the
|
|
14
|
-
// content overlay to avoid showing a blank screen and to uncover the error
|
|
15
|
-
// message.
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
if (!rendererConnected) {
|
|
19
|
-
// Delay "waiting for renderer" state to avoid rapidly changing visual
|
|
20
|
-
// states when renderer is already compiled and will respond immediately
|
|
21
|
-
return (React.createElement(OverlayContainer, { "data-testid": "waiting" },
|
|
22
|
-
React.createElement(ContentContainer, null)));
|
|
23
|
-
}
|
|
24
|
-
if (fixtureSelected) {
|
|
25
|
-
return (React.createElement(OverlayContainer, { "data-testid": "notFound" },
|
|
26
|
-
React.createElement(ContentContainer, null)));
|
|
27
|
-
}
|
|
28
|
-
if (welcomeDismissed) {
|
|
29
|
-
return (React.createElement(OverlayContainer, { "data-testid": "blank" },
|
|
30
|
-
React.createElement(NoFixtureSelected, { onShowWelcome: onShowWelcome })));
|
|
31
|
-
}
|
|
32
|
-
return (React.createElement(OverlayContainer, { "data-testid": "welcome" },
|
|
33
|
-
React.createElement(WelcomeCosmos, { onDismissWelcome: onDismissWelcome })));
|
|
34
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Slot } from 'react-plugin';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { ArtificialIntelligenceIllustration } from '../../components/illustrations/ArtificialIntelligence.js';
|
|
5
|
-
import { screenGrey3, screenGrey5, screenPrimary2, screenPrimary3, } from '../../style/colors.js';
|
|
6
|
-
import { ContentContainer, IllustrationContainer, NoWrap, TextContainer, } from './shared.js';
|
|
7
|
-
export function RendererNotResponding() {
|
|
8
|
-
return (React.createElement(ContentContainer, null,
|
|
9
|
-
React.createElement(TextContainer, null,
|
|
10
|
-
React.createElement(Header, null,
|
|
11
|
-
"Renderer ",
|
|
12
|
-
React.createElement(NoWrap, null, "not responding")),
|
|
13
|
-
React.createElement(Paragraph, null, `It's usually one of the following...`),
|
|
14
|
-
React.createElement(List, null,
|
|
15
|
-
React.createElement("li", null,
|
|
16
|
-
React.createElement(No, null, "1"),
|
|
17
|
-
React.createElement("span", null,
|
|
18
|
-
React.createElement("strong", null, "Please check your terminal for errors."),
|
|
19
|
-
React.createElement("br", null),
|
|
20
|
-
"Your build might be broken.")),
|
|
21
|
-
React.createElement("li", null,
|
|
22
|
-
React.createElement(No, null, "2"),
|
|
23
|
-
React.createElement("span", null,
|
|
24
|
-
React.createElement(Slot, { name: "rendererError" },
|
|
25
|
-
"If you use a bundler plugin,",
|
|
26
|
-
' ',
|
|
27
|
-
React.createElement("strong", null,
|
|
28
|
-
"make sure",
|
|
29
|
-
React.createElement("br", null),
|
|
30
|
-
"your build is generating an index.html page."))))),
|
|
31
|
-
React.createElement(Paragraph, null,
|
|
32
|
-
React.createElement(ActionLink, { href: "https://discord.gg/3X95VgfnW5", rel: "noopener noreferrer", target: "_blank" }, "ask for help"))),
|
|
33
|
-
React.createElement(IllustrationContainer, null,
|
|
34
|
-
React.createElement(ArtificialIntelligenceIllustration, { title: "robot" }))));
|
|
35
|
-
}
|
|
36
|
-
const Header = styled.h1 `
|
|
37
|
-
position: relative;
|
|
38
|
-
margin: 0 0 64px 0;
|
|
39
|
-
color: ${screenPrimary2};
|
|
40
|
-
font-size: 30px;
|
|
41
|
-
font-weight: 700;
|
|
42
|
-
line-height: 1.2em;
|
|
43
|
-
text-transform: uppercase;
|
|
44
|
-
letter-spacing: 0.015em;
|
|
45
|
-
|
|
46
|
-
::after {
|
|
47
|
-
content: '';
|
|
48
|
-
position: absolute;
|
|
49
|
-
bottom: -12px;
|
|
50
|
-
left: 0;
|
|
51
|
-
width: 64px;
|
|
52
|
-
height: 3px;
|
|
53
|
-
background: ${screenPrimary2};
|
|
54
|
-
}
|
|
55
|
-
`;
|
|
56
|
-
const Paragraph = styled.p `
|
|
57
|
-
margin: 16px 0;
|
|
58
|
-
|
|
59
|
-
:last-child {
|
|
60
|
-
margin-bottom: 0;
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
63
|
-
const List = styled.ul `
|
|
64
|
-
margin: 0 0 48px 0;
|
|
65
|
-
padding: 0;
|
|
66
|
-
list-style: none;
|
|
67
|
-
|
|
68
|
-
li {
|
|
69
|
-
display: flex;
|
|
70
|
-
flex-direction: row;
|
|
71
|
-
align-items: flex-start;
|
|
72
|
-
margin-bottom: 12px;
|
|
73
|
-
}
|
|
74
|
-
`;
|
|
75
|
-
const No = styled.span `
|
|
76
|
-
flex-shrink: 0;
|
|
77
|
-
display: flex;
|
|
78
|
-
align-items: center;
|
|
79
|
-
justify-content: flex-end;
|
|
80
|
-
box-sizing: border-box;
|
|
81
|
-
width: 32px;
|
|
82
|
-
height: 32px;
|
|
83
|
-
margin: 6px 16px 0 0;
|
|
84
|
-
padding: 0 6px 0 0;
|
|
85
|
-
border-radius: 100%;
|
|
86
|
-
font-size: 18px;
|
|
87
|
-
font-weight: 600;
|
|
88
|
-
background: ${screenGrey5};
|
|
89
|
-
color: ${screenGrey3};
|
|
90
|
-
|
|
91
|
-
::after {
|
|
92
|
-
content: '.';
|
|
93
|
-
}
|
|
94
|
-
`;
|
|
95
|
-
const actionLinkHeight = 36;
|
|
96
|
-
const ActionLink = styled.a `
|
|
97
|
-
display: inline-block;
|
|
98
|
-
height: ${actionLinkHeight}px;
|
|
99
|
-
padding: 0 16px;
|
|
100
|
-
background: ${screenPrimary3};
|
|
101
|
-
color: #fff;
|
|
102
|
-
border-radius: 5px;
|
|
103
|
-
font-size: 12px;
|
|
104
|
-
font-weight: 700;
|
|
105
|
-
line-height: ${actionLinkHeight}px;
|
|
106
|
-
text-transform: uppercase;
|
|
107
|
-
letter-spacing: 0.1em;
|
|
108
|
-
text-decoration: none;
|
|
109
|
-
`;
|