Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

287 righe
7.7 KiB

  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["jssDefaultUnit"] = factory();
  8. else
  9. root["jssDefaultUnit"] = factory();
  10. })(this, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId])
  20. /******/ return installedModules[moduleId].exports;
  21. /******/
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ exports: {},
  25. /******/ id: moduleId,
  26. /******/ loaded: false
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.loaded = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // __webpack_public_path__
  47. /******/ __webpack_require__.p = "";
  48. /******/
  49. /******/ // Load entry module and return exports
  50. /******/ return __webpack_require__(0);
  51. /******/ })
  52. /************************************************************************/
  53. /******/ ([
  54. /* 0 */
  55. /***/ (function(module, exports, __webpack_require__) {
  56. 'use strict';
  57. Object.defineProperty(exports, "__esModule", {
  58. value: true
  59. });
  60. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  61. exports['default'] = defaultUnit;
  62. var _defaultUnits = __webpack_require__(1);
  63. var _defaultUnits2 = _interopRequireDefault(_defaultUnits);
  64. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  65. /**
  66. * Clones the object and adds a camel cased property version.
  67. */
  68. function addCamelCasedVersion(obj) {
  69. var regExp = /(-[a-z])/g;
  70. var replace = function replace(str) {
  71. return str[1].toUpperCase();
  72. };
  73. var newObj = {};
  74. for (var key in obj) {
  75. newObj[key] = obj[key];
  76. newObj[key.replace(regExp, replace)] = obj[key];
  77. }
  78. return newObj;
  79. }
  80. var units = addCamelCasedVersion(_defaultUnits2['default']);
  81. /**
  82. * Recursive deep style passing function
  83. *
  84. * @param {String} current property
  85. * @param {(Object|Array|Number|String)} property value
  86. * @param {Object} options
  87. * @return {(Object|Array|Number|String)} resulting value
  88. */
  89. function iterate(prop, value, options) {
  90. if (!value) return value;
  91. var convertedValue = value;
  92. var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
  93. if (type === 'object' && Array.isArray(value)) type = 'array';
  94. switch (type) {
  95. case 'object':
  96. if (prop === 'fallbacks') {
  97. for (var innerProp in value) {
  98. value[innerProp] = iterate(innerProp, value[innerProp], options);
  99. }
  100. break;
  101. }
  102. for (var _innerProp in value) {
  103. value[_innerProp] = iterate(prop + '-' + _innerProp, value[_innerProp], options);
  104. }
  105. break;
  106. case 'array':
  107. for (var i = 0; i < value.length; i++) {
  108. value[i] = iterate(prop, value[i], options);
  109. }
  110. break;
  111. case 'number':
  112. if (value !== 0) {
  113. convertedValue = value + (options[prop] || units[prop] || '');
  114. }
  115. break;
  116. default:
  117. break;
  118. }
  119. return convertedValue;
  120. }
  121. /**
  122. * Add unit to numeric values.
  123. */
  124. function defaultUnit() {
  125. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  126. var camelCasedOptions = addCamelCasedVersion(options);
  127. function onProcessStyle(style, rule) {
  128. if (rule.type !== 'style') return style;
  129. for (var prop in style) {
  130. style[prop] = iterate(prop, style[prop], camelCasedOptions);
  131. }
  132. return style;
  133. }
  134. function onChangeValue(value, prop) {
  135. return iterate(prop, value, camelCasedOptions);
  136. }
  137. return { onProcessStyle: onProcessStyle, onChangeValue: onChangeValue };
  138. }
  139. /***/ }),
  140. /* 1 */
  141. /***/ (function(module, exports) {
  142. 'use strict';
  143. Object.defineProperty(exports, "__esModule", {
  144. value: true
  145. });
  146. /**
  147. * Generated jss-default-unit CSS property units
  148. *
  149. * @type object
  150. */
  151. exports['default'] = {
  152. 'animation-delay': 'ms',
  153. 'animation-duration': 'ms',
  154. 'background-position': 'px',
  155. 'background-position-x': 'px',
  156. 'background-position-y': 'px',
  157. 'background-size': 'px',
  158. border: 'px',
  159. 'border-bottom': 'px',
  160. 'border-bottom-left-radius': 'px',
  161. 'border-bottom-right-radius': 'px',
  162. 'border-bottom-width': 'px',
  163. 'border-left': 'px',
  164. 'border-left-width': 'px',
  165. 'border-radius': 'px',
  166. 'border-right': 'px',
  167. 'border-right-width': 'px',
  168. 'border-spacing': 'px',
  169. 'border-top': 'px',
  170. 'border-top-left-radius': 'px',
  171. 'border-top-right-radius': 'px',
  172. 'border-top-width': 'px',
  173. 'border-width': 'px',
  174. 'border-after-width': 'px',
  175. 'border-before-width': 'px',
  176. 'border-end-width': 'px',
  177. 'border-horizontal-spacing': 'px',
  178. 'border-start-width': 'px',
  179. 'border-vertical-spacing': 'px',
  180. bottom: 'px',
  181. 'box-shadow': 'px',
  182. 'column-gap': 'px',
  183. 'column-rule': 'px',
  184. 'column-rule-width': 'px',
  185. 'column-width': 'px',
  186. 'flex-basis': 'px',
  187. 'font-size': 'px',
  188. 'font-size-delta': 'px',
  189. height: 'px',
  190. left: 'px',
  191. 'letter-spacing': 'px',
  192. 'logical-height': 'px',
  193. 'logical-width': 'px',
  194. margin: 'px',
  195. 'margin-after': 'px',
  196. 'margin-before': 'px',
  197. 'margin-bottom': 'px',
  198. 'margin-left': 'px',
  199. 'margin-right': 'px',
  200. 'margin-top': 'px',
  201. 'max-height': 'px',
  202. 'max-width': 'px',
  203. 'margin-end': 'px',
  204. 'margin-start': 'px',
  205. 'mask-position-x': 'px',
  206. 'mask-position-y': 'px',
  207. 'mask-size': 'px',
  208. 'max-logical-height': 'px',
  209. 'max-logical-width': 'px',
  210. 'min-height': 'px',
  211. 'min-width': 'px',
  212. 'min-logical-height': 'px',
  213. 'min-logical-width': 'px',
  214. motion: 'px',
  215. 'motion-offset': 'px',
  216. outline: 'px',
  217. 'outline-offset': 'px',
  218. 'outline-width': 'px',
  219. padding: 'px',
  220. 'padding-bottom': 'px',
  221. 'padding-left': 'px',
  222. 'padding-right': 'px',
  223. 'padding-top': 'px',
  224. 'padding-after': 'px',
  225. 'padding-before': 'px',
  226. 'padding-end': 'px',
  227. 'padding-start': 'px',
  228. 'perspective-origin-x': '%',
  229. 'perspective-origin-y': '%',
  230. perspective: 'px',
  231. right: 'px',
  232. 'shape-margin': 'px',
  233. size: 'px',
  234. 'text-indent': 'px',
  235. 'text-stroke': 'px',
  236. 'text-stroke-width': 'px',
  237. top: 'px',
  238. 'transform-origin': '%',
  239. 'transform-origin-x': '%',
  240. 'transform-origin-y': '%',
  241. 'transform-origin-z': '%',
  242. 'transition-delay': 'ms',
  243. 'transition-duration': 'ms',
  244. 'vertical-align': 'px',
  245. width: 'px',
  246. 'word-spacing': 'px',
  247. // Not existing properties.
  248. // Used to avoid issues with jss-expand intergration.
  249. 'box-shadow-x': 'px',
  250. 'box-shadow-y': 'px',
  251. 'box-shadow-blur': 'px',
  252. 'box-shadow-spread': 'px',
  253. 'font-line-height': 'px',
  254. 'text-shadow-x': 'px',
  255. 'text-shadow-y': 'px',
  256. 'text-shadow-blur': 'px'
  257. };
  258. /***/ })
  259. /******/ ])
  260. });
  261. ;
  262. //# sourceMappingURL=jss-default-unit.js.map