@h-ai/ui 1.0.0-beta.1 → 1.0.0-beta.2
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
CHANGED
|
@@ -16,6 +16,8 @@ A cross-platform Svelte 5 Runes component library with DaisyUI v5 + Tailwind CSS
|
|
|
16
16
|
- Authentication, CRUD, AI content, onboarding and a help center.
|
|
17
17
|
- Svelte 5, themes, responsive layouts and Chinese/English/Japanese component messages.
|
|
18
18
|
|
|
19
|
+
Markdown underline and highlight markers support escaping; unclosed markers remain text. Toasts and document downloads handle unusually long text without repeated scanning, while trace identifiers remain hidden by default.
|
|
20
|
+
|
|
19
21
|
## Getting started
|
|
20
22
|
|
|
21
23
|
### Installation
|
package/README.ja.md
CHANGED
|
@@ -16,6 +16,8 @@ Svelte 5 Runes のクロスプラットフォーム UI ライブラリーです
|
|
|
16
16
|
- 認証、CRUD、AI コンテンツ、操作ガイド、ヘルプセンター。
|
|
17
17
|
- Svelte 5、テーマ、レスポンシブ表示、中国語・英語・日本語のコンポーネント文言。
|
|
18
18
|
|
|
19
|
+
Markdown の下線と強調マーカーはエスケープに対応し、閉じていないマーカーはテキストとして扱います。長い異常入力でも Toast と文書出力で反復走査を避け、追跡 ID は既定で折りたたみます。
|
|
20
|
+
|
|
19
21
|
## 使い始める
|
|
20
22
|
|
|
21
23
|
### インストール
|
package/README.md
CHANGED
|
@@ -165,9 +165,11 @@ function resolveDocumentBaseName(title, filename) {
|
|
|
165
165
|
const sanitizedName = stripControlCharacters(preferredName)
|
|
166
166
|
.replace(/[<>:"/\\|?*]+/g, ' ')
|
|
167
167
|
.replace(/\s+/g, ' ')
|
|
168
|
-
.replace(/[. ]+$/g, '')
|
|
169
168
|
.trim();
|
|
170
|
-
|
|
169
|
+
let end = sanitizedName.length;
|
|
170
|
+
while (end > 0 && (sanitizedName[end - 1] === '.' || sanitizedName[end - 1] === ' '))
|
|
171
|
+
end--;
|
|
172
|
+
return sanitizedName.slice(0, end) || 'ai-document';
|
|
171
173
|
}
|
|
172
174
|
function downloadBlob(blob, filename) {
|
|
173
175
|
const url = URL.createObjectURL(blob);
|
|
@@ -9,8 +9,9 @@ const ALIGN_VALUE_REGEX = /^(?:left|center|right|justify)$/i;
|
|
|
9
9
|
const HAI_ALIGN_BLOCK_REGEX = /^<hai-align\s+value="(left|center|right|justify)">\n?([\s\S]+?)\n?<\/hai-align>\n{0,2}/i;
|
|
10
10
|
const HAI_SPAN_INLINE_REGEX = /^<hai-span\b([^>]*)>([\s\S]+?)<\/hai-span>/i;
|
|
11
11
|
const HAI_SPAN_ATTR_REGEX = /\b(color|bg)="([^"]+)"/gi;
|
|
12
|
-
|
|
13
|
-
const
|
|
12
|
+
// 转义分支与普通字符互斥,未闭合标记中的长反斜线不会触发组合回溯。
|
|
13
|
+
const HAI_UNDERLINE_REGEX = /^\+\+((?:\\[\s\S]|[^\\])+?)\+\+/;
|
|
14
|
+
const HAI_HIGHLIGHT_REGEX = /^==((?:\\[\s\S]|[^\\])+?)==/;
|
|
14
15
|
/**
|
|
15
16
|
* Markdown heading 提取目录时需要一个“纯文本标题”。
|
|
16
17
|
* 这里显式递归常见 inline token,保证 `<hai-span>`、链接、强调等都能回落成纯文本。
|
package/dist/toast.svelte.js
CHANGED
|
@@ -9,10 +9,19 @@ import { untrack } from 'svelte';
|
|
|
9
9
|
/** 兼容安全错误消息中的追踪编号,将排查信息从用户说明中分离。 */
|
|
10
10
|
function normalizeMessage(message, explicitTraceId) {
|
|
11
11
|
let traceId = explicitTraceId && /^[\w.:-]{1,128}$/.test(explicitTraceId) ? explicitTraceId : undefined;
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const parts = [];
|
|
13
|
+
let cursor = 0;
|
|
14
|
+
// 先找固定标记,再移除相邻空白;无标记的长空白不会从每个字符重新回溯。
|
|
15
|
+
for (const match of message.matchAll(/\(traceId: ([\w.:-]{1,128})\)/g)) {
|
|
16
|
+
let end = match.index;
|
|
17
|
+
while (end > cursor && message[end - 1].trim() === '')
|
|
18
|
+
end--;
|
|
19
|
+
parts.push(message.slice(cursor, end));
|
|
20
|
+
cursor = match.index + match[0].length;
|
|
21
|
+
traceId ??= match[1];
|
|
22
|
+
}
|
|
23
|
+
parts.push(message.slice(cursor));
|
|
24
|
+
const readable = parts.join('').trim();
|
|
16
25
|
return { message: readable || core.i18n.coreM('core_errorInternal'), traceId };
|
|
17
26
|
}
|
|
18
27
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h-ai/ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.2",
|
|
5
5
|
"description": "Hai Framework UI component library for Svelte 5 Runes.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"svelte": "./dist/index.js",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"svelte": "^5.57.2"
|
|
125
125
|
},
|
|
126
126
|
"dependencies": {
|
|
127
|
-
"@h-ai/core": "1.0.0-beta.
|
|
127
|
+
"@h-ai/core": "1.0.0-beta.2",
|
|
128
128
|
"@internationalized/date": "^3.12.4",
|
|
129
129
|
"@rrweb/replay": "^2.1.7",
|
|
130
130
|
"@shikijs/langs": "^4.5.0",
|