@blocklet/theme 3.0.15 → 3.0.17
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/cjs/index.js +2 -2
- package/dist/es/index.js +2 -2
- package/dist/types/blocklet.d.ts +2 -2
- package/dist/types/types.d.ts +56 -0
- package/dist/types/util.d.ts +2 -2
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -12,8 +12,8 @@ const merge = (x, y) => {
|
|
|
12
12
|
function isValidThemeMode(mode) {
|
|
13
13
|
return mode === "light" || mode === "dark";
|
|
14
14
|
}
|
|
15
|
-
function getBlockletThemeOptions(mode = "light") {
|
|
16
|
-
const { common = {}, light = {}, dark = {} } = window.blocklet?.theme || {};
|
|
15
|
+
function getBlockletThemeOptions(mode = "light", meta) {
|
|
16
|
+
const { common = {}, light = {}, dark = {} } = meta || window.blocklet?.theme || {};
|
|
17
17
|
if (mode === "dark") {
|
|
18
18
|
return merge(common, dark);
|
|
19
19
|
}
|
package/dist/es/index.js
CHANGED
|
@@ -10,8 +10,8 @@ const merge = (x, y) => {
|
|
|
10
10
|
function isValidThemeMode(mode) {
|
|
11
11
|
return mode === "light" || mode === "dark";
|
|
12
12
|
}
|
|
13
|
-
function getBlockletThemeOptions(mode = "light") {
|
|
14
|
-
const { common = {}, light = {}, dark = {} } = window.blocklet?.theme || {};
|
|
13
|
+
function getBlockletThemeOptions(mode = "light", meta) {
|
|
14
|
+
const { common = {}, light = {}, dark = {} } = meta || window.blocklet?.theme || {};
|
|
15
15
|
if (mode === "dark") {
|
|
16
16
|
return merge(common, dark);
|
|
17
17
|
}
|
package/dist/types/blocklet.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Theme, ThemeOptions } from './types';
|
|
2
|
-
export type { Theme, ThemeOptions };
|
|
1
|
+
import { Theme, ThemeOptions, BlockletThemeMeta } from './types';
|
|
2
|
+
export type { Theme, ThemeOptions, BlockletThemeMeta };
|
|
3
3
|
export declare const DEFAULT_FONTS: string[];
|
|
4
4
|
/**
|
|
5
5
|
* figma: https://www.figma.com/file/1qHyMF137EXOQpSFVByszG/UX-Library?node-id=295%3A1518
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { PaletteMode } from '@mui/material';
|
|
2
|
+
import { Theme, ThemeOptions, Components, PaletteColorOptions, Shadows, SimplePaletteColorOptions } from '@mui/material/styles';
|
|
3
|
+
declare module '@mui/material/styles' {
|
|
4
|
+
interface Theme {
|
|
5
|
+
mode?: PaletteMode;
|
|
6
|
+
themeName?: string;
|
|
7
|
+
pageWidth?: string;
|
|
8
|
+
/** @deprecated 请使用 theme.palette */
|
|
9
|
+
colors?: Record<string, string>;
|
|
10
|
+
/** @private 标识这是一个 UX Theme */
|
|
11
|
+
__isUxTheme__?: true;
|
|
12
|
+
}
|
|
13
|
+
interface ThemeOptions {
|
|
14
|
+
mode?: PaletteMode;
|
|
15
|
+
themeName?: string;
|
|
16
|
+
pageWidth?: string;
|
|
17
|
+
/** @deprecated 请使用 theme.palette */
|
|
18
|
+
colors?: Record<string, string>;
|
|
19
|
+
/** @deprecated 请使用 components */
|
|
20
|
+
overrides?: Components<Omit<Theme, 'components'>>;
|
|
21
|
+
}
|
|
22
|
+
interface Palette {
|
|
23
|
+
storeSecondary: SimplePaletteColorOptions;
|
|
24
|
+
did: {
|
|
25
|
+
primary: string;
|
|
26
|
+
secondary: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
interface PaletteOptions {
|
|
30
|
+
storeSecondary?: PaletteColorOptions;
|
|
31
|
+
did?: {
|
|
32
|
+
primary?: string;
|
|
33
|
+
secondary?: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
interface TypeText {
|
|
37
|
+
hint: string;
|
|
38
|
+
contrast: string;
|
|
39
|
+
}
|
|
40
|
+
interface TypographyVariants {
|
|
41
|
+
/** @deprecated 请使用 theme.palette.text */
|
|
42
|
+
color: Record<string, string>;
|
|
43
|
+
}
|
|
44
|
+
interface TypographyVariantsOptions {
|
|
45
|
+
/** @deprecated 请使用 theme.palette.text */
|
|
46
|
+
color?: Record<string, string>;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export type BlockletThemeMeta = {
|
|
50
|
+
mode?: PaletteMode;
|
|
51
|
+
prefer?: 'light' | 'dark' | 'system';
|
|
52
|
+
light?: ThemeOptions;
|
|
53
|
+
dark?: ThemeOptions;
|
|
54
|
+
common?: ThemeOptions;
|
|
55
|
+
};
|
|
56
|
+
export type { Theme, ThemeOptions, Shadows };
|
package/dist/types/util.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PaletteMode } from '@mui/material';
|
|
2
|
-
import { ThemeOptions } from './types';
|
|
2
|
+
import { BlockletThemeMeta, ThemeOptions } from './types';
|
|
3
3
|
export declare const BLOCKLET_THEME_PREFER_KEY = "blocklet_theme_prefer";
|
|
4
4
|
export declare const merge: <T>(x: T, y: Partial<T>) => T;
|
|
5
5
|
export declare function isValidThemeMode(mode: any): mode is PaletteMode;
|
|
6
|
-
export declare function getBlockletThemeOptions(mode?: PaletteMode): ThemeOptions;
|
|
6
|
+
export declare function getBlockletThemeOptions(mode?: PaletteMode, meta?: BlockletThemeMeta): ThemeOptions;
|
|
7
7
|
export declare function getDefaultThemePrefer(meta?: {
|
|
8
8
|
theme: {
|
|
9
9
|
prefer: 'light' | 'dark' | 'system';
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "3.0.
|
|
6
|
+
"version": "3.0.17",
|
|
7
7
|
"description": "A preset MUI-based theme configuration designed for use with Blocklet.",
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"module": "dist/es/index.js",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"ts-jest": "^29.4.0",
|
|
46
46
|
"typescript": "~5.5.4"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "4c0ab1335d46f38cc05e804c6ae099dfd6fa9ad8"
|
|
49
49
|
}
|