@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.
Files changed (193) hide show
  1. package/README.md +57 -34
  2. package/dist/3~0.js +2117 -0
  3. package/dist/ark-message-list-view~0.js +310 -0
  4. package/dist/a~0.js +21 -0
  5. package/dist/c7~0.js +24 -0
  6. package/dist/client/client.d.ts +12 -0
  7. package/dist/client/errors.d.ts +30 -0
  8. package/dist/client/index.d.ts +4 -0
  9. package/dist/client/options.d.ts +101 -0
  10. package/dist/client/provider.d.ts +52 -0
  11. package/dist/client/types.d.ts +160 -0
  12. package/dist/client.js +239 -0
  13. package/dist/components/agent-connect/agent-connect-copy.d.ts +34 -0
  14. package/dist/components/agent-connect/agent-connect-design.d.ts +1781 -0
  15. package/dist/components/agent-connect/agent-connect-detail.d.ts +13 -0
  16. package/dist/components/agent-connect/agent-connect-installer.d.ts +3 -0
  17. package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +14 -0
  18. package/dist/components/agent-connect/agent-connect-instructions.d.ts +145 -0
  19. package/dist/components/agent-connect/agent-connect-markdown.d.ts +3 -0
  20. package/dist/components/agent-connect/agent-connect.d.ts +4 -1
  21. package/dist/components/agent-connect/content-en.d.ts +137 -0
  22. package/dist/components/agent-connect/content-zh.d.ts +137 -0
  23. package/dist/components/agent-connect/index.d.ts +1 -0
  24. package/dist/components/agent-connect/style.css +503 -0
  25. package/dist/components/agent-connect/types.d.ts +29 -0
  26. package/dist/components/agent-connect.js +1 -0
  27. package/dist/components/file-preview/file-preview-adapters.d.ts +33 -0
  28. package/dist/components/file-preview/file-preview-body.d.ts +27 -0
  29. package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +16 -0
  30. package/dist/components/file-preview/file-preview-breadcrumb.d.ts +21 -0
  31. package/dist/components/file-preview/file-preview-copy-path.d.ts +12 -0
  32. package/dist/components/file-preview/file-preview-editor.d.ts +22 -0
  33. package/dist/components/file-preview/file-preview-handle-adapters.d.ts +26 -0
  34. package/dist/components/file-preview/file-preview-header.d.ts +25 -0
  35. package/dist/components/file-preview/file-preview-labels.d.ts +16 -0
  36. package/dist/components/file-preview/file-preview-lazy-viewer.d.ts +3 -0
  37. package/dist/components/file-preview/file-preview-path.d.ts +30 -0
  38. package/dist/components/file-preview/file-preview-source.d.ts +24 -0
  39. package/dist/components/file-preview/file-preview-state.d.ts +28 -0
  40. package/dist/components/file-preview/file-preview-tab-row.d.ts +16 -0
  41. package/dist/components/file-preview/file-preview-viewer.d.ts +31 -0
  42. package/dist/components/file-preview/file-preview.d.ts +14 -1
  43. package/dist/components/file-preview/index.d.ts +1 -0
  44. package/dist/components/file-preview/style.css +4139 -0
  45. package/dist/components/file-preview/types.d.ts +516 -0
  46. package/dist/components/file-preview/use-file-preview-actions-context.d.ts +23 -0
  47. package/dist/components/file-preview/use-file-preview-actions.d.ts +19 -0
  48. package/dist/components/file-preview/use-file-preview-editing.d.ts +32 -0
  49. package/dist/components/file-preview/use-file-preview-ids.d.ts +24 -0
  50. package/dist/components/file-preview.js +1 -0
  51. package/dist/components/file-tree/file-tree-body.d.ts +18 -0
  52. package/dist/components/file-tree/file-tree-entry-row.d.ts +12 -0
  53. package/dist/components/file-tree/file-tree-icons.d.ts +15 -0
  54. package/dist/components/file-tree/file-tree-info-labels.d.ts +21 -0
  55. package/dist/components/file-tree/file-tree-info-tooltip.d.ts +43 -0
  56. package/dist/components/file-tree/file-tree-info.d.ts +29 -0
  57. package/dist/components/file-tree/file-tree-keyboard.d.ts +14 -0
  58. package/dist/components/file-tree/file-tree-row-context.d.ts +46 -0
  59. package/dist/components/file-tree/file-tree-row-shared.d.ts +11 -0
  60. package/dist/components/file-tree/file-tree-spinner.d.ts +10 -0
  61. package/dist/components/file-tree/file-tree-state-row.d.ts +7 -0
  62. package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +22 -0
  63. package/dist/components/file-tree/file-tree-tooltip.d.ts +17 -0
  64. package/dist/components/file-tree/file-tree.d.ts +15 -1
  65. package/dist/components/file-tree/index.d.ts +1 -0
  66. package/dist/components/file-tree/style.css +410 -0
  67. package/dist/components/file-tree/types.d.ts +589 -0
  68. package/dist/components/file-tree/use-file-tree-actions.d.ts +17 -0
  69. package/dist/components/file-tree.js +1 -0
  70. package/dist/components/scope-switcher/index.d.ts +1 -0
  71. package/dist/components/scope-switcher/scope-keyboard.d.ts +2 -0
  72. package/dist/components/scope-switcher/scope-panel.d.ts +11 -0
  73. package/dist/components/scope-switcher/scope-selector.d.ts +2 -0
  74. package/dist/components/scope-switcher/scope-switcher.d.ts +6 -1
  75. package/dist/components/scope-switcher/style.css +452 -0
  76. package/dist/components/scope-switcher/types.d.ts +489 -0
  77. package/dist/components/scope-switcher.js +3 -0
  78. package/dist/components/style.css +14249 -18
  79. package/dist/components/tui/command-catalog.d.ts +58 -0
  80. package/dist/components/tui/command-completion.d.ts +19 -0
  81. package/dist/components/tui/command-definitions.d.ts +10 -0
  82. package/dist/components/tui/command-input.d.ts +16 -0
  83. package/dist/components/tui/index.d.ts +1 -0
  84. package/dist/components/tui/style.css +1552 -0
  85. package/dist/components/tui/tui-assist.d.ts +15 -0
  86. package/dist/components/tui/tui-code-block.d.ts +8 -0
  87. package/dist/components/tui/tui-command-help.d.ts +9 -0
  88. package/dist/components/tui/tui-command-text.d.ts +6 -0
  89. package/dist/components/tui/tui-composer.d.ts +24 -0
  90. package/dist/components/tui/tui-copy-button.d.ts +9 -0
  91. package/dist/components/tui/tui-input-mirror.d.ts +14 -0
  92. package/dist/components/tui/tui-labels-zh.d.ts +2 -0
  93. package/dist/components/tui/tui-labels.d.ts +5 -0
  94. package/dist/components/tui/tui-markdown-renderers.d.ts +10 -0
  95. package/dist/components/tui/tui-markdown.d.ts +6 -0
  96. package/dist/components/tui/tui-param-hint.d.ts +7 -0
  97. package/dist/components/tui/tui-record-time.d.ts +11 -0
  98. package/dist/components/tui/tui-record.d.ts +13 -0
  99. package/dist/components/tui/tui-resource-preview.d.ts +10 -0
  100. package/dist/components/tui/tui-resource-tree.d.ts +10 -0
  101. package/dist/components/tui/tui-result-header.d.ts +7 -0
  102. package/dist/components/tui/tui-result-text.d.ts +5 -0
  103. package/dist/components/tui/tui-search-list.d.ts +8 -0
  104. package/dist/components/tui/tui-skeleton.d.ts +6 -0
  105. package/dist/components/tui/tui-status-card.d.ts +7 -0
  106. package/dist/components/tui/tui-text.d.ts +10 -0
  107. package/dist/components/tui/tui-uri-text.d.ts +19 -0
  108. package/dist/components/tui/tui-write-result.d.ts +7 -0
  109. package/dist/components/tui/tui.d.ts +11 -1
  110. package/dist/components/tui/types.d.ts +527 -0
  111. package/dist/components/tui/use-tui-assist-position.d.ts +3 -0
  112. package/dist/components/tui/use-tui-completion.d.ts +14 -0
  113. package/dist/components/tui/use-tui-composer-keyboard.d.ts +25 -0
  114. package/dist/components/tui.js +1 -0
  115. package/dist/components/viking-bot/ark-adapter.d.ts +45 -0
  116. package/dist/components/viking-bot/ark-message-body.d.ts +16 -0
  117. package/dist/components/viking-bot/ark-message-list-view.d.ts +7 -0
  118. package/dist/components/viking-bot/ark-message-row.d.ts +19 -0
  119. package/dist/components/viking-bot/index.d.ts +10 -0
  120. package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +10 -0
  121. package/dist/components/viking-bot/interaction/index.d.ts +4 -0
  122. package/dist/components/viking-bot/interaction/labels.d.ts +7 -0
  123. package/dist/components/viking-bot/interaction/lazy-interaction.d.ts +3 -0
  124. package/dist/components/viking-bot/interaction/schedule-input.d.ts +13 -0
  125. package/dist/components/viking-bot/interaction/style.css +189 -0
  126. package/dist/components/viking-bot/interaction/types.d.ts +188 -0
  127. package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +9 -0
  128. package/dist/components/viking-bot/interaction.js +2 -0
  129. package/dist/components/viking-bot/labels.d.ts +2 -0
  130. package/dist/components/viking-bot/lazy-composer.d.ts +3 -0
  131. package/dist/components/viking-bot/message-groups.d.ts +12 -0
  132. package/dist/components/viking-bot/model.d.ts +252 -0
  133. package/dist/components/viking-bot/render-part.d.ts +12 -0
  134. package/dist/components/viking-bot/style.css +7133 -0
  135. package/dist/components/viking-bot/types.d.ts +140 -0
  136. package/dist/components/viking-bot/viking-bot-composer.d.ts +6 -0
  137. package/dist/components/viking-bot/viking-bot-message-list.d.ts +3 -0
  138. package/dist/components/viking-bot/viking-bot.d.ts +16 -1
  139. package/dist/components/viking-bot.js +4 -0
  140. package/dist/c~0.js +201 -0
  141. package/dist/file-preview-viewer~0.js +191 -0
  142. package/dist/f~0.js +356 -0
  143. package/dist/g~0.js +1207 -0
  144. package/dist/h~0.js +58 -0
  145. package/dist/icons/file-type-icon.d.ts +31 -0
  146. package/dist/icons/index.d.ts +33 -23
  147. package/dist/icons/nextjs-icon.d.ts +19 -0
  148. package/dist/icons.js +1 -25
  149. package/dist/index.d.ts +16 -2
  150. package/dist/index.js +8 -1
  151. package/dist/k~0.js +1440 -0
  152. package/dist/lk~0.js +233 -0
  153. package/dist/l~0.js +44 -0
  154. package/dist/modules/console/console.d.ts +4 -0
  155. package/dist/modules/console/index.d.ts +1 -0
  156. package/dist/modules/console/style.css +111 -0
  157. package/dist/modules/console/types.d.ts +101 -0
  158. package/dist/modules/console.js +1 -0
  159. package/dist/modules/file-browser/file-browser-toolbar-button.d.ts +10 -0
  160. package/dist/modules/file-browser/file-browser.d.ts +6 -0
  161. package/dist/modules/file-browser/index.d.ts +1 -0
  162. package/dist/modules/file-browser/style.css +158 -0
  163. package/dist/modules/file-browser/types.d.ts +101 -0
  164. package/dist/modules/file-browser.js +1 -0
  165. package/dist/modules/scope-cascade/controller.d.ts +6 -0
  166. package/dist/modules/scope-cascade/index.d.ts +3 -0
  167. package/dist/modules/scope-cascade/scope-cascade.d.ts +3 -0
  168. package/dist/modules/scope-cascade/style.css +456 -0
  169. package/dist/modules/scope-cascade/style.js +0 -0
  170. package/dist/modules/scope-cascade/types.d.ts +39 -0
  171. package/dist/modules/scope-cascade/use-scope-cascade.d.ts +5 -0
  172. package/dist/modules/scope-cascade.js +1 -0
  173. package/dist/modules/style.css +808 -0
  174. package/dist/modules/style.js +0 -0
  175. package/dist/n~0.js +727 -0
  176. package/dist/shared/components/tooltip/index.d.ts +1 -0
  177. package/dist/shared/components/tooltip/tooltip.d.ts +25 -0
  178. package/dist/shared/components/tooltip/types.d.ts +42 -0
  179. package/dist/shared/components/tooltip/use-tooltip-position.d.ts +38 -0
  180. package/dist/style.css +15138 -18
  181. package/dist/u~0.js +1601 -0
  182. package/dist/viking-bot-composer~0.js +164 -0
  183. package/dist/viking-bot-interaction~0.js +284 -0
  184. package/dist/w~0.js +19 -0
  185. package/package.json +46 -22
  186. package/dist/components/resource-import/resource-import.d.ts +0 -1
  187. package/dist/components/resource-import/style.css +0 -2
  188. package/dist/components/status-badge/status-badge.d.ts +0 -8
  189. package/dist/components/status-badge/style.css +0 -37
  190. package/dist/components/status-badge.js +0 -30
  191. /package/dist/components/{resource-import → viking-bot/interaction}/style.js +0 -0
  192. /package/dist/{components/status-badge → modules/console}/style.js +0 -0
  193. /package/dist/{components/resource-import.js → modules/file-browser/style.js} +0 -0
@@ -0,0 +1,21 @@
1
+ import type { FileTreeInfoKey, FileTreeInfoLabels } from './types.js';
2
+ /**
3
+ * 内置英文文案。`FileTreeLabels.info` 未提供的键沿用这里的值。
4
+ *
5
+ * Built-in English copy. Keys missing from `FileTreeLabels.info` fall back here.
6
+ */
7
+ export declare const DEFAULT_INFO_LABELS: FileTreeInfoLabels;
8
+ /**
9
+ * 按宿主的覆盖合并内置文案,键为单位。宿主的空字符串表示该键不显示,因此
10
+ * 合并时保留空串,由渲染方判断。
11
+ *
12
+ * Merges host overrides over the built-in copy, key by key. An empty host string
13
+ * means "hide this key", so it is kept and the renderer decides.
14
+ *
15
+ * Returns the copy of one key, or `undefined` when the key is hidden or has no
16
+ * copy.
17
+ */
18
+ export declare function resolveInfoCopy(key: FileTreeInfoKey, hostLabels: FileTreeInfoLabels | undefined): {
19
+ description?: string;
20
+ triggerBehavior?: string;
21
+ };
@@ -0,0 +1,43 @@
1
+ import type { FileTreeEntryRow, FileTreeInfoLabels } from './types.js';
2
+ export interface FileTreeInfoCopy {
3
+ /** 行名称,作为浮层标题。Row name, used as the tooltip title. */
4
+ title: string;
5
+ /** 说明,已按行内同样的优先级解析。Description, resolved with the same precedence as inline. */
6
+ description?: string;
7
+ /** 触发行为,只出现在浮层。Trigger copy, tooltip only. */
8
+ triggerBehavior?: string;
9
+ /** 完整路径。Full path. */
10
+ path: string;
11
+ /** 浮层里各行的字段名。Field names used inside the tooltip. */
12
+ fields: {
13
+ description: string;
14
+ triggerBehavior: string;
15
+ path: string;
16
+ };
17
+ }
18
+ /**
19
+ * 解析目录浮层要显示的内容,没有可显示内容时返回 `null`。
20
+ *
21
+ * 说明按 `row.description` → 内置文案的顺序解析,与行内一致:宿主给了就用宿主的
22
+ * (含显式空串),没给才用内置。调用方据此决定是否创建浮层外壳,避免留下一个
23
+ * 只有背景和内边距的空壳。
24
+ *
25
+ * Resolves what a directory tooltip should show, or `null` when there is nothing.
26
+ *
27
+ * The description resolves as `row.description` then built-in copy, matching the
28
+ * inline behaviour: a host value wins, including an explicit empty string, and
29
+ * the built-in copy applies only when absent. The caller uses this to decide
30
+ * whether to create the tooltip shell, so no empty shell is left behind.
31
+ */
32
+ export declare function resolveFileTreeInfoCopy(row: FileTreeEntryRow, infoLabels?: FileTreeInfoLabels): FileTreeInfoCopy | null;
33
+ /**
34
+ * 目录的默认浮层内容:说明、触发行为与路径。九类长期记忆的说明只出现在这里,
35
+ * 因此这个浮层是它们唯一的展示位置。
36
+ *
37
+ * The default tooltip content for a directory: description, trigger copy and
38
+ * path. The nine long-term-memory keys describe themselves here only, so this
39
+ * tooltip is the sole place their copy appears.
40
+ */
41
+ export declare function FileTreeInfoTooltip({ copy }: {
42
+ copy: FileTreeInfoCopy;
43
+ }): import("react").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import type { FileTreeInfoKey } from './types.js';
2
+ /**
3
+ * 把 `viking://` 地址拆成小写路径段,忽略协议、查询串与末尾斜杠。
4
+ *
5
+ * Splits a `viking://` address into lower-cased segments, ignoring the scheme,
6
+ * query string and trailing slashes.
7
+ */
8
+ export declare function splitVikingUri(uri: string): string[];
9
+ /**
10
+ * 按路径结构判定目录的语义键,判定不出来时返回 `null`。
11
+ *
12
+ * 只认路径形状,不认节点类型:同名目录在目录与文件位置上含义相同,由调用方
13
+ * 决定是否使用。判定规则与产品无关,任何宿主都能直接命中。
14
+ *
15
+ * Resolves the semantic key of a directory from its path structure, or `null`
16
+ * when nothing matches.
17
+ *
18
+ * Only the path shape is inspected, not the node type: a name means the same
19
+ * thing whether it is a directory or a file, and the caller decides whether to
20
+ * use it. The rules are product-neutral, so any host matches them.
21
+ */
22
+ export declare function resolveFileTreeInfoKey(uri: string): FileTreeInfoKey | null;
23
+ /**
24
+ * 该键的说明是否显示在行内。判定不出来时为 `false`。
25
+ *
26
+ * Whether the description of this key renders inline; `false` when nothing
27
+ * matched.
28
+ */
29
+ export declare function showsInlineDescription(key: FileTreeInfoKey | null): boolean;
@@ -0,0 +1,14 @@
1
+ import type { KeyboardEvent } from 'react';
2
+ import type { FileTreeEntryRow } from './types.js';
3
+ /**
4
+ * 树行的键盘语义:上下移动焦点,左右展开折叠,回车与空格选中。
5
+ *
6
+ * Keyboard semantics for a row: up/down move focus, left/right collapse and
7
+ * expand, Enter and Space select.
8
+ */
9
+ export declare function handleRowKeyDown(event: KeyboardEvent<HTMLDivElement>, { root, row, onSelect, onToggleExpand, }: {
10
+ root: HTMLElement | null;
11
+ row: FileTreeEntryRow;
12
+ onSelect?: (row: FileTreeEntryRow) => void;
13
+ onToggleExpand?: (row: FileTreeEntryRow) => void;
14
+ }): void;
@@ -0,0 +1,46 @@
1
+ import type { HTMLAttributes, KeyboardEvent, ReactNode } from 'react';
2
+ import type { FileTreeEntryRow, FileTreeErrorRow, FileTreeInfoLabels, FileTreeLabels, FileTreeLoadMoreRow, FileTreeRow } from './types.js';
3
+ /**
4
+ * 文案的内部形状:标量项都有默认值,嵌套的 `info` 保持可选。
5
+ *
6
+ * Internal copy shape: every scalar has a default, while the nested `info`
7
+ * stays optional.
8
+ */
9
+ export type ResolvedLabels = Required<Omit<FileTreeLabels, 'info'>> & Pick<FileTreeLabels, 'info'>;
10
+ /** 渲染行所需的外部输入,由组件主体注入。Row rendering inputs, injected by the tree. */
11
+ export interface FileTreeRowContext {
12
+ /** 已合并默认值的文案。Copy with defaults merged in. */
13
+ text: ResolvedLabels;
14
+ /** 目录说明的宿主覆盖,用于解析内置说明。Host overrides for directory copy. */
15
+ infoLabels?: FileTreeInfoLabels;
16
+ /** 当前选中的行 id。Currently selected row id. */
17
+ selectedId?: string | null;
18
+ /** 当前展示浮层的行 id。Row whose tooltip is showing. */
19
+ tooltipRowId: string | null;
20
+ /** 为行追加属性。Extra attributes for a row. */
21
+ getRowAttributes?: (row: FileTreeRow) => HTMLAttributes<HTMLDivElement>;
22
+ /** 行尾指示器。Row-end indicator. */
23
+ renderDashboard?: (row: FileTreeEntryRow) => ReactNode;
24
+ /** 悬停浮层内容。Hover content. */
25
+ renderRowTooltip?: (row: FileTreeEntryRow) => ReactNode;
26
+ /** 行首文件图标。Leading icon for a file row. */
27
+ renderRowIcon?: (row: FileTreeEntryRow) => ReactNode;
28
+ /** 加载转圈;省略时用内置的 CSS 圆环。Loading spinner; defaults to the CSS ring. */
29
+ renderSpinner?: () => ReactNode;
30
+ /** 选中。Selects a row. */
31
+ onSelect?: (row: FileTreeEntryRow) => void;
32
+ /** 展开或折叠。Expands or collapses a directory. */
33
+ onToggleExpand?: (row: FileTreeEntryRow) => void;
34
+ /** 加载下一页。Loads the next page. */
35
+ onLoadMore?: (row: FileTreeLoadMoreRow) => void;
36
+ /** 重试失败的子节点。Retries a failed children load. */
37
+ onRetry?: (row: FileTreeErrorRow) => void;
38
+ /** 打开保留策略设置。Opens retention settings. */
39
+ onOpenRetentionSettings?: (uri: string) => void;
40
+ /** 行的键盘处理。Key handling for a row. */
41
+ onRowKeyDown: (event: KeyboardEvent<HTMLDivElement>, row: FileTreeEntryRow) => void;
42
+ /** 指针进入行。Pointer enters a row. */
43
+ onRowEnter: (rowId: string) => void;
44
+ /** 指针离开行。Pointer leaves a row. */
45
+ onRowLeave: () => void;
46
+ }
@@ -0,0 +1,11 @@
1
+ /** 每一级缩进与祖先连线的宽度。Indent per level, and the guide through it. */
2
+ export declare const INDENT = 20;
3
+ export declare const CHEVRON_SIZE = 16;
4
+ /** 行按深度缩进。Indents a row by its depth. */
5
+ export declare function rowStyle(depth: number): {
6
+ paddingLeft: number;
7
+ };
8
+ /** 每一级祖先画一条竖线,上下各溢出 1px 让相邻行接上。 */
9
+ export declare function Guides({ depth }: {
10
+ depth: number;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ /**
3
+ * 目录加载子节点时,替换展开箭头显示的转圈。用纯 CSS 画环,不依赖图标资源。
4
+ * 需要换成图标或品牌化的加载态时,改用 `FileTree` 的 `slots.spinner` 覆盖。
5
+ *
6
+ * The spinner shown in place of the expand chevron while a directory loads its
7
+ * children. Drawn with CSS alone, so it needs no icon asset. To swap in an icon
8
+ * or a branded loader, override it with `FileTree`'s `slots.spinner`.
9
+ */
10
+ export declare function FileTreeSpinner({ className, ...rest }: HTMLAttributes<HTMLSpanElement>): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { FileTreeRowContext } from './file-tree-row-context.js';
2
+ import type { FileTreeRow } from './types.js';
3
+ /** 非条目行:加载、分页、失败与空态都只占一行,不参与选中。 */
4
+ export declare function FileTreeStateRow({ row, ctx, }: {
5
+ row: FileTreeRow;
6
+ ctx: FileTreeRowContext;
7
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,22 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { FileTreeEntryRow, FileTreeInfoLabels } from './types.js';
3
+ /**
4
+ * 行浮层的外壳。宿主提供 `renderRowTooltip` 时只渲染它返回的内容;它返回 `null`
5
+ * 表示这一行不显示浮层,不回退到内置内容。
6
+ *
7
+ * 宿主没有提供时,用按 `uri` 解析的内置浮层。先解析内容、再决定是否创建外壳,
8
+ * 因此没有可显示内容时不会留下一个只有背景和内边距的空壳。
9
+ *
10
+ * The shell around a row tooltip. When the host supplies `renderRowTooltip`, only
11
+ * its result renders; returning `null` hides the tooltip for that row and does
12
+ * not fall back to the built-in content.
13
+ *
14
+ * When the host supplies none, the built-in tooltip resolved from the row `uri`
15
+ * renders. The content is resolved before the shell is created, so with nothing
16
+ * to show no empty shell with just background and padding is left behind.
17
+ */
18
+ export declare function FileTreeTooltipSurface({ row, infoLabels, renderRowTooltip, }: {
19
+ row: FileTreeEntryRow;
20
+ infoLabels?: FileTreeInfoLabels;
21
+ renderRowTooltip?: (row: FileTreeEntryRow) => ReactNode;
22
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 悬停停留一段时间后才展示行浮层。
3
+ *
4
+ * 用定时器而不是 CSS 延迟,是因为浮层内容由宿主渲染、需要按行 id 切换;卸载或
5
+ * 换行时清掉未触发的定时器,避免迟到的回调写入已失效的行。
6
+ *
7
+ * Shows a row tooltip once the pointer has rested for a while.
8
+ *
9
+ * A timer rather than a CSS delay, because the host renders the content and it
10
+ * switches per row id; a pending timer is cleared on unmount or when the row
11
+ * changes, so a late callback never writes to a row that is gone.
12
+ */
13
+ export declare function useRowTooltip(delay?: number): {
14
+ tooltipRowId: string | null;
15
+ show: (rowId: string) => void;
16
+ hide: () => void;
17
+ };
@@ -1 +1,15 @@
1
- export {};
1
+ import type { FileTreeComponent } from './types.js';
2
+ export { FileTreeSpinner } from './file-tree-spinner.js';
3
+ export { resolveFileTreeInfoKey, showsInlineDescription, splitVikingUri, } from './file-tree-info.js';
4
+ export { DEFAULT_INFO_LABELS, resolveInfoCopy, } from './file-tree-info-labels.js';
5
+ export { FILE_TREE_ROW_ATTRIBUTE } from './types.js';
6
+ export type { FileTreeChildRow, FileTreeComponent, FileTreeEmptyRow, FileTreeEntryRow, FileTreeErrorRow, FileTreeHandle, FileTreeInfoKey, FileTreeInfoLabels, FileTreeLabels, FileTreeLoadingRow, FileTreeLoadMoreRow, FileTreeOperations, FileTreeProps, FileTreeRow, FileTreeRowBase, FileTreeSlots, } from './types.js';
7
+ /**
8
+ * 目录树。宿主把树状态展平成有序行列表传进来,组件负责渲染、键盘交互,
9
+ * 并在操作成功后通知。
10
+ *
11
+ * A file tree. The host flattens its tree state into an ordered row list; the
12
+ * component renders it, handles keyboard interaction and reports successful
13
+ * operations.
14
+ */
15
+ export declare const FileTree: FileTreeComponent;
@@ -0,0 +1 @@
1
+ export * from './file-tree.js';
@@ -1,2 +1,412 @@
1
+ .ov-agent-connect, .ov-file-browser, .ov-file-preview, .ov-file-tree, .ov-module-placeholder, .ov-scope-switcher, .ov-tooltip, .ov-tui, .ov-viking-bot, .ov-viking-bot__interaction {
2
+ --ov-ui-primary-default: #5252ff;
3
+ --ov-ui-primary-hover-default: #7075ff;
4
+ --ov-ui-primary-active-default: #3833d2;
5
+ --ov-ui-primary-light-default: #f5f7ff;
6
+ --ov-ui-connect-glow-warm-default: #ff952b0a;
7
+ --ov-ui-connect-glow-pink-default: #fb4fbc0f;
8
+ --ov-ui-connect-glow-pink-soft-default: #fb4fbc0a;
9
+ --ov-ui-on-primary-default: #fff;
10
+ --ov-ui-text-1-default: #0b0b0f;
11
+ --ov-ui-text-2-default: #3f3f51;
12
+ --ov-ui-text-3-default: #6e718c;
13
+ --ov-ui-text-description-default: #0006;
14
+ --ov-ui-text-disabled-default: #a5a7bb;
15
+ --ov-ui-border-1-default: #f0f2fa;
16
+ --ov-ui-border-2-default: #e1e4f2;
17
+ --ov-ui-border-3-default: #d7daea;
18
+ --ov-ui-bg-1-default: #fff;
19
+ --ov-ui-bg-3-default: #f7f8fd;
20
+ --ov-ui-bg-4-default: #f6f7fa;
21
+ --ov-ui-bg-5-default: #f1f2f9;
22
+ --ov-ui-status-success-default: #1f9d55;
23
+ --ov-ui-shadow-default: #0f172a;
24
+ --ov-ui-focus-default: #5252ff;
25
+ --ov-ui-fill-hover-default: #f1f2f9;
26
+ --ov-ui-status-error-default: #c43838;
27
+ --ov-ui-warning-default: #b26a00;
28
+ --ov-ui-warning-light-default: #fff0b3;
29
+ --ov-ui-tooltip-bg-default: #1f2329;
30
+ --ov-ui-tooltip-text-default: #fff;
31
+ }
32
+
33
+ .dark .ov-agent-connect, .dark .ov-file-browser, .dark .ov-file-preview, .dark .ov-file-tree, .dark .ov-module-placeholder, .dark .ov-scope-switcher, .dark .ov-tooltip, .dark .ov-tui, .dark .ov-viking-bot, .dark .ov-viking-bot__interaction {
34
+ --ov-ui-primary-default: #5f5fff;
35
+ --ov-ui-primary-hover-default: #7075ff;
36
+ --ov-ui-primary-active-default: #4242ba;
37
+ --ov-ui-primary-light-default: #1a1632;
38
+ --ov-ui-connect-glow-warm-default: #ff952b05;
39
+ --ov-ui-connect-glow-pink-default: #fb4fbc08;
40
+ --ov-ui-connect-glow-pink-soft-default: #fb4fbc05;
41
+ --ov-ui-text-1-default: #c7ccd6;
42
+ --ov-ui-text-2-default: #9da3af;
43
+ --ov-ui-text-3-default: #737a87;
44
+ --ov-ui-text-description-default: #fff6;
45
+ --ov-ui-text-disabled-default: #42464e;
46
+ --ov-ui-border-1-default: #23252a;
47
+ --ov-ui-border-2-default: #2e3138;
48
+ --ov-ui-border-3-default: #3a3d45;
49
+ --ov-ui-bg-1-default: #131416;
50
+ --ov-ui-bg-3-default: #1b1d21;
51
+ --ov-ui-bg-4-default: #202227;
52
+ --ov-ui-bg-5-default: #23252a;
53
+ --ov-ui-focus-default: #5f5fff;
54
+ --ov-ui-fill-hover-default: #23252a;
55
+ --ov-ui-status-error-default: #ff9595;
56
+ --ov-ui-warning-default: #e0a04a;
57
+ --ov-ui-warning-light-default: #3a2f14;
58
+ --ov-ui-tooltip-bg-default: #2a2d33;
59
+ --ov-ui-tooltip-text-default: #f0f1f3;
60
+ }
61
+
62
+ .ov-agent-connect {
63
+ --ov-ui-connect-card-default: #fbfbfc;
64
+ --ov-ui-connect-tabs-default: #f7f7f9;
65
+ --ov-ui-connect-selected-default: #f3f4f7;
66
+ --ov-ui-connect-border-default: #edeef2;
67
+ --ov-ui-connect-outline-default: #e1e3ea;
68
+ --ov-ui-connect-muted-default: #787c91;
69
+ --ov-ui-connect-notice-default: #2e2984;
70
+ }
71
+
72
+ .dark .ov-agent-connect {
73
+ --ov-ui-connect-card-default: var(--ov-ui-bg-3-default);
74
+ --ov-ui-connect-tabs-default: var(--ov-ui-bg-3-default);
75
+ --ov-ui-connect-selected-default: var(--ov-ui-bg-4-default);
76
+ --ov-ui-connect-border-default: var(--ov-ui-border-1-default);
77
+ --ov-ui-connect-outline-default: var(--ov-ui-border-2-default);
78
+ --ov-ui-connect-muted-default: var(--ov-ui-text-3-default);
79
+ --ov-ui-connect-notice-default: var(--ov-ui-text-2-default);
80
+ }
81
+
82
+ .ov-file-tree {
83
+ --ov-ui-file-tree-row-height: 32px;
84
+ --ov-ui-file-tree-row-radius: 4px;
85
+ --ov-ui-file-tree-indent: 20px;
86
+ --ov-ui-file-tree-text: var(--ov-ui-color-text-1, var(--ov-ui-text-1-default, #0b0b0f));
87
+ --ov-ui-file-tree-text-muted: var(--ov-ui-color-text-3, var(--ov-ui-text-3-default, #6e718c));
88
+ --ov-ui-file-tree-icon: var(--ov-ui-color-text-2, var(--ov-ui-text-2-default, #3f3f51));
89
+ --ov-ui-file-tree-row-hover: var(--ov-ui-color-bg-5, var(--ov-ui-bg-5-default, #f1f2f9));
90
+ --ov-ui-file-tree-row-selected: var(--ov-ui-color-bg-4, var(--ov-ui-bg-4-default, #f6f7fa));
91
+ --ov-ui-file-tree-guide: var(--ov-ui-color-border-2, var(--ov-ui-border-2-default, #e1e4f2));
92
+ --ov-ui-file-tree-spinner-track: var(--ov-ui-color-border-3, var(--ov-ui-border-3-default, #d7daea));
93
+ --ov-ui-file-tree-spinner: var(--ov-ui-color-primary, var(--ov-ui-primary-default, #5252ff));
94
+ --ov-ui-file-tree-action: var(--ov-ui-color-primary, var(--ov-ui-primary-default, #5252ff));
95
+ --ov-ui-file-tree-warning: var(--ov-ui-color-warning, var(--ov-ui-warning-default, #b26a00));
96
+ box-sizing: border-box;
97
+ min-width: 0;
98
+ min-height: 0;
99
+ color: var(--ov-ui-file-tree-text);
100
+ flex-direction: column;
101
+ font-family: inherit;
102
+ font-size: 13px;
103
+ line-height: 20px;
104
+ display: flex;
105
+ }
106
+
107
+ .ov-file-tree__toolbar {
108
+ flex: none;
109
+ padding: 4px 0 8px;
110
+ }
111
+
112
+ .ov-file-tree__body {
113
+ flex: auto;
114
+ min-height: 0;
115
+ overflow: auto;
116
+ }
117
+
118
+ .ov-file-tree__rows {
119
+ flex-direction: column;
120
+ display: flex;
121
+ }
122
+
123
+ .ov-file-tree__row, .ov-file-tree__state-row {
124
+ box-sizing: border-box;
125
+ height: var(--ov-ui-file-tree-row-height);
126
+ border-radius: var(--ov-ui-file-tree-row-radius);
127
+ cursor: default;
128
+ -webkit-user-select: none;
129
+ user-select: none;
130
+ outline: none;
131
+ align-items: center;
132
+ gap: 4px;
133
+ padding-right: 8px;
134
+ display: flex;
135
+ position: relative;
136
+ }
137
+
138
+ .ov-file-tree__row {
139
+ transition: background-color .12s;
140
+ }
141
+
142
+ .ov-file-tree__row:hover {
143
+ background-color: var(--ov-ui-file-tree-row-hover);
144
+ }
145
+
146
+ .ov-file-tree__row[data-selected] {
147
+ background-color: var(--ov-ui-file-tree-row-selected);
148
+ }
149
+
150
+ .ov-file-tree__row:focus-visible, .ov-file-tree__state-row:focus-visible {
151
+ outline: 2px solid var(--ov-ui-file-tree-action);
152
+ outline-offset: -2px;
153
+ }
154
+
155
+ .ov-file-tree__row[data-disabled] {
156
+ color: var(--ov-ui-file-tree-text-muted);
157
+ cursor: not-allowed;
158
+ }
159
+
160
+ .ov-file-tree__guide {
161
+ background-color: var(--ov-ui-file-tree-guide);
162
+ pointer-events: none;
163
+ width: 1px;
164
+ position: absolute;
165
+ top: 0;
166
+ bottom: 0;
167
+ }
168
+
169
+ .ov-file-tree__toggle, .ov-file-tree__toggle-spacer {
170
+ flex: none;
171
+ justify-content: center;
172
+ align-items: center;
173
+ width: 16px;
174
+ height: 16px;
175
+ display: inline-flex;
176
+ }
177
+
178
+ .ov-file-tree__toggle {
179
+ color: var(--ov-ui-file-tree-text-muted);
180
+ cursor: pointer;
181
+ background: none;
182
+ border: 0;
183
+ border-radius: 4px;
184
+ padding: 0;
185
+ }
186
+
187
+ .ov-file-tree__toggle:hover:not(:disabled) {
188
+ background-color: var(--ov-ui-file-tree-row-hover);
189
+ }
190
+
191
+ .ov-file-tree__toggle:disabled {
192
+ cursor: default;
193
+ }
194
+
195
+ .ov-file-tree__chevron {
196
+ transition: transform .15s cubic-bezier(.22, 1, .36, 1);
197
+ }
198
+
199
+ .ov-file-tree__chevron[data-expanded] {
200
+ transform: rotate(90deg);
201
+ }
202
+
203
+ .ov-file-tree__icon-slot {
204
+ width: 16px;
205
+ height: 16px;
206
+ color: var(--ov-ui-file-tree-icon);
207
+ flex: none;
208
+ justify-content: center;
209
+ align-items: center;
210
+ display: inline-flex;
211
+ }
212
+
213
+ .ov-file-tree__folder {
214
+ width: 14px;
215
+ height: 14px;
216
+ display: inline-block;
217
+ position: relative;
218
+ }
219
+
220
+ .ov-file-tree__folder-layer {
221
+ opacity: 0;
222
+ width: 14px;
223
+ height: 14px;
224
+ transition: opacity .22s cubic-bezier(.22, 1, .36, 1);
225
+ position: absolute;
226
+ inset: 0;
227
+ }
228
+
229
+ .ov-file-tree__folder-layer[data-open="true"] {
230
+ opacity: 1;
231
+ }
232
+
233
+ .ov-file-tree__file-icon {
234
+ width: 16px;
235
+ height: 16px;
236
+ }
237
+
238
+ .ov-file-tree__label-group {
239
+ flex: auto;
240
+ align-items: center;
241
+ gap: 8px;
242
+ min-width: 0;
243
+ display: flex;
244
+ overflow: hidden;
245
+ }
246
+
247
+ .ov-file-tree__label {
248
+ text-overflow: ellipsis;
249
+ white-space: nowrap;
250
+ overflow: hidden;
251
+ }
252
+
253
+ .ov-file-tree__description {
254
+ color: var(--ov-ui-file-tree-text-muted);
255
+ text-overflow: ellipsis;
256
+ white-space: nowrap;
257
+ font-size: 12px;
258
+ overflow: hidden;
259
+ }
260
+
261
+ .ov-file-tree__level {
262
+ color: var(--ov-ui-file-tree-text-muted);
263
+ flex: none;
264
+ margin-left: auto;
265
+ font-size: 14px;
266
+ }
267
+
268
+ .ov-file-tree__expiry {
269
+ color: var(--ov-ui-file-tree-warning);
270
+ flex: none;
271
+ font-size: 12px;
272
+ }
273
+
274
+ .ov-file-tree__expiry-action {
275
+ color: inherit;
276
+ font: inherit;
277
+ cursor: pointer;
278
+ background: none;
279
+ border: 0;
280
+ padding: 0;
281
+ text-decoration: underline;
282
+ }
283
+
284
+ .ov-file-tree__dashboard {
285
+ flex: none;
286
+ align-items: center;
287
+ display: inline-flex;
288
+ }
289
+
290
+ .ov-file-tree__tooltip {
291
+ z-index: 1;
292
+ border-radius: var(--ov-ui-file-tree-row-radius);
293
+ background: var(--ov-ui-color-tooltip-bg, var(--ov-ui-tooltip-bg-default, #1f2329));
294
+ max-width: 320px;
295
+ color: var(--ov-ui-color-tooltip-text, var(--ov-ui-tooltip-text-default, #fff));
296
+ pointer-events: none;
297
+ padding: 6px 8px;
298
+ font-size: 12px;
299
+ line-height: 18px;
300
+ position: absolute;
301
+ top: calc(100% + 4px);
302
+ left: 0;
303
+ }
304
+
305
+ .ov-file-tree__info {
306
+ flex-direction: column;
307
+ gap: 4px;
308
+ display: flex;
309
+ }
310
+
311
+ .ov-file-tree__info-title {
312
+ word-break: break-all;
313
+ font-size: 13px;
314
+ font-weight: 500;
315
+ line-height: 20px;
316
+ }
317
+
318
+ .ov-file-tree__info-row {
319
+ gap: 8px;
320
+ min-width: 0;
321
+ display: flex;
322
+ }
323
+
324
+ .ov-file-tree__info-label {
325
+ opacity: .65;
326
+ flex: none;
327
+ }
328
+
329
+ .ov-file-tree__info-value {
330
+ word-break: break-word;
331
+ min-width: 0;
332
+ }
333
+
334
+ .ov-file-tree__info-path {
335
+ opacity: .8;
336
+ word-break: break-all;
337
+ min-width: 0;
338
+ }
339
+
340
+ .ov-file-tree__state-row {
341
+ color: var(--ov-ui-file-tree-text-muted);
342
+ }
343
+
344
+ .ov-file-tree__state-row[data-tone="error"] {
345
+ color: var(--ov-ui-color-status-error, var(--ov-ui-status-error-default, #c43838));
346
+ }
347
+
348
+ .ov-file-tree__state {
349
+ box-sizing: border-box;
350
+ min-height: 120px;
351
+ color: var(--ov-ui-file-tree-text-muted);
352
+ justify-content: center;
353
+ align-items: center;
354
+ padding: 24px;
355
+ display: flex;
356
+ }
357
+
358
+ .ov-file-tree__muted {
359
+ color: inherit;
360
+ text-overflow: ellipsis;
361
+ white-space: nowrap;
362
+ overflow: hidden;
363
+ }
364
+
365
+ .ov-file-tree__spinner {
366
+ box-sizing: border-box;
367
+ border: 1px solid var(--ov-ui-file-tree-spinner-track);
368
+ border-top-color: var(--ov-ui-file-tree-spinner);
369
+ border-radius: 50%;
370
+ flex: none;
371
+ width: 12px;
372
+ height: 12px;
373
+ animation: .9s linear infinite ov-file-tree-spin;
374
+ display: inline-block;
375
+ }
376
+
377
+ @keyframes ov-file-tree-spin {
378
+ to {
379
+ transform: rotate(360deg);
380
+ }
381
+ }
382
+
383
+ .ov-file-tree__action {
384
+ color: inherit;
385
+ font: inherit;
386
+ cursor: pointer;
387
+ background: none;
388
+ border: 0;
389
+ padding: 0;
390
+ transition: color .12s;
391
+ }
392
+
393
+ .ov-file-tree__action:hover:not(:disabled) {
394
+ color: var(--ov-ui-file-tree-action);
395
+ }
396
+
397
+ .ov-file-tree__action:disabled {
398
+ cursor: default;
399
+ }
400
+
401
+ @media (prefers-reduced-motion: reduce) {
402
+ .ov-file-tree__chevron, .ov-file-tree__folder-layer {
403
+ transition: none;
404
+ }
405
+
406
+ .ov-file-tree__spinner {
407
+ animation-duration: 2s;
408
+ }
409
+ }
410
+
1
411
 
2
412