@openviking/react 0.1.1 → 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.
Files changed (164) hide show
  1. package/README.md +18 -15
  2. package/dist/3~0.js +2113 -4
  3. package/dist/ark-message-list-view~0.js +310 -0
  4. package/dist/c7~0.js +24 -0
  5. package/dist/components/agent-connect/agent-connect-copy.d.ts +34 -0
  6. package/dist/components/agent-connect/agent-connect-design.d.ts +1781 -0
  7. package/dist/components/agent-connect/agent-connect-detail.d.ts +13 -0
  8. package/dist/components/agent-connect/agent-connect-installer.d.ts +3 -0
  9. package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +14 -0
  10. package/dist/components/agent-connect/agent-connect-instructions.d.ts +145 -0
  11. package/dist/components/agent-connect/agent-connect-markdown.d.ts +3 -0
  12. package/dist/components/agent-connect/agent-connect.d.ts +3 -3
  13. package/dist/components/agent-connect/content-en.d.ts +137 -0
  14. package/dist/components/agent-connect/content-zh.d.ts +137 -0
  15. package/dist/components/agent-connect/style.css +495 -6
  16. package/dist/components/agent-connect/types.d.ts +20 -166
  17. package/dist/components/file-preview/file-preview-adapters.d.ts +33 -0
  18. package/dist/components/file-preview/file-preview-body.d.ts +24 -12
  19. package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +16 -0
  20. package/dist/components/file-preview/file-preview-breadcrumb.d.ts +21 -0
  21. package/dist/components/file-preview/file-preview-copy-path.d.ts +12 -0
  22. package/dist/components/file-preview/file-preview-editor.d.ts +22 -0
  23. package/dist/components/file-preview/file-preview-handle-adapters.d.ts +26 -0
  24. package/dist/components/file-preview/file-preview-header.d.ts +23 -14
  25. package/dist/components/file-preview/file-preview-labels.d.ts +15 -4
  26. package/dist/components/file-preview/file-preview-lazy-viewer.d.ts +3 -0
  27. package/dist/components/file-preview/file-preview-path.d.ts +30 -0
  28. package/dist/components/file-preview/file-preview-source.d.ts +24 -0
  29. package/dist/components/file-preview/file-preview-state.d.ts +28 -0
  30. package/dist/components/file-preview/file-preview-tab-row.d.ts +16 -0
  31. package/dist/components/file-preview/file-preview-viewer.d.ts +31 -0
  32. package/dist/components/file-preview/file-preview.d.ts +8 -11
  33. package/dist/components/file-preview/style.css +3984 -128
  34. package/dist/components/file-preview/types.d.ts +250 -169
  35. package/dist/components/file-preview/use-file-preview-actions-context.d.ts +23 -0
  36. package/dist/components/file-preview/use-file-preview-actions.d.ts +19 -0
  37. package/dist/components/file-preview/use-file-preview-editing.d.ts +21 -2
  38. package/dist/components/file-preview/use-file-preview-ids.d.ts +24 -0
  39. package/dist/components/file-preview.js +1 -442
  40. package/dist/components/file-tree/file-tree-body.d.ts +8 -4
  41. package/dist/components/file-tree/file-tree-entry-row.d.ts +9 -3
  42. package/dist/components/file-tree/file-tree-icons.d.ts +12 -5
  43. package/dist/components/file-tree/file-tree-info-labels.d.ts +21 -0
  44. package/dist/components/file-tree/file-tree-info-tooltip.d.ts +43 -0
  45. package/dist/components/file-tree/file-tree-info.d.ts +29 -0
  46. package/dist/components/file-tree/file-tree-keyboard.d.ts +8 -4
  47. package/dist/components/file-tree/file-tree-row-context.d.ts +31 -9
  48. package/dist/components/file-tree/file-tree-row-shared.d.ts +11 -0
  49. package/dist/components/file-tree/file-tree-spinner.d.ts +10 -0
  50. package/dist/components/file-tree/file-tree-state-row.d.ts +7 -0
  51. package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +22 -0
  52. package/dist/components/file-tree/file-tree-tooltip.d.ts +9 -3
  53. package/dist/components/file-tree/file-tree.d.ts +12 -1
  54. package/dist/components/file-tree/style.css +225 -57
  55. package/dist/components/file-tree/types.d.ts +183 -0
  56. package/dist/components/file-tree/use-file-tree-actions.d.ts +7 -0
  57. package/dist/components/file-tree.js +1 -1
  58. package/dist/components/scope-switcher/scope-panel.d.ts +9 -3
  59. package/dist/components/scope-switcher/scope-selector.d.ts +1 -1
  60. package/dist/components/scope-switcher/scope-switcher.d.ts +1 -1
  61. package/dist/components/scope-switcher/style.css +282 -76
  62. package/dist/components/scope-switcher/types.d.ts +230 -108
  63. package/dist/components/style.css +13845 -372
  64. package/dist/components/tui/command-catalog.d.ts +58 -0
  65. package/dist/components/tui/command-completion.d.ts +19 -0
  66. package/dist/components/tui/command-definitions.d.ts +10 -0
  67. package/dist/components/tui/command-input.d.ts +16 -0
  68. package/dist/components/tui/style.css +1543 -5
  69. package/dist/components/tui/tui-assist.d.ts +15 -0
  70. package/dist/components/tui/tui-code-block.d.ts +8 -0
  71. package/dist/components/tui/tui-command-help.d.ts +9 -0
  72. package/dist/components/tui/tui-command-text.d.ts +6 -0
  73. package/dist/components/tui/tui-composer.d.ts +24 -0
  74. package/dist/components/tui/tui-copy-button.d.ts +9 -0
  75. package/dist/components/tui/tui-input-mirror.d.ts +14 -0
  76. package/dist/components/tui/tui-labels-zh.d.ts +2 -0
  77. package/dist/components/tui/tui-labels.d.ts +5 -0
  78. package/dist/components/tui/tui-markdown-renderers.d.ts +10 -0
  79. package/dist/components/tui/tui-markdown.d.ts +6 -0
  80. package/dist/components/tui/tui-param-hint.d.ts +7 -0
  81. package/dist/components/tui/tui-record-time.d.ts +11 -0
  82. package/dist/components/tui/tui-record.d.ts +13 -0
  83. package/dist/components/tui/tui-resource-preview.d.ts +10 -0
  84. package/dist/components/tui/tui-resource-tree.d.ts +10 -0
  85. package/dist/components/tui/tui-result-header.d.ts +7 -0
  86. package/dist/components/tui/tui-result-text.d.ts +5 -0
  87. package/dist/components/tui/tui-search-list.d.ts +8 -0
  88. package/dist/components/tui/tui-skeleton.d.ts +6 -0
  89. package/dist/components/tui/tui-status-card.d.ts +7 -0
  90. package/dist/components/tui/tui-text.d.ts +10 -0
  91. package/dist/components/tui/tui-uri-text.d.ts +19 -0
  92. package/dist/components/tui/tui-write-result.d.ts +7 -0
  93. package/dist/components/tui/tui.d.ts +10 -2
  94. package/dist/components/tui/types.d.ts +57 -15
  95. package/dist/components/tui/use-tui-assist-position.d.ts +3 -0
  96. package/dist/components/tui/use-tui-completion.d.ts +14 -0
  97. package/dist/components/tui/use-tui-composer-keyboard.d.ts +25 -0
  98. package/dist/components/viking-bot/ark-adapter.d.ts +45 -0
  99. package/dist/components/viking-bot/ark-message-body.d.ts +16 -0
  100. package/dist/components/viking-bot/ark-message-list-view.d.ts +7 -0
  101. package/dist/components/viking-bot/ark-message-row.d.ts +19 -0
  102. package/dist/components/viking-bot/index.d.ts +10 -0
  103. package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +10 -0
  104. package/dist/components/viking-bot/interaction/index.d.ts +4 -0
  105. package/dist/components/viking-bot/interaction/labels.d.ts +7 -0
  106. package/dist/components/viking-bot/interaction/lazy-interaction.d.ts +3 -0
  107. package/dist/components/viking-bot/interaction/schedule-input.d.ts +13 -0
  108. package/dist/components/viking-bot/interaction/style.css +189 -0
  109. package/dist/components/viking-bot/interaction/types.d.ts +188 -0
  110. package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +9 -0
  111. package/dist/components/viking-bot/interaction.js +2 -0
  112. package/dist/components/viking-bot/labels.d.ts +2 -0
  113. package/dist/components/viking-bot/lazy-composer.d.ts +3 -0
  114. package/dist/components/viking-bot/message-groups.d.ts +12 -0
  115. package/dist/components/viking-bot/model.d.ts +252 -0
  116. package/dist/components/viking-bot/render-part.d.ts +12 -0
  117. package/dist/components/viking-bot/style.css +7135 -0
  118. package/dist/components/viking-bot/style.js +0 -0
  119. package/dist/components/viking-bot/types.d.ts +140 -0
  120. package/dist/components/viking-bot/viking-bot-composer.d.ts +6 -0
  121. package/dist/components/viking-bot/viking-bot-message-list.d.ts +3 -0
  122. package/dist/components/viking-bot/viking-bot.d.ts +16 -0
  123. package/dist/components/viking-bot.js +4 -0
  124. package/dist/c~0.js +201 -0
  125. package/dist/file-preview-viewer~0.js +191 -0
  126. package/dist/f~0.js +149 -77
  127. package/dist/g~0.js +1207 -0
  128. package/dist/h~0.js +58 -0
  129. package/dist/icons/file-type-icon.d.ts +31 -0
  130. package/dist/icons/index.d.ts +33 -23
  131. package/dist/icons/nextjs-icon.d.ts +19 -0
  132. package/dist/icons.js +1 -25
  133. package/dist/index.d.ts +2 -2
  134. package/dist/index.js +1 -1
  135. package/dist/k~0.js +1440 -0
  136. package/dist/lk~0.js +25 -12
  137. package/dist/modules/console/style.css +83 -1
  138. package/dist/modules/file-browser/style.css +89 -6
  139. package/dist/modules/scope-cascade/style.css +282 -76
  140. package/dist/modules/style.css +533 -110
  141. package/dist/n~0.js +434 -206
  142. package/dist/shared/components/tooltip/index.d.ts +1 -0
  143. package/dist/shared/components/tooltip/tooltip.d.ts +25 -0
  144. package/dist/shared/components/tooltip/types.d.ts +42 -0
  145. package/dist/shared/components/tooltip/use-tooltip-position.d.ts +38 -0
  146. package/dist/style.css +14451 -474
  147. package/dist/u~0.js +1597 -4
  148. package/dist/viking-bot-composer~0.js +164 -0
  149. package/dist/viking-bot-interaction~0.js +284 -0
  150. package/dist/w~0.js +19 -0
  151. package/package.json +18 -10
  152. package/dist/components/file-preview/file-preview-icons.d.ts +0 -2
  153. package/dist/components/file-preview/file-preview-operations.d.ts +0 -1
  154. package/dist/components/file-tree/file-tree-dom.d.ts +0 -4
  155. package/dist/components/file-tree/file-tree-labels.d.ts +0 -5
  156. package/dist/components/file-tree/file-tree-rows.d.ts +0 -12
  157. package/dist/i~0.js +0 -21
  158. package/dist/modules/task-center/columns.d.ts +0 -129
  159. package/dist/modules/task-center/index.d.ts +0 -1
  160. package/dist/modules/task-center/style.css +0 -29
  161. package/dist/modules/task-center/task-center.d.ts +0 -4
  162. package/dist/modules/task-center/types.d.ts +0 -168
  163. package/dist/modules/task-center.js +0 -1
  164. /package/dist/{modules/task-center → components/viking-bot/interaction}/style.js +0 -0
