@openviking/react 0.1.7 → 0.1.8-beta.11.1.gc6def608a25e

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 (127) hide show
  1. package/README.md +11 -1
  2. package/dist/1~0.js +57 -0
  3. package/dist/3~0.js +171 -5
  4. package/dist/5~0.js +181 -0
  5. package/dist/6~0.js +48 -0
  6. package/dist/ark-message-list-view~0.js +50 -8
  7. package/dist/components/agent-connect/style.css +4 -2
  8. package/dist/components/api-key-login-form/api-key-login-form.d.ts +2 -0
  9. package/dist/components/api-key-login-form/index.d.ts +3 -0
  10. package/dist/components/api-key-login-form/style.css +438 -0
  11. package/dist/components/api-key-login-form/style.js +0 -0
  12. package/dist/components/api-key-login-form/types.d.ts +7 -0
  13. package/dist/components/api-key-login-form.js +1 -0
  14. package/dist/components/directory-tour/directory-tour-intro.d.ts +3 -0
  15. package/dist/components/directory-tour/index.d.ts +2 -1
  16. package/dist/components/directory-tour/style.css +154 -26
  17. package/dist/components/directory-tour/tour-card.d.ts +14 -0
  18. package/dist/components/directory-tour/types.d.ts +24 -1
  19. package/dist/components/directory-tour/use-tour-anchor.d.ts +1 -0
  20. package/dist/components/directory-tour/use-tour-position.d.ts +4 -1
  21. package/dist/components/directory-tour/use-tour-theme.d.ts +2 -0
  22. package/dist/components/directory-tour.js +52 -1
  23. package/dist/components/email-login-form/email-login-form.d.ts +2 -0
  24. package/dist/components/email-login-form/index.d.ts +3 -0
  25. package/dist/components/email-login-form/style.css +438 -0
  26. package/dist/components/email-login-form/style.js +0 -0
  27. package/dist/components/email-login-form/types.d.ts +11 -0
  28. package/dist/components/email-login-form.js +1 -0
  29. package/dist/components/experience-dashboard/experience-impact.d.ts +3 -1
  30. package/dist/components/experience-dashboard/style.css +4 -2
  31. package/dist/components/file-browser-entries/style.css +12 -6
  32. package/dist/components/file-preview/file-preview-header.d.ts +4 -21
  33. package/dist/components/file-preview/file-preview-toolbar.d.ts +7 -0
  34. package/dist/components/file-preview/locales/en-US.d.ts +9 -0
  35. package/dist/components/file-preview/locales/zh-CN.d.ts +9 -0
  36. package/dist/components/file-preview/style.css +116 -2
  37. package/dist/components/file-preview/types.d.ts +14 -21
  38. package/dist/components/file-tree/style.css +4 -2
  39. package/dist/components/invitation-confirmation/index.d.ts +3 -0
  40. package/dist/components/invitation-confirmation/invitation-confirmation.d.ts +2 -0
  41. package/dist/components/invitation-confirmation/style.css +438 -0
  42. package/dist/components/invitation-confirmation/style.js +0 -0
  43. package/dist/components/invitation-confirmation/types.d.ts +20 -0
  44. package/dist/components/invitation-confirmation.js +1 -0
  45. package/dist/components/login-method-selector/index.d.ts +2 -0
  46. package/dist/components/login-method-selector/login-method-selector.d.ts +2 -0
  47. package/dist/components/login-method-selector/style.css +438 -0
  48. package/dist/components/login-method-selector/style.js +0 -0
  49. package/dist/components/login-method-selector/types.d.ts +14 -0
  50. package/dist/components/login-method-selector.js +1 -0
  51. package/dist/components/password-reset-request-form/index.d.ts +3 -0
  52. package/dist/components/password-reset-request-form/password-reset-request-form.d.ts +2 -0
  53. package/dist/components/password-reset-request-form/style.css +438 -0
  54. package/dist/components/password-reset-request-form/style.js +0 -0
  55. package/dist/components/password-reset-request-form/types.d.ts +13 -0
  56. package/dist/components/password-reset-request-form.js +1 -0
  57. package/dist/components/password-setup-form/index.d.ts +3 -0
  58. package/dist/components/password-setup-form/password-setup-form.d.ts +2 -0
  59. package/dist/components/password-setup-form/style.css +438 -0
  60. package/dist/components/password-setup-form/style.js +0 -0
  61. package/dist/components/password-setup-form/types.d.ts +10 -0
  62. package/dist/components/password-setup-form.js +1 -0
  63. package/dist/components/scope-switcher/style.css +4 -2
  64. package/dist/components/scope-switcher.js +1 -1
  65. package/dist/components/style.css +3120 -79
  66. package/dist/components/tui/style.css +8 -4
  67. package/dist/components/viking-bot/bot-popover.d.ts +2 -1
  68. package/dist/components/viking-bot/composer-reference-tags.d.ts +8 -0
  69. package/dist/components/viking-bot/composer-references.d.ts +0 -5
  70. package/dist/components/viking-bot/locales/en-US.d.ts +1 -0
  71. package/dist/components/viking-bot/locales/zh-CN.d.ts +1 -0
  72. package/dist/components/viking-bot/model.d.ts +1 -0
  73. package/dist/components/viking-bot/popover-tab-navigation.d.ts +3 -0
  74. package/dist/components/viking-bot/style.css +166 -27
  75. package/dist/components/viking-bot/types.d.ts +3 -1
  76. package/dist/components/viking-bot/user-message-group.d.ts +9 -0
  77. package/dist/components/wiki-dashboard/index.d.ts +1 -1
  78. package/dist/components/wiki-dashboard/style.css +16 -4
  79. package/dist/components/wiki-dashboard/types.d.ts +12 -16
  80. package/dist/components/wiki-dashboard/wiki-action-button.d.ts +2 -9
  81. package/dist/components/wiki-dashboard/wiki-conflict-card.d.ts +3 -10
  82. package/dist/c~0.js +77 -6
  83. package/dist/d~0.js +28 -0
  84. package/dist/ep~0.js +281 -133
  85. package/dist/fi~0.js +339 -0
  86. package/dist/fj~0.js +32 -67
  87. package/dist/fl~0.js +3 -2
  88. package/dist/f~0.js +63 -326
  89. package/dist/g~0.js +135 -0
  90. package/dist/icons/index.d.ts +2 -0
  91. package/dist/icons/viking-bot-icons.d.ts +1 -1
  92. package/dist/icons.js +1 -1
  93. package/dist/index.d.ts +12 -0
  94. package/dist/index.js +8 -2
  95. package/dist/k~0.js +44 -4
  96. package/dist/l5~0.js +3813 -0
  97. package/dist/lg~0.js +41 -1
  98. package/dist/lk~0.js +1 -1
  99. package/dist/l~0.js +54 -3811
  100. package/dist/modules/console/style.css +182 -35
  101. package/dist/modules/file-browser/file-browser-detail-icons.d.ts +0 -6
  102. package/dist/modules/file-browser/file-browser-detail.d.ts +2 -23
  103. package/dist/modules/file-browser/file-browser.d.ts +1 -1
  104. package/dist/modules/file-browser/fs-file-editing.d.ts +4 -0
  105. package/dist/modules/file-browser/fs-preview-images.d.ts +3 -0
  106. package/dist/modules/file-browser/fs-read-file.d.ts +1 -1
  107. package/dist/modules/file-browser/style.css +156 -70
  108. package/dist/modules/file-browser/types.d.ts +2 -0
  109. package/dist/modules/file-browser/use-file-browser-acl.d.ts +1 -0
  110. package/dist/modules/file-browser/wiki-dashboard-pane.d.ts +2 -4
  111. package/dist/modules/file-browser.js +1 -1
  112. package/dist/modules/scope-cascade/style.css +4 -2
  113. package/dist/modules/style.css +346 -109
  114. package/dist/n~0.js +1 -1
  115. package/dist/p0~0.js +27 -0
  116. package/dist/p~0.js +34 -25
  117. package/dist/shared/auth/agreements.d.ts +10 -0
  118. package/dist/shared/auth/fields.d.ts +15 -0
  119. package/dist/shared/auth/form-frame.d.ts +12 -0
  120. package/dist/shared/auth/locales/en-US.d.ts +24 -0
  121. package/dist/shared/auth/locales/zh-CN.d.ts +24 -0
  122. package/dist/shared/auth/types.d.ts +61 -0
  123. package/dist/shared/auth/use-auth-labels.d.ts +3 -0
  124. package/dist/shared/auth/use-form.d.ts +8 -0
  125. package/dist/style.css +3690 -410
  126. package/dist/viking-bot-composer~0.js +86 -29
  127. package/package.json +32 -2
package/dist/fi~0.js ADDED
@@ -0,0 +1,339 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
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 "./p0~0.js";
6
+ import { input_Input } from "./c7r~0.js";
7
+ import { chevron_downreact } from "./s~0.js";
8
+ import { useLocale, LocaleProvider } from "./28~0.js";
9
+ const messages = {
10
+ loading: 'Loading…',
11
+ searchPlaceholder: 'Search',
12
+ empty: 'No options',
13
+ noMatch: 'No matches',
14
+ error: 'Unable to load options'
15
+ };
16
+ const en_US = messages;
17
+ const zh_CN_messages = {
18
+ loading: '加载中…',
19
+ searchPlaceholder: '搜索',
20
+ empty: '暂无选项',
21
+ noMatch: '没有匹配项',
22
+ error: '选项加载失败'
23
+ };
24
+ const zh_CN = zh_CN_messages;
25
+ const LOCALES = {
26
+ 'en-US': en_US,
27
+ 'zh-CN': zh_CN
28
+ };
29
+ function resolveScopeLabels(locale = 'en-US', labels) {
30
+ const defaults = resolveLocale(LOCALES, locale, labels);
31
+ return {
32
+ ...defaults,
33
+ noMatch: labels?.noMatch ?? labels?.empty ?? defaults.noMatch
34
+ };
35
+ }
36
+ function moveScopeFocus(event) {
37
+ if (![
38
+ 'ArrowDown',
39
+ 'ArrowUp',
40
+ 'Home',
41
+ 'End'
42
+ ].includes(event.key)) return;
43
+ const target = event.target;
44
+ const isSearch = target.matches('input.ov-scope-switcher__search');
45
+ if (event.defaultPrevented || !target.matches('[role="option"]') && !isSearch || isSearch && !event.key.startsWith('Arrow')) return;
46
+ const options = Array.from(event.currentTarget.querySelectorAll('[role="option"]:not([aria-disabled="true"])'));
47
+ if (!options.length) return;
48
+ event.preventDefault();
49
+ const current = options.indexOf(document.activeElement);
50
+ 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;
51
+ options[next]?.focus();
52
+ }
53
+ function Highlight({ text, keyword }) {
54
+ const needle = keyword.trim().toLocaleLowerCase();
55
+ if (!needle) return /*#__PURE__*/ jsx(Fragment, {
56
+ children: text
57
+ });
58
+ const haystack = text.toLocaleLowerCase();
59
+ const parts = [];
60
+ let cursor = 0;
61
+ let hit = haystack.indexOf(needle);
62
+ while(hit >= 0){
63
+ if (hit > cursor) parts.push(text.slice(cursor, hit));
64
+ const end = hit + needle.length;
65
+ parts.push(/*#__PURE__*/ jsx("mark", {
66
+ children: text.slice(hit, end)
67
+ }, `${hit}-${end}`));
68
+ cursor = end;
69
+ hit = haystack.indexOf(needle, cursor);
70
+ }
71
+ if (cursor < text.length) parts.push(text.slice(cursor));
72
+ return /*#__PURE__*/ jsx(Fragment, {
73
+ children: parts
74
+ });
75
+ }
76
+ function ScopePanel({ label, data, state, slots, actions, onSelect, labels }) {
77
+ const focusPanel = useCallback((node)=>{
78
+ const target = node?.querySelector('input') ?? node?.querySelector('[role="option"][aria-selected="true"]:not([aria-disabled="true"])') ?? node?.querySelector('[role="option"]:not([aria-disabled="true"])');
79
+ (target ?? node)?.focus();
80
+ }, []);
81
+ const options = data.visibleOptions ?? data.options;
82
+ const keyword = state?.searchKeyword ?? '';
83
+ const hasKeyword = keyword.trim().length > 0;
84
+ const searchVisible = actions?.onSearchKeywordChange && (hasKeyword || Math.max(options.length, data.options.length, data.total ?? 0) > 10);
85
+ const search = searchVisible ? /*#__PURE__*/ jsx(input_Input, {
86
+ size: "small",
87
+ prefix: /*#__PURE__*/ jsx(searchreact, {
88
+ className: "ov-scope-switcher__search-icon"
89
+ }),
90
+ type: "search",
91
+ className: "ov-scope-switcher__search-field",
92
+ value: keyword,
93
+ "aria-label": labels.searchPlaceholder,
94
+ placeholder: labels.searchPlaceholder,
95
+ onChange: (event)=>actions?.onSearchKeywordChange?.(event.currentTarget.value)
96
+ }) : null;
97
+ let list;
98
+ list = state?.loading ? /*#__PURE__*/ jsx("div", {
99
+ className: "ov-scope-switcher__state",
100
+ role: "status",
101
+ children: labels.loading
102
+ }) : state?.error ? /*#__PURE__*/ jsx("div", {
103
+ className: "ov-scope-switcher__state",
104
+ role: "alert",
105
+ children: slots?.errorFallback ?? labels.error
106
+ }) : options.length ? /*#__PURE__*/ jsx("div", {
107
+ className: "ov-scope-switcher__list",
108
+ role: "listbox",
109
+ "aria-label": label,
110
+ "aria-busy": state?.busy,
111
+ onScroll: (event)=>{
112
+ const { scrollTop, scrollHeight, clientHeight } = event.currentTarget;
113
+ actions?.onScroll?.({
114
+ scrollTop,
115
+ scrollHeight,
116
+ clientHeight
117
+ });
118
+ },
119
+ children: options.map((option)=>{
120
+ const selected = option.id === data.selectedId;
121
+ const content = /*#__PURE__*/ jsxs(Fragment, {
122
+ children: [
123
+ option.icon && /*#__PURE__*/ jsx("span", {
124
+ className: "ov-scope-switcher__icon",
125
+ "aria-hidden": "true",
126
+ children: option.icon
127
+ }),
128
+ /*#__PURE__*/ jsxs("span", {
129
+ className: "ov-scope-switcher__option-text",
130
+ children: [
131
+ /*#__PURE__*/ jsx("span", {
132
+ children: /*#__PURE__*/ jsx(Highlight, {
133
+ text: option.label,
134
+ keyword: keyword
135
+ })
136
+ }),
137
+ option.description && /*#__PURE__*/ jsx("small", {
138
+ children: option.description
139
+ })
140
+ ]
141
+ }),
142
+ selected && /*#__PURE__*/ jsx("span", {
143
+ className: "ov-scope-switcher__check",
144
+ "aria-hidden": "true",
145
+ children: /*#__PURE__*/ jsx(checkreact, {})
146
+ })
147
+ ]
148
+ });
149
+ return /*#__PURE__*/ jsx("div", {
150
+ tabIndex: option.disabled || state?.busy ? -1 : 0,
151
+ role: "option",
152
+ "aria-selected": selected,
153
+ className: "ov-scope-switcher__option",
154
+ title: option.label,
155
+ "aria-disabled": option.disabled || state?.busy || void 0,
156
+ onClick: (event)=>{
157
+ const target = event.target;
158
+ if (option.disabled || state?.busy || target.closest('button, a, input, select, textarea, [role="button"]')) return;
159
+ onSelect(option);
160
+ },
161
+ onKeyDown: (event)=>{
162
+ if (event.target !== event.currentTarget || option.disabled || state?.busy) return;
163
+ if ('Enter' === event.key || ' ' === event.key) {
164
+ event.preventDefault();
165
+ onSelect(option);
166
+ }
167
+ },
168
+ children: slots?.renderOption ? slots?.renderOption(content, option) : content
169
+ }, option.id);
170
+ })
171
+ }, keyword) : /*#__PURE__*/ jsx("div", {
172
+ className: "ov-scope-switcher__state",
173
+ role: "status",
174
+ children: slots?.emptyFallback ?? (hasKeyword ? labels.noMatch : labels.empty)
175
+ });
176
+ return /*#__PURE__*/ jsx("div", {
177
+ role: "group",
178
+ tabIndex: -1,
179
+ ref: focusPanel,
180
+ className: "ov-scope-switcher__panel-inner",
181
+ onKeyDownCapture: moveScopeFocus,
182
+ children: slots?.renderPanel ? slots?.renderPanel({
183
+ search,
184
+ list
185
+ }) : /*#__PURE__*/ jsxs("div", {
186
+ className: "ov-scope-switcher__panel-body",
187
+ children: [
188
+ search,
189
+ list
190
+ ]
191
+ })
192
+ });
193
+ }
194
+ function ScopeSelector(props) {
195
+ const { identity, trigger: triggerContent } = props;
196
+ const locale = useLocale(props.locale);
197
+ const labels = resolveScopeLabels(locale, props.labels);
198
+ const selectable = 'selectable' === props.kind ? props : void 0;
199
+ const data = selectable?.data;
200
+ const state = selectable?.state;
201
+ const actions = selectable?.actions;
202
+ const slots = selectable?.slots;
203
+ const [localVisible, setLocalVisible] = useState(false);
204
+ const root = useRef(null);
205
+ const trigger = useRef(null);
206
+ const restoreSelectionFocus = useRef(false);
207
+ const panelId = useId();
208
+ const open = void 0 !== selectable && (state?.visible ?? localVisible) && !state?.disabled;
209
+ const onVisibleChange = actions?.onVisibleChange;
210
+ const changeVisible = useCallback((visible)=>{
211
+ setLocalVisible(visible);
212
+ onVisibleChange?.(visible);
213
+ }, [
214
+ onVisibleChange
215
+ ]);
216
+ useEffect(()=>{
217
+ if (!open) return;
218
+ const dismiss = (event)=>{
219
+ if (event.target instanceof Node && !root.current?.contains(event.target)) changeVisible(false);
220
+ };
221
+ const escape = (event)=>{
222
+ if ('Escape' === event.key) {
223
+ event.preventDefault();
224
+ changeVisible(false);
225
+ trigger.current?.focus();
226
+ }
227
+ };
228
+ document.addEventListener('pointerdown', dismiss);
229
+ document.addEventListener('keydown', escape);
230
+ return ()=>{
231
+ document.removeEventListener('pointerdown', dismiss);
232
+ document.removeEventListener('keydown', escape);
233
+ };
234
+ }, [
235
+ open,
236
+ changeVisible
237
+ ]);
238
+ useEffect(()=>{
239
+ if (open || !restoreSelectionFocus.current) return;
240
+ restoreSelectionFocus.current = false;
241
+ if (document.activeElement === document.body || root.current?.contains(document.activeElement)) trigger.current?.focus();
242
+ }, [
243
+ open
244
+ ]);
245
+ const selected = data?.options.find((o)=>o.id === data.selectedId);
246
+ const label = triggerContent?.label ?? selected?.label ?? '';
247
+ const icon = triggerContent?.icon ?? selected?.icon;
248
+ const content = /*#__PURE__*/ jsxs(Fragment, {
249
+ children: [
250
+ icon && /*#__PURE__*/ jsx("span", {
251
+ className: "ov-scope-switcher__icon",
252
+ "aria-hidden": "true",
253
+ children: icon
254
+ }),
255
+ /*#__PURE__*/ jsx("span", {
256
+ className: "ov-scope-switcher__label",
257
+ children: label
258
+ }),
259
+ identity.tag && /*#__PURE__*/ jsx("span", {
260
+ className: "ov-scope-switcher__tag",
261
+ children: identity.tag
262
+ })
263
+ ]
264
+ });
265
+ return /*#__PURE__*/ jsxs("div", {
266
+ ref: root,
267
+ role: "group",
268
+ className: "ov-scope-switcher__level",
269
+ onBlur: (event)=>{
270
+ if (open && event.relatedTarget instanceof Node && !event.currentTarget.contains(event.relatedTarget)) changeVisible(false);
271
+ },
272
+ children: [
273
+ void 0 === selectable ? /*#__PURE__*/ jsx("span", {
274
+ className: "ov-scope-switcher__trigger",
275
+ "aria-label": identity.ariaLabel,
276
+ title: label,
277
+ children: content
278
+ }) : /*#__PURE__*/ jsxs("button", {
279
+ ref: trigger,
280
+ type: "button",
281
+ className: "ov-scope-switcher__trigger",
282
+ "aria-label": identity.ariaLabel,
283
+ title: label,
284
+ disabled: state?.disabled,
285
+ "aria-expanded": open,
286
+ "aria-haspopup": "dialog",
287
+ "aria-controls": open ? panelId : void 0,
288
+ onClick: ()=>changeVisible(!open),
289
+ onKeyDown: (event)=>{
290
+ if ('ArrowDown' === event.key || 'ArrowUp' === event.key) {
291
+ event.preventDefault();
292
+ if (open) root.current?.querySelector('[role="option"]:not([aria-disabled="true"])')?.focus();
293
+ else changeVisible(true);
294
+ }
295
+ },
296
+ children: [
297
+ content,
298
+ /*#__PURE__*/ jsx("span", {
299
+ className: "ov-scope-switcher__arrow",
300
+ "aria-hidden": "true",
301
+ children: /*#__PURE__*/ jsx(chevron_downreact, {})
302
+ })
303
+ ]
304
+ }),
305
+ open && void 0 !== selectable && void 0 !== data && /*#__PURE__*/ jsx("div", {
306
+ id: panelId,
307
+ className: slots?.renderPanel ? 'ov-scope-switcher__panel ov-scope-switcher__panel--custom' : 'ov-scope-switcher__panel',
308
+ role: "dialog",
309
+ "aria-label": identity.ariaLabel ?? label,
310
+ children: /*#__PURE__*/ jsx(ScopePanel, {
311
+ label: identity.ariaLabel ?? label,
312
+ data: data,
313
+ state: state,
314
+ slots: slots,
315
+ actions: actions,
316
+ onSelect: (option)=>{
317
+ restoreSelectionFocus.current = true;
318
+ changeVisible(false);
319
+ actions?.onSelect?.(option);
320
+ },
321
+ labels: labels
322
+ })
323
+ })
324
+ ]
325
+ });
326
+ }
327
+ function ScopeSwitcher({ locale: localeProp, children, className = '', ...props }) {
328
+ const locale = useLocale(localeProp);
329
+ return /*#__PURE__*/ jsx(LocaleProvider, {
330
+ locale: locale,
331
+ children: /*#__PURE__*/ jsx("div", {
332
+ lang: locale,
333
+ ...props,
334
+ className: `ov-scope-switcher ${className}`,
335
+ children: children
336
+ })
337
+ });
338
+ }
339
+ export { ScopeSelector, ScopeSwitcher };
package/dist/fj~0.js CHANGED
@@ -1,7 +1,7 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useId, useRef, useState } from "react";
3
3
  import { mergeLabels } from "./nx~0.js";
4
- import { getFileTypeColor, getFileTypeIcon, WikiWarningIcon, WikiSuccessIcon, WikiEditIcon, WikiDiscussIcon, WikiHistoryIcon, resolveFileTypeIconKey } from "./k~0.js";
4
+ import { getFileTypeColor, resolveFileTypeIconKey, WikiWarningIcon, WikiSuccessIcon, getFileTypeIcon } from "./k~0.js";
5
5
  import { Tooltip } from "./rt~0.js";
6
6
  import { button_Button } from "./e~0.js";
7
7
  import { Popover } from "./r~0.js";
@@ -10,7 +10,6 @@ import { DashboardState } from "./37~0.js";
10
10
  const en = {
11
11
  title: 'Generation results',
12
12
  pendingLabel: 'Pending',
13
- discuss: 'VikingBot discussion',
14
13
  conflicts: 'All conflicts',
15
14
  conflictFiles: 'Conflicting files',
16
15
  pending: 'Pending conflicts',
@@ -27,20 +26,15 @@ const en = {
27
26
  failed: 'Could not load conflicts',
28
27
  retry: 'Retry',
29
28
  open: 'Open',
30
- edit: 'Manual edit',
31
29
  solution: 'Solution',
32
30
  occurred: 'Detected',
33
31
  fixedAt: 'Resolved',
34
32
  evidence: 'Resolution basis',
35
- history: 'Resolution history',
36
- historyHint: 'View the resolution plan and evidence',
37
- unavailable: 'Action unavailable',
38
33
  limited: 'Showing up to 100 conflicting files'
39
34
  };
40
35
  const zh = {
41
36
  title: '生成效果',
42
37
  pendingLabel: '待确认',
43
- discuss: 'VikingBot 对话',
44
38
  conflicts: '全部冲突',
45
39
  conflictFiles: '冲突文件数',
46
40
  pending: '待确认冲突',
@@ -57,14 +51,10 @@ const zh = {
57
51
  failed: '冲突加载失败',
58
52
  retry: '重试',
59
53
  open: '打开',
60
- edit: '人工修改',
61
54
  solution: '修复方案',
62
55
  occurred: '检测时间',
63
56
  fixedAt: '修复时间',
64
57
  evidence: '修复依据',
65
- history: '修复回溯',
66
- historyHint: '查看修复方案与依据',
67
- unavailable: '当前不可操作',
68
58
  limited: '最多展示 100 个存在待确认冲突的文件'
69
59
  };
70
60
  const wikiLabels = (locale, labels)=>mergeLabels('zh-CN' === locale ? zh : en, labels);
@@ -80,24 +70,23 @@ function WikiFileIcon({ name }) {
80
70
  }
81
71
  });
