@h-ai/ui 0.1.0-alpha.71 → 0.1.0-alpha.73
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.en.md +14 -2
- package/README.ja.md +14 -2
- package/README.md +14 -2
- package/auto-import.d.ts +2 -0
- package/auto-import.js +2 -0
- package/dist/components/compounds/JsonViewer.svelte +214 -0
- package/dist/components/compounds/JsonViewer.svelte.d.ts +26 -0
- package/dist/components/compounds/index.d.ts +1 -0
- package/dist/components/compounds/index.js +2 -0
- package/dist/components/scenes/ai/index.d.ts +1 -0
- package/dist/components/scenes/ai/index.js +2 -0
- package/dist/components/scenes/app/FeedbackForm.svelte +80 -78
- package/dist/components/scenes/app/FeedbackList.svelte +0 -1
- package/dist/components/scenes/app/FeedbackModal.svelte +1 -1
- package/dist/components/scenes/iam/AuthPanel.svelte +71 -7
- package/dist/components/scenes/iam/ReauthenticationDialog.svelte +68 -0
- package/dist/components/scenes/iam/ReauthenticationDialog.svelte.d.ts +17 -0
- package/dist/components/scenes/iam/auth-captcha.d.ts +21 -0
- package/dist/components/scenes/iam/auth-captcha.js +23 -0
- package/dist/components/scenes/iam/auth-error-message.js +4 -0
- package/dist/components/scenes/iam/index.d.ts +1 -0
- package/dist/components/scenes/iam/index.js +1 -0
- package/dist/components/scenes/iam/password-utils.js +5 -0
- package/dist/components/scenes/types.d.ts +44 -3
- package/dist/messages/en-US.json +11 -1
- package/dist/messages/ja-JP.json +11 -1
- package/dist/messages/zh-CN.json +11 -1
- package/dist/types.d.ts +29 -2
- package/package.json +3 -2
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @module types
|
|
6
6
|
*/
|
|
7
7
|
import type { HaiResult } from '@h-ai/core';
|
|
8
|
+
import type { Challenge } from 'altcha/lib';
|
|
8
9
|
import type { Snippet } from 'svelte';
|
|
9
10
|
import type { DataAttributes, FormLayoutOptions, FormText, InputProps, Size } from '../../types.js';
|
|
10
11
|
/**
|
|
@@ -238,6 +239,21 @@ export interface ChangePasswordFormData {
|
|
|
238
239
|
newPassword: string;
|
|
239
240
|
confirmPassword: string;
|
|
240
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* 敏感操作再鉴别对话框属性;宿主只在服务端选定操作前请求密码。
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* import type { ReauthenticationDialogProps } from '@h-ai/ui'
|
|
247
|
+
* const props: ReauthenticationDialogProps = { open: false, onsubmit: async (password) => { void password }, onclose: () => {} }
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
250
|
+
export interface ReauthenticationDialogProps {
|
|
251
|
+
open: boolean;
|
|
252
|
+
loading?: boolean;
|
|
253
|
+
error?: string;
|
|
254
|
+
onsubmit: (password: string) => void | Promise<void>;
|
|
255
|
+
onclose: () => void;
|
|
256
|
+
}
|
|
241
257
|
/**
|
|
242
258
|
* 修改密码表单属性
|
|
243
259
|
*
|
|
@@ -408,6 +424,8 @@ export interface PasswordPolicy {
|
|
|
408
424
|
requireLowercase: boolean;
|
|
409
425
|
requireNumber: boolean;
|
|
410
426
|
requireSpecialChar: boolean;
|
|
427
|
+
/** 至少满足的字符类别数;0 或未提供时仅应用各项独立要求。 */
|
|
428
|
+
minCharacterClasses?: number;
|
|
411
429
|
}
|
|
412
430
|
/**
|
|
413
431
|
* 仅消费安全公开配置,不能将 iam.config 或连接密钥传入浏览器。
|
|
@@ -431,6 +449,9 @@ export interface PasswordPolicy {
|
|
|
431
449
|
* ```
|
|
432
450
|
*/
|
|
433
451
|
export interface AuthPanelConfig {
|
|
452
|
+
captcha?: {
|
|
453
|
+
enabled: boolean;
|
|
454
|
+
};
|
|
434
455
|
/** 只有已启用且具备运行时依赖的方式才应为 true。 */
|
|
435
456
|
login: {
|
|
436
457
|
password: boolean;
|
|
@@ -488,12 +509,20 @@ export interface AuthPanelConfig {
|
|
|
488
509
|
* ```
|
|
489
510
|
*/
|
|
490
511
|
export interface AuthPanelActions {
|
|
512
|
+
/** 仅启用交互挑战时需要;动作返回可公开挑战,签名秘密保留在服务端。 */
|
|
513
|
+
createCaptcha?: (input: {
|
|
514
|
+
operation: 'login' | 'register' | 'sendOtp' | 'passwordReset' | 'renewPassword';
|
|
515
|
+
}) => Promise<HaiResult<{
|
|
516
|
+
id: string;
|
|
517
|
+
challenge: Challenge;
|
|
518
|
+
}>>;
|
|
491
519
|
/** password/ldap 使用 password,email/sms 使用 code;成功后由工厂保存凭证。 */
|
|
492
520
|
login: (input: {
|
|
493
521
|
identifier: string;
|
|
494
522
|
password: string;
|
|
495
523
|
method?: AuthLoginMethod;
|
|
496
524
|
code?: string;
|
|
525
|
+
captcha?: string;
|
|
497
526
|
}) => Promise<HaiResult<unknown>>;
|
|
498
527
|
/** 注册并登录;禁用新账户的待启用状态由面板单独提示。 */
|
|
499
528
|
register: (input: {
|
|
@@ -502,10 +531,22 @@ export interface AuthPanelActions {
|
|
|
502
531
|
email?: string;
|
|
503
532
|
phone?: string;
|
|
504
533
|
displayName?: string;
|
|
534
|
+
captcha?: string;
|
|
535
|
+
}) => Promise<HaiResult<unknown>>;
|
|
536
|
+
sendOtp: (identifier: string, options?: {
|
|
537
|
+
captcha?: string;
|
|
538
|
+
}) => Promise<HaiResult<unknown>>;
|
|
539
|
+
requestPasswordReset: (identifier: string, options?: {
|
|
540
|
+
captcha?: string;
|
|
505
541
|
}) => Promise<HaiResult<unknown>>;
|
|
506
|
-
sendOtp: (identifier: string) => Promise<HaiResult<unknown>>;
|
|
507
|
-
requestPasswordReset: (identifier: string) => Promise<HaiResult<unknown>>;
|
|
508
542
|
confirmPasswordReset: (token: string, newPassword: string) => Promise<HaiResult<unknown>>;
|
|
543
|
+
/** 首次或密码过期时,验证原密码并换新;完成后重新登录。 */
|
|
544
|
+
renewPassword?: (input: {
|
|
545
|
+
identifier: string;
|
|
546
|
+
password: string;
|
|
547
|
+
newPassword: string;
|
|
548
|
+
captcha?: string;
|
|
549
|
+
}) => Promise<HaiResult<unknown>>;
|
|
509
550
|
}
|
|
510
551
|
/**
|
|
511
552
|
* AuthPanel 的初始页面;未传独立路由时由组件内部导航。
|
|
@@ -516,7 +557,7 @@ export interface AuthPanelActions {
|
|
|
516
557
|
* const example: AuthPanelMode = 'login'
|
|
517
558
|
* ```
|
|
518
559
|
*/
|
|
519
|
-
export type AuthPanelMode = 'login' | 'register' | 'forgot' | 'reset';
|
|
560
|
+
export type AuthPanelMode = 'login' | 'register' | 'forgot' | 'reset' | 'renew';
|
|
520
561
|
/**
|
|
521
562
|
* 配置驱动认证场景;网络、通知和令牌存储由应用注入 actions。
|
|
522
563
|
*
|
package/dist/messages/en-US.json
CHANGED
|
@@ -350,6 +350,7 @@
|
|
|
350
350
|
"auth_unavailable": "This authentication feature is unavailable.",
|
|
351
351
|
"auth_reset_sent": "If the account exists, a reset notification has been sent. Check your email or SMS.",
|
|
352
352
|
"auth_reset_done": "Password reset. Sign in with your new password.",
|
|
353
|
+
"auth_renew_title": "Update your sign-in password",
|
|
353
354
|
"auth_have_token": "I have a reset token",
|
|
354
355
|
"auth_brand": "Account center",
|
|
355
356
|
"password_policy_length": "Use {min}–{max} characters",
|
|
@@ -357,6 +358,7 @@
|
|
|
357
358
|
"password_policy_lowercase": "Include lowercase letters",
|
|
358
359
|
"password_policy_number": "Include numbers",
|
|
359
360
|
"password_policy_special": "Include special characters",
|
|
361
|
+
"password_policy_classes": "Include at least {count} of uppercase, lowercase, numbers and special characters",
|
|
360
362
|
"guide_welcome": "Welcome",
|
|
361
363
|
"guide_start": "Start tour",
|
|
362
364
|
"guide_later": "Remind me later",
|
|
@@ -476,5 +478,13 @@
|
|
|
476
478
|
"feedback_record_empty": "No video was recorded. Please retry.",
|
|
477
479
|
"feedback_local_saved": "Your feedback download has started.",
|
|
478
480
|
"feedback_notification_disabled": "Notifications disabled",
|
|
479
|
-
"feedback_capacity_hint": "Attachments {used}/{total} MiB · {single} MiB each · up to {count}"
|
|
481
|
+
"feedback_capacity_hint": "Attachments {used}/{total} MiB · {single} MiB each · up to {count}",
|
|
482
|
+
"json_viewer_copy": "Copy",
|
|
483
|
+
"json_viewer_copied": "Copied",
|
|
484
|
+
"auth_captcha_error": "Security check is incomplete or unavailable. Try again.",
|
|
485
|
+
"auth_captcha_verifying": "Verifying security challenge",
|
|
486
|
+
"reauthentication_title": "Confirm sensitive action",
|
|
487
|
+
"reauthentication_hint": "Enter your current password to continue this action.",
|
|
488
|
+
"reauthentication_password": "Current password",
|
|
489
|
+
"reauthentication_confirm": "Verify and continue"
|
|
480
490
|
}
|
package/dist/messages/ja-JP.json
CHANGED
|
@@ -350,6 +350,7 @@
|
|
|
350
350
|
"auth_unavailable": "この認証機能は利用できません。",
|
|
351
351
|
"auth_reset_sent": "アカウントが存在する場合、リセット通知を送信しました。メールまたはSMSをご確認ください。",
|
|
352
352
|
"auth_reset_done": "パスワードをリセットしました。新しいパスワードでログインしてください。",
|
|
353
|
+
"auth_renew_title": "ログインパスワードの更新",
|
|
353
354
|
"auth_have_token": "リセットトークンを持っています",
|
|
354
355
|
"auth_brand": "アカウントセンター",
|
|
355
356
|
"password_policy_length": "{min}~{max}文字で入力",
|
|
@@ -357,6 +358,7 @@
|
|
|
357
358
|
"password_policy_lowercase": "英小文字を含める",
|
|
358
359
|
"password_policy_number": "数字を含める",
|
|
359
360
|
"password_policy_special": "特殊文字を含める",
|
|
361
|
+
"password_policy_classes": "大文字、小文字、数字、特殊文字のうち {count} 種類以上を含める",
|
|
360
362
|
"guide_welcome": "ようこそ",
|
|
361
363
|
"guide_start": "ツアーを開始",
|
|
362
364
|
"guide_later": "後で通知",
|
|
@@ -476,5 +478,13 @@
|
|
|
476
478
|
"feedback_record_empty": "映像がありません。再試行してください。",
|
|
477
479
|
"feedback_local_saved": "フィードバックのダウンロードを開始しました。",
|
|
478
480
|
"feedback_notification_disabled": "通知は無効です",
|
|
479
|
-
"feedback_capacity_hint": "添付 {used}/{total} MiB · 各 {single} MiB まで · 最大 {count} 件"
|
|
481
|
+
"feedback_capacity_hint": "添付 {used}/{total} MiB · 各 {single} MiB まで · 最大 {count} 件",
|
|
482
|
+
"json_viewer_copy": "コピー",
|
|
483
|
+
"json_viewer_copied": "コピーしました",
|
|
484
|
+
"auth_captcha_error": "セキュリティ確認が未完了または利用できません。再試行してください",
|
|
485
|
+
"auth_captcha_verifying": "セキュリティ確認中",
|
|
486
|
+
"reauthentication_title": "重要な操作の確認",
|
|
487
|
+
"reauthentication_hint": "この操作を続けるには現在のパスワードを入力してください。",
|
|
488
|
+
"reauthentication_password": "現在のパスワード",
|
|
489
|
+
"reauthentication_confirm": "認証して続行"
|
|
480
490
|
}
|
package/dist/messages/zh-CN.json
CHANGED
|
@@ -350,6 +350,7 @@
|
|
|
350
350
|
"auth_unavailable": "此认证功能暂不可用",
|
|
351
351
|
"auth_reset_sent": "如果账号存在,重置通知已发送,请查看邮箱或短信。",
|
|
352
352
|
"auth_reset_done": "密码已重置,请使用新密码登录。",
|
|
353
|
+
"auth_renew_title": "更新登录密码",
|
|
353
354
|
"auth_have_token": "已有重置令牌",
|
|
354
355
|
"auth_brand": "账号中心",
|
|
355
356
|
"password_policy_length": "密码长度为 {min}–{max} 个字符",
|
|
@@ -357,6 +358,7 @@
|
|
|
357
358
|
"password_policy_lowercase": "包含小写字母",
|
|
358
359
|
"password_policy_number": "包含数字",
|
|
359
360
|
"password_policy_special": "包含特殊字符",
|
|
361
|
+
"password_policy_classes": "大写、小写、数字、特殊字符中至少满足 {count} 类",
|
|
360
362
|
"guide_welcome": "欢迎使用",
|
|
361
363
|
"guide_start": "开始引导",
|
|
362
364
|
"guide_later": "稍后提醒",
|
|
@@ -476,5 +478,13 @@
|
|
|
476
478
|
"feedback_record_empty": "未录制到画面,请重试。",
|
|
477
479
|
"feedback_local_saved": "已开始下载反馈文件。",
|
|
478
480
|
"feedback_notification_disabled": "未启用通知",
|
|
479
|
-
"feedback_capacity_hint": "附件 {used}/{total} MiB · 单个最多 {single} MiB · 最多 {count} 项"
|
|
481
|
+
"feedback_capacity_hint": "附件 {used}/{total} MiB · 单个最多 {single} MiB · 最多 {count} 项",
|
|
482
|
+
"json_viewer_copy": "复制",
|
|
483
|
+
"json_viewer_copied": "已复制",
|
|
484
|
+
"auth_captcha_error": "安全验证未完成或暂不可用,请重试",
|
|
485
|
+
"auth_captcha_verifying": "正在进行安全验证",
|
|
486
|
+
"reauthentication_title": "确认敏感操作",
|
|
487
|
+
"reauthentication_hint": "请输入当前密码以继续本次操作。",
|
|
488
|
+
"reauthentication_password": "当前密码",
|
|
489
|
+
"reauthentication_confirm": "验证并继续"
|
|
480
490
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -160,8 +160,8 @@ export interface InputProps extends DataAttributes {
|
|
|
160
160
|
value?: string;
|
|
161
161
|
/** 占位符 */
|
|
162
162
|
placeholder?: string;
|
|
163
|
-
/**
|
|
164
|
-
type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search';
|
|
163
|
+
/** 类型;datetime-local 使用浏览器本地时区,服务层应转换为明确的时间戳。 */
|
|
164
|
+
type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search' | 'datetime-local';
|
|
165
165
|
/** 尺寸 */
|
|
166
166
|
size?: Size;
|
|
167
167
|
/** 是否禁用 */
|
|
@@ -1299,6 +1299,33 @@ export interface EmptyProps extends DataAttributes {
|
|
|
1299
1299
|
/** 自定义图标插槽 */
|
|
1300
1300
|
children?: Snippet;
|
|
1301
1301
|
}
|
|
1302
|
+
/**
|
|
1303
|
+
* JSON 查看器属性
|
|
1304
|
+
*
|
|
1305
|
+
* @example
|
|
1306
|
+
* ```svelte
|
|
1307
|
+
* <script lang="ts">
|
|
1308
|
+
* import { JsonViewer } from '@h-ai/ui'
|
|
1309
|
+
* import type { JsonViewerProps } from '@h-ai/ui'
|
|
1310
|
+
* const props: JsonViewerProps = { value: { name: 'wf', nested: { list: [1, 2] } } }
|
|
1311
|
+
* </script>
|
|
1312
|
+
* <JsonViewer {...props} />
|
|
1313
|
+
* ```
|
|
1314
|
+
*/
|
|
1315
|
+
export interface JsonViewerProps extends DataAttributes {
|
|
1316
|
+
/** 要展示的 JSON 数据;循环引用自动替换为占位符 */
|
|
1317
|
+
value: unknown;
|
|
1318
|
+
/** 初始展开深度;0 表示全部折叠,1 展开顶层容器 */
|
|
1319
|
+
defaultExpandedDepth?: number;
|
|
1320
|
+
/** 标量文本截断长度;超出部分以省略号结尾 */
|
|
1321
|
+
maxScalarLength?: number;
|
|
1322
|
+
/** 是否显示复制按钮 */
|
|
1323
|
+
showCopy?: boolean;
|
|
1324
|
+
/** 自定义类名 */
|
|
1325
|
+
class?: string;
|
|
1326
|
+
/** 复制成功后的回调,参数为复制的格式化 JSON 文本 */
|
|
1327
|
+
onCopy?: (text: string) => void;
|
|
1328
|
+
}
|
|
1302
1329
|
/**
|
|
1303
1330
|
* 结果页属性
|
|
1304
1331
|
*
|
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.
|
|
4
|
+
"version": "0.1.0-alpha.73",
|
|
5
5
|
"description": "Hai Framework UI component library for Svelte 5 Runes.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"svelte": "./dist/index.js",
|
|
@@ -119,10 +119,11 @@
|
|
|
119
119
|
"svelte": "^5.57.2"
|
|
120
120
|
},
|
|
121
121
|
"dependencies": {
|
|
122
|
-
"@h-ai/core": "0.1.0-alpha.
|
|
122
|
+
"@h-ai/core": "0.1.0-alpha.73",
|
|
123
123
|
"@internationalized/date": "^3.12.4",
|
|
124
124
|
"@rrweb/replay": "^2.1.7",
|
|
125
125
|
"@shikijs/langs": "^4.5.0",
|
|
126
|
+
"altcha": "^3.5.0",
|
|
126
127
|
"bits-ui": "^2.19.5",
|
|
127
128
|
"driver.js": "1.9.0",
|
|
128
129
|
"html2canvas": "^1.4.1",
|