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

react-cosmos-shared2

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-cosmos-shared2 - npm Package Compare versions

Comparing version 5.6.7 to 5.6.8

dist/react/getFixtureList.d.ts

4

dist/FixtureLoader/fixtureHelpers.d.ts

@@ -1,3 +0,3 @@

import React from 'react';
import { ReactNode } from 'react';
import { ReactFixtureExport } from '../react';
export declare function getFixture(fixtureExport: ReactFixtureExport, fixtureName: null | string): void | React.ReactNode;
export declare function getFixture(fixtureExport: ReactFixtureExport, fixtureName?: string): void | ReactNode;

@@ -11,3 +11,3 @@ "use strict";

function getFixture(fixtureExport, fixtureName) {
if (fixtureName === null) {
if (fixtureName === undefined) {
if ((0, _react.isMultiFixture)(fixtureExport)) {

@@ -14,0 +14,0 @@ // Fixture name missing in multi fixture

@@ -1,12 +0,12 @@

import React from 'react';
import React, { Component } from 'react';
import { FixtureState, SetFixtureState } from '../fixtureState';
import { ReactDecorator, ReactDecoratorsByPath, ReactFixtureExportsByPath } from '../react';
import { FixtureId, FixtureNamesByPath, RendererConnect, RendererRequest, RendererResponse, SelectFixtureRequest, SetFixtureStateRequest } from '../renderer';
import { ReactDecorator, ReactDecorators, ReactFixtureWrappers } from '../react';
import { FixtureId, RendererConnect, RendererRequest, RendererResponse, SelectFixtureRequest, SetFixtureStateRequest } from '../renderer';
export declare type Props = {
rendererId: string;
rendererConnect: RendererConnect;
fixtures: ReactFixtureExportsByPath;
fixtures: ReactFixtureWrappers;
selectedFixtureId: null | FixtureId;
systemDecorators: ReactDecorator[];
userDecorators: ReactDecoratorsByPath;
userDecorators: ReactDecorators;
renderMessage?: (args: {

@@ -17,11 +17,12 @@ msg: string;

};
declare type SelectedFixture = {
fixtureId: FixtureId;
fixtureState: FixtureState;
syncedFixtureState: FixtureState;
};
declare type State = {
selectedFixture: null | {
fixtureId: FixtureId;
fixtureState: FixtureState;
syncedFixtureState: FixtureState;
};
selectedFixture: null | SelectedFixture;
renderKey: number;
};
export declare class FixtureLoader extends React.Component<Props, State> {
export declare class FixtureLoader extends Component<Props, State> {
state: State;

@@ -42,3 +43,5 @@ unsubscribe: null | (() => unknown);

setFixtureState: SetFixtureState;
getFixtureNamesByPath(): FixtureNamesByPath;
getFixtureList(): {
[x: string]: import("../renderer").FixtureListItem;
};
fireChangeCallback(): void;

@@ -45,0 +48,0 @@ updateSyncedFixtureState(syncedFixtureState: FixtureState): void;

@@ -12,3 +12,3 @@ "use strict";

var _react = _interopRequireDefault(require("react"));
var _react = _interopRequireWildcard(require("react"));

@@ -21,4 +21,6 @@ var _react2 = require("../react");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

@@ -50,5 +52,14 @@

var FixtureLoader = /*#__PURE__*/function (_React$Component) {
_inherits(FixtureLoader, _React$Component);
function getSelectedFixture(fixtureId) {
if (!fixtureId) return null;
return {
fixtureId: fixtureId,
fixtureState: {},
syncedFixtureState: {}
};
}
var FixtureLoader = /*#__PURE__*/function (_Component) {
_inherits(FixtureLoader, _Component);
var _super = _createSuper(FixtureLoader);

@@ -68,7 +79,3 @@

_defineProperty(_assertThisInitialized(_this), "state", {
selectedFixture: _this.props.selectedFixtureId ? {
fixtureId: _this.props.selectedFixtureId,
fixtureState: {},
syncedFixtureState: {}
} : null,
selectedFixture: getSelectedFixture(_this.props.selectedFixtureId),
renderKey: 0

@@ -215,3 +222,3 @@ });

var fixtureExport = fixtures[fixtureId.path];
var fixtureExport = fixtures[fixtureId.path].module.default;
var fixture = (0, _fixtureHelpers.getFixture)(fixtureExport, fixtureId.name);

@@ -290,3 +297,3 @@

rendererId: rendererId,
fixtures: this.getFixtureNamesByPath()
fixtures: this.getFixtureList()
}

@@ -303,3 +310,3 @@ });

rendererId: rendererId,
fixtures: this.getFixtureNamesByPath()
fixtures: this.getFixtureList()
}

@@ -309,5 +316,5 @@ });

}, {
key: "getFixtureNamesByPath",
value: function getFixtureNamesByPath() {
return (0, _react2.getFixtureNamesByPath)(this.props.fixtures);
key: "getFixtureList",
value: function getFixtureList() {
return (0, _react2.getFixtureListFromWrappers)(this.props.fixtures);
}

@@ -359,3 +366,3 @@ }, {

return FixtureLoader;
}(_react.default.Component);
}(_react.Component);

@@ -362,0 +369,0 @@ exports.FixtureLoader = FixtureLoader;

import React from 'react';
import { FixtureState, SetFixtureState } from '../fixtureState';
import { ReactDecorator, ReactDecoratorsByPath } from '../react';
import { ReactDecorator, ReactDecorators } from '../react';
import { FixtureId } from '../renderer';

@@ -9,3 +9,3 @@ declare type Props = {

systemDecorators: ReactDecorator[];
userDecorators: ReactDecoratorsByPath;
userDecorators: ReactDecorators;
fixtureState: FixtureState;

@@ -12,0 +12,0 @@ setFixtureState: SetFixtureState;

@@ -1,3 +0,3 @@

import { FixtureNamesByPath } from '../../renderer';
import { FixtureList } from '../../renderer';
import { FixtureTreeNode } from '../shared/types';
export declare function createRawFixtureTree(fixtures: FixtureNamesByPath): FixtureTreeNode;
export declare function createRawFixtureTree(fixtures: FixtureList): FixtureTreeNode;

@@ -30,3 +30,3 @@ "use strict";

function addFixturePathToTree(rootNode, fixturePath, fixtureNames) {
function addFixturePathToTree(rootNode, fixturePath, fixtureItem) {
var _parseFixturePath = parseFixturePath(fixturePath),

@@ -36,17 +36,19 @@ parents = _parseFixturePath.parents,

if (!fixtureNames) return injectNode(rootNode, parents, fileName, {
data: {
type: 'fixture',
fixtureId: {
path: fixturePath,
name: null
if (fixtureItem.type == 'single') {
injectNode(rootNode, parents, fileName, {
data: {
type: 'fixture',
fixtureId: {
path: fixturePath
}
}
}
});
injectNode(rootNode, parents, fileName, {
data: {
type: 'multiFixture',
fixtureIds: createFixtureIds(fixturePath, fixtureNames)
}
});
});
} else if (fixtureItem.type == 'multi') {
injectNode(rootNode, parents, fileName, {
data: {
type: 'multiFixture',
fixtureIds: createFixtureIds(fixturePath, fixtureItem.fixtureNames)
}
});
}
}

@@ -53,0 +55,0 @@

@@ -1,7 +0,7 @@

import { FixtureNamesByPath } from '../../renderer';
import { FixtureList } from '../../renderer';
import { FixtureTreeNode } from '../shared/types';
export declare function createFixtureTree({ fixtures, fixturesDir, fixtureFileSuffix, }: {
fixtures: FixtureNamesByPath;
fixtures: FixtureList;
fixturesDir: string;
fixtureFileSuffix: string;
}): FixtureTreeNode;

@@ -1,2 +0,2 @@

import { ReactDecoratorsByPath, ReactDecorator } from './shared';
export declare function getSortedDecoratorsForFixturePath(fixturePath: string, decoratorsByPath: ReactDecoratorsByPath): ReactDecorator[];
import { ReactDecorators, ReactDecorator } from './shared';
export declare function getSortedDecoratorsForFixturePath(fixturePath: string, decoratorsByPath: ReactDecorators): ReactDecorator[];

@@ -1,7 +0,7 @@

export { ReactFixture, ReactFixtureMap, ReactFixtureExport, ReactDecoratorProps, ReactDecorator, ReactFixtureExportsByPath, ReactDecoratorsByPath, } from './shared';
export { areNodesEqual } from './areNodesEqual';
export { getComponentName } from './getComponentName';
export { getFixtureNamesByPath } from './getFixtureNamesByPath';
export { getFixtureListFromExports, getFixtureListFromWrappers, } from './getFixtureList';
export { getSortedDecoratorsForFixturePath } from './getSortedDecoratorsForFixturePath';
export { isMultiFixture } from './isMultiFixture';
export { isReactElement } from './isReactElement';
export { getSortedDecoratorsForFixturePath } from './getSortedDecoratorsForFixturePath';
export { ReactDecorator, ReactDecoratorProps, ReactDecorators, ReactFixture, ReactFixtureExport, ReactFixtureExports, ReactFixtureMap, ReactFixtureModule, ReactFixtureWrapper, ReactFixtureWrappers, } from './shared';

@@ -18,6 +18,6 @@ "use strict";

});
Object.defineProperty(exports, "ReactDecoratorsByPath", {
Object.defineProperty(exports, "ReactDecorators", {
enumerable: true,
get: function get() {
return _shared.ReactDecoratorsByPath;
return _shared.ReactDecorators;
}

@@ -37,6 +37,6 @@ });

});
Object.defineProperty(exports, "ReactFixtureExportsByPath", {
Object.defineProperty(exports, "ReactFixtureExports", {
enumerable: true,
get: function get() {
return _shared.ReactFixtureExportsByPath;
return _shared.ReactFixtureExports;
}

@@ -50,2 +50,20 @@ });

});
Object.defineProperty(exports, "ReactFixtureModule", {
enumerable: true,
get: function get() {
return _shared.ReactFixtureModule;
}
});
Object.defineProperty(exports, "ReactFixtureWrapper", {
enumerable: true,
get: function get() {
return _shared.ReactFixtureWrapper;
}
});
Object.defineProperty(exports, "ReactFixtureWrappers", {
enumerable: true,
get: function get() {
return _shared.ReactFixtureWrappers;
}
});
Object.defineProperty(exports, "areNodesEqual", {

@@ -63,8 +81,14 @@ enumerable: true,

});
Object.defineProperty(exports, "getFixtureNamesByPath", {
Object.defineProperty(exports, "getFixtureListFromExports", {
enumerable: true,
get: function get() {
return _getFixtureNamesByPath.getFixtureNamesByPath;
return _getFixtureList.getFixtureListFromExports;
}
});
Object.defineProperty(exports, "getFixtureListFromWrappers", {
enumerable: true,
get: function get() {
return _getFixtureList.getFixtureListFromWrappers;
}
});
Object.defineProperty(exports, "getSortedDecoratorsForFixturePath", {

@@ -89,4 +113,2 @@ enumerable: true,

var _shared = require("./shared");
var _areNodesEqual = require("./areNodesEqual");

@@ -96,4 +118,6 @@

var _getFixtureNamesByPath = require("./getFixtureNamesByPath");
var _getFixtureList = require("./getFixtureList");
var _getSortedDecoratorsForFixturePath = require("./getSortedDecoratorsForFixturePath");
var _isMultiFixture = require("./isMultiFixture");

@@ -103,2 +127,2 @@

var _getSortedDecoratorsForFixturePath = require("./getSortedDecoratorsForFixturePath");
var _shared = require("./shared");

@@ -1,2 +0,2 @@

/// <reference types="react" />
import { ComponentType, FunctionComponent, ReactNode } from 'react';
import { FixtureState, SetFixtureState } from '../fixtureState';

@@ -7,7 +7,15 @@ declare type FixtureMap<FixtureType> = {

declare type FixtureExport<FixtureType> = FixtureType | FixtureMap<FixtureType>;
export declare type ReactFixture = React.ReactNode | React.FunctionComponent;
declare type FixtureModule<FixtureType> = {
default: FixtureExport<FixtureType>;
};
declare type FixtureWrapper<FixtureType> = {
module: FixtureModule<FixtureType>;
};
export declare type ReactFixture = ReactNode | FunctionComponent;
export declare type ReactFixtureMap = FixtureMap<ReactFixture>;
export declare type ReactFixtureExport = FixtureExport<ReactFixture>;
export declare type ReactFixtureModule = FixtureModule<ReactFixture>;
export declare type ReactFixtureWrapper = FixtureWrapper<ReactFixture>;
export declare type ReactDecoratorProps = {
children: React.ReactNode;
children: ReactNode;
fixtureState: FixtureState;

@@ -17,8 +25,6 @@ setFixtureState: SetFixtureState;

};
export declare type ReactDecorator = React.ComponentType<ReactDecoratorProps>;
declare type ModuleByPath<ModuleType> = {
[path: string]: ModuleType;
};
export declare type ReactFixtureExportsByPath = ModuleByPath<ReactFixtureExport>;
export declare type ReactDecoratorsByPath = ModuleByPath<ReactDecorator>;
export declare type ReactDecorator = ComponentType<ReactDecoratorProps>;
export declare type ReactFixtureExports = Record<string, ReactFixtureExport>;
export declare type ReactFixtureWrappers = Record<string, ReactFixtureWrapper>;
export declare type ReactDecorators = Record<string, ReactDecorator>;
export {};
import { FixtureState } from './fixtureState';
export declare type RendererId = string;
export declare type FixtureNamesByPath = {
[fixturePath: string]: null | string[];
export declare type FixtureListItem = {
type: 'single';
} | {
type: 'multi';
fixtureNames: string[];
};
export declare type FixtureList = {
[fixturePath: string]: FixtureListItem;
};
export declare type FixtureId = {
path: string;
name: null | string;
name?: string;
};

@@ -40,3 +46,3 @@ export declare type PingRenderersRequest = {

rendererId: RendererId;
fixtures: FixtureNamesByPath;
fixtures: FixtureList;
};

@@ -54,3 +60,3 @@ };

rendererId: RendererId;
fixtures: FixtureNamesByPath;
fixtures: FixtureList;
};

@@ -57,0 +63,0 @@ };

{
"name": "react-cosmos-shared2",
"version": "5.6.7",
"version": "5.6.8",
"description": "Code shared between Cosmos packages",

@@ -14,3 +14,3 @@ "repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos-shared2",

},
"gitHead": "1839af43c194b514f3c1ceeef490ffaf41d4d800"
"gitHead": "cf9e3bd7e977f9faf4a45c9d6003b65ddd11a23a"
}
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