82
72
  }
83
- function WikiActionButton({ label, hint, onClick, children, ...aria }) {
73
+ function WikiActionButton({ icon, tooltip, disabled, onClick }) {
74
+ const inactive = disabled || !onClick;
84
75
  return /*#__PURE__*/ jsx(Tooltip, {
85
- content: hint,
76
+ content: tooltip,
86
77
  children: /*#__PURE__*/ jsx(button_Button, {
87
78
  size: "mini",
88
79
  type: "text",
89
80
  iconOnly: true,
90
- ...aria,
91
81
  htmlType: "button",
92
- "aria-label": label,
93
- "aria-disabled": !onClick || void 0,
94
- "aria-description": onClick ? void 0 : hint,
95
- onClick: ()=>onClick?.(),
96
- children: children
82
+ "aria-label": tooltip,
83
+ "aria-disabled": inactive || void 0,
84
+ icon: icon,
85
+ onClick: onClick
97
86
  })
98
87
  });
99
88
  }
100
- function WikiConflictCard({ conflict, path, labels: t, editDisabledReason, discussDisabledReason, onOpenUri, onEdit, onDiscuss }) {
89
+ function WikiConflictCard({ conflict, path, labels: t, actions = [], onOpenUri }) {
101
90
  const [expanded, setExpanded] = useState(false);
102
91
  const id = useId();
103
92
  const fixed = 'fixed' === conflict.state;
@@ -106,7 +95,11 @@ function WikiConflictCard({ conflict, path, labels: t, editDisabledReason, discu
106
95
  className: "ov-wiki-dashboard__conflict",
107
96
  children: [
108
97
  /*#__PURE__*/ jsxs("div", {
109
- className: `ov-wiki-dashboard__conflict-row${path ? '' : ' ov-wiki-dashboard__conflict-row--without-path'}`,
98
+ className: [
99
+ 'ov-wiki-dashboard__conflict-row',
100
+ !path && 'ov-wiki-dashboard__conflict-row--without-path',
101
+ actions.length > 0 && 'ov-wiki-dashboard__conflict-row--with-actions'
102
+ ].filter(Boolean).join(' '),
110
103
  children: [
111
104
  /*#__PURE__*/ jsxs("span", {
112
105
  className: `ov-wiki-dashboard__status ov-wiki-dashboard__status--${conflict.state}`,
@@ -163,41 +156,12 @@ function WikiConflictCard({ conflict, path, labels: t, editDisabledReason, discu
163
156
  className: `ov-wiki-dashboard__severity ov-wiki-dashboard__severity--${conflict.severity}`,
164
157
  children: t[conflict.severity]
165
158
  }),
166
- /*#__PURE__*/ jsx("div", {
159
+ actions.length > 0 ? /*#__PURE__*/ jsx("div", {
167
160
  className: "ov-wiki-dashboard__actions",
168
- children: fixed ? /*#__PURE__*/ jsx(WikiActionButton, {
169
- label: t.history,
170
- hint: t.historyHint,
171
- "aria-expanded": expanded,
172
- "aria-controls": id,
173
- onClick: ()=>setExpanded(!expanded),
174
- children: /*#__PURE__*/ jsx(WikiHistoryIcon, {
175
- width: 14,
176
- height: 14
177
- })
178
- }) : /*#__PURE__*/ jsxs(Fragment, {
179
- children: [
180
- /*#__PURE__*/ jsx(WikiActionButton, {
181
- label: `${t.edit}: ${conflict.description}`,
182
- hint: onEdit ? t.edit : editDisabledReason || t.unavailable,
183
- onClick: onEdit ? ()=>onEdit(conflict) : void 0,
184
- children: /*#__PURE__*/ jsx(WikiEditIcon, {
185
- width: 14,
186
- height: 14
187
- })
188
- }),
189
- /*#__PURE__*/ jsx(WikiActionButton, {
190
- label: `${t.discuss}: ${conflict.description}`,
191
- hint: onDiscuss ? t.discuss : discussDisabledReason || t.unavailable,
192
- onClick: onDiscuss ? ()=>onDiscuss(conflict) : void 0,
193
- children: /*#__PURE__*/ jsx(WikiDiscussIcon, {
194
- width: 14,
195
- height: 14
196
- })
197
- })
198
- ]
199
- })
200
- })
161
+ children: actions.map(({ key, ...action })=>/*#__PURE__*/ jsx(WikiActionButton, {
162
+ ...action
163
+ }, key))
164
+ }) : null
201
165
  ]
202
166
  }),
203
167
  /*#__PURE__*/ jsx("div", {
@@ -388,7 +352,7 @@ function WikiSeverityFilter({ value, onChange, labels: t }) {
388
352
  });
389
353
  }
390
354
  function WikiDashboard(props) {
391
- const { kind, data, editDisabledReason, discussDisabledReason, locale: localeProp, onOpenUri, onOpenDashboard, onEdit, onDiscuss, labels, loading, error, onRetry, className, ...rest } = props;
355
+ const { kind, data, locale: localeProp, onOpenUri, onOpenDashboard, defineActions, labels, loading, error, onRetry, className, ...rest } = props;
392
356
  const locale = useLocale(localeProp);
393
357
  const t = wikiLabels(locale, labels);
394
358
  const [severity, setSeverity] = useState('all');
@@ -449,15 +413,14 @@ function WikiDashboard(props) {
449
413
  conflict: conflict,
450
414
  path: data?.path,
451
415
  labels: t,
452
- editDisabledReason: editDisabledReason,
453
- discussDisabledReason: discussDisabledReason,
454
416
  onOpenUri: onOpenUri,
455
- onEdit: onEdit,
456
- onDiscuss: onDiscuss
417
+ actions: defineActions?.(conflict)
457
418
  }, conflict.id))
458
419
  }) : 'directory' === kind && data?.files.length ? /*#__PURE__*/ jsx("ul", {
459
420
  className: "ov-wiki-dashboard__files",
460
- children: data.files.map((file)=>/*#__PURE__*/ jsxs("li", {
421
+ children: data.files.map((file)=>{
422
+ const actions = defineActions?.(file) ?? [];
423
+ return /*#__PURE__*/ jsxs("li", {
461
424
  children: [
462
425
  /*#__PURE__*/ jsx(WikiFileIcon, {
463
426
  name: file
@@ -477,13 +440,15 @@ function WikiDashboard(props) {
477
440
  })
478
441
  ]
479
442
  }),
480
- onEdit ? /*#__PURE__*/ jsx(button_Button, {
481
- size: "small",
482
- onClick: ()=>onEdit(file),
483
- children: t.edit
443
+ actions.length > 0 ? /*#__PURE__*/ jsx("div", {
444
+ className: "ov-wiki-dashboard__actions",
445
+ children: actions.map(({ key, ...action })=>/*#__PURE__*/ jsx(WikiActionButton, {
446
+ ...action
447
+ }, key))
484
448
  }) : null
485
449
  ]
486
- }, file))
450
+ }, file);
451
+ })
487
452
  }) : /*#__PURE__*/ jsx(DashboardState, {
488
453
  state: {
489
454
  loading,
package/dist/fl~0.js CHANGED
@@ -283,7 +283,7 @@ const ORDER = [
283
283
  'failure',
284
284
  'unknown'
285
285
  ];
286
- function ExperienceImpact({ data, labels: t, days, onDaysChange, outcomesState, trajectoriesState, onOpenUri }) {
286
+ function ExperienceImpact({ data, labels: t, locale, days, onDaysChange, outcomesState, trajectoriesState, onOpenUri }) {
287
287
  const total = data.outcomes?.reduce((sum, item)=>sum + item.count, 0) ?? 0;
288
288
  const metrics = [
289
289
  {
@@ -304,7 +304,7 @@ function ExperienceImpact({ data, labels: t, days, onDaysChange, outcomesState,
304
304
  },
305
305
  {
306
306
  label: t.rate,
307
- value: data.effect ? new Intl.NumberFormat('en-US', {
307
+ value: data.effect ? new Intl.NumberFormat(locale, {
308
308
  style: 'percent',
309
309
  maximumFractionDigits: 1
310
310
  }).format(data.effect.injectionRate) : void 0,
@@ -657,6 +657,7 @@ function ExperienceDashboardContent({ uri, data = {}, kind, tab: controlledTab,
657
657
  /*#__PURE__*/ jsx(ExperienceImpact, {
658
658
  data: result,
659
659
  labels: t,
660
+ locale: locale,
660
661
  days: days,
661
662
  onDaysChange: setDays,
662
663
  outcomesState: states.outcomes ?? {},