@openviking/react 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/README.md +18 -15
  2. package/dist/1~0.js +506 -0
  3. package/dist/2~0.js +122 -0
  4. package/dist/30~0.js +1332 -0
  5. package/dist/3~0.js +2113 -4
  6. package/dist/ark-message-list-view~0.js +310 -0
  7. package/dist/c7~0.js +24 -0
  8. package/dist/client/index.d.ts +2 -1
  9. package/dist/client/paths.d.ts +64 -0
  10. package/dist/client/response.d.ts +31 -0
  11. package/dist/client/sse.d.ts +39 -0
  12. package/dist/client/stream.d.ts +26 -0
  13. package/dist/client/types.d.ts +104 -0
  14. package/dist/client.js +1 -239
  15. package/dist/components/agent-connect/agent-connect-copy.d.ts +34 -0
  16. package/dist/components/agent-connect/agent-connect-design.d.ts +1781 -0
  17. package/dist/components/agent-connect/agent-connect-detail.d.ts +13 -0
  18. package/dist/components/agent-connect/agent-connect-installer.d.ts +3 -0
  19. package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +14 -0
  20. package/dist/components/agent-connect/agent-connect-instructions.d.ts +145 -0
  21. package/dist/components/agent-connect/agent-connect-markdown.d.ts +3 -0
  22. package/dist/components/agent-connect/agent-connect.d.ts +3 -3
  23. package/dist/components/agent-connect/content-en.d.ts +137 -0
  24. package/dist/components/agent-connect/content-zh.d.ts +137 -0
  25. package/dist/components/agent-connect/style.css +495 -6
  26. package/dist/components/agent-connect/types.d.ts +20 -166
  27. package/dist/components/file-browser-entries/file-browser-entries-icons.d.ts +18 -0
  28. package/dist/components/file-browser-entries/file-browser-entries.d.ts +14 -0
  29. package/dist/components/file-browser-entries/index.d.ts +1 -0
  30. package/dist/components/file-browser-entries/style.css +155 -0
  31. package/dist/components/file-browser-entries/types.d.ts +45 -0
  32. package/dist/components/file-browser-entries.js +1 -0
  33. package/dist/components/file-preview/file-preview-adapters.d.ts +33 -0
  34. package/dist/components/file-preview/file-preview-body.d.ts +24 -12
  35. package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +16 -0
  36. package/dist/components/file-preview/file-preview-breadcrumb.d.ts +21 -0
  37. package/dist/components/file-preview/file-preview-copy-path.d.ts +12 -0
  38. package/dist/components/file-preview/file-preview-directory.d.ts +32 -0
  39. package/dist/components/file-preview/file-preview-editor.d.ts +22 -0
  40. package/dist/components/file-preview/file-preview-handle-adapters.d.ts +26 -0
  41. package/dist/components/file-preview/file-preview-header.d.ts +41 -14
  42. package/dist/components/file-preview/file-preview-labels.d.ts +15 -4
  43. package/dist/components/file-preview/file-preview-lazy-viewer.d.ts +3 -0
  44. package/dist/components/file-preview/file-preview-panels.d.ts +41 -0
  45. package/dist/components/file-preview/file-preview-path.d.ts +30 -0
  46. package/dist/components/file-preview/file-preview-source.d.ts +24 -0
  47. package/dist/components/file-preview/file-preview-state.d.ts +35 -0
  48. package/dist/components/file-preview/file-preview-tab-row.d.ts +16 -0
  49. package/dist/components/file-preview/file-preview-viewer.d.ts +31 -0
  50. package/dist/components/file-preview/file-preview.d.ts +9 -11
  51. package/dist/components/file-preview/level-selection.d.ts +25 -0
  52. package/dist/components/file-preview/style.css +4055 -126
  53. package/dist/components/file-preview/types.d.ts +350 -170
  54. package/dist/components/file-preview/use-directory-level.d.ts +30 -0
  55. package/dist/components/file-preview/use-file-preview-actions-context.d.ts +27 -0
  56. package/dist/components/file-preview/use-file-preview-actions.d.ts +19 -0
  57. package/dist/components/file-preview/use-file-preview-editing.d.ts +21 -2
  58. package/dist/components/file-preview/use-file-preview-ids.d.ts +24 -0
  59. package/dist/components/file-preview.js +1 -442
  60. package/dist/components/file-tree/file-tree-body.d.ts +8 -4
  61. package/dist/components/file-tree/file-tree-entry-row.d.ts +9 -3
  62. package/dist/components/file-tree/file-tree-icons.d.ts +12 -5
  63. package/dist/components/file-tree/file-tree-info-labels.d.ts +21 -0
  64. package/dist/components/file-tree/file-tree-info-tooltip.d.ts +43 -0
  65. package/dist/components/file-tree/file-tree-info.d.ts +29 -0
  66. package/dist/components/file-tree/file-tree-keyboard.d.ts +8 -4
  67. package/dist/components/file-tree/file-tree-row-context.d.ts +29 -12
  68. package/dist/components/file-tree/file-tree-row-shared.d.ts +18 -0
  69. package/dist/components/file-tree/file-tree-spinner.d.ts +10 -0
  70. package/dist/components/file-tree/file-tree-state-row.d.ts +7 -0
  71. package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +22 -0
  72. package/dist/components/file-tree/file-tree.d.ts +12 -1
  73. package/dist/components/file-tree/style.css +280 -75
  74. package/dist/components/file-tree/types.d.ts +203 -0
  75. package/dist/components/file-tree/use-file-tree-actions.d.ts +7 -0
  76. package/dist/components/file-tree.js +1 -1
  77. package/dist/components/scope-switcher/scope-panel.d.ts +9 -3
  78. package/dist/components/scope-switcher/scope-selector.d.ts +1 -1
  79. package/dist/components/scope-switcher/scope-switcher.d.ts +1 -1
  80. package/dist/components/scope-switcher/style.css +282 -76
  81. package/dist/components/scope-switcher/types.d.ts +230 -108
  82. package/dist/components/style.css +14128 -390
  83. package/dist/components/tui/command-catalog.d.ts +58 -0
  84. package/dist/components/tui/command-completion.d.ts +19 -0
  85. package/dist/components/tui/command-definitions.d.ts +10 -0
  86. package/dist/components/tui/command-input.d.ts +16 -0
  87. package/dist/components/tui/style.css +1543 -5
  88. package/dist/components/tui/tui-assist.d.ts +15 -0
  89. package/dist/components/tui/tui-code-block.d.ts +8 -0
  90. package/dist/components/tui/tui-command-help.d.ts +9 -0
  91. package/dist/components/tui/tui-command-text.d.ts +6 -0
  92. package/dist/components/tui/tui-composer.d.ts +24 -0
  93. package/dist/components/tui/tui-copy-button.d.ts +9 -0
  94. package/dist/components/tui/tui-input-mirror.d.ts +14 -0
  95. package/dist/components/tui/tui-labels-zh.d.ts +2 -0
  96. package/dist/components/tui/tui-labels.d.ts +5 -0
  97. package/dist/components/tui/tui-markdown-renderers.d.ts +10 -0
  98. package/dist/components/tui/tui-markdown.d.ts +6 -0
  99. package/dist/components/tui/tui-param-hint.d.ts +7 -0
  100. package/dist/components/tui/tui-record-time.d.ts +11 -0
  101. package/dist/components/tui/tui-record.d.ts +13 -0
  102. package/dist/components/tui/tui-resource-preview.d.ts +10 -0
  103. package/dist/components/tui/tui-resource-tree.d.ts +10 -0
  104. package/dist/components/tui/tui-result-header.d.ts +7 -0
  105. package/dist/components/tui/tui-result-text.d.ts +5 -0
  106. package/dist/components/tui/tui-search-list.d.ts +8 -0
  107. package/dist/components/tui/tui-skeleton.d.ts +6 -0
  108. package/dist/components/tui/tui-status-card.d.ts +7 -0
  109. package/dist/components/tui/tui-text.d.ts +10 -0
  110. package/dist/components/tui/tui-uri-text.d.ts +19 -0
  111. package/dist/components/tui/tui-write-result.d.ts +7 -0
  112. package/dist/components/tui/tui.d.ts +10 -2
  113. package/dist/components/tui/types.d.ts +57 -15
  114. package/dist/components/tui/use-tui-assist-position.d.ts +3 -0
  115. package/dist/components/tui/use-tui-completion.d.ts +14 -0
  116. package/dist/components/tui/use-tui-composer-keyboard.d.ts +25 -0
  117. package/dist/components/viking-bot/ark-adapter.d.ts +45 -0
  118. package/dist/components/viking-bot/ark-message-body.d.ts +16 -0
  119. package/dist/components/viking-bot/ark-message-list-view.d.ts +7 -0
  120. package/dist/components/viking-bot/ark-message-row.d.ts +19 -0
  121. package/dist/components/viking-bot/index.d.ts +10 -0
  122. package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +10 -0
  123. package/dist/components/viking-bot/interaction/index.d.ts +4 -0
  124. package/dist/components/viking-bot/interaction/labels.d.ts +7 -0
  125. package/dist/components/viking-bot/interaction/lazy-interaction.d.ts +3 -0
  126. package/dist/components/viking-bot/interaction/schedule-input.d.ts +13 -0
  127. package/dist/components/viking-bot/interaction/style.css +189 -0
  128. package/dist/components/viking-bot/interaction/style.js +0 -0
  129. package/dist/components/viking-bot/interaction/types.d.ts +188 -0
  130. package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +9 -0
  131. package/dist/components/viking-bot/interaction.js +2 -0
  132. package/dist/components/viking-bot/labels.d.ts +2 -0
  133. package/dist/components/viking-bot/lazy-composer.d.ts +3 -0
  134. package/dist/components/viking-bot/message-groups.d.ts +12 -0
  135. package/dist/components/viking-bot/model.d.ts +252 -0
  136. package/dist/components/viking-bot/render-part.d.ts +12 -0
  137. package/dist/components/viking-bot/style.css +7135 -0
  138. package/dist/components/viking-bot/style.js +0 -0
  139. package/dist/components/viking-bot/types.d.ts +140 -0
  140. package/dist/components/viking-bot/viking-bot-composer.d.ts +6 -0
  141. package/dist/components/viking-bot/viking-bot-message-list.d.ts +3 -0
  142. package/dist/components/viking-bot/viking-bot.d.ts +16 -0
  143. package/dist/components/viking-bot.js +4 -0
  144. package/dist/c~0.js +201 -0
  145. package/dist/file-preview-viewer~0.js +191 -0
  146. package/dist/f~0.js +149 -77
  147. package/dist/h~0.js +58 -0
  148. package/dist/icons/file-type-icon.d.ts +31 -0
  149. package/dist/icons/index.d.ts +33 -23
  150. package/dist/icons/nextjs-icon.d.ts +19 -0
  151. package/dist/icons.js +1 -25
  152. package/dist/index.d.ts +4 -2
  153. package/dist/index.js +2 -1
  154. package/dist/k~0.js +1440 -0
  155. package/dist/lk~0.js +25 -12
  156. package/dist/l~0.js +1464 -25
  157. package/dist/modules/console/style.css +83 -1
  158. package/dist/modules/file-browser/file-browser-detail-icons.d.ts +10 -0
  159. package/dist/modules/file-browser/file-browser-detail.d.ts +33 -0
  160. package/dist/modules/file-browser/file-browser-empty.d.ts +3 -0
  161. package/dist/modules/file-browser/file-browser-failure.d.ts +22 -0
  162. package/dist/modules/file-browser/file-browser-icons.d.ts +18 -0
  163. package/dist/modules/file-browser/file-browser-labels.d.ts +28 -0
  164. package/dist/modules/file-browser/file-browser-layout.d.ts +27 -0
  165. package/dist/modules/file-browser/file-browser-toolbar.d.ts +18 -0
  166. package/dist/modules/file-browser/file-browser-tree-pane.d.ts +30 -0
  167. package/dist/modules/file-browser/file-browser.d.ts +14 -5
  168. package/dist/modules/file-browser/find-result.d.ts +24 -0
  169. package/dist/modules/file-browser/fs-directories.d.ts +33 -0
  170. package/dist/modules/file-browser/fs-file-kind.d.ts +19 -0
  171. package/dist/modules/file-browser/fs-icon.d.ts +17 -0
  172. package/dist/modules/file-browser/fs-model.d.ts +106 -0
  173. package/dist/modules/file-browser/fs-page.d.ts +16 -0
  174. package/dist/modules/file-browser/fs-path.d.ts +16 -0
  175. package/dist/modules/file-browser/fs-read-directory.d.ts +20 -0
  176. package/dist/modules/file-browser/fs-scope.d.ts +22 -0
  177. package/dist/modules/file-browser/fs-stat.d.ts +25 -0
  178. package/dist/modules/file-browser/index.d.ts +3 -1
  179. package/dist/modules/file-browser/style.css +5009 -34
  180. package/dist/modules/file-browser/tree-info-copy.d.ts +15 -0
  181. package/dist/modules/file-browser/tree-info-copy.zh-CN.d.ts +15 -0
  182. package/dist/modules/file-browser/types.d.ts +189 -44
  183. package/dist/modules/file-browser/use-container-width.d.ts +17 -0
  184. package/dist/modules/file-browser/use-file-browser.d.ts +49 -0
  185. package/dist/modules/file-browser/use-fs-preview.d.ts +51 -0
  186. package/dist/modules/file-browser/use-fs-search.d.ts +35 -0
  187. package/dist/modules/file-browser/use-fs-tree.d.ts +43 -0
  188. package/dist/modules/file-browser/use-request-scope.d.ts +39 -0
  189. package/dist/modules/file-browser.js +1 -1
  190. package/dist/modules/scope-cascade/style.css +282 -76
  191. package/dist/modules/style.css +5445 -130
  192. package/dist/n~0.js +568 -236
  193. package/dist/o~0.js +103 -0
  194. package/dist/shared/components/divider/divider.d.ts +18 -0
  195. package/dist/shared/components/divider/index.d.ts +1 -0
  196. package/dist/shared/components/divider/types.d.ts +35 -0
  197. package/dist/shared/components/overlay/types.d.ts +7 -0
  198. package/dist/shared/components/overlay/use-overlay-position.d.ts +38 -0
  199. package/dist/shared/components/popover/index.d.ts +1 -0
  200. package/dist/shared/components/popover/popover.d.ts +23 -0
  201. package/dist/shared/components/popover/types.d.ts +50 -0
  202. package/dist/shared/components/resizable/clamp.d.ts +13 -0
  203. package/dist/shared/components/resizable/index.d.ts +2 -0
  204. package/dist/shared/components/resizable/resizable-handle.d.ts +25 -0
  205. package/dist/shared/components/resizable/types.d.ts +48 -0
  206. package/dist/shared/components/tooltip/index.d.ts +1 -0
  207. package/dist/shared/components/tooltip/tooltip.d.ts +25 -0
  208. package/dist/shared/components/tooltip/types.d.ts +42 -0
  209. package/dist/style.css +19664 -530
  210. package/dist/u~0.js +1597 -4
  211. package/dist/viking-bot-composer~0.js +164 -0
  212. package/dist/viking-bot-interaction~0.js +284 -0
  213. package/dist/w~0.js +19 -0
  214. package/package.json +23 -10
  215. package/dist/components/file-preview/file-preview-icons.d.ts +0 -2
  216. package/dist/components/file-preview/file-preview-operations.d.ts +0 -1
  217. package/dist/components/file-tree/file-tree-dom.d.ts +0 -4
  218. package/dist/components/file-tree/file-tree-labels.d.ts +0 -5
  219. package/dist/components/file-tree/file-tree-rows.d.ts +0 -12
  220. package/dist/components/file-tree/file-tree-tooltip.d.ts +0 -11
  221. package/dist/i~0.js +0 -21
  222. package/dist/modules/file-browser/file-browser-toolbar-button.d.ts +0 -10
  223. package/dist/modules/task-center/columns.d.ts +0 -129
  224. package/dist/modules/task-center/index.d.ts +0 -1
  225. package/dist/modules/task-center/style.css +0 -29
  226. package/dist/modules/task-center/task-center.d.ts +0 -4
  227. package/dist/modules/task-center/types.d.ts +0 -168
  228. package/dist/modules/task-center.js +0 -1
  229. /package/dist/{modules/task-center → components/file-browser-entries}/style.js +0 -0
