react-cosmos-renderer
Advanced tools
Comparing version 6.0.0-canary.fdbaa56.0 to 6.0.0
export * from './fixture/FixtureCapture/FixtureCapture.js'; | ||
export * from './fixture/FixtureContext.js'; | ||
export * from './fixture/Viewport.js'; | ||
export * from './fixture/useFixtureState.js'; | ||
export * from './fixture/useSelect/index.js'; | ||
@@ -5,0 +6,0 @@ export * from './fixture/useValue/index.js'; |
export * from './fixture/FixtureCapture/FixtureCapture.js'; | ||
export * from './fixture/FixtureContext.js'; | ||
export * from './fixture/Viewport.js'; | ||
export * from './fixture/useFixtureState.js'; | ||
export * from './fixture/useSelect/index.js'; | ||
@@ -5,0 +6,0 @@ export * from './fixture/useValue/index.js'; |
import React from 'react'; | ||
import { useFixtureState } from './useFixtureState.js'; | ||
import { useFixtureClassState } from './useFixtureClassState.js'; | ||
import { useReadClassState } from './useReadClassState.js'; | ||
@@ -12,3 +12,3 @@ export function useClassStateCapture(fixture, decoratorId) { | ||
useReadClassState(fixture, decoratorId, elRefs); | ||
return useFixtureState(fixture, decoratorId, elRefs); | ||
return useFixtureClassState(fixture, decoratorId, elRefs); | ||
} |
import { isEqual } from 'lodash-es'; | ||
import { useContext, useEffect, useRef, } from 'react'; | ||
import { createValues, extendWithValues, findFixtureStateClassState, updateFixtureStateClassState, } from 'react-cosmos-core'; | ||
import { FixtureContext } from '../../FixtureContext.js'; | ||
import { useEffect, useRef } from 'react'; | ||
import { createValues, extendWithValues, findClassStateFixtureStateItem, updateClassStateFixtureStateItem, } from 'react-cosmos-core'; | ||
import { useFixtureState } from '../../useFixtureState.js'; | ||
import { findRelevantElementPaths } from '../shared/findRelevantElementPaths.js'; | ||
@@ -11,3 +11,3 @@ // How often to check the state of the loaded component and update the fixture | ||
const elPaths = findRelevantElementPaths(fixture); | ||
const { fixtureState, setFixtureState } = useContext(FixtureContext); | ||
const [classStateFs, setClassStateFs] = useFixtureState('classState'); | ||
const timeoutId = useRef(null); | ||
@@ -37,14 +37,9 @@ useEffect(() => { | ||
const elementId = { decoratorId, elPath }; | ||
const fsClassState = findFixtureStateClassState(fixtureState, elementId); | ||
if (fsClassState && | ||
state && | ||
!doesFixtureStateMatchClassState(fsClassState, state)) { | ||
const fsItem = findClassStateFixtureStateItem(classStateFs, elementId); | ||
if (fsItem && state && !doesFixtureStateMatchClassState(fsItem, state)) { | ||
fixtureStateChangeScheduled = true; | ||
setFixtureState(prevFs => ({ | ||
...prevFs, | ||
classState: updateFixtureStateClassState({ | ||
fixtureState: prevFs, | ||
elementId, | ||
values: createValues(state), | ||
}), | ||
setClassStateFs(prevFs => updateClassStateFixtureStateItem({ | ||
classStateFs: prevFs, | ||
elementId, | ||
values: createValues(state), | ||
})); | ||
@@ -51,0 +46,0 @@ } |
@@ -7,3 +7,3 @@ import React from 'react'; | ||
}; | ||
export declare function FixtureCapture({ children, decoratorId }: Props): JSX.Element; | ||
export declare function FixtureCapture({ children, decoratorId }: Props): React.ReactNode; | ||
export {}; |
@@ -9,3 +9,2 @@ // In a React Server Components setup this is a Client entry point for fixtures. | ||
'use client'; | ||
import React from 'react'; | ||
import { useClassStateCapture } from './classState/index.js'; | ||
@@ -16,4 +15,3 @@ import { usePropsCapture } from './props/index.js'; | ||
fixture = useClassStateCapture(fixture, decoratorId); | ||
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051 | ||
return React.createElement(React.Fragment, null, fixture); | ||
return fixture; | ||
} |
@@ -1,4 +0,4 @@ | ||
import { useContext, useEffect, useRef } from 'react'; | ||
import { areNodesEqual, createFixtureStateProps, createValues, findFixtureStateProps, getComponentName, getFixtureStateProps, removeFixtureStateProps, updateFixtureStateProps, } from 'react-cosmos-core'; | ||
import { FixtureContext } from '../../FixtureContext.js'; | ||
import { useEffect, useRef } from 'react'; | ||
import { areNodesEqual, createPropsFixtureStateItem, createValues, filterPropsFixtureState, findPropsFixtureStateItem, getComponentName, removePropsFixtureStateItem, updatePropsFixtureStateItem, } from 'react-cosmos-core'; | ||
import { useFixtureState } from '../../useFixtureState.js'; | ||
import { findRelevantElementPaths } from '../shared/findRelevantElementPaths.js'; | ||
@@ -8,3 +8,3 @@ import { getElementAtPath, getExpectedElementAtPath, } from '../shared/nodeTree/index.js'; | ||
export function usePropsCapture(fixture, decoratorId) { | ||
const { fixtureState, setFixtureState } = useContext(FixtureContext); | ||
const [propsFs, setPropsFs] = useFixtureState('props'); | ||
const prevFixtureRef = useRef(fixture); | ||
@@ -14,5 +14,5 @@ const elPaths = findRelevantElementPaths(fixture); | ||
// Create empty fixture state | ||
if (!fixtureState.props && elPaths.length === 0) { | ||
if (!propsFs && elPaths.length === 0) { | ||
// Make sure not to override any (currently pending) fixture state props | ||
setFixtureState(prevFs => ({ ...prevFs, props: prevFs.props || [] })); | ||
setPropsFs(prevFs => prevFs ?? []); | ||
return; | ||
@@ -23,9 +23,6 @@ } | ||
// component type of the corresponding element changed | ||
const fsProps = getFixtureStateProps(fixtureState, decoratorId); | ||
fsProps.forEach(({ elementId }) => { | ||
const decoratorFs = filterPropsFixtureState(propsFs, decoratorId); | ||
decoratorFs.forEach(({ elementId }) => { | ||
if (elPaths.indexOf(elementId.elPath) === -1) { | ||
setFixtureState(prevFs => ({ | ||
...prevFs, | ||
props: removeFixtureStateProps(fixtureState, elementId), | ||
})); | ||
setPropsFs(prevFs => removePropsFixtureStateItem(prevFs, elementId)); | ||
} | ||
@@ -39,12 +36,9 @@ }); | ||
// from another renderer) | ||
if (!findFixtureStateProps(fixtureState, elementId)) { | ||
if (!findPropsFixtureStateItem(propsFs, elementId)) { | ||
const componentName = getComponentName(childEl.type); | ||
setFixtureState(prevFs => ({ | ||
...prevFs, | ||
props: createFixtureStateProps({ | ||
fixtureState: prevFs, | ||
elementId, | ||
values: createValues(childEl.props), | ||
componentName, | ||
}), | ||
setPropsFs(prevFs => createPropsFixtureStateItem({ | ||
propsFs: prevFs, | ||
elementId, | ||
values: createValues(childEl.props), | ||
componentName, | ||
})); | ||
@@ -55,9 +49,6 @@ } | ||
if (!areNodesEqual(prevChildEl, childEl, false)) { | ||
setFixtureState(prevFs => ({ | ||
...prevFs, | ||
props: updateFixtureStateProps({ | ||
fixtureState, | ||
elementId, | ||
values: createValues(childEl.props), | ||
}), | ||
setPropsFs(prevFs => updatePropsFixtureStateItem({ | ||
propsFs: prevFs, | ||
elementId, | ||
values: createValues(childEl.props), | ||
})); | ||
@@ -67,14 +58,7 @@ } | ||
}); | ||
}, [ | ||
fixture, | ||
decoratorId, | ||
elPaths, | ||
fixtureState, | ||
fixtureState.props, | ||
setFixtureState, | ||
]); | ||
}, [decoratorId, elPaths, fixture, propsFs, setPropsFs]); | ||
useEffect(() => { | ||
prevFixtureRef.current = fixture; | ||
}); | ||
return useFixtureProps(fixture, fixtureState, decoratorId); | ||
return useFixtureProps(fixture, propsFs, decoratorId); | ||
} |
import React from 'react'; | ||
import { FixtureDecoratorId, FixtureState } from 'react-cosmos-core'; | ||
export declare function useFixtureProps(fixture: React.ReactNode, fixtureState: FixtureState, decoratorId: FixtureDecoratorId): React.ReactNode; | ||
import { FixtureDecoratorId, PropsFixtureState } from 'react-cosmos-core'; | ||
export declare function useFixtureProps(fixture: React.ReactNode, propsFs: PropsFixtureState | undefined, decoratorId: FixtureDecoratorId): React.ReactNode; |
import { isEqual, mapValues } from 'lodash-es'; | ||
import React from 'react'; | ||
import { DEFAULT_RENDER_KEY, extendWithValues, findFixtureStateProps, getComponentName, } from 'react-cosmos-core'; | ||
import { DEFAULT_RENDER_KEY, extendWithValues, findPropsFixtureStateItem, getComponentName, } from 'react-cosmos-core'; | ||
import { findRelevantElementPaths } from '../shared/findRelevantElementPaths.js'; | ||
import { getChildrenPath, setElementAtPath } from '../shared/nodeTree/index.js'; | ||
export function useFixtureProps(fixture, fixtureState, decoratorId) { | ||
export function useFixtureProps(fixture, propsFs, decoratorId) { | ||
const propCache = React.useMemo(() => ({}), | ||
@@ -14,5 +14,5 @@ // React.useMemo is used as a cache invalidated by decoratorId | ||
const elementId = { decoratorId, elPath }; | ||
const fsProps = findFixtureStateProps(fixtureState, elementId); | ||
const fsItem = findPropsFixtureStateItem(propsFs, elementId); | ||
return setElementAtPath(extendedFixture, elPath, element => { | ||
if (!fsProps || componentTypeChanged(fsProps.componentName)) { | ||
if (!fsItem || componentTypeChanged(fsItem.componentName)) { | ||
return { | ||
@@ -27,3 +27,3 @@ ...element, | ||
const originalProps = element.props; | ||
const extendedProps = extendWithValues(originalProps, fsProps.values); | ||
const extendedProps = extendWithValues(originalProps, fsItem.values); | ||
// Preserve identity between renders for indentical non-primitive props | ||
@@ -54,3 +54,3 @@ const cachedProps = mapValues(extendedProps, (value, propName) => { | ||
: cachedProps, | ||
key: getElRenderKey(elPath, fsProps.renderKey), | ||
key: getElRenderKey(elPath, fsItem.renderKey), | ||
}; | ||
@@ -57,0 +57,0 @@ function componentTypeChanged(componentName) { |
@@ -1,7 +0,6 @@ | ||
import React, { useEffect } from 'react'; | ||
import { findFixtureStateControl } from 'react-cosmos-core'; | ||
import { FixtureContext } from '../FixtureContext.js'; | ||
import { useEffect } from 'react'; | ||
import { useFixtureState } from '../useFixtureState.js'; | ||
import { getDefaultSelectValue } from './shared.js'; | ||
export function useCreateFixtureState(selectName, args) { | ||
const { setFixtureState } = React.useContext(FixtureContext); | ||
const [, setFixtureState] = useFixtureState('controls'); | ||
const defaultValue = getDefaultSelectValue(args); | ||
@@ -13,17 +12,14 @@ useEffect(() => { | ||
setFixtureState(prevFs => { | ||
const fsControl = findFixtureStateControl(prevFs, selectName); | ||
if (fsControl && | ||
fsControl.type === 'select' && | ||
fsControl.defaultValue === defaultValue) | ||
const controlFs = prevFs && prevFs[selectName]; | ||
if (controlFs && | ||
controlFs.type === 'select' && | ||
controlFs.defaultValue === defaultValue) | ||
return prevFs; | ||
return { | ||
...prevFs, | ||
controls: { | ||
...prevFs.controls, | ||
[selectName]: { | ||
type: 'select', | ||
options: args.options, | ||
defaultValue, | ||
currentValue: defaultValue, | ||
}, | ||
[selectName]: { | ||
type: 'select', | ||
options: args.options, | ||
defaultValue, | ||
currentValue: defaultValue, | ||
}, | ||
@@ -30,0 +26,0 @@ }; |
@@ -1,11 +0,9 @@ | ||
import { useContext } from 'react'; | ||
import { findFixtureStateControl } from 'react-cosmos-core'; | ||
import { FixtureContext } from '../FixtureContext.js'; | ||
import { useFixtureState } from '../useFixtureState.js'; | ||
import { getDefaultSelectValue } from './shared.js'; | ||
export function useCurrentValue(selectName, args) { | ||
const { fixtureState } = useContext(FixtureContext); | ||
const fsControl = findFixtureStateControl(fixtureState, selectName); | ||
return fsControl && fsControl.type === 'select' | ||
? fsControl.currentValue | ||
const [fixtureState] = useFixtureState('controls'); | ||
const controlFs = fixtureState && fixtureState[selectName]; | ||
return controlFs && controlFs.type === 'select' | ||
? controlFs.currentValue | ||
: getDefaultSelectValue(args); | ||
} |
@@ -1,21 +0,17 @@ | ||
import { useCallback, useContext } from 'react'; | ||
import { findFixtureStateControl } from 'react-cosmos-core'; | ||
import { FixtureContext } from '../FixtureContext.js'; | ||
import { useCallback } from 'react'; | ||
import { useFixtureState } from '../useFixtureState.js'; | ||
export function useSetValue(selectName) { | ||
const { setFixtureState } = useContext(FixtureContext); | ||
const [, setFixtureState] = useFixtureState('controls'); | ||
return useCallback(value => { | ||
setFixtureState(prevFs => { | ||
const fsControl = findFixtureStateControl(prevFs, selectName); | ||
if (!fsControl || fsControl.type !== 'select') { | ||
const controlFs = prevFs && prevFs[selectName]; | ||
if (!controlFs || controlFs.type !== 'select') { | ||
console.warn(`Invalid fixture state for select: ${selectName}`); | ||
return prevFs; | ||
return prevFs ?? {}; | ||
} | ||
return { | ||
...prevFs, | ||
controls: { | ||
...prevFs.controls, | ||
[selectName]: { | ||
...fsControl, | ||
currentValue: value, | ||
}, | ||
[selectName]: { | ||
...controlFs, | ||
currentValue: value, | ||
}, | ||
@@ -22,0 +18,0 @@ }; |
import { isEqual } from 'lodash-es'; | ||
import React from 'react'; | ||
import { createValue, extendWithValue, findFixtureStateControl, } from 'react-cosmos-core'; | ||
import { FixtureContext } from '../FixtureContext.js'; | ||
import { createValue, extendWithValue, } from 'react-cosmos-core'; | ||
import { useFixtureState } from '../useFixtureState.js'; | ||
export function useCreateFixtureState(inputName, defaultValue) { | ||
const { setFixtureState } = React.useContext(FixtureContext); | ||
const [, setFixtureState] = useFixtureState('controls'); | ||
React.useEffect(() => { | ||
@@ -12,16 +12,13 @@ // The fixture state for this value is (re)created in two situations: | ||
setFixtureState(prevFs => { | ||
const fsControl = findFixtureStateControl(prevFs, inputName); | ||
if (fsControl && | ||
fsControl.type === 'standard' && | ||
fsValueExtendsBaseValue(fsControl.defaultValue, defaultValue)) | ||
const controlFs = prevFs && prevFs[inputName]; | ||
if (controlFs && | ||
controlFs.type === 'standard' && | ||
fsValueExtendsBaseValue(controlFs.defaultValue, defaultValue)) | ||
return prevFs; | ||
return { | ||
...prevFs, | ||
controls: { | ||
...prevFs.controls, | ||
[inputName]: { | ||
type: 'standard', | ||
defaultValue: createValue(defaultValue), | ||
currentValue: createValue(defaultValue), | ||
}, | ||
[inputName]: { | ||
type: 'standard', | ||
defaultValue: createValue(defaultValue), | ||
currentValue: createValue(defaultValue), | ||
}, | ||
@@ -28,0 +25,0 @@ }; |
@@ -1,12 +0,11 @@ | ||
import React from 'react'; | ||
import { extendWithValue, findFixtureStateControl, } from 'react-cosmos-core'; | ||
import { FixtureContext } from '../FixtureContext.js'; | ||
import { extendWithValue, } from 'react-cosmos-core'; | ||
import { useFixtureState } from '../useFixtureState.js'; | ||
export function useCurrentValue(inputName, defaultValue) { | ||
const { fixtureState } = React.useContext(FixtureContext); | ||
const fsControl = findFixtureStateControl(fixtureState, inputName); | ||
return fsControl && fsControl.type === 'standard' | ||
const [fixtureState] = useFixtureState('controls'); | ||
const controlFs = fixtureState && fixtureState[inputName]; | ||
return controlFs && controlFs.type === 'standard' | ||
? // Types of fixture state values cannot be guaranteed at read time, which | ||
// means that tampering with the fixture state can cause runtime errors | ||
extendWithValue(defaultValue, fsControl.currentValue) | ||
extendWithValue(defaultValue, controlFs.currentValue) | ||
: defaultValue; | ||
} |
import React from 'react'; | ||
import { createValue, extendWithValue, findFixtureStateControl, } from 'react-cosmos-core'; | ||
import { FixtureContext } from '../FixtureContext.js'; | ||
import { createValue, extendWithValue, } from 'react-cosmos-core'; | ||
import { useFixtureState } from '../useFixtureState.js'; | ||
export function useSetValue(inputName, defaultValue) { | ||
const { setFixtureState } = React.useContext(FixtureContext); | ||
const [, setFixtureState] = useFixtureState('controls'); | ||
return React.useCallback(stateChange => { | ||
@@ -17,9 +17,6 @@ setFixtureState(prevFs => { | ||
...prevFs, | ||
controls: { | ||
...prevFs.controls, | ||
[inputName]: { | ||
type: 'standard', | ||
defaultValue: createValue(defaultValue), | ||
currentValue: createValue(currentValue), | ||
}, | ||
[inputName]: { | ||
type: 'standard', | ||
defaultValue: createValue(defaultValue), | ||
currentValue: createValue(currentValue), | ||
}, | ||
@@ -31,6 +28,6 @@ }; | ||
function getCurrentValueFromFixtureState(fixtureState, inputName, defaultValue) { | ||
const fsControl = findFixtureStateControl(fixtureState, inputName); | ||
return fsControl && fsControl.type === 'standard' | ||
? extendWithValue(defaultValue, fsControl.currentValue) | ||
const controlFs = fixtureState && fixtureState[inputName]; | ||
return controlFs && controlFs.type === 'standard' | ||
? extendWithValue(defaultValue, controlFs.currentValue) | ||
: defaultValue; | ||
} |
@@ -7,3 +7,3 @@ import React from 'react'; | ||
}; | ||
export declare function Viewport({ children, width, height }: Props): JSX.Element; | ||
export declare function Viewport({ children, width, height }: Props): React.ReactNode; | ||
export declare namespace Viewport { | ||
@@ -10,0 +10,0 @@ var cosmosCapture: boolean; |
'use client'; | ||
import React from 'react'; | ||
import { FixtureContext } from './FixtureContext.js'; | ||
import { useFixtureState } from './useFixtureState.js'; | ||
export function Viewport({ children, width, height }) { | ||
const { setFixtureState } = React.useContext(FixtureContext); | ||
const [, setViewport] = useFixtureState('viewport'); | ||
React.useEffect(() => { | ||
setFixtureState(fixtureState => ({ | ||
...fixtureState, | ||
viewport: { width, height }, | ||
})); | ||
}, [setFixtureState, width, height]); | ||
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051 | ||
return React.createElement(React.Fragment, null, children); | ||
setViewport({ width, height }); | ||
}, [setViewport, width, height]); | ||
return children; | ||
} | ||
Viewport.cosmosCapture = false; |
@@ -1,2 +0,2 @@ | ||
import { ReactElement } from 'react'; | ||
import React from 'react'; | ||
import { ReactDecorator, UserModuleWrappers } from 'react-cosmos-core'; | ||
@@ -6,5 +6,5 @@ type Props = { | ||
globalDecorators?: ReactDecorator[]; | ||
renderMessage?: (msg: string) => ReactElement; | ||
renderMessage?: (msg: string) => React.ReactNode; | ||
}; | ||
export declare function ClientFixtureLoader({ moduleWrappers, globalDecorators, renderMessage, }: Props): JSX.Element; | ||
export declare function ClientFixtureLoader({ moduleWrappers, globalDecorators, renderMessage, }: Props): React.JSX.Element; | ||
export {}; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
export declare function defaultRenderMessage(msg: string): JSX.Element; | ||
export declare function defaultRenderMessage(msg: string): string; |
@@ -1,4 +0,3 @@ | ||
import React from 'react'; | ||
export function defaultRenderMessage(msg) { | ||
return React.createElement(React.Fragment, null, msg); | ||
return msg; | ||
} |
@@ -7,6 +7,6 @@ import React from 'react'; | ||
selectedFixture: SelectedFixture | null; | ||
renderMessage: (msg: string) => React.ReactElement; | ||
renderFixture: (selected: SelectedFixture) => React.ReactElement; | ||
renderMessage: (msg: string) => React.ReactNode; | ||
renderFixture: (selected: SelectedFixture) => React.ReactNode; | ||
}; | ||
export declare function FixtureLoaderConnect({ moduleWrappers, selectedFixture, renderMessage, renderFixture, }: Props): JSX.Element; | ||
export declare function FixtureLoaderConnect({ moduleWrappers, selectedFixture, renderMessage, renderFixture, }: Props): React.JSX.Element; | ||
export {}; |
@@ -7,3 +7,3 @@ import React from 'react'; | ||
}; | ||
export declare function RendererSync({ children, fixtures }: Props): JSX.Element; | ||
export declare function RendererSync({ children, fixtures }: Props): React.ReactNode; | ||
export {}; |
@@ -64,3 +64,3 @@ 'use client'; | ||
}), [locked, rendererConnect, rendererId, selectFixture, unselectFixture]); | ||
return React.createElement(React.Fragment, null, children); | ||
return children; | ||
} |
@@ -7,6 +7,6 @@ import React from 'react'; | ||
globalDecorators?: ReactDecorator[]; | ||
renderMessage?: (msg: string) => React.ReactElement; | ||
renderMessage?: (msg: string) => React.ReactNode; | ||
selectedFixture: SelectedFixture | null; | ||
}; | ||
export declare function ServerFixtureLoader({ moduleWrappers, globalDecorators, renderMessage, selectedFixture, }: Props): JSX.Element; | ||
export declare function ServerFixtureLoader({ moduleWrappers, globalDecorators, renderMessage, selectedFixture, }: Props): React.JSX.Element; | ||
export {}; |
@@ -0,1 +1,3 @@ | ||
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/65220 | ||
/// <reference types="react/experimental" /> | ||
import React, { Suspense } from 'react'; | ||
@@ -2,0 +4,0 @@ import { FixtureModule } from '../fixtureModule/FixtureModule.js'; |
@@ -0,1 +1,2 @@ | ||
/// <reference types="react/experimental" /> | ||
import React from 'react'; | ||
@@ -11,5 +12,5 @@ import { FixtureId, FixtureState, ReactDecorator, ReactDecoratorModule, ReactFixtureModule } from 'react-cosmos-core'; | ||
lazy: boolean; | ||
renderMessage: (msg: string) => React.ReactElement; | ||
renderMessage: (msg: string) => React.ReactNode; | ||
}; | ||
export declare function FixtureModule({ fixtureModule, decoratorModules, globalDecorators, fixtureId, initialFixtureState, renderKey, lazy, renderMessage, }: Props): JSX.Element; | ||
export declare function FixtureModule({ fixtureModule, decoratorModules, globalDecorators, fixtureId, initialFixtureState, renderKey, lazy, renderMessage, }: Props): string | number | boolean | Iterable<React.ReactNode> | React.PromiseLikeOfReactNode | React.JSX.Element | null | undefined; | ||
export {}; |
@@ -10,3 +10,3 @@ import React from 'react'; | ||
}; | ||
export declare function FixtureProvider(props: Props): JSX.Element; | ||
export declare function FixtureProvider(props: Props): React.JSX.Element; | ||
export {}; |
@@ -6,2 +6,5 @@ import { registerPlaygroundShortcuts, } from 'react-cosmos-core'; | ||
} | ||
registerPlaygroundShortcuts(command => { | ||
postMessage({ type: 'playgroundCommand', payload: { command } }); | ||
}); | ||
return { | ||
@@ -14,8 +17,4 @@ postMessage, | ||
window.addEventListener('message', handleMessage, false); | ||
const removeShortcuts = registerPlaygroundShortcuts(command => { | ||
postMessage({ type: 'playgroundCommand', payload: { command } }); | ||
}); | ||
return () => { | ||
window.removeEventListener('message', handleMessage); | ||
removeShortcuts(); | ||
}; | ||
@@ -22,0 +21,0 @@ }, |
@@ -14,3 +14,3 @@ import React from 'react'; | ||
}; | ||
export declare function RendererProvider(props: Props): JSX.Element; | ||
export declare function RendererProvider(props: Props): React.JSX.Element; | ||
export {}; |
@@ -11,3 +11,3 @@ import React from 'react'; | ||
}; | ||
export declare function StatefulRendererProvider({ children, selectedFixtureId, ...otherProps }: Props): JSX.Element; | ||
export declare function StatefulRendererProvider({ children, selectedFixtureId, ...otherProps }: Props): React.JSX.Element; | ||
export {}; |
{ | ||
"name": "react-cosmos-renderer", | ||
"version": "6.0.0-canary.fdbaa56.0+fdbaa56", | ||
"version": "6.0.0", | ||
"description": "React Cosmos Renderer", | ||
@@ -14,7 +14,7 @@ "repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos-renderer", | ||
"dependencies": { | ||
"lodash-es": "^4.17.21", | ||
"react-cosmos-core": "6.0.0-canary.fdbaa56.0+fdbaa56", | ||
"react-is": "^18.2.0" | ||
"lodash-es": "4.17.21", | ||
"react-cosmos-core": "^6.0.0", | ||
"react-is": "18.2.0" | ||
}, | ||
"gitHead": "fdbaa565382e2685f7ac21aecec25f2d78c7b8ab" | ||
"gitHead": "db4fd8fd917598f1f16d4c291be76217436422ee" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
108
1
0
69501
1475
+ Addedjs-base64@3.7.7(transitive)
+ Addedreact-cosmos-core@6.2.0(transitive)
+ Addedreact-is@18.2.0(transitive)
Updatedlodash-es@4.17.21
Updatedreact-cosmos-core@^6.0.0
Updatedreact-is@18.2.0