@apform-ui/core 1.7.4 → 1.9.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.
Files changed (66) hide show
  1. package/README.md +43 -5
  2. package/dist/__tests__/artifactGallery.spec.d.ts +1 -0
  3. package/dist/__tests__/normalizeArtifact.spec.d.ts +1 -0
  4. package/dist/apform-ui.css +1 -1
  5. package/dist/apform-ui.js +5237 -3723
  6. package/dist/apform-ui.umd.cjs +138 -64
  7. package/dist/components/ArtifactGallery/ArtifactGallery.vue.d.ts +16 -0
  8. package/dist/components/ArtifactGallery/doc.d.ts +3 -0
  9. package/dist/components/ArtifactGallery/index.d.ts +1 -0
  10. package/dist/components/FileChip/FileChip.vue.d.ts +10 -0
  11. package/dist/components/FileChip/doc.d.ts +3 -0
  12. package/dist/components/FileChip/index.d.ts +1 -0
  13. package/dist/components/HitlArtifactPanel/HitlArtifactPanel.vue.d.ts +15 -0
  14. package/dist/components/HitlArtifactPanel/doc.d.ts +3 -0
  15. package/dist/components/HitlArtifactPanel/index.d.ts +1 -0
  16. package/dist/components/ImagePreviewCard/ImagePreviewCard.vue.d.ts +14 -0
  17. package/dist/components/ImagePreviewCard/doc.d.ts +3 -0
  18. package/dist/components/ImagePreviewCard/index.d.ts +1 -0
  19. package/dist/components/LogStream/LogStream.vue.d.ts +37 -0
  20. package/dist/components/LogStream/doc.d.ts +3 -0
  21. package/dist/components/LogStream/index.d.ts +2 -0
  22. package/dist/components/MetricChart/MetricChart.vue.d.ts +49 -0
  23. package/dist/components/MetricChart/doc.d.ts +3 -0
  24. package/dist/components/MetricChart/index.d.ts +2 -0
  25. package/dist/components/NodeArtifactStrip/NodeArtifactStrip.vue.d.ts +13 -0
  26. package/dist/components/NodeArtifactStrip/doc.d.ts +3 -0
  27. package/dist/components/NodeArtifactStrip/index.d.ts +1 -0
  28. package/dist/components/ServiceGrid/ServiceGrid.vue.d.ts +28 -0
  29. package/dist/components/ServiceGrid/doc.d.ts +3 -0
  30. package/dist/components/ServiceGrid/index.d.ts +2 -0
  31. package/dist/components/SeverityBadge/SeverityBadge.vue.d.ts +14 -0
  32. package/dist/components/SeverityBadge/doc.d.ts +3 -0
  33. package/dist/components/SeverityBadge/index.d.ts +2 -0
  34. package/dist/components/StatCard/StatCard.vue.d.ts +33 -0
  35. package/dist/components/StatCard/doc.d.ts +3 -0
  36. package/dist/components/StatCard/index.d.ts +2 -0
  37. package/dist/components/StatusTimeline/StatusTimeline.vue.d.ts +24 -0
  38. package/dist/components/StatusTimeline/doc.d.ts +3 -0
  39. package/dist/components/StatusTimeline/index.d.ts +2 -0
  40. package/dist/components/TextPreviewCard/TextPreviewCard.vue.d.ts +11 -0
  41. package/dist/components/TextPreviewCard/doc.d.ts +3 -0
  42. package/dist/components/TextPreviewCard/index.d.ts +1 -0
  43. package/dist/components/ThresholdSlider/ThresholdSlider.vue.d.ts +23 -0
  44. package/dist/components/ThresholdSlider/doc.d.ts +3 -0
  45. package/dist/components/ThresholdSlider/index.d.ts +2 -0
  46. package/dist/components/TimeRangePicker/TimeRangePicker.vue.d.ts +36 -0
  47. package/dist/components/TimeRangePicker/doc.d.ts +3 -0
  48. package/dist/components/TimeRangePicker/index.d.ts +2 -0
  49. package/dist/components/VideoPreviewCard/VideoPreviewCard.vue.d.ts +11 -0
  50. package/dist/components/VideoPreviewCard/doc.d.ts +3 -0
  51. package/dist/components/VideoPreviewCard/index.d.ts +1 -0
  52. package/dist/composables/index.d.ts +2 -0
  53. package/dist/composables/useRealtime.d.ts +34 -0
  54. package/dist/docs/index.d.ts +15 -0
  55. package/dist/index-v6HiJkED.js +44296 -0
  56. package/dist/index.d.ts +28 -2
  57. package/dist/tokens/index.d.ts +16 -0
  58. package/dist/types/artifact.d.ts +25 -0
  59. package/dist/types/index.d.ts +1 -0
  60. package/dist/utils/metricFormat.d.ts +21 -0
  61. package/dist/utils/normalizeArtifact.d.ts +35 -0
  62. package/dist/utils/optionalPeers.d.ts +16 -0
  63. package/package.json +6 -1
  64. package/src/docs/index.ts +45 -0
  65. package/src/tokens/index.ts +26 -0
  66. package/src/tokens/tokens.css +393 -193
