@openviking/react 0.1.5 → 0.1.7

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 (145) hide show
  1. package/README.md +15 -11
  2. package/dist/2~0.js +6 -5
  3. package/dist/37~0.js +27 -0
  4. package/dist/3c~0.js +24 -12
  5. package/dist/3~0.js +19 -9
  6. package/dist/ae~0.js +8 -1
  7. package/dist/ark-message-list-view~0.js +9 -4
  8. package/dist/a~0.js +13 -7
  9. package/dist/c7r~0.js +50 -0
  10. package/dist/ck~0.js +7 -0
  11. package/dist/client/paths.d.ts +10 -0
  12. package/dist/client/provider.d.ts +6 -1
  13. package/dist/components/agent-connect/style.css +268 -37
  14. package/dist/components/directory-tour/style.css +265 -21
  15. package/dist/components/directory-tour.js +1 -1
  16. package/dist/components/experience-dashboard/dashboard-tabs.d.ts +11 -0
  17. package/dist/components/experience-dashboard/experience-dashboard.d.ts +2 -0
  18. package/dist/components/experience-dashboard/experience-impact.d.ts +11 -0
  19. package/dist/components/experience-dashboard/experience-list.d.ts +9 -0
  20. package/dist/components/experience-dashboard/experience-pagination.d.ts +8 -0
  21. package/dist/components/experience-dashboard/experience-tests.d.ts +6 -0
  22. package/dist/components/experience-dashboard/experience-trajectories.d.ts +6 -0
  23. package/dist/components/experience-dashboard/index.d.ts +2 -0
  24. package/dist/components/experience-dashboard/labels.d.ts +2 -0
  25. package/dist/components/experience-dashboard/style.css +914 -0
  26. package/dist/components/experience-dashboard/style.js +0 -0
  27. package/dist/components/experience-dashboard/types.d.ts +106 -0
  28. package/dist/components/experience-dashboard.js +1 -0
  29. package/dist/components/file-browser-entries/style.css +463 -86
  30. package/dist/components/file-preview/style.css +267 -78
  31. package/dist/components/file-tree/file-tree-toolbar.d.ts +3 -3
  32. package/dist/components/file-tree/locales/en-US.d.ts +3 -0
  33. package/dist/components/file-tree/locales/zh-CN.d.ts +3 -0
  34. package/dist/components/file-tree/style.css +372 -88
  35. package/dist/components/file-tree/types.d.ts +13 -4
  36. package/dist/components/scope-switcher/style.css +412 -39
  37. package/dist/components/style.css +9326 -4553
  38. package/dist/components/tui/style.css +385 -67
  39. package/dist/components/viking-bot/interaction/style.css +143 -22
  40. package/dist/components/viking-bot/style.css +1075 -278
  41. package/dist/components/wiki-dashboard/index.d.ts +2 -0
  42. package/dist/components/wiki-dashboard/labels.d.ts +2 -0
  43. package/dist/components/wiki-dashboard/style.css +956 -0
  44. package/dist/components/wiki-dashboard/style.js +0 -0
  45. package/dist/components/wiki-dashboard/types.d.ts +92 -0
  46. package/dist/components/wiki-dashboard/wiki-action-button.d.ts +9 -0
  47. package/dist/components/wiki-dashboard/wiki-conflict-card.d.ts +15 -0
  48. package/dist/components/wiki-dashboard/wiki-dashboard.d.ts +2 -0
  49. package/dist/components/wiki-dashboard/wiki-file-icon.d.ts +3 -0
  50. package/dist/components/wiki-dashboard/wiki-severity-filter.d.ts +8 -0
  51. package/dist/components/wiki-dashboard.js +1 -0
  52. package/dist/c~0.js +16 -8
  53. package/dist/ep~0.js +345 -0
  54. package/dist/e~0.js +33 -328
  55. package/dist/fj~0.js +507 -0
  56. package/dist/fl~0.js +709 -0
  57. package/dist/f~0.js +12 -27
  58. package/dist/icons/index.d.ts +28 -0
  59. package/dist/icons.js +1 -1
  60. package/dist/index.d.ts +4 -0
  61. package/dist/index.js +3 -1
  62. package/dist/k~0.js +277 -1
  63. package/dist/lk~0.js +56 -14
  64. package/dist/l~0.js +2786 -446
  65. package/dist/modules/console/index.d.ts +1 -2
  66. package/dist/modules/console/style.css +1787 -346
  67. package/dist/modules/console.js +1 -1
  68. package/dist/modules/file-browser/acl/acl-add-principal.d.ts +12 -0
  69. package/dist/modules/file-browser/acl/acl-candidate.d.ts +8 -0
  70. package/dist/modules/file-browser/acl/acl-client.d.ts +13 -0
  71. package/dist/modules/file-browser/acl/acl-confirmation.d.ts +6 -0
  72. package/dist/modules/file-browser/acl/acl-entry.d.ts +13 -0
  73. package/dist/modules/file-browser/acl/acl-labels.d.ts +47 -0
  74. package/dist/modules/file-browser/acl/acl-menu.d.ts +10 -0
  75. package/dist/modules/file-browser/acl/acl-modal.d.ts +17 -0
  76. package/dist/modules/file-browser/acl/acl-model.d.ts +17 -0
  77. package/dist/modules/file-browser/acl/acl-principal-tabs.d.ts +6 -0
  78. package/dist/modules/file-browser/acl/acl-tag.d.ts +7 -0
  79. package/dist/modules/file-browser/acl/locales/en-US.d.ts +44 -0
  80. package/dist/modules/file-browser/acl/locales/zh-CN.d.ts +44 -0
  81. package/dist/modules/file-browser/acl/use-acl-principals.d.ts +17 -0
  82. package/dist/modules/file-browser/acl/use-acl-report.d.ts +27 -0
  83. package/dist/modules/file-browser/acl-types.d.ts +86 -0
  84. package/dist/modules/file-browser/dashboard-data.d.ts +9 -0
  85. package/dist/modules/file-browser/dashboard-indicator.d.ts +8 -0
  86. package/dist/modules/file-browser/dashboard-labels.d.ts +9 -0
  87. package/dist/modules/file-browser/dashboard-model.d.ts +17 -0
  88. package/dist/modules/file-browser/dashboard-resource.d.ts +12 -0
  89. package/dist/modules/file-browser/experience-dashboard-pane.d.ts +8 -0
  90. package/dist/modules/file-browser/experience-data.d.ts +31 -0
  91. package/dist/modules/file-browser/file-browser-detail.d.ts +4 -1
  92. package/dist/modules/file-browser/file-browser-labels.d.ts +1 -1
  93. package/dist/modules/file-browser/file-browser-search.d.ts +20 -0
  94. package/dist/modules/file-browser/file-browser-toolbar.d.ts +3 -10
  95. package/dist/modules/file-browser/file-browser-tree-pane.d.ts +4 -7
  96. package/dist/modules/file-browser/file-browser.d.ts +1 -1
  97. package/dist/modules/file-browser/fs-directories.d.ts +9 -0
  98. package/dist/modules/file-browser/fs-lines.d.ts +36 -0
  99. package/dist/modules/file-browser/fs-memory-fields.d.ts +65 -0
  100. package/dist/modules/file-browser/fs-model.d.ts +15 -3
  101. package/dist/modules/file-browser/fs-read-file.d.ts +14 -0
  102. package/dist/modules/file-browser/index.d.ts +3 -2
  103. package/dist/modules/file-browser/locales/en-US.d.ts +5 -0
  104. package/dist/modules/file-browser/locales/zh-CN.d.ts +5 -0
  105. package/dist/modules/file-browser/style.css +4033 -483
  106. package/dist/modules/file-browser/types.d.ts +82 -20
  107. package/dist/modules/file-browser/use-browser-dashboards.d.ts +31 -0
  108. package/dist/modules/file-browser/use-dashboard-query.d.ts +9 -0
  109. package/dist/modules/file-browser/use-experience-dashboard.d.ts +27 -0
  110. package/dist/modules/file-browser/use-file-browser-acl.d.ts +15 -0
  111. package/dist/modules/file-browser/use-file-browser.d.ts +6 -51
  112. package/dist/modules/file-browser/use-fs-tree.d.ts +3 -0
  113. package/dist/modules/file-browser/use-wiki-dashboard.d.ts +17 -0
  114. package/dist/modules/file-browser/wiki-conflicts.d.ts +12 -0
  115. package/dist/modules/file-browser/wiki-dashboard-pane.d.ts +14 -0
  116. package/dist/modules/file-browser.js +1 -1
  117. package/dist/modules/scope-cascade/controller.d.ts +2 -2
  118. package/dist/modules/scope-cascade/index.d.ts +1 -2
  119. package/dist/modules/scope-cascade/scope-cascade.d.ts +1 -1
  120. package/dist/modules/scope-cascade/style.css +581 -39
  121. package/dist/modules/scope-cascade/types.d.ts +8 -3
  122. package/dist/modules/scope-cascade/use-scope-cascade.d.ts +2 -2
  123. package/dist/modules/scope-cascade.js +1 -1
  124. package/dist/modules/style.css +13589 -7966
  125. package/dist/n~0.js +73 -165
  126. package/dist/rt~0.js +255 -0
  127. package/dist/r~0.js +18 -39
  128. package/dist/shared/components/button/button.d.ts +20 -0
  129. package/dist/shared/components/input/input.d.ts +17 -0
  130. package/dist/shared/components/modal/locales/en-US.d.ts +4 -0
  131. package/dist/shared/components/modal/locales/zh-CN.d.ts +4 -0
  132. package/dist/shared/components/modal/modal.d.ts +2 -0
  133. package/dist/shared/components/modal/types.d.ts +18 -0
  134. package/dist/shared/components/overlay/lock-body-scroll.d.ts +1 -0
  135. package/dist/shared/components/popover/popover.d.ts +1 -1
  136. package/dist/shared/components/popover/types.d.ts +7 -1
  137. package/dist/shared/dashboard/dashboard-state.d.ts +12 -0
  138. package/dist/static/image/dashboard-background.png +0 -0
  139. package/dist/style.css +16088 -5602
  140. package/dist/s~0.js +16 -0
  141. package/dist/u~0.js +15 -6
  142. package/dist/viking-bot-composer~0.js +30 -12
  143. package/dist/viking-bot-interaction~0.js +2 -1
  144. package/package.json +14 -3
  145. package/dist/o~0.js +0 -106
