@kupola/kupola 1.9.13 → 1.9.14

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 CHANGED
@@ -18,6 +18,73 @@
18
18
  - [English](#english)
19
19
  - [中文](#中文)
20
20
 
21
+ ---
22
+
23
+ ## 📦 构建工具插件
24
+
25
+ ### Vite 插件
26
+
27
+ ```js
28
+ // vite.config.js
29
+ import { kupola } from '@kupola/kupola/vite';
30
+
31
+ export default {
32
+ plugins: [kupola()]
33
+ };
34
+ ```
35
+
36
+ **配置选项:**
37
+
38
+ | 选项 | 类型 | 默认值 | 说明 |
39
+ |------|------|--------|------|
40
+ | `autoCSS` | boolean | `true` | 自动注入 Kupola CSS |
41
+ | `autoImport` | boolean | `true` | 自动导入 `useDeps`/`useQuery` |
42
+ | `devTools` | boolean | `true` | 开发模式下启用调试工具 |
43
+ | `cssPath` | string | `null` | 自定义 CSS 路径 |
44
+ | `themePreload` | boolean | `false` | 自动注入主题预加载脚本 |
45
+
46
+ ### Webpack 插件
47
+
48
+ ```js
49
+ // webpack.config.js
50
+ const KupolaWebpackPlugin = require('@kupola/kupola/webpack');
51
+
52
+ module.exports = {
53
+ plugins: [new KupolaWebpackPlugin()]
54
+ };
55
+ ```
56
+
57
+ **配置选项:**
58
+
59
+ | 选项 | 类型 | 默认值 | 说明 |
60
+ |------|------|--------|------|
61
+ | `autoCSS` | boolean | `true` | 自动注入 Kupola CSS |
62
+ | `themePreload` | boolean | `false` | 自动注入主题预加载脚本 |
63
+ | `cssPath` | string | `null` | 自定义 CSS 路径 |
64
+
65
+ ### themePreload 配置说明
66
+
67
+ **默认值:`false`**(v1.9.13 变更)
68
+
69
+ `themePreload` 用于在 CSS 加载前设置主题属性,防止主题切换时的闪屏问题。请根据你的使用方式决定是否开启:
70
+
71
+ | 使用方式 | themePreload | 说明 |
72
+ |---------|-------------|------|
73
+ | **ESM + initTheme()** | `false`(默认) | JS 模块加载时自动初始化,无需预加载 |
74
+ | **UMD / 纯 CSS** | `true` | 需要在 CSS 加载前设置主题,防止闪屏 |
75
+
76
+ **开启示例:**
77
+
78
+ ```js
79
+ // Vite
80
+ kupola({ themePreload: true })
81
+
82
+ // Webpack
83
+ new KupolaWebpackPlugin({ themePreload: true })
84
+ ```
85
+
86
+ ---
87
+
21
88
  ## 📖 Documentation
22
89
 
23
90
  - [**用户文档**](https://kupola-cn.github.io/kupola/docs/index.html) — 安装、组件速查、核心 API、主题、后端集成
@@ -26,6 +93,71 @@
26
93
  ---
27
94
 
28
95
  <a id="english"></a>
96
+ ## 📦 Build Tool Plugins
97
+
98
+ ### Vite Plugin
99
+
100
+ ```js
101
+ // vite.config.js
102
+ import { kupola } from '@kupola/kupola/vite';
103
+
104
+ export default {
105
+ plugins: [kupola()]
106
+ };
107
+ ```
108
+
109
+ **Options:**
110
+
111
+ | Option | Type | Default | Description |
112
+ |--------|------|--------|-------------|
113
+ | `autoCSS` | boolean | `true` | Auto inject Kupola CSS |
114
+ | `autoImport` | boolean | `true` | Auto import `useDeps`/`useQuery` |
115
+ | `devTools` | boolean | `true` | Enable dev tools in dev mode |
116
+ | `cssPath` | string | `null` | Custom CSS path |
117
+ | `themePreload` | boolean | `false` | Auto inject theme preload script |
118
+
119
+ ### Webpack Plugin
120
+
121
+ ```js
122
+ // webpack.config.js
123
+ const KupolaWebpackPlugin = require('@kupola/kupola/webpack');
124
+
125
+ module.exports = {
126
+ plugins: [new KupolaWebpackPlugin()]
127
+ };
128
+ ```
129
+
130
+ **Options:**
131
+
132
+ | Option | Type | Default | Description |
133
+ |--------|------|--------|-------------|
134
+ | `autoCSS` | boolean | `true` | Auto inject Kupola CSS |
135
+ | `themePreload` | boolean | `false` | Auto inject theme preload script |
136
+ | `cssPath` | string | `null` | Custom CSS path |
137
+
138
+ ### themePreload Configuration
139
+
140
+ **Default: `false`** (Changed in v1.9.13)
141
+
142
+ `themePreload` sets theme attributes before CSS loads to prevent flash of unstyled content during theme switching. Enable it based on your usage pattern:
143
+
144
+ | Usage Pattern | themePreload | Reason |
145
+ |--------------|-------------|--------|
146
+ | **ESM + initTheme()** | `false` (default) | JS module initializes automatically on load |
147
+ | **UMD / CSS-only** | `true` | Needs theme set before CSS loads to prevent flash |
148
+
149
+ **Example with themePreload enabled:**
150
+
151
+ ```js
152
+ // Vite
153
+ kupola({ themePreload: true })
154
+
155
+ // Webpack
156
+ new KupolaWebpackPlugin({ themePreload: true })
157
+ ```
158
+
159
+ ---
160
+
29
161
  ## ✨ Features
30
162
 
31
163
  - **50+ UI Components** — Buttons, inputs, cards, modals, datepickers, timepickers, heatmap, virtual list, stat cards, and more
package/css/kupola.css CHANGED
@@ -1,6 +1,5 @@
1
1
  @import url('colors-and-type.css');
2
- @import url('theme-dark.css');
3
- @import url('theme-light.css');
2
+ @import url('theme.css');
4
3
  @import url('brand-themes.css');
5
4
  @import url('scaffold.css');
6
5
  @import url('dashboard.css');