Outlook_Addin_LLM/node_modules/@fluentui/tokens/lib-commonjs/themeToTokensObject.js

26 lines
923 B
JavaScript
Raw Permalink Normal View History

/**
* Programmatically generates a tokens to css variables mapping object from the keys in a theme.
* This helps with ease of use as a user of a custom theme does not have to manually construct this object, but it could
* affect tree-shaking since bundlers do not know the shape of the output.
*
* @param theme - Theme from which to get the keys to generate the tokens to css variables mapping object
* @returns Tokens to css variables mapping object corresponding to the passed theme
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "themeToTokensObject", {
enumerable: true,
get: function() {
return themeToTokensObject;
}
});
function themeToTokensObject(theme) {
const tokens = {};
const keys = Object.keys(theme);
for (const key of keys){
tokens[key] = `var(--${String(key)})`;
}
return tokens;
}