@openviking/react 0.0.0-stage → 0.1.1

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 (104) hide show
  1. package/README.md +82 -2
  2. package/dist/3~0.js +8 -0
  3. package/dist/a~0.js +21 -0
  4. package/dist/client/client.d.ts +12 -0
  5. package/dist/client/errors.d.ts +30 -0
  6. package/dist/client/index.d.ts +4 -0
  7. package/dist/client/options.d.ts +101 -0
  8. package/dist/client/provider.d.ts +52 -0
  9. package/dist/client/types.d.ts +160 -0
  10. package/dist/client.js +239 -0
  11. package/dist/components/agent-connect/agent-connect.d.ts +4 -0
  12. package/dist/components/agent-connect/index.d.ts +1 -0
  13. package/dist/components/agent-connect/style.css +16 -0
  14. package/dist/components/agent-connect/style.js +0 -0
  15. package/dist/components/agent-connect/types.d.ts +175 -0
  16. package/dist/components/agent-connect.js +1 -0
  17. package/dist/components/file-preview/file-preview-body.d.ts +15 -0
  18. package/dist/components/file-preview/file-preview-header.d.ts +16 -0
  19. package/dist/components/file-preview/file-preview-icons.d.ts +2 -0
  20. package/dist/components/file-preview/file-preview-labels.d.ts +5 -0
  21. package/dist/components/file-preview/file-preview-operations.d.ts +1 -0
  22. package/dist/components/file-preview/file-preview.d.ts +17 -0
  23. package/dist/components/file-preview/index.d.ts +1 -0
  24. package/dist/components/file-preview/style.css +285 -0
  25. package/dist/components/file-preview/style.js +0 -0
  26. package/dist/components/file-preview/types.d.ts +435 -0
  27. package/dist/components/file-preview/use-file-preview-editing.d.ts +13 -0
  28. package/dist/components/file-preview.js +442 -0
  29. package/dist/components/file-tree/file-tree-body.d.ts +14 -0
  30. package/dist/components/file-tree/file-tree-dom.d.ts +4 -0
  31. package/dist/components/file-tree/file-tree-entry-row.d.ts +6 -0
  32. package/dist/components/file-tree/file-tree-icons.d.ts +8 -0
  33. package/dist/components/file-tree/file-tree-keyboard.d.ts +10 -0
  34. package/dist/components/file-tree/file-tree-labels.d.ts +5 -0
  35. package/dist/components/file-tree/file-tree-row-context.d.ts +24 -0
  36. package/dist/components/file-tree/file-tree-rows.d.ts +12 -0
  37. package/dist/components/file-tree/file-tree-tooltip.d.ts +11 -0
  38. package/dist/components/file-tree/file-tree.d.ts +4 -0
  39. package/dist/components/file-tree/index.d.ts +1 -0
  40. package/dist/components/file-tree/style.css +244 -0
  41. package/dist/components/file-tree/style.js +0 -0
  42. package/dist/components/file-tree/types.d.ts +406 -0
  43. package/dist/components/file-tree/use-file-tree-actions.d.ts +10 -0
  44. package/dist/components/file-tree.js +1 -0
  45. package/dist/components/scope-switcher/index.d.ts +1 -0
  46. package/dist/components/scope-switcher/scope-keyboard.d.ts +2 -0
  47. package/dist/components/scope-switcher/scope-panel.d.ts +5 -0
  48. package/dist/components/scope-switcher/scope-selector.d.ts +2 -0
  49. package/dist/components/scope-switcher/scope-switcher.d.ts +6 -0
  50. package/dist/components/scope-switcher/style.css +248 -0
  51. package/dist/components/scope-switcher/style.js +0 -0
  52. package/dist/components/scope-switcher/types.d.ts +367 -0
  53. package/dist/components/scope-switcher.js +3 -0
  54. package/dist/components/style.css +811 -0
  55. package/dist/components/style.js +0 -0
  56. package/dist/components/tui/index.d.ts +1 -0
  57. package/dist/components/tui/style.css +16 -0
  58. package/dist/components/tui/style.js +0 -0
  59. package/dist/components/tui/tui.d.ts +3 -0
  60. package/dist/components/tui/types.d.ts +485 -0
  61. package/dist/components/tui.js +1 -0
  62. package/dist/f~0.js +284 -0
  63. package/dist/icons/index.d.ts +23 -0
  64. package/dist/icons.js +25 -0
  65. package/dist/index.d.ts +16 -0
  66. package/dist/index.js +8 -0
  67. package/dist/i~0.js +21 -0
  68. package/dist/lk~0.js +220 -0
  69. package/dist/l~0.js +44 -0
  70. package/dist/modules/console/console.d.ts +4 -0
  71. package/dist/modules/console/index.d.ts +1 -0
  72. package/dist/modules/console/style.css +29 -0
  73. package/dist/modules/console/style.js +0 -0
  74. package/dist/modules/console/types.d.ts +101 -0
  75. package/dist/modules/console.js +1 -0
  76. package/dist/modules/file-browser/file-browser-toolbar-button.d.ts +10 -0
  77. package/dist/modules/file-browser/file-browser.d.ts +6 -0
  78. package/dist/modules/file-browser/index.d.ts +1 -0
  79. package/dist/modules/file-browser/style.css +75 -0
  80. package/dist/modules/file-browser/style.js +0 -0
  81. package/dist/modules/file-browser/types.d.ts +101 -0
  82. package/dist/modules/file-browser.js +1 -0
  83. package/dist/modules/scope-cascade/controller.d.ts +6 -0
  84. package/dist/modules/scope-cascade/index.d.ts +3 -0
  85. package/dist/modules/scope-cascade/scope-cascade.d.ts +3 -0
  86. package/dist/modules/scope-cascade/style.css +250 -0
  87. package/dist/modules/scope-cascade/style.js +0 -0
  88. package/dist/modules/scope-cascade/types.d.ts +39 -0
  89. package/dist/modules/scope-cascade/use-scope-cascade.d.ts +5 -0
  90. package/dist/modules/scope-cascade.js +1 -0
  91. package/dist/modules/style.css +385 -0
  92. package/dist/modules/style.js +0 -0
  93. package/dist/modules/task-center/columns.d.ts +129 -0
  94. package/dist/modules/task-center/index.d.ts +1 -0
  95. package/dist/modules/task-center/style.css +29 -0
  96. package/dist/modules/task-center/style.js +0 -0
  97. package/dist/modules/task-center/task-center.d.ts +4 -0
  98. package/dist/modules/task-center/types.d.ts +168 -0
  99. package/dist/modules/task-center.js +1 -0
  100. package/dist/n~0.js +499 -0
  101. package/dist/style.css +1198 -0
  102. package/dist/style.js +0 -0
  103. package/dist/u~0.js +8 -0
  104. package/package.json +103 -4
