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,158 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { AstronautIllustration } from '../../components/illustrations/Astronaut.js';
|
|
4
|
+
import { screenGrey1, screenGrey3, screenGrey5, screenPrimary1, screenPrimary2, screenPrimary3, } from '../../style/colors.js';
|
|
5
|
+
import { ContentContainer, IllustrationContainer, NoWrap, SecondaryButton, TextContainer, } from './shared.js';
|
|
6
|
+
export function WelcomeCosmos({ onDismissWelcome }) {
|
|
7
|
+
return (React.createElement(ContentContainer, null,
|
|
8
|
+
React.createElement(TextContainer, null,
|
|
9
|
+
React.createElement(Header, null,
|
|
10
|
+
"Welcome to ",
|
|
11
|
+
React.createElement(NoWrap, null, "React Cosmos")),
|
|
12
|
+
React.createElement(List, null,
|
|
13
|
+
React.createElement("li", null,
|
|
14
|
+
React.createElement(Bullet, null),
|
|
15
|
+
React.createElement("span", null,
|
|
16
|
+
React.createElement(Link, { href: "https://github.com/react-cosmos/react-cosmos/tree/main/docs", rel: "noopener noreferrer", target: "_blank" },
|
|
17
|
+
React.createElement("strong", null, "Read the docs")),
|
|
18
|
+
' ',
|
|
19
|
+
"to get the most out of React Cosmos.",
|
|
20
|
+
React.createElement("br", null),
|
|
21
|
+
"Chat with us on",
|
|
22
|
+
' ',
|
|
23
|
+
React.createElement(Link, { href: "https://react-cosmos.slack.com/join/shared_invite/zt-g9rsalqq-clCoV7DWttVvzO5FAAmVAw", rel: "noopener noreferrer", target: "_blank" }, "Slack"),
|
|
24
|
+
". Report detailed issues on",
|
|
25
|
+
' ',
|
|
26
|
+
React.createElement(Link, { href: "https://github.com/react-cosmos/react-cosmos/issues", rel: "noopener noreferrer", target: "_blank" }, "GitHub"),
|
|
27
|
+
".")),
|
|
28
|
+
React.createElement("li", null,
|
|
29
|
+
React.createElement(Bullet, null),
|
|
30
|
+
React.createElement("span", null,
|
|
31
|
+
React.createElement(Link, { href: "https://github.com/users/skidding/sponsorship", rel: "noopener noreferrer", target: "_blank" },
|
|
32
|
+
React.createElement("strong", null, "Become a Sponsor")),
|
|
33
|
+
' ',
|
|
34
|
+
"to invest in the future of React Cosmos.",
|
|
35
|
+
React.createElement("br", null),
|
|
36
|
+
`Don't worry if you can't. `,
|
|
37
|
+
React.createElement(Highlight, null, "React Cosmos will always be free.")))),
|
|
38
|
+
React.createElement(Paragraph, null,
|
|
39
|
+
React.createElement(ActionLink, { href: "https://forms.gle/yvoie73Rfo6Zy7no7", rel: "noopener noreferrer", target: "_blank" }, "share your feedback"),
|
|
40
|
+
React.createElement(SecondaryButton, { onClick: onDismissWelcome }, "hide this screen"))),
|
|
41
|
+
React.createElement(IllustrationContainer, null,
|
|
42
|
+
React.createElement(AstronautIllustration, { title: "astronaut" }))));
|
|
43
|
+
}
|
|
44
|
+
const Header = styled.h1 `
|
|
45
|
+
position: relative;
|
|
46
|
+
margin: 0 0 64px 0;
|
|
47
|
+
color: ${screenPrimary2};
|
|
48
|
+
font-size: 30px;
|
|
49
|
+
font-weight: 700;
|
|
50
|
+
line-height: 1.2em;
|
|
51
|
+
text-transform: uppercase;
|
|
52
|
+
letter-spacing: 0.015em;
|
|
53
|
+
|
|
54
|
+
::after {
|
|
55
|
+
content: '';
|
|
56
|
+
position: absolute;
|
|
57
|
+
bottom: -12px;
|
|
58
|
+
left: 0;
|
|
59
|
+
width: 64px;
|
|
60
|
+
height: 3px;
|
|
61
|
+
background: ${screenPrimary2};
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
const Paragraph = styled.p `
|
|
65
|
+
margin: 16px 0;
|
|
66
|
+
|
|
67
|
+
:last-child {
|
|
68
|
+
margin-bottom: 0;
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
const List = styled.ul `
|
|
72
|
+
margin: 0 0 48px 0;
|
|
73
|
+
padding: 0;
|
|
74
|
+
list-style: none;
|
|
75
|
+
|
|
76
|
+
li {
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: row;
|
|
79
|
+
align-items: flex-start;
|
|
80
|
+
margin-bottom: 24px;
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
const Bullet = styled.span `
|
|
84
|
+
flex-shrink: 0;
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: flex-end;
|
|
88
|
+
box-sizing: border-box;
|
|
89
|
+
position: relative;
|
|
90
|
+
width: 32px;
|
|
91
|
+
height: 32px;
|
|
92
|
+
margin: 6px 16px 0 0;
|
|
93
|
+
padding: 0 0 0 0;
|
|
94
|
+
border-radius: 100%;
|
|
95
|
+
font-size: 18px;
|
|
96
|
+
font-weight: 600;
|
|
97
|
+
background: ${screenGrey5};
|
|
98
|
+
color: ${screenGrey3};
|
|
99
|
+
|
|
100
|
+
::after {
|
|
101
|
+
position: absolute;
|
|
102
|
+
content: '';
|
|
103
|
+
width: 6px;
|
|
104
|
+
height: 6px;
|
|
105
|
+
top: 13px;
|
|
106
|
+
left: 13px;
|
|
107
|
+
border-radius: 100%;
|
|
108
|
+
background: ${screenGrey3};
|
|
109
|
+
transform: rotate(0deg);
|
|
110
|
+
}
|
|
111
|
+
`;
|
|
112
|
+
const Link = styled.a `
|
|
113
|
+
color: ${screenGrey1};
|
|
114
|
+
`;
|
|
115
|
+
const Highlight = styled.span `
|
|
116
|
+
padding: 2px 4px;
|
|
117
|
+
border-radius: 2px;
|
|
118
|
+
background: rgba(255, 255, 200, 0.88);
|
|
119
|
+
color: black;
|
|
120
|
+
`;
|
|
121
|
+
const actionLinkHeight = 36;
|
|
122
|
+
const ActionLink = styled.a `
|
|
123
|
+
display: inline-block;
|
|
124
|
+
height: ${actionLinkHeight}px;
|
|
125
|
+
padding: 0 16px;
|
|
126
|
+
background: ${screenPrimary3};
|
|
127
|
+
color: #fff;
|
|
128
|
+
border-radius: 5px;
|
|
129
|
+
font-size: 12px;
|
|
130
|
+
font-weight: 700;
|
|
131
|
+
line-height: ${actionLinkHeight}px;
|
|
132
|
+
text-transform: uppercase;
|
|
133
|
+
letter-spacing: 0.1em;
|
|
134
|
+
text-decoration: none;
|
|
135
|
+
transform: translate3d(0, 0, 0);
|
|
136
|
+
animation: pulse 10s ease-out infinite;
|
|
137
|
+
outline: none;
|
|
138
|
+
|
|
139
|
+
:focus {
|
|
140
|
+
box-shadow: 0 0 0px 2px ${screenPrimary1};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
::-moz-focus-inner {
|
|
144
|
+
border: 0;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@keyframes pulse {
|
|
148
|
+
21.25% {
|
|
149
|
+
background: ${screenPrimary3};
|
|
150
|
+
}
|
|
151
|
+
25% {
|
|
152
|
+
background: ${screenPrimary2};
|
|
153
|
+
}
|
|
154
|
+
30% {
|
|
155
|
+
background: ${screenPrimary3};
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { screenGrey6 } from '../../style/colors.js';
|
|
4
|
+
export default ({ children }) => (React.createElement(Wrapper, null, children));
|
|
5
|
+
const Wrapper = styled.div `
|
|
6
|
+
position: absolute;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
display: flex;
|
|
10
|
+
background-color: ${screenGrey6};
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createPlugin } from 'react-plugin';
|
|
3
|
+
import { ContentOverlay } from './ContentOverlay.js';
|
|
4
|
+
import { useWelcomeDismiss } from './welcomeDismiss.js';
|
|
5
|
+
const { plug, register } = createPlugin({
|
|
6
|
+
name: 'contentOverlay',
|
|
7
|
+
});
|
|
8
|
+
plug('contentOverlay', ({ pluginContext }) => {
|
|
9
|
+
const { getMethodsOf } = pluginContext;
|
|
10
|
+
const router = getMethodsOf('router');
|
|
11
|
+
const fixtureSelected = router.getSelectedFixtureId() !== null;
|
|
12
|
+
const rendererCore = getMethodsOf('rendererCore');
|
|
13
|
+
const rendererPreview = getMethodsOf('rendererPreview');
|
|
14
|
+
const { welcomeDismissed, onDismissWelcome, onShowWelcome } = useWelcomeDismiss(pluginContext);
|
|
15
|
+
return (React.createElement(ContentOverlay, { fixtureSelected: fixtureSelected, validFixtureSelected: fixtureSelected && rendererCore.isValidFixtureSelected(), rendererConnected: rendererCore.isRendererConnected(), rendererPreviewUrlStatus: rendererPreview.getUrlStatus(), rendererPreviewRuntimeStatus: rendererPreview.getRuntimeStatus(), welcomeDismissed: welcomeDismissed, onDismissWelcome: onDismissWelcome, onShowWelcome: onShowWelcome }));
|
|
16
|
+
});
|
|
17
|
+
export { register };
|
|
18
|
+
if (process.env.NODE_ENV !== 'test')
|
|
19
|
+
register();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PluginContext } from 'react-plugin';
|
|
2
|
+
import { ContentOverlaySpec } from './spec.js';
|
|
3
|
+
export type ContentOverlayContext = PluginContext<ContentOverlaySpec>;
|
|
4
|
+
export declare const OverlayContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const ContentContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const TextContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare const IllustrationContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
|
+
export declare const SecondaryButton: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
9
|
+
export declare const NoWrap: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { screenGrey1, screenGrey2, screenGrey5, screenGrey6, screenPrimary2, screenPrimary3, } from '../../style/colors.js';
|
|
3
|
+
export const OverlayContainer = styled.div `
|
|
4
|
+
position: absolute;
|
|
5
|
+
top: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
justify-items: flex-start;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
background: ${screenGrey6};
|
|
14
|
+
overflow: auto;
|
|
15
|
+
`;
|
|
16
|
+
export const ContentContainer = styled.div `
|
|
17
|
+
flex-shrink: 0;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: row;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
min-width: 100%;
|
|
23
|
+
min-height: 100%;
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
`;
|
|
26
|
+
export const TextContainer = styled.div `
|
|
27
|
+
flex-shrink: 0;
|
|
28
|
+
width: 512px;
|
|
29
|
+
padding: 32px;
|
|
30
|
+
font-size: 16px;
|
|
31
|
+
line-height: 1.5em;
|
|
32
|
+
color: ${screenGrey1};
|
|
33
|
+
|
|
34
|
+
strong {
|
|
35
|
+
font-weight: 500;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
const illustrationSize = 320;
|
|
39
|
+
export const IllustrationContainer = styled.div `
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
display: flex;
|
|
42
|
+
width: ${illustrationSize}px;
|
|
43
|
+
height: ${illustrationSize}px;
|
|
44
|
+
padding: 0 16px;
|
|
45
|
+
`;
|
|
46
|
+
const buttonHeight = 36;
|
|
47
|
+
export const SecondaryButton = styled.button `
|
|
48
|
+
display: inline-block;
|
|
49
|
+
height: ${buttonHeight}px;
|
|
50
|
+
margin: 0 0 0 16px;
|
|
51
|
+
padding: 0 16px;
|
|
52
|
+
border: 0;
|
|
53
|
+
background: ${screenGrey5};
|
|
54
|
+
color: ${screenGrey2};
|
|
55
|
+
border-radius: 5px;
|
|
56
|
+
font-size: 12px;
|
|
57
|
+
font-weight: 700;
|
|
58
|
+
line-height: ${buttonHeight}px;
|
|
59
|
+
text-transform: uppercase;
|
|
60
|
+
letter-spacing: 0.1em;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
outline: none;
|
|
63
|
+
|
|
64
|
+
:focus {
|
|
65
|
+
color: ${screenPrimary2};
|
|
66
|
+
box-shadow: 0 0 0px 2px ${screenPrimary3};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
::-moz-focus-inner {
|
|
70
|
+
border: 0;
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
export const NoWrap = styled.span `
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ContentOverlayContext } from './shared.js';
|
|
2
|
+
export declare const WELCOME_DISMISS_STORAGE_KEY = "welcomeDismissedAt";
|
|
3
|
+
export declare function useWelcomeDismiss(context: ContentOverlayContext): {
|
|
4
|
+
welcomeDismissed: boolean;
|
|
5
|
+
onDismissWelcome: () => void;
|
|
6
|
+
onShowWelcome: () => void;
|
|
7
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const WELCOME_DISMISS_STORAGE_KEY = 'welcomeDismissedAt';
|
|
3
|
+
const SHOW_AGAIN_IN = 90 * 86400 * 1000; // ~3 months
|
|
4
|
+
export function useWelcomeDismiss(context) {
|
|
5
|
+
const { getMethodsOf } = context;
|
|
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
|
+
const onDismissWelcome = React.useCallback(() => storage.setItem(WELCOME_DISMISS_STORAGE_KEY, Date.now()), [storage]);
|
|
11
|
+
const onShowWelcome = React.useCallback(() => storage.setItem(WELCOME_DISMISS_STORAGE_KEY, 0), [storage]);
|
|
12
|
+
return {
|
|
13
|
+
welcomeDismissed,
|
|
14
|
+
onDismissWelcome,
|
|
15
|
+
onShowWelcome,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FixtureState, StateUpdater } from 'react-cosmos-core';
|
|
2
|
+
type Props = {
|
|
3
|
+
fixtureState: FixtureState;
|
|
4
|
+
controlActionOrder: string[];
|
|
5
|
+
onFixtureStateChange: (stateUpdater: StateUpdater<FixtureState>) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function ControlPanel({ fixtureState, controlActionOrder, onFixtureStateChange, }: Props): JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { isEqual } from 'lodash-es';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { IconButton32 } from '../../components/buttons/index.js';
|
|
4
|
+
import { RotateCcwIcon } from '../../components/icons/index.js';
|
|
5
|
+
import { SidePanelActions, SidePanelBody, SidePanelContainer, SidePanelHeader, SidePanelTitle, } from '../../components/SidePanel.js';
|
|
6
|
+
import { ControlActionSlot } from '../../slots/ControlActionSlot.js';
|
|
7
|
+
import { ControlSlot } from '../../slots/ControlSlot.js';
|
|
8
|
+
export function ControlPanel({ fixtureState, controlActionOrder, onFixtureStateChange, }) {
|
|
9
|
+
const handleControlsReset = React.useCallback(() => onFixtureStateChange(resetControls), [onFixtureStateChange]);
|
|
10
|
+
const controls = fixtureState.controls || {};
|
|
11
|
+
if (Object.keys(controls).length === 0)
|
|
12
|
+
return null;
|
|
13
|
+
return (React.createElement(SidePanelContainer, null,
|
|
14
|
+
React.createElement(SidePanelHeader, null,
|
|
15
|
+
React.createElement(SidePanelTitle, { label: "Controls" }),
|
|
16
|
+
React.createElement(SidePanelActions, null,
|
|
17
|
+
React.createElement(IconButton32, { title: "Reset to default values", icon: React.createElement(RotateCcwIcon, null), disabled: areControlsUnchanged(controls), onClick: handleControlsReset }),
|
|
18
|
+
React.createElement(ControlActionSlot, { slotProps: { controls }, plugOrder: controlActionOrder }))),
|
|
19
|
+
React.createElement(SidePanelBody, null, Object.keys(controls).map(controlName => (React.createElement(ControlSlot, { key: controlName, slotProps: {
|
|
20
|
+
controlName,
|
|
21
|
+
control: controls[controlName],
|
|
22
|
+
onFixtureStateChange,
|
|
23
|
+
} }))))));
|
|
24
|
+
}
|
|
25
|
+
function areControlsUnchanged(controls) {
|
|
26
|
+
return Object.keys(controls).every(controlName => isEqual(controls[controlName].currentValue, controls[controlName].defaultValue));
|
|
27
|
+
}
|
|
28
|
+
function resetControls(fixtureState) {
|
|
29
|
+
const controls = fixtureState.controls ? { ...fixtureState.controls } : {};
|
|
30
|
+
Object.keys(controls).forEach(controlName => {
|
|
31
|
+
controls[controlName] = resetControl(controls[controlName]);
|
|
32
|
+
});
|
|
33
|
+
return { ...fixtureState, controls };
|
|
34
|
+
}
|
|
35
|
+
function resetControl(control) {
|
|
36
|
+
return { ...control, currentValue: control.defaultValue };
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createPlugin } from 'react-plugin';
|
|
3
|
+
import { ControlPanel } from './ControlPanel.js';
|
|
4
|
+
const { namedPlug, register } = createPlugin({
|
|
5
|
+
name: 'controlPanel',
|
|
6
|
+
defaultConfig: {
|
|
7
|
+
controlActionOrder: [],
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
namedPlug('sidePanelRow', 'values', ({ pluginContext, slotProps }) => {
|
|
11
|
+
const { controlActionOrder } = pluginContext.getConfig();
|
|
12
|
+
const { fixtureState, onFixtureStateChange } = slotProps;
|
|
13
|
+
return (React.createElement(ControlPanel, { fixtureState: fixtureState, controlActionOrder: controlActionOrder, onFixtureStateChange: onFixtureStateChange }));
|
|
14
|
+
});
|
|
15
|
+
export { register };
|
|
16
|
+
if (process.env.NODE_ENV !== 'test')
|
|
17
|
+
register();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FixtureStateSelectControl } from 'react-cosmos-core';
|
|
2
|
+
type Props = {
|
|
3
|
+
name: string;
|
|
4
|
+
control: FixtureStateSelectControl;
|
|
5
|
+
onChange: (name: string, select: FixtureStateSelectControl) => unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare function SelectValueInput({ name, control, onChange }: Props): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Select } from '../../components/inputs/Select.js';
|
|
3
|
+
import { Label, ValueDataContainer, ValueInputContainer, } from '../../components/ValueInputTree/ValueInput/shared.js';
|
|
4
|
+
import { lightBlue } from '../../style/colors.js';
|
|
5
|
+
export function SelectValueInput({ name, control, onChange }) {
|
|
6
|
+
const { options, currentValue } = control;
|
|
7
|
+
const id = `select-${name}`;
|
|
8
|
+
return (React.createElement(ValueInputContainer, { key: name },
|
|
9
|
+
React.createElement(Label, { title: name, htmlFor: id }, name),
|
|
10
|
+
React.createElement(ValueDataContainer, null,
|
|
11
|
+
React.createElement(Select, { id: id, options: options.map(option => ({ value: option, label: option })), value: currentValue, color: lightBlue, height: 24, padding: 5, onChange: newValue => onChange(name, {
|
|
12
|
+
...control,
|
|
13
|
+
currentValue: newValue.value,
|
|
14
|
+
}) }))));
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { createPlugin } from 'react-plugin';
|
|
3
|
+
import { SelectValueInput } from './SelectValueInput.js';
|
|
4
|
+
const { plug, register } = createPlugin({
|
|
5
|
+
name: 'controlSelect',
|
|
6
|
+
});
|
|
7
|
+
plug('control-select', ({ slotProps }) => {
|
|
8
|
+
const { controlName, control, onFixtureStateChange } = slotProps;
|
|
9
|
+
const handleChange = useCallback((selectName, updatedControl) => {
|
|
10
|
+
onFixtureStateChange(fixtureState => ({
|
|
11
|
+
...fixtureState,
|
|
12
|
+
controls: {
|
|
13
|
+
...fixtureState.controls,
|
|
14
|
+
[selectName]: updatedControl,
|
|
15
|
+
},
|
|
16
|
+
}));
|
|
17
|
+
}, [onFixtureStateChange]);
|
|
18
|
+
return (React.createElement(SelectValueInput, { key: controlName, name: controlName, control: control, onChange: handleChange }));
|
|
19
|
+
});
|
|
20
|
+
export { register };
|
|
21
|
+
if (process.env.NODE_ENV !== 'test')
|
|
22
|
+
register();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { omit } from 'lodash-es';
|
|
2
|
+
import { registerPlaygroundShortcuts } from 'react-cosmos-core';
|
|
3
|
+
import { createPlugin } from 'react-plugin';
|
|
4
|
+
const { onLoad, register } = createPlugin({
|
|
5
|
+
name: 'core',
|
|
6
|
+
initialState: {
|
|
7
|
+
commands: {},
|
|
8
|
+
},
|
|
9
|
+
defaultConfig: {
|
|
10
|
+
projectId: 'defaultProjectId',
|
|
11
|
+
fixturesDir: '__fixtures__',
|
|
12
|
+
fixtureFileSuffix: 'fixture',
|
|
13
|
+
devServerOn: false,
|
|
14
|
+
webRendererUrl: null,
|
|
15
|
+
},
|
|
16
|
+
methods: {
|
|
17
|
+
registerCommands,
|
|
18
|
+
runCommand,
|
|
19
|
+
getProjectId,
|
|
20
|
+
getFixtureFileVars,
|
|
21
|
+
isDevServerOn,
|
|
22
|
+
getWebRendererUrl,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
export { register };
|
|
26
|
+
if (process.env.NODE_ENV !== 'test')
|
|
27
|
+
register();
|
|
28
|
+
onLoad(pluginContext => registerPlaygroundShortcuts(command => runCommand(pluginContext, command)));
|
|
29
|
+
onLoad(pluginContext => {
|
|
30
|
+
const { projectId } = pluginContext.getConfig();
|
|
31
|
+
document.title = projectId;
|
|
32
|
+
});
|
|
33
|
+
function registerCommands(context, commands) {
|
|
34
|
+
context.setState(prevState => {
|
|
35
|
+
const existingCommandNames = Object.keys(prevState.commands);
|
|
36
|
+
Object.keys(commands).forEach(commandName => {
|
|
37
|
+
if (existingCommandNames.indexOf(commandName) !== -1)
|
|
38
|
+
throw new Error(`Command "${commandName} already registered`);
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
...prevState,
|
|
42
|
+
commands: { ...prevState.commands, ...commands },
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
return () => context.setState(prevState => ({
|
|
46
|
+
...prevState,
|
|
47
|
+
commands: omit(prevState.commands, ...Object.keys(commands)),
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
function runCommand(context, name) {
|
|
51
|
+
const { commands } = context.getState();
|
|
52
|
+
if (!commands[name])
|
|
53
|
+
return console.warn(`Command "${name}" is not available`);
|
|
54
|
+
commands[name]();
|
|
55
|
+
}
|
|
56
|
+
function getProjectId({ getConfig }) {
|
|
57
|
+
return getConfig().projectId;
|
|
58
|
+
}
|
|
59
|
+
function getFixtureFileVars({ getConfig }) {
|
|
60
|
+
const { fixturesDir, fixtureFileSuffix } = getConfig();
|
|
61
|
+
return { fixturesDir, fixtureFileSuffix };
|
|
62
|
+
}
|
|
63
|
+
function isDevServerOn({ getConfig }) {
|
|
64
|
+
return getConfig().devServerOn;
|
|
65
|
+
}
|
|
66
|
+
function getWebRendererUrl({ getConfig }) {
|
|
67
|
+
return getConfig().webRendererUrl;
|
|
68
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type Commands = Record<string, () => unknown>;
|
|
2
|
+
export type CoreSpec = {
|
|
3
|
+
name: 'core';
|
|
4
|
+
config: {
|
|
5
|
+
projectId: string;
|
|
6
|
+
fixturesDir: string;
|
|
7
|
+
fixtureFileSuffix: string;
|
|
8
|
+
devServerOn: boolean;
|
|
9
|
+
webRendererUrl: null | string;
|
|
10
|
+
};
|
|
11
|
+
state: {
|
|
12
|
+
commands: Commands;
|
|
13
|
+
};
|
|
14
|
+
methods: {
|
|
15
|
+
registerCommands(commands: Commands): () => void;
|
|
16
|
+
runCommand(name: string): unknown;
|
|
17
|
+
getProjectId(): string;
|
|
18
|
+
getFixtureFileVars(): {
|
|
19
|
+
fixturesDir: string;
|
|
20
|
+
fixtureFileSuffix: string;
|
|
21
|
+
};
|
|
22
|
+
isDevServerOn(): boolean;
|
|
23
|
+
getWebRendererUrl(): null | string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconButton32 } from '../../components/buttons/index.js';
|
|
3
|
+
import { StarIcon } from '../../components/icons/index.js';
|
|
4
|
+
export function BookmarkFixtureButton({ selected, onClick }) {
|
|
5
|
+
return (React.createElement(IconButton32, { icon: React.createElement(StarIcon, null), selected: selected, title: "Bookmark fixture", onClick: onClick }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FixtureId, FlatFixtureTree } from 'react-cosmos-core';
|
|
2
|
+
type Props = {
|
|
3
|
+
fixtureItems: FlatFixtureTree;
|
|
4
|
+
bookmarks: FixtureId[];
|
|
5
|
+
selectedFixtureId: FixtureId | null;
|
|
6
|
+
onFixtureSelect: (fixtureId: FixtureId) => void;
|
|
7
|
+
onBookmarkDelete: (fixtureId: FixtureId) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function FixtureBookmarks({ fixtureItems, bookmarks, selectedFixtureId, onFixtureSelect, onBookmarkDelete, }: Props): JSX.Element | null;
|
|
10
|
+
export {};
|