package/dist/index.d.ts CHANGED
@@ -24,6 +24,22 @@ export { AppUserPanel } from './components/AppUserPanel';
24
24
  export type { AppUserPanelUser } from './components/AppUserPanel';
25
25
  export { SliderCaptcha } from './components/SliderCaptcha';
26
26
  export type { CaptchaPayload, SliderCaptchaValue } from './components/SliderCaptcha';
27
+ export { TimeRangePicker } from './components/TimeRangePicker';
28
+ export type { TimeRange, TimeRangePreset } from './components/TimeRangePicker';
29
+ export { MetricChart } from './components/MetricChart';
30
+ export type { MetricSeries, MetricThreshold, MetricUnit } from './components/MetricChart';
31
+ export { StatCard } from './components/StatCard';
32
+ export type { StatTrend } from './components/StatCard';
33
+ export { SeverityBadge } from './components/SeverityBadge';
34
+ export type { AlertSeverity } from './components/SeverityBadge';
35
+ export { ServiceGrid } from './components/ServiceGrid';
36
+ export type { ServiceItem } from './components/ServiceGrid';
37
+ export { StatusTimeline } from './components/StatusTimeline';
38
+ export type { TimelineSegment } from './components/StatusTimeline';
39
+ export { LogStream } from './components/LogStream';
40
+ export type { LogEntry } from './components/LogStream';
41
+ export { ThresholdSlider } from './components/ThresholdSlider';
42
+ export type { ThresholdType } from './components/ThresholdSlider';
27
43
  export { PageShell } from './components/PageShell';
28
44
  export { PageHeader } from './components/PageHeader';
29
45
  export { BreadcrumbNav } from './components/BreadcrumbNav';
@@ -48,6 +64,13 @@ export { DocumentPreviewPanel, DocumentPreviewDrawer, } from './components/Docum
48
64
  export { PdfPreviewCard } from './components/PdfPreviewCard';
49
65
  export { ExcelPreviewCard } from './components/ExcelPreviewCard';
50
66
  export type { DocumentPreviewChunk, DocumentPreviewPanelProps, } from './components/DocumentPreview';
67
+ export { ImagePreviewCard } from './components/ImagePreviewCard';
68
+ export { VideoPreviewCard } from './components/VideoPreviewCard';
69
+ export { TextPreviewCard } from './components/TextPreviewCard';
70
+ export { FileChip } from './components/FileChip';
71
+ export { ArtifactGallery } from './components/ArtifactGallery';
72
+ export { NodeArtifactStrip } from './components/NodeArtifactStrip';
73
+ export { HitlArtifactPanel } from './components/HitlArtifactPanel';
51
74
  export { MessageBubble } from './components/Chat/MessageBubble';
52
75
  export { MessageList } from './components/Chat/MessageList';
53
76
  export { Composer } from './components/Chat/Composer';
