@openviking/react 0.1.1 → 0.1.3
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.md +18 -15
- package/dist/1~0.js +506 -0
- package/dist/2~0.js +122 -0
- package/dist/30~0.js +1332 -0
- package/dist/3~0.js +2113 -4
- package/dist/ark-message-list-view~0.js +310 -0
- package/dist/c7~0.js +24 -0
- package/dist/client/index.d.ts +2 -1
- package/dist/client/paths.d.ts +64 -0
- package/dist/client/response.d.ts +31 -0
- package/dist/client/sse.d.ts +39 -0
- package/dist/client/stream.d.ts +26 -0
- package/dist/client/types.d.ts +104 -0
- package/dist/client.js +1 -239
- package/dist/components/agent-connect/agent-connect-copy.d.ts +34 -0
- package/dist/components/agent-connect/agent-connect-design.d.ts +1781 -0
- package/dist/components/agent-connect/agent-connect-detail.d.ts +13 -0
- package/dist/components/agent-connect/agent-connect-installer.d.ts +3 -0
- package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +14 -0
- package/dist/components/agent-connect/agent-connect-instructions.d.ts +145 -0
- package/dist/components/agent-connect/agent-connect-markdown.d.ts +3 -0
- package/dist/components/agent-connect/agent-connect.d.ts +3 -3
- package/dist/components/agent-connect/content-en.d.ts +137 -0
- package/dist/components/agent-connect/content-zh.d.ts +137 -0
- package/dist/components/agent-connect/style.css +495 -6
- package/dist/components/agent-connect/types.d.ts +20 -166
- package/dist/components/file-browser-entries/file-browser-entries-icons.d.ts +18 -0
- package/dist/components/file-browser-entries/file-browser-entries.d.ts +14 -0
- package/dist/components/file-browser-entries/index.d.ts +1 -0
- package/dist/components/file-browser-entries/style.css +155 -0
- package/dist/components/file-browser-entries/types.d.ts +45 -0
- package/dist/components/file-browser-entries.js +1 -0
- package/dist/components/file-preview/file-preview-adapters.d.ts +33 -0
- package/dist/components/file-preview/file-preview-body.d.ts +24 -12
- package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +16 -0
- package/dist/components/file-preview/file-preview-breadcrumb.d.ts +21 -0
- package/dist/components/file-preview/file-preview-copy-path.d.ts +12 -0
- package/dist/components/file-preview/file-preview-directory.d.ts +32 -0
- package/dist/components/file-preview/file-preview-editor.d.ts +22 -0
- package/dist/components/file-preview/file-preview-handle-adapters.d.ts +26 -0
- package/dist/components/file-preview/file-preview-header.d.ts +41 -14
- package/dist/components/file-preview/file-preview-labels.d.ts +15 -4
- package/dist/components/file-preview/file-preview-lazy-viewer.d.ts +3 -0
- package/dist/components/file-preview/file-preview-panels.d.ts +41 -0
- package/dist/components/file-preview/file-preview-path.d.ts +30 -0
- package/dist/components/file-preview/file-preview-source.d.ts +24 -0
- package/dist/components/file-preview/file-preview-state.d.ts +35 -0
- package/dist/components/file-preview/file-preview-tab-row.d.ts +16 -0
- package/dist/components/file-preview/file-preview-viewer.d.ts +31 -0
- package/dist/components/file-preview/file-preview.d.ts +9 -11
- package/dist/components/file-preview/level-selection.d.ts +25 -0
- package/dist/components/file-preview/style.css +4055 -126
- package/dist/components/file-preview/types.d.ts +350 -170
- package/dist/components/file-preview/use-directory-level.d.ts +30 -0
- package/dist/components/file-preview/use-file-preview-actions-context.d.ts +27 -0
- package/dist/components/file-preview/use-file-preview-actions.d.ts +19 -0
- package/dist/components/file-preview/use-file-preview-editing.d.ts +21 -2
- package/dist/components/file-preview/use-file-preview-ids.d.ts +24 -0
- package/dist/components/file-preview.js +1 -442
- package/dist/components/file-tree/file-tree-body.d.ts +8 -4
- package/dist/components/file-tree/file-tree-entry-row.d.ts +9 -3
- package/dist/components/file-tree/file-tree-icons.d.ts +12 -5
- package/dist/components/file-tree/file-tree-info-labels.d.ts +21 -0
- package/dist/components/file-tree/file-tree-info-tooltip.d.ts +43 -0
- package/dist/components/file-tree/file-tree-info.d.ts +29 -0
- package/dist/components/file-tree/file-tree-keyboard.d.ts +8 -4
- package/dist/components/file-tree/file-tree-row-context.d.ts +29 -12
- package/dist/components/file-tree/file-tree-row-shared.d.ts +18 -0
- package/dist/components/file-tree/file-tree-spinner.d.ts +10 -0
- package/dist/components/file-tree/file-tree-state-row.d.ts +7 -0
- package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +22 -0
- package/dist/components/file-tree/file-tree.d.ts +12 -1
- package/dist/components/file-tree/style.css +280 -75
- package/dist/components/file-tree/types.d.ts +203 -0
- package/dist/components/file-tree/use-file-tree-actions.d.ts +7 -0
- package/dist/components/file-tree.js +1 -1
- package/dist/components/scope-switcher/scope-panel.d.ts +9 -3
- package/dist/components/scope-switcher/scope-selector.d.ts +1 -1
- package/dist/components/scope-switcher/scope-switcher.d.ts +1 -1
- package/dist/components/scope-switcher/style.css +282 -76
- package/dist/components/scope-switcher/types.d.ts +230 -108
- package/dist/components/style.css +14128 -390
- package/dist/components/tui/command-catalog.d.ts +58 -0
- package/dist/components/tui/command-completion.d.ts +19 -0
- package/dist/components/tui/command-definitions.d.ts +10 -0
- package/dist/components/tui/command-input.d.ts +16 -0
- package/dist/components/tui/style.css +1543 -5
- package/dist/components/tui/tui-assist.d.ts +15 -0
- package/dist/components/tui/tui-code-block.d.ts +8 -0
- package/dist/components/tui/tui-command-help.d.ts +9 -0
- package/dist/components/tui/tui-command-text.d.ts +6 -0
- package/dist/components/tui/tui-composer.d.ts +24 -0
- package/dist/components/tui/tui-copy-button.d.ts +9 -0
- package/dist/components/tui/tui-input-mirror.d.ts +14 -0
- package/dist/components/tui/tui-labels-zh.d.ts +2 -0
- package/dist/components/tui/tui-labels.d.ts +5 -0
- package/dist/components/tui/tui-markdown-renderers.d.ts +10 -0
- package/dist/components/tui/tui-markdown.d.ts +6 -0
- package/dist/components/tui/tui-param-hint.d.ts +7 -0
- package/dist/components/tui/tui-record-time.d.ts +11 -0
- package/dist/components/tui/tui-record.d.ts +13 -0
- package/dist/components/tui/tui-resource-preview.d.ts +10 -0
- package/dist/components/tui/tui-resource-tree.d.ts +10 -0
- package/dist/components/tui/tui-result-header.d.ts +7 -0
- package/dist/components/tui/tui-result-text.d.ts +5 -0
- package/dist/components/tui/tui-search-list.d.ts +8 -0
- package/dist/components/tui/tui-skeleton.d.ts +6 -0
- package/dist/components/tui/tui-status-card.d.ts +7 -0
- package/dist/components/tui/tui-text.d.ts +10 -0
- package/dist/components/tui/tui-uri-text.d.ts +19 -0
- package/dist/components/tui/tui-write-result.d.ts +7 -0
- package/dist/components/tui/tui.d.ts +10 -2
- package/dist/components/tui/types.d.ts +57 -15
- package/dist/components/tui/use-tui-assist-position.d.ts +3 -0
- package/dist/components/tui/use-tui-completion.d.ts +14 -0
- package/dist/components/tui/use-tui-composer-keyboard.d.ts +25 -0
- package/dist/components/viking-bot/ark-adapter.d.ts +45 -0
- package/dist/components/viking-bot/ark-message-body.d.ts +16 -0
- package/dist/components/viking-bot/ark-message-list-view.d.ts +7 -0
- package/dist/components/viking-bot/ark-message-row.d.ts +19 -0
- package/dist/components/viking-bot/index.d.ts +10 -0
- package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +10 -0
- package/dist/components/viking-bot/interaction/index.d.ts +4 -0
- package/dist/components/viking-bot/interaction/labels.d.ts +7 -0
- package/dist/components/viking-bot/interaction/lazy-interaction.d.ts +3 -0
- package/dist/components/viking-bot/interaction/schedule-input.d.ts +13 -0
- package/dist/components/viking-bot/interaction/style.css +189 -0
- package/dist/components/viking-bot/interaction/style.js +0 -0
- package/dist/components/viking-bot/interaction/types.d.ts +188 -0
- package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +9 -0
- package/dist/components/viking-bot/interaction.js +2 -0
- package/dist/components/viking-bot/labels.d.ts +2 -0
- package/dist/components/viking-bot/lazy-composer.d.ts +3 -0
- package/dist/components/viking-bot/message-groups.d.ts +12 -0
- package/dist/components/viking-bot/model.d.ts +252 -0
- package/dist/components/viking-bot/render-part.d.ts +12 -0
- package/dist/components/viking-bot/style.css +7135 -0
- package/dist/components/viking-bot/style.js +0 -0
- package/dist/components/viking-bot/types.d.ts +140 -0
- package/dist/components/viking-bot/viking-bot-composer.d.ts +6 -0
- package/dist/components/viking-bot/viking-bot-message-list.d.ts +3 -0
- package/dist/components/viking-bot/viking-bot.d.ts +16 -0
- package/dist/components/viking-bot.js +4 -0
- package/dist/c~0.js +201 -0
- package/dist/file-preview-viewer~0.js +191 -0
- package/dist/f~0.js +149 -77
- package/dist/h~0.js +58 -0
- package/dist/icons/file-type-icon.d.ts +31 -0
- package/dist/icons/index.d.ts +33 -23
- package/dist/icons/nextjs-icon.d.ts +19 -0
- package/dist/icons.js +1 -25
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -1
- package/dist/k~0.js +1440 -0
- package/dist/lk~0.js +25 -12
- package/dist/l~0.js +1464 -25
- package/dist/modules/console/style.css +83 -1
- package/dist/modules/file-browser/file-browser-detail-icons.d.ts +10 -0
- package/dist/modules/file-browser/file-browser-detail.d.ts +33 -0
- package/dist/modules/file-browser/file-browser-empty.d.ts +3 -0
- package/dist/modules/file-browser/file-browser-failure.d.ts +22 -0
- package/dist/modules/file-browser/file-browser-icons.d.ts +18 -0
- package/dist/modules/file-browser/file-browser-labels.d.ts +28 -0
- package/dist/modules/file-browser/file-browser-layout.d.ts +27 -0
- package/dist/modules/file-browser/file-browser-toolbar.d.ts +18 -0
- package/dist/modules/file-browser/file-browser-tree-pane.d.ts +30 -0
- package/dist/modules/file-browser/file-browser.d.ts +14 -5
- package/dist/modules/file-browser/find-result.d.ts +24 -0
- package/dist/modules/file-browser/fs-directories.d.ts +33 -0
- package/dist/modules/file-browser/fs-file-kind.d.ts +19 -0
- package/dist/modules/file-browser/fs-icon.d.ts +17 -0
- package/dist/modules/file-browser/fs-model.d.ts +106 -0
- package/dist/modules/file-browser/fs-page.d.ts +16 -0
- package/dist/modules/file-browser/fs-path.d.ts +16 -0
- package/dist/modules/file-browser/fs-read-directory.d.ts +20 -0
- package/dist/modules/file-browser/fs-scope.d.ts +22 -0
- package/dist/modules/file-browser/fs-stat.d.ts +25 -0
- package/dist/modules/file-browser/index.d.ts +3 -1
- package/dist/modules/file-browser/style.css +5009 -34
- package/dist/modules/file-browser/tree-info-copy.d.ts +15 -0
- package/dist/modules/file-browser/tree-info-copy.zh-CN.d.ts +15 -0
- package/dist/modules/file-browser/types.d.ts +189 -44
- package/dist/modules/file-browser/use-container-width.d.ts +17 -0
- package/dist/modules/file-browser/use-file-browser.d.ts +49 -0
- package/dist/modules/file-browser/use-fs-preview.d.ts +51 -0
- package/dist/modules/file-browser/use-fs-search.d.ts +35 -0
- package/dist/modules/file-browser/use-fs-tree.d.ts +43 -0
- package/dist/modules/file-browser/use-request-scope.d.ts +39 -0
- package/dist/modules/file-browser.js +1 -1
- package/dist/modules/scope-cascade/style.css +282 -76
- package/dist/modules/style.css +5445 -130
- package/dist/n~0.js +568 -236
- package/dist/o~0.js +103 -0
- package/dist/shared/components/divider/divider.d.ts +18 -0
- package/dist/shared/components/divider/index.d.ts +1 -0
- package/dist/shared/components/divider/types.d.ts +35 -0
- package/dist/shared/components/overlay/types.d.ts +7 -0
- package/dist/shared/components/overlay/use-overlay-position.d.ts +38 -0
- package/dist/shared/components/popover/index.d.ts +1 -0
- package/dist/shared/components/popover/popover.d.ts +23 -0
- package/dist/shared/components/popover/types.d.ts +50 -0
- package/dist/shared/components/resizable/clamp.d.ts +13 -0
- package/dist/shared/components/resizable/index.d.ts +2 -0
- package/dist/shared/components/resizable/resizable-handle.d.ts +25 -0
- package/dist/shared/components/resizable/types.d.ts +48 -0
- package/dist/shared/components/tooltip/index.d.ts +1 -0
- package/dist/shared/components/tooltip/tooltip.d.ts +25 -0
- package/dist/shared/components/tooltip/types.d.ts +42 -0
- package/dist/style.css +19664 -530
- package/dist/u~0.js +1597 -4
- package/dist/viking-bot-composer~0.js +164 -0
- package/dist/viking-bot-interaction~0.js +284 -0
- package/dist/w~0.js +19 -0
- package/package.json +23 -10
- package/dist/components/file-preview/file-preview-icons.d.ts +0 -2
- package/dist/components/file-preview/file-preview-operations.d.ts +0 -1
- package/dist/components/file-tree/file-tree-dom.d.ts +0 -4
- package/dist/components/file-tree/file-tree-labels.d.ts +0 -5
- package/dist/components/file-tree/file-tree-rows.d.ts +0 -12
- package/dist/components/file-tree/file-tree-tooltip.d.ts +0 -11
- package/dist/i~0.js +0 -21
- package/dist/modules/file-browser/file-browser-toolbar-button.d.ts +0 -10
- package/dist/modules/task-center/columns.d.ts +0 -129
- package/dist/modules/task-center/index.d.ts +0 -1
- package/dist/modules/task-center/style.css +0 -29
- package/dist/modules/task-center/task-center.d.ts +0 -4
- package/dist/modules/task-center/types.d.ts +0 -168
- package/dist/modules/task-center.js +0 -1
- /package/dist/{modules/task-center → components/file-browser-entries}/style.js +0 -0
|
File without changes
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode, RefObject } from 'react';
|
|
2
|
+
import type { VikingBotInteractionProps } from './interaction/types.js';
|
|
3
|
+
import type { VikingBotAttachment, VikingBotDraft, VikingBotLabels, VikingBotMessage, VikingBotStreamingState } from './model.js';
|
|
4
|
+
/** 消息列表的公开接口。Public interface of the message list. */
|
|
5
|
+
export interface VikingBotMessageListProps {
|
|
6
|
+
/** 当前会话的消息。Messages in the current session. */
|
|
7
|
+
messages: readonly VikingBotMessage[];
|
|
8
|
+
/** 附加到根元素的类名。Class name applied to the root element. */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** 助手仍在生成时追加的片段。Parts appended while the assistant is still streaming. */
|
|
11
|
+
streaming?: VikingBotStreamingState;
|
|
12
|
+
/** 渲染在最后一条消息之后,例如记忆提交提示条。Rendered after the last message. */
|
|
13
|
+
footer?: ReactNode;
|
|
14
|
+
/** 当前身份作用域的标识;值变化时重置展示状态。Identity scope; changes reset display state. */
|
|
15
|
+
listKey?: string;
|
|
16
|
+
/** 打开消息中引用的资源。Opens a resource referenced by a message. */
|
|
17
|
+
onOpenUri?: (uri: string) => void;
|
|
18
|
+
/** 复制由宿主执行,列表只上报意图。The host copies; the list reports intent. */
|
|
19
|
+
onCopy?: (text: string) => void;
|
|
20
|
+
/** 触发一条消息声明的动作,例如提交记忆。Fires a message action. */
|
|
21
|
+
onMessageAction?: (messageId: string, actionKey: string) => void;
|
|
22
|
+
/** 消息正文的替换渲染,用于宿主自带 Markdown 渲染器。Replaces message bodies. */
|
|
23
|
+
renderMessage?: (message: VikingBotMessage) => ReactNode;
|
|
24
|
+
/** 可替换文案,缺省为英文。Replaceable copy; English by default. */
|
|
25
|
+
labels?: VikingBotLabels;
|
|
26
|
+
}
|
|
27
|
+
/** 输入区的命令式入口。Imperative handle of the composer. */
|
|
28
|
+
export interface VikingBotComposerRef {
|
|
29
|
+
/** 替换输入文本。Replaces the input text. */
|
|
30
|
+
setText: (text: string) => void;
|
|
31
|
+
/** 追加文本,保留已编辑的草稿。Appends text, keeping the current draft. */
|
|
32
|
+
appendText: (text: string) => void;
|
|
33
|
+
/** 添加在输入区外拖入的文件。Adds files dropped outside the input area. */
|
|
34
|
+
addFiles: (files: readonly File[]) => void;
|
|
35
|
+
/** 是否已达到附件数量上限。Whether the attachment limit has been reached. */
|
|
36
|
+
isAttachmentLimitReached: () => boolean;
|
|
37
|
+
/** 清空输入框与待发送附件。Clears the input and pending attachments. */
|
|
38
|
+
clear: () => void;
|
|
39
|
+
/** 聚焦输入框。Focuses the input. */
|
|
40
|
+
focus: () => void;
|
|
41
|
+
}
|
|
42
|
+
/** 输入区的公开接口。Public interface of the composer. */
|
|
43
|
+
export interface VikingBotComposerProps {
|
|
44
|
+
/** 受控的草稿文本。Controlled draft text. */
|
|
45
|
+
value: string;
|
|
46
|
+
/** 附加到根元素的类名。Class name applied to the root element. */
|
|
47
|
+
className?: string;
|
|
48
|
+
/** 宿主已选中的附件。Attachments already selected by the host. */
|
|
49
|
+
attachments?: readonly VikingBotAttachment[];
|
|
50
|
+
/** 是否禁用发送;原因与提示由宿主决定。Disables sending; the host owns the reason. */
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
/** 禁用时展示的说明。Reason shown while the composer is disabled. */
|
|
53
|
+
disabledReason?: string;
|
|
54
|
+
/** 是否正在回复;回复中停止动作替代发送。Whether a reply is streaming. */
|
|
55
|
+
isSending?: boolean;
|
|
56
|
+
/** 输入区布局形态。Layout of the input area. */
|
|
57
|
+
variant?: 'default' | 'compact';
|
|
58
|
+
/** 宿主接受的 MIME 类型。MIME types the host accepts. */
|
|
59
|
+
accept?: string;
|
|
60
|
+
/** 宿主允许的最大附件数。Maximum number of attachments the host allows. */
|
|
61
|
+
maxAttachments?: number;
|
|
62
|
+
/** 发送按钮旁的额外控件。Extra controls rendered next to the send button. */
|
|
63
|
+
actions?: ReactNode;
|
|
64
|
+
/** 输入值变化时触发。省略时输入框只读。Invoked when the input changes. */
|
|
65
|
+
onValueChange?: (value: string) => void;
|
|
66
|
+
/** 上报用户选择或拖入的文件;由宿主上传。Reports files the user picked or dropped. */
|
|
67
|
+
onFilesAdded?: (files: readonly File[]) => void;
|
|
68
|
+
/** 移除一个附件。Removes an attachment. */
|
|
69
|
+
onAttachmentRemove?: (attachment: VikingBotAttachment) => void;
|
|
70
|
+
/** 上报发送意图;由宿主发送并清空草稿。省略时不能发送。Reports the send intent. */
|
|
71
|
+
onSend?: (draft: VikingBotDraft) => void;
|
|
72
|
+
/** 停止正在进行的回复。省略时不展示停止动作。Stops the streaming reply. */
|
|
73
|
+
onCancel?: () => void;
|
|
74
|
+
/** 可替换文案,缺省为英文。Replaceable copy; English by default. */
|
|
75
|
+
labels?: VikingBotLabels;
|
|
76
|
+
}
|
|
77
|
+
/** 完整对话区的公开接口。Public interface of the whole conversation view. */
|
|
78
|
+
export interface VikingBotProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onCopy' | 'onSubmit'> {
|
|
79
|
+
/** 当前会话的消息。Messages in the current session. */
|
|
80
|
+
messages: readonly VikingBotMessage[];
|
|
81
|
+
/** 附加到根元素的类名。Class name applied to the root element. */
|
|
82
|
+
className?: string;
|
|
83
|
+
/** 助手仍在生成时追加的片段。Parts appended while the assistant is still streaming. */
|
|
84
|
+
streaming?: VikingBotStreamingState;
|
|
85
|
+
/** 受控的草稿文本;不传则不展示输入区。Controlled draft text; omit to hide the composer. */
|
|
86
|
+
draft?: string;
|
|
87
|
+
/** 宿主已选中的附件。Attachments already selected by the host. */
|
|
88
|
+
attachments?: readonly VikingBotAttachment[];
|
|
89
|
+
/** 是否正在回复。Whether a reply is streaming. */
|
|
90
|
+
isSending?: boolean;
|
|
91
|
+
/** 是否可接受输入。Whether the bot can accept input. */
|
|
92
|
+
isAvailable?: boolean;
|
|
93
|
+
/** 不可用时的说明。Message shown while the bot is unavailable. */
|
|
94
|
+
unavailableMessage?: string;
|
|
95
|
+
/** 首条消息之前替代消息列表显示的内容。Shown instead of the list before the first message. */
|
|
96
|
+
emptyState?: ReactNode;
|
|
97
|
+
/** 头部插槽,例如会话标题或历史按钮。Header slot. */
|
|
98
|
+
header?: ReactNode;
|
|
99
|
+
/** 渲染在输入区上方,例如记忆提交提示条。Rendered above the composer. */
|
|
100
|
+
footer?: ReactNode;
|
|
101
|
+
/** 替换整个主体,用于宿主自定义组合。Replaces the whole body. */
|
|
102
|
+
children?: ReactNode;
|
|
103
|
+
/** 替换消息列表,用于宿主自带渲染底座。Replaces the message list. */
|
|
104
|
+
messageList?: ReactNode;
|
|
105
|
+
/** 替换输入区,用于宿主自带输入组件。Replaces the composer. */
|
|
106
|
+
composer?: ReactNode;
|
|
107
|
+
/**
|
|
108
|
+
* 待确认交互的配置;存在时替代输入区。
|
|
109
|
+
* Configuration of a pending interaction; replaces the composer.
|
|
110
|
+
*/
|
|
111
|
+
interaction?: VikingBotInteractionProps;
|
|
112
|
+
/**
|
|
113
|
+
* 整块替换交互区;传值时忽略 `interaction` 的内置渲染,宿主自行渲染。
|
|
114
|
+
* Replaces the whole interaction area; when set, the built-in rendering of
|
|
115
|
+
* `interaction` is skipped and the host renders its own.
|
|
116
|
+
*/
|
|
117
|
+
interactionSlot?: ReactNode;
|
|
118
|
+
/** 当前身份作用域的标识;值变化时重置展示状态。Identity scope; changes reset display state. */
|
|
119
|
+
listKey?: string;
|
|
120
|
+
/** 输入区的命令式入口。Imperative handle of the composer. */
|
|
121
|
+
composerRef?: RefObject<VikingBotComposerRef | null>;
|
|
122
|
+
/** 草稿变化时触发。Invoked when the draft changes. */
|
|
123
|
+
onDraftChange?: (value: string) => void;
|
|
124
|
+
/** 上报用户选择或拖入的文件;由宿主上传。Reports files the user picked or dropped. */
|
|
125
|
+
onFilesAdded?: (files: readonly File[]) => void;
|
|
126
|
+
/** 移除一个附件。Removes an attachment. */
|
|
127
|
+
onAttachmentRemove?: (attachment: VikingBotAttachment) => void;
|
|
128
|
+
/** 上报发送意图。Reports the send intent. */
|
|
129
|
+
onSend?: (draft: VikingBotDraft) => void;
|
|
130
|
+
/** 停止正在进行的回复。Stops the streaming reply. */
|
|
131
|
+
onCancel?: () => void;
|
|
132
|
+
/** 打开消息中引用的资源。Opens a resource referenced by a message. */
|
|
133
|
+
onOpenUri?: (uri: string) => void;
|
|
134
|
+
/** 复制由宿主执行,组件只上报意图。The host copies; the component reports intent. */
|
|
135
|
+
onCopy?: (text: string) => void;
|
|
136
|
+
/** 触发一条消息声明的动作。Fires a message action. */
|
|
137
|
+
onMessageAction?: (messageId: string, actionKey: string) => void;
|
|
138
|
+
/** 可替换文案,缺省为英文。Replaceable copy; English by default. */
|
|
139
|
+
labels?: VikingBotLabels;
|
|
140
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { VikingBotComposerProps, VikingBotComposerRef } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 输入区。发送与停止都由宿主决定,组件只上报意图。
|
|
4
|
+
* The composer. The host owns sending and stopping; the component reports intent.
|
|
5
|
+
*/
|
|
6
|
+
export declare const VikingBotComposerView: import("react").ForwardRefExoticComponent<VikingBotComposerProps & import("react").RefAttributes<VikingBotComposerRef>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { VikingBotProps } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 占位组件:仅按 props 契约渲染可用视图,未经设计评审,真实实现待重写。
|
|
4
|
+
*
|
|
5
|
+
* 完整对话区。消息列表、输入区与待确认交互都可被宿主替换:
|
|
6
|
+
* 传 `messageList`、`composer` 或 `interaction` 时使用宿主的渲染底座,
|
|
7
|
+
* 不传时使用内置实现。
|
|
8
|
+
*
|
|
9
|
+
* Placeholder: renders a working view against the props contract only, pending
|
|
10
|
+
* design review; the real implementation will be rewritten.
|
|
11
|
+
*
|
|
12
|
+
* The whole conversation view. The message list, the composer and the pending
|
|
13
|
+
* interaction can each be replaced by the host; the built-in implementations
|
|
14
|
+
* are used when they are omitted.
|
|
15
|
+
*/
|
|
16
|
+
export declare function VikingBot({ messages, className, streaming, draft, attachments, isSending, isAvailable, unavailableMessage, emptyState, header, footer, children, messageList, composer, interaction, interactionSlot, listKey, composerRef, onDraftChange, onFilesAdded, onAttachmentRemove, onSend, onCancel, onOpenUri, onCopy, onMessageAction, labels: overrides, ...rest }: VikingBotProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { DEFAULT_INTERACTION_LABELS } from "../c7~0.js";
|
|
2
|
+
export { DEFAULT_LABELS, VikingBot, VikingBotComposer, VikingBotMessageList } from "../c~0.js";
|
|
3
|
+
export { VikingBotInteraction } from "../w~0.js";
|
|
4
|
+
export { groupByActivity, groupMessages, messageText } from "../h~0.js";
|
package/dist/c~0.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense, forwardRef, lazy } from "react";
|
|
3
|
+
import { VikingBotInteraction } from "./w~0.js";
|
|
4
|
+
const DEFAULT_LABELS = {
|
|
5
|
+
placeholder: 'Ask VikingBot anything',
|
|
6
|
+
send: 'Send',
|
|
7
|
+
stop: 'Stop',
|
|
8
|
+
attach: 'Attach files',
|
|
9
|
+
removeAttachment: 'Remove attachment',
|
|
10
|
+
copy: 'Copy',
|
|
11
|
+
copied: 'Copied',
|
|
12
|
+
reasoning: 'Reasoning',
|
|
13
|
+
thinking: 'Thinking',
|
|
14
|
+
tool: 'Tool call',
|
|
15
|
+
toolPending: 'Queued',
|
|
16
|
+
toolRunning: 'Running',
|
|
17
|
+
toolCompleted: 'Done',
|
|
18
|
+
toolError: 'Failed',
|
|
19
|
+
context: 'Context',
|
|
20
|
+
empty: 'Start a conversation',
|
|
21
|
+
newSession: 'New chat',
|
|
22
|
+
retry: 'Retry',
|
|
23
|
+
scrollToLatest: 'Scroll to latest',
|
|
24
|
+
unavailable: 'VikingBot is unavailable'
|
|
25
|
+
};
|
|
26
|
+
const View = /*#__PURE__*/ lazy(async ()=>{
|
|
27
|
+
const { VikingBotComposerView } = await import("./viking-bot-composer~0.js");
|
|
28
|
+
return {
|
|
29
|
+
default: VikingBotComposerView
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
const lazy_composer_VikingBotComposer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
33
|
+
return /*#__PURE__*/ jsx(Suspense, {
|
|
34
|
+
fallback: /*#__PURE__*/ jsx("div", {
|
|
35
|
+
className: "ov-viking-bot__composer ov-viking-bot__composer--loading"
|
|
36
|
+
}),
|
|
37
|
+
children: /*#__PURE__*/ jsx(View, {
|
|
38
|
+
...props,
|
|
39
|
+
ref: ref
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
const toStatus = (status)=>'pending' === status ? 'queued' : 'running' === status ? 'running' : 'completed' === status ? 'success' : 'failed';
|
|
44
|
+
const toReasoningItem = (part, index)=>({
|
|
45
|
+
id: `${part.groupId ?? 'reasoning'}:${index}`,
|
|
46
|
+
type: 'reasoning',
|
|
47
|
+
status: part.running ? 'running' : 'success',
|
|
48
|
+
summary: part.text ? [
|
|
49
|
+
part.text
|
|
50
|
+
] : [],
|
|
51
|
+
visibility: 'contentAllowed',
|
|
52
|
+
durationMs: part.durationMs
|
|
53
|
+
});
|
|
54
|
+
const toToolItem = (part)=>({
|
|
55
|
+
id: part.id,
|
|
56
|
+
type: 'mcpToolCall',
|
|
57
|
+
status: toStatus(part.status),
|
|
58
|
+
server: part.server ?? '',
|
|
59
|
+
tool: part.name,
|
|
60
|
+
arguments: part.input,
|
|
61
|
+
resultPreview: part.output,
|
|
62
|
+
durationMs: part.durationMs
|
|
63
|
+
});
|
|
64
|
+
const isActivityPart = (part)=>'reasoning' === part.type || 'tool' === part.type;
|
|
65
|
+
function groupActivityParts(parts) {
|
|
66
|
+
const groups = new Map();
|
|
67
|
+
const order = [];
|
|
68
|
+
parts.forEach((part, index)=>{
|
|
69
|
+
if (!isActivityPart(part)) return;
|
|
70
|
+
const key = 'groupId' in part && part.groupId || `loose:${index}`;
|
|
71
|
+
const group = groups.get(key) ?? {
|
|
72
|
+
id: key,
|
|
73
|
+
items: []
|
|
74
|
+
};
|
|
75
|
+
if (!groups.has(key)) {
|
|
76
|
+
groups.set(key, group);
|
|
77
|
+
order.push(key);
|
|
78
|
+
}
|
|
79
|
+
group.items.push('reasoning' === part.type ? toReasoningItem(part, index) : toToolItem(part));
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
groups,
|
|
83
|
+
order
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function toRenderItems(messages, streaming, group = (list)=>[
|
|
87
|
+
...list
|
|
88
|
+
]) {
|
|
89
|
+
const insertIndex = streaming ? Math.min(Math.max(streaming.insertIndex ?? messages.length, 0), messages.length) : messages.length;
|
|
90
|
+
const before = group(messages.slice(0, insertIndex));
|
|
91
|
+
const after = streaming ? group(messages.slice(insertIndex)) : [];
|
|
92
|
+
const items = before.map((message)=>({
|
|
93
|
+
id: message.id,
|
|
94
|
+
message
|
|
95
|
+
}));
|
|
96
|
+
if (streaming) items.push({
|
|
97
|
+
id: '__streaming__',
|
|
98
|
+
streaming
|
|
99
|
+
});
|
|
100
|
+
for (const message of after)items.push({
|
|
101
|
+
id: message.id,
|
|
102
|
+
message
|
|
103
|
+
});
|
|
104
|
+
return items;
|
|
105
|
+
}
|
|
106
|
+
const List = /*#__PURE__*/ lazy(async ()=>{
|
|
107
|
+
const { VikingBotMessageListView } = await import("./ark-message-list-view~0.js");
|
|
108
|
+
return {
|
|
109
|
+
default: VikingBotMessageListView
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
function ListSkeleton() {
|
|
113
|
+
return /*#__PURE__*/ jsx("div", {
|
|
114
|
+
className: "ov-viking-bot__list ov-viking-bot__list--loading"
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function VikingBotMessageList(props) {
|
|
118
|
+
const labels = {
|
|
119
|
+
...DEFAULT_LABELS,
|
|
120
|
+
...props.labels
|
|
121
|
+
};
|
|
122
|
+
const items = toRenderItems(props.messages, props.streaming);
|
|
123
|
+
if (0 === items.length) return /*#__PURE__*/ jsx("div", {
|
|
124
|
+
className: "ov-viking-bot__empty",
|
|
125
|
+
children: labels.empty
|
|
126
|
+
});
|
|
127
|
+
return /*#__PURE__*/ jsx(Suspense, {
|
|
128
|
+
fallback: /*#__PURE__*/ jsx(ListSkeleton, {}),
|
|
129
|
+
children: /*#__PURE__*/ jsx(List, {
|
|
130
|
+
...props
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function VikingBot({ messages, className, streaming, draft, attachments, isSending, isAvailable = true, unavailableMessage, emptyState, header, footer, children, messageList, composer, interaction, interactionSlot, listKey, composerRef, onDraftChange, onFilesAdded, onAttachmentRemove, onSend, onCancel, onOpenUri, onCopy, onMessageAction, labels: overrides, ...rest }) {
|
|
135
|
+
const labels = {
|
|
136
|
+
...DEFAULT_LABELS,
|
|
137
|
+
...overrides
|
|
138
|
+
};
|
|
139
|
+
const hasMessages = messages.length > 0;
|
|
140
|
+
if (children) return /*#__PURE__*/ jsx("div", {
|
|
141
|
+
className: [
|
|
142
|
+
'ov-viking-bot',
|
|
143
|
+
className
|
|
144
|
+
].filter(Boolean).join(' '),
|
|
145
|
+
...rest,
|
|
146
|
+
children: children
|
|
147
|
+
});
|
|
148
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
149
|
+
className: [
|
|
150
|
+
'ov-viking-bot',
|
|
151
|
+
className
|
|
152
|
+
].filter(Boolean).join(' '),
|
|
153
|
+
...rest,
|
|
154
|
+
children: [
|
|
155
|
+
header ? /*#__PURE__*/ jsx("div", {
|
|
156
|
+
className: "ov-viking-bot__header",
|
|
157
|
+
children: header
|
|
158
|
+
}) : null,
|
|
159
|
+
isAvailable ? null : /*#__PURE__*/ jsx("p", {
|
|
160
|
+
className: "ov-viking-bot__unavailable",
|
|
161
|
+
role: "status",
|
|
162
|
+
children: unavailableMessage ?? labels.unavailable
|
|
163
|
+
}),
|
|
164
|
+
/*#__PURE__*/ jsx("div", {
|
|
165
|
+
className: "ov-viking-bot__body",
|
|
166
|
+
children: !hasMessages && emptyState ? /*#__PURE__*/ jsx("div", {
|
|
167
|
+
className: "ov-viking-bot__empty",
|
|
168
|
+
children: emptyState
|
|
169
|
+
}) : messageList ?? /*#__PURE__*/ jsx(VikingBotMessageList, {
|
|
170
|
+
messages: messages,
|
|
171
|
+
streaming: streaming,
|
|
172
|
+
listKey: listKey,
|
|
173
|
+
onOpenUri: onOpenUri,
|
|
174
|
+
onCopy: onCopy,
|
|
175
|
+
onMessageAction: onMessageAction,
|
|
176
|
+
labels: overrides
|
|
177
|
+
})
|
|
178
|
+
}),
|
|
179
|
+
footer ? /*#__PURE__*/ jsx("div", {
|
|
180
|
+
className: "ov-viking-bot__footer",
|
|
181
|
+
children: footer
|
|
182
|
+
}) : null,
|
|
183
|
+
interaction ? interactionSlot ?? /*#__PURE__*/ jsx(VikingBotInteraction, {
|
|
184
|
+
...interaction
|
|
185
|
+
}) : composer ?? (void 0 !== draft ? /*#__PURE__*/ jsx(lazy_composer_VikingBotComposer, {
|
|
186
|
+
ref: composerRef,
|
|
187
|
+
value: draft,
|
|
188
|
+
attachments: attachments,
|
|
189
|
+
disabled: !isAvailable,
|
|
190
|
+
isSending: isSending,
|
|
191
|
+
onValueChange: onDraftChange,
|
|
192
|
+
onFilesAdded: onFilesAdded,
|
|
193
|
+
onAttachmentRemove: onAttachmentRemove,
|
|
194
|
+
onSend: onSend,
|
|
195
|
+
onCancel: onCancel,
|
|
196
|
+
labels: overrides
|
|
197
|
+
}) : null)
|
|
198
|
+
]
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
export { DEFAULT_LABELS, VikingBot, VikingBotMessageList, groupActivityParts, lazy_composer_VikingBotComposer as VikingBotComposer, toRenderItems };
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FileViewerCore } from "@ark-design/ui/file-viewer/core";
|
|
3
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
4
|
+
import { code } from "@ark-design/ui/file-viewer/adapters/code";
|
|
5
|
+
import { diff } from "@ark-design/ui/file-viewer/adapters/diff";
|
|
6
|
+
import { html } from "@ark-design/ui/file-viewer/adapters/html";
|
|
7
|
+
import { image as image_image } from "@ark-design/ui/file-viewer/adapters/image";
|
|
8
|
+
import { json } from "@ark-design/ui/file-viewer/adapters/json";
|
|
9
|
+
import { markdown } from "@ark-design/ui/file-viewer/adapters/markdown";
|
|
10
|
+
import { media } from "@ark-design/ui/file-viewer/adapters/media";
|
|
11
|
+
import { pdf } from "@ark-design/ui/file-viewer/adapters/pdf";
|
|
12
|
+
import { powerpoint } from "@ark-design/ui/file-viewer/adapters/powerpoint";
|
|
13
|
+
import { table } from "@ark-design/ui/file-viewer/adapters/table";
|
|
14
|
+
import { text as text_text } from "@ark-design/ui/file-viewer/adapters/text";
|
|
15
|
+
import { word } from "@ark-design/ui/file-viewer/adapters/word";
|
|
16
|
+
import { toFileSource, LoadFailedState, LoadingState, UnsupportedState } from "./30~0.js";
|
|
17
|
+
function createFilePreviewAdapterList({ onLinkClick } = {}) {
|
|
18
|
+
return [
|
|
19
|
+
code({
|
|
20
|
+
showLineNumbers: true
|
|
21
|
+
}),
|
|
22
|
+
text_text({
|
|
23
|
+
showLineNumbers: true
|
|
24
|
+
}),
|
|
25
|
+
json({
|
|
26
|
+
defaultExpandDepth: 4
|
|
27
|
+
}),
|
|
28
|
+
markdown({
|
|
29
|
+
onLinkClick
|
|
30
|
+
}),
|
|
31
|
+
html(),
|
|
32
|
+
table(),
|
|
33
|
+
pdf({
|
|
34
|
+
initialFit: 'fit-width'
|
|
35
|
+
}),
|
|
36
|
+
word({
|
|
37
|
+
initialFit: 'fit-width'
|
|
38
|
+
}),
|
|
39
|
+
powerpoint({
|
|
40
|
+
initialFit: 'fit-width'
|
|
41
|
+
}),
|
|
42
|
+
image_image(),
|
|
43
|
+
media(),
|
|
44
|
+
diff()
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
function createFilePreviewAdapters({ onHandleChange, onViewModesChange, onLinkClick }) {
|
|
48
|
+
return createFilePreviewAdapterList({
|
|
49
|
+
onLinkClick
|
|
50
|
+
}).map((adapter)=>{
|
|
51
|
+
const wrap = (context)=>{
|
|
52
|
+
const descriptor = adapter(context);
|
|
53
|
+
return {
|
|
54
|
+
...descriptor,
|
|
55
|
+
load: async (loadContext)=>{
|
|
56
|
+
const { Component } = await descriptor.load(loadContext);
|
|
57
|
+
onViewModesChange(descriptor.supportedViewModes ?? []);
|
|
58
|
+
function HandleCapture(props) {
|
|
59
|
+
const latest = useRef(props.registerHandle);
|
|
60
|
+
latest.current = props.registerHandle;
|
|
61
|
+
const proxy = useCallback((handle)=>{
|
|
62
|
+
onHandleChange(handle);
|
|
63
|
+
latest.current?.(handle);
|
|
64
|
+
}, []);
|
|
65
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
66
|
+
...props,
|
|
67
|
+
registerHandle: proxy
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
HandleCapture.displayName = 'FilePreviewHandleCapture';
|
|
71
|
+
return {
|
|
72
|
+
Component: HandleCapture
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
return wrap;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function sourceDeps(source) {
|
|
81
|
+
return [
|
|
82
|
+
source.content,
|
|
83
|
+
source.file,
|
|
84
|
+
source.url,
|
|
85
|
+
source.fileName,
|
|
86
|
+
source.fileType,
|
|
87
|
+
source.path
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
function FilePreviewViewer({ tab, text, locale, viewMode, onViewModeChange, onDownload, onHandleChange, onViewModesChange, onLinkClick }) {
|
|
91
|
+
const source = useMemo(()=>toFileSource(tab.source), sourceDeps(tab.source));
|
|
92
|
+
const adapters = useMemo(()=>createFilePreviewAdapters({
|
|
93
|
+
onHandleChange,
|
|
94
|
+
onViewModesChange,
|
|
95
|
+
onLinkClick
|
|
96
|
+
}), [
|
|
97
|
+
onHandleChange,
|
|
98
|
+
onViewModesChange,
|
|
99
|
+
onLinkClick
|
|
100
|
+
]);
|
|
101
|
+
const canDownload = Boolean(tab.operations?.download);
|
|
102
|
+
const latest = useRef({
|
|
103
|
+
text,
|
|
104
|
+
onDownload,
|
|
105
|
+
tabSlots: tab.slots,
|
|
106
|
+
canDownload
|
|
107
|
+
});
|
|
108
|
+
latest.current = {
|
|
109
|
+
text,
|
|
110
|
+
onDownload,
|
|
111
|
+
tabSlots: tab.slots,
|
|
112
|
+
canDownload
|
|
113
|
+
};
|
|
114
|
+
const slotPresence = [
|
|
115
|
+
Boolean(tab.slots?.confirmFallback),
|
|
116
|
+
Boolean(tab.slots?.downloadFallback),
|
|
117
|
+
Boolean(tab.slots?.unsupportedFallback)
|
|
118
|
+
].join();
|
|
119
|
+
const slots = useMemo(()=>{
|
|
120
|
+
const loadingSlot = ()=>{
|
|
121
|
+
const own = latest.current.tabSlots?.loadingFallback;
|
|
122
|
+
return own ? /*#__PURE__*/ jsx(Fragment, {
|
|
123
|
+
children: own
|
|
124
|
+
}) : /*#__PURE__*/ jsx(LoadingState, {
|
|
125
|
+
text: latest.current.text
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
const errorSlot = ({ retry })=>{
|
|
129
|
+
const own = latest.current.tabSlots?.errorFallback;
|
|
130
|
+
return own ? /*#__PURE__*/ jsx(Fragment, {
|
|
131
|
+
children: own
|
|
132
|
+
}) : /*#__PURE__*/ jsx(LoadFailedState, {
|
|
133
|
+
text: latest.current.text,
|
|
134
|
+
onRetry: retry
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
const own = tab.slots;
|
|
138
|
+
const hasConfirm = Boolean(own?.confirmFallback);
|
|
139
|
+
const hasHostDownload = Boolean(own?.downloadFallback);
|
|
140
|
+
const hasUnsupported = Boolean(own?.unsupportedFallback);
|
|
141
|
+
const confirmSlot = (props)=>{
|
|
142
|
+
const Host = latest.current.tabSlots?.confirmFallback;
|
|
143
|
+
return Host ? /*#__PURE__*/ jsx(Host, {
|
|
144
|
+
...props
|
|
145
|
+
}) : null;
|
|
146
|
+
};
|
|
147
|
+
const downloadSlot = (props)=>{
|
|
148
|
+
const tabSlots = latest.current.tabSlots;
|
|
149
|
+
const Host = tabSlots?.downloadFallback;
|
|
150
|
+
if (Host) return /*#__PURE__*/ jsx(Host, {
|
|
151
|
+
...props
|
|
152
|
+
});
|
|
153
|
+
return /*#__PURE__*/ jsx(UnsupportedState, {
|
|
154
|
+
text: latest.current.text,
|
|
155
|
+
onDownload: latest.current.canDownload ? latest.current.onDownload : void 0
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
return {
|
|
159
|
+
loading: loadingSlot,
|
|
160
|
+
error: errorSlot,
|
|
161
|
+
...hasConfirm ? {
|
|
162
|
+
confirm: confirmSlot
|
|
163
|
+
} : {},
|
|
164
|
+
...hasHostDownload || !hasUnsupported ? {
|
|
165
|
+
downloadFallback: downloadSlot
|
|
166
|
+
} : {}
|
|
167
|
+
};
|
|
168
|
+
}, [
|
|
169
|
+
tab.key,
|
|
170
|
+
slotPresence
|
|
171
|
+
]);
|
|
172
|
+
if (!source) return tab.slots?.unsupportedFallback ?? /*#__PURE__*/ jsx(UnsupportedState, {
|
|
173
|
+
text: text,
|
|
174
|
+
onDownload: canDownload ? onDownload : void 0
|
|
175
|
+
});
|
|
176
|
+
return /*#__PURE__*/ jsx(FileViewerCore, {
|
|
177
|
+
adapters: adapters,
|
|
178
|
+
className: "ov-file-preview__viewer",
|
|
179
|
+
locale: locale,
|
|
180
|
+
resources: tab.resources,
|
|
181
|
+
slots: slots,
|
|
182
|
+
source: source,
|
|
183
|
+
toolbar: false,
|
|
184
|
+
unsupportedFallback: tab.slots?.unsupportedFallback,
|
|
185
|
+
viewMode: viewMode,
|
|
186
|
+
onViewModeChange: (mode)=>{
|
|
187
|
+
if ('preview' === mode || 'source' === mode) onViewModeChange(mode);
|
|
188
|
+
}
|
|
189
|
+
}, tab.key);
|
|
190
|
+
}
|
|
191
|
+
export { FilePreviewViewer };
|