@@ -0,0 +1,33 @@
1
+ import type { MarkdownAdapterOptions } from '@ark-design/ui/file-viewer/adapters/markdown';
2
+ import type { FileViewerCoreProps } from '@ark-design/ui/file-viewer/core';
3
+ /**
4
+ * 组件内置的格式集合:文本、文档、图片与音视频。
5
+ *
6
+ * 图片是内容式 Adapter,音视频是引用式 Adapter;底座会按 Adapter 声明的读取
7
+ * 方式自动转换 `source`,宿主只需给出内容、文件或链接,不用区分。
8
+ *
9
+ * CAD 与 3D 需要额外的引擎与伴随资源,不放进公共组件。
10
+ *
11
+ * 本模块会静态引入底座,因此只能被懒加载的正文模块引用,不能进入包的顶层
12
+ * 导入链——底座会静态引入浏览器专用组件,顶层导入会破坏服务端渲染。
13
+ *
14
+ * The formats the component ships: text, documents, images and media. The image
15
+ * adapter reads content while the media adapter reads a reference; the base
16
+ * converts `source` according to the adapter's declared mode, so the host only
17
+ * supplies content, a file or a URL. CAD and 3D need extra engines and companion
18
+ * resources, so they stay out of the shared component. This module statically
19
+ * imports the base, so only the lazily loaded body may reference it: the base
20
+ * pulls in browser-only packages, and a top-level import would break server
21
+ * rendering.
22
+ */
23
+ export declare function createFilePreviewAdapterList({ onLinkClick, }?: {
24
+ /**
25
+ * Markdown 正文里的链接被点击时调用。传入后由回调接管导航,底座不再自行
26
+ * 跳转;只有 Markdown Adapter 支持这个回调,其余格式忽略它。
27
+ *
28
+ * Called when a link inside a Markdown body is clicked. Supplying it hands
29
+ * navigation to the callback and the base no longer jumps on its own. Only the
30
+ * Markdown adapter supports this; other formats ignore it.
31
+ */
32
+ onLinkClick?: MarkdownAdapterOptions['onLinkClick'];
33
+ }): FileViewerCoreProps['adapters'];
@@ -1,15 +1,27 @@
1
- import type { FilePreviewContentTab, FilePreviewFileTab, FilePreviewLabels } from './types.js';
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 { useFilePreviewEditing } from './use-file-preview-editing.js';
4
+ import type { FilePreviewFileTab, FilePreviewLabels, FilePreviewViewMode } from './types.js';
2
5
  export interface FilePreviewBodyProps {
3
- fileTab?: FilePreviewFileTab;
4
- contentTab?: FilePreviewContentTab;
6
+ fileTab: FilePreviewFileTab;
5
7
  text: Required<FilePreviewLabels>;
6
- editing: boolean;
7
- loadingEdit: boolean;
8
- editFailed: boolean;
9
- saving: boolean;
10
- saveFailed: boolean;
11
- draft: string;
12
- onDraftChange: (value: string) => void;
8
+ locale?: 'en-US' | 'zh-CN';
9
+ viewMode: FilePreviewViewMode;
10
+ editing: ReturnType<typeof useFilePreviewEditing>;
11
+ onViewModeChange: (mode: FilePreviewViewMode) => void;
12
+ onHandleChange: (handle: ViewerHandle | null) => void;
13
+ onViewModesChange: (modes: readonly ViewerViewModeOption[]) => void;
14
+ onDownload: () => void;
15
+ /** Markdown 正文里的链接被点击时调用。 */
16
+ onLinkClick?: MarkdownAdapterOptions['onLinkClick'];
17
+ /** 读取失败后退出编辑态。Leaves editing after a failed load. */
18
+ onCancelEditing: () => void;
13
19
  }
