one-design-next 0.0.75 → 0.0.76

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.
@@ -1,5 +1,4 @@
1
1
  import type { IconName } from '../icon';
2
- import type { ArtifactFileIconType } from './icons';
3
2
  /** 点击产物时的预期行为类型。 */
4
3
  export type ArtifactActionKind = 'preview' | 'download';
5
4
  export interface ArtifactAction {
@@ -9,9 +8,5 @@ export interface ArtifactAction {
9
8
  /** hover 时展示的操作 Icon */
10
9
  icon: IconName;
11
10
  }
12
- /**
13
- * 按文件类型给出点击预期:
14
- * - html / md / csv / file → 预览(arrow-right)
15
- * - pdf / xlsx / docx / pptx → 下载(arrow-down-to-line)
16
- */
17
- export declare function getArtifactAction(fileType: ArtifactFileIconType): ArtifactAction;
11
+ /** 根据 actionKind 返回对应的 ArtifactAction(label + icon)。 */
12
+ export declare function getArtifactActionFromKind(kind: ArtifactActionKind): ArtifactAction;
@@ -1,25 +1,15 @@
1
1
  /** 点击产物时的预期行为类型。 */
2
2
 
3
- /**
4
- * 按文件类型给出点击预期:
5
- * - html / md / csv / file → 预览(arrow-right)
6
- * - pdf / xlsx / docx / pptx → 下载(arrow-down-to-line)
7
- */
8
- export function getArtifactAction(fileType) {
9
- switch (fileType) {
10
- case 'html':
11
- case 'md':
12
- case 'csv':
13
- case 'file':
3
+ /** 根据 actionKind 返回对应的 ArtifactAction(label + icon)。 */
4
+ export function getArtifactActionFromKind(kind) {
5
+ switch (kind) {
6
+ case 'preview':
14
7
  return {
15
8
  kind: 'preview',
16
9
  label: '预览详情',
17
10
  icon: 'arrow-right'
18
11
  };
19
- case 'pdf':
20
- case 'xlsx':
21
- case 'docx':
22
- case 'pptx':
12
+ case 'download':
23
13
  return {
24
14
  kind: 'download',
25
15
  label: '下载导出',
@@ -1,7 +1,8 @@
1
1
  import { type CSSProperties } from 'react';
2
+ import { type ArtifactActionKind } from './actions';
2
3
  import { type ArtifactFileIconType } from './icons';
3
4
  import './style';
4
- export { getArtifactAction, type ArtifactAction, type ArtifactActionKind, } from './actions';
5
+ export { getArtifactActionFromKind, type ArtifactAction, type ArtifactActionKind, } from './actions';
5
6
  export { ARTIFACT_FILE_GLOW_COLORS, getArtifactGlowColor } from './glow';
6
7
  export { ARTIFACT_DEDICATED_FILE_ICON_TYPES, ARTIFACT_FILE_ICON_MEDIUM_SIZE, ARTIFACT_FILE_ICON_MEDIUM_VIEWBOX, ARTIFACT_FILE_ICON_SMALL_SIZE, ARTIFACT_FILE_ICON_SMALL_VIEWBOX, ARTIFACT_FILE_ICON_TYPES, ArtifactFileIcon, artifactFileIcons, artifactFileIconsMedium, artifactFileIconsSmall, getArtifactFileIconUrl, } from './icons';
7
8
  export type { ArtifactFileIconProps, ArtifactFileIconSize, ArtifactFileIconType, } from './icons';
@@ -14,6 +15,8 @@ export type ArtifactSize = 'medium' | 'small';
14
15
  export interface ArtifactProps {
15
16
  /** 文件名 / 产物标题 */
16
17
  title: string;
18
+ /** 点击产物时的行为:`'preview'` 预览 或 `'download'` 下载,由调用方决定。 */
19
+ actionKind: ArtifactActionKind;
17
20
  /**
18
21
  * 文件类型图标。
19
22
  * 不传时从 `title` 扩展名推断;无专属 Icon 时回退 `file`(浅灰通用 File Icon)。
@@ -39,7 +42,7 @@ export interface ArtifactProps {
39
42
  * - medium / Card:左 Icon + 右标题 / 大小·日期;可点 hover 时 Icon 后退缩小、文案左移遮罩,右侧浮出操作预期
40
43
  * - small / Small:无底色/描边;hover 用 HoverFill 叠灰底(不展示预览/下载操作预期)
41
44
  */
42
- export declare function Artifact({ title, fileType, fileSize, date, size, status, onOpen, className, style, }: ArtifactProps): import("react").JSX.Element;
45
+ export declare function Artifact({ title, actionKind, fileType, fileSize, date, size, status, onOpen, className, style, }: ArtifactProps): import("react").JSX.Element;
43
46
  export declare namespace Artifact {
44
47
  var displayName: string;
45
48
  }
@@ -6,11 +6,11 @@ import { useCallback, useRef, useState } from 'react';
6
6
  import HoverFill from "../hover-fill";
7
7
  import Icon from "../icon";
8
8
  import Tooltip from "../tooltip";
9
- import { getArtifactAction } from "./actions";
9
+ import { getArtifactActionFromKind } from "./actions";
10
10
  import { getArtifactGlowColor } from "./glow";
11
11
  import { ARTIFACT_DEDICATED_FILE_ICON_TYPES, ArtifactFileIcon } from "./icons";
12
12
  import "./style";
13
- export { getArtifactAction } from "./actions";
13
+ export { getArtifactActionFromKind } from "./actions";
14
14
  export { ARTIFACT_FILE_GLOW_COLORS, getArtifactGlowColor } from "./glow";
15
15
  export { ARTIFACT_DEDICATED_FILE_ICON_TYPES, ARTIFACT_FILE_ICON_MEDIUM_SIZE, ARTIFACT_FILE_ICON_MEDIUM_VIEWBOX, ARTIFACT_FILE_ICON_SMALL_SIZE, ARTIFACT_FILE_ICON_SMALL_VIEWBOX, ARTIFACT_FILE_ICON_TYPES, ArtifactFileIcon, artifactFileIcons, artifactFileIconsMedium, artifactFileIconsSmall, getArtifactFileIconUrl } from "./icons";
16
16
 
@@ -77,6 +77,7 @@ function ArtifactActionCue(_ref) {
77
77
  */
78
78
  export function Artifact(_ref2) {
79
79
  var title = _ref2.title,
80
+ actionKind = _ref2.actionKind,
80
81
  fileType = _ref2.fileType,
81
82
  fileSize = _ref2.fileSize,
82
83
  date = _ref2.date,
@@ -91,7 +92,7 @@ export function Artifact(_ref2) {
91
92
  var isInteractive = !!onOpen && !isGenerating;
92
93
  var resolvedType = fileType !== null && fileType !== void 0 ? fileType : inferFileType(title);
93
94
  var iconSize = size;
94
- var action = getArtifactAction(resolvedType);
95
+ var action = getArtifactActionFromKind(actionKind);
95
96
  var _splitTitleParts = splitTitleParts(title),
96
97
  titleHead = _splitTitleParts.head,
97
98
  titleTail = _splitTitleParts.tail,
package/dist/index.d.ts CHANGED
@@ -55,7 +55,7 @@ export { default as ActionBar, type ActionBarProps } from './action-bar';
55
55
  export { default as AgentStep, type AgentStepGroupProps, type AgentStepProps, } from './agent-step';
56
56
  export { default as AgentThink, type AgentThinkProps } from './agent-think';
57
57
  export { APPROVAL_DEFAULT_ACTIONS_HINT, default as Approval, type ApprovalDecision, type ApprovalProps, type ApprovalResolvePayload, type ApprovalSpec, type ApprovalSummaryItem, } from './approval';
58
- export { ARTIFACT_DEDICATED_FILE_ICON_TYPES, ARTIFACT_FILE_GLOW_COLORS, ARTIFACT_FILE_ICON_TYPES, default as Artifact, ArtifactFileIcon, getArtifactAction, getArtifactGlowColor, type ArtifactAction, type ArtifactActionKind, type ArtifactFileIconProps, type ArtifactFileIconSize, type ArtifactFileIconType, type ArtifactProps, type ArtifactSize, } from './artifact';
58
+ export { ARTIFACT_DEDICATED_FILE_ICON_TYPES, ARTIFACT_FILE_GLOW_COLORS, ARTIFACT_FILE_ICON_TYPES, default as Artifact, ArtifactFileIcon, getArtifactActionFromKind, getArtifactGlowColor, type ArtifactAction, type ArtifactActionKind, type ArtifactFileIconProps, type ArtifactFileIconSize, type ArtifactFileIconType, type ArtifactProps, type ArtifactSize, } from './artifact';
59
59
  export { default as Attachments, type AttachmentsProps } from './attachments';
60
60
  export { default as ChatItem, formatRelativeTime, type ChatItemProps, } from './chat-item';
61
61
  export { default as ChatList, matchChatListFilterTime, matchChatListFilterType, type ChatListFilterTime, type ChatListFilterType, type ChatListItem, type ChatListProps, } from './chat-list';
package/dist/index.js CHANGED
@@ -61,7 +61,7 @@ export { default as ActionBar } from "./action-bar";
61
61
  export { default as AgentStep } from "./agent-step";
62
62
  export { default as AgentThink } from "./agent-think";
63
63
  export { APPROVAL_DEFAULT_ACTIONS_HINT, default as Approval } from "./approval";
64
- export { ARTIFACT_DEDICATED_FILE_ICON_TYPES, ARTIFACT_FILE_GLOW_COLORS, ARTIFACT_FILE_ICON_TYPES, default as Artifact, ArtifactFileIcon, getArtifactAction, getArtifactGlowColor } from "./artifact";
64
+ export { ARTIFACT_DEDICATED_FILE_ICON_TYPES, ARTIFACT_FILE_GLOW_COLORS, ARTIFACT_FILE_ICON_TYPES, default as Artifact, ArtifactFileIcon, getArtifactActionFromKind, getArtifactGlowColor } from "./artifact";
65
65
  export { default as Attachments } from "./attachments";
66
66
  export { default as ChatItem, formatRelativeTime } from "./chat-item";
67
67
  export { default as ChatList, matchChatListFilterTime, matchChatListFilterType } from "./chat-list";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "one-design-next",
3
- "version": "0.0.75",
3
+ "version": "0.0.76",
4
4
  "description": "One Design Next from TAD@tencent.com",
5
5
  "license": "MIT",
6
6
  "type": "module",