mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 17:02:38 +00:00
Theming API: Improve performance
This commit is contained in:
parent
d0d0a38598
commit
45521ea6af
28 changed files with 193 additions and 141 deletions
|
@ -3,9 +3,9 @@ import Theme, { SharedUtils } from 'primevue/themes';
|
|||
const types = ['value', 'variable'];
|
||||
|
||||
export const $dt = (tokenPath, param1, param2) => {
|
||||
const config = Theme.getPConfig();
|
||||
const theme = Theme.getTheme();
|
||||
|
||||
return types.includes(param1) ? dt(config?.theme, tokenPath, undefined, param1) : dt(config?.theme, tokenPath, param1, param2);
|
||||
return types.includes(param1) ? dt(theme, tokenPath, undefined, param1) : dt(theme, tokenPath, param1, param2);
|
||||
};
|
||||
|
||||
export const dt = (theme = {}, tokenPath, fallback, type = 'variable') => {
|
||||
|
@ -23,11 +23,11 @@ export const dt = (theme = {}, tokenPath, fallback, type = 'variable') => {
|
|||
};
|
||||
|
||||
export const $dtp = (tokenPath) => {
|
||||
const config = Theme.getPConfig();
|
||||
const theme = Theme.getTheme();
|
||||
|
||||
const variable = dt(config?.theme, tokenPath, undefined, 'variable');
|
||||
const variable = dt(theme, tokenPath, undefined, 'variable');
|
||||
const name = variable.match(/--[\w-]+/g)?.[0];
|
||||
const value = dt(config?.theme, tokenPath, undefined, 'value');
|
||||
const value = dt(theme, tokenPath, undefined, 'value');
|
||||
|
||||
return {
|
||||
variable,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue