Skip to content

Commit b7147d2

Browse files
committed
Hotfix: Added build folder
1 parent 66cd9e9 commit b7147d2

12 files changed

+4750
-1
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
node_modules
22
coverage
3-
dist
43
*.log
54
.*
65
!.README

dist/SimpleMap.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"use strict";
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8+
9+
var _class = function () {
10+
function _class() {
11+
_classCallCheck(this, _class);
12+
13+
this.size = 0;
14+
this.keys = [];
15+
this.values = [];
16+
}
17+
18+
_class.prototype.get = function get(key) {
19+
var index = this.keys.indexOf(key);
20+
21+
return this.values[index];
22+
};
23+
24+
_class.prototype.set = function set(key, value) {
25+
this.keys.push(key);
26+
this.values.push(value);
27+
this.size = this.keys.length;
28+
29+
return value;
30+
};
31+
32+
return _class;
33+
}();
34+
35+
exports.default = _class;
36+
module.exports = exports["default"];

dist/extendReactClass.js

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
var _isObject2 = require('lodash/isObject');
8+
9+
var _isObject3 = _interopRequireDefault(_isObject2);
10+
11+
var _react = require('react');
12+
13+
var _react2 = _interopRequireDefault(_react);
14+
15+
var _hoistNonReactStatics = require('hoist-non-react-statics');
16+
17+
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
18+
19+
var _linkClass = require('./linkClass');
20+
21+
var _linkClass2 = _interopRequireDefault(_linkClass);
22+
23+
var _renderNothing = require('./renderNothing');
24+
25+
var _renderNothing2 = _interopRequireDefault(_renderNothing);
26+
27+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28+
29+
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
30+
31+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
32+
33+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
34+
35+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } /* eslint-disable react/prop-types */
36+
37+
/**
38+
* @param {ReactClass} Component
39+
* @param {Object} defaultStyles
40+
* @param {Object} options
41+
* @returns {ReactClass}
42+
*/
43+
exports.default = function (Component, defaultStyles, options) {
44+
var WrappedComponent = function (_Component) {
45+
_inherits(WrappedComponent, _Component);
46+
47+
function WrappedComponent() {
48+
_classCallCheck(this, WrappedComponent);
49+
50+
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
51+
}
52+
53+
WrappedComponent.prototype.render = function render() {
54+
var styles = void 0;
55+
56+
var hasDefaultstyles = (0, _isObject3.default)(defaultStyles);
57+
58+
if (this.props.styles || hasDefaultstyles) {
59+
var props = Object.assign({}, this.props);
60+
61+
if (this.props.styles) {
62+
styles = this.props.styles;
63+
} else if (hasDefaultstyles) {
64+
styles = defaultStyles;
65+
delete this.props.styles;
66+
}
67+
68+
Object.defineProperty(props, 'styles', {
69+
configurable: true,
70+
enumerable: false,
71+
value: styles,
72+
writable: false
73+
});
74+
75+
// Removed to fix this bug https://github.com/gajus/react-css-modules/issues/272
76+
// this.props = props;
77+
} else {
78+
styles = {};
79+
}
80+
81+
var renderResult = _Component.prototype.render.call(this);
82+
83+
if (renderResult) {
84+
return (0, _linkClass2.default)(renderResult, styles, options);
85+
}
86+
87+
return (0, _renderNothing2.default)(_react2.default.version);
88+
};
89+
90+
return WrappedComponent;
91+
}(Component);
92+
93+
return (0, _hoistNonReactStatics2.default)(WrappedComponent, Component);
94+
};
95+
96+
module.exports = exports['default'];

dist/generateAppendClassName.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
var _SimpleMap = require('./SimpleMap');
8+
9+
var _SimpleMap2 = _interopRequireDefault(_SimpleMap);
10+
11+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12+
13+
var CustomMap = typeof Map === 'undefined' ? _SimpleMap2.default : Map;
14+
15+
var stylesIndex = new CustomMap();
16+
17+
exports.default = function (styles, styleNames, handleNotFoundStyleName) {
18+
var appendClassName = void 0;
19+
var stylesIndexMap = void 0;
20+
21+
stylesIndexMap = stylesIndex.get(styles);
22+
23+
if (stylesIndexMap) {
24+
var styleNameIndex = stylesIndexMap.get(styleNames);
25+
26+
if (styleNameIndex) {
27+
return styleNameIndex;
28+
}
29+
} else {
30+
stylesIndexMap = new CustomMap();
31+
stylesIndex.set(styles, new CustomMap());
32+
}
33+
34+
appendClassName = '';
35+
36+
for (var styleName in styleNames) {
37+
if (styleNames.hasOwnProperty(styleName)) {
38+
var className = styles[styleNames[styleName]];
39+
40+
if (className) {
41+
appendClassName += ' ' + className;
42+
} else {
43+
if (handleNotFoundStyleName === 'throw') {
44+
throw new Error('"' + styleNames[styleName] + '" CSS module is undefined.');
45+
}
46+
if (handleNotFoundStyleName === 'log') {
47+
// eslint-disable-next-line no-console
48+
console.warn('"' + styleNames[styleName] + '" CSS module is undefined.');
49+
}
50+
}
51+
}
52+
}
53+
54+
appendClassName = appendClassName.trim();
55+
56+
stylesIndexMap.set(styleNames, appendClassName);
57+
58+
return appendClassName;
59+
};
60+
61+
module.exports = exports['default'];