@@ -1,5 +1,5 @@
1
- import type { FileViewerResource } from '@ark-design/ui/file-viewer/core';
2
- import type { ForwardRefExoticComponent, HTMLAttributes, PropsWithoutRef, ReactNode, RefAttributes } from 'react';
1
+ import type { ConfirmSlotProps, DownloadSlotProps, FileViewerResource, ViewerHandle } from '@ark-design/ui/file-viewer/core';
2
+ import type { ComponentType, ForwardRefExoticComponent, HTMLAttributes, PropsWithoutRef, ReactNode, RefAttributes } from 'react';
3
3
  /**
4
4
  * 要预览的内容及文件信息。提供多个来源时,按 `content`、`file`、`url`
5
5
  * 的顺序使用第一个有值的来源。
@@ -9,8 +9,7 @@ import type { ForwardRefExoticComponent, HTMLAttributes, PropsWithoutRef, ReactN
9
9
  export interface FilePreviewSource {
10
10
  /**
11
11
  * 文本内容,适用于 Markdown、JSON、代码等可内联的格式。
12
- * Text content, for formats that can be inlined such as Markdown, JSON and
13
- * code.
12
+ * Text content, for formats that can be inlined such as Markdown, JSON and code.
14
13
  */
15
14
  content?: string;
16
15
  /**
@@ -32,8 +31,9 @@ export interface FilePreviewSource {
32
31
  */
