@openviking/react 0.1.2 → 0.1.4
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 +25 -15
- package/dist/0~0.js +19 -0
- package/dist/2~0.js +2360 -0
- package/dist/2~0.js.LICENSE.txt +23 -0
- package/dist/3c~0.js +2206 -0
- package/dist/3~0.js +1205 -1982
- package/dist/4~0.js +18 -0
- package/dist/9~0.js +43 -0
- package/dist/ae~0.js +487 -0
- package/dist/ark-message-list-view~0.js +530 -119
- package/dist/a~0.js +1289 -10
- package/dist/c7~0.js +38 -2
- package/dist/ck~0.js +23 -0
- package/dist/client/index.d.ts +2 -1
- package/dist/client/paths.d.ts +64 -0
- package/dist/client/provider.d.ts +5 -3
- 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 +109 -5
- package/dist/client.js +2 -239
- package/dist/components/agent-connect/agent-connect-copy.d.ts +19 -33
- package/dist/components/agent-connect/agent-connect-design.d.ts +1935 -167
- package/dist/components/agent-connect/agent-connect-instructions.d.ts +135 -0
- package/dist/components/agent-connect/locales/en-US.d.ts +20 -0
- package/dist/components/agent-connect/locales/zh-CN.d.ts +3 -0
- package/dist/components/agent-connect/style.css +14 -2
- package/dist/components/agent-connect/types.d.ts +2 -1
- 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 +42 -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-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/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 +905 -0
- package/dist/components/file-browser-entries/style.js +0 -0
- package/dist/components/file-browser-entries/types.d.ts +63 -0
- package/dist/components/file-browser-entries.js +1 -0
- 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 +33 -0
- package/dist/components/file-preview/file-preview-handle-adapters.d.ts +2 -1
- package/dist/components/file-preview/file-preview-header.d.ts +25 -3
- 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 +44 -0
- package/dist/components/file-preview/file-preview-state.d.ts +10 -3
- package/dist/components/file-preview/file-preview-viewer.d.ts +2 -1
- package/dist/components/file-preview/file-preview.d.ts +1 -1
- package/dist/components/file-preview/index.d.ts +2 -1
- package/dist/components/file-preview/level-selection.d.ts +25 -0
- 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 +234 -3
- package/dist/components/file-preview/types.d.ts +134 -11
- package/dist/components/file-preview/use-directory-level.d.ts +30 -0
- package/dist/components/file-preview/use-file-preview-actions-context.d.ts +6 -2
- package/dist/components/file-preview/use-file-preview-actions.d.ts +1 -1
- 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-info-tooltip.d.ts +7 -7
- package/dist/components/file-tree/file-tree-labels.d.ts +4 -0
- package/dist/components/file-tree/file-tree-row-context.d.ts +0 -5
- package/dist/components/file-tree/file-tree-row-shared.d.ts +1 -4
- package/dist/components/file-tree/file-tree-toolbar.d.ts +11 -0
- package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +8 -8
- 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 +207 -42
- package/dist/components/file-tree/types.d.ts +58 -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 +1 -1
- package/dist/components/scope-switcher/style.css +14 -2
- package/dist/components/scope-switcher/types.d.ts +11 -5
- package/dist/components/style.css +10144 -6840
- 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 +1 -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 +21 -9
- 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 +533 -66
- package/dist/e~0.js +333 -0
- package/dist/file-preview-viewer~0.js +90 -8
- package/dist/f~0.js +39 -47
- 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 +4 -0
- package/dist/index.js +3 -1
- package/dist/k~0.js +1 -0
- package/dist/lg~0.js +155 -0
- package/dist/lk~0.js +37 -8
- package/dist/l~0.js +1447 -25
- 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-icons.d.ts +10 -0
- package/dist/modules/file-browser/file-browser-detail.d.ts +34 -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 +27 -0
- package/dist/modules/file-browser/file-browser-layout.d.ts +27 -0
- package/dist/modules/file-browser/file-browser-toolbar.d.ts +17 -0
- package/dist/modules/file-browser/file-browser-tree-pane.d.ts +32 -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 +16 -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/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 +6388 -41
- package/dist/modules/file-browser/types.d.ts +206 -52
- package/dist/modules/file-browser/use-container-width.d.ts +17 -0
- package/dist/modules/file-browser/use-file-browser.d.ts +54 -0
- package/dist/modules/file-browser/use-fs-preview.d.ts +65 -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/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 +1 -1
- package/dist/modules/scope-cascade/style.css +14 -2
- package/dist/modules/scope-cascade/types.d.ts +3 -0
- package/dist/modules/style.css +17338 -77
- package/dist/nx~0.js +15 -0
- package/dist/n~0.js +403 -144
- package/dist/o~0.js +106 -0
- 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/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/drawer/drawer.d.ts +13 -0
- package/dist/shared/components/drawer/index.d.ts +1 -0
- package/dist/shared/components/overlay/types.d.ts +7 -0
- package/dist/shared/components/{tooltip/use-tooltip-position.d.ts → overlay/use-overlay-position.d.ts} +6 -6
- 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/types.d.ts +5 -5
- package/dist/shared/components/tooltip/use-portal-theme.d.ts +3 -0
- package/dist/shared/locale.d.ts +6 -0
- package/dist/style.css +27753 -7176
- package/dist/u~0.js +75 -58
- package/dist/viking-bot-composer~0.js +434 -77
- package/dist/viking-bot-interaction~0.js +11 -11
- package/package.json +18 -4
- package/dist/components/file-tree/file-tree-tooltip.d.ts +0 -17
- package/dist/components/tui/tui-labels-zh.d.ts +0 -2
- package/dist/g~0.js +0 -1207
- package/dist/modules/file-browser/file-browser-toolbar-button.d.ts +0 -10
|
File without changes
|
|
@@ -0,0 +1,63 @@
|
|
|
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';
|
|
4
|
+
/**
|
|
5
|
+
* 文件浏览入口条与抽屉的文案。未覆盖项跟随 locale。
|
|
6
|
+
* Copy of the file browser entries and drawer. Omitted fields follow locale.
|
|
7
|
+
*/
|
|
8
|
+
export interface FileBrowserEntriesLabels {
|
|
9
|
+
/** 连接 Agent 的文案。Label of the connect-agent entry. */
|
|
10
|
+
connectAgent?: string;
|
|
11
|
+
/** 导入资源的文案。Label of the import-resources entry. */
|
|
12
|
+
importResources?: string;
|
|
13
|
+
/** 右侧接入抽屉的关闭文案。Close label of the connection drawer. */
|
|
14
|
+
close?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 文件浏览入口条的属性。
|
|
18
|
+
*
|
|
19
|
+
* 固定两个入口:连接 Agent 与导入资源。agentConnect 可启用内置右侧接入抽屉,
|
|
20
|
+
* 也可仅通过回调接入宿主流程。宿主可包装或替换默认导入按钮。
|
|
21
|
+
* 图标、文案、等分排布与分隔线由组件负责。
|
|
22
|
+
*
|
|
23
|
+
* 只显示一个入口时不画分隔线:线分隔的是两个相邻项,只剩一个就无从分隔。
|
|
24
|
+
*
|
|
25
|
+
* Props of the file browser entry row.
|
|
26
|
+
*
|
|
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.
|
|
31
|
+
*
|
|
32
|
+
* With a single entry no divider is drawn: a divider separates two neighbours, and
|
|
33
|
+
* there is nothing left to separate.
|
|
34
|
+
*/
|
|
35
|
+
export interface FileBrowserEntriesProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
36
|
+
/** 内置中英文文案的语言。Language of the built-in interface copy. */
|
|
37
|
+
locale: Locale;
|
|
38
|
+
/**
|
|
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.
|
|
46
|
+
*/
|
|
47
|
+
onConnectAgent?: () => void;
|
|
48
|
+
/**
|
|
49
|
+
* 默认导入按钮被点击时触发;未提供导入回调和渲染插槽时隐藏入口。
|
|
50
|
+
* Called when the default import button is clicked; omit both import props to hide it.
|
|
51
|
+
*/
|
|
52
|
+
onImportResources?: () => void;
|
|
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. */
|
|
62
|
+
labels?: FileBrowserEntriesLabels;
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FileBrowserEntries } from "../2~0.js";
|
|
@@ -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;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Locale } from '../../shared/locale.js';
|
|
2
|
+
import type { ViewerHandle, ViewerViewModeOption } from '@ark-design/ui/file-viewer/core';
|
|
3
|
+
import type { FilePreviewActions } from './types.js';
|
|
4
|
+
import type { useFilePreviewEditing } from './use-file-preview-editing.js';
|
|
5
|
+
import type { FilePreviewDirectoryTab, FilePreviewLabels, FilePreviewViewMode } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* 目录页签的正文:标题行之下多一层同级视图切换(L0 摘要 / L1 总览),每一级
|
|
8
|
+
* 各自是一份 Markdown,走与文件页签相同的渲染路径。
|
|
9
|
+
*
|
|
10
|
+
* 这一层属于目录这种实体:文件没有同级视图可切,给它加同样的插槽只会留一个
|
|
11
|
+
* 永远空着的位置。
|
|
12
|
+
*
|
|
13
|
+
* The body of a directory tab: one extra level of sibling switching between
|
|
14
|
+
* summary levels (L0 / L1) under the header, each level its own Markdown going
|
|
15
|
+
* through the same rendering path as a file tab.
|
|
16
|
+
*
|
|
17
|
+
* That level belongs to the directory entity: a file has no sibling views to
|
|
18
|
+
* switch, so giving it the same slot would only leave a permanently empty space.
|
|
19
|
+
*/
|
|
20
|
+
export interface FilePreviewDirectoryBodyProps {
|
|
21
|
+
tab: FilePreviewDirectoryTab;
|
|
22
|
+
text: Required<FilePreviewLabels>;
|
|
23
|
+
locale?: Locale;
|
|
24
|
+
actions: FilePreviewActions;
|
|
25
|
+
editing: ReturnType<typeof useFilePreviewEditing>;
|
|
26
|
+
viewMode: FilePreviewViewMode;
|
|
27
|
+
onViewModeChange: (mode: FilePreviewViewMode) => void;
|
|
28
|
+
onHandleChange: (handle: ViewerHandle | null) => void;
|
|
29
|
+
onViewModesChange: (modes: readonly ViewerViewModeOption[]) => void;
|
|
30
|
+
onDownload: () => void;
|
|
31
|
+
onCancelEditing: () => void;
|
|
32
|
+
}
|
|
33
|
+
export declare function FilePreviewDirectoryBody({ tab, text, locale, actions, editing, viewMode, onViewModeChange, onHandleChange, onViewModesChange, onDownload, onCancelEditing, }: FilePreviewDirectoryBodyProps): import("react").JSX.Element | null;
|
|
@@ -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,9 +1,31 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { FilePreviewActions, FilePreviewLevel } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* 标题行需要的最少信息。它按字段而不是按页签类型取值,文件页签与目录页签因此
|
|
5
|
+
* 共用同一条渲染路径——两者的路径行本来就一样。
|
|
6
|
+
*
|
|
7
|
+
* The least a header needs. It reads fields rather than a tab kind, so a file tab
|
|
8
|
+
* and a directory tab share one rendering path — their path rows are the same.
|
|
9
|
+
*/
|
|
2
10
|
export interface FilePreviewHeaderProps {
|
|
3
|
-
|
|
11
|
+
/** 完整路径,显示为面包屑;省略时面包屑退化为文件名。 */
|
|
12
|
+
path?: string;
|
|
13
|
+
/** 无路径时回落到文件名。Falls back to the file name when there is no path. */
|
|
14
|
+
fileName: string;
|
|
15
|
+
/** 能否沿路径向上打开。Whether an ancestor can be opened. */
|
|
16
|
+
canOpenParent: boolean;
|
|
17
|
+
/** 标题旁的额外内容。Extra content next to the title. */
|
|
18
|
+
titleExtra?: ReactNode;
|
|
19
|
+
/** 标题行动作区,节点或接收上下文的函数。 */
|
|
20
|
+
/** The header action area: a node, or a function of the actions context. */
|
|
21
|
+
slotActions?: ReactNode | ((actions: FilePreviewActions) => ReactNode);
|
|
4
22
|
actions: FilePreviewActions;
|
|
23
|
+
levels?: readonly FilePreviewLevel[];
|
|
24
|
+
levelKey?: string;
|
|
25
|
+
onLevelChange?: (key: string) => void;
|
|
5
26
|
text: {
|
|
6
27
|
copyPath: string;
|
|
28
|
+
showHiddenPath: string;
|
|
7
29
|
};
|
|
8
30
|
onOpenParent: (uri: string) => void;
|
|
9
31
|
}
|
|
@@ -22,4 +44,4 @@ export interface FilePreviewHeaderProps {
|
|
|
22
44
|
* body, download, view switch, edit) carry host product semantics and copy, and
|
|
23
45
|
* the host renders them in `slots.actions` from the `actions` context.
|
|
24
46
|
*/
|
|
25
|
-
export declare function FilePreviewHeader({
|
|
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 {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Locale } from '../../shared/locale.js';
|
|
2
|
+
import type { MarkdownAdapterOptions } from '@ark-design/ui/file-viewer/adapters/markdown';
|
|
3
|
+
import type { ViewerHandle, ViewerViewModeOption } from '@ark-design/ui/file-viewer/core';
|
|
4
|
+
import type { HTMLAttributes } from 'react';
|
|
5
|
+
import type { useFilePreviewActions } from './use-file-preview-actions.js';
|
|
6
|
+
import type { FilePreviewActions } from './types.js';
|
|
7
|
+
import type { useFilePreviewEditing } from './use-file-preview-editing.js';
|
|
8
|
+
import type { FilePreviewContentTab, FilePreviewDirectoryTab, FilePreviewFileTab, FilePreviewLabels, FilePreviewTab, FilePreviewViewMode } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* 页签正文的三种渲染分支:内容页签整块交给宿主,目录页签多一层摘要切换,文件
|
|
11
|
+
* 页签走底座。
|
|
12
|
+
*
|
|
13
|
+
* 单独成文件是因为三条分支的参数加起来让主组件超出了行数上限;分支本身仍是
|
|
14
|
+
* 主组件的一次渲染,没有引入新的状态。
|
|
15
|
+
*
|
|
16
|
+
* The three ways a tab body renders: a content tab hands the whole body to the
|
|
17
|
+
* host, a directory tab adds one summary-switching layer, and a file tab goes
|
|
18
|
+
* through the base component.
|
|
19
|
+
*
|
|
20
|
+
* It lives in its own file because the three branches' parameters pushed the main
|
|
21
|
+
* component past the line limit; it is still one render of that component and
|
|
22
|
+
* introduces no state of its own.
|
|
23
|
+
*/
|
|
24
|
+
export interface FilePreviewPanelsProps {
|
|
25
|
+
contentTab?: FilePreviewContentTab;
|
|
26
|
+
directoryTab?: FilePreviewDirectoryTab;
|
|
27
|
+
fileTab?: FilePreviewFileTab;
|
|
28
|
+
levelKey?: string;
|
|
29
|
+
onLevelChange: (key: string) => void;
|
|
30
|
+
panelProps: HTMLAttributes<HTMLDivElement>;
|
|
31
|
+
panelClass: string;
|
|
32
|
+
text: Required<FilePreviewLabels>;
|
|
33
|
+
locale?: Locale;
|
|
34
|
+
actions: ReturnType<typeof useFilePreviewActions>;
|
|
35
|
+
actionContext: FilePreviewActions;
|
|
36
|
+
editing: ReturnType<typeof useFilePreviewEditing>;
|
|
37
|
+
viewMode: FilePreviewViewMode;
|
|
38
|
+
setViewMode: (mode: FilePreviewViewMode) => void;
|
|
39
|
+
onHandleChange: (handle: ViewerHandle | null) => void;
|
|
40
|
+
onViewModesChange: (modes: readonly ViewerViewModeOption[]) => void;
|
|
41
|
+
linkClickHandler?: MarkdownAdapterOptions['onLinkClick'];
|
|
42
|
+
activeTab: FilePreviewTab;
|
|
43
|
+
}
|
|
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;
|
|
@@ -7,9 +7,16 @@ export declare function EmptyFileState({ text, }: {
|
|
|
7
7
|
export declare function NoContentState({ text, }: {
|
|
8
8
|
text: Required<FilePreviewLabels>;
|
|
9
9
|
}): import("react").JSX.Element;
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
/**
|
|
11
|
+
* 加载态。只用到 `loading` 一条文案,因此参数收窄到这一项:宿主在正文还没
|
|
12
|
+
* 取回来时手上没有完整的一套文案,也不该为了显示加载中而编一份。
|
|
13
|
+
*
|
|
14
|
+
* A loading state. Only `loading` is read, so the parameter narrows to that one
|
|
15
|
+
* field: a host that has not received the body yet has no full copy set, and should
|
|
16
|
+
* not have to invent one just to show that something is loading.
|
|
17
|
+
*/
|
|
18
|
+
export declare function LoadingState({ text, }: {
|
|
19
|
+
text: Pick<FilePreviewLabels, 'loading'>;
|
|
13
20
|
}): import("react").JSX.Element;
|
|
14
21
|
/** 读取失败态,带重试入口。A read-failure state with a retry entry. */
|
|
15
22
|
export declare function LoadFailedState({ text, description, onRetry, }: {
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import type { FilePreviewComponent } from './types.js';
|
|
2
|
-
export
|
|
2
|
+
export { LoadingState } from './file-preview-state.js';
|
|
3
3
|
/**
|
|
4
4
|
* 文件预览:页签行、内容区标题行与正文组成的外壳,正文由底座按格式渲染。
|
|
5
5
|
*
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { FilePreview, LoadingState } from './file-preview.js';
|
|
2
|
+
export type * from './types.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 目录页签的初始层级:受控值优先,其次是非受控时记下的选择,然后是
|
|
3
|
+
* `defaultLevelKey`,最后回落到第一级。
|
|
4
|
+
*
|
|
5
|
+
* 单列成纯函数是因为它有一条容易漏掉的规则:外壳算出的 `activeLevelKey` 是受控
|
|
6
|
+
* 值,正文组件因此没有机会用上自己的初值,`defaultLevelKey` 必须在这里就被尊重,
|
|
7
|
+
* 否则宿主声明的默认层级会被静默改成第一级。
|
|
8
|
+
*
|
|
9
|
+
* The initial level of a directory tab: the controlled value first, then the choice
|
|
10
|
+
* recorded while uncontrolled, then `defaultLevelKey`, and the first level as the last
|
|
11
|
+
* resort.
|
|
12
|
+
*
|
|
13
|
+
* It is a standalone pure function because of one easily missed rule: the
|
|
14
|
+
* `activeLevelKey` the shell computes is a controlled value, so the body component never
|
|
15
|
+
* applies its own initial one — `defaultLevelKey` has to be honoured here, or the
|
|
16
|
+
* host's declared default is silently replaced by the first level.
|
|
17
|
+
*/
|
|
18
|
+
export interface LevelChoiceTab {
|
|
19
|
+
levels: readonly {
|
|
20
|
+
key: string;
|
|
21
|
+
}[];
|
|
22
|
+
activeLevelKey?: string;
|
|
23
|
+
defaultLevelKey?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function initialLevelKey(tab: LevelChoiceTab, remembered: Readonly<Record<string, string>>, tabKey: string): string;
|
|
@@ -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;
|