@h-ai/ui 0.1.0-alpha.60 → 0.1.0-alpha.62

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.
@@ -351,5 +351,22 @@
351
351
  "password_policy_uppercase": "包含大写字母",
352
352
  "password_policy_lowercase": "包含小写字母",
353
353
  "password_policy_number": "包含数字",
354
- "password_policy_special": "包含特殊字符"
354
+ "password_policy_special": "包含特殊字符",
355
+ "guide_welcome": "欢迎使用",
356
+ "guide_start": "开始引导",
357
+ "guide_later": "稍后提醒",
358
+ "guide_dismiss": "不再提醒",
359
+ "guide_help": "帮助中心",
360
+ "guide_close": "关闭",
361
+ "guide_loading": "正在准备引导…",
362
+ "guide_next": "下一步",
363
+ "guide_previous": "上一步",
364
+ "guide_done": "完成",
365
+ "guide_progress": "第 {current} / {total} 步",
366
+ "guide_search": "搜索帮助内容",
367
+ "guide_empty": "没有找到相关帮助内容",
368
+ "guide_tours": "操作导览",
369
+ "guide_unavailable": "此引导暂不可用,请从帮助中心选择其他内容。",
370
+ "guide_targetMissing": "当前页面暂未提供此操作。请稍后重试或查看帮助内容。",
371
+ "guide_startFailed": "无法开始引导,请稍后重试。"
355
372
  }
@@ -11,6 +11,7 @@ export type UIMessageKey = keyof typeof messagesZhCN;
11
11
  *
12
12
  * @param key - 消息 key
13
13
  * @param params - 可选的插值参数
14
+ * @param locale - 可选的宿主语言;省略时使用现有全局语言
14
15
  * @returns 当前 locale 对应的翻译文本
15
16
  *
16
17
  * @example
@@ -18,7 +19,7 @@ export type UIMessageKey = keyof typeof messagesZhCN;
18
19
  * uiM('password_show') // => '显示密码' (zh-CN) 或 'Show password' (en-US)
19
20
  * ```
20
21
  */
21
- export declare function uiM(key: UIMessageKey, params?: Record<string, string | number | boolean>): string;
22
+ export declare function uiM(key: UIMessageKey, params?: Record<string, string | number | boolean>, locale?: string): string;
22
23
  /**
23
24
  * 获取当前 UI 模块使用的 locale
24
25
  */
package/dist/messages.js CHANGED
@@ -18,6 +18,7 @@ const getMessage = core.i18n.createMessageGetter({
18
18
  *
19
19
  * @param key - 消息 key
20
20
  * @param params - 可选的插值参数
21
+ * @param locale - 可选的宿主语言;省略时使用现有全局语言
21
22
  * @returns 当前 locale 对应的翻译文本
22
23
  *
23
24
  * @example
@@ -25,8 +26,8 @@ const getMessage = core.i18n.createMessageGetter({
25
26
  * uiM('password_show') // => '显示密码' (zh-CN) 或 'Show password' (en-US)
26
27
  * ```
27
28
  */
