react-cosmos-shared2
Advanced tools
Comparing version 5.0.0 to 5.0.4
@@ -26,2 +26,6 @@ "use strict"; | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } | ||
// How often to check the state of the loaded component and update the fixture | ||
@@ -59,44 +63,54 @@ // state if it changed | ||
var fixtureStateChangeScheduled = false; | ||
Object.keys(elRefs.current).map(function _callee(elPath) { | ||
var state, elementId, fsClassState; | ||
return regeneratorRuntime.async(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
if (!(elPaths.indexOf(elPath) === -1)) { | ||
_context.next = 2; | ||
break; | ||
} | ||
Object.keys(elRefs.current).map( | ||
/*#__PURE__*/ | ||
function () { | ||
var _ref = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee(elPath) { | ||
var state, elementId, fsClassState; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
if (!(elPaths.indexOf(elPath) === -1)) { | ||
_context.next = 2; | ||
break; | ||
} | ||
throw new Error("[FixtureCapture] Child ref exists for missing element path \"".concat(elPath, "\"")); | ||
throw new Error("[FixtureCapture] Child ref exists for missing element path \"".concat(elPath, "\"")); | ||
case 2: | ||
state = elRefs.current[elPath].state; | ||
elementId = { | ||
decoratorId: decoratorId, | ||
elPath: elPath | ||
}; | ||
fsClassState = (0, _fixtureState.findFixtureStateClassState)(fixtureState, elementId); | ||
case 2: | ||
state = elRefs.current[elPath].state; | ||
elementId = { | ||
decoratorId: decoratorId, | ||
elPath: elPath | ||
}; | ||
fsClassState = (0, _fixtureState.findFixtureStateClassState)(fixtureState, elementId); | ||
if (fsClassState && state && !doesFixtureStateMatchClassState(fsClassState, state)) { | ||
fixtureStateChangeScheduled = true; | ||
setFixtureState(function (prevFs) { | ||
return _objectSpread({}, prevFs, { | ||
classState: (0, _fixtureState.updateFixtureStateClassState)({ | ||
fixtureState: prevFs, | ||
elementId: elementId, | ||
values: (0, _fixtureState.createValues)(state) | ||
}) | ||
if (fsClassState && state && !doesFixtureStateMatchClassState(fsClassState, state)) { | ||
fixtureStateChangeScheduled = true; | ||
setFixtureState(function (prevFs) { | ||
return _objectSpread({}, prevFs, { | ||
classState: (0, _fixtureState.updateFixtureStateClassState)({ | ||
fixtureState: prevFs, | ||
elementId: elementId, | ||
values: (0, _fixtureState.createValues)(state) | ||
}) | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
case 6: | ||
case "end": | ||
return _context.stop(); | ||
case 6: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
}, _callee); | ||
})); | ||
return function (_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}()); | ||
if (!fixtureStateChangeScheduled) { | ||
@@ -103,0 +117,0 @@ scheduleStateCheck(); |
@@ -20,3 +20,3 @@ "use strict"; | ||
var _extendFixtureProps = require("./extendFixtureProps"); | ||
var _useFixtureProps = require("./useFixtureProps"); | ||
@@ -110,3 +110,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
return (0, _extendFixtureProps.extendFixtureProps)(fixture, fixtureState, decoratorId); | ||
return (0, _useFixtureProps.useFixtureProps)(fixture, fixtureState, decoratorId); | ||
} |
{ | ||
"name": "react-cosmos-shared2", | ||
"version": "5.0.0", | ||
"version": "5.0.4", | ||
"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": "1cf442307150c294933e1978813378b4b1b87140" | ||
"gitHead": "573594a9a2c1b2900c4d6740dc000781046f105d" | ||
} |
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
126555
2683