vite-plugin-theme-css 0.3.0 → 0.4.0
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/README.md +6 -0
- package/client.d.ts +15 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -161,6 +161,12 @@ getTheme() // 'dark'
|
|
|
161
161
|
|
|
162
162
|
`setTheme` 默认在主题名为 `dark` 时同步给 `<html>` 加上 `dark` class(可用 `syncHtmlDark: false` 关闭)。
|
|
163
163
|
|
|
164
|
+
TypeScript 需引入虚拟模块声明(在 `env.d.ts` / `vite-env.d.ts` 中):
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
/// <reference types="vite-plugin-theme-css/client" />
|
|
168
|
+
```
|
|
169
|
+
|
|
164
170
|
## 插件选项
|
|
165
171
|
|
|
166
172
|
```ts
|
package/client.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 用户侧虚拟模块的 ambient 声明。
|
|
3
|
+
* 在项目 env.d.ts / vite-env.d.ts 中引用:
|
|
4
|
+
*
|
|
5
|
+
* /// <reference types="vite-plugin-theme-css/client" />
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
declare module '@scope/theme-css' {
|
|
9
|
+
export function theme(...keys: string[]): string
|
|
10
|
+
export function common(...keys: string[]): string
|
|
11
|
+
export function setTheme(name: string): void
|
|
12
|
+
export function getTheme(): string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare module 'virtual:theme-css/css' {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-theme-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Vite 插件:用一份主题配置生成 CSS 变量、SCSS helper 与 JS 运行时,支持多主题切换与热更新",
|
|
5
5
|
"author": "yuzinan <1589937631@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,10 +40,14 @@
|
|
|
40
40
|
"types": "./dist/runtime.d.ts",
|
|
41
41
|
"import": "./dist/runtime.mjs",
|
|
42
42
|
"require": "./dist/runtime.cjs"
|
|
43
|
+
},
|
|
44
|
+
"./client": {
|
|
45
|
+
"types": "./client.d.ts"
|
|
43
46
|
}
|
|
44
47
|
},
|
|
45
48
|
"files": [
|
|
46
|
-
"dist"
|
|
49
|
+
"dist",
|
|
50
|
+
"client.d.ts"
|
|
47
51
|
],
|
|
48
52
|
"dependencies": {
|
|
49
53
|
"jiti": "^2.7.0"
|