flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
6
VISUALIZACION/node_modules/polished/lib/helpers/cssVar.d.ts
generated
vendored
Executable file
6
VISUALIZACION/node_modules/polished/lib/helpers/cssVar.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
declare function cssVar(
|
||||
cssVariable: string,
|
||||
defaultValue?: string | number,
|
||||
): string | number;
|
||||
|
||||
export default cssVar;
|
||||
49
VISUALIZACION/node_modules/polished/lib/helpers/cssVar.js
generated
vendored
Executable file
49
VISUALIZACION/node_modules/polished/lib/helpers/cssVar.js
generated
vendored
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = cssVar;
|
||||
var _errors = _interopRequireDefault(require("../internalHelpers/_errors"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
var cssVariableRegex = /--[\S]*/g;
|
||||
|
||||
/**
|
||||
* Fetches the value of a passed CSS Variable in the :root scope, or otherwise returns a defaultValue if provided.
|
||||
*
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* 'background': cssVar('--background-color'),
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* background: ${cssVar('--background-color')};
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* 'background': 'red'
|
||||
* }
|
||||
*/
|
||||
function cssVar(cssVariable, defaultValue) {
|
||||
if (!cssVariable || !cssVariable.match(cssVariableRegex)) {
|
||||
throw new _errors["default"](73);
|
||||
}
|
||||
var variableValue;
|
||||
|
||||
/* eslint-disable */
|
||||
/* istanbul ignore next */
|
||||
if (typeof document !== 'undefined' && document.documentElement !== null) {
|
||||
variableValue = getComputedStyle(document.documentElement).getPropertyValue(cssVariable);
|
||||
}
|
||||
/* eslint-enable */
|
||||
|
||||
if (variableValue) {
|
||||
return variableValue.trim();
|
||||
} else if (defaultValue) {
|
||||
return defaultValue;
|
||||
}
|
||||
throw new _errors["default"](74);
|
||||
}
|
||||
module.exports = exports.default;
|
||||
50
VISUALIZACION/node_modules/polished/lib/helpers/cssVar.js.flow
generated
vendored
Executable file
50
VISUALIZACION/node_modules/polished/lib/helpers/cssVar.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
// @flow
|
||||
import PolishedError from '../internalHelpers/_errors'
|
||||
|
||||
const cssVariableRegex = /--[\S]*/g
|
||||
|
||||
/**
|
||||
* Fetches the value of a passed CSS Variable in the :root scope, or otherwise returns a defaultValue if provided.
|
||||
*
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* 'background': cssVar('--background-color'),
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* background: ${cssVar('--background-color')};
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* 'background': 'red'
|
||||
* }
|
||||
*/
|
||||
export default function cssVar(
|
||||
cssVariable: string,
|
||||
defaultValue?: string | number,
|
||||
): string | number {
|
||||
if (!cssVariable || !cssVariable.match(cssVariableRegex)) {
|
||||
throw new PolishedError(73)
|
||||
}
|
||||
|
||||
let variableValue
|
||||
|
||||
/* eslint-disable */
|
||||
/* istanbul ignore next */
|
||||
if (typeof document !== 'undefined' && document.documentElement !== null) {
|
||||
variableValue = getComputedStyle(document.documentElement).getPropertyValue(cssVariable)
|
||||
}
|
||||
/* eslint-enable */
|
||||
|
||||
if (variableValue) {
|
||||
return variableValue.trim()
|
||||
} else if (defaultValue) {
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
throw new PolishedError(74)
|
||||
}
|
||||
8
VISUALIZACION/node_modules/polished/lib/helpers/directionalProperty.d.ts
generated
vendored
Executable file
8
VISUALIZACION/node_modules/polished/lib/helpers/directionalProperty.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
import { Styles } from '../types/style';
|
||||
|
||||
declare function directionalProperty(
|
||||
property: string,
|
||||
...values: Array<null | void | string | null | void | number>
|
||||
): Styles;
|
||||
|
||||
export default directionalProperty;
|
||||
67
VISUALIZACION/node_modules/polished/lib/helpers/directionalProperty.js
generated
vendored
Executable file
67
VISUALIZACION/node_modules/polished/lib/helpers/directionalProperty.js
generated
vendored
Executable file
|
|
@ -0,0 +1,67 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = directionalProperty;
|
||||
var _capitalizeString = _interopRequireDefault(require("../internalHelpers/_capitalizeString"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
var positionMap = ['Top', 'Right', 'Bottom', 'Left'];
|
||||
function generateProperty(property, position) {
|
||||
if (!property) return position.toLowerCase();
|
||||
var splitProperty = property.split('-');
|
||||
if (splitProperty.length > 1) {
|
||||
splitProperty.splice(1, 0, position);
|
||||
return splitProperty.reduce(function (acc, val) {
|
||||
return "" + acc + (0, _capitalizeString["default"])(val);
|
||||
});
|
||||
}
|
||||
var joinedProperty = property.replace(/([a-z])([A-Z])/g, "$1" + position + "$2");
|
||||
return property === joinedProperty ? "" + property + position : joinedProperty;
|
||||
}
|
||||
function generateStyles(property, valuesWithDefaults) {
|
||||
var styles = {};
|
||||
for (var i = 0; i < valuesWithDefaults.length; i += 1) {
|
||||
if (valuesWithDefaults[i] || valuesWithDefaults[i] === 0) {
|
||||
styles[generateProperty(property, positionMap[i])] = valuesWithDefaults[i];
|
||||
}
|
||||
}
|
||||
return styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables shorthand for direction-based properties. It accepts a property (hyphenated or camelCased) and up to four values that map to top, right, bottom, and left, respectively. You can optionally pass an empty string to get only the directional values as properties. You can also optionally pass a null argument for a directional value to ignore it.
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* ...directionalProperty('padding', '12px', '24px', '36px', '48px')
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* ${directionalProperty('padding', '12px', '24px', '36px', '48px')}
|
||||
* `
|
||||
*
|
||||
* // CSS as JS Output
|
||||
*
|
||||
* div {
|
||||
* 'paddingTop': '12px',
|
||||
* 'paddingRight': '24px',
|
||||
* 'paddingBottom': '36px',
|
||||
* 'paddingLeft': '48px'
|
||||
* }
|
||||
*/
|
||||
function directionalProperty(property) {
|
||||
for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
values[_key - 1] = arguments[_key];
|
||||
}
|
||||
// prettier-ignore
|
||||
var firstValue = values[0],
|
||||
_values$ = values[1],
|
||||
secondValue = _values$ === void 0 ? firstValue : _values$,
|
||||
_values$2 = values[2],
|
||||
thirdValue = _values$2 === void 0 ? firstValue : _values$2,
|
||||
_values$3 = values[3],
|
||||
fourthValue = _values$3 === void 0 ? secondValue : _values$3;
|
||||
var valuesWithDefaults = [firstValue, secondValue, thirdValue, fourthValue];
|
||||
return generateStyles(property, valuesWithDefaults);
|
||||
}
|
||||
module.exports = exports.default;
|
||||
59
VISUALIZACION/node_modules/polished/lib/helpers/directionalProperty.js.flow
generated
vendored
Executable file
59
VISUALIZACION/node_modules/polished/lib/helpers/directionalProperty.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
// @flow
|
||||
import capitalizeString from '../internalHelpers/_capitalizeString'
|
||||
|
||||
import type { Styles } from '../types/style'
|
||||
|
||||
const positionMap = ['Top', 'Right', 'Bottom', 'Left']
|
||||
|
||||
function generateProperty(property: string, position: string) {
|
||||
if (!property) return position.toLowerCase()
|
||||
const splitProperty = property.split('-')
|
||||
if (splitProperty.length > 1) {
|
||||
splitProperty.splice(1, 0, position)
|
||||
return splitProperty.reduce((acc, val) => `${acc}${capitalizeString(val)}`)
|
||||
}
|
||||
const joinedProperty = property.replace(/([a-z])([A-Z])/g, `$1${position}$2`)
|
||||
return property === joinedProperty ? `${property}${position}` : joinedProperty
|
||||
}
|
||||
|
||||
function generateStyles(property: string, valuesWithDefaults: Array<?string | ?number>) {
|
||||
const styles = {}
|
||||
for (let i = 0; i < valuesWithDefaults.length; i += 1) {
|
||||
if (valuesWithDefaults[i] || valuesWithDefaults[i] === 0) {
|
||||
styles[generateProperty(property, positionMap[i])] = valuesWithDefaults[i]
|
||||
}
|
||||
}
|
||||
return styles
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables shorthand for direction-based properties. It accepts a property (hyphenated or camelCased) and up to four values that map to top, right, bottom, and left, respectively. You can optionally pass an empty string to get only the directional values as properties. You can also optionally pass a null argument for a directional value to ignore it.
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* ...directionalProperty('padding', '12px', '24px', '36px', '48px')
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* ${directionalProperty('padding', '12px', '24px', '36px', '48px')}
|
||||
* `
|
||||
*
|
||||
* // CSS as JS Output
|
||||
*
|
||||
* div {
|
||||
* 'paddingTop': '12px',
|
||||
* 'paddingRight': '24px',
|
||||
* 'paddingBottom': '36px',
|
||||
* 'paddingLeft': '48px'
|
||||
* }
|
||||
*/
|
||||
export default function directionalProperty(
|
||||
property: string,
|
||||
...values: Array<?string | ?number>
|
||||
): Styles {
|
||||
// prettier-ignore
|
||||
const [firstValue, secondValue = firstValue, thirdValue = firstValue, fourthValue = secondValue] = values
|
||||
const valuesWithDefaults = [firstValue, secondValue, thirdValue, fourthValue]
|
||||
return generateStyles(property, valuesWithDefaults)
|
||||
}
|
||||
3
VISUALIZACION/node_modules/polished/lib/helpers/em.d.ts
generated
vendored
Executable file
3
VISUALIZACION/node_modules/polished/lib/helpers/em.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
declare const em: (value: string | number, base?: string | number) => string;
|
||||
|
||||
export default em;
|
||||
32
VISUALIZACION/node_modules/polished/lib/helpers/em.js
generated
vendored
Executable file
32
VISUALIZACION/node_modules/polished/lib/helpers/em.js
generated
vendored
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _pxto = _interopRequireDefault(require("../internalHelpers/_pxto"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
/**
|
||||
* Convert pixel value to ems. The default base value is 16px, but can be changed by passing a
|
||||
* second argument to the function.
|
||||
* @function
|
||||
* @param {string|number} pxval
|
||||
* @param {string|number} [base='16px']
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* 'height': em('16px')
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* height: ${em('16px')}
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* 'height': '1em'
|
||||
* }
|
||||
*/
|
||||
var em = (0, _pxto["default"])('em');
|
||||
var _default = exports["default"] = em;
|
||||
module.exports = exports.default;
|
||||
28
VISUALIZACION/node_modules/polished/lib/helpers/em.js.flow
generated
vendored
Executable file
28
VISUALIZACION/node_modules/polished/lib/helpers/em.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
// @flow
|
||||
import pixelsto from '../internalHelpers/_pxto'
|
||||
|
||||
/**
|
||||
* Convert pixel value to ems. The default base value is 16px, but can be changed by passing a
|
||||
* second argument to the function.
|
||||
* @function
|
||||
* @param {string|number} pxval
|
||||
* @param {string|number} [base='16px']
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* 'height': em('16px')
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* height: ${em('16px')}
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* 'height': '1em'
|
||||
* }
|
||||
*/
|
||||
const em: (value: string | number, base?: string | number) => string = pixelsto('em')
|
||||
export default em
|
||||
3
VISUALIZACION/node_modules/polished/lib/helpers/getValueAndUnit.d.ts
generated
vendored
Executable file
3
VISUALIZACION/node_modules/polished/lib/helpers/getValueAndUnit.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
declare function getValueAndUnit(value: string | number): any;
|
||||
|
||||
export default getValueAndUnit;
|
||||
36
VISUALIZACION/node_modules/polished/lib/helpers/getValueAndUnit.js
generated
vendored
Executable file
36
VISUALIZACION/node_modules/polished/lib/helpers/getValueAndUnit.js
generated
vendored
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = getValueAndUnit;
|
||||
var cssRegex = /^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;
|
||||
|
||||
/**
|
||||
* Returns a given CSS value and its unit as elements of an array.
|
||||
*
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* '--dimension': getValueAndUnit('100px')[0],
|
||||
* '--unit': getValueAndUnit('100px')[1],
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* --dimension: ${getValueAndUnit('100px')[0]};
|
||||
* --unit: ${getValueAndUnit('100px')[1]};
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* '--dimension': 100,
|
||||
* '--unit': 'px',
|
||||
* }
|
||||
*/
|
||||
function getValueAndUnit(value) {
|
||||
if (typeof value !== 'string') return [value, ''];
|
||||
var matchedValue = value.match(cssRegex);
|
||||
if (matchedValue) return [parseFloat(value), matchedValue[2]];
|
||||
return [value, undefined];
|
||||
}
|
||||
module.exports = exports.default;
|
||||
32
VISUALIZACION/node_modules/polished/lib/helpers/getValueAndUnit.js.flow
generated
vendored
Executable file
32
VISUALIZACION/node_modules/polished/lib/helpers/getValueAndUnit.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
// @flow
|
||||
const cssRegex = /^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/
|
||||
|
||||
/**
|
||||
* Returns a given CSS value and its unit as elements of an array.
|
||||
*
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* '--dimension': getValueAndUnit('100px')[0],
|
||||
* '--unit': getValueAndUnit('100px')[1],
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* --dimension: ${getValueAndUnit('100px')[0]};
|
||||
* --unit: ${getValueAndUnit('100px')[1]};
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* '--dimension': 100,
|
||||
* '--unit': 'px',
|
||||
* }
|
||||
*/
|
||||
export default function getValueAndUnit(value: string | number): any {
|
||||
if (typeof value !== 'string') return [value, '']
|
||||
const matchedValue = value.match(cssRegex)
|
||||
if (matchedValue) return [parseFloat(value), matchedValue[2]]
|
||||
return [value, undefined]
|
||||
}
|
||||
8
VISUALIZACION/node_modules/polished/lib/helpers/important.d.ts
generated
vendored
Executable file
8
VISUALIZACION/node_modules/polished/lib/helpers/important.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
import { Styles } from '../types/style';
|
||||
|
||||
declare function important(
|
||||
styleBlock: Styles,
|
||||
rules?: Array<string> | string,
|
||||
): Styles;
|
||||
|
||||
export default important;
|
||||
47
VISUALIZACION/node_modules/polished/lib/helpers/important.js
generated
vendored
Executable file
47
VISUALIZACION/node_modules/polished/lib/helpers/important.js
generated
vendored
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = important;
|
||||
var _errors = _interopRequireDefault(require("../internalHelpers/_errors"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
/**
|
||||
* Helper for targeting rules in a style block generated by polished modules that need !important-level specificity. Can optionally specify a rule (or rules) to target specific rules.
|
||||
*
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* ...important(cover())
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* ${important(cover())}
|
||||
* `
|
||||
*
|
||||
* // CSS as JS Output
|
||||
*
|
||||
* div: {
|
||||
* 'position': 'absolute !important',
|
||||
* 'top': '0 !important',
|
||||
* 'right: '0 !important',
|
||||
* 'bottom': '0 !important',
|
||||
* 'left: '0 !important'
|
||||
* }
|
||||
*/
|
||||
function important(styleBlock, rules) {
|
||||
if (typeof styleBlock !== 'object' || styleBlock === null) {
|
||||
throw new _errors["default"](75, typeof styleBlock);
|
||||
}
|
||||
var newStyleBlock = {};
|
||||
Object.keys(styleBlock).forEach(function (key) {
|
||||
if (typeof styleBlock[key] === 'object' && styleBlock[key] !== null) {
|
||||
newStyleBlock[key] = important(styleBlock[key], rules);
|
||||
} else if (!rules || rules && (rules === key || rules.indexOf(key) >= 0)) {
|
||||
newStyleBlock[key] = styleBlock[key] + " !important";
|
||||
} else {
|
||||
newStyleBlock[key] = styleBlock[key];
|
||||
}
|
||||
});
|
||||
return newStyleBlock;
|
||||
}
|
||||
module.exports = exports.default;
|
||||
47
VISUALIZACION/node_modules/polished/lib/helpers/important.js.flow
generated
vendored
Executable file
47
VISUALIZACION/node_modules/polished/lib/helpers/important.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
// @flow
|
||||
import type { Styles } from '../types/style'
|
||||
import PolishedError from '../internalHelpers/_errors'
|
||||
|
||||
/**
|
||||
* Helper for targeting rules in a style block generated by polished modules that need !important-level specificity. Can optionally specify a rule (or rules) to target specific rules.
|
||||
*
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* ...important(cover())
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* ${important(cover())}
|
||||
* `
|
||||
*
|
||||
* // CSS as JS Output
|
||||
*
|
||||
* div: {
|
||||
* 'position': 'absolute !important',
|
||||
* 'top': '0 !important',
|
||||
* 'right: '0 !important',
|
||||
* 'bottom': '0 !important',
|
||||
* 'left: '0 !important'
|
||||
* }
|
||||
*/
|
||||
export default function important(styleBlock: Styles, rules?: Array<string> | string): Styles {
|
||||
if (typeof styleBlock !== 'object' || styleBlock === null) {
|
||||
throw new PolishedError(75, typeof styleBlock)
|
||||
}
|
||||
|
||||
const newStyleBlock = {}
|
||||
|
||||
Object.keys(styleBlock).forEach(key => {
|
||||
if (typeof styleBlock[key] === 'object' && styleBlock[key] !== null) {
|
||||
newStyleBlock[key] = important(styleBlock[key], rules)
|
||||
} else if (!rules || (rules && (rules === key || rules.indexOf(key) >= 0))) {
|
||||
newStyleBlock[key] = `${styleBlock[key]} !important`
|
||||
} else {
|
||||
newStyleBlock[key] = styleBlock[key]
|
||||
}
|
||||
})
|
||||
|
||||
return newStyleBlock
|
||||
}
|
||||
29
VISUALIZACION/node_modules/polished/lib/helpers/modularScale.d.ts
generated
vendored
Executable file
29
VISUALIZACION/node_modules/polished/lib/helpers/modularScale.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
import { ModularScaleRatio } from '../types/modularScaleRatio';
|
||||
|
||||
declare const ratioNames: {
|
||||
minorSecond: 1.067;
|
||||
majorSecond: 1.125;
|
||||
minorThird: 1.2;
|
||||
majorThird: 1.25;
|
||||
perfectFourth: 1.333;
|
||||
augFourth: 1.414;
|
||||
perfectFifth: 1.5;
|
||||
minorSixth: 1.6;
|
||||
goldenSection: 1.618;
|
||||
majorSixth: 1.667;
|
||||
minorSeventh: 1.778;
|
||||
majorSeventh: 1.875;
|
||||
octave: 2;
|
||||
majorTenth: 2.5;
|
||||
majorEleventh: 2.667;
|
||||
majorTwelfth: 3;
|
||||
doubleOctave: 4;
|
||||
};
|
||||
declare function modularScale(
|
||||
steps: number,
|
||||
base?: number | string,
|
||||
ratio?: ModularScaleRatio,
|
||||
): string;
|
||||
|
||||
export { ratioNames };
|
||||
export default modularScale;
|
||||
74
VISUALIZACION/node_modules/polished/lib/helpers/modularScale.js
generated
vendored
Executable file
74
VISUALIZACION/node_modules/polished/lib/helpers/modularScale.js
generated
vendored
Executable file
|
|
@ -0,0 +1,74 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = modularScale;
|
||||
exports.ratioNames = void 0;
|
||||
var _getValueAndUnit = _interopRequireDefault(require("./getValueAndUnit"));
|
||||
var _errors = _interopRequireDefault(require("../internalHelpers/_errors"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
var ratioNames = exports.ratioNames = {
|
||||
minorSecond: 1.067,
|
||||
majorSecond: 1.125,
|
||||
minorThird: 1.2,
|
||||
majorThird: 1.25,
|
||||
perfectFourth: 1.333,
|
||||
augFourth: 1.414,
|
||||
perfectFifth: 1.5,
|
||||
minorSixth: 1.6,
|
||||
goldenSection: 1.618,
|
||||
majorSixth: 1.667,
|
||||
minorSeventh: 1.778,
|
||||
majorSeventh: 1.875,
|
||||
octave: 2,
|
||||
majorTenth: 2.5,
|
||||
majorEleventh: 2.667,
|
||||
majorTwelfth: 3,
|
||||
doubleOctave: 4
|
||||
};
|
||||
function getRatio(ratioName) {
|
||||
return ratioNames[ratioName];
|
||||
}
|
||||
|
||||
/**
|
||||
* Establish consistent measurements and spacial relationships throughout your projects by incrementing an em or rem value up or down a defined scale. We provide a list of commonly used scales as pre-defined variables.
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* // Increment two steps up the default scale
|
||||
* 'fontSize': modularScale(2)
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* // Increment two steps up the default scale
|
||||
* fontSize: ${modularScale(2)}
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* 'fontSize': '1.77689em'
|
||||
* }
|
||||
*/
|
||||
function modularScale(steps, base, ratio) {
|
||||
if (base === void 0) {
|
||||
base = '1em';
|
||||
}
|
||||
if (ratio === void 0) {
|
||||
ratio = 1.333;
|
||||
}
|
||||
if (typeof steps !== 'number') {
|
||||
throw new _errors["default"](42);
|
||||
}
|
||||
if (typeof ratio === 'string' && !ratioNames[ratio]) {
|
||||
throw new _errors["default"](43);
|
||||
}
|
||||
var _ref = typeof base === 'string' ? (0, _getValueAndUnit["default"])(base) : [base, ''],
|
||||
realBase = _ref[0],
|
||||
unit = _ref[1];
|
||||
var realRatio = typeof ratio === 'string' ? getRatio(ratio) : ratio;
|
||||
if (typeof realBase === 'string') {
|
||||
throw new _errors["default"](44, base);
|
||||
}
|
||||
return "" + realBase * Math.pow(realRatio, steps) + (unit || '');
|
||||
}
|
||||
72
VISUALIZACION/node_modules/polished/lib/helpers/modularScale.js.flow
generated
vendored
Executable file
72
VISUALIZACION/node_modules/polished/lib/helpers/modularScale.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,72 @@
|
|||
// @flow
|
||||
import getValueAndUnit from './getValueAndUnit'
|
||||
import PolishedError from '../internalHelpers/_errors'
|
||||
|
||||
import type { ModularScaleRatio } from '../types/modularScaleRatio'
|
||||
|
||||
export const ratioNames = {
|
||||
minorSecond: 1.067,
|
||||
majorSecond: 1.125,
|
||||
minorThird: 1.2,
|
||||
majorThird: 1.25,
|
||||
perfectFourth: 1.333,
|
||||
augFourth: 1.414,
|
||||
perfectFifth: 1.5,
|
||||
minorSixth: 1.6,
|
||||
goldenSection: 1.618,
|
||||
majorSixth: 1.667,
|
||||
minorSeventh: 1.778,
|
||||
majorSeventh: 1.875,
|
||||
octave: 2,
|
||||
majorTenth: 2.5,
|
||||
majorEleventh: 2.667,
|
||||
majorTwelfth: 3,
|
||||
doubleOctave: 4,
|
||||
}
|
||||
|
||||
function getRatio(ratioName: string): number {
|
||||
return ratioNames[ratioName]
|
||||
}
|
||||
|
||||
/**
|
||||
* Establish consistent measurements and spacial relationships throughout your projects by incrementing an em or rem value up or down a defined scale. We provide a list of commonly used scales as pre-defined variables.
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* // Increment two steps up the default scale
|
||||
* 'fontSize': modularScale(2)
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* // Increment two steps up the default scale
|
||||
* fontSize: ${modularScale(2)}
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* 'fontSize': '1.77689em'
|
||||
* }
|
||||
*/
|
||||
export default function modularScale(
|
||||
steps: number,
|
||||
base?: number | string = '1em',
|
||||
ratio?: ModularScaleRatio = 1.333,
|
||||
): string {
|
||||
if (typeof steps !== 'number') {
|
||||
throw new PolishedError(42)
|
||||
}
|
||||
if (typeof ratio === 'string' && !ratioNames[ratio]) {
|
||||
throw new PolishedError(43)
|
||||
}
|
||||
|
||||
const [realBase, unit] = typeof base === 'string' ? getValueAndUnit(base) : [base, '']
|
||||
const realRatio = typeof ratio === 'string' ? getRatio(ratio) : ratio
|
||||
|
||||
if (typeof realBase === 'string') {
|
||||
throw new PolishedError(44, base)
|
||||
}
|
||||
|
||||
return `${realBase * realRatio ** steps}${unit || ''}`
|
||||
}
|
||||
3
VISUALIZACION/node_modules/polished/lib/helpers/rem.d.ts
generated
vendored
Executable file
3
VISUALIZACION/node_modules/polished/lib/helpers/rem.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
declare const rem: (value: string | number, base?: string | number) => string;
|
||||
|
||||
export default rem;
|
||||
32
VISUALIZACION/node_modules/polished/lib/helpers/rem.js
generated
vendored
Executable file
32
VISUALIZACION/node_modules/polished/lib/helpers/rem.js
generated
vendored
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _pxto = _interopRequireDefault(require("../internalHelpers/_pxto"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
/**
|
||||
* Convert pixel value to rems. The default base value is 16px, but can be changed by passing a
|
||||
* second argument to the function.
|
||||
* @function
|
||||
* @param {string|number} pxval
|
||||
* @param {string|number} [base='16px']
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* 'height': rem('16px')
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* height: ${rem('16px')}
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* 'height': '1rem'
|
||||
* }
|
||||
*/
|
||||
var rem = (0, _pxto["default"])('rem');
|
||||
var _default = exports["default"] = rem;
|
||||
module.exports = exports.default;
|
||||
28
VISUALIZACION/node_modules/polished/lib/helpers/rem.js.flow
generated
vendored
Executable file
28
VISUALIZACION/node_modules/polished/lib/helpers/rem.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
// @flow
|
||||
import pixelsto from '../internalHelpers/_pxto'
|
||||
|
||||
/**
|
||||
* Convert pixel value to rems. The default base value is 16px, but can be changed by passing a
|
||||
* second argument to the function.
|
||||
* @function
|
||||
* @param {string|number} pxval
|
||||
* @param {string|number} [base='16px']
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* 'height': rem('16px')
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* height: ${rem('16px')}
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* 'height': '1rem'
|
||||
* }
|
||||
*/
|
||||
const rem: (value: string | number, base?: string | number) => string = pixelsto('rem')
|
||||
export default rem
|
||||
6
VISUALIZACION/node_modules/polished/lib/helpers/remToPx.d.ts
generated
vendored
Executable file
6
VISUALIZACION/node_modules/polished/lib/helpers/remToPx.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
declare function remToPx(
|
||||
value: string | number,
|
||||
base?: string | number,
|
||||
): string;
|
||||
|
||||
export default remToPx;
|
||||
61
VISUALIZACION/node_modules/polished/lib/helpers/remToPx.js
generated
vendored
Executable file
61
VISUALIZACION/node_modules/polished/lib/helpers/remToPx.js
generated
vendored
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = remToPx;
|
||||
var _getValueAndUnit = _interopRequireDefault(require("./getValueAndUnit"));
|
||||
var _errors = _interopRequireDefault(require("../internalHelpers/_errors"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
var defaultFontSize = 16;
|
||||
function convertBase(base) {
|
||||
var deconstructedValue = (0, _getValueAndUnit["default"])(base);
|
||||
if (deconstructedValue[1] === 'px') {
|
||||
return parseFloat(base);
|
||||
}
|
||||
if (deconstructedValue[1] === '%') {
|
||||
return parseFloat(base) / 100 * defaultFontSize;
|
||||
}
|
||||
throw new _errors["default"](78, deconstructedValue[1]);
|
||||
}
|
||||
function getBaseFromDoc() {
|
||||
/* eslint-disable */
|
||||
/* istanbul ignore next */
|
||||
if (typeof document !== 'undefined' && document.documentElement !== null) {
|
||||
var rootFontSize = getComputedStyle(document.documentElement).fontSize;
|
||||
return rootFontSize ? convertBase(rootFontSize) : defaultFontSize;
|
||||
}
|
||||
/* eslint-enable */
|
||||
/* istanbul ignore next */
|
||||
return defaultFontSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert rem values to px. By default, the base value is pulled from the font-size property on the root element (if it is set in % or px). It defaults to 16px if not found on the root. You can also override the base value by providing your own base in % or px.
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* 'height': remToPx('1.6rem')
|
||||
* 'height': remToPx('1.6rem', '10px')
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* height: ${remToPx('1.6rem')}
|
||||
* height: ${remToPx('1.6rem', '10px')}
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* 'height': '25.6px',
|
||||
* 'height': '16px',
|
||||
* }
|
||||
*/
|
||||
function remToPx(value, base) {
|
||||
var deconstructedValue = (0, _getValueAndUnit["default"])(value);
|
||||
if (deconstructedValue[1] !== 'rem' && deconstructedValue[1] !== '') {
|
||||
throw new _errors["default"](77, deconstructedValue[1]);
|
||||
}
|
||||
var newBase = base ? convertBase(base) : getBaseFromDoc();
|
||||
return deconstructedValue[0] * newBase + "px";
|
||||
}
|
||||
module.exports = exports.default;
|
||||
63
VISUALIZACION/node_modules/polished/lib/helpers/remToPx.js.flow
generated
vendored
Executable file
63
VISUALIZACION/node_modules/polished/lib/helpers/remToPx.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,63 @@
|
|||
// @flow
|
||||
import getValueAndUnit from './getValueAndUnit'
|
||||
import PolishedError from '../internalHelpers/_errors'
|
||||
|
||||
const defaultFontSize = 16
|
||||
|
||||
function convertBase(base: string | number): number {
|
||||
const deconstructedValue = getValueAndUnit(base)
|
||||
if (deconstructedValue[1] === 'px') {
|
||||
return parseFloat(base)
|
||||
}
|
||||
|
||||
if (deconstructedValue[1] === '%') {
|
||||
return (parseFloat(base) / 100) * defaultFontSize
|
||||
}
|
||||
|
||||
throw new PolishedError(78, deconstructedValue[1])
|
||||
}
|
||||
|
||||
function getBaseFromDoc(): number {
|
||||
/* eslint-disable */
|
||||
/* istanbul ignore next */
|
||||
if (typeof document !== 'undefined' && document.documentElement !== null) {
|
||||
const rootFontSize = getComputedStyle(document.documentElement).fontSize
|
||||
return rootFontSize ? convertBase(rootFontSize) : defaultFontSize
|
||||
}
|
||||
/* eslint-enable */
|
||||
/* istanbul ignore next */
|
||||
return defaultFontSize
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert rem values to px. By default, the base value is pulled from the font-size property on the root element (if it is set in % or px). It defaults to 16px if not found on the root. You can also override the base value by providing your own base in % or px.
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* 'height': remToPx('1.6rem')
|
||||
* 'height': remToPx('1.6rem', '10px')
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* height: ${remToPx('1.6rem')}
|
||||
* height: ${remToPx('1.6rem', '10px')}
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* 'height': '25.6px',
|
||||
* 'height': '16px',
|
||||
* }
|
||||
*/
|
||||
export default function remToPx(value: string | number, base?: string | number): string {
|
||||
const deconstructedValue = getValueAndUnit(value)
|
||||
|
||||
if (deconstructedValue[1] !== 'rem' && deconstructedValue[1] !== '') {
|
||||
throw new PolishedError(77, deconstructedValue[1])
|
||||
}
|
||||
|
||||
const newBase = base ? convertBase(base) : getBaseFromDoc()
|
||||
return `${deconstructedValue[0] * newBase}px`
|
||||
}
|
||||
3
VISUALIZACION/node_modules/polished/lib/helpers/stripUnit.d.ts
generated
vendored
Executable file
3
VISUALIZACION/node_modules/polished/lib/helpers/stripUnit.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
declare function stripUnit(value: string | number): string | number;
|
||||
|
||||
export default stripUnit;
|
||||
32
VISUALIZACION/node_modules/polished/lib/helpers/stripUnit.js
generated
vendored
Executable file
32
VISUALIZACION/node_modules/polished/lib/helpers/stripUnit.js
generated
vendored
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = stripUnit;
|
||||
var cssRegex = /^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;
|
||||
|
||||
/**
|
||||
* Returns a given CSS value minus its unit of measure.
|
||||
*
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* '--dimension': stripUnit('100px')
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* --dimension: ${stripUnit('100px')};
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* '--dimension': 100
|
||||
* }
|
||||
*/
|
||||
function stripUnit(value) {
|
||||
if (typeof value !== 'string') return value;
|
||||
var matchedValue = value.match(cssRegex);
|
||||
return matchedValue ? parseFloat(value) : value;
|
||||
}
|
||||
module.exports = exports.default;
|
||||
28
VISUALIZACION/node_modules/polished/lib/helpers/stripUnit.js.flow
generated
vendored
Executable file
28
VISUALIZACION/node_modules/polished/lib/helpers/stripUnit.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
// @flow
|
||||
const cssRegex = /^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/
|
||||
|
||||
/**
|
||||
* Returns a given CSS value minus its unit of measure.
|
||||
*
|
||||
* @example
|
||||
* // Styles as object usage
|
||||
* const styles = {
|
||||
* '--dimension': stripUnit('100px')
|
||||
* }
|
||||
*
|
||||
* // styled-components usage
|
||||
* const div = styled.div`
|
||||
* --dimension: ${stripUnit('100px')};
|
||||
* `
|
||||
*
|
||||
* // CSS in JS Output
|
||||
*
|
||||
* element {
|
||||
* '--dimension': 100
|
||||
* }
|
||||
*/
|
||||
export default function stripUnit(value: string | number): string | number {
|
||||
if (typeof value !== 'string') return value
|
||||
const matchedValue = value.match(cssRegex)
|
||||
return matchedValue ? parseFloat(value) : value
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue