This commit is contained in:
2026-05-25 17:07:28 +08:00
parent 30cba5ee96
commit df501f6151
10000 changed files with 276005 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _warning = require("@rc-component/util/lib/warning");
let uuid = 0;
/**
* Theme with algorithms to derive tokens from design tokens.
* Use `createTheme` first which will help to manage the theme instance cache.
*/
class Theme {
derivatives;
id;
constructor(derivatives) {
this.derivatives = Array.isArray(derivatives) ? derivatives : [derivatives];
this.id = uuid;
if (derivatives.length === 0) {
(0, _warning.warning)(derivatives.length > 0, '[Ant Design CSS-in-JS] Theme should have at least one derivative function.');
}
uuid += 1;
}
getDerivativeToken(token) {
return this.derivatives.reduce((result, derivative) => derivative(token, result), undefined);
}
}
exports.default = Theme;