package/dist/f~0.js ADDED
@@ -0,0 +1,284 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useId, useRef, useState } from "react";
3
+ const chevron_downinline_namespaceObject = "data:image/svg+xml;base64,PHN2ZyBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIiBvdmVyZmxvdz0idmlzaWJsZSIgc3R5bGU9ImRpc3BsYXk6IGJsb2NrOyIgd2lkdGg9IjE0IiBoZWlnaHQ9IjE0IiB2aWV3Qm94PSIwIDAgMTQgMTQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxnIGlkPSJpY29uLyYjMjI4OyYjMTg0OyYjMTM5OyYjMjMwOyYjMTM5OyYjMTM3OyYjMjMxOyYjMTc0OyYjMTczOyYjMjI5OyYjMTY0OyYjMTgwOyI+CjxwYXRoIGlkPSJWZWN0b3IgKFN0cm9rZSkiIGQ9Ik05LjYwNzM0IDUuMjMyMzRDOS43NzgxOSA1LjA2MTQ5IDEwLjA1NTEgNS4wNjE0OSAxMC4yMjYgNS4yMzIzNEMxMC4zOTY4IDUuNDAzMTkgMTAuMzk2OCA1LjY4MDE0IDEwLjIyNiA1Ljg1MDk5TDcuMzA5MzMgOC43Njc2NkM3LjEzODQ3IDguOTM4NTEgNi44NjE1MyA4LjkzODUxIDYuNjkwNjcgOC43Njc2NkwzLjc3NDAxIDUuODUwOTlDMy42MDMxNSA1LjY4MDE0IDMuNjAzMTUgNS40MDMxOSAzLjc3NDAxIDUuMjMyMzRDMy45NDQ4NiA1LjA2MTQ5IDQuMjIxODEgNS4wNjE0OSA0LjM5MjY2IDUuMjMyMzRMNyA3LjgzOTY4TDkuNjA3MzQgNS4yMzIzNFoiIGZpbGw9IiMzRjNGNTEiLz4KPC9nPgo8L3N2Zz4K";
4
+ function moveScopeFocus(event) {
5
+ if (![
6
+ 'ArrowDown',
7
+ 'ArrowUp',
8
+ 'Home',
9
+ 'End'
10
+ ].includes(event.key)) return;
11
+ const target = event.target;
12
+ const isSearch = target.matches('input.ov-scope-switcher__search');
13
+ if (event.defaultPrevented || !target.matches('[role="option"]') && !isSearch || isSearch && !event.key.startsWith('Arrow')) return;
14
+ const options = Array.from(event.currentTarget.querySelectorAll('[role="option"]:not([aria-disabled="true"])'));
15
+ if (!options.length) return;
16
+ event.preventDefault();
17
+ const current = options.indexOf(document.activeElement);
18
+ 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;
19
+ options[next]?.focus();
20
+ }
21
+ const checkinline_namespaceObject = "data:image/svg+xml;base64,PHN2ZyBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIiBvdmVyZmxvdz0idmlzaWJsZSIgc3R5bGU9ImRpc3BsYXk6IGJsb2NrOyIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiB2aWV3Qm94PSIwIDAgMTYgMTYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxnIGlkPSJjaGVjayI+CjxwYXRoIGlkPSJJY29uIiBkPSJNMTMuMzMzMyA0TDYgMTEuMzMzM0wyLjY2NjY3IDgiIHN0cm9rZS13aWR0aD0iMS4yIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZT0iIzUyNTJGRiIvPgo8L2c+Cjwvc3ZnPgo=";
22
+ function Highlight({ text, keyword }) {
23
+ const index = text.toLocaleLowerCase().indexOf(keyword.toLocaleLowerCase());
24
+ if (!keyword || index < 0) return /*#__PURE__*/ jsx(Fragment, {
25
+ children: text
26
+ });
27
+ return /*#__PURE__*/ jsxs(Fragment, {
28
+ children: [
29
+ text.slice(0, index),
30
+ /*#__PURE__*/ jsx("mark", {
31
+ children: text.slice(index, index + keyword.length)
32
+ }),
33
+ text.slice(index + keyword.length)
34
+ ]
35
+ });
36
+ }
37
+ function ScopePanel({ level, labels }) {
38
+ const focusPanel = useCallback((node)=>{
39
+ const target = node?.querySelector('input') ?? node?.querySelector('[role="option"][aria-selected="true"]:not([aria-disabled="true"])') ?? node?.querySelector('[role="option"]:not([aria-disabled="true"])');
40
+ (target ?? node)?.focus();
41
+ }, []);
42
+ const keyword = level.searchKeyword ?? '';
43
+ const searchVisible = level.onSearchKeywordChange && (keyword.length > 0 || Math.max(level.options.length, level.total ?? 0) > 10);
44
+ const search = searchVisible ? /*#__PURE__*/ jsx("input", {
45
+ type: "search",
46
+ className: "ov-scope-switcher__search",
47
+ value: keyword,
48
+ "aria-label": labels?.searchPlaceholder ?? 'Search',
49
+ placeholder: labels?.searchPlaceholder ?? 'Search',
50
+ onChange: (event)=>level.onSearchKeywordChange?.(event.currentTarget.value)
51
+ }) : null;
52
+ let list;
53
+ list = level.loading ? /*#__PURE__*/ jsx("div", {
54
+ className: "ov-scope-switcher__state",
55
+ role: "status",
56
+ children: labels?.loading ?? 'Loading…'
57
+ }) : level.error ? /*#__PURE__*/ jsx("div", {
58
+ className: "ov-scope-switcher__state",
59
+ role: "alert",
60
+ children: level.errorFallback ?? labels?.error ?? 'Unable to load options'
61
+ }) : level.options.length ? /*#__PURE__*/ jsx("div", {
62
+ className: "ov-scope-switcher__list",
63
+ role: "listbox",
64
+ "aria-label": level.ariaLabel ?? level.selectedLabel,
65
+ "aria-busy": level.busy,
66
+ onScroll: (event)=>{
67
+ const { scrollTop, scrollHeight, clientHeight } = event.currentTarget;
68
+ level.onScroll?.({
69
+ scrollTop,
70
+ scrollHeight,
71
+ clientHeight
72
+ });
73
+ },
74
+ children: level.options.map((option)=>{
75
+ const selected = option.id === level.selectedId;
76
+ const content = /*#__PURE__*/ jsxs(Fragment, {
77
+ children: [
78
+ option.icon && /*#__PURE__*/ jsx("span", {
79
+ className: "ov-scope-switcher__icon",
80
+ "aria-hidden": "true",
81
+ children: option.icon
82
+ }),
83
+ /*#__PURE__*/ jsxs("span", {
84
+ className: "ov-scope-switcher__option-text",
85
+ children: [
86
+ /*#__PURE__*/ jsx("span", {
87
+ children: /*#__PURE__*/ jsx(Highlight, {
88
+ text: option.label,
89
+ keyword: keyword
90
+ })
91
+ }),
92
+ option.description && /*#__PURE__*/ jsx("small", {
93
+ children: option.description
94
+ })
95
+ ]
96
+ }),
97
+ selected && /*#__PURE__*/ jsx("span", {
98
+ className: "ov-scope-switcher__check",
99
+ "aria-hidden": "true",
100
+ children: /*#__PURE__*/ jsx("img", {
101
+ src: checkinline_namespaceObject,
102
+ alt: "",
103
+ width: 16,
104
+ height: 16
105
+ })
106
+ })
107
+ ]
108
+ });
109
+ return /*#__PURE__*/ jsx("div", {
110
+ tabIndex: option.disabled || level.busy ? -1 : 0,
111
+ role: "option",
112
+ "aria-selected": selected,
113
+ className: "ov-scope-switcher__option",
114
+ title: option.label,
115
+ "aria-disabled": option.disabled || level.busy || void 0,
116
+ onClick: (event)=>{
117
+ const target = event.target;
118
+ if (option.disabled || level.busy || target.closest('button, a, input, select, textarea, [role="button"]')) return;
119
+ level.onSelect?.(option);
120
+ },
121
+ onKeyDown: (event)=>{
122
+ if (event.target !== event.currentTarget || option.disabled || level.busy) return;
123
+ if ('Enter' === event.key || ' ' === event.key) {
124
+ event.preventDefault();
125
+ level.onSelect?.(option);
126
+ }
127
+ },
128
+ children: level.renderOption ? level.renderOption(content, option) : content
129
+ }, option.id);
130
+ })
131
+ }, keyword) : /*#__PURE__*/ jsx("div", {
132
+ className: "ov-scope-switcher__state",
133
+ role: "status",
134
+ children: level.emptyFallback ?? (keyword ? labels?.noMatch ?? labels?.empty ?? 'No matches' : labels?.empty ?? 'No options')
135
+ });
136
+ return /*#__PURE__*/ jsx("div", {
137
+ role: "group",
138
+ tabIndex: -1,
139
+ ref: focusPanel,
140
+ onKeyDownCapture: moveScopeFocus,
141
+ children: level.renderPanel ? level.renderPanel({
142
+ search,
143
+ list
144
+ }) : /*#__PURE__*/ jsxs(Fragment, {
145
+ children: [
146
+ search,
147
+ list
148
+ ]
149
+ })
150
+ });
151
+ }
152
+ function ScopeSelector({ level, labels }) {
153
+ const [localVisible, setLocalVisible] = useState(false);
154
+ const root = useRef(null);
155
+ const trigger = useRef(null);
156
+ const restoreSelectionFocus = useRef(false);
157
+ const panelId = useId();
158
+ const open = 'selectable' === level.kind && (level.visible ?? localVisible) && !level.disabled;
159
+ const onVisibleChange = 'selectable' === level.kind ? level.onVisibleChange : void 0;
160
+ const changeVisible = useCallback((visible)=>{
161
+ setLocalVisible(visible);
162
+ onVisibleChange?.(visible);
163
+ }, [
164
+ onVisibleChange
165
+ ]);
166
+ useEffect(()=>{
167
+ if (!open) return;
168
+ const dismiss = (event)=>{
169
+ if (event.target instanceof Node && !root.current?.contains(event.target)) changeVisible(false);
170
+ };
171
+ const escape = (event)=>{
172
+ if ('Escape' === event.key) {
173
+ event.preventDefault();
174
+ changeVisible(false);
175
+ trigger.current?.focus();
176
+ }
177
+ };
178
+ document.addEventListener('pointerdown', dismiss);
179
+ document.addEventListener('keydown', escape);
180
+ return ()=>{
181
+ document.removeEventListener('pointerdown', dismiss);
182
+ document.removeEventListener('keydown', escape);
183
+ };
184
+ }, [
185
+ open,
186
+ changeVisible
187
+ ]);
188
+ useEffect(()=>{
189
+ if (open || !restoreSelectionFocus.current) return;
190
+ restoreSelectionFocus.current = false;
191
+ if (document.activeElement === document.body || root.current?.contains(document.activeElement)) trigger.current?.focus();
192
+ }, [
193
+ open
194
+ ]);
195
+ const content = /*#__PURE__*/ jsxs(Fragment, {
196
+ children: [
197
+ level.icon && /*#__PURE__*/ jsx("span", {
198
+ className: "ov-scope-switcher__icon",
199
+ "aria-hidden": "true",
200
+ children: level.icon
201
+ }),
202
+ /*#__PURE__*/ jsx("span", {
203
+ className: "ov-scope-switcher__label",
204
+ children: level.selectedLabel
205
+ }),
206
+ level.tag && /*#__PURE__*/ jsx("span", {
207
+ className: "ov-scope-switcher__tag",
208
+ children: level.tag
209
+ })
210
+ ]
211
+ });
212
+ return /*#__PURE__*/ jsxs("div", {
213
+ ref: root,
214
+ role: "group",
215
+ className: "ov-scope-switcher__level",
216
+ onBlur: (event)=>{
217
+ if (open && event.relatedTarget instanceof Node && !event.currentTarget.contains(event.relatedTarget)) changeVisible(false);
218
+ },
219
+ children: [
220
+ 'fixed' === level.kind ? /*#__PURE__*/ jsx("span", {
221
+ className: "ov-scope-switcher__trigger",
222
+ "aria-label": level.ariaLabel,
223
+ title: level.selectedLabel,
224
+ children: content
225
+ }) : /*#__PURE__*/ jsxs("button", {
226
+ ref: trigger,
227
+ type: "button",
228
+ className: "ov-scope-switcher__trigger",
229
+ "aria-label": level.ariaLabel,
230
+ title: level.selectedLabel,
231
+ disabled: level.disabled,
232
+ "aria-expanded": open,
233
+ "aria-haspopup": "dialog",
234
+ "aria-controls": open ? panelId : void 0,
235
+ onClick: ()=>changeVisible(!open),
236
+ onKeyDown: (event)=>{
237
+ if ('ArrowDown' === event.key || 'ArrowUp' === event.key) {
238
+ event.preventDefault();
239
+ if (open) root.current?.querySelector('[role="option"]:not([aria-disabled="true"])')?.focus();
240
+ else changeVisible(true);
241
+ }
242
+ },
243
+ children: [
244
+ content,
245
+ /*#__PURE__*/ jsx("span", {
246
+ className: "ov-scope-switcher__arrow",
247
+ "aria-hidden": "true",
248
+ children: /*#__PURE__*/ jsx("img", {
249
+ src: chevron_downinline_namespaceObject,
250
+ alt: "",
251
+ width: 14,
252
+ height: 14
253
+ })
254
+ })
255
+ ]
256
+ }),
257
+ open && 'selectable' === level.kind && /*#__PURE__*/ jsx("div", {
258
+ id: panelId,
259
+ className: "ov-scope-switcher__panel",
260
+ role: "dialog",
261
+ "aria-label": level.ariaLabel ?? level.selectedLabel,
262
+ children: /*#__PURE__*/ jsx(ScopePanel, {
263
+ level: {
264
+ ...level,
265
+ onSelect: (option)=>{
266
+ restoreSelectionFocus.current = true;
267
+ changeVisible(false);
268
+ level.onSelect?.(option);
269
+ }
270
+ },
271
+ labels: labels
272
+ })
273
+ })
274
+ ]
275
+ });
276
+ }
277
+ function ScopeSwitcher({ children, className = '', ...props }) {
278
+ return /*#__PURE__*/ jsx("div", {
279
+ ...props,
280
+ className: `ov-scope-switcher ${className}`,
281
+ children: children
282
+ });
283
+ }
284
+ export { ScopeSelector, ScopeSwitcher };
@@ -0,0 +1,23 @@
1
+ import type { ComponentPropsWithoutRef } from 'react';
2
+ type IconProps = Omit<ComponentPropsWithoutRef<'img'>, 'src' | 'srcSet'>;
3
+ export declare const AudioIcon: {
4
+ (props: IconProps): import("react").JSX.Element;
5
+ displayName: string;
6
+ };
7
+ export declare const PdfIcon: {
8
+ (props: IconProps): import("react").JSX.Element;
9
+ displayName: string;
10
+ };
11
+ export declare const PptIcon: {
12
+ (props: IconProps): import("react").JSX.Element;
13
+ displayName: string;
14
+ };
15
+ export declare const VideoIcon: {
16
+ (props: IconProps): import("react").JSX.Element;
17
+ displayName: string;
18
+ };
19
+ export declare const WordIcon: {
20
+ (props: IconProps): import("react").JSX.Element;
21
+ displayName: string;
22
+ };
23
+ export {};
package/dist/icons.js ADDED
@@ -0,0 +1,25 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ const audioinline_namespaceObject = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2IiBmaWxsPSJub25lIj4KICA8cmVjdCB4PSIzIiB5PSIyIiB3aWR0aD0iMTEiIGhlaWdodD0iMTIiIHJ4PSIyIiBmaWxsPSIjN2MzYWVkIi8+CiAgPGcgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjEuMSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj4KICAgIDxwYXRoIGQ9Ik03IDExVjdsNC0xdjRNNyAxMUg2bTUtMWgtMSIvPgogIDwvZz4KPC9zdmc+Cg==";
3
+ const pdfinline_namespaceObject = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2IiBmaWxsPSJub25lIj4KICA8cmVjdCB4PSIzIiB5PSIyIiB3aWR0aD0iMTEiIGhlaWdodD0iMTIiIHJ4PSIyIiBmaWxsPSIjYjkxYzFjIi8+CiAgPGcgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjEuMSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj4KICAgIDxwYXRoIGQ9Ik02IDExVjZoM3YzSDZtNCAyaDEiLz4KICA8L2c+Cjwvc3ZnPgo=";
4
+ const pptinline_namespaceObject = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2IiBmaWxsPSJub25lIj4KICA8cmVjdCB4PSIzIiB5PSIyIiB3aWR0aD0iMTEiIGhlaWdodD0iMTIiIHJ4PSIyIiBmaWxsPSIjYzI0MTBjIi8+CiAgPGcgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjEuMSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj4KICAgIDxwYXRoIGQ9Ik02IDdoNXY0SDZ6bTIuNSA0djEiLz4KICA8L2c+Cjwvc3ZnPgo=";
5
+ const videoinline_namespaceObject = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2IiBmaWxsPSJub25lIj4KICA8cmVjdCB4PSIzIiB5PSIyIiB3aWR0aD0iMTEiIGhlaWdodD0iMTIiIHJ4PSIyIiBmaWxsPSIjMDM2OWExIi8+CiAgPGcgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjEuMSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj4KICAgIDxwYXRoIGQ9Im03IDYgNCAyLjVMNyAxMXoiLz4KICA8L2c+Cjwvc3ZnPgo=";
6
+ const wordinline_namespaceObject = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2IiBmaWxsPSJub25lIj4KICA8cmVjdCB4PSIzIiB5PSIyIiB3aWR0aD0iMTEiIGhlaWdodD0iMTIiIHJ4PSIyIiBmaWxsPSIjMWQ0ZWQ4Ii8+CiAgPGcgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjEuMSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj4KICAgIDxwYXRoIGQ9Im01LjUgNyAxIDQgMi0zIDIgMyAxLTQiLz4KICA8L2c+Cjwvc3ZnPgo=";
7
+ function createIcon(src, name) {
8
+ function Icon(props) {
9
+ return /*#__PURE__*/ jsx("img", {
10
+ alt: "",
11
+ width: 16,
12
+ height: 16,
13
+ ...props,
14
+ src: src
15
+ });
16
+ }
17
+ Icon.displayName = name;
18
+ return Icon;
19
+ }
20
+ const AudioIcon = createIcon(audioinline_namespaceObject, 'AudioIcon');
21
+ const PdfIcon = createIcon(pdfinline_namespaceObject, 'PdfIcon');
22
+ const PptIcon = createIcon(pptinline_namespaceObject, 'PptIcon');
23
+ const VideoIcon = createIcon(videoinline_namespaceObject, 'VideoIcon');
24
+ const WordIcon = createIcon(wordinline_namespaceObject, 'WordIcon');
25
+ export { AudioIcon, PdfIcon, PptIcon, VideoIcon, WordIcon };
@@ -0,0 +1,16 @@
1
+ export { FileTree } from './components/file-tree/index.js';
2
+ export type { FileTreeProps } from './components/file-tree/index.js';
3
+ export { Tui } from './components/tui/index.js';
4
+ export type { TuiProps } from './components/tui/index.js';
5
+ export { ScopeSwitcher, ScopeSelector, } from './components/scope-switcher/index.js';
6
+ export type { ScopeSwitcherProps, ScopeSelectorProps, } from './components/scope-switcher/index.js';
7
+ export { AgentConnect } from './components/agent-connect/index.js';
8
+ export type { AgentConnectProps } from './components/agent-connect/index.js';
9
+ export { FileBrowser } from './modules/file-browser/index.js';
10
+ export type { FileBrowserProps } from './modules/file-browser/index.js';
11
+ export { Console } from './modules/console/index.js';
12
+ export type { ConsoleProps } from './modules/console/index.js';
13
+ export { TaskCenter } from './modules/task-center/index.js';
14
+ export type { TaskCenterProps } from './modules/task-center/index.js';
15
+ export { ScopeCascade } from './modules/scope-cascade/index.js';
16
+ export type { ScopeCascadeProps } from './modules/scope-cascade/index.js';
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export { AgentConnect } from "./u~0.js";
2
+ export { Console } from "./a~0.js";
3
+ export { FileBrowser } from "./l~0.js";
4
+ export { FileTree } from "./n~0.js";
5
+ export { ScopeCascade } from "./lk~0.js";
6
+ export { ScopeSelector, ScopeSwitcher } from "./f~0.js";
7
+ export { TaskCenter } from "./i~0.js";
8
+ export { Tui } from "./3~0.js";
package/dist/i~0.js ADDED
@@ -0,0 +1,21 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ function TaskCenter({ className, style, labels }) {
3
+ return /*#__PURE__*/ jsxs("div", {
4
+ className: [
5
+ 'ov-module-placeholder',
6
+ className
7
+ ].filter(Boolean).join(' '),
8
+ style: style,
9
+ children: [
10
+ /*#__PURE__*/ jsx("p", {
11
+ className: "ov-module-placeholder__title",
12
+ children: labels?.title ?? 'Task center'
13
+ }),
14
+ /*#__PURE__*/ jsx("p", {
15
+ className: "ov-module-placeholder__description",
16
+ children: labels?.description ?? 'Placeholder. Functionality is not available yet.'
17
+ })
18
+ ]
19
+ });
20
+ }
21
+ export { TaskCenter };
package/dist/lk~0.js ADDED
@@ -0,0 +1,220 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState, useSyncExternalStore } from "react";
3
+ import { ScopeSelector, ScopeSwitcher } from "./f~0.js";
4
+ const indices = [
5
+ 0,
6
+ 1,
7
+ 2
8
+ ];
9
+ const empty = (enabled, parentIds = [])=>({
10
+ options: [],
11
+ enabled,
12
+ loading: false,
13
+ error: null,
14
+ scopeKey: JSON.stringify(parentIds),
15
+ parentIds
16
+ });
17
+ function createScopeController() {
18
+ const snapshots = [
19
+ empty(true),
20
+ empty(false),
21
+ empty(false)
22
+ ];
23
+ const listeners = indices.map(()=>new Set());
24
+ const requests = [];
25
+ let api;
26
+ let active = false;
27
+ const notify = (index)=>listeners[index].forEach((listener)=>listener());
28
+ const update = (index, patch)=>{
29
+ snapshots[index] = {
30
+ ...snapshots[index],
31
+ ...patch
32
+ };
33
+ };
34
+ const abort = (index)=>{
35
+ requests[index]?.abort();
36
+ requests[index] = void 0;
37
+ };
38
+ const resetDescendants = (index)=>{
39
+ for(let next = index + 1; next < 3; next++){
40
+ abort(next);
41
+ const ancestors = snapshots.slice(0, next).map((item)=>item.selected?.id);
42
+ snapshots[next] = empty(ancestors.every((id)=>void 0 !== id), ancestors.filter((id)=>void 0 !== id));
43
+ }
44
+ };
45
+ const load = async (index)=>{
46
+ if (!active || !api || !snapshots[index].enabled) return;
47
+ abort(index);
48
+ const request = new AbortController();
49
+ requests[index] = request;
50
+ update(index, {
51
+ loading: true,
52
+ error: null
53
+ });
54
+ notify(index);
55
+ try {
56
+ const libraryId = snapshots[0].selected?.id;
57
+ const spaceId = snapshots[1].selected?.id;
58
+ const options = await (0 === index ? api.loadLibraries(request.signal) : 1 === index ? api.loadSpaces(libraryId, request.signal) : api.loadUsers(libraryId, spaceId, request.signal));
59
+ if (!active || request.signal.aborted || requests[index] !== request) return;
60
+ const previous = snapshots[index].selected;
61
+ const selected = options.find((option)=>option.id === previous?.id && !option.disabled);
62
+ update(index, {
63
+ options,
64
+ selected,
65
+ loading: false,
66
+ error: null
67
+ });
68
+ const revoked = void 0 !== previous && void 0 === selected;
69
+ if (revoked) resetDescendants(index);
70
+ notify(index);
71
+ if (revoked) for(let next = index + 1; next < 3; next++)notify(next);
72
+ } catch (error) {
73
+ if (!active || request.signal.aborted || requests[index] !== request) return;
74
+ update(index, {
75
+ loading: false,
76
+ error: error instanceof Error ? error : new Error(String(error))
77
+ });
78
+ notify(index);
79
+ }
80
+ };
81
+ const select = (index, candidate)=>{
82
+ const state = snapshots[index];
83
+ if (!active || !state.enabled || state.loading || state.error) return;
84
+ const option = state.options.find((item)=>item.id === candidate.id && !item.disabled);
85
+ if (!option || option.id === state.selected?.id) return;
86
+ update(index, {
87
+ selected: option
88
+ });
89
+ resetDescendants(index);
90
+ for(let next = index; next < 3; next++)notify(next);
91
+ if (index < 2) load(index + 1);
92
+ };
93
+ const channel = (index)=>({
94
+ getSnapshot: ()=>snapshots[index],
95
+ subscribe: (listener)=>{
96
+ listeners[index].add(listener);
97
+ return ()=>{
98
+ listeners[index].delete(listener);
99
+ };
100
+ },
101
+ select: (option)=>select(index, option),
102
+ refresh: ()=>{
103
+ load(index);
104
+ }
105
+ });
106
+ const controller = {
107
+ levels: [
108
+ channel(0),
109
+ channel(1),
110
+ channel(2)
111
+ ]
112
+ };
113
+ return {
114
+ controller,
115
+ start (nextApi) {
116
+ api = nextApi;
117
+ active = true;
118
+ indices.forEach((index)=>{
119
+ abort(index);
120
+ snapshots[index] = empty(0 === index);
121
+ });
122
+ indices.forEach(notify);
123
+ load(0);
124
+ return ()=>{
125
+ active = false;
126
+ indices.forEach(abort);
127
+ };
128
+ }
129
+ };
130
+ }
131
+ function useScopeCascade({ loadLibraries, loadSpaces, loadUsers }) {
132
+ const [instance] = useState(createScopeController);
133
+ useEffect(()=>instance.start({
134
+ loadLibraries,
135
+ loadSpaces,
136
+ loadUsers
137
+ }), [
138
+ instance,
139
+ loadLibraries,
140
+ loadSpaces,
141
+ loadUsers
142
+ ]);
143
+ return instance.controller;
144
+ }
145
+ function useScopeCascadeLevel(level) {
146
+ return useSyncExternalStore(level.subscribe, level.getSnapshot, level.getSnapshot);
147
+ }
148
+ function ConnectedLevel(props) {
149
+ const state = useScopeCascadeLevel(props.level);
150
+ return /*#__PURE__*/ jsx(LevelView, {
151
+ ...props,
152
+ state: state
153
+ }, state.scopeKey);
154
+ }
155
+ function LevelView({ level, state, name, labels, retryLabel }) {
156
+ const [keyword, setKeyword] = useState('');
157
+ return /*#__PURE__*/ jsx(ScopeSelector, {
158
+ labels: labels,
159
+ level: {
160
+ kind: 'selectable',
161
+ key: name,
162
+ ariaLabel: name,
163
+ selectedId: state.selected?.id ?? '',
164
+ selectedLabel: state.selected?.label ?? name,
165
+ icon: state.selected?.icon,
166
+ disabled: !state.enabled,
167
+ options: state.options.filter((option)=>option.label.toLocaleLowerCase().includes(keyword.toLocaleLowerCase())),
168
+ total: state.options.length,
169
+ loading: state.loading,
170
+ error: null !== state.error,
171
+ searchKeyword: keyword,
172
+ onSearchKeywordChange: setKeyword,
173
+ onSelect: (option)=>{
174
+ level.select(option);
175
+ setKeyword('');
176
+ },
177
+ errorFallback: /*#__PURE__*/ jsxs(Fragment, {
178
+ children: [
179
+ labels?.error ?? 'Unable to load options',
180
+ ' ',
181
+ /*#__PURE__*/ jsx("button", {
182
+ type: "button",
183
+ onClick: level.refresh,
184
+ children: retryLabel ?? 'Retry'
185
+ })
186
+ ]
187
+ })
188
+ }
189
+ });
190
+ }
191
+ function ScopeCascade({ controller, labels, levelNames = [
192
+ 'Library',
193
+ 'Space',
194
+ 'User'
195
+ ], retryLabel, ...props }) {
196
+ return /*#__PURE__*/ jsxs(ScopeSwitcher, {
197
+ ...props,
198
+ children: [
199
+ /*#__PURE__*/ jsx(ConnectedLevel, {
200
+ level: controller.levels[0],
201
+ name: levelNames[0],
202
+ labels: labels,
203
+ retryLabel: retryLabel
204
+ }),
205
+ /*#__PURE__*/ jsx(ConnectedLevel, {
206
+ level: controller.levels[1],
207
+ name: levelNames[1],
208
+ labels: labels,
209
+ retryLabel: retryLabel
210
+ }),
211
+ /*#__PURE__*/ jsx(ConnectedLevel, {
212
+ level: controller.levels[2],
213
+ name: levelNames[2],
214
+ labels: labels,
215
+ retryLabel: retryLabel
216
+ })
217
+ ]
218
+ });
219
+ }
220
+ export { ScopeCascade, useScopeCascade, useScopeCascadeLevel };
package/dist/l~0.js ADDED
@@ -0,0 +1,44 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ function FileBrowserToolbarButton({ icon, children, onClick, disabled, className, ...rest }) {
3
+ return /*#__PURE__*/ jsxs("button", {
4
+ ...rest,
5
+ type: "button",
6
+ disabled: disabled,
7
+ className: [
8
+ 'ov-file-browser__toolbar-button',
9
+ className
10
+ ].filter(Boolean).join(' '),
11
+ onClick: onClick,
12
+ children: [
13
+ /*#__PURE__*/ jsx("span", {
14
+ className: "ov-file-browser__toolbar-button-icon",
15
+ "aria-hidden": "true",
16
+ children: icon
17
+ }),
18
+ /*#__PURE__*/ jsx("span", {
19
+ className: "ov-file-browser__toolbar-button-label",
20
+ children: children
21
+ })
22
+ ]
23
+ });
24
+ }
25
+ function FileBrowser({ className, style, labels }) {
26
+ return /*#__PURE__*/ jsxs("div", {
27
+ className: [
28
+ 'ov-module-placeholder',
29
+ className
30
+ ].filter(Boolean).join(' '),
31
+ style: style,
32
+ children: [
33
+ /*#__PURE__*/ jsx("p", {
34
+ className: "ov-module-placeholder__title",
35
+ children: labels?.title ?? 'File browser'
36
+ }),
37
+ /*#__PURE__*/ jsx("p", {
38
+ className: "ov-module-placeholder__description",
39
+ children: labels?.description ?? 'Placeholder. Functionality is not available yet.'
40
+ })
41
+ ]
42
+ });
43
+ }
44
+ export { FileBrowser, FileBrowserToolbarButton };
@@ -0,0 +1,4 @@
1
+ import type { ConsoleProps } from './types.js';
2
+ export type { ConsoleLabels, ConsoleMode, ConsoleProps, ConsoleSlots, } from './types.js';
3
+ /** 占位组件:渲染一个带模块名的空容器,真实实现随模块 Hook 与组合视图迁入。 */
4
+ export declare function Console({ className, style, labels }: ConsoleProps): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './console.js';