33
32
  fileName: string;
34
33
  /**
35
- * 完整路径,显示在标题下方。省略时只显示文件名。
36
- * Full path shown under the title. Only the file name is shown when omitted.
34
+ * 完整路径,显示为面包屑。省略时面包屑退化为文件名,不渲染祖先按钮。
35
+ * Full path, rendered as the breadcrumb. When omitted the breadcrumb falls
36
+ * back to the file name and renders no ancestor buttons.
37
37
  */
38
38
  path?: string;
39
39
  /**
@@ -41,6 +41,14 @@ export interface FilePreviewSource {
41
41
  * Explicit format hint, taking precedence over extension and MIME.
42
42
  */
43
43
  fileType?: string;
44
+ /**
45
+ * 正文是否被截断。宿主按读取上限取回部分内容时置为 `true`,组件在正文
46
+ * 下方提示,避免把「只读了一部分」当作完整文件。
47
+ * Whether the body was truncated. A host that read only part of the content
48
+ * sets this so the component can say so instead of passing a partial file off
49
+ * as complete.
50
+ */
51
+ truncated?: boolean;
44
52
  }
45
53
  /**
46
54
  * 所有页签的公共配置,包括标识、标题、图标、文案及标题行操作。
@@ -55,14 +63,23 @@ export interface FilePreviewTabBase {
55
63
  key: string;
56
64
  /**
57
65
  * 页签行显示的内容。可以是纯文本,也可以是带样式或图标的节点。
58
- * What the tab row shows. It can be plain text or a node with styling or
59
- * icons.
66
+ * What the tab row shows. It can be plain text or a node with styling or icons.
60
67
  */
