@openviking/react 0.1.2 → 0.1.4

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 (249) hide show
  1. package/LICENSE.arco-design +21 -0
  2. package/README.md +25 -15
  3. package/dist/0~0.js +19 -0
  4. package/dist/2~0.js +2360 -0
  5. package/dist/2~0.js.LICENSE.txt +23 -0
  6. package/dist/3c~0.js +2206 -0
  7. package/dist/3~0.js +1205 -1982
  8. package/dist/4~0.js +18 -0
  9. package/dist/9~0.js +43 -0
  10. package/dist/ae~0.js +487 -0
  11. package/dist/ark-message-list-view~0.js +530 -119
  12. package/dist/a~0.js +1289 -10
  13. package/dist/c7~0.js +38 -2
  14. package/dist/ck~0.js +23 -0
  15. package/dist/client/index.d.ts +2 -1
  16. package/dist/client/paths.d.ts +64 -0
  17. package/dist/client/provider.d.ts +5 -3
  18. package/dist/client/response.d.ts +31 -0
  19. package/dist/client/sse.d.ts +39 -0
  20. package/dist/client/stream.d.ts +26 -0
  21. package/dist/client/types.d.ts +109 -5
  22. package/dist/client.js +2 -239
  23. package/dist/components/agent-connect/agent-connect-copy.d.ts +19 -33
  24. package/dist/components/agent-connect/agent-connect-design.d.ts +1935 -167
  25. package/dist/components/agent-connect/agent-connect-instructions.d.ts +135 -0
  26. package/dist/components/agent-connect/locales/en-US.d.ts +20 -0
  27. package/dist/components/agent-connect/locales/zh-CN.d.ts +3 -0
  28. package/dist/components/agent-connect/style.css +14 -2
  29. package/dist/components/agent-connect/types.d.ts +2 -1
  30. package/dist/components/directory-tour/directory-tour.d.ts +3 -0
  31. package/dist/components/directory-tour/index.d.ts +3 -0
  32. package/dist/components/directory-tour/locales/en-US.d.ts +3 -0
  33. package/dist/components/directory-tour/locales/zh-CN.d.ts +3 -0
  34. package/dist/components/directory-tour/steps.d.ts +5 -0
  35. package/dist/components/directory-tour/style.css +237 -0
  36. package/dist/components/directory-tour/style.js +0 -0
  37. package/dist/components/directory-tour/types.d.ts +42 -0
  38. package/dist/components/directory-tour/use-tour-anchor.d.ts +5 -0
  39. package/dist/components/directory-tour/use-tour-position.d.ts +12 -0
  40. package/dist/components/directory-tour.js +40 -0
  41. package/dist/components/file-browser-entries/file-browser-entries-icons.d.ts +18 -0
  42. package/dist/components/file-browser-entries/file-browser-entries.d.ts +14 -0
  43. package/dist/components/file-browser-entries/index.d.ts +1 -0
  44. package/dist/components/file-browser-entries/labels.d.ts +3 -0
  45. package/dist/components/file-browser-entries/locales/en-US.d.ts +6 -0
  46. package/dist/components/file-browser-entries/locales/zh-CN.d.ts +6 -0
  47. package/dist/components/file-browser-entries/style.css +905 -0
  48. package/dist/components/file-browser-entries/style.js +0 -0
  49. package/dist/components/file-browser-entries/types.d.ts +63 -0
  50. package/dist/components/file-browser-entries.js +1 -0
  51. package/dist/components/file-preview/file-preview-adapters.d.ts +2 -1
  52. package/dist/components/file-preview/file-preview-body.d.ts +2 -1
  53. package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +2 -1
  54. package/dist/components/file-preview/file-preview-breadcrumb.d.ts +2 -1
  55. package/dist/components/file-preview/file-preview-directory.d.ts +33 -0
  56. package/dist/components/file-preview/file-preview-handle-adapters.d.ts +2 -1
  57. package/dist/components/file-preview/file-preview-header.d.ts +25 -3
  58. package/dist/components/file-preview/file-preview-image-frame.d.ts +5 -0
  59. package/dist/components/file-preview/file-preview-labels.d.ts +2 -14
  60. package/dist/components/file-preview/file-preview-level-tabs.d.ts +7 -0
  61. package/dist/components/file-preview/file-preview-markdown-images.d.ts +13 -0
  62. package/dist/components/file-preview/file-preview-panels.d.ts +44 -0
  63. package/dist/components/file-preview/file-preview-state.d.ts +10 -3
  64. package/dist/components/file-preview/file-preview-viewer.d.ts +2 -1
  65. package/dist/components/file-preview/file-preview.d.ts +1 -1
  66. package/dist/components/file-preview/index.d.ts +2 -1
  67. package/dist/components/file-preview/level-selection.d.ts +25 -0
  68. package/dist/components/file-preview/locales/en-US.d.ts +16 -0
  69. package/dist/components/file-preview/locales/zh-CN.d.ts +16 -0
  70. package/dist/components/file-preview/style.css +234 -3
  71. package/dist/components/file-preview/types.d.ts +134 -11
  72. package/dist/components/file-preview/use-directory-level.d.ts +30 -0
  73. package/dist/components/file-preview/use-file-preview-actions-context.d.ts +6 -2
  74. package/dist/components/file-preview/use-file-preview-actions.d.ts +1 -1
  75. package/dist/components/file-preview/use-file-preview-levels.d.ts +7 -0
  76. package/dist/components/file-preview/use-file-preview-view-state.d.ts +15 -0
  77. package/dist/components/file-preview.js +1 -1
  78. package/dist/components/file-tree/file-tree-info-labels.d.ts +0 -15
  79. package/dist/components/file-tree/file-tree-info-tooltip.d.ts +7 -7
  80. package/dist/components/file-tree/file-tree-labels.d.ts +4 -0
  81. package/dist/components/file-tree/file-tree-row-context.d.ts +0 -5
  82. package/dist/components/file-tree/file-tree-row-shared.d.ts +1 -4
  83. package/dist/components/file-tree/file-tree-toolbar.d.ts +11 -0
  84. package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +8 -8
  85. package/dist/components/file-tree/locales/en-US.d.ts +69 -0
  86. package/dist/components/file-tree/locales/zh-CN.d.ts +69 -0
  87. package/dist/components/file-tree/style.css +207 -42
  88. package/dist/components/file-tree/types.d.ts +58 -10
  89. package/dist/components/file-tree/use-file-tree-actions.d.ts +4 -1
  90. package/dist/components/scope-switcher/labels.d.ts +3 -0
  91. package/dist/components/scope-switcher/locales/en-US.d.ts +8 -0
  92. package/dist/components/scope-switcher/locales/zh-CN.d.ts +8 -0
  93. package/dist/components/scope-switcher/scope-panel.d.ts +1 -1
  94. package/dist/components/scope-switcher/scope-switcher.d.ts +1 -1
  95. package/dist/components/scope-switcher/style.css +14 -2
  96. package/dist/components/scope-switcher/types.d.ts +11 -5
  97. package/dist/components/style.css +10144 -6840
  98. package/dist/components/tui/locales/en-US.d.ts +35 -0
  99. package/dist/components/tui/locales/zh-CN.d.ts +35 -0
  100. package/dist/components/tui/style.css +310 -18
  101. package/dist/components/tui/tui-copy-button.d.ts +1 -1
  102. package/dist/components/tui/tui-empty.d.ts +25 -0
  103. package/dist/components/tui/tui-labels.d.ts +2 -2
  104. package/dist/components/tui/tui.d.ts +1 -1
  105. package/dist/components/tui/types.d.ts +35 -12
  106. package/dist/components/tui.js +1 -1
  107. package/dist/components/viking-bot/ark-adapter.d.ts +2 -0
  108. package/dist/components/viking-bot/ark-message-body.d.ts +1 -7
  109. package/dist/components/viking-bot/ark-message-list-view.d.ts +1 -1
  110. package/dist/components/viking-bot/ark-message-row.d.ts +3 -1
  111. package/dist/components/viking-bot/bot-popover.d.ts +9 -0
  112. package/dist/components/viking-bot/capabilities.d.ts +49 -0
  113. package/dist/components/viking-bot/composer-attachments.d.ts +13 -0
  114. package/dist/components/viking-bot/composer-controls.d.ts +10 -0
  115. package/dist/components/viking-bot/composer-footer.d.ts +17 -0
  116. package/dist/components/viking-bot/composer-references.d.ts +20 -0
  117. package/dist/components/viking-bot/composer-text.d.ts +10 -0
  118. package/dist/components/viking-bot/index.d.ts +3 -1
  119. package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +1 -1
  120. package/dist/components/viking-bot/interaction/labels.d.ts +2 -1
  121. package/dist/components/viking-bot/interaction/locales/en-US.d.ts +17 -0
  122. package/dist/components/viking-bot/interaction/locales/zh-CN.d.ts +17 -0
  123. package/dist/components/viking-bot/interaction/types.d.ts +8 -3
  124. package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +1 -1
  125. package/dist/components/viking-bot/labels.d.ts +2 -0
  126. package/dist/components/viking-bot/locales/en-US.d.ts +40 -0
  127. package/dist/components/viking-bot/locales/zh-CN.d.ts +40 -0
  128. package/dist/components/viking-bot/markdown-links.d.ts +27 -0
  129. package/dist/components/viking-bot/message-activity.d.ts +7 -0
  130. package/dist/components/viking-bot/message-code-block.d.ts +8 -0
  131. package/dist/components/viking-bot/message-footer.d.ts +8 -0
  132. package/dist/components/viking-bot/message-markdown.d.ts +9 -0
  133. package/dist/components/viking-bot/model.d.ts +37 -3
  134. package/dist/components/viking-bot/quick-input-tracker.d.ts +16 -0
  135. package/dist/components/viking-bot/quick-inputs.d.ts +6 -0
  136. package/dist/components/viking-bot/reference-picker.d.ts +16 -0
  137. package/dist/components/viking-bot/session-actions.d.ts +11 -0
  138. package/dist/components/viking-bot/style.css +1486 -48
  139. package/dist/components/viking-bot/tool-activity.d.ts +9 -0
  140. package/dist/components/viking-bot/tool-result-links.d.ts +6 -0
  141. package/dist/components/viking-bot/types.d.ts +21 -9
  142. package/dist/components/viking-bot/use-quick-input.d.ts +17 -0
  143. package/dist/components/viking-bot/viking-bot.d.ts +1 -6
  144. package/dist/components/viking-bot/welcome.d.ts +8 -0
  145. package/dist/components/viking-bot.js +1 -1
  146. package/dist/c~0.js +533 -66
  147. package/dist/e~0.js +333 -0
  148. package/dist/file-preview-viewer~0.js +90 -8
  149. package/dist/f~0.js +39 -47
  150. package/dist/h~0.js +5 -1
  151. package/dist/icons/console-icons.d.ts +12 -0
  152. package/dist/icons/index.d.ts +2 -0
  153. package/dist/icons/viking-bot-icons.d.ts +6 -0
  154. package/dist/icons.js +1 -0
  155. package/dist/index.d.ts +4 -0
  156. package/dist/index.js +3 -1
  157. package/dist/k~0.js +1 -0
  158. package/dist/lg~0.js +155 -0
  159. package/dist/lk~0.js +37 -8
  160. package/dist/l~0.js +1447 -25
  161. package/dist/modules/console/command-messages.d.ts +19 -0
  162. package/dist/modules/console/command-parser.d.ts +15 -0
  163. package/dist/modules/console/command-specs.d.ts +15 -0
  164. package/dist/modules/console/commands.d.ts +6 -0
  165. package/dist/modules/console/console-history.d.ts +10 -0
  166. package/dist/modules/console/console-toolbar.d.ts +18 -0
  167. package/dist/modules/console/console.d.ts +1 -3
  168. package/dist/modules/console/controller.d.ts +17 -0
  169. package/dist/modules/console/index.d.ts +2 -0
  170. package/dist/modules/console/labels.d.ts +61 -0
  171. package/dist/modules/console/locales/en-US.d.ts +49 -0
  172. package/dist/modules/console/locales/zh-CN.d.ts +3 -0
  173. package/dist/modules/console/localize-records.d.ts +11 -0
  174. package/dist/modules/console/results.d.ts +2 -0
  175. package/dist/modules/console/style.css +10905 -15
  176. package/dist/modules/console/types.d.ts +59 -80
  177. package/dist/modules/console/use-console.d.ts +3 -0
  178. package/dist/modules/console.js +1 -1
  179. package/dist/modules/file-browser/file-browser-detail-icons.d.ts +10 -0
  180. package/dist/modules/file-browser/file-browser-detail.d.ts +34 -0
  181. package/dist/modules/file-browser/file-browser-empty.d.ts +3 -0
  182. package/dist/modules/file-browser/file-browser-failure.d.ts +22 -0
  183. package/dist/modules/file-browser/file-browser-icons.d.ts +18 -0
  184. package/dist/modules/file-browser/file-browser-labels.d.ts +27 -0
  185. package/dist/modules/file-browser/file-browser-layout.d.ts +27 -0
  186. package/dist/modules/file-browser/file-browser-toolbar.d.ts +17 -0
  187. package/dist/modules/file-browser/file-browser-tree-pane.d.ts +32 -0
  188. package/dist/modules/file-browser/file-browser.d.ts +14 -5
  189. package/dist/modules/file-browser/find-result.d.ts +24 -0
  190. package/dist/modules/file-browser/fs-directories.d.ts +33 -0
  191. package/dist/modules/file-browser/fs-file-kind.d.ts +19 -0
  192. package/dist/modules/file-browser/fs-icon.d.ts +17 -0
  193. package/dist/modules/file-browser/fs-model.d.ts +106 -0
  194. package/dist/modules/file-browser/fs-page.d.ts +16 -0
  195. package/dist/modules/file-browser/fs-path.d.ts +16 -0
  196. package/dist/modules/file-browser/fs-read-directory.d.ts +16 -0
  197. package/dist/modules/file-browser/fs-scope.d.ts +22 -0
  198. package/dist/modules/file-browser/fs-stat.d.ts +25 -0
  199. package/dist/modules/file-browser/index.d.ts +3 -1
  200. package/dist/modules/file-browser/locales/en-US.d.ts +25 -0
  201. package/dist/modules/file-browser/locales/zh-CN.d.ts +25 -0
  202. package/dist/modules/file-browser/style.css +6388 -41
  203. package/dist/modules/file-browser/types.d.ts +206 -52
  204. package/dist/modules/file-browser/use-container-width.d.ts +17 -0
  205. package/dist/modules/file-browser/use-file-browser.d.ts +54 -0
  206. package/dist/modules/file-browser/use-fs-preview.d.ts +65 -0
  207. package/dist/modules/file-browser/use-fs-search.d.ts +35 -0
  208. package/dist/modules/file-browser/use-fs-tree.d.ts +43 -0
  209. package/dist/modules/file-browser/use-request-scope.d.ts +39 -0
  210. package/dist/modules/file-browser.js +1 -1
  211. package/dist/modules/scope-cascade/labels.d.ts +6 -0
  212. package/dist/modules/scope-cascade/locales/en-US.d.ts +6 -0
  213. package/dist/modules/scope-cascade/locales/zh-CN.d.ts +3 -0
  214. package/dist/modules/scope-cascade/scope-cascade.d.ts +1 -1
  215. package/dist/modules/scope-cascade/style.css +14 -2
  216. package/dist/modules/scope-cascade/types.d.ts +3 -0
  217. package/dist/modules/style.css +17338 -77
  218. package/dist/nx~0.js +15 -0
  219. package/dist/n~0.js +403 -144
  220. package/dist/o~0.js +106 -0
  221. package/dist/p~0.js +27 -0
  222. package/dist/rslib-runtime~0.js +42 -0
  223. package/dist/r~0.js +152 -0
  224. package/dist/shared/components/divider/divider.d.ts +18 -0
  225. package/dist/shared/components/divider/index.d.ts +1 -0
  226. package/dist/shared/components/divider/types.d.ts +35 -0
  227. package/dist/shared/components/drawer/drawer.d.ts +13 -0
  228. package/dist/shared/components/drawer/index.d.ts +1 -0
  229. package/dist/shared/components/overlay/types.d.ts +7 -0
  230. package/dist/shared/components/{tooltip/use-tooltip-position.d.ts → overlay/use-overlay-position.d.ts} +6 -6
  231. package/dist/shared/components/popover/index.d.ts +1 -0
  232. package/dist/shared/components/popover/popover.d.ts +23 -0
  233. package/dist/shared/components/popover/types.d.ts +50 -0
  234. package/dist/shared/components/resizable/clamp.d.ts +13 -0
  235. package/dist/shared/components/resizable/index.d.ts +2 -0
  236. package/dist/shared/components/resizable/resizable-handle.d.ts +25 -0
  237. package/dist/shared/components/resizable/types.d.ts +48 -0
  238. package/dist/shared/components/tooltip/types.d.ts +5 -5
  239. package/dist/shared/components/tooltip/use-portal-theme.d.ts +3 -0
  240. package/dist/shared/locale.d.ts +6 -0
  241. package/dist/style.css +27753 -7176
  242. package/dist/u~0.js +75 -58
  243. package/dist/viking-bot-composer~0.js +434 -77
  244. package/dist/viking-bot-interaction~0.js +11 -11
  245. package/package.json +18 -4
  246. package/dist/components/file-tree/file-tree-tooltip.d.ts +0 -17
  247. package/dist/components/tui/tui-labels-zh.d.ts +0 -2
  248. package/dist/g~0.js +0 -1207
  249. package/dist/modules/file-browser/file-browser-toolbar-button.d.ts +0 -10
package/dist/e~0.js ADDED
@@ -0,0 +1,333 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useId, useRef, useState } from "react";
3
+ import { createPortal } from "react-dom";
4
+ import { resolveLocale } from "./nx~0.js";
5
+ function useTourAnchor(target, locateTarget, timeout, attempt) {
6
+ const [state, setState] = useState({
7
+ anchor: null,
8
+ failed: false
9
+ });
10
+ useEffect(()=>{
11
+ const controller = new AbortController();
12
+ setState({
13
+ anchor: null,
14
+ failed: false
15
+ });
16
+ const timer = window.setTimeout(()=>{
17
+ controller.abort();
18
+ setState({
19
+ anchor: null,
20
+ failed: true
21
+ });
22
+ }, timeout);
23
+ Promise.resolve().then(()=>locateTarget?.(target, controller.signal) ?? null).then((anchor)=>{
24
+ if (controller.signal.aborted) return;
25
+ window.clearTimeout(timer);
26
+ if (anchor?.isConnected) {
27
+ anchor.scrollIntoView({
28
+ block: 'nearest',
29
+ inline: 'nearest'
30
+ });
31
+ setState({
32
+ anchor,
33
+ failed: false
34
+ });
35
+ } else setState({
36
+ anchor: null,
37
+ failed: true
38
+ });
39
+ }, ()=>{
40
+ if (controller.signal.aborted) return;
41
+ window.clearTimeout(timer);
42
+ setState({
43
+ anchor: null,
44
+ failed: true
45
+ });
46
+ });
47
+ return ()=>{
48
+ controller.abort();
49
+ window.clearTimeout(timer);
50
+ };
51
+ }, [
52
+ target,
53
+ locateTarget,
54
+ timeout,
55
+ attempt
56
+ ]);
57
+ return state;
58
+ }
59
+ function useTourPosition(anchor, surface, placement) {
60
+ const [position, setPosition] = useState();
61
+ useEffect(()=>{
62
+ if (!surface) return;
63
+ surface.showPopover?.();
64
+ const update = ()=>{
65
+ const a = anchor?.getBoundingClientRect();
66
+ const box = surface.getBoundingClientRect();
67
+ const width = window.innerWidth;
68
+ const height = window.innerHeight;
69
+ const margin = 8;
70
+ let left = (width - box.width) / 2;
71
+ let top = (height - box.height) / 2;
72
+ const missing = Boolean(anchor && !anchor.isConnected);
73
+ let visible = !anchor || missing;
74
+ if (anchor && a && !missing) {
75
+ let clip = {
76
+ left: 0,
77
+ top: 0,
78
+ right: width,
79
+ bottom: height
80
+ };
81
+ for(let parent = anchor.parentElement; parent; parent = parent.parentElement){
82
+ const css = window.getComputedStyle(parent);
83
+ const rect = parent.getBoundingClientRect();
84
+ if (/(auto|scroll|hidden|clip)/.test(css.overflowX)) clip = {
85
+ ...clip,
86
+ left: Math.max(clip.left, rect.left),
87
+ right: Math.min(clip.right, rect.right)
88
+ };
89
+ if (/(auto|scroll|hidden|clip)/.test(css.overflowY)) clip = {
90
+ ...clip,
91
+ top: Math.max(clip.top, rect.top),
92
+ bottom: Math.min(clip.bottom, rect.bottom)
93
+ };
94
+ }
95
+ visible = anchor.isConnected && a.width > 0 && a.height > 0 && a.top < clip.bottom && a.bottom > clip.top && a.left < clip.right && a.right > clip.left;
96
+ const right = a.right + 6;
97
+ const leftSide = a.left - box.width - 6;
98
+ left = 'right' === placement ? right + box.width <= width - margin || leftSide < margin ? right : leftSide : leftSide >= margin || right + box.width > width - margin ? leftSide : right;
99
+ top = a.top - 16;
100
+ const css = window.getComputedStyle(anchor);
101
+ for(let i = 0; i < css.length; i++){
102
+ const name = css[i];
103
+ if (name?.startsWith('--ov-ui-')) surface.style.setProperty(name, css.getPropertyValue(name));
104
+ }
105
+ }
106
+ const next = {
107
+ left: Math.max(margin, Math.min(left, width - box.width - margin)),
108
+ top: Math.max(margin, Math.min(top, height - box.height - margin)),
109
+ targetTop: a?.top ?? 0,
110
+ targetLeft: a?.left ?? 0,
111
+ targetWidth: a?.width ?? 0,
112
+ targetHeight: a?.height ?? 0,
113
+ visible,
114
+ missing
115
+ };
116
+ setPosition((old)=>old && Object.keys(next).every((key)=>old[key] === next[key]) ? old : next);
117
+ };
118
+ update();
119
+ const resize = new ResizeObserver(update);
120
+ resize.observe(surface);
121
+ for(let node = anchor; node; node = node.parentElement)resize.observe(node);
122
+ const mutation = new MutationObserver(update);
123
+ mutation.observe(document.body, {
124
+ childList: true,
125
+ subtree: true
126
+ });
127
+ window.addEventListener('scroll', update, true);
128
+ window.addEventListener('resize', update);
129
+ window.visualViewport?.addEventListener('resize', update);
130
+ window.visualViewport?.addEventListener('scroll', update);
131
+ return ()=>{
132
+ resize.disconnect();
133
+ mutation.disconnect();
134
+ window.removeEventListener('scroll', update, true);
135
+ window.removeEventListener('resize', update);
136
+ window.visualViewport?.removeEventListener('resize', update);
137
+ window.visualViewport?.removeEventListener('scroll', update);
138
+ if (surface.isConnected) surface.hidePopover?.();
139
+ };
140
+ }, [
141
+ anchor,
142
+ surface,
143
+ placement
144
+ ]);
145
+ return position;
146
+ }
147
+ const messages = {
148
+ close: 'Close guide',
149
+ next: 'Next',
150
+ done: 'Got it',
151
+ locating: 'Locating directory…',
152
+ unavailable: 'This directory is unavailable. Retry or skip this step.',
153
+ retry: 'Retry',
154
+ skip: 'Skip',
155
+ progress: (current, total)=>`${current}/${total}`
156
+ };
157
+ const en_US = messages;
158
+ const zh_CN_messages = {
159
+ close: '关闭引导',
160
+ next: '下一步',
161
+ done: '知道了',
162
+ locating: '正在定位目录…',
163
+ unavailable: '此目录暂不可用,请重试或跳过这一步。',
164
+ retry: '重试',
165
+ skip: '跳过',
166
+ progress: (current, total)=>`${current}/${total}`
167
+ };
168
+ const zh_CN = zh_CN_messages;
169
+ function DirectoryTour(props) {
170
+ if (!props.open || 0 === props.steps.length) return null;
171
+ return /*#__PURE__*/ jsx(TourSession, {
172
+ ...props
173
+ });
174
+ }
175
+ function TourSession(props) {
176
+ const [index, setIndex] = useState(props.defaultStep ?? 0);
177
+ const skipped = useRef(new Set());
178
+ const current = props.currentStep ?? index;
179
+ const step = props.steps[current];
180
+ if (!step) return null;
181
+ const advance = (skip)=>{
182
+ if (skip) skipped.current.add(step.id);
183
+ if (current === props.steps.length - 1) props.onComplete?.({
184
+ skippedStepIds: [
185
+ ...skipped.current
186
+ ]
187
+ });
188
+ else {
189
+ if (void 0 === props.currentStep) setIndex(current + 1);
190
+ props.onStepChange?.(current + 1);
191
+ }
192
+ };
193
+ return /*#__PURE__*/ jsx(TourStep, {
194
+ ...props,
195
+ step: step,
196
+ index: current,
197
+ advance: advance
198
+ }, step.id);
199
+ }
200
+ function TourStep({ step, index, advance, steps, locateTarget, locateTimeout = 10000, placement = 'right', onClose, labels, locale, className, style }) {
201
+ const text = resolveLocale({
202
+ 'en-US': en_US,
203
+ 'zh-CN': zh_CN
204
+ }, locale, labels);
205
+ const [attempt, retry] = useState(0);
206
+ const [surface, setSurface] = useState(null);
207
+ const { anchor, failed } = useTourAnchor(step.target, locateTarget, locateTimeout, attempt);
208
+ const position = useTourPosition(anchor, surface, placement);
209
+ const titleId = useId();
210
+ const bodyId = useId();
211
+ useEffect(()=>{
212
+ const close = (event)=>{
213
+ if ('Escape' === event.key) {
214
+ event.preventDefault();
215
+ onClose?.();
216
+ }
217
+ };
218
+ document.addEventListener('keydown', close);
219
+ return ()=>document.removeEventListener('keydown', close);
220
+ }, [
221
+ onClose
222
+ ]);
223
+ useEffect(()=>{
224
+ const previous = document.activeElement;
225
+ return ()=>{
226
+ if (previous instanceof HTMLElement && previous.isConnected) previous.focus({
227
+ preventScroll: true
228
+ });
229
+ };
230
+ }, []);
231
+ const visible = position?.visible;
232
+ useEffect(()=>{
233
+ if (surface && visible) surface.focus({
234
+ preventScroll: true
235
+ });
236
+ }, [
237
+ surface,
238
+ visible
239
+ ]);
240
+ if ("u" < typeof document) return null;
241
+ const unavailable = failed || position?.missing;
242
+ const locating = !anchor && !failed;
243
+ return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsxs("div", {
244
+ ref: setSurface,
245
+ popover: "manual",
246
+ role: "dialog",
247
+ "aria-modal": "false",
248
+ "aria-labelledby": titleId,
249
+ "aria-describedby": bodyId,
250
+ "aria-busy": locating,
251
+ tabIndex: -1,
252
+ className: [
253
+ 'ov-directory-tour',
254
+ className
255
+ ].filter(Boolean).join(' '),
256
+ style: {
257
+ ...style,
258
+ top: position?.top ?? 0,
259
+ left: position?.left ?? 0,
260
+ visibility: position?.visible ? 'visible' : 'hidden'
261
+ },
262
+ children: [
263
+ anchor && !unavailable && position?.visible && /*#__PURE__*/ jsx("div", {
264
+ className: "ov-directory-tour__highlight",
265
+ "aria-hidden": "true",
266
+ style: {
267
+ top: position.targetTop,
268
+ left: position.targetLeft,
269
+ width: position.targetWidth,
270
+ height: position.targetHeight
271
+ }
272
+ }),
273
+ /*#__PURE__*/ jsxs("div", {
274
+ className: "ov-directory-tour__card",
275
+ children: [
276
+ onClose && /*#__PURE__*/ jsx("button", {
277
+ className: "ov-directory-tour__close",
278
+ type: "button",
279
+ "aria-label": text.close,
280
+ onClick: onClose,
281
+ children: "\xd7"
282
+ }),
283
+ !locating && !unavailable && step.illustration && /*#__PURE__*/ jsx("div", {
284
+ className: "ov-directory-tour__illustration",
285
+ children: step.illustration
286
+ }),
287
+ /*#__PURE__*/ jsx("h2", {
288
+ id: titleId,
289
+ className: "ov-directory-tour__title",
290
+ children: step.title
291
+ }),
292
+ /*#__PURE__*/ jsx("div", {
293
+ id: bodyId,
294
+ className: "ov-directory-tour__description",
295
+ role: unavailable ? 'alert' : void 0,
296
+ children: unavailable ? text.unavailable : locating ? text.locating : step.description
297
+ }),
298
+ /*#__PURE__*/ jsxs("footer", {
299
+ className: "ov-directory-tour__actions",
300
+ children: [
301
+ /*#__PURE__*/ jsx("span", {
302
+ className: "ov-directory-tour__progress",
303
+ "aria-live": "polite",
304
+ children: text.progress(index + 1, steps.length)
305
+ }),
306
+ unavailable ? /*#__PURE__*/ jsxs(Fragment, {
307
+ children: [
308
+ /*#__PURE__*/ jsx("button", {
309
+ type: "button",
310
+ onClick: ()=>retry((value)=>value + 1),
311
+ children: text.retry
312
+ }),
313
+ /*#__PURE__*/ jsx("button", {
314
+ type: "button",
315
+ onClick: ()=>advance(true),
316
+ children: text.skip
317
+ })
318
+ ]
319
+ }) : /*#__PURE__*/ jsx("button", {
320
+ type: "button",
321
+ className: "ov-directory-tour__primary",
322
+ disabled: locating,
323
+ onClick: ()=>advance(false),
324
+ children: step.nextLabel ?? (index === steps.length - 1 ? text.done : text.next)
325
+ })
326
+ ]
327
+ })
328
+ ]
329
+ })
330
+ ]
331
+ }), document.body);
332
+ }
333
+ export { DirectoryTour };
@@ -13,8 +13,42 @@ import { powerpoint } from "@ark-design/ui/file-viewer/adapters/powerpoint";
13
13
  import { table } from "@ark-design/ui/file-viewer/adapters/table";
14
14
  import { text as text_text } from "@ark-design/ui/file-viewer/adapters/text";
15
15
  import { word } from "@ark-design/ui/file-viewer/adapters/word";
16
- import { toFileSource, LoadFailedState, LoadingState, UnsupportedState } from "./g~0.js";
17
- function createFilePreviewAdapterList({ onLinkClick } = {}) {
16
+ import { toFileSource, LoadFailedState, LoadingState, UnsupportedState } from "./3~0.js";
17
+ const PREFIX = './__ov_viking_image__/';
18
+ function imagePreviewTarget(url) {
19
+ return /^viking:\/\//i.test(url) ? PREFIX + encodeURIComponent(url) : url;
20
+ }
21
+ function originalImageTarget(url) {
22
+ if (!url.startsWith(PREFIX)) return url;
23
+ try {
24
+ const original = decodeURIComponent(url.slice(PREFIX.length));
25
+ return /^viking:\/\//i.test(original) ? original : url;
26
+ } catch {
27
+ return url;
28
+ }
29
+ }
30
+ function preserveVikingImages(root) {
31
+ const definitions = new Map();
32
+ function collect(node) {
33
+ if ('definition' === node.type && node.identifier && !definitions.has(node.identifier.toUpperCase())) definitions.set(node.identifier.toUpperCase(), node);
34
+ node.children?.forEach(collect);
35
+ }
36
+ function visit(node) {
37
+ if ('image' === node.type && node.url) node.url = imagePreviewTarget(node.url);
38
+ if ('imageReference' === node.type && node.identifier) {
39
+ const definition = definitions.get(node.identifier.toUpperCase());
40
+ if (definition?.url && /^viking:\/\//i.test(definition.url)) {
41
+ node.type = 'image';
42
+ node.url = imagePreviewTarget(definition.url);
43
+ node.title = definition.title;
44
+ }
45
+ }
46
+ node.children?.forEach(visit);
47
+ }
48
+ collect(root);
49
+ visit(root);
50
+ }
51
+ function createFilePreviewAdapterList({ onLinkClick, resolveImage } = {}) {
18
52
  return [
19
53
  code({
20
54
  showLineNumbers: true
@@ -26,7 +60,31 @@ function createFilePreviewAdapterList({ onLinkClick } = {}) {
26
60
  defaultExpandDepth: 4
27
61
  }),
28
62
  markdown({
29
- onLinkClick
63
+ onLinkClick,
64
+ rendererProps: {
65
+ astPlugins: (current)=>[
66
+ ...current,
67
+ {
68
+ name: 'ov-viking-images',
69
+ config: {
70
+ priority: 2
71
+ },
72
+ modifier: (root)=>{
73
+ preserveVikingImages(root);
74
+ },
75
+ before: ()=>{},
76
+ after: ()=>{},
77
+ beforeEach: ()=>{},
78
+ afterEach: ()=>{}
79
+ }
80
+ ],
81
+ imageOptions: {
82
+ processSrcBeforeLoad: resolveImage ? (src)=>resolveImage(originalImageTarget(src)) : void 0,
83
+ forceHttps: false,
84
+ objectFit: 'contain',
85
+ responsiveNaturalSize: true
86
+ }
87
+ }
30
88
  }),
31
89
  html(),
32
90
  table(),
@@ -44,9 +102,10 @@ function createFilePreviewAdapterList({ onLinkClick } = {}) {
44
102
  diff()
45
103
  ];
46
104
  }
47
- function createFilePreviewAdapters({ onHandleChange, onViewModesChange, onLinkClick }) {
105
+ function createFilePreviewAdapters({ onHandleChange, onViewModesChange, onLinkClick, resolveImage }) {
48
106
  return createFilePreviewAdapterList({
49
- onLinkClick
107
+ onLinkClick,
108
+ resolveImage
50
109
  }).map((adapter)=>{
51
110
  const wrap = (context)=>{
52
111
  const descriptor = adapter(context);
@@ -89,14 +148,37 @@ function sourceDeps(source) {
89
148
  }
90
149
  function FilePreviewViewer({ tab, text, locale, viewMode, onViewModeChange, onDownload, onHandleChange, onViewModesChange, onLinkClick }) {
91
150
  const source = useMemo(()=>toFileSource(tab.source), sourceDeps(tab.source));
151
+ const imageInput = useRef(tab.source);
152
+ imageInput.current = tab.source;
153
+ const imageResolver = tab.resolveImage;
154
+ const resolveImage = useCallback((src)=>imageResolver(src, imageInput.current), [
155
+ imageResolver
156
+ ]);
157
+ const resources = useMemo(()=>tab.resources?.flatMap((resource)=>{
158
+ const key = imagePreviewTarget(resource.key);
159
+ return key === resource.key ? [
160
+ resource
161
+ ] : [
162
+ resource,
163
+ {
164
+ ...resource,
165
+ key
166
+ }
167
+ ];
168
+ }), [
169
+ tab.resources
170
+ ]);
92
171
  const adapters = useMemo(()=>createFilePreviewAdapters({
93
172
  onHandleChange,
94
173
  onViewModesChange,
95
- onLinkClick
174
+ onLinkClick,
175
+ resolveImage: imageResolver ? resolveImage : void 0
96
176
  }), [
97
177
  onHandleChange,
98
178
  onViewModesChange,
99
- onLinkClick
179
+ onLinkClick,
180
+ resolveImage,
181
+ imageResolver
100
182
  ]);
101
183
  const canDownload = Boolean(tab.operations?.download);
102
184
  const latest = useRef({
@@ -177,7 +259,7 @@ function FilePreviewViewer({ tab, text, locale, viewMode, onViewModeChange, onDo
177
259
  adapters: adapters,
178
260
  className: "ov-file-preview__viewer",
179
261
  locale: locale,
180
- resources: tab.resources,
262
+ resources: resources,
181
263
  slots: slots,
182
264
  source: source,
183
265
  toolbar: false,
package/dist/f~0.js CHANGED
@@ -1,5 +1,8 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useId, useRef, useState } from "react";
3
+ import { resolveLocale } from "./nx~0.js";
4
+ import { checkreact } from "./0~0.js";
5
+ import { searchreact } from "./p~0.js";
3
6
  const SvgChevronDown = (props)=>/*#__PURE__*/ jsx("svg", {
4
7
  xmlns: "http://www.w3.org/2000/svg",
5
8
  width: 14,
@@ -13,6 +16,33 @@ const SvgChevronDown = (props)=>/*#__PURE__*/ jsx("svg", {
13
16
  })
14
17
  });
15
18
  const chevron_downreact = SvgChevronDown;
19
+ const messages = {
20
+ loading: 'Loading…',
21
+ searchPlaceholder: 'Search',
22
+ empty: 'No options',
23
+ noMatch: 'No matches',
24
+ error: 'Unable to load options'
25
+ };
26
+ const en_US = messages;
27
+ const zh_CN_messages = {
28
+ loading: '加载中…',
29
+ searchPlaceholder: '搜索',
30
+ empty: '暂无选项',
31
+ noMatch: '没有匹配项',
32
+ error: '选项加载失败'
33
+ };
34
+ const zh_CN = zh_CN_messages;
35
+ const LOCALES = {
36
+ 'en-US': en_US,
37
+ 'zh-CN': zh_CN
38
+ };
39
+ function resolveScopeLabels(locale = 'en-US', labels) {
40
+ const defaults = resolveLocale(LOCALES, locale, labels);
41
+ return {
42
+ ...defaults,
43
+ noMatch: labels?.noMatch ?? labels?.empty ?? defaults.noMatch
44
+ };
45
+ }
16
46
  function moveScopeFocus(event) {
17
47
  if (![
18
48
  'ArrowDown',
@@ -30,46 +60,6 @@ function moveScopeFocus(event) {
30
60
  const next = 'Home' === event.key ? 0 : 'End' === event.key ? options.length - 1 : 'ArrowDown' === event.key ? (current + 1) % options.length : current < 0 ? options.length - 1 : (current - 1 + options.length) % options.length;
31
61
  options[next]?.focus();
32
62
  }
33
- const SvgCheck = (props)=>/*#__PURE__*/ jsx("svg", {
34
- xmlns: "http://www.w3.org/2000/svg",
35
- width: 16,
36
- height: 16,
37
- fill: "none",
38
- viewBox: "0 0 16 16",
39
- ...props,
40
- children: /*#__PURE__*/ jsx("path", {
41
- stroke: "currentColor",
42
- strokeLinecap: "round",
43
- strokeLinejoin: "round",
44
- strokeWidth: 1.2,
45
- d: "M13.333 4 6 11.333 2.667 8"
46
- })
47
- });
48
- const checkreact = SvgCheck;
49
- const SvgSearch = (props)=>/*#__PURE__*/ jsx("svg", {
50
- xmlns: "http://www.w3.org/2000/svg",
51
- width: 16,
52
- height: 16,
53
- fill: "none",
54
- viewBox: "0 0 16 16",
55
- ...props,
56
- children: /*#__PURE__*/ jsxs("g", {
57
- stroke: "currentColor",
58
- strokeWidth: 1.2,
59
- children: [
60
- /*#__PURE__*/ jsx("circle", {
61
- cx: 7.167,
62
- cy: 7.167,
63
- r: 4.667
64
- }),
65
- /*#__PURE__*/ jsx("path", {
66
- strokeLinecap: "round",
67
- d: "m10.667 10.667 3 3"
68
- })
69
- ]
70
- })
71
- });
72
- const searchreact = SvgSearch;
73
63
  function Highlight({ text, keyword }) {
74
64
  const needle = keyword.trim().toLocaleLowerCase();
75
65
  if (!needle) return /*#__PURE__*/ jsx(Fragment, {
@@ -112,8 +102,8 @@ function ScopePanel({ label, data, state, slots, actions, onSelect, labels }) {
112
102
  type: "search",
113
103
  className: "ov-scope-switcher__search",
114
104
  value: keyword,
115
- "aria-label": labels?.searchPlaceholder ?? 'Search',
116
- placeholder: labels?.searchPlaceholder ?? 'Search',
105
+ "aria-label": labels.searchPlaceholder,
106
+ placeholder: labels.searchPlaceholder,
117
107
  onChange: (event)=>actions?.onSearchKeywordChange?.(event.currentTarget.value)
118
108
  })
119
109
  ]
@@ -122,11 +112,11 @@ function ScopePanel({ label, data, state, slots, actions, onSelect, labels }) {
122
112
  list = state?.loading ? /*#__PURE__*/ jsx("div", {
123
113
  className: "ov-scope-switcher__state",
124
114
  role: "status",
125
- children: labels?.loading ?? 'Loading…'
115
+ children: labels.loading
126
116
  }) : state?.error ? /*#__PURE__*/ jsx("div", {
127
117
  className: "ov-scope-switcher__state",
128
118
  role: "alert",
129
- children: slots?.errorFallback ?? labels?.error ?? 'Unable to load options'
119
+ children: slots?.errorFallback ?? labels.error
130
120
  }) : options.length ? /*#__PURE__*/ jsx("div", {
131
121
  className: "ov-scope-switcher__list",
132
122
  role: "listbox",
@@ -195,7 +185,7 @@ function ScopePanel({ label, data, state, slots, actions, onSelect, labels }) {
195
185
  }, keyword) : /*#__PURE__*/ jsx("div", {
196
186
  className: "ov-scope-switcher__state",
197
187
  role: "status",
198
- children: slots?.emptyFallback ?? (hasKeyword ? labels?.noMatch ?? labels?.empty ?? 'No matches' : labels?.empty ?? 'No options')
188
+ children: slots?.emptyFallback ?? (hasKeyword ? labels.noMatch : labels.empty)
199
189
  });
200
190
  return /*#__PURE__*/ jsx("div", {
201
191
  role: "group",
@@ -216,7 +206,8 @@ function ScopePanel({ label, data, state, slots, actions, onSelect, labels }) {
216
206
  });
217
207
  }
218
208
  function ScopeSelector(props) {
219
- const { identity, trigger: triggerContent, labels } = props;
209
+ const { identity, trigger: triggerContent, locale } = props;
210
+ const labels = resolveScopeLabels(locale, props.labels);
220
211
  const selectable = 'selectable' === props.kind ? props : void 0;
221
212
  const data = selectable?.data;
222
213
  const state = selectable?.state;
@@ -346,8 +337,9 @@ function ScopeSelector(props) {
346
337
  ]
347
338
  });
348
339
  }
349
- function ScopeSwitcher({ children, className = '', ...props }) {
340
+ function ScopeSwitcher({ locale, children, className = '', ...props }) {
350
341
  return /*#__PURE__*/ jsx("div", {
342
+ lang: locale,
351
343
  ...props,
352
344
  className: `ov-scope-switcher ${className}`,
353
345
  children: children
package/dist/h~0.js CHANGED
@@ -10,6 +10,7 @@ function groupMessages(messages) {
10
10
  ];
11
11
  previous.turnId ??= message.turnId;
12
12
  previous.streaming = previous.streaming || message.streaming;
13
+ previous.createdAt = message.createdAt ?? previous.createdAt;
13
14
  if (message.action) previous.actions = [
14
15
  ...previous.actions ?? [],
15
16
  {
@@ -42,7 +43,10 @@ function groupByActivity(parts) {
42
43
  for (const part of parts){
43
44
  const groupId = 'groupId' in part ? part.groupId : void 0;
44
45
  const previous = blocks.at(-1);
45
- if (previous && groupId && previous.groupId === groupId) {
46
+ const activity = 'reasoning' === part.type || 'tool' === part.type;
47
+ const previousType = previous?.parts[0]?.type;
48
+ const previousActivity = 'reasoning' === previousType || 'tool' === previousType;
49
+ if (previous && groupId && previous.groupId === groupId && activity === previousActivity) {
46
50
  previous.parts.push(part);
47
51
  continue;
48
52
  }
@@ -0,0 +1,12 @@
1
+ declare const icons: {
2
+ conversation: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement>>;
3
+ command: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement>>;
4
+ history: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement>>;
5
+ newSession: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement>>;
6
+ historyEmpty: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement>>;
7
+ };
8
+ /** Private Console controls. Sources and licenses are in packages/icons/README.md. */
9
+ export declare function ConsoleIcon({ name }: {
10
+ name: keyof typeof icons;
11
+ }): import("react").JSX.Element;
12
+ export {};
@@ -31,3 +31,5 @@ export declare const VideoIcon: IconComponent;
31
31
  export declare const WordIcon: IconComponent;
32
32
  export { getFileTypeColor, getFileTypeIcon, resolveFileTypeIconKey, } from './file-type-icon.js';
33
33
  export type { FileTypeIconComponent } from './file-type-icon.js';
34
+ export { VikingBotIcon } from './viking-bot-icons.js';
35
+ export type { VikingBotIconName } from './viking-bot-icons.js';
@@ -0,0 +1,6 @@
1
+ import type { SVGProps } from 'react';
2
+ export type VikingBotIconName = 'bulb' | 'book' | 'video' | 'report' | 'history' | 'newSession' | 'remove' | 'tool';
3
+ /** Reference artwork and the local remove glyph. See packages/icons/README.md. */
4
+ export declare function VikingBotIcon({ name, 'aria-label': ariaLabel, ...props }: SVGProps<SVGSVGElement> & {
5
+ name: VikingBotIconName;
6
+ }): import("react").JSX.Element;
package/dist/icons.js CHANGED
@@ -1 +1,2 @@
1
1
  export { ArrowRightIcon, AudioIcon, ChevronRightIcon, DocumentIcon, FolderIcon, FolderOpenIcon, PdfIcon, PptIcon, VideoIcon, WordIcon, getFileTypeColor, getFileTypeIcon, resolveFileTypeIconKey } from "./k~0.js";
2
+ export { VikingBotIcon } from "./lg~0.js";
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { FileBrowserEntries } from './components/file-browser-entries/index.js';
2
+ export type { FileBrowserEntriesProps } from './components/file-browser-entries/index.js';
1
3
  export { FileTree } from './components/file-tree/index.js';
2
4
  export type { FileTreeProps } from './components/file-tree/index.js';
3
5
  export { Tui } from './components/tui/index.js';
@@ -14,3 +16,5 @@ export { Console } from './modules/console/index.js';
14
16
  export type { ConsoleProps } from './modules/console/index.js';
15
17
  export { ScopeCascade } from './modules/scope-cascade/index.js';
16
18
  export type { ScopeCascadeProps } from './modules/scope-cascade/index.js';
19
+ export { DirectoryTour } from './components/directory-tour/index.js';
20
+ export type { DirectoryTourProps } from './components/directory-tour/index.js';