@openviking/react 0.1.0 → 0.1.2
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 +57 -34
- package/dist/3~0.js +2117 -0
- package/dist/ark-message-list-view~0.js +310 -0
- package/dist/a~0.js +21 -0
- package/dist/c7~0.js +24 -0
- package/dist/client/client.d.ts +12 -0
- package/dist/client/errors.d.ts +30 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/options.d.ts +101 -0
- package/dist/client/provider.d.ts +52 -0
- package/dist/client/types.d.ts +160 -0
- package/dist/client.js +239 -0
- 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 +4 -1
- 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/index.d.ts +1 -0
- package/dist/components/agent-connect/style.css +503 -0
- package/dist/components/agent-connect/types.d.ts +29 -0
- package/dist/components/agent-connect.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 +27 -0
- 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-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 +25 -0
- package/dist/components/file-preview/file-preview-labels.d.ts +16 -0
- package/dist/components/file-preview/file-preview-lazy-viewer.d.ts +3 -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 +28 -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 +14 -1
- package/dist/components/file-preview/index.d.ts +1 -0
- package/dist/components/file-preview/style.css +4139 -0
- package/dist/components/file-preview/types.d.ts +516 -0
- package/dist/components/file-preview/use-file-preview-actions-context.d.ts +23 -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 +32 -0
- package/dist/components/file-preview/use-file-preview-ids.d.ts +24 -0
- package/dist/components/file-preview.js +1 -0
- package/dist/components/file-tree/file-tree-body.d.ts +18 -0
- package/dist/components/file-tree/file-tree-entry-row.d.ts +12 -0
- package/dist/components/file-tree/file-tree-icons.d.ts +15 -0
- 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 +14 -0
- package/dist/components/file-tree/file-tree-row-context.d.ts +46 -0
- package/dist/components/file-tree/file-tree-row-shared.d.ts +11 -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-tooltip.d.ts +17 -0
- package/dist/components/file-tree/file-tree.d.ts +15 -1
- package/dist/components/file-tree/index.d.ts +1 -0
- package/dist/components/file-tree/style.css +410 -0
- package/dist/components/file-tree/types.d.ts +589 -0
- package/dist/components/file-tree/use-file-tree-actions.d.ts +17 -0
- package/dist/components/file-tree.js +1 -0
- package/dist/components/scope-switcher/index.d.ts +1 -0
- package/dist/components/scope-switcher/scope-keyboard.d.ts +2 -0
- package/dist/components/scope-switcher/scope-panel.d.ts +11 -0
- package/dist/components/scope-switcher/scope-selector.d.ts +2 -0
- package/dist/components/scope-switcher/scope-switcher.d.ts +6 -1
- package/dist/components/scope-switcher/style.css +452 -0
- package/dist/components/scope-switcher/types.d.ts +489 -0
- package/dist/components/scope-switcher.js +3 -0
- package/dist/components/style.css +14249 -18
- 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/index.d.ts +1 -0
- package/dist/components/tui/style.css +1552 -0
- 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 +11 -1
- package/dist/components/tui/types.d.ts +527 -0
- 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/tui.js +1 -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/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 +7133 -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 -1
- 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 +356 -0
- package/dist/g~0.js +1207 -0
- 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 +16 -2
- package/dist/index.js +8 -1
- package/dist/k~0.js +1440 -0
- package/dist/lk~0.js +233 -0
- package/dist/l~0.js +44 -0
- package/dist/modules/console/console.d.ts +4 -0
- package/dist/modules/console/index.d.ts +1 -0
- package/dist/modules/console/style.css +111 -0
- package/dist/modules/console/types.d.ts +101 -0
- package/dist/modules/console.js +1 -0
- package/dist/modules/file-browser/file-browser-toolbar-button.d.ts +10 -0
- package/dist/modules/file-browser/file-browser.d.ts +6 -0
- package/dist/modules/file-browser/index.d.ts +1 -0
- package/dist/modules/file-browser/style.css +158 -0
- package/dist/modules/file-browser/types.d.ts +101 -0
- package/dist/modules/file-browser.js +1 -0
- package/dist/modules/scope-cascade/controller.d.ts +6 -0
- package/dist/modules/scope-cascade/index.d.ts +3 -0
- package/dist/modules/scope-cascade/scope-cascade.d.ts +3 -0
- package/dist/modules/scope-cascade/style.css +456 -0
- package/dist/modules/scope-cascade/style.js +0 -0
- package/dist/modules/scope-cascade/types.d.ts +39 -0
- package/dist/modules/scope-cascade/use-scope-cascade.d.ts +5 -0
- package/dist/modules/scope-cascade.js +1 -0
- package/dist/modules/style.css +808 -0
- package/dist/modules/style.js +0 -0
- package/dist/n~0.js +727 -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/shared/components/tooltip/use-tooltip-position.d.ts +38 -0
- package/dist/style.css +15138 -18
- package/dist/u~0.js +1601 -0
- 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 +46 -22
- package/dist/components/resource-import/resource-import.d.ts +0 -1
- package/dist/components/resource-import/style.css +0 -2
- package/dist/components/status-badge/status-badge.d.ts +0 -8
- package/dist/components/status-badge/style.css +0 -37
- package/dist/components/status-badge.js +0 -30
- /package/dist/components/{resource-import → viking-bot/interaction}/style.js +0 -0
- /package/dist/{components/status-badge → modules/console}/style.js +0 -0
- /package/dist/{components/resource-import.js → modules/file-browser/style.js} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FileViewerCoreProps, ViewerHandle, ViewerViewModeOption } from '@ark-design/ui/file-viewer/core';
|
|
2
|
+
import type { MarkdownAdapterOptions } from '@ark-design/ui/file-viewer/adapters/markdown';
|
|
3
|
+
export interface FilePreviewAdapterOptions {
|
|
4
|
+
/** 底座交出或收回命令式句柄时调用。 */
|
|
5
|
+
onHandleChange: (handle: ViewerHandle | null) => void;
|
|
6
|
+
/** 命中的 Adapter 加载完成时,上报它支持的视图模式。 */
|
|
7
|
+
onViewModesChange: (modes: readonly ViewerViewModeOption[]) => void;
|
|
8
|
+
/** Markdown 正文里的链接被点击时调用;传入即由宿主接管导航。 */
|
|
9
|
+
onLinkClick?: MarkdownAdapterOptions['onLinkClick'];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 给每个 Adapter 套一层:接住底座交出来的命令式句柄,并上报命中格式支持
|
|
13
|
+
* 的视图模式。
|
|
14
|
+
*
|
|
15
|
+
* 底座没有 forwardRef,句柄是通过渲染组件的 `registerHandle` 属性交出的;
|
|
16
|
+
* `load()` 只会对命中的那个 Adapter 调用一次,因此在这里上报视图模式就等价
|
|
17
|
+
* 于「当前文件支持哪些视图」,组件据此决定是否显示预览/源码切换。
|
|
18
|
+
*
|
|
19
|
+
* Wraps every adapter to capture the imperative handle and to report the view
|
|
20
|
+
* modes the matched format supports. The base has no forwardRef: the handle
|
|
21
|
+
* arrives through the renderer's `registerHandle` prop. `load()` runs once for
|
|
22
|
+
* the matched adapter only, so reporting there is equivalent to "which views
|
|
23
|
+
* this file supports", and the component uses it to decide whether to render the
|
|
24
|
+
* preview/source switch.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createFilePreviewAdapters({ onHandleChange, onViewModesChange, onLinkClick, }: FilePreviewAdapterOptions): FileViewerCoreProps['adapters'];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FilePreviewActions, FilePreviewFileTab } from './types.js';
|
|
2
|
+
export interface FilePreviewHeaderProps {
|
|
3
|
+
fileTab: FilePreviewFileTab;
|
|
4
|
+
actions: FilePreviewActions;
|
|
5
|
+
text: {
|
|
6
|
+
copyPath: string;
|
|
7
|
+
};
|
|
8
|
+
onOpenParent: (uri: string) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 内容区标题行:路径面包屑、复制路径与宿主提供的动作区。
|
|
12
|
+
*
|
|
13
|
+
* 复制路径是外壳的一部分——有 `source.path` 的文件在任何宿主下都需要它,因此
|
|
14
|
+
* 内置在面包屑末尾。其余动作(复制正文、下载、视图切换、编辑)依赖宿主的产品
|
|
15
|
+
* 语义与文案,由宿主在 `slots.actions` 里用 `actions` 上下文自行渲染。
|
|
16
|
+
*
|
|
17
|
+
* The content header: the path breadcrumb, copy-path, and a host-supplied action
|
|
18
|
+
* area.
|
|
19
|
+
*
|
|
20
|
+
* Copy-path belongs to the shell — any file with a `source.path` needs it under
|
|
21
|
+
* every host — so it sits at the end of the breadcrumb. The other actions (copy
|
|
22
|
+
* body, download, view switch, edit) carry host product semantics and copy, and
|
|
23
|
+
* the host renders them in `slots.actions` from the `actions` context.
|
|
24
|
+
*/
|
|
25
|
+
export declare function FilePreviewHeader({ fileTab, actions, text, onOpenParent, }: FilePreviewHeaderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
*/
|
|
16
|
+
export declare const DEFAULT_LABELS: Required<FilePreviewLabels>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface PathSegment {
|
|
2
|
+
/** 该段的展示文本,不含协议前缀。 */
|
|
3
|
+
label: string;
|
|
4
|
+
/** 点击该段时要打开的完整 URI。 */
|
|
5
|
+
uri: string;
|
|
6
|
+
/** 是否首段,渲染时在它前面补上协议前缀。 */
|
|
7
|
+
isFirst: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 把完整路径拆成可逐级打开的祖先段,最后一段(文件名)不包含在内。
|
|
11
|
+
*
|
|
12
|
+
* 带协议前缀时首段带 `isFirst` 标记,渲染时补上前缀:`viking://a/b/c.md` 拆成
|
|
13
|
+
* `a`、`b`,首段显示为 `viking://a`。
|
|
14
|
+
*
|
|
15
|
+
* 绝对路径(`/a/b/c.md`)保留开头的斜杠:丢掉它祖先会变成相对路径 `a`、
|
|
16
|
+
* `a/b`,宿主按相对路径解析就跳到了错误的目录。相对路径(`a/b/c.md`)保持
|
|
17
|
+
* 原样,不加斜杠。
|
|
18
|
+
*
|
|
19
|
+
* Splits a full path into the ancestor levels that can be opened one by one,
|
|
20
|
+
* excluding the trailing file name. The first segment carries `isFirst` so the
|
|
21
|
+
* renderer can prepend the scheme: `viking://a/b/c.md` yields `a` and `b`, the
|
|
22
|
+
* first rendering as `viking://a`.
|
|
23
|
+
*
|
|
24
|
+
* An absolute path (`/a/b/c.md`) keeps its leading slash: dropping it turns the
|
|
25
|
+
* ancestors into relative paths (`a`, `a/b`) that a host resolves against the
|
|
26
|
+
* wrong directory. A relative path (`a/b/c.md`) is left as-is with no slash added.
|
|
27
|
+
*/
|
|
28
|
+
export declare function splitPathSegments(path?: string): PathSegment[];
|
|
29
|
+
/** 取路径里的文件名,用于面包屑末段与标题回落。 */
|
|
30
|
+
export declare function getPathFileName(path?: string): string | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FileSource } from '@ark-design/ui/file-viewer';
|
|
2
|
+
import type { FilePreviewSource } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* 把宿主的 `source` 映射成底座的 `FileSource`,按 `content`、`file`、`url`
|
|
5
|
+
* 的顺序取第一个有值的来源。都没有时返回 `undefined`,由组件渲染不支持态。
|
|
6
|
+
*
|
|
7
|
+
* Maps the host `source` onto the base `FileSource`, taking the first available
|
|
8
|
+
* of `content`, `file` and `url`. Returns `undefined` when none is present, and
|
|
9
|
+
* the component then renders the unsupported state.
|
|
10
|
+
*/
|
|
11
|
+
export declare function toFileSource(source: FilePreviewSource): FileSource | undefined;
|
|
12
|
+
/** 取页签上可用于复制的正文;拿不到时返回 `undefined`。 */
|
|
13
|
+
export declare function readCopyableText(source: FilePreviewSource): string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* 判断文件是否为严格空文件。
|
|
16
|
+
*
|
|
17
|
+
* 只把长度为 0 视为空文件;空白字符组成的文件有内容但无可见文本,属于
|
|
18
|
+
* 「暂无内容」,两者提示不同,不能合并成 `trim()` 判断。
|
|
19
|
+
*
|
|
20
|
+
* Whether the file itself is empty. Only a zero-length body counts as empty; a
|
|
21
|
+
* body made of whitespace has content but nothing visible, which is a different
|
|
22
|
+
* message. The two must not be merged into a `trim()` check.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isEmptyFile(source: FilePreviewSource): boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FilePreviewLabels } from './types.js';
|
|
2
|
+
/** 空文件态:严格长度为 0。The empty-file state, for a strictly zero-length body. */
|
|
3
|
+
export declare function EmptyFileState({ text, }: {
|
|
4
|
+
text: Required<FilePreviewLabels>;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
|
+
/** 无可见内容态:正文存在但没有可渲染的文本。 */
|
|
7
|
+
export declare function NoContentState({ text, }: {
|
|
8
|
+
text: Required<FilePreviewLabels>;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
|
+
/** 加载态。A loading state. */
|
|
11
|
+
export declare function LoadingState({ text }: {
|
|
12
|
+
text: Required<FilePreviewLabels>;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
/** 读取失败态,带重试入口。A read-failure state with a retry entry. */
|
|
15
|
+
export declare function LoadFailedState({ text, description, onRetry, }: {
|
|
16
|
+
text: Required<FilePreviewLabels>;
|
|
17
|
+
description?: string;
|
|
18
|
+
onRetry?: () => void;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
20
|
+
/** 格式不支持态,带下载入口。An unsupported-format state with a download entry. */
|
|
21
|
+
export declare function UnsupportedState({ text, onDownload, }: {
|
|
22
|
+
text: Required<FilePreviewLabels>;
|
|
23
|
+
onDownload?: () => void;
|
|
24
|
+
}): import("react").JSX.Element;
|
|
25
|
+
/** 正文被截断时的提示,固定在正文下方。 */
|
|
26
|
+
export declare function TruncatedNotice({ text, }: {
|
|
27
|
+
text: Required<FilePreviewLabels>;
|
|
28
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FilePreviewTab } from './types.js';
|
|
2
|
+
export interface FilePreviewTabRowProps {
|
|
3
|
+
tabs: readonly FilePreviewTab[];
|
|
4
|
+
activeKey: string;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
/** 按 key 生成页签的 DOM id,带实例前缀避免多实例重复。 */
|
|
7
|
+
tabId: (key: string) => string;
|
|
8
|
+
/** 按 key 生成面板的 DOM id,与 `tabId` 同源。 */
|
|
9
|
+
panelId: (key: string) => string;
|
|
10
|
+
onSelect: (key: string) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 页签行:文件夹卡片式页签,选中页签与内容区连成一体。
|
|
14
|
+
* The tab row: folder-style tabs where the selected one joins the content area.
|
|
15
|
+
*/
|
|
16
|
+
export declare function FilePreviewTabRow({ tabs, activeKey, disabled, tabId, panelId, onSelect, }: FilePreviewTabRowProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ViewerHandle, ViewerViewModeOption } from '@ark-design/ui/file-viewer/core';
|
|
2
|
+
import type { MarkdownAdapterOptions } from '@ark-design/ui/file-viewer/adapters/markdown';
|
|
3
|
+
import type { FilePreviewFileTab, FilePreviewLabels, FilePreviewViewMode } from './types.js';
|
|
4
|
+
export interface FilePreviewViewerProps {
|
|
5
|
+
tab: FilePreviewFileTab;
|
|
6
|
+
text: Required<FilePreviewLabels>;
|
|
7
|
+
locale?: 'en-US' | 'zh-CN';
|
|
8
|
+
viewMode: FilePreviewViewMode;
|
|
9
|
+
onViewModeChange: (mode: FilePreviewViewMode) => void;
|
|
10
|
+
onDownload: () => void;
|
|
11
|
+
onHandleChange: (handle: ViewerHandle | null) => void;
|
|
12
|
+
onViewModesChange: (modes: readonly ViewerViewModeOption[]) => void;
|
|
13
|
+
/** Markdown 正文里的链接被点击时调用;传入即由宿主接管导航。 */
|
|
14
|
+
onLinkClick?: MarkdownAdapterOptions['onLinkClick'];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 文件页签的正文:把宿主的 `source` 交给底座按格式渲染。
|
|
18
|
+
*
|
|
19
|
+
* `toolbar` 恒为 `false`,外壳全部由组件渲染;兜底态通过 `slots` 换成组件
|
|
20
|
+
* 自己的文案,底座只负责格式路由、渲染器按需加载与准入。
|
|
21
|
+
*
|
|
22
|
+
* 本模块会静态引入底座,只能由懒加载入口引用,见 `file-preview-body.tsx`。
|
|
23
|
+
*
|
|
24
|
+
* The body of a file tab: hands the host `source` to the base component for
|
|
25
|
+
* format rendering. `toolbar` stays `false` because the component renders the
|
|
26
|
+
* whole shell, and the fallback states are replaced through `slots` so the copy
|
|
27
|
+
* comes from this component. The base keeps format routing, on-demand renderer
|
|
28
|
+
* loading and admission. This module statically imports the base, so only the
|
|
29
|
+
* lazy entry may reference it; see `file-preview-body.tsx`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function FilePreviewViewer({ tab, text, locale, viewMode, onViewModeChange, onDownload, onHandleChange, onViewModesChange, onLinkClick, }: FilePreviewViewerProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | Iterable<import("react").ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined>;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import type { FilePreviewComponent } from './types.js';
|
|
2
|
+
export type { FilePreviewActions, FilePreviewComponent, FilePreviewContentTab, FilePreviewEditing, FilePreviewFileTab, FilePreviewFileTabSlots, FilePreviewHandle, FilePreviewHeaderSlots, FilePreviewLabels, FilePreviewOperations, FilePreviewProps, FilePreviewSource, FilePreviewTab, FilePreviewTabBase, FilePreviewViewMode, } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* 文件预览:页签行、内容区标题行与正文组成的外壳,正文由底座按格式渲染。
|
|
5
|
+
*
|
|
6
|
+
* 文件页签的正文交给 `FileViewerCore`,内容页签的正文由宿主原样渲染。空文件、
|
|
7
|
+
* 截断与编辑态由组件自己处理,不经过底座。
|
|
8
|
+
*
|
|
9
|
+
* File preview: a shell of tab row, content header and body, where the body is
|
|
10
|
+
* rendered by the base component according to the format. A file tab hands its
|
|
11
|
+
* body to `FileViewerCore`; a content tab renders the host node as-is. Empty
|
|
12
|
+
* files, truncation and editing are handled by this component, not the base.
|
|
13
|
+
*/
|
|
14
|
+
export declare const FilePreview: FilePreviewComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './file-preview.js';
|