react-cosmos-shared2
Advanced tools
Comparing version 4.8.0-alpha.1 to 4.8.0-alpha.2
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.getDomContainer = getDomContainer; | ||
/* eslint-env browser */ | ||
exports.__esModule = true; | ||
var CONTAINER_ID = 'root'; | ||
function getDomContainer() { | ||
return document.getElementById(CONTAINER_ID) || createDomContainer(); | ||
return document.getElementById(CONTAINER_ID) || createDomContainer(); | ||
} | ||
exports.getDomContainer = getDomContainer; | ||
function createDomContainer() { | ||
var _document = document, | ||
body = _document.body; | ||
if (!body) { | ||
throw new Error("Can't create DOM container because document.body is missing"); | ||
} | ||
var container = document.createElement('div'); | ||
container.setAttribute('id', CONTAINER_ID); | ||
body.appendChild(container); | ||
return container; | ||
} | ||
var body = document.body; | ||
if (!body) { | ||
throw new Error("Can't create DOM container because document.body is missing"); | ||
} | ||
var container = document.createElement('div'); | ||
container.setAttribute('id', CONTAINER_ID); | ||
body.appendChild(container); | ||
return container; | ||
} |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
exports.__esModule = true; | ||
var lodash_1 = require("lodash"); | ||
var react_is_1 = require("react-is"); | ||
function areNodesEqual(a, b) { | ||
return lodash_1.isEqual(stripInternalElementAttrs(a), stripInternalElementAttrs(b)); | ||
} | ||
exports.areNodesEqual = areNodesEqual; | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/objectSpread")); | ||
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array")); | ||
var _lodash = require("lodash"); | ||
var _reactIs = require("react-is"); | ||
function areNodesEqual(a, b) { | ||
return (0, _lodash.isEqual)(stripInternalElementAttrs(a), stripInternalElementAttrs(b)); | ||
} // Don't compare private element attrs like _owner and _store, which hold | ||
// Don't compare private element attrs like _owner and _store, which hold | ||
// internal details and have auto increment-type attrs | ||
function stripInternalElementAttrs(node) { | ||
if ((0, _isArray.default)(node)) { | ||
return node.map(function (n) { | ||
return stripInternalElementAttrs(n); | ||
}); | ||
} | ||
if ((0, _reactIs.isElement)(node)) { | ||
// $FlowFixMe Flow can't get cues from react-is package | ||
if (Array.isArray(node)) { | ||
return node.map(function (n) { return stripInternalElementAttrs(n); }); | ||
} | ||
if (!react_is_1.isElement(node)) { | ||
return node; | ||
} | ||
var el = node; | ||
return (0, _objectSpread2.default)({}, (0, _lodash.pick)(el, 'type', 'key', 'ref'), { | ||
// children and other props can contain Elements | ||
props: (0, _lodash.mapValues)(el.props, function (propValue) { | ||
return stripInternalElementAttrs(propValue); | ||
}) | ||
}); | ||
} | ||
return node; | ||
} | ||
return __assign({}, lodash_1.pick(el, 'type', 'key', 'ref'), { | ||
// children and other props can contain Elements | ||
props: lodash_1.mapValues(el.props, function (propValue) { | ||
return stripInternalElementAttrs(propValue); | ||
}) }); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "areNodesEqual", { | ||
enumerable: true, | ||
get: function get() { | ||
return _areNodesEqual.areNodesEqual; | ||
} | ||
}); | ||
var _areNodesEqual = require("./areNodesEqual"); | ||
exports.__esModule = true; | ||
var areNodesEqual_1 = require("./areNodesEqual"); | ||
exports.areNodesEqual = areNodesEqual_1.areNodesEqual; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.RENDERER_MESSAGE_EVENT_NAME = void 0; | ||
var RENDERER_MESSAGE_EVENT_NAME = 'cosmos-cmd'; | ||
exports.RENDERER_MESSAGE_EVENT_NAME = RENDERER_MESSAGE_EVENT_NAME; | ||
exports.__esModule = true; | ||
exports.RENDERER_MESSAGE_EVENT_NAME = 'cosmos-cmd'; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.findUserModulePaths = findUserModulePaths; | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator")); | ||
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator")); | ||
var _glob = _interopRequireDefault(require("glob")); | ||
var _micromatch = _interopRequireDefault(require("micromatch")); | ||
var _util = _interopRequireDefault(require("util.promisify")); | ||
var _util2 = require("../util"); | ||
var globAsync = (0, _util.default)(_glob.default); // TODO: Make paths configurable | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
exports.__esModule = true; | ||
var glob = require("glob"); | ||
var micromatch = require("micromatch"); | ||
var promisify = require("util.promisify"); | ||
var util_1 = require("../util"); | ||
var globAsync = promisify(glob); | ||
// TODO: Make paths configurable | ||
var FILE_PATH_IGNORE = '**/node_modules/**'; | ||
var FIXTURE_PATTERNS = ['**/<fixturesDir>/**/*.{js,jsx,ts,tsx}', '**/*.<fixtureFileSuffix>.{js,jsx,ts,tsx}']; | ||
var FIXTURE_PATTERNS = [ | ||
'**/<fixturesDir>/**/*.{js,jsx,ts,tsx}', | ||
'**/*.<fixtureFileSuffix>.{js,jsx,ts,tsx}' | ||
]; | ||
var DECORATOR_PATTERNS = ['**/cosmos.decorator.{js,jsx,ts,tsx}']; | ||
function findUserModulePaths(_x) { | ||
return _findUserModulePaths.apply(this, arguments); | ||
function findUserModulePaths(_a) { | ||
var rootDir = _a.rootDir, fixturesDir = _a.fixturesDir, fixtureFileSuffix = _a.fixtureFileSuffix; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var paths, patterns, fixturePaths, decoratorPaths; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, globAsync('**/*', { | ||
cwd: rootDir, | ||
absolute: true, | ||
ignore: FILE_PATH_IGNORE | ||
})]; | ||
case 1: | ||
paths = _b.sent(); | ||
patterns = getFixturePatterns({ fixturesDir: fixturesDir, fixtureFileSuffix: fixtureFileSuffix }); | ||
fixturePaths = getMatchingPaths(paths, patterns); | ||
decoratorPaths = getMatchingPaths(paths, DECORATOR_PATTERNS); | ||
// IDEA: Omit fixture paths that are also decorator paths. Relevant only if | ||
// it becomes useful to put decorator files inside fixture dirs. | ||
return [2 /*return*/, { fixturePaths: fixturePaths, decoratorPaths: decoratorPaths }]; | ||
} | ||
}); | ||
}); | ||
} | ||
function _findUserModulePaths() { | ||
_findUserModulePaths = (0, _asyncToGenerator2.default)( | ||
/*#__PURE__*/ | ||
_regenerator.default.mark(function _callee(_ref) { | ||
var rootDir, fixturesDir, fixtureFileSuffix, paths, patterns, fixturePaths, decoratorPaths; | ||
return _regenerator.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
rootDir = _ref.rootDir, fixturesDir = _ref.fixturesDir, fixtureFileSuffix = _ref.fixtureFileSuffix; | ||
_context.next = 3; | ||
return globAsync('**/*', { | ||
cwd: rootDir, | ||
absolute: true, | ||
ignore: FILE_PATH_IGNORE | ||
}); | ||
case 3: | ||
paths = _context.sent; | ||
patterns = getFixturePatterns({ | ||
fixturesDir: fixturesDir, | ||
fixtureFileSuffix: fixtureFileSuffix | ||
}); | ||
fixturePaths = getMatchingPaths(paths, patterns); | ||
decoratorPaths = getMatchingPaths(paths, DECORATOR_PATTERNS); // IDEA: Omit fixture paths that are also decorator paths. Relevant only if | ||
// it becomes useful to put decorator files inside fixture dirs. | ||
return _context.abrupt("return", { | ||
fixturePaths: fixturePaths, | ||
decoratorPaths: decoratorPaths | ||
}); | ||
case 8: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
})); | ||
return _findUserModulePaths.apply(this, arguments); | ||
exports.findUserModulePaths = findUserModulePaths; | ||
function getMatchingPaths(paths, patterns) { | ||
return micromatch(paths, patterns, { dot: true }); | ||
} | ||
function getMatchingPaths(paths, pattern) { | ||
return (0, _micromatch.default)(paths, pattern, { | ||
dot: true | ||
}); | ||
function getFixturePatterns(_a) { | ||
var fixturesDir = _a.fixturesDir, fixtureFileSuffix = _a.fixtureFileSuffix; | ||
return FIXTURE_PATTERNS.map(function (pattern) { | ||
return util_1.replaceKeys(pattern, { | ||
'<fixturesDir>': fixturesDir, | ||
'<fixtureFileSuffix>': fixtureFileSuffix | ||
}); | ||
}); | ||
} | ||
function getFixturePatterns(_ref2) { | ||
var fixturesDir = _ref2.fixturesDir, | ||
fixtureFileSuffix = _ref2.fixtureFileSuffix; | ||
return FIXTURE_PATTERNS.map(function (pattern) { | ||
return (0, _util2.replaceKeys)(pattern, { | ||
'<fixturesDir>': fixturesDir, | ||
'<fixtureFileSuffix>': fixtureFileSuffix | ||
}); | ||
}); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "findUserModulePaths", { | ||
enumerable: true, | ||
get: function get() { | ||
return _findUserModulePaths.findUserModulePaths; | ||
} | ||
}); | ||
var _findUserModulePaths = require("./findUserModulePaths"); | ||
exports.__esModule = true; | ||
var findUserModulePaths_1 = require("./findUserModulePaths"); | ||
exports.findUserModulePaths = findUserModulePaths_1.findUserModulePaths; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.updateItem = updateItem; | ||
exports.replaceOrAddItem = replaceOrAddItem; | ||
exports.removeItemMatch = removeItemMatch; | ||
exports.removeItem = removeItem; | ||
exports.updateState = updateState; | ||
exports.replaceKeys = replaceKeys; | ||
Object.defineProperty(exports, "uuid", { | ||
enumerable: true, | ||
get: function get() { | ||
return _uuid.uuid; | ||
} | ||
}); | ||
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/objectSpread")); | ||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray")); | ||
var _lodash = require("lodash"); | ||
var _uuid = require("./uuid"); | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
exports.__esModule = true; | ||
var lodash_1 = require("lodash"); | ||
function updateItem(items, item, update) { | ||
var index = items.indexOf(item); | ||
return (0, _toConsumableArray2.default)(items.slice(0, index)).concat([(0, _objectSpread2.default)({}, item, update)], (0, _toConsumableArray2.default)(items.slice(index + 1))); | ||
var index = items.indexOf(item); | ||
return items.slice(0, index).concat([ | ||
__assign({}, item, update) | ||
], items.slice(index + 1)); | ||
} | ||
exports.updateItem = updateItem; | ||
function replaceOrAddItem(items, matcher, item) { | ||
var index = (0, _lodash.findIndex)(items, matcher); | ||
return index !== -1 ? (0, _toConsumableArray2.default)(items.slice(0, index)).concat([item], (0, _toConsumableArray2.default)(items.slice(index + 1))) : (0, _toConsumableArray2.default)(items).concat([item]); | ||
var index = lodash_1.findIndex(items, matcher); | ||
return index !== -1 | ||
? items.slice(0, index).concat([item], items.slice(index + 1)) : items.concat([item]); | ||
} | ||
exports.replaceOrAddItem = replaceOrAddItem; | ||
function removeItemMatch(items, matcher) { | ||
var index = (0, _lodash.findIndex)(items, matcher); | ||
return index === -1 ? (0, _toConsumableArray2.default)(items) : (0, _toConsumableArray2.default)(items.slice(0, index)).concat((0, _toConsumableArray2.default)(items.slice(index + 1))); | ||
var index = lodash_1.findIndex(items, matcher); | ||
return index === -1 | ||
? items.slice() : items.slice(0, index).concat(items.slice(index + 1)); | ||
} | ||
exports.removeItemMatch = removeItemMatch; | ||
function removeItem(items, item) { | ||
var index = items.indexOf(item); | ||
if (index === -1) { | ||
throw new Error("Trying to remove missing list item"); | ||
} | ||
return (0, _toConsumableArray2.default)(items.slice(0, index)).concat((0, _toConsumableArray2.default)(items.slice(index + 1))); | ||
var index = items.indexOf(item); | ||
if (index === -1) { | ||
throw new Error("Trying to remove missing list item"); | ||
} | ||
return items.slice(0, index).concat(items.slice(index + 1)); | ||
} | ||
function updateState(prevState, updater) { | ||
return typeof updater === 'function' ? updater(prevState) : updater; | ||
exports.removeItem = removeItem; | ||
function replaceKeys(str, map) { | ||
return Object.keys(map).reduce(function (res, key) { return res.replace(key, map[key]); }, str); | ||
} | ||
function replaceKeys(str, map) { | ||
return (0, _keys.default)(map).reduce(function (res, key) { | ||
return res.replace(key, map[key]); | ||
}, str); | ||
} | ||
exports.replaceKeys = replaceKeys; | ||
var uuid_1 = require("./uuid"); | ||
exports.uuid = uuid_1.uuid; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.uuid = uuid; | ||
exports.__esModule = true; | ||
// From here https://gist.github.com/jed/982883 | ||
function uuid(a) { | ||
return a ? // $FlowFixMe | ||
(a ^ Math.random() * 16 >> a / 4).toString(16) : // $FlowFixMe | ||
([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid); | ||
} | ||
/* tslint:disable:no-bitwise */ | ||
return a | ||
? (Number(a) ^ ((Math.random() * 16) >> (Number(a) / 4))).toString(16) | ||
: ('' + 1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid); | ||
} | ||
exports.uuid = uuid; |
@@ -1,1 +0,1 @@ | ||
export declare function getDomContainer(): HTMLElement; | ||
export * from './dist/dom'; |
@@ -1,3 +0,1 @@ | ||
// @flow | ||
module.exports = require('./dist/dom'); |
@@ -1,71 +0,1 @@ | ||
// @flow | ||
import { SetState } from './util'; | ||
export type KeyValue = { [key: string]: unknown }; | ||
export type FixtureRenderKey = number; | ||
export type FixtureDecoratorId = string; | ||
export type FixtureStateValue = { | ||
serializable: boolean; | ||
key: string; | ||
stringified: string; | ||
}; | ||
export type FixtureStateValues = FixtureStateValue[]; | ||
export type ComponentFixtureState = { | ||
decoratorId: FixtureDecoratorId; | ||
elPath: string; | ||
componentName: string; | ||
renderKey: FixtureRenderKey; | ||
props: null | FixtureStateValues; | ||
state: null | FixtureStateValues; | ||
}; | ||
export type FixtureState = { | ||
components: ComponentFixtureState[]; | ||
[key: string]: any; | ||
}; | ||
export type SetFixtureState = SetState<null | FixtureState>; | ||
export declare var DEFAULT_RENDER_KEY: FixtureRenderKey; | ||
export declare function extractValuesFromObj(obj: KeyValue): FixtureStateValues; | ||
export declare function extendObjWithValues( | ||
obj: KeyValue, | ||
values: FixtureStateValues | ||
): KeyValue; | ||
export declare function getCompFixtureStates( | ||
fixtureState: null | FixtureState, | ||
decoratorId?: FixtureDecoratorId | ||
): ComponentFixtureState[]; | ||
export declare function findCompFixtureState( | ||
fixtureState: null | FixtureState, | ||
decoratorId: FixtureDecoratorId, | ||
elPath: string | ||
): null | ComponentFixtureState; | ||
export declare function createCompFixtureState(args: { | ||
fixtureState: null | FixtureState; | ||
decoratorId: FixtureDecoratorId; | ||
elPath: string; | ||
componentName: string; | ||
props: null | FixtureStateValues; | ||
state: null | FixtureStateValues; | ||
}): ComponentFixtureState[]; | ||
export declare function updateCompFixtureState(args: { | ||
fixtureState: null | FixtureState; | ||
decoratorId: FixtureDecoratorId; | ||
elPath: string; | ||
props?: null | FixtureStateValues; | ||
state?: null | FixtureStateValues; | ||
resetInstance?: boolean; | ||
}): ComponentFixtureState[]; | ||
export * from './dist/fixtureState'; |
@@ -1,3 +0,1 @@ | ||
// @flow | ||
module.exports = require('./dist/fixtureState'); |
{ | ||
"name": "react-cosmos-shared2", | ||
"version": "4.8.0-alpha.1", | ||
"version": "4.8.0-alpha.2", | ||
"description": "Code shared between Cosmos packages", | ||
@@ -13,3 +13,3 @@ "repository": "https://github.com/react-cosmos/react-cosmos/tree/master/packages/react-cosmos-shared2", | ||
}, | ||
"gitHead": "3ff1182c1b798dd9960d06d8c0a06fba6d7af007" | ||
"gitHead": "e63acbf04970b78dc66bcb7b6c89605b017294c8" | ||
} |
@@ -1,3 +0,1 @@ | ||
// @flow | ||
module.exports = require('./dist/react'); |
@@ -1,103 +0,1 @@ | ||
// @flow | ||
import { FixtureState } from './fixtureState'; | ||
// FYI: Renderer ids are self assigned in remote environments, so uniqueness | ||
// cannot be established by consensus | ||
export type RendererId = string; | ||
export type FixtureNamesByPath = { | ||
[fixturePath: string]: null | string[]; | ||
}; | ||
export type FixtureId = { | ||
path: string; | ||
name: null | string; | ||
}; | ||
export type pingRenderersRequest = { | ||
type: 'pingRenderers'; | ||
}; | ||
export type SelectFixtureRequest = { | ||
type: 'selectFixture'; | ||
payload: { | ||
rendererId: RendererId; | ||
fixtureId: FixtureId; | ||
fixtureState: null | FixtureState; | ||
}; | ||
}; | ||
export type UnselectFixtureRequest = { | ||
type: 'unselectFixture'; | ||
payload: { | ||
rendererId: RendererId; | ||
}; | ||
}; | ||
export type SetFixtureStateRequest = { | ||
type: 'setFixtureState'; | ||
payload: { | ||
rendererId: RendererId; | ||
// The fixture ID is sent alongside the fixture state change to ensure | ||
// that the fixture state is only paired with its corresponding fixture | ||
fixtureId: FixtureId; | ||
fixtureState: null | FixtureState; | ||
}; | ||
}; | ||
export type RendererRequest = | ||
| pingRenderersRequest | ||
| SelectFixtureRequest | ||
| UnselectFixtureRequest | ||
| SetFixtureStateRequest; | ||
export type OnRendererRequest = (msg: RendererRequest) => unknown; | ||
export type RendererReadyResponse = { | ||
type: 'rendererReady'; | ||
payload: { | ||
rendererId: RendererId; | ||
fixtures: FixtureNamesByPath; | ||
}; | ||
}; | ||
export type RendererErrorResponse = { | ||
type: 'rendererError'; | ||
payload: { | ||
rendererId: RendererId; | ||
}; | ||
}; | ||
export type FixtureListUpdateResponse = { | ||
type: 'fixtureListUpdate'; | ||
payload: { | ||
rendererId: RendererId; | ||
fixtures: FixtureNamesByPath; | ||
}; | ||
}; | ||
// Caused by an organic state change inside the renderer. Also dispatched | ||
// after a fixtureSelect request, when rendering stateful components, as their | ||
// initial state is read. | ||
export type FixtureStateChangeResponse = { | ||
type: 'fixtureStateChange'; | ||
payload: { | ||
rendererId: RendererId; | ||
// The fixture ID is sent alongside the fixture state to ensure that the | ||
// fixture state is only paired with its corresponding fixture | ||
fixtureId: FixtureId; | ||
// Entire fixture state is included | ||
fixtureState: null | FixtureState; | ||
}; | ||
}; | ||
export type RendererResponse = | ||
| RendererReadyResponse | ||
| RendererErrorResponse | ||
| FixtureListUpdateResponse | ||
| FixtureStateChangeResponse; | ||
export type OnRendererResponse = (msg: RendererResponse) => unknown; | ||
export declare var RENDERER_MESSAGE_EVENT_NAME: string; | ||
export * from './dist/renderer'; |
@@ -1,3 +0,1 @@ | ||
// @flow | ||
module.exports = require('./dist/renderer'); |
@@ -1,3 +0,1 @@ | ||
// @flow | ||
module.exports = require('./dist/server'); |
@@ -1,44 +0,1 @@ | ||
// @flow | ||
import { ListIteratee } from 'lodash'; | ||
export type StateUpdater<T> = T | ((prevState: T) => T); | ||
export type SetState<T> = ( | ||
updater: StateUpdater<T>, | ||
callback?: () => unknown | ||
) => unknown; | ||
export declare function updateItem<T>( | ||
items: Readonly<Array<T>>, | ||
item: T, | ||
update: Partial<T> | ||
): Array<T>; | ||
export declare function replaceOrAddItem<T>( | ||
items: Readonly<Array<T>>, | ||
matcher: ListIteratee<T>, | ||
item: T | ||
): Array<T>; | ||
export declare function removeItemMatch<T>( | ||
items: Readonly<Array<T>>, | ||
matcher: ListIteratee<T> | ||
): Array<T>; | ||
export declare function removeItem<T>( | ||
items: Readonly<Array<T>>, | ||
item: T | ||
): Array<T>; | ||
export declare function updateState<T>( | ||
prevState: T, | ||
updater: StateUpdater<T> | ||
): T; | ||
export declare function replaceKeys( | ||
str: string, | ||
map: { [key: string]: string } | ||
): string; | ||
export declare function uuid(a?: string): string; | ||
export * from './dist/util'; |
@@ -1,3 +0,1 @@ | ||
// @flow | ||
module.exports = require('./dist/util'); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
27029
39
590
1