14
- /** 内容区:内容页签原样渲染,文件页签按编辑态、取正文状态与文本降级依次分支。 */
15
- export declare function FilePreviewBody({ fileTab, contentTab, text, editing, loadingEdit, editFailed, saving, saveFailed, draft, onDraftChange, }: FilePreviewBodyProps): 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> | null | undefined;
20
+ /**
21
+ * 文件页签的正文:按编辑态、空文件、底座依次短路。内容页签不走这里——它的
22
+ * 正文整块由宿主渲染。
23
+ *
24
+ * The body of a file tab: it short-circuits through editing, empty file and then
25
+ * the base component. A content tab never reaches this — its body is the host's.
26
+ */
27
+ export declare function FilePreviewBody({ fileTab, text, locale, viewMode, editing, onViewModeChange, onHandleChange, onViewModesChange, onDownload, onLinkClick, onCancelEditing, }: FilePreviewBodyProps): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import type { PathSegment } from './file-preview-path.js';
2
+ export interface FilePreviewBreadcrumbMenuProps {
3
+ segments: readonly PathSegment[];
4
+ canOpen: boolean;
5
+ disabled: boolean;
6
+ onOpen: (uri: string) => void;
7
+ }
8
+ /**
9
+ * 折叠层级的菜单。用 Tooltip 的 `click` 形态承载:点击「…」展开,按 Esc 或
10
+ * 点外部关闭,浮层渲染到 body,因此不受面包屑容器的布局约束。
11
+ *
12
+ * The menu of collapsed levels, carried by Tooltip's `click` shape: clicking "…"
13
+ * opens it, Escape or a press outside closes it, and because the surface renders
14
+ * into `body` the breadcrumb's own layout cannot clip it.
15
+ */
16
+ export declare function FilePreviewBreadcrumbMenu({ segments, canOpen, disabled, onOpen, }: FilePreviewBreadcrumbMenuProps): import("react").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import type { PathSegment } from './file-preview-path.js';
2
+ export interface FilePreviewBreadcrumbProps {
3
+ segments: readonly PathSegment[];
4
+ title: string;
5
+ canOpen: boolean;
6
+ disabled: boolean;
7
+ onOpen: (uri: string) => void;
8
+ }
9
+ /**
10
+ * 路径面包屑:祖先逐段可点,放不下时按「保两端、缩中间」折叠。
11
+ *
12
+ * 折叠顺序与内部版一致:先保留首段与末段,从紧邻首段的那一级开始逐级收进
13
+ * 「…」;中间全部收起后仍放不下,才连首段一起收起,只留末段。
14
+ *
15
+ * Path breadcrumb: every ancestor is clickable, and overflow collapses by keeping
16
+ * both ends and shrinking the middle. The first level and the trailing name stay
17
+ * as long as possible; ancestors are folded into a "…" menu starting next to the
18
+ * first level, and only when even that does not fit is the first level dropped
19
+ * too, leaving the trailing name alone.
20
+ */
21
+ export declare function FilePreviewBreadcrumb({ segments, title, canOpen, disabled, onOpen, }: FilePreviewBreadcrumbProps): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 路径旁的复制按钮。有 `source.path` 的文件在任何宿主下都需要它,因此内置在
3
+ * 外壳里,而不是交给宿主渲染。
4
+ *
5
+ * The copy-path button beside the path. Any file with a `source.path` needs it
6
+ * under every host, so it lives in the shell rather than being left to the host.
7
+ */
8
+ export declare function FilePreviewCopyPath({ label, disabled, onClick, }: {
9
+ label: string;
10
+ disabled: boolean;
11
+ onClick: () => void;
12
+ }): import("react").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import type { FilePreviewLabels } from './types.js';
2
+ export interface FilePreviewEditorProps {
3
+ draft: string;
4
+ text: Required<FilePreviewLabels>;
5
+ loading: boolean;
6
+ failed: boolean;
7
+ saveFailed: boolean;
8
+ saving: boolean;
9
+ onChange: (value: string) => void;
10
+ onCancel: () => void;
11
+ }
12
+ /**
13
+ * 编辑态正文:纯文本编辑区,不经过底座。
14
+ *
15
+ * 编辑区独立于 `FileViewerCore`,因此进入编辑不会重建渲染器,退出编辑也
16
+ * 不会重新解析内容。
17
+ *
18
+ * The editing body: a plain-text area that bypasses the base component. Keeping
19
+ * it separate means entering or leaving editing never remounts the renderer nor
20
+ * reparses the content.
21
+ */
22
+ export declare function FilePreviewEditor({ draft, text, loading, failed, saveFailed, saving, onChange, onCancel, }: FilePreviewEditorProps): import("react").JSX.Element;
@@ -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'];
@@ -1,16 +1,25 @@
1
- import type { FilePreviewFileTab, FilePreviewLabels, FilePreviewTab } from './types.js';
1
+ import type { FilePreviewActions, FilePreviewFileTab } from './types.js';
2
2
  export interface FilePreviewHeaderProps {
3
- activeTab: FilePreviewTab;
4
- fileTab?: FilePreviewFileTab;
5
- text: Required<FilePreviewLabels>;
6
- viewMode: 'preview' | 'source';
7
- editing: boolean;
8
- loadingEdit: boolean;
9
- saving: boolean;
10
- onViewModeChange: (mode: 'preview' | 'source') => void;
11
- onEditStart: () => void;
12
- onEditCancel: () => void;
13
- onEditSave: () => void;
3
+ fileTab: FilePreviewFileTab;
4
+ actions: FilePreviewActions;
5
+ text: {
6
+ copyPath: string;
7
+ };
8
+ onOpenParent: (uri: string) => void;
14
9
  }