@@ -74,6 +97,8 @@ export { useChatScroll } from './composables';
74
97
  export type { UseChatScrollOptions, UseChatScrollReturn } from './composables';
75
98
  export { useClipboard } from './composables';
76
99
  export type { UseClipboardOptions } from './composables';
100
+ export { useRealtime } from './composables';
101
+ export type { RealtimeEventType, RealtimeMessage, UseRealtimeOptions, UseRealtimeReturn, } from './composables';
77
102
  export { ICON_MAP, APP_ICON_NAMES, isRegisteredAppIcon } from './utils';
78
103
  export type { AppIconName } from './utils';
79
104
  export { DEFAULT_PAGE_SIZE, PAGE_SIZE_OPTIONS, PAGINATION_LAYOUT } from './utils';
@@ -83,7 +108,8 @@ export type { ApiError } from './utils';
83
108
  export { renderMarkdown, splitTextAndCodeBlocks } from './utils/textParser';
84
109
  export type { TextPart } from './utils/textParser';
85
110
  export { isImage, isPdf, isOffice, isPreviewable, fileKind, formatSize } from './utils/attachmentKind';
86
- export { COLORS, TEXT_COLORS, SPACING, BORDER_RADIUS, SHADOWS, DURATION, Z_INDEX, FONT_SIZE, CONTROL_HEIGHT, LAYOUT_HEIGHT, ICON_SIZE, PAGE, FORM, AVATAR_SIZE, } from './tokens';
87
- export declare const SCHEMA_UI_VERSION = "1.7.0";
111
+ export { extractDocumentId, detectArtifactKind, normalizeNodeOutput, normalizeAttachments, tryParseJsonText, } from './utils/normalizeArtifact';
112
+ export { COLORS, CHART_COLORS, TEXT_COLORS, SPACING, BORDER_RADIUS, SHADOWS, DURATION, Z_INDEX, FONT_SIZE, CONTROL_HEIGHT, LAYOUT_HEIGHT, ICON_SIZE, PAGE, FORM, AVATAR_SIZE, } from './tokens';
113
+ export declare const SCHEMA_UI_VERSION = "1.9.0";
88
114
  export declare const EP_FORK_BASE = "2.14.2";
89
115
  export declare const EP_FORK_DATE = "2026-08-27";
@@ -16,6 +16,22 @@ export declare const COLORS: {
16
16
  readonly danger: "#E50113";
17
17
  readonly info: "#4581E9";
18
18
  };
19
+ /**
20
+ * 图表色板 — 基于 COLORS 派生,监控系统专用
21
+ * ECharts 无法读取 CSS 变量,故导出 hex 常量
22
+ */
23
+ export declare const CHART_COLORS: {
24
+ readonly primary: "#0060A2";
25
+ readonly success: "#26A036";
26
+ readonly warning: "#F09700";
27
+ readonly danger: "#E50113";
28
+ readonly info: "#4581E9";
29
+ readonly series: readonly ["#0060A2", "#26A036", "#F09700", "#E50113", "#8B5CF6", "#EC4899", "#14B8A6", "#F97316"];
30
+ readonly axisLine: "#D5DDE3";
31
+ readonly splitLine: "#EBEDF3";
32
+ readonly tooltipBg: "#FFFFFF";
33
+ readonly tooltipText: "#303133";
34
+ };
19
35
  /** 文字色 */
