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,45 @@
|
|
|
1
|
+
import { ResponsiveViewport } from '../spec.js';
|
|
2
|
+
export declare const responsivePreviewPadding: {
|
|
3
|
+
top: number;
|
|
4
|
+
bottom: number;
|
|
5
|
+
left: number;
|
|
6
|
+
right: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const responsivePreviewBorderWidth = 1;
|
|
9
|
+
export declare const stretchStyle: {
|
|
10
|
+
display: string;
|
|
11
|
+
flex: number;
|
|
12
|
+
};
|
|
13
|
+
export declare function getStyles({ container, viewport, scaled, }: {
|
|
14
|
+
container: ResponsiveViewport;
|
|
15
|
+
viewport: ResponsiveViewport;
|
|
16
|
+
scaled: boolean;
|
|
17
|
+
}): {
|
|
18
|
+
maskContainerStyle: {
|
|
19
|
+
flex: number;
|
|
20
|
+
display: string;
|
|
21
|
+
justifyContent: string;
|
|
22
|
+
alignItems: string;
|
|
23
|
+
overflow: string;
|
|
24
|
+
};
|
|
25
|
+
padContainerStyle: {
|
|
26
|
+
readonly position: "relative";
|
|
27
|
+
readonly paddingTop: number;
|
|
28
|
+
readonly paddingBottom: number;
|
|
29
|
+
readonly paddingLeft: number;
|
|
30
|
+
readonly paddingRight: number;
|
|
31
|
+
};
|
|
32
|
+
alignContainerStyle: {
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
border: string;
|
|
36
|
+
overflow: string;
|
|
37
|
+
};
|
|
38
|
+
scaleContainerStyle: {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
transformOrigin: string;
|
|
42
|
+
transform: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export declare function getViewportScaleFactor(viewport: ResponsiveViewport, container: ResponsiveViewport): number;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { white20 } from '../../../style/colors.js';
|
|
2
|
+
export const responsivePreviewPadding = {
|
|
3
|
+
top: 8,
|
|
4
|
+
bottom: 24,
|
|
5
|
+
left: 24,
|
|
6
|
+
right: 24,
|
|
7
|
+
};
|
|
8
|
+
export const responsivePreviewBorderWidth = 1;
|
|
9
|
+
export const stretchStyle = { display: 'flex', flex: 1 };
|
|
10
|
+
export function getStyles({ container, viewport, scaled, }) {
|
|
11
|
+
const width = Math.max(16, viewport.width);
|
|
12
|
+
const height = Math.max(16, viewport.height);
|
|
13
|
+
const availableViewport = getAvailableViewport(container);
|
|
14
|
+
const widthScale = Math.min(1, availableViewport.width / width);
|
|
15
|
+
const heightScale = Math.min(1, availableViewport.height / height);
|
|
16
|
+
const scaleFactor = scaled ? Math.min(widthScale, heightScale) : 1;
|
|
17
|
+
const scaledWidth = width * scaleFactor;
|
|
18
|
+
const scaledHeight = height * scaleFactor;
|
|
19
|
+
return {
|
|
20
|
+
maskContainerStyle: getMaskContainerStyle(scaled, widthScale, heightScale),
|
|
21
|
+
padContainerStyle: getPadContainerStyle(),
|
|
22
|
+
alignContainerStyle: getAlignContainerStyle(scaledWidth, scaledHeight),
|
|
23
|
+
scaleContainerStyle: getScaleContainerStyle(width, height, scaleFactor),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function getViewportScaleFactor(viewport, container) {
|
|
27
|
+
const containerViewport = getAvailableViewport(container);
|
|
28
|
+
return Math.min(Math.min(1, containerViewport.width / viewport.width), Math.min(1, containerViewport.height / viewport.height));
|
|
29
|
+
}
|
|
30
|
+
function getAvailableViewport(container) {
|
|
31
|
+
return {
|
|
32
|
+
width: container.width - getHorPadding(),
|
|
33
|
+
height: container.height - getVerPadding(),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function getMaskContainerStyle(scale, widthScale, heightScale) {
|
|
37
|
+
return {
|
|
38
|
+
flex: 1,
|
|
39
|
+
display: 'flex',
|
|
40
|
+
justifyContent: scale || widthScale === 1 ? 'space-around' : 'flex-start',
|
|
41
|
+
alignItems: scale || heightScale === 1 ? 'center' : 'flex-start',
|
|
42
|
+
overflow: scale ? 'hidden' : 'scroll',
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function getPadContainerStyle() {
|
|
46
|
+
return {
|
|
47
|
+
position: 'relative',
|
|
48
|
+
paddingTop: responsivePreviewPadding.top,
|
|
49
|
+
paddingBottom: responsivePreviewPadding.bottom,
|
|
50
|
+
paddingLeft: responsivePreviewPadding.left,
|
|
51
|
+
paddingRight: responsivePreviewPadding.right,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function getAlignContainerStyle(scaledWidth, scaledHeight) {
|
|
55
|
+
return {
|
|
56
|
+
width: scaledWidth,
|
|
57
|
+
height: scaledHeight,
|
|
58
|
+
border: `${responsivePreviewBorderWidth}px solid ${white20}`,
|
|
59
|
+
overflow: 'hidden',
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function getScaleContainerStyle(width, height, scaleFactor) {
|
|
63
|
+
return {
|
|
64
|
+
width,
|
|
65
|
+
height,
|
|
66
|
+
transformOrigin: '0% 0%',
|
|
67
|
+
transform: `scale(${scaleFactor})`,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function getHorPadding() {
|
|
71
|
+
return (responsivePreviewPadding.left +
|
|
72
|
+
responsivePreviewPadding.right +
|
|
73
|
+
2 * responsivePreviewBorderWidth);
|
|
74
|
+
}
|
|
75
|
+
function getVerPadding() {
|
|
76
|
+
return (responsivePreviewPadding.top +
|
|
77
|
+
responsivePreviewPadding.bottom +
|
|
78
|
+
2 * responsivePreviewBorderWidth);
|
|
79
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconButton32 } from '../../../components/buttons/index.js';
|
|
3
|
+
import { SmartphoneIcon } from '../../../components/icons/index.js';
|
|
4
|
+
export function ToggleButton({ selected, onToggle }) {
|
|
5
|
+
return (React.createElement(IconButton32, { icon: React.createElement(SmartphoneIcon, null), title: "Toggle responsive mode", selected: selected, onClick: onToggle }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createPlugin } from 'react-plugin';
|
|
3
|
+
import { ResponsivePreview } from './ResponsivePreview/ResponsivePreview.js';
|
|
4
|
+
import { DEFAULT_DEVICES, DEFAULT_VIEWPORT_STATE, VIEWPORT_STORAGE_KEY, } from './shared.js';
|
|
5
|
+
import { ToggleButton } from './ToggleButton/index.js';
|
|
6
|
+
const { plug, namedPlug, register } = createPlugin({
|
|
7
|
+
name: 'responsivePreview',
|
|
8
|
+
defaultConfig: {
|
|
9
|
+
devices: DEFAULT_DEVICES,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
plug('rendererPreviewOuter', ({ children, pluginContext }) => {
|
|
13
|
+
const { getConfig, getMethodsOf } = pluginContext;
|
|
14
|
+
const { devices } = getConfig();
|
|
15
|
+
const rendererCore = getMethodsOf('rendererCore');
|
|
16
|
+
const { enabled, viewport, scaled } = getViewportState(pluginContext);
|
|
17
|
+
const onViewportChange = useViewportChange(pluginContext);
|
|
18
|
+
const onScaledChange = useScaledChange(pluginContext);
|
|
19
|
+
return (React.createElement(ResponsivePreview, { devices: devices, enabled: enabled, viewport: viewport, scaled: scaled, validFixtureSelected: rendererCore.isValidFixtureSelected(), setViewport: onViewportChange, setScaled: onScaledChange }, children));
|
|
20
|
+
});
|
|
21
|
+
namedPlug('rendererAction', 'responsivePreview', ({ pluginContext }) => {
|
|
22
|
+
const { getMethodsOf } = pluginContext;
|
|
23
|
+
const core = getMethodsOf('core');
|
|
24
|
+
const viewportState = getViewportState(pluginContext);
|
|
25
|
+
const { enabled, viewport } = viewportState;
|
|
26
|
+
if (!core.getWebRendererUrl())
|
|
27
|
+
return null;
|
|
28
|
+
return (React.createElement(ToggleButton, { selected: enabled, onToggle: () => {
|
|
29
|
+
if (enabled) {
|
|
30
|
+
setViewportState(pluginContext, { ...viewportState, enabled: false });
|
|
31
|
+
setFixtureStateViewport(pluginContext, null);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
setViewportState(pluginContext, { ...viewportState, enabled: true });
|
|
35
|
+
setFixtureStateViewport(pluginContext, viewport);
|
|
36
|
+
}
|
|
37
|
+
} }));
|
|
38
|
+
});
|
|
39
|
+
export { register };
|
|
40
|
+
if (process.env.NODE_ENV !== 'test')
|
|
41
|
+
register();
|
|
42
|
+
function useViewportChange(context) {
|
|
43
|
+
const viewportState = getViewportState(context);
|
|
44
|
+
return React.useCallback((viewportChange) => {
|
|
45
|
+
const viewport = typeof viewportChange === 'function'
|
|
46
|
+
? viewportChange(viewportState.viewport)
|
|
47
|
+
: viewportChange;
|
|
48
|
+
setViewportState(context, { ...viewportState, enabled: true, viewport });
|
|
49
|
+
setFixtureStateViewport(context, viewport);
|
|
50
|
+
}, [context, viewportState]);
|
|
51
|
+
}
|
|
52
|
+
function useScaledChange(context) {
|
|
53
|
+
const viewportState = getViewportState(context);
|
|
54
|
+
return React.useCallback((scaled) => setViewportState(context, { ...viewportState, scaled }), [context, viewportState]);
|
|
55
|
+
}
|
|
56
|
+
function getViewportState(context) {
|
|
57
|
+
const { getMethodsOf } = context;
|
|
58
|
+
const storage = getMethodsOf('storage');
|
|
59
|
+
const viewportState = storage.getItem(VIEWPORT_STORAGE_KEY) ||
|
|
60
|
+
DEFAULT_VIEWPORT_STATE;
|
|
61
|
+
const rendererCore = getMethodsOf('rendererCore');
|
|
62
|
+
const fixtureState = rendererCore.getFixtureState();
|
|
63
|
+
return fixtureState.viewport
|
|
64
|
+
? { ...viewportState, enabled: true, viewport: fixtureState.viewport }
|
|
65
|
+
: viewportState;
|
|
66
|
+
}
|
|
67
|
+
function setViewportState(context, viewportState) {
|
|
68
|
+
const { getMethodsOf } = context;
|
|
69
|
+
const storage = getMethodsOf('storage');
|
|
70
|
+
storage.setItem(VIEWPORT_STORAGE_KEY, viewportState);
|
|
71
|
+
}
|
|
72
|
+
function setFixtureStateViewport(context, viewport) {
|
|
73
|
+
const { getMethodsOf } = context;
|
|
74
|
+
const rendererCore = getMethodsOf('rendererCore');
|
|
75
|
+
rendererCore.setFixtureState(fixtureState => ({
|
|
76
|
+
...fixtureState,
|
|
77
|
+
viewport,
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FixtureState } from 'react-cosmos-core';
|
|
2
|
+
import { PluginContext } from 'react-plugin';
|
|
3
|
+
import { StorageSpec } from '../Storage/spec.js';
|
|
4
|
+
import { ResponsivePreviewSpec, ResponsiveViewport } from './spec.js';
|
|
5
|
+
export type ResponsivePreviewContext = PluginContext<ResponsivePreviewSpec>;
|
|
6
|
+
export type StorageMethods = StorageSpec['methods'];
|
|
7
|
+
export type FixtureStateWithViewport = FixtureState & {
|
|
8
|
+
viewport?: ResponsiveViewport;
|
|
9
|
+
};
|
|
10
|
+
export type ViewportState = {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
scaled: boolean;
|
|
13
|
+
viewport: ResponsiveViewport;
|
|
14
|
+
};
|
|
15
|
+
export declare const DEFAULT_DEVICES: {
|
|
16
|
+
label: string;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
}[];
|
|
20
|
+
export declare const VIEWPORT_STORAGE_KEY = "responsiveViewportState";
|
|
21
|
+
export declare const DEFAULT_VIEWPORT_STATE: ViewportState;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const DEFAULT_DEVICES = [
|
|
2
|
+
{ label: 'iPhone 5/SE', width: 320, height: 568 },
|
|
3
|
+
{ label: 'iPhone 6/7/8', width: 375, height: 667 },
|
|
4
|
+
{ label: 'iPhone 6/7/8 Plus', width: 414, height: 736 },
|
|
5
|
+
{ label: 'iPhone X', width: 375, height: 812 },
|
|
6
|
+
{ label: 'iPad', width: 768, height: 1024 },
|
|
7
|
+
{ label: 'iPad Pro', width: 1024, height: 1366 },
|
|
8
|
+
{ label: 'Small laptop', width: 1280, height: 720 },
|
|
9
|
+
{ label: 'Laptop', width: 1366, height: 768 },
|
|
10
|
+
{ label: 'Large laptop', width: 1600, height: 900 },
|
|
11
|
+
{ label: 'Full HD', width: 1920, height: 1080 },
|
|
12
|
+
{ label: 'Quad HD', width: 2560, height: 1440 },
|
|
13
|
+
];
|
|
14
|
+
export const VIEWPORT_STORAGE_KEY = 'responsiveViewportState';
|
|
15
|
+
export const DEFAULT_VIEWPORT_STATE = {
|
|
16
|
+
enabled: false,
|
|
17
|
+
scaled: true,
|
|
18
|
+
viewport: { width: 320, height: 568 },
|
|
19
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ResponsiveViewport = {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
};
|
|
5
|
+
export type ResponsiveDevice = ResponsiveViewport & {
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
8
|
+
export type ResponsivePreviewSpec = {
|
|
9
|
+
name: 'responsivePreview';
|
|
10
|
+
config: {
|
|
11
|
+
devices: ResponsiveDevice[];
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FixtureId } from 'react-cosmos-core';
|
|
2
|
+
type Props = {
|
|
3
|
+
selectedFixtureId: FixtureId | null;
|
|
4
|
+
rendererConnected: boolean;
|
|
5
|
+
validFixtureSelected: boolean;
|
|
6
|
+
globalActionOrder: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function GlobalHeader({ selectedFixtureId, rendererConnected, validFixtureSelected, globalActionOrder, }: Props): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArraySlot } from 'react-plugin';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { grey176, grey32, white10 } from '../../style/colors.js';
|
|
5
|
+
export function GlobalHeader({ selectedFixtureId, rendererConnected, validFixtureSelected, globalActionOrder, }) {
|
|
6
|
+
function getMessage() {
|
|
7
|
+
if (!rendererConnected) {
|
|
8
|
+
return React.createElement(Message, null, "Waiting for renderer...");
|
|
9
|
+
}
|
|
10
|
+
if (!selectedFixtureId) {
|
|
11
|
+
return React.createElement(Message, null, "No fixture selected");
|
|
12
|
+
}
|
|
13
|
+
if (!validFixtureSelected) {
|
|
14
|
+
return React.createElement(Message, null, "Fixture not found");
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return (React.createElement(Container, null,
|
|
19
|
+
React.createElement(Left, null),
|
|
20
|
+
getMessage(),
|
|
21
|
+
React.createElement(Right, null, rendererConnected && (React.createElement(ArraySlot, { name: "globalAction", plugOrder: globalActionOrder })))));
|
|
22
|
+
}
|
|
23
|
+
const Container = styled.div `
|
|
24
|
+
flex-shrink: 0;
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
height: 32px;
|
|
29
|
+
padding: 4px;
|
|
30
|
+
border-bottom: 1px solid ${white10};
|
|
31
|
+
background: ${grey32};
|
|
32
|
+
`;
|
|
33
|
+
const Actions = styled.div `
|
|
34
|
+
> button {
|
|
35
|
+
margin-left: 4px;
|
|
36
|
+
|
|
37
|
+
:first-child {
|
|
38
|
+
margin-left: 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
const Left = styled(Actions) `
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: row;
|
|
45
|
+
align-items: center;
|
|
46
|
+
`;
|
|
47
|
+
const Right = styled(Actions) `
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
align-items: center;
|
|
51
|
+
`;
|
|
52
|
+
const Message = styled.div `
|
|
53
|
+
padding: 4px;
|
|
54
|
+
color: ${grey176};
|
|
55
|
+
line-height: 24px;
|
|
56
|
+
white-space: nowrap;
|
|
57
|
+
text-overflow: ellipsis;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FixtureId, FlatFixtureTreeItem } from 'react-cosmos-core';
|
|
3
|
+
type Props = {
|
|
4
|
+
fixtureItems: FlatFixtureTreeItem[];
|
|
5
|
+
fixtureId: FixtureId;
|
|
6
|
+
navOpen: boolean;
|
|
7
|
+
panelOpen: boolean;
|
|
8
|
+
fixtureActionOrder: string[];
|
|
9
|
+
rendererActionOrder: string[];
|
|
10
|
+
onOpenNav: () => unknown;
|
|
11
|
+
onTogglePanel: () => unknown;
|
|
12
|
+
onFixtureSelect: (fixtureId: FixtureId) => unknown;
|
|
13
|
+
onClose: () => unknown;
|
|
14
|
+
};
|
|
15
|
+
export declare const RendererHeader: React.NamedExoticComponent<Props>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { isEqual } from 'lodash-es';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { IconButton32 } from '../../components/buttons/index.js';
|
|
5
|
+
import { MenuIcon, RotateCcwIcon, SlidersIcon, XCircleIcon, } from '../../components/icons/index.js';
|
|
6
|
+
import { FixtureActionSlot } from '../../slots/FixtureActionSlot.js';
|
|
7
|
+
import { RendererActionSlot } from '../../slots/RendererActionSlot.js';
|
|
8
|
+
import { grey176, grey32, white10 } from '../../style/colors.js';
|
|
9
|
+
export const RendererHeader = React.memo(function RendererHeader({ fixtureItems, fixtureId, navOpen, panelOpen, fixtureActionOrder, rendererActionOrder, onOpenNav, onTogglePanel, onFixtureSelect, onClose, }) {
|
|
10
|
+
const fixtureItem = findFixtureItemById(fixtureItems, fixtureId);
|
|
11
|
+
const slotProps = React.useMemo(() => ({ fixtureId }), [fixtureId]);
|
|
12
|
+
const onReload = React.useCallback(() => onFixtureSelect(fixtureId), [fixtureId, onFixtureSelect]);
|
|
13
|
+
return (React.createElement(Container, null,
|
|
14
|
+
React.createElement(Left, null,
|
|
15
|
+
!navOpen && (React.createElement(React.Fragment, null,
|
|
16
|
+
React.createElement(IconButton32, { icon: React.createElement(MenuIcon, null), title: "Show fixture list", selected: false, onClick: onOpenNav }),
|
|
17
|
+
React.createElement(ButtonSeparator, null))),
|
|
18
|
+
React.createElement(IconButton32, { icon: React.createElement(XCircleIcon, null), title: "Close fixture", onClick: onClose }),
|
|
19
|
+
React.createElement(IconButton32, { icon: React.createElement(RotateCcwIcon, null), title: "Reload fixture", onClick: onReload }),
|
|
20
|
+
React.createElement(FixtureActionSlot, { slotProps: slotProps, plugOrder: fixtureActionOrder })),
|
|
21
|
+
fixtureItem && React.createElement(FixtureName, null, getFixtureName(fixtureItem)),
|
|
22
|
+
React.createElement(Right, null,
|
|
23
|
+
React.createElement(RendererActionSlot, { slotProps: slotProps, plugOrder: rendererActionOrder }),
|
|
24
|
+
React.createElement(IconButton32, { icon: React.createElement(SlidersIcon, null), title: "Toggle control panel", selected: panelOpen, onClick: onTogglePanel }))));
|
|
25
|
+
});
|
|
26
|
+
function findFixtureItemById(fixtureItems, fixtureId) {
|
|
27
|
+
return fixtureItems.find(fixtureItem => isEqual(fixtureItem.fixtureId, fixtureId));
|
|
28
|
+
}
|
|
29
|
+
function getFixtureName({ name, fileName }) {
|
|
30
|
+
return name ? `${fileName} ${name}` : fileName;
|
|
31
|
+
}
|
|
32
|
+
const Container = styled.div `
|
|
33
|
+
flex-shrink: 0;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: row;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
height: 40px;
|
|
39
|
+
padding: 0 4px;
|
|
40
|
+
border-bottom: 1px solid ${white10};
|
|
41
|
+
background: ${grey32};
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
overflow-x: auto;
|
|
44
|
+
`;
|
|
45
|
+
const Actions = styled.div `
|
|
46
|
+
> button {
|
|
47
|
+
margin-left: 4px;
|
|
48
|
+
|
|
49
|
+
:first-child {
|
|
50
|
+
margin-left: 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
const Left = styled(Actions) `
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: row;
|
|
57
|
+
align-items: center;
|
|
58
|
+
`;
|
|
59
|
+
const Right = styled(Actions) `
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: row;
|
|
62
|
+
align-items: center;
|
|
63
|
+
`;
|
|
64
|
+
const ButtonSeparator = styled.div `
|
|
65
|
+
flex-shrink: 0;
|
|
66
|
+
background: ${white10};
|
|
67
|
+
width: 1px;
|
|
68
|
+
height: 40px;
|
|
69
|
+
margin-left: 4px;
|
|
70
|
+
`;
|
|
71
|
+
const FixtureName = styled.div `
|
|
72
|
+
margin: 0 32px;
|
|
73
|
+
padding: 4px 0;
|
|
74
|
+
color: ${grey176};
|
|
75
|
+
line-height: 24px;
|
|
76
|
+
white-space: nowrap;
|
|
77
|
+
text-overflow: ellipsis;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
`;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FixtureId, FixtureState, FlatFixtureTreeItem, StateUpdater } from 'react-cosmos-core';
|
|
2
|
+
type Props = {
|
|
3
|
+
storageCacheReady: boolean;
|
|
4
|
+
fixtureItems: FlatFixtureTreeItem[];
|
|
5
|
+
selectedFixtureId: FixtureId | null;
|
|
6
|
+
rendererConnected: boolean;
|
|
7
|
+
validFixtureSelected: boolean;
|
|
8
|
+
fixtureState: FixtureState;
|
|
9
|
+
navOpen: boolean;
|
|
10
|
+
panelOpen: boolean;
|
|
11
|
+
navWidth: number;
|
|
12
|
+
panelWidth: number;
|
|
13
|
+
sidePanelRowOrder: string[];
|
|
14
|
+
globalActionOrder: string[];
|
|
15
|
+
globalOrder: string[];
|
|
16
|
+
navRowOrder: string[];
|
|
17
|
+
fixtureActionOrder: string[];
|
|
18
|
+
rendererActionOrder: string[];
|
|
19
|
+
onToggleNav: () => unknown;
|
|
20
|
+
onTogglePanel: () => unknown;
|
|
21
|
+
onFixtureSelect: (fixtureId: FixtureId) => unknown;
|
|
22
|
+
onFixtureClose: () => unknown;
|
|
23
|
+
onFixtureStateChange: (stateUpdater: StateUpdater<FixtureState>) => void;
|
|
24
|
+
setNavWidth: (width: number) => unknown;
|
|
25
|
+
setPanelWidth: (width: number) => unknown;
|
|
26
|
+
};
|
|
27
|
+
export declare function Root({ storageCacheReady, fixtureItems, selectedFixtureId, rendererConnected, validFixtureSelected, fixtureState, navOpen, panelOpen, navWidth, panelWidth, sidePanelRowOrder, globalActionOrder, globalOrder, navRowOrder, fixtureActionOrder, rendererActionOrder, onToggleNav, onTogglePanel, onFixtureSelect, onFixtureClose, onFixtureStateChange, setNavWidth, setPanelWidth, }: Props): JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArraySlot, Slot } from 'react-plugin';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { useDrag } from '../../hooks/useDrag.js';
|
|
5
|
+
import { NavRowSlot } from '../../slots/NavRowSlot.js';
|
|
6
|
+
import { grey32, grey8, white10 } from '../../style/colors.js';
|
|
7
|
+
import { GlobalHeader } from './GlobalHeader.js';
|
|
8
|
+
import { RendererHeader } from './RendererHeader.js';
|
|
9
|
+
import { SidePanel } from './SidePanel.js';
|
|
10
|
+
export function Root({ storageCacheReady, fixtureItems, selectedFixtureId, rendererConnected, validFixtureSelected, fixtureState, navOpen, panelOpen, navWidth, panelWidth, sidePanelRowOrder, globalActionOrder, globalOrder, navRowOrder, fixtureActionOrder, rendererActionOrder, onToggleNav, onTogglePanel, onFixtureSelect, onFixtureClose, onFixtureStateChange, setNavWidth, setPanelWidth, }) {
|
|
11
|
+
const navDrag = useDrag({
|
|
12
|
+
value: navWidth,
|
|
13
|
+
onChange: setNavWidth,
|
|
14
|
+
});
|
|
15
|
+
const panelDrag = useDrag({
|
|
16
|
+
value: panelWidth,
|
|
17
|
+
reverse: true,
|
|
18
|
+
onChange: setPanelWidth,
|
|
19
|
+
});
|
|
20
|
+
if (!storageCacheReady) {
|
|
21
|
+
return React.createElement(Container, null);
|
|
22
|
+
}
|
|
23
|
+
const showNav = rendererConnected && (navOpen || !validFixtureSelected);
|
|
24
|
+
const dragging = navDrag.dragging || panelDrag.dragging;
|
|
25
|
+
// z-indexes are set here on purpose to show the layer hierarchy at a glance
|
|
26
|
+
return (React.createElement(Container, { dragging: dragging },
|
|
27
|
+
showNav && (React.createElement(Draggable, { style: { width: navWidth, zIndex: 2 } },
|
|
28
|
+
React.createElement(Nav, null, rendererConnected && (React.createElement(NavRowSlot, { slotProps: { onCloseNav: onToggleNav }, plugOrder: navRowOrder }))),
|
|
29
|
+
navDrag.dragging && React.createElement(DragOverlay, null),
|
|
30
|
+
React.createElement(NavDragHandle, { ref: navDrag.dragElRef }))),
|
|
31
|
+
React.createElement(MainContainer, { key: "main", style: { zIndex: 1 } },
|
|
32
|
+
!validFixtureSelected && (React.createElement(GlobalHeader, { selectedFixtureId: selectedFixtureId, rendererConnected: rendererConnected, validFixtureSelected: validFixtureSelected, globalActionOrder: globalActionOrder })),
|
|
33
|
+
React.createElement(RendererContainer, { key: "rendererContainer" },
|
|
34
|
+
selectedFixtureId && validFixtureSelected && (React.createElement(RendererHeader, { fixtureItems: fixtureItems, fixtureId: selectedFixtureId, navOpen: navOpen, panelOpen: panelOpen, fixtureActionOrder: fixtureActionOrder, rendererActionOrder: rendererActionOrder, onOpenNav: onToggleNav, onTogglePanel: onTogglePanel, onFixtureSelect: onFixtureSelect, onClose: onFixtureClose })),
|
|
35
|
+
React.createElement(RendererBody, { key: "rendererBody" },
|
|
36
|
+
React.createElement(Slot, { name: "rendererPreview" }),
|
|
37
|
+
dragging && React.createElement(DragOverlay, null),
|
|
38
|
+
panelOpen && selectedFixtureId && (React.createElement(ControlPanelContainer, { style: { width: panelWidth, zIndex: 3 } },
|
|
39
|
+
React.createElement(SidePanel, { fixtureId: selectedFixtureId, fixtureState: fixtureState, sidePanelRowOrder: sidePanelRowOrder, onFixtureStateChange: onFixtureStateChange }),
|
|
40
|
+
panelDrag.dragging && React.createElement(DragOverlay, null),
|
|
41
|
+
React.createElement(PanelDragHandle, { ref: panelDrag.dragElRef })))),
|
|
42
|
+
React.createElement(Slot, { name: "contentOverlay" }))),
|
|
43
|
+
React.createElement("div", { style: { zIndex: 4 } },
|
|
44
|
+
React.createElement(ArraySlot, { name: "global", plugOrder: globalOrder }))));
|
|
45
|
+
}
|
|
46
|
+
const Container = styled.div.attrs({ 'data-testid': 'root' }) `
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 0;
|
|
49
|
+
bottom: 0;
|
|
50
|
+
left: 0;
|
|
51
|
+
right: 0;
|
|
52
|
+
display: flex;
|
|
53
|
+
background: ${grey32};
|
|
54
|
+
cursor: ${props => (props.dragging ? 'col-resize' : 'default')};
|
|
55
|
+
`;
|
|
56
|
+
const Draggable = styled.div `
|
|
57
|
+
flex-shrink: 0;
|
|
58
|
+
position: relative;
|
|
59
|
+
`;
|
|
60
|
+
const Nav = styled.div `
|
|
61
|
+
width: 100%;
|
|
62
|
+
height: 100%;
|
|
63
|
+
background: ${grey32};
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
`;
|
|
67
|
+
const MainContainer = styled.div `
|
|
68
|
+
flex: 1;
|
|
69
|
+
position: relative;
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
`;
|
|
74
|
+
const RendererContainer = styled.div `
|
|
75
|
+
flex: 1;
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
position: relative;
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
`;
|
|
81
|
+
const RendererBody = styled.div `
|
|
82
|
+
flex: 1;
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: row;
|
|
85
|
+
justify-content: flex-end;
|
|
86
|
+
background: ${grey8};
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
`;
|
|
89
|
+
const ControlPanelContainer = styled(Draggable) `
|
|
90
|
+
max-width: 100%;
|
|
91
|
+
overflow-x: hidden;
|
|
92
|
+
overflow-y: auto;
|
|
93
|
+
`;
|
|
94
|
+
const DragHandle = styled.div `
|
|
95
|
+
position: absolute;
|
|
96
|
+
top: 0;
|
|
97
|
+
width: 1px;
|
|
98
|
+
height: 100%;
|
|
99
|
+
background-color: ${white10};
|
|
100
|
+
background-clip: content-box;
|
|
101
|
+
cursor: col-resize;
|
|
102
|
+
user-select: none;
|
|
103
|
+
`;
|
|
104
|
+
const NavDragHandle = styled(DragHandle) `
|
|
105
|
+
right: -2px;
|
|
106
|
+
padding: 0 2px;
|
|
107
|
+
`;
|
|
108
|
+
const PanelDragHandle = styled(DragHandle) `
|
|
109
|
+
left: -2px;
|
|
110
|
+
padding: 0 1px 0 2px;
|
|
111
|
+
`;
|
|
112
|
+
// The purpose of DragOverlay is to cover the renderer iframe while dragging,
|
|
113
|
+
// because otherwise the iframe steaps the mousemove events and stops the drag.
|
|
114
|
+
const DragOverlay = styled.div `
|
|
115
|
+
position: absolute;
|
|
116
|
+
top: 0;
|
|
117
|
+
bottom: 0;
|
|
118
|
+
left: 0;
|
|
119
|
+
right: 0;
|
|
120
|
+
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FixtureId, FixtureState, StateUpdater } from 'react-cosmos-core';
|
|
3
|
+
type Props = {
|
|
4
|
+
fixtureId: FixtureId;
|
|
5
|
+
fixtureState: FixtureState;
|
|
6
|
+
onFixtureStateChange: (stateUpdater: StateUpdater<FixtureState>) => void;
|
|
7
|
+
sidePanelRowOrder: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare const SidePanel: React.NamedExoticComponent<Props>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { SidePanelRowSlot } from '../../slots/SidePanelRowSlot.js';
|
|
4
|
+
import { grey32 } from '../../style/colors.js';
|
|
5
|
+
export const SidePanel = React.memo(function SidePanel({ fixtureId, fixtureState, onFixtureStateChange, sidePanelRowOrder, }) {
|
|
6
|
+
const slotProps = React.useMemo(() => ({ fixtureId, fixtureState, onFixtureStateChange }), [fixtureId, fixtureState, onFixtureStateChange]);
|
|
7
|
+
return (React.createElement(Container, null,
|
|
8
|
+
React.createElement(Content, null,
|
|
9
|
+
React.createElement(SidePanelRowSlot, { slotProps: slotProps, plugOrder: sidePanelRowOrder }))));
|
|
10
|
+
});
|
|
11
|
+
const Container = styled.div `
|
|
12
|
+
height: 100%;
|
|
13
|
+
padding: 0 0 0 1px;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
justify-content: flex-start;
|
|
17
|
+
background: ${grey32};
|
|
18
|
+
`;
|
|
19
|
+
// The background color is required for the proper scroll bar color theme
|
|
20
|
+
const Content = styled.div `
|
|
21
|
+
width: 100%;
|
|
22
|
+
max-height: 100%;
|
|
23
|
+
background: ${grey32};
|
|
24
|
+
overflow-x: hidden;
|
|
25
|
+
overflow-y: auto;
|
|
26
|
+
`;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconButton8 } from '../../components/buttons/index.js';
|
|
3
|
+
import { MenuIcon } from '../../components/icons/index.js';
|
|
4
|
+
export function ToggleNavButton({ disabled, selected, onToggle }) {
|
|
5
|
+
return (React.createElement(IconButton8, { title: "Show fixture list", icon: React.createElement(MenuIcon, null), disabled: disabled, selected: selected, onClick: onToggle }));
|
|
6
|
+
}
|