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.3.0-alpha.0 to 5.3.0-alpha.1

11

dist/FixtureLoader/FixtureCapture/classState/index.js

@@ -10,4 +10,2 @@ "use strict";

var _shared = require("./shared");
var _useFixtureState = require("./useFixtureState");

@@ -22,7 +20,10 @@

(0, _shared.useUnmount)(function () {
elRefs.current = {};
});
_react.default.useEffect(function () {
return function () {
elRefs.current = {};
};
}, []);
(0, _useReadClassState.useReadClassState)(fixture, decoratorId, elRefs);
return (0, _useFixtureState.useFixtureState)(fixture, decoratorId, elRefs);
}

@@ -18,3 +18,2 @@ import React from 'react';

};
export declare function useUnmount(cb: () => void): void;
export declare function replaceState(elRef: React.Component, nextState: {}): void;

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

});
exports.useUnmount = useUnmount;
exports.replaceState = replaceState;
var _react = _interopRequireDefault(require("react"));
var _lodash = require("lodash");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

@@ -22,12 +17,4 @@

function useUnmount(cb) {
var onUnmount = _react.default.useCallback(cb, []);
_react.default.useEffect(function () {
return onUnmount;
}, [onUnmount]);
} // We need to do this because React doesn't provide a replaceState method
// We need to do this because React doesn't provide a replaceState method
// (anymore) https://reactjs.org/docs/react-component.html#setstate
function replaceState(elRef, nextState) {

@@ -43,4 +30,4 @@ var fullState = resetOriginalKeys(elRef.state, nextState);

return Object.keys(original).reduce(function (result, key) {
return Object.keys(result).indexOf(key) === -1 ? _objectSpread({}, result, _defineProperty({}, key, undefined)) : result;
return Object.keys(result).indexOf(key) === -1 ? _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, key, undefined)) : result;
}, current);
}

@@ -53,6 +53,8 @@ "use strict";

(0, _shared.useUnmount)(function () {
initialStates.current = {};
cachedRefHandlers.current = {};
});
_react.default.useEffect(function () {
return function () {
initialStates.current = {};
cachedRefHandlers.current = {};
};
}, []);

