Security upgrades
This commit is contained in:
8
node_modules/jss-plugin-default-unit/LICENSE
generated
vendored
Normal file
8
node_modules/jss-plugin-default-unit/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2014-present Oleg Isonen (Slobodskoi) & contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
2422
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.bundle.js
generated
vendored
Normal file
2422
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.bundle.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
217
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.cjs.js
generated
vendored
Normal file
217
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,217 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var jss = require('jss');
|
||||
|
||||
var px = jss.hasCSSTOMSupport && CSS ? CSS.px : 'px';
|
||||
var ms = jss.hasCSSTOMSupport && CSS ? CSS.ms : 'ms';
|
||||
var percent = jss.hasCSSTOMSupport && CSS ? CSS.percent : '%';
|
||||
/**
|
||||
* Generated jss-plugin-default-unit CSS property units
|
||||
*
|
||||
* @type object
|
||||
*/
|
||||
|
||||
var defaultUnits = {
|
||||
// Animation properties
|
||||
'animation-delay': ms,
|
||||
'animation-duration': ms,
|
||||
// Background properties
|
||||
'background-position': px,
|
||||
'background-position-x': px,
|
||||
'background-position-y': px,
|
||||
'background-size': px,
|
||||
// Border Properties
|
||||
border: px,
|
||||
'border-bottom': px,
|
||||
'border-bottom-left-radius': px,
|
||||
'border-bottom-right-radius': px,
|
||||
'border-bottom-width': px,
|
||||
'border-left': px,
|
||||
'border-left-width': px,
|
||||
'border-radius': px,
|
||||
'border-right': px,
|
||||
'border-right-width': px,
|
||||
'border-top': px,
|
||||
'border-top-left-radius': px,
|
||||
'border-top-right-radius': px,
|
||||
'border-top-width': px,
|
||||
'border-width': px,
|
||||
// Margin properties
|
||||
margin: px,
|
||||
'margin-bottom': px,
|
||||
'margin-left': px,
|
||||
'margin-right': px,
|
||||
'margin-top': px,
|
||||
// Padding properties
|
||||
padding: px,
|
||||
'padding-bottom': px,
|
||||
'padding-left': px,
|
||||
'padding-right': px,
|
||||
'padding-top': px,
|
||||
// Mask properties
|
||||
'mask-position-x': px,
|
||||
'mask-position-y': px,
|
||||
'mask-size': px,
|
||||
// Width and height properties
|
||||
height: px,
|
||||
width: px,
|
||||
'min-height': px,
|
||||
'max-height': px,
|
||||
'min-width': px,
|
||||
'max-width': px,
|
||||
// Position properties
|
||||
bottom: px,
|
||||
left: px,
|
||||
top: px,
|
||||
right: px,
|
||||
// Shadow properties
|
||||
'box-shadow': px,
|
||||
'text-shadow': px,
|
||||
// Column properties
|
||||
'column-gap': px,
|
||||
'column-rule': px,
|
||||
'column-rule-width': px,
|
||||
'column-width': px,
|
||||
// Font and text properties
|
||||
'font-size': px,
|
||||
'font-size-delta': px,
|
||||
'letter-spacing': px,
|
||||
'text-indent': px,
|
||||
'text-stroke': px,
|
||||
'text-stroke-width': px,
|
||||
'word-spacing': px,
|
||||
// Motion properties
|
||||
motion: px,
|
||||
'motion-offset': px,
|
||||
// Outline properties
|
||||
outline: px,
|
||||
'outline-offset': px,
|
||||
'outline-width': px,
|
||||
// Perspective properties
|
||||
perspective: px,
|
||||
'perspective-origin-x': percent,
|
||||
'perspective-origin-y': percent,
|
||||
// Transform properties
|
||||
'transform-origin': percent,
|
||||
'transform-origin-x': percent,
|
||||
'transform-origin-y': percent,
|
||||
'transform-origin-z': percent,
|
||||
// Transition properties
|
||||
'transition-delay': ms,
|
||||
'transition-duration': ms,
|
||||
// Alignment properties
|
||||
'vertical-align': px,
|
||||
'flex-basis': px,
|
||||
// Some random properties
|
||||
'shape-margin': px,
|
||||
size: px,
|
||||
// Grid properties
|
||||
grid: px,
|
||||
'grid-gap': px,
|
||||
'grid-row-gap': px,
|
||||
'grid-column-gap': px,
|
||||
'grid-template-rows': px,
|
||||
'grid-template-columns': px,
|
||||
'grid-auto-rows': px,
|
||||
'grid-auto-columns': px,
|
||||
// Not existing properties.
|
||||
// Used to avoid issues with jss-plugin-expand integration.
|
||||
'box-shadow-x': px,
|
||||
'box-shadow-y': px,
|
||||
'box-shadow-blur': px,
|
||||
'box-shadow-spread': px,
|
||||
'font-line-height': px,
|
||||
'text-shadow-x': px,
|
||||
'text-shadow-y': px,
|
||||
'text-shadow-blur': px
|
||||
};
|
||||
|
||||
/**
|
||||
* Clones the object and adds a camel cased property version.
|
||||
*/
|
||||
function addCamelCasedVersion(obj) {
|
||||
var regExp = /(-[a-z])/g;
|
||||
|
||||
var replace = function replace(str) {
|
||||
return str[1].toUpperCase();
|
||||
};
|
||||
|
||||
var newObj = {};
|
||||
|
||||
for (var _key in obj) {
|
||||
newObj[_key] = obj[_key];
|
||||
newObj[_key.replace(regExp, replace)] = obj[_key];
|
||||
}
|
||||
|
||||
return newObj;
|
||||
}
|
||||
|
||||
var units = addCamelCasedVersion(defaultUnits);
|
||||
/**
|
||||
* Recursive deep style passing function
|
||||
*/
|
||||
|
||||
function iterate(prop, value, options) {
|
||||
if (!value) return value;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
value[i] = iterate(prop, value[i], options);
|
||||
}
|
||||
} else if (typeof value === 'object') {
|
||||
if (prop === 'fallbacks') {
|
||||
for (var innerProp in value) {
|
||||
value[innerProp] = iterate(innerProp, value[innerProp], options);
|
||||
}
|
||||
} else {
|
||||
for (var _innerProp in value) {
|
||||
value[_innerProp] = iterate(prop + "-" + _innerProp, value[_innerProp], options);
|
||||
}
|
||||
}
|
||||
} else if (typeof value === 'number') {
|
||||
var unit = options[prop] || units[prop];
|
||||
|
||||
if (unit) {
|
||||
return typeof unit === 'function' ? unit(value).toString() : "" + value + unit;
|
||||
}
|
||||
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* Add unit to numeric values.
|
||||
*/
|
||||
|
||||
|
||||
function defaultUnit(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var camelCasedOptions = addCamelCasedVersion(options);
|
||||
|
||||
function onProcessStyle(style, rule) {
|
||||
if (rule.type !== 'style') return style;
|
||||
|
||||
for (var prop in style) {
|
||||
style[prop] = iterate(prop, style[prop], camelCasedOptions);
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
function onChangeValue(value, prop) {
|
||||
return iterate(prop, value, camelCasedOptions);
|
||||
}
|
||||
|
||||
return {
|
||||
onProcessStyle: onProcessStyle,
|
||||
onChangeValue: onChangeValue
|
||||
};
|
||||
}
|
||||
|
||||
exports.default = defaultUnit;
|
||||
3
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.cjs.js.flow
generated
vendored
Normal file
3
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.cjs.js.flow
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
// @flow
|
||||
|
||||
export * from '../src';
|
||||
213
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.esm.js
generated
vendored
Normal file
213
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.esm.js
generated
vendored
Normal file
@@ -0,0 +1,213 @@
|
||||
import { hasCSSTOMSupport } from 'jss';
|
||||
|
||||
var px = hasCSSTOMSupport && CSS ? CSS.px : 'px';
|
||||
var ms = hasCSSTOMSupport && CSS ? CSS.ms : 'ms';
|
||||
var percent = hasCSSTOMSupport && CSS ? CSS.percent : '%';
|
||||
/**
|
||||
* Generated jss-plugin-default-unit CSS property units
|
||||
*
|
||||
* @type object
|
||||
*/
|
||||
|
||||
var defaultUnits = {
|
||||
// Animation properties
|
||||
'animation-delay': ms,
|
||||
'animation-duration': ms,
|
||||
// Background properties
|
||||
'background-position': px,
|
||||
'background-position-x': px,
|
||||
'background-position-y': px,
|
||||
'background-size': px,
|
||||
// Border Properties
|
||||
border: px,
|
||||
'border-bottom': px,
|
||||
'border-bottom-left-radius': px,
|
||||
'border-bottom-right-radius': px,
|
||||
'border-bottom-width': px,
|
||||
'border-left': px,
|
||||
'border-left-width': px,
|
||||
'border-radius': px,
|
||||
'border-right': px,
|
||||
'border-right-width': px,
|
||||
'border-top': px,
|
||||
'border-top-left-radius': px,
|
||||
'border-top-right-radius': px,
|
||||
'border-top-width': px,
|
||||
'border-width': px,
|
||||
// Margin properties
|
||||
margin: px,
|
||||
'margin-bottom': px,
|
||||
'margin-left': px,
|
||||
'margin-right': px,
|
||||
'margin-top': px,
|
||||
// Padding properties
|
||||
padding: px,
|
||||
'padding-bottom': px,
|
||||
'padding-left': px,
|
||||
'padding-right': px,
|
||||
'padding-top': px,
|
||||
// Mask properties
|
||||
'mask-position-x': px,
|
||||
'mask-position-y': px,
|
||||
'mask-size': px,
|
||||
// Width and height properties
|
||||
height: px,
|
||||
width: px,
|
||||
'min-height': px,
|
||||
'max-height': px,
|
||||
'min-width': px,
|
||||
'max-width': px,
|
||||
// Position properties
|
||||
bottom: px,
|
||||
left: px,
|
||||
top: px,
|
||||
right: px,
|
||||
// Shadow properties
|
||||
'box-shadow': px,
|
||||
'text-shadow': px,
|
||||
// Column properties
|
||||
'column-gap': px,
|
||||
'column-rule': px,
|
||||
'column-rule-width': px,
|
||||
'column-width': px,
|
||||
// Font and text properties
|
||||
'font-size': px,
|
||||
'font-size-delta': px,
|
||||
'letter-spacing': px,
|
||||
'text-indent': px,
|
||||
'text-stroke': px,
|
||||
'text-stroke-width': px,
|
||||
'word-spacing': px,
|
||||
// Motion properties
|
||||
motion: px,
|
||||
'motion-offset': px,
|
||||
// Outline properties
|
||||
outline: px,
|
||||
'outline-offset': px,
|
||||
'outline-width': px,
|
||||
// Perspective properties
|
||||
perspective: px,
|
||||
'perspective-origin-x': percent,
|
||||
'perspective-origin-y': percent,
|
||||
// Transform properties
|
||||
'transform-origin': percent,
|
||||
'transform-origin-x': percent,
|
||||
'transform-origin-y': percent,
|
||||
'transform-origin-z': percent,
|
||||
// Transition properties
|
||||
'transition-delay': ms,
|
||||
'transition-duration': ms,
|
||||
// Alignment properties
|
||||
'vertical-align': px,
|
||||
'flex-basis': px,
|
||||
// Some random properties
|
||||
'shape-margin': px,
|
||||
size: px,
|
||||
// Grid properties
|
||||
grid: px,
|
||||
'grid-gap': px,
|
||||
'grid-row-gap': px,
|
||||
'grid-column-gap': px,
|
||||
'grid-template-rows': px,
|
||||
'grid-template-columns': px,
|
||||
'grid-auto-rows': px,
|
||||
'grid-auto-columns': px,
|
||||
// Not existing properties.
|
||||
// Used to avoid issues with jss-plugin-expand integration.
|
||||
'box-shadow-x': px,
|
||||
'box-shadow-y': px,
|
||||
'box-shadow-blur': px,
|
||||
'box-shadow-spread': px,
|
||||
'font-line-height': px,
|
||||
'text-shadow-x': px,
|
||||
'text-shadow-y': px,
|
||||
'text-shadow-blur': px
|
||||
};
|
||||
|
||||
/**
|
||||
* Clones the object and adds a camel cased property version.
|
||||
*/
|
||||
function addCamelCasedVersion(obj) {
|
||||
var regExp = /(-[a-z])/g;
|
||||
|
||||
var replace = function replace(str) {
|
||||
return str[1].toUpperCase();
|
||||
};
|
||||
|
||||
var newObj = {};
|
||||
|
||||
for (var _key in obj) {
|
||||
newObj[_key] = obj[_key];
|
||||
newObj[_key.replace(regExp, replace)] = obj[_key];
|
||||
}
|
||||
|
||||
return newObj;
|
||||
}
|
||||
|
||||
var units = addCamelCasedVersion(defaultUnits);
|
||||
/**
|
||||
* Recursive deep style passing function
|
||||
*/
|
||||
|
||||
function iterate(prop, value, options) {
|
||||
if (!value) return value;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
value[i] = iterate(prop, value[i], options);
|
||||
}
|
||||
} else if (typeof value === 'object') {
|
||||
if (prop === 'fallbacks') {
|
||||
for (var innerProp in value) {
|
||||
value[innerProp] = iterate(innerProp, value[innerProp], options);
|
||||
}
|
||||
} else {
|
||||
for (var _innerProp in value) {
|
||||
value[_innerProp] = iterate(prop + "-" + _innerProp, value[_innerProp], options);
|
||||
}
|
||||
}
|
||||
} else if (typeof value === 'number') {
|
||||
var unit = options[prop] || units[prop];
|
||||
|
||||
if (unit) {
|
||||
return typeof unit === 'function' ? unit(value).toString() : "" + value + unit;
|
||||
}
|
||||
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* Add unit to numeric values.
|
||||
*/
|
||||
|
||||
|
||||
function defaultUnit(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var camelCasedOptions = addCamelCasedVersion(options);
|
||||
|
||||
function onProcessStyle(style, rule) {
|
||||
if (rule.type !== 'style') return style;
|
||||
|
||||
for (var prop in style) {
|
||||
style[prop] = iterate(prop, style[prop], camelCasedOptions);
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
function onChangeValue(value, prop) {
|
||||
return iterate(prop, value, camelCasedOptions);
|
||||
}
|
||||
|
||||
return {
|
||||
onProcessStyle: onProcessStyle,
|
||||
onChangeValue: onChangeValue
|
||||
};
|
||||
}
|
||||
|
||||
export default defaultUnit;
|
||||
222
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.js
generated
vendored
Normal file
222
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.js
generated
vendored
Normal file
@@ -0,0 +1,222 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jss')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', 'jss'], factory) :
|
||||
(global = global || self, factory(global.jssPluginDefaultUnit = {}, global.jss));
|
||||
}(this, (function (exports, jss) { 'use strict';
|
||||
|
||||
var px = jss.hasCSSTOMSupport && CSS ? CSS.px : 'px';
|
||||
var ms = jss.hasCSSTOMSupport && CSS ? CSS.ms : 'ms';
|
||||
var percent = jss.hasCSSTOMSupport && CSS ? CSS.percent : '%';
|
||||
/**
|
||||
* Generated jss-plugin-default-unit CSS property units
|
||||
*
|
||||
* @type object
|
||||
*/
|
||||
|
||||
var defaultUnits = {
|
||||
// Animation properties
|
||||
'animation-delay': ms,
|
||||
'animation-duration': ms,
|
||||
// Background properties
|
||||
'background-position': px,
|
||||
'background-position-x': px,
|
||||
'background-position-y': px,
|
||||
'background-size': px,
|
||||
// Border Properties
|
||||
border: px,
|
||||
'border-bottom': px,
|
||||
'border-bottom-left-radius': px,
|
||||
'border-bottom-right-radius': px,
|
||||
'border-bottom-width': px,
|
||||
'border-left': px,
|
||||
'border-left-width': px,
|
||||
'border-radius': px,
|
||||
'border-right': px,
|
||||
'border-right-width': px,
|
||||
'border-top': px,
|
||||
'border-top-left-radius': px,
|
||||
'border-top-right-radius': px,
|
||||
'border-top-width': px,
|
||||
'border-width': px,
|
||||
// Margin properties
|
||||
margin: px,
|
||||
'margin-bottom': px,
|
||||
'margin-left': px,
|
||||
'margin-right': px,
|
||||
'margin-top': px,
|
||||
// Padding properties
|
||||
padding: px,
|
||||
'padding-bottom': px,
|
||||
'padding-left': px,
|
||||
'padding-right': px,
|
||||
'padding-top': px,
|
||||
// Mask properties
|
||||
'mask-position-x': px,
|
||||
'mask-position-y': px,
|
||||
'mask-size': px,
|
||||
// Width and height properties
|
||||
height: px,
|
||||
width: px,
|
||||
'min-height': px,
|
||||
'max-height': px,
|
||||
'min-width': px,
|
||||
'max-width': px,
|
||||
// Position properties
|
||||
bottom: px,
|
||||
left: px,
|
||||
top: px,
|
||||
right: px,
|
||||
// Shadow properties
|
||||
'box-shadow': px,
|
||||
'text-shadow': px,
|
||||
// Column properties
|
||||
'column-gap': px,
|
||||
'column-rule': px,
|
||||
'column-rule-width': px,
|
||||
'column-width': px,
|
||||
// Font and text properties
|
||||
'font-size': px,
|
||||
'font-size-delta': px,
|
||||
'letter-spacing': px,
|
||||
'text-indent': px,
|
||||
'text-stroke': px,
|
||||
'text-stroke-width': px,
|
||||
'word-spacing': px,
|
||||
// Motion properties
|
||||
motion: px,
|
||||
'motion-offset': px,
|
||||
// Outline properties
|
||||
outline: px,
|
||||
'outline-offset': px,
|
||||
'outline-width': px,
|
||||
// Perspective properties
|
||||
perspective: px,
|
||||
'perspective-origin-x': percent,
|
||||
'perspective-origin-y': percent,
|
||||
// Transform properties
|
||||
'transform-origin': percent,
|
||||
'transform-origin-x': percent,
|
||||
'transform-origin-y': percent,
|
||||
'transform-origin-z': percent,
|
||||
// Transition properties
|
||||
'transition-delay': ms,
|
||||
'transition-duration': ms,
|
||||
// Alignment properties
|
||||
'vertical-align': px,
|
||||
'flex-basis': px,
|
||||
// Some random properties
|
||||
'shape-margin': px,
|
||||
size: px,
|
||||
// Grid properties
|
||||
grid: px,
|
||||
'grid-gap': px,
|
||||
'grid-row-gap': px,
|
||||
'grid-column-gap': px,
|
||||
'grid-template-rows': px,
|
||||
'grid-template-columns': px,
|
||||
'grid-auto-rows': px,
|
||||
'grid-auto-columns': px,
|
||||
// Not existing properties.
|
||||
// Used to avoid issues with jss-plugin-expand integration.
|
||||
'box-shadow-x': px,
|
||||
'box-shadow-y': px,
|
||||
'box-shadow-blur': px,
|
||||
'box-shadow-spread': px,
|
||||
'font-line-height': px,
|
||||
'text-shadow-x': px,
|
||||
'text-shadow-y': px,
|
||||
'text-shadow-blur': px
|
||||
};
|
||||
|
||||
/**
|
||||
* Clones the object and adds a camel cased property version.
|
||||
*/
|
||||
function addCamelCasedVersion(obj) {
|
||||
var regExp = /(-[a-z])/g;
|
||||
|
||||
var replace = function replace(str) {
|
||||
return str[1].toUpperCase();
|
||||
};
|
||||
|
||||
var newObj = {};
|
||||
|
||||
for (var _key in obj) {
|
||||
newObj[_key] = obj[_key];
|
||||
newObj[_key.replace(regExp, replace)] = obj[_key];
|
||||
}
|
||||
|
||||
return newObj;
|
||||
}
|
||||
|
||||
var units = addCamelCasedVersion(defaultUnits);
|
||||
/**
|
||||
* Recursive deep style passing function
|
||||
*/
|
||||
|
||||
function iterate(prop, value, options) {
|
||||
if (!value) return value;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
value[i] = iterate(prop, value[i], options);
|
||||
}
|
||||
} else if (typeof value === 'object') {
|
||||
if (prop === 'fallbacks') {
|
||||
for (var innerProp in value) {
|
||||
value[innerProp] = iterate(innerProp, value[innerProp], options);
|
||||
}
|
||||
} else {
|
||||
for (var _innerProp in value) {
|
||||
value[_innerProp] = iterate(prop + "-" + _innerProp, value[_innerProp], options);
|
||||
}
|
||||
}
|
||||
} else if (typeof value === 'number') {
|
||||
var unit = options[prop] || units[prop];
|
||||
|
||||
if (unit) {
|
||||
return typeof unit === 'function' ? unit(value).toString() : "" + value + unit;
|
||||
}
|
||||
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* Add unit to numeric values.
|
||||
*/
|
||||
|
||||
|
||||
function defaultUnit(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var camelCasedOptions = addCamelCasedVersion(options);
|
||||
|
||||
function onProcessStyle(style, rule) {
|
||||
if (rule.type !== 'style') return style;
|
||||
|
||||
for (var prop in style) {
|
||||
style[prop] = iterate(prop, style[prop], camelCasedOptions);
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
function onChangeValue(value, prop) {
|
||||
return iterate(prop, value, camelCasedOptions);
|
||||
}
|
||||
|
||||
return {
|
||||
onProcessStyle: onProcessStyle,
|
||||
onChangeValue: onChangeValue
|
||||
};
|
||||
}
|
||||
|
||||
exports.default = defaultUnit;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
//# sourceMappingURL=jss-plugin-default-unit.js.map
|
||||
1
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.js.map
generated
vendored
Normal file
1
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.min.js
generated
vendored
Normal file
1
node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("jss")):"function"==typeof define&&define.amd?define(["exports","jss"],r):r((t=t||self).jssPluginDefaultUnit={},t.jss)}(this,function(t,r){"use strict";var o=r.hasCSSTOMSupport&&CSS?CSS.px:"px",i=r.hasCSSTOMSupport&&CSS?CSS.ms:"ms",e=r.hasCSSTOMSupport&&CSS?CSS.percent:"%";function n(t){var r=/(-[a-z])/g,o=function(t){return t[1].toUpperCase()},i={};for(var e in t)i[e]=t[e],i[e.replace(r,o)]=t[e];return i}var a=n({"animation-delay":i,"animation-duration":i,"background-position":o,"background-position-x":o,"background-position-y":o,"background-size":o,border:o,"border-bottom":o,"border-bottom-left-radius":o,"border-bottom-right-radius":o,"border-bottom-width":o,"border-left":o,"border-left-width":o,"border-radius":o,"border-right":o,"border-right-width":o,"border-top":o,"border-top-left-radius":o,"border-top-right-radius":o,"border-top-width":o,"border-width":o,margin:o,"margin-bottom":o,"margin-left":o,"margin-right":o,"margin-top":o,padding:o,"padding-bottom":o,"padding-left":o,"padding-right":o,"padding-top":o,"mask-position-x":o,"mask-position-y":o,"mask-size":o,height:o,width:o,"min-height":o,"max-height":o,"min-width":o,"max-width":o,bottom:o,left:o,top:o,right:o,"box-shadow":o,"text-shadow":o,"column-gap":o,"column-rule":o,"column-rule-width":o,"column-width":o,"font-size":o,"font-size-delta":o,"letter-spacing":o,"text-indent":o,"text-stroke":o,"text-stroke-width":o,"word-spacing":o,motion:o,"motion-offset":o,outline:o,"outline-offset":o,"outline-width":o,perspective:o,"perspective-origin-x":e,"perspective-origin-y":e,"transform-origin":e,"transform-origin-x":e,"transform-origin-y":e,"transform-origin-z":e,"transition-delay":i,"transition-duration":i,"vertical-align":o,"flex-basis":o,"shape-margin":o,size:o,grid:o,"grid-gap":o,"grid-row-gap":o,"grid-column-gap":o,"grid-template-rows":o,"grid-template-columns":o,"grid-auto-rows":o,"grid-auto-columns":o,"box-shadow-x":o,"box-shadow-y":o,"box-shadow-blur":o,"box-shadow-spread":o,"font-line-height":o,"text-shadow-x":o,"text-shadow-y":o,"text-shadow-blur":o});function d(t,r,o){if(!r)return r;if(Array.isArray(r))for(var i=0;i<r.length;i++)r[i]=d(t,r[i],o);else if("object"==typeof r)if("fallbacks"===t)for(var e in r)r[e]=d(e,r[e],o);else for(var n in r)r[n]=d(t+"-"+n,r[n],o);else if("number"==typeof r){var s=o[t]||a[t];return s?"function"==typeof s?s(r).toString():""+r+s:r.toString()}return r}t.default=function(t){void 0===t&&(t={});var r=n(t);return{onProcessStyle:function(t,o){if("style"!==o.type)return t;for(var i in t)t[i]=d(i,t[i],r);return t},onChangeValue:function(t,o){return d(o,t,r)}}},Object.defineProperty(t,"__esModule",{value:!0})});
|
||||
75
node_modules/jss-plugin-default-unit/package.json
generated
vendored
Normal file
75
node_modules/jss-plugin-default-unit/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"_from": "jss-plugin-default-unit@^10.0.3",
|
||||
"_id": "jss-plugin-default-unit@10.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-tT5KkIXAsZOSS9WDSe8m8lEHIjoEOj4Pr0WrG0WZZsMXZ1mVLFCSsD2jdWarQWDaRNyMj/I4d7czRRObhOxSuw==",
|
||||
"_location": "/jss-plugin-default-unit",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "jss-plugin-default-unit@^10.0.3",
|
||||
"name": "jss-plugin-default-unit",
|
||||
"escapedName": "jss-plugin-default-unit",
|
||||
"rawSpec": "^10.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^10.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@material-ui/styles"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.3.0.tgz",
|
||||
"_shasum": "cd74cf5088542620a82591f76c62c6b43a7e50a6",
|
||||
"_spec": "jss-plugin-default-unit@^10.0.3",
|
||||
"_where": "D:\\WORK\\Menui\\menui_backend\\node_modules\\@material-ui\\styles",
|
||||
"author": {
|
||||
"name": "JSS Team"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/cssinjs/jss/issues/new?title=[jss-plugin-default-unit]"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"jss": "^10.3.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "JSS plugin that adds default custom unit to numeric values where needed",
|
||||
"devDependencies": {
|
||||
"jss-plugin-expand": "^10.3.0",
|
||||
"jss-plugin-rule-value-function": "^10.3.0",
|
||||
"jss-plugin-rule-value-observable": "^10.3.0"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"src",
|
||||
"LICENSE"
|
||||
],
|
||||
"gitHead": "4094410d82dfdae772e1c09f0cd187cb48fa1cdc",
|
||||
"homepage": "https://cssinjs.org/jss-default-unit",
|
||||
"keywords": [
|
||||
"cssinjs",
|
||||
"css-in-js",
|
||||
"css in js",
|
||||
"jss",
|
||||
"plugin",
|
||||
"px",
|
||||
"unit",
|
||||
"default-unit"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/jss-plugin-default-unit.cjs.js",
|
||||
"module": "dist/jss-plugin-default-unit.esm.js",
|
||||
"name": "jss-plugin-default-unit",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cssinjs/jss.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node ../../scripts/build.js",
|
||||
"check-snapshot": "node ../../scripts/match-snapshot.js"
|
||||
},
|
||||
"typings": "./src/index.d.ts",
|
||||
"unpkg": "dist/jss-plugin-default-unit.bundle.js",
|
||||
"version": "10.3.0"
|
||||
}
|
||||
26
node_modules/jss-plugin-default-unit/readme.md
generated
vendored
Normal file
26
node_modules/jss-plugin-default-unit/readme.md
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# jss-plugin-default-unit
|
||||
|
||||
[](https://npmjs.org/package/jss-plugin-default-unit)
|
||||
[](https://github.com/cssinjs/jss/blob/master/LICENSE)
|
||||
[](https://npmjs.org/package/jss-plugin-default-unit)
|
||||
[](https://npmjs.org/package/jss-plugin-default-unit)
|
||||
[](https://npmjs.org/package/jss-plugin-default-unit)
|
||||
[](https://gitter.im/cssinjs/lobby)
|
||||
|
||||
> JSS plugin that adds default custom unit to numeric values where needed
|
||||
|
||||
See our website [jss-plugin-default-unit](https://cssinjs.org/jss-plugin-default-unit?v=v10.3.0) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install jss-plugin-default-unit
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add jss-plugin-default-unit
|
||||
```
|
||||
146
node_modules/jss-plugin-default-unit/src/defaultUnits.js
generated
vendored
Normal file
146
node_modules/jss-plugin-default-unit/src/defaultUnits.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
// @flow
|
||||
|
||||
import {hasCSSTOMSupport} from 'jss'
|
||||
|
||||
const px = hasCSSTOMSupport && CSS ? CSS.px : 'px'
|
||||
const ms = hasCSSTOMSupport && CSS ? CSS.ms : 'ms'
|
||||
const percent = hasCSSTOMSupport && CSS ? CSS.percent : '%'
|
||||
|
||||
/**
|
||||
* Generated jss-plugin-default-unit CSS property units
|
||||
*
|
||||
* @type object
|
||||
*/
|
||||
export default {
|
||||
// Animation properties
|
||||
'animation-delay': ms,
|
||||
'animation-duration': ms,
|
||||
|
||||
// Background properties
|
||||
'background-position': px,
|
||||
'background-position-x': px,
|
||||
'background-position-y': px,
|
||||
'background-size': px,
|
||||
|
||||
// Border Properties
|
||||
border: px,
|
||||
'border-bottom': px,
|
||||
'border-bottom-left-radius': px,
|
||||
'border-bottom-right-radius': px,
|
||||
'border-bottom-width': px,
|
||||
'border-left': px,
|
||||
'border-left-width': px,
|
||||
'border-radius': px,
|
||||
'border-right': px,
|
||||
'border-right-width': px,
|
||||
'border-top': px,
|
||||
'border-top-left-radius': px,
|
||||
'border-top-right-radius': px,
|
||||
'border-top-width': px,
|
||||
'border-width': px,
|
||||
|
||||
// Margin properties
|
||||
margin: px,
|
||||
'margin-bottom': px,
|
||||
'margin-left': px,
|
||||
'margin-right': px,
|
||||
'margin-top': px,
|
||||
|
||||
// Padding properties
|
||||
padding: px,
|
||||
'padding-bottom': px,
|
||||
'padding-left': px,
|
||||
'padding-right': px,
|
||||
'padding-top': px,
|
||||
|
||||
// Mask properties
|
||||
'mask-position-x': px,
|
||||
'mask-position-y': px,
|
||||
'mask-size': px,
|
||||
|
||||
// Width and height properties
|
||||
height: px,
|
||||
width: px,
|
||||
'min-height': px,
|
||||
'max-height': px,
|
||||
'min-width': px,
|
||||
'max-width': px,
|
||||
|
||||
// Position properties
|
||||
bottom: px,
|
||||
left: px,
|
||||
top: px,
|
||||
right: px,
|
||||
|
||||
// Shadow properties
|
||||
'box-shadow': px,
|
||||
'text-shadow': px,
|
||||
|
||||
// Column properties
|
||||
'column-gap': px,
|
||||
'column-rule': px,
|
||||
'column-rule-width': px,
|
||||
'column-width': px,
|
||||
|
||||
// Font and text properties
|
||||
'font-size': px,
|
||||
'font-size-delta': px,
|
||||
'letter-spacing': px,
|
||||
'text-indent': px,
|
||||
'text-stroke': px,
|
||||
'text-stroke-width': px,
|
||||
'word-spacing': px,
|
||||
|
||||
// Motion properties
|
||||
motion: px,
|
||||
'motion-offset': px,
|
||||
|
||||
// Outline properties
|
||||
outline: px,
|
||||
'outline-offset': px,
|
||||
'outline-width': px,
|
||||
|
||||
// Perspective properties
|
||||
perspective: px,
|
||||
'perspective-origin-x': percent,
|
||||
'perspective-origin-y': percent,
|
||||
|
||||
// Transform properties
|
||||
'transform-origin': percent,
|
||||
'transform-origin-x': percent,
|
||||
'transform-origin-y': percent,
|
||||
'transform-origin-z': percent,
|
||||
|
||||
// Transition properties
|
||||
'transition-delay': ms,
|
||||
'transition-duration': ms,
|
||||
|
||||
// Alignment properties
|
||||
'vertical-align': px,
|
||||
'flex-basis': px,
|
||||
|
||||
// Some random properties
|
||||
'shape-margin': px,
|
||||
size: px,
|
||||
|
||||
// Grid properties
|
||||
grid: px,
|
||||
'grid-gap': px,
|
||||
'grid-row-gap': px,
|
||||
'grid-column-gap': px,
|
||||
'grid-template-rows': px,
|
||||
'grid-template-columns': px,
|
||||
'grid-auto-rows': px,
|
||||
'grid-auto-columns': px,
|
||||
|
||||
// Not existing properties.
|
||||
// Used to avoid issues with jss-plugin-expand integration.
|
||||
'box-shadow-x': px,
|
||||
'box-shadow-y': px,
|
||||
'box-shadow-blur': px,
|
||||
'box-shadow-spread': px,
|
||||
'font-line-height': px,
|
||||
'text-shadow-x': px,
|
||||
'text-shadow-y': px,
|
||||
'text-shadow-blur': px
|
||||
}
|
||||
5
node_modules/jss-plugin-default-unit/src/index.d.ts
generated
vendored
Normal file
5
node_modules/jss-plugin-default-unit/src/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import {Plugin} from 'jss'
|
||||
|
||||
export type Options = {[key: string]: string}
|
||||
|
||||
export default function jssPluginSyntaxDefaultUnit(options?: Options): Plugin
|
||||
77
node_modules/jss-plugin-default-unit/src/index.js
generated
vendored
Normal file
77
node_modules/jss-plugin-default-unit/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
// @flow
|
||||
import type {Plugin} from 'jss'
|
||||
import defaultUnits from './defaultUnits'
|
||||
|
||||
export type Options = {[key: string]: string | ((val: number) => string)}
|
||||
|
||||
/**
|
||||
* Clones the object and adds a camel cased property version.
|
||||
*/
|
||||
function addCamelCasedVersion(obj) {
|
||||
const regExp = /(-[a-z])/g
|
||||
const replace = str => str[1].toUpperCase()
|
||||
const newObj = {}
|
||||
for (const key in obj) {
|
||||
newObj[key] = obj[key]
|
||||
newObj[key.replace(regExp, replace)] = obj[key]
|
||||
}
|
||||
return newObj
|
||||
}
|
||||
|
||||
const units = addCamelCasedVersion(defaultUnits)
|
||||
|
||||
/**
|
||||
* Recursive deep style passing function
|
||||
*/
|
||||
function iterate(prop: string, value: any, options: Options) {
|
||||
if (!value) return value
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
value[i] = iterate(prop, value[i], options)
|
||||
}
|
||||
} else if (typeof value === 'object') {
|
||||
if (prop === 'fallbacks') {
|
||||
for (const innerProp in value) {
|
||||
value[innerProp] = iterate(innerProp, value[innerProp], options)
|
||||
}
|
||||
} else {
|
||||
for (const innerProp in value) {
|
||||
value[innerProp] = iterate(`${prop}-${innerProp}`, value[innerProp], options)
|
||||
}
|
||||
}
|
||||
} else if (typeof value === 'number') {
|
||||
const unit = options[prop] || units[prop]
|
||||
|
||||
if (unit) {
|
||||
return typeof unit === 'function' ? unit(value).toString() : `${value}${unit}`
|
||||
}
|
||||
|
||||
return value.toString()
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
/**
|
||||
* Add unit to numeric values.
|
||||
*/
|
||||
export default function defaultUnit(options: Options = {}): Plugin {
|
||||
const camelCasedOptions = addCamelCasedVersion(options)
|
||||
|
||||
function onProcessStyle(style, rule) {
|
||||
if (rule.type !== 'style') return style
|
||||
|
||||
for (const prop in style) {
|
||||
style[prop] = iterate(prop, style[prop], camelCasedOptions)
|
||||
}
|
||||
|
||||
return style
|
||||
}
|
||||
|
||||
function onChangeValue(value, prop) {
|
||||
return iterate(prop, value, camelCasedOptions)
|
||||
}
|
||||
|
||||
return {onProcessStyle, onChangeValue}
|
||||
}
|
||||
403
node_modules/jss-plugin-default-unit/src/index.test.js
generated
vendored
Normal file
403
node_modules/jss-plugin-default-unit/src/index.test.js
generated
vendored
Normal file
@@ -0,0 +1,403 @@
|
||||
import expect from 'expect.js'
|
||||
import expand from 'jss-plugin-expand'
|
||||
import {create} from 'jss'
|
||||
import {stripIndent} from 'common-tags'
|
||||
import Observable from 'zen-observable'
|
||||
import observablePlugin from 'jss-plugin-rule-value-observable'
|
||||
import functionPlugin from 'jss-plugin-rule-value-function'
|
||||
|
||||
import defaultUnit from './index'
|
||||
|
||||
const settings = {
|
||||
createGenerateId: () => rule => `${rule.key}-id`
|
||||
}
|
||||
|
||||
describe('jss-plugin-default-unit', () => {
|
||||
let jss
|
||||
|
||||
beforeEach(() => {
|
||||
jss = create(settings).use(defaultUnit({'min-width': 'pc', 'max-width': val => `${val / 2}px`}))
|
||||
})
|
||||
|
||||
describe('unitless values', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
sheet = jss.createStyleSheet({
|
||||
a: {
|
||||
zoom: 1
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should add rule', () => {
|
||||
expect(sheet.getRule('a')).to.not.be(undefined)
|
||||
})
|
||||
|
||||
it('should generate correct CSS', () => {
|
||||
expect(sheet.toString()).to.be('.a-id {\n zoom: 1;\n}')
|
||||
})
|
||||
})
|
||||
|
||||
describe('values with px units', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
sheet = jss.createStyleSheet({
|
||||
a: {
|
||||
width: 10
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should add rule', () => {
|
||||
expect(sheet.getRule('a')).to.not.be(undefined)
|
||||
})
|
||||
|
||||
it('should generate correct CSS', () => {
|
||||
expect(sheet.toString()).to.be('.a-id {\n width: 10px;\n}')
|
||||
})
|
||||
})
|
||||
|
||||
describe('values with ms units', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
sheet = jss.createStyleSheet({
|
||||
a: {
|
||||
'animation-duration': 200
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should add rule', () => {
|
||||
expect(sheet.getRule('a')).to.not.be(undefined)
|
||||
})
|
||||
|
||||
it('should generate correct CSS', () => {
|
||||
expect(sheet.toString()).to.be('.a-id {\n animation-duration: 200ms;\n}')
|
||||
})
|
||||
})
|
||||
|
||||
describe('values with % units', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
sheet = jss.createStyleSheet({
|
||||
a: {
|
||||
'transform-origin-x': 50
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should add rule', () => {
|
||||
expect(sheet.getRule('a')).to.not.be(undefined)
|
||||
})
|
||||
|
||||
it('should generate correct CSS', () => {
|
||||
expect(sheet.toString()).to.be('.a-id {\n transform-origin-x: 50%;\n}')
|
||||
})
|
||||
})
|
||||
|
||||
describe('leave non-regular rules unchanged', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
sheet = jss.createStyleSheet({
|
||||
'@font-face': {
|
||||
'font-family': 'MyHelvetica',
|
||||
src: 'local("Helvetica")'
|
||||
},
|
||||
'@media print': {
|
||||
a: {
|
||||
'border-left': 1,
|
||||
border: 3
|
||||
}
|
||||
},
|
||||
'@keyframes a': {
|
||||
from: {top: 0},
|
||||
'30%': {top: 30},
|
||||
'60%, 70%': {top: 80}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should generate correct CSS', () => {
|
||||
expect(sheet.toString()).to.be(
|
||||
'@font-face {\n' +
|
||||
' font-family: MyHelvetica;\n' +
|
||||
' src: local("Helvetica");\n' +
|
||||
'}\n' +
|
||||
'@media print {\n' +
|
||||
' .a-id {\n' +
|
||||
' border-left: 1px;\n' +
|
||||
' border: 3px;\n' +
|
||||
' }\n' +
|
||||
'}\n' +
|
||||
'@keyframes keyframes-a-id {\n' +
|
||||
' from {\n' +
|
||||
' top: 0;\n' +
|
||||
' }\n' +
|
||||
' 30% {\n' +
|
||||
' top: 30px;\n' +
|
||||
' }\n' +
|
||||
' 60%, 70% {\n' +
|
||||
' top: 80px;\n' +
|
||||
' }\n' +
|
||||
'}'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('comma-separated values', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
sheet = jss.createStyleSheet({
|
||||
a: {
|
||||
'background-size': [10, 15]
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should add rule', () => {
|
||||
expect(sheet.getRule('a')).to.not.be(undefined)
|
||||
})
|
||||
|
||||
it('should generate correct CSS', () => {
|
||||
expect(sheet.toString()).to.be('.a-id {\n background-size: 10px, 15px;\n}')
|
||||
})
|
||||
})
|
||||
|
||||
describe('comma-separated values', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
sheet = jss.createStyleSheet({
|
||||
a: {
|
||||
'background-size': [[10, 5]]
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should add rule', () => {
|
||||
expect(sheet.getRule('a')).to.not.be(undefined)
|
||||
})
|
||||
|
||||
it('should generate correct CSS', () => {
|
||||
expect(sheet.toString()).to.be('.a-id {\n background-size: 10px 5px;\n}')
|
||||
})
|
||||
})
|
||||
|
||||
describe('customized units via options object', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
sheet = jss.createStyleSheet({
|
||||
a: {
|
||||
'min-width': 20,
|
||||
'max-width': 20
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should add rule', () => {
|
||||
expect(sheet.getRule('a')).to.not.be(undefined)
|
||||
})
|
||||
|
||||
it('should generate correct CSS', () => {
|
||||
expect(sheet.toString()).to.be('.a-id {\n min-width: 20pc;\n max-width: 10px;\n}')
|
||||
})
|
||||
})
|
||||
|
||||
describe('ignore falsy values', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
sheet = jss.createStyleSheet({
|
||||
a: {
|
||||
padding: 10,
|
||||
margin: null
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should add rule', () => {
|
||||
expect(sheet.getRule('a')).to.not.be(undefined)
|
||||
})
|
||||
|
||||
it('should generate correct CSS', () => {
|
||||
expect(sheet.toString()).to.be('.a-id {\n padding: 10px;\n}')
|
||||
})
|
||||
})
|
||||
|
||||
describe('add default units to fallbacks', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
const localJss = create(settings).use(defaultUnit())
|
||||
sheet = localJss.createStyleSheet({
|
||||
a: {
|
||||
padding: 1,
|
||||
fallbacks: {
|
||||
padding: 5
|
||||
}
|
||||
},
|
||||
b: {
|
||||
padding: 1,
|
||||
fallbacks: [{padding: 5}, {padding: 10}]
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should add rule', () => {
|
||||
expect(sheet.getRule('a')).to.not.be(undefined)
|
||||
expect(sheet.getRule('b')).to.not.be(undefined)
|
||||
})
|
||||
|
||||
it('should generate correct CSS', () => {
|
||||
expect(sheet.toString()).to.be(
|
||||
'.a-id {\n' +
|
||||
' padding: 5px;\n' +
|
||||
' padding: 1px;\n' +
|
||||
'}\n' +
|
||||
'.b-id {\n' +
|
||||
' padding: 5px;\n' +
|
||||
' padding: 10px;\n' +
|
||||
' padding: 1px;\n' +
|
||||
'}'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('add default units in combination with expand plugin', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
const localJss = create(settings).use(defaultUnit({'padding-top': 'rem'}), expand())
|
||||
sheet = localJss.createStyleSheet({
|
||||
a: {
|
||||
padding: {
|
||||
top: 5,
|
||||
left: 0,
|
||||
right: 10,
|
||||
bottom: 15
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should add rule', () => {
|
||||
expect(sheet.getRule('a')).to.not.be(undefined)
|
||||
})
|
||||
|
||||
it('should generate correct CSS', () => {
|
||||
expect(sheet.toString()).to.be('.a-id {\n padding: 5rem 10px 15px 0;\n}')
|
||||
})
|
||||
})
|
||||
|
||||
describe('add default units in combination with expand plugin (objects inside arrays)', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
const localJss = create(settings).use(defaultUnit(), expand())
|
||||
sheet = localJss.createStyleSheet({
|
||||
a: {
|
||||
transition: [
|
||||
{
|
||||
timingFunction: 'linear',
|
||||
delay: 100,
|
||||
property: 'opacity',
|
||||
duration: 200
|
||||
},
|
||||
{
|
||||
timingFunction: 'linear',
|
||||
property: 'transform',
|
||||
duration: 300
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should add rule', () => {
|
||||
expect(sheet.getRule('a')).to.not.be(undefined)
|
||||
})
|
||||
|
||||
it('should generate correct CSS', () => {
|
||||
expect(sheet.toString()).to.be(
|
||||
'.a-id {\n transition: opacity 200ms linear 100ms, transform 300ms linear;\n}'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('support camel cased units', () => {
|
||||
it('should work with default units', () => {
|
||||
const sheet = jss.createStyleSheet({
|
||||
a: {
|
||||
borderBottom: 10
|
||||
}
|
||||
})
|
||||
expect(sheet.toString()).to.be('.a-id {\n borderBottom: 10px;\n}')
|
||||
})
|
||||
|
||||
it('should work with user units', () => {
|
||||
const localJss = create(settings).use(defaultUnit({borderBottom: 'pc'}))
|
||||
|
||||
const sheet = localJss.createStyleSheet({
|
||||
a: {
|
||||
borderBottom: 10
|
||||
}
|
||||
})
|
||||
|
||||
expect(sheet.toString()).to.be('.a-id {\n borderBottom: 10pc;\n}')
|
||||
})
|
||||
})
|
||||
|
||||
describe('support function values', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
jss.use(functionPlugin())
|
||||
|
||||
sheet = jss.createStyleSheet({
|
||||
a: {
|
||||
width: () => 1
|
||||
}
|
||||
})
|
||||
sheet.update()
|
||||
})
|
||||
|
||||
it('should add default unit', () => {
|
||||
expect(sheet.toString()).to.be(stripIndent`
|
||||
.a-id {
|
||||
width: 1px;
|
||||
}
|
||||
`)
|
||||
})
|
||||
})
|
||||
|
||||
describe('support observable values', () => {
|
||||
let sheet
|
||||
|
||||
beforeEach(() => {
|
||||
jss.use(observablePlugin())
|
||||
|
||||
sheet = jss.createStyleSheet({
|
||||
a: {
|
||||
width: new Observable(observer => {
|
||||
observer.next(1)
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should add default unit', () => {
|
||||
expect(sheet.toString()).to.be(stripIndent`
|
||||
.a-id {
|
||||
width: 1px;
|
||||
}
|
||||
`)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user