61
68
  title?: ReactNode;
62
69
  /**
63
- * 页签图标。省略时按文件格式自动选择,内容页签使用内置的看板图标。
64
- * Tab icon. Chosen from the file format when omitted; a content tab uses the
65
- * built-in dashboard icon.
70
+ * 页签图标,由宿主提供;省略时该页签只显示标题,不占图标位。
71
+ *
72
+ * 组件不按文件名推断类型:格式识别属于上层职责,内置图标集会把整包图标
73
+ * 拖进产物。需要按格式取图标的宿主可从 `@openviking/react/icons` 引入
74
+ * `getFileTypeIcon`,把结果传进来。
75
+ *
76
+ * The tab icon, supplied by the host. Omit it and the tab shows only its title,
77
+ * with no icon slot.
78
+ *
79
+ * The component does not infer a type from the file name: format detection
80
+ * belongs to the caller, and bundling the icon set would pull every icon into
81
+ * the output. A host that wants a per-format icon can import
82
+ * `getFileTypeIcon` from `@openviking/react/icons` and pass the result in.
66
83
  */
67
84
  icon?: ReactNode;
68
85
  /**
@@ -77,46 +94,25 @@ export interface FilePreviewTabBase {
77
94
  */
78
95
  disabled?: boolean;
79
96
  /**
80
- * 上级目录成功打开后触发,参数为当前文件路径;失败时不触发。
81
- * Called after the parent directory opens, with the current file path;
97
+ * 祖先导航成功打开后触发,参数为被点击那一级的完整 URI;失败时不触发。
98
+ * Called after an ancestor opens, with the full URI of the clicked level;
82
99
  * not called on failure.
83
100
  */
84
- onOpenParent?: (path: string) => void;
101
+ onOpenParent?: (uri: string) => void;
85
102
  /**
86
103
  * 路径复制成功后触发,参数为已复制的路径;复制失败时不触发。
87
104
  * 省略回调不影响复制。文件页签提供 `source.path` 时显示复制路径按钮。
88
- *
89
105
  * Called after path copying succeeds, with the copied path; not called on
90
106
  * failure. Omitting it does not affect copying. File tabs with `source.path`
91
107
  * show the copy-path button.
92
108
  */
93
109
  onCopyPath?: (path: string) => void;
94
- /**
95
- * 是否显示预览/源码切换,默认 `true`。格式本身没有源码视图时自动隐藏。
96
- *
97
- * 只在文件页签上生效。内容页签的正文由宿主渲染,组件没有可切换的两种视图,
98
- * 传了也不会渲染切换按钮;宿主需要两种视图时在 `content` 里自行实现。
99
- *
100
- * Whether to show the preview/source switch, `true` by default. Hidden
101
- * automatically when the format has no source view.
102
- *
103
- * Only meaningful on file tabs. A content tab's body is rendered by the host,
104
- * so the component has no second view to switch to and renders no control;
105
- * a host that needs two views implements the switch inside `content`.
106
- */
107
- showViewModeSwitch?: boolean;
108
- /**
109
- * 内容区标题行的插槽。页签行本身只显示标题与图标,其余元素都在这一层。
110
- * Slots of the content header row. The tab row itself shows only a title and
111
- * an icon; everything else renders in this layer.
112
- */
113
- slots?: FilePreviewHeaderSlots;
114
110
  }
115
111
  /**
116
112
  * 文件预览页签或宿主自定义内容页签。
117
113
  * A file-preview tab or a tab with host-provided content.
118
114
  */
119
- export type FilePreviewTab = FilePreviewFileTab | FilePreviewContentTab;
115
+ export type FilePreviewTab = FilePreviewFileTab | FilePreviewContentTab | FilePreviewDirectoryTab;
120
116
  /**
121
117
  * 按文件格式预览 `source` 的页签。
122
118
  * A tab that previews `source` according to its file format.
@@ -127,6 +123,18 @@ export interface FilePreviewFileTab extends FilePreviewTabBase {
127
123
  * Tab kind discriminator, always `file`.
128
124
  */
129
125
  kind: 'file';
126
+ /**
127
+ * 正文是否还在读取。为真时组件渲染加载态而不是正文,外壳(页签行、路径行)
128
+ * 照常显示——宿主切换文件时外壳因此不闪,只有正文区在等。
129
+ *
130
+ * `source` 在加载中可以为空;组件不会把它判成「空文件」。
131
+ *
132
+ * Whether the body is still being read. When true the component renders its
133
+ * loading state instead of the body while the shell — tab row, path row — stays
134
+ * put, so a host switching files does not flash the whole area. `source` may be
135
+ * empty while loading; it is not treated as an empty file.
136
+ */
137
+ loading?: boolean;
130
138
  /**
131
139
  * 要预览的内容及文件信息。
132
140
  * The content and file information to preview.
@@ -150,14 +158,12 @@ export interface FilePreviewFileTab extends FilePreviewTabBase {
150
158
  editing?: FilePreviewEditing;
151
159
  /**
152
160
  * 文件页签的标题行插槽,在基类之上增加三类状态兜底。
153
- * Header slots of a file tab, adding the three state fallbacks on top of the
154
- * base ones.
161
+ * Header slots of a file tab, adding the three state fallbacks on top of the base ones.
155
162
  */
156
163
  slots?: FilePreviewFileTabSlots;
157
164
  /**
158
165
  * 正文复制成功后触发,参数为已复制的文本;复制失败时不触发。
159
166
  * 省略回调不影响复制。仅文件页签提供正文复制,没有可复制文本时按钮禁用。
160
- *
161
167
  * Called after content copying succeeds, with the copied text; not called on
162
168
  * failure. Omitting it does not affect copying. Only file tabs provide body
163
169
  * copying; the button is disabled when no copyable text is available.
@@ -169,17 +175,27 @@ export interface FilePreviewFileTab extends FilePreviewTabBase {
169
175
  */
170
176
  onDownload?: () => void;
171
177
  /**
172
- * 正文中的资源成功打开后触发,参数为已打开的 URI;失败时不触发。
173
- * Called after a content resource opens, with its URI; not called on failure.
178
+ * 正文中的链接成功打开后触发,参数为被点击的 URI;失败时不触发。只有
179
+ * Markdown 正文会触发。
180
+ *
181
+ * Called after a link inside the body opens, with the clicked URI; not called on
182
+ * failure. Only Markdown bodies fire this.
174
183
  */
