mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 08:52:34 +00:00
Theming API: Update themes folder structure and all exports
This commit is contained in:
parent
5403be3a70
commit
e23fd12ff4
27 changed files with 92 additions and 18 deletions
21
components/lib/themes/helpers/dt.js
Normal file
21
components/lib/themes/helpers/dt.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
import Theme, { SharedUtils } from 'primevue/themes';
|
||||
|
||||
export const $dt = (tokenPath, type) => {
|
||||
const config = Theme.getPConfig();
|
||||
|
||||
return dt(config?.theme, tokenPath, type);
|
||||
};
|
||||
|
||||
export const dt = (theme = {}, tokenPath, type) => {
|
||||
if (tokenPath) {
|
||||
const VARIABLE = Theme.defaults.variable;
|
||||
const { prefix, transform } = theme?.options || {};
|
||||
const regex = /{([^}]*)}/g;
|
||||
const token = SharedUtils.object.test(regex, tokenPath) ? tokenPath : `{${tokenPath}}`;
|
||||
const isStrictTransform = type === 'value' || transform === 'strict'; // @todo - TRANSFORM: strict | lenient(default)
|
||||
|
||||
return isStrictTransform ? Theme.getTokenValue(tokenPath) : SharedUtils.object.getVariableValue(token, undefined, prefix, [VARIABLE.excludedKeyRegex]);
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue