@openviking/react 0.0.0-stage → 0.1.1

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 (104) hide show
  1. package/README.md +82 -2
  2. package/dist/3~0.js +8 -0
  3. package/dist/a~0.js +21 -0
  4. package/dist/client/client.d.ts +12 -0
  5. package/dist/client/errors.d.ts +30 -0
  6. package/dist/client/index.d.ts +4 -0
  7. package/dist/client/options.d.ts +101 -0
  8. package/dist/client/provider.d.ts +52 -0
  9. package/dist/client/types.d.ts +160 -0
  10. package/dist/client.js +239 -0
  11. package/dist/components/agent-connect/agent-connect.d.ts +4 -0
  12. package/dist/components/agent-connect/index.d.ts +1 -0
  13. package/dist/components/agent-connect/style.css +16 -0
  14. package/dist/components/agent-connect/style.js +0 -0
  15. package/dist/components/agent-connect/types.d.ts +175 -0
  16. package/dist/components/agent-connect.js +1 -0
  17. package/dist/components/file-preview/file-preview-body.d.ts +15 -0
  18. package/dist/components/file-preview/file-preview-header.d.ts +16 -0
  19. package/dist/components/file-preview/file-preview-icons.d.ts +2 -0
  20. package/dist/components/file-preview/file-preview-labels.d.ts +5 -0
  21. package/dist/components/file-preview/file-preview-operations.d.ts +1 -0
  22. package/dist/components/file-preview/file-preview.d.ts +17 -0
  23. package/dist/components/file-preview/index.d.ts +1 -0
  24. package/dist/components/file-preview/style.css +285 -0
  25. package/dist/components/file-preview/style.js +0 -0
  26. package/dist/components/file-preview/types.d.ts +435 -0
  27. package/dist/components/file-preview/use-file-preview-editing.d.ts +13 -0
  28. package/dist/components/file-preview.js +442 -0
  29. package/dist/components/file-tree/file-tree-body.d.ts +14 -0
  30. package/dist/components/file-tree/file-tree-dom.d.ts +4 -0
  31. package/dist/components/file-tree/file-tree-entry-row.d.ts +6 -0
  32. package/dist/components/file-tree/file-tree-icons.d.ts +8 -0
  33. package/dist/components/file-tree/file-tree-keyboard.d.ts +10 -0
  34. package/dist/components/file-tree/file-tree-labels.d.ts +5 -0
  35. package/dist/components/file-tree/file-tree-row-context.d.ts +24 -0
  36. package/dist/components/file-tree/file-tree-rows.d.ts +12 -0
  37. package/dist/components/file-tree/file-tree-tooltip.d.ts +11 -0
  38. package/dist/components/file-tree/file-tree.d.ts +4 -0
  39. package/dist/components/file-tree/index.d.ts +1 -0
  40. package/dist/components/file-tree/style.css +244 -0
  41. package/dist/components/file-tree/style.js +0 -0
  42. package/dist/components/file-tree/types.d.ts +406 -0
  43. package/dist/components/file-tree/use-file-tree-actions.d.ts +10 -0
  44. package/dist/components/file-tree.js +1 -0
  45. package/dist/components/scope-switcher/index.d.ts +1 -0
  46. package/dist/components/scope-switcher/scope-keyboard.d.ts +2 -0
  47. package/dist/components/scope-switcher/scope-panel.d.ts +5 -0
  48. package/dist/components/scope-switcher/scope-selector.d.ts +2 -0
  49. package/dist/components/scope-switcher/scope-switcher.d.ts +6 -0
  50. package/dist/components/scope-switcher/style.css +248 -0
  51. package/dist/components/scope-switcher/style.js +0 -0
  52. package/dist/components/scope-switcher/types.d.ts +367 -0
  53. package/dist/components/scope-switcher.js +3 -0
  54. package/dist/components/style.css +811 -0
  55. package/dist/components/style.js +0 -0
  56. package/dist/components/tui/index.d.ts +1 -0
  57. package/dist/components/tui/style.css +16 -0
  58. package/dist/components/tui/style.js +0 -0
  59. package/dist/components/tui/tui.d.ts +3 -0
  60. package/dist/components/tui/types.d.ts +485 -0
  61. package/dist/components/tui.js +1 -0
  62. package/dist/f~0.js +284 -0
  63. package/dist/icons/index.d.ts +23 -0
  64. package/dist/icons.js +25 -0
  65. package/dist/index.d.ts +16 -0
  66. package/dist/index.js +8 -0
  67. package/dist/i~0.js +21 -0
  68. package/dist/lk~0.js +220 -0
  69. package/dist/l~0.js +44 -0
  70. package/dist/modules/console/console.d.ts +4 -0
  71. package/dist/modules/console/index.d.ts +1 -0
  72. package/dist/modules/console/style.css +29 -0
  73. package/dist/modules/console/style.js +0 -0
  74. package/dist/modules/console/types.d.ts +101 -0
  75. package/dist/modules/console.js +1 -0
  76. package/dist/modules/file-browser/file-browser-toolbar-button.d.ts +10 -0
  77. package/dist/modules/file-browser/file-browser.d.ts +6 -0
  78. package/dist/modules/file-browser/index.d.ts +1 -0
  79. package/dist/modules/file-browser/style.css +75 -0
  80. package/dist/modules/file-browser/style.js +0 -0
  81. package/dist/modules/file-browser/types.d.ts +101 -0
  82. package/dist/modules/file-browser.js +1 -0
  83. package/dist/modules/scope-cascade/controller.d.ts +6 -0
  84. package/dist/modules/scope-cascade/index.d.ts +3 -0
  85. package/dist/modules/scope-cascade/scope-cascade.d.ts +3 -0
  86. package/dist/modules/scope-cascade/style.css +250 -0
  87. package/dist/modules/scope-cascade/style.js +0 -0
  88. package/dist/modules/scope-cascade/types.d.ts +39 -0
  89. package/dist/modules/scope-cascade/use-scope-cascade.d.ts +5 -0
  90. package/dist/modules/scope-cascade.js +1 -0
  91. package/dist/modules/style.css +385 -0
  92. package/dist/modules/style.js +0 -0
  93. package/dist/modules/task-center/columns.d.ts +129 -0
  94. package/dist/modules/task-center/index.d.ts +1 -0
  95. package/dist/modules/task-center/style.css +29 -0
  96. package/dist/modules/task-center/style.js +0 -0
  97. package/dist/modules/task-center/task-center.d.ts +4 -0
  98. package/dist/modules/task-center/types.d.ts +168 -0
  99. package/dist/modules/task-center.js +1 -0
  100. package/dist/n~0.js +499 -0
  101. package/dist/style.css +1198 -0
  102. package/dist/style.js +0 -0
  103. package/dist/u~0.js +8 -0
  104. package/package.json +103 -4
@@ -0,0 +1,244 @@
1
+ .ov-file-tree {
2
+ box-sizing: border-box;
3
+ min-width: 0;
4
+ min-height: 0;
5
+ color: inherit;
6
+ flex-direction: column;
7
+ font-family: inherit;
8
+ font-size: 13px;
9
+ line-height: 20px;
10
+ display: flex;
11
+ }
12
+
13
+ .ov-file-tree__toolbar {
14
+ flex: none;
15
+ padding: 4px 0 8px;
16
+ }
17
+
18
+ .ov-file-tree__body {
19
+ flex: auto;
20
+ min-height: 0;
21
+ overflow: auto;
22
+ }
23
+
24
+ .ov-file-tree__rows {
25
+ flex-direction: column;
26
+ display: flex;
27
+ }
28
+
29
+ .ov-file-tree__row {
30
+ box-sizing: border-box;
31
+ border-radius: var(--ov-ui-radius, 6px);
32
+ height: 28px;
33
+ color: inherit;
34
+ cursor: default;
35
+ -webkit-user-select: none;
36
+ user-select: none;
37
+ outline: none;
38
+ align-items: center;
39
+ gap: 4px;
40
+ padding-right: 8px;
41
+ display: flex;
42
+ position: relative;
43
+ }
44
+
45
+ .ov-file-tree__row:hover {
46
+ background: var(--ov-ui-row-hover, color-mix(in srgb, currentColor 6%, transparent));
47
+ }
48
+
49
+ .ov-file-tree__row:focus-visible {
50
+ outline: 2px solid var(--ov-ui-focus-ring, #2563c5);
51
+ outline-offset: -2px;
52
+ }
53
+
54
+ .ov-file-tree__row[data-selected] {
55
+ background: var(--ov-ui-row-selected, #2563c51a);
56
+ }
57
+
58
+ .ov-file-tree__row[data-disabled] {
59
+ color: var(--ov-ui-text-muted, color-mix(in srgb, currentColor 62%, transparent));
60
+ cursor: not-allowed;
61
+ }
62
+
63
+ .ov-file-tree__toggle, .ov-file-tree__toggle-spacer {
64
+ flex: none;
65
+ justify-content: center;
66
+ align-items: center;
67
+ width: 16px;
68
+ height: 16px;
69
+ display: inline-flex;
70
+ }
71
+
72
+ .ov-file-tree__toggle {
73
+ color: var(--ov-ui-text-muted, color-mix(in srgb, currentColor 62%, transparent));
74
+ cursor: pointer;
75
+ background: none;
76
+ border: 0;
77
+ border-radius: 4px;
78
+ padding: 0;
79
+ }
80
+
81
+ .ov-file-tree__toggle:hover {
82
+ background: color-mix(in srgb, currentColor 10%, transparent);
83
+ }
84
+
85
+ .ov-file-tree__chevron {
86
+ transition: transform .12s;
87
+ }
88
+
89
+ .ov-file-tree__chevron[data-expanded] {
90
+ transform: rotate(90deg);
91
+ }
92
+
93
+ .ov-file-tree__icon-slot {
94
+ color: var(--ov-ui-icon, color-mix(in srgb, currentColor 62%, transparent));
95
+ flex: none;
96
+ align-items: center;
97
+ display: inline-flex;
98
+ }
99
+
100
+ .ov-file-tree__icon {
101
+ display: block;
102
+ }
103
+
104
+ .ov-file-tree__label-group {
105
+ flex: auto;
106
+ align-items: baseline;
107
+ gap: 6px;
108
+ min-width: 0;
109
+ display: flex;
110
+ }
111
+
112
+ .ov-file-tree__label {
113
+ text-overflow: ellipsis;
114
+ white-space: nowrap;
115
+ overflow: hidden;
116
+ }
117
+
118
+ .ov-file-tree__description {
119
+ color: var(--ov-ui-text-muted, color-mix(in srgb, currentColor 62%, transparent));
120
+ text-overflow: ellipsis;
121
+ white-space: nowrap;
122
+ font-size: 12px;
123
+ overflow: hidden;
124
+ }
125
+
126
+ .ov-file-tree__level {
127
+ background: var(--ov-ui-chip, color-mix(in srgb, currentColor 10%, transparent));
128
+ color: var(--ov-ui-text-muted, color-mix(in srgb, currentColor 62%, transparent));
129
+ border-radius: 3px;
130
+ flex: none;
131
+ padding: 0 4px;
132
+ font-size: 11px;
133
+ line-height: 16px;
134
+ }
135
+
136
+ .ov-file-tree__expiry {
137
+ color: var(--ov-ui-warning, #b26a00);
138
+ flex: none;
139
+ font-size: 12px;
140
+ }
141
+
142
+ .ov-file-tree__expiry-action {
143
+ color: inherit;
144
+ font: inherit;
145
+ cursor: pointer;
146
+ background: none;
147
+ border: 0;
148
+ padding: 0;
149
+ text-decoration: underline;
150
+ }
151
+
152
+ .ov-file-tree__dashboard {
153
+ flex: none;
154
+ align-items: center;
155
+ display: inline-flex;
156
+ }
157
+
158
+ .ov-file-tree__tooltip {
159
+ z-index: 1;
160
+ border-radius: var(--ov-ui-radius, 6px);
161
+ background: var(--ov-ui-tooltip-bg, #1f2329);
162
+ max-width: 320px;
163
+ color: var(--ov-ui-tooltip-text, #fff);
164
+ pointer-events: none;
165
+ padding: 6px 8px;
166
+ font-size: 12px;
167
+ line-height: 18px;
168
+ position: absolute;
169
+ top: calc(100% + 4px);
170
+ left: 0;
171
+ }
172
+
173
+ .ov-file-tree__child-row {
174
+ box-sizing: border-box;
175
+ height: 28px;
176
+ color: var(--ov-ui-text-muted, color-mix(in srgb, currentColor 62%, transparent));
177
+ align-items: center;
178
+ gap: 6px;
179
+ padding-right: 8px;
180
+ display: flex;
181
+ }
182
+
183
+ .ov-file-tree__child-row[data-tone="error"] {
184
+ color: var(--ov-ui-status-error, #c43838);
185
+ }
186
+
187
+ .ov-file-tree__child-action {
188
+ color: inherit;
189
+ font: inherit;
190
+ cursor: pointer;
191
+ background: none;
192
+ border: 0;
193
+ padding: 0;
194
+ text-decoration: underline;
195
+ }
196
+
197
+ .ov-file-tree__child-action:disabled {
198
+ cursor: default;
199
+ opacity: .6;
200
+ }
201
+
202
+ .ov-file-tree__state {
203
+ box-sizing: border-box;
204
+ justify-content: center;
205
+ align-items: center;
206
+ min-height: 120px;
207
+ padding: 24px;
208
+ display: flex;
209
+ }
210
+
211
+ .ov-file-tree__muted {
212
+ color: inherit;
213
+ }
214
+
215
+ .ov-file-tree__spinner {
216
+ box-sizing: border-box;
217
+ border: 1.5px solid;
218
+ border-right-color: #0000;
219
+ border-radius: 50%;
220
+ flex: none;
221
+ width: 12px;
222
+ height: 12px;
223
+ animation: .72s linear infinite ov-file-tree-spin;
224
+ display: inline-block;
225
+ }
226
+
227
+ @keyframes ov-file-tree-spin {
228
+ to {
229
+ transform: rotate(360deg);
230
+ }
231
+ }
232
+
233
+ @media (prefers-reduced-motion: reduce) {
234
+ .ov-file-tree__chevron {
235
+ transition: none;
236
+ }
237
+
238
+ .ov-file-tree__spinner {
239
+ animation-duration: 2s;
240
+ }
241
+ }
242
+
243
+
244
+
File without changes
@@ -0,0 +1,406 @@
1
+ import type { ForwardRefExoticComponent, HTMLAttributes, PropsWithoutRef, ReactNode, RefAttributes } from 'react';
2
+ /**
3
+ * 所有行的公共字段。行是按宿主展平后的顺序渲染的,因此 `id` 与 `depth` 每行都要有。
4
+ *
5
+ * Fields shared by every row. Rows render in the host-flattened order, so each
6
+ * one carries its own `id` and `depth`.
7
+ */
8
+ export interface FileTreeRowBase {
9
+ /**
10
+ * 行唯一标识,用于选中与定位。
11
+ * Unique row identity, used for selection and lookup.
12
+ */
13
+ id: string;
14
+ /**
15
+ * 缩进层级,根层为 `0`。
16
+ * Indentation level; the root level is `0`.
17
+ */
18
+ depth: number;
19
+ }
20
+ /**
21
+ * 子节点区域的行。这些行挂在某个父节点下方,用 `parentId` 表示归属。
22
+ *
23
+ * A row inside a children area. These rows sit under a parent node and use
24
+ * `parentId` to name it.
25
+ */
26
+ export interface FileTreeChildRow extends FileTreeRowBase {
27
+ /**
28
+ * 所属父节点的 id。整体加载失败、没有具体父节点时省略。
29
+ * Id of the owning parent; omitted when the failure is not tied to a parent.
30
+ */
31
+ parentId?: string;
32
+ }
33
+ /**
34
+ * 树中一条可见的行。宿主把自己的树状态展开成有序行列表后传入,
35
+ * 因此展开、分页、加载、错误行都由调用方决定,组件不感知树结构。
36
+ *
37
+ * One visible row of the tree. The host flattens its own tree state into this
38
+ * ordered list, so expansion, pagination, loading and error rows all come from
39
+ * the caller and the component never inspects the tree structure.
40
+ */
41
+ export type FileTreeRow = FileTreeEntryRow | FileTreeLoadingRow | FileTreeLoadMoreRow | FileTreeErrorRow | FileTreeEmptyRow;
42
+ /**
43
+ * 一个目录或文件行。只保留渲染必需的字段,宿主负责把自身数据映射到该形状。
44
+ *
45
+ * A directory or file row. Only what rendering needs is kept here; the host
46
+ * maps its own data onto this shape.
47
+ */
48
+ export interface FileTreeEntryRow extends FileTreeRowBase {
49
+ /**
50
+ * 行类型标记,固定为 `entry`。
51
+ * Row kind discriminator, always `entry`.
52
+ */
53
+ kind: 'entry';
54
+ /**
55
+ * 资源标识,通过回调原样回传。
56
+ * Resource identifier reported back through callbacks unchanged.
57
+ */
58
+ uri: string;
59
+ /**
60
+ * 显示名称。
61
+ * Display name.
62
+ */
63
+ name: string;
64
+ /**
65
+ * 节点类型:目录或文件。
66
+ * Node type: directory or file.
67
+ */
68
+ type:
69
+ /**
70
+ * 目录。
71
+ * Directory.
72
+ */
73
+ 'directory'
74
+ /**
75
+ * 文件。
76
+ * File.
77
+ */
78
+ | 'file';
79
+ /**
80
+ * 是否还有可加载的子节点。目录行未提供该字段时按「可以展开」处理,
81
+ * 因此宿主在展开前无法得知子节点时无需传值;明确没有子节点时传 `false`。
82
+ * Whether children can be loaded. A directory row without this field is
83
+ * treated as expandable, so a host that cannot know before expanding can
84
+ * omit it; pass `false` when the directory is known to be childless.
85
+ */
86
+ hasChildren?: boolean;
87
+ /**
88
+ * 当前是否处于展开状态。
89
+ * Whether the node is currently expanded.
90
+ */
91
+ expanded?: boolean;
92
+ /**
93
+ * 行可见但不可打开或选中,例如没有详情权限的节点。
94
+ * The row is visible but cannot be opened or selected, for example a node
95
+ * without detail permission.
96
+ */
97
+ disabled?: boolean;
98
+ /**
99
+ * 名称下方的次要说明,例如摘要或行内描述。
100
+ * Secondary line under the name, for example an abstract or inline
101
+ * description.
102
+ */
103
+ description?: string;
104
+ /**
105
+ * 简短标记,例如摘要层级或上下文层级。不需要时省略。
106
+ * Short badge, for example a summary level or context level; omit it when
107
+ * unused.
108
+ */
109
+ levelLabel?: string;
110
+ /**
111
+ * 是否显示该节点上有进行中的写入。
112
+ * Shows an in-flight write on this node.
113
+ */
114
+ busy?: boolean;
115
+ /**
116
+ * 过期时间,未知时为 `null`。宿主没有过期策略时省略。
117
+ * Expiry time, or `null` when unknown; omit it when the host has no expiry
118
+ * policy.
119
+ */
120
+ expiresAt?: string | null;
121
+ }
122
+ /**
123
+ * 子节点加载中的行,插在父节点下方占位。
124
+ * A row shown under a parent while its children are loading.
125
+ *
126
+ * 宿主在子节点区域渲染加载占位时产出这类行;也可以不产出,
127
+ * 改用行内加载指示表达。
128
+ * The host emits this row when the children area shows a loading placeholder;
129
+ * it may also skip the row and use an inline indicator instead.
130
+ */
131
+ export interface FileTreeLoadingRow extends FileTreeChildRow {
132
+ /**
133
+ * 行类型标记,固定为 `loading`。
134
+ * Row kind discriminator, always `loading`.
135
+ */
136
+ kind: 'loading';
137
+ /**
138
+ * 正在加载子节点的父节点 id。
139
+ * Id of the parent whose children are loading.
140
+ */
141
+ parentId: string;
142
+ }
143
+ /**
144
+ * 子节点尚未加载时的分页行,提供继续加载的入口。
145
+ * A pagination row for children the host has not loaded yet; the host uses it
146
+ * to offer a load-more entry.
147
+ *
148
+ * 宿主按页取子节点时产出这类行;一次性返回全部子节点时不产出。
149
+ * The host emits this row when children are paged; it is not emitted when all
150
+ * children arrive in one response.
151
+ */
152
+ export interface FileTreeLoadMoreRow extends FileTreeChildRow {
153
+ /**
154
+ * 行类型标记,固定为 `load-more`。
155
+ * Row kind discriminator, always `load-more`.
156
+ */
157
+ kind: 'load-more';
158
+ /**
159
+ * 需要继续加载子节点的父节点 id。
160
+ * Id of the parent whose children should be loaded next.
161
+ */
162
+ parentId: string;
163
+ /**
164
+ * 下一页是否正在加载。
165
+ * Whether the next page is loading.
166
+ */
167
+ loading?: boolean;
168
+ }
169
+ /**
170
+ * 子节点加载失败的行,提供重新加载的入口。
171
+ * A failed children load with a retry entry.
172
+ */
173
+ export interface FileTreeErrorRow extends FileTreeChildRow {
174
+ /**
175
+ * 行类型标记,固定为 `error`。
176
+ * Row kind discriminator, always `error`.
177
+ */
178
+ kind: 'error';
179
+ /**
180
+ * 失败原因,未提供时显示默认文案。
181
+ * Failure reason; the default copy is used when omitted.
182
+ */
183
+ message?: string;
184
+ }
185
+ /**
186
+ * 已展开但当前没有子节点的目录。
187
+ * An expanded directory that currently has no children.
188
+ */
189
+ export interface FileTreeEmptyRow extends FileTreeChildRow {
190
+ /**
191
+ * 行类型标记,固定为 `empty`。
192
+ * Row kind discriminator, always `empty`.
193
+ */
194
+ kind: 'empty';
195
+ /**
196
+ * 该空目录的 id。
197
+ * Id of the empty directory.
198
+ */
199
+ parentId: string;
200
+ }
201
+ /**
202
+ * 可替换文案,组件内置英文默认值。
203
+ * Replaceable copy; the component ships English defaults.
204
+ */
205
+ export interface FileTreeLabels {
206
+ /**
207
+ * 空树提示。
208
+ * Empty tree message.
209
+ */
210
+ empty?: string;
211
+ /**
212
+ * 加载失败提示。
213
+ * Load failure message.
214
+ */
215
+ error?: string;
216
+ /**
217
+ * 重试按钮文案。
218
+ * Retry button label.
219
+ */
220
+ retry?: string;
221
+ /**
222
+ * 加载更多按钮文案。
223
+ * Load-more button label.
224
+ */
225
+ loadMore?: string;
226
+ /**
227
+ * 子节点加载中的提示。
228
+ * Message shown while children load.
229
+ */
230
+ loading?: string;
231
+ /**
232
+ * 展开按钮的无障碍名称,`{name}` 会被替换为节点名。
233
+ * Accessible name of the expand control; `{name}` is replaced with the node
234
+ * name.
235
+ */
236
+ expand?: string;
237
+ /**
238
+ * 折叠按钮的无障碍名称,`{name}` 会被替换为节点名。
239
+ * Accessible name of the collapse control; `{name}` is replaced with the
240
+ * node name.
241
+ */
242
+ collapse?: string;
243
+ }
244
+ /**
245
+ * 树的插槽。目前只有工具栏,页面层可自行决定内容与交互。
246
+ * Slots of the tree. Only the toolbar for now; the page layer owns its content
247
+ * and interaction.
248
+ */
249
+ export interface FileTreeSlots {
250
+ /**
251
+ * 树上方的工具栏,例如搜索、导入来源、刷新。
252
+ * Toolbar above the tree, for example search, import sources or refresh.
253
+ */
254
+ toolbar?: ReactNode;
255
+ }
256
+ /**
257
+ * 行的 DOM 属性约定。组件为每条行元素设置该属性,取值等于行的 `id`,
258
+ * 页面层据此定位行,例如做一次性高亮、滚动定位或覆盖层。
259
+ *
260
+ * Row DOM attribute. The component sets it on every row element with the row
261
+ * `id` as its value, so the page layer can locate a row for a transient
262
+ * highlight, scroll targeting or an overlay.
263
+ */
264
+ export declare const FILE_TREE_ROW_ATTRIBUTE = "data-file-tree-row-id";
265
+ /**
266
+ * 组件通过 ref 暴露的命令式能力,供页面层做一次性 UI 效果。
267
+ * Imperative capabilities exposed through the ref, for one-off page-level
268
+ * effects.
269
+ */
270
+ export interface FileTreeHandle {
271
+ /**
272
+ * 取得某行的根元素,未渲染时返回 `null`。
273
+ * Returns the row root element, or `null` when the row is not rendered.
274
+ */
275
+ getRowElement: (id: string) => HTMLElement | null;
276
+ /**
277
+ * 把某行滚动到可见区域,返回是否找到该行。
278
+ * Scrolls a row into view and reports whether it was found.
279
+ */
280
+ scrollToRow: (id: string, options?: ScrollIntoViewOptions) => boolean;
281
+ }
282
+ /** 文件树操作的执行能力。File-tree operation capabilities. */
283
+ export interface FileTreeOperations {
284
+ /** 选中条目。Selects an entry. */
285
+ select?: (row: FileTreeEntryRow) => Promise<void>;
286
+ /** 展开或折叠目录。Expands or collapses a directory. */
287
+ toggleExpand?: (row: FileTreeEntryRow) => Promise<void>;
288
+ /** 加载下一页子节点。Loads the next page of children. */
289
+ loadMore?: (row: FileTreeLoadMoreRow) => Promise<void>;
290
+ /** 重新加载失败的子节点。Retries a failed children load. */
291
+ retry?: (row: FileTreeErrorRow) => Promise<void>;
292
+ /** 打开保留策略设置。Opens retention policy settings. */
293
+ openRetentionSettings?: (uri: string) => Promise<void>;
294
+ }
295
+ /**
296
+ * 目录树的公开接口。
297
+ * Public interface of the file tree.
298
+ *
299
+ * 组件渲染行并通知成功的操作;工具栏、搜索、导入、权限流程都由页面层实现,
300
+ * 通过 `toolbar` 插槽注入。
301
+ * The component renders rows and reports successful operations. Toolbars, search,
302
+ * import and permission flows belong to the page layer and are injected
303
+ * through the `toolbar` slot.
304
+ */
305
+ export interface FileTreeProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onSelect'> {
306
+ /**
307
+ * 按渲染顺序排列的可见行。
308
+ * Visible rows in render order.
309
+ */
310
+ rows: readonly FileTreeRow[];
311
+ /**
312
+ * 操作的执行能力;省略对应方法时禁用该操作。
313
+ * Operation capabilities; omitting a method disables its operation.
314
+ */
315
+ operations?: FileTreeOperations;
316
+ /**
317
+ * 当前选中的行 id,由宿主持有。
318
+ * Selected row id, owned by the host.
319
+ */
320
+ selectedId?: string | null;
321
+ /**
322
+ * 首次加载是否已完成。
323
+ * Whether the tree has finished its first load.
324
+ */
325
+ isReady?: boolean;
326
+ /**
327
+ * 首次加载期间替代行列表显示的内容。
328
+ * Rendered instead of rows while the first load runs.
329
+ */
330
+ loadingFallback?: ReactNode;
331
+ /**
332
+ * 整体加载失败时替代行列表显示的内容,通常包含标题与重试入口。
333
+ * Rendered instead of rows when the whole tree failed to load, usually with a
334
+ * title and a retry entry.
335
+ */
336
+ errorFallback?: ReactNode;
337
+ /**
338
+ * 树中没有条目时显示的内容。
339
+ * Rendered instead of rows when the tree has no entries.
340
+ */
341
+ emptyFallback?: ReactNode;
342
+ /**
343
+ * 为行元素追加属性。返回的 `className` 会与组件自身的类名合并,
344
+ * 其余属性覆盖到行元素上,用于一次性高亮、埋点或自定义 `data-*`。
345
+ * Extra attributes for a row element. The returned `className` is merged with
346
+ * the component's own classes and the remaining attributes are applied to
347
+ * the row element, for one-off highlights, analytics or custom `data-*`.
348
+ */
349
+ getRowAttributes?: (row: FileTreeRow) => HTMLAttributes<HTMLDivElement>;
350
+ /**
351
+ * 渲染行尾的看板指示器。返回 `null` 时该行不显示指示器。内容与交互都由
352
+ * 宿主决定,包括点击行为与折叠时的数量角标。
353
+ * Renders the dashboard indicator at the end of a row. Returning `null` shows
354
+ * no indicator. Both the content and its interaction belong to the host,
355
+ * including the click behaviour and any collapsed-count badge.
356
+ */
357
+ renderDashboard?: (row: FileTreeEntryRow) => ReactNode;
358
+ /**
359
+ * 渲染行的悬停浮层内容。返回 `null` 时不展示;延迟、定位与悬停抑制
360
+ * 由组件处理。
361
+ * Renders the hover content of a row. Returning `null` shows nothing; the
362
+ * component handles the delay, positioning and hover suppression.
363
+ */
364
+ renderRowTooltip?: (row: FileTreeEntryRow) => ReactNode;
365
+ /**
366
+ * 条目成功选中后触发,参数为选中的条目;失败时不触发。
367
+ * Called after an entry is selected successfully; not called on failure.
368
+ */
369
+ onSelect?: (row: FileTreeEntryRow) => void;
370
+ /**
371
+ * 目录成功展开或折叠后触发,参数为操作的条目;失败时不触发。
372
+ * Called after a directory expands or collapses successfully; not called on failure.
373
+ */
374
+ onToggleExpand?: (row: FileTreeEntryRow) => void;
375
+ /**
376
+ * 下一页子节点加载成功后触发;失败时不触发。
377
+ * Called after the next page of children loads successfully; not called on failure.
378
+ */
379
+ onLoadMore?: (row: FileTreeLoadMoreRow) => void;
380
+ /**
381
+ * 重新加载子节点成功后触发;重试失败时不触发。
382
+ * Called after retrying a children load succeeds; not called on failure.
383
+ */
384
+ onRetry?: (row: FileTreeErrorRow) => void;
385
+ /**
386
+ * 保留策略设置成功打开后触发,参数为对应 URI;失败时不触发。
387
+ * Called after retention settings open successfully, with the URI; not called on failure.
388
+ */
389
+ onOpenRetentionSettings?: (uri: string) => void;
390
+ /**
391
+ * 树的插槽。工具栏由页面层实现,可以是搜索、导入来源、刷新等任意组合。
392
+ * Slots of the tree. The toolbar is implemented by the page layer and can
393
+ * hold search, import sources, refresh or any other combination.
394
+ */
395
+ slots?: FileTreeSlots;
396
+ /**
397
+ * 可替换文案,缺省为英文。
398
+ * Replaceable copy; English by default.
399
+ */
400
+ labels?: FileTreeLabels;
401
+ }
402
+ /**
403
+ * 目录树组件,可通过 ref 查找行或滚动到指定行。
404
+ * A file-tree component whose ref supports row lookup and scrolling.
405
+ */
406
+ export type FileTreeComponent = ForwardRefExoticComponent<PropsWithoutRef<FileTreeProps> & RefAttributes<FileTreeHandle>>;
@@ -0,0 +1,10 @@
1
+ import type { FileTreeEntryRow, FileTreeErrorRow, FileTreeLoadMoreRow, FileTreeProps } from './types.js';
2
+ type ActionProps = Pick<FileTreeProps, 'operations' | 'onSelect' | 'onToggleExpand' | 'onLoadMore' | 'onRetry' | 'onOpenRetentionSettings'>;
3
+ export declare function useFileTreeActions(props: ActionProps): {
4
+ onSelect: ((row: FileTreeEntryRow) => undefined) | undefined;
5
+ onToggleExpand: ((row: FileTreeEntryRow) => undefined) | undefined;
6
+ onLoadMore: ((row: FileTreeLoadMoreRow) => undefined) | undefined;
7
+ onRetry: ((row: FileTreeErrorRow) => undefined) | undefined;
8
+ onOpenRetentionSettings: ((uri: string) => undefined) | undefined;
9
+ };
10
+ export {};
@@ -0,0 +1 @@
1
+ export { FILE_TREE_ROW_ATTRIBUTE, FileTree } from "../n~0.js";
@@ -0,0 +1 @@
1
+ export * from './scope-switcher.js';
@@ -0,0 +1,2 @@
1
+ import type { KeyboardEvent } from 'react';
2
+ export declare function moveScopeFocus(event: KeyboardEvent<HTMLDivElement>): void;
@@ -0,0 +1,5 @@
1
+ import type { ScopeSwitcherLabels, ScopeSwitcherSelectableLevel } from './types.js';
2
+ export declare function ScopePanel({ level, labels, }: {
3
+ level: ScopeSwitcherSelectableLevel;
4
+ labels?: ScopeSwitcherLabels;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { ScopeSelectorProps } from './types.js';
2
+ export declare function ScopeSelector({ level, labels }: ScopeSelectorProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { ScopeSwitcherProps } from './types.js';
2
+ export { ScopeSelector } from './scope-selector.js';
3
+ export { SCOPE_SWITCHER_SEARCH_THRESHOLD } from './types.js';
4
+ export type { ScopeSwitcherFixedLevel, ScopeSwitcherLabels, ScopeSwitcherLevel, ScopeSwitcherLevelBase, ScopeSwitcherOption, ScopeSwitcherPanelContent, ScopeSwitcherProps, ScopeSelectorProps, ScopeSwitcherScrollMetrics, ScopeSwitcherSelectableLevel, } from './types.js';
5
+ /** No shared state, data aggregation or subscription in the layout root. */
6
+ export declare function ScopeSwitcher({ children, className, ...props }: ScopeSwitcherProps): import("react").JSX.Element;