20
36
  export declare const TEXT_COLORS: {
21
37
  readonly title: "#303133";
@@ -0,0 +1,25 @@
1
+ /**
2
+ * 统一产物展示模型(Chat / 工作流执行共用)
3
+ * 不含 audio / 3D / PPT(本迭代明确不做)
4
+ */
5
+ /** 产物类型 */
6
+ export type ArtifactKind = 'text' | 'image' | 'video' | 'pdf' | 'office' | 'file' | 'json';
7
+ /** 可预览产物项 */
8
+ export interface ArtifactItem {
9
+ /** 稳定 ID */
10
+ id: string;
11
+ kind: ArtifactKind;
12
+ /** 可请求 URL(图/视频/文件) */
13
+ url?: string;
14
+ /** 平台文档 ID(走 preview API / 抽屉) */
15
+ documentId?: string;
16
+ /** 纯文本或 JSON 字符串 */
17
+ text?: string;
18
+ filename?: string;
19
+ mimetype?: string;
20
+ label?: string;
21
+ /** 字段来源:imageUrls / videoUrl / documentIds … */
22
+ source?: string;
23
+ }
24
+ /** Gallery 尺寸 */
25
+ export type ArtifactGallerySize = 'compact' | 'default';
@@ -1 +1,2 @@
1
1
  export * from './chat';
2
+ export * from './artifact';
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 监控指标数值格式化
3
+ */
4
+ /** 指标单位 */
5
+ export type MetricUnit = 'count' | 'ms' | 'percent' | 'currency' | 'tokens' | 'bytes';
6
+ /**
7
+ * 按单位格式化数值
8
+ * @param value - 原始数值
9
+ * @param unit - 单位类型
10
+ */
11
+ export declare function formatMetricValue(value: number, unit: MetricUnit): string;
12
+ /**
13
+ * 相对时间文案(用于 lastSeen 等)
14
+ * @param iso - ISO 8601 时间
15
+ */
16
+ export declare function formatRelativeTime(iso: string): string;
17
+ /**
18
+ * 时长文案
19
+ * @param ms - 毫秒
20
+ */
21
+ export declare function formatDuration(ms: number): string;
@@ -0,0 +1,35 @@
1
+ import { ArtifactItem, ArtifactKind } from '../types/artifact';
2
+ import { MessageAttachment } from '../types/chat';
3
+ /**
4
+ * 从 URL 提取平台 documentId
5
+ * @param url 原始 URL
6
+ */
7
+ export declare function extractDocumentId(url: string): string | undefined;
8
+ /**
9
+ * 按 URL / 文件名 / mimetype 推断 kind
10
+ */
11
+ export declare function detectArtifactKind(opts: {
12
+ url?: string;
13
+ filename?: string;
14
+ mimetype?: string;
15
+ hint?: string;
16
+ }): ArtifactKind;
17
+ /**
18
+ * 尝试把字符串识别为 JSON 产物(剧本 / 分镜等)
19
+ * @param raw 原始文本
20
+ */
21
+ export declare function tryParseJsonText(raw: string): {
22
+ kind: 'json';
23
+ text: string;
24
+ } | null;
25
+ /**
26
+ * 从工作流节点 output 抽取产物
27
+ * @param payload 节点 output
28
+ * @param idPrefix ID 前缀
29
+ */
30
+ export declare function normalizeNodeOutput(payload: unknown, idPrefix?: string): ArtifactItem[];
31
+ /**
32
+ * 从 Chat 附件列表归一
33
+ * @param attachments 消息附件
34
+ */
35
+ export declare function normalizeAttachments(attachments: MessageAttachment[]): ArtifactItem[];
@@ -36,3 +36,19 @@ export declare function tryLoadPdfjs(): Promise<PdfjsModule | null>;
36
36
  * 尝试加载 xlsx
37
37
  */
38
38
  export declare function tryLoadXlsx(): Promise<XlsxModule | null>;
39
+ /** 宽松 echarts 模块(init + 实例方法) */
40
+ export type EchartsModule = {
41
+ init: (el: HTMLElement, theme?: string | object | null, opts?: object) => EchartsInstance;
42
+ };
43
+ /** ECharts 实例最小接口 */
44
+ export type EchartsInstance = {
45
+ setOption: (option: object, opts?: object) => void;
46
+ resize: () => void;
47
+ dispose: () => void;
48
+ on: (event: string, handler: (params: unknown) => void) => void;
49
+ off: (event: string, handler?: (params: unknown) => void) => void;
50
+ };
51
+ /**
52
+ * 尝试加载 echarts
53
+ */
54
+ export declare function tryLoadEcharts(): Promise<EchartsModule | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apform-ui/core",
3
- "version": "1.7.4",
3
+ "version": "1.9.0",
4
4
  "type": "module",
5
5
  "author": "yangdongnan",
6
6
  "license": "MIT",
@@ -61,12 +61,16 @@
61
61
  "prepublishOnly": "pnpm run build"
62
62
  },
