flow like the river

This commit is contained in:
root 2025-11-07 00:06:12 +01:00
commit 013fe673f3
42435 changed files with 5764238 additions and 0 deletions

View file

@ -0,0 +1,7 @@
import { Styles } from '../types/style';
declare function animation(
...args: Array<Array<string | number> | string | number>
): Styles;
export default animation;

View file

@ -0,0 +1,65 @@
"use strict";
exports.__esModule = true;
exports["default"] = animation;
var _errors = _interopRequireDefault(require("../internalHelpers/_errors"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Shorthand for easily setting the animation property. Allows either multiple arrays with animations
* or a single animation spread over the arguments.
* @example
* // Styles as object usage
* const styles = {
* ...animation(['rotate', '1s', 'ease-in-out'], ['colorchange', '2s'])
* }
*
* // styled-components usage
* const div = styled.div`
* ${animation(['rotate', '1s', 'ease-in-out'], ['colorchange', '2s'])}
* `
*
* // CSS as JS Output
*
* div {
* 'animation': 'rotate 1s ease-in-out, colorchange 2s'
* }
* @example
* // Styles as object usage
* const styles = {
* ...animation('rotate', '1s', 'ease-in-out')
* }
*
* // styled-components usage
* const div = styled.div`
* ${animation('rotate', '1s', 'ease-in-out')}
* `
*
* // CSS as JS Output
*
* div {
* 'animation': 'rotate 1s ease-in-out'
* }
*/
function animation() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
// Allow single or multiple animations passed
var multiMode = Array.isArray(args[0]);
if (!multiMode && args.length > 8) {
throw new _errors["default"](64);
}
var code = args.map(function (arg) {
if (multiMode && !Array.isArray(arg) || !multiMode && Array.isArray(arg)) {
throw new _errors["default"](65);
}
if (Array.isArray(arg) && arg.length > 8) {
throw new _errors["default"](66);
}
return Array.isArray(arg) ? arg.join(' ') : arg;
}).join(', ');
return {
animation: code
};
}
module.exports = exports.default;

View file

@ -0,0 +1,66 @@
// @flow
import PolishedError from '../internalHelpers/_errors'
import type { Styles } from '../types/style'
/**
* Shorthand for easily setting the animation property. Allows either multiple arrays with animations
* or a single animation spread over the arguments.
* @example
* // Styles as object usage
* const styles = {
* ...animation(['rotate', '1s', 'ease-in-out'], ['colorchange', '2s'])
* }
*
* // styled-components usage
* const div = styled.div`
* ${animation(['rotate', '1s', 'ease-in-out'], ['colorchange', '2s'])}
* `
*
* // CSS as JS Output
*
* div {
* 'animation': 'rotate 1s ease-in-out, colorchange 2s'
* }
* @example
* // Styles as object usage
* const styles = {
* ...animation('rotate', '1s', 'ease-in-out')
* }
*
* // styled-components usage
* const div = styled.div`
* ${animation('rotate', '1s', 'ease-in-out')}
* `
*
* // CSS as JS Output
*
* div {
* 'animation': 'rotate 1s ease-in-out'
* }
*/
export default function animation(
...args: Array<Array<string | number> | string | number>
): Styles {
// Allow single or multiple animations passed
const multiMode = Array.isArray(args[0])
if (!multiMode && args.length > 8) {
throw new PolishedError(64)
}
const code = args
.map(arg => {
if ((multiMode && !Array.isArray(arg)) || (!multiMode && Array.isArray(arg))) {
throw new PolishedError(65)
}
if (Array.isArray(arg) && arg.length > 8) {
throw new PolishedError(66)
}
return Array.isArray(arg) ? arg.join(' ') : arg
})
.join(', ')
return {
animation: code,
}
}

View file

@ -0,0 +1,5 @@
import { Styles } from '../types/style';
declare function backgroundImages(...properties: Array<string>): Styles;
export default backgroundImages;

View file

@ -0,0 +1,32 @@
"use strict";
exports.__esModule = true;
exports["default"] = backgroundImages;
/**
* Shorthand that accepts any number of backgroundImage values as parameters for creating a single background statement.
* @example
* // Styles as object usage
* const styles = {
* ...backgroundImages('url("/image/background.jpg")', 'linear-gradient(red, green)')
* }
*
* // styled-components usage
* const div = styled.div`
* ${backgroundImages('url("/image/background.jpg")', 'linear-gradient(red, green)')}
* `
*
* // CSS as JS Output
*
* div {
* 'backgroundImage': 'url("/image/background.jpg"), linear-gradient(red, green)'
* }
*/
function backgroundImages() {
for (var _len = arguments.length, properties = new Array(_len), _key = 0; _key < _len; _key++) {
properties[_key] = arguments[_key];
}
return {
backgroundImage: properties.join(', ')
};
}
module.exports = exports.default;

View file

@ -0,0 +1,27 @@
// @flow
import type { Styles } from '../types/style'
/**
* Shorthand that accepts any number of backgroundImage values as parameters for creating a single background statement.
* @example
* // Styles as object usage
* const styles = {
* ...backgroundImages('url("/image/background.jpg")', 'linear-gradient(red, green)')
* }
*
* // styled-components usage
* const div = styled.div`
* ${backgroundImages('url("/image/background.jpg")', 'linear-gradient(red, green)')}
* `
*
* // CSS as JS Output
*
* div {
* 'backgroundImage': 'url("/image/background.jpg"), linear-gradient(red, green)'
* }
*/
export default function backgroundImages(...properties: Array<string>): Styles {
return {
backgroundImage: properties.join(', '),
}
}

View file

@ -0,0 +1,5 @@
import { Styles } from '../types/style';
declare function backgrounds(...properties: Array<string>): Styles;
export default backgrounds;

View file

@ -0,0 +1,32 @@
"use strict";
exports.__esModule = true;
exports["default"] = backgrounds;
/**
* Shorthand that accepts any number of background values as parameters for creating a single background statement.
* @example
* // Styles as object usage
* const styles = {
* ...backgrounds('url("/image/background.jpg")', 'linear-gradient(red, green)', 'center no-repeat')
* }
*
* // styled-components usage
* const div = styled.div`
* ${backgrounds('url("/image/background.jpg")', 'linear-gradient(red, green)', 'center no-repeat')}
* `
*
* // CSS as JS Output
*
* div {
* 'background': 'url("/image/background.jpg"), linear-gradient(red, green), center no-repeat'
* }
*/
function backgrounds() {
for (var _len = arguments.length, properties = new Array(_len), _key = 0; _key < _len; _key++) {
properties[_key] = arguments[_key];
}
return {
background: properties.join(', ')
};
}
module.exports = exports.default;

View file

@ -0,0 +1,27 @@
// @flow
import type { Styles } from '../types/style'
/**
* Shorthand that accepts any number of background values as parameters for creating a single background statement.
* @example
* // Styles as object usage
* const styles = {
* ...backgrounds('url("/image/background.jpg")', 'linear-gradient(red, green)', 'center no-repeat')
* }
*
* // styled-components usage
* const div = styled.div`
* ${backgrounds('url("/image/background.jpg")', 'linear-gradient(red, green)', 'center no-repeat')}
* `
*
* // CSS as JS Output
*
* div {
* 'background': 'url("/image/background.jpg"), linear-gradient(red, green), center no-repeat'
* }
*/
export default function backgrounds(...properties: Array<string>): Styles {
return {
background: properties.join(', '),
}
}

View file

@ -0,0 +1,9 @@
import { SideKeyword } from '../types/sideKeyword';
import { Styles } from '../types/style';
declare function border(
sideKeyword: SideKeyword | string | number,
...values: Array<string | number>
): Styles;
export default border;

66
VISUALIZACION/node_modules/polished/lib/shorthands/border.js generated vendored Executable file
View file

@ -0,0 +1,66 @@
"use strict";
exports.__esModule = true;
exports["default"] = border;
var _capitalizeString = _interopRequireDefault(require("../internalHelpers/_capitalizeString"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var sideMap = ['top', 'right', 'bottom', 'left'];
/**
* Shorthand for the border property that splits out individual properties for use with tools like Fela and Styletron. A side keyword can optionally be passed to target only one side's border properties.
*
* @example
* // Styles as object usage
* const styles = {
* ...border('1px', 'solid', 'red')
* }
*
* // styled-components usage
* const div = styled.div`
* ${border('1px', 'solid', 'red')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderColor': 'red',
* 'borderStyle': 'solid',
* 'borderWidth': `1px`,
* }
*
* // Styles as object usage
* const styles = {
* ...border('top', '1px', 'solid', 'red')
* }
*
* // styled-components usage
* const div = styled.div`
* ${border('top', '1px', 'solid', 'red')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopColor': 'red',
* 'borderTopStyle': 'solid',
* 'borderTopWidth': `1px`,
* }
*/
function border(sideKeyword) {
for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
values[_key - 1] = arguments[_key];
}
if (typeof sideKeyword === 'string' && sideMap.indexOf(sideKeyword) >= 0) {
var _ref;
return _ref = {}, _ref["border" + (0, _capitalizeString["default"])(sideKeyword) + "Width"] = values[0], _ref["border" + (0, _capitalizeString["default"])(sideKeyword) + "Style"] = values[1], _ref["border" + (0, _capitalizeString["default"])(sideKeyword) + "Color"] = values[2], _ref;
} else {
values.unshift(sideKeyword);
return {
borderWidth: values[0],
borderStyle: values[1],
borderColor: values[2]
};
}
}
module.exports = exports.default;

View file

@ -0,0 +1,68 @@
// @flow
import capitalizeString from '../internalHelpers/_capitalizeString'
import type { SideKeyword } from '../types/sideKeyword'
import type { Styles } from '../types/style'
const sideMap = ['top', 'right', 'bottom', 'left']
/**
* Shorthand for the border property that splits out individual properties for use with tools like Fela and Styletron. A side keyword can optionally be passed to target only one side's border properties.
*
* @example
* // Styles as object usage
* const styles = {
* ...border('1px', 'solid', 'red')
* }
*
* // styled-components usage
* const div = styled.div`
* ${border('1px', 'solid', 'red')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderColor': 'red',
* 'borderStyle': 'solid',
* 'borderWidth': `1px`,
* }
*
* // Styles as object usage
* const styles = {
* ...border('top', '1px', 'solid', 'red')
* }
*
* // styled-components usage
* const div = styled.div`
* ${border('top', '1px', 'solid', 'red')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopColor': 'red',
* 'borderTopStyle': 'solid',
* 'borderTopWidth': `1px`,
* }
*/
export default function border(
sideKeyword: SideKeyword | string | number,
...values: Array<string | number>
): Styles {
if (typeof sideKeyword === 'string' && sideMap.indexOf(sideKeyword) >= 0) {
return {
[`border${capitalizeString(sideKeyword)}Width`]: values[0],
[`border${capitalizeString(sideKeyword)}Style`]: values[1],
[`border${capitalizeString(sideKeyword)}Color`]: values[2],
}
} else {
values.unshift(sideKeyword)
return {
borderWidth: values[0],
borderStyle: values[1],
borderColor: values[2],
}
}
}

View file

@ -0,0 +1,5 @@
import { Styles } from '../types/style';
declare function borderColor(...values: Array<null | void | string>): Styles;
export default borderColor;

View file

@ -0,0 +1,35 @@
"use strict";
exports.__esModule = true;
exports["default"] = borderColor;
var _directionalProperty = _interopRequireDefault(require("../helpers/directionalProperty"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...borderColor('red', 'green', 'blue', 'yellow')
* }
*
* // styled-components usage
* const div = styled.div`
* ${borderColor('red', 'green', 'blue', 'yellow')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopColor': 'red',
* 'borderRightColor': 'green',
* 'borderBottomColor': 'blue',
* 'borderLeftColor': 'yellow'
* }
*/
function borderColor() {
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
values[_key] = arguments[_key];
}
return _directionalProperty["default"].apply(void 0, ['borderColor'].concat(values));
}
module.exports = exports.default;

View file

@ -0,0 +1,30 @@
// @flow
import directionalProperty from '../helpers/directionalProperty'
import type { Styles } from '../types/style'
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...borderColor('red', 'green', 'blue', 'yellow')
* }
*
* // styled-components usage
* const div = styled.div`
* ${borderColor('red', 'green', 'blue', 'yellow')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopColor': 'red',
* 'borderRightColor': 'green',
* 'borderBottomColor': 'blue',
* 'borderLeftColor': 'yellow'
* }
*/
export default function borderColor(...values: Array<?string>): Styles {
return directionalProperty('borderColor', ...values)
}

View file

@ -0,0 +1,5 @@
import { Styles } from '../types/style';
declare function borderRadius(side: string, radius: string | number): Styles;
export default borderRadius;

View file

@ -0,0 +1,43 @@
"use strict";
exports.__esModule = true;
exports["default"] = borderRadius;
var _capitalizeString = _interopRequireDefault(require("../internalHelpers/_capitalizeString"));
var _errors = _interopRequireDefault(require("../internalHelpers/_errors"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Shorthand that accepts a value for side and a value for radius and applies the radius value to both corners of the side.
* @example
* // Styles as object usage
* const styles = {
* ...borderRadius('top', '5px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${borderRadius('top', '5px')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopRightRadius': '5px',
* 'borderTopLeftRadius': '5px',
* }
*/
function borderRadius(side, radius) {
var uppercaseSide = (0, _capitalizeString["default"])(side);
if (!radius && radius !== 0) {
throw new _errors["default"](62);
}
if (uppercaseSide === 'Top' || uppercaseSide === 'Bottom') {
var _ref;
return _ref = {}, _ref["border" + uppercaseSide + "RightRadius"] = radius, _ref["border" + uppercaseSide + "LeftRadius"] = radius, _ref;
}
if (uppercaseSide === 'Left' || uppercaseSide === 'Right') {
var _ref2;
return _ref2 = {}, _ref2["borderTop" + uppercaseSide + "Radius"] = radius, _ref2["borderBottom" + uppercaseSide + "Radius"] = radius, _ref2;
}
throw new _errors["default"](63);
}
module.exports = exports.default;

View file

@ -0,0 +1,47 @@
// @flow
import capitalizeString from '../internalHelpers/_capitalizeString'
import PolishedError from '../internalHelpers/_errors'
import type { Styles } from '../types/style'
/**
* Shorthand that accepts a value for side and a value for radius and applies the radius value to both corners of the side.
* @example
* // Styles as object usage
* const styles = {
* ...borderRadius('top', '5px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${borderRadius('top', '5px')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopRightRadius': '5px',
* 'borderTopLeftRadius': '5px',
* }
*/
export default function borderRadius(side: string, radius: string | number): Styles {
const uppercaseSide = capitalizeString(side)
if (!radius && radius !== 0) {
throw new PolishedError(62)
}
if (uppercaseSide === 'Top' || uppercaseSide === 'Bottom') {
return {
[`border${uppercaseSide}RightRadius`]: radius,
[`border${uppercaseSide}LeftRadius`]: radius,
}
}
if (uppercaseSide === 'Left' || uppercaseSide === 'Right') {
return {
[`borderTop${uppercaseSide}Radius`]: radius,
[`borderBottom${uppercaseSide}Radius`]: radius,
}
}
throw new PolishedError(63)
}

View file

@ -0,0 +1,5 @@
import { Styles } from '../types/style';
declare function borderStyle(...values: Array<null | void | string>): Styles;
export default borderStyle;

View file

@ -0,0 +1,35 @@
"use strict";
exports.__esModule = true;
exports["default"] = borderStyle;
var _directionalProperty = _interopRequireDefault(require("../helpers/directionalProperty"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...borderStyle('solid', 'dashed', 'dotted', 'double')
* }
*
* // styled-components usage
* const div = styled.div`
* ${borderStyle('solid', 'dashed', 'dotted', 'double')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopStyle': 'solid',
* 'borderRightStyle': 'dashed',
* 'borderBottomStyle': 'dotted',
* 'borderLeftStyle': 'double'
* }
*/
function borderStyle() {
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
values[_key] = arguments[_key];
}
return _directionalProperty["default"].apply(void 0, ['borderStyle'].concat(values));
}
module.exports = exports.default;

View file

@ -0,0 +1,30 @@
// @flow
import directionalProperty from '../helpers/directionalProperty'
import type { Styles } from '../types/style'
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...borderStyle('solid', 'dashed', 'dotted', 'double')
* }
*
* // styled-components usage
* const div = styled.div`
* ${borderStyle('solid', 'dashed', 'dotted', 'double')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopStyle': 'solid',
* 'borderRightStyle': 'dashed',
* 'borderBottomStyle': 'dotted',
* 'borderLeftStyle': 'double'
* }
*/
export default function borderStyle(...values: Array<?string>): Styles {
return directionalProperty('borderStyle', ...values)
}

View file

@ -0,0 +1,7 @@
import { Styles } from '../types/style';
declare function borderWidth(
...values: Array<null | void | string | null | void | number>
): Styles;
export default borderWidth;

View file

@ -0,0 +1,35 @@
"use strict";
exports.__esModule = true;
exports["default"] = borderWidth;
var _directionalProperty = _interopRequireDefault(require("../helpers/directionalProperty"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...borderWidth('12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${borderWidth('12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopWidth': '12px',
* 'borderRightWidth': '24px',
* 'borderBottomWidth': '36px',
* 'borderLeftWidth': '48px'
* }
*/
function borderWidth() {
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
values[_key] = arguments[_key];
}
return _directionalProperty["default"].apply(void 0, ['borderWidth'].concat(values));
}
module.exports = exports.default;

View file

@ -0,0 +1,30 @@
// @flow
import directionalProperty from '../helpers/directionalProperty'
import type { Styles } from '../types/style'
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...borderWidth('12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${borderWidth('12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopWidth': '12px',
* 'borderRightWidth': '24px',
* 'borderBottomWidth': '36px',
* 'borderLeftWidth': '48px'
* }
*/
export default function borderWidth(...values: Array<?string | ?number>): Styles {
return directionalProperty('borderWidth', ...values)
}

View file

@ -0,0 +1,5 @@
import { InteractionState } from '../types/interactionState';
declare function buttons(...states: Array<InteractionState>): string;
export default buttons;

View file

@ -0,0 +1,44 @@
"use strict";
exports.__esModule = true;
exports["default"] = buttons;
var _statefulSelectors = _interopRequireDefault(require("../internalHelpers/_statefulSelectors"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var stateMap = [undefined, null, 'active', 'focus', 'hover'];
function template(state) {
return "button" + state + ",\n input[type=\"button\"]" + state + ",\n input[type=\"reset\"]" + state + ",\n input[type=\"submit\"]" + state;
}
/**
* Populates selectors that target all buttons. You can pass optional states to append to the selectors.
* @example
* // Styles as object usage
* const styles = {
* [buttons('active')]: {
* 'border': 'none'
* }
* }
*
* // styled-components usage
* const div = styled.div`
* > ${buttons('active')} {
* border: none;
* }
* `
*
* // CSS in JS Output
*
* 'button:active,
* 'input[type="button"]:active,
* 'input[type=\"reset\"]:active,
* 'input[type=\"submit\"]:active: {
* 'border': 'none'
* }
*/
function buttons() {
for (var _len = arguments.length, states = new Array(_len), _key = 0; _key < _len; _key++) {
states[_key] = arguments[_key];
}
return (0, _statefulSelectors["default"])(states, template, stateMap);
}
module.exports = exports.default;

View file

@ -0,0 +1,43 @@
// @flow
import statefulSelectors from '../internalHelpers/_statefulSelectors'
import type { InteractionState } from '../types/interactionState'
const stateMap = [undefined, null, 'active', 'focus', 'hover']
function template(state: string): string {
return `button${state},
input[type="button"]${state},
input[type="reset"]${state},
input[type="submit"]${state}`
}
/**
* Populates selectors that target all buttons. You can pass optional states to append to the selectors.
* @example
* // Styles as object usage
* const styles = {
* [buttons('active')]: {
* 'border': 'none'
* }
* }
*
* // styled-components usage
* const div = styled.div`
* > ${buttons('active')} {
* border: none;
* }
* `
*
* // CSS in JS Output
*
* 'button:active,
* 'input[type="button"]:active,
* 'input[type=\"reset\"]:active,
* 'input[type=\"submit\"]:active: {
* 'border': 'none'
* }
*/
export default function buttons(...states: Array<InteractionState>): string {
return statefulSelectors(states, template, stateMap)
}

View file

@ -0,0 +1,7 @@
import { Styles } from '../types/style';
declare function margin(
...values: Array<null | void | string | null | void | number>
): Styles;
export default margin;

35
VISUALIZACION/node_modules/polished/lib/shorthands/margin.js generated vendored Executable file
View file

@ -0,0 +1,35 @@
"use strict";
exports.__esModule = true;
exports["default"] = margin;
var _directionalProperty = _interopRequireDefault(require("../helpers/directionalProperty"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...margin('12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${margin('12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'marginTop': '12px',
* 'marginRight': '24px',
* 'marginBottom': '36px',
* 'marginLeft': '48px'
* }
*/
function margin() {
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
values[_key] = arguments[_key];
}
return _directionalProperty["default"].apply(void 0, ['margin'].concat(values));
}
module.exports = exports.default;

View file

@ -0,0 +1,30 @@
// @flow
import directionalProperty from '../helpers/directionalProperty'
import type { Styles } from '../types/style'
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...margin('12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${margin('12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'marginTop': '12px',
* 'marginRight': '24px',
* 'marginBottom': '36px',
* 'marginLeft': '48px'
* }
*/
export default function margin(...values: Array<?string | ?number>): Styles {
return directionalProperty('margin', ...values)
}

View file

@ -0,0 +1,7 @@
import { Styles } from '../types/style';
declare function padding(
...values: Array<null | void | string | null | void | number>
): Styles;
export default padding;

View file

@ -0,0 +1,35 @@
"use strict";
exports.__esModule = true;
exports["default"] = padding;
var _directionalProperty = _interopRequireDefault(require("../helpers/directionalProperty"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...padding('12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${padding('12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'paddingTop': '12px',
* 'paddingRight': '24px',
* 'paddingBottom': '36px',
* 'paddingLeft': '48px'
* }
*/
function padding() {
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
values[_key] = arguments[_key];
}
return _directionalProperty["default"].apply(void 0, ['padding'].concat(values));
}
module.exports = exports.default;

View file

@ -0,0 +1,30 @@
// @flow
import directionalProperty from '../helpers/directionalProperty'
import type { Styles } from '../types/style'
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...padding('12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${padding('12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'paddingTop': '12px',
* 'paddingRight': '24px',
* 'paddingBottom': '36px',
* 'paddingLeft': '48px'
* }
*/
export default function padding(...values: Array<?string | ?number>): Styles {
return directionalProperty('padding', ...values)
}

View file

@ -0,0 +1,8 @@
import { Styles } from '../types/style';
declare function position(
firstValue: string | number | null,
...values: Array<null | void | string | null | void | number>
): Styles;
export default position;

View file

@ -0,0 +1,64 @@
"use strict";
exports.__esModule = true;
exports["default"] = position;
var _directionalProperty = _interopRequireDefault(require("../helpers/directionalProperty"));
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 positionMap = ['absolute', 'fixed', 'relative', 'static', 'sticky'];
/**
* Shorthand accepts up to five values, including null to skip a value, and maps them to their respective directions. The first value can optionally be a position keyword.
* @example
* // Styles as object usage
* const styles = {
* ...position('12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${position('12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'top': '12px',
* 'right': '24px',
* 'bottom': '36px',
* 'left': '48px'
* }
*
* // Styles as object usage
* const styles = {
* ...position('absolute', '12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${position('absolute', '12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'position': 'absolute',
* 'top': '12px',
* 'right': '24px',
* 'bottom': '36px',
* 'left': '48px'
* }
*/
function position(firstValue) {
for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
values[_key - 1] = arguments[_key];
}
if (positionMap.indexOf(firstValue) >= 0 && firstValue) {
return _extends({}, _directionalProperty["default"].apply(void 0, [''].concat(values)), {
position: firstValue
});
} else {
return _directionalProperty["default"].apply(void 0, ['', firstValue].concat(values));
}
}
module.exports = exports.default;

View file

@ -0,0 +1,62 @@
// @flow
import directionalProperty from '../helpers/directionalProperty'
import type { Styles } from '../types/style'
const positionMap = ['absolute', 'fixed', 'relative', 'static', 'sticky']
/**
* Shorthand accepts up to five values, including null to skip a value, and maps them to their respective directions. The first value can optionally be a position keyword.
* @example
* // Styles as object usage
* const styles = {
* ...position('12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${position('12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'top': '12px',
* 'right': '24px',
* 'bottom': '36px',
* 'left': '48px'
* }
*
* // Styles as object usage
* const styles = {
* ...position('absolute', '12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${position('absolute', '12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'position': 'absolute',
* 'top': '12px',
* 'right': '24px',
* 'bottom': '36px',
* 'left': '48px'
* }
*/
export default function position(
firstValue?: string | number | null,
...values: Array<?string | ?number>
): Styles {
if (positionMap.indexOf(firstValue) >= 0 && firstValue) {
return {
...directionalProperty('', ...values),
position: firstValue,
}
} else {
return directionalProperty('', firstValue, ...values)
}
}

View file

@ -0,0 +1,5 @@
import { Styles } from '../types/style';
declare function size(height: string | number, width?: string | number): Styles;
export default size;

34
VISUALIZACION/node_modules/polished/lib/shorthands/size.js generated vendored Executable file
View file

@ -0,0 +1,34 @@
"use strict";
exports.__esModule = true;
exports["default"] = size;
/**
* Shorthand to set the height and width properties in a single statement.
* @example
* // Styles as object usage
* const styles = {
* ...size('300px', '250px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${size('300px', '250px')}
* `
*
* // CSS as JS Output
*
* div {
* 'height': '300px',
* 'width': '250px',
* }
*/
function size(height, width) {
if (width === void 0) {
width = height;
}
return {
height: height,
width: width
};
}
module.exports = exports.default;

View file

@ -0,0 +1,29 @@
// @flow
import type { Styles } from '../types/style'
/**
* Shorthand to set the height and width properties in a single statement.
* @example
* // Styles as object usage
* const styles = {
* ...size('300px', '250px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${size('300px', '250px')}
* `
*
* // CSS as JS Output
*
* div {
* 'height': '300px',
* 'width': '250px',
* }
*/
export default function size(height: string | number, width?: string | number = height): Styles {
return {
height,
width,
}
}

View file

@ -0,0 +1,5 @@
import { InteractionState } from '../types/interactionState';
declare function textInputs(...states: Array<InteractionState>): string;
export default textInputs;

View file

@ -0,0 +1,56 @@
"use strict";
exports.__esModule = true;
exports["default"] = textInputs;
var _statefulSelectors = _interopRequireDefault(require("../internalHelpers/_statefulSelectors"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var stateMap = [undefined, null, 'active', 'focus', 'hover'];
function template(state) {
return "input[type=\"color\"]" + state + ",\n input[type=\"date\"]" + state + ",\n input[type=\"datetime\"]" + state + ",\n input[type=\"datetime-local\"]" + state + ",\n input[type=\"email\"]" + state + ",\n input[type=\"month\"]" + state + ",\n input[type=\"number\"]" + state + ",\n input[type=\"password\"]" + state + ",\n input[type=\"search\"]" + state + ",\n input[type=\"tel\"]" + state + ",\n input[type=\"text\"]" + state + ",\n input[type=\"time\"]" + state + ",\n input[type=\"url\"]" + state + ",\n input[type=\"week\"]" + state + ",\n input:not([type])" + state + ",\n textarea" + state;
}
/**
* Populates selectors that target all text inputs. You can pass optional states to append to the selectors.
* @example
* // Styles as object usage
* const styles = {
* [textInputs('active')]: {
* 'border': 'none'
* }
* }
*
* // styled-components usage
* const div = styled.div`
* > ${textInputs('active')} {
* border: none;
* }
* `
*
* // CSS in JS Output
*
* 'input[type="color"]:active,
* input[type="date"]:active,
* input[type="datetime"]:active,
* input[type="datetime-local"]:active,
* input[type="email"]:active,
* input[type="month"]:active,
* input[type="number"]:active,
* input[type="password"]:active,
* input[type="search"]:active,
* input[type="tel"]:active,
* input[type="text"]:active,
* input[type="time"]:active,
* input[type="url"]:active,
* input[type="week"]:active,
* input:not([type]):active,
* textarea:active': {
* 'border': 'none'
* }
*/
function textInputs() {
for (var _len = arguments.length, states = new Array(_len), _key = 0; _key < _len; _key++) {
states[_key] = arguments[_key];
}
return (0, _statefulSelectors["default"])(states, template, stateMap);
}
module.exports = exports.default;

View file

@ -0,0 +1,67 @@
// @flow
import statefulSelectors from '../internalHelpers/_statefulSelectors'
import type { InteractionState } from '../types/interactionState'
const stateMap = [undefined, null, 'active', 'focus', 'hover']
function template(state: string): string {
return `input[type="color"]${state},
input[type="date"]${state},
input[type="datetime"]${state},
input[type="datetime-local"]${state},
input[type="email"]${state},
input[type="month"]${state},
input[type="number"]${state},
input[type="password"]${state},
input[type="search"]${state},
input[type="tel"]${state},
input[type="text"]${state},
input[type="time"]${state},
input[type="url"]${state},
input[type="week"]${state},
input:not([type])${state},
textarea${state}`
}
/**
* Populates selectors that target all text inputs. You can pass optional states to append to the selectors.
* @example
* // Styles as object usage
* const styles = {
* [textInputs('active')]: {
* 'border': 'none'
* }
* }
*
* // styled-components usage
* const div = styled.div`
* > ${textInputs('active')} {
* border: none;
* }
* `
*
* // CSS in JS Output
*
* 'input[type="color"]:active,
* input[type="date"]:active,
* input[type="datetime"]:active,
* input[type="datetime-local"]:active,
* input[type="email"]:active,
* input[type="month"]:active,
* input[type="number"]:active,
* input[type="password"]:active,
* input[type="search"]:active,
* input[type="tel"]:active,
* input[type="text"]:active,
* input[type="time"]:active,
* input[type="url"]:active,
* input[type="week"]:active,
* input:not([type]):active,
* textarea:active': {
* 'border': 'none'
* }
*/
export default function textInputs(...states: Array<InteractionState>): string {
return statefulSelectors(states, template, stateMap)
}

View file

@ -0,0 +1,7 @@
import { Styles } from '../types/style';
declare function transitions(
...properties: Array<string | Array<string>>
): Styles;
export default transitions;

View file

@ -0,0 +1,50 @@
"use strict";
exports.__esModule = true;
exports["default"] = transitions;
var _errors = _interopRequireDefault(require("../internalHelpers/_errors"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Accepts any number of transition values as parameters for creating a single transition statement. You may also pass an array of properties as the first parameter that you would like to apply the same transition values to (second parameter).
* @example
* // Styles as object usage
* const styles = {
* ...transitions('opacity 1.0s ease-in 0s', 'width 2.0s ease-in 2s'),
* ...transitions(['color', 'background-color'], '2.0s ease-in 2s')
* }
*
* // styled-components usage
* const div = styled.div`
* ${transitions('opacity 1.0s ease-in 0s', 'width 2.0s ease-in 2s')};
* ${transitions(['color', 'background-color'], '2.0s ease-in 2s'),};
* `
*
* // CSS as JS Output
*
* div {
* 'transition': 'opacity 1.0s ease-in 0s, width 2.0s ease-in 2s'
* 'transition': 'color 2.0s ease-in 2s, background-color 2.0s ease-in 2s',
* }
*/
function transitions() {
for (var _len = arguments.length, properties = new Array(_len), _key = 0; _key < _len; _key++) {
properties[_key] = arguments[_key];
}
if (Array.isArray(properties[0]) && properties.length === 2) {
var value = properties[1];
if (typeof value !== 'string') {
throw new _errors["default"](61);
}
var transitionsString = properties[0].map(function (property) {
return property + " " + value;
}).join(', ');
return {
transition: transitionsString
};
} else {
return {
transition: properties.join(', ')
};
}
}
module.exports = exports.default;

View file

@ -0,0 +1,44 @@
// @flow
import type { Styles } from '../types/style'
import PolishedError from '../internalHelpers/_errors'
/**
* Accepts any number of transition values as parameters for creating a single transition statement. You may also pass an array of properties as the first parameter that you would like to apply the same transition values to (second parameter).
* @example
* // Styles as object usage
* const styles = {
* ...transitions('opacity 1.0s ease-in 0s', 'width 2.0s ease-in 2s'),
* ...transitions(['color', 'background-color'], '2.0s ease-in 2s')
* }
*
* // styled-components usage
* const div = styled.div`
* ${transitions('opacity 1.0s ease-in 0s', 'width 2.0s ease-in 2s')};
* ${transitions(['color', 'background-color'], '2.0s ease-in 2s'),};
* `
*
* // CSS as JS Output
*
* div {
* 'transition': 'opacity 1.0s ease-in 0s, width 2.0s ease-in 2s'
* 'transition': 'color 2.0s ease-in 2s, background-color 2.0s ease-in 2s',
* }
*/
export default function transitions(...properties: Array<string | Array<string>>): Styles {
if (Array.isArray(properties[0]) && properties.length === 2) {
const value = properties[1]
if (typeof value !== 'string') {
throw new PolishedError(61)
}
const transitionsString = properties[0]
.map((property: string): string => `${property} ${value}`)
.join(', ')
return {
transition: transitionsString,
}
} else {
return {
transition: properties.join(', '),
}
}
}