175
184
  onOpenUri?: (uri: string) => void;
176
185
  }
177
186
  /**
178
187
  * 展示宿主自定义内容的页签,例如看板或图谱。
179
- * 标题行可通过 `slots` 补充内容与操作;正文及其加载、错误提示由 `content` 提供。
180
- * A tab with host-provided content, such as a dashboard or graph. Use `slots`
181
- * for extra header content and actions, and `content` for the body and any
182
- * loading or error messages.
188
+ *
189
+ * 这类页签只有页签行由组件负责,正文整块交给宿主——组件不渲染内容区标题行,
190
+ * 也不在中间套任何容器。宿主想加工具栏、标题或状态提示,都写在自己的
191
+ * `content` 里,按需要怎么排就怎么排。
192
+ *
193
+ * A tab with host-provided content, such as a dashboard or graph.
194
+ *
195
+ * The component only renders the tab row for these; the whole body belongs to the
196
+ * host. No content header row is rendered and no wrapper is placed in between, so
197
+ * a host that wants a toolbar, a title or a status line puts it inside `content`
198
+ * and lays it out however it needs.
183
199
  */
184
200
  export interface FilePreviewContentTab extends FilePreviewTabBase {
185
201
  /**
@@ -188,31 +204,138 @@ export interface FilePreviewContentTab extends FilePreviewTabBase {
188
204
  */
189
205
  kind: 'content';
190
206
  /**
191
- * 页签行显示的内容。内容页签没有 `source.fileName` 可以回落,因此这里是
192
- * 必填。
207
+ * 页签行显示的内容。内容页签没有 `source.fileName` 可以回落,因此这里是必填。
193
208
  * What the tab row shows. A content tab has no `source.fileName` to fall back
194
209
  * to, so it is required here.
195
210
  */
196
211
  title: ReactNode;
197
212
  /**
198
- * 页签正文,由宿主渲染。
199
- * The tab body, rendered by the host.
213
+ * 页签正文,由宿主渲染,铺满页签行以下的整个区域。
214
+ * The tab body, rendered by the host and filling everything below the tab row.
200
215
  */
201
216
  content: ReactNode;
202
217
  }
203
- /** 文件操作的执行能力。File operation capabilities. */
218
+ /**
219
+ * 目录页签:一个目录的若干级摘要,例如 L0 摘要与 L1 总览。
220
+ *
221
+ * 它和文件页签的区别在于**正文的层级**:文件页签只有正文;目录页签在标题行
222
+ * 之下、正文之上还有一层同级视图切换(下划线页签),每一级各自是一份
223
+ * Markdown。这一层属于目录这种实体,不属于所有文件页签,因此单独开一类,
224
+ * 而不是给文件页签加一个通用插槽——那样每个文件页签都会多一个它用不到的
225
+ * 空位。
226
+ *
227
+ * A tab for a directory's summary levels, for example its L0 abstract and L1
228
+ * overview.
229
+ *
230
+ * It differs from a file tab in the layering of the body: a file tab has a body
231
+ * and nothing else, while a directory tab has one more level between the header
232
+ * and the body — an underlined switch between sibling views, each holding its own
233
+ * Markdown. That level belongs to the directory entity rather than to every file
234
+ * tab, so it gets its own kind instead of a generic slot on file tabs, which would
235
+ * leave every file tab with an empty space it never uses.
236
+ */
237
+ export interface FilePreviewDirectoryTab extends FilePreviewTabBase {
238
+ /**
239
+ * 页签类型标记,固定为 `directory`。
240
+ * Tab kind discriminator, always `directory`.
241
+ */
242
+ kind: 'directory';
243
+ /**
244
+ * 摘要是否还在读取。与文件页签同义:为真时正文区显示加载态,外壳照常。
245
+ * Whether the summary is still being read. Same as a file tab: the body shows
246
+ * the loading state while the shell stays put.
247
+ */
248
+ loading?: boolean;
249
+ /**
250
+ * 可切换的摘要层级,至少一级。每级用 `source` 交给组件按格式渲染,与文件
251
+ * 页签的正文同一条渲染路径。
252
+ * The summary levels to switch between, at least one. Each level's `source` goes
253
+ * through the same rendering path as a file tab's body.
254
+ */
255
+ levels: readonly [FilePreviewDirectoryLevel, ...FilePreviewDirectoryLevel[]];
256
+ /**
257
+ * 受控的当前层级 key。传入时由宿主决定层级,组件只上报切换意图。
258
+ * The controlled active level key. When given, the host owns the level and the
259
+ * component only reports switch intent.
260
+ */
261
+ activeLevelKey?: string;
262
+ /**
263
+ * 非受控时的初始层级 key,省略时选中第一级。
264
+ * Initial level key when uncontrolled; the first level is selected when omitted.
265
+ */
266
+ defaultLevelKey?: string;
267
+ /**
268
+ * 当前层级变化后触发,参数为新的层级 key。
269
+ * Called after the active level changes, with the new level key.
270
+ */
271
+ onActiveLevelChange?: (key: string) => void;
272
+ /**
273
+ * 目录操作的执行能力,例如沿路径向上打开。省略对应方法时该操作不可用。
274
+ * Directory operation capabilities, for example opening an ancestor. Omitting a
275
+ * method makes its operation unavailable.
276
+ */
277
+ operations?: FilePreviewOperations;
278
+ /**
279
+ * 目录页签的插槽。标题行动作与状态兜底与文件页签一致。
280
+ * Slots of a directory tab. Header actions and state fallbacks match a file tab.
281
+ */
282
+ slots?: FilePreviewFileTabSlots;
283
+ }
284
+ /**
285
+ * 目录的一级摘要。One summary level of a directory.
286
+ */
287
+ export interface FilePreviewDirectoryLevel {
288
+ /**
289
+ * 层级唯一标识,用于切换与受控状态。
290
+ * Unique level key, used for switching and controlled state.
291
+ */
292
+ key: string;
293
+ /**
294
+ * 页签行显示的名称,例如「L0 摘要」。
295
+ * What the level switch shows, for example "L0 Summary".
296
+ */
297
+ label: ReactNode;
298
+ /**
299
+ * 该级的正文来源,与文件页签的 `source` 同形,交给组件按格式渲染。
300
+ * The body source of this level, the same shape as a file tab's `source`, handed
301
+ * to the component for format rendering.
302
+ */
303
+ source: FilePreviewSource;
304
+ }
305
+ /**
306
+ * 文件操作的执行能力。方法返回的 Promise 完成后才触发对应的成功通知。
307
+ * File operation capabilities. The matching success notification fires only
308
+ * after the returned promise resolves.
309
+ */
204
310
  export interface FilePreviewOperations {
205
- /** 打开当前文件的上级目录。Opens the current file's parent directory. */
206
- openParent?: (path: string) => Promise<void>;
311
+ /**
312
+ * 打开给定的祖先 URI,参数可能指向任意一级目录,不限于当前文件的直接父级。
313
+ * Opens the given ancestor URI. The argument may point at any level, not only
314
+ * the immediate parent of the current file.
315
+ */
316
+ openParent?: (uri: string) => Promise<void>;
207
317
  /** 下载当前文件,完成后返回。Downloads the current file and resolves on completion. */
208
318
  download?: () => Promise<void>;
209
- /** 打开正文引用的资源。Opens a resource referenced by the content. */
319
+ /**
320
+ * 打开正文里被点击的链接,完成后返回。传入后由宿主接管导航,组件阻止默认
321
+ * 跳转;相对路径的解析也归宿主,组件给出的是 Markdown 里的原始目标。
322
+ *
323
+ * 目前只有 Markdown 正文会触发:其它格式的渲染器不提供链接点击回调。
324
+ *
325
+ * Opens a link clicked inside the body and resolves on completion. Supplying it
326
+ * hands navigation to the host — the component prevents the default jump — and
327
+ * resolving relative paths is the host's job too; the component passes the raw
328
+ * target as written in the Markdown.
329
+ *
330
+ * Only Markdown bodies fire this today: the other renderers expose no link-click
331
+ * callback.
332
+ */
210
333
  openUri?: (uri: string) => Promise<void>;
211
334
  }
