@openviking/react 0.1.3 → 0.1.5
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/LICENSE.arco-design +21 -0
- package/README.md +27 -15
- package/dist/0~0.js +19 -0
- package/dist/28~0.js +15 -0
- package/dist/2~0.js +2270 -29
- package/dist/2~0.js.LICENSE.txt +23 -0
- package/dist/3c~0.js +2208 -0
- package/dist/3~0.js +1207 -1982
- package/dist/4~0.js +18 -0
- package/dist/9~0.js +43 -0
- package/dist/{1~0.js → ae~0.js} +11 -26
- package/dist/ark-message-list-view~0.js +530 -119
- package/dist/a~0.js +1300 -14
- package/dist/c7~0.js +38 -2
- package/dist/ck~0.js +23 -0
- package/dist/client/provider.d.ts +15 -9
- package/dist/client/types.d.ts +5 -5
- package/dist/client.js +2 -1
- package/dist/components/agent-connect/agent-connect-code-block.d.ts +14 -0
- package/dist/components/agent-connect/agent-connect-copy.d.ts +22 -33
- package/dist/components/agent-connect/agent-connect-design.d.ts +1936 -168
- package/dist/components/agent-connect/agent-connect-installer.d.ts +1 -0
- package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +4 -6
- package/dist/components/agent-connect/agent-connect-instructions.d.ts +148 -0
- package/dist/components/agent-connect/agent-connect-markdown.d.ts +8 -2
- package/dist/components/agent-connect/agent-connect-mask.d.ts +10 -0
- package/dist/components/agent-connect/agent-connect.d.ts +1 -1
- package/dist/components/agent-connect/locales/en-US.d.ts +23 -0
- package/dist/components/agent-connect/locales/zh-CN.d.ts +3 -0
- package/dist/components/agent-connect/style.css +129 -3
- package/dist/components/agent-connect/types.d.ts +7 -4
- package/dist/components/agent-connect/use-agent-connect-copy.d.ts +6 -0
- package/dist/components/directory-tour/directory-tour.d.ts +3 -0
- package/dist/components/directory-tour/index.d.ts +3 -0
- package/dist/components/directory-tour/locales/en-US.d.ts +3 -0
- package/dist/components/directory-tour/locales/zh-CN.d.ts +3 -0
- package/dist/components/directory-tour/steps.d.ts +5 -0
- package/dist/components/directory-tour/style.css +237 -0
- package/dist/components/directory-tour/style.js +0 -0
- package/dist/components/directory-tour/types.d.ts +43 -0
- package/dist/components/directory-tour/use-tour-anchor.d.ts +5 -0
- package/dist/components/directory-tour/use-tour-position.d.ts +12 -0
- package/dist/components/directory-tour.js +40 -0
- package/dist/components/file-browser-entries/file-browser-entries.d.ts +5 -5
- package/dist/components/file-browser-entries/labels.d.ts +3 -0
- package/dist/components/file-browser-entries/locales/en-US.d.ts +6 -0
- package/dist/components/file-browser-entries/locales/zh-CN.d.ts +6 -0
- package/dist/components/file-browser-entries/style.css +866 -2
- package/dist/components/file-browser-entries/types.d.ts +34 -16
- package/dist/components/file-preview/file-preview-adapters.d.ts +2 -1
- package/dist/components/file-preview/file-preview-body.d.ts +2 -1
- package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +2 -1
- package/dist/components/file-preview/file-preview-breadcrumb.d.ts +2 -1
- package/dist/components/file-preview/file-preview-directory.d.ts +2 -1
- package/dist/components/file-preview/file-preview-handle-adapters.d.ts +2 -1
- package/dist/components/file-preview/file-preview-header.d.ts +6 -2
- package/dist/components/file-preview/file-preview-image-frame.d.ts +5 -0
- package/dist/components/file-preview/file-preview-labels.d.ts +2 -14
- package/dist/components/file-preview/file-preview-level-tabs.d.ts +7 -0
- package/dist/components/file-preview/file-preview-markdown-images.d.ts +13 -0
- package/dist/components/file-preview/file-preview-panels.d.ts +5 -2
- package/dist/components/file-preview/file-preview-viewer.d.ts +2 -1
- package/dist/components/file-preview/file-preview.d.ts +0 -1
- package/dist/components/file-preview/index.d.ts +2 -1
- package/dist/components/file-preview/locales/en-US.d.ts +16 -0
- package/dist/components/file-preview/locales/zh-CN.d.ts +16 -0
- package/dist/components/file-preview/style.css +160 -2
- package/dist/components/file-preview/types.d.ts +34 -10
- package/dist/components/file-preview/use-file-preview-levels.d.ts +7 -0
- package/dist/components/file-preview/use-file-preview-view-state.d.ts +15 -0
- package/dist/components/file-preview.js +1 -1
- package/dist/components/file-tree/file-tree-info-labels.d.ts +0 -15
- package/dist/components/file-tree/file-tree-labels.d.ts +4 -0
- package/dist/components/file-tree/file-tree-row-shared.d.ts +2 -12
- package/dist/components/file-tree/file-tree-toolbar.d.ts +11 -0
- package/dist/components/file-tree/locales/en-US.d.ts +69 -0
- package/dist/components/file-tree/locales/zh-CN.d.ts +69 -0
- package/dist/components/file-tree/style.css +143 -15
- package/dist/components/file-tree/types.d.ts +38 -10
- package/dist/components/file-tree/use-file-tree-actions.d.ts +4 -1
- package/dist/components/scope-switcher/labels.d.ts +3 -0
- package/dist/components/scope-switcher/locales/en-US.d.ts +8 -0
- package/dist/components/scope-switcher/locales/zh-CN.d.ts +8 -0
- package/dist/components/scope-switcher/scope-panel.d.ts +1 -1
- package/dist/components/scope-switcher/scope-switcher.d.ts +2 -2
- package/dist/components/scope-switcher/style.css +14 -2
- package/dist/components/scope-switcher/types.d.ts +12 -6
- package/dist/components/style.css +10030 -6763
- package/dist/components/tui/locales/en-US.d.ts +35 -0
- package/dist/components/tui/locales/zh-CN.d.ts +35 -0
- package/dist/components/tui/style.css +310 -18
- package/dist/components/tui/tui-copy-button.d.ts +1 -1
- package/dist/components/tui/tui-empty.d.ts +25 -0
- package/dist/components/tui/tui-labels.d.ts +2 -2
- package/dist/components/tui/tui.d.ts +1 -1
- package/dist/components/tui/types.d.ts +35 -12
- package/dist/components/tui.js +1 -1
- package/dist/components/viking-bot/ark-adapter.d.ts +2 -0
- package/dist/components/viking-bot/ark-message-body.d.ts +1 -7
- package/dist/components/viking-bot/ark-message-list-view.d.ts +4 -1
- package/dist/components/viking-bot/ark-message-row.d.ts +3 -1
- package/dist/components/viking-bot/bot-popover.d.ts +9 -0
- package/dist/components/viking-bot/capabilities.d.ts +49 -0
- package/dist/components/viking-bot/composer-attachments.d.ts +13 -0
- package/dist/components/viking-bot/composer-controls.d.ts +10 -0
- package/dist/components/viking-bot/composer-footer.d.ts +17 -0
- package/dist/components/viking-bot/composer-references.d.ts +20 -0
- package/dist/components/viking-bot/composer-text.d.ts +10 -0
- package/dist/components/viking-bot/index.d.ts +3 -1
- package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +1 -1
- package/dist/components/viking-bot/interaction/labels.d.ts +2 -1
- package/dist/components/viking-bot/interaction/locales/en-US.d.ts +17 -0
- package/dist/components/viking-bot/interaction/locales/zh-CN.d.ts +17 -0
- package/dist/components/viking-bot/interaction/types.d.ts +8 -3
- package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +1 -1
- package/dist/components/viking-bot/labels.d.ts +2 -0
- package/dist/components/viking-bot/locales/en-US.d.ts +40 -0
- package/dist/components/viking-bot/locales/zh-CN.d.ts +40 -0
- package/dist/components/viking-bot/markdown-links.d.ts +27 -0
- package/dist/components/viking-bot/message-activity.d.ts +7 -0
- package/dist/components/viking-bot/message-code-block.d.ts +8 -0
- package/dist/components/viking-bot/message-footer.d.ts +8 -0
- package/dist/components/viking-bot/message-markdown.d.ts +9 -0
- package/dist/components/viking-bot/model.d.ts +37 -3
- package/dist/components/viking-bot/quick-input-tracker.d.ts +16 -0
- package/dist/components/viking-bot/quick-inputs.d.ts +6 -0
- package/dist/components/viking-bot/reference-picker.d.ts +16 -0
- package/dist/components/viking-bot/session-actions.d.ts +11 -0
- package/dist/components/viking-bot/style.css +1486 -48
- package/dist/components/viking-bot/tool-activity.d.ts +9 -0
- package/dist/components/viking-bot/tool-result-links.d.ts +6 -0
- package/dist/components/viking-bot/types.d.ts +20 -8
- package/dist/components/viking-bot/use-quick-input.d.ts +17 -0
- package/dist/components/viking-bot/viking-bot.d.ts +1 -6
- package/dist/components/viking-bot/welcome.d.ts +8 -0
- package/dist/components/viking-bot.js +1 -1
- package/dist/c~0.js +550 -69
- package/dist/e~0.js +335 -0
- package/dist/file-preview-viewer~0.js +90 -8
- package/dist/f~0.js +49 -51
- package/dist/h~0.js +5 -1
- package/dist/icons/console-icons.d.ts +12 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/viking-bot-icons.d.ts +6 -0
- package/dist/icons.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/k~0.js +1 -0
- package/dist/lg~0.js +155 -0
- package/dist/lk~0.js +40 -8
- package/dist/l~0.js +170 -181
- package/dist/modules/console/command-messages.d.ts +19 -0
- package/dist/modules/console/command-parser.d.ts +15 -0
- package/dist/modules/console/command-specs.d.ts +15 -0
- package/dist/modules/console/commands.d.ts +6 -0
- package/dist/modules/console/console-history.d.ts +10 -0
- package/dist/modules/console/console-toolbar.d.ts +18 -0
- package/dist/modules/console/console.d.ts +1 -3
- package/dist/modules/console/controller.d.ts +17 -0
- package/dist/modules/console/index.d.ts +2 -0
- package/dist/modules/console/labels.d.ts +61 -0
- package/dist/modules/console/locales/en-US.d.ts +49 -0
- package/dist/modules/console/locales/zh-CN.d.ts +3 -0
- package/dist/modules/console/localize-records.d.ts +11 -0
- package/dist/modules/console/results.d.ts +2 -0
- package/dist/modules/console/style.css +10905 -15
- package/dist/modules/console/types.d.ts +59 -80
- package/dist/modules/console/use-console.d.ts +3 -0
- package/dist/modules/console.js +1 -1
- package/dist/modules/file-browser/file-browser-detail.d.ts +2 -1
- package/dist/modules/file-browser/file-browser-labels.d.ts +11 -12
- package/dist/modules/file-browser/file-browser-toolbar.d.ts +3 -4
- package/dist/modules/file-browser/file-browser-tree-pane.d.ts +7 -5
- package/dist/modules/file-browser/file-browser.d.ts +1 -1
- package/dist/modules/file-browser/fs-read-directory.d.ts +2 -6
- package/dist/modules/file-browser/locales/en-US.d.ts +25 -0
- package/dist/modules/file-browser/locales/zh-CN.d.ts +25 -0
- package/dist/modules/file-browser/style.css +1695 -126
- package/dist/modules/file-browser/types.d.ts +38 -29
- package/dist/modules/file-browser/use-file-browser.d.ts +6 -1
- package/dist/modules/file-browser/use-fs-preview.d.ts +15 -1
- package/dist/modules/scope-cascade/labels.d.ts +6 -0
- package/dist/modules/scope-cascade/locales/en-US.d.ts +6 -0
- package/dist/modules/scope-cascade/locales/zh-CN.d.ts +3 -0
- package/dist/modules/scope-cascade/scope-cascade.d.ts +2 -2
- package/dist/modules/scope-cascade/style.css +14 -2
- package/dist/modules/scope-cascade/types.d.ts +3 -0
- package/dist/modules/style.css +15938 -3455
- package/dist/nx~0.js +15 -0
- package/dist/n~0.js +240 -83
- package/dist/o~0.js +10 -7
- package/dist/p~0.js +27 -0
- package/dist/rslib-runtime~0.js +42 -0
- package/dist/r~0.js +152 -0
- package/dist/shared/components/drawer/drawer.d.ts +13 -0
- package/dist/shared/components/drawer/index.d.ts +1 -0
- package/dist/shared/components/overlay/use-overlay-position.d.ts +2 -2
- package/dist/shared/components/tooltip/use-portal-theme.d.ts +3 -0
- package/dist/shared/locale-context.d.ts +8 -0
- package/dist/shared/locale.d.ts +6 -0
- package/dist/style.css +26339 -10577
- package/dist/u~0.js +397 -152
- package/dist/viking-bot-composer~0.js +436 -77
- package/dist/viking-bot-interaction~0.js +13 -11
- package/package.json +15 -4
- package/dist/30~0.js +0 -1332
- package/dist/components/tui/tui-labels-zh.d.ts +0 -2
- package/dist/modules/file-browser/tree-info-copy.d.ts +0 -15
- package/dist/modules/file-browser/tree-info-copy.zh-CN.d.ts +0 -15
|
@@ -1,45 +1,63 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Locale } from '../../shared/locale.js';
|
|
2
|
+
import type { ComponentPropsWithRef, HTMLAttributes, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import type { AgentConnectProps } from '../agent-connect/index.js';
|
|
2
4
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Copy of the file browser
|
|
5
|
-
* default.
|
|
5
|
+
* 文件浏览入口条与抽屉的文案。未覆盖项跟随 locale。
|
|
6
|
+
* Copy of the file browser entries and drawer. Omitted fields follow locale.
|
|
6
7
|
*/
|
|
7
8
|
export interface FileBrowserEntriesLabels {
|
|
8
9
|
/** 连接 Agent 的文案。Label of the connect-agent entry. */
|
|
9
10
|
connectAgent?: string;
|
|
10
11
|
/** 导入资源的文案。Label of the import-resources entry. */
|
|
11
12
|
importResources?: string;
|
|
13
|
+
/** 右侧接入抽屉的关闭文案。Close label of the connection drawer. */
|
|
14
|
+
close?: string;
|
|
12
15
|
}
|
|
13
16
|
/**
|
|
14
17
|
* 文件浏览入口条的属性。
|
|
15
18
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
+
* 固定两个入口:连接 Agent 与导入资源。agentConnect 可启用内置右侧接入抽屉,
|
|
20
|
+
* 也可仅通过回调接入宿主流程。宿主可包装或替换默认导入按钮。
|
|
21
|
+
* 图标、文案、等分排布与分隔线由组件负责。
|
|
19
22
|
*
|
|
20
23
|
* 只显示一个入口时不画分隔线:线分隔的是两个相邻项,只剩一个就无从分隔。
|
|
21
24
|
*
|
|
22
25
|
* Props of the file browser entry row.
|
|
23
26
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
27
|
+
* Two fixed entries: connect an agent and import resources. agentConnect enables
|
|
28
|
+
* the built-in connection drawer; callbacks also support host-owned flows.
|
|
29
|
+
* Hosts can wrap or replace the default import button. The component owns the
|
|
30
|
+
* icons, copy, equal-width layout and divider.
|
|
28
31
|
*
|
|
29
32
|
* With a single entry no divider is drawn: a divider separates two neighbours, and
|
|
30
33
|
* there is nothing left to separate.
|
|
31
34
|
*/
|
|
32
35
|
export interface FileBrowserEntriesProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
36
|
+
/** 可选文案语言;继承上层,最终默认英文。Optional locale; inherits or defaults to en-US. */
|
|
37
|
+
locale?: Locale;
|
|
33
38
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
39
|
+
* 内置 AgentConnect 右侧抽屉的参数;传入后显示连接入口。
|
|
40
|
+
* Options for the built-in AgentConnect drawer; enables the connect entry.
|
|
41
|
+
*/
|
|
42
|
+
agentConnect?: AgentConnectProps;
|
|
43
|
+
/**
|
|
44
|
+
* 点击连接入口时通知;未传 agentConnect 时由宿主处理接入。
|
|
45
|
+
* Click notification; the host owns connection when agentConnect is omitted.
|
|
36
46
|
*/
|
|
37
47
|
onConnectAgent?: () => void;
|
|
38
48
|
/**
|
|
39
|
-
*
|
|
40
|
-
* Called
|
|
49
|
+
* 默认导入按钮被点击时触发;未提供导入回调和渲染插槽时隐藏入口。
|
|
50
|
+
* Called when the default import button is clicked; omit both import props to hide it.
|
|
41
51
|
*/
|
|
42
52
|
onImportResources?: () => void;
|
|
43
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* 自定义导入入口;参数是带有图标、文案和点击回调的默认原生按钮。
|
|
55
|
+
* 传入后显示入口,返回 null 时隐藏;不传时按 onImportResources 渲染默认按钮。
|
|
56
|
+
* Renders the import entry using its default native button, including icon, label
|
|
57
|
+
* and click handler. Enables the entry; return null to hide it. When omitted,
|
|
58
|
+
* onImportResources enables the default button.
|
|
59
|
+
*/
|
|
60
|
+
renderImportResources?: (trigger: ReactElement<ComponentPropsWithRef<'button'>>) => ReactNode;
|
|
61
|
+
/** 可替换文案,未提供的项使用当前 locale 的内置文案。Replaceable copy; omitted fields follow locale. */
|
|
44
62
|
labels?: FileBrowserEntriesLabels;
|
|
45
63
|
}
|
|
@@ -20,7 +20,7 @@ import type { FileViewerCoreProps } from '@ark-design/ui/file-viewer/core';
|
|
|
20
20
|
* pulls in browser-only packages, and a top-level import would break server
|
|
21
21
|
* rendering.
|
|
22
22
|
*/
|
|
23
|
-
export declare function createFilePreviewAdapterList({ onLinkClick, }?: {
|
|
23
|
+
export declare function createFilePreviewAdapterList({ onLinkClick, resolveImage, }?: {
|
|
24
24
|
/**
|
|
25
25
|
* Markdown 正文里的链接被点击时调用。传入后由回调接管导航,底座不再自行
|
|
26
26
|
* 跳转;只有 Markdown Adapter 支持这个回调,其余格式忽略它。
|
|
@@ -30,4 +30,5 @@ export declare function createFilePreviewAdapterList({ onLinkClick, }?: {
|
|
|
30
30
|
* Markdown adapter supports this; other formats ignore it.
|
|
31
31
|
*/
|
|
32
32
|
onLinkClick?: MarkdownAdapterOptions['onLinkClick'];
|
|
33
|
+
resolveImage?: (src: string) => Promise<string>;
|
|
33
34
|
}): FileViewerCoreProps['adapters'];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Locale } from '../../shared/locale.js';
|
|
1
2
|
import type { ViewerHandle, ViewerViewModeOption } from '@ark-design/ui/file-viewer/core';
|
|
2
3
|
import type { MarkdownAdapterOptions } from '@ark-design/ui/file-viewer/adapters/markdown';
|
|
3
4
|
import type { useFilePreviewEditing } from './use-file-preview-editing.js';
|
|
@@ -5,7 +6,7 @@ import type { FilePreviewFileTab, FilePreviewLabels, FilePreviewViewMode } from
|
|
|
5
6
|
export interface FilePreviewBodyProps {
|
|
6
7
|
fileTab: FilePreviewFileTab;
|
|
7
8
|
text: Required<FilePreviewLabels>;
|
|
8
|
-
locale?:
|
|
9
|
+
locale?: Locale;
|
|
9
10
|
viewMode: FilePreviewViewMode;
|
|
10
11
|
editing: ReturnType<typeof useFilePreviewEditing>;
|
|
11
12
|
onViewModeChange: (mode: FilePreviewViewMode) => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PathSegment } from './file-preview-path.js';
|
|
2
2
|
export interface FilePreviewBreadcrumbMenuProps {
|
|
3
|
+
hiddenPathLabel: string;
|
|
3
4
|
segments: readonly PathSegment[];
|
|
4
5
|
canOpen: boolean;
|
|
5
6
|
disabled: boolean;
|
|
@@ -13,4 +14,4 @@ export interface FilePreviewBreadcrumbMenuProps {
|
|
|
13
14
|
* opens it, Escape or a press outside closes it, and because the surface renders
|
|
14
15
|
* into `body` the breadcrumb's own layout cannot clip it.
|
|
15
16
|
*/
|
|
16
|
-
export declare function FilePreviewBreadcrumbMenu({ segments, canOpen, disabled, onOpen, }: FilePreviewBreadcrumbMenuProps): import("react").JSX.Element;
|
|
17
|
+
export declare function FilePreviewBreadcrumbMenu({ hiddenPathLabel, segments, canOpen, disabled, onOpen, }: FilePreviewBreadcrumbMenuProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PathSegment } from './file-preview-path.js';
|
|
2
2
|
export interface FilePreviewBreadcrumbProps {
|
|
3
|
+
hiddenPathLabel: string;
|
|
3
4
|
segments: readonly PathSegment[];
|
|
4
5
|
title: string;
|
|
5
6
|
canOpen: boolean;
|
|
@@ -18,4 +19,4 @@ export interface FilePreviewBreadcrumbProps {
|
|
|
18
19
|
* first level, and only when even that does not fit is the first level dropped
|
|
19
20
|
* too, leaving the trailing name alone.
|
|
20
21
|
*/
|
|
21
|
-
export declare function FilePreviewBreadcrumb({ segments, title, canOpen, disabled, onOpen, }: FilePreviewBreadcrumbProps): import("react").JSX.Element;
|
|
22
|
+
export declare function FilePreviewBreadcrumb({ hiddenPathLabel, segments, title, canOpen, disabled, onOpen, }: FilePreviewBreadcrumbProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Locale } from '../../shared/locale.js';
|
|
1
2
|
import type { ViewerHandle, ViewerViewModeOption } from '@ark-design/ui/file-viewer/core';
|
|
2
3
|
import type { FilePreviewActions } from './types.js';
|
|
3
4
|
import type { useFilePreviewEditing } from './use-file-preview-editing.js';
|
|
@@ -19,7 +20,7 @@ import type { FilePreviewDirectoryTab, FilePreviewLabels, FilePreviewViewMode }
|
|
|
19
20
|
export interface FilePreviewDirectoryBodyProps {
|
|
20
21
|
tab: FilePreviewDirectoryTab;
|
|
21
22
|
text: Required<FilePreviewLabels>;
|
|
22
|
-
locale?:
|
|
23
|
+
locale?: Locale;
|
|
23
24
|
actions: FilePreviewActions;
|
|
24
25
|
editing: ReturnType<typeof useFilePreviewEditing>;
|
|
25
26
|
viewMode: FilePreviewViewMode;
|
|
@@ -7,6 +7,7 @@ export interface FilePreviewAdapterOptions {
|
|
|
7
7
|
onViewModesChange: (modes: readonly ViewerViewModeOption[]) => void;
|
|
8
8
|
/** Markdown 正文里的链接被点击时调用;传入即由宿主接管导航。 */
|
|
9
9
|
onLinkClick?: MarkdownAdapterOptions['onLinkClick'];
|
|
10
|
+
resolveImage?: (src: string) => Promise<string>;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* 给每个 Adapter 套一层:接住底座交出来的命令式句柄,并上报命中格式支持
|
|
@@ -23,4 +24,4 @@ export interface FilePreviewAdapterOptions {
|
|
|
23
24
|
* this file supports", and the component uses it to decide whether to render the
|
|
24
25
|
* preview/source switch.
|
|
25
26
|
*/
|
|
26
|
-
export declare function createFilePreviewAdapters({ onHandleChange, onViewModesChange, onLinkClick, }: FilePreviewAdapterOptions): FileViewerCoreProps['adapters'];
|
|
27
|
+
export declare function createFilePreviewAdapters({ onHandleChange, onViewModesChange, onLinkClick, resolveImage, }: FilePreviewAdapterOptions): FileViewerCoreProps['adapters'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { FilePreviewActions } from './types.js';
|
|
2
|
+
import type { FilePreviewActions, FilePreviewLevel } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* 标题行需要的最少信息。它按字段而不是按页签类型取值,文件页签与目录页签因此
|
|
5
5
|
* 共用同一条渲染路径——两者的路径行本来就一样。
|
|
@@ -20,8 +20,12 @@ export interface FilePreviewHeaderProps {
|
|
|
20
20
|
/** The header action area: a node, or a function of the actions context. */
|
|
21
21
|
slotActions?: ReactNode | ((actions: FilePreviewActions) => ReactNode);
|
|
22
22
|
actions: FilePreviewActions;
|
|
23
|
+
levels?: readonly FilePreviewLevel[];
|
|
24
|
+
levelKey?: string;
|
|
25
|
+
onLevelChange?: (key: string) => void;
|
|
23
26
|
text: {
|
|
24
27
|
copyPath: string;
|
|
28
|
+
showHiddenPath: string;
|
|
25
29
|
};
|
|
26
30
|
onOpenParent: (uri: string) => void;
|
|
27
31
|
}
|
|
@@ -40,4 +44,4 @@ export interface FilePreviewHeaderProps {
|
|
|
40
44
|
* body, download, view switch, edit) carry host product semantics and copy, and
|
|
41
45
|
* the host renders them in `slots.actions` from the `actions` context.
|
|
42
46
|
*/
|
|
43
|
-
export declare function FilePreviewHeader({ path, fileName, canOpenParent, titleExtra, slotActions, actions, text, onOpenParent, }: FilePreviewHeaderProps): import("react").JSX.Element;
|
|
47
|
+
export declare function FilePreviewHeader({ levels, levelKey, onLevelChange, path, fileName, canOpenParent, titleExtra, slotActions, actions, text, onOpenParent, }: FilePreviewHeaderProps): import("react").JSX.Element;
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import type { FilePreviewLabels } from './types.js';
|
|
2
|
-
|
|
3
|
-
* 组件内置文案,宿主可通过 `labels` 逐项覆盖。
|
|
4
|
-
*
|
|
5
|
-
* 只包含组件自己渲染的文案:复制路径按钮、加载与失败态、格式不支持、空文件
|
|
6
|
-
* 与截断提示。其余动作按钮(复制正文、下载、预览/源码切换、编辑)由宿主在
|
|
7
|
-
* `slots.actions` 里自绘,文案归宿主,这里不重复提供。
|
|
8
|
-
*
|
|
9
|
-
* Built-in copy, overridable field by field through `labels`.
|
|
10
|
-
*
|
|
11
|
-
* Only what the component renders itself: the copy-path button, loading and
|
|
12
|
-
* failure states, unsupported formats, empty files and the truncation notice.
|
|
13
|
-
* Every other action button (copy content, download, preview/source, edit) is
|
|
14
|
-
* drawn by the host in `slots.actions` and carries its own copy.
|
|
15
|
-
*/
|
|
2
|
+
import { type Locale } from '../../shared/locale.js';
|
|
16
3
|
export declare const DEFAULT_LABELS: Required<FilePreviewLabels>;
|
|
4
|
+
export declare function resolveFilePreviewLabels(locale: Locale, labels?: FilePreviewLabels): Required<FilePreviewLabels>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FilePreviewLevel } from './types.js';
|
|
2
|
+
export declare function FilePreviewLevelTabs({ levels, activeKey, disabled, onSelect, }: {
|
|
3
|
+
levels?: readonly FilePreviewLevel[];
|
|
4
|
+
activeKey?: string;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
onSelect: (key: string) => void;
|
|
7
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function imagePreviewTarget(url: string): string;
|
|
2
|
+
export declare function originalImageTarget(url: string): string;
|
|
3
|
+
type Node = {
|
|
4
|
+
type: string;
|
|
5
|
+
url?: string;
|
|
6
|
+
identifier?: string;
|
|
7
|
+
alt?: string | null;
|
|
8
|
+
title?: string | null;
|
|
9
|
+
children?: Node[];
|
|
10
|
+
};
|
|
11
|
+
/** Rewrite image nodes only. Fenced code and normal links remain untouched. */
|
|
12
|
+
export declare function preserveVikingImages(root: Node): void;
|
|
13
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Locale } from '../../shared/locale.js';
|
|
1
2
|
import type { MarkdownAdapterOptions } from '@ark-design/ui/file-viewer/adapters/markdown';
|
|
2
3
|
import type { ViewerHandle, ViewerViewModeOption } from '@ark-design/ui/file-viewer/core';
|
|
3
4
|
import type { HTMLAttributes } from 'react';
|
|
@@ -24,10 +25,12 @@ export interface FilePreviewPanelsProps {
|
|
|
24
25
|
contentTab?: FilePreviewContentTab;
|
|
25
26
|
directoryTab?: FilePreviewDirectoryTab;
|
|
26
27
|
fileTab?: FilePreviewFileTab;
|
|
28
|
+
levelKey?: string;
|
|
29
|
+
onLevelChange: (key: string) => void;
|
|
27
30
|
panelProps: HTMLAttributes<HTMLDivElement>;
|
|
28
31
|
panelClass: string;
|
|
29
32
|
text: Required<FilePreviewLabels>;
|
|
30
|
-
locale?:
|
|
33
|
+
locale?: Locale;
|
|
31
34
|
actions: ReturnType<typeof useFilePreviewActions>;
|
|
32
35
|
actionContext: FilePreviewActions;
|
|
33
36
|
editing: ReturnType<typeof useFilePreviewEditing>;
|
|
@@ -38,4 +41,4 @@ export interface FilePreviewPanelsProps {
|
|
|
38
41
|
linkClickHandler?: MarkdownAdapterOptions['onLinkClick'];
|
|
39
42
|
activeTab: FilePreviewTab;
|
|
40
43
|
}
|
|
41
|
-
export declare function FilePreviewPanels({ contentTab, directoryTab, fileTab, panelProps, panelClass, text, locale, actions, actionContext, editing, viewMode, setViewMode, onHandleChange, onViewModesChange, linkClickHandler, activeTab, }: FilePreviewPanelsProps): import("react").JSX.Element | null;
|
|
44
|
+
export declare function FilePreviewPanels({ levelKey, onLevelChange, contentTab, directoryTab, fileTab, panelProps, panelClass, text, locale, actions, actionContext, editing, viewMode, setViewMode, onHandleChange, onViewModesChange, linkClickHandler, activeTab, }: FilePreviewPanelsProps): import("react").JSX.Element | null;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { Locale } from '../../shared/locale.js';
|
|
1
2
|
import type { ViewerHandle, ViewerViewModeOption } from '@ark-design/ui/file-viewer/core';
|
|
2
3
|
import type { MarkdownAdapterOptions } from '@ark-design/ui/file-viewer/adapters/markdown';
|
|
3
4
|
import type { FilePreviewFileTab, FilePreviewLabels, FilePreviewViewMode } from './types.js';
|
|
4
5
|
export interface FilePreviewViewerProps {
|
|
5
6
|
tab: FilePreviewFileTab;
|
|
6
7
|
text: Required<FilePreviewLabels>;
|
|
7
|
-
locale?:
|
|
8
|
+
locale?: Locale;
|
|
8
9
|
viewMode: FilePreviewViewMode;
|
|
9
10
|
onViewModeChange: (mode: FilePreviewViewMode) => void;
|
|
10
11
|
onDownload: () => void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { FilePreviewComponent } from './types.js';
|
|
2
2
|
export { LoadingState } from './file-preview-state.js';
|
|
3
|
-
export type { FilePreviewActions, FilePreviewComponent, FilePreviewContentTab, FilePreviewDirectoryLevel, FilePreviewDirectoryTab, FilePreviewEditing, FilePreviewFileTab, FilePreviewFileTabSlots, FilePreviewHandle, FilePreviewHeaderSlots, FilePreviewLabels, FilePreviewOperations, FilePreviewProps, FilePreviewSource, FilePreviewTab, FilePreviewTabBase, FilePreviewViewMode, } from './types.js';
|
|
4
3
|
/**
|
|
5
4
|
* 文件预览:页签行、内容区标题行与正文组成的外壳,正文由底座按格式渲染。
|
|
6
5
|
*
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { FilePreview, LoadingState } from './file-preview.js';
|
|
2
|
+
export type * from './types.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const messages: {
|
|
2
|
+
showHiddenPath: string;
|
|
3
|
+
copyPath: string;
|
|
4
|
+
editor: string;
|
|
5
|
+
leaveEditing: string;
|
|
6
|
+
retry: string;
|
|
7
|
+
loadFailed: string;
|
|
8
|
+
saveFailed: string;
|
|
9
|
+
unsupported: string;
|
|
10
|
+
loading: string;
|
|
11
|
+
download: string;
|
|
12
|
+
fileEmpty: string;
|
|
13
|
+
noContent: string;
|
|
14
|
+
truncated: string;
|
|
15
|
+
};
|
|
16
|
+
export default messages;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const messages: {
|
|
2
|
+
showHiddenPath: string;
|
|
3
|
+
copyPath: string;
|
|
4
|
+
editor: string;
|
|
5
|
+
leaveEditing: string;
|
|
6
|
+
retry: string;
|
|
7
|
+
loadFailed: string;
|
|
8
|
+
saveFailed: string;
|
|
9
|
+
unsupported: string;
|
|
10
|
+
loading: string;
|
|
11
|
+
download: string;
|
|
12
|
+
fileEmpty: string;
|
|
13
|
+
noContent: string;
|
|
14
|
+
truncated: string;
|
|
15
|
+
};
|
|
16
|
+
export default messages;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
.ov-agent-connect, .ov-divider, .ov-file-browser, .ov-file-browser
|
|
1
|
+
.ov-directory-tour, .ov-agent-connect, .ov-console, .ov-divider, .ov-file-browser-entries, .ov-drawer, .ov-file-browser, .ov-file-preview, .ov-file-tree, .ov-module-placeholder, .ov-popover, .ov-scope-switcher, .ov-tooltip, .ov-tui, .ov-viking-bot, .ov-viking-bot__popover, .ov-viking-bot__reference-picker--mention, .ov-viking-bot__interaction {
|
|
2
|
+
--ov-ui-tour-shadow-default: 0 15px 35px #0000000d, 0 5px 15px #0000000d;
|
|
3
|
+
--ov-ui-tour-highlight-default: #5252ff14;
|
|
2
4
|
--ov-ui-primary-default: #5252ff;
|
|
3
5
|
--ov-ui-primary-hover-default: #7075ff;
|
|
4
6
|
--ov-ui-primary-active-default: #3833d2;
|
|
7
|
+
--ov-ui-primary-disabled-default: #acb4ff;
|
|
8
|
+
--ov-ui-text-on-primary-default: #fff;
|
|
5
9
|
--ov-ui-primary-light-default: #f5f7ff;
|
|
6
10
|
--ov-ui-connect-glow-warm-default: #ff952b0a;
|
|
7
11
|
--ov-ui-connect-glow-pink-default: #fb4fbc0f;
|
|
@@ -19,18 +23,21 @@
|
|
|
19
23
|
--ov-ui-bg-3-default: #f7f8fd;
|
|
20
24
|
--ov-ui-bg-4-default: #f6f7fa;
|
|
21
25
|
--ov-ui-bg-5-default: #f1f2f9;
|
|
26
|
+
--ov-ui-code-bg-default: #fbfbfc;
|
|
22
27
|
--ov-ui-status-success-default: #1f9d55;
|
|
23
28
|
--ov-ui-shadow-default: #0f172a;
|
|
29
|
+
--ov-ui-shadow-control-default: #0000000d;
|
|
24
30
|
--ov-ui-focus-default: #5252ff;
|
|
25
31
|
--ov-ui-fill-hover-default: #f1f2f9;
|
|
26
32
|
--ov-ui-status-error-default: #c43838;
|
|
27
33
|
--ov-ui-warning-default: #b26a00;
|
|
28
34
|
--ov-ui-warning-light-default: #fff0b3;
|
|
35
|
+
--ov-ui-overlay-default: #0006;
|
|
29
36
|
--ov-ui-tooltip-bg-default: #1f2329;
|
|
30
37
|
--ov-ui-tooltip-text-default: #fff;
|
|
31
38
|
}
|
|
32
39
|
|
|
33
|
-
.dark .ov-agent-connect, .dark .ov-divider, .dark .ov-file-browser, .dark .ov-file-browser
|
|
40
|
+
.dark .ov-directory-tour, .dark .ov-agent-connect, .dark .ov-console, .dark .ov-divider, .dark .ov-file-browser-entries, .dark .ov-drawer, .dark .ov-file-browser, .dark .ov-file-preview, .dark .ov-file-tree, .dark .ov-module-placeholder, .dark .ov-popover, .dark .ov-scope-switcher, .dark .ov-tooltip, .dark .ov-tui, .dark .ov-viking-bot, .dark .ov-viking-bot__popover, .dark .ov-viking-bot__reference-picker--mention, .dark .ov-viking-bot__interaction {
|
|
34
41
|
--ov-ui-primary-default: #5f5fff;
|
|
35
42
|
--ov-ui-primary-hover-default: #7075ff;
|
|
36
43
|
--ov-ui-primary-active-default: #4242ba;
|
|
@@ -56,9 +63,14 @@
|
|
|
56
63
|
--ov-ui-warning-default: #e0a04a;
|
|
57
64
|
--ov-ui-warning-light-default: #3a2f14;
|
|
58
65
|
--ov-ui-tooltip-bg-default: #2a2d33;
|
|
66
|
+
--ov-ui-overlay-default: #000000a3;
|
|
59
67
|
--ov-ui-tooltip-text-default: #f0f1f3;
|
|
60
68
|
}
|
|
61
69
|
|
|
70
|
+
.dark .ov-viking-bot {
|
|
71
|
+
--ov-ui-code-bg-default: var(--ov-ui-bg-3-default);
|
|
72
|
+
}
|
|
73
|
+
|
|
62
74
|
.ov-agent-connect {
|
|
63
75
|
--ov-ui-connect-card-default: #fbfbfc;
|
|
64
76
|
--ov-ui-connect-tabs-default: #f7f7f9;
|
|
@@ -4210,5 +4222,151 @@ button.ark-agentic-file-viewer-diff__gutter {
|
|
|
4210
4222
|
}
|
|
4211
4223
|
}
|
|
4212
4224
|
|
|
4225
|
+
.ov-file-preview {
|
|
4226
|
+
background: var(--ov-ui-file-preview-surface);
|
|
4227
|
+
color: var(--ov-ui-file-preview-text);
|
|
4228
|
+
}
|
|
4229
|
+
|
|
4230
|
+
.ov-file-preview__header {
|
|
4231
|
+
border-bottom: 0;
|
|
4232
|
+
padding: 8px;
|
|
4233
|
+
}
|
|
4234
|
+
|
|
4235
|
+
.ov-file-preview__footer {
|
|
4236
|
+
background: var(--ov-ui-color-bg-3, var(--ov-ui-bg-3-default));
|
|
4237
|
+
border: 0;
|
|
4238
|
+
justify-content: space-between;
|
|
4239
|
+
align-items: center;
|
|
4240
|
+
gap: 8px;
|
|
4241
|
+
padding: 4px 8px;
|
|
4242
|
+
display: flex;
|
|
4243
|
+
}
|
|
4244
|
+
|
|
4245
|
+
.ov-file-preview__levels--file {
|
|
4246
|
+
border-bottom: 1px solid
|
|
4247
|
+
var(--ov-ui-color-border-1, var(--ov-ui-border-1-default));
|
|
4248
|
+
flex: none;
|
|
4249
|
+
gap: 24px;
|
|
4250
|
+
min-width: 0;
|
|
4251
|
+
padding: 0 16px;
|
|
4252
|
+
display: flex;
|
|
4253
|
+
overflow-x: auto;
|
|
4254
|
+
}
|
|
4255
|
+
|
|
4256
|
+
.ov-file-preview__levels--file .ov-file-preview__level {
|
|
4257
|
+
color: var(--ov-ui-file-preview-text-muted);
|
|
4258
|
+
font: inherit;
|
|
4259
|
+
cursor: pointer;
|
|
4260
|
+
background: none;
|
|
4261
|
+
border: 0;
|
|
4262
|
+
flex: none;
|
|
4263
|
+
padding: 8px 0;
|
|
4264
|
+
position: relative;
|
|
4265
|
+
}
|
|
4266
|
+
|
|
4267
|
+
.ov-file-preview__levels--file .ov-file-preview__level[aria-pressed="true"] {
|
|
4268
|
+
color: var(--ov-ui-file-preview-accent);
|
|
4269
|
+
font-weight: 500;
|
|
4270
|
+
}
|
|
4271
|
+
|
|
4272
|
+
.ov-file-preview__levels--file .ov-file-preview__level[aria-pressed="true"]:after {
|
|
4273
|
+
content: "";
|
|
4274
|
+
background: currentColor;
|
|
4275
|
+
width: 14px;
|
|
4276
|
+
height: 2px;
|
|
4277
|
+
position: absolute;
|
|
4278
|
+
bottom: 0;
|
|
4279
|
+
left: calc(50% - 7px);
|
|
4280
|
+
}
|
|
4281
|
+
|
|
4282
|
+
.ov-file-preview__levels--file .ov-file-preview__level:disabled {
|
|
4283
|
+
opacity: .5;
|
|
4284
|
+
cursor: not-allowed;
|
|
4285
|
+
}
|
|
4286
|
+
|
|
4287
|
+
.ov-file-preview__levels--file .ov-file-preview__level:focus-visible {
|
|
4288
|
+
outline: 2px solid var(--ov-ui-file-preview-focus-ring);
|
|
4289
|
+
outline-offset: -2px;
|
|
4290
|
+
}
|
|
4291
|
+
|
|
4292
|
+
.ov-file-preview .ov-file-preview__viewer {
|
|
4293
|
+
background: var(--ov-ui-file-preview-surface);
|
|
4294
|
+
min-height: 0;
|
|
4295
|
+
color: inherit;
|
|
4296
|
+
border: 0;
|
|
4297
|
+
border-radius: 0;
|
|
4298
|
+
}
|
|
4299
|
+
|
|
4300
|
+
.ov-file-preview .ark-agentic-file-viewer-image {
|
|
4301
|
+
background: var(--ov-ui-file-preview-surface);
|
|
4302
|
+
min-height: 0;
|
|
4303
|
+
overflow: hidden;
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4306
|
+
.ov-file-preview .ark-agentic-file-viewer-image__stage {
|
|
4307
|
+
padding: 24px;
|
|
4308
|
+
overflow: hidden;
|
|
4309
|
+
}
|
|
4310
|
+
|
|
4311
|
+
.ov-file-preview .ark-agentic-file-viewer-markdown {
|
|
4312
|
+
background: var(--ov-ui-file-preview-surface);
|
|
4313
|
+
color: inherit;
|
|
4314
|
+
}
|
|
4315
|
+
|
|
4316
|
+
.ov-file-preview .ark-agentic-file-viewer-markdown__content img {
|
|
4317
|
+
object-fit: contain;
|
|
4318
|
+
max-width: 100%;
|
|
4319
|
+
height: auto;
|
|
4320
|
+
}
|
|
4321
|
+
|
|
4322
|
+
@media (width <= 480px) {
|
|
4323
|
+
.ov-file-preview__header {
|
|
4324
|
+
flex-wrap: wrap;
|
|
4325
|
+
}
|
|
4326
|
+
|
|
4327
|
+
.ov-file-preview__path-row {
|
|
4328
|
+
flex-basis: 100%;
|
|
4329
|
+
}
|
|
4330
|
+
|
|
4331
|
+
.ov-file-preview__header-actions {
|
|
4332
|
+
flex-wrap: wrap;
|
|
4333
|
+
max-width: 100%;
|
|
4334
|
+
margin-left: auto;
|
|
4335
|
+
}
|
|
4336
|
+
|
|
4337
|
+
.ov-file-preview .ark-agentic-file-viewer-image__stage {
|
|
4338
|
+
padding: 12px;
|
|
4339
|
+
}
|
|
4340
|
+
|
|
4341
|
+
.ov-file-preview .ark-agentic-file-viewer-markdown {
|
|
4342
|
+
padding: 16px;
|
|
4343
|
+
}
|
|
4344
|
+
|
|
4345
|
+
.ov-file-preview__footer {
|
|
4346
|
+
flex-wrap: wrap;
|
|
4347
|
+
}
|
|
4348
|
+
}
|
|
4349
|
+
|
|
4350
|
+
.ov-file-preview__image-frame {
|
|
4351
|
+
flex: auto;
|
|
4352
|
+
min-width: 0;
|
|
4353
|
+
min-height: 0;
|
|
4354
|
+
display: flex;
|
|
4355
|
+
position: relative;
|
|
4356
|
+
overflow: hidden;
|
|
4357
|
+
}
|
|
4358
|
+
|
|
4359
|
+
.ov-file-preview__image-size {
|
|
4360
|
+
background: var(--ov-ui-file-preview-surface);
|
|
4361
|
+
color: var(--ov-ui-file-preview-text-muted);
|
|
4362
|
+
font-variant-numeric: tabular-nums;
|
|
4363
|
+
pointer-events: none;
|
|
4364
|
+
padding: 0 2px;
|
|
4365
|
+
font-size: 12px;
|
|
4366
|
+
position: absolute;
|
|
4367
|
+
bottom: 8px;
|
|
4368
|
+
right: 8px;
|
|
4369
|
+
}
|
|
4370
|
+
|
|
4213
4371
|
|
|
4214
4372
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Locale } from '../../shared/locale.js';
|
|
1
2
|
import type { ConfirmSlotProps, DownloadSlotProps, FileViewerResource, ViewerHandle } from '@ark-design/ui/file-viewer/core';
|
|
2
3
|
import type { ComponentType, ForwardRefExoticComponent, HTMLAttributes, PropsWithoutRef, ReactNode, RefAttributes } from 'react';
|
|
3
4
|
/**
|
|
@@ -151,6 +152,15 @@ export interface FilePreviewFileTab extends FilePreviewTabBase {
|
|
|
151
152
|
* textures of a 3D model.
|
|
152
153
|
*/
|
|
153
154
|
resources?: readonly FileViewerResource[];
|
|
155
|
+
/** 可选的分级内容,宿主提供 L0/L1/L2 等视图与内容。 Optional host-supplied content levels. */
|
|
156
|
+
levels?: readonly FilePreviewLevel[];
|
|
157
|
+
/** 受控分级 key。 Controlled content-level key. */
|
|
158
|
+
activeLevelKey?: string;
|
|
159
|
+
/** Markdown 图片地址解析;宿主负责相对路径、鉴权与 URL 生命周期。
|
|
160
|
+
* Resolves Markdown images; the host owns relative paths, authentication and URL lifetime. */
|
|
161
|
+
resolveImage?: (src: string, source: FilePreviewSource) => Promise<string>;
|
|
162
|
+
/** 分级切换意图;受控时宿主更新 activeLevelKey。 Content-level selection intent. */
|
|
163
|
+
onLevelChange?: (key: string) => void;
|
|
154
164
|
/**
|
|
155
165
|
* 文件编辑配置;省略时只读。
|
|
156
166
|
* File-editing options; omit them for a read-only preview.
|
|
@@ -183,6 +193,16 @@ export interface FilePreviewFileTab extends FilePreviewTabBase {
|
|
|
183
193
|
*/
|
|
184
194
|
onOpenUri?: (uri: string) => void;
|
|
185
195
|
}
|
|
196
|
+
/** 一个资源的内容层级,使用独立 source 与资源表。 One content level with its own source and resources. */
|
|
197
|
+
export interface FilePreviewLevel {
|
|
198
|
+
key: string;
|
|
199
|
+
label: ReactNode;
|
|
200
|
+
source: FilePreviewSource;
|
|
201
|
+
resources?: readonly FileViewerResource[];
|
|
202
|
+
disabled?: boolean;
|
|
203
|
+
/** 摘要默认只读;只有明确提供此能力时才可编辑。 Summaries are read-only unless explicitly editable. */
|
|
204
|
+
editing?: FilePreviewEditing;
|
|
205
|
+
}
|
|
186
206
|
/**
|
|
187
207
|
* 展示宿主自定义内容的页签,例如看板或图谱。
|
|
188
208
|
*
|
|
@@ -264,6 +284,10 @@ export interface FilePreviewDirectoryTab extends FilePreviewTabBase {
|
|
|
264
284
|
* Initial level key when uncontrolled; the first level is selected when omitted.
|
|
265
285
|
*/
|
|
266
286
|
defaultLevelKey?: string;
|
|
287
|
+
/** 目录摘要的伴随图片资源。 Companion images shared by directory summary levels. */
|
|
288
|
+
resources?: readonly FileViewerResource[];
|
|
289
|
+
/** 宿主解析当前摘要的 Markdown 图片。 Host resolution of Markdown images in the active summary. */
|
|
290
|
+
resolveImage?: FilePreviewFileTab['resolveImage'];
|
|
267
291
|
/**
|
|
268
292
|
* 当前层级变化后触发,参数为新的层级 key。
|
|
269
293
|
* Called after the active level changes, with the new level key.
|
|
@@ -301,6 +325,8 @@ export interface FilePreviewDirectoryLevel {
|
|
|
301
325
|
* to the component for format rendering.
|
|
302
326
|
*/
|
|
303
327
|
source: FilePreviewSource;
|
|
328
|
+
/** 该级独立的伴随资源。 Companion resources specific to this level. */
|
|
329
|
+
resources?: readonly FileViewerResource[];
|
|
304
330
|
}
|
|
305
331
|
/**
|
|
306
332
|
* 文件操作的执行能力。方法返回的 Promise 完成后才触发对应的成功通知。
|
|
@@ -495,10 +521,12 @@ export interface FilePreviewFileTabSlots extends FilePreviewHeaderSlots {
|
|
|
495
521
|
downloadFallback?: ComponentType<DownloadSlotProps>;
|
|
496
522
|
}
|
|
497
523
|
/**
|
|
498
|
-
*
|
|
499
|
-
* Replaceable copy
|
|
524
|
+
* 可替换文案,组件内置中英文文案。
|
|
525
|
+
* Replaceable copy with built-in Chinese and English defaults.
|
|
500
526
|
*/
|
|
501
527
|
export interface FilePreviewLabels {
|
|
528
|
+
/** 展开折叠路径层级的无障碍名称。Accessible name for hidden path levels. */
|
|
529
|
+
showHiddenPath?: string;
|
|
502
530
|
/**
|
|
503
531
|
* 复制路径按钮的文案。这是组件自己渲染的唯一按钮——其余动作按钮由宿主在
|
|
504
532
|
* `slots.actions` 里自绘,文案也归宿主。
|
|
@@ -569,6 +597,8 @@ export interface FilePreviewProps extends Omit<HTMLAttributes<HTMLDivElement>, '
|
|
|
569
597
|
* component for format rendering or renders fully custom `content`.
|
|
570
598
|
*/
|
|
571
599
|
tabs: readonly [FilePreviewTab, ...FilePreviewTab[]];
|
|
600
|
+
/** 可选文案语言;继承上层,最终默认英文。Optional locale; inherits or defaults to en-US. */
|
|
601
|
+
locale?: Locale;
|
|
572
602
|
/**
|
|
573
603
|
* 受控的当前页签 key。传入时由宿主决定当前页签,组件只上报切换意图。
|
|
574
604
|
* The controlled active tab key. When given, the host owns the active tab and
|
|
@@ -580,20 +610,14 @@ export interface FilePreviewProps extends Omit<HTMLAttributes<HTMLDivElement>, '
|
|
|
580
610
|
* Initial tab key when uncontrolled; the first tab is selected when omitted.
|
|
581
611
|
*/
|
|
582
612
|
defaultActiveKey?: string;
|
|
583
|
-
/**
|
|
584
|
-
* 底座内置文案的语言。组件自身文案仍由 `labels` 控制。
|
|
585
|
-
* Language of the base component's built-in copy. The component's own copy is
|
|
586
|
-
* still controlled by `labels`.
|
|
587
|
-
*/
|
|
588
|
-
locale?: 'en-US' | 'zh-CN';
|
|
589
613
|
/**
|
|
590
614
|
* 当前页签变化后触发,参数为新的页签 key。
|
|
591
615
|
* Called after the active tab changes, with the new tab key.
|
|
592
616
|
*/
|
|
593
617
|
onActiveKeyChange?: (key: string) => void;
|
|
594
618
|
/**
|
|
595
|
-
*
|
|
596
|
-
* Default copy for every tab,
|
|
619
|
+
* 所有页签的默认文案,跟随 locale。页签可以逐项覆盖。
|
|
620
|
+
* Default copy for every tab, following locale. A tab can override it field
|
|
597
621
|
* by field.
|
|
598
622
|
*/
|
|
599
623
|
labels?: FilePreviewLabels;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FilePreviewTab } from './types.js';
|
|
2
|
+
/** Level data stays with the host; only the uncontrolled selection lives here. */
|
|
3
|
+
export declare function useFilePreviewLevels(selected: FilePreviewTab): {
|
|
4
|
+
tab: FilePreviewTab;
|
|
5
|
+
levelKey: string | undefined;
|
|
6
|
+
selectLevel: (key: string) => void;
|
|
7
|
+
};
|