@@ -70,3 +72,3 @@ _react.default.useEffect(function () {

setFixtureState(function (prevFs) {
return _objectSpread({}, prevFs, {
return _objectSpread(_objectSpread({}, prevFs), {}, {
classState: (0, _fixtureState.removeFixtureStateClassState)(fixtureState, elementId)

@@ -103,3 +105,3 @@ });

setFixtureState(function (prevFs) {
return _objectSpread({}, prevFs, {
return _objectSpread(_objectSpread({}, prevFs), {}, {
classState: (0, _fixtureState.createFixtureStateClassState)({

@@ -171,3 +173,3 @@ fixtureState: prevFs,

setFixtureState(function (prevFs) {
return _objectSpread({}, prevFs, {
return _objectSpread(_objectSpread({}, prevFs), {}, {
classState: (0, _fixtureState.createFixtureStateClassState)({

@@ -174,0 +176,0 @@ fixtureState: prevFs,

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

setFixtureState(function (prevFs) {
return _objectSpread({}, prevFs, {
return _objectSpread(_objectSpread({}, prevFs), {}, {
classState: (0, _fixtureState.updateFixtureStateClassState)({

@@ -90,0 +90,0 @@ fixtureState: prevFs,

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

setFixtureState(function (prevFs) {
return _objectSpread({}, prevFs, {
return _objectSpread(_objectSpread({}, prevFs), {}, {
props: prevFs.props || []

@@ -61,3 +61,3 @@ });

setFixtureState(function (prevFs) {
return _objectSpread({}, prevFs, {
return _objectSpread(_objectSpread({}, prevFs), {}, {
props: (0, _fixtureState.removeFixtureStateProps)(fixtureState, elementId)

@@ -80,3 +80,3 @@ });

setFixtureState(function (prevFs) {
return _objectSpread({}, prevFs, {
return _objectSpread(_objectSpread({}, prevFs), {}, {
props: (0, _fixtureState.createFixtureStateProps)({

@@ -95,3 +95,3 @@ fixtureState: prevFs,

setFixtureState(function (prevFs) {
return _objectSpread({}, prevFs, {
return _objectSpread(_objectSpread({}, prevFs), {}, {
props: (0, _fixtureState.updateFixtureStateProps)({

@@ -98,0 +98,0 @@ fixtureState: fixtureState,

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

if (!fsProps || componentTypeChanged(fsProps.componentName)) {
return _objectSpread({}, element, {
return _objectSpread(_objectSpread({}, element), {}, {
key: getElRenderKey(elPath, _fixtureState.DEFAULT_RENDER_KEY)

@@ -77,4 +77,4 @@ });

return _objectSpread({}, element, {
props: hasChildElPaths(elPaths, elPath) ? _objectSpread({}, cachedProps, {
return _objectSpread(_objectSpread({}, element), {}, {
props: hasChildElPaths(elPaths, elPath) ? _objectSpread(_objectSpread({}, cachedProps), {}, {
children: originalProps.children

@@ -81,0 +81,0 @@ }) : cachedProps,

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

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

@@ -23,0 +23,0 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }

@@ -51,4 +51,4 @@ "use strict";

return _objectSpread({}, value, {
props: _objectSpread({}, otherProps, {
return _objectSpread(_objectSpread({}, value), {}, {
props: _objectSpread(_objectSpread({}, otherProps), {}, {
children: cloneNode(children)

@@ -55,0 +55,0 @@ })

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

function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

@@ -141,3 +141,3 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

return {
selectedFixture: _objectSpread({}, selectedFixture, {
selectedFixture: _objectSpread(_objectSpread({}, selectedFixture), {}, {
fixtureState: stateUpdate(selectedFixture.fixtureState)

@@ -332,3 +332,3 @@ })

return {
selectedFixture: _objectSpread({}, selectedFixture, {
selectedFixture: _objectSpread(_objectSpread({}, selectedFixture), {}, {
syncedFixtureState: syncedFixtureState

@@ -335,0 +335,0 @@ })

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

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

@@ -25,0 +25,0 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }

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

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

@@ -23,0 +23,0 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }

@@ -39,4 +39,4 @@ "use strict";

return _objectSpread({}, prevFsState, {
values: _objectSpread({}, prevFsState.values, _defineProperty({}, inputName, {
return _objectSpread(_objectSpread({}, prevFsState), {}, {
values: _objectSpread(_objectSpread({}, prevFsState.values), {}, _defineProperty({}, inputName, {
defaultValue: (0, _fixtureState.createValue)(defaultValue),

@@ -43,0 +43,0 @@ currentValue: (0, _fixtureState.createValue)(defaultValue)

@@ -32,4 +32,4 @@ "use strict";

getCurrentValueFromFixtureState(prevFsState, inputName, defaultValue)) : stateChange;
return _objectSpread({}, prevFsState, {
values: _objectSpread({}, prevFsState.values, _defineProperty({}, inputName, {
return _objectSpread(_objectSpread({}, prevFsState), {}, {
values: _objectSpread(_objectSpread({}, prevFsState.values), {}, _defineProperty({}, inputName, {
defaultValue: (0, _fixtureState.createValue)(defaultValue),

@@ -36,0 +36,0 @@ currentValue: (0, _fixtureState.createValue)(currentValue)

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

setFixtureState(function (fixtureState) {
return _objectSpread({}, fixtureState, {
return _objectSpread(_objectSpread({}, fixtureState), {}, {
viewport: {

@@ -37,0 +37,0 @@ width: width,

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

if (dirNode.items) {
items = _objectSpread({}, items, {}, dirNode.items);
items = _objectSpread(_objectSpread({}, items), dirNode.items);
}

@@ -30,0 +30,0 @@

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

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

@@ -17,0 +17,0 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }

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

var cleanDirName = removeFixtureNameSuffix(dirName, suffix);
return _objectSpread({}, prev, _defineProperty({}, cleanDirName, hideFixtureSuffix(treeNode.dirs[dirName], suffix)));
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, cleanDirName, hideFixtureSuffix(treeNode.dirs[dirName], suffix)));
}, {});

@@ -23,0 +23,0 @@ var items = (0, _lodash.mapKeys)(treeNode.items, function (fixturePath, fixtureName) {

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

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

@@ -17,0 +17,0 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }

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

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

@@ -35,3 +35,3 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }

}).reduce(function (acc, dPath) {
return _objectSpread({}, acc, _defineProperty({}, dPath, decoratorsByPath[dPath]));
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, dPath, decoratorsByPath[dPath]));
}, {});

@@ -38,0 +38,0 @@ }

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

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

@@ -33,3 +33,3 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }

var index = items.indexOf(item);
return [].concat(_toConsumableArray(items.slice(0, index)), [_objectSpread({}, item, {}, update)], _toConsumableArray(items.slice(index + 1)));
return [].concat(_toConsumableArray(items.slice(0, index)), [_objectSpread(_objectSpread({}, item), update)], _toConsumableArray(items.slice(index + 1)));
}

@@ -36,0 +36,0 @@

{
"name": "react-cosmos-shared2",
"version": "5.3.0-alpha.0",
"version": "5.3.0-alpha.1",
"description": "Code shared between Cosmos packages",

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

},
"gitHead": "7218ce3cd8b085ed339d50ca24dcdece2ab013e7"
"gitHead": "df53edcc8c75504e15707efb993ab3f7ae282f21"
}
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