@kupola/kupola 1.9.13 → 1.9.15

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/dashboard.css CHANGED
@@ -264,26 +264,77 @@ body.ds-dashboard-page {
264
264
 
265
265
  /* Responsive adjustments for tablet */
266
266
  @media (max-width: 1024px) and (min-width: 769px) {
267
+ .ds-dashboard__header-center {
268
+ display: none;
269
+ }
270
+
271
+ .ds-dashboard__content {
272
+ padding: var(--spacer-12);
273
+ padding-bottom: calc(var(--spacer-12) + 56px);
274
+ }
275
+
267
276
  .ds-dashboard__sidebar {
268
- width: 44px;
277
+ position: fixed;
278
+ bottom: 0;
279
+ left: 0;
280
+ right: 0;
281
+ width: 100%;
282
+ height: 56px;
283
+ flex-direction: row;
284
+ justify-content: space-around;
285
+ align-items: center;
286
+ padding: 0;
287
+ border-right: none;
288
+ border-top: 1px solid var(--border-neutral-l1);
289
+ z-index: 100;
290
+ background: var(--bg-base-secondary);
291
+ backdrop-filter: blur(10px);
292
+ }
293
+
294
+ .ds-dashboard__sidebar-nav {
295
+ flex-direction: row;
296
+ width: 100%;
297
+ justify-content: space-around;
298
+ padding: 0;
269
299
  }
270
300
 
271
301
  .ds-dashboard__sidebar-item {
272
- width: 34px;
273
- height: 34px;
302
+ width: 48px;
303
+ height: 48px;
304
+ margin: 0;
305
+ flex-direction: column;
306
+ gap: 2px;
274
307
  }
275
308
 
276
309
  .ds-dashboard__sidebar-item img {
277
- width: 16px;
278
- height: 16px;
310
+ width: 18px;
311
+ height: 18px;
279
312
  }
280
313
 
281
- .ds-dashboard__header-center {
314
+ .ds-dashboard__sidebar-item::before {
282
315
  display: none;
283
316
  }
284
317
 
285
- .ds-dashboard__content {
286
- padding: var(--spacer-12);
318
+ .ds-dashboard__sidebar-item::after {
319
+ display: none;
320
+ }
321
+
322
+ .ds-dashboard__sidebar-item span {
323
+ display: block;
324
+ font-size: 10px;
325
+ color: inherit;
326
+ }
327
+
328
+ .ds-dashboard__sidebar-divider {
329
+ display: none;
330
+ }
331
+
332
+ .ds-dashboard__sidebar-bottom {
333
+ display: none;
334
+ }
335
+
336
+ .ds-dashboard__footer {
337
+ display: none;
287
338
  }
288
339
  }
289
340
 
@@ -299,12 +350,12 @@ body.ds-dashboard-page {
299
350
 
300
351
  .ds-dashboard__content {
301
352
  padding: var(--spacer-8);
302
- padding-bottom: calc(var(--spacer-8) + 56px + var(--dashboard-footer-height, 24px));
353
+ padding-bottom: calc(var(--spacer-8) + 56px);
303
354
  }
304
355
 
305
356
  .ds-dashboard__sidebar {
306
357
  position: fixed;
307
- bottom: var(--dashboard-footer-height, 24px);
358
+ bottom: 0;
308
359
  left: 0;
309
360
  right: 0;
310
361
  width: 100%;
@@ -363,6 +414,6 @@ body.ds-dashboard-page {
363
414
  }
364
415
 
365
416
  .ds-dashboard__footer {
366
- padding-bottom: calc(env(safe-area-inset-bottom) + 4px);
417
+ display: none;
367
418
  }
368
419
  }
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');