Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

148 lignes
3.8 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["jssCamelCase"] = factory();
  8. else
  9. root["jssCamelCase"] = factory();
  10. })(this, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/ // The require function
  15. /******/ function __webpack_require__(moduleId) {
  16. /******/ // Check if module is in cache
  17. /******/ if(installedModules[moduleId])
  18. /******/ return installedModules[moduleId].exports;
  19. /******/ // Create a new module (and put it into the cache)
  20. /******/ var module = installedModules[moduleId] = {
  21. /******/ exports: {},
  22. /******/ id: moduleId,
  23. /******/ loaded: false
  24. /******/ };
  25. /******/ // Execute the module function
  26. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  27. /******/ // Flag the module as loaded
  28. /******/ module.loaded = true;
  29. /******/ // Return the exports of the module
  30. /******/ return module.exports;
  31. /******/ }
  32. /******/ // expose the modules object (__webpack_modules__)
  33. /******/ __webpack_require__.m = modules;
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/ // __webpack_public_path__
  37. /******/ __webpack_require__.p = "";
  38. /******/ // Load entry module and return exports
  39. /******/ return __webpack_require__(0);
  40. /******/ })
  41. /************************************************************************/
  42. /******/ ([
  43. /* 0 */
  44. /***/ (function(module, exports, __webpack_require__) {
  45. 'use strict';
  46. Object.defineProperty(exports, "__esModule", {
  47. value: true
  48. });
  49. exports['default'] = camelCase;
  50. var _hyphenateStyleName = __webpack_require__(1);
  51. var _hyphenateStyleName2 = _interopRequireDefault(_hyphenateStyleName);
  52. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  53. /**
  54. * Convert camel cased property names to dash separated.
  55. *
  56. * @param {Object} style
  57. * @return {Object}
  58. */
  59. function convertCase(style) {
  60. var converted = {};
  61. for (var prop in style) {
  62. converted[(0, _hyphenateStyleName2['default'])(prop)] = style[prop];
  63. }
  64. if (style.fallbacks) {
  65. if (Array.isArray(style.fallbacks)) converted.fallbacks = style.fallbacks.map(convertCase);else converted.fallbacks = convertCase(style.fallbacks);
  66. }
  67. return converted;
  68. }
  69. /**
  70. * Allow camel cased property names by converting them back to dasherized.
  71. *
  72. * @param {Rule} rule
  73. */
  74. function camelCase() {
  75. function onProcessStyle(style) {
  76. if (Array.isArray(style)) {
  77. // Handle rules like @font-face, which can have multiple styles in an array
  78. for (var index = 0; index < style.length; index++) {
  79. style[index] = convertCase(style[index]);
  80. }
  81. return style;
  82. }
  83. return convertCase(style);
  84. }
  85. function onChangeValue(value, prop, rule) {
  86. var hyphenatedProp = (0, _hyphenateStyleName2['default'])(prop);
  87. // There was no camel case in place
  88. if (prop === hyphenatedProp) return value;
  89. rule.prop(hyphenatedProp, value);
  90. // Core will ignore that property value we set the proper one above.
  91. return null;
  92. }
  93. return { onProcessStyle: onProcessStyle, onChangeValue: onChangeValue };
  94. }
  95. /***/ }),
  96. /* 1 */
  97. /***/ (function(module, exports) {
  98. 'use strict';
  99. var uppercasePattern = /[A-Z]/g;
  100. var msPattern = /^ms-/;
  101. var cache = {};
  102. function hyphenateStyleName(string) {
  103. return string in cache
  104. ? cache[string]
  105. : cache[string] = string
  106. .replace(uppercasePattern, '-$&')
  107. .toLowerCase()
  108. .replace(msPattern, '-ms-');
  109. }
  110. module.exports = hyphenateStyleName;
  111. /***/ })
  112. /******/ ])
  113. });
  114. ;