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,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createFixtureTree, flattenFixtureTree } from 'react-cosmos-core';
|
|
3
|
+
import { createPlugin } from 'react-plugin';
|
|
4
|
+
import { isNavOpen, openNav } from './navOpen.js';
|
|
5
|
+
import { getNavWidthApi } from './navWidth.js';
|
|
6
|
+
import { isPanelOpen, openPanel } from './panelOpen.js';
|
|
7
|
+
import { getPanelWidthApi } from './panelWidth.js';
|
|
8
|
+
import { Root } from './Root.js';
|
|
9
|
+
const { onLoad, plug, register } = createPlugin({
|
|
10
|
+
name: 'root',
|
|
11
|
+
defaultConfig: {
|
|
12
|
+
sidePanelRowOrder: [],
|
|
13
|
+
globalActionOrder: [],
|
|
14
|
+
globalOrder: [],
|
|
15
|
+
navRowOrder: [],
|
|
16
|
+
fixtureActionOrder: [],
|
|
17
|
+
rendererActionOrder: [],
|
|
18
|
+
},
|
|
19
|
+
initialState: {
|
|
20
|
+
storageCacheReady: false,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
onLoad(context => {
|
|
24
|
+
const storage = context.getMethodsOf('storage');
|
|
25
|
+
const core = context.getMethodsOf('core');
|
|
26
|
+
storage.loadCache(core.getProjectId()).then(() => {
|
|
27
|
+
context.setState({ storageCacheReady: true });
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
onLoad(context => {
|
|
31
|
+
const core = context.getMethodsOf('core');
|
|
32
|
+
return core.registerCommands({
|
|
33
|
+
toggleFixtureList: () => openNav(context, !isNavOpen(context)),
|
|
34
|
+
toggleControlPanel: () => openPanel(context, !isPanelOpen(context)),
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
plug('root', ({ pluginContext }) => {
|
|
38
|
+
const { getConfig, getState, getMethodsOf } = pluginContext;
|
|
39
|
+
const router = getMethodsOf('router');
|
|
40
|
+
const rendererCore = getMethodsOf('rendererCore');
|
|
41
|
+
const fixtureItems = useFixtureItems(pluginContext);
|
|
42
|
+
const onToggleNav = useOpenNav(pluginContext);
|
|
43
|
+
const onTogglePanel = useOpenPanel(pluginContext);
|
|
44
|
+
const { storageCacheReady } = getState();
|
|
45
|
+
if (!storageCacheReady) {
|
|
46
|
+
return (React.createElement(Root, { storageCacheReady: false, fixtureItems: [], selectedFixtureId: null, rendererConnected: false, validFixtureSelected: false, fixtureState: {}, navOpen: false, panelOpen: false, navWidth: 0, panelWidth: 0, sidePanelRowOrder: [], globalActionOrder: [], globalOrder: [], navRowOrder: [], fixtureActionOrder: [], rendererActionOrder: [], onToggleNav: () => { }, onTogglePanel: () => { }, onFixtureSelect: () => { }, onFixtureClose: () => { }, onFixtureStateChange: () => { }, setNavWidth: () => { }, setPanelWidth: () => { } }));
|
|
47
|
+
}
|
|
48
|
+
const { navWidth, setNavWidth } = getNavWidthApi(pluginContext);
|
|
49
|
+
const { panelWidth, setPanelWidth } = getPanelWidthApi(pluginContext);
|
|
50
|
+
const { sidePanelRowOrder, globalActionOrder, globalOrder, navRowOrder, fixtureActionOrder, rendererActionOrder, } = getConfig();
|
|
51
|
+
return (React.createElement(Root, { storageCacheReady: true, fixtureItems: fixtureItems, selectedFixtureId: router.getSelectedFixtureId(), rendererConnected: rendererCore.isRendererConnected(), validFixtureSelected: rendererCore.isValidFixtureSelected(), fixtureState: rendererCore.getFixtureState(), navOpen: isNavOpen(pluginContext), panelOpen: isPanelOpen(pluginContext), navWidth: navWidth, panelWidth: panelWidth, sidePanelRowOrder: sidePanelRowOrder, globalActionOrder: globalActionOrder, globalOrder: globalOrder, navRowOrder: navRowOrder, fixtureActionOrder: fixtureActionOrder, rendererActionOrder: rendererActionOrder, onToggleNav: onToggleNav, onTogglePanel: onTogglePanel, onFixtureSelect: router.selectFixture, onFixtureClose: router.unselectFixture, onFixtureStateChange: rendererCore.setFixtureState, setNavWidth: setNavWidth, setPanelWidth: setPanelWidth }));
|
|
52
|
+
});
|
|
53
|
+
export { register };
|
|
54
|
+
if (process.env.NODE_ENV !== 'test')
|
|
55
|
+
register();
|
|
56
|
+
function useFixtureItems(context) {
|
|
57
|
+
const { getMethodsOf } = context;
|
|
58
|
+
const core = getMethodsOf('core');
|
|
59
|
+
const { fixturesDir, fixtureFileSuffix } = core.getFixtureFileVars();
|
|
60
|
+
const rendererCore = getMethodsOf('rendererCore');
|
|
61
|
+
const fixtures = rendererCore.getFixtures();
|
|
62
|
+
return React.useMemo(() => flattenFixtureTree(createFixtureTree({ fixturesDir, fixtureFileSuffix, fixtures })), [fixtureFileSuffix, fixtures, fixturesDir]);
|
|
63
|
+
}
|
|
64
|
+
function useOpenNav(context) {
|
|
65
|
+
return React.useCallback(() => {
|
|
66
|
+
openNav(context, !isNavOpen(context));
|
|
67
|
+
}, [context]);
|
|
68
|
+
}
|
|
69
|
+
function useOpenPanel(context) {
|
|
70
|
+
return React.useCallback(() => {
|
|
71
|
+
openPanel(context, !isPanelOpen(context));
|
|
72
|
+
}, [context]);
|
|
73
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const NAV_OPEN_STORAGE_KEY = 'navOpen';
|
|
2
|
+
const NAV_OPEN_DEFAULT = true;
|
|
3
|
+
export function isNavOpen(context) {
|
|
4
|
+
const storage = context.getMethodsOf('storage');
|
|
5
|
+
const open = storage.getItem(NAV_OPEN_STORAGE_KEY);
|
|
6
|
+
return typeof open === 'boolean' ? open : NAV_OPEN_DEFAULT;
|
|
7
|
+
}
|
|
8
|
+
export function openNav(context, open) {
|
|
9
|
+
const storage = context.getMethodsOf('storage');
|
|
10
|
+
storage.setItem(NAV_OPEN_STORAGE_KEY, open);
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const NAV_WIDTH_STORAGE_KEY = 'navWidth';
|
|
2
|
+
const NAV_WIDTH_DEFAULT = 320;
|
|
3
|
+
const NAV_WIDTH_MIN = 224;
|
|
4
|
+
const NAV_WIDTH_MAX = 512;
|
|
5
|
+
export function getNavWidthApi({ getMethodsOf }) {
|
|
6
|
+
const storage = getMethodsOf('storage');
|
|
7
|
+
return {
|
|
8
|
+
navWidth: storage.getItem(NAV_WIDTH_STORAGE_KEY) || NAV_WIDTH_DEFAULT,
|
|
9
|
+
setNavWidth: (newWidth) => storage.setItem(NAV_WIDTH_STORAGE_KEY, restrictNavWidth(newWidth)),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function restrictNavWidth(navWidth) {
|
|
13
|
+
return Math.min(NAV_WIDTH_MAX, Math.max(NAV_WIDTH_MIN, navWidth));
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const PANEL_OPEN_STORAGE_KEY = 'sidePanelOpen';
|
|
2
|
+
const PANEL_OPEN_DEFAULT = true;
|
|
3
|
+
export function isPanelOpen(context) {
|
|
4
|
+
const { getMethodsOf } = context;
|
|
5
|
+
const rendererCore = getMethodsOf('rendererCore');
|
|
6
|
+
if (!rendererCore.isValidFixtureSelected()) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
const storage = context.getMethodsOf('storage');
|
|
10
|
+
const open = storage.getItem(PANEL_OPEN_STORAGE_KEY);
|
|
11
|
+
return typeof open === 'boolean' ? open : PANEL_OPEN_DEFAULT;
|
|
12
|
+
}
|
|
13
|
+
export function openPanel(context, open) {
|
|
14
|
+
const storage = context.getMethodsOf('storage');
|
|
15
|
+
storage.setItem(PANEL_OPEN_STORAGE_KEY, open);
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const PANEL_WIDTH_STORAGE_KEY = 'panelWidth';
|
|
2
|
+
const PANEL_WIDTH_DEFAULT = 320;
|
|
3
|
+
const PANEL_WIDTH_MIN = 224;
|
|
4
|
+
const PANEL_WIDTH_MAX = 512;
|
|
5
|
+
export function getPanelWidthApi({ getMethodsOf }) {
|
|
6
|
+
const storage = getMethodsOf('storage');
|
|
7
|
+
return {
|
|
8
|
+
panelWidth: storage.getItem(PANEL_WIDTH_STORAGE_KEY) || PANEL_WIDTH_DEFAULT,
|
|
9
|
+
setPanelWidth: (newWidth) => storage.setItem(PANEL_WIDTH_STORAGE_KEY, restrictPanelWidth(newWidth)),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function restrictPanelWidth(panelWidth) {
|
|
13
|
+
return Math.min(PANEL_WIDTH_MAX, Math.max(PANEL_WIDTH_MIN, panelWidth));
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type RootSpec = {
|
|
2
|
+
name: 'root';
|
|
3
|
+
config: {
|
|
4
|
+
sidePanelRowOrder: string[];
|
|
5
|
+
globalActionOrder: string[];
|
|
6
|
+
globalOrder: string[];
|
|
7
|
+
navRowOrder: string[];
|
|
8
|
+
fixtureActionOrder: string[];
|
|
9
|
+
rendererActionOrder: string[];
|
|
10
|
+
};
|
|
11
|
+
state: {
|
|
12
|
+
storageCacheReady: boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { isEqual } from 'lodash-es';
|
|
2
|
+
import { createPlugin } from 'react-plugin';
|
|
3
|
+
import { getUrlParams, pushUrlParams, subscribeToLocationChanges, } from '../../shared/url.js';
|
|
4
|
+
const { onLoad, register } = createPlugin({
|
|
5
|
+
name: 'router',
|
|
6
|
+
initialState: {
|
|
7
|
+
urlParams: {},
|
|
8
|
+
},
|
|
9
|
+
methods: {
|
|
10
|
+
getSelectedFixtureId,
|
|
11
|
+
selectFixture,
|
|
12
|
+
unselectFixture,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
onLoad(context => {
|
|
16
|
+
const { setState } = context;
|
|
17
|
+
setState({ urlParams: getUrlParams() });
|
|
18
|
+
return subscribeToLocationChanges((urlParams) => {
|
|
19
|
+
const { fixtureId } = context.getState().urlParams;
|
|
20
|
+
const fixtureChanged = !isEqual(urlParams.fixtureId, fixtureId);
|
|
21
|
+
setState({ urlParams }, () => {
|
|
22
|
+
if (fixtureChanged) {
|
|
23
|
+
emitFixtureChangeEvent(context);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
export { register };
|
|
29
|
+
if (process.env.NODE_ENV !== 'test')
|
|
30
|
+
register();
|
|
31
|
+
function getSelectedFixtureId({ getState }) {
|
|
32
|
+
return getState().urlParams.fixtureId || null;
|
|
33
|
+
}
|
|
34
|
+
function selectFixture(context, fixtureId) {
|
|
35
|
+
setUrlParams(context, { fixtureId });
|
|
36
|
+
}
|
|
37
|
+
function unselectFixture(context) {
|
|
38
|
+
setUrlParams(context, {});
|
|
39
|
+
}
|
|
40
|
+
function setUrlParams(context, nextUrlParams) {
|
|
41
|
+
const { urlParams } = context.getState();
|
|
42
|
+
const fixtureChanged = !isEqual(nextUrlParams.fixtureId, urlParams.fixtureId);
|
|
43
|
+
const urlParamsEqual = isEqual(nextUrlParams, urlParams);
|
|
44
|
+
context.setState({ urlParams: nextUrlParams }, () => {
|
|
45
|
+
// Setting identical url params is considered a "reset" request
|
|
46
|
+
if (fixtureChanged || urlParamsEqual) {
|
|
47
|
+
emitFixtureChangeEvent(context);
|
|
48
|
+
}
|
|
49
|
+
if (!urlParamsEqual) {
|
|
50
|
+
pushUrlParams(context.getState().urlParams);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function emitFixtureChangeEvent(context) {
|
|
55
|
+
context.emit('fixtureChange', getSelectedFixtureId(context));
|
|
56
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FixtureId, PlaygroundUrlParams } from 'react-cosmos-core';
|
|
2
|
+
export type RouterSpec = {
|
|
3
|
+
name: 'router';
|
|
4
|
+
state: {
|
|
5
|
+
urlParams: PlaygroundUrlParams;
|
|
6
|
+
};
|
|
7
|
+
methods: {
|
|
8
|
+
getSelectedFixtureId(): null | FixtureId;
|
|
9
|
+
selectFixture(fixtureId: FixtureId): void;
|
|
10
|
+
unselectFixture(): void;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
fixtureChange(fixtureId: null | FixtureId): void;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { createPlugin } from 'react-plugin';
|
|
3
|
+
import { ExpandCollapseValues } from '../../components/ValueInputTree/ExpandCollapseValues.js';
|
|
4
|
+
import { ValueInputTree } from '../../components/ValueInputTree/index.js';
|
|
5
|
+
import { useTreeExpansionStorage } from './storage.js';
|
|
6
|
+
const { namedPlug, plug, register } = createPlugin({
|
|
7
|
+
name: 'standardControl',
|
|
8
|
+
});
|
|
9
|
+
plug('control-standard', ({ pluginContext, slotProps }) => {
|
|
10
|
+
const { controlName, control, onFixtureStateChange } = slotProps;
|
|
11
|
+
const treeExpansionApi = useTreeExpansionStorage(pluginContext);
|
|
12
|
+
const values = useMemo(() => ({ [controlName]: control.currentValue }), [control.currentValue, controlName]);
|
|
13
|
+
const handleValueChange = useCallback((updatedValues) => {
|
|
14
|
+
onFixtureStateChange(fixtureState => ({
|
|
15
|
+
...fixtureState,
|
|
16
|
+
controls: {
|
|
17
|
+
...fixtureState.controls,
|
|
18
|
+
[controlName]: {
|
|
19
|
+
...control,
|
|
20
|
+
currentValue: updatedValues[controlName],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
}, [control, controlName, onFixtureStateChange]);
|
|
25
|
+
return (React.createElement(ValueInputTree, { id: `control-${controlName}`, values: values, onValueChange: handleValueChange, ...treeExpansionApi }));
|
|
26
|
+
});
|
|
27
|
+
namedPlug('controlAction', 'expandCollapse', ({ pluginContext, slotProps }) => {
|
|
28
|
+
const { controls } = slotProps;
|
|
29
|
+
const treeExpansionApi = useTreeExpansionStorage(pluginContext);
|
|
30
|
+
return (React.createElement(ExpandCollapseValues, { values: extractValuesFromStandardControls(controls), ...treeExpansionApi }));
|
|
31
|
+
});
|
|
32
|
+
function extractValuesFromStandardControls(controls) {
|
|
33
|
+
const values = {};
|
|
34
|
+
Object.keys(controls).forEach(controlName => {
|
|
35
|
+
const control = controls[controlName];
|
|
36
|
+
if (control.type === 'standard')
|
|
37
|
+
values[controlName] = control.currentValue;
|
|
38
|
+
});
|
|
39
|
+
return values;
|
|
40
|
+
}
|
|
41
|
+
export { register };
|
|
42
|
+
if (process.env.NODE_ENV !== 'test')
|
|
43
|
+
register();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PluginContext } from 'react-plugin';
|
|
2
|
+
import { TreeExpansion } from '../../shared/treeExpansion.js';
|
|
3
|
+
import { StandardControlSpec } from './spec.js';
|
|
4
|
+
export declare function useTreeExpansionStorage(pluginContext: PluginContext<StandardControlSpec>): {
|
|
5
|
+
expansion: TreeExpansion;
|
|
6
|
+
setExpansion: (newTreeExpansion: TreeExpansion) => void;
|
|
7
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
const storageKey = 'standardControlTreeExpansion';
|
|
3
|
+
const emptyTreeExpansion = {};
|
|
4
|
+
// TODO: Persist tree expansion state per fixture ID?
|
|
5
|
+
export function useTreeExpansionStorage(pluginContext) {
|
|
6
|
+
const storage = pluginContext.getMethodsOf('storage');
|
|
7
|
+
const expansion = storage.getItem(storageKey) || emptyTreeExpansion;
|
|
8
|
+
const setExpansion = React.useCallback((newTreeExpansion) => storage.setItem(storageKey, newTreeExpansion), [storage]);
|
|
9
|
+
return { expansion, setExpansion };
|
|
10
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import localForage from 'localforage';
|
|
2
|
+
import { createPlugin } from 'react-plugin';
|
|
3
|
+
const { register } = createPlugin({
|
|
4
|
+
name: 'storage',
|
|
5
|
+
initialState: {
|
|
6
|
+
cache: null,
|
|
7
|
+
},
|
|
8
|
+
methods: {
|
|
9
|
+
loadCache,
|
|
10
|
+
getItem,
|
|
11
|
+
setItem,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
if (process.env.NODE_ENV !== 'test')
|
|
15
|
+
register();
|
|
16
|
+
export { register };
|
|
17
|
+
async function loadCache(context, projectId) {
|
|
18
|
+
const items = (await localForage.getItem(getProjectKey(projectId))) || {};
|
|
19
|
+
context.setState({ cache: { projectId, items } });
|
|
20
|
+
}
|
|
21
|
+
function getItem(context, key) {
|
|
22
|
+
const { cache } = context.getState();
|
|
23
|
+
if (!cache) {
|
|
24
|
+
throw new Error(`Can't retrieve item "${key}" before loading storage`);
|
|
25
|
+
}
|
|
26
|
+
return cache.items[key];
|
|
27
|
+
}
|
|
28
|
+
function setItem(context, key, value) {
|
|
29
|
+
const { cache } = context.getState();
|
|
30
|
+
if (!cache) {
|
|
31
|
+
throw new Error(`Can't set item "${key}" before loading storage`);
|
|
32
|
+
}
|
|
33
|
+
const { projectId, items } = cache;
|
|
34
|
+
const newItems = { ...items, [key]: value };
|
|
35
|
+
context.setState({ cache: { projectId, items: newItems } });
|
|
36
|
+
localForage.setItem(getProjectKey(projectId), newItems);
|
|
37
|
+
}
|
|
38
|
+
function getProjectKey(projectId) {
|
|
39
|
+
return `cosmos-${projectId}`;
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type Cache = {
|
|
2
|
+
projectId: string;
|
|
3
|
+
items: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export type StorageSpec = {
|
|
8
|
+
name: 'storage';
|
|
9
|
+
state: {
|
|
10
|
+
cache: null | Cache;
|
|
11
|
+
};
|
|
12
|
+
methods: {
|
|
13
|
+
loadCache(projectId: string): Promise<unknown>;
|
|
14
|
+
getItem<T>(key: string): void | T;
|
|
15
|
+
setItem<T>(key: string, value: T): void;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import './BuildNotifications/index.js';
|
|
2
|
+
import './ClassStatePanel/index.js';
|
|
3
|
+
import './ContentOverlay/index.js';
|
|
4
|
+
import './ControlPanel/index.js';
|
|
5
|
+
import './ControlSelect/index.js';
|
|
6
|
+
import './Core/index.js';
|
|
7
|
+
import './FixtureBookmark/index.js';
|
|
8
|
+
import './FixtureSearch/index.js';
|
|
9
|
+
import './FixtureTree/index.js';
|
|
10
|
+
import './FullScreenButton/index.js';
|
|
11
|
+
import './MessageHandler/index.js';
|
|
12
|
+
import './Notifications/index.js';
|
|
13
|
+
import './PluginList/index.js';
|
|
14
|
+
import './PropsPanel/index.js';
|
|
15
|
+
import './RemoteRenderer/index.js';
|
|
16
|
+
import './RendererCore/index.js';
|
|
17
|
+
import './RendererPreview/index.js';
|
|
18
|
+
import './RendererSelect/index.js';
|
|
19
|
+
import './ResponsivePreview/index.js';
|
|
20
|
+
import './Root/index.js';
|
|
21
|
+
import './Router/index.js';
|
|
22
|
+
import './StandardControl/index.js';
|
|
23
|
+
import './Storage/index.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { enablePlugin } from 'react-plugin';
|
|
2
|
+
import './BuildNotifications/index.js';
|
|
3
|
+
import './ClassStatePanel/index.js';
|
|
4
|
+
import './ContentOverlay/index.js';
|
|
5
|
+
import './ControlPanel/index.js';
|
|
6
|
+
import './ControlSelect/index.js';
|
|
7
|
+
import './Core/index.js';
|
|
8
|
+
import './FixtureBookmark/index.js';
|
|
9
|
+
import './FixtureSearch/index.js';
|
|
10
|
+
import './FixtureTree/index.js';
|
|
11
|
+
import './FullScreenButton/index.js';
|
|
12
|
+
import './MessageHandler/index.js';
|
|
13
|
+
import './Notifications/index.js';
|
|
14
|
+
import './PluginList/index.js';
|
|
15
|
+
import './PropsPanel/index.js';
|
|
16
|
+
import './RemoteRenderer/index.js';
|
|
17
|
+
import './RendererCore/index.js';
|
|
18
|
+
import './RendererPreview/index.js';
|
|
19
|
+
import './RendererSelect/index.js';
|
|
20
|
+
import './ResponsivePreview/index.js';
|
|
21
|
+
import './Root/index.js';
|
|
22
|
+
import './Router/index.js';
|
|
23
|
+
import './StandardControl/index.js';
|
|
24
|
+
import './Storage/index.js';
|
|
25
|
+
const disabledPlugins = ['rendererSelect', 'pluginList'];
|
|
26
|
+
// Unregistering plugins first makes this file hot-reloadable because a plugin
|
|
27
|
+
// can only be registered once with a given name
|
|
28
|
+
// resetPlugins();
|
|
29
|
+
disabledPlugins.forEach(disabledPlugin => enablePlugin(disabledPlugin, false));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const DEFAULT_PLUGIN_CONFIG: {
|
|
2
|
+
root: {
|
|
3
|
+
sidePanelRowOrder: string[];
|
|
4
|
+
globalActionOrder: string[];
|
|
5
|
+
globalOrder: string[];
|
|
6
|
+
navRowOrder: string[];
|
|
7
|
+
fixtureActionOrder: string[];
|
|
8
|
+
rendererActionOrder: string[];
|
|
9
|
+
};
|
|
10
|
+
controlPanel: {
|
|
11
|
+
controlActionOrder: string[];
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const DEFAULT_PLUGIN_CONFIG = {
|
|
2
|
+
root: {
|
|
3
|
+
sidePanelRowOrder: ['values', 'props', 'classState'],
|
|
4
|
+
globalActionOrder: ['remoteRenderer'],
|
|
5
|
+
globalOrder: ['fixtureSearch', 'notifications'],
|
|
6
|
+
navRowOrder: ['fixtureSearch', 'fixtureBookmarks', 'fixtureTree'],
|
|
7
|
+
fixtureActionOrder: ['bookmarkFixture'],
|
|
8
|
+
rendererActionOrder: ['editFixture', 'fullScreen', 'responsivePreview'],
|
|
9
|
+
},
|
|
10
|
+
controlPanel: {
|
|
11
|
+
controlActionOrder: ['expandCollapse'],
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FixtureId, FixtureTreeNode } from 'react-cosmos-core';
|
|
2
|
+
export declare function recordContainsFixtureId(fixtureIds: Record<string, FixtureId>, fixtureId: FixtureId): boolean;
|
|
3
|
+
export declare function nodeContainsFixtureId({ data, children }: FixtureTreeNode, fixtureId: FixtureId): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isEqual } from 'lodash-es';
|
|
2
|
+
export function recordContainsFixtureId(fixtureIds, fixtureId) {
|
|
3
|
+
return Object.keys(fixtureIds).some(fixtureName => isEqual(fixtureIds[fixtureName], fixtureId));
|
|
4
|
+
}
|
|
5
|
+
export function nodeContainsFixtureId({ data, children }, fixtureId) {
|
|
6
|
+
if (data.type === 'fixture')
|
|
7
|
+
return isEqual(data.fixtureId, fixtureId);
|
|
8
|
+
if (data.type === 'multiFixture')
|
|
9
|
+
return recordContainsFixtureId(data.fixtureIds, fixtureId);
|
|
10
|
+
return (children !== undefined &&
|
|
11
|
+
Object.keys(children).some(childName => nodeContainsFixtureId(children[childName], fixtureId)));
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TreeNode } from 'react-cosmos-core';
|
|
2
|
+
export type TreeExpansion = {
|
|
3
|
+
[nodePath: string]: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare function isTreeFullyCollapsed(treeExpansion: TreeExpansion): boolean;
|
|
6
|
+
export declare function getFullTreeExpansion(rootNode: TreeNode<any>): Record<string, boolean>;
|
|
7
|
+
export declare function hasExpandableNodes(rootNode: TreeNode<any>): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function isTreeFullyCollapsed(treeExpansion) {
|
|
2
|
+
return Object.keys(treeExpansion).every(childPath => treeExpansion[childPath] === false);
|
|
3
|
+
}
|
|
4
|
+
export function getFullTreeExpansion(rootNode) {
|
|
5
|
+
const childPaths = getExpandableNodes(rootNode);
|
|
6
|
+
return childPaths.reduce((treeExpansion, dirName) => ({ ...treeExpansion, [dirName]: true }), {});
|
|
7
|
+
}
|
|
8
|
+
export function hasExpandableNodes(rootNode) {
|
|
9
|
+
return getExpandableNodes(rootNode).length > 0;
|
|
10
|
+
}
|
|
11
|
+
function getExpandableNodes(treeNode, parents = []) {
|
|
12
|
+
const { children } = treeNode;
|
|
13
|
+
if (!children)
|
|
14
|
+
return [];
|
|
15
|
+
const nodePaths = [];
|
|
16
|
+
Object.keys(children).forEach(childName => {
|
|
17
|
+
const childNode = children[childName];
|
|
18
|
+
if (childNode.children && Object.keys(childNode.children).length > 0) {
|
|
19
|
+
nodePaths.push([...parents, childName].join('/'));
|
|
20
|
+
nodePaths.push(...getExpandableNodes(childNode, [...parents, childName]));
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return nodePaths;
|
|
24
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PlaygroundUrlParams } from 'react-cosmos-core';
|
|
2
|
+
export declare function getUrlParams(): PlaygroundUrlParams;
|
|
3
|
+
export declare function pushUrlParams(urlParams: PlaygroundUrlParams): void;
|
|
4
|
+
export declare function subscribeToLocationChanges(userHandler: (urlParams: PlaygroundUrlParams) => unknown): () => void;
|
|
5
|
+
export declare function createRelativePlaygroundUrl(urlParams: PlaygroundUrlParams): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { parsePlaygroundUrlQuery, stringifyPlaygroundUrlQuery, } from 'react-cosmos-core';
|
|
2
|
+
export function getUrlParams() {
|
|
3
|
+
return parsePlaygroundUrlQuery(location.search);
|
|
4
|
+
}
|
|
5
|
+
export function pushUrlParams(urlParams) {
|
|
6
|
+
const query = stringifyPlaygroundUrlQuery(urlParams);
|
|
7
|
+
// Refresh page completely when pushState isn't supported
|
|
8
|
+
if (!history.pushState) {
|
|
9
|
+
location.search = query;
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
// Update URL without refreshing page
|
|
13
|
+
history.pushState({}, '', createRelativeUrlWithQuery(query));
|
|
14
|
+
}
|
|
15
|
+
export function subscribeToLocationChanges(userHandler) {
|
|
16
|
+
const handler = () => {
|
|
17
|
+
userHandler(getUrlParams());
|
|
18
|
+
};
|
|
19
|
+
window.addEventListener('popstate', handler);
|
|
20
|
+
return () => {
|
|
21
|
+
window.removeEventListener('popstate', handler);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function createRelativePlaygroundUrl(urlParams) {
|
|
25
|
+
const query = stringifyPlaygroundUrlQuery(urlParams);
|
|
26
|
+
return createRelativeUrlWithQuery(query);
|
|
27
|
+
}
|
|
28
|
+
function createRelativeUrlWithQuery(query) {
|
|
29
|
+
// NOTE: "./" is used to return to the home URL. Passing an empty string
|
|
30
|
+
// doesn't do anything. And passing "/" doesn't work if Cosmos is not hosted
|
|
31
|
+
// at root (sub)domain level.
|
|
32
|
+
return query.length > 0 ? `?${query}` : './';
|
|
33
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FixtureStateControls } from 'react-cosmos-core';
|
|
2
|
+
export type ControlActionSlotProps = {
|
|
3
|
+
controls: FixtureStateControls;
|
|
4
|
+
};
|
|
5
|
+
type Props = {
|
|
6
|
+
slotProps: ControlActionSlotProps;
|
|
7
|
+
plugOrder: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare function ControlActionSlot({ slotProps, plugOrder }: Props): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FixtureState, FixtureStateControl, StateUpdater } from 'react-cosmos-core';
|
|
2
|
+
export type ControlSlotProps<TControl extends FixtureStateControl> = {
|
|
3
|
+
controlName: string;
|
|
4
|
+
control: TControl;
|
|
5
|
+
onFixtureStateChange: (stateUpdater: StateUpdater<FixtureState>) => void;
|
|
6
|
+
};
|
|
7
|
+
type Props = {
|
|
8
|
+
slotProps: ControlSlotProps<any>;
|
|
9
|
+
};
|
|
10
|
+
export declare function ControlSlot({ slotProps }: Props): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FixtureId } from 'react-cosmos-core';
|
|
2
|
+
export type FixtureActionSlotProps = {
|
|
3
|
+
fixtureId: FixtureId;
|
|
4
|
+
};
|
|
5
|
+
type Props = {
|
|
6
|
+
slotProps: FixtureActionSlotProps;
|
|
7
|
+
plugOrder: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare function FixtureActionSlot({ slotProps, plugOrder }: Props): JSX.Element;
|
|
10
|
+
export {};
|