@openviking/react 0.1.7 → 0.1.8-beta.10.1.g8e5299efeb0a
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.
- package/README.md +11 -1
- package/dist/1~0.js +57 -0
- package/dist/3~0.js +171 -5
- package/dist/5~0.js +181 -0
- package/dist/6~0.js +48 -0
- package/dist/components/agent-connect/style.css +4 -2
- package/dist/components/api-key-login-form/api-key-login-form.d.ts +2 -0
- package/dist/components/api-key-login-form/index.d.ts +3 -0
- package/dist/components/api-key-login-form/style.css +438 -0
- package/dist/components/api-key-login-form/style.js +0 -0
- package/dist/components/api-key-login-form/types.d.ts +7 -0
- package/dist/components/api-key-login-form.js +1 -0
- package/dist/components/directory-tour/directory-tour-intro.d.ts +3 -0
- package/dist/components/directory-tour/index.d.ts +2 -1
- package/dist/components/directory-tour/style.css +154 -26
- package/dist/components/directory-tour/tour-card.d.ts +14 -0
- package/dist/components/directory-tour/types.d.ts +24 -1
- package/dist/components/directory-tour/use-tour-anchor.d.ts +1 -0
- package/dist/components/directory-tour/use-tour-position.d.ts +4 -1
- package/dist/components/directory-tour/use-tour-theme.d.ts +2 -0
- package/dist/components/directory-tour.js +52 -1
- package/dist/components/email-login-form/email-login-form.d.ts +2 -0
- package/dist/components/email-login-form/index.d.ts +3 -0
- package/dist/components/email-login-form/style.css +438 -0
- package/dist/components/email-login-form/style.js +0 -0
- package/dist/components/email-login-form/types.d.ts +11 -0
- package/dist/components/email-login-form.js +1 -0
- package/dist/components/experience-dashboard/experience-impact.d.ts +3 -1
- package/dist/components/experience-dashboard/style.css +4 -2
- package/dist/components/file-browser-entries/style.css +12 -6
- package/dist/components/file-preview/file-preview-header.d.ts +4 -21
- package/dist/components/file-preview/file-preview-toolbar.d.ts +7 -0
- package/dist/components/file-preview/locales/en-US.d.ts +9 -0
- package/dist/components/file-preview/locales/zh-CN.d.ts +9 -0
- package/dist/components/file-preview/style.css +116 -2
- package/dist/components/file-preview/types.d.ts +14 -21
- package/dist/components/file-tree/style.css +4 -2
- package/dist/components/invitation-confirmation/index.d.ts +3 -0
- package/dist/components/invitation-confirmation/invitation-confirmation.d.ts +2 -0
- package/dist/components/invitation-confirmation/style.css +438 -0
- package/dist/components/invitation-confirmation/style.js +0 -0
- package/dist/components/invitation-confirmation/types.d.ts +20 -0
- package/dist/components/invitation-confirmation.js +1 -0
- package/dist/components/login-method-selector/index.d.ts +2 -0
- package/dist/components/login-method-selector/login-method-selector.d.ts +2 -0
- package/dist/components/login-method-selector/style.css +438 -0
- package/dist/components/login-method-selector/style.js +0 -0
- package/dist/components/login-method-selector/types.d.ts +14 -0
- package/dist/components/login-method-selector.js +1 -0
- package/dist/components/password-reset-request-form/index.d.ts +3 -0
- package/dist/components/password-reset-request-form/password-reset-request-form.d.ts +2 -0
- package/dist/components/password-reset-request-form/style.css +438 -0
- package/dist/components/password-reset-request-form/style.js +0 -0
- package/dist/components/password-reset-request-form/types.d.ts +13 -0
- package/dist/components/password-reset-request-form.js +1 -0
- package/dist/components/password-setup-form/index.d.ts +3 -0
- package/dist/components/password-setup-form/password-setup-form.d.ts +2 -0
- package/dist/components/password-setup-form/style.css +438 -0
- package/dist/components/password-setup-form/style.js +0 -0
- package/dist/components/password-setup-form/types.d.ts +10 -0
- package/dist/components/password-setup-form.js +1 -0
- package/dist/components/scope-switcher/style.css +4 -2
- package/dist/components/scope-switcher.js +1 -1
- package/dist/components/style.css +2966 -58
- package/dist/components/tui/style.css +8 -4
- package/dist/components/viking-bot/style.css +12 -6
- package/dist/components/wiki-dashboard/index.d.ts +1 -1
- package/dist/components/wiki-dashboard/style.css +16 -4
- package/dist/components/wiki-dashboard/types.d.ts +12 -16
- package/dist/components/wiki-dashboard/wiki-action-button.d.ts +2 -9
- package/dist/components/wiki-dashboard/wiki-conflict-card.d.ts +3 -10
- package/dist/d~0.js +28 -0
- package/dist/ep~0.js +281 -133
- package/dist/fi~0.js +339 -0
- package/dist/fj~0.js +32 -67
- package/dist/fl~0.js +3 -2
- package/dist/f~0.js +63 -326
- package/dist/g~0.js +135 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons.js +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +8 -2
- package/dist/k~0.js +44 -4
- package/dist/l5~0.js +3813 -0
- package/dist/lk~0.js +1 -1
- package/dist/l~0.js +54 -3811
- package/dist/modules/console/style.css +28 -14
- package/dist/modules/file-browser/file-browser-detail-icons.d.ts +0 -6
- package/dist/modules/file-browser/file-browser-detail.d.ts +2 -23
- package/dist/modules/file-browser/file-browser.d.ts +1 -1
- package/dist/modules/file-browser/fs-file-editing.d.ts +4 -0
- package/dist/modules/file-browser/fs-preview-images.d.ts +3 -0
- package/dist/modules/file-browser/fs-read-file.d.ts +1 -1
- package/dist/modules/file-browser/style.css +156 -70
- package/dist/modules/file-browser/types.d.ts +2 -0
- package/dist/modules/file-browser/use-file-browser-acl.d.ts +1 -0
- package/dist/modules/file-browser/wiki-dashboard-pane.d.ts +2 -4
- package/dist/modules/file-browser.js +1 -1
- package/dist/modules/scope-cascade/style.css +4 -2
- package/dist/modules/style.css +192 -88
- package/dist/n~0.js +1 -1
- package/dist/p0~0.js +27 -0
- package/dist/p~0.js +34 -25
- package/dist/shared/auth/agreements.d.ts +10 -0
- package/dist/shared/auth/fields.d.ts +15 -0
- package/dist/shared/auth/form-frame.d.ts +12 -0
- package/dist/shared/auth/locales/en-US.d.ts +24 -0
- package/dist/shared/auth/locales/zh-CN.d.ts +24 -0
- package/dist/shared/auth/types.d.ts +61 -0
- package/dist/shared/auth/use-auth-labels.d.ts +3 -0
- package/dist/shared/auth/use-form.d.ts +8 -0
- package/dist/style.css +3364 -350
- 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 {
|
|
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,
|
|
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({
|
|
73
|
+
function WikiActionButton({ icon, tooltip, disabled, onClick }) {
|
|
74
|
+
const inactive = disabled || !onClick;
|
|
84
75
|
return /*#__PURE__*/ jsx(Tooltip, {
|
|
85
|
-
content:
|
|
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":
|
|
93
|
-
"aria-disabled":
|
|
94
|
-
|
|
95
|
-
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,
|
|
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:
|
|
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:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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,
|
|
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
|
-
|
|
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)
|
|
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
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
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(
|
|
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 ?? {},
|