@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/client.js ADDED
@@ -0,0 +1,239 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext as external_react_useContext, useMemo } from "react";
3
+ class OvClientError extends Error {
4
+ code;
5
+ statusCode;
6
+ details;
7
+ requestId;
8
+ responseBody;
9
+ constructor(options){
10
+ super(options.message, void 0 === options.cause ? void 0 : {
11
+ cause: options.cause
12
+ });
13
+ this.name = 'OvClientError';
14
+ this.code = options.code;
15
+ this.statusCode = options.statusCode;
16
+ this.details = options.details;
17
+ this.requestId = options.requestId;
18
+ this.responseBody = options.responseBody;
19
+ }
20
+ }
21
+ function isOvClientError(value) {
22
+ return value instanceof OvClientError;
23
+ }
24
+ const IDENTITY_HEADERS = {
25
+ apiKey: 'X-API-Key',
26
+ accountId: 'X-OpenViking-Account',
27
+ userId: 'X-OpenViking-User',
28
+ resourceId: 'V-Resource-Id'
29
+ };
30
+ async function evaluate(value) {
31
+ if (void 0 === value) return;
32
+ return 'function' == typeof value ? await value() : value;
33
+ }
34
+ async function resolveIdentityLayer(options) {
35
+ const layer = {};
36
+ for (const field of Object.keys(IDENTITY_HEADERS)){
37
+ const value = await evaluate(options?.[field]);
38
+ if (void 0 !== value) layer[field] = value;
39
+ }
40
+ return layer;
41
+ }
42
+ function mergeIdentityLayers(far, near) {
43
+ return {
44
+ ...far,
45
+ ...near
46
+ };
47
+ }
48
+ function toHeaders(layer) {
49
+ const out = {};
50
+ for (const field of Object.keys(IDENTITY_HEADERS)){
51
+ const value = layer[field]?.trim();
52
+ if (value) out[IDENTITY_HEADERS[field].toLowerCase()] = value;
53
+ }
54
+ return out;
55
+ }
56
+ function resolveClientOptions(options, identity) {
57
+ return {
58
+ baseURL: options.baseURL ?? '',
59
+ credentials: options.credentials ?? 'same-origin',
60
+ headers: toHeaders(identity),
61
+ signal: options.signal
62
+ };
63
+ }
64
+ function resolveRequestOptions(local, parent, mergedLayer) {
65
+ const headers = {
66
+ ...parent.headers
67
+ };
68
+ for (const field of Object.keys(IDENTITY_HEADERS)){
69
+ const value = mergedLayer[field];
70
+ if (void 0 === value) continue;
71
+ const name = IDENTITY_HEADERS[field].toLowerCase();
72
+ if (value.trim()) headers[name] = value;
73
+ else delete headers[name];
74
+ }
75
+ return {
76
+ baseURL: local?.baseURL ?? parent.baseURL,
77
+ credentials: parent.credentials,
78
+ headers,
79
+ signal: local?.signal ?? parent.signal
80
+ };
81
+ }
82
+ function joinUrl(baseURL, path) {
83
+ const prefix = baseURL.replace(/\/+$/, '');
84
+ return `${prefix}${path.startsWith('/') ? path : `/${path}`}`;
85
+ }
86
+ function buildQuery(query) {
87
+ if (!query) return '';
88
+ const params = new URLSearchParams();
89
+ for (const [key, value] of Object.entries(query))if (null != value) {
90
+ if (Array.isArray(value)) {
91
+ for (const item of value)params.append(key, String(item));
92
+ continue;
93
+ }
94
+ params.set(key, String(value));
95
+ }
96
+ const text = params.toString();
97
+ return text ? `?${text}` : '';
98
+ }
99
+ function mergeProviderConfig(inherited, local) {
100
+ const declared = {};
101
+ if (void 0 !== local.apiKey) declared.apiKey = local.apiKey;
102
+ if (void 0 !== local.accountId) declared.accountId = local.accountId;
103
+ if (void 0 !== local.userId) declared.userId = local.userId;
104
+ if (void 0 !== local.resourceId) declared.resourceId = local.resourceId;
105
+ return {
106
+ baseURL: local.baseURL ?? inherited?.baseURL,
107
+ credentials: local.credentials ?? inherited?.credentials,
108
+ signal: local.signal ?? inherited?.signal,
109
+ fetch: local.fetch ?? inherited?.fetch,
110
+ identity: {
111
+ ...inherited?.identity,
112
+ ...declared
113
+ }
114
+ };
115
+ }
116
+ function isRecord(value) {
117
+ return 'object' == typeof value && null !== value && !Array.isArray(value);
118
+ }
119
+ function readEnvelope(value) {
120
+ return isRecord(value) ? value : {};
121
+ }
122
+ function isAbortError(error) {
123
+ return isRecord(error) && ('AbortError' === error.name || 'ABORT_ERR' === error.code);
124
+ }
125
+ function normalizeTransportError(error, signal) {
126
+ if (isAbortError(error) || signal?.aborted) throw error;
127
+ throw new OvClientError({
128
+ code: 'NETWORK_ERROR',
129
+ message: error instanceof Error ? error.message : 'Network request failed',
130
+ cause: error
131
+ });
132
+ }
133
+ function createOvClient(options = {}) {
134
+ const fetchImpl = options.fetch ?? globalThis.fetch;
135
+ if (!fetchImpl) throw new Error('createOvClient needs a fetch implementation. Pass `fetch` on platforms without a global one.');
136
+ const defaults = options;
137
+ const client = {
138
+ get baseURL () {
139
+ return defaults.baseURL ?? '';
140
+ },
141
+ async request (spec) {
142
+ const baseLayer = await resolveIdentityLayer(defaults);
143
+ const localLayer = await resolveIdentityLayer(spec.options);
144
+ const parent = resolveClientOptions(defaults, baseLayer);
145
+ const effective = resolveRequestOptions(spec.options, parent, mergeIdentityLayers(baseLayer, localLayer));
146
+ const url = joinUrl(effective.baseURL, spec.path) + buildQuery(spec.query);
147
+ const hasBody = void 0 !== spec.body;
148
+ const headers = hasBody ? {
149
+ 'content-type': 'application/json',
150
+ ...effective.headers
151
+ } : effective.headers;
152
+ let response;
153
+ try {
154
+ response = await fetchImpl(url, {
155
+ method: spec.method,
156
+ headers,
157
+ body: hasBody ? JSON.stringify(spec.body) : void 0,
158
+ credentials: effective.credentials,
159
+ signal: effective.signal
160
+ });
161
+ } catch (error) {
162
+ normalizeTransportError(error, effective.signal);
163
+ }
164
+ let raw;
165
+ try {
166
+ raw = await response.text();
167
+ } catch (error) {
168
+ normalizeTransportError(error, effective.signal);
169
+ }
170
+ let body;
171
+ if (raw.trim()) try {
172
+ body = JSON.parse(raw);
173
+ } catch {
174
+ body = raw;
175
+ }
176
+ const envelope = readEnvelope(body);
177
+ const requestId = response.headers.get('x-request-id') ?? void 0;
178
+ if (!response.ok) throw new OvClientError({
179
+ code: envelope.error?.code ?? `HTTP_${response.status}`,
180
+ message: envelope.error?.message ?? response.statusText,
181
+ statusCode: response.status,
182
+ details: envelope.error?.details,
183
+ requestId,
184
+ responseBody: body
185
+ });
186
+ if ('error' === envelope.status) throw new OvClientError({
187
+ code: envelope.error?.code ?? 'UNKNOWN',
188
+ message: envelope.error?.message ?? 'Request failed',
189
+ statusCode: response.status,
190
+ details: envelope.error?.details,
191
+ requestId,
192
+ responseBody: body
193
+ });
194
+ return 'result' in envelope ? envelope.result : body;
195
+ }
196
+ };
197
+ return client;
198
+ }
199
+ const OvClientContext = /*#__PURE__*/ createContext(null);
200
+ function OpenVikingProvider({ baseURL, apiKey, accountId, userId, resourceId, credentials, signal, fetch, children }) {
201
+ const parent = external_react_useContext(OvClientContext);
202
+ const value = useMemo(()=>{
203
+ const base = mergeProviderConfig(parent?.base, {
204
+ baseURL,
205
+ apiKey,
206
+ accountId,
207
+ userId,
208
+ resourceId,
209
+ credentials,
210
+ signal,
211
+ fetch
212
+ });
213
+ return {
214
+ base,
215
+ client: createOvClient({
216
+ ...base.identity,
217
+ baseURL: base.baseURL,
218
+ credentials: base.credentials,
219
+ signal: base.signal,
220
+ fetch: base.fetch
221
+ })
222
+ };
223
+ }, [
224
+ parent,
225
+ baseURL,
226
+ apiKey,
227
+ accountId,
228
+ userId,
229
+ resourceId,
230
+ credentials,
231
+ signal,
232
+ fetch
233
+ ]);
234
+ return /*#__PURE__*/ jsx(OvClientContext.Provider, {
235
+ value: value,
236
+ children: children
237
+ });
238
+ }
239
+ export { OpenVikingProvider, OvClientError, createOvClient, isOvClientError };
@@ -0,0 +1,4 @@
1
+ import type { AgentConnectProps } from './types.js';
2
+ export type { AgentConnectDetail, AgentConnectItem, AgentConnectLabels, AgentConnectProps, AgentConnectTab, } from './types.js';
3
+ /** 占位组件:仅渲染固定尺寸的空壳,真实实现按 props 契约重写。 */
4
+ export declare function AgentConnect(_props: AgentConnectProps): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './agent-connect.js';
@@ -0,0 +1,16 @@
1
+ .ov-agent-connect {
2
+ box-sizing: border-box;
3
+ border-radius: var(--ov-ui-radius, 6px);
4
+ background: var(--ov-ui-placeholder, #f3f4f7);
5
+ width: 960px;
6
+ height: 640px;
7
+ color: var(--ov-ui-text-muted, #8f959e);
8
+ justify-content: center;
9
+ align-items: center;
10
+ font-family: inherit;
11
+ font-size: 12px;
12
+ display: flex;
13
+ }
14
+
15
+
16
+
File without changes
@@ -0,0 +1,175 @@
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ /**
3
+ * 顶部的一个接入分组,例如「接入主流 Agent」「接入应用」「开发自己的 Agent」。
4
+ * 分组名称与数量由宿主决定,组件只按顺序渲染页签。
5
+ *
6
+ * One tab of the view, for example "Mainstream agents", "Apps" or "Build your
7
+ * own agent". The host decides how many groups exist and what they are called;
8
+ * the component renders them in order.
9
+ */
10
+ export interface AgentConnectTab {
11
+ /**
12
+ * 页签唯一标识。
13
+ * Unique tab key.
14
+ */
15
+ id: string;
16
+ /**
17
+ * 页签显示文本。
18
+ * Tab label.
19
+ */
20
+ label: string;
21
+ }
22
+ /**
23
+ * 左侧列表中的一个条目,例如某个 Agent 或某种接入方式。
24
+ *
25
+ * One entry in the left list, for example an agent or an access method.
26
+ */
27
+ export interface AgentConnectItem {
28
+ /**
29
+ * 条目唯一标识。
30
+ * Unique item key.
31
+ */
32
+ id: string;
33
+ /**
34
+ * 条目名称。
35
+ * Item name.
36
+ */
37
+ name: string;
38
+ /**
39
+ * 列表中的一句话说明。
40
+ * One-line summary shown in the list.
41
+ */
42
+ description?: string;
43
+ /**
44
+ * 条目图标,可以是图片或图标节点。
45
+ * Item icon, which can be an image or an icon node.
46
+ */
47
+ icon?: ReactNode;
48
+ }
49
+ /**
50
+ * 右侧详情的正文。正文由宿主提供,组件只负责排版与复制,不解析业务含义。
51
+ *
52
+ * The detail body. The host supplies it; the component only lays it out and
53
+ * copies it, without interpreting its meaning.
54
+ */
55
+ export interface AgentConnectDetail {
56
+ /**
57
+ * 详情标题,通常与选中条目同名。
58
+ * Detail title, usually the selected item's name.
59
+ */
60
+ title?: string;
61
+ /**
62
+ * 标题旁的图标。
63
+ * Icon shown next to the title.
64
+ */
65
+ icon?: ReactNode;
66
+ /**
67
+ * 标题下方的说明文字。
68
+ * Description under the title.
69
+ */
70
+ description?: string;
71
+ /**
72
+ * 标题下方的标签,例如「SDK」「境外」。
73
+ * Tags under the title, for example "SDK" or "Overseas".
74
+ */
75
+ tags?: readonly string[];
76
+ /**
77
+ * 正文内容,可以是 Markdown 渲染后的节点。
78
+ * Body content, which can be the rendered Markdown node.
79
+ */
80
+ content?: ReactNode;
81
+ /**
82
+ * 复制按钮要写入剪贴板的纯文本。组件负责写入并提示成功;不传时不渲染复制按钮。
83
+ * Plain text the copy control writes to the clipboard. The component performs
84
+ * the write and reports success; no copy control is rendered when omitted.
85
+ */
86
+ copyText?: string;
87
+ }
88
+ /**
89
+ * 可替换文案,组件内置英文默认值。
90
+ * Replaceable copy; the component ships English defaults.
91
+ */
92
+ export interface AgentConnectLabels {
93
+ /**
94
+ * 正文区域的标题,例如「完整指令」。
95
+ * Heading of the body area, for example "Complete instructions".
96
+ */
97
+ instructions?: string;
98
+ /**
99
+ * 复制按钮文案。
100
+ * Copy control label.
101
+ */
102
+ copy?: string;
103
+ /**
104
+ * 复制成功后的提示。
105
+ * Message shown after a successful copy.
106
+ */
107
+ copied?: string;
108
+ /**
109
+ * 没有条目时的提示。
110
+ * Message shown when there are no items.
111
+ */
112
+ empty?: string;
113
+ }
114
+ /**
115
+ * Agent 接入视图的公开接口。
116
+ *
117
+ * 组件只渲染页签、左侧列表与右侧详情,并上报切换与复制意图;目录数据、正文
118
+ * 内容、权限与跳转都由宿主提供。
119
+ *
120
+ * Public interface of the agent connection view.
121
+ *
122
+ * The component renders the tabs, the left list and the right detail, and
123
+ * reports switch and copy intent. Catalog data, body content, permissions and
124
+ * navigation all come from the host.
125
+ */
126
+ export interface AgentConnectProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onSelect' | 'onCopy'> {
127
+ /**
128
+ * 顶部页签。
129
+ * Tabs at the top.
130
+ */
131
+ tabs: readonly AgentConnectTab[];
132
+ /**
133
+ * 当前页签 id,由宿主持有。
134
+ * Active tab id, owned by the host.
135
+ */
136
+ activeTabId: string;
137
+ /**
138
+ * 当前页签下的条目,按宿主给定顺序渲染。
139
+ * Items of the active tab, rendered in the order the host gives.
140
+ */
141
+ items: readonly AgentConnectItem[];
142
+ /**
143
+ * 当前选中条目 id,由宿主持有。
144
+ * Selected item id, owned by the host.
145
+ */
146
+ selectedId?: string;
147
+ /**
148
+ * 当前选中条目的详情。不传时右侧不渲染正文。
149
+ * Detail of the selected item. No body is rendered when omitted.
150
+ */
151
+ detail?: AgentConnectDetail;
152
+ /**
153
+ * 切换页签时触发。
154
+ * Invoked when a tab is selected.
155
+ */
156
+ onTabChange?: (tabId: string) => void;
157
+ /**
158
+ * 选中一个条目时触发。
159
+ * Invoked when an item is selected.
160
+ */
161
+ onSelect?: (item: AgentConnectItem) => void;
162
+ /**
163
+ * 复制成功后触发,用于埋点或额外反馈。复制本身由组件完成,回调不承担写入。
164
+ * 不传时仍渲染复制按钮,只是不通知。
165
+ * Invoked after the body has been copied, for analytics or extra feedback.
166
+ * The component performs the write; this callback never does. The copy
167
+ * control still renders when omitted, it just reports nothing.
168
+ */
169
+ onCopy?: (text: string) => void;
170
+ /**
171
+ * 可替换文案,缺省为英文。
172
+ * Replaceable copy; English by default.
173
+ */
174
+ labels?: AgentConnectLabels;
175
+ }
@@ -0,0 +1 @@
1
+ export { AgentConnect } from "../u~0.js";
@@ -0,0 +1,15 @@
1
+ import type { FilePreviewContentTab, FilePreviewFileTab, FilePreviewLabels } from './types.js';
2
+ export interface FilePreviewBodyProps {
3
+ fileTab?: FilePreviewFileTab;
4
+ contentTab?: FilePreviewContentTab;
5
+ text: Required<FilePreviewLabels>;
6
+ editing: boolean;
7
+ loadingEdit: boolean;
8
+ editFailed: boolean;
9
+ saving: boolean;
10
+ saveFailed: boolean;
11
+ draft: string;
12
+ onDraftChange: (value: string) => void;
13
+ }
14
+ /** 内容区:内容页签原样渲染,文件页签按编辑态、取正文状态与文本降级依次分支。 */
15
+ export declare function FilePreviewBody({ fileTab, contentTab, text, editing, loadingEdit, editFailed, saving, saveFailed, draft, onDraftChange, }: FilePreviewBodyProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | Iterable<import("react").ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
@@ -0,0 +1,16 @@
1
+ import type { FilePreviewFileTab, FilePreviewLabels, FilePreviewTab } from './types.js';
2
+ export interface FilePreviewHeaderProps {
3
+ activeTab: FilePreviewTab;
4
+ fileTab?: FilePreviewFileTab;
5
+ text: Required<FilePreviewLabels>;
6
+ viewMode: 'preview' | 'source';
7
+ editing: boolean;
8
+ loadingEdit: boolean;
9
+ saving: boolean;
10
+ onViewModeChange: (mode: 'preview' | 'source') => void;
11
+ onEditStart: () => void;
12
+ onEditCancel: () => void;
13
+ onEditSave: () => void;
14
+ }
15
+ /** 内容区标题行:路径面包屑、复制、视图切换、编辑与页签级插槽。 */
16
+ export declare function FilePreviewHeader({ activeTab, fileTab, text, viewMode, editing, loadingEdit, saving, onViewModeChange, onEditStart, onEditCancel, onEditSave, }: FilePreviewHeaderProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export declare function FileIcon(): import("react").JSX.Element;
2
+ export declare function CopyIcon(): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { FilePreviewFileTab, FilePreviewLabels } from './types.js';
2
+ /** 组件内置文案,宿主可通过面板或页签级 `labels` 覆盖。 */
3
+ export declare const DEFAULT_LABELS: Required<FilePreviewLabels>;
4
+ /** 从文件页签的 `source` 里取出可复制的纯文本;拿不到时返回 `undefined`。 */
5
+ export declare function readCopyableText(tab: FilePreviewFileTab): string | undefined;
@@ -0,0 +1 @@
1
+ export declare function performPreviewOperation(execute: (() => Promise<void>) | undefined, notify: (() => void) | undefined): Promise<void>;
@@ -0,0 +1,17 @@
1
+ import type { FilePreviewComponent } from './types.js';
2
+ export type { FilePreviewComponent, FilePreviewContentTab, FilePreviewEditing, FilePreviewFileTab, FilePreviewFileTabSlots, FilePreviewHandle, FilePreviewHeaderSlots, FilePreviewLabels, FilePreviewOperations, FilePreviewProps, FilePreviewSource, FilePreviewTab, FilePreviewTabBase, } from './types.js';
3
+ /**
4
+ * 文件预览的占位实现。
5
+ *
6
+ * 外壳(页签行、内容区标题行、页签切换与 ref 句柄)按最终形态实现,可直接
7
+ * 交互;文件正文尚未接入 FileViewer,文件页签先以纯文本降级展示,内容页签
8
+ * 按宿主给的节点渲染。
9
+ *
10
+ * Placeholder implementation of the file preview.
11
+ *
12
+ * The shell — tab row, content header row, tab switching and the ref handle — is
13
+ * implemented as it will ship and is fully interactive. The file body is not
14
+ * wired to FileViewer yet: a file tab falls back to plain text, while a content
15
+ * tab renders the node the host supplies.
16
+ */
17
+ export declare const FilePreview: FilePreviewComponent;
@@ -0,0 +1 @@
1
+ export * from './file-preview.js';