63
63
  "peerDependencies": {
64
+ "echarts": ">=5.0.0",
64
65
  "element-plus": "2.14.2",
65
66
  "pdfjs-dist": ">=4.0.0",
66
67
  "vue": "^3.5.0",
67
68
  "xlsx": ">=0.18.0"
68
69
  },
69
70
  "peerDependenciesMeta": {
71
+ "echarts": {
72
+ "optional": true
73
+ },
70
74
  "pdfjs-dist": {
71
75
  "optional": true
72
76
  },
@@ -85,6 +89,7 @@
85
89
  "@types/node": "^26.0.1",
86
90
  "@vitejs/plugin-vue": "^5.2.3",
87
91
  "@vue/test-utils": "^2.4.6",
92
+ "echarts": "^5.6.0",
88
93
  "element-plus": "2.14.2",
89
94
  "jsdom": "^26.0.0",
90
95
  "sass-embedded": "^1.100.0",
package/src/docs/index.ts CHANGED
@@ -51,6 +51,21 @@ export { TableRowActionsDoc } from '../components/TableRowActions/doc'
51
51
  export { ToastDoc } from '../components/Toast/doc'
52
52
  export { TruncatedTooltipTextDoc } from '../components/TruncatedTooltipText/doc'
53
53
  export { UserAvatarDoc } from '../components/UserAvatar/doc'
54
+ export { TimeRangePickerDoc } from '../components/TimeRangePicker/doc'
55
+ export { MetricChartDoc } from '../components/MetricChart/doc'
56
+ export { StatCardDoc } from '../components/StatCard/doc'
57
+ export { SeverityBadgeDoc } from '../components/SeverityBadge/doc'
58
+ export { ServiceGridDoc } from '../components/ServiceGrid/doc'
59
+ export { StatusTimelineDoc } from '../components/StatusTimeline/doc'
60
+ export { LogStreamDoc } from '../components/LogStream/doc'
61
+ export { ThresholdSliderDoc } from '../components/ThresholdSlider/doc'
62
+ export { ImagePreviewCardDoc } from '../components/ImagePreviewCard/doc'
63
+ export { VideoPreviewCardDoc } from '../components/VideoPreviewCard/doc'
64
+ export { TextPreviewCardDoc } from '../components/TextPreviewCard/doc'
65
+ export { FileChipDoc } from '../components/FileChip/doc'
66
+ export { ArtifactGalleryDoc } from '../components/ArtifactGallery/doc'
67
+ export { NodeArtifactStripDoc } from '../components/NodeArtifactStrip/doc'
68
+ export { HitlArtifactPanelDoc } from '../components/HitlArtifactPanel/doc'
54
69
 
55
70
  import type { ComponentDoc } from './types'
56
71
  import { AppDialogDoc } from '../components/AppDialog/doc'
@@ -100,6 +115,21 @@ import { TableRowActionsDoc } from '../components/TableRowActions/doc'
100
115
  import { ToastDoc } from '../components/Toast/doc'
101
116
  import { TruncatedTooltipTextDoc } from '../components/TruncatedTooltipText/doc'
102
117
  import { UserAvatarDoc } from '../components/UserAvatar/doc'
118
+ import { TimeRangePickerDoc } from '../components/TimeRangePicker/doc'
119
+ import { MetricChartDoc } from '../components/MetricChart/doc'
120
+ import { StatCardDoc } from '../components/StatCard/doc'
121
+ import { SeverityBadgeDoc } from '../components/SeverityBadge/doc'
122
+ import { ServiceGridDoc } from '../components/ServiceGrid/doc'
123
+ import { StatusTimelineDoc } from '../components/StatusTimeline/doc'
124
+ import { LogStreamDoc } from '../components/LogStream/doc'
125
+ import { ThresholdSliderDoc } from '../components/ThresholdSlider/doc'
126
+ import { ImagePreviewCardDoc } from '../components/ImagePreviewCard/doc'
127
+ import { VideoPreviewCardDoc } from '../components/VideoPreviewCard/doc'
128
+ import { TextPreviewCardDoc } from '../components/TextPreviewCard/doc'
129
+ import { FileChipDoc } from '../components/FileChip/doc'
130
+ import { ArtifactGalleryDoc } from '../components/ArtifactGallery/doc'
131
+ import { NodeArtifactStripDoc } from '../components/NodeArtifactStrip/doc'
132
+ import { HitlArtifactPanelDoc } from '../components/HitlArtifactPanel/doc'
103
133
 
104
134
  /** 按组件名索引的文档表 */
105
135
  export const componentDocs: Record<string, ComponentDoc> = {
@@ -138,16 +168,31 @@ export const componentDocs: Record<string, ComponentDoc> = {
138
168
  JsonCard: JsonCardDoc,
139
169
  JsonDetailDialog: JsonDetailDialogDoc,
140
170
  LoadingDots: LoadingDotsDoc,
171
+ LogStream: LogStreamDoc,
172
+ MetricChart: MetricChartDoc,
141
173
  PageHeader: PageHeaderDoc,
142
174
  PageShell: PageShellDoc,
143
175
  PdfPreviewCard: PdfPreviewCardDoc,
144
176
  SchemaLitePreview: SchemaLitePreviewDoc,
145
177
  SearchForm: SearchFormDoc,
146
178
  SectionToggle: SectionToggleDoc,
179
+ ServiceGrid: ServiceGridDoc,
180
+ SeverityBadge: SeverityBadgeDoc,
147
181
  Skeleton: SkeletonDoc,
182
+ StatCard: StatCardDoc,
148
183
  StatusTag: StatusTagDoc,
184
+ StatusTimeline: StatusTimelineDoc,
149
185
  TableRowActions: TableRowActionsDoc,
186
+ ThresholdSlider: ThresholdSliderDoc,
187
+ TimeRangePicker: TimeRangePickerDoc,
150
188
  Toast: ToastDoc,
151
189
  TruncatedTooltipText: TruncatedTooltipTextDoc,
152
190
  UserAvatar: UserAvatarDoc,
191
+ ImagePreviewCard: ImagePreviewCardDoc,
192
+ VideoPreviewCard: VideoPreviewCardDoc,
193
+ TextPreviewCard: TextPreviewCardDoc,
194
+ FileChip: FileChipDoc,
195
+ ArtifactGallery: ArtifactGalleryDoc,
196
+ NodeArtifactStrip: NodeArtifactStripDoc,
197
+ HitlArtifactPanel: HitlArtifactPanelDoc,
153
198
  }
@@ -18,6 +18,32 @@ export const COLORS = {
18
18
  info: '#4581E9',
19
19
  } as const
20
20
 
21
+ /**
22
+ * 图表色板 — 基于 COLORS 派生,监控系统专用
23
+ * ECharts 无法读取 CSS 变量,故导出 hex 常量
24
+ */
25
+ export const CHART_COLORS = {
26
+ primary: COLORS.primary,
27
+ success: COLORS.success,
28
+ warning: COLORS.warning,
29
+ danger: COLORS.danger,
30
+ info: COLORS.info,
31
+ series: [
32
+ COLORS.primary,
33
+ COLORS.success,
34
+ COLORS.warning,
35
+ COLORS.danger,
36
+ '#8B5CF6',
37
+ '#EC4899',
38
+ '#14B8A6',
39
+ '#F97316',
40
+ ],
41
+ axisLine: '#D5DDE3',
42
+ splitLine: '#EBEDF3',
43
+ tooltipBg: '#FFFFFF',
44
+ tooltipText: '#303133',
45
+ } as const
46
+
21
47
  /** 文字色 */
22
48
  export const TEXT_COLORS = {
23
49
  title: '#303133',