@apform-ui/core 1.8.0 → 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 (35) hide show
  1. package/README.md +7 -0
  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 +3969 -3538
  6. package/dist/apform-ui.umd.cjs +52 -52
  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/NodeArtifactStrip/NodeArtifactStrip.vue.d.ts +13 -0
  20. package/dist/components/NodeArtifactStrip/doc.d.ts +3 -0
  21. package/dist/components/NodeArtifactStrip/index.d.ts +1 -0
  22. package/dist/components/TextPreviewCard/TextPreviewCard.vue.d.ts +11 -0
  23. package/dist/components/TextPreviewCard/doc.d.ts +3 -0
  24. package/dist/components/TextPreviewCard/index.d.ts +1 -0
  25. package/dist/components/VideoPreviewCard/VideoPreviewCard.vue.d.ts +11 -0
  26. package/dist/components/VideoPreviewCard/doc.d.ts +3 -0
  27. package/dist/components/VideoPreviewCard/index.d.ts +1 -0
  28. package/dist/composables/useRealtime.d.ts +4 -2
  29. package/dist/docs/index.d.ts +7 -0
  30. package/dist/index.d.ts +9 -1
  31. package/dist/types/artifact.d.ts +25 -0
  32. package/dist/types/index.d.ts +1 -0
  33. package/dist/utils/normalizeArtifact.d.ts +35 -0
  34. package/package.json +1 -1
  35. package/src/docs/index.ts +21 -0
@@ -0,0 +1,16 @@
1
+ import { ArtifactItem, ArtifactGallerySize } from '../../types/artifact';
2
+ type __VLS_Props = {
3
+ items: ArtifactItem[];
4
+ size?: ArtifactGallerySize;
5
+ /** 最多展示条数 */
6
+ max?: number;
7
+ };
8
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
9
+ preview: (item: ArtifactItem) => any;
10
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
11
+ onPreview?: ((item: ArtifactItem) => any) | undefined;
12
+ }>, {
13
+ size: ArtifactGallerySize;
14
+ max: number;
15
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
16
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { ComponentDoc } from '../../docs/types';
2
+ /** ArtifactGallery 文档 */
3
+ export declare const ArtifactGalleryDoc: ComponentDoc;
@@ -0,0 +1 @@
1
+ export { default as ArtifactGallery } from './ArtifactGallery.vue';
@@ -0,0 +1,10 @@
1
+ import { ArtifactItem } from '../../types/artifact';
2
+ type __VLS_Props = {
3
+ item: ArtifactItem;
4
+ };
5
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
6
+ preview: (item: ArtifactItem) => any;
7
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
8
+ onPreview?: ((item: ArtifactItem) => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
10
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { ComponentDoc } from '../../docs/types';
2
+ /** FileChip 文档 */
3
+ export declare const FileChipDoc: ComponentDoc;
@@ -0,0 +1 @@
1
+ export { default as FileChip } from './FileChip.vue';
@@ -0,0 +1,15 @@
1
+ import { ArtifactItem } from '../../types/artifact';
2
+ type __VLS_Props = {
3
+ items: ArtifactItem[];
4
+ title?: string;
5
+ max?: number;
6
+ };
7
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
8
+ preview: (item: ArtifactItem) => any;
9
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
10
+ onPreview?: ((item: ArtifactItem) => any) | undefined;
11
+ }>, {
12
+ title: string;
13
+ max: number;
14
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
15
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { ComponentDoc } from '../../docs/types';
2
+ /** HitlArtifactPanel 文档 */
3
+ export declare const HitlArtifactPanelDoc: ComponentDoc;
@@ -0,0 +1 @@
1
+ export { default as HitlArtifactPanel } from './HitlArtifactPanel.vue';
@@ -0,0 +1,14 @@
1
+ type __VLS_Props = {
2
+ /** 单图 */
3
+ url?: string;
4
+ /** 多图 */
5
+ urls?: string[];
6
+ /** compact 用于节点条 */
7
+ size?: 'compact' | 'default';
8
+ alt?: string;
9
+ };
10
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
+ size: "compact" | "default";
12
+ alt: string;
13
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { ComponentDoc } from '../../docs/types';
2
+ /** ImagePreviewCard 文档 */
3
+ export declare const ImagePreviewCardDoc: ComponentDoc;
@@ -0,0 +1 @@
1
+ export { default as ImagePreviewCard } from './ImagePreviewCard.vue';
@@ -0,0 +1,13 @@
1
+ import { ArtifactItem } from '../../types/artifact';
2
+ type __VLS_Props = {
3
+ items: ArtifactItem[];
4
+ max?: number;
5
+ };
6
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
7
+ preview: (item: ArtifactItem) => any;
8
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onPreview?: ((item: ArtifactItem) => any) | undefined;
10
+ }>, {
11
+ max: number;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { ComponentDoc } from '../../docs/types';
2
+ /** NodeArtifactStrip 文档 */
3
+ export declare const NodeArtifactStripDoc: ComponentDoc;
@@ -0,0 +1 @@
1
+ export { default as NodeArtifactStrip } from './NodeArtifactStrip.vue';
@@ -0,0 +1,11 @@
1
+ type __VLS_Props = {
2
+ text: string;
3
+ label?: string;
4
+ size?: 'compact' | 'default';
5
+ maxHeight?: string;
6
+ };
7
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
8
+ size: "compact" | "default";
9
+ maxHeight: string;
10
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { ComponentDoc } from '../../docs/types';
2
+ /** TextPreviewCard 文档 */
3
+ export declare const TextPreviewCardDoc: ComponentDoc;
@@ -0,0 +1 @@
1
+ export { default as TextPreviewCard } from './TextPreviewCard.vue';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * VideoPreviewCard — 视频预览播放器
3
+ */
4
+ type __VLS_Props = {
5
+ url: string;
6
+ size?: 'compact' | 'default';
7
+ };
8
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
9
+ size: "compact" | "default";
10
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { ComponentDoc } from '../../docs/types';
2
+ /** VideoPreviewCard 文档 */
3
+ export declare const VideoPreviewCardDoc: ComponentDoc;
@@ -0,0 +1 @@
1
+ export { default as VideoPreviewCard } from './VideoPreviewCard.vue';
@@ -1,4 +1,4 @@
1
- import { Ref } from 'vue';
1
+ import { MaybeRefOrGetter, Ref } from 'vue';
2
2
  /** 实时事件类型 */
3
3
  export type RealtimeEventType = 'event:new' | 'alert:triggered' | 'alert:resolved' | 'health:change';
4
4
  /** 实时消息 */
@@ -12,8 +12,10 @@ export interface RealtimeMessage {
12
12
  export interface UseRealtimeOptions {
13
13
  /** WebSocket 地址 */
14
14
  url: string;
15
+ /** 订阅鉴权 token;函数形式可在重连时重新读取 */
16
+ token?: string | (() => string | undefined);
15
17
  /** 订阅项目,空则全部 */
16
- projectId?: number;
18
+ projectId?: MaybeRefOrGetter<number | null | undefined>;
17
19
  /** 初始重连间隔 ms */
18
20
  reconnectInterval?: number;
19
21
  /** 最大重试次数 */
@@ -59,5 +59,12 @@ export { ServiceGridDoc } from '../components/ServiceGrid/doc';
59
59
  export { StatusTimelineDoc } from '../components/StatusTimeline/doc';
60
60
  export { LogStreamDoc } from '../components/LogStream/doc';
61
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';
62
69
  /** 按组件名索引的文档表 */
63
70
  export declare const componentDocs: Record<string, ComponentDoc>;
package/dist/index.d.ts CHANGED
@@ -64,6 +64,13 @@ export { DocumentPreviewPanel, DocumentPreviewDrawer, } from './components/Docum
64
64
  export { PdfPreviewCard } from './components/PdfPreviewCard';
65
65
  export { ExcelPreviewCard } from './components/ExcelPreviewCard';
66
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';
67
74
  export { MessageBubble } from './components/Chat/MessageBubble';
68
75
  export { MessageList } from './components/Chat/MessageList';
69
76
  export { Composer } from './components/Chat/Composer';
@@ -101,7 +108,8 @@ export type { ApiError } from './utils';
101
108
  export { renderMarkdown, splitTextAndCodeBlocks } from './utils/textParser';
102
109
  export type { TextPart } from './utils/textParser';
103
110
  export { isImage, isPdf, isOffice, isPreviewable, fileKind, formatSize } from './utils/attachmentKind';
111
+ export { extractDocumentId, detectArtifactKind, normalizeNodeOutput, normalizeAttachments, tryParseJsonText, } from './utils/normalizeArtifact';
104
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';
105
- export declare const SCHEMA_UI_VERSION = "1.8.0";
113
+ export declare const SCHEMA_UI_VERSION = "1.9.0";
106
114
  export declare const EP_FORK_BASE = "2.14.2";
107
115
  export declare const EP_FORK_DATE = "2026-08-27";
@@ -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,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[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apform-ui/core",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "type": "module",
5
5
  "author": "yangdongnan",
6
6
  "license": "MIT",
package/src/docs/index.ts CHANGED
@@ -59,6 +59,13 @@ export { ServiceGridDoc } from '../components/ServiceGrid/doc'
59
59
  export { StatusTimelineDoc } from '../components/StatusTimeline/doc'
60
60
  export { LogStreamDoc } from '../components/LogStream/doc'
61
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'
62
69
 
63
70
  import type { ComponentDoc } from './types'
64
71
  import { AppDialogDoc } from '../components/AppDialog/doc'
@@ -116,6 +123,13 @@ import { ServiceGridDoc } from '../components/ServiceGrid/doc'
116
123
  import { StatusTimelineDoc } from '../components/StatusTimeline/doc'
117
124
  import { LogStreamDoc } from '../components/LogStream/doc'
118
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'
119
133
 
120
134
  /** 按组件名索引的文档表 */
121
135
  export const componentDocs: Record<string, ComponentDoc> = {
@@ -174,4 +188,11 @@ export const componentDocs: Record<string, ComponentDoc> = {
174
188
  Toast: ToastDoc,
175
189
  TruncatedTooltipText: TruncatedTooltipTextDoc,
176
190
  UserAvatar: UserAvatarDoc,
191
+ ImagePreviewCard: ImagePreviewCardDoc,
192
+ VideoPreviewCard: VideoPreviewCardDoc,
193
+ TextPreviewCard: TextPreviewCardDoc,
194
+ FileChip: FileChipDoc,
195
+ ArtifactGallery: ArtifactGalleryDoc,
196
+ NodeArtifactStrip: NodeArtifactStripDoc,
197
+ HitlArtifactPanel: HitlArtifactPanelDoc,
177
198
  }