@h-ai/ui 0.1.0-alpha.69 → 0.1.0-alpha.71

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.
@@ -389,12 +389,12 @@
389
389
  "feedback_optional_description": "一句话说明(可选)",
390
390
  "feedback_quick_hint": "可以直接提交。系统会附上允许收集的现场材料。",
391
391
  "feedback_more": "更多选项",
392
- "feedback_materials": "自动收集的材料",
392
+ "feedback_materials": "收集材料",
393
393
  "feedback_screenshots": "截图与标注",
394
394
  "feedback_attachments": "附件",
395
395
  "feedback_add_files": "添加截图或附件",
396
396
  "feedback_remove": "删除",
397
- "feedback_local_export": "保存本地问题包",
397
+ "feedback_local_export": "保存反馈到本地",
398
398
  "feedback_accepted": "已受理:{number}",
399
399
  "feedback_accepted_hint": "您可以继续使用产品,材料将在后台汇集。",
400
400
  "feedback_collecting": "材料收集中",
@@ -423,7 +423,7 @@
423
423
  "feedback_notification": "通知状态",
424
424
  "feedback_notification_pending": "等待通知",
425
425
  "feedback_notification_sending": "正在发送",
426
- "feedback_notification_sent": "邮件服务已接受",
426
+ "feedback_notification_sent": "通知通道已受理",
427
427
  "feedback_notification_deferred": "通知已延迟",
428
428
  "feedback_notification_failed": "通知失败",
429
429
  "feedback_date_range": "提交时间范围",
@@ -446,17 +446,35 @@
446
446
  "feedback_revision": "证据修订",
447
447
  "feedback_mark_outline": "圈选问题位置",
448
448
  "feedback_mark_mask": "遮挡敏感区域",
449
- "feedback_mark_hint": "在图片上拖动选择区域,或填写百分比坐标,再应用标注。",
449
+ "feedback_mark_hint": "在图片上拖动选择区域,再应用标注。也可用方向键移动选区,Shift + 方向键调整大小。",
450
450
  "feedback_mark_apply": "应用标注",
451
451
  "feedback_mark_clear": "清除选区",
452
- "feedback_mark_x": "左侧 (%)",
453
- "feedback_mark_y": "顶部 (%)",
454
- "feedback_mark_width": "宽度 (%)",
455
- "feedback_mark_height": "高度 (%)",
456
452
  "feedback_download": "查看 / 下载",
457
453
  "feedback_close": "关闭",
458
454
  "feedback_apply_filters": "查询材料",
459
455
  "feedback_preview_failed": "图片预览不可用,其他材料仍可查看或提交。",
460
456
  "feedback_build_id": "构建标识",
461
- "feedback_commit": "源码提交"
457
+ "feedback_commit": "源码提交",
458
+ "feedback_capture_add": "添加页面截图",
459
+ "feedback_capture_replace": "重新截图",
460
+ "feedback_capture_now": "截取当前页面",
461
+ "feedback_capture_return": "返回反馈",
462
+ "feedback_capture_hint": "切换到需要截图的页面,再点击“截取当前页面”。已填写的内容会保留。",
463
+ "feedback_replay": "页面回放",
464
+ "feedback_replay_play": "播放",
465
+ "feedback_replay_pause": "暂停",
466
+ "feedback_replay_hint": "回放已采集的页面与操作。输入内容已遮挡,外部资源可能缺失。",
467
+ "feedback_replay_empty": "没有可用的页面回放。仅在启用回放采集后记录操作;也可查看截图或录屏。",
468
+ "feedback_record": "录屏",
469
+ "feedback_record_start": "开始录屏",
470
+ "feedback_record_stop": "停止录屏",
471
+ "feedback_record_cancel": "取消录屏",
472
+ "feedback_record_hint": "选择页面或窗口后录制,最多 60 秒 / {size} MiB,不录制声音。请避开敏感内容;停止后可预览或删除。",
473
+ "feedback_recording": "正在录屏 · {seconds} 秒",
474
+ "feedback_record_unsupported": "当前浏览器不支持录屏,请使用截图或添加视频文件。",
475
+ "feedback_record_failed": "录屏未完成,请重新选择页面或添加视频文件。",
476
+ "feedback_record_empty": "未录制到画面,请重试。",
477
+ "feedback_local_saved": "已开始下载反馈文件。",
478
+ "feedback_notification_disabled": "未启用通知",
479
+ "feedback_capacity_hint": "附件 {used}/{total} MiB · 单个最多 {single} MiB · 最多 {count} 项"
462
480
  }
