@particle-network/ui-react 0.5.1-beta.19 → 0.5.1-beta.20
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.js +1 -2
- package/dist/components/UXThemeSwitch/index.d.ts +2 -2
- package/dist/components/UXThemeSwitch/index.js +2 -2
- package/dist/components/UXThemeSwitch/use-theme.d.ts +1 -1
- package/dist/components/UXThemeSwitch/use-theme.js +1 -1
- package/package.json +3 -3
- package/dist/components/UXThemeSwitch/use-color-scheme.d.ts +0 -5
- package/dist/components/UXThemeSwitch/use-color-scheme.js +0 -14
- package/dist/components/UXThemeSwitch/use-theme-color.d.ts +0 -1
- package/dist/components/UXThemeSwitch/use-theme-color.js +0 -6
- package/dist/components/UXThemeSwitch/use-theme-store.d.ts +0 -46
- package/dist/components/UXThemeSwitch/use-theme-store.js +0 -36
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo, useRef } from "react";
|
|
4
|
-
import { radiusMap } from "@particle-network/ui-shared";
|
|
4
|
+
import { radiusMap, useThemeColor } from "@particle-network/ui-shared";
|
|
5
5
|
import { useSize } from "ahooks";
|
|
6
6
|
import { cn } from "../../utils/index.js";
|
|
7
7
|
import { Center } from "../layout/index.js";
|
|
8
|
-
import { useThemeColor } from "../UXThemeSwitch/use-theme-color.js";
|
|
9
8
|
const ProgressWrapper = ({ className, value = 0, width, height, radius = 'sm', strokeWidth = 1, color = 'primary', children, svgClassName, ...restProps })=>{
|
|
10
9
|
const uxColors = useThemeColor();
|
|
11
10
|
const autoLayout = !width && !height;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import { useColorScheme, useThemeColor, useThemeStore } from '@particle-network/ui-shared';
|
|
1
2
|
export * from './theme-switch';
|
|
2
|
-
export * from './use-color-scheme';
|
|
3
3
|
export * from './use-theme';
|
|
4
|
-
export
|
|
4
|
+
export { useColorScheme, useThemeColor, useThemeStore };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import { useColorScheme, useThemeColor, useThemeStore } from "@particle-network/ui-shared";
|
|
1
2
|
export * from "./theme-switch.js";
|
|
2
|
-
export * from "./use-color-scheme.js";
|
|
3
3
|
export * from "./use-theme.js";
|
|
4
|
-
export
|
|
4
|
+
export { useColorScheme, useThemeColor, useThemeStore };
|
|
@@ -11,6 +11,6 @@ export declare const useTheme: () => {
|
|
|
11
11
|
fontUrl: string;
|
|
12
12
|
setFontUrl: (link: string) => void;
|
|
13
13
|
clearFontUrl: () => void;
|
|
14
|
-
fontLoadStatus: import("
|
|
14
|
+
fontLoadStatus: import("@particle-network/ui-shared").FontLoadStatus;
|
|
15
15
|
fontName: string;
|
|
16
16
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { useThemeStore } from "@particle-network/ui-shared";
|
|
1
2
|
import { useDebounceFn } from "ahooks";
|
|
2
|
-
import { useThemeStore } from "./use-theme-store.js";
|
|
3
3
|
import { applyFont, applyTheme, extractFontFamilyFromLink, preloadFonts } from "./utils.js";
|
|
4
4
|
const useTheme = ()=>{
|
|
5
5
|
const theme = useThemeStore((state)=>state.theme);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-network/ui-react",
|
|
3
|
-
"version": "0.5.1-beta.
|
|
3
|
+
"version": "0.5.1-beta.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"react-aria-components": "^1.14.0",
|
|
53
53
|
"values.js": "^2.1.1",
|
|
54
54
|
"zustand": "^5.0.8",
|
|
55
|
-
"@particle-network/icons": "0.5.1-beta.
|
|
56
|
-
"@particle-network/ui-shared": "0.4.1-beta.
|
|
55
|
+
"@particle-network/icons": "0.5.1-beta.7",
|
|
56
|
+
"@particle-network/ui-shared": "0.4.1-beta.6"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "rslib build",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import { useThemeStore } from "./use-theme-store.js";
|
|
3
|
-
const useColorScheme = ()=>{
|
|
4
|
-
const { colorScheme } = useThemeStore((state)=>state.theme);
|
|
5
|
-
const scheme = useMemo(()=>({
|
|
6
|
-
colorScheme,
|
|
7
|
-
isDark: 'dark' === colorScheme,
|
|
8
|
-
isLight: 'light' === colorScheme
|
|
9
|
-
}), [
|
|
10
|
-
colorScheme
|
|
11
|
-
]);
|
|
12
|
-
return scheme;
|
|
13
|
-
};
|
|
14
|
-
export { useColorScheme };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useThemeColor: () => Record<import("@particle-network/ui-shared").ThemeColorVariable, string>;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { type ThemeItemType } from '@particle-network/ui-shared';
|
|
2
|
-
export type FontLoadStatus = 'idle' | 'loading' | 'success' | 'error';
|
|
3
|
-
interface State {
|
|
4
|
-
/**
|
|
5
|
-
* 保存的主题
|
|
6
|
-
*/
|
|
7
|
-
theme: ThemeItemType;
|
|
8
|
-
/**
|
|
9
|
-
* 保存的自定义主题配置(当切换到其他主题时保存,切回 custom 时恢复)
|
|
10
|
-
*/
|
|
11
|
-
customTheme: ThemeItemType;
|
|
12
|
-
/**
|
|
13
|
-
* 保存的字体链接
|
|
14
|
-
*/
|
|
15
|
-
fontUrl: string;
|
|
16
|
-
/**
|
|
17
|
-
* 应用的字体名称
|
|
18
|
-
*/
|
|
19
|
-
fontName: string;
|
|
20
|
-
/**
|
|
21
|
-
* 字体加载状态
|
|
22
|
-
*/
|
|
23
|
-
fontLoadStatus: FontLoadStatus;
|
|
24
|
-
}
|
|
25
|
-
interface Actions {
|
|
26
|
-
setTheme: (theme: ThemeItemType) => void;
|
|
27
|
-
setCustomTheme: (customTheme: ThemeItemType) => void;
|
|
28
|
-
setFontUrl: (fontUrl: string) => void;
|
|
29
|
-
setFontLoadStatus: (status: FontLoadStatus) => void;
|
|
30
|
-
setFontName: (name: string) => void;
|
|
31
|
-
}
|
|
32
|
-
type ThemeStore = State & Actions;
|
|
33
|
-
export declare const useThemeStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<ThemeStore>, "setState" | "persist"> & {
|
|
34
|
-
setState(partial: ThemeStore | Partial<ThemeStore> | ((state: ThemeStore) => ThemeStore | Partial<ThemeStore>), replace?: false | undefined): unknown;
|
|
35
|
-
setState(state: ThemeStore | ((state: ThemeStore) => ThemeStore), replace: true): unknown;
|
|
36
|
-
persist: {
|
|
37
|
-
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<ThemeStore, unknown, unknown>>) => void;
|
|
38
|
-
clearStorage: () => void;
|
|
39
|
-
rehydrate: () => Promise<void> | void;
|
|
40
|
-
hasHydrated: () => boolean;
|
|
41
|
-
onHydrate: (fn: (state: ThemeStore) => void) => () => void;
|
|
42
|
-
onFinishHydration: (fn: (state: ThemeStore) => void) => () => void;
|
|
43
|
-
getOptions: () => Partial<import("zustand/middleware").PersistOptions<ThemeStore, unknown, unknown>>;
|
|
44
|
-
};
|
|
45
|
-
}>;
|
|
46
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { CustomTheme, UXDarkTheme } from "@particle-network/ui-shared";
|
|
2
|
-
import { create } from "zustand";
|
|
3
|
-
import { createJSONStorage, persist } from "zustand/middleware";
|
|
4
|
-
const useThemeStore = create()(persist((set)=>({
|
|
5
|
-
theme: UXDarkTheme,
|
|
6
|
-
customTheme: CustomTheme,
|
|
7
|
-
fontUrl: '',
|
|
8
|
-
fontName: '',
|
|
9
|
-
fontLoadStatus: 'idle',
|
|
10
|
-
setTheme: (theme)=>set({
|
|
11
|
-
theme
|
|
12
|
-
}),
|
|
13
|
-
setCustomTheme: (customTheme)=>set({
|
|
14
|
-
customTheme
|
|
15
|
-
}),
|
|
16
|
-
setFontUrl: (fontUrl)=>set({
|
|
17
|
-
fontUrl
|
|
18
|
-
}),
|
|
19
|
-
setFontLoadStatus: (fontLoadStatus)=>set({
|
|
20
|
-
fontLoadStatus
|
|
21
|
-
}),
|
|
22
|
-
setFontName: (fontName)=>set({
|
|
23
|
-
fontName
|
|
24
|
-
})
|
|
25
|
-
}), {
|
|
26
|
-
name: 'ux-preference-theme',
|
|
27
|
-
version: 2,
|
|
28
|
-
storage: createJSONStorage(()=>'undefined' != typeof window ? window.localStorage : {}),
|
|
29
|
-
partialize: (state)=>({
|
|
30
|
-
theme: state.theme,
|
|
31
|
-
customTheme: state.customTheme,
|
|
32
|
-
fontName: state.fontName,
|
|
33
|
-
fontUrl: state.fontUrl
|
|
34
|
-
})
|
|
35
|
-
}));
|
|
36
|
-
export { useThemeStore };
|