package/dist/e~0.js CHANGED
@@ -1,335 +1,40 @@
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 { useLocale } from "./28~0.js";
5
- import { resolveLocale } from "./nx~0.js";
6
- function useTourAnchor(target, locateTarget, timeout, attempt) {
7
- const [state, setState] = useState({
8
- anchor: null,
9
- failed: false
10
- });
11
- useEffect(()=>{
12
- const controller = new AbortController();
13
- setState({
14
- anchor: null,
15
- failed: false
16
- });
17
- const timer = window.setTimeout(()=>{
18
- controller.abort();
19
- setState({
20
- anchor: null,
21
- failed: true
22
- });
23
- }, timeout);
24
- Promise.resolve().then(()=>locateTarget?.(target, controller.signal) ?? null).then((anchor)=>{
25
- if (controller.signal.aborted) return;
26
- window.clearTimeout(timer);
27
- if (anchor?.isConnected) {
28
- anchor.scrollIntoView({
29
- block: 'nearest',
30
- inline: 'nearest'
31
- });
32
- setState({
33
- anchor,
34
- failed: false
35
- });
36
- } else setState({
37
- anchor: null,
38
- failed: true
39
- });
40
- }, ()=>{
41
- if (controller.signal.aborted) return;
42
- window.clearTimeout(timer);
43
- setState({
44
- anchor: null,
45
- failed: true
46
- });
47
- });
48
- return ()=>{
49
- controller.abort();
50
- window.clearTimeout(timer);
51
- };
52
- }, [
53
- target,
54
- locateTarget,
55
- timeout,
56
- attempt
57
- ]);
58
- return state;
59
- }
60
- function useTourPosition(anchor, surface, placement) {
61
- const [position, setPosition] = useState();
62
- useEffect(()=>{
63
- if (!surface) return;
64
- surface.showPopover?.();
65
- const update = ()=>{
66
- const a = anchor?.getBoundingClientRect();
67
- const box = surface.getBoundingClientRect();
68
- const width = window.innerWidth;
69
- const height = window.innerHeight;
70
- const margin = 8;
71
- let left = (width - box.width) / 2;
72
- let top = (height - box.height) / 2;
73
- const missing = Boolean(anchor && !anchor.isConnected);
74
- let visible = !anchor || missing;
75
- if (anchor && a && !missing) {
76
- let clip = {
77
- left: 0,
78
- top: 0,
79
- right: width,
80
- bottom: height
81
- };
82
- for(let parent = anchor.parentElement; parent; parent = parent.parentElement){
83
- const css = window.getComputedStyle(parent);
84
- const rect = parent.getBoundingClientRect();
85
- if (/(auto|scroll|hidden|clip)/.test(css.overflowX)) clip = {
86
- ...clip,
87
- left: Math.max(clip.left, rect.left),
88
- right: Math.min(clip.right, rect.right)
89
- };
90
- if (/(auto|scroll|hidden|clip)/.test(css.overflowY)) clip = {
91
- ...clip,
92
- top: Math.max(clip.top, rect.top),
93
- bottom: Math.min(clip.bottom, rect.bottom)
94
- };
95
- }
96
- 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;
97
- const right = a.right + 6;
98
- const leftSide = a.left - box.width - 6;
99
- left = 'right' === placement ? right + box.width <= width - margin || leftSide < margin ? right : leftSide : leftSide >= margin || right + box.width > width - margin ? leftSide : right;
100
- top = a.top - 16;
101
- const css = window.getComputedStyle(anchor);
102
- for(let i = 0; i < css.length; i++){
103
- const name = css[i];
104
- if (name?.startsWith('--ov-ui-')) surface.style.setProperty(name, css.getPropertyValue(name));
105
- }
106
- }
107
- const next = {
108
- left: Math.max(margin, Math.min(left, width - box.width - margin)),
109
- top: Math.max(margin, Math.min(top, height - box.height - margin)),
110
- targetTop: a?.top ?? 0,
111
- targetLeft: a?.left ?? 0,
112
- targetWidth: a?.width ?? 0,
113
- targetHeight: a?.height ?? 0,
114
- visible,
115
- missing
116
- };
117
- setPosition((old)=>old && Object.keys(next).every((key)=>old[key] === next[key]) ? old : next);
118
- };
119
- update();
120
- const resize = new ResizeObserver(update);
121
- resize.observe(surface);
122
- for(let node = anchor; node; node = node.parentElement)resize.observe(node);
123
- const mutation = new MutationObserver(update);
124
- mutation.observe(document.body, {
125
- childList: true,
126
- subtree: true
127
- });
128
- window.addEventListener('scroll', update, true);
129
- window.addEventListener('resize', update);
130
- window.visualViewport?.addEventListener('resize', update);
131
- window.visualViewport?.addEventListener('scroll', update);
132
- return ()=>{
133
- resize.disconnect();
134
- mutation.disconnect();
135
- window.removeEventListener('scroll', update, true);
136
- window.removeEventListener('resize', update);
137
- window.visualViewport?.removeEventListener('resize', update);
138
- window.visualViewport?.removeEventListener('scroll', update);
139
- if (surface.isConnected) surface.hidePopover?.();
140
- };
141
- }, [
142
- anchor,
143
- surface,
144
- placement
145
- ]);
146
- return position;
147
- }
148
- const messages = {
149
- close: 'Close guide',
150
- next: 'Next',
151
- done: 'Got it',
152
- locating: 'Locating directory…',
153
- unavailable: 'This directory is unavailable. Retry or skip this step.',
154
- retry: 'Retry',
155
- skip: 'Skip',
156
- progress: (current, total)=>`${current}/${total}`
157
- };
158
- const en_US = messages;
159
- const zh_CN_messages = {
160
- close: '关闭引导',
161
- next: '下一步',
162
- done: '知道了',
163
- locating: '正在定位目录…',
164
- unavailable: '此目录暂不可用,请重试或跳过这一步。',
165
- retry: '重试',
166
- skip: '跳过',
167
- progress: (current, total)=>`${current}/${total}`
168
- };
169
- const zh_CN = zh_CN_messages;
170
- function DirectoryTour(props) {
171
- if (!props.open || 0 === props.steps.length) return null;
172
- return /*#__PURE__*/ jsx(TourSession, {
173
- ...props
174
- });
175
- }
176
- function TourSession(props) {
177
- const [index, setIndex] = useState(props.defaultStep ?? 0);
178
- const skipped = useRef(new Set());
179
- const current = props.currentStep ?? index;
180
- const step = props.steps[current];
181
- if (!step) return null;
182
- const advance = (skip)=>{
183
- if (skip) skipped.current.add(step.id);
184
- if (current === props.steps.length - 1) props.onComplete?.({
185
- skippedStepIds: [
186
- ...skipped.current
187
- ]
188
- });
189
- else {
190
- if (void 0 === props.currentStep) setIndex(current + 1);
191
- props.onStepChange?.(current + 1);
192
- }
193
- };
194
- return /*#__PURE__*/ jsx(TourStep, {
195
- ...props,
196
- step: step,
197
- index: current,
198
- advance: advance
199
- }, step.id);
200
- }
201
- function TourStep({ step, index, advance, steps, locateTarget, locateTimeout = 10000, placement = 'right', onClose, labels, locale: localeProp, className, style }) {
202
- const locale = useLocale(localeProp);
203
- const text = resolveLocale({
204
- 'en-US': en_US,
205
- 'zh-CN': zh_CN
206
- }, locale, labels);
207
- const [attempt, retry] = useState(0);
208
- const [surface, setSurface] = useState(null);
209
- const { anchor, failed } = useTourAnchor(step.target, locateTarget, locateTimeout, attempt);
210
- const position = useTourPosition(anchor, surface, placement);
211
- const titleId = useId();
212
- const bodyId = useId();
213
- useEffect(()=>{
214
- const close = (event)=>{
215
- if ('Escape' === event.key) {
216
- event.preventDefault();
217
- onClose?.();
218
- }
219
- };
220
- document.addEventListener('keydown', close);
221
- return ()=>document.removeEventListener('keydown', close);
222
- }, [
223
- onClose
224
- ]);
225
- useEffect(()=>{
226
- const previous = document.activeElement;
227
- return ()=>{
228
- if (previous instanceof HTMLElement && previous.isConnected) previous.focus({
229
- preventScroll: true
230
- });
231
- };
232
- }, []);
233
- const visible = position?.visible;
234
- useEffect(()=>{
235
- if (surface && visible) surface.focus({
236
- preventScroll: true
237
- });
238
- }, [
239
- surface,
240
- visible
241
- ]);
242
- if ("u" < typeof document) return null;
243
- const unavailable = failed || position?.missing;
244
- const locating = !anchor && !failed;
245
- return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsxs("div", {
246
- ref: setSurface,
247
- popover: "manual",
248
- role: "dialog",
249
- "aria-modal": "false",
250
- "aria-labelledby": titleId,
251
- "aria-describedby": bodyId,
252
- "aria-busy": locating,
253
- tabIndex: -1,
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ const button_Button = /*#__PURE__*/ forwardRef(function({ type = 'default', htmlType = 'button', size = 'default', shape = 'square', icon, iconOnly, loading, long, disabled, className, children, onClick, ...rest }, ref) {
4
+ const inactive = disabled || loading || true === rest['aria-disabled'] || 'true' === rest['aria-disabled'];
5
+ const variant = 'default' === type ? 'secondary' : type;
6
+ const onlyIcon = iconOnly || null != icon && null == children;
7
+ return /*#__PURE__*/ jsxs("button", {
8
+ ...rest,
9
+ ref: ref,
10
+ type: htmlType,
11
+ disabled: disabled || loading,
12
+ "aria-busy": loading || rest['aria-busy'],
254
13
  className: [
255
- 'ov-directory-tour',
14
+ 'ov-button',
15
+ `ov-button--${variant}`,
16
+ `ov-button--${size}`,
17
+ `ov-button--${shape}`,
18
+ onlyIcon && 'ov-button--icon-only',
19
+ disabled && 'ov-button--disabled',
20
+ loading && 'ov-button--loading',
21
+ long && 'ov-button--long',
256
22
  className
257
23
  ].filter(Boolean).join(' '),
258
- style: {
259
- ...style,
260
- top: position?.top ?? 0,
261
- left: position?.left ?? 0,
262
- visibility: position?.visible ? 'visible' : 'hidden'
24
+ onClick: (event)=>{
25
+ if (inactive) return void event.preventDefault();
26
+ onClick?.(event);
263
27
  },
264
28
  children: [
265
- anchor && !unavailable && position?.visible && /*#__PURE__*/ jsx("div", {
266
- className: "ov-directory-tour__highlight",
29
+ loading || null != icon ? /*#__PURE__*/ jsx("span", {
30
+ className: "ov-button__icon",
267
31
  "aria-hidden": "true",
268
- style: {
269
- top: position.targetTop,
270
- left: position.targetLeft,
271
- width: position.targetWidth,
272
- height: position.targetHeight
273
- }
274
- }),
275
- /*#__PURE__*/ jsxs("div", {
276
- className: "ov-directory-tour__card",
277
- children: [
278
- onClose && /*#__PURE__*/ jsx("button", {
279
- className: "ov-directory-tour__close",
280
- type: "button",
281
- "aria-label": text.close,
282
- onClick: onClose,
283
- children: "\xd7"
284
- }),
285
- !locating && !unavailable && step.illustration && /*#__PURE__*/ jsx("div", {
286
- className: "ov-directory-tour__illustration",
287
- children: step.illustration
288
- }),
289
- /*#__PURE__*/ jsx("h2", {
290
- id: titleId,
291
- className: "ov-directory-tour__title",
292
- children: step.title
293
- }),
294
- /*#__PURE__*/ jsx("div", {
295
- id: bodyId,
296
- className: "ov-directory-tour__description",
297
- role: unavailable ? 'alert' : void 0,
298
- children: unavailable ? text.unavailable : locating ? text.locating : step.description
299
- }),
300
- /*#__PURE__*/ jsxs("footer", {
301
- className: "ov-directory-tour__actions",
302
- children: [
303
- /*#__PURE__*/ jsx("span", {
304
- className: "ov-directory-tour__progress",
305
- "aria-live": "polite",
306
- children: text.progress(index + 1, steps.length)
307
- }),
308
- unavailable ? /*#__PURE__*/ jsxs(Fragment, {
309
- children: [
310
- /*#__PURE__*/ jsx("button", {
311
- type: "button",
312
- onClick: ()=>retry((value)=>value + 1),
313
- children: text.retry
314
- }),
315
- /*#__PURE__*/ jsx("button", {
316
- type: "button",
317
- onClick: ()=>advance(true),
318
- children: text.skip
319
- })
320
- ]
321
- }) : /*#__PURE__*/ jsx("button", {
322
- type: "button",
323
- className: "ov-directory-tour__primary",
324
- disabled: locating,
325
- onClick: ()=>advance(false),
326
- children: step.nextLabel ?? (index === steps.length - 1 ? text.done : text.next)
327
- })
328
- ]
329
- })
330
- ]
331
- })
32
+ children: loading ? /*#__PURE__*/ jsx("span", {
33
+ className: "ov-button__spinner"
34
+ }) : icon
35
+ }) : null,
36
+ children
332
37
  ]
333
- }), document.body);
334
- }
335
- export { DirectoryTour };
38
+ });
39
+ });
40
+ export { button_Button };