212
335
  /**
213
336
  * 文件编辑配置。省略时只读;可提供编辑所需的完整文本,并处理保存与取消操作。
214
- * File-editing options. Omit them for a read-only preview. Provide the full
215
- * text to edit and handle save and cancel actions as needed.
337
+ * File-editing options. Omit them for a read-only preview. Provide the full text
338
+ * to edit and handle save and cancel actions as needed.
216
339
  */
217
340
  export interface FilePreviewEditing {
218
341
  /**
@@ -221,14 +344,14 @@ export interface FilePreviewEditing {
221
344
  * 返回 `undefined` 时放弃本次编辑,保持预览态。
222
345
  * Provides the full text when editing is requested, for example for a truncated
223
346
  * preview or a file URL. When omitted, text from `content` or `file` is used;
224
- * URL-only sources require this loader. Returning `undefined` cancels the
225
- * edit request and keeps the preview open.
347
+ * URL-only sources require this loader. Returning `undefined` cancels the edit
348
+ * request and keeps the preview open.
226
349
  */
227
350
  loadContent?: (source: FilePreviewSource) => Promise<string | undefined>;
228
351
  /**
229
352
  * 保存草稿时调用。抛错或 reject 时组件展示失败提示并保留草稿。
230
- * Invoked when the draft is saved. A thrown error or rejection keeps the
231
- * draft and shows a failure message.
353
+ * Invoked when the draft is saved. A thrown error or rejection keeps the draft
354
+ * and shows a failure message.
232
355
  */
233
356
  save: (value: string) => Promise<void>;
234
357
  /**
@@ -244,29 +367,84 @@ export interface FilePreviewEditing {
244
367
  onCancel?: (value: string) => void;
245
368
  }
246
369
  /**
247
- * 所有页签共用的内容区标题行插槽。
248
- * Content-header slots shared by every tab.
370
+ * 交给宿主的动作上下文:组件持有的视图与编辑状态,以及改变它们的方法。
371
+ *
372
+ * 组件只渲染外壳与正文,不内置复制、下载、视图切换、编辑这些按钮;宿主在
373
+ * `slots.actions` 里用这份上下文自己拼。状态仍由组件维护,宿主不必接管。
374
+ *
375
+ * The action context handed to the host: the view and editing state the component
376
+ * owns, plus the methods that change it.
377
+ *
378
+ * The component renders only the shell and the body — it ships no copy, download,
379
+ * view-switch or edit buttons. A host composes them in `slots.actions` from this
380
+ * context. The state stays with the component; the host does not take it over.
381
+ */
382
+ export interface FilePreviewActions {
383
+ /** 当前视图模式。The current view mode. */
384
+ viewMode: FilePreviewViewMode;
385
+ /** 切换到指定视图模式。Switches to the given view mode. */
386
+ setViewMode: (mode: FilePreviewViewMode) => void;
387
+ /**
388
+ * 该页签的格式是否同时支持预览与源码。为 `false` 时不该渲染切换控件。
389
+ * Whether the format supports both preview and source. Do not render a switch
390
+ * when it is `false`.
391
+ */
392
+ canSwitchView: boolean;
393
+ /** 是否处于编辑态。Whether the tab is being edited. */
394
+ editing: boolean;
395
+ /** 是否有保存或读取在进行中。Whether a save or load is in flight. */
396
+ busy: boolean;
397
+ /** 该页签是否可编辑,即可提供 `editing`。Whether the tab is editable. */
398
+ canEdit: boolean;
399
+ /** 进入编辑态。Enters editing. */
400
+ startEditing: () => void;
401
+ /** 保存草稿,成功返回 `true`。Saves the draft, resolving to `true` on success. */
402
+ saveEditing: () => Promise<boolean>;
403
+ /** 放弃草稿并退出编辑态。Discards the draft and leaves editing. */
404
+ cancelEditing: () => void;
405
+ /** 该页签是否有可复制的正文。Whether the tab has copyable body text. */
406
+ canCopyContent: boolean;
407
+ /** 复制正文,成功返回 `true`。Copies the body, resolving to `true` on success. */
408
+ copyContent: () => Promise<boolean>;
409
+ /** 该页签是否有可复制的路径。Whether the tab has a copyable path. */
410
+ canCopyPath: boolean;
411
+ /** 复制路径,成功返回 `true`。Copies the path, resolving to `true` on success. */
412
+ copyPath: () => Promise<boolean>;
413
+ /** 该页签是否可下载。Whether the tab can be downloaded. */
414
+ canDownload: boolean;
415
+ /** 下载当前文件。Downloads the current file. */
416
+ download: () => void;
417
+ }
418
+ /**
419
+ * 文件页签内容区标题行的插槽。内容页签不消费这些——它整块正文由宿主渲染,
420
+ * 没有组件提供的标题行可言。
421
+ *
422
+ * Slots of a file tab's content header. Content tabs do not use them: their whole
423
+ * body is the host's, so there is no component-provided header to fill.
249
424
  */
250
425
  export interface FilePreviewHeaderSlots {
251
426
  /**
252
- * 标题行右侧的额外动作,例如权限设置或删除。
253
- *
254
- * 复制与下载使用已有按钮,不需要在这里重复添加。
427
+ * 标题行右侧的动作区。组件不内置任何按钮,复制、下载、视图切换、编辑都由
428
+ * 宿主用上下文里的状态与方法自行渲染。
255
429
  *
256
- * Extra actions on the right of the header, for example permissions or
257
- * delete.
258
- *
259
- * Use the existing copy and download buttons instead of adding duplicates here.
430
+ * The action area on the right of the header. The component ships no buttons of
431
+ * its own: copy, download, view switch and editing are all rendered by the host
432
+ * from the state and methods in the context.
260
433
  */
261
- actions?: ReactNode;
434
+ actions?: ReactNode | ((actions: FilePreviewActions) => ReactNode);
262
435
  /**
263
- * 标题旁的额外内容。宿主想放在文件名之后的任何东西都可以从这里注入,
264
- * 例如权限标记、状态徽标或版本号;不需要时不传。
265
- * Extra content next to the title. Anything the host wants after the file
266
- * name can go here, for example a permission tag, a status badge or a
267
- * version label; omit it when not needed.
436
+ * 标题旁的额外内容,例如权限标记、状态徽标或版本号;不需要时不传。
437
+ * Extra content next to the title, for example a permission tag, a status badge
438
+ * or a version label; omit it when not needed.
268
439
  */
269
440
  titleExtra?: ReactNode;
441
+ /**
442
+ * 正文下方的补充信息,例如字符数、更新时间或保留策略控件。渲染在正文与
443
+ * 滚动容器之外,不随正文滚动。
444
+ * Supplementary information under the body, for example a character count, an
445
+ * update time or retention controls. Rendered outside the scrolling body.
446
+ */
447
+ footer?: ReactNode;
270
448
  }
271
449
  /**
272
450
  * 文件页签的标题行插槽,以及加载、失败或格式不支持时的替代内容。
@@ -287,11 +465,34 @@ export interface FilePreviewFileTabSlots extends FilePreviewHeaderSlots {
287
465
  */
288
466
  errorFallback?: ReactNode;
289
467
  /**
290
- * 格式不支持时的兜底内容。不传时使用内置提示。
291
- * Fallback when the format cannot be previewed. A built-in message is used
292
- * when omitted.
468
+ * 格式不支持时的兜底内容。格式是否可预览由底座判定,因此这个节点会交给
469
+ * 底座,而不是在组件这边提前判断。传了就由它接管整个不支持态(含底座原本
470
+ * 会给出的下载入口);不传时使用内置提示。
471
+ *
472
+ * Fallback when the format cannot be previewed. Whether a format can be
473
+ * previewed is the base component's call, so this node is handed to it rather
474
+ * than decided here. Supplying it takes over the whole unsupported state,
475
+ * including the download entry the base would otherwise offer; omit it for the
476
+ * built-in message.
293
477
  */
294
478
  unsupportedFallback?: ReactNode;
479
+ /**
480
+ * 大文件确认态的替代内容。需要拿到确认与取消回调,因此是组件而不是节点。
481
+ * 不传时使用内置确认态与底座文案。
482
+ * Replacement for the large-file confirmation state. It receives the confirm
483
+ * and cancel callbacks, so it is a component rather than a node. A built-in
484
+ * state with base copy is used when omitted.
485
+ */
486
+ confirmFallback?: ComponentType<ConfirmSlotProps>;
487
+ /**
488
+ * 无法内联预览时的替代内容,通常包含下载入口。需要拿到下载与重试回调,
489
+ * 因此是组件而不是节点。不传时使用内置提示与底座文案。
490
+ * Replacement for the state where inline preview is impossible, usually with a
491
+ * download entry. It receives the download and retry callbacks, so it is a
492
+ * component rather than a node. A built-in message with base copy is used when
493
+ * omitted.
494
+ */
495
+ downloadFallback?: ComponentType<DownloadSlotProps>;
295
496
  }
