download
raw
1.03 kB
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createGetCssVar;
/**
* The benefit of this function is to help developers get CSS var from theme without specifying the whole variable
* and they does not need to remember the prefix (defined once).
*/
function createGetCssVar(prefix = '') {
function appendVar(...vars) {
if (!vars.length) {
return '';
}
const value = vars[0];
if (typeof value === 'string' && !value.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)) {
return `, var(--${prefix ? `${prefix}-` : ''}${value}${appendVar(...vars.slice(1))})`;
}
return `, ${value}`;
}
// AdditionalVars makes `getCssVar` less strict, so it can be use like this `getCssVar('non-mui-variable')` without type error.
const getCssVar = (field, ...fallbacks) => {
return `var(--${prefix ? `${prefix}-` : ''}${field}${appendVar(...fallbacks)})`;
};
return getCssVar;
}

Xet Storage Details

Size:
1.03 kB
·
Xet hash:
afc91ccd9fecb9510c9b2a22c59c0fa3a95e1a379b6107d2c8ad6d45ba76decc

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.