15
- /** 内容区标题行:路径面包屑、复制、视图切换、编辑与页签级插槽。 */
16
- export declare function FilePreviewHeader({ activeTab, fileTab, text, viewMode, editing, loadingEdit, saving, onViewModeChange, onEditStart, onEditCancel, onEditSave, }: FilePreviewHeaderProps): import("react").JSX.Element;
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;
@@ -1,5 +1,16 @@
1
- import type { FilePreviewFileTab, FilePreviewLabels } from './types.js';
2
- /** 组件内置文案,宿主可通过面板或页签级 `labels` 覆盖。 */
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
+ */
3
16
  export declare const DEFAULT_LABELS: Required<FilePreviewLabels>;
4
- /** 从文件页签的 `source` 里取出可复制的纯文本;拿不到时返回 `undefined`。 */
5
- export declare function readCopyableText(tab: FilePreviewFileTab): string | undefined;
@@ -0,0 +1,3 @@
1
+ import type { FilePreviewViewerProps } from './file-preview-viewer.js';
2
+ /** 懒加载正文:先渲染加载态,模块就绪后交给底座。 */
3
+ export declare function LazyFilePreviewViewer(props: FilePreviewViewerProps): import("react").JSX.Element;
@@ -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,17 +1,14 @@
1
1
  import type { FilePreviewComponent } from './types.js';