296
497
  /**
297
498
  * 可替换文案,组件内置英文默认值。
@@ -299,128 +500,97 @@ export interface FilePreviewFileTabSlots extends FilePreviewHeaderSlots {
299
500
  */
300
501
  export interface FilePreviewLabels {
301
502
  /**
302
- * 复制内容按钮的文案。
303
- * Label of the copy-content button.
304
- */
305
- copyContent?: string;
306
- /**
307
- * 复制内容成功后的提示。
308
- * Message shown after the content was copied.
309
- */
310
- copyContentSuccess?: string;
311
- /**
312
- * 没有内容可复制时的提示。
313
- * Message shown when there is no content to copy.
314
- */
315
- copyContentEmpty?: string;
316
- /**
317
- * 复制路径按钮的文案。
318
- * Label of the copy-path button.
503
+ * 复制路径按钮的文案。这是组件自己渲染的唯一按钮——其余动作按钮由宿主在
504
+ * `slots.actions` 里自绘,文案也归宿主。
505
+ *
506
+ * Label of the copy-path button. It is the only button the component renders
507
+ * itself; every other action button belongs to the host's `slots.actions`,
508
+ * copy included.
319
509
  */
320
510
  copyPath?: string;
321
- /**
322
- * 复制路径成功后的提示。
323
- * Message shown after the path was copied.
324
- */
325
- copyPathSuccess?: string;
326
- /**
327
- * 打开上级目录的按钮文案。
328
- * Label of the control that opens the parent directory.
329
- */
330
- openParent?: string;
331
- /**
332
- * 进入编辑状态的按钮文案。
333
- * Label of the control that enters editing.
334
- */
335
- edit?: string;
336
- /**
337
- * 保存按钮文案。
338
- * Save button label.
339
- */
340
- save?: string;
341
- /**
342
- * 取消编辑的按钮文案。
343
- * Label of the control that leaves editing.
344
- */
345
- cancel?: string;
346
- /**
347
- * 预览视图的文案。
348
- * Label of the preview view.
349
- */
350
- preview?: string;
351
- /**
352
- * 源码视图的文案。
353
- * Label of the source view.
354
- */
355
- source?: string;
356
- /**
357
- * 重试按钮文案。
358
- * Retry button label.
359
- */
511
+ /** 编辑区文本框的无障碍名称。Accessible name of the editor textarea. */
512
+ editor?: string;
513
+ /** 读取失败后退出编辑态的按钮文案。Label of the button that leaves editing after a failed load. */
514
+ leaveEditing?: string;
515
+ /** 重试按钮文案。Retry button label. */
360
516
  retry?: string;
361
- /**
362
- * 读取失败时的提示。
363
- * Message shown when reading failed.
364
- */
517
+ /** 读取失败时的提示。Message shown when reading failed. */
365
518
  loadFailed?: string;
366
- /**
367
- * 保存失败时的提示。
368
- * Message shown when saving failed.
369
- */
519
+ /** 保存失败时的提示。Message shown when saving failed. */
370
520
  saveFailed?: string;
371
- /**
372
- * 无法预览该格式时的提示。
373
- * Message shown when the format cannot be previewed.
374
- */
521
+ /** 无法预览该格式时的提示。Message shown when the format cannot be previewed. */
375
522
  unsupported?: string;
376
- /**
377
- * 取回正文时的加载提示。
378
- * Message shown while the text is being fetched.
379
- */
523
+ /** 取回正文时的加载提示。Message shown while the text is being fetched. */
380
524
  loading?: string;
381
- /**
382
- * 下载按钮文案。
383
- * Label of the download button.
384
- */
525
+ /** 下载按钮文案。Label of the download button. */
385
526
  download?: string;
386
- /**
387
- * 无法预览二进制文件时的提示。
388
- * Message shown when a binary file cannot be previewed.
389
- */
390
- binaryUnsupported?: string;
527
+ /** 文件长度为 0 时的提示。Message shown when the file itself is empty. */
528
+ fileEmpty?: string;
529
+ /** 文件非空但没有可展示内容时的提示。Message shown for a non-empty file with nothing to render. */
530
+ noContent?: string;
531
+ /** 正文被截断时的提示。Message shown when the body was truncated. */
532
+ truncated?: string;
391
533
  }
392
534
  /**
393
- * 通过组件 ref 切换或查询当前页签。
394
- * Switches or queries the active tab through the component ref.
535
+ * 通过组件 ref 切换或查询当前页签,并透传底座的命令式能力。
536
+ * Switches or queries the active tab through the component ref, and exposes the
537
+ * base component's imperative capabilities.
395
538
  */
396
539
  export interface FilePreviewHandle {
397
540
  /**
398
541
  * 切到指定 key 的页签。该页签不存在或被禁用时返回 `false`。
399
- * Switches to the tab with the given key. Returns `false` when the tab does
400
- * not exist or is disabled.
542
+ * Switches to the tab with the given key. Returns `false` when the tab does not
543
+ * exist or is disabled.
401
544
  */
402
545
  setActiveTab: (key: string) => boolean;
546
+ /** 取当前激活页签的 key。Returns the key of the active tab. */
547
+ getActiveTab: () => string;
403
548
  /**
404
- * 取当前激活页签的 key。
405
- * Returns the key of the active tab.
549
+ * 取当前文件页签的底座句柄,用于翻页、搜索、缩放等命令式操作。
550
+ * 当前页签不是文件页签、或底座尚未就绪时返回 `null`。
551
+ * Returns the base handle of the active file tab for page, search and zoom
552
+ * commands. Returns `null` when the active tab is a content tab or the base is
553
+ * not ready yet.
406
554
  */
407
- getActiveTab: () => string;
555
+ getViewerHandle: () => ViewerHandle | null;
408
556
  }
409
557
  /**
410
558
  * 文件预览配置,支持文件页签与自定义内容页签。
411
559
  * 通过页签配置内容与操作,文件页签可提供编辑能力与状态提示。
412
- * File-preview options supporting file tabs and custom-content tabs.
413
- * Configure content and actions per tab; file tabs also support editing options
414
- * and status content.
560
+ * File-preview options supporting file tabs and custom-content tabs. Configure
561
+ * content and actions per tab; file tabs also support editing options and status
562
+ * content.
415
563
  */
416
564
  export interface FilePreviewProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
417
565
  /**
418
- * 页签列表,至少一个。每个页签用 `source` 交给组件按格式渲染,或用
419
- * `content` 完全自定义渲染。
566
+ * 页签列表,至少一个。每个页签用 `source` 交给组件按格式渲染,或用 `content`
567
+ * 完全自定义渲染。
420
568
  * The tab list, at least one entry. Each tab either hands `source` to the
421
569
  * component for format rendering or renders fully custom `content`.
422
570
  */
423
571
  tabs: readonly [FilePreviewTab, ...FilePreviewTab[]];
572
+ /**
573
+ * 受控的当前页签 key。传入时由宿主决定当前页签,组件只上报切换意图。
574
+ * The controlled active tab key. When given, the host owns the active tab and
575
+ * the component only reports switch intent.
576
+ */
577
+ activeKey?: string;
578
+ /**
579
+ * 非受控时的初始页签 key,省略时选中第一个。
580
+ * Initial tab key when uncontrolled; the first tab is selected when omitted.
581
+ */
582
+ 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
+ /**
590
+ * 当前页签变化后触发,参数为新的页签 key。
591
+ * Called after the active tab changes, with the new tab key.
592
+ */
593
+ onActiveKeyChange?: (key: string) => void;
424
594
  /**
425
595
  * 所有页签的默认文案,缺省为英文。页签可以逐项覆盖。
426
596
  * Default copy for every tab, English by default. A tab can override it field
@@ -433,3 +603,13 @@ export interface FilePreviewProps extends Omit<HTMLAttributes<HTMLDivElement>, '
433
603
  * A file-preview component whose ref supports switching and querying tabs.
434
604
  */
435
605
  export type FilePreviewComponent = ForwardRefExoticComponent<PropsWithoutRef<FilePreviewProps> & RefAttributes<FilePreviewHandle>>;
606
+ /**
607
+ * 文件页签的视图模式。底座的 `ViewerViewMode` 是不透明的字符串,这里只收
608
+ * 组件自己会切换的两种;其它格式的私有模式(Word 版式/阅读、CAD 2D/3D)
609
+ * 由底座与 Adapter 自行管理,不经过组件。
610
+ *
611
+ * View modes of a file tab. The base `ViewerViewMode` is an opaque string; only
612
+ * the two the component switches between are listed here. Format-private modes
613
+ * (Word layout/reading, CAD 2D/3D) are managed by the base and its adapters.
614
+ */
615
+ export type FilePreviewViewMode = 'preview' | 'source';