@h-ai/ui 1.0.0-beta.22 → 1.0.0-beta.24
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 +0 -1
- package/README.ja.md +0 -1
- package/README.md +0 -1
- package/dist/components/scenes/ai/AiDocumentEditor.svelte +5 -57
- package/dist/components/scenes/ai/document-types.d.ts +0 -12
- package/dist/components/scenes/ai/index.d.ts +1 -1
- package/dist/components/scenes/ai/table/AiTableEditor.svelte +1 -7
- package/dist/messages/en-US.json +0 -1
- package/dist/messages/ja-JP.json +0 -1
- package/dist/messages/zh-CN.json +0 -1
- package/dist/theme-config.d.ts +0 -2
- package/dist/theme-config.js +1 -1
- package/package.json +2 -2
package/README.en.md
CHANGED
|
@@ -919,7 +919,6 @@ import { createThemeBootstrapScript, DEFAULT_THEME_COLOR_CSS_VAR } from '@h-ai/u
|
|
|
919
919
|
|
|
920
920
|
const themeBootstrapScript = createThemeBootstrapScript({
|
|
921
921
|
storageKey: 'hai-demo-preferences',
|
|
922
|
-
legacyThemeStorageKey: 'hai-demo-theme',
|
|
923
922
|
defaultThemeColor: '#5765f0',
|
|
924
923
|
colorCssVar: DEFAULT_THEME_COLOR_CSS_VAR,
|
|
925
924
|
})
|
package/README.ja.md
CHANGED
|
@@ -919,7 +919,6 @@ import { createThemeBootstrapScript, DEFAULT_THEME_COLOR_CSS_VAR } from '@h-ai/u
|
|
|
919
919
|
|
|
920
920
|
const themeBootstrapScript = createThemeBootstrapScript({
|
|
921
921
|
storageKey: 'hai-demo-preferences',
|
|
922
|
-
legacyThemeStorageKey: 'hai-demo-theme',
|
|
923
922
|
defaultThemeColor: '#5765f0',
|
|
924
923
|
colorCssVar: DEFAULT_THEME_COLOR_CSS_VAR,
|
|
925
924
|
})
|
package/README.md
CHANGED
|
@@ -918,7 +918,6 @@ import { createThemeBootstrapScript, DEFAULT_THEME_COLOR_CSS_VAR } from '@h-ai/u
|
|
|
918
918
|
|
|
919
919
|
const themeBootstrapScript = createThemeBootstrapScript({
|
|
920
920
|
storageKey: 'hai-demo-preferences',
|
|
921
|
-
legacyThemeStorageKey: 'hai-demo-theme',
|
|
922
921
|
defaultThemeColor: '#5765f0',
|
|
923
922
|
colorCssVar: DEFAULT_THEME_COLOR_CSS_VAR,
|
|
924
923
|
})
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
import type { DataAttributes } from '../../../types.js'
|
|
26
26
|
import type {
|
|
27
27
|
AiDocumentEditorProps,
|
|
28
|
-
MarkdownBlockFormatKind,
|
|
29
28
|
MarkdownBlockStyleKind,
|
|
30
29
|
MarkdownCodeBlockItem,
|
|
31
30
|
MarkdownCodeRunRequest,
|
|
@@ -405,8 +404,6 @@
|
|
|
405
404
|
onhistory,
|
|
406
405
|
// 全文复制回调。
|
|
407
406
|
oncopydocument,
|
|
408
|
-
// 块级格式动作回调。
|
|
409
|
-
onapplyblockformat,
|
|
410
407
|
// 细粒度块样式动作回调。
|
|
411
408
|
onapplyblockstyle,
|
|
412
409
|
// 行内格式动作回调。
|
|
@@ -543,21 +540,11 @@
|
|
|
543
540
|
? resolvedRewriteActions[0]
|
|
544
541
|
: null,
|
|
545
542
|
)
|
|
546
|
-
// 新版工具条支持 paragraph / heading1-4,优先走细粒度回调,避免把旧接口误当成新接口调用。
|
|
547
|
-
const richBlockFormattingEnabled = $derived(Boolean(onapplyblockstyle))
|
|
548
|
-
// 旧版 heading / bullet 回调仍然保留,用于兼容外部还没迁移的调用方。
|
|
549
|
-
const legacyBlockFormattingEnabled = $derived(
|
|
550
|
-
Boolean(onapplyblockformat) && !onapplyblockstyle,
|
|
551
|
-
)
|
|
552
|
-
// 这里统一判断是否存在任意块级格式能力,方便控制分隔线和浮层显隐。
|
|
553
|
-
const anyBlockFormattingEnabled = $derived(
|
|
554
|
-
richBlockFormattingEnabled || legacyBlockFormattingEnabled,
|
|
555
|
-
)
|
|
556
543
|
// selectionToolsEnabled 统一判断选区工具条是否值得出现,避免正文只读展示时还露出空浮层。
|
|
557
544
|
const selectionToolsEnabled = $derived(
|
|
558
545
|
[
|
|
559
546
|
onrewrite,
|
|
560
|
-
|
|
547
|
+
onapplyblockstyle,
|
|
561
548
|
onapplyinlineformat,
|
|
562
549
|
onapplyalignment,
|
|
563
550
|
onapplylink,
|
|
@@ -2474,17 +2461,6 @@
|
|
|
2474
2461
|
})
|
|
2475
2462
|
}
|
|
2476
2463
|
|
|
2477
|
-
function applyBlockFormat(kind: MarkdownBlockFormatKind): void {
|
|
2478
|
-
if (!syncSelectionForToolbarAction()) {
|
|
2479
|
-
return
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
|
-
onapplyblockformat?.(kind)
|
|
2483
|
-
activeSelectionMenu = null
|
|
2484
|
-
activeSelectionMenuTrigger = null
|
|
2485
|
-
queueSelectionRefresh()
|
|
2486
|
-
}
|
|
2487
|
-
|
|
2488
2464
|
function applyBlockStyle(kind: MarkdownBlockStyleKind): void {
|
|
2489
2465
|
if (!syncSelectionForToolbarAction()) {
|
|
2490
2466
|
return
|
|
@@ -2886,7 +2862,7 @@
|
|
|
2886
2862
|
</button>
|
|
2887
2863
|
{/if}
|
|
2888
2864
|
|
|
2889
|
-
{#if
|
|
2865
|
+
{#if onapplyblockstyle}
|
|
2890
2866
|
{#if onrewrite}
|
|
2891
2867
|
<span class='hai-ai-doc-selection-divider'></span>
|
|
2892
2868
|
{/if}
|
|
@@ -2914,38 +2890,10 @@
|
|
|
2914
2890
|
></path>
|
|
2915
2891
|
</svg>
|
|
2916
2892
|
</button>
|
|
2917
|
-
{:else if legacyBlockFormattingEnabled}
|
|
2918
|
-
{#if onrewrite}
|
|
2919
|
-
<span class='hai-ai-doc-selection-divider'></span>
|
|
2920
|
-
{/if}
|
|
2921
|
-
<button
|
|
2922
|
-
type='button'
|
|
2923
|
-
class='hai-ai-doc-selection-btn'
|
|
2924
|
-
title={uiM('markdown_format_heading')}
|
|
2925
|
-
onclick={() => applyBlockFormat('heading')}
|
|
2926
|
-
>
|
|
2927
|
-
<svg viewBox='0 0 24 24' aria-hidden='true'>
|
|
2928
|
-
<path
|
|
2929
|
-
d='M5 5.25a.75.75 0 0 1 .75.75V11h6.5V6a.75.75 0 0 1 1.5 0v12a.75.75 0 0 1-1.5 0v-5.5h-6.5V18a.75.75 0 0 1-1.5 0V6A.75.75 0 0 1 5 5.25Zm11.25 2.5a.75.75 0 0 1 0 1.5h3a.75.75 0 0 1 0 1.5H18.5v8.5a.75.75 0 0 1-1.5 0v-8.5h-.75a.75.75 0 0 1 0-1.5h3Z'
|
|
2930
|
-
></path>
|
|
2931
|
-
</svg>
|
|
2932
|
-
</button>
|
|
2933
|
-
<button
|
|
2934
|
-
type='button'
|
|
2935
|
-
class='hai-ai-doc-selection-btn'
|
|
2936
|
-
title={uiM('markdown_format_bullet')}
|
|
2937
|
-
onclick={() => applyBlockFormat('bullet')}
|
|
2938
|
-
>
|
|
2939
|
-
<svg viewBox='0 0 24 24' aria-hidden='true'>
|
|
2940
|
-
<path
|
|
2941
|
-
d='M6.25 7.25a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm14 0a.75.75 0 0 1-.75.75H8.75a.75.75 0 0 1 0-1.5H19.5a.75.75 0 0 1 .75.75Zm-14 5.5a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm14 0a.75.75 0 0 1-.75.75H8.75a.75.75 0 0 1 0-1.5H19.5a.75.75 0 0 1 .75.75Zm-14 5.5a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm14 0a.75.75 0 0 1-.75.75H8.75a.75.75 0 0 1 0-1.5H19.5a.75.75 0 0 1 .75.75Z'
|
|
2942
|
-
></path>
|
|
2943
|
-
</svg>
|
|
2944
|
-
</button>
|
|
2945
2893
|
{/if}
|
|
2946
2894
|
|
|
2947
2895
|
{#if onapplyalignment}
|
|
2948
|
-
{#if
|
|
2896
|
+
{#if onapplyblockstyle || onrewrite}
|
|
2949
2897
|
<span class='hai-ai-doc-selection-divider'></span>
|
|
2950
2898
|
{/if}
|
|
2951
2899
|
<button
|
|
@@ -2983,7 +2931,7 @@
|
|
|
2983
2931
|
{/if}
|
|
2984
2932
|
|
|
2985
2933
|
{#if onapplyinlineformat || onapplylink || onapplycolor}
|
|
2986
|
-
{#if
|
|
2934
|
+
{#if onapplyblockstyle || onapplyalignment || onrewrite}
|
|
2987
2935
|
<span class='hai-ai-doc-selection-divider'></span>
|
|
2988
2936
|
{/if}
|
|
2989
2937
|
{/if}
|
|
@@ -3178,7 +3126,7 @@
|
|
|
3178
3126
|
</button>
|
|
3179
3127
|
{/each}
|
|
3180
3128
|
</div>
|
|
3181
|
-
{:else if activeSelectionMenu === 'block' &&
|
|
3129
|
+
{:else if activeSelectionMenu === 'block' && onapplyblockstyle}
|
|
3182
3130
|
<div
|
|
3183
3131
|
class='hai-ai-doc-selection-panel'
|
|
3184
3132
|
data-menu-alignment={selectionMenuAlignment}
|
|
@@ -125,16 +125,6 @@ export interface MarkdownRewriteRequest {
|
|
|
125
125
|
/** 当前文档标题。 */
|
|
126
126
|
title?: string;
|
|
127
127
|
}
|
|
128
|
-
/**
|
|
129
|
-
* 块级快捷操作种类:标题或列表。
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```ts
|
|
133
|
-
* import type { MarkdownBlockFormatKind } from '@h-ai/ui'
|
|
134
|
-
* const example: MarkdownBlockFormatKind = 'heading'
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
export type MarkdownBlockFormatKind = 'heading' | 'bullet';
|
|
138
128
|
/**
|
|
139
129
|
* 当前工具栏支持的具体段落和标题样式。
|
|
140
130
|
*
|
|
@@ -357,8 +347,6 @@ export interface AiDocumentEditorProps extends DataAttributes {
|
|
|
357
347
|
onhistory?: () => void;
|
|
358
348
|
/** 宿主自定义的整篇复制操作。 */
|
|
359
349
|
oncopydocument?: () => void | Promise<void>;
|
|
360
|
-
/** 标题/列表快捷格式操作回调。 */
|
|
361
|
-
onapplyblockformat?: BivariantCallback<[kind: MarkdownBlockFormatKind], void>;
|
|
362
350
|
/** 切换段落或具体标题级别的回调。 */
|
|
363
351
|
onapplyblockstyle?: BivariantCallback<[kind: MarkdownBlockStyleKind], void>;
|
|
364
352
|
/** 选区工具栏的行内格式回调。 */
|
|
@@ -11,7 +11,7 @@ export { downloadAiDocument, resolveDocumentDownloadActions, resolveDocumentMark
|
|
|
11
11
|
export type { AiDocumentDownloadFormat, AiDocumentDownloadRequest, AiDocumentResolvedDownloadAction, } from './document-download.js';
|
|
12
12
|
export { renderMarkdownDocument } from './document-parse.js';
|
|
13
13
|
export type { MarkdownDocumentBlock, MarkdownDocumentHtmlBlock, MarkdownDocumentMermaidBlock, MarkdownDocumentParseOptions, MarkdownRenderResult, } from './document-parse.js';
|
|
14
|
-
export type { AiDocumentEditorProps,
|
|
14
|
+
export type { AiDocumentEditorProps, MarkdownBlockStyleKind, MarkdownCodeBlockItem, MarkdownCodeRunRequest, MarkdownCodeRunResult, MarkdownColorFormatRequest, MarkdownInlineFormatKind, MarkdownOutlineItem, MarkdownRewriteAction, MarkdownRewriteRequest, MarkdownTextAlignKind, MarkdownToolbarDownloadAction, } from './document-types.js';
|
|
15
15
|
export { highlightCode, isLanguageSupported } from './highlight.js';
|
|
16
16
|
export { parseMarkdown } from './markdown-parse.js';
|
|
17
17
|
export type { MarkdownParseOptions } from './markdown-parse.js';
|
|
@@ -1260,13 +1260,7 @@
|
|
|
1260
1260
|
|
|
1261
1261
|
<style>
|
|
1262
1262
|
.hai-ai-table-pane {
|
|
1263
|
-
|
|
1264
|
-
主题变量兼容层:
|
|
1265
|
-
- hai-mate Web 端主要使用 daisyUI v5 的 `--color-*` 语义变量;
|
|
1266
|
-
- 组件库内部分场景仍可能提供旧版 `--b1/--bc/--p` 通道变量;
|
|
1267
|
-
- 这里统一抽象为 AiTableEditor 私有变量,确保在两套主题体系下都能稳定着色。
|
|
1268
|
-
*/
|
|
1269
|
-
--hai-ai-table-bg: var(--color-base-100, var(--color-base-100, oklch(1 0 0)));
|
|
1263
|
+
--hai-ai-table-bg: var(--color-base-100, oklch(1 0 0));
|
|
1270
1264
|
--hai-ai-table-bg-soft: var(--color-base-200, var(--color-base-200, oklch(0.97 0 0)));
|
|
1271
1265
|
--hai-ai-table-fg: var(--color-base-content, var(--color-base-content, oklch(0.22 0 0)));
|
|
1272
1266
|
--hai-ai-table-primary: var(--color-primary, var(--color-primary, oklch(0.62 0.2 258)));
|
package/dist/messages/en-US.json
CHANGED
|
@@ -235,7 +235,6 @@
|
|
|
235
235
|
"markdown_format_heading_2": "Heading 2",
|
|
236
236
|
"markdown_format_heading_3": "Heading 3",
|
|
237
237
|
"markdown_format_heading_4": "Heading 4",
|
|
238
|
-
"markdown_format_bullet": "Bullets",
|
|
239
238
|
"markdown_format_ordered_list": "Ordered list",
|
|
240
239
|
"markdown_format_bullet_list": "Bullet list",
|
|
241
240
|
"markdown_format_bold": "Bold",
|
package/dist/messages/ja-JP.json
CHANGED
|
@@ -235,7 +235,6 @@
|
|
|
235
235
|
"markdown_format_heading_2": "見出し2",
|
|
236
236
|
"markdown_format_heading_3": "見出し3",
|
|
237
237
|
"markdown_format_heading_4": "見出し4",
|
|
238
|
-
"markdown_format_bullet": "箇条書き",
|
|
239
238
|
"markdown_format_ordered_list": "番号付きリスト",
|
|
240
239
|
"markdown_format_bullet_list": "箇条書きリスト",
|
|
241
240
|
"markdown_format_bold": "太字",
|
package/dist/messages/zh-CN.json
CHANGED
|
@@ -235,7 +235,6 @@
|
|
|
235
235
|
"markdown_format_heading_2": "二级标题",
|
|
236
236
|
"markdown_format_heading_3": "三级标题",
|
|
237
237
|
"markdown_format_heading_4": "四级标题",
|
|
238
|
-
"markdown_format_bullet": "列表",
|
|
239
238
|
"markdown_format_ordered_list": "有序列表",
|
|
240
239
|
"markdown_format_bullet_list": "无序列表",
|
|
241
240
|
"markdown_format_bold": "加粗",
|
package/dist/theme-config.d.ts
CHANGED
|
@@ -247,8 +247,6 @@ export interface ThemeBootstrapLocaleConfig {
|
|
|
247
247
|
export interface ThemeBootstrapScriptOptions {
|
|
248
248
|
/** 偏好存储 key。 */
|
|
249
249
|
storageKey: string;
|
|
250
|
-
/** 历史主题 key;传 null 表示不做迁移。 */
|
|
251
|
-
legacyThemeStorageKey?: string | null;
|
|
252
250
|
/** 默认主题 ID。 */
|
|
253
251
|
defaultThemeId?: string;
|
|
254
252
|
/** 默认主题色;传 null 表示不处理主题色。 */
|
package/dist/theme-config.js
CHANGED
|
@@ -371,7 +371,7 @@ export function createThemeBootstrapScript(options) {
|
|
|
371
371
|
if (locale) {
|
|
372
372
|
defaultPreferences[locale.key] = locale.defaultValue;
|
|
373
373
|
}
|
|
374
|
-
return `(function(){var d=${escapeJsonForScript(defaultPreferences)};var s=${escapeJsonForScript(options.storageKey)};var
|
|
374
|
+
return `(function(){var d=${escapeJsonForScript(defaultPreferences)};var s=${escapeJsonForScript(options.storageKey)};var u=new Set(${escapeJsonForScript(SUPPORTED_THEME_IDS)});var k=new Set(${escapeJsonForScript(DARK_THEMES)});var c=${escapeJsonForScript(options.colorCssVar ?? null)};var y=${escapeJsonForScript(options.toneDatasetKey ?? null)};var i=${escapeJsonForScript(locale)};function n(e){var r=''+(e??'');return u.has(r)?r:d.themeId}function h(e){var r=(''+(e??'')).trim().toLowerCase();if(/^#[0-9a-f]{6}$/i.test(r))return r;if(/^#[0-9a-f]{3}$/i.test(r))return '#'+r[1]+r[1]+r[2]+r[2]+r[3]+r[3];return Object.prototype.hasOwnProperty.call(d,'themeColor')?d.themeColor:null}function g(e){var r={...d,themeId:n(e?.themeId)};if(Object.prototype.hasOwnProperty.call(d,'themeColor'))r.themeColor=h(e?.themeColor);if(i)r[i.key]=i.supportedValues.includes(e?.[i.key])?e[i.key]:d[i.key];return r}function a(e){var r=document.documentElement;var o=k.has(e.themeId)?'dark':'light';r.setAttribute('data-theme',e.themeId);if(y)r.dataset[y]=o;if(c){if(e.themeColor){r.style.setProperty(c,e.themeColor)}else{r.style.removeProperty(c)}}r.style.setProperty('color-scheme',o)}var p=d;try{var f=window.localStorage.getItem(s);if(f){p=g(JSON.parse(f))}a(p);window.localStorage.setItem(s,JSON.stringify(p))}catch{a(d)}})()`;
|
|
375
375
|
}
|
|
376
376
|
/**
|
|
377
377
|
* 获取主题初始化脚本(用于 HTML shell 防闪烁)
|
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.24",
|
|
5
5
|
"description": "Hai Framework UI component library for Svelte 5 Runes.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"svelte": "./dist/index.js",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"svelte": "^5.57.3"
|
|
130
130
|
},
|
|
131
131
|
"dependencies": {
|
|
132
|
-
"@h-ai/core": "1.0.0-beta.
|
|
132
|
+
"@h-ai/core": "1.0.0-beta.24",
|
|
133
133
|
"@internationalized/date": "^3.12.4",
|
|
134
134
|
"@rrweb/replay": "^2.2.1",
|
|
135
135
|
"@shikijs/langs": "^4.6.0",
|