dist/index.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
var _isFunction2 = require('lodash/isFunction');
8+
9+
var _isFunction3 = _interopRequireDefault(_isFunction2);
10+
11+
var _extendReactClass = require('./extendReactClass');
12+
13+
var _extendReactClass2 = _interopRequireDefault(_extendReactClass);
14+
15+
var _wrapStatelessFunction = require('./wrapStatelessFunction');
16+
17+
var _wrapStatelessFunction2 = _interopRequireDefault(_wrapStatelessFunction);
18+
19+
var _makeConfiguration = require('./makeConfiguration');
20+
21+
var _makeConfiguration2 = _interopRequireDefault(_makeConfiguration);
22+
23+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24+
25+
/**
26+
* Determines if the given object has the signature of a class that inherits React.Component.
27+
*/
28+
29+
30+
/**
31+
* @see https://github.com/gajus/react-css-modules#options
32+
*/
33+
var isReactComponent = function isReactComponent(maybeReactComponent) {
34+
return 'prototype' in maybeReactComponent && (0, _isFunction3.default)(maybeReactComponent.prototype.render);
35+
};
36+
37+
/**
38+
* When used as a function.
39+
*/
40+
var functionConstructor = function functionConstructor(Component, defaultStyles, options) {
41+
var decoratedClass = void 0;
42+
43+
var configuration = (0, _makeConfiguration2.default)(options);
44+
45+
if (isReactComponent(Component)) {
46+
decoratedClass = (0, _extendReactClass2.default)(Component, defaultStyles, configuration);
47+
} else {
48+
decoratedClass = (0, _wrapStatelessFunction2.default)(Component, defaultStyles, configuration);
49+
}
50+
51+
if (Component.displayName) {
52+
decoratedClass.displayName = Component.displayName;
53+
} else {
54+
decoratedClass.displayName = Component.name;
55+
}
56+
57+
return decoratedClass;
58+
};
59+
60+
/**
61+
* When used as a ES7 decorator.
62+
*/
63+
var decoratorConstructor = function decoratorConstructor(defaultStyles, options) {
64+
return function (Component) {
65+
return functionConstructor(Component, defaultStyles, options);
66+
};
67+
};
68+
69+
exports.default = function () {
70+
if ((0, _isFunction3.default)(arguments.length <= 0 ? undefined : arguments[0])) {
71+
return functionConstructor(arguments.length <= 0 ? undefined : arguments[0], arguments.length <= 1 ? undefined : arguments[1], arguments.length <= 2 ? undefined : arguments[2]);
72+
} else {
73+
return decoratorConstructor(arguments.length <= 0 ? undefined : arguments[0], arguments.length <= 1 ? undefined : arguments[1]);
74+
}
75+
};
76+
77+
module.exports = exports['default'];

dist/isIterable.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
var _isObject2 = require('lodash/isObject');
8+
9+
var _isObject3 = _interopRequireDefault(_isObject2);
10+
11+
var _isFunction2 = require('lodash/isFunction');
12+
13+
var _isFunction3 = _interopRequireDefault(_isFunction2);
14+
15+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16+
17+
var ITERATOR_SYMBOL = typeof Symbol !== 'undefined' && (0, _isFunction3.default)(Symbol) && Symbol.iterator;
18+
var OLD_ITERATOR_SYMBOL = '@@iterator';
19+
20+
/**
21+
* @see https://github.com/lodash/lodash/issues/1668
22+
* @see https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols
23+
*/
24+
25+
exports.default = function (maybeIterable) {
26+
var iterator = void 0;
27+
28+
if (!(0, _isObject3.default)(maybeIterable)) {
29+
return false;
30+
}
31+
32+
if (ITERATOR_SYMBOL) {
33+
iterator = maybeIterable[ITERATOR_SYMBOL];
34+
} else {
35+
iterator = maybeIterable[OLD_ITERATOR_SYMBOL];
36+
}
37+
38+
return (0, _isFunction3.default)(iterator);
39+
};
40+
41+
module.exports = exports['default'];

0 commit comments

Comments
 (0)