cs
This commit is contained in:
33
node_modules/@ant-design/cssinjs/es/theme/Theme.js
generated
vendored
Normal file
33
node_modules/@ant-design/cssinjs/es/theme/Theme.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
||||
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
||||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
||||
import { warning } from "rc-util/es/warning";
|
||||
var uuid = 0;
|
||||
|
||||
/**
|
||||
* Theme with algorithms to derive tokens from design tokens.
|
||||
* Use `createTheme` first which will help to manage the theme instance cache.
|
||||
*/
|
||||
var Theme = /*#__PURE__*/function () {
|
||||
function Theme(derivatives) {
|
||||
_classCallCheck(this, Theme);
|
||||
_defineProperty(this, "derivatives", void 0);
|
||||
_defineProperty(this, "id", void 0);
|
||||
this.derivatives = Array.isArray(derivatives) ? derivatives : [derivatives];
|
||||
this.id = uuid;
|
||||
if (derivatives.length === 0) {
|
||||
warning(derivatives.length > 0, '[Ant Design CSS-in-JS] Theme should have at least one derivative function.');
|
||||
}
|
||||
uuid += 1;
|
||||
}
|
||||
_createClass(Theme, [{
|
||||
key: "getDerivativeToken",
|
||||
value: function getDerivativeToken(token) {
|
||||
return this.derivatives.reduce(function (result, derivative) {
|
||||
return derivative(token, result);
|
||||
}, undefined);
|
||||
}
|
||||
}]);
|
||||
return Theme;
|
||||
}();
|
||||
export { Theme as default };
|
||||
Reference in New Issue
Block a user