react-cosmos-core 6.0.0-alpha.13 → 6.0.0-alpha.14
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.
|
@@ -10,7 +10,8 @@ type Props = {
|
|
|
10
10
|
initialFixtureId?: FixtureId;
|
|
11
11
|
selectedFixtureId?: null | FixtureId;
|
|
12
12
|
renderMessage?: (msg: string) => ReactElement;
|
|
13
|
+
renderNoFixtureSelected?: boolean;
|
|
13
14
|
onErrorReset?: () => unknown;
|
|
14
15
|
};
|
|
15
|
-
export declare function FixtureConnect({ rendererId, rendererConnect, moduleWrappers, systemDecorators, initialFixtureId, selectedFixtureId, onErrorReset, renderMessage, }: Props): JSX.Element;
|
|
16
|
+
export declare function FixtureConnect({ rendererId, rendererConnect, moduleWrappers, systemDecorators, initialFixtureId, selectedFixtureId, onErrorReset, renderMessage, renderNoFixtureSelected, }: Props): JSX.Element | null;
|
|
16
17
|
export {};
|
|
@@ -5,12 +5,14 @@ import { LazyFixtureLoader } from './LazyFixtureLoader.js';
|
|
|
5
5
|
import { useRendererRequest } from './useRendererRequest.js';
|
|
6
6
|
import { useRendererResponse } from './useRendererResponse.js';
|
|
7
7
|
import { useSelectedFixture } from './useSelectedFixture.js';
|
|
8
|
-
export function FixtureConnect({ rendererId, rendererConnect, moduleWrappers, systemDecorators, initialFixtureId, selectedFixtureId, onErrorReset, renderMessage = defaultRenderMessage, }) {
|
|
8
|
+
export function FixtureConnect({ rendererId, rendererConnect, moduleWrappers, systemDecorators, initialFixtureId, selectedFixtureId, onErrorReset, renderMessage = defaultRenderMessage, renderNoFixtureSelected = true, }) {
|
|
9
9
|
const { selectedFixture, setSelectedFixture, setFixtureState } = useSelectedFixture(initialFixtureId, selectedFixtureId);
|
|
10
10
|
useRendererRequest(rendererId, rendererConnect, moduleWrappers, setSelectedFixture, onErrorReset);
|
|
11
11
|
useRendererResponse(rendererId, rendererConnect, moduleWrappers, initialFixtureId);
|
|
12
12
|
if (!selectedFixture) {
|
|
13
|
-
return
|
|
13
|
+
return renderNoFixtureSelected
|
|
14
|
+
? renderMessage('No fixture selected.')
|
|
15
|
+
: null;
|
|
14
16
|
}
|
|
15
17
|
const { fixtureId, fixtureState, renderKey } = selectedFixture;
|
|
16
18
|
if (!moduleWrappers.fixtures[fixtureId.path]) {
|
|
@@ -10,7 +10,7 @@ export function FixtureLoader({ fixtureWrapper, decorators, systemDecorators, fi
|
|
|
10
10
|
const fixtureExport = fixtureModule.default;
|
|
11
11
|
const fixture = getFixture(fixtureExport, fixtureId.name);
|
|
12
12
|
if (typeof fixture === 'undefined') {
|
|
13
|
-
return renderMessage(`Invalid fixture
|
|
13
|
+
return renderMessage(`Invalid fixture name: ${fixtureId.name}`);
|
|
14
14
|
}
|
|
15
15
|
return (React.createElement(DecoratedFixture, { fixture: fixture, systemDecorators: systemDecorators, userDecoratorModules: decoratorModules, fixtureState: fixtureState, setFixtureState: setFixtureState, renderKey: renderKey, onErrorReset: onErrorReset }));
|
|
16
16
|
}
|
|
@@ -14,7 +14,7 @@ export function LazyFixtureLoader({ rendererId, rendererConnect, fixtureWrapper,
|
|
|
14
14
|
const fixtureExport = fixtureModule.default;
|
|
15
15
|
const fixture = getFixture(fixtureExport, fixtureId.name);
|
|
16
16
|
if (typeof fixture === 'undefined') {
|
|
17
|
-
return renderMessage(`Invalid fixture
|
|
17
|
+
return renderMessage(`Invalid fixture name: ${fixtureId.name}`);
|
|
18
18
|
}
|
|
19
19
|
return (React.createElement(React.Fragment, null,
|
|
20
20
|
React.createElement(DecoratedFixture, { fixture: fixture, systemDecorators: systemDecorators, userDecoratorModules: decoratorModules, fixtureState: fixtureState, setFixtureState: setFixtureState, renderKey: renderKey, onErrorReset: onErrorReset }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cosmos-core",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.14",
|
|
4
4
|
"description": "React Cosmos Core",
|
|
5
5
|
"repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos-core",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
"lodash-es": "^4.17.21",
|
|
12
12
|
"react-is": "^18.2.0"
|
|
13
13
|
},
|
|
14
|
-
"gitHead": "
|
|
14
|
+
"gitHead": "ed13194534675df091da3ceaef4202572ddeed12"
|
|
15
15
|
}
|