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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-present Ovidiu Cherecheș
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type SvgElementType = React.ReactElement<'path' | 'polyline' | 'line' | 'circle' | 'ellipse' | 'rect' | 'polygon' | 'g' | 'defs' | 'title'>;
|
|
3
|
+
export type SvgChildren = SvgElementType | SvgElementType[];
|
|
4
|
+
type Props = {
|
|
5
|
+
children: SvgChildren;
|
|
6
|
+
[attr: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
export declare function BaseSvg({ children, ...attrs }: Props): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export function BaseSvg({ children, ...attrs }) {
|
|
4
|
+
return (React.createElement(StyledSvg, { xmlns: "http://www.w3.org/2000/svg", ...attrs }, children));
|
|
5
|
+
}
|
|
6
|
+
const StyledSvg = styled.svg `
|
|
7
|
+
display: block;
|
|
8
|
+
`;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseSvg } from './BaseSvg.js';
|
|
3
|
+
export function Icon({ children, size = '100%' }) {
|
|
4
|
+
return (React.createElement(BaseSvg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }, children));
|
|
5
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
// https://stackoverflow.com/a/11752084/128816
|
|
4
|
+
const isMacLike = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
|
|
5
|
+
const padding = 5;
|
|
6
|
+
export function KeyBox({ value, bgColor, textColor, size = 24, fontSize = 14, }) {
|
|
7
|
+
const displayValue = value === '⌘' && !isMacLike ? 'Ctrl' : value;
|
|
8
|
+
return (React.createElement(Container, { style: {
|
|
9
|
+
backgroundColor: bgColor,
|
|
10
|
+
color: textColor,
|
|
11
|
+
minWidth: size - 2 * padding,
|
|
12
|
+
height: size,
|
|
13
|
+
padding: `0 ${padding}px`,
|
|
14
|
+
fontSize,
|
|
15
|
+
lineHeight: `${size}px`,
|
|
16
|
+
} }, displayValue));
|
|
17
|
+
}
|
|
18
|
+
const Container = styled.span `
|
|
19
|
+
flex-shrink: 0;
|
|
20
|
+
margin: 0 0 0 5px;
|
|
21
|
+
padding: 0 ${padding}px;
|
|
22
|
+
border-radius: 5px;
|
|
23
|
+
text-align: center;
|
|
24
|
+
|
|
25
|
+
:first-child {
|
|
26
|
+
margin-left: 0;
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const SidePanelContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const SidePanelHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
type TitleProps = {
|
|
4
|
+
label: string;
|
|
5
|
+
componentName?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function SidePanelTitle({ label, componentName }: TitleProps): JSX.Element;
|
|
8
|
+
export declare const SidePanelActions: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
|
+
export declare const SidePanelBody: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { grey128, grey160, grey32, white10 } from '../style/colors.js';
|
|
4
|
+
export const SidePanelContainer = styled.div `
|
|
5
|
+
background: ${grey32};
|
|
6
|
+
border-top: 1px solid ${white10};
|
|
7
|
+
|
|
8
|
+
:first-child {
|
|
9
|
+
border-top: none;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
export const SidePanelHeader = styled.div `
|
|
13
|
+
height: 40px;
|
|
14
|
+
padding: 0 4px 0 24px;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
align-items: center;
|
|
19
|
+
`;
|
|
20
|
+
export function SidePanelTitle({ label, componentName }) {
|
|
21
|
+
return (React.createElement(TitleContainer, null,
|
|
22
|
+
React.createElement(TitleLabel, null, label),
|
|
23
|
+
typeof componentName === 'string' && (React.createElement(ComponentName, null, componentName ? componentName : React.createElement("em", null, "Unnamed")))));
|
|
24
|
+
}
|
|
25
|
+
export const SidePanelActions = styled.div `
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: row;
|
|
28
|
+
|
|
29
|
+
> button {
|
|
30
|
+
margin-left: 4px;
|
|
31
|
+
|
|
32
|
+
:first-child {
|
|
33
|
+
margin-left: 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
export const SidePanelBody = styled.div `
|
|
38
|
+
padding: 0 4px 8px 4px;
|
|
39
|
+
`;
|
|
40
|
+
const TitleContainer = styled.div `
|
|
41
|
+
color: ${grey128};
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
text-overflow: ellipsis;
|
|
45
|
+
`;
|
|
46
|
+
const TitleLabel = styled.span `
|
|
47
|
+
text-transform: uppercase;
|
|
48
|
+
`;
|
|
49
|
+
const ComponentName = styled.span `
|
|
50
|
+
padding-left: 8px;
|
|
51
|
+
color: ${grey160};
|
|
52
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TreeNode } from 'react-cosmos-core';
|
|
3
|
+
import { TreeExpansion } from '../shared/treeExpansion.js';
|
|
4
|
+
type Props<Item> = {
|
|
5
|
+
node: TreeNode<Item>;
|
|
6
|
+
name?: string;
|
|
7
|
+
parents?: string[];
|
|
8
|
+
expansion: TreeExpansion;
|
|
9
|
+
setExpansion: (expansion: TreeExpansion) => unknown;
|
|
10
|
+
renderNode: (args: {
|
|
11
|
+
node: TreeNode<Item>;
|
|
12
|
+
name: string;
|
|
13
|
+
parents: string[];
|
|
14
|
+
expanded: boolean;
|
|
15
|
+
onToggle: () => unknown;
|
|
16
|
+
}) => ReactNode;
|
|
17
|
+
};
|
|
18
|
+
export declare function TreeView<Item>({ node, name, parents, expansion, setExpansion, renderNode, }: Props<Item>): JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
// The root doesn't have a name and its data isn't rendered
|
|
3
|
+
// And the children of the root node are always expanded
|
|
4
|
+
export function TreeView({ node, name, parents = [], expansion, setExpansion, renderNode, }) {
|
|
5
|
+
const expanded = name ? expansion[getTreeNodePath(parents, name)] : true;
|
|
6
|
+
const onToggle = useCallback(() => {
|
|
7
|
+
if (name) {
|
|
8
|
+
const nodePath = getTreeNodePath(parents, name);
|
|
9
|
+
setExpansion({ ...expansion, [nodePath]: !expansion[nodePath] });
|
|
10
|
+
}
|
|
11
|
+
}, [expansion, name, parents, setExpansion]);
|
|
12
|
+
const { children } = node;
|
|
13
|
+
return (React.createElement(React.Fragment, null,
|
|
14
|
+
name !== undefined &&
|
|
15
|
+
renderNode({ node, name, parents, expanded, onToggle }),
|
|
16
|
+
children &&
|
|
17
|
+
expanded &&
|
|
18
|
+
Object.keys(children).map(childName => {
|
|
19
|
+
const childNode = children[childName];
|
|
20
|
+
const nextParents = name ? [...parents, name] : parents;
|
|
21
|
+
return (React.createElement(TreeView, { key: childName, node: childNode, name: childName, parents: nextParents, expansion: expansion, setExpansion: setExpansion, renderNode: renderNode }));
|
|
22
|
+
})));
|
|
23
|
+
}
|
|
24
|
+
function getTreeNodePath(parents, name) {
|
|
25
|
+
return [...parents, name].join('/');
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FixtureStateValues } from 'react-cosmos-core';
|
|
2
|
+
import { TreeExpansion } from '../../shared/treeExpansion.js';
|
|
3
|
+
type Props = {
|
|
4
|
+
values: FixtureStateValues;
|
|
5
|
+
expansion: TreeExpansion;
|
|
6
|
+
setExpansion: (treeExpansion: TreeExpansion) => unknown;
|
|
7
|
+
};
|
|
8
|
+
export declare function ExpandCollapseValues({ values, expansion, setExpansion, }: Props): JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getFullTreeExpansion, hasExpandableNodes, isTreeFullyCollapsed, } from '../../shared/treeExpansion.js';
|
|
3
|
+
import { IconButton32 } from '../buttons/index.js';
|
|
4
|
+
import { MinusSquareIcon, PlusSquareIcon } from '../icons/index.js';
|
|
5
|
+
import { createValueTree } from './valueTree.js';
|
|
6
|
+
export function ExpandCollapseValues({ values, expansion, setExpansion, }) {
|
|
7
|
+
const rootNode = createValueTree(values);
|
|
8
|
+
if (!hasExpandableNodes(rootNode))
|
|
9
|
+
return null;
|
|
10
|
+
return isTreeFullyCollapsed(expansion) ? (React.createElement(IconButton32, { title: "Expand all fixture tree folders", icon: React.createElement(PlusSquareIcon, null), onClick: () => setExpansion(getFullTreeExpansion(rootNode)) })) : (React.createElement(IconButton32, { title: "Collapse all fixture tree folders", icon: React.createElement(MinusSquareIcon, null), onClick: () => setExpansion({}) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { blue, lightBlue } from '../../../style/colors.js';
|
|
4
|
+
import { Label, ValueDataContainer } from './shared.js';
|
|
5
|
+
export function BooleanValueInput({ id, name, data, onChange }) {
|
|
6
|
+
const onToggle = React.useCallback(() => onChange(!data), [onChange, data]);
|
|
7
|
+
return (React.createElement(React.Fragment, null,
|
|
8
|
+
React.createElement(Label, { title: name, as: "span", onClick: onToggle }, name),
|
|
9
|
+
React.createElement(ValueDataContainer, null,
|
|
10
|
+
React.createElement(BooleanButton, { onClick: onToggle }, data ? 'true' : 'false'))));
|
|
11
|
+
}
|
|
12
|
+
const BooleanButton = styled.button `
|
|
13
|
+
height: 24px;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0 5px;
|
|
16
|
+
border: none;
|
|
17
|
+
border-radius: 3px;
|
|
18
|
+
background: transparent;
|
|
19
|
+
color: ${lightBlue};
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
line-height: 24px;
|
|
22
|
+
outline: none;
|
|
23
|
+
user-select: none;
|
|
24
|
+
|
|
25
|
+
:focus {
|
|
26
|
+
box-shadow: 0 0 0.5px 1px ${blue};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
::-moz-focus-inner {
|
|
30
|
+
border: 0;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Label, UneditableInput, ValueDataContainer } from './shared.js';
|
|
3
|
+
export function NullValueInput({ name }) {
|
|
4
|
+
return (React.createElement(React.Fragment, null,
|
|
5
|
+
React.createElement(Label, { title: name, disabled: true }, name),
|
|
6
|
+
React.createElement(ValueDataContainer, null,
|
|
7
|
+
React.createElement(UneditableInput, null,
|
|
8
|
+
React.createElement("em", null, "null")))));
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { blue, grey248, grey8 } from '../../../style/colors.js';
|
|
3
|
+
import { NumberInput } from '../../inputs/NumberInput.js';
|
|
4
|
+
import { Label, ValueDataContainer } from './shared.js';
|
|
5
|
+
export function NumberValueInput({ id, name, data, onChange }) {
|
|
6
|
+
return (React.createElement(React.Fragment, null,
|
|
7
|
+
React.createElement(Label, { title: name, htmlFor: id }, name),
|
|
8
|
+
React.createElement(ValueDataContainer, null,
|
|
9
|
+
React.createElement(NumberInput, { id: id, value: data, styles: {
|
|
10
|
+
focusedColor: grey248,
|
|
11
|
+
focusedBg: grey8,
|
|
12
|
+
focusedBoxShadow: `0 0 0.5px 1px ${blue}`,
|
|
13
|
+
}, onChange: onChange }))));
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useFocus } from '../../../hooks/useFocus.js';
|
|
3
|
+
import { blue, grey248, grey8 } from '../../../style/colors.js';
|
|
4
|
+
import { TextContainer, TextField, TextInputContainer, TextMirror, } from '../../inputs/shared.js';
|
|
5
|
+
import { Label, ValueDataContainer } from './shared.js';
|
|
6
|
+
export function StringValueInput({ id, name, data, onChange }) {
|
|
7
|
+
const { focused, onFocus, onBlur } = useFocus();
|
|
8
|
+
const onInputChange = React.useCallback((e) => onChange(e.currentTarget.value), [onChange]);
|
|
9
|
+
// Mirror textarea behavior and add an extra row after user adds a new line
|
|
10
|
+
const mirrorText = focused ? data.replace(/\n$/, `\n `) : data;
|
|
11
|
+
return (React.createElement(React.Fragment, null,
|
|
12
|
+
React.createElement(Label, { title: name, htmlFor: id }, name),
|
|
13
|
+
React.createElement(ValueDataContainer, null,
|
|
14
|
+
React.createElement(TextInputContainer, { focused: focused, focusedBg: grey8, focusedBoxShadow: `0 0 0.5px 1px ${blue}` },
|
|
15
|
+
React.createElement(TextContainer, null,
|
|
16
|
+
React.createElement(TextMirror, { minWidth: 64, focused: focused }, data.length > 0 || focused ? mirrorText : React.createElement("em", null, "empty")),
|
|
17
|
+
React.createElement(TextField, { rows: 1, id: id, value: data, focused: focused, color: grey248, onChange: onInputChange, onFocus: onFocus, onBlur: onBlur }))))));
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Label, UneditableInput, ValueDataContainer } from './shared.js';
|
|
3
|
+
export function UndefinedValueInput({ name }) {
|
|
4
|
+
return (React.createElement(React.Fragment, null,
|
|
5
|
+
React.createElement(Label, { title: name, disabled: true }, name),
|
|
6
|
+
React.createElement(ValueDataContainer, null,
|
|
7
|
+
React.createElement(UneditableInput, null,
|
|
8
|
+
React.createElement("em", null, "undefined")))));
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Label, UneditableInput, ValueDataContainer } from './shared.js';
|
|
3
|
+
export function UnserializableValueInput({ name, data }) {
|
|
4
|
+
return (React.createElement(React.Fragment, null,
|
|
5
|
+
React.createElement(Label, { title: name, disabled: true }, name),
|
|
6
|
+
React.createElement(ValueDataContainer, null,
|
|
7
|
+
React.createElement(UneditableInput, { title: data }, trimMultilineValue(data)))));
|
|
8
|
+
}
|
|
9
|
+
function trimMultilineValue(data) {
|
|
10
|
+
return data.indexOf(`\n`) !== -1 ? `${data.split(`\n`)[0]}...` : data;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PrimitiveData } from 'react-cosmos-core';
|
|
2
|
+
import { LeafValue } from '../shared.js';
|
|
3
|
+
type Props = {
|
|
4
|
+
value: LeafValue;
|
|
5
|
+
name: string;
|
|
6
|
+
id: string;
|
|
7
|
+
indentLevel: number;
|
|
8
|
+
onChange: (data: PrimitiveData) => unknown;
|
|
9
|
+
};
|
|
10
|
+
export declare function ValueInput({ value, name, id, indentLevel, onChange }: Props): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ValueInputSlot } from '../../../slots/ValueInputSlot.js';
|
|
3
|
+
import { ValueTreeItem } from '../shared.js';
|
|
4
|
+
import { BooleanValueInput } from './BooleanValueInput.js';
|
|
5
|
+
import { NullValueInput } from './NullValueInput.js';
|
|
6
|
+
import { NumberValueInput } from './NumberValueInput.js';
|
|
7
|
+
import { ValueInputContainer } from './shared.js';
|
|
8
|
+
import { StringValueInput } from './StringValueInput.js';
|
|
9
|
+
import { UndefinedValueInput } from './UndefinedValueInput.js';
|
|
10
|
+
import { UnserializableValueInput } from './UnserializableValueInput.js';
|
|
11
|
+
export function ValueInput({ value, name, id, indentLevel, onChange }) {
|
|
12
|
+
return (React.createElement(ValueInputSlot, { slotProps: { id, name, value, indentLevel, onChange } },
|
|
13
|
+
React.createElement(ValueTreeItem, { indentLevel: indentLevel },
|
|
14
|
+
React.createElement(ValueInputContainer, null, getInput(id, name, value, onChange)))));
|
|
15
|
+
}
|
|
16
|
+
function getInput(id, name, value, onChange) {
|
|
17
|
+
if (value.type === 'unserializable')
|
|
18
|
+
return (React.createElement(UnserializableValueInput, { name: name, data: value.stringifiedData }));
|
|
19
|
+
if (typeof value.data === 'string')
|
|
20
|
+
return (React.createElement(StringValueInput, { id: id, name: name, data: value.data, onChange: onChange }));
|
|
21
|
+
if (typeof value.data === 'number')
|
|
22
|
+
return (React.createElement(NumberValueInput, { id: id, name: name, data: value.data, onChange: onChange }));
|
|
23
|
+
if (typeof value.data === 'boolean')
|
|
24
|
+
return (React.createElement(BooleanValueInput, { id: id, name: name, data: value.data, onChange: onChange }));
|
|
25
|
+
if (value.data === null)
|
|
26
|
+
return React.createElement(NullValueInput, { name: name });
|
|
27
|
+
if (value.data === undefined)
|
|
28
|
+
return React.createElement(UndefinedValueInput, { name: name });
|
|
29
|
+
throw new Error(`Invalid primitive value: ${value.data}`);
|
|
30
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const Label: import("styled-components").StyledComponent<"label", any, {
|
|
2
|
+
disabled?: boolean | undefined;
|
|
3
|
+
}, never>;
|
|
4
|
+
export declare const ValueInputContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const ValueDataContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const UneditableInput: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { disabledColors, grey128, grey224 } from '../../../style/colors.js';
|
|
3
|
+
export const Label = styled.label `
|
|
4
|
+
padding: 0;
|
|
5
|
+
color: ${disabledColors(grey224, grey128)};
|
|
6
|
+
font-size: 14px;
|
|
7
|
+
user-select: none;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
text-overflow: ellipsis;
|
|
10
|
+
`;
|
|
11
|
+
export const ValueInputContainer = styled.div `
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
align-items: flex-start;
|
|
15
|
+
min-height: 28px;
|
|
16
|
+
line-height: 28px;
|
|
17
|
+
padding: 0 0 0 20px;
|
|
18
|
+
`;
|
|
19
|
+
export const ValueDataContainer = styled.div `
|
|
20
|
+
flex: 1;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: row;
|
|
23
|
+
justify-content: flex-start;
|
|
24
|
+
min-width: 44px;
|
|
25
|
+
min-height: 28px;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
padding: 2px 2px 2px 3px;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
`;
|
|
30
|
+
export const UneditableInput = styled.span `
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
height: 24px;
|
|
33
|
+
padding: 2px 5px;
|
|
34
|
+
line-height: 20px;
|
|
35
|
+
color: ${grey128};
|
|
36
|
+
font-style: italic;
|
|
37
|
+
white-space: pre;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
text-overflow: ellipsis;
|
|
40
|
+
cursor: not-allowed;
|
|
41
|
+
`;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { blue, disabledColors, grey128, grey160, grey224, } from '../../style/colors.js';
|
|
4
|
+
import { ChevronDownIcon, ChevronRightIcon } from '../icons/index.js';
|
|
5
|
+
import { ValueTreeItem } from './shared.js';
|
|
6
|
+
export function ValueInputDir({ name, childNames, expanded, indentLevel, onToggle, }) {
|
|
7
|
+
const disabled = childNames.length === 0;
|
|
8
|
+
return (React.createElement(ValueTreeItem, { indentLevel: indentLevel },
|
|
9
|
+
React.createElement(ButtonContainer, null,
|
|
10
|
+
React.createElement(Button, { disabled: disabled, onClick: onToggle },
|
|
11
|
+
React.createElement(React.Fragment, null,
|
|
12
|
+
!disabled && (React.createElement(ChevronContainer, null, expanded ? React.createElement(ChevronDownIcon, null) : React.createElement(ChevronRightIcon, null))),
|
|
13
|
+
React.createElement(Text, null,
|
|
14
|
+
React.createElement(DirName, { disabled: disabled }, name),
|
|
15
|
+
React.createElement(ChildrenInfo, null, getChildInfo(childNames))))))));
|
|
16
|
+
}
|
|
17
|
+
function getChildInfo(childNames) {
|
|
18
|
+
return childNames.length > 0 ? `{ ${childNames.join(', ')} }` : `{}`;
|
|
19
|
+
}
|
|
20
|
+
const ButtonContainer = styled.div `
|
|
21
|
+
padding: 2px 0;
|
|
22
|
+
`;
|
|
23
|
+
const Button = styled.button `
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: row;
|
|
26
|
+
align-items: center;
|
|
27
|
+
max-width: 100%;
|
|
28
|
+
height: 24px;
|
|
29
|
+
margin: 0;
|
|
30
|
+
padding: 0 4px;
|
|
31
|
+
border: none;
|
|
32
|
+
border-radius: 3px;
|
|
33
|
+
background: transparent;
|
|
34
|
+
font-size: 14px;
|
|
35
|
+
line-height: 24px;
|
|
36
|
+
text-align: left;
|
|
37
|
+
outline: none;
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
|
|
40
|
+
:focus {
|
|
41
|
+
box-shadow: 0 0 0.5px 1px ${blue};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
::-moz-focus-inner {
|
|
45
|
+
border: 0;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
const iconSize = 16;
|
|
49
|
+
const ChevronContainer = styled.span `
|
|
50
|
+
flex-shrink: 0;
|
|
51
|
+
width: ${iconSize}px;
|
|
52
|
+
height: ${iconSize}px;
|
|
53
|
+
margin: 0 0 0 -2px;
|
|
54
|
+
padding: 0px 2px 0 0;
|
|
55
|
+
color: ${grey160};
|
|
56
|
+
`;
|
|
57
|
+
const Text = styled.span `
|
|
58
|
+
color: ${grey128};
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
text-overflow: ellipsis;
|
|
61
|
+
`;
|
|
62
|
+
const DirName = styled.span `
|
|
63
|
+
color: ${disabledColors(grey224, grey128)};
|
|
64
|
+
padding: 0 0 0 ${props => (props.disabled ? 16 : 0)}px;
|
|
65
|
+
`;
|
|
66
|
+
const ChildrenInfo = styled.span `
|
|
67
|
+
padding: 0 0 0 6px;
|
|
68
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FixtureStateValues } from 'react-cosmos-core';
|
|
3
|
+
import { TreeExpansion } from '../../shared/treeExpansion.js';
|
|
4
|
+
type Props = {
|
|
5
|
+
id: string;
|
|
6
|
+
values: FixtureStateValues;
|
|
7
|
+
expansion: TreeExpansion;
|
|
8
|
+
setExpansion: (expansion: TreeExpansion) => unknown;
|
|
9
|
+
onValueChange: (values: FixtureStateValues) => unknown;
|
|
10
|
+
};
|
|
11
|
+
export declare const ValueInputTree: React.NamedExoticComponent<Props>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { clone, setWith } from 'lodash-es';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { grey248, grey32 } from '../../style/colors.js';
|
|
5
|
+
import { TreeView } from '../TreeView.js';
|
|
6
|
+
import { ValueInput } from './ValueInput/ValueInput.js';
|
|
7
|
+
import { ValueInputDir } from './ValueInputDir.js';
|
|
8
|
+
import { createValueTree } from './valueTree.js';
|
|
9
|
+
export const ValueInputTree = React.memo(function ValueInputTree({ id, values, expansion, setExpansion, onValueChange, }) {
|
|
10
|
+
const rootNode = createValueTree(values);
|
|
11
|
+
return (React.createElement(Container, null,
|
|
12
|
+
React.createElement(TreeView, { node: rootNode, expansion: expansion, setExpansion: setExpansion, renderNode: ({ node, name, parents, expanded, onToggle }) => {
|
|
13
|
+
const { data, children } = node;
|
|
14
|
+
if (data.type === 'item')
|
|
15
|
+
return (React.createElement(ValueInput, { value: data.value, name: name, id: getInputId(id, parents, name), indentLevel: parents.length, onChange: newData => onValueChange(setValueAtPath(values, { type: 'primitive', data: newData }, getValuePath(name, parents))) }));
|
|
16
|
+
return (children && (React.createElement(ValueInputDir, { name: name, childNames: Object.keys(children), expanded: expanded, indentLevel: parents.length, onToggle: onToggle })));
|
|
17
|
+
} })));
|
|
18
|
+
});
|
|
19
|
+
function getInputId(treeId, parents, name) {
|
|
20
|
+
return `${treeId}-${[...parents, name].join('-')}`;
|
|
21
|
+
}
|
|
22
|
+
function getValuePath(valueKey, parentKeys) {
|
|
23
|
+
return [...parentKeys.map(p => `${p}.values`), valueKey].join('.');
|
|
24
|
+
}
|
|
25
|
+
function setValueAtPath(values, newValue, valuePath) {
|
|
26
|
+
// Inspired by https://github.com/lodash/lodash/issues/1696#issuecomment-328335502
|
|
27
|
+
return setWith(clone(values), valuePath, newValue, clone);
|
|
28
|
+
}
|
|
29
|
+
const Container = styled.div `
|
|
30
|
+
background: ${grey32};
|
|
31
|
+
color: ${grey248};
|
|
32
|
+
`;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { stringifyElementId, stringifyFixtureId } from './shared.js';
|
|
2
|
+
export { hasFsValues, sortFsValueGroups } from './valueGroups.js';
|
|
3
|
+
export { ValueInputTree } from './ValueInputTree.js';
|
|
4
|
+
export { FixtureExpansion, FixtureExpansionGroup, getFixtureExpansion, OnElementExpansionChange, updateElementExpansion, } from './valueTreeExpansion.js';
|