Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-cosmos-renderer

Package Overview
Dependencies
Maintainers
1
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-cosmos-renderer - npm Package Compare versions

Comparing version 6.0.0-canary.ab59b01.0 to 6.0.0-canary.b87d3fe.0

3

dist/fixtureLoaders/RendererSync.js

@@ -5,4 +5,3 @@ 'use client';

export function RendererSync({ children, fixtures }) {
const { searchParams, rendererId, rendererConnect, reloadRenderer, lazyItems, } = React.useContext(RendererContext);
const { fixtureId: selectedFixtureId } = searchParams;
const { params: { fixtureId: selectedFixtureId }, rendererId, rendererConnect, reloadRenderer, lazyItems, } = React.useContext(RendererContext);
const readyRef = React.useRef(false);

@@ -9,0 +8,0 @@ React.useEffect(() => {

@@ -5,26 +5,20 @@ 'use client';

export function ServerFixtureChangeListener({ children }) {
const { rendererId, rendererConnect, searchParams, setSearchParams } = React.useContext(RendererContext);
const { rendererId, rendererConnect, params, setParams } = React.useContext(RendererContext);
React.useEffect(() => rendererConnect.onMessage(msg => {
if (!searchParams.locked &&
if (!params.locked &&
msg.type === 'selectFixture' &&
msg.payload.rendererId === rendererId) {
const { fixtureId } = msg.payload;
setSearchParams({
setParams({
fixtureId,
key: (searchParams.key ?? 0) + 1,
key: (params.key ?? 0) + 1,
});
}
else if (!searchParams.locked &&
else if (!params.locked &&
msg.type === 'unselectFixture' &&
msg.payload.rendererId === rendererId) {
setSearchParams({});
setParams({});
}
}), [
rendererConnect,
rendererId,
searchParams.key,
searchParams.locked,
setSearchParams,
]);
}), [params.key, params.locked, rendererConnect, rendererId, setParams]);
return React.createElement(React.Fragment, null, children);
}
import React from 'react';
import { ReactDecorator, StringRendererSearchParams, UserModuleWrappers } from 'react-cosmos-core';
import { ReactDecorator, RendererParams, UserModuleWrappers } from 'react-cosmos-core';
type Props = {
searchParams: StringRendererSearchParams;
params: RendererParams;
moduleWrappers: UserModuleWrappers;

@@ -9,3 +9,3 @@ globalDecorators?: ReactDecorator[];

};
export declare function ServerFixtureLoader({ searchParams, moduleWrappers, globalDecorators, renderMessage, }: Props): JSX.Element;
export declare function ServerFixtureLoader({ params, moduleWrappers, globalDecorators, renderMessage, }: Props): JSX.Element;
export {};
import React, { Suspense } from 'react';
import { decodeRendererSearchParams, } from 'react-cosmos-core';
import { FixtureModule } from '../fixtureModule/FixtureModule.js';

@@ -8,4 +7,4 @@ import { AsyncModuleLoader } from '../moduleLoaders/AsyncModuleLoader.js';

import { defaultRenderMessage } from './defaultRenderMessage.js';
export function ServerFixtureLoader({ searchParams, moduleWrappers, globalDecorators, renderMessage = defaultRenderMessage, }) {
const { fixtureId = null, key = 0 } = decodeRendererSearchParams(searchParams);
export function ServerFixtureLoader({ params, moduleWrappers, globalDecorators, renderMessage = defaultRenderMessage, }) {
const { fixtureId = null, key = 0 } = params;
const fixtureSelection = fixtureId && {

@@ -12,0 +11,0 @@ fixtureId,

import React from 'react';
import { RendererContext } from '../rendererConnect/RendererContext.js';
export function useFixtureSelection() {
const { rendererId, rendererConnect, searchParams } = React.useContext(RendererContext);
const { fixtureId: selectedFixtureId = null } = searchParams;
const { rendererId, rendererConnect, params } = React.useContext(RendererContext);
const { fixtureId: selectedFixtureId = null } = params;
const [selection, setSelection] = React.useState(() => selectedFixtureId && {

@@ -12,3 +12,3 @@ fixtureId: selectedFixtureId,

React.useEffect(() => rendererConnect.onMessage(msg => {
if (!searchParams.locked &&
if (!params.locked &&
msg.type === 'selectFixture' &&

@@ -25,3 +25,3 @@ msg.payload.rendererId === rendererId) {

}
else if (!searchParams.locked &&
else if (!params.locked &&
msg.type === 'unselectFixture' &&

@@ -31,4 +31,4 @@ msg.payload.rendererId === rendererId) {

}
}), [rendererConnect, rendererId, searchParams.locked]);
}), [params.locked, rendererConnect, rendererId]);
return selection;
}
import React from 'react';
import { FixtureList, RendererConnect, RendererSearchParams } from 'react-cosmos-core';
import { FixtureList, RendererConnect, RendererParams } from 'react-cosmos-core';
export type RendererContextValue = {
rendererId: string;
rendererConnect: RendererConnect;
searchParams: RendererSearchParams;
setSearchParams(nextParams: RendererSearchParams): void;
params: RendererParams;
setParams(nextParams: RendererParams): void;
reloadRenderer(): void;

@@ -9,0 +9,0 @@ lazyItems: FixtureList;

@@ -8,4 +8,4 @@ import React from 'react';

},
searchParams: {},
setSearchParams: () => { },
params: {},
setParams: () => { },
reloadRenderer: () => { },

@@ -12,0 +12,0 @@ lazyItems: {},

import React from 'react';
import { RendererConnect, RendererSearchParams } from 'react-cosmos-core';
import { RendererConnect, RendererParams } from 'react-cosmos-core';
export type Props = {

@@ -7,6 +7,6 @@ children: React.ReactNode;

rendererConnect: RendererConnect;
searchParams: RendererSearchParams;
setSearchParams(nextParams: RendererSearchParams): void;
params: RendererParams;
setParams(nextParams: RendererParams): void;
reloadRenderer(): void;
};
export declare function RendererProvider(props: Props): JSX.Element;

@@ -10,4 +10,4 @@ 'use client';

rendererConnect: props.rendererConnect,
searchParams: props.searchParams,
setSearchParams: props.setSearchParams,
params: props.params,
setParams: props.setParams,
reloadRenderer: props.reloadRenderer,

@@ -19,9 +19,9 @@ lazyItems,

lazyItems,
props.params,
props.reloadRenderer,
props.rendererConnect,
props.rendererId,
props.searchParams,
props.setSearchParams,
props.setParams,
]);
return (React.createElement(RendererContext.Provider, { value: value }, props.children));
}
{
"name": "react-cosmos-renderer",
"version": "6.0.0-canary.ab59b01.0+ab59b01",
"version": "6.0.0-canary.b87d3fe.0+b87d3fe",
"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.0.0-canary.ab59b01.0+ab59b01",
"react-cosmos-core": "6.0.0-canary.b87d3fe.0+b87d3fe",
"react-is": "^18.2.0"
},
"gitHead": "ab59b011ccf0b9e1f6969e3aed3e45228836bee8"
"gitHead": "b87d3fe06a56c8e3c4c87e731e31092df67d52c0"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc