react-cosmos-ui 6.0.0-beta.1 → 6.0.0-beta.10
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/dist/components/BaseSvg.d.ts +1 -1
- package/dist/components/Icon.d.ts +2 -2
- package/dist/components/Illustration.d.ts +2 -2
- package/dist/components/KeyBox.d.ts +2 -2
- package/dist/components/SidePanel.d.ts +2 -2
- package/dist/components/Space.d.ts +2 -2
- package/dist/components/TreeView.d.ts +2 -2
- package/dist/components/ValueInputTree/ExpandCollapseValues.d.ts +2 -2
- package/dist/components/ValueInputTree/ValueInput/BooleanValueInput.d.ts +2 -2
- package/dist/components/ValueInputTree/ValueInput/NullValueInput.d.ts +2 -2
- package/dist/components/ValueInputTree/ValueInput/NumberValueInput.d.ts +2 -2
- package/dist/components/ValueInputTree/ValueInput/StringValueInput.d.ts +2 -2
- package/dist/components/ValueInputTree/ValueInput/UndefinedValueInput.d.ts +2 -2
- package/dist/components/ValueInputTree/ValueInput/UnserializableValueInput.d.ts +2 -2
- package/dist/components/ValueInputTree/ValueInput/ValueInput.d.ts +2 -2
- package/dist/components/ValueInputTree/ValueInputDir.d.ts +4 -3
- package/dist/components/ValueInputTree/ValueInputDir.js +2 -6
- package/dist/components/ValueInputTree/ValueInputTree.js +17 -2
- package/dist/components/ValueInputTree/shared.d.ts +1 -0
- package/dist/components/ValueInputTree/valueTree.d.ts +1 -1
- package/dist/components/ValueInputTree/valueTree.js +10 -5
- package/dist/components/buttons/Button32.d.ts +1 -1
- package/dist/components/buttons/Button8.d.ts +1 -1
- package/dist/components/buttons/IconButton32.d.ts +1 -1
- package/dist/components/buttons/IconButton8.d.ts +1 -1
- package/dist/components/buttons/shared.js +4 -1
- package/dist/components/icons/index.d.ts +30 -30
- package/dist/components/illustrations/ArtificialIntelligence.d.ts +2 -2
- package/dist/components/illustrations/Astronaut.d.ts +2 -2
- package/dist/components/illustrations/BlankCanvas.d.ts +2 -2
- package/dist/components/inputs/NumberInput.d.ts +2 -2
- package/dist/components/inputs/Select.d.ts +2 -2
- package/dist/cosmos.decorator.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/playground.bundle.js +326 -317
- package/dist/playground.bundle.js.map +1 -1
- package/dist/playground.js +2 -2
- package/dist/pluginMocks.d.ts +1 -0
- package/dist/pluginMocks.js +1 -0
- package/dist/plugins/ClassStatePanel/ClassStatePanel/ComponentClassState.d.ts +6 -5
- package/dist/plugins/ClassStatePanel/ClassStatePanel/ComponentClassState.js +8 -8
- package/dist/plugins/ClassStatePanel/ClassStatePanel/index.d.ts +4 -3
- package/dist/plugins/ClassStatePanel/ClassStatePanel/index.js +5 -5
- package/dist/plugins/ClassStatePanel/ClassStatePanel/shared.d.ts +2 -2
- package/dist/plugins/ClassStatePanel/ClassStatePanel/shared.js +6 -9
- package/dist/plugins/ClassStatePanel/index.js +5 -3
- package/dist/plugins/ClassStatePanel/shared.d.ts +2 -0
- package/dist/plugins/ControlPanel/ControlPanel.d.ts +6 -5
- package/dist/plugins/ControlPanel/ControlPanel.js +3 -3
- package/dist/plugins/ControlPanel/index.js +4 -2
- package/dist/plugins/ControlPanel/shared.d.ts +2 -0
- package/dist/plugins/ControlPanel/shared.js +1 -0
- package/dist/plugins/ControlSelect/SelectValueInput.d.ts +5 -5
- package/dist/plugins/ControlSelect/index.js +3 -6
- package/dist/plugins/FixtureBookmark/BookmarkFixtureButton.d.ts +2 -2
- package/dist/plugins/FixtureBookmark/FixtureBookmarks.d.ts +2 -2
- package/dist/plugins/FixtureSearch/FixtureSearchHeader.d.ts +2 -2
- package/dist/plugins/FixtureSearch/FixtureSearchOverlay.d.ts +2 -2
- package/dist/plugins/FixtureSearch/FixtureSearchOverlay.js +10 -4
- package/dist/plugins/FixtureSearch/FixtureSearchResult.d.ts +2 -2
- package/dist/plugins/FixtureSearch/FixtureSearchShortcuts.d.ts +2 -2
- package/dist/plugins/FixtureTree/BlankState.d.ts +2 -2
- package/dist/plugins/FixtureTree/FixtureTree/FixtureButton.d.ts +2 -2
- package/dist/plugins/FixtureTree/FixtureTree/FixtureDir.d.ts +2 -2
- package/dist/plugins/FixtureTree/FixtureTree/FixtureLink.d.ts +2 -2
- package/dist/plugins/FixtureTree/FixtureTree/MultiFixtureButton.d.ts +2 -2
- package/dist/plugins/FixtureTree/FixtureTree/MultiFixtureChildButton.d.ts +2 -2
- package/dist/plugins/FixtureTree/FixtureTreeContainer.d.ts +2 -2
- package/dist/plugins/FixtureTree/FixtureTreeHeader.d.ts +2 -2
- package/dist/plugins/FullScreenButton/FullScreenButton.d.ts +2 -2
- package/dist/plugins/MessageHandler/socket.js +1 -1
- package/dist/plugins/Notifications/Notifications.d.ts +2 -2
- package/dist/plugins/PluginList/PluginList.d.ts +2 -2
- package/dist/plugins/PropsPanel/BlankState.d.ts +2 -2
- package/dist/plugins/PropsPanel/PropsPanel/ComponentProps.d.ts +6 -5
- package/dist/plugins/PropsPanel/PropsPanel/ComponentProps.js +14 -12
- package/dist/plugins/PropsPanel/PropsPanel/index.d.ts +4 -3
- package/dist/plugins/PropsPanel/PropsPanel/index.js +5 -5
- package/dist/plugins/PropsPanel/PropsPanel/shared.d.ts +2 -2
- package/dist/plugins/PropsPanel/PropsPanel/shared.js +6 -9
- package/dist/plugins/PropsPanel/index.js +14 -9
- package/dist/plugins/PropsPanel/shared.d.ts +2 -0
- package/dist/plugins/RemoteRenderer/RemoteButton/index.d.ts +2 -2
- package/dist/plugins/RendererCore/index.js +11 -3
- package/dist/plugins/RendererCore/onRouterFixtureReselect.js +2 -2
- package/dist/plugins/RendererCore/onRouterFixtureSelect.js +2 -2
- package/dist/plugins/RendererCore/receiveResponse/rendererReady.js +8 -3
- package/dist/plugins/RendererCore/setFixtureState.d.ts +2 -2
- package/dist/plugins/RendererCore/setFixtureState.js +5 -4
- package/dist/plugins/RendererCore/setGlobalFixtureState.d.ts +2 -0
- package/dist/plugins/RendererCore/setGlobalFixtureState.js +15 -0
- package/dist/plugins/RendererCore/shared/postRequest.d.ts +1 -1
- package/dist/plugins/RendererCore/spec.d.ts +8 -3
- package/dist/plugins/RendererPreview/RendererOverlay/RemoteRendererConnected.d.ts +2 -2
- package/dist/plugins/RendererPreview/RendererOverlay/RemoteRendererOverlay.d.ts +2 -2
- package/dist/plugins/RendererPreview/RendererOverlay/RendererOverlay.d.ts +2 -2
- package/dist/plugins/RendererPreview/RendererOverlay/WaitingForRenderer.d.ts +2 -2
- package/dist/plugins/RendererPreview/RendererPreview.js +1 -1
- package/dist/plugins/ResponsivePreview/ResponsivePreview/ResponsiveHeader.d.ts +4 -3
- package/dist/plugins/ResponsivePreview/ResponsivePreview/ResponsivePreview.d.ts +6 -5
- package/dist/plugins/ResponsivePreview/ResponsivePreview/style.d.ts +4 -4
- package/dist/plugins/ResponsivePreview/ToggleButton/index.d.ts +2 -2
- package/dist/plugins/ResponsivePreview/index.js +10 -15
- package/dist/plugins/ResponsivePreview/shared.d.ts +3 -6
- package/dist/plugins/ResponsivePreview/spec.d.ts +2 -5
- package/dist/plugins/Root/GlobalHeader.d.ts +2 -2
- package/dist/plugins/Root/HomeOverlay/HomeOverlay.d.ts +2 -2
- package/dist/plugins/Root/HomeOverlay/KeyShortcut.d.ts +2 -2
- package/dist/plugins/Root/HomeOverlay/NoFixtureSelected.d.ts +2 -2
- package/dist/plugins/Root/HomeOverlay/WelcomeCosmos.d.ts +2 -2
- package/dist/plugins/Root/Root.d.ts +6 -5
- package/dist/plugins/Root/Root.js +2 -2
- package/dist/plugins/Root/SidePanel.d.ts +4 -3
- package/dist/plugins/Root/SidePanel.js +2 -2
- package/dist/plugins/Root/ToggleNavButton.d.ts +2 -2
- package/dist/plugins/Root/index.js +1 -1
- package/dist/plugins/Root/navOpen.js +1 -1
- package/dist/plugins/Root/panelOpen.js +1 -1
- package/dist/plugins/Router/index.js +8 -1
- package/dist/plugins/Router/spec.d.ts +3 -0
- package/dist/plugins/StandardControl/index.js +3 -6
- package/dist/slots/ControlActionSlot.d.ts +4 -4
- package/dist/slots/ControlSlot.d.ts +5 -5
- package/dist/slots/FixtureActionSlot.d.ts +2 -2
- package/dist/slots/NavRowSlot.d.ts +2 -2
- package/dist/slots/RendererActionSlot.d.ts +2 -2
- package/dist/slots/SidePanelRowSlot.d.ts +6 -5
- package/dist/slots/ValueInputSlot.d.ts +2 -2
- package/dist/testHelpers/pluginMocks.d.ts +8 -4
- package/dist/testHelpers/pluginMocks.js +4 -2
- package/package.json +8 -8
- package/pluginMocks.d.ts +1 -0
- package/pluginMocks.js +1 -0
package/dist/playground.js
CHANGED
|
@@ -13,14 +13,14 @@ window.ReactDom = ReactDom;
|
|
|
13
13
|
window.StyledComponents = styled;
|
|
14
14
|
export default async function mount({ playgroundConfig, pluginConfigs, }) {
|
|
15
15
|
const { loadPlugins, Slot } = ReactPlugin;
|
|
16
|
-
const config = { ...DEFAULT_PLUGIN_CONFIG, ...playgroundConfig };
|
|
17
|
-
loadPlugins({ config });
|
|
18
16
|
// We can make plugin loading unblocking if react-plugin exports the
|
|
19
17
|
// reloadPlugins method.
|
|
20
18
|
await Promise.all(pluginConfigs.map(async (pluginConfig) => {
|
|
21
19
|
if (pluginConfig.ui)
|
|
22
20
|
await loadPluginScript(pluginConfig.ui);
|
|
23
21
|
}));
|
|
22
|
+
const config = { ...DEFAULT_PLUGIN_CONFIG, ...playgroundConfig };
|
|
23
|
+
loadPlugins({ config });
|
|
24
24
|
const root = ReactDom.createRoot(document.getElementById('root'));
|
|
25
25
|
root.render(React.createElement(React.Fragment, null,
|
|
26
26
|
React.createElement(GlobalStyle, null),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './testHelpers/pluginMocks.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './testHelpers/pluginMocks.js';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ClassStateFixtureStateItem } from 'react-cosmos-core';
|
|
3
3
|
import { FixtureExpansion, OnElementExpansionChange } from '../../../components/ValueInputTree/index.js';
|
|
4
|
+
import { SetClassStateFixtureState } from '../shared.js';
|
|
4
5
|
type Props = {
|
|
5
|
-
|
|
6
|
+
classStateFsItem: ClassStateFixtureStateItem;
|
|
6
7
|
fixtureExpansion: FixtureExpansion;
|
|
7
|
-
onFixtureStateChange:
|
|
8
|
+
onFixtureStateChange: SetClassStateFixtureState;
|
|
8
9
|
onElementExpansionChange: OnElementExpansionChange;
|
|
9
10
|
};
|
|
10
|
-
export declare function ComponentClassState({
|
|
11
|
+
export declare function ComponentClassState({ classStateFsItem, fixtureExpansion, onFixtureStateChange, onElementExpansionChange, }: Props): React.JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { isEqual } from 'lodash-es';
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { updateClassStateFixtureStateItem, } from 'react-cosmos-core';
|
|
4
4
|
import { SidePanelActions, SidePanelBody, SidePanelContainer, SidePanelHeader, SidePanelTitle, } from '../../../components/SidePanel.js';
|
|
5
5
|
import { ExpandCollapseValues } from '../../../components/ValueInputTree/ExpandCollapseValues.js';
|
|
6
6
|
import { ValueInputTree, stringifyElementId, } from '../../../components/ValueInputTree/index.js';
|
|
7
7
|
import { IconButton32 } from '../../../components/buttons/index.js';
|
|
8
8
|
import { RotateCcwIcon } from '../../../components/icons/index.js';
|
|
9
|
-
import {
|
|
10
|
-
export function ComponentClassState({
|
|
11
|
-
const { componentName, elementId, values } =
|
|
9
|
+
import { classStateFsItemUpdater } from './shared.js';
|
|
10
|
+
export function ComponentClassState({ classStateFsItem, fixtureExpansion, onFixtureStateChange, onElementExpansionChange, }) {
|
|
11
|
+
const { componentName, elementId, values } = classStateFsItem;
|
|
12
12
|
const [initialValues] = React.useState(() => values);
|
|
13
|
-
const handleValuesReset = React.useCallback(() => onFixtureStateChange(
|
|
14
|
-
|
|
13
|
+
const handleValuesReset = React.useCallback(() => onFixtureStateChange(classStateFsItemUpdater(elementId, prevFs => updateClassStateFixtureStateItem({
|
|
14
|
+
classStateFs: prevFs,
|
|
15
15
|
elementId,
|
|
16
16
|
values: initialValues,
|
|
17
17
|
}))), [elementId, initialValues, onFixtureStateChange]);
|
|
18
18
|
const handleValueChange = React.useCallback((newValues) => {
|
|
19
|
-
onFixtureStateChange(
|
|
20
|
-
|
|
19
|
+
onFixtureStateChange(classStateFsItemUpdater(elementId, prevFs => updateClassStateFixtureStateItem({
|
|
20
|
+
classStateFs: prevFs,
|
|
21
21
|
elementId,
|
|
22
22
|
values: newValues,
|
|
23
23
|
})));
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ClassStateFixtureState } from 'react-cosmos-core';
|
|
3
3
|
import { FixtureExpansion, OnElementExpansionChange } from '../../../components/ValueInputTree/index.js';
|
|
4
|
+
import { SetClassStateFixtureState } from '../shared.js';
|
|
4
5
|
type Props = {
|
|
5
|
-
fixtureState:
|
|
6
|
+
fixtureState: ClassStateFixtureState | undefined;
|
|
6
7
|
fixtureExpansion: FixtureExpansion;
|
|
7
|
-
onFixtureStateChange:
|
|
8
|
+
onFixtureStateChange: SetClassStateFixtureState;
|
|
8
9
|
onElementExpansionChange: OnElementExpansionChange;
|
|
9
10
|
};
|
|
10
11
|
export declare const ClassStatePanel: React.NamedExoticComponent<Props>;
|
|
@@ -2,12 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import { hasFsValues, sortFsValueGroups, stringifyElementId, } from '../../../components/ValueInputTree/index.js';
|
|
3
3
|
import { ComponentClassState } from './ComponentClassState.js';
|
|
4
4
|
export const ClassStatePanel = React.memo(function ClassStatePanel({ fixtureState, fixtureExpansion, onFixtureStateChange, onElementExpansionChange, }) {
|
|
5
|
-
if (!fixtureState
|
|
5
|
+
if (!fixtureState) {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
|
-
const classStateWithValues = fixtureState.
|
|
9
|
-
return (React.createElement(React.Fragment, null, sortFsValueGroups(classStateWithValues).map(
|
|
10
|
-
const strElementId = stringifyElementId(
|
|
11
|
-
return (React.createElement(ComponentClassState, { key: strElementId,
|
|
8
|
+
const classStateWithValues = fixtureState.filter(hasFsValues);
|
|
9
|
+
return (React.createElement(React.Fragment, null, sortFsValueGroups(classStateWithValues).map(fsItem => {
|
|
10
|
+
const strElementId = stringifyElementId(fsItem.elementId);
|
|
11
|
+
return (React.createElement(ComponentClassState, { key: strElementId, classStateFsItem: fsItem, fixtureExpansion: fixtureExpansion, onFixtureStateChange: onFixtureStateChange, onElementExpansionChange: onElementExpansionChange }));
|
|
12
12
|
})));
|
|
13
13
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function
|
|
1
|
+
import { ClassStateFixtureState, FixtureElementId, FixtureStateUpdater } from 'react-cosmos-core';
|
|
2
|
+
export declare function classStateFsItemUpdater(elementId: FixtureElementId, cb: FixtureStateUpdater<ClassStateFixtureState>): FixtureStateUpdater<ClassStateFixtureState>;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { findClassStateFixtureStateItem, } from 'react-cosmos-core';
|
|
2
2
|
import { stringifyElementId } from '../../../components/ValueInputTree/index.js';
|
|
3
|
-
export function
|
|
3
|
+
export function classStateFsItemUpdater(elementId, cb) {
|
|
4
4
|
return prevFs => {
|
|
5
|
-
const
|
|
6
|
-
if (!
|
|
5
|
+
const fsItem = findClassStateFixtureStateItem(prevFs, elementId);
|
|
6
|
+
if (!fsItem) {
|
|
7
7
|
const elId = stringifyElementId(elementId);
|
|
8
8
|
console.warn(`Trying to update missing element with ID: ${elId}`);
|
|
9
|
-
return prevFs;
|
|
9
|
+
return prevFs ?? [];
|
|
10
10
|
}
|
|
11
|
-
return
|
|
12
|
-
...prevFs,
|
|
13
|
-
classState: cb(prevFs),
|
|
14
|
-
};
|
|
11
|
+
return cb(prevFs);
|
|
15
12
|
};
|
|
16
13
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { createPlugin } from 'react-plugin';
|
|
3
3
|
import { getFixtureExpansion, updateElementExpansion, } from '../../components/ValueInputTree/index.js';
|
|
4
4
|
import { ClassStatePanel } from './ClassStatePanel/index.js';
|
|
5
|
-
import { CLASS_STATE_TREE_EXPANSION_STORAGE_KEY } from './shared.js';
|
|
5
|
+
import { CLASS_STATE_TREE_EXPANSION_STORAGE_KEY, } from './shared.js';
|
|
6
6
|
const { namedPlug, register } = createPlugin({
|
|
7
7
|
name: 'classStatePanel',
|
|
8
8
|
});
|
|
9
9
|
namedPlug('sidePanelRow', 'classState', ({ pluginContext, slotProps }) => {
|
|
10
|
-
const { fixtureId,
|
|
10
|
+
const { fixtureId, getFixtureState, setFixtureState } = slotProps;
|
|
11
11
|
const { fixtureExpansion, onElementExpansionChange } = useFixtureExpansion(pluginContext, fixtureId);
|
|
12
|
+
const fixtureState = getFixtureState('classState');
|
|
13
|
+
const onFixtureStateChange = useCallback(update => setFixtureState('classState', update), [setFixtureState]);
|
|
12
14
|
return (React.createElement(ClassStatePanel, { fixtureState: fixtureState, fixtureExpansion: fixtureExpansion, onFixtureStateChange: onFixtureStateChange, onElementExpansionChange: onElementExpansionChange }));
|
|
13
15
|
});
|
|
14
16
|
export { register };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ControlsFixtureState } from 'react-cosmos-core';
|
|
3
|
+
import { SetControlsFixtureState } from './shared.js';
|
|
3
4
|
type Props = {
|
|
4
|
-
fixtureState:
|
|
5
|
+
fixtureState: ControlsFixtureState | undefined;
|
|
5
6
|
controlActionOrder: string[];
|
|
6
|
-
onFixtureStateChange:
|
|
7
|
+
onFixtureStateChange: SetControlsFixtureState;
|
|
7
8
|
};
|
|
8
|
-
export declare function ControlPanel({ fixtureState, controlActionOrder, onFixtureStateChange, }: Props): JSX.Element | null;
|
|
9
|
+
export declare function ControlPanel({ fixtureState, controlActionOrder, onFixtureStateChange, }: Props): React.JSX.Element | null;
|
|
9
10
|
export {};
|
|
@@ -7,7 +7,7 @@ import { ControlActionSlot } from '../../slots/ControlActionSlot.js';
|
|
|
7
7
|
import { ControlSlot } from '../../slots/ControlSlot.js';
|
|
8
8
|
export function ControlPanel({ fixtureState, controlActionOrder, onFixtureStateChange, }) {
|
|
9
9
|
const handleControlsReset = React.useCallback(() => onFixtureStateChange(resetControls), [onFixtureStateChange]);
|
|
10
|
-
const controls = fixtureState
|
|
10
|
+
const controls = fixtureState ?? {};
|
|
11
11
|
if (Object.keys(controls).length === 0)
|
|
12
12
|
return null;
|
|
13
13
|
return (React.createElement(SidePanelContainer, null,
|
|
@@ -26,11 +26,11 @@ function areControlsUnchanged(controls) {
|
|
|
26
26
|
return Object.keys(controls).every(controlName => isEqual(controls[controlName].currentValue, controls[controlName].defaultValue));
|
|
27
27
|
}
|
|
28
28
|
function resetControls(fixtureState) {
|
|
29
|
-
const controls = fixtureState
|
|
29
|
+
const controls = fixtureState ? { ...fixtureState } : {};
|
|
30
30
|
Object.keys(controls).forEach(controlName => {
|
|
31
31
|
controls[controlName] = resetControl(controls[controlName]);
|
|
32
32
|
});
|
|
33
|
-
return
|
|
33
|
+
return controls;
|
|
34
34
|
}
|
|
35
35
|
function resetControl(control) {
|
|
36
36
|
return { ...control, currentValue: control.defaultValue };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { createPlugin } from 'react-plugin';
|
|
3
3
|
import { ControlPanel } from './ControlPanel.js';
|
|
4
4
|
const { namedPlug, register } = createPlugin({
|
|
@@ -9,7 +9,9 @@ const { namedPlug, register } = createPlugin({
|
|
|
9
9
|
});
|
|
10
10
|
namedPlug('sidePanelRow', 'values', ({ pluginContext, slotProps }) => {
|
|
11
11
|
const { controlActionOrder } = pluginContext.getConfig();
|
|
12
|
-
const {
|
|
12
|
+
const { getFixtureState, setFixtureState } = slotProps;
|
|
13
|
+
const fixtureState = getFixtureState('controls');
|
|
14
|
+
const onFixtureStateChange = useCallback(update => setFixtureState('controls', update), [setFixtureState]);
|
|
13
15
|
return (React.createElement(ControlPanel, { fixtureState: fixtureState, controlActionOrder: controlActionOrder, onFixtureStateChange: onFixtureStateChange }));
|
|
14
16
|
});
|
|
15
17
|
export { register };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectControlFixtureState } from 'react-cosmos-core';
|
|
3
3
|
type Props = {
|
|
4
4
|
name: string;
|
|
5
|
-
control:
|
|
6
|
-
onChange: (name: string, select:
|
|
5
|
+
control: SelectControlFixtureState;
|
|
6
|
+
onChange: (name: string, select: SelectControlFixtureState) => unknown;
|
|
7
7
|
};
|
|
8
|
-
export declare function SelectValueInput({ name, control, onChange }: Props): JSX.Element;
|
|
8
|
+
export declare function SelectValueInput({ name, control, onChange }: Props): React.JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -7,12 +7,9 @@ const { plug, register } = createPlugin({
|
|
|
7
7
|
plug('control-select', ({ slotProps }) => {
|
|
8
8
|
const { controlName, control, onFixtureStateChange } = slotProps;
|
|
9
9
|
const handleChange = useCallback((selectName, updatedControl) => {
|
|
10
|
-
onFixtureStateChange(
|
|
11
|
-
...
|
|
12
|
-
|
|
13
|
-
...fixtureState.controls,
|
|
14
|
-
[selectName]: updatedControl,
|
|
15
|
-
},
|
|
10
|
+
onFixtureStateChange(prevFs => ({
|
|
11
|
+
...prevFs,
|
|
12
|
+
[selectName]: updatedControl,
|
|
16
13
|
}));
|
|
17
14
|
}, [onFixtureStateChange]);
|
|
18
15
|
return (React.createElement(SelectValueInput, { key: controlName, name: controlName, control: control, onChange: handleChange }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
type Props = {
|
|
3
3
|
selected: boolean;
|
|
4
4
|
onClick: () => unknown;
|
|
5
5
|
};
|
|
6
|
-
export declare function BookmarkFixtureButton({ selected, onClick }: Props): JSX.Element;
|
|
6
|
+
export declare function BookmarkFixtureButton({ selected, onClick }: Props): React.JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { FixtureId, FlatFixtureTree, FlatFixtureTreeItem } from 'react-cosmos-core';
|
|
3
3
|
type Props = {
|
|
4
4
|
bookmarks: FlatFixtureTree;
|
|
@@ -6,5 +6,5 @@ type Props = {
|
|
|
6
6
|
onFixtureSelect: (fixtureId: FixtureId) => void;
|
|
7
7
|
onBookmarkDelete: (fixtureItem: FlatFixtureTreeItem) => void;
|
|
8
8
|
};
|
|
9
|
-
export declare function FixtureBookmarks({ bookmarks, selectedFixtureId, onFixtureSelect, onBookmarkDelete, }: Props): JSX.Element | null;
|
|
9
|
+
export declare function FixtureBookmarks({ bookmarks, selectedFixtureId, onFixtureSelect, onBookmarkDelete, }: Props): React.JSX.Element | null;
|
|
10
10
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
type Props = {
|
|
3
3
|
fixtureSelected: boolean;
|
|
4
4
|
onOpen: () => unknown;
|
|
5
5
|
onCloseNav: () => unknown;
|
|
6
6
|
};
|
|
7
|
-
export declare function FixtureSearchHeader({ fixtureSelected, onOpen, onCloseNav, }: Props): JSX.Element;
|
|
7
|
+
export declare function FixtureSearchHeader({ fixtureSelected, onOpen, onCloseNav, }: Props): React.JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { FixtureId, FixtureList } from 'react-cosmos-core';
|
|
3
3
|
type Props = {
|
|
4
4
|
searchText: string;
|
|
@@ -10,5 +10,5 @@ type Props = {
|
|
|
10
10
|
onClose: () => unknown;
|
|
11
11
|
onSelect: (fixtureId: FixtureId, revealFixture: boolean) => unknown;
|
|
12
12
|
};
|
|
13
|
-
export declare function FixtureSearchOverlay({ searchText, fixturesDir, fixtureFileSuffix, fixtures, selectedFixtureId, onSetSearchText, onClose, onSelect, }: Props): JSX.Element;
|
|
13
|
+
export declare function FixtureSearchOverlay({ searchText, fixturesDir, fixtureFileSuffix, fixtures, selectedFixtureId, onSetSearchText, onClose, onSelect, }: Props): React.JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -230,8 +230,10 @@ const Content = styled.div `
|
|
|
230
230
|
max-width: 640px;
|
|
231
231
|
border-radius: 3px;
|
|
232
232
|
background: ${grey248};
|
|
233
|
-
box-shadow:
|
|
234
|
-
rgba(15, 15, 15, 0.
|
|
233
|
+
box-shadow:
|
|
234
|
+
rgba(15, 15, 15, 0.05) 0px 0px 0px 1px,
|
|
235
|
+
rgba(15, 15, 15, 0.1) 0px 5px 10px,
|
|
236
|
+
rgba(15, 15, 15, 0.2) 0px 15px 40px;
|
|
235
237
|
display: flex;
|
|
236
238
|
flex-direction: column;
|
|
237
239
|
overflow: hidden;
|
|
@@ -277,7 +279,9 @@ const HelpButton = styled.div `
|
|
|
277
279
|
background: ${props => (props.selected ? grey224 : 'transparent')};
|
|
278
280
|
color: ${props => (props.selected ? grey128 : grey176)};
|
|
279
281
|
cursor: pointer;
|
|
280
|
-
transition:
|
|
282
|
+
transition:
|
|
283
|
+
background ${quick}s,
|
|
284
|
+
color ${quick}s;
|
|
281
285
|
|
|
282
286
|
:hover {
|
|
283
287
|
color: ${grey128};
|
|
@@ -287,7 +291,9 @@ const ShortcutsContainer = styled.div `
|
|
|
287
291
|
height: ${props => (props.visible ? 72 : 0)}px;
|
|
288
292
|
overflow: hidden;
|
|
289
293
|
opacity: ${props => (props.visible ? 1 : 0)};
|
|
290
|
-
transition:
|
|
294
|
+
transition:
|
|
295
|
+
height ${quick}s,
|
|
296
|
+
opacity ${quick}s;
|
|
291
297
|
user-select: none;
|
|
292
298
|
`;
|
|
293
299
|
const ResultsViewport = styled.div `
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { FixtureId, FlatFixtureTreeItem } from 'react-cosmos-core';
|
|
3
3
|
type Props = {
|
|
4
4
|
active: boolean;
|
|
@@ -6,5 +6,5 @@ type Props = {
|
|
|
6
6
|
fixtureItem: FlatFixtureTreeItem;
|
|
7
7
|
onSelect: (fixtureId: FixtureId, revealFixture: boolean) => unknown;
|
|
8
8
|
};
|
|
9
|
-
export declare function FixtureSearchResult({ active, cleanFixturePath, fixtureItem, onSelect, }: Props): JSX.Element;
|
|
9
|
+
export declare function FixtureSearchResult({ active, cleanFixturePath, fixtureItem, onSelect, }: Props): React.JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function FixtureSearchShortcuts(): JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare function FixtureSearchShortcuts(): React.JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
type Props = {
|
|
3
3
|
fixturesDir: string;
|
|
4
4
|
fixtureFileSuffix: string;
|
|
5
5
|
};
|
|
6
|
-
export declare function BlankState({ fixturesDir, fixtureFileSuffix }: Props): JSX.Element;
|
|
6
|
+
export declare function BlankState({ fixturesDir, fixtureFileSuffix }: Props): React.JSX.Element;
|
|
7
7
|
export declare const IconContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
8
|
export declare const NoWrap: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
9
9
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
1
|
+
import React, { RefObject } from 'react';
|
|
2
2
|
import { FixtureId } from 'react-cosmos-core';
|
|
3
3
|
type Props = {
|
|
4
4
|
name: string;
|
|
@@ -8,5 +8,5 @@ type Props = {
|
|
|
8
8
|
selectedRef: RefObject<HTMLElement>;
|
|
9
9
|
onSelect: (fixtureId: FixtureId) => unknown;
|
|
10
10
|
};
|
|
11
|
-
export declare function FixtureButton({ name, fixturePath, indentLevel, selected, selectedRef, onSelect, }: Props): JSX.Element;
|
|
11
|
+
export declare function FixtureButton({ name, fixturePath, indentLevel, selected, selectedRef, onSelect, }: Props): React.JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
type Props = {
|
|
3
3
|
name: string;
|
|
4
4
|
expanded: boolean;
|
|
@@ -6,5 +6,5 @@ type Props = {
|
|
|
6
6
|
selected: boolean;
|
|
7
7
|
onToggle: () => unknown;
|
|
8
8
|
};
|
|
9
|
-
export declare function FixtureDir({ name, expanded, indentLevel, selected, onToggle, }: Props): JSX.Element;
|
|
9
|
+
export declare function FixtureDir({ name, expanded, indentLevel, selected, onToggle, }: Props): React.JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { FixtureId } from 'react-cosmos-core';
|
|
3
3
|
type Props = {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
fixtureId: FixtureId;
|
|
6
6
|
onSelect: (fixtureId: FixtureId) => unknown;
|
|
7
7
|
};
|
|
8
|
-
export declare function FixtureLink({ children, fixtureId, onSelect }: Props): JSX.Element;
|
|
8
|
+
export declare function FixtureLink({ children, fixtureId, onSelect }: Props): React.JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
1
|
+
import React, { RefObject } from 'react';
|
|
2
2
|
import { FixtureId } from 'react-cosmos-core';
|
|
3
3
|
type Props = {
|
|
4
4
|
name: string;
|
|
@@ -10,5 +10,5 @@ type Props = {
|
|
|
10
10
|
selectedRef: RefObject<HTMLElement>;
|
|
11
11
|
onSelect: (fixtureId: FixtureId) => unknown;
|
|
12
12
|
};
|
|
13
|
-
export declare function MultiFixtureButton({ name, fixturePath, fixtureNames, indentLevel, selected, selectedFixtureId, selectedRef, onSelect, }: Props): JSX.Element;
|
|
13
|
+
export declare function MultiFixtureButton({ name, fixturePath, fixtureNames, indentLevel, selected, selectedFixtureId, selectedRef, onSelect, }: Props): React.JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
1
|
+
import React, { RefObject } from 'react';
|
|
2
2
|
import { FixtureId } from 'react-cosmos-core';
|
|
3
3
|
type Props = {
|
|
4
4
|
name: string;
|
|
@@ -8,5 +8,5 @@ type Props = {
|
|
|
8
8
|
selectedRef: RefObject<HTMLElement>;
|
|
9
9
|
onSelect: (fixtureId: FixtureId) => unknown;
|
|
10
10
|
};
|
|
11
|
-
export declare function MultiFixtureChildButton({ name, fixtureId, indentLevel, selected, selectedRef, onSelect, }: Props): JSX.Element;
|
|
11
|
+
export declare function MultiFixtureChildButton({ name, fixtureId, indentLevel, selected, selectedRef, onSelect, }: Props): React.JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { FixtureId, FixtureList } from 'react-cosmos-core';
|
|
3
3
|
import { TreeExpansion } from '../../shared/treeExpansion.js';
|
|
4
4
|
type Props = {
|
|
@@ -10,5 +10,5 @@ type Props = {
|
|
|
10
10
|
selectFixture: (fixtureId: FixtureId) => void;
|
|
11
11
|
setExpansion: (expansion: TreeExpansion) => unknown;
|
|
12
12
|
};
|
|
13
|
-
export declare function FixtureTreeContainer({ fixturesDir, fixtureFileSuffix, selectedFixtureId, fixtures, expansion, selectFixture, setExpansion, }: Props): JSX.Element;
|
|
13
|
+
export declare function FixtureTreeContainer({ fixturesDir, fixtureFileSuffix, selectedFixtureId, fixtures, expansion, selectFixture, setExpansion, }: Props): React.JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { FixtureList } from 'react-cosmos-core';
|
|
3
3
|
import { TreeExpansion } from '../../shared/treeExpansion.js';
|
|
4
4
|
type Props = {
|
|
@@ -8,5 +8,5 @@ type Props = {
|
|
|
8
8
|
expansion: TreeExpansion;
|
|
9
9
|
setExpansion: (treeExpansion: TreeExpansion) => unknown;
|
|
10
10
|
};
|
|
11
|
-
export declare function FixtureTreeHeader({ fixturesDir, fixtureFileSuffix, fixtures, expansion, setExpansion, }: Props): JSX.Element;
|
|
11
|
+
export declare function FixtureTreeHeader({ fixturesDir, fixtureFileSuffix, fixtures, expansion, setExpansion, }: Props): React.JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
type Props = {
|
|
3
3
|
onClick: () => void;
|
|
4
4
|
};
|
|
5
|
-
export declare function FullScreenButton({ onClick }: Props): JSX.Element;
|
|
5
|
+
export declare function FullScreenButton({ onClick }: Props): React.JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -6,7 +6,7 @@ export function initSocket(context) {
|
|
|
6
6
|
if (!core.isDevServerOn()) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
-
socket = new WebSocket(location.origin.replace(/^https
|
|
9
|
+
socket = new WebSocket(location.origin.replace(/^https:/, 'wss:').replace(/^http:/, 'ws:'));
|
|
10
10
|
socket.addEventListener('open', () => {
|
|
11
11
|
if (socket && pendingMessages.length > 0) {
|
|
12
12
|
for (const msg of pendingMessages)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { NotificationItem } from './spec.js';
|
|
3
3
|
type Props = {
|
|
4
4
|
notifications: NotificationItem[];
|
|
5
5
|
};
|
|
6
|
-
export declare function Notifications({ notifications }: Props): JSX.Element;
|
|
6
|
+
export declare function Notifications({ notifications }: Props): React.JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export type SimplePlugin = {
|
|
3
3
|
name: string;
|
|
4
4
|
enabled: boolean;
|
|
@@ -7,5 +7,5 @@ type Props = {
|
|
|
7
7
|
plugins: SimplePlugin[];
|
|
8
8
|
enable: (pluginName: string, enabled: boolean) => void;
|
|
9
9
|
};
|
|
10
|
-
export declare function PluginList({ plugins, enable }: Props): JSX.Element;
|
|
10
|
+
export declare function PluginList({ plugins, enable }: Props): React.JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function BlankState(): JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare function BlankState(): React.JSX.Element;
|
|
3
3
|
export declare const IconContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
4
|
export declare const NoWrap: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PropsFixtureStateItem } from 'react-cosmos-core';
|
|
3
3
|
import { FixtureExpansion, OnElementExpansionChange } from '../../../components/ValueInputTree/index.js';
|
|
4
|
+
import { SetPropsFixtureState } from '../shared.js';
|
|
4
5
|
type Props = {
|
|
5
|
-
|
|
6
|
+
propsFsItem: PropsFixtureStateItem;
|
|
6
7
|
fixtureExpansion: FixtureExpansion;
|
|
7
|
-
onFixtureStateChange:
|
|
8
|
+
onFixtureStateChange: SetPropsFixtureState;
|
|
8
9
|
onElementExpansionChange: OnElementExpansionChange;
|
|
9
10
|
};
|
|
10
|
-
export declare function ComponentProps({
|
|
11
|
+
export declare function ComponentProps({ propsFsItem, fixtureExpansion, onFixtureStateChange, onElementExpansionChange, }: Props): React.JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { isEqual } from 'lodash-es';
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { IconButton32 } from '../../../components/buttons/index.js';
|
|
5
|
-
import { CopyIcon, RotateCcwIcon } from '../../../components/icons/index.js';
|
|
3
|
+
import { resetPropsFixtureStateItem, updatePropsFixtureStateItem, } from 'react-cosmos-core';
|
|
6
4
|
import { SidePanelActions, SidePanelBody, SidePanelContainer, SidePanelHeader, SidePanelTitle, } from '../../../components/SidePanel.js';
|
|
7
5
|
import { ExpandCollapseValues } from '../../../components/ValueInputTree/ExpandCollapseValues.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import { ValueInputTree, stringifyElementId, } from '../../../components/ValueInputTree/index.js';
|
|
7
|
+
import { IconButton32 } from '../../../components/buttons/index.js';
|
|
8
|
+
import { CopyIcon, RotateCcwIcon } from '../../../components/icons/index.js';
|
|
9
|
+
import { propsFsItemUpdater } from './shared.js';
|
|
10
|
+
export function ComponentProps({ propsFsItem, fixtureExpansion, onFixtureStateChange, onElementExpansionChange, }) {
|
|
11
|
+
const { componentName, elementId, values } = propsFsItem;
|
|
12
12
|
const [reset, setReset] = React.useState(true);
|
|
13
13
|
const handleResetToggle = React.useCallback(() => setReset(!reset), [reset]);
|
|
14
14
|
const [initialValues] = React.useState(() => values);
|
|
15
|
-
const handleValuesReset = React.useCallback(() => onFixtureStateChange(
|
|
16
|
-
|
|
15
|
+
const handleValuesReset = React.useCallback(() => onFixtureStateChange(propsFsItemUpdater(elementId, prevFs => resetPropsFixtureStateItem({
|
|
16
|
+
propsFs: prevFs,
|
|
17
17
|
elementId,
|
|
18
18
|
values: initialValues,
|
|
19
19
|
}))), [elementId, initialValues, onFixtureStateChange]);
|
|
20
20
|
const handleValueChange = React.useCallback((newValues) => {
|
|
21
|
-
const changeFn = reset
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const changeFn = reset
|
|
22
|
+
? resetPropsFixtureStateItem
|
|
23
|
+
: updatePropsFixtureStateItem;
|
|
24
|
+
onFixtureStateChange(propsFsItemUpdater(elementId, prevFs => changeFn({
|
|
25
|
+
propsFs: prevFs,
|
|
24
26
|
elementId,
|
|
25
27
|
values: newValues,
|
|
26
28
|
})));
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PropsFixtureState } from 'react-cosmos-core';
|
|
3
3
|
import { FixtureExpansion, OnElementExpansionChange } from '../../../components/ValueInputTree/index.js';
|
|
4
|
+
import { SetPropsFixtureState } from '../shared.js';
|
|
4
5
|
type Props = {
|
|
5
|
-
fixtureState:
|
|
6
|
+
fixtureState: PropsFixtureState | undefined;
|
|
6
7
|
fixtureExpansion: FixtureExpansion;
|
|
7
|
-
onFixtureStateChange:
|
|
8
|
+
onFixtureStateChange: SetPropsFixtureState;
|
|
8
9
|
onElementExpansionChange: OnElementExpansionChange;
|
|
9
10
|
};
|
|
10
11
|
export declare const PropsPanel: React.NamedExoticComponent<Props>;
|