28
- export function uiM(key, params) {
29
- return getMessage(key, params ? { params } : undefined);
29
+ export function uiM(key, params, locale) {
30
+ return getMessage(key, { params, locale });
30
31
  }
31
32
  /**
32
33
  * 获取当前 UI 模块使用的 locale
@@ -0,0 +1,88 @@
1
+ /* 引导浮层挂到 body,使用全局主题变量,避免 Svelte 局部样式失效。 */
2
+ .driver-popover.hai-guide-popover {
3
+ background: var(--color-base-100);
4
+ color: var(--color-base-content);
5
+ border: 1px solid color-mix(in oklch, var(--color-base-content) 12%, transparent);
6
+ border-radius: var(--hai-radius-lg, 16px);
7
+ box-shadow: var(--shadow-overlay, 0 16px 48px -12px #0003);
8
+ padding: 20px;
9
+ min-width: 240px;
10
+ max-width: min(360px, calc(100vw - 24px));
11
+ --driver-popover-font-family: inherit;
12
+ }
13
+
14
+ .hai-guide-popover .driver-popover-title {
15
+ font-size: 16px;
16
+ font-weight: 600;
17
+ line-height: 1.5;
18
+ }
19
+ .hai-guide-popover .driver-popover-description {
20
+ font-size: 14px;
21
+ line-height: 1.75;
22
+ overflow-wrap: anywhere;
23
+ }
24
+ .hai-guide-popover .driver-popover-progress-text {
25
+ color: color-mix(in oklch, var(--color-base-content) 55%, transparent);
26
+ font-size: 12px;
27
+ }
28
+ .hai-guide-popover .driver-popover-close-btn {
29
+ color: var(--color-base-content);
30
+ min-width: 36px;
31
+ min-height: 36px;
32
+ }
33
+ .hai-guide-popover .driver-popover-footer button {
34
+ border: 1px solid color-mix(in oklch, var(--color-base-content) 12%, transparent);
35
+ border-radius: var(--hai-radius-md, 8px);
36
+ background: var(--color-base-200);
37
+ color: var(--color-base-content);
38
+ padding: 8px 12px;
39
+ font-size: 13px;
40
+ font-weight: 500;
41
+ text-shadow: none;
42
+ min-height: 36px;
43
+ }
44
+ .hai-guide-popover .driver-popover-footer .driver-popover-next-btn {
45
+ background: var(--color-primary);
46
+ color: var(--color-primary-content);
47
+ border-color: var(--color-primary);
48
+ }
49
+ .hai-guide-popover button:focus-visible {
50
+ outline: 2px solid var(--color-primary);
51
+ outline-offset: 2px;
52
+ }
53
+ .hai-guide-popover .driver-popover-arrow-side-top {
54
+ border-top-color: var(--color-base-100);
55
+ }
56
+ .hai-guide-popover .driver-popover-arrow-side-bottom {
57
+ border-bottom-color: var(--color-base-100);
58
+ }
59
+ .hai-guide-popover .driver-popover-arrow-side-left {
60
+ border-left-color: var(--color-base-100);
61
+ }
62
+ .hai-guide-popover .driver-popover-arrow-side-right {
63
+ border-right-color: var(--color-base-100);
64
+ }
65
+ .hai-guide-offer {
66
+ padding-bottom: max(20px, env(safe-area-inset-bottom));
67
+ }
68
+
69
+ /* 引擎会禁用高亮区域外的指针事件,等待提示的取消按钮必须保持可操作。 */
70
+ .driver-active .hai-guide-loading,
71
+ .driver-active .hai-guide-loading * {
72
+ pointer-events: auto;
73
+ }
74
+
75
+ @media (max-width: 640px) {
76
+ .hai-guide-popover .driver-popover-footer button,
77
+ .hai-guide-popover .driver-popover-close-btn {
78
+ min-height: var(--hai-touch-target-min, 44px);
79
+ }
80
+ }
81
+
82
+ @media (prefers-reduced-motion: reduce) {
83
+ .driver-overlay,
84
+ .hai-guide-popover {
85
+ animation: none !important;
86
+ transition: none !important;
87
+ }
88
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@h-ai/ui",
3
3
  "type": "module",
4
- "version": "0.1.0-alpha.60",
4
+ "version": "0.1.0-alpha.62",
5
5
  "description": "Hai Framework UI component library for Svelte 5 Runes.",
6
6
  "license": "Apache-2.0",
7
7
  "svelte": "./dist/index.js",
@@ -23,6 +23,11 @@
23
23
  "types": "./dist/theme-config.d.ts",
24
24
  "import": "./dist/theme-config.js"
25
25
  },
26
+ "./guide": {
27
+ "types": "./dist/guide.d.ts",
28
+ "svelte": "./dist/guide.js",
29
+ "import": "./dist/guide.js"
30
+ },
26
31
  "./components/*": {
27
32
  "types": "./dist/components/*.d.ts",
28
33
  "svelte": "./dist/components/*.js",
@@ -49,10 +54,11 @@
49
54
  "svelte": "^5.57.2"
50
55
  },
51
56
  "dependencies": {
52
- "@h-ai/core": "0.1.0-alpha.60",
57
+ "@h-ai/core": "0.1.0-alpha.62",
53
58
  "@internationalized/date": "^3.12.4",
54
59
  "@shikijs/langs": "^4.5.0",
55
60
  "bits-ui": "^2.19.5",
61
+ "driver.js": "1.9.0",
56
62
  "html2canvas": "^1.4.1",
57
63
  "jspdf": "^4.2.1",
58
64
  "layerchart": "2.6.1",
package/vite.js CHANGED
@@ -68,6 +68,7 @@ export const haiPrebundledDeps = Object.freeze([
68
68
  'html2canvas',
69
69
  // ─── 工具 ───
70
70
  'tailwind-merge',
71
+ 'driver.js',
71
72
  // ─── 框架运行时(@h-ai/core / @h-ai/crypto / @h-ai/kit 在登录等路径引入) ───
72
73
  'nanoid',
73
74
  'process',