mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 17:02:38 +00:00
Theming API: Refactor on internal CSS variables
This commit is contained in:
parent
c61840859f
commit
b94d91e677
10 changed files with 49 additions and 27 deletions
|
@ -1,12 +1,14 @@
|
|||
import Theme, { SharedUtils } from 'primevue/themes';
|
||||
|
||||
export const $dt = (tokenPath, type) => {
|
||||
const types = ['value', 'variable'];
|
||||
|
||||
export const $dt = (tokenPath, param1, param2) => {
|
||||
const config = Theme.getPConfig();
|
||||
|
||||
return dt(config?.theme, tokenPath, undefined, type);
|
||||
return types.includes(param1) ? dt(config?.theme, tokenPath, undefined, param2) : dt(config?.theme, tokenPath, param1, param2);
|
||||
};
|
||||
|
||||
export const dt = (theme = {}, tokenPath, fallback, type) => {
|
||||
export const dt = (theme = {}, tokenPath, fallback, type = 'variable') => {
|
||||
if (tokenPath) {
|
||||
const VARIABLE = Theme.defaults.variable;
|
||||
const { prefix, transform } = theme?.options || {};
|
||||
|
@ -19,3 +21,17 @@ export const dt = (theme = {}, tokenPath, fallback, type) => {
|
|||
|
||||
return '';
|
||||
};
|
||||
|
||||
export const $dtp = (tokenPath) => {
|
||||
const config = Theme.getPConfig();
|
||||
|
||||
const variable = dt(config?.theme, tokenPath, undefined, 'variable');
|
||||
const name = variable.match(/--[\w-]+/g)?.[0];
|
||||
const value = dt(config?.theme, tokenPath, undefined, 'value');
|
||||
|
||||
return {
|
||||
variable,
|
||||
name,
|
||||
value
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue