@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,489 @@
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ /**
3
+ * 搜索框的显示阈值。已加载条数或 `total` 超过它,或关键字非空时,面板才渲染搜索框。
4
+ * 组件内部按该值判断,不开放为 Props。
5
+ *
6
+ * Threshold above which a panel renders its search box. The panel shows search
7
+ * once the loaded count or `total` exceeds it, or when a keyword is set. The
8
+ * component applies it internally and does not expose it as a prop.
9
+ */
10
+ export declare const SCOPE_SWITCHER_SEARCH_THRESHOLD = 10;
11
+ /**
12
+ * 一个层级中的可选项。宿主把库、数据空间、账号或用户记录映射成该结构。
13
+ *
14
+ * One selectable value in a level. Hosts map their own library, data space,
15
+ * account or user records onto this shape.
16
+ */
17
+ export interface ScopeSwitcherOption {
18
+ /**
19
+ * 选项唯一标识。
20
+ * Unique option key.
21
+ */
22
+ id: string;
23
+ /**
24
+ * 选项显示文本。搜索命中时由组件高亮匹配片段。
25
+ * Option label. The component highlights the matching part while searching.
26
+ */
27
+ label: string;
28
+ /**
29
+ * 行首图标,例如库、数据空间或用户的头像。
30
+ * Row leading icon, for example a library, data space or user avatar.
31
+ */
32
+ icon?: ReactNode;
33
+ /**
34
+ * 显示在标签下方的次要说明,例如套餐或地址。
35
+ * Secondary line under the label, for example a plan or an address.
36
+ */
37
+ description?: string;
38
+ /**
39
+ * 是否禁用该选项:渲染置灰样式且不响应点击。
40
+ * Whether the option is disabled: rendered dimmed and ignoring clicks.
41
+ */
42
+ disabled?: boolean;
43
+ }
44
+ /**
45
+ * 层级的身份:稳定标识、无障碍名与末尾标记。这些值基本不随请求变化。
46
+ *
47
+ * A level's identity: its stable key, accessible name and trailing marker. These
48
+ * values rarely change with a request.
49
+ */
50
+ export interface ScopeSwitcherIdentity {
51
+ /**
52
+ * 稳定标识,例如 `library`、`account` 或 `user`。
53
+ * Stable key, for example `library`, `account` or `user`.
54
+ */
55
+ key: string;
56
+ /**
57
+ * 触发器的无障碍名称,例如「切换库」。不传时不写 `aria-label`。
58
+ * Accessible name of the trigger, for example "Switch library". No
59
+ * `aria-label` is written when omitted.
60
+ */
61
+ ariaLabel?: string;
62
+ /**
63
+ * 触发器末尾的标记,例如套餐名。不传时不渲染。
64
+ * Tag at the end of the trigger, for example a plan name. Not rendered when
65
+ * omitted.
66
+ */
67
+ tag?: ReactNode;
68
+ }
69
+ /**
70
+ * 触发器展示的内容:当前值文本与图标。
71
+ *
72
+ * What the trigger shows: the current value and its icon.
73
+ */
74
+ export interface ScopeSwitcherTrigger {
75
+ /**
76
+ * 触发器上展示的当前选中项文本。不传时按 `data.selectedId` 从 `data.options`
77
+ * 里取对应项的 `label`;两者都没有时触发器为空。
78
+ *
79
+ * 当前值不在已加载的那一页里时,传这一项由宿主给出文本。
80
+ *
81
+ * Text shown on the trigger for the current selection. When omitted it is read
82
+ * from the matching `data.options` entry by `data.selectedId`; with neither the
83
+ * trigger is empty.
84
+ *
85
+ * Supply it when the current value is not on the loaded page.
86
+ */
87
+ label?: string;
88
+ /**
89
+ * 触发器图标,也可以是头像。不传时用选中项的 `icon`。
90
+ * Trigger icon, which can also be an avatar. Falls back to the selected
91
+ * option's `icon` when omitted.
92
+ */
93
+ icon?: ReactNode;
94
+ }
95
+ /**
96
+ * 层级的数据:可选项与当前选中项。每次请求后都会变。
97
+ *
98
+ * A level's data: the options and the current selection. Changes after every
99
+ * request.
100
+ */
101
+ export interface ScopeSwitcherData {
102
+ /**
103
+ * 该层级的权威选项集合,按宿主给定的顺序渲染。它是判断当前选中值是否仍然
104
+ * 有效的依据,因此不要只放当前搜索结果:搜索过滤后的子集请通过
105
+ * `visibleOptions` 传入。
106
+ *
107
+ * The level's authoritative option set, rendered in the order the host gives.
108
+ * It is what decides whether the current selection is still valid, so do not
109
+ * pass only the current search result: hand a filtered subset in through
110
+ * `visibleOptions` instead.
111
+ */
112
+ options: readonly ScopeSwitcherOption[];
113
+ /**
114
+ * 面板里实际渲染的选项。不传时渲染 `options`。搜索过滤、分页追加的下一屏都
115
+ * 走这里,不影响选中值是否有效的判断。
116
+ *
117
+ * Options actually rendered in the panel; `options` is rendered when omitted.
118
+ * Search filtering and an appended page go here and never affect whether the
119
+ * current selection is still valid.
120
+ */
121
+ visibleOptions?: readonly ScopeSwitcherOption[];
122
+ /**
123
+ * 当前选中项 id,由宿主持有。命中项渲染勾选标记并使用
124
+ * `role="option"` + `aria-selected` 表达状态。
125
+ *
126
+ * 组件只按传入的值渲染,不做归一化:id 为空或不在 `options` 里时,列表里没有
127
+ * 任何一行被标记为选中;id 命中一个禁用项时照常标记选中(禁用只阻止交互,不
128
+ * 抹掉选中态),直到宿主把它归一化掉。组件不会替宿主改选中值,也不会回调
129
+ * `actions.onSelect`。
130
+ *
131
+ * 作用域始终要有一个确定的值,因此**归一化由宿主负责**:在数据到达后检查
132
+ * `selectedId` 是否仍有效,无效则改选第一个可选项,并把结果写回 URL 与请求
133
+ * 参数。使用 `ScopeCascade` 时这层已经内置——它的 controller 在权威列表到达
134
+ * 后完成回退、清空下游并加载下一级。
135
+ *
136
+ * 只出现在 `visibleOptions` 之外不算失效:那只说明它被搜索过滤掉了。
137
+ *
138
+ * Selected option id, owned by the host. The matching option renders a check
139
+ * mark and expresses its state with `role="option"` and `aria-selected`.
140
+ *
141
+ * The component renders the value it is given and never normalises it: an id
142
+ * that is empty or absent from `options` marks no row as selected, while an id
143
+ * matching a disabled option is still rendered as selected — disabled blocks
144
+ * interaction, it does not clear the selection — until the host normalises it.
145
+ * The component neither changes the value nor calls `actions.onSelect` on the
146
+ * host's behalf.
147
+ *
148
+ * A scope still needs a definite value, so **normalisation belongs to the
149
+ * host**: after data arrives, check whether `selectedId` is still valid and
150
+ * pick the first selectable option when it is not, then write the result back
151
+ * to the URL and request parameters. `ScopeCascade` already does this — its
152
+ * controller falls back, resets descendants and loads the next level once the
153
+ * authoritative list arrives.
154
+ *
155
+ * Being absent from `visibleOptions` alone does not invalidate it: that only
156
+ * means the current search filtered it out.
157
+ */
158
+ selectedId: string;
159
+ /**
160
+ * 该层级的总条数,用于判断搜索框是否可见。不传时以 `options` 的条数为准。
161
+ *
162
+ * 搜索可见性始终取 `options`、`visibleOptions` 与 `total` 三者的最大值,因此
163
+ * 宿主只传当前一页的 `visibleOptions` 时,只要权威集合超过阈值,搜索框照样
164
+ * 出现。
165
+ *
166
+ * Total number of entries, used to decide whether the search box is shown. The
167
+ * `options` count is used when omitted.
168
+ *
169
+ * Visibility takes the largest of `options`, `visibleOptions` and `total`, so a
170
+ * host that passes only the current page still gets a search box once the
171
+ * authoritative set crosses the threshold.
172
+ */
173
+ total?: number;
174
+ }
175
+ /**
176
+ * 层级的交互状态。随用户操作与请求进度变化。
177
+ *
178
+ * A level's interaction state. Changes with user actions and request progress.
179
+ */
180
+ export interface ScopeSwitcherState {
181
+ /**
182
+ * 选项列表是否正在首次加载。为 `true` 时面板显示加载态,不渲染列表。
183
+ * Whether the option list is loading for the first time. While true the panel
184
+ * shows a loading state instead of the list.
185
+ */
186
+ loading?: boolean;
187
+ /**
188
+ * 选项列表是否加载失败。为 `true` 时面板渲染 `slots.errorFallback`。
189
+ * Whether the option list failed to load. While true the panel renders
190
+ * `slots.errorFallback`.
191
+ */
192
+ error?: boolean;
193
+ /**
194
+ * 该层级是否有一个变更正在进行,例如正在删除某个库或正在切换数据空间。
195
+ * 为 `true` 时组件禁用整个列表,避免并发切换。
196
+ *
197
+ * Whether a change is in flight for this level, for example deleting a library
198
+ * or switching the data space. While true the component disables the whole
199
+ * list so no second switch can start.
200
+ */
201
+ busy?: boolean;
202
+ /**
203
+ * 该层级是否暂时不可切换,例如权限尚未就绪。为 `true` 时触发器置灰、不响应
204
+ * 点击,也不渲染下拉。恒为可切换的宿主不传。
205
+ *
206
+ * Whether the level is temporarily not switchable, for example while
207
+ * permissions load. While true the trigger is dimmed, ignores clicks and
208
+ * renders no dropdown. Hosts whose levels are always switchable leave it out.
209
+ */
210
+ disabled?: boolean;
211
+ /**
212
+ * 可选受控展开状态;不传时由本级选择器独立维护。
213
+ * Optional controlled visibility; otherwise local to this selector.
214
+ */
215
+ visible?: boolean;
216
+ /**
217
+ * 当前搜索关键字。非空时搜索框保持可见,并用于高亮命中片段。
218
+ * Current search keyword. A non-empty value keeps the search box visible and
219
+ * drives hit highlighting.
220
+ */
221
+ searchKeyword?: string;
222
+ }
223
+ /**
224
+ * 层级的插槽:由宿主替换或补充组件渲染的内容。
225
+ *
226
+ * A level's slots: content the host replaces or adds to what the component
227
+ * renders.
228
+ */
229
+ export interface ScopeSwitcherSlots {
230
+ /**
231
+ * 面板内除列表以外的全部内容,由宿主自行实现。
232
+ *
233
+ * 参数是组件渲染好的两块内容:`search` 是搜索框,`list` 是选项列表与加载/空/
234
+ * 失败三态。宿主可以分别摆放它们,也可以只放其中一块;面板标题、顶部入口、底部
235
+ * 管理入口、说明文字都由宿主用自己的组件、链接和路由渲染。不传时面板只渲染
236
+ * `search` 与 `list`。
237
+ *
238
+ * Everything in the panel except the list, implemented by the host.
239
+ *
240
+ * The argument holds two blocks the component rendered: `search` is the search
241
+ * box and `list` is the option list with its loading, empty and failed states.
242
+ * The host can place them separately or use only one. Panel headings, top
243
+ * entries, bottom management entries and explanatory text are all rendered by
244
+ * the host with its own components, links and router. When omitted the panel
245
+ * renders `search` and `list` alone.
246
+ *
247
+ * The panel keeps its height cap either way: a host layout that needs more room
248
+ * scrolls inside the panel instead of growing it.
249
+ */
250
+ renderPanel?: (panel: ScopeSwitcherPanelContent) => ReactNode;
251
+ /**
252
+ * 在默认行内容的基础上追加或替换,例如行尾的「更多」菜单、失效态标记。
253
+ *
254
+ * 参数 `content` 是组件渲染好的默认行内容(图标、标签、描述、搜索高亮与选中
255
+ * 标记),`option` 是原始数据。宿主原样使用 `content` 只加行尾,或丢掉它自己
256
+ * 渲染。不传时渲染默认行。
257
+ *
258
+ * 行本身的点击、选中态与键盘交互始终由组件处理。
259
+ *
260
+ * Adds to or replaces the default row content, for example a "more" menu at the
261
+ * row end or an expired marker.
262
+ *
263
+ * `content` is the default row content the component rendered (icon, label,
264
+ * description, search highlight and check mark), and `option` is the raw data.
265
+ * The host reuses `content` and only appends, or discards it and renders its
266
+ * own. The default row renders when omitted.
267
+ *
268
+ * The row's click, selection state and keyboard interaction always stay with
269
+ * the component.
270
+ */
271
+ renderOption?: (content: ReactNode, option: ScopeSwitcherOption) => ReactNode;
272
+ /**
273
+ * 没有可选项时替代列表显示的内容。不传时使用 `labels.empty`。
274
+ * Rendered instead of the list when there are no options. `labels.empty` is
275
+ * used when omitted.
276
+ */
277
+ emptyFallback?: ReactNode;
278
+ /**
279
+ * 加载失败时替代列表显示的内容。不传时使用 `labels.error`。
280
+ * Rendered instead of the list when loading failed. `labels.error` is used
281
+ * when omitted.
282
+ */
283
+ errorFallback?: ReactNode;
284
+ }
285
+ /**
286
+ * 层级的回调:把用户意图交给宿主。
287
+ *
288
+ * A level's callbacks: user intent handed back to the host.
289
+ */
290
+ export interface ScopeSwitcherActions {
291
+ /**
292
+ * 选中时触发;组件关闭本级面板,不改变搜索词和业务选中值。
293
+ * Invoked on selection. Closes this panel; selection and search remain host-owned.
294
+ */
295
+ onSelect?: (option: ScopeSwitcherOption) => void;
296
+ /**
297
+ * 面板可见性变化时触发,打开和关闭都会调用,参数是变化后的状态。
298
+ *
299
+ * 宿主在这里写回 `state.visible`,同时可按需取数,例如打开时才请求第一页选项。
300
+ *
301
+ * Invoked whenever the panel's visibility changes — on both open and close —
302
+ * with the new state.
303
+ *
304
+ * The host writes it back to `state.visible` and can load data on demand from
305
+ * it, for example requesting the first page only when the panel opens.
306
+ */
307
+ onVisibleChange?: (visible: boolean) => void;
308
+ /**
309
+ * 搜索关键字变化时触发。不传时不渲染搜索框。
310
+ * Invoked when the search keyword changes. No search box is rendered when
311
+ * omitted.
312
+ */
313
+ onSearchKeywordChange?: (keyword: string) => void;
314
+ /**
315
+ * 选项列表滚动时触发,参数是滚动后的位置信息。是否加载下一页由宿主判断,加载
316
+ * 完成后把新一页通过 `data.options` 传回。不传时不响应滚动。
317
+ *
318
+ * Invoked when the option list scrolls, with the resulting scroll metrics. The
319
+ * host decides whether to load the next page and passes it back through
320
+ * `data.options`. Scrolling is not observed when omitted.
321
+ */
322
+ onScroll?: (metrics: ScopeSwitcherScrollMetrics) => void;
323
+ }
324
+ /**
325
+ * 组件渲染好的面板内容,作为参数传给 `slots.renderPanel`。
326
+ *
327
+ * Panel content the component rendered, passed to `slots.renderPanel`.
328
+ */
329
+ export interface ScopeSwitcherPanelContent {
330
+ /**
331
+ * 搜索框。搜索框不可见时为空节点。
332
+ * The search box; an empty node when it is not shown.
333
+ */
334
+ search: ReactNode;
335
+ /**
336
+ * 选项列表与加载、空、失败三态。
337
+ * The option list with its loading, empty and failed states.
338
+ */
339
+ list: ReactNode;
340
+ }
341
+ /**
342
+ * 选项列表滚动时的位置信息,由组件从列表元素上读取后传入 `actions.onScroll`。
343
+ *
344
+ * Scroll metrics of the option list, read from the list element and passed to
345
+ * `actions.onScroll`.
346
+ */
347
+ export interface ScopeSwitcherScrollMetrics {
348
+ /**
349
+ * 列表已滚动的距离。
350
+ * Distance the list has scrolled.
351
+ */
352
+ scrollTop: number;
353
+ /**
354
+ * 列表内容总高度。
355
+ * Total height of the list content.
356
+ */
357
+ scrollHeight: number;
358
+ /**
359
+ * 列表可视区域高度。
360
+ * Height of the list viewport.
361
+ */
362
+ clientHeight: number;
363
+ }
364
+ /**
365
+ * 可替换文案,组件内置英文默认值。
366
+ * Replaceable copy; the component ships English defaults.
367
+ */
368
+ export interface ScopeSwitcherLabels {
369
+ /** Loading status text / 加载提示。 */
370
+ loading?: string;
371
+ /**
372
+ * 搜索框占位文本。
373
+ * Search input placeholder.
374
+ */
375
+ searchPlaceholder?: string;
376
+ /**
377
+ * 没有可选项时的提示。
378
+ * Message shown when there are no options.
379
+ */
380
+ empty?: string;
381
+ /**
382
+ * 有关键字但没有命中项时的提示。不传时回落到 `empty`。
383
+ * Message shown when a keyword matches nothing. Falls back to `empty` when
384
+ * omitted.
385
+ */
386
+ noMatch?: string;
387
+ /**
388
+ * 加载失败时的提示。
389
+ * Message shown when loading failed.
390
+ */
391
+ error?: string;
392
+ }
393
+ /** Layout only: each child owns its state and data subscription. */
394
+ export type ScopeSwitcherProps = HTMLAttributes<HTMLDivElement>;
395
+ /**
396
+ * 两种层级共有的入参:身份与触发器内容。
397
+ *
398
+ * Props shared by both level forms: identity and what the trigger shows.
399
+ */
400
+ export interface ScopeSelectorBaseProps {
401
+ /**
402
+ * 层级身份:稳定标识、无障碍名与末尾标记。
403
+ * Level identity: stable key, accessible name and trailing marker.
404
+ */
405
+ identity: ScopeSwitcherIdentity;
406
+ /**
407
+ * 触发器展示的当前值文本与图标。不传时从 `data.options` 里按 `data.selectedId`
408
+ * 取对应项;固定层级没有 `data`,因此固定层级需要在这里给出 `label`。
409
+ *
410
+ * The current value and icon shown on the trigger. When omitted they are read
411
+ * from `data.options` by `data.selectedId`; a fixed level has no `data`, so it
412
+ * supplies `label` here.
413
+ */
414
+ trigger?: ScopeSwitcherTrigger;
415
+ /**
416
+ * 可替换文案,缺省为英文。
417
+ * Replaceable copy; English by default.
418
+ */
419
+ labels?: ScopeSwitcherLabels;
420
+ }
421
+ /**
422
+ * 固定层级的入参:只展示当前值,不渲染下拉,也不接收任何选项或面板字段。
423
+ *
424
+ * 用于当前作用域不可切换的情形,例如个人终端里跟随登录态固定的库与数据空间、
425
+ * 管理模式下不能切换的数据空间。这类层级在视觉上同样是一条面包屑,只是没有
426
+ * 展开箭头、不可点击,也不需要宿主伪造一份空选项列表。
427
+ *
428
+ * Props of a fixed level: shows the current value only, renders no dropdown and
429
+ * takes no option or panel fields.
430
+ *
431
+ * Used where the current scope cannot be switched, for example a library and
432
+ * data space fixed by the sign-in in a personal terminal, or a data space that
433
+ * cannot be switched in management mode. It still looks like a breadcrumb
434
+ * segment, just without an expand affordance and not clickable, and the host
435
+ * does not have to fabricate an empty option list.
436
+ */
437
+ export interface ScopeSelectorFixedProps extends ScopeSelectorBaseProps {
438
+ /**
439
+ * 判别字段,固定层级为 `'fixed'`。
440
+ * Discriminant, always `'fixed'` for a fixed level.
441
+ */
442
+ kind: 'fixed';
443
+ }
444
+ /**
445
+ * 可切换层级的入参:渲染可展开的触发器与下拉面板。
446
+ *
447
+ * 面板结构、搜索、分页与选中状态全部受控,由宿主传入。同一行里可以只有一个
448
+ * 可切换层级,也可以三个都可切换。
449
+ *
450
+ * Props of a selectable level: renders an expandable trigger and its dropdown
451
+ * panel.
452
+ *
453
+ * The panel structure, search, paging and selection are all controlled and come
454
+ * from the host. A row can hold one selectable level or several.
455
+ */
456
+ export interface ScopeSelectorSelectableProps extends ScopeSelectorBaseProps {
457
+ /**
458
+ * 判别字段,可切换层级为 `'selectable'`。
459
+ * Discriminant, always `'selectable'` for a selectable level.
460
+ */
461
+ kind: 'selectable';
462
+ /**
463
+ * 可选项与当前选中项。
464
+ * The options and the current selection.
465
+ */
466
+ data: ScopeSwitcherData;
467
+ /**
468
+ * 加载、错误、忙碌、禁用、展开与搜索关键字等交互状态。
469
+ * Interaction state: loading, error, busy, disabled, visibility and keyword.
470
+ */
471
+ state?: ScopeSwitcherState;
472
+ /**
473
+ * 用户意图回调。
474
+ * Callbacks for user intent.
475
+ */
476
+ actions?: ScopeSwitcherActions;
477
+ /**
478
+ * 宿主替换或补充的渲染内容。
479
+ * Content the host replaces or adds.
480
+ */
481
+ slots?: ScopeSwitcherSlots;
482
+ }
483
+ /**
484
+ * 一个作用域选择器的入参。按 `kind` 区分固定与可切换两种形态,同一行里可以混用。
485
+ *
486
+ * Props of one scope selector. `kind` separates the fixed and selectable forms;
487
+ * both can be mixed in one row.
488
+ */
489
+ export type ScopeSelectorProps = ScopeSelectorFixedProps | ScopeSelectorSelectableProps;
@@ -0,0 +1,3 @@
1
+ var scope_switcher_SCOPE_SWITCHER_SEARCH_THRESHOLD = 10;
2
+ export { ScopeSelector, ScopeSwitcher } from "../f~0.js";
3
+ export { scope_switcher_SCOPE_SWITCHER_SEARCH_THRESHOLD as SCOPE_SWITCHER_SEARCH_THRESHOLD };