New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vx/text

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vx/text - npm Package Compare versions

Comparing version 0.0.175 to 0.0.179

13

build/Text.js

@@ -131,7 +131,6 @@ 'use strict';

var wordsByLines = this.state.wordsByLines;
var x = textProps.x,
y = textProps.y;
var x = textProps.x;
var y = textProps.y;
var startDy = void 0;

@@ -211,5 +210,11 @@ switch (verticalAnchor) {

style: _propTypes2.default.object,
innerRef: _propTypes2.default.func
innerRef: _propTypes2.default.func,
x: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
y: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
dx: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
dy: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
lineHeight: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
capHeight: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string])
};
exports.default = Text;

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

import PropTypes from 'prop-types';
import React, { Component } from 'react';

@@ -6,896 +7,2 @@ import reduceCSSCalc from 'reduce-css-calc';

function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
var emptyFunction_1 = emptyFunction;
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var validateFormat = function validateFormat(format) {};
if (process.env.NODE_ENV !== 'production') {
validateFormat = function validateFormat(format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};
}
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
var invariant_1 = invariant;
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction_1;
if (process.env.NODE_ENV !== 'production') {
var printWarning = function printWarning(format) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
warning = function warning(condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
}
var warning_1 = warning;
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
if (process.env.NODE_ENV !== 'production') {
var invariant$1 = invariant_1;
var warning$1 = warning_1;
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
var loggedTypeFailures = {};
}
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?Function} getStack Returns the component stack.
* @private
*/
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
if (process.env.NODE_ENV !== 'production') {
for (var typeSpecName in typeSpecs) {
if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
invariant$1(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
} catch (ex) {
error = ex;
}
warning$1(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var stack = getStack ? getStack() : '';
warning$1(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
}
}
}
}
}
var checkPropTypes_1 = checkPropTypes;
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
/**
* Collection of methods that allow declaration and validation of props that are
* supplied to React components. Example usage:
*
* var Props = require('ReactPropTypes');
* var MyArticle = React.createClass({
* propTypes: {
* // An optional string prop named "description".
* description: Props.string,
*
* // A required enum prop named "category".
* category: Props.oneOf(['News','Photos']).isRequired,
*
* // A prop named "dialog" that requires an instance of Dialog.
* dialog: Props.instanceOf(Dialog).isRequired
* },
* render: function() { ... }
* });
*
* A more formal specification of how these methods are used:
*
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
* decl := ReactPropTypes.{type}(.isRequired)?
*
* Each and every declaration produces a function with the same signature. This
* allows the creation of custom validation functions. For example:
*
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* if (propValue != null && typeof propValue !== 'string' &&
* !(propValue instanceof URI)) {
* return new Error(
* 'Expected a string or an URI for ' + propName + ' in ' +
* componentName
* );
* }
* }
* },
* render: function() {...}
* });
*
* @internal
*/
var ANONYMOUS = '<<anonymous>>';
// Important!
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
symbol: createPrimitiveTypeChecker('symbol'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker,
exact: createStrictShapeTypeChecker,
};
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
/*eslint-disable no-self-compare*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/*eslint-enable no-self-compare*/
/**
* We use an Error-like object for backward compatibility as people may call
* PropTypes directly and inspect their output. However, we don't use real
* Errors anymore. We don't inspect their stack anyway, and creating them
* is prohibitively expensive if they are created too often, such as what
* happens in oneOfType() for any type before the one that matched.
*/
function PropTypeError(message) {
this.message = message;
this.stack = '';
}
// Make `instanceof Error` still work for returned errors.
PropTypeError.prototype = Error.prototype;
function createChainableTypeChecker(validate) {
if (process.env.NODE_ENV !== 'production') {
var manualPropTypeCallCache = {};
var manualPropTypeWarningCount = 0;
}
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (secret !== ReactPropTypesSecret_1) {
if (throwOnDirectAccess) {
// New behavior only for users of `prop-types` package
invariant_1(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use `PropTypes.checkPropTypes()` to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
// Old behavior for people using React.PropTypes
var cacheKey = componentName + ':' + propName;
if (
!manualPropTypeCallCache[cacheKey] &&
// Avoid spamming the console because they are often not actionable except for lib authors
manualPropTypeWarningCount < 3
) {
warning_1(
false,
'You are manually calling a React.PropTypes validation ' +
'function for the `%s` prop on `%s`. This is deprecated ' +
'and will throw in the standalone `prop-types` package. ' +
'You may be seeing this warning due to a third-party PropTypes ' +
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
propFullName,
componentName
);
manualPropTypeCallCache[cacheKey] = true;
manualPropTypeWarningCount++;
}
}
}
if (props[propName] == null) {
if (isRequired) {
if (props[propName] === null) {
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
}
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
}
return null;
} else {
return validate(props, propName, componentName, location, propFullName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location, propFullName, secret) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
// `propValue` being instance of, say, date/regexp, pass the 'object'
// check, but we can offer a more precise error message here rather than
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunction_1.thatReturnsNull);
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
}
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!isValidElement(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var expectedClassName = expectedClass.name || ANONYMOUS;
var actualClassName = getClassName(props[propName]);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
process.env.NODE_ENV !== 'production' ? warning_1(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
return emptyFunction_1.thatReturnsNull;
}
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (is(propValue, expectedValues[i])) {
return null;
}
}
var valuesString = JSON.stringify(expectedValues);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
}
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
if (!Array.isArray(arrayOfTypeCheckers)) {
process.env.NODE_ENV !== 'production' ? warning_1(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
return emptyFunction_1.thatReturnsNull;
}
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (typeof checker !== 'function') {
warning_1(
false,
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
'received %s at index %s.',
getPostfixForTypeWarning(checker),
i
);
return emptyFunction_1.thatReturnsNull;
}
}
function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
return null;
}
}
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createStrictShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
// We need to check all keys in case some are required but missing from
// props.
var allKeys = objectAssign({}, props[propName], shapeTypes);
for (var key in allKeys) {
var checker = shapeTypes[key];
if (!checker) {
return new PropTypeError(
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
);
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
case 'undefined':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (propValue === null || isValidElement(propValue)) {
return true;
}
var iteratorFn = getIteratorFn(propValue);
if (iteratorFn) {
var iterator = iteratorFn.call(propValue);
var step;
if (iteratorFn !== propValue.entries) {
while (!(step = iterator.next()).done) {
if (!isNode(step.value)) {
return false;
}
}
} else {
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
if (!isNode(entry[1])) {
return false;
}
}
}
}
} else {
return false;
}
return true;
default:
return false;
}
}
function isSymbol(propType, propValue) {
// Native Symbol.
if (propType === 'symbol') {
return true;
}
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
if (propValue['@@toStringTag'] === 'Symbol') {
return true;
}
// Fallback for non-spec compliant Symbols which are polyfilled.
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
return true;
}
return false;
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
if (isSymbol(propType, propValue)) {
return 'symbol';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
if (typeof propValue === 'undefined' || propValue === null) {
return '' + propValue;
}
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
// Returns a string that is postfixed to a warning about an invalid type.
// For example, "undefined" or "of type array"
function getPostfixForTypeWarning(value) {
var type = getPreciseType(value);
switch (type) {
case 'array':
case 'object':
return 'an ' + type;
case 'boolean':
case 'date':
case 'regexp':
return 'a ' + type;
default:
return type;
}
}
// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return ANONYMOUS;
}
return propValue.constructor.name;
}
ReactPropTypes.checkPropTypes = checkPropTypes_1;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
var factoryWithThrowingShims = function() {
function shim(props, propName, componentName, location, propFullName, secret) {
if (secret === ReactPropTypesSecret_1) {
// It is still safe when called from React.
return;
}
invariant_1(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
} shim.isRequired = shim;
function getShim() {
return shim;
} // Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
var ReactPropTypes = {
array: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim,
exact: getShim
};
ReactPropTypes.checkPropTypes = emptyFunction_1;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
var propTypes = createCommonjsModule(function (module) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (process.env.NODE_ENV !== 'production') {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess);
} else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = factoryWithThrowingShims();
}
});
/** Detect free variable `global` from Node.js. */

@@ -923,3 +30,3 @@ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;

/** Used to check objects for own properties. */
var hasOwnProperty$1 = objectProto.hasOwnProperty;
var hasOwnProperty = objectProto.hasOwnProperty;

@@ -944,3 +51,3 @@ /**

function getRawTag(value) {
var isOwn = hasOwnProperty$1.call(value, symToStringTag),
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];

@@ -1148,7 +255,7 @@

/** Used to check objects for own properties. */
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString$1.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'

@@ -1248,3 +355,3 @@ );

/** Used to check objects for own properties. */
var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;

@@ -1266,3 +373,3 @@ /**

}
return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
return hasOwnProperty$2.call(data, key) ? data[key] : undefined;
}

@@ -1276,3 +383,3 @@

/** Used to check objects for own properties. */
var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;

@@ -1290,3 +397,3 @@ /**

var data = this.__data__;
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$4.call(data, key);
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$3.call(data, key);
}

@@ -1957,7 +1064,6 @@

var wordsByLines = this.state.wordsByLines;
var x = textProps.x,
y = textProps.y;
var x = textProps.x;
var y = textProps.y;
var startDy = void 0;

@@ -2031,10 +1137,16 @@ switch (verticalAnchor) {

Text.propTypes = {
scaleToFit: propTypes.bool,
angle: propTypes.number,
textAnchor: propTypes.oneOf(['start', 'middle', 'end', 'inherit']),
verticalAnchor: propTypes.oneOf(['start', 'middle', 'end']),
style: propTypes.object,
innerRef: propTypes.func
scaleToFit: PropTypes.bool,
angle: PropTypes.number,
textAnchor: PropTypes.oneOf(['start', 'middle', 'end', 'inherit']),
verticalAnchor: PropTypes.oneOf(['start', 'middle', 'end']),
style: PropTypes.object,
innerRef: PropTypes.func,
x: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
y: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
dx: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
dy: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
lineHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
capHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
};
export { Text, getStringWidth$1 as getStringWidth };

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("reduce-css-calc")):"function"==typeof define&&define.amd?define(["exports","react","reduce-css-calc"],t):t(e.vx=e.vx||{},e.React,null)}(this,function(e,t,w){"use strict";var O="default"in t?t.default:t;w=w&&w.hasOwnProperty("default")?w.default:w;var r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return function(){return e}}var o=function(){};o.thatReturns=n,o.thatReturnsFalse=n(!1),o.thatReturnsTrue=n(!0),o.thatReturnsNull=n(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e};var h=o,f=function(e){};"production"!==process.env.NODE_ENV&&(f=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")});var v=function(e,t,r,n,o,i,a,u){if(f(t),!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,o,i,a,u],l=0;(s=new Error(t.replace(/%s/g,function(){return c[l++]}))).name="Invariant Violation"}throw s.framesToPop=1,s}},i=h;if("production"!==process.env.NODE_ENV){i=function(e,t){if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==t.indexOf("Failed Composite propType: ")&&!e){for(var r=arguments.length,n=Array(2<r?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];(function(e){for(var t=arguments.length,r=Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=0,i="Warning: "+e.replace(/%s/g,function(){return r[o++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}}).apply(void 0,[t].concat(n))}}}var b=i,s=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;var g=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,n,o=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),i=1;i<arguments.length;i++){for(var a in r=Object(arguments[i]))c.call(r,a)&&(o[a]=r[a]);if(s){n=s(r);for(var u=0;u<n.length;u++)l.call(r,n[u])&&(o[n[u]]=r[n[u]])}}return o},m="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";if("production"!==process.env.NODE_ENV)var p=v,d=b,y=m,_={};var a,j=function(e,t,r,n,o){if("production"!==process.env.NODE_ENV)for(var i in e)if(e.hasOwnProperty(i)){var a;try{p("function"==typeof e[i],"%s: %s type `%s` is invalid; it must be a function, usually from the `prop-types` package, but received `%s`.",n||"React class",r,i,typeof e[i]),a=e[i](t,i,n,r,null,y)}catch(e){a=e}if(d(!a||a instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",r,i,typeof a),a instanceof Error&&!(a.message in _)){_[a.message]=!0;var u=o?o():"";d(!1,"Failed %s type: %s%s",r,a.message,null!=u?u:"")}}},u=function(u,f){var i="function"==typeof Symbol&&Symbol.iterator,a="@@iterator";var p="<<anonymous>>",e={array:t("array"),bool:t("boolean"),func:t("function"),number:t("number"),object:t("object"),string:t("string"),symbol:t("symbol"),any:r(h.thatReturnsNull),arrayOf:function(c){return r(function(e,t,r,n,o){if("function"!=typeof c)return new d("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var i=e[t];if(!Array.isArray(i)){var a=y(i);return new d("Invalid "+n+" `"+o+"` of type `"+a+"` supplied to `"+r+"`, expected an array.")}for(var u=0;u<i.length;u++){var s=c(i,u,r,n,o+"["+u+"]",m);if(s instanceof Error)return s}return null})},element:r(function(e,t,r,n,o){var i=e[t];if(!u(i)){var a=y(i);return new d("Invalid "+n+" `"+o+"` of type `"+a+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}),instanceOf:function(u){return r(function(e,t,r,n,o){if(!(e[t]instanceof u)){var i=u.name||p,a=function(e){if(!e.constructor||!e.constructor.name)return p;return e.constructor.name}(e[t]);return new d("Invalid "+n+" `"+o+"` of type `"+a+"` supplied to `"+r+"`, expected instance of `"+i+"`.")}return null})},node:r(function(e,t,r,n,o){return s(e[t])?null:new d("Invalid "+n+" `"+o+"` supplied to `"+r+"`, expected a ReactNode.")}),objectOf:function(c){return r(function(e,t,r,n,o){if("function"!=typeof c)return new d("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var i=e[t],a=y(i);if("object"!==a)return new d("Invalid "+n+" `"+o+"` of type `"+a+"` supplied to `"+r+"`, expected an object.");for(var u in i)if(i.hasOwnProperty(u)){var s=c(i,u,r,n,o+"."+u,m);if(s instanceof Error)return s}return null})},oneOf:function(s){if(!Array.isArray(s))return"production"!==process.env.NODE_ENV&&b(!1,"Invalid argument supplied to oneOf, expected an instance of array."),h.thatReturnsNull;return r(function(e,t,r,n,o){for(var i=e[t],a=0;a<s.length;a++)if(c(i,s[a]))return null;var u=JSON.stringify(s);return new d("Invalid "+n+" `"+o+"` of value `"+i+"` supplied to `"+r+"`, expected one of "+u+".")})},oneOfType:function(u){if(!Array.isArray(u))return"production"!==process.env.NODE_ENV&&b(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),h.thatReturnsNull;for(var e=0;e<u.length;e++){var t=u[e];if("function"!=typeof t)return b(!1,"Invalid argument supplied to oneOfType. Expected an array of check functions, but received %s at index %s.",n(t),e),h.thatReturnsNull}return r(function(e,t,r,n,o){for(var i=0;i<u.length;i++){var a=u[i];if(null==a(e,t,r,n,o,m))return null}return new d("Invalid "+n+" `"+o+"` supplied to `"+r+"`.")})},shape:function(l){return r(function(e,t,r,n,o){var i=e[t],a=y(i);if("object"!==a)return new d("Invalid "+n+" `"+o+"` of type `"+a+"` supplied to `"+r+"`, expected `object`.");for(var u in l){var s=l[u];if(s){var c=s(i,u,r,n,o+"."+u,m);if(c)return c}}return null})},exact:function(f){return r(function(e,t,r,n,o){var i=e[t],a=y(i);if("object"!==a)return new d("Invalid "+n+" `"+o+"` of type `"+a+"` supplied to `"+r+"`, expected `object`.");var u=g({},e[t],f);for(var s in u){var c=f[s];if(!c)return new d("Invalid "+n+" `"+o+"` key `"+s+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(e[t],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(f),null," "));var l=c(i,s,r,n,o+"."+s,m);if(l)return l}return null})}};function c(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function d(e){this.message=e,this.stack=""}function r(s){if("production"!==process.env.NODE_ENV)var c={},l=0;function e(e,t,r,n,o,i,a){if(n=n||p,i=i||r,a!==m)if(f)v(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var u=n+":"+r;!c[u]&&l<3&&(b(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",i,n),c[u]=!0,l++)}return null==t[r]?e?null===t[r]?new d("The "+o+" `"+i+"` is marked as required in `"+n+"`, but its value is `null`."):new d("The "+o+" `"+i+"` is marked as required in `"+n+"`, but its value is `undefined`."):null:s(t,r,n,o,i)}var t=e.bind(null,!1);return t.isRequired=e.bind(null,!0),t}function t(u){return r(function(e,t,r,n,o,i){var a=e[t];return y(a)!==u?new d("Invalid "+n+" `"+o+"` of type `"+l(a)+"` supplied to `"+r+"`, expected `"+u+"`."):null})}function s(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(s);if(null===e||u(e))return!0;var t=function(e){var t=e&&(i&&e[i]||e[a]);if("function"==typeof t)return t}(e);if(!t)return!1;var r,n=t.call(e);if(t!==e.entries){for(;!(r=n.next()).done;)if(!s(r.value))return!1}else for(;!(r=n.next()).done;){var o=r.value;if(o&&!s(o[1]))return!1}return!0;default:return!1}}function y(e){var t,r=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":(t=e,"symbol"===r||"Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol?"symbol":r)}function l(e){if(null==e)return""+e;var t=y(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function n(e){var t=l(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return d.prototype=Error.prototype,e.checkPropTypes=j,e.PropTypes=e},x=(function(e){if("production"!==process.env.NODE_ENV){var t="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;e.exports=u(function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},!0)}else e.exports=function(){function e(e,t,r,n,o,i){i!==m&&v(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}var r={array:e.isRequired=e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=h,r.PropTypes=r}()}(a={exports:{}},a.exports),a.exports),E="object"==typeof r&&r&&r.Object===Object&&r,T="object"==typeof self&&self&&self.Object===Object&&self,P=E||T||Function("return this")(),S=P.Symbol,k=Object.prototype,N=k.hasOwnProperty,R=k.toString,A=S?S.toStringTag:void 0;var I=function(e){var t=N.call(e,A),r=e[A];try{e[A]=void 0}catch(e){}var n=R.call(e);return t?e[A]=r:delete e[A],n},W=Object.prototype.toString;var C=function(e){return W.call(e)},F=S?S.toStringTag:void 0;var z=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":F&&F in Object(e)?I(e):C(e)};var B=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var D,L=function(e){if(!B(e))return!1;var t=z(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},q=P["__core-js_shared__"],V=(D=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+D:"";var $=function(e){return!!V&&V in e},H=Function.prototype.toString;var J=function(e){if(null!=e){try{return H.call(e)}catch(e){}try{return e+""}catch(e){}}return""},M=/^\[object .+?Constructor\]$/,U=Function.prototype,Y=Object.prototype,G=U.toString,K=Y.hasOwnProperty,Q=RegExp("^"+G.call(K).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var X=function(e){return!(!B(e)||$(e))&&(L(e)?Q:M).test(J(e))};var Z=function(e,t){return null==e?void 0:e[t]};var ee=function(e,t){var r=Z(e,t);return X(r)?r:void 0},te=ee(Object,"create");var re=function(){this.__data__=te?te(null):{},this.size=0};var ne=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},oe=Object.prototype.hasOwnProperty;var ie=function(e){var t=this.__data__;if(te){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return oe.call(t,e)?t[e]:void 0},ae=Object.prototype.hasOwnProperty;var ue=function(e){var t=this.__data__;return te?void 0!==t[e]:ae.call(t,e)};var se=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=te&&void 0===t?"__lodash_hash_undefined__":t,this};function ce(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ce.prototype.clear=re,ce.prototype.delete=ne,ce.prototype.get=ie,ce.prototype.has=ue,ce.prototype.set=se;var le=ce;var fe=function(){this.__data__=[],this.size=0};var pe=function(e,t){return e===t||e!=e&&t!=t};var de=function(e,t){for(var r=e.length;r--;)if(pe(e[r][0],t))return r;return-1},ye=Array.prototype.splice;var he=function(e){var t=this.__data__,r=de(t,e);return!(r<0||(r==t.length-1?t.pop():ye.call(t,r,1),--this.size,0))};var ve=function(e){var t=this.__data__,r=de(t,e);return r<0?void 0:t[r][1]};var be=function(e){return-1<de(this.__data__,e)};var ge=function(e,t){var r=this.__data__,n=de(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function me(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}me.prototype.clear=fe,me.prototype.delete=he,me.prototype.get=ve,me.prototype.has=be,me.prototype.set=ge;var _e=me,we=ee(P,"Map");var Oe=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var je=function(e,t){var r=e.__data__;return Oe(t)?r["string"==typeof t?"string":"hash"]:r.map};var xe=function(e){var t=je(this,e).delete(e);return this.size-=t?1:0,t};var Ee=function(e){return je(this,e).get(e)};var Te=function(e){return je(this,e).has(e)};var Pe=function(e,t){var r=je(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function Se(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Se.prototype.clear=function(){this.size=0,this.__data__={hash:new le,map:new(we||_e),string:new le}},Se.prototype.delete=xe,Se.prototype.get=Ee,Se.prototype.has=Te,Se.prototype.set=Pe;var ke=Se,Ne="Expected a function";function Re(o,i){if("function"!=typeof o||null!=i&&"function"!=typeof i)throw new TypeError(Ne);var a=function(){var e=arguments,t=i?i.apply(this,e):e[0],r=a.cache;if(r.has(t))return r.get(t);var n=o.apply(this,e);return a.cache=r.set(t,n)||r,n};return a.cache=new(Re.Cache||ke),a}Re.Cache=ke;var Ae="__react_svg_text_measurement_id";var Ie=Re(function(e,t){try{var r=document.getElementById(Ae);if(!r){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.style.width=0,n.style.height=0,n.style.position="absolute",n.style.top="-100%",n.style.left="-100%",(r=document.createElementNS("http://www.w3.org/2000/svg","text")).setAttribute("id",Ae),n.appendChild(r),document.body.appendChild(n)}return Object.assign(r.style,t),r.textContent=e,r.getComputedTextLength()}catch(e){return null}},function(e,t){return e+"_"+JSON.stringify(t)}),We=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}(),Ce=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Fe=function(e){function r(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e));return t.state={wordsByLines:[]},t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(r,t.Component),We(r,[{key:"componentWillMount",value:function(){this.updateWordsByLines(this.props,!0)}},{key:"componentWillReceiveProps",value:function(e){var t=this.props.children!==e.children||this.props.style!==e.style;this.updateWordsByLines(e,t)}},{key:"updateWordsByLines",value:function(t,e){if(t.width||t.scaleToFit){if(e){var r=t.children?t.children.toString().split(/\s+/):[];this.wordsWithComputedWidth=r.map(function(e){return{word:e,width:Ie(e,t.style)}}),this.spaceWidth=Ie(" ",t.style)}var n=this.calculateWordsByLines(this.wordsWithComputedWidth,this.spaceWidth,t.width);this.setState({wordsByLines:n})}else this.updateWordsWithoutCalculate(t)}},{key:"updateWordsWithoutCalculate",value:function(e){var t=e.children?e.children.toString().split(/\s+/):[];this.setState({wordsByLines:[{words:t}]})}},{key:"calculateWordsByLines",value:function(e,a,u){var s=this.props.scaleToFit;return e.reduce(function(e,t){var r=t.word,n=t.width,o=e[e.length-1];if(o&&(null==u||s||o.width+n+a<u))o.words.push(r),o.width+=n+a;else{var i={words:[r],width:n};e.push(i)}return e},[])}},{key:"render",value:function(){var e=this.props,t=e.dx,r=e.dy,n=e.textAnchor,o=e.verticalAnchor,i=e.scaleToFit,a=e.angle,u=e.lineHeight,s=e.capHeight,c=e.innerRef,l=function(e,t){var r={};for(var n in e)0<=t.indexOf(n)||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(e,["dx","dy","textAnchor","verticalAnchor","scaleToFit","angle","lineHeight","capHeight","innerRef"]),f=this.state.wordsByLines,p=l.x,d=l.y,y=void 0;switch(o){case"start":y=w("calc("+s+")");break;case"middle":y=w("calc("+(f.length-1)/2+" * -"+u+" + ("+s+" / 2))");break;default:y=w("calc("+(f.length-1)+" * -"+u+")")}var h=[];if(i&&f.length){var v=f[0].width,b=this.props.width/v,g=b,m=p-b*p,_=d-g*d;h.push("matrix("+b+", 0, 0, "+g+", "+m+", "+_+")")}return a&&h.push("rotate("+a+", "+p+", "+d+")"),h.length&&(l.transform=h.join(" ")),O.createElement("svg",{ref:c,x:t,y:r,fontSize:l.fontSize,style:{overflow:"visible"}},O.createElement("text",Ce({},l,{textAnchor:n}),f.map(function(e,t){return O.createElement("tspan",{x:p,dy:0===t?y:u,key:t},e.words.join(" "))})))}}]),r}();Fe.defaultProps={x:0,y:0,dx:0,dy:0,lineHeight:"1em",capHeight:"0.71em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end"},Fe.propTypes={scaleToFit:x.bool,angle:x.number,textAnchor:x.oneOf(["start","middle","end","inherit"]),verticalAnchor:x.oneOf(["start","middle","end"]),style:x.object,innerRef:x.func},e.Text=Fe,e.getStringWidth=Ie,Object.defineProperty(e,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("prop-types"),require("react"),require("reduce-css-calc")):"function"==typeof define&&define.amd?define(["exports","prop-types","react","reduce-css-calc"],e):e(t.vx=t.vx||{},t.PropTypes,t.React,null)}(this,function(t,e,n,m){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var O="default"in n?n.default:n;m=m&&m.hasOwnProperty("default")?m.default:m;var r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},o="object"==typeof r&&r&&r.Object===Object&&r,i="object"==typeof self&&self&&self.Object===Object&&self,a=o||i||Function("return this")(),s=a.Symbol,c=Object.prototype,u=c.hasOwnProperty,l=c.toString,p=s?s.toStringTag:void 0;var h=function(t){var e=u.call(t,p),r=t[p];try{t[p]=void 0}catch(t){}var n=l.call(t);return e?t[p]=r:delete t[p],n},f=Object.prototype.toString;var d=function(t){return f.call(t)},y=s?s.toStringTag:void 0;var v=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":y&&y in Object(t)?h(t):d(t)};var _=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};var g,b=function(t){if(!_(t))return!1;var e=v(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},w=a["__core-js_shared__"],j=(g=/[^.]+$/.exec(w&&w.keys&&w.keys.IE_PROTO||""))?"Symbol(src)_1."+g:"";var x=function(t){return!!j&&j in t},T=Function.prototype.toString;var P=function(t){if(null!=t){try{return T.call(t)}catch(t){}try{return t+""}catch(t){}}return""},S=/^\[object .+?Constructor\]$/,W=Function.prototype,z=Object.prototype,C=W.toString,E=z.hasOwnProperty,k=RegExp("^"+C.call(E).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var A=function(t){return!(!_(t)||x(t))&&(b(t)?k:S).test(P(t))};var F=function(t,e){return null==t?void 0:t[e]};var B=function(t,e){var r=F(t,e);return A(r)?r:void 0},L=B(Object,"create");var H=function(){this.__data__=L?L(null):{},this.size=0};var R=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},$=Object.prototype.hasOwnProperty;var N=function(t){var e=this.__data__;if(L){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return $.call(e,t)?e[t]:void 0},q=Object.prototype.hasOwnProperty;var M=function(t){var e=this.__data__;return L?void 0!==e[t]:q.call(e,t)};var I=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=L&&void 0===e?"__lodash_hash_undefined__":e,this};function G(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}G.prototype.clear=H,G.prototype.delete=R,G.prototype.get=N,G.prototype.has=M,G.prototype.set=I;var J=G;var U=function(){this.__data__=[],this.size=0};var D=function(t,e){return t===e||t!=t&&e!=e};var K=function(t,e){for(var r=t.length;r--;)if(D(t[r][0],e))return r;return-1},Q=Array.prototype.splice;var V=function(t){var e=this.__data__,r=K(e,t);return!(r<0||(r==e.length-1?e.pop():Q.call(e,r,1),--this.size,0))};var X=function(t){var e=this.__data__,r=K(e,t);return r<0?void 0:e[r][1]};var Y=function(t){return-1<K(this.__data__,t)};var Z=function(t,e){var r=this.__data__,n=K(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function tt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}tt.prototype.clear=U,tt.prototype.delete=V,tt.prototype.get=X,tt.prototype.has=Y,tt.prototype.set=Z;var et=tt,rt=B(a,"Map");var nt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var ot=function(t,e){var r=t.__data__;return nt(e)?r["string"==typeof e?"string":"hash"]:r.map};var it=function(t){var e=ot(this,t).delete(t);return this.size-=e?1:0,e};var at=function(t){return ot(this,t).get(t)};var st=function(t){return ot(this,t).has(t)};var ct=function(t,e){var r=ot(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function ut(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ut.prototype.clear=function(){this.size=0,this.__data__={hash:new J,map:new(rt||et),string:new J}},ut.prototype.delete=it,ut.prototype.get=at,ut.prototype.has=st,ut.prototype.set=ct;var lt=ut,pt="Expected a function";function ht(o,i){if("function"!=typeof o||null!=i&&"function"!=typeof i)throw new TypeError(pt);var a=function(){var t=arguments,e=i?i.apply(this,t):t[0],r=a.cache;if(r.has(e))return r.get(e);var n=o.apply(this,t);return a.cache=r.set(e,n)||r,n};return a.cache=new(ht.Cache||lt),a}ht.Cache=lt;var ft="__react_svg_text_measurement_id";var dt=ht(function(t,e){try{var r=document.getElementById(ft);if(!r){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.style.width=0,n.style.height=0,n.style.position="absolute",n.style.top="-100%",n.style.left="-100%",(r=document.createElementNS("http://www.w3.org/2000/svg","text")).setAttribute("id",ft),n.appendChild(r),document.body.appendChild(n)}return Object.assign(r.style,e),r.textContent=t,r.getComputedTextLength()}catch(t){return null}},function(t,e){return t+"_"+JSON.stringify(e)}),yt=function(){function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}}(),vt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_t=function(t){function r(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,t));return e.state={wordsByLines:[]},e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(r,n.Component),yt(r,[{key:"componentWillMount",value:function(){this.updateWordsByLines(this.props,!0)}},{key:"componentWillReceiveProps",value:function(t){var e=this.props.children!==t.children||this.props.style!==t.style;this.updateWordsByLines(t,e)}},{key:"updateWordsByLines",value:function(e,t){if(e.width||e.scaleToFit){if(t){var r=e.children?e.children.toString().split(/\s+/):[];this.wordsWithComputedWidth=r.map(function(t){return{word:t,width:dt(t,e.style)}}),this.spaceWidth=dt(" ",e.style)}var n=this.calculateWordsByLines(this.wordsWithComputedWidth,this.spaceWidth,e.width);this.setState({wordsByLines:n})}else this.updateWordsWithoutCalculate(e)}},{key:"updateWordsWithoutCalculate",value:function(t){var e=t.children?t.children.toString().split(/\s+/):[];this.setState({wordsByLines:[{words:e}]})}},{key:"calculateWordsByLines",value:function(t,a,s){var c=this.props.scaleToFit;return t.reduce(function(t,e){var r=e.word,n=e.width,o=t[t.length-1];if(o&&(null==s||c||o.width+n+a<s))o.words.push(r),o.width+=n+a;else{var i={words:[r],width:n};t.push(i)}return t},[])}},{key:"render",value:function(){var t=this.props,e=t.dx,r=t.dy,n=t.textAnchor,o=t.verticalAnchor,i=t.scaleToFit,a=t.angle,s=t.lineHeight,c=t.capHeight,u=t.innerRef,l=function(t,e){var r={};for(var n in t)0<=e.indexOf(n)||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}(t,["dx","dy","textAnchor","verticalAnchor","scaleToFit","angle","lineHeight","capHeight","innerRef"]),p=this.state.wordsByLines,h=l.x,f=l.y,d=void 0;switch(o){case"start":d=m("calc("+c+")");break;case"middle":d=m("calc("+(p.length-1)/2+" * -"+s+" + ("+c+" / 2))");break;default:d=m("calc("+(p.length-1)+" * -"+s+")")}var y=[];if(i&&p.length){var v=p[0].width,_=this.props.width/v,g=_,b=h-_*h,w=f-g*f;y.push("matrix("+_+", 0, 0, "+g+", "+b+", "+w+")")}return a&&y.push("rotate("+a+", "+h+", "+f+")"),y.length&&(l.transform=y.join(" ")),O.createElement("svg",{ref:u,x:e,y:r,fontSize:l.fontSize,style:{overflow:"visible"}},O.createElement("text",vt({},l,{textAnchor:n}),p.map(function(t,e){return O.createElement("tspan",{x:h,dy:0===e?d:s,key:e},t.words.join(" "))})))}}]),r}();_t.defaultProps={x:0,y:0,dx:0,dy:0,lineHeight:"1em",capHeight:"0.71em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end"},_t.propTypes={scaleToFit:e.bool,angle:e.number,textAnchor:e.oneOf(["start","middle","end","inherit"]),verticalAnchor:e.oneOf(["start","middle","end"]),style:e.object,innerRef:e.func,x:e.oneOfType([e.number,e.string]),y:e.oneOfType([e.number,e.string]),dx:e.oneOfType([e.number,e.string]),dy:e.oneOfType([e.number,e.string]),lineHeight:e.oneOfType([e.number,e.string]),capHeight:e.oneOfType([e.number,e.string])},t.Text=_t,t.getStringWidth=dt,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "@vx/text",
"version": "0.0.175",
"version": "0.0.179",
"description": "vx text",

@@ -40,2 +40,3 @@ "sideEffects": false,

"lodash": "^4.17.4",
"prop-types": "^15.6.2",
"reduce-css-calc": "^1.3.0"

@@ -42,0 +43,0 @@ },

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