flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
3
VISUALIZACION/node_modules/polished/lib/math/math.d.ts
generated
vendored
Executable file
3
VISUALIZACION/node_modules/polished/lib/math/math.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
declare function math(formula: string, additionalSymbols?: Object): string;
|
||||
|
||||
export default math;
|
||||
143
VISUALIZACION/node_modules/polished/lib/math/math.js
generated
vendored
Executable file
143
VISUALIZACION/node_modules/polished/lib/math/math.js
generated
vendored
Executable file
|
|
@ -0,0 +1,143 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = math;
|
||||
var _defaultSymbols = _interopRequireDefault(require("./presets/defaultSymbols"));
|
||||
var _errors = _interopRequireDefault(require("../internalHelpers/_errors"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
var unitRegExp = /((?!\w)a|na|hc|mc|dg|me[r]?|xe|ni(?![a-zA-Z])|mm|cp|tp|xp|q(?!s)|hv|xamv|nimv|wv|sm|s(?!\D|$)|ged|darg?|nrut)/g;
|
||||
|
||||
// Merges additional math functionality into the defaults.
|
||||
function mergeSymbolMaps(additionalSymbols) {
|
||||
var symbolMap = {};
|
||||
symbolMap.symbols = additionalSymbols ? _extends({}, _defaultSymbols["default"].symbols, additionalSymbols.symbols) : _extends({}, _defaultSymbols["default"].symbols);
|
||||
return symbolMap;
|
||||
}
|
||||
function exec(operators, values) {
|
||||
var _ref;
|
||||
var op = operators.pop();
|
||||
values.push(op.f.apply(op, (_ref = []).concat.apply(_ref, values.splice(-op.argCount))));
|
||||
return op.precedence;
|
||||
}
|
||||
function calculate(expression, additionalSymbols) {
|
||||
var symbolMap = mergeSymbolMaps(additionalSymbols);
|
||||
var match;
|
||||
var operators = [symbolMap.symbols['('].prefix];
|
||||
var values = [];
|
||||
var pattern = new RegExp( // Pattern for numbers
|
||||
"\\d+(?:\\.\\d+)?|" +
|
||||
// ...and patterns for individual operators/function names
|
||||
Object.keys(symbolMap.symbols).map(function (key) {
|
||||
return symbolMap.symbols[key];
|
||||
})
|
||||
// longer symbols should be listed first
|
||||
// $FlowFixMe
|
||||
.sort(function (a, b) {
|
||||
return b.symbol.length - a.symbol.length;
|
||||
})
|
||||
// $FlowFixMe
|
||||
.map(function (val) {
|
||||
return val.regSymbol;
|
||||
}).join('|') + "|(\\S)", 'g');
|
||||
pattern.lastIndex = 0; // Reset regular expression object
|
||||
|
||||
var afterValue = false;
|
||||
do {
|
||||
match = pattern.exec(expression);
|
||||
var _ref2 = match || [')', undefined],
|
||||
token = _ref2[0],
|
||||
bad = _ref2[1];
|
||||
var notNumber = symbolMap.symbols[token];
|
||||
var notNewValue = notNumber && !notNumber.prefix && !notNumber.func;
|
||||
var notAfterValue = !notNumber || !notNumber.postfix && !notNumber.infix;
|
||||
|
||||
// Check for syntax errors:
|
||||
if (bad || (afterValue ? notAfterValue : notNewValue)) {
|
||||
throw new _errors["default"](37, match ? match.index : expression.length, expression);
|
||||
}
|
||||
if (afterValue) {
|
||||
// We either have an infix or postfix operator (they should be mutually exclusive)
|
||||
var curr = notNumber.postfix || notNumber.infix;
|
||||
do {
|
||||
var prev = operators[operators.length - 1];
|
||||
if ((curr.precedence - prev.precedence || prev.rightToLeft) > 0) break;
|
||||
// Apply previous operator, since it has precedence over current one
|
||||
} while (exec(operators, values)); // Exit loop after executing an opening parenthesis or function
|
||||
afterValue = curr.notation === 'postfix';
|
||||
if (curr.symbol !== ')') {
|
||||
operators.push(curr);
|
||||
// Postfix always has precedence over any operator that follows after it
|
||||
if (afterValue) exec(operators, values);
|
||||
}
|
||||
} else if (notNumber) {
|
||||
// prefix operator or function
|
||||
operators.push(notNumber.prefix || notNumber.func);
|
||||
if (notNumber.func) {
|
||||
// Require an opening parenthesis
|
||||
match = pattern.exec(expression);
|
||||
if (!match || match[0] !== '(') {
|
||||
throw new _errors["default"](38, match ? match.index : expression.length, expression);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// number
|
||||
values.push(+token);
|
||||
afterValue = true;
|
||||
}
|
||||
} while (match && operators.length);
|
||||
if (operators.length) {
|
||||
throw new _errors["default"](39, match ? match.index : expression.length, expression);
|
||||
} else if (match) {
|
||||
throw new _errors["default"](40, match ? match.index : expression.length, expression);
|
||||
} else {
|
||||
return values.pop();
|
||||
}
|
||||
}
|
||||
function reverseString(str) {
|
||||
return str.split('').reverse().join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for doing math with CSS Units. Accepts a formula as a string. All values in the formula must have the same unit (or be unitless). Supports complex formulas utliziing addition, subtraction, multiplication, division, square root, powers, factorial, min, max, as well as parentheses for order of operation.
|
||||
*
|
||||
*In cases where you need to do calculations with mixed units where one unit is a [relative length unit](https://developer.mozilla.org/en-US/docs/Web/CSS/length#Relative_length_units), you will want to use [CSS Calc](https://developer.mozilla.org/en-US/docs/Web/CSS/calc).
|
||||
*
|
||||
* *warning* While we've done everything possible to ensure math safely evalutes formulas expressed as strings, you should always use extreme caution when passing `math` user provided values.
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* fontSize: math('12rem + 8rem'),
|
||||
* fontSize: math('(12px + 2px) * 3'),
|
||||
* fontSize: math('3px^2 + sqrt(4)'),
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* fontSize: ${math('12rem + 8rem')};
|
||||
* fontSize: ${math('(12px + 2px) * 3')};
|
||||
* fontSize: ${math('3px^2 + sqrt(4)')};
|
||||
* `
|
||||
*
|
||||
* // CSS as JS Output
|
||||
*
|
||||
* div: {
|
||||
* fontSize: '20rem',
|
||||
* fontSize: '42px',
|
||||
* fontSize: '11px',
|
||||
* }
|
||||
*/
|
||||
function math(formula, additionalSymbols) {
|
||||
var reversedFormula = reverseString(formula);
|
||||
var formulaMatch = reversedFormula.match(unitRegExp);
|
||||
|
||||
// Check that all units are the same
|
||||
if (formulaMatch && !formulaMatch.every(function (unit) {
|
||||
return unit === formulaMatch[0];
|
||||
})) {
|
||||
throw new _errors["default"](41);
|
||||
}
|
||||
var cleanFormula = reverseString(reversedFormula.replace(unitRegExp, ''));
|
||||
return "" + calculate(cleanFormula, additionalSymbols) + (formulaMatch ? reverseString(formulaMatch[0]) : '');
|
||||
}
|
||||
module.exports = exports.default;
|
||||
147
VISUALIZACION/node_modules/polished/lib/math/math.js.flow
generated
vendored
Executable file
147
VISUALIZACION/node_modules/polished/lib/math/math.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,147 @@
|
|||
// @flow
|
||||
import defaultSymbolMap from './presets/defaultSymbols'
|
||||
import PolishedError from '../internalHelpers/_errors'
|
||||
|
||||
const unitRegExp = /((?!\w)a|na|hc|mc|dg|me[r]?|xe|ni(?![a-zA-Z])|mm|cp|tp|xp|q(?!s)|hv|xamv|nimv|wv|sm|s(?!\D|$)|ged|darg?|nrut)/g
|
||||
|
||||
// Merges additional math functionality into the defaults.
|
||||
function mergeSymbolMaps(additionalSymbols?: Object): Object {
|
||||
const symbolMap = {}
|
||||
symbolMap.symbols = additionalSymbols
|
||||
? { ...defaultSymbolMap.symbols, ...additionalSymbols.symbols }
|
||||
: { ...defaultSymbolMap.symbols }
|
||||
|
||||
return symbolMap
|
||||
}
|
||||
|
||||
function exec(operators: Array<any>, values: Array<number>): Array<number | string> {
|
||||
const op = operators.pop()
|
||||
values.push(op.f(...[].concat(...values.splice(-op.argCount))))
|
||||
return op.precedence
|
||||
}
|
||||
|
||||
function calculate(expression: string, additionalSymbols?: Object): number {
|
||||
const symbolMap = mergeSymbolMaps(additionalSymbols)
|
||||
|
||||
let match
|
||||
const operators = [symbolMap.symbols['('].prefix]
|
||||
const values = []
|
||||
|
||||
const pattern = new RegExp( // Pattern for numbers
|
||||
`\\d+(?:\\.\\d+)?|${
|
||||
// ...and patterns for individual operators/function names
|
||||
Object.keys(symbolMap.symbols)
|
||||
.map(key => symbolMap.symbols[key])
|
||||
// longer symbols should be listed first
|
||||
// $FlowFixMe
|
||||
.sort((a, b) => b.symbol.length - a.symbol.length)
|
||||
// $FlowFixMe
|
||||
.map(val => val.regSymbol)
|
||||
.join('|')
|
||||
}|(\\S)`,
|
||||
'g',
|
||||
)
|
||||
pattern.lastIndex = 0 // Reset regular expression object
|
||||
|
||||
let afterValue = false
|
||||
|
||||
do {
|
||||
match = pattern.exec(expression)
|
||||
|
||||
const [token, bad] = match || [')', undefined]
|
||||
const notNumber = symbolMap.symbols[token]
|
||||
const notNewValue = notNumber && !notNumber.prefix && !notNumber.func
|
||||
const notAfterValue = !notNumber || (!notNumber.postfix && !notNumber.infix)
|
||||
|
||||
// Check for syntax errors:
|
||||
if (bad || (afterValue ? notAfterValue : notNewValue)) {
|
||||
throw new PolishedError(37, match ? match.index : expression.length, expression)
|
||||
}
|
||||
|
||||
if (afterValue) {
|
||||
// We either have an infix or postfix operator (they should be mutually exclusive)
|
||||
const curr = notNumber.postfix || notNumber.infix
|
||||
do {
|
||||
const prev = operators[operators.length - 1]
|
||||
if ((curr.precedence - prev.precedence || prev.rightToLeft) > 0) break
|
||||
// Apply previous operator, since it has precedence over current one
|
||||
} while (exec(operators, values)) // Exit loop after executing an opening parenthesis or function
|
||||
afterValue = curr.notation === 'postfix'
|
||||
if (curr.symbol !== ')') {
|
||||
operators.push(curr)
|
||||
// Postfix always has precedence over any operator that follows after it
|
||||
if (afterValue) exec(operators, values)
|
||||
}
|
||||
} else if (notNumber) {
|
||||
// prefix operator or function
|
||||
operators.push(notNumber.prefix || notNumber.func)
|
||||
if (notNumber.func) {
|
||||
// Require an opening parenthesis
|
||||
match = pattern.exec(expression)
|
||||
if (!match || match[0] !== '(') {
|
||||
throw new PolishedError(38, match ? match.index : expression.length, expression)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// number
|
||||
values.push(+token)
|
||||
afterValue = true
|
||||
}
|
||||
} while (match && operators.length)
|
||||
|
||||
if (operators.length) {
|
||||
throw new PolishedError(39, match ? match.index : expression.length, expression)
|
||||
} else if (match) {
|
||||
throw new PolishedError(40, match ? match.index : expression.length, expression)
|
||||
} else {
|
||||
return values.pop()
|
||||
}
|
||||
}
|
||||
|
||||
function reverseString(str: string): string {
|
||||
return str.split('').reverse().join('')
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for doing math with CSS Units. Accepts a formula as a string. All values in the formula must have the same unit (or be unitless). Supports complex formulas utliziing addition, subtraction, multiplication, division, square root, powers, factorial, min, max, as well as parentheses for order of operation.
|
||||
*
|
||||
*In cases where you need to do calculations with mixed units where one unit is a [relative length unit](https://developer.mozilla.org/en-US/docs/Web/CSS/length#Relative_length_units), you will want to use [CSS Calc](https://developer.mozilla.org/en-US/docs/Web/CSS/calc).
|
||||
*
|
||||
* *warning* While we've done everything possible to ensure math safely evalutes formulas expressed as strings, you should always use extreme caution when passing `math` user provided values.
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* fontSize: math('12rem + 8rem'),
|
||||
* fontSize: math('(12px + 2px) * 3'),
|
||||
* fontSize: math('3px^2 + sqrt(4)'),
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* fontSize: ${math('12rem + 8rem')};
|
||||
* fontSize: ${math('(12px + 2px) * 3')};
|
||||
* fontSize: ${math('3px^2 + sqrt(4)')};
|
||||
* `
|
||||
*
|
||||
* // CSS as JS Output
|
||||
*
|
||||
* div: {
|
||||
* fontSize: '20rem',
|
||||
* fontSize: '42px',
|
||||
* fontSize: '11px',
|
||||
* }
|
||||
*/
|
||||
export default function math(formula: string, additionalSymbols?: Object): string {
|
||||
const reversedFormula = reverseString(formula)
|
||||
const formulaMatch = reversedFormula.match(unitRegExp)
|
||||
|
||||
// Check that all units are the same
|
||||
if (formulaMatch && !formulaMatch.every(unit => unit === formulaMatch[0])) {
|
||||
throw new PolishedError(41)
|
||||
}
|
||||
|
||||
const cleanFormula = reverseString(reversedFormula.replace(unitRegExp, ''))
|
||||
return `${calculate(cleanFormula, additionalSymbols)}${
|
||||
formulaMatch ? reverseString(formulaMatch[0]) : ''
|
||||
}`
|
||||
}
|
||||
139
VISUALIZACION/node_modules/polished/lib/math/presets/defaultSymbols.d.ts
generated
vendored
Executable file
139
VISUALIZACION/node_modules/polished/lib/math/presets/defaultSymbols.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,139 @@
|
|||
declare function multiplication(a: number, b: number): number;
|
||||
declare function division(a: number, b: number): number;
|
||||
declare function addition(a: number, b: number): number;
|
||||
declare function last(...a: Array<number>): number;
|
||||
declare function subtraction(a: number, b: number): number;
|
||||
declare function negation(a: number): number;
|
||||
declare function comma(...a: Array<number | string>): Array<number | string>;
|
||||
declare function min(...a: Array<number>): number;
|
||||
declare function max(...a: Array<number>): number;
|
||||
declare const defaultSymbols: {
|
||||
symbols: {
|
||||
'*': {
|
||||
infix: {
|
||||
symbol: '*';
|
||||
f: multiplication;
|
||||
notation: 'infix';
|
||||
precedence: 4;
|
||||
rightToLeft: 0;
|
||||
argCount: 2;
|
||||
};
|
||||
symbol: '*';
|
||||
regSymbol: '\\*';
|
||||
};
|
||||
'/': {
|
||||
infix: {
|
||||
symbol: '/';
|
||||
f: division;
|
||||
notation: 'infix';
|
||||
precedence: 4;
|
||||
rightToLeft: 0;
|
||||
argCount: 2;
|
||||
};
|
||||
symbol: '/';
|
||||
regSymbol: '/';
|
||||
};
|
||||
'+': {
|
||||
infix: {
|
||||
symbol: '+';
|
||||
f: addition;
|
||||
notation: 'infix';
|
||||
precedence: 2;
|
||||
rightToLeft: 0;
|
||||
argCount: 2;
|
||||
};
|
||||
prefix: {
|
||||
symbol: '+';
|
||||
f: last;
|
||||
notation: 'prefix';
|
||||
precedence: 3;
|
||||
rightToLeft: 0;
|
||||
argCount: 1;
|
||||
};
|
||||
symbol: '+';
|
||||
regSymbol: '\\+';
|
||||
};
|
||||
'-': {
|
||||
infix: {
|
||||
symbol: '-';
|
||||
f: subtraction;
|
||||
notation: 'infix';
|
||||
precedence: 2;
|
||||
rightToLeft: 0;
|
||||
argCount: 2;
|
||||
};
|
||||
prefix: {
|
||||
symbol: '-';
|
||||
f: negation;
|
||||
notation: 'prefix';
|
||||
precedence: 3;
|
||||
rightToLeft: 0;
|
||||
argCount: 1;
|
||||
};
|
||||
symbol: '-';
|
||||
regSymbol: '-';
|
||||
};
|
||||
',': {
|
||||
infix: {
|
||||
symbol: ',';
|
||||
f: comma;
|
||||
notation: 'infix';
|
||||
precedence: 1;
|
||||
rightToLeft: 0;
|
||||
argCount: 2;
|
||||
};
|
||||
symbol: ',';
|
||||
regSymbol: ',';
|
||||
};
|
||||
'(': {
|
||||
prefix: {
|
||||
symbol: '(';
|
||||
f: last;
|
||||
notation: 'prefix';
|
||||
precedence: 0;
|
||||
rightToLeft: 0;
|
||||
argCount: 1;
|
||||
};
|
||||
symbol: '(';
|
||||
regSymbol: '\\(';
|
||||
};
|
||||
')': {
|
||||
postfix: {
|
||||
symbol: ')';
|
||||
f: undefined;
|
||||
notation: 'postfix';
|
||||
precedence: 0;
|
||||
rightToLeft: 0;
|
||||
argCount: 1;
|
||||
};
|
||||
symbol: ')';
|
||||
regSymbol: '\\)';
|
||||
};
|
||||
min: {
|
||||
func: {
|
||||
symbol: 'min';
|
||||
f: min;
|
||||
notation: 'func';
|
||||
precedence: 0;
|
||||
rightToLeft: 0;
|
||||
argCount: 1;
|
||||
};
|
||||
symbol: 'min';
|
||||
regSymbol: 'min\\b';
|
||||
};
|
||||
max: {
|
||||
func: {
|
||||
symbol: 'max';
|
||||
f: max;
|
||||
notation: 'func';
|
||||
precedence: 0;
|
||||
rightToLeft: 0;
|
||||
argCount: 1;
|
||||
};
|
||||
symbol: 'max';
|
||||
regSymbol: 'max\\b';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export default defaultSymbols;
|
||||
162
VISUALIZACION/node_modules/polished/lib/math/presets/defaultSymbols.js
generated
vendored
Executable file
162
VISUALIZACION/node_modules/polished/lib/math/presets/defaultSymbols.js
generated
vendored
Executable file
|
|
@ -0,0 +1,162 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
function last() {
|
||||
var _ref;
|
||||
return _ref = arguments.length - 1, _ref < 0 || arguments.length <= _ref ? undefined : arguments[_ref];
|
||||
}
|
||||
function negation(a) {
|
||||
return -a;
|
||||
}
|
||||
function addition(a, b) {
|
||||
return a + b;
|
||||
}
|
||||
function subtraction(a, b) {
|
||||
return a - b;
|
||||
}
|
||||
function multiplication(a, b) {
|
||||
return a * b;
|
||||
}
|
||||
function division(a, b) {
|
||||
return a / b;
|
||||
}
|
||||
function max() {
|
||||
return Math.max.apply(Math, arguments);
|
||||
}
|
||||
function min() {
|
||||
return Math.min.apply(Math, arguments);
|
||||
}
|
||||
function comma() {
|
||||
return Array.of.apply(Array, arguments);
|
||||
}
|
||||
var defaultSymbols = {
|
||||
symbols: {
|
||||
'*': {
|
||||
infix: {
|
||||
symbol: '*',
|
||||
f: multiplication,
|
||||
notation: 'infix',
|
||||
precedence: 4,
|
||||
rightToLeft: 0,
|
||||
argCount: 2
|
||||
},
|
||||
symbol: '*',
|
||||
regSymbol: '\\*'
|
||||
},
|
||||
'/': {
|
||||
infix: {
|
||||
symbol: '/',
|
||||
f: division,
|
||||
notation: 'infix',
|
||||
precedence: 4,
|
||||
rightToLeft: 0,
|
||||
argCount: 2
|
||||
},
|
||||
symbol: '/',
|
||||
regSymbol: '/'
|
||||
},
|
||||
'+': {
|
||||
infix: {
|
||||
symbol: '+',
|
||||
f: addition,
|
||||
notation: 'infix',
|
||||
precedence: 2,
|
||||
rightToLeft: 0,
|
||||
argCount: 2
|
||||
},
|
||||
prefix: {
|
||||
symbol: '+',
|
||||
f: last,
|
||||
notation: 'prefix',
|
||||
precedence: 3,
|
||||
rightToLeft: 0,
|
||||
argCount: 1
|
||||
},
|
||||
symbol: '+',
|
||||
regSymbol: '\\+'
|
||||
},
|
||||
'-': {
|
||||
infix: {
|
||||
symbol: '-',
|
||||
f: subtraction,
|
||||
notation: 'infix',
|
||||
precedence: 2,
|
||||
rightToLeft: 0,
|
||||
argCount: 2
|
||||
},
|
||||
prefix: {
|
||||
symbol: '-',
|
||||
f: negation,
|
||||
notation: 'prefix',
|
||||
precedence: 3,
|
||||
rightToLeft: 0,
|
||||
argCount: 1
|
||||
},
|
||||
symbol: '-',
|
||||
regSymbol: '-'
|
||||
},
|
||||
',': {
|
||||
infix: {
|
||||
symbol: ',',
|
||||
f: comma,
|
||||
notation: 'infix',
|
||||
precedence: 1,
|
||||
rightToLeft: 0,
|
||||
argCount: 2
|
||||
},
|
||||
symbol: ',',
|
||||
regSymbol: ','
|
||||
},
|
||||
'(': {
|
||||
prefix: {
|
||||
symbol: '(',
|
||||
f: last,
|
||||
notation: 'prefix',
|
||||
precedence: 0,
|
||||
rightToLeft: 0,
|
||||
argCount: 1
|
||||
},
|
||||
symbol: '(',
|
||||
regSymbol: '\\('
|
||||
},
|
||||
')': {
|
||||
postfix: {
|
||||
symbol: ')',
|
||||
f: undefined,
|
||||
notation: 'postfix',
|
||||
precedence: 0,
|
||||
rightToLeft: 0,
|
||||
argCount: 1
|
||||
},
|
||||
symbol: ')',
|
||||
regSymbol: '\\)'
|
||||
},
|
||||
min: {
|
||||
func: {
|
||||
symbol: 'min',
|
||||
f: min,
|
||||
notation: 'func',
|
||||
precedence: 0,
|
||||
rightToLeft: 0,
|
||||
argCount: 1
|
||||
},
|
||||
symbol: 'min',
|
||||
regSymbol: 'min\\b'
|
||||
},
|
||||
max: {
|
||||
func: {
|
||||
symbol: 'max',
|
||||
f: max,
|
||||
notation: 'func',
|
||||
precedence: 0,
|
||||
rightToLeft: 0,
|
||||
argCount: 1
|
||||
},
|
||||
symbol: 'max',
|
||||
regSymbol: 'max\\b'
|
||||
}
|
||||
}
|
||||
};
|
||||
var _default = exports["default"] = defaultSymbols;
|
||||
module.exports = exports.default;
|
||||
168
VISUALIZACION/node_modules/polished/lib/math/presets/defaultSymbols.js.flow
generated
vendored
Executable file
168
VISUALIZACION/node_modules/polished/lib/math/presets/defaultSymbols.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,168 @@
|
|||
// @flow
|
||||
|
||||
function last(...a: Array<number>): number {
|
||||
return a[a.length - 1]
|
||||
}
|
||||
|
||||
function negation(a: number): number {
|
||||
return -a
|
||||
}
|
||||
|
||||
function addition(a: number, b: number): number {
|
||||
return a + b
|
||||
}
|
||||
|
||||
function subtraction(a: number, b: number): number {
|
||||
return a - b
|
||||
}
|
||||
|
||||
function multiplication(a: number, b: number): number {
|
||||
return a * b
|
||||
}
|
||||
|
||||
function division(a: number, b: number): number {
|
||||
return a / b
|
||||
}
|
||||
|
||||
function max(...a: Array<number>): number {
|
||||
return Math.max(...a)
|
||||
}
|
||||
|
||||
function min(...a: Array<number>): number {
|
||||
return Math.min(...a)
|
||||
}
|
||||
|
||||
function comma(...a: Array<number | string>): Array<number | string> {
|
||||
return Array.of(...a)
|
||||
}
|
||||
|
||||
const defaultSymbols = {
|
||||
symbols: {
|
||||
'*': {
|
||||
infix: {
|
||||
symbol: '*',
|
||||
f: multiplication,
|
||||
notation: 'infix',
|
||||
precedence: 4,
|
||||
rightToLeft: 0,
|
||||
argCount: 2,
|
||||
},
|
||||
symbol: '*',
|
||||
regSymbol: '\\*',
|
||||
},
|
||||
'/': {
|
||||
infix: {
|
||||
symbol: '/',
|
||||
f: division,
|
||||
notation: 'infix',
|
||||
precedence: 4,
|
||||
rightToLeft: 0,
|
||||
argCount: 2,
|
||||
},
|
||||
symbol: '/',
|
||||
regSymbol: '/',
|
||||
},
|
||||
'+': {
|
||||
infix: {
|
||||
symbol: '+',
|
||||
f: addition,
|
||||
notation: 'infix',
|
||||
precedence: 2,
|
||||
rightToLeft: 0,
|
||||
argCount: 2,
|
||||
},
|
||||
prefix: {
|
||||
symbol: '+',
|
||||
f: last,
|
||||
notation: 'prefix',
|
||||
precedence: 3,
|
||||
rightToLeft: 0,
|
||||
argCount: 1,
|
||||
},
|
||||
symbol: '+',
|
||||
regSymbol: '\\+',
|
||||
},
|
||||
'-': {
|
||||
infix: {
|
||||
symbol: '-',
|
||||
f: subtraction,
|
||||
notation: 'infix',
|
||||
precedence: 2,
|
||||
rightToLeft: 0,
|
||||
argCount: 2,
|
||||
},
|
||||
prefix: {
|
||||
symbol: '-',
|
||||
f: negation,
|
||||
notation: 'prefix',
|
||||
precedence: 3,
|
||||
rightToLeft: 0,
|
||||
argCount: 1,
|
||||
},
|
||||
symbol: '-',
|
||||
regSymbol: '-',
|
||||
},
|
||||
',': {
|
||||
infix: {
|
||||
symbol: ',',
|
||||
f: comma,
|
||||
notation: 'infix',
|
||||
precedence: 1,
|
||||
rightToLeft: 0,
|
||||
argCount: 2,
|
||||
},
|
||||
symbol: ',',
|
||||
regSymbol: ',',
|
||||
},
|
||||
'(': {
|
||||
prefix: {
|
||||
symbol: '(',
|
||||
f: last,
|
||||
notation: 'prefix',
|
||||
precedence: 0,
|
||||
rightToLeft: 0,
|
||||
argCount: 1,
|
||||
},
|
||||
symbol: '(',
|
||||
regSymbol: '\\(',
|
||||
},
|
||||
')': {
|
||||
postfix: {
|
||||
symbol: ')',
|
||||
f: undefined,
|
||||
notation: 'postfix',
|
||||
precedence: 0,
|
||||
rightToLeft: 0,
|
||||
argCount: 1,
|
||||
},
|
||||
symbol: ')',
|
||||
regSymbol: '\\)',
|
||||
},
|
||||
min: {
|
||||
func: {
|
||||
symbol: 'min',
|
||||
f: min,
|
||||
notation: 'func',
|
||||
precedence: 0,
|
||||
rightToLeft: 0,
|
||||
argCount: 1,
|
||||
},
|
||||
symbol: 'min',
|
||||
regSymbol: 'min\\b',
|
||||
},
|
||||
max: {
|
||||
func: {
|
||||
symbol: 'max',
|
||||
f: max,
|
||||
notation: 'func',
|
||||
precedence: 0,
|
||||
rightToLeft: 0,
|
||||
argCount: 1,
|
||||
},
|
||||
symbol: 'max',
|
||||
regSymbol: 'max\\b',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default defaultSymbols
|
||||
45
VISUALIZACION/node_modules/polished/lib/math/presets/exponentialSymbols.d.ts
generated
vendored
Executable file
45
VISUALIZACION/node_modules/polished/lib/math/presets/exponentialSymbols.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
declare function factorial(a: number): number;
|
||||
declare function power(a: number, b: number): number;
|
||||
declare function sqrt(a: number): number;
|
||||
declare const exponentialSymbols: {
|
||||
symbols: {
|
||||
'!': {
|
||||
postfix: {
|
||||
symbol: '!';
|
||||
f: factorial;
|
||||
notation: 'postfix';
|
||||
precedence: 6;
|
||||
rightToLeft: 0;
|
||||
argCount: 1;
|
||||
};
|
||||
symbol: '!';
|
||||
regSymbol: '!';
|
||||
};
|
||||
'^': {
|
||||
infix: {
|
||||
symbol: '^';
|
||||
f: power;
|
||||
notation: 'infix';
|
||||
precedence: 5;
|
||||
rightToLeft: 1;
|
||||
argCount: 2;
|
||||
};
|
||||
symbol: '^';
|
||||
regSymbol: '\\^';
|
||||
};
|
||||
sqrt: {
|
||||
func: {
|
||||
symbol: 'sqrt';
|
||||
f: sqrt;
|
||||
notation: 'func';
|
||||
precedence: 0;
|
||||
rightToLeft: 0;
|
||||
argCount: 1;
|
||||
};
|
||||
symbol: 'sqrt';
|
||||
regSymbol: 'sqrt\\b';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export default exponentialSymbols;
|
||||
58
VISUALIZACION/node_modules/polished/lib/math/presets/exponentialSymbols.js
generated
vendored
Executable file
58
VISUALIZACION/node_modules/polished/lib/math/presets/exponentialSymbols.js
generated
vendored
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
function factorial(a) {
|
||||
if (a % 1 || !(+a >= 0)) return NaN;
|
||||
if (a > 170) return Infinity;else if (a === 0) return 1;else {
|
||||
return a * factorial(a - 1);
|
||||
}
|
||||
}
|
||||
function power(a, b) {
|
||||
return Math.pow(a, b);
|
||||
}
|
||||
function sqrt(a) {
|
||||
return Math.sqrt(a);
|
||||
}
|
||||
var exponentialSymbols = {
|
||||
symbols: {
|
||||
'!': {
|
||||
postfix: {
|
||||
symbol: '!',
|
||||
f: factorial,
|
||||
notation: 'postfix',
|
||||
precedence: 6,
|
||||
rightToLeft: 0,
|
||||
argCount: 1
|
||||
},
|
||||
symbol: '!',
|
||||
regSymbol: '!'
|
||||
},
|
||||
'^': {
|
||||
infix: {
|
||||
symbol: '^',
|
||||
f: power,
|
||||
notation: 'infix',
|
||||
precedence: 5,
|
||||
rightToLeft: 1,
|
||||
argCount: 2
|
||||
},
|
||||
symbol: '^',
|
||||
regSymbol: '\\^'
|
||||
},
|
||||
sqrt: {
|
||||
func: {
|
||||
symbol: 'sqrt',
|
||||
f: sqrt,
|
||||
notation: 'func',
|
||||
precedence: 0,
|
||||
rightToLeft: 0,
|
||||
argCount: 1
|
||||
},
|
||||
symbol: 'sqrt',
|
||||
regSymbol: 'sqrt\\b'
|
||||
}
|
||||
}
|
||||
};
|
||||
var _default = exports["default"] = exponentialSymbols;
|
||||
module.exports = exports.default;
|
||||
61
VISUALIZACION/node_modules/polished/lib/math/presets/exponentialSymbols.js.flow
generated
vendored
Executable file
61
VISUALIZACION/node_modules/polished/lib/math/presets/exponentialSymbols.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
// @flow
|
||||
|
||||
function factorial(a: number): number {
|
||||
if (a % 1 || !(+a >= 0)) return NaN
|
||||
if (a > 170) return Infinity
|
||||
else if (a === 0) return 1
|
||||
else {
|
||||
return a * factorial(a - 1)
|
||||
}
|
||||
}
|
||||
|
||||
function power(a: number, b: number): number {
|
||||
return a ** b
|
||||
}
|
||||
|
||||
function sqrt(a: number): number {
|
||||
return Math.sqrt(a)
|
||||
}
|
||||
|
||||
const exponentialSymbols = {
|
||||
symbols: {
|
||||
'!': {
|
||||
postfix: {
|
||||
symbol: '!',
|
||||
f: factorial,
|
||||
notation: 'postfix',
|
||||
precedence: 6,
|
||||
rightToLeft: 0,
|
||||
argCount: 1,
|
||||
},
|
||||
symbol: '!',
|
||||
regSymbol: '!',
|
||||
},
|
||||
'^': {
|
||||
infix: {
|
||||
symbol: '^',
|
||||
f: power,
|
||||
notation: 'infix',
|
||||
precedence: 5,
|
||||
rightToLeft: 1,
|
||||
argCount: 2,
|
||||
},
|
||||
symbol: '^',
|
||||
regSymbol: '\\^',
|
||||
},
|
||||
sqrt: {
|
||||
func: {
|
||||
symbol: 'sqrt',
|
||||
f: sqrt,
|
||||
notation: 'func',
|
||||
precedence: 0,
|
||||
rightToLeft: 0,
|
||||
argCount: 1,
|
||||
},
|
||||
symbol: 'sqrt',
|
||||
regSymbol: 'sqrt\\b',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default exponentialSymbols
|
||||
Loading…
Add table
Add a link
Reference in a new issue