react-cosmos-renderer
Advanced tools
Comparing version 6.2.3-canary.dc84193.0 to 6.2.4-canary.4981a3d.0
import React from 'react'; | ||
type Props = { | ||
children: React.ClassicElement<unknown>; | ||
children: React.ReactElement<{ | ||
ref?: React.Ref<unknown>; | ||
}>; | ||
state?: {}; | ||
@@ -9,3 +11,5 @@ }; | ||
childRef: React.Component | null; | ||
render(): React.CElement<unknown, React.Component<{}, {}, any>>; | ||
render(): React.ReactElement<{ | ||
ref?: React.Ref<unknown>; | ||
}, string | React.JSXElementConstructor<any>>; | ||
componentDidUpdate(prevProps: Props): void; | ||
@@ -12,0 +16,0 @@ handleRef: (childRef: React.Component | null) => void; |
import { isEqual } from 'lodash-es'; | ||
import React from 'react'; | ||
// Compied from https://github.com/skidding/react-mock/blob/c33dfa1d6f0c9ce7b3eaba073618d61731a0e82e/packages/state/src/index.js | ||
// Copied from https://github.com/skidding/react-mock/blob/c33dfa1d6f0c9ce7b3eaba073618d61731a0e82e/packages/state/src/index.js | ||
export class ClassStateMock extends React.Component { | ||
@@ -25,3 +25,3 @@ static cosmosCapture = false; | ||
handleRef = (childRef) => { | ||
const prevRef = this.props.children.ref; | ||
const prevRef = this.props.children.props.ref; | ||
this.childRef = childRef; | ||
@@ -70,5 +70,4 @@ if (!childRef) { | ||
else if (ref && typeof ref === 'object') { | ||
// @ts-ignore | ||
ref.current = elRef; | ||
} | ||
} |
@@ -12,4 +12,5 @@ import { cloneElement, } from 'react'; | ||
} | ||
const origRef = element.props.ref; | ||
return cloneElement(element, { | ||
ref: getDecoratedRef(element.ref, spyRef, elPath, cachedRefHandlers), | ||
ref: getDecoratedRef(origRef, spyRef, elPath, cachedRefHandlers), | ||
}); | ||
@@ -30,6 +31,5 @@ }); | ||
return (elRef) => { | ||
if (origRef) { | ||
callOriginalRef(origRef, elRef); | ||
} | ||
const callback = origRef ? callOriginalRef(origRef, elRef) : undefined; | ||
spyRef(elPath, elRef); | ||
return callback; | ||
}; | ||
@@ -43,4 +43,3 @@ } | ||
if (typeof ref === 'function') { | ||
ref(elRef); | ||
return; | ||
return ref(elRef); | ||
} | ||
@@ -47,0 +46,0 @@ const refObj = ref; |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
import React, { RefCallback } from 'react'; | ||
export type ElRefs = { | ||
@@ -12,4 +12,4 @@ [elPath: string]: React.Component; | ||
export type CachedRefHandler = { | ||
origRef: null | React.Ref<any>; | ||
handler: (elRef: null | React.Component) => unknown; | ||
origRef: undefined | React.Ref<unknown>; | ||
handler: RefCallback<unknown>; | ||
}; | ||
@@ -16,0 +16,0 @@ export type CachedRefHandlers = { |
@@ -1,4 +0,4 @@ | ||
import { MutableRefObject, ReactNode } from 'react'; | ||
import { ReactNode, RefObject } from 'react'; | ||
import { FixtureDecoratorId } from 'react-cosmos-core'; | ||
import { ElRefs } from './shared.js'; | ||
export declare function useFixtureClassState(fixture: ReactNode, decoratorId: FixtureDecoratorId, elRefs: MutableRefObject<ElRefs>): ReactNode; | ||
export declare function useFixtureClassState(fixture: ReactNode, decoratorId: FixtureDecoratorId, elRefs: RefObject<ElRefs>): ReactNode; |
@@ -1,4 +0,4 @@ | ||
import { MutableRefObject, ReactNode } from 'react'; | ||
import { ReactNode, RefObject } from 'react'; | ||
import { FixtureDecoratorId } from 'react-cosmos-core'; | ||
import { ElRefs } from './shared.js'; | ||
export declare function useReadClassState(fixture: ReactNode, decoratorId: FixtureDecoratorId, elRefs: MutableRefObject<ElRefs>): void; | ||
export declare function useReadClassState(fixture: ReactNode, decoratorId: FixtureDecoratorId, elRefs: RefObject<ElRefs>): void; |
@@ -1,3 +0,4 @@ | ||
import { ReactElement, ReactNode } from 'react'; | ||
export declare function getElementAtPath(node: ReactNode, elPath: string): null | ReactElement; | ||
export declare function getExpectedElementAtPath(node: ReactNode, elPath: string): ReactElement; | ||
import { ReactNode } from 'react'; | ||
import { ReactElementWithChildren } from 'react-cosmos-core'; | ||
export declare function getElementAtPath(node: ReactNode, elPath: string): null | ReactElementWithChildren; | ||
export declare function getExpectedElementAtPath(node: ReactNode, elPath: string): ReactElementWithChildren; |
@@ -1,2 +0,3 @@ | ||
import { ReactElement, ReactNode } from 'react'; | ||
export declare function setElementAtPath(node: ReactNode, elPath: string, updater: (el: ReactElement) => ReactElement): ReactNode; | ||
import { ReactNode } from 'react'; | ||
import { ReactElementWithChildren } from 'react-cosmos-core'; | ||
export declare function setElementAtPath(node: ReactNode, elPath: string, updater: (el: ReactElementWithChildren) => ReactElementWithChildren): ReactNode; |
@@ -9,3 +9,3 @@ import React from 'react'; | ||
}; | ||
export declare function DecoratedFixture({ fixture, fixtureOptions, userDecoratorModules, globalDecorators, }: Props): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
export declare function DecoratedFixture({ fixture, fixtureOptions, userDecoratorModules, globalDecorators, }: Props): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>; | ||
export {}; |
@@ -13,3 +13,3 @@ import React from 'react'; | ||
}; | ||
export declare function FixtureModule({ fixtureModule, decoratorModules, globalDecorators, fixtureId, initialFixtureState, renderKey, lazy, renderMessage, }: Props): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<React.AwaitedReactNode> | React.JSX.Element | null | undefined; | ||
export declare function FixtureModule({ fixtureModule, decoratorModules, globalDecorators, fixtureId, initialFixtureState, renderKey, lazy, renderMessage, }: Props): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined; | ||
export {}; |
@@ -8,3 +8,3 @@ import React from 'react'; | ||
}; | ||
export declare function AsyncModuleLoader({ moduleWrappers, fixturePath, renderModules, }: Props): Promise<React.ReactElement<any, string | React.JSXElementConstructor<any>>>; | ||
export declare function AsyncModuleLoader({ moduleWrappers, fixturePath, renderModules, }: Props): Promise<React.ReactElement<unknown, string | React.JSXElementConstructor<any>>>; | ||
export {}; |
@@ -9,3 +9,3 @@ import React from 'react'; | ||
}; | ||
export declare function LazyModuleLoader({ fixtureWrapper, decorators, fixturePath, renderModules, }: Props): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null; | ||
export declare function LazyModuleLoader({ fixtureWrapper, decorators, fixturePath, renderModules, }: Props): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null; | ||
export {}; |
@@ -9,3 +9,3 @@ import React from 'react'; | ||
}; | ||
export declare function StaticModuleLoader({ fixtureWrapper, decorators, fixturePath, renderModules, }: Props): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
export declare function StaticModuleLoader({ fixtureWrapper, decorators, fixturePath, renderModules, }: Props): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>; | ||
export {}; |
{ | ||
"name": "react-cosmos-renderer", | ||
"version": "6.2.3-canary.dc84193.0+dc84193", | ||
"version": "6.2.4-canary.4981a3d.0+4981a3d", | ||
"description": "React Cosmos Renderer", | ||
@@ -15,6 +15,6 @@ "repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos-renderer", | ||
"lodash-es": "4.17.21", | ||
"react-cosmos-core": "6.2.3-canary.dc84193.0+dc84193", | ||
"react-is": "18.3.1" | ||
"react-cosmos-core": "6.2.4-canary.4981a3d.0+4981a3d", | ||
"react-is": "19.0.0" | ||
}, | ||
"gitHead": "dc841937eaa894dad5553d6d20de734925612720" | ||
"gitHead": "4981a3d7d9b878a196e618628d6db7e318a9a0a8" | ||
} |
Sorry, the diff of this file is not supported yet
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
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
80317
115
1657
+ Addedreact-is@19.0.0(transitive)
- Removedreact-is@18.3.1(transitive)
Updatedreact-is@19.0.0