@particle-network/ui-react 0.5.1-beta.4 → 0.5.1-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ProgressWrapper/index.d.ts +2 -2
- package/dist/components/UXButton/button.js +1 -1
- package/dist/components/UXChip/chip.extend.d.ts +2 -1
- package/dist/components/UXChip/index.d.ts +1 -1
- package/dist/components/UXColorPicker/color-picker.js +1 -1
- package/dist/components/UXColorPicker/types.d.ts +1 -1
- package/dist/components/UXInput/index.d.ts +4 -4
- package/dist/components/UXInput/input.extend.d.ts +4 -4
- package/dist/components/UXSpinner/spinner.d.ts +1 -5
- package/dist/components/UXSpinner/spinner.js +2 -3
- package/dist/components/UXSwitch/index.d.ts +2 -2
- package/dist/components/UXSwitch/switch.extend.d.ts +2 -2
- package/dist/components/UXTable/index.d.ts +2 -2
- package/dist/components/UXTable/table.extend.d.ts +2 -2
- package/dist/components/UXThemeSwitch/constants.d.ts +9 -0
- package/dist/components/UXThemeSwitch/constants.js +3 -0
- package/dist/components/UXThemeSwitch/custom-theme-config.js +52 -15
- package/dist/components/UXThemeSwitch/theme-item.js +47 -11
- package/dist/components/UXThemeSwitch/theme-switch.js +6 -5
- package/dist/components/UXThemeSwitch/use-theme-color.d.ts +1 -22
- package/dist/components/UXThemeSwitch/use-theme-color.js +1 -9
- package/dist/components/UXThemeSwitch/use-theme-store.d.ts +5 -0
- package/dist/components/UXThemeSwitch/use-theme-store.js +9 -4
- package/dist/components/UXThemeSwitch/use-theme.d.ts +2 -0
- package/dist/components/UXThemeSwitch/use-theme.js +5 -76
- package/dist/components/UXThemeSwitch/utils.d.ts +28 -0
- package/dist/components/UXThemeSwitch/utils.js +202 -0
- package/dist/components/layout/Box/box-theme.d.ts +1808 -0
- package/dist/components/layout/Box/box-theme.js +328 -0
- package/dist/components/layout/Box/box.d.ts +14 -0
- package/dist/components/layout/Box/box.js +90 -0
- package/dist/components/layout/Circle.js +2 -3
- package/dist/components/layout/Flex.d.ts +3 -27
- package/dist/components/layout/Flex.js +6 -19
- package/dist/components/layout/HStack.d.ts +1 -1
- package/dist/components/layout/Square.js +5 -3
- package/dist/components/layout/VStack.d.ts +1 -1
- package/dist/components/layout/VStack.js +2 -2
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/index.js +1 -0
- package/dist/components/typography/Text.js +21 -6
- package/dist/components/typography/Text.type.d.ts +3 -26
- package/dist/components/typography/Text.type.js +0 -47
- package/dist/components/typography/text-theme.d.ts +178 -0
- package/dist/components/typography/text-theme.js +79 -0
- package/dist/heroui/constants.d.ts +18 -0
- package/dist/heroui/constants.js +98 -0
- package/dist/heroui/types.d.ts +91 -0
- package/dist/heroui/types.js +0 -0
- package/dist/heroui/utils/colors.d.ts +34 -0
- package/dist/heroui/utils/colors.js +121 -0
- package/dist/heroui/utils/object.d.ts +1 -0
- package/dist/heroui/utils/object.js +17 -0
- package/dist/hooks/useI18n.d.ts +54 -38
- package/dist/hooks/useI18n.js +54 -38
- package/package.json +4 -3
- package/tailwind-preset.js +22 -69
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CustomTheme, UXDarkTheme } from "@particle-network/ui-shared";
|
|
2
2
|
import { create } from "zustand";
|
|
3
3
|
import { createJSONStorage, persist } from "zustand/middleware";
|
|
4
4
|
const useThemeStore = create()(persist((set)=>({
|
|
5
|
-
theme:
|
|
5
|
+
theme: UXDarkTheme,
|
|
6
|
+
customTheme: CustomTheme,
|
|
6
7
|
fontUrl: '',
|
|
7
8
|
fontName: '',
|
|
8
9
|
fontLoadStatus: 'idle',
|
|
9
10
|
setTheme: (theme)=>set({
|
|
10
11
|
theme
|
|
11
12
|
}),
|
|
13
|
+
setCustomTheme: (customTheme)=>set({
|
|
14
|
+
customTheme
|
|
15
|
+
}),
|
|
12
16
|
setFontUrl: (fontUrl)=>set({
|
|
13
17
|
fontUrl
|
|
14
18
|
}),
|
|
@@ -19,11 +23,12 @@ const useThemeStore = create()(persist((set)=>({
|
|
|
19
23
|
fontName
|
|
20
24
|
})
|
|
21
25
|
}), {
|
|
22
|
-
name: 'ux-
|
|
23
|
-
version:
|
|
26
|
+
name: 'ux-preference-theme',
|
|
27
|
+
version: 0,
|
|
24
28
|
storage: createJSONStorage(()=>'undefined' != typeof window ? window.localStorage : {}),
|
|
25
29
|
partialize: (state)=>({
|
|
26
30
|
theme: state.theme,
|
|
31
|
+
customTheme: state.customTheme,
|
|
27
32
|
fontName: state.fontName,
|
|
28
33
|
fontUrl: state.fontUrl
|
|
29
34
|
})
|
|
@@ -4,7 +4,9 @@ import { type ThemeItemType } from '@particle-network/ui-shared';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const useTheme: () => {
|
|
6
6
|
theme: ThemeItemType;
|
|
7
|
+
customTheme: ThemeItemType;
|
|
7
8
|
setTheme: (theme: ThemeItemType) => void;
|
|
9
|
+
setCustomTheme: (customTheme: ThemeItemType) => void;
|
|
8
10
|
fontUrl: string;
|
|
9
11
|
setFontUrl: (link: string) => void;
|
|
10
12
|
clearFontUrl: () => void;
|
|
@@ -1,88 +1,15 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
|
-
import { colorToCSSVariable, hexColorToHSLValue, themeKeys } from "@particle-network/ui-shared";
|
|
3
2
|
import { useDebounceFn } from "ahooks";
|
|
4
3
|
import { useThemeStore } from "./use-theme-store.js";
|
|
5
|
-
|
|
6
|
-
const PRELOAD_FONTS_URL = 'https://fonts.googleapis.com/css2?family=Geist:wght@100..900&family=IBM+Plex+Sans:ital,wght@0,100..700;1,100..700&display=swap';
|
|
7
|
-
const preloadFonts = ()=>{
|
|
8
|
-
if ('undefined' == typeof window) return;
|
|
9
|
-
const existingLink = document.getElementById('ux-preload-fonts-link');
|
|
10
|
-
if (existingLink) return;
|
|
11
|
-
const linkElement = document.createElement('link');
|
|
12
|
-
linkElement.id = 'ux-preload-fonts-link';
|
|
13
|
-
linkElement.rel = 'stylesheet';
|
|
14
|
-
linkElement.href = PRELOAD_FONTS_URL;
|
|
15
|
-
document.head.appendChild(linkElement);
|
|
16
|
-
};
|
|
17
|
-
const applyCustomThemeColors = (theme)=>{
|
|
18
|
-
if ('undefined' == typeof window) return;
|
|
19
|
-
const root = document.documentElement;
|
|
20
|
-
Object.entries(theme.colorVariables).forEach(([color, value])=>{
|
|
21
|
-
const cssVariable = colorToCSSVariable[color]?.self;
|
|
22
|
-
if (cssVariable) cssVariable.forEach((variable)=>{
|
|
23
|
-
root.style.setProperty(variable, hexColorToHSLValue(value));
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
const clearCustomThemeColors = ()=>{
|
|
28
|
-
if ('undefined' == typeof window) return;
|
|
29
|
-
const root = document.documentElement;
|
|
30
|
-
Object.values(colorToCSSVariable).forEach((cssVar)=>{
|
|
31
|
-
cssVar.self?.forEach((variable)=>{
|
|
32
|
-
root.style.removeProperty(variable);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
const applyTheme = (theme)=>{
|
|
37
|
-
if ('undefined' == typeof window) return;
|
|
38
|
-
const root = document.documentElement;
|
|
39
|
-
const isClassListCorrect = root.classList.contains(theme.id);
|
|
40
|
-
const isDataThemeCorrect = root.getAttribute('data-theme') === theme.colorScheme;
|
|
41
|
-
const isDataPrefersColorCorrect = root.getAttribute('data-prefers-color') === theme.colorScheme;
|
|
42
|
-
if ('custom' === theme.id) {
|
|
43
|
-
clearCustomThemeColors();
|
|
44
|
-
applyCustomThemeColors(theme);
|
|
45
|
-
} else clearCustomThemeColors();
|
|
46
|
-
if (isClassListCorrect && isDataThemeCorrect && isDataPrefersColorCorrect && 'custom' !== theme.id) return;
|
|
47
|
-
if (!isDataThemeCorrect) root.setAttribute('data-theme', theme.colorScheme);
|
|
48
|
-
if (!isDataPrefersColorCorrect) root.setAttribute('data-prefers-color', theme.colorScheme);
|
|
49
|
-
root.classList.remove('dark');
|
|
50
|
-
root.classList.remove('light');
|
|
51
|
-
if (!isClassListCorrect) {
|
|
52
|
-
themeKeys.forEach((key)=>{
|
|
53
|
-
root.classList.remove(key);
|
|
54
|
-
});
|
|
55
|
-
root.classList.add('custom' === theme.id ? theme.baseThemeId : theme.id);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const extractFontFamilyFromLink = (link)=>{
|
|
59
|
-
if (!link) return null;
|
|
60
|
-
try {
|
|
61
|
-
const url = new URL(link);
|
|
62
|
-
const familyParam = url.searchParams.get('family');
|
|
63
|
-
if (!familyParam) return null;
|
|
64
|
-
const firstFamily = familyParam.split('&family=')[0].split(':')[0].replace(/\+/g, ' ');
|
|
65
|
-
return firstFamily;
|
|
66
|
-
} catch {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
const applyFont = (fontName)=>{
|
|
71
|
-
if ('undefined' == typeof window) return;
|
|
72
|
-
if (fontName) {
|
|
73
|
-
document.documentElement.style.setProperty('--ux-font-family', `"${fontName}", ${DEFAULT_FONT_FAMILY}`);
|
|
74
|
-
document.body.style.fontFamily = `"${fontName}", ${DEFAULT_FONT_FAMILY}`;
|
|
75
|
-
} else {
|
|
76
|
-
document.documentElement.style.setProperty('--ux-font-family', DEFAULT_FONT_FAMILY);
|
|
77
|
-
document.body.style.fontFamily = DEFAULT_FONT_FAMILY;
|
|
78
|
-
}
|
|
79
|
-
};
|
|
4
|
+
import { applyFont, applyTheme, extractFontFamilyFromLink, preloadFonts } from "./utils.js";
|
|
80
5
|
const useTheme = ()=>{
|
|
81
6
|
const theme = useThemeStore((state)=>state.theme);
|
|
7
|
+
const customTheme = useThemeStore((state)=>state.customTheme);
|
|
82
8
|
const fontUrl = useThemeStore((state)=>state.fontUrl);
|
|
83
9
|
const fontName = useThemeStore((state)=>state.fontName);
|
|
84
10
|
const fontLoadStatus = useThemeStore((state)=>state.fontLoadStatus);
|
|
85
11
|
const storeSetTheme = useThemeStore((state)=>state.setTheme);
|
|
12
|
+
const storeSetCustomTheme = useThemeStore((state)=>state.setCustomTheme);
|
|
86
13
|
const storeSetFontUrl = useThemeStore((state)=>state.setFontUrl);
|
|
87
14
|
const storeSetFontLoadStatus = useThemeStore((state)=>state.setFontLoadStatus);
|
|
88
15
|
const storeSetFontName = useThemeStore((state)=>state.setFontName);
|
|
@@ -142,7 +69,9 @@ const useTheme = ()=>{
|
|
|
142
69
|
};
|
|
143
70
|
return {
|
|
144
71
|
theme,
|
|
72
|
+
customTheme,
|
|
145
73
|
setTheme,
|
|
74
|
+
setCustomTheme: storeSetCustomTheme,
|
|
146
75
|
fontUrl,
|
|
147
76
|
setFontUrl,
|
|
148
77
|
clearFontUrl,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ThemeItemType } from '@particle-network/ui-shared';
|
|
2
|
+
/**
|
|
3
|
+
* 初始化并预加载字体 CSS(仅执行一次)
|
|
4
|
+
*/
|
|
5
|
+
export declare const preloadFonts: () => void;
|
|
6
|
+
export declare const setCSSProperty: (property: string, value: string) => void;
|
|
7
|
+
/**
|
|
8
|
+
* 应用自定义主题的颜色到 CSS 变量
|
|
9
|
+
*/
|
|
10
|
+
export declare const applyCustomThemeColors: (theme: ThemeItemType) => void;
|
|
11
|
+
/**
|
|
12
|
+
* 清除自定义主题的 CSS 变量(切换到其他主题时)
|
|
13
|
+
*/
|
|
14
|
+
export declare const clearCustomThemeColors: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* 应用主题到文档根元素
|
|
17
|
+
*/
|
|
18
|
+
export declare const applyTheme: (theme: ThemeItemType) => void;
|
|
19
|
+
/**
|
|
20
|
+
* 从 Google Fonts 链接中提取字体名称
|
|
21
|
+
* 例如: https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap
|
|
22
|
+
* 提取: Roboto
|
|
23
|
+
*/
|
|
24
|
+
export declare const extractFontFamilyFromLink: (link: string) => string | null;
|
|
25
|
+
/**
|
|
26
|
+
* 应用字体到 DOM
|
|
27
|
+
*/
|
|
28
|
+
export declare const applyFont: (fontName: string | undefined) => void;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { hexColorToHSLValue, themeKeys } from "@particle-network/ui-shared";
|
|
2
|
+
import { readableColor } from "color2k";
|
|
3
|
+
import { generateThemeColor } from "../../heroui/utils/colors.js";
|
|
4
|
+
import { DEFAULT_FONT_FAMILY, PRELOAD_FONTS_URL } from "./constants.js";
|
|
5
|
+
const getCSSProperties = (theme)=>{
|
|
6
|
+
const { colorVariables } = theme;
|
|
7
|
+
return {
|
|
8
|
+
foreground: [
|
|
9
|
+
[
|
|
10
|
+
'--heroui-foreground',
|
|
11
|
+
colorVariables.foreground
|
|
12
|
+
]
|
|
13
|
+
],
|
|
14
|
+
secondary: [
|
|
15
|
+
...generateThemeColor(colorVariables.secondary, 'secondary', theme.colorScheme).cssVariables,
|
|
16
|
+
[
|
|
17
|
+
'--heroui-foreground-300',
|
|
18
|
+
colorVariables.secondary
|
|
19
|
+
]
|
|
20
|
+
],
|
|
21
|
+
tertiary: [
|
|
22
|
+
[
|
|
23
|
+
'--heroui-tertiary',
|
|
24
|
+
colorVariables.tertiary
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
'--heroui-foreground-100',
|
|
28
|
+
colorVariables.tertiary
|
|
29
|
+
],
|
|
30
|
+
[
|
|
31
|
+
'--heroui-tertiary-foreground',
|
|
32
|
+
readableColor(colorVariables.tertiary)
|
|
33
|
+
]
|
|
34
|
+
],
|
|
35
|
+
primary: generateThemeColor(colorVariables.primary, 'primary', theme.colorScheme).cssVariables,
|
|
36
|
+
success: generateThemeColor(colorVariables.success, 'success', theme.colorScheme).cssVariables,
|
|
37
|
+
danger: generateThemeColor(colorVariables.danger, 'danger', theme.colorScheme).cssVariables,
|
|
38
|
+
alert: [
|
|
39
|
+
[
|
|
40
|
+
'--heroui-alert',
|
|
41
|
+
colorVariables.alert
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
'--heroui-alert-foreground',
|
|
45
|
+
readableColor(colorVariables.alert)
|
|
46
|
+
]
|
|
47
|
+
],
|
|
48
|
+
warning: generateThemeColor(colorVariables.warning, 'warning', theme.colorScheme).cssVariables,
|
|
49
|
+
'bg-default': [
|
|
50
|
+
[
|
|
51
|
+
'--heroui-background',
|
|
52
|
+
colorVariables['bg-default']
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
'--heroui-background-500',
|
|
56
|
+
colorVariables['bg-default']
|
|
57
|
+
]
|
|
58
|
+
],
|
|
59
|
+
'bg-200': [
|
|
60
|
+
[
|
|
61
|
+
'--heroui-background-200',
|
|
62
|
+
colorVariables['bg-200']
|
|
63
|
+
]
|
|
64
|
+
],
|
|
65
|
+
'bg-300': [
|
|
66
|
+
[
|
|
67
|
+
'--heroui-background-300',
|
|
68
|
+
colorVariables['bg-300']
|
|
69
|
+
]
|
|
70
|
+
],
|
|
71
|
+
'bg-400': [
|
|
72
|
+
[
|
|
73
|
+
'--heroui-background-400',
|
|
74
|
+
colorVariables['bg-400']
|
|
75
|
+
]
|
|
76
|
+
],
|
|
77
|
+
overlay: [
|
|
78
|
+
[
|
|
79
|
+
'--heroui-overlay',
|
|
80
|
+
colorVariables.overlay
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
'--heroui-content1',
|
|
84
|
+
colorVariables.overlay
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
'--heroui-overlay-foreground',
|
|
88
|
+
readableColor(colorVariables.overlay)
|
|
89
|
+
],
|
|
90
|
+
[
|
|
91
|
+
'--heroui-content1-foreground',
|
|
92
|
+
readableColor(colorVariables.overlay)
|
|
93
|
+
]
|
|
94
|
+
],
|
|
95
|
+
divider: [
|
|
96
|
+
[
|
|
97
|
+
'--heroui-divider',
|
|
98
|
+
colorVariables.divider
|
|
99
|
+
],
|
|
100
|
+
[
|
|
101
|
+
'--heroui-divider-foreground',
|
|
102
|
+
readableColor(colorVariables.divider)
|
|
103
|
+
]
|
|
104
|
+
],
|
|
105
|
+
bullish: [
|
|
106
|
+
[
|
|
107
|
+
'--heroui-bullish',
|
|
108
|
+
colorVariables.bullish
|
|
109
|
+
],
|
|
110
|
+
[
|
|
111
|
+
'--heroui-bullish-foreground',
|
|
112
|
+
readableColor(colorVariables.bullish)
|
|
113
|
+
]
|
|
114
|
+
],
|
|
115
|
+
bearish: [
|
|
116
|
+
[
|
|
117
|
+
'--heroui-bearish',
|
|
118
|
+
colorVariables.bearish
|
|
119
|
+
],
|
|
120
|
+
[
|
|
121
|
+
'--heroui-bearish-foreground',
|
|
122
|
+
readableColor(colorVariables.bearish)
|
|
123
|
+
]
|
|
124
|
+
]
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
const preloadFonts = ()=>{
|
|
128
|
+
if ('undefined' == typeof window) return;
|
|
129
|
+
const existingLink = document.getElementById('ux-preload-fonts-link');
|
|
130
|
+
if (existingLink) return;
|
|
131
|
+
const linkElement = document.createElement('link');
|
|
132
|
+
linkElement.id = 'ux-preload-fonts-link';
|
|
133
|
+
linkElement.rel = 'stylesheet';
|
|
134
|
+
linkElement.href = PRELOAD_FONTS_URL;
|
|
135
|
+
document.head.appendChild(linkElement);
|
|
136
|
+
};
|
|
137
|
+
const setCSSProperty = (property, value)=>{
|
|
138
|
+
if ('undefined' == typeof window) return;
|
|
139
|
+
const root = document.documentElement;
|
|
140
|
+
root.style.setProperty(property, hexColorToHSLValue(value));
|
|
141
|
+
};
|
|
142
|
+
const applyCustomThemeColors = (theme)=>{
|
|
143
|
+
if ('undefined' == typeof window) return;
|
|
144
|
+
const cssProperties = getCSSProperties(theme);
|
|
145
|
+
Object.entries(cssProperties).forEach(([, value])=>{
|
|
146
|
+
value.forEach(([variable, value])=>{
|
|
147
|
+
setCSSProperty(variable, value);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
const clearCustomThemeColors = ()=>{
|
|
152
|
+
if ('undefined' == typeof window) return;
|
|
153
|
+
const rootStyles = getComputedStyle(document.documentElement);
|
|
154
|
+
Array.from(rootStyles).filter((prop)=>prop.startsWith('--heroui')).forEach((prop)=>{
|
|
155
|
+
document.documentElement.style.removeProperty(prop);
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
const applyTheme = (theme)=>{
|
|
159
|
+
if ('undefined' == typeof window) return;
|
|
160
|
+
const root = document.documentElement;
|
|
161
|
+
const isClassListCorrect = root.classList.contains(theme.id);
|
|
162
|
+
const isDataThemeCorrect = root.getAttribute('data-theme') === theme.colorScheme;
|
|
163
|
+
const isDataPrefersColorCorrect = root.getAttribute('data-prefers-color') === theme.colorScheme;
|
|
164
|
+
if ('custom' === theme.id) {
|
|
165
|
+
clearCustomThemeColors();
|
|
166
|
+
applyCustomThemeColors(theme);
|
|
167
|
+
} else clearCustomThemeColors();
|
|
168
|
+
if (isClassListCorrect && isDataThemeCorrect && isDataPrefersColorCorrect && 'custom' !== theme.id) return;
|
|
169
|
+
if (!isDataThemeCorrect) root.setAttribute('data-theme', theme.colorScheme);
|
|
170
|
+
if (!isDataPrefersColorCorrect) root.setAttribute('data-prefers-color', theme.colorScheme);
|
|
171
|
+
root.classList.remove('dark');
|
|
172
|
+
root.classList.remove('light');
|
|
173
|
+
if (!isClassListCorrect) {
|
|
174
|
+
themeKeys.forEach((key)=>{
|
|
175
|
+
root.classList.remove(key);
|
|
176
|
+
});
|
|
177
|
+
root.classList.add('custom' === theme.id ? theme.baseThemeId : theme.id);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const extractFontFamilyFromLink = (link)=>{
|
|
181
|
+
if (!link) return null;
|
|
182
|
+
try {
|
|
183
|
+
const url = new URL(link);
|
|
184
|
+
const familyParam = url.searchParams.get('family');
|
|
185
|
+
if (!familyParam) return null;
|
|
186
|
+
const firstFamily = familyParam.split('&family=')[0].split(':')[0].replace(/\+/g, ' ');
|
|
187
|
+
return firstFamily;
|
|
188
|
+
} catch {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const applyFont = (fontName)=>{
|
|
193
|
+
if ('undefined' == typeof window) return;
|
|
194
|
+
if (fontName) {
|
|
195
|
+
document.documentElement.style.setProperty('--ux-font-family', `"${fontName}", ${DEFAULT_FONT_FAMILY}`);
|
|
196
|
+
document.body.style.fontFamily = `"${fontName}", ${DEFAULT_FONT_FAMILY}`;
|
|
197
|
+
} else {
|
|
198
|
+
document.documentElement.style.setProperty('--ux-font-family', DEFAULT_FONT_FAMILY);
|
|
199
|
+
document.body.style.fontFamily = DEFAULT_FONT_FAMILY;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
export { applyCustomThemeColors, applyFont, applyTheme, clearCustomThemeColors, extractFontFamilyFromLink, preloadFonts, setCSSProperty };
|