react-cosmos-ui 6.0.0-alpha.0
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/LICENSE +21 -0
- package/dist/components/BaseSvg.d.ts +9 -0
- package/dist/components/BaseSvg.js +8 -0
- package/dist/components/Icon.d.ts +7 -0
- package/dist/components/Icon.js +5 -0
- package/dist/components/Illustration.d.ts +8 -0
- package/dist/components/Illustration.js +5 -0
- package/dist/components/KeyBox.d.ts +9 -0
- package/dist/components/KeyBox.js +28 -0
- package/dist/components/SidePanel.d.ts +10 -0
- package/dist/components/SidePanel.js +52 -0
- package/dist/components/Space.d.ts +7 -0
- package/dist/components/Space.js +8 -0
- package/dist/components/TreeView.d.ts +19 -0
- package/dist/components/TreeView.js +26 -0
- package/dist/components/ValueInputTree/ExpandCollapseValues.d.ts +9 -0
- package/dist/components/ValueInputTree/ExpandCollapseValues.js +11 -0
- package/dist/components/ValueInputTree/ValueInput/BooleanValueInput.d.ts +8 -0
- package/dist/components/ValueInputTree/ValueInput/BooleanValueInput.js +32 -0
- package/dist/components/ValueInputTree/ValueInput/NullValueInput.d.ts +5 -0
- package/dist/components/ValueInputTree/ValueInput/NullValueInput.js +9 -0
- package/dist/components/ValueInputTree/ValueInput/NumberValueInput.d.ts +8 -0
- package/dist/components/ValueInputTree/ValueInput/NumberValueInput.js +14 -0
- package/dist/components/ValueInputTree/ValueInput/StringValueInput.d.ts +8 -0
- package/dist/components/ValueInputTree/ValueInput/StringValueInput.js +18 -0
- package/dist/components/ValueInputTree/ValueInput/UndefinedValueInput.d.ts +5 -0
- package/dist/components/ValueInputTree/ValueInput/UndefinedValueInput.js +9 -0
- package/dist/components/ValueInputTree/ValueInput/UnserializableValueInput.d.ts +6 -0
- package/dist/components/ValueInputTree/ValueInput/UnserializableValueInput.js +11 -0
- package/dist/components/ValueInputTree/ValueInput/ValueInput.d.ts +11 -0
- package/dist/components/ValueInputTree/ValueInput/ValueInput.js +30 -0
- package/dist/components/ValueInputTree/ValueInput/shared.d.ts +6 -0
- package/dist/components/ValueInputTree/ValueInput/shared.js +41 -0
- package/dist/components/ValueInputTree/ValueInputDir.d.ts +9 -0
- package/dist/components/ValueInputTree/ValueInputDir.js +68 -0
- package/dist/components/ValueInputTree/ValueInputTree.d.ts +12 -0
- package/dist/components/ValueInputTree/ValueInputTree.js +32 -0
- package/dist/components/ValueInputTree/index.d.ts +4 -0
- package/dist/components/ValueInputTree/index.js +4 -0
- package/dist/components/ValueInputTree/shared.d.ts +16 -0
- package/dist/components/ValueInputTree/shared.js +15 -0
- package/dist/components/ValueInputTree/valueGroups.d.ts +8 -0
- package/dist/components/ValueInputTree/valueGroups.js +10 -0
- package/dist/components/ValueInputTree/valueTree.d.ts +3 -0
- package/dist/components/ValueInputTree/valueTree.js +20 -0
- package/dist/components/ValueInputTree/valueTreeExpansion.d.ts +7 -0
- package/dist/components/ValueInputTree/valueTreeExpansion.js +16 -0
- package/dist/components/buttons/Button32.d.ts +11 -0
- package/dist/components/buttons/Button32.js +8 -0
- package/dist/components/buttons/Button8.d.ts +11 -0
- package/dist/components/buttons/Button8.js +8 -0
- package/dist/components/buttons/IconButton32.d.ts +10 -0
- package/dist/components/buttons/IconButton32.js +7 -0
- package/dist/components/buttons/IconButton8.d.ts +10 -0
- package/dist/components/buttons/IconButton8.js +7 -0
- package/dist/components/buttons/index.d.ts +4 -0
- package/dist/components/buttons/index.js +4 -0
- package/dist/components/buttons/shared.d.ts +15 -0
- package/dist/components/buttons/shared.js +52 -0
- package/dist/components/icons/index.d.ts +33 -0
- package/dist/components/icons/index.js +107 -0
- package/dist/components/illustrations/ArtificialIntelligence.d.ts +3 -0
- package/dist/components/illustrations/ArtificialIntelligence.js +123 -0
- package/dist/components/illustrations/Astronaut.d.ts +3 -0
- package/dist/components/illustrations/Astronaut.js +72 -0
- package/dist/components/illustrations/BlankCanvas.d.ts +3 -0
- package/dist/components/illustrations/BlankCanvas.js +75 -0
- package/dist/components/inputs/NumberInput.d.ts +15 -0
- package/dist/components/inputs/NumberInput.js +79 -0
- package/dist/components/inputs/Select.d.ts +16 -0
- package/dist/components/inputs/Select.js +69 -0
- package/dist/components/inputs/shared.d.ts +14 -0
- package/dist/components/inputs/shared.js +43 -0
- package/dist/cosmos.decorator.d.ts +5 -0
- package/dist/cosmos.decorator.js +6 -0
- package/dist/cosmos.loadPlugins.d.ts +1 -0
- package/dist/cosmos.loadPlugins.js +17 -0
- package/dist/hooks/useDrag.d.ts +14 -0
- package/dist/hooks/useDrag.js +58 -0
- package/dist/hooks/useFocus.d.ts +5 -0
- package/dist/hooks/useFocus.js +7 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +36 -0
- package/dist/playground.bundle.js +1358 -0
- package/dist/playground.bundle.js.LICENSE.txt +64 -0
- package/dist/playground.bundle.js.map +1 -0
- package/dist/playground.d.ts +11 -0
- package/dist/playground.js +36 -0
- package/dist/playgroundConfig.d.ts +10 -0
- package/dist/playgroundConfig.js +1 -0
- package/dist/plugins/BuildNotifications/index.d.ts +2 -0
- package/dist/plugins/BuildNotifications/index.js +35 -0
- package/dist/plugins/BuildNotifications/spec.d.ts +3 -0
- package/dist/plugins/BuildNotifications/spec.js +1 -0
- package/dist/plugins/ClassStatePanel/ClassStatePanel/ComponentClassState.d.ts +10 -0
- package/dist/plugins/ClassStatePanel/ClassStatePanel/ComponentClassState.js +36 -0
- package/dist/plugins/ClassStatePanel/ClassStatePanel/index.d.ts +11 -0
- package/dist/plugins/ClassStatePanel/ClassStatePanel/index.js +13 -0
- package/dist/plugins/ClassStatePanel/ClassStatePanel/shared.d.ts +2 -0
- package/dist/plugins/ClassStatePanel/ClassStatePanel/shared.js +16 -0
- package/dist/plugins/ClassStatePanel/index.d.ts +2 -0
- package/dist/plugins/ClassStatePanel/index.js +30 -0
- package/dist/plugins/ClassStatePanel/shared.d.ts +1 -0
- package/dist/plugins/ClassStatePanel/shared.js +1 -0
- package/dist/plugins/ClassStatePanel/spec.d.ts +3 -0
- package/dist/plugins/ClassStatePanel/spec.js +1 -0
- package/dist/plugins/ContentOverlay/ContentOverlay.d.ts +13 -0
- package/dist/plugins/ContentOverlay/ContentOverlay.js +34 -0
- package/dist/plugins/ContentOverlay/KeyShortcut.d.ts +6 -0
- package/dist/plugins/ContentOverlay/KeyShortcut.js +30 -0
- package/dist/plugins/ContentOverlay/NoFixtureSelected.d.ts +5 -0
- package/dist/plugins/ContentOverlay/NoFixtureSelected.js +34 -0
- package/dist/plugins/ContentOverlay/RendererNotResponding.d.ts +1 -0
- package/dist/plugins/ContentOverlay/RendererNotResponding.js +109 -0
- package/dist/plugins/ContentOverlay/WelcomeCosmos.d.ts +5 -0
- package/dist/plugins/ContentOverlay/WelcomeCosmos.js +158 -0
- package/dist/plugins/ContentOverlay/cosmos.decorator.d.ts +5 -0
- package/dist/plugins/ContentOverlay/cosmos.decorator.js +13 -0
- package/dist/plugins/ContentOverlay/index.d.ts +2 -0
- package/dist/plugins/ContentOverlay/index.js +19 -0
- package/dist/plugins/ContentOverlay/shared.d.ts +9 -0
- package/dist/plugins/ContentOverlay/shared.js +75 -0
- package/dist/plugins/ContentOverlay/spec.d.ts +3 -0
- package/dist/plugins/ContentOverlay/spec.js +1 -0
- package/dist/plugins/ContentOverlay/welcomeDismiss.d.ts +7 -0
- package/dist/plugins/ContentOverlay/welcomeDismiss.js +17 -0
- package/dist/plugins/ControlPanel/ControlPanel.d.ts +8 -0
- package/dist/plugins/ControlPanel/ControlPanel.js +37 -0
- package/dist/plugins/ControlPanel/index.d.ts +2 -0
- package/dist/plugins/ControlPanel/index.js +17 -0
- package/dist/plugins/ControlPanel/spec.d.ts +6 -0
- package/dist/plugins/ControlPanel/spec.js +1 -0
- package/dist/plugins/ControlSelect/SelectValueInput.d.ts +8 -0
- package/dist/plugins/ControlSelect/SelectValueInput.js +15 -0
- package/dist/plugins/ControlSelect/index.d.ts +2 -0
- package/dist/plugins/ControlSelect/index.js +22 -0
- package/dist/plugins/ControlSelect/spec.d.ts +3 -0
- package/dist/plugins/ControlSelect/spec.js +1 -0
- package/dist/plugins/Core/index.d.ts +2 -0
- package/dist/plugins/Core/index.js +68 -0
- package/dist/plugins/Core/spec.d.ts +25 -0
- package/dist/plugins/Core/spec.js +1 -0
- package/dist/plugins/FixtureBookmark/BookmarkFixtureButton.d.ts +6 -0
- package/dist/plugins/FixtureBookmark/BookmarkFixtureButton.js +6 -0
- package/dist/plugins/FixtureBookmark/FixtureBookmarks.d.ts +10 -0
- package/dist/plugins/FixtureBookmark/FixtureBookmarks.js +123 -0
- package/dist/plugins/FixtureBookmark/index.d.ts +2 -0
- package/dist/plugins/FixtureBookmark/index.js +46 -0
- package/dist/plugins/FixtureBookmark/spec.d.ts +3 -0
- package/dist/plugins/FixtureBookmark/spec.js +1 -0
- package/dist/plugins/FixtureSearch/FixtureSearchHeader.d.ts +7 -0
- package/dist/plugins/FixtureSearch/FixtureSearchHeader.js +66 -0
- package/dist/plugins/FixtureSearch/FixtureSearchOverlay.d.ts +13 -0
- package/dist/plugins/FixtureSearch/FixtureSearchOverlay.js +312 -0
- package/dist/plugins/FixtureSearch/FixtureSearchResult.d.ts +9 -0
- package/dist/plugins/FixtureSearch/FixtureSearchResult.js +48 -0
- package/dist/plugins/FixtureSearch/FixtureSearchShortcuts.d.ts +1 -0
- package/dist/plugins/FixtureSearch/FixtureSearchShortcuts.js +60 -0
- package/dist/plugins/FixtureSearch/index.d.ts +2 -0
- package/dist/plugins/FixtureSearch/index.js +72 -0
- package/dist/plugins/FixtureSearch/spec.d.ts +7 -0
- package/dist/plugins/FixtureSearch/spec.js +1 -0
- package/dist/plugins/FixtureTree/BlankState.d.ts +8 -0
- package/dist/plugins/FixtureTree/BlankState.js +75 -0
- package/dist/plugins/FixtureTree/FixtureTree/FixtureButton.d.ts +12 -0
- package/dist/plugins/FixtureTree/FixtureTree/FixtureButton.js +16 -0
- package/dist/plugins/FixtureTree/FixtureTree/FixtureDir.d.ts +9 -0
- package/dist/plugins/FixtureTree/FixtureTree/FixtureDir.js +46 -0
- package/dist/plugins/FixtureTree/FixtureTree/FixtureLink.d.ts +9 -0
- package/dist/plugins/FixtureTree/FixtureTree/FixtureLink.js +34 -0
- package/dist/plugins/FixtureTree/FixtureTree/FixtureTree.d.ts +13 -0
- package/dist/plugins/FixtureTree/FixtureTree/FixtureTree.js +37 -0
- package/dist/plugins/FixtureTree/FixtureTree/FixtureTreeItem.d.ts +6 -0
- package/dist/plugins/FixtureTree/FixtureTree/FixtureTreeItem.js +24 -0
- package/dist/plugins/FixtureTree/FixtureTree/MultiFixtureButton.d.ts +13 -0
- package/dist/plugins/FixtureTree/FixtureTree/MultiFixtureButton.js +46 -0
- package/dist/plugins/FixtureTree/FixtureTree/MultiFixtureChildButton.d.ts +12 -0
- package/dist/plugins/FixtureTree/FixtureTree/MultiFixtureChildButton.js +26 -0
- package/dist/plugins/FixtureTree/FixtureTreeContainer.d.ts +14 -0
- package/dist/plugins/FixtureTree/FixtureTreeContainer.js +28 -0
- package/dist/plugins/FixtureTree/FixtureTreeHeader.d.ts +11 -0
- package/dist/plugins/FixtureTree/FixtureTreeHeader.js +33 -0
- package/dist/plugins/FixtureTree/index.d.ts +2 -0
- package/dist/plugins/FixtureTree/index.js +25 -0
- package/dist/plugins/FixtureTree/revealFixture.d.ts +3 -0
- package/dist/plugins/FixtureTree/revealFixture.js +48 -0
- package/dist/plugins/FixtureTree/shared.d.ts +7 -0
- package/dist/plugins/FixtureTree/shared.js +8 -0
- package/dist/plugins/FixtureTree/spec.d.ts +7 -0
- package/dist/plugins/FixtureTree/spec.js +1 -0
- package/dist/plugins/FixtureTree/useScrollToSelected.d.ts +6 -0
- package/dist/plugins/FixtureTree/useScrollToSelected.js +18 -0
- package/dist/plugins/FullScreenButton/FullScreenButton.d.ts +5 -0
- package/dist/plugins/FullScreenButton/FullScreenButton.js +6 -0
- package/dist/plugins/FullScreenButton/index.d.ts +2 -0
- package/dist/plugins/FullScreenButton/index.js +25 -0
- package/dist/plugins/FullScreenButton/spec.d.ts +3 -0
- package/dist/plugins/FullScreenButton/spec.js +1 -0
- package/dist/plugins/MessageHandler/index.d.ts +2 -0
- package/dist/plugins/MessageHandler/index.js +12 -0
- package/dist/plugins/MessageHandler/shared.d.ts +3 -0
- package/dist/plugins/MessageHandler/shared.js +1 -0
- package/dist/plugins/MessageHandler/socket.d.ts +4 -0
- package/dist/plugins/MessageHandler/socket.js +45 -0
- package/dist/plugins/MessageHandler/spec.d.ts +11 -0
- package/dist/plugins/MessageHandler/spec.js +1 -0
- package/dist/plugins/Notifications/Notifications.d.ts +6 -0
- package/dist/plugins/Notifications/Notifications.js +75 -0
- package/dist/plugins/Notifications/index.d.ts +2 -0
- package/dist/plugins/Notifications/index.js +36 -0
- package/dist/plugins/Notifications/pushNotification.d.ts +6 -0
- package/dist/plugins/Notifications/pushNotification.js +40 -0
- package/dist/plugins/Notifications/shared.d.ts +3 -0
- package/dist/plugins/Notifications/shared.js +1 -0
- package/dist/plugins/Notifications/spec.d.ts +22 -0
- package/dist/plugins/Notifications/spec.js +1 -0
- package/dist/plugins/PluginList/PluginList.d.ts +10 -0
- package/dist/plugins/PluginList/PluginList.js +38 -0
- package/dist/plugins/PluginList/index.d.ts +2 -0
- package/dist/plugins/PluginList/index.js +12 -0
- package/dist/plugins/PluginList/spec.d.ts +3 -0
- package/dist/plugins/PluginList/spec.js +1 -0
- package/dist/plugins/PropsPanel/BlankState.d.ts +3 -0
- package/dist/plugins/PropsPanel/BlankState.js +47 -0
- package/dist/plugins/PropsPanel/PropsPanel/ComponentProps.d.ts +10 -0
- package/dist/plugins/PropsPanel/PropsPanel/ComponentProps.js +40 -0
- package/dist/plugins/PropsPanel/PropsPanel/index.d.ts +11 -0
- package/dist/plugins/PropsPanel/PropsPanel/index.js +13 -0
- package/dist/plugins/PropsPanel/PropsPanel/shared.d.ts +2 -0
- package/dist/plugins/PropsPanel/PropsPanel/shared.js +16 -0
- package/dist/plugins/PropsPanel/index.d.ts +2 -0
- package/dist/plugins/PropsPanel/index.js +55 -0
- package/dist/plugins/PropsPanel/shared.d.ts +1 -0
- package/dist/plugins/PropsPanel/shared.js +1 -0
- package/dist/plugins/PropsPanel/spec.d.ts +3 -0
- package/dist/plugins/PropsPanel/spec.js +1 -0
- package/dist/plugins/RemoteRenderer/RemoteButton/copyToClipboard.d.ts +1 -0
- package/dist/plugins/RemoteRenderer/RemoteButton/copyToClipboard.js +24 -0
- package/dist/plugins/RemoteRenderer/RemoteButton/index.d.ts +8 -0
- package/dist/plugins/RemoteRenderer/RemoteButton/index.js +37 -0
- package/dist/plugins/RemoteRenderer/index.d.ts +2 -0
- package/dist/plugins/RemoteRenderer/index.js +36 -0
- package/dist/plugins/RemoteRenderer/shared.d.ts +3 -0
- package/dist/plugins/RemoteRenderer/shared.js +1 -0
- package/dist/plugins/RemoteRenderer/spec.d.ts +3 -0
- package/dist/plugins/RemoteRenderer/spec.js +1 -0
- package/dist/plugins/RendererCore/index.d.ts +2 -0
- package/dist/plugins/RendererCore/index.js +47 -0
- package/dist/plugins/RendererCore/isValidFixtureSelected.d.ts +2 -0
- package/dist/plugins/RendererCore/isValidFixtureSelected.js +16 -0
- package/dist/plugins/RendererCore/onRouterFixtureChange.d.ts +3 -0
- package/dist/plugins/RendererCore/onRouterFixtureChange.js +18 -0
- package/dist/plugins/RendererCore/receiveResponse/fixtureListUpdate.d.ts +3 -0
- package/dist/plugins/RendererCore/receiveResponse/fixtureListUpdate.js +11 -0
- package/dist/plugins/RendererCore/receiveResponse/fixtureStateChange.d.ts +3 -0
- package/dist/plugins/RendererCore/receiveResponse/fixtureStateChange.js +30 -0
- package/dist/plugins/RendererCore/receiveResponse/index.d.ts +3 -0
- package/dist/plugins/RendererCore/receiveResponse/index.js +20 -0
- package/dist/plugins/RendererCore/receiveResponse/playgroundCommand.d.ts +3 -0
- package/dist/plugins/RendererCore/receiveResponse/playgroundCommand.js +5 -0
- package/dist/plugins/RendererCore/receiveResponse/rendererReady.d.ts +3 -0
- package/dist/plugins/RendererCore/receiveResponse/rendererReady.js +49 -0
- package/dist/plugins/RendererCore/setFixtureState.d.ts +3 -0
- package/dist/plugins/RendererCore/setFixtureState.js +22 -0
- package/dist/plugins/RendererCore/shared/index.d.ts +4 -0
- package/dist/plugins/RendererCore/shared/index.js +1 -0
- package/dist/plugins/RendererCore/shared/postRequest.d.ts +5 -0
- package/dist/plugins/RendererCore/shared/postRequest.js +31 -0
- package/dist/plugins/RendererCore/shared/router.d.ts +2 -0
- package/dist/plugins/RendererCore/shared/router.js +3 -0
- package/dist/plugins/RendererCore/spec.d.ts +25 -0
- package/dist/plugins/RendererCore/spec.js +1 -0
- package/dist/plugins/RendererPreview/RendererPreview.d.ts +8 -0
- package/dist/plugins/RendererPreview/RendererPreview.js +25 -0
- package/dist/plugins/RendererPreview/checkRendererStatus.d.ts +2 -0
- package/dist/plugins/RendererPreview/checkRendererStatus.js +31 -0
- package/dist/plugins/RendererPreview/handleRendererRequests.d.ts +6 -0
- package/dist/plugins/RendererPreview/handleRendererRequests.js +76 -0
- package/dist/plugins/RendererPreview/handleWindowMessages.d.ts +2 -0
- package/dist/plugins/RendererPreview/handleWindowMessages.js +56 -0
- package/dist/plugins/RendererPreview/index.d.ts +2 -0
- package/dist/plugins/RendererPreview/index.js +49 -0
- package/dist/plugins/RendererPreview/shared.d.ts +9 -0
- package/dist/plugins/RendererPreview/shared.js +1 -0
- package/dist/plugins/RendererPreview/spec.d.ts +13 -0
- package/dist/plugins/RendererPreview/spec.js +1 -0
- package/dist/plugins/RendererSelect/index.d.ts +2 -0
- package/dist/plugins/RendererSelect/index.js +27 -0
- package/dist/plugins/RendererSelect/spec.d.ts +3 -0
- package/dist/plugins/RendererSelect/spec.js +1 -0
- package/dist/plugins/ResponsivePreview/ResponsivePreview/Header.d.ts +13 -0
- package/dist/plugins/ResponsivePreview/ResponsivePreview/Header.js +97 -0
- package/dist/plugins/ResponsivePreview/ResponsivePreview/ResponsivePreview.d.ts +14 -0
- package/dist/plugins/ResponsivePreview/ResponsivePreview/ResponsivePreview.js +152 -0
- package/dist/plugins/ResponsivePreview/ResponsivePreview/style.d.ts +45 -0
- package/dist/plugins/ResponsivePreview/ResponsivePreview/style.js +79 -0
- package/dist/plugins/ResponsivePreview/ToggleButton/index.d.ts +6 -0
- package/dist/plugins/ResponsivePreview/ToggleButton/index.js +6 -0
- package/dist/plugins/ResponsivePreview/index.d.ts +2 -0
- package/dist/plugins/ResponsivePreview/index.js +79 -0
- package/dist/plugins/ResponsivePreview/shared.d.ts +21 -0
- package/dist/plugins/ResponsivePreview/shared.js +19 -0
- package/dist/plugins/ResponsivePreview/spec.d.ts +13 -0
- package/dist/plugins/ResponsivePreview/spec.js +1 -0
- package/dist/plugins/Root/GlobalHeader.d.ts +9 -0
- package/dist/plugins/Root/GlobalHeader.js +59 -0
- package/dist/plugins/Root/RendererHeader.d.ts +16 -0
- package/dist/plugins/Root/RendererHeader.js +79 -0
- package/dist/plugins/Root/Root.d.ts +28 -0
- package/dist/plugins/Root/Root.js +120 -0
- package/dist/plugins/Root/SidePanel.d.ts +10 -0
- package/dist/plugins/Root/SidePanel.js +26 -0
- package/dist/plugins/Root/ToggleNavButton.d.ts +7 -0
- package/dist/plugins/Root/ToggleNavButton.js +6 -0
- package/dist/plugins/Root/index.d.ts +2 -0
- package/dist/plugins/Root/index.js +73 -0
- package/dist/plugins/Root/navOpen.d.ts +4 -0
- package/dist/plugins/Root/navOpen.js +11 -0
- package/dist/plugins/Root/navWidth.d.ts +5 -0
- package/dist/plugins/Root/navWidth.js +14 -0
- package/dist/plugins/Root/panelOpen.d.ts +4 -0
- package/dist/plugins/Root/panelOpen.js +16 -0
- package/dist/plugins/Root/panelWidth.d.ts +5 -0
- package/dist/plugins/Root/panelWidth.js +14 -0
- package/dist/plugins/Root/shared.d.ts +3 -0
- package/dist/plugins/Root/shared.js +1 -0
- package/dist/plugins/Root/spec.d.ts +14 -0
- package/dist/plugins/Root/spec.js +1 -0
- package/dist/plugins/Router/index.d.ts +2 -0
- package/dist/plugins/Router/index.js +56 -0
- package/dist/plugins/Router/spec.d.ts +15 -0
- package/dist/plugins/Router/spec.js +1 -0
- package/dist/plugins/StandardControl/index.d.ts +2 -0
- package/dist/plugins/StandardControl/index.js +43 -0
- package/dist/plugins/StandardControl/spec.d.ts +3 -0
- package/dist/plugins/StandardControl/spec.js +1 -0
- package/dist/plugins/StandardControl/storage.d.ts +7 -0
- package/dist/plugins/StandardControl/storage.js +10 -0
- package/dist/plugins/Storage/index.d.ts +2 -0
- package/dist/plugins/Storage/index.js +40 -0
- package/dist/plugins/Storage/spec.d.ts +18 -0
- package/dist/plugins/Storage/spec.js +1 -0
- package/dist/plugins/pluginEntry.d.ts +23 -0
- package/dist/plugins/pluginEntry.js +29 -0
- package/dist/shared/defaultPluginConfig.d.ts +13 -0
- package/dist/shared/defaultPluginConfig.js +13 -0
- package/dist/shared/fixtureTree.d.ts +3 -0
- package/dist/shared/fixtureTree.js +12 -0
- package/dist/shared/treeExpansion.d.ts +7 -0
- package/dist/shared/treeExpansion.js +24 -0
- package/dist/shared/url.d.ts +5 -0
- package/dist/shared/url.js +33 -0
- package/dist/slots/ControlActionSlot.d.ts +10 -0
- package/dist/slots/ControlActionSlot.js +5 -0
- package/dist/slots/ControlSlot.d.ts +11 -0
- package/dist/slots/ControlSlot.js +5 -0
- package/dist/slots/FixtureActionSlot.d.ts +10 -0
- package/dist/slots/FixtureActionSlot.js +5 -0
- package/dist/slots/NavRowSlot.d.ts +9 -0
- package/dist/slots/NavRowSlot.js +5 -0
- package/dist/slots/RendererActionSlot.d.ts +10 -0
- package/dist/slots/RendererActionSlot.js +5 -0
- package/dist/slots/SidePanelRowSlot.d.ts +12 -0
- package/dist/slots/SidePanelRowSlot.js +5 -0
- package/dist/slots/ValueInputSlot.d.ts +16 -0
- package/dist/slots/ValueInputSlot.js +5 -0
- package/dist/style/colors.d.ts +37 -0
- package/dist/style/colors.js +43 -0
- package/dist/style/globalStyle.d.ts +2 -0
- package/dist/style/globalStyle.js +49 -0
- package/dist/style/vars.d.ts +2 -0
- package/dist/style/vars.js +2 -0
- package/dist/testHelpers/pluginHelpers.d.ts +5 -0
- package/dist/testHelpers/pluginHelpers.js +25 -0
- package/dist/testHelpers/pluginMocks.d.ts +116 -0
- package/dist/testHelpers/pluginMocks.js +139 -0
- package/package.json +24 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { createPlugin } from 'react-plugin';
|
|
3
|
+
import { FixtureTreeContainer } from './FixtureTreeContainer.js';
|
|
4
|
+
import { revealFixture } from './revealFixture.js';
|
|
5
|
+
import { getTreeExpansion, setTreeExpansion } from './shared.js';
|
|
6
|
+
const { namedPlug, register } = createPlugin({
|
|
7
|
+
name: 'fixtureTree',
|
|
8
|
+
methods: {
|
|
9
|
+
revealFixture,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
namedPlug('navRow', 'fixtureTree', ({ pluginContext }) => {
|
|
13
|
+
const { getMethodsOf } = pluginContext;
|
|
14
|
+
const storage = pluginContext.getMethodsOf('storage');
|
|
15
|
+
const router = getMethodsOf('router');
|
|
16
|
+
const core = getMethodsOf('core');
|
|
17
|
+
const { fixturesDir, fixtureFileSuffix } = core.getFixtureFileVars();
|
|
18
|
+
const rendererCore = getMethodsOf('rendererCore');
|
|
19
|
+
const expansion = getTreeExpansion(storage);
|
|
20
|
+
const setExpansionMemo = useCallback((newExpansion) => setTreeExpansion(storage, newExpansion), [storage]);
|
|
21
|
+
return (React.createElement(FixtureTreeContainer, { fixturesDir: fixturesDir, fixtureFileSuffix: fixtureFileSuffix, selectedFixtureId: router.getSelectedFixtureId(), rendererConnected: rendererCore.isRendererConnected(), fixtures: rendererCore.getFixtures(), expansion: expansion, selectFixture: router.selectFixture, setExpansion: setExpansionMemo }));
|
|
22
|
+
});
|
|
23
|
+
export { register };
|
|
24
|
+
if (process.env.NODE_ENV !== 'test')
|
|
25
|
+
register();
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createFixtureTree, } from 'react-cosmos-core';
|
|
2
|
+
import { nodeContainsFixtureId } from '../../shared/fixtureTree.js';
|
|
3
|
+
import { getTreeExpansion, setTreeExpansion, } from './shared.js';
|
|
4
|
+
export function revealFixture(context, fixtureId) {
|
|
5
|
+
const { getMethodsOf } = context;
|
|
6
|
+
const storage = context.getMethodsOf('storage');
|
|
7
|
+
const core = getMethodsOf('core');
|
|
8
|
+
const rendererCore = getMethodsOf('rendererCore');
|
|
9
|
+
const { fixturesDir, fixtureFileSuffix } = core.getFixtureFileVars();
|
|
10
|
+
const fixtures = rendererCore.getFixtures();
|
|
11
|
+
const rootNode = createFixtureTree({
|
|
12
|
+
fixtures,
|
|
13
|
+
fixturesDir,
|
|
14
|
+
fixtureFileSuffix,
|
|
15
|
+
});
|
|
16
|
+
const dirPath = findDirPath(rootNode, fixtureId);
|
|
17
|
+
if (dirPath) {
|
|
18
|
+
const treeExpansion = getTreeExpansion(storage);
|
|
19
|
+
const curDirPath = [];
|
|
20
|
+
const curTreeExpansion = { ...treeExpansion };
|
|
21
|
+
for (let pathIndex = 0; pathIndex < dirPath.length; pathIndex++) {
|
|
22
|
+
curDirPath.push(dirPath[pathIndex]);
|
|
23
|
+
curTreeExpansion[curDirPath.join('/')] = true;
|
|
24
|
+
}
|
|
25
|
+
setTreeExpansion(storage, curTreeExpansion);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function findDirPath({ data, children }, fixtureId, parents = []) {
|
|
29
|
+
if (data.type !== 'fileDir' || !children)
|
|
30
|
+
return null;
|
|
31
|
+
const childNames = Object.keys(children);
|
|
32
|
+
for (let childName of childNames) {
|
|
33
|
+
const childNode = children[childName];
|
|
34
|
+
if (childNode.data.type !== 'fileDir') {
|
|
35
|
+
if (nodeContainsFixtureId(childNode, fixtureId))
|
|
36
|
+
return parents;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const dirPath = findDirPath(childNode, fixtureId, [
|
|
40
|
+
...parents,
|
|
41
|
+
childName,
|
|
42
|
+
]);
|
|
43
|
+
if (dirPath)
|
|
44
|
+
return dirPath;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PluginContext } from 'react-plugin';
|
|
2
|
+
import { TreeExpansion } from '../../shared/treeExpansion.js';
|
|
3
|
+
import { StorageSpec } from '../Storage/spec.js';
|
|
4
|
+
import { FixtureTreeSpec } from './spec.js';
|
|
5
|
+
export type FixtureTreeContext = PluginContext<FixtureTreeSpec>;
|
|
6
|
+
export declare function getTreeExpansion({ getItem }: StorageSpec['methods']): TreeExpansion;
|
|
7
|
+
export declare function setTreeExpansion({ setItem }: StorageSpec['methods'], treeExpansion: TreeExpansion): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const TREE_EXPANSION_STORAGE_KEY = 'fixtureTreeExpansion';
|
|
2
|
+
const DEFAULT_TREE_EXPANSION = {};
|
|
3
|
+
export function getTreeExpansion({ getItem }) {
|
|
4
|
+
return (getItem(TREE_EXPANSION_STORAGE_KEY) || DEFAULT_TREE_EXPANSION);
|
|
5
|
+
}
|
|
6
|
+
export function setTreeExpansion({ setItem }, treeExpansion) {
|
|
7
|
+
setItem(TREE_EXPANSION_STORAGE_KEY, treeExpansion);
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FixtureId } from 'react-cosmos-core';
|
|
3
|
+
export declare function useScrollToSelected(selectedFixtureId: FixtureId | null): {
|
|
4
|
+
containerRef: import("react").RefObject<HTMLDivElement>;
|
|
5
|
+
selectedRef: import("react").RefObject<HTMLElement>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
export function useScrollToSelected(selectedFixtureId) {
|
|
3
|
+
const containerRef = useRef(null);
|
|
4
|
+
const selectedRef = useRef(null);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const { current: selectedEl } = selectedRef;
|
|
7
|
+
const { current: containerEl } = containerRef;
|
|
8
|
+
if (containerEl && selectedEl && !isVisibleInside(selectedEl, containerEl))
|
|
9
|
+
selectedEl.scrollIntoView({ block: 'center' });
|
|
10
|
+
}, [selectedFixtureId]);
|
|
11
|
+
return { containerRef, selectedRef };
|
|
12
|
+
}
|
|
13
|
+
function isVisibleInside(element, container) {
|
|
14
|
+
const containerRect = container.getBoundingClientRect();
|
|
15
|
+
const elementRect = element.getBoundingClientRect();
|
|
16
|
+
return (containerRect.top < elementRect.top &&
|
|
17
|
+
elementRect.bottom < containerRect.bottom);
|
|
18
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconButton32 } from '../../components/buttons/index.js';
|
|
3
|
+
import { ExternalIcon } from '../../components/icons/index.js';
|
|
4
|
+
export function FullScreenButton({ onClick }) {
|
|
5
|
+
return (React.createElement(IconButton32, { icon: React.createElement(ExternalIcon, null), title: "Go fullscreen", onClick: onClick }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createPlugin } from 'react-plugin';
|
|
3
|
+
import { stringifyRendererUrlQuery } from 'react-cosmos-core';
|
|
4
|
+
import { FullScreenButton } from './FullScreenButton.js';
|
|
5
|
+
const { namedPlug, register } = createPlugin({
|
|
6
|
+
name: 'fullScreenButton',
|
|
7
|
+
});
|
|
8
|
+
namedPlug('rendererAction', 'fullScreen', ({ pluginContext, slotProps }) => {
|
|
9
|
+
const { getMethodsOf } = pluginContext;
|
|
10
|
+
const { fixtureId } = slotProps;
|
|
11
|
+
const core = getMethodsOf('core');
|
|
12
|
+
const rendererUrl = core.getWebRendererUrl();
|
|
13
|
+
const onSelect = React.useCallback(() => {
|
|
14
|
+
const query = stringifyRendererUrlQuery({ _fixtureId: fixtureId });
|
|
15
|
+
const fixtureUrl = `${rendererUrl}?${query}`;
|
|
16
|
+
window.open(fixtureUrl, '_blank');
|
|
17
|
+
}, [fixtureId, rendererUrl]);
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
return core.registerCommands({ goFullScreen: onSelect });
|
|
20
|
+
}, [core, onSelect]);
|
|
21
|
+
return rendererUrl ? React.createElement(FullScreenButton, { onClick: onSelect }) : null;
|
|
22
|
+
});
|
|
23
|
+
export { register };
|
|
24
|
+
if (process.env.NODE_ENV !== 'test')
|
|
25
|
+
register();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createPlugin } from 'react-plugin';
|
|
2
|
+
import { initSocket, postRendererRequest } from './socket.js';
|
|
3
|
+
const { onLoad, register } = createPlugin({
|
|
4
|
+
name: 'messageHandler',
|
|
5
|
+
methods: {
|
|
6
|
+
postRendererRequest,
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
onLoad(initSocket);
|
|
10
|
+
export { register };
|
|
11
|
+
if (process.env.NODE_ENV !== 'test')
|
|
12
|
+
register();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MessageType } from 'react-cosmos-core';
|
|
2
|
+
import { MessageHandlerContext } from './shared.js';
|
|
3
|
+
export declare function initSocket(context: MessageHandlerContext): (() => void) | undefined;
|
|
4
|
+
export declare function postRendererRequest(context: MessageHandlerContext, msg: MessageType): void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { rendererSocketMessage, } from 'react-cosmos-core';
|
|
2
|
+
let socket = null;
|
|
3
|
+
let pendingMessages = [];
|
|
4
|
+
export function initSocket(context) {
|
|
5
|
+
const core = context.getMethodsOf('core');
|
|
6
|
+
if (!core.isDevServerOn()) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
socket = new WebSocket(location.origin.replace(/^https?:/, 'ws:'));
|
|
10
|
+
socket.addEventListener('open', () => {
|
|
11
|
+
if (socket && pendingMessages.length > 0) {
|
|
12
|
+
for (const msg of pendingMessages)
|
|
13
|
+
socket.send(JSON.stringify(msg));
|
|
14
|
+
pendingMessages = [];
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
function handleMessage(event) {
|
|
18
|
+
const message = JSON.parse(event.data);
|
|
19
|
+
switch (message.channel) {
|
|
20
|
+
case 'renderer':
|
|
21
|
+
return context.emit('rendererResponse', message.message);
|
|
22
|
+
case 'server':
|
|
23
|
+
return context.emit('serverMessage', message.message);
|
|
24
|
+
default:
|
|
25
|
+
console.log('Unknown socket message', message);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
socket.addEventListener('message', handleMessage);
|
|
29
|
+
return () => {
|
|
30
|
+
if (socket) {
|
|
31
|
+
socket.removeEventListener('message', handleMessage);
|
|
32
|
+
socket.close();
|
|
33
|
+
socket = null;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function postRendererRequest(context, msg) {
|
|
38
|
+
const socketMessage = rendererSocketMessage(msg);
|
|
39
|
+
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
40
|
+
socket.send(JSON.stringify(socketMessage));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
pendingMessages.push(socketMessage);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MessageType } from 'react-cosmos-core';
|
|
2
|
+
export type MessageHandlerSpec = {
|
|
3
|
+
name: 'messageHandler';
|
|
4
|
+
methods: {
|
|
5
|
+
postRendererRequest(msg: MessageType): unknown;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
serverMessage(msg: MessageType): void;
|
|
9
|
+
rendererResponse(msg: MessageType): void;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { AlertCircleIcon, CheckCircleIcon, InfoIcon, LoaderIcon, } from '../../components/icons/index.js';
|
|
4
|
+
import { grey128, grey32, grey64, grey8, white95 } from '../../style/colors.js';
|
|
5
|
+
import { quick } from '../../style/vars.js';
|
|
6
|
+
export function Notifications({ notifications }) {
|
|
7
|
+
return (React.createElement(Container, null, notifications.map(({ id, type, title, info }) => {
|
|
8
|
+
const Icon = IconTypes[type];
|
|
9
|
+
return (React.createElement(Item, { key: id },
|
|
10
|
+
React.createElement(IconContainer, null,
|
|
11
|
+
React.createElement(Icon, null)),
|
|
12
|
+
React.createElement(Content, null,
|
|
13
|
+
React.createElement(Title, null, title),
|
|
14
|
+
React.createElement(Info, null, info))));
|
|
15
|
+
})));
|
|
16
|
+
}
|
|
17
|
+
const Container = styled.div `
|
|
18
|
+
position: absolute;
|
|
19
|
+
bottom: 8px;
|
|
20
|
+
right: 8px;
|
|
21
|
+
`;
|
|
22
|
+
const Item = styled.div `
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
align-items: flex-start;
|
|
26
|
+
min-height: 56px;
|
|
27
|
+
margin-top: 6px;
|
|
28
|
+
border-radius: 6px;
|
|
29
|
+
background: ${white95};
|
|
30
|
+
box-shadow: 0 2px 10px -4px ${grey8};
|
|
31
|
+
line-height: 20px;
|
|
32
|
+
animation: fadeScaleIn ${quick}s forwards;
|
|
33
|
+
|
|
34
|
+
:first-child {
|
|
35
|
+
margin-top: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@keyframes fadeScaleIn {
|
|
39
|
+
0% {
|
|
40
|
+
opacity: 0;
|
|
41
|
+
transform: scale(0.8);
|
|
42
|
+
}
|
|
43
|
+
100% {
|
|
44
|
+
opacity: 1;
|
|
45
|
+
transform: scale(1);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
const iconSize = 20;
|
|
50
|
+
const IconContainer = styled.div `
|
|
51
|
+
width: ${iconSize}px;
|
|
52
|
+
height: ${iconSize}px;
|
|
53
|
+
margin: 18px 16px;
|
|
54
|
+
color: ${grey128};
|
|
55
|
+
`;
|
|
56
|
+
const Content = styled.div `
|
|
57
|
+
width: 288px;
|
|
58
|
+
padding: 8px 16px 8px 0;
|
|
59
|
+
`;
|
|
60
|
+
const Title = styled.div `
|
|
61
|
+
color: ${grey32};
|
|
62
|
+
font-weight: 500;
|
|
63
|
+
`;
|
|
64
|
+
const Info = styled.div `
|
|
65
|
+
margin: 2px 0 0 0;
|
|
66
|
+
font-size: 12px;
|
|
67
|
+
line-height: 18px;
|
|
68
|
+
color: ${grey64};
|
|
69
|
+
`;
|
|
70
|
+
const IconTypes = {
|
|
71
|
+
success: CheckCircleIcon,
|
|
72
|
+
error: AlertCircleIcon,
|
|
73
|
+
info: InfoIcon,
|
|
74
|
+
loading: LoaderIcon,
|
|
75
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createPlugin } from 'react-plugin';
|
|
3
|
+
import { Notifications } from './Notifications.js';
|
|
4
|
+
import { clearTimedNotification, pushStickyNotification, pushTimedNotification, removeStickyNotification, } from './pushNotification.js';
|
|
5
|
+
const { register, onLoad, namedPlug } = createPlugin({
|
|
6
|
+
name: 'notifications',
|
|
7
|
+
initialState: {
|
|
8
|
+
stickyNotifications: [],
|
|
9
|
+
timedNotifications: null,
|
|
10
|
+
},
|
|
11
|
+
methods: {
|
|
12
|
+
pushStickyNotification,
|
|
13
|
+
removeStickyNotification,
|
|
14
|
+
pushTimedNotification,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
onLoad(context => {
|
|
18
|
+
return () => {
|
|
19
|
+
// Clean up timed notifications when plugin unloads
|
|
20
|
+
const { timedNotifications } = context.getState();
|
|
21
|
+
if (timedNotifications) {
|
|
22
|
+
window.clearInterval(timedNotifications.timeoutId);
|
|
23
|
+
clearTimedNotification(context);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
namedPlug('global', 'notifications', ({ pluginContext }) => {
|
|
28
|
+
const { stickyNotifications, timedNotifications } = pluginContext.getState();
|
|
29
|
+
const notifications = timedNotifications === null
|
|
30
|
+
? stickyNotifications
|
|
31
|
+
: [...stickyNotifications, ...timedNotifications.items];
|
|
32
|
+
return React.createElement(Notifications, { notifications: notifications });
|
|
33
|
+
});
|
|
34
|
+
export { register };
|
|
35
|
+
if (process.env.NODE_ENV !== 'test')
|
|
36
|
+
register();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NotificationsContext } from './shared.js';
|
|
2
|
+
import { NotificationItem } from './spec.js';
|
|
3
|
+
export declare function pushStickyNotification(context: NotificationsContext, notification: NotificationItem): void;
|
|
4
|
+
export declare function removeStickyNotification(context: NotificationsContext, notificationId: string): void;
|
|
5
|
+
export declare function pushTimedNotification(context: NotificationsContext, notification: NotificationItem): void;
|
|
6
|
+
export declare function clearTimedNotification(context: NotificationsContext): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { removeItemMatch, replaceOrAddItem } from 'react-cosmos-core';
|
|
2
|
+
const TIMEOUT = 3000;
|
|
3
|
+
export function pushStickyNotification(context, notification) {
|
|
4
|
+
context.setState(prevState => ({
|
|
5
|
+
...prevState,
|
|
6
|
+
stickyNotifications: replaceOrAddItem(prevState.stickyNotifications, i => i.id === notification.id, notification),
|
|
7
|
+
}));
|
|
8
|
+
}
|
|
9
|
+
export function removeStickyNotification(context, notificationId) {
|
|
10
|
+
context.setState(prevState => ({
|
|
11
|
+
...prevState,
|
|
12
|
+
stickyNotifications: removeItemMatch(prevState.stickyNotifications, i => i.id === notificationId),
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
export function pushTimedNotification(context, notification) {
|
|
16
|
+
const { timedNotifications } = context.getState();
|
|
17
|
+
if (timedNotifications !== null) {
|
|
18
|
+
window.clearTimeout(timedNotifications.timeoutId);
|
|
19
|
+
}
|
|
20
|
+
context.setState(prevState => ({
|
|
21
|
+
...prevState,
|
|
22
|
+
timedNotifications: {
|
|
23
|
+
timeoutId: createNotificationTimeout(context),
|
|
24
|
+
items: replaceOrAddItem(getTimedNotifications(prevState), i => i.id === notification.id, notification),
|
|
25
|
+
},
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
export function clearTimedNotification(context) {
|
|
29
|
+
context.setState(prevState => ({
|
|
30
|
+
...prevState,
|
|
31
|
+
timedNotifications: null,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
function createNotificationTimeout(context) {
|
|
35
|
+
return window.setTimeout(() => clearTimedNotification(context), TIMEOUT);
|
|
36
|
+
}
|
|
37
|
+
function getTimedNotifications(prevState) {
|
|
38
|
+
const { timedNotifications } = prevState;
|
|
39
|
+
return timedNotifications !== null ? timedNotifications.items : [];
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type NotificationType = 'success' | 'error' | 'info' | 'loading';
|
|
2
|
+
export type NotificationItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
type: NotificationType;
|
|
5
|
+
title: string;
|
|
6
|
+
info: string;
|
|
7
|
+
};
|
|
8
|
+
export type NotificationsSpec = {
|
|
9
|
+
name: 'notifications';
|
|
10
|
+
state: {
|
|
11
|
+
stickyNotifications: NotificationItem[];
|
|
12
|
+
timedNotifications: null | {
|
|
13
|
+
timeoutId: number;
|
|
14
|
+
items: NotificationItem[];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
methods: {
|
|
18
|
+
pushStickyNotification(notification: NotificationItem): void;
|
|
19
|
+
removeStickyNotification(notificationId: string): void;
|
|
20
|
+
pushTimedNotification(notification: NotificationItem): void;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type SimplePlugin = {
|
|
2
|
+
name: string;
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
};
|
|
5
|
+
type Props = {
|
|
6
|
+
plugins: SimplePlugin[];
|
|
7
|
+
enable: (pluginName: string, enabled: boolean) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function PluginList({ plugins, enable }: Props): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { SidePanelContainer, SidePanelHeader, SidePanelTitle, } from '../../components/SidePanel.js';
|
|
4
|
+
import { grey224 } from '../../style/colors.js';
|
|
5
|
+
const requiredPlugins = [
|
|
6
|
+
'core',
|
|
7
|
+
'messageHandler',
|
|
8
|
+
'rendererCore',
|
|
9
|
+
'rendererPreview',
|
|
10
|
+
'root',
|
|
11
|
+
'router',
|
|
12
|
+
'storage',
|
|
13
|
+
];
|
|
14
|
+
export function PluginList({ plugins, enable }) {
|
|
15
|
+
return (React.createElement(SidePanelContainer, null,
|
|
16
|
+
React.createElement(SidePanelHeader, null,
|
|
17
|
+
React.createElement(SidePanelTitle, { label: "Plugins" })),
|
|
18
|
+
React.createElement(Body, null, [...plugins]
|
|
19
|
+
.sort((p1, p2) => p1.name.localeCompare(p2.name))
|
|
20
|
+
.map(({ name, enabled }) => (React.createElement(Label, { key: name },
|
|
21
|
+
React.createElement("input", { disabled: requiredPlugins.indexOf(name) !== -1, type: "checkbox", checked: enabled, onChange: e => enable(name, e.target.checked) }),
|
|
22
|
+
React.createElement(Name, { style: { opacity: enabled ? 1 : 0.6 } }, name)))))));
|
|
23
|
+
}
|
|
24
|
+
const Body = styled.div `
|
|
25
|
+
padding: 0 24px 20px 24px;
|
|
26
|
+
`;
|
|
27
|
+
const Label = styled.label `
|
|
28
|
+
height: 24px;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: row;
|
|
31
|
+
align-items: center;
|
|
32
|
+
line-height: 24px;
|
|
33
|
+
`;
|
|
34
|
+
const Name = styled.span `
|
|
35
|
+
margin-left: 8px;
|
|
36
|
+
color: ${grey224};
|
|
37
|
+
user-select: none;
|
|
38
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createPlugin, PluginsConsumer } from 'react-plugin';
|
|
3
|
+
import { PluginList } from './PluginList.js';
|
|
4
|
+
const { plug, register } = createPlugin({
|
|
5
|
+
name: 'pluginList',
|
|
6
|
+
});
|
|
7
|
+
plug('sidePanelRow', () => {
|
|
8
|
+
return (React.createElement(PluginsConsumer, null, ({ plugins, enable }) => (React.createElement(PluginList, { plugins: plugins.map(p => ({ name: p.name, enabled: p.enabled })), enable: enable }))));
|
|
9
|
+
});
|
|
10
|
+
export { register };
|
|
11
|
+
if (process.env.NODE_ENV !== 'test')
|
|
12
|
+
register();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { SlidersIcon } from '../../components/icons/index.js';
|
|
4
|
+
import { grey160, grey224, grey32, grey64 } from '../../style/colors.js';
|
|
5
|
+
export function BlankState() {
|
|
6
|
+
return (React.createElement(Container, null,
|
|
7
|
+
React.createElement(IconContainer, null,
|
|
8
|
+
React.createElement(SlidersIcon, null)),
|
|
9
|
+
React.createElement(Title, null,
|
|
10
|
+
"No visible props in ",
|
|
11
|
+
React.createElement(NoWrap, null, "selected fixture")),
|
|
12
|
+
React.createElement(Description, null,
|
|
13
|
+
"Props of exported JSX ",
|
|
14
|
+
React.createElement(NoWrap, null, "elements from"),
|
|
15
|
+
" your fixtures",
|
|
16
|
+
' ',
|
|
17
|
+
React.createElement(NoWrap, null, "will appear here."))));
|
|
18
|
+
}
|
|
19
|
+
const Container = styled.div `
|
|
20
|
+
padding: 16px 24px;
|
|
21
|
+
background: ${grey32};
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
line-height: 22px;
|
|
24
|
+
`;
|
|
25
|
+
const iconSize = 32;
|
|
26
|
+
export const IconContainer = styled.div `
|
|
27
|
+
margin: 16px auto;
|
|
28
|
+
display: flex;
|
|
29
|
+
width: ${iconSize}px;
|
|
30
|
+
height: ${iconSize}px;
|
|
31
|
+
color: ${grey64};
|
|
32
|
+
`;
|
|
33
|
+
const Title = styled.div `
|
|
34
|
+
margin: 0 0 16px 0;
|
|
35
|
+
color: ${grey224};
|
|
36
|
+
text-align: center;
|
|
37
|
+
font-weight: 500;
|
|
38
|
+
`;
|
|
39
|
+
const Description = styled.div `
|
|
40
|
+
margin: 0 auto;
|
|
41
|
+
max-width: 256px;
|
|
42
|
+
color: ${grey160};
|
|
43
|
+
text-align: center;
|
|
44
|
+
`;
|
|
45
|
+
export const NoWrap = styled.span `
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FixtureState, FixtureStateProps, StateUpdater } from 'react-cosmos-core';
|
|
2
|
+
import { FixtureExpansion, OnElementExpansionChange } from '../../../components/ValueInputTree/index.js';
|
|
3
|
+
type Props = {
|
|
4
|
+
fsProps: FixtureStateProps;
|
|
5
|
+
fixtureExpansion: FixtureExpansion;
|
|
6
|
+
onFixtureStateChange: (stateUpdater: StateUpdater<FixtureState>) => void;
|
|
7
|
+
onElementExpansionChange: OnElementExpansionChange;
|
|
8
|
+
};
|
|
9
|
+
export declare function ComponentProps({ fsProps, fixtureExpansion, onFixtureStateChange, onElementExpansionChange, }: Props): JSX.Element;
|
|
10
|
+
export {};
|