2
- export type { FilePreviewComponent, FilePreviewContentTab, FilePreviewEditing, FilePreviewFileTab, FilePreviewFileTabSlots, FilePreviewHandle, FilePreviewHeaderSlots, FilePreviewLabels, FilePreviewOperations, FilePreviewProps, FilePreviewSource, FilePreviewTab, FilePreviewTabBase, } 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
3
  /**
4
- * 文件预览的占位实现。
4
+ * 文件预览:页签行、内容区标题行与正文组成的外壳,正文由底座按格式渲染。
5
5
  *
6
- * 外壳(页签行、内容区标题行、页签切换与 ref 句柄)按最终形态实现,可直接
7
- * 交互;文件正文尚未接入 FileViewer,文件页签先以纯文本降级展示,内容页签
8
- * 按宿主给的节点渲染。
6
+ * 文件页签的正文交给 `FileViewerCore`,内容页签的正文由宿主原样渲染。空文件、
7
+ * 截断与编辑态由组件自己处理,不经过底座。
9
8
  *
10
- * Placeholder implementation of the file preview.
11
- *
12
- * The shell — tab row, content header row, tab switching and the ref handle — is
13
- * implemented as it will ship and is fully interactive. The file body is not
14
- * wired to FileViewer yet: a file tab falls back to plain text, while a content
15
- * tab renders the node the host supplies.
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.
16
13
  */
17
14
  export declare const FilePreview: FilePreviewComponent;