0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

8
web/node_modules/jss-plugin-default-unit/LICENSE generated vendored Normal file
View 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.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,256 @@
'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,
'border-block': px,
'border-block-end': px,
'border-block-end-width': px,
'border-block-start': px,
'border-block-start-width': px,
'border-block-width': px,
'border-inline': px,
'border-inline-end': px,
'border-inline-end-width': px,
'border-inline-start': px,
'border-inline-start-width': px,
'border-inline-width': px,
'border-start-start-radius': px,
'border-start-end-radius': px,
'border-end-start-radius': px,
'border-end-end-radius': px,
// Margin properties
margin: px,
'margin-bottom': px,
'margin-left': px,
'margin-right': px,
'margin-top': px,
'margin-block': px,
'margin-block-end': px,
'margin-block-start': px,
'margin-inline': px,
'margin-inline-end': px,
'margin-inline-start': px,
// Padding properties
padding: px,
'padding-bottom': px,
'padding-left': px,
'padding-right': px,
'padding-top': px,
'padding-block': px,
'padding-block-end': px,
'padding-block-start': px,
'padding-inline': px,
'padding-inline-end': px,
'padding-inline-start': 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,
inset: px,
'inset-block': px,
'inset-block-end': px,
'inset-block-start': px,
'inset-inline': px,
'inset-inline-end': px,
'inset-inline-start': 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-decoration-thickness': 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,
gap: px,
// Grid properties
grid: px,
'grid-gap': px,
'row-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 == null) 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);
}
} // eslint-disable-next-line no-restricted-globals
} else if (typeof value === 'number' && isNaN(value) === false) {
var unit = options[prop] || units[prop]; // Add the unit if available, except for the special case of 0px.
if (unit && !(value === 0 && unit === px)) {
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;

View file

@ -0,0 +1,3 @@
// @flow
export * from '../src';

View file

@ -0,0 +1,252 @@
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,
'border-block': px,
'border-block-end': px,
'border-block-end-width': px,
'border-block-start': px,
'border-block-start-width': px,
'border-block-width': px,
'border-inline': px,
'border-inline-end': px,
'border-inline-end-width': px,
'border-inline-start': px,
'border-inline-start-width': px,
'border-inline-width': px,
'border-start-start-radius': px,
'border-start-end-radius': px,
'border-end-start-radius': px,
'border-end-end-radius': px,
// Margin properties
margin: px,
'margin-bottom': px,
'margin-left': px,
'margin-right': px,
'margin-top': px,
'margin-block': px,
'margin-block-end': px,
'margin-block-start': px,
'margin-inline': px,
'margin-inline-end': px,
'margin-inline-start': px,
// Padding properties
padding: px,
'padding-bottom': px,
'padding-left': px,
'padding-right': px,
'padding-top': px,
'padding-block': px,
'padding-block-end': px,
'padding-block-start': px,
'padding-inline': px,
'padding-inline-end': px,
'padding-inline-start': 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,
inset: px,
'inset-block': px,
'inset-block-end': px,
'inset-block-start': px,
'inset-inline': px,
'inset-inline-end': px,
'inset-inline-start': 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-decoration-thickness': 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,
gap: px,
// Grid properties
grid: px,
'grid-gap': px,
'row-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 == null) 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);
}
} // eslint-disable-next-line no-restricted-globals
} else if (typeof value === 'number' && isNaN(value) === false) {
var unit = options[prop] || units[prop]; // Add the unit if available, except for the special case of 0px.
if (unit && !(value === 0 && unit === px)) {
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;

View file

@ -0,0 +1,261 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jss')) :
typeof define === 'function' && define.amd ? define(['exports', 'jss'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : 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,
'border-block': px,
'border-block-end': px,
'border-block-end-width': px,
'border-block-start': px,
'border-block-start-width': px,
'border-block-width': px,
'border-inline': px,
'border-inline-end': px,
'border-inline-end-width': px,
'border-inline-start': px,
'border-inline-start-width': px,
'border-inline-width': px,
'border-start-start-radius': px,
'border-start-end-radius': px,
'border-end-start-radius': px,
'border-end-end-radius': px,
// Margin properties
margin: px,
'margin-bottom': px,
'margin-left': px,
'margin-right': px,
'margin-top': px,
'margin-block': px,
'margin-block-end': px,
'margin-block-start': px,
'margin-inline': px,
'margin-inline-end': px,
'margin-inline-start': px,
// Padding properties
padding: px,
'padding-bottom': px,
'padding-left': px,
'padding-right': px,
'padding-top': px,
'padding-block': px,
'padding-block-end': px,
'padding-block-start': px,
'padding-inline': px,
'padding-inline-end': px,
'padding-inline-start': 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,
inset: px,
'inset-block': px,
'inset-block-end': px,
'inset-block-start': px,
'inset-inline': px,
'inset-inline-end': px,
'inset-inline-start': 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-decoration-thickness': 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,
gap: px,
// Grid properties
grid: px,
'grid-gap': px,
'row-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 == null) 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);
}
} // eslint-disable-next-line no-restricted-globals
} else if (typeof value === 'number' && isNaN(value) === false) {
var unit = options[prop] || units[prop]; // Add the unit if available, except for the special case of 0px.
if (unit && !(value === 0 && unit === px)) {
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

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("jss")):"function"==typeof define&&define.amd?define(["exports","jss"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self).jssPluginDefaultUnit={},r.jss)}(this,(function(r,t){"use strict";var i=t.hasCSSTOMSupport&&CSS?CSS.px:"px",e=t.hasCSSTOMSupport&&CSS?CSS.ms:"ms",o=t.hasCSSTOMSupport&&CSS?CSS.percent:"%";function n(r){var t=/(-[a-z])/g,i=function(r){return r[1].toUpperCase()},e={};for(var o in r)e[o]=r[o],e[o.replace(t,i)]=r[o];return e}var d=n({"animation-delay":e,"animation-duration":e,"background-position":i,"background-position-x":i,"background-position-y":i,"background-size":i,border:i,"border-bottom":i,"border-bottom-left-radius":i,"border-bottom-right-radius":i,"border-bottom-width":i,"border-left":i,"border-left-width":i,"border-radius":i,"border-right":i,"border-right-width":i,"border-top":i,"border-top-left-radius":i,"border-top-right-radius":i,"border-top-width":i,"border-width":i,"border-block":i,"border-block-end":i,"border-block-end-width":i,"border-block-start":i,"border-block-start-width":i,"border-block-width":i,"border-inline":i,"border-inline-end":i,"border-inline-end-width":i,"border-inline-start":i,"border-inline-start-width":i,"border-inline-width":i,"border-start-start-radius":i,"border-start-end-radius":i,"border-end-start-radius":i,"border-end-end-radius":i,margin:i,"margin-bottom":i,"margin-left":i,"margin-right":i,"margin-top":i,"margin-block":i,"margin-block-end":i,"margin-block-start":i,"margin-inline":i,"margin-inline-end":i,"margin-inline-start":i,padding:i,"padding-bottom":i,"padding-left":i,"padding-right":i,"padding-top":i,"padding-block":i,"padding-block-end":i,"padding-block-start":i,"padding-inline":i,"padding-inline-end":i,"padding-inline-start":i,"mask-position-x":i,"mask-position-y":i,"mask-size":i,height:i,width:i,"min-height":i,"max-height":i,"min-width":i,"max-width":i,bottom:i,left:i,top:i,right:i,inset:i,"inset-block":i,"inset-block-end":i,"inset-block-start":i,"inset-inline":i,"inset-inline-end":i,"inset-inline-start":i,"box-shadow":i,"text-shadow":i,"column-gap":i,"column-rule":i,"column-rule-width":i,"column-width":i,"font-size":i,"font-size-delta":i,"letter-spacing":i,"text-decoration-thickness":i,"text-indent":i,"text-stroke":i,"text-stroke-width":i,"word-spacing":i,motion:i,"motion-offset":i,outline:i,"outline-offset":i,"outline-width":i,perspective:i,"perspective-origin-x":o,"perspective-origin-y":o,"transform-origin":o,"transform-origin-x":o,"transform-origin-y":o,"transform-origin-z":o,"transition-delay":e,"transition-duration":e,"vertical-align":i,"flex-basis":i,"shape-margin":i,size:i,gap:i,grid:i,"grid-gap":i,"row-gap":i,"grid-row-gap":i,"grid-column-gap":i,"grid-template-rows":i,"grid-template-columns":i,"grid-auto-rows":i,"grid-auto-columns":i,"box-shadow-x":i,"box-shadow-y":i,"box-shadow-blur":i,"box-shadow-spread":i,"font-line-height":i,"text-shadow-x":i,"text-shadow-y":i,"text-shadow-blur":i});function a(r,t,e){if(null==t)return t;if(Array.isArray(t))for(var o=0;o<t.length;o++)t[o]=a(r,t[o],e);else if("object"==typeof t)if("fallbacks"===r)for(var n in t)t[n]=a(n,t[n],e);else for(var s in t)t[s]=a(r+"-"+s,t[s],e);else if("number"==typeof t&&!1===isNaN(t)){var l=e[r]||d[r];return!l||0===t&&l===i?t.toString():"function"==typeof l?l(t).toString():""+t+l}return t}r.default=function(r){void 0===r&&(r={});var t=n(r);return{onProcessStyle:function(r,i){if("style"!==i.type)return r;for(var e in r)r[e]=a(e,r[e],t);return r},onChangeValue:function(r,i){return a(i,r,t)}}},Object.defineProperty(r,"__esModule",{value:!0})}));

49
web/node_modules/jss-plugin-default-unit/package.json generated vendored Normal file
View file

@ -0,0 +1,49 @@
{
"name": "jss-plugin-default-unit",
"description": "JSS plugin that adds default custom unit to numeric values where needed",
"version": "10.7.1",
"license": "MIT",
"homepage": "https://cssinjs.org/jss-default-unit",
"main": "dist/jss-plugin-default-unit.cjs.js",
"module": "dist/jss-plugin-default-unit.esm.js",
"unpkg": "dist/jss-plugin-default-unit.bundle.js",
"sideEffects": false,
"typings": "./src/index.d.ts",
"author": "JSS Team",
"repository": {
"type": "git",
"url": "https://github.com/cssinjs/jss"
},
"bugs": {
"url": "https://github.com/cssinjs/jss/issues/new?title=[jss-plugin-default-unit]"
},
"files": [
"dist",
"src",
"!*.test.*"
],
"keywords": [
"cssinjs",
"css-in-js",
"css in js",
"jss",
"plugin",
"px",
"unit",
"default-unit"
],
"scripts": {
"build": "node ../../scripts/build.js",
"check-snapshot": "node ../../scripts/match-snapshot.js"
},
"devDependencies": {
"jss-plugin-expand": "10.7.1",
"jss-plugin-rule-value-function": "10.7.1",
"jss-plugin-rule-value-observable": "10.7.1"
},
"dependencies": {
"@babel/runtime": "^7.3.1",
"jss": "10.7.1"
},
"gitHead": "2b54776c03d97a3bccbbcb28b63508f74103ebbc"
}

25
web/node_modules/jss-plugin-default-unit/readme.md generated vendored Normal file
View file

@ -0,0 +1,25 @@
# jss-plugin-default-unit
[![Version](https://img.shields.io/npm/v/jss-plugin-default-unit.svg?style=flat)](https://npmjs.org/package/jss-plugin-default-unit)
[![License](https://img.shields.io/npm/l/jss-plugin-default-unit.svg?style=flat)](https://github.com/cssinjs/jss/blob/master/LICENSE)
[![Downlodas](https://img.shields.io/npm/dm/jss-plugin-default-unit.svg?style=flat)](https://npmjs.org/package/jss-plugin-default-unit)
[![Size](https://img.shields.io/bundlephobia/minzip/jss-plugin-default-unit.svg?style=flat)](https://npmjs.org/package/jss-plugin-default-unit)
[![Dependencies](https://img.shields.io/david/cssinjs/jss.svg?path=packages%2Fjss-plugin-default-unit&style=flat)](https://npmjs.org/package/jss-plugin-default-unit)
> 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.7.1) for more information.
## Install
Using npm:
```sh
npm install jss-plugin-default-unit
```
or using yarn:
```sh
yarn add jss-plugin-default-unit
```

View file

@ -0,0 +1,184 @@
// @flow
import {hasCSSTOMSupport} from 'jss'
export const px: string | Function = hasCSSTOMSupport && CSS ? CSS.px : 'px'
export const ms: string | Function = hasCSSTOMSupport && CSS ? CSS.ms : 'ms'
export const percent: string | Function = 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,
'border-block': px,
'border-block-end': px,
'border-block-end-width': px,
'border-block-start': px,
'border-block-start-width': px,
'border-block-width': px,
'border-inline': px,
'border-inline-end': px,
'border-inline-end-width': px,
'border-inline-start': px,
'border-inline-start-width': px,
'border-inline-width': px,
'border-start-start-radius': px,
'border-start-end-radius': px,
'border-end-start-radius': px,
'border-end-end-radius': px,
// Margin properties
margin: px,
'margin-bottom': px,
'margin-left': px,
'margin-right': px,
'margin-top': px,
'margin-block': px,
'margin-block-end': px,
'margin-block-start': px,
'margin-inline': px,
'margin-inline-end': px,
'margin-inline-start': px,
// Padding properties
padding: px,
'padding-bottom': px,
'padding-left': px,
'padding-right': px,
'padding-top': px,
'padding-block': px,
'padding-block-end': px,
'padding-block-start': px,
'padding-inline': px,
'padding-inline-end': px,
'padding-inline-start': 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,
inset: px,
'inset-block': px,
'inset-block-end': px,
'inset-block-start': px,
'inset-inline': px,
'inset-inline-end': px,
'inset-inline-start': 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-decoration-thickness': 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,
gap: px,
// Grid properties
grid: px,
'grid-gap': px,
'row-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
}

View file

@ -0,0 +1,5 @@
import {Plugin} from 'jss'
export type Options = {[key: string]: string}
export default function jssPluginSyntaxDefaultUnit(options?: Options): Plugin

79
web/node_modules/jss-plugin-default-unit/src/index.js generated vendored Normal file
View file

@ -0,0 +1,79 @@
// @flow
import type {Plugin} from 'jss'
import defaultUnits, {px} 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 == null) 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)
}
}
// eslint-disable-next-line no-restricted-globals
} else if (typeof value === 'number' && isNaN(value) === false) {
const unit = options[prop] || units[prop]
// Add the unit if available, except for the special case of 0px.
if (unit && !(value === 0 && unit === px)) {
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}
}