@@ -168,6 +168,15 @@ export declare function notifySuccess(message: string, duration?: number): strin
168
168
  * ```
169
169
  */
170
170
  export declare function notifyError(error: unknown, fallback?: string, duration?: number): string;
171
+ /**
172
+ * 行内错误和 Toast 共用的安全提示;日志保留脱敏原因,提示末尾共用 traceId。
173
+ * @example
174
+ * ```ts
175
+ * import { errorMessage } from '@h-ai/ui'
176
+ * const text = errorMessage(new Error('Internal detail'), '保存失败')
177
+ * ```
178
+ */
179
+ export declare function errorMessage(error: unknown, fallback?: string): string;
171
180
  /**
172
181
  * 弹出信息提示(右上角)。
173
182
  *
@@ -4,6 +4,7 @@
4
4
  * Toast 通知的状态管理,使用 Svelte 5 Runes
5
5
  * @module toast.svelte
6
6
  */
7
+ import { core } from '@h-ai/core';
7
8
  /**
8
9
  * Toast 状态
9
10
  */
@@ -201,10 +202,30 @@ export function notifySuccess(message, duration = SUCCESS_DURATION) {
201
202
  * ```
202
203
  */
203
204
  export function notifyError(error, fallback = '', duration = ERROR_DURATION) {
204
- const message = error instanceof Error
205
- ? error.message
206
- : (typeof error === 'string' ? error : fallback);
207
- return toast.error(message || fallback, duration);
205
+ return toast.error(errorMessage(error, fallback), duration);
206
+ }
207
+ /**
208
+ * 行内错误和 Toast 共用的安全提示;日志保留脱敏原因,提示末尾共用 traceId。
209
+ * @example
210
+ * ```ts
211
+ * import { errorMessage } from '@h-ai/ui'
212
+ * const text = errorMessage(new Error('Internal detail'), '保存失败')
213
+ * ```
214
+ */
215
+ export function errorMessage(error, fallback = '') {
216
+ let known;
217
+ if (error && typeof error === 'object' && !(error instanceof Error) && Object.hasOwn(error, 'code') && Object.hasOwn(error, 'message') && 'message' in error && typeof error.message === 'string')
218
+ known = error;
219
+ const receivedMessage = error instanceof Error ? error.message : typeof error === 'string' ? error : '';
220
+ const embeddedTraceId = /\(traceId: ([\w.:-]{1,128})\)$/.exec(receivedMessage)?.[1];
221
+ const traceId = known?.traceId ?? embeddedTraceId ?? core.context.get().traceId ?? core.context.get().requestId ?? core.id.uuid();
222
+ core.logger.error('User operation failed', { traceId, error });
223
+ let message = fallback || core.i18n.coreM('core_errorInternal');
224
+ if (known)
225
+ message = core.error.toPublic(known, traceId).message;
226
+ else if (typeof error === 'string' || embeddedTraceId)
227
+ message = receivedMessage;
228
+ return core.error.formatMessage({ message, traceId: /\(traceId: [\w.:-]{1,128}\)$/.test(message) ? undefined : traceId });
208
229
  }
209
230
  /**
210
231
  * 弹出信息提示(右上角)。
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.69",
4
+ "version": "0.1.0-alpha.71",
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,8 +119,9 @@
119
119
  "svelte": "^5.57.2"
120
120
  },
121
121
  "dependencies": {
122
- "@h-ai/core": "0.1.0-alpha.69",
122
+ "@h-ai/core": "0.1.0-alpha.71",
123
123
  "@internationalized/date": "^3.12.4",
124
+ "@rrweb/replay": "^2.1.7",
124
125
  "@shikijs/langs": "^4.5.0",
125
126
  "bits-ui": "^2.19.5",
126
127
  "driver.js": "1.9.0",