@icen.ai/ui 0.10.0 → 0.11.0
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/AGENTS.md +79 -309
- package/LICENSE +21 -0
- package/README.md +43 -54
- package/dist/base.css +57 -16
- package/dist/behaviors/accordion.mjs +1 -1
- package/dist/behaviors/ai-branch.mjs +1 -0
- package/dist/behaviors/ai-chat.d.mts +2 -2
- package/dist/behaviors/ai-chat.mjs +53 -10
- package/dist/behaviors/ai-composer.d.mts +5 -5
- package/dist/behaviors/ai-composer.mjs +21 -10
- package/dist/behaviors/ai-core.mjs +1 -0
- package/dist/behaviors/ai-diff.mjs +1 -0
- package/dist/behaviors/ai-feedback.mjs +1 -0
- package/dist/behaviors/ai-panel.d.mts +2 -2
- package/dist/behaviors/ai-panel.mjs +1 -0
- package/dist/behaviors/ai-provider.d.mts +1 -1
- package/dist/behaviors/ai-provider.mjs +1 -0
- package/dist/behaviors/ai-threads.mjs +1 -0
- package/dist/behaviors/ai-tool.d.mts +1 -1
- package/dist/behaviors/ai-tool.mjs +57 -24
- package/dist/behaviors/ai-tools.mjs +937 -28
- package/dist/behaviors/autocomplete.d.mts +1 -1
- package/dist/behaviors/autocomplete.mjs +1 -0
- package/dist/behaviors/back-top.mjs +1 -0
- package/dist/behaviors/carousel.mjs +8 -1
- package/dist/behaviors/cascader.mjs +14 -0
- package/dist/behaviors/charts.mjs +56 -20
- package/dist/behaviors/code-block.mjs +9 -1
- package/dist/behaviors/command-palette.mjs +3 -3
- package/dist/behaviors/context-menu.d.mts +2 -2
- package/dist/behaviors/context-menu.mjs +1 -0
- package/dist/behaviors/controls.d.mts +8 -8
- package/dist/behaviors/controls.mjs +37 -6
- package/dist/behaviors/copy.mjs +1 -0
- package/dist/behaviors/datatable.d.mts +3 -3
- package/dist/behaviors/datatable.mjs +76 -11
- package/dist/behaviors/date-picker.mjs +1 -0
- package/dist/behaviors/events.d.mts +10 -10
- package/dist/behaviors/events.mjs +11 -1
- package/dist/behaviors/form-validate.d.mts +10 -1
- package/dist/behaviors/form-validate.mjs +266 -4611
- package/dist/behaviors/i18n.d.mts +1 -0
- package/dist/behaviors/i18n.mjs +2 -0
- package/dist/behaviors/input.mjs +3 -0
- package/dist/behaviors/kb-access.d.mts +2 -2
- package/dist/behaviors/kb-access.mjs +8 -2
- package/dist/behaviors/kb-acl.d.mts +2 -2
- package/dist/behaviors/kb-acl.mjs +1 -0
- package/dist/behaviors/kb-answer.d.mts +2 -2
- package/dist/behaviors/kb-answer.mjs +56 -23
- package/dist/behaviors/kb-audit.d.mts +2 -2
- package/dist/behaviors/kb-audit.mjs +1 -0
- package/dist/behaviors/kb-canvas.d.mts +3 -3
- package/dist/behaviors/kb-canvas.mjs +1 -0
- package/dist/behaviors/kb-chain.d.mts +2 -2
- package/dist/behaviors/kb-chain.mjs +1 -0
- package/dist/behaviors/kb-checkpoint.d.mts +2 -2
- package/dist/behaviors/kb-checkpoint.mjs +1 -0
- package/dist/behaviors/kb-chunks.d.mts +2 -2
- package/dist/behaviors/kb-chunks.mjs +1 -0
- package/dist/behaviors/kb-citation.d.mts +2 -2
- package/dist/behaviors/kb-citation.mjs +20 -6
- package/dist/behaviors/kb-clarify.d.mts +2 -2
- package/dist/behaviors/kb-clarify.mjs +1 -0
- package/dist/behaviors/kb-conflict.d.mts +2 -2
- package/dist/behaviors/kb-conflict.mjs +1 -0
- package/dist/behaviors/kb-connector.d.mts +2 -2
- package/dist/behaviors/kb-connector.mjs +1 -0
- package/dist/behaviors/kb-core.d.mts +1 -1
- package/dist/behaviors/kb-core.mjs +1 -0
- package/dist/behaviors/kb-eval.d.mts +2 -2
- package/dist/behaviors/kb-eval.mjs +8 -2
- package/dist/behaviors/kb-explain.d.mts +2 -2
- package/dist/behaviors/kb-explain.mjs +13 -2
- package/dist/behaviors/kb-filter.d.mts +2 -2
- package/dist/behaviors/kb-filter.mjs +8 -2
- package/dist/behaviors/kb-gap.d.mts +2 -2
- package/dist/behaviors/kb-gap.mjs +1 -0
- package/dist/behaviors/kb-hittest.d.mts +2 -2
- package/dist/behaviors/kb-hittest.mjs +2 -1
- package/dist/behaviors/kb-metadata.mjs +6 -0
- package/dist/behaviors/kb-passage.d.mts +2 -2
- package/dist/behaviors/kb-passage.mjs +1 -0
- package/dist/behaviors/kb-pipeline.d.mts +2 -2
- package/dist/behaviors/kb-pipeline.mjs +1 -0
- package/dist/behaviors/kb-qa.mjs +1 -0
- package/dist/behaviors/kb-rerank.d.mts +2 -2
- package/dist/behaviors/kb-rerank.mjs +1 -0
- package/dist/behaviors/kb-retrieval.d.mts +2 -2
- package/dist/behaviors/kb-retrieval.mjs +18 -4
- package/dist/behaviors/kb-review.d.mts +2 -2
- package/dist/behaviors/kb-review.mjs +8 -2
- package/dist/behaviors/kb-sandbox.d.mts +2 -2
- package/dist/behaviors/kb-sandbox.mjs +7 -1
- package/dist/behaviors/kb-segment.d.mts +2 -2
- package/dist/behaviors/kb-segment.mjs +2 -1
- package/dist/behaviors/kb-select.mjs +8 -2
- package/dist/behaviors/kb-sources.d.mts +2 -2
- package/dist/behaviors/kb-sources.mjs +1 -0
- package/dist/behaviors/kb-sql.d.mts +2 -2
- package/dist/behaviors/kb-sql.mjs +1 -0
- package/dist/behaviors/kb-trace.d.mts +2 -2
- package/dist/behaviors/kb-trace.mjs +9 -3
- package/dist/behaviors/kb-visibility.d.mts +2 -2
- package/dist/behaviors/kb-visibility.mjs +1 -0
- package/dist/behaviors/kb-who-can.d.mts +2 -2
- package/dist/behaviors/kb-who-can.mjs +8 -2
- package/dist/behaviors/mentions.d.mts +1 -1
- package/dist/behaviors/mentions.mjs +1 -0
- package/dist/behaviors/modal.d.mts +1 -1
- package/dist/behaviors/modal.mjs +1 -0
- package/dist/behaviors/notification.d.mts +2 -2
- package/dist/behaviors/notification.mjs +14 -3
- package/dist/behaviors/panel.mjs +1 -0
- package/dist/behaviors/scroll-area.d.mts +17 -0
- package/dist/behaviors/scroll-area.mjs +59 -0
- package/dist/behaviors/select.mjs +8 -2
- package/dist/behaviors/slider.mjs +3 -3
- package/dist/behaviors/split-pane.mjs +2 -0
- package/dist/behaviors/suggestions.mjs +1 -0
- package/dist/behaviors/tabs.mjs +10 -0
- package/dist/behaviors/tag-input.mjs +1 -0
- package/dist/behaviors/theme-switcher.d.mts +2 -2
- package/dist/behaviors/theme-switcher.mjs +17 -2
- package/dist/behaviors/theme.mjs +16 -2
- package/dist/behaviors/toast.d.mts +2 -2
- package/dist/behaviors/toast.mjs +1 -0
- package/dist/behaviors/tree-select.mjs +14 -0
- package/dist/behaviors/tree.mjs +4 -4
- package/dist/behaviors/upload.mjs +1 -0
- package/dist/behaviors/url-safety.d.mts +8 -0
- package/dist/behaviors/url-safety.mjs +11 -0
- package/dist/components/accordion.d.mts +2 -0
- package/dist/components/ai-branch.d.mts +2 -0
- package/dist/components/ai-chat.css +40 -33
- package/dist/components/ai-chat.d.mts +2 -0
- package/dist/components/ai-composer.d.mts +2 -0
- package/dist/components/ai-context.d.mts +2 -0
- package/dist/components/ai-context.mjs +1 -0
- package/dist/components/ai-diff.css +6 -6
- package/dist/components/ai-diff.d.mts +2 -0
- package/dist/components/ai-feedback.d.mts +2 -0
- package/dist/components/ai-files.d.mts +2 -0
- package/dist/components/ai-message.d.mts +2 -0
- package/dist/components/ai-panel.css +12 -10
- package/dist/components/ai-reasoning.d.mts +2 -0
- package/dist/components/ai-subagent.d.mts +2 -0
- package/dist/components/ai-subagent.mjs +1 -0
- package/dist/components/ai-threads.d.mts +2 -0
- package/dist/components/ai-todo.d.mts +2 -0
- package/dist/components/ai-todo.mjs +1 -0
- package/dist/components/ai-tool-call.d.mts +2 -0
- package/dist/components/ai-tool-call.mjs +1 -0
- package/dist/components/ai-tool.css +16 -16
- package/dist/components/ai-usage.d.mts +2 -0
- package/dist/components/alert.d.mts +2 -0
- package/dist/components/autocomplete.css +12 -12
- package/dist/components/autocomplete.d.mts +2 -0
- package/dist/components/avatar.d.mts +2 -0
- package/dist/components/back-top.css +47 -16
- package/dist/components/back-top.d.mts +2 -0
- package/dist/components/badge.css +1 -1
- package/dist/components/badge.d.mts +2 -0
- package/dist/components/breadcrumb.css +26 -8
- package/dist/components/breadcrumb.d.mts +2 -0
- package/dist/components/btn.css +67 -62
- package/dist/components/btn.d.mts +2 -0
- package/dist/components/card.css +22 -22
- package/dist/components/card.d.mts +2 -0
- package/dist/components/carousel.d.mts +2 -0
- package/dist/components/cascader.css +56 -35
- package/dist/components/cascader.d.mts +2 -0
- package/dist/components/chart-area.css +46 -0
- package/dist/components/chart-area.d.mts +2 -0
- package/dist/components/chart-bar.css +66 -19
- package/dist/components/chart-bar.d.mts +2 -0
- package/dist/components/chart-calendar.d.mts +2 -0
- package/dist/components/chart-gauge.css +23 -3
- package/dist/components/chart-gauge.d.mts +2 -0
- package/dist/components/chart-graph.css +15 -3
- package/dist/components/chart-graph.d.mts +2 -0
- package/dist/components/chart-heatmap.css +117 -95
- package/dist/components/chart-heatmap.d.mts +2 -0
- package/dist/components/chart-line.css +54 -0
- package/dist/components/chart-line.d.mts +2 -0
- package/dist/components/chart-map.d.mts +2 -0
- package/dist/components/chart-pie.css +29 -0
- package/dist/components/chart-pie.d.mts +2 -0
- package/dist/components/chart-radar.css +50 -1
- package/dist/components/chart-radar.d.mts +2 -0
- package/dist/components/chart-scatter.css +39 -2
- package/dist/components/chart-scatter.d.mts +2 -0
- package/dist/components/chart-sparkline.css +20 -0
- package/dist/components/chart-sparkline.d.mts +2 -0
- package/dist/components/chart-stack.css +16 -5
- package/dist/components/chart-stack.d.mts +2 -0
- package/dist/components/charts.css +80 -35
- package/dist/components/charts.d.mts +2 -0
- package/dist/components/code-block.css +10 -8
- package/dist/components/code-block.d.mts +2 -0
- package/dist/components/command-palette.css +45 -38
- package/dist/components/command-palette.d.mts +2 -0
- package/dist/components/content.css +62 -57
- package/dist/components/context-menu.d.mts +2 -0
- package/dist/components/copy.css +10 -10
- package/dist/components/copy.d.mts +2 -0
- package/dist/components/datatable.css +72 -59
- package/dist/components/datatable.d.mts +2 -0
- package/dist/components/date-picker.css +26 -26
- package/dist/components/date-picker.d.mts +2 -0
- package/dist/components/desc.d.mts +2 -0
- package/dist/components/dropdown.d.mts +2 -0
- package/dist/components/empty.css +16 -16
- package/dist/components/empty.d.mts +2 -0
- package/dist/components/feedback.css +31 -29
- package/dist/components/form-validate.css +20 -6
- package/dist/components/form-validate.d.mts +2 -0
- package/dist/components/form.css +17 -14
- package/dist/components/form.d.mts +2 -0
- package/dist/components/icon.css +21 -10
- package/dist/components/icon.d.mts +2 -0
- package/dist/components/input.css +22 -22
- package/dist/components/input.d.mts +2 -0
- package/dist/components/kb-access.d.mts +2 -0
- package/dist/components/kb-acl.d.mts +2 -0
- package/dist/components/kb-agent.css +134 -55
- package/dist/components/kb-answer.d.mts +2 -0
- package/dist/components/kb-audit.d.mts +2 -0
- package/dist/components/kb-canvas.d.mts +2 -0
- package/dist/components/kb-chain.d.mts +2 -0
- package/dist/components/kb-checkpoint.d.mts +2 -0
- package/dist/components/kb-chunks.d.mts +2 -0
- package/dist/components/kb-citation.d.mts +2 -0
- package/dist/components/kb-clarify.d.mts +2 -0
- package/dist/components/kb-conflict.d.mts +2 -0
- package/dist/components/kb-connector.d.mts +2 -0
- package/dist/components/kb-data.css +192 -80
- package/dist/components/kb-eval.d.mts +2 -0
- package/dist/components/kb-explain.d.mts +2 -0
- package/dist/components/kb-filter.d.mts +2 -0
- package/dist/components/kb-gap.d.mts +2 -0
- package/dist/components/kb-ground.css +165 -73
- package/dist/components/kb-hittest.d.mts +2 -0
- package/dist/components/kb-ingest.css +308 -113
- package/dist/components/kb-metadata.d.mts +2 -0
- package/dist/components/kb-ops.css +189 -75
- package/dist/components/kb-passage.d.mts +2 -0
- package/dist/components/kb-perm.css +158 -87
- package/dist/components/kb-pipeline.d.mts +2 -0
- package/dist/components/kb-qa.d.mts +2 -0
- package/dist/components/kb-rerank.d.mts +2 -0
- package/dist/components/kb-retrieval.d.mts +2 -0
- package/dist/components/kb-review.d.mts +2 -0
- package/dist/components/kb-sandbox.d.mts +2 -0
- package/dist/components/kb-search.css +353 -116
- package/dist/components/kb-segment.d.mts +2 -0
- package/dist/components/kb-sources.d.mts +2 -0
- package/dist/components/kb-sql.d.mts +2 -0
- package/dist/components/kb-trace.d.mts +2 -0
- package/dist/components/kb-visibility.d.mts +2 -0
- package/dist/components/kb-who-can.d.mts +2 -0
- package/dist/components/kb.css +60 -36
- package/dist/components/kb.d.mts +2 -0
- package/dist/components/kbd.d.mts +2 -0
- package/dist/components/layout.css +10 -10
- package/dist/components/layout.d.mts +2 -0
- package/dist/components/list.d.mts +2 -0
- package/dist/components/material-chinese.css +10 -0
- package/dist/components/material-soviet.css +10 -0
- package/dist/components/material.css +61 -18
- package/dist/components/media-card.d.mts +2 -0
- package/dist/components/media.css +22 -27
- package/dist/components/mentions.css +18 -17
- package/dist/components/mentions.d.mts +2 -0
- package/dist/components/menu.css +32 -28
- package/dist/components/modal.css +30 -27
- package/dist/components/modal.d.mts +2 -0
- package/dist/components/nav.css +48 -44
- package/dist/components/nav.d.mts +2 -0
- package/dist/components/notification.css +31 -25
- package/dist/components/notification.d.mts +2 -0
- package/dist/components/pagination.css +15 -13
- package/dist/components/pagination.d.mts +2 -0
- package/dist/components/panel.css +19 -20
- package/dist/components/panel.d.mts +2 -0
- package/dist/components/pill.css +8 -7
- package/dist/components/pill.d.mts +2 -0
- package/dist/components/popover.css +32 -23
- package/dist/components/popover.d.mts +2 -0
- package/dist/components/progress.d.mts +2 -0
- package/dist/components/rating.d.mts +2 -0
- package/dist/components/result.d.mts +2 -0
- package/dist/components/scroll-area.css +84 -112
- package/dist/components/scroll-area.d.mts +2 -0
- package/dist/components/scroll-area.mjs +1 -0
- package/dist/components/segmented.css +47 -29
- package/dist/components/segmented.d.mts +2 -0
- package/dist/components/select.css +80 -41
- package/dist/components/select.d.mts +2 -0
- package/dist/components/sidebar.css +42 -38
- package/dist/components/sidebar.d.mts +2 -0
- package/dist/components/skeleton.d.mts +2 -0
- package/dist/components/slider.css +26 -22
- package/dist/components/slider.d.mts +2 -0
- package/dist/components/spinner.d.mts +2 -0
- package/dist/components/split-pane.css +16 -7
- package/dist/components/split-pane.d.mts +2 -0
- package/dist/components/stat.css +17 -16
- package/dist/components/stat.d.mts +2 -0
- package/dist/components/steps.css +26 -26
- package/dist/components/steps.d.mts +2 -0
- package/dist/components/switch.css +78 -39
- package/dist/components/switch.d.mts +2 -0
- package/dist/components/table.css +54 -32
- package/dist/components/table.d.mts +2 -0
- package/dist/components/tabs.css +53 -32
- package/dist/components/tabs.d.mts +2 -0
- package/dist/components/tag-input.css +12 -8
- package/dist/components/tag-input.d.mts +2 -0
- package/dist/components/tag.css +20 -12
- package/dist/components/tag.d.mts +2 -0
- package/dist/components/theme-switcher.css +7 -7
- package/dist/components/theme-switcher.d.mts +2 -0
- package/dist/components/timeline.d.mts +2 -0
- package/dist/components/toast.css +34 -30
- package/dist/components/toast.d.mts +2 -0
- package/dist/components/toolbar.css +19 -18
- package/dist/components/toolbar.d.mts +2 -0
- package/dist/components/tooltip.css +9 -8
- package/dist/components/tooltip.d.mts +2 -0
- package/dist/components/tree-select.css +63 -40
- package/dist/components/tree-select.d.mts +2 -0
- package/dist/components/tree.d.mts +2 -0
- package/dist/components/upload.css +9 -11
- package/dist/components/upload.d.mts +2 -0
- package/dist/index.d.mts +85 -84
- package/dist/index.mjs +14764 -14311
- package/dist/react.d.mts +18 -18
- package/dist/react.mjs +135 -36
- package/dist/registry.json +795 -64
- package/dist/tokens/colors.css +6 -0
- package/dist/tokens/design.css +130 -30
- package/dist/tokens/dtcg.json +6189 -1461
- package/dist/tokens/figma.variables.json +4107 -345
- package/dist/tokens/pixel.css +3 -0
- package/dist/tokens/scrollbars.css +40 -0
- package/dist/tokens/tokens-studio.json +5191 -271
- package/dist/tokens.css +304 -81
- package/dist/ui.css +4050 -2148
- package/dist/vue.d.mts +17 -17
- package/dist/vue.mjs +129 -34
- package/docs/spec/design-philosophy.md +5 -5
- package/docs/spec/design-primitives.md +10 -10
- package/docs/spec/scrollbars.md +46 -0
- package/package.json +16 -3
package/dist/react.d.mts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { RefObject, CSSProperties, ReactElement, FC } from 'react';
|
|
2
|
-
import { IcenEventMap } from './behaviors/events.
|
|
3
|
-
import { ChartSpec, ChartHandle } from './behaviors/charts.
|
|
4
|
-
import { TableOptions, TableHandle } from './behaviors/datatable.
|
|
5
|
-
export { TableColumn } from './behaviors/datatable.
|
|
6
|
-
import { AiMessageModel } from './behaviors/ai-chat.
|
|
7
|
-
export { AiMessageHandle } from './behaviors/ai-chat.
|
|
8
|
-
import { AiToolCallHandle } from './behaviors/ai-tool.
|
|
9
|
-
import { AiProviderOption, AiComposerCurrentModel, AiComposerBindOpts } from './behaviors/ai-composer.
|
|
10
|
-
import { AiClient } from './behaviors/ai-provider.
|
|
11
|
-
import { AiToolCallModel } from './behaviors/ai-core.
|
|
12
|
-
export { AiContent, AiContentPart, AiStatus, AiUsage } from './behaviors/ai-core.
|
|
13
|
-
import './behaviors/mentions.
|
|
14
|
-
import './behaviors/suggestions.
|
|
15
|
-
import './behaviors/kb-core.
|
|
16
|
-
import './behaviors/icons.
|
|
17
|
-
import './behaviors/popover.
|
|
18
|
-
import './behaviors/ai-panel.
|
|
19
|
-
import './behaviors/context-menu.
|
|
2
|
+
import { IcenEventMap } from './behaviors/events.mjs';
|
|
3
|
+
import { ChartSpec, ChartHandle } from './behaviors/charts.mjs';
|
|
4
|
+
import { TableOptions, TableHandle } from './behaviors/datatable.mjs';
|
|
5
|
+
export { TableColumn } from './behaviors/datatable.mjs';
|
|
6
|
+
import { AiMessageModel } from './behaviors/ai-chat.mjs';
|
|
7
|
+
export { AiMessageHandle } from './behaviors/ai-chat.mjs';
|
|
8
|
+
import { AiToolCallHandle } from './behaviors/ai-tool.mjs';
|
|
9
|
+
import { AiProviderOption, AiComposerCurrentModel, AiComposerBindOpts } from './behaviors/ai-composer.mjs';
|
|
10
|
+
import { AiClient } from './behaviors/ai-provider.mjs';
|
|
11
|
+
import { AiToolCallModel } from './behaviors/ai-core.mjs';
|
|
12
|
+
export { AiContent, AiContentPart, AiStatus, AiUsage } from './behaviors/ai-core.mjs';
|
|
13
|
+
import './behaviors/mentions.mjs';
|
|
14
|
+
import './behaviors/suggestions.mjs';
|
|
15
|
+
import './behaviors/kb-core.mjs';
|
|
16
|
+
import './behaviors/icons.mjs';
|
|
17
|
+
import './behaviors/popover.mjs';
|
|
18
|
+
import './behaviors/ai-panel.mjs';
|
|
19
|
+
import './behaviors/context-menu.mjs';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* 生命周期接线原语:mount 时调 init,返回的清理函数在 unmount / deps 变化时执行。
|
package/dist/react.mjs
CHANGED
|
@@ -166,6 +166,7 @@ var ICEN_LOCALE_ZH_CN = {
|
|
|
166
166
|
"aiChat.roleTool": "\u5DE5",
|
|
167
167
|
"aiChat.roleUser": "\u6211",
|
|
168
168
|
"aiChat.thinking": "\u601D\u8003 {p0}",
|
|
169
|
+
"aiChat.thinkingNow": "\u6B63\u5728\u601D\u8003\u2026",
|
|
169
170
|
/* ── aiComposer ── */
|
|
170
171
|
"aiComposer.attachAgent": "\u4EE3\u7406",
|
|
171
172
|
"aiComposer.library": "\u6DFB\u52A0\u4E0A\u4E0B\u6587\u4E0E\u547D\u4EE4",
|
|
@@ -1213,7 +1214,8 @@ function withChrome(el, opts, hasLegend, paint, state, extras) {
|
|
|
1213
1214
|
emitIcen(el, "icen:chart-legend-visibility", { visible: hidden ? false : true });
|
|
1214
1215
|
});
|
|
1215
1216
|
syncEye();
|
|
1216
|
-
head.append(title, eye);
|
|
1217
|
+
if (hasLegend) head.append(title, eye);
|
|
1218
|
+
else head.append(title);
|
|
1217
1219
|
el.append(head, body);
|
|
1218
1220
|
paint(body);
|
|
1219
1221
|
}
|
|
@@ -1314,7 +1316,7 @@ function renderVBar(el, opts) {
|
|
|
1314
1316
|
wrap.appendChild(track);
|
|
1315
1317
|
}
|
|
1316
1318
|
body.append(wrap, labelsRow(labelsUsed));
|
|
1317
|
-
if (seriesList.length > 1) body.appendChild(toggleLegend(seriesList.map((s, si) => ({ key: s.name
|
|
1319
|
+
if (seriesList.length > 1) body.appendChild(toggleLegend(seriesList.map((s, si) => ({ key: `${si}:${s.name}`, label: s.name, tone: s.tone ?? (si === 0 ? opts.tone : void 0), si })), wrap));
|
|
1318
1320
|
});
|
|
1319
1321
|
attachChartInteraction(el, "vbar");
|
|
1320
1322
|
return el;
|
|
@@ -1409,8 +1411,10 @@ function renderDonut(el, opts) {
|
|
|
1409
1411
|
"stroke-width": "14"
|
|
1410
1412
|
}));
|
|
1411
1413
|
let offset = 0;
|
|
1414
|
+
const gap = opts.segments.length > 1 ? 2.5 : 0;
|
|
1412
1415
|
opts.segments.forEach((seg, segIndex) => {
|
|
1413
|
-
const
|
|
1416
|
+
const arcLength = Math.max(0, seg.value / total * circumference);
|
|
1417
|
+
const dash = arcLength - Math.min(gap, arcLength * 0.1);
|
|
1414
1418
|
const arc = svgEl("circle", {
|
|
1415
1419
|
cx: "60",
|
|
1416
1420
|
cy: "60",
|
|
@@ -1424,7 +1428,7 @@ function renderDonut(el, opts) {
|
|
|
1424
1428
|
});
|
|
1425
1429
|
setMarkData(arc, { index: segIndex, label: seg.label, value: seg.value });
|
|
1426
1430
|
svg.appendChild(arc);
|
|
1427
|
-
offset +=
|
|
1431
|
+
offset += arcLength;
|
|
1428
1432
|
});
|
|
1429
1433
|
const legend = document.createElement("div");
|
|
1430
1434
|
legend.className = "icen-chart-legend";
|
|
@@ -1459,8 +1463,9 @@ function renderLine(el, opts) {
|
|
|
1459
1463
|
const svg = svgEl("svg", { viewBox: `0 0 ${width} ${height}`, role: "img", "aria-label": chartAriaLabel(opts.title, t("charts.type.line")) });
|
|
1460
1464
|
const defs = svgEl("defs", {});
|
|
1461
1465
|
for (let i = 0; i < 4; i++) {
|
|
1462
|
-
const y = pad + i * (height - pad * 2) / 3;
|
|
1466
|
+
const y = Math.round(pad + i * (height - pad * 2) / 3) + 0.5;
|
|
1463
1467
|
svg.appendChild(svgEl("line", {
|
|
1468
|
+
class: i === 3 ? "icen-chart-grid icen-chart-baseline" : "icen-chart-grid",
|
|
1464
1469
|
x1: String(pad),
|
|
1465
1470
|
x2: String(width - pad),
|
|
1466
1471
|
y1: String(y),
|
|
@@ -1544,7 +1549,7 @@ function renderLine(el, opts) {
|
|
|
1544
1549
|
if (defs.firstChild) svg.insertBefore(defs, svg.firstChild);
|
|
1545
1550
|
wrap.append(svg, pointLabelsRow(labelsUsed, width, pad));
|
|
1546
1551
|
body.appendChild(wrap);
|
|
1547
|
-
if (seriesList.length > 1) body.appendChild(toggleLegend(seriesList.map((s, si) => ({ key: s.name
|
|
1552
|
+
if (seriesList.length > 1) body.appendChild(toggleLegend(seriesList.map((s, si) => ({ key: `${si}:${s.name}`, label: s.name, tone: s.tone ?? (si === 0 ? opts.tone : void 0), si })), wrap));
|
|
1548
1553
|
});
|
|
1549
1554
|
if (el.dataset.icenChartBody == null) observeFluidWidth(el, () => renderLine(el, opts));
|
|
1550
1555
|
attachChartInteraction(el, "line");
|
|
@@ -1651,7 +1656,7 @@ function renderRadar(el, opts) {
|
|
|
1651
1656
|
setMarkData(dot, { index: i, seriesIndex: si, seriesName: s.name || void 0, label: axes[i] ?? "", value: s.values[i] ?? 0 });
|
|
1652
1657
|
svg.appendChild(dot);
|
|
1653
1658
|
}
|
|
1654
|
-
legendItems.push({ key: s.name || t("charts.seriesName", { p0: si + 1 })
|
|
1659
|
+
legendItems.push({ key: `${si}:${s.name || t("charts.seriesName", { p0: si + 1 })}`, label: s.name || t("charts.seriesName", { p0: si + 1 }), tone: s.tone, si });
|
|
1655
1660
|
});
|
|
1656
1661
|
wrap.appendChild(svg);
|
|
1657
1662
|
body.appendChild(wrap);
|
|
@@ -1673,6 +1678,11 @@ function niceCeil(v) {
|
|
|
1673
1678
|
else nice = 10;
|
|
1674
1679
|
return nice * base;
|
|
1675
1680
|
}
|
|
1681
|
+
function tickPrecision(min, max, steps) {
|
|
1682
|
+
const span = Math.abs(max - min);
|
|
1683
|
+
if (!Number.isFinite(span) || span <= 0) return 0;
|
|
1684
|
+
return Math.max(0, Math.ceil(-Math.log10(span / steps)));
|
|
1685
|
+
}
|
|
1676
1686
|
function isoDate(d) {
|
|
1677
1687
|
const m = String(d.getMonth() + 1).padStart(2, "0");
|
|
1678
1688
|
const day = String(d.getDate()).padStart(2, "0");
|
|
@@ -1768,7 +1778,8 @@ function renderSparkline(el, opts) {
|
|
|
1768
1778
|
const tone = toneVar(opts.tone);
|
|
1769
1779
|
const points = values.map((value, i) => ({
|
|
1770
1780
|
x: values.length <= 1 ? width / 2 : pad + i / (values.length - 1) * (width - pad * 2),
|
|
1771
|
-
|
|
1781
|
+
/* 负值钳到基线(与折线图同口径):viewBox 仅 28 高,反向射出更刺眼 */
|
|
1782
|
+
y: height - pad - Math.max(0, value) / max * (height - pad * 2),
|
|
1772
1783
|
value
|
|
1773
1784
|
}));
|
|
1774
1785
|
const line = points.map((p, i) => `${i === 0 ? "M" : "L"}${p.x.toFixed(1)},${p.y.toFixed(1)}`).join(" ");
|
|
@@ -1893,6 +1904,7 @@ function renderCalendar(el, opts) {
|
|
|
1893
1904
|
weekdayRow.appendChild(s);
|
|
1894
1905
|
});
|
|
1895
1906
|
const max = maxOf(entries.map((e) => e.value));
|
|
1907
|
+
entries.sort((a, b) => a.date.localeCompare(b.date));
|
|
1896
1908
|
const pad = padFirstWeek(grid, entries[0].date, weekStart);
|
|
1897
1909
|
let lastMonth = -1;
|
|
1898
1910
|
entries.forEach((entry, i) => {
|
|
@@ -1951,8 +1963,9 @@ function renderScatter(el, opts) {
|
|
|
1951
1963
|
const xAt = (x) => pad + (x - xMin) / (xMax - xMin) * (width - pad * 2);
|
|
1952
1964
|
const yAt = (y) => height - pad - (y - yMin) / (yMax - yMin) * (height - pad * 2);
|
|
1953
1965
|
for (let i = 0; i <= 3; i++) {
|
|
1954
|
-
const y = pad + i * (height - pad * 2) / 3;
|
|
1966
|
+
const y = Math.round(pad + i * (height - pad * 2) / 3) + 0.5;
|
|
1955
1967
|
svg.appendChild(svgEl("line", {
|
|
1968
|
+
class: i === 3 ? "icen-chart-grid icen-chart-baseline" : "icen-chart-grid",
|
|
1956
1969
|
x1: String(pad),
|
|
1957
1970
|
x2: String(width - pad),
|
|
1958
1971
|
y1: String(y),
|
|
@@ -1968,12 +1981,13 @@ function renderScatter(el, opts) {
|
|
|
1968
1981
|
"font-size": "8",
|
|
1969
1982
|
fill: "var(--icen-token-text-faint)"
|
|
1970
1983
|
});
|
|
1971
|
-
txt.textContent = fmt(opts,
|
|
1984
|
+
txt.textContent = fmt(opts, +tv.toFixed(tickPrecision(yMin, yMax, 3)));
|
|
1972
1985
|
svg.appendChild(txt);
|
|
1973
1986
|
}
|
|
1974
1987
|
for (let i = 0; i <= 4; i++) {
|
|
1975
|
-
const x = pad + i * (width - pad * 2) / 4;
|
|
1988
|
+
const x = Math.round(pad + i * (width - pad * 2) / 4) + 0.5;
|
|
1976
1989
|
svg.appendChild(svgEl("line", {
|
|
1990
|
+
class: i === 0 ? "icen-chart-grid icen-chart-grid--v icen-chart-axis" : "icen-chart-grid icen-chart-grid--v",
|
|
1977
1991
|
x1: String(x),
|
|
1978
1992
|
x2: String(x),
|
|
1979
1993
|
y1: String(pad),
|
|
@@ -1990,7 +2004,7 @@ function renderScatter(el, opts) {
|
|
|
1990
2004
|
"font-size": "8",
|
|
1991
2005
|
fill: "var(--icen-token-text-faint)"
|
|
1992
2006
|
});
|
|
1993
|
-
txt.textContent = fmt(opts,
|
|
2007
|
+
txt.textContent = fmt(opts, +tv.toFixed(tickPrecision(xMin, xMax, 4)));
|
|
1994
2008
|
svg.appendChild(txt);
|
|
1995
2009
|
}
|
|
1996
2010
|
if (opts.yLabel) {
|
|
@@ -2354,6 +2368,7 @@ function renderChartSkeleton(body) {
|
|
|
2354
2368
|
body.appendChild(box);
|
|
2355
2369
|
}
|
|
2356
2370
|
var CHART_MARK_ACCENT = "var(--icen-token-accent)";
|
|
2371
|
+
var CHART_MARK_ACCENT_TEXT = "var(--icen-token-accent-text)";
|
|
2357
2372
|
function markToneVar(tone) {
|
|
2358
2373
|
switch (tone) {
|
|
2359
2374
|
case "success":
|
|
@@ -2489,7 +2504,7 @@ function paintSvgChartMarks(root, view, marks, formatValue, warned) {
|
|
|
2489
2504
|
y: String(clampNum(y - 10, 8, CHART_LINE_H - 4)),
|
|
2490
2505
|
"text-anchor": "middle",
|
|
2491
2506
|
"font-size": "8",
|
|
2492
|
-
fill:
|
|
2507
|
+
fill: CHART_MARK_ACCENT_TEXT
|
|
2493
2508
|
});
|
|
2494
2509
|
label.textContent = mark.text ?? mark.label;
|
|
2495
2510
|
g.appendChild(label);
|
|
@@ -3047,6 +3062,12 @@ function renderChart(el, raw) {
|
|
|
3047
3062
|
const graphic = root.querySelector('[role="img"]');
|
|
3048
3063
|
if (graphic && !graphic.getAttribute("aria-label")) {
|
|
3049
3064
|
graphic.setAttribute("aria-label", spec.title ? `${spec.title}\uFF08${type}\uFF09` : type);
|
|
3065
|
+
} else if (!graphic) {
|
|
3066
|
+
const dom = root.querySelector(".icen-chart-vbar, .icen-chart-hbar");
|
|
3067
|
+
if (dom) {
|
|
3068
|
+
dom.setAttribute("role", "img");
|
|
3069
|
+
dom.setAttribute("aria-label", spec.title ? `${spec.title}\uFF08${type}\uFF09` : type);
|
|
3070
|
+
}
|
|
3050
3071
|
}
|
|
3051
3072
|
}
|
|
3052
3073
|
if (loading) return;
|
|
@@ -3759,7 +3780,13 @@ function onKeyDown2(e) {
|
|
|
3759
3780
|
|
|
3760
3781
|
// src/behaviors/datatable.ts
|
|
3761
3782
|
function defaultCompare(a, b) {
|
|
3762
|
-
if (typeof a === "number" && typeof b === "number")
|
|
3783
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
3784
|
+
if (Number.isNaN(a) || Number.isNaN(b)) {
|
|
3785
|
+
if (Number.isNaN(a) && Number.isNaN(b)) return 0;
|
|
3786
|
+
return Number.isNaN(a) ? 1 : -1;
|
|
3787
|
+
}
|
|
3788
|
+
return a - b;
|
|
3789
|
+
}
|
|
3763
3790
|
return String(a ?? "").localeCompare(String(b ?? ""), "zh-CN", { numeric: true });
|
|
3764
3791
|
}
|
|
3765
3792
|
function toNum2(v) {
|
|
@@ -4048,11 +4075,13 @@ function createTable(el, opts) {
|
|
|
4048
4075
|
const body = document.createElement("div");
|
|
4049
4076
|
body.className = "icen-dt-body";
|
|
4050
4077
|
body.setAttribute("role", "rowgroup");
|
|
4051
|
-
const summaryEl = document.createElement("div");
|
|
4052
|
-
summaryEl
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4078
|
+
const summaryEl = opts.summaryRow ? document.createElement("div") : null;
|
|
4079
|
+
if (summaryEl) {
|
|
4080
|
+
summaryEl.className = "icen-dt-row icen-dt-row--summary";
|
|
4081
|
+
summaryEl.setAttribute("role", "row");
|
|
4082
|
+
summaryEl.hidden = true;
|
|
4083
|
+
}
|
|
4084
|
+
canvas.append(head, body, ...summaryEl ? [summaryEl] : []);
|
|
4056
4085
|
scroll.appendChild(canvas);
|
|
4057
4086
|
root.appendChild(scroll);
|
|
4058
4087
|
const foot = document.createElement("div");
|
|
@@ -4866,6 +4895,7 @@ function createTable(el, opts) {
|
|
|
4866
4895
|
return wrap;
|
|
4867
4896
|
}
|
|
4868
4897
|
function renderSummary() {
|
|
4898
|
+
if (!summaryEl) return;
|
|
4869
4899
|
summaryEl.textContent = "";
|
|
4870
4900
|
summaryEl.hidden = true;
|
|
4871
4901
|
const cfg = opts.summaryRow;
|
|
@@ -5062,9 +5092,9 @@ function createTable(el, opts) {
|
|
|
5062
5092
|
}
|
|
5063
5093
|
}
|
|
5064
5094
|
let currentTotal = 0;
|
|
5065
|
-
function visibleRange(total) {
|
|
5095
|
+
function visibleRange(total, avail) {
|
|
5066
5096
|
if (!virtual) {
|
|
5067
|
-
if (opts.remote || opts.pagination === false) return [0, total];
|
|
5097
|
+
if (opts.remote || opts.pagination === false) return [0, Math.min(total, avail)];
|
|
5068
5098
|
const start2 = (page - 1) * pageSize;
|
|
5069
5099
|
return [start2, Math.min(total, start2 + pageSize)];
|
|
5070
5100
|
}
|
|
@@ -5079,6 +5109,10 @@ function createTable(el, opts) {
|
|
|
5079
5109
|
const rows = pipeline();
|
|
5080
5110
|
const entries = groupFn ? flatEntries() : null;
|
|
5081
5111
|
const total = entries ? entries.length : opts.remote ? opts.totalCount ?? data.length : rows.length;
|
|
5112
|
+
if (!opts.remote && opts.pagination !== false) {
|
|
5113
|
+
const pages = Math.max(1, Math.ceil(total / pageSize));
|
|
5114
|
+
if (page > pages) page = pages;
|
|
5115
|
+
}
|
|
5082
5116
|
navTotal = entries ? entries.length : rows.length;
|
|
5083
5117
|
currentTotal = total;
|
|
5084
5118
|
const keepTop = virtual ? scroll.scrollTop : 0;
|
|
@@ -5107,7 +5141,7 @@ function createTable(el, opts) {
|
|
|
5107
5141
|
renderSummary();
|
|
5108
5142
|
return;
|
|
5109
5143
|
}
|
|
5110
|
-
const [start, end] = visibleRange(total);
|
|
5144
|
+
const [start, end] = visibleRange(total, rows.length);
|
|
5111
5145
|
const frag = document.createDocumentFragment();
|
|
5112
5146
|
const offsets = frozenOffsets();
|
|
5113
5147
|
if (virtual && start > 0) {
|
|
@@ -5170,11 +5204,21 @@ function createTable(el, opts) {
|
|
|
5170
5204
|
const pages = Math.ceil(total / pageSize);
|
|
5171
5205
|
const pager = document.createElement("nav");
|
|
5172
5206
|
pager.className = "icen-dt-pager";
|
|
5173
|
-
|
|
5207
|
+
{
|
|
5208
|
+
const base = t("datatable.paginationAria");
|
|
5209
|
+
const used = /* @__PURE__ */ new Set();
|
|
5210
|
+
for (const el2 of document.querySelectorAll(".icen-dt-pager[aria-label]")) {
|
|
5211
|
+
if (!root.contains(el2)) used.add(el2.getAttribute("aria-label") ?? "");
|
|
5212
|
+
}
|
|
5213
|
+
let label = base, n = 2;
|
|
5214
|
+
while (used.has(label)) label = `${base} ${n++}`;
|
|
5215
|
+
pager.setAttribute("aria-label", label);
|
|
5216
|
+
}
|
|
5174
5217
|
const sizeSel = document.createElement("select");
|
|
5175
5218
|
sizeSel.className = "icen-dt-page-size";
|
|
5176
5219
|
sizeSel.setAttribute("aria-label", t("datatable.pageSizeAria"));
|
|
5177
|
-
|
|
5220
|
+
const sizeOptions = pageSizes.includes(pageSize) ? pageSizes : [...pageSizes, pageSize].sort((a, b) => a - b);
|
|
5221
|
+
for (const s of sizeOptions) {
|
|
5178
5222
|
const o = document.createElement("option");
|
|
5179
5223
|
o.value = String(s);
|
|
5180
5224
|
o.textContent = t("pagination.pageSize", { p0: s });
|
|
@@ -5266,6 +5310,7 @@ function createTable(el, opts) {
|
|
|
5266
5310
|
if (destroyed) return;
|
|
5267
5311
|
renderHead();
|
|
5268
5312
|
renderBody();
|
|
5313
|
+
syncFrozenWidths();
|
|
5269
5314
|
}
|
|
5270
5315
|
rekey();
|
|
5271
5316
|
renderAll();
|
|
@@ -5286,12 +5331,52 @@ function createTable(el, opts) {
|
|
|
5286
5331
|
opts.onPageChange?.(page, pageSize);
|
|
5287
5332
|
renderAll();
|
|
5288
5333
|
}
|
|
5334
|
+
function hasFluidFrozen() {
|
|
5335
|
+
return cols().some((c) => frozenSide(c) != null && !/^(\d+(?:\.\d+)?)px/.test(colWidths.get(c.key) ?? c.width ?? ""));
|
|
5336
|
+
}
|
|
5337
|
+
function syncFrozenWidths() {
|
|
5338
|
+
if (!hasFluidFrozen()) return;
|
|
5339
|
+
const visible = cols();
|
|
5340
|
+
const headCells = Array.from(headRow.children);
|
|
5341
|
+
const lead = headCells.length - visible.length;
|
|
5342
|
+
const left = /* @__PURE__ */ new Map();
|
|
5343
|
+
const right = /* @__PURE__ */ new Map();
|
|
5344
|
+
let acc = headCells.slice(0, lead).reduce((s, c) => s + c.offsetWidth, 0);
|
|
5345
|
+
for (let i = 0; i < visible.length; i++) {
|
|
5346
|
+
const c = visible[i];
|
|
5347
|
+
if (frozenSide(c) === "left") left.set(c.key, acc);
|
|
5348
|
+
acc += headCells[lead + i]?.offsetWidth ?? 0;
|
|
5349
|
+
}
|
|
5350
|
+
let accR = 0;
|
|
5351
|
+
for (let i = visible.length - 1; i >= 0; i--) {
|
|
5352
|
+
const c = visible[i];
|
|
5353
|
+
if (frozenSide(c) === "right") right.set(c.key, accR);
|
|
5354
|
+
accR += headCells[lead + i]?.offsetWidth ?? 0;
|
|
5355
|
+
}
|
|
5356
|
+
const rows = [headRow, ...summaryEl ? [summaryEl] : [], ...Array.from(body.querySelectorAll(".icen-dt-row"))];
|
|
5357
|
+
for (const row of rows) {
|
|
5358
|
+
const cells = Array.from(row.children);
|
|
5359
|
+
if (cells.length !== headCells.length) continue;
|
|
5360
|
+
cells.forEach((cell, i) => {
|
|
5361
|
+
const col = i >= lead ? visible[i - lead] : void 0;
|
|
5362
|
+
if (!col) return;
|
|
5363
|
+
const l = left.get(col.key);
|
|
5364
|
+
if (l != null && cell.classList.contains("icen-dt-cell--frozen")) cell.style.left = `${l}px`;
|
|
5365
|
+
const r = right.get(col.key);
|
|
5366
|
+
if (r != null && cell.classList.contains("icen-dt-cell--frozen-right")) cell.style.right = `${r}px`;
|
|
5367
|
+
});
|
|
5368
|
+
}
|
|
5369
|
+
}
|
|
5289
5370
|
return {
|
|
5290
5371
|
setPage,
|
|
5291
5372
|
setPageSize,
|
|
5292
5373
|
setData(next) {
|
|
5293
5374
|
if (editing) cancelEdit(true);
|
|
5294
5375
|
data = next;
|
|
5376
|
+
if (typeof opts.rowKey !== "function" && typeof opts.rowKey !== "string" && selected.size > 0) {
|
|
5377
|
+
selected.clear();
|
|
5378
|
+
emitSelection();
|
|
5379
|
+
}
|
|
5295
5380
|
rekey();
|
|
5296
5381
|
invalidate();
|
|
5297
5382
|
page = 1;
|
|
@@ -5662,6 +5747,15 @@ function svgIcon(svg) {
|
|
|
5662
5747
|
return parseSvg(svg);
|
|
5663
5748
|
}
|
|
5664
5749
|
|
|
5750
|
+
// src/behaviors/url-safety.ts
|
|
5751
|
+
function safeUrl(uri) {
|
|
5752
|
+
const s = uri.replace(/[\t\n\r\0-\x1f\x7f]/g, "").trim().toLowerCase();
|
|
5753
|
+
if (!s) return void 0;
|
|
5754
|
+
if (s.startsWith("javascript:") || s.startsWith("vbscript:")) return void 0;
|
|
5755
|
+
if (/^data:\s*text\/html/.test(s)) return void 0;
|
|
5756
|
+
return uri;
|
|
5757
|
+
}
|
|
5758
|
+
|
|
5665
5759
|
// src/behaviors/ai-chat.ts
|
|
5666
5760
|
var ICON_COPY = iconHTML("copy");
|
|
5667
5761
|
var ICON_RETRY = iconHTML("refresh");
|
|
@@ -5689,6 +5783,8 @@ function createAiStream(el) {
|
|
|
5689
5783
|
el.setAttribute("aria-busy", "true");
|
|
5690
5784
|
if (reasoning) {
|
|
5691
5785
|
reasoning.classList.add("is-streaming");
|
|
5786
|
+
const timeEl = reasoning.querySelector(".icen-ai-reasoning-time");
|
|
5787
|
+
if (timeEl) timeEl.textContent = t("aiChat.thinkingNow");
|
|
5692
5788
|
setReasoningOpen(reasoning, true);
|
|
5693
5789
|
const head = reasoning.querySelector(".icen-ai-reasoning-head");
|
|
5694
5790
|
if (head && head.dataset.icenReasoningStart == null) head.dataset.icenReasoningStart = String(startedAt);
|
|
@@ -5776,10 +5872,9 @@ var ROLE_AVATAR = {
|
|
|
5776
5872
|
system: t("aiChat.roleSystem"),
|
|
5777
5873
|
tool: t("aiChat.roleTool")
|
|
5778
5874
|
};
|
|
5779
|
-
function
|
|
5780
|
-
const
|
|
5781
|
-
|
|
5782
|
-
return uri;
|
|
5875
|
+
function safeContentUrl(part) {
|
|
5876
|
+
const src = aiContentUrl(part);
|
|
5877
|
+
return src ? safeUrl(src) : void 0;
|
|
5783
5878
|
}
|
|
5784
5879
|
function renderAiContentPart(part) {
|
|
5785
5880
|
if (part.type === "text") {
|
|
@@ -5789,7 +5884,7 @@ function renderAiContentPart(part) {
|
|
|
5789
5884
|
return span;
|
|
5790
5885
|
}
|
|
5791
5886
|
if (part.type === "image") {
|
|
5792
|
-
const src =
|
|
5887
|
+
const src = safeContentUrl(part);
|
|
5793
5888
|
if (!src) return void 0;
|
|
5794
5889
|
const img = document.createElement("img");
|
|
5795
5890
|
img.className = "icen-ai-msg-media icen-ai-msg-media--image";
|
|
@@ -5799,7 +5894,7 @@ function renderAiContentPart(part) {
|
|
|
5799
5894
|
return img;
|
|
5800
5895
|
}
|
|
5801
5896
|
if (part.type === "audio") {
|
|
5802
|
-
const src =
|
|
5897
|
+
const src = safeContentUrl(part);
|
|
5803
5898
|
if (!src) return void 0;
|
|
5804
5899
|
const audio = document.createElement("audio");
|
|
5805
5900
|
audio.className = "icen-ai-msg-media icen-ai-msg-media--audio";
|
|
@@ -5808,7 +5903,7 @@ function renderAiContentPart(part) {
|
|
|
5808
5903
|
return audio;
|
|
5809
5904
|
}
|
|
5810
5905
|
if (part.type === "video") {
|
|
5811
|
-
const src =
|
|
5906
|
+
const src = safeContentUrl(part);
|
|
5812
5907
|
if (!src) return void 0;
|
|
5813
5908
|
const video = document.createElement("video");
|
|
5814
5909
|
video.className = "icen-ai-msg-media icen-ai-msg-media--video";
|
|
@@ -5820,7 +5915,7 @@ function renderAiContentPart(part) {
|
|
|
5820
5915
|
if (part.type === "file") {
|
|
5821
5916
|
const chip = h("span", "icen-ai-msg-file");
|
|
5822
5917
|
chip.appendChild(h("span", "ai-msg-file-name", part.filename ?? t("aiChat.file")));
|
|
5823
|
-
const href2 = part.url ?
|
|
5918
|
+
const href2 = part.url ? safeUrl(part.url) : void 0;
|
|
5824
5919
|
if (href2 && /^(https?:|data:)/i.test(href2)) {
|
|
5825
5920
|
const a2 = document.createElement("a");
|
|
5826
5921
|
a2.className = "icen-ai-msg-file-link";
|
|
@@ -5833,7 +5928,7 @@ function renderAiContentPart(part) {
|
|
|
5833
5928
|
}
|
|
5834
5929
|
const a = document.createElement("a");
|
|
5835
5930
|
a.className = "icen-ai-msg-link";
|
|
5836
|
-
const href =
|
|
5931
|
+
const href = safeUrl(part.uri);
|
|
5837
5932
|
if (href) a.href = href;
|
|
5838
5933
|
a.textContent = part.name ?? part.uri;
|
|
5839
5934
|
a.title = part.uri;
|
|
@@ -5895,7 +5990,7 @@ function renderAiMessage(scrollEl, model) {
|
|
|
5895
5990
|
errEl.textContent = message;
|
|
5896
5991
|
},
|
|
5897
5992
|
stream() {
|
|
5898
|
-
const span = h("span", "ai-msg-stream-text");
|
|
5993
|
+
const span = h("span", "icen-ai-msg-text ai-msg-stream-text");
|
|
5899
5994
|
body.appendChild(span);
|
|
5900
5995
|
return createAiStream(span);
|
|
5901
5996
|
}
|
|
@@ -6035,8 +6130,12 @@ function buildApproval() {
|
|
|
6035
6130
|
}
|
|
6036
6131
|
function applyTint(item, model) {
|
|
6037
6132
|
const tint = getAiKind(model.kind).tint;
|
|
6038
|
-
if (tint)
|
|
6039
|
-
|
|
6133
|
+
if (tint) {
|
|
6134
|
+
const slot = tint === "muted" ? "text-muted" : tint;
|
|
6135
|
+
item.style.setProperty("--ai-item-tint", `var(--icen-token-${slot})`);
|
|
6136
|
+
} else {
|
|
6137
|
+
item.style.removeProperty("--ai-item-tint");
|
|
6138
|
+
}
|
|
6040
6139
|
}
|
|
6041
6140
|
function applyKindVisual(parts, model) {
|
|
6042
6141
|
const kind = getAiKind(model.kind);
|