@openviking/react 0.1.1 → 0.1.3
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 +18 -15
- package/dist/1~0.js +506 -0
- package/dist/2~0.js +122 -0
- package/dist/30~0.js +1332 -0
- package/dist/3~0.js +2113 -4
- package/dist/ark-message-list-view~0.js +310 -0
- package/dist/c7~0.js +24 -0
- package/dist/client/index.d.ts +2 -1
- package/dist/client/paths.d.ts +64 -0
- package/dist/client/response.d.ts +31 -0
- package/dist/client/sse.d.ts +39 -0
- package/dist/client/stream.d.ts +26 -0
- package/dist/client/types.d.ts +104 -0
- package/dist/client.js +1 -239
- package/dist/components/agent-connect/agent-connect-copy.d.ts +34 -0
- package/dist/components/agent-connect/agent-connect-design.d.ts +1781 -0
- package/dist/components/agent-connect/agent-connect-detail.d.ts +13 -0
- package/dist/components/agent-connect/agent-connect-installer.d.ts +3 -0
- package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +14 -0
- package/dist/components/agent-connect/agent-connect-instructions.d.ts +145 -0
- package/dist/components/agent-connect/agent-connect-markdown.d.ts +3 -0
- package/dist/components/agent-connect/agent-connect.d.ts +3 -3
- package/dist/components/agent-connect/content-en.d.ts +137 -0
- package/dist/components/agent-connect/content-zh.d.ts +137 -0
- package/dist/components/agent-connect/style.css +495 -6
- package/dist/components/agent-connect/types.d.ts +20 -166
- package/dist/components/file-browser-entries/file-browser-entries-icons.d.ts +18 -0
- package/dist/components/file-browser-entries/file-browser-entries.d.ts +14 -0
- package/dist/components/file-browser-entries/index.d.ts +1 -0
- package/dist/components/file-browser-entries/style.css +155 -0
- package/dist/components/file-browser-entries/types.d.ts +45 -0
- package/dist/components/file-browser-entries.js +1 -0
- package/dist/components/file-preview/file-preview-adapters.d.ts +33 -0
- package/dist/components/file-preview/file-preview-body.d.ts +24 -12
- package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +16 -0
- package/dist/components/file-preview/file-preview-breadcrumb.d.ts +21 -0
- package/dist/components/file-preview/file-preview-copy-path.d.ts +12 -0
- package/dist/components/file-preview/file-preview-directory.d.ts +32 -0
- package/dist/components/file-preview/file-preview-editor.d.ts +22 -0
- package/dist/components/file-preview/file-preview-handle-adapters.d.ts +26 -0
- package/dist/components/file-preview/file-preview-header.d.ts +41 -14
- package/dist/components/file-preview/file-preview-labels.d.ts +15 -4
- package/dist/components/file-preview/file-preview-lazy-viewer.d.ts +3 -0
- package/dist/components/file-preview/file-preview-panels.d.ts +41 -0
- package/dist/components/file-preview/file-preview-path.d.ts +30 -0
- package/dist/components/file-preview/file-preview-source.d.ts +24 -0
- package/dist/components/file-preview/file-preview-state.d.ts +35 -0
- package/dist/components/file-preview/file-preview-tab-row.d.ts +16 -0
- package/dist/components/file-preview/file-preview-viewer.d.ts +31 -0
- package/dist/components/file-preview/file-preview.d.ts +9 -11
- package/dist/components/file-preview/level-selection.d.ts +25 -0
- package/dist/components/file-preview/style.css +4055 -126
- package/dist/components/file-preview/types.d.ts +350 -170
- package/dist/components/file-preview/use-directory-level.d.ts +30 -0
- package/dist/components/file-preview/use-file-preview-actions-context.d.ts +27 -0
- package/dist/components/file-preview/use-file-preview-actions.d.ts +19 -0
- package/dist/components/file-preview/use-file-preview-editing.d.ts +21 -2
- package/dist/components/file-preview/use-file-preview-ids.d.ts +24 -0
- package/dist/components/file-preview.js +1 -442
- package/dist/components/file-tree/file-tree-body.d.ts +8 -4
- package/dist/components/file-tree/file-tree-entry-row.d.ts +9 -3
- package/dist/components/file-tree/file-tree-icons.d.ts +12 -5
- package/dist/components/file-tree/file-tree-info-labels.d.ts +21 -0
- package/dist/components/file-tree/file-tree-info-tooltip.d.ts +43 -0
- package/dist/components/file-tree/file-tree-info.d.ts +29 -0
- package/dist/components/file-tree/file-tree-keyboard.d.ts +8 -4
- package/dist/components/file-tree/file-tree-row-context.d.ts +29 -12
- package/dist/components/file-tree/file-tree-row-shared.d.ts +18 -0
- package/dist/components/file-tree/file-tree-spinner.d.ts +10 -0
- package/dist/components/file-tree/file-tree-state-row.d.ts +7 -0
- package/dist/components/file-tree/file-tree-tooltip-surface.d.ts +22 -0
- package/dist/components/file-tree/file-tree.d.ts +12 -1
- package/dist/components/file-tree/style.css +280 -75
- package/dist/components/file-tree/types.d.ts +203 -0
- package/dist/components/file-tree/use-file-tree-actions.d.ts +7 -0
- package/dist/components/file-tree.js +1 -1
- package/dist/components/scope-switcher/scope-panel.d.ts +9 -3
- package/dist/components/scope-switcher/scope-selector.d.ts +1 -1
- package/dist/components/scope-switcher/scope-switcher.d.ts +1 -1
- package/dist/components/scope-switcher/style.css +282 -76
- package/dist/components/scope-switcher/types.d.ts +230 -108
- package/dist/components/style.css +14128 -390
- package/dist/components/tui/command-catalog.d.ts +58 -0
- package/dist/components/tui/command-completion.d.ts +19 -0
- package/dist/components/tui/command-definitions.d.ts +10 -0
- package/dist/components/tui/command-input.d.ts +16 -0
- package/dist/components/tui/style.css +1543 -5
- package/dist/components/tui/tui-assist.d.ts +15 -0
- package/dist/components/tui/tui-code-block.d.ts +8 -0
- package/dist/components/tui/tui-command-help.d.ts +9 -0
- package/dist/components/tui/tui-command-text.d.ts +6 -0
- package/dist/components/tui/tui-composer.d.ts +24 -0
- package/dist/components/tui/tui-copy-button.d.ts +9 -0
- package/dist/components/tui/tui-input-mirror.d.ts +14 -0
- package/dist/components/tui/tui-labels-zh.d.ts +2 -0
- package/dist/components/tui/tui-labels.d.ts +5 -0
- package/dist/components/tui/tui-markdown-renderers.d.ts +10 -0
- package/dist/components/tui/tui-markdown.d.ts +6 -0
- package/dist/components/tui/tui-param-hint.d.ts +7 -0
- package/dist/components/tui/tui-record-time.d.ts +11 -0
- package/dist/components/tui/tui-record.d.ts +13 -0
- package/dist/components/tui/tui-resource-preview.d.ts +10 -0
- package/dist/components/tui/tui-resource-tree.d.ts +10 -0
- package/dist/components/tui/tui-result-header.d.ts +7 -0
- package/dist/components/tui/tui-result-text.d.ts +5 -0
- package/dist/components/tui/tui-search-list.d.ts +8 -0
- package/dist/components/tui/tui-skeleton.d.ts +6 -0
- package/dist/components/tui/tui-status-card.d.ts +7 -0
- package/dist/components/tui/tui-text.d.ts +10 -0
- package/dist/components/tui/tui-uri-text.d.ts +19 -0
- package/dist/components/tui/tui-write-result.d.ts +7 -0
- package/dist/components/tui/tui.d.ts +10 -2
- package/dist/components/tui/types.d.ts +57 -15
- package/dist/components/tui/use-tui-assist-position.d.ts +3 -0
- package/dist/components/tui/use-tui-completion.d.ts +14 -0
- package/dist/components/tui/use-tui-composer-keyboard.d.ts +25 -0
- package/dist/components/viking-bot/ark-adapter.d.ts +45 -0
- package/dist/components/viking-bot/ark-message-body.d.ts +16 -0
- package/dist/components/viking-bot/ark-message-list-view.d.ts +7 -0
- package/dist/components/viking-bot/ark-message-row.d.ts +19 -0
- package/dist/components/viking-bot/index.d.ts +10 -0
- package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +10 -0
- package/dist/components/viking-bot/interaction/index.d.ts +4 -0
- package/dist/components/viking-bot/interaction/labels.d.ts +7 -0
- package/dist/components/viking-bot/interaction/lazy-interaction.d.ts +3 -0
- package/dist/components/viking-bot/interaction/schedule-input.d.ts +13 -0
- package/dist/components/viking-bot/interaction/style.css +189 -0
- package/dist/components/viking-bot/interaction/style.js +0 -0
- package/dist/components/viking-bot/interaction/types.d.ts +188 -0
- package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +9 -0
- package/dist/components/viking-bot/interaction.js +2 -0
- package/dist/components/viking-bot/labels.d.ts +2 -0
- package/dist/components/viking-bot/lazy-composer.d.ts +3 -0
- package/dist/components/viking-bot/message-groups.d.ts +12 -0
- package/dist/components/viking-bot/model.d.ts +252 -0
- package/dist/components/viking-bot/render-part.d.ts +12 -0
- package/dist/components/viking-bot/style.css +7135 -0
- package/dist/components/viking-bot/style.js +0 -0
- package/dist/components/viking-bot/types.d.ts +140 -0
- package/dist/components/viking-bot/viking-bot-composer.d.ts +6 -0
- package/dist/components/viking-bot/viking-bot-message-list.d.ts +3 -0
- package/dist/components/viking-bot/viking-bot.d.ts +16 -0
- package/dist/components/viking-bot.js +4 -0
- package/dist/c~0.js +201 -0
- package/dist/file-preview-viewer~0.js +191 -0
- package/dist/f~0.js +149 -77
- package/dist/h~0.js +58 -0
- package/dist/icons/file-type-icon.d.ts +31 -0
- package/dist/icons/index.d.ts +33 -23
- package/dist/icons/nextjs-icon.d.ts +19 -0
- package/dist/icons.js +1 -25
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -1
- package/dist/k~0.js +1440 -0
- package/dist/lk~0.js +25 -12
- package/dist/l~0.js +1464 -25
- package/dist/modules/console/style.css +83 -1
- package/dist/modules/file-browser/file-browser-detail-icons.d.ts +10 -0
- package/dist/modules/file-browser/file-browser-detail.d.ts +33 -0
- package/dist/modules/file-browser/file-browser-empty.d.ts +3 -0
- package/dist/modules/file-browser/file-browser-failure.d.ts +22 -0
- package/dist/modules/file-browser/file-browser-icons.d.ts +18 -0
- package/dist/modules/file-browser/file-browser-labels.d.ts +28 -0
- package/dist/modules/file-browser/file-browser-layout.d.ts +27 -0
- package/dist/modules/file-browser/file-browser-toolbar.d.ts +18 -0
- package/dist/modules/file-browser/file-browser-tree-pane.d.ts +30 -0
- package/dist/modules/file-browser/file-browser.d.ts +14 -5
- package/dist/modules/file-browser/find-result.d.ts +24 -0
- package/dist/modules/file-browser/fs-directories.d.ts +33 -0
- package/dist/modules/file-browser/fs-file-kind.d.ts +19 -0
- package/dist/modules/file-browser/fs-icon.d.ts +17 -0
- package/dist/modules/file-browser/fs-model.d.ts +106 -0
- package/dist/modules/file-browser/fs-page.d.ts +16 -0
- package/dist/modules/file-browser/fs-path.d.ts +16 -0
- package/dist/modules/file-browser/fs-read-directory.d.ts +20 -0
- package/dist/modules/file-browser/fs-scope.d.ts +22 -0
- package/dist/modules/file-browser/fs-stat.d.ts +25 -0
- package/dist/modules/file-browser/index.d.ts +3 -1
- package/dist/modules/file-browser/style.css +5009 -34
- package/dist/modules/file-browser/tree-info-copy.d.ts +15 -0
- package/dist/modules/file-browser/tree-info-copy.zh-CN.d.ts +15 -0
- package/dist/modules/file-browser/types.d.ts +189 -44
- package/dist/modules/file-browser/use-container-width.d.ts +17 -0
- package/dist/modules/file-browser/use-file-browser.d.ts +49 -0
- package/dist/modules/file-browser/use-fs-preview.d.ts +51 -0
- package/dist/modules/file-browser/use-fs-search.d.ts +35 -0
- package/dist/modules/file-browser/use-fs-tree.d.ts +43 -0
- package/dist/modules/file-browser/use-request-scope.d.ts +39 -0
- package/dist/modules/file-browser.js +1 -1
- package/dist/modules/scope-cascade/style.css +282 -76
- package/dist/modules/style.css +5445 -130
- package/dist/n~0.js +568 -236
- package/dist/o~0.js +103 -0
- package/dist/shared/components/divider/divider.d.ts +18 -0
- package/dist/shared/components/divider/index.d.ts +1 -0
- package/dist/shared/components/divider/types.d.ts +35 -0
- package/dist/shared/components/overlay/types.d.ts +7 -0
- package/dist/shared/components/overlay/use-overlay-position.d.ts +38 -0
- package/dist/shared/components/popover/index.d.ts +1 -0
- package/dist/shared/components/popover/popover.d.ts +23 -0
- package/dist/shared/components/popover/types.d.ts +50 -0
- package/dist/shared/components/resizable/clamp.d.ts +13 -0
- package/dist/shared/components/resizable/index.d.ts +2 -0
- package/dist/shared/components/resizable/resizable-handle.d.ts +25 -0
- package/dist/shared/components/resizable/types.d.ts +48 -0
- package/dist/shared/components/tooltip/index.d.ts +1 -0
- package/dist/shared/components/tooltip/tooltip.d.ts +25 -0
- package/dist/shared/components/tooltip/types.d.ts +42 -0
- package/dist/style.css +19664 -530
- package/dist/u~0.js +1597 -4
- package/dist/viking-bot-composer~0.js +164 -0
- package/dist/viking-bot-interaction~0.js +284 -0
- package/dist/w~0.js +19 -0
- package/package.json +23 -10
- package/dist/components/file-preview/file-preview-icons.d.ts +0 -2
- package/dist/components/file-preview/file-preview-operations.d.ts +0 -1
- package/dist/components/file-tree/file-tree-dom.d.ts +0 -4
- package/dist/components/file-tree/file-tree-labels.d.ts +0 -5
- package/dist/components/file-tree/file-tree-rows.d.ts +0 -12
- package/dist/components/file-tree/file-tree-tooltip.d.ts +0 -11
- package/dist/i~0.js +0 -21
- package/dist/modules/file-browser/file-browser-toolbar-button.d.ts +0 -10
- package/dist/modules/task-center/columns.d.ts +0 -129
- package/dist/modules/task-center/index.d.ts +0 -1
- package/dist/modules/task-center/style.css +0 -29
- package/dist/modules/task-center/task-center.d.ts +0 -4
- package/dist/modules/task-center/types.d.ts +0 -168
- package/dist/modules/task-center.js +0 -1
- /package/dist/{modules/task-center → components/file-browser-entries}/style.js +0 -0
|
@@ -1,6 +1,88 @@
|
|
|
1
|
+
.ov-agent-connect, .ov-divider, .ov-file-browser, .ov-file-browser-entries, .ov-file-preview, .ov-file-tree, .ov-module-placeholder, .ov-popover, .ov-scope-switcher, .ov-tooltip, .ov-tui, .ov-viking-bot, .ov-viking-bot__interaction {
|
|
2
|
+
--ov-ui-primary-default: #5252ff;
|
|
3
|
+
--ov-ui-primary-hover-default: #7075ff;
|
|
4
|
+
--ov-ui-primary-active-default: #3833d2;
|
|
5
|
+
--ov-ui-primary-light-default: #f5f7ff;
|
|
6
|
+
--ov-ui-connect-glow-warm-default: #ff952b0a;
|
|
7
|
+
--ov-ui-connect-glow-pink-default: #fb4fbc0f;
|
|
8
|
+
--ov-ui-connect-glow-pink-soft-default: #fb4fbc0a;
|
|
9
|
+
--ov-ui-on-primary-default: #fff;
|
|
10
|
+
--ov-ui-text-1-default: #0b0b0f;
|
|
11
|
+
--ov-ui-text-2-default: #3f3f51;
|
|
12
|
+
--ov-ui-text-3-default: #6e718c;
|
|
13
|
+
--ov-ui-text-description-default: #0006;
|
|
14
|
+
--ov-ui-text-disabled-default: #a5a7bb;
|
|
15
|
+
--ov-ui-border-1-default: #f0f2fa;
|
|
16
|
+
--ov-ui-border-2-default: #e1e4f2;
|
|
17
|
+
--ov-ui-border-3-default: #d7daea;
|
|
18
|
+
--ov-ui-bg-1-default: #fff;
|
|
19
|
+
--ov-ui-bg-3-default: #f7f8fd;
|
|
20
|
+
--ov-ui-bg-4-default: #f6f7fa;
|
|
21
|
+
--ov-ui-bg-5-default: #f1f2f9;
|
|
22
|
+
--ov-ui-status-success-default: #1f9d55;
|
|
23
|
+
--ov-ui-shadow-default: #0f172a;
|
|
24
|
+
--ov-ui-focus-default: #5252ff;
|
|
25
|
+
--ov-ui-fill-hover-default: #f1f2f9;
|
|
26
|
+
--ov-ui-status-error-default: #c43838;
|
|
27
|
+
--ov-ui-warning-default: #b26a00;
|
|
28
|
+
--ov-ui-warning-light-default: #fff0b3;
|
|
29
|
+
--ov-ui-tooltip-bg-default: #1f2329;
|
|
30
|
+
--ov-ui-tooltip-text-default: #fff;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.dark .ov-agent-connect, .dark .ov-divider, .dark .ov-file-browser, .dark .ov-file-browser-entries, .dark .ov-file-preview, .dark .ov-file-tree, .dark .ov-module-placeholder, .dark .ov-popover, .dark .ov-scope-switcher, .dark .ov-tooltip, .dark .ov-tui, .dark .ov-viking-bot, .dark .ov-viking-bot__interaction {
|
|
34
|
+
--ov-ui-primary-default: #5f5fff;
|
|
35
|
+
--ov-ui-primary-hover-default: #7075ff;
|
|
36
|
+
--ov-ui-primary-active-default: #4242ba;
|
|
37
|
+
--ov-ui-primary-light-default: #1a1632;
|
|
38
|
+
--ov-ui-connect-glow-warm-default: #ff952b05;
|
|
39
|
+
--ov-ui-connect-glow-pink-default: #fb4fbc08;
|
|
40
|
+
--ov-ui-connect-glow-pink-soft-default: #fb4fbc05;
|
|
41
|
+
--ov-ui-text-1-default: #c7ccd6;
|
|
42
|
+
--ov-ui-text-2-default: #9da3af;
|
|
43
|
+
--ov-ui-text-3-default: #737a87;
|
|
44
|
+
--ov-ui-text-description-default: #fff6;
|
|
45
|
+
--ov-ui-text-disabled-default: #42464e;
|
|
46
|
+
--ov-ui-border-1-default: #23252a;
|
|
47
|
+
--ov-ui-border-2-default: #2e3138;
|
|
48
|
+
--ov-ui-border-3-default: #3a3d45;
|
|
49
|
+
--ov-ui-bg-1-default: #131416;
|
|
50
|
+
--ov-ui-bg-3-default: #1b1d21;
|
|
51
|
+
--ov-ui-bg-4-default: #202227;
|
|
52
|
+
--ov-ui-bg-5-default: #23252a;
|
|
53
|
+
--ov-ui-focus-default: #5f5fff;
|
|
54
|
+
--ov-ui-fill-hover-default: #23252a;
|
|
55
|
+
--ov-ui-status-error-default: #ff9595;
|
|
56
|
+
--ov-ui-warning-default: #e0a04a;
|
|
57
|
+
--ov-ui-warning-light-default: #3a2f14;
|
|
58
|
+
--ov-ui-tooltip-bg-default: #2a2d33;
|
|
59
|
+
--ov-ui-tooltip-text-default: #f0f1f3;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.ov-agent-connect {
|
|
63
|
+
--ov-ui-connect-card-default: #fbfbfc;
|
|
64
|
+
--ov-ui-connect-tabs-default: #f7f7f9;
|
|
65
|
+
--ov-ui-connect-selected-default: #f3f4f7;
|
|
66
|
+
--ov-ui-connect-border-default: #edeef2;
|
|
67
|
+
--ov-ui-connect-outline-default: #e1e3ea;
|
|
68
|
+
--ov-ui-connect-muted-default: #787c91;
|
|
69
|
+
--ov-ui-connect-notice-default: #2e2984;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.dark .ov-agent-connect {
|
|
73
|
+
--ov-ui-connect-card-default: var(--ov-ui-bg-3-default);
|
|
74
|
+
--ov-ui-connect-tabs-default: var(--ov-ui-bg-3-default);
|
|
75
|
+
--ov-ui-connect-selected-default: var(--ov-ui-bg-4-default);
|
|
76
|
+
--ov-ui-connect-border-default: var(--ov-ui-border-1-default);
|
|
77
|
+
--ov-ui-connect-outline-default: var(--ov-ui-border-2-default);
|
|
78
|
+
--ov-ui-connect-muted-default: var(--ov-ui-text-3-default);
|
|
79
|
+
--ov-ui-connect-notice-default: var(--ov-ui-text-2-default);
|
|
80
|
+
}
|
|
81
|
+
|
|
1
82
|
.ov-module-placeholder {
|
|
2
83
|
box-sizing: border-box;
|
|
3
|
-
border: 1px dashed
|
|
84
|
+
border: 1px dashed
|
|
85
|
+
var(--ov-ui-color-border-2, var(--ov-ui-border-2-default, currentColor));
|
|
4
86
|
border-radius: var(--ov-ui-radius, 6px);
|
|
5
87
|
min-width: 0;
|
|
6
88
|
min-height: 160px;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** 复制图标。Copy icon. */
|
|
2
|
+
export declare function CopyIcon({ size }: {
|
|
3
|
+
size?: number;
|
|
4
|
+
}): import("react").JSX.Element;
|
|
5
|
+
/** 历史图标。History icon. */
|
|
6
|
+
export declare function HistoryIcon(): import("react").JSX.Element;
|
|
7
|
+
/** 看板图标。Dashboard icon. */
|
|
8
|
+
export declare function DashboardIcon(): import("react").JSX.Element;
|
|
9
|
+
/** 下载图标。Download icon. */
|
|
10
|
+
export declare function DownloadIcon(): import("react").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type FilePreviewTab } from '../../components/file-preview/index.js';
|
|
2
|
+
import type { FileBrowserLabels } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* 详情区:页签行与正文。分段器(预览 / 源码)与右侧图标按钮由这里渲染,通过
|
|
5
|
+
* `slots.actions` 拿到预览的视图状态。
|
|
6
|
+
*
|
|
7
|
+
* 目录的摘要层级不在这里——它是 `directory` 页签内部的一层,由组件自己渲染。
|
|
8
|
+
*
|
|
9
|
+
* The detail pane: tab row and body. The segmented control (preview / source) and
|
|
10
|
+
* the icon buttons on the right are rendered here, reading the view state from the
|
|
11
|
+
* preview through `slots.actions`.
|
|
12
|
+
*
|
|
13
|
+
* A directory's summary levels are not here: they are a layer inside the
|
|
14
|
+
* `directory` tab, rendered by the component itself.
|
|
15
|
+
*/
|
|
16
|
+
export interface FileBrowserDetailProps {
|
|
17
|
+
tabs: readonly FilePreviewTab[];
|
|
18
|
+
activeKey: string | null;
|
|
19
|
+
locale?: 'en-US' | 'zh-CN';
|
|
20
|
+
labels?: FileBrowserLabels['preview'];
|
|
21
|
+
footer?: string;
|
|
22
|
+
/** 分段器与图标按钮的文案。Copy for the segmented control and icon buttons. */
|
|
23
|
+
viewLabels: {
|
|
24
|
+
preview: string;
|
|
25
|
+
source: string;
|
|
26
|
+
copyPath: string;
|
|
27
|
+
copyContent: string;
|
|
28
|
+
download: string;
|
|
29
|
+
viewSwitch: string;
|
|
30
|
+
};
|
|
31
|
+
onActiveKeyChange: (key: string) => void;
|
|
32
|
+
}
|
|
33
|
+
export declare function FileBrowserDetail({ tabs, activeKey, locale, labels, footer, viewLabels, onActiveKeyChange, }: FileBrowserDetailProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 请求失败时的占位:一句结论、一行原始原因、一个重试按钮。
|
|
3
|
+
*
|
|
4
|
+
* 结论用可替换文案,原因原样显示服务端或传输层给的消息——把「403 Forbidden」
|
|
5
|
+
* 换成「加载失败」会让人分不清是权限、网络还是数据确实不存在,而这三者的处置
|
|
6
|
+
* 完全不同。
|
|
7
|
+
*
|
|
8
|
+
* The placeholder shown when a request fails: a conclusion, the raw reason and a
|
|
9
|
+
* retry button.
|
|
10
|
+
*
|
|
11
|
+
* The conclusion is replaceable copy while the reason is shown as the server or the
|
|
12
|
+
* transport reported it — replacing "403 Forbidden" with "Failed to load" hides
|
|
13
|
+
* whether this is a permission problem, a network problem or genuinely missing
|
|
14
|
+
* data, and the three call for different actions.
|
|
15
|
+
*/
|
|
16
|
+
export interface FileBrowserFailureProps {
|
|
17
|
+
message: string;
|
|
18
|
+
detail?: string;
|
|
19
|
+
retryLabel: string;
|
|
20
|
+
onRetry: () => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function FileBrowserFailure({ message, detail, retryLabel, onRetry, }: FileBrowserFailureProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 工具栏图标:搜索与刷新。
|
|
3
|
+
*
|
|
4
|
+
* 路径取自控制台所用的图标集(Arco `IconSearch` / `IconRefresh`),不是手绘近似。
|
|
5
|
+
* 两者都是 48 网格、`stroke-width: 4`、`fill: none`、`stroke: currentColor`,按
|
|
6
|
+
* 同一比例缩放到 16px,描边粗细因此与原图标一致。
|
|
7
|
+
*
|
|
8
|
+
* Toolbar icons: search and refresh.
|
|
9
|
+
*
|
|
10
|
+
* The paths come from the icon set the console uses (Arco `IconSearch` /
|
|
11
|
+
* `IconRefresh`) rather than a hand-drawn approximation. Both are 48-grid,
|
|
12
|
+
* `stroke-width: 4`, `fill: none`, `stroke: currentColor`, scaled to 16px at the
|
|
13
|
+
* same ratio so the stroke weight matches the original.
|
|
14
|
+
*/
|
|
15
|
+
/** 搜索图标。Search icon. */
|
|
16
|
+
export declare function SearchIcon(): import("react").JSX.Element;
|
|
17
|
+
/** 刷新图标。Refresh icon. */
|
|
18
|
+
export declare function RefreshIcon(): import("react").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FilePreviewLabels } from '../../components/file-preview/index.js';
|
|
2
|
+
import type { FileTreeLabels } from '../../components/file-tree/index.js';
|
|
3
|
+
import type { FileBrowserLabels } from './types.js';
|
|
4
|
+
/** 模块外壳自己渲染的文案,其余透传给树与预览。 */
|
|
5
|
+
type ShellLabels = Omit<FileBrowserLabels, 'tree' | 'preview'>;
|
|
6
|
+
/**
|
|
7
|
+
* 模块外壳的内置文案。树与预览的默认值留在各自组件里,模块不重复一份。
|
|
8
|
+
* Built-in copy of the module shell. The tree and the preview keep their own
|
|
9
|
+
* defaults, so the module does not duplicate them.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DEFAULT_LABELS: Required<ShellLabels>;
|
|
12
|
+
/** 解析后的外壳文案,外加透传给两个组件的文案。 */
|
|
13
|
+
export interface ResolvedLabels extends Required<ShellLabels> {
|
|
14
|
+
tree: FileTreeLabels | undefined;
|
|
15
|
+
previewLabels: FileBrowserLabels['preview'];
|
|
16
|
+
}
|
|
17
|
+
/** 逐项合并默认文案;树与预览的文案原样透传,缺省由组件自己兜底。 */
|
|
18
|
+
export declare function resolveLabels(labels: FileBrowserLabels | undefined): ResolvedLabels;
|
|
19
|
+
/**
|
|
20
|
+
* 预览组件的文案:模块自己的那几项叠在宿主透传的之上。组件那份英文默认值只在
|
|
21
|
+
* 宿主完全不传时才会用到,模块不能让它在中文界面里漏出来。
|
|
22
|
+
*
|
|
23
|
+
* The preview component's copy: the module's own fields layered over what the host
|
|
24
|
+
* passed through. The component's English defaults only apply when a host passes
|
|
25
|
+
* nothing, and must not leak into a Chinese interface.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolvePreviewLabels(text: ResolvedLabels): FilePreviewLabels;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件浏览的栏宽约束。
|
|
3
|
+
*
|
|
4
|
+
* 树默认 352px(与设计稿一致);窄于 200px 就只剩图标可辨。上限除了 520px 的
|
|
5
|
+
* 绝对值,还要给右侧详情留出可读宽度——容器被宿主压窄时,树不能继续占着
|
|
6
|
+
* 520px 把详情挤没。
|
|
7
|
+
*
|
|
8
|
+
* Column-width limits of the file browser.
|
|
9
|
+
*
|
|
10
|
+
* The tree starts at 352px, matching the design; below 200px only icons stay
|
|
11
|
+
* legible. Above the 520px absolute cap the detail pane must still have room, so a
|
|
12
|
+
* container the host squeezed narrows the tree rather than letting it keep 520px
|
|
13
|
+
* and crush the detail.
|
|
14
|
+
*/
|
|
15
|
+
export declare const TREE_DEFAULT_WIDTH = 352;
|
|
16
|
+
export declare const TREE_MIN_WIDTH = 200;
|
|
17
|
+
/**
|
|
18
|
+
* 按容器宽度算出树的最大宽度。
|
|
19
|
+
*
|
|
20
|
+
* 容器宽度还没测出来(首帧)时用绝对值上限,避免把树压到最小。
|
|
21
|
+
*
|
|
22
|
+
* Resolves the tree's maximum width from the container width.
|
|
23
|
+
*
|
|
24
|
+
* Before the container is measured (the first frame) the absolute cap applies, so
|
|
25
|
+
* the tree is never squeezed to its minimum.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveTreeMaxWidth(containerWidth: number): number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 搜索行:搜索框与刷新按钮。两者都是模块自己的,宿主入口在上一行的
|
|
3
|
+
* `toolbarActions` 里。
|
|
4
|
+
*
|
|
5
|
+
* The search row: the search box and the refresh button. Both belong to the module;
|
|
6
|
+
* host entries live in `toolbarActions` on the row above.
|
|
7
|
+
*/
|
|
8
|
+
export interface FileBrowserToolbarProps {
|
|
9
|
+
searchId: string;
|
|
10
|
+
query: string;
|
|
11
|
+
refreshing: boolean;
|
|
12
|
+
canRefresh: boolean;
|
|
13
|
+
placeholder: string;
|
|
14
|
+
refreshLabel: string;
|
|
15
|
+
onQueryChange: (value: string) => void;
|
|
16
|
+
onRefresh: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function FileBrowserToolbar({ searchId, query, refreshing, canRefresh, placeholder, refreshLabel, onQueryChange, onRefresh, }: FileBrowserToolbarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { FileTreeLabels } from '../../components/file-tree/index.js';
|
|
3
|
+
import type { FileBrowserApi } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* 左栏:宿主入口条、搜索行与目录树。
|
|
6
|
+
*
|
|
7
|
+
* 宽度由外层的可拖拽分隔条决定,因此这里只铺满自己的盒子,不设宽度;树内容
|
|
8
|
+
* 比栏宽时横向滚动,而不是把名称截成省略号。
|
|
9
|
+
*
|
|
10
|
+
* The left column: the host's entries, the search row and the tree.
|
|
11
|
+
*
|
|
12
|
+
* The width comes from the draggable divider outside, so this only fills its own
|
|
13
|
+
* box. When the tree is wider than the column it scrolls sideways rather than
|
|
14
|
+
* truncating names into ellipses.
|
|
15
|
+
*/
|
|
16
|
+
export interface FileBrowserTreePaneProps {
|
|
17
|
+
toolbarActions?: ReactNode;
|
|
18
|
+
searchId: string;
|
|
19
|
+
browser: FileBrowserApi;
|
|
20
|
+
treeLabels: FileTreeLabels | undefined;
|
|
21
|
+
searchPlaceholder: string;
|
|
22
|
+
refreshLabel: string;
|
|
23
|
+
searchLoading: string;
|
|
24
|
+
searchEmpty: string;
|
|
25
|
+
/** 搜索失败时的结论文案。Conclusion shown when the search request fails. */
|
|
26
|
+
searchErrorLabel: string;
|
|
27
|
+
/** 失败态里的重试按钮。Retry button of the failure state. */
|
|
28
|
+
retryLabel: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function FileBrowserTreePane({ toolbarActions, searchId, browser, treeLabels, searchPlaceholder, refreshLabel, searchLoading, searchEmpty, searchErrorLabel, retryLabel, }: FileBrowserTreePaneProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import { FileBrowserToolbarButton } from './file-browser-toolbar-button.js';
|
|
2
1
|
import type { FileBrowserProps } from './types.js';
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export type { FileBrowserActions, FileBrowserApi, FileBrowserLabels, FileBrowserProps, } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* 文件浏览模块的组合视图,对齐控制台设计稿:左侧目录树(入口条、搜索行、树),
|
|
5
|
+
* 右侧详情区(面包屑、标题行、正文、底部元信息)。两栏之间有一条可拖拽的
|
|
6
|
+
* 分隔条,拖动改树宽;取数与联动都在 {@link useFileBrowser} 里,这里只组装
|
|
7
|
+
* 视图。
|
|
8
|
+
*
|
|
9
|
+
* The file browser module's composite view, matching the console design: the tree
|
|
10
|
+
* on the left (entry row, search row, tree) and the detail pane on the right
|
|
11
|
+
* (breadcrumb, header, body, footer). A draggable divider between them resizes the
|
|
12
|
+
* tree; loading and coordination live in {@link useFileBrowser}, and this only
|
|
13
|
+
* assembles the view.
|
|
14
|
+
*/
|
|
15
|
+
export declare function FileBrowser({ uri, defaultUri, rootUri, defaultExpandedUri, locale, toolbarActions, onUriChange, labels, requestOptions, className, style, ...rest }: FileBrowserProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FsEntry } from './fs-model.js';
|
|
2
|
+
/** 语义搜索返回的分组结果。Grouped results of a semantic search. */
|
|
3
|
+
export interface FindResult {
|
|
4
|
+
memories?: Array<{
|
|
5
|
+
uri?: string;
|
|
6
|
+
abstract?: string;
|
|
7
|
+
}>;
|
|
8
|
+
resources?: Array<{
|
|
9
|
+
uri?: string;
|
|
10
|
+
abstract?: string;
|
|
11
|
+
}>;
|
|
12
|
+
skills?: Array<{
|
|
13
|
+
uri?: string;
|
|
14
|
+
abstract?: string;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 把分组结果合并成一个按 URI 去重的列表。搜索视图只需要「跳到哪个资源」,类别
|
|
19
|
+
* 分组对使用者没有意义。
|
|
20
|
+
*
|
|
21
|
+
* Merges the grouped result into one list deduplicated by URI: the search view
|
|
22
|
+
* only needs "which resource to jump to", so the category split adds nothing.
|
|
23
|
+
*/
|
|
24
|
+
export declare function mergeFindResult(result: FindResult | null | undefined): FsEntry[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { DirState } from './fs-model.js';
|
|
2
|
+
/**
|
|
3
|
+
* 树已知的目录 URI 集合:根目录,加上每一层已加载条目里标记为目录的那些。
|
|
4
|
+
*
|
|
5
|
+
* 它与「当前可见的行」无关——根目录从不出现在展平列表里,祖先折叠后其后代也会
|
|
6
|
+
* 消失,但它们的类型不会因此改变。预览据此决定读 L0/L1 摘要还是读正文。
|
|
7
|
+
*
|
|
8
|
+
* The set of directory URIs the tree knows about: the root plus every loaded entry
|
|
9
|
+
* marked as a directory.
|
|
10
|
+
*
|
|
11
|
+
* It is independent of the rows currently visible — the root never appears in the
|
|
12
|
+
* flattened list, and a descendant disappears when its ancestor collapses, yet
|
|
13
|
+
* neither changes type. The preview decides between an L0/L1 summary and content
|
|
14
|
+
* from this set.
|
|
15
|
+
*/
|
|
16
|
+
export declare function knownDirectories(rootUri: string, dirs: Record<string, DirState>): ReadonlySet<string>;
|
|
17
|
+
/**
|
|
18
|
+
* 树里出现过的文件 URI。与 {@link knownDirectories} 一起构成「类型已知」的判定:
|
|
19
|
+
* 两者都不包含,说明这个 URI 还没被加载过,类型未知——此时不能假定它是文件。
|
|
20
|
+
*
|
|
21
|
+
* The file URIs the tree has seen. Together with {@link knownDirectories} this decides
|
|
22
|
+
* "type known": in neither means the URI was never loaded, so its type is unknown —
|
|
23
|
+
* and it must not be assumed to be a file.
|
|
24
|
+
*/
|
|
25
|
+
export declare function knownFiles(dirs: Record<string, DirState>): ReadonlySet<string>;
|
|
26
|
+
/**
|
|
27
|
+
* 「这个 URI 是树里见过的文件」的判定函数。引用跟着文件集合走,因此同一份加载
|
|
28
|
+
* 结果下它是稳定的,可以作为依赖。
|
|
29
|
+
*
|
|
30
|
+
* The predicate "this URI is a file the tree has seen". Its identity follows the file
|
|
31
|
+
* set, so it stays stable for one load result and can be used as a dependency.
|
|
32
|
+
*/
|
|
33
|
+
export declare function useKnownFile(dirs: Record<string, DirState>): (uri: string) => boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FilePreviewFileTab } from '../../components/file-preview/index.js';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* 该文件是否应按二进制读取。没有扩展名或扩展名未知时按文本处理——绝大多数
|
|
5
|
+
* 无扩展名的资源都是文本,例如 `Dockerfile`、`Makefile`。
|
|
6
|
+
*
|
|
7
|
+
* Whether the file should be read as binary. A file with no extension, or an
|
|
8
|
+
* unknown one, is treated as text — most extensionless resources are text, such as
|
|
9
|
+
* `Dockerfile` and `Makefile`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isBinaryFile(name: string): boolean;
|
|
12
|
+
/** 该文件名对应的 MIME 类型。The MIME type for this file name. */
|
|
13
|
+
export declare function mimeTypeOf(name: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* 一个二进制文件的预览页签。字节直接交给底座,按 `fileName` 的扩展名选 Adapter。
|
|
16
|
+
* A preview tab for a binary file. The bytes go to the base, which picks an adapter
|
|
17
|
+
* from the `fileName` extension.
|
|
18
|
+
*/
|
|
19
|
+
export declare function toBinaryTab(uri: string, name: string, file: Blob, icon?: ReactNode, openParent?: (uri: string) => Promise<void>): FilePreviewFileTab;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 文件行的类型图标。同一份图标集里每个键都登记了浅色与暗色两套色值,交给
|
|
4
|
+
* `color` 由 CSS 跟随宿主的 `.dark`,不在这里判断主题。
|
|
5
|
+
*
|
|
6
|
+
* 树行与预览页签共用它,两处的图标因此完全一致——页签不该另画一套。
|
|
7
|
+
*
|
|
8
|
+
* The type icon of a file row. Every key in the icon set registers a light and a
|
|
9
|
+
* dark colour; `color` lets CSS follow the host's `.dark` rather than deciding the
|
|
10
|
+
* scheme here.
|
|
11
|
+
*
|
|
12
|
+
* The tree row and the preview tab share it, so both show the same icon — a tab
|
|
13
|
+
* has no business drawing its own.
|
|
14
|
+
*/
|
|
15
|
+
export declare function fileTypeIcon(name: string): ReactNode;
|
|
16
|
+
/** 目录的图标,与树上的文件夹图标同源。The directory icon, the tree's folder icon. */
|
|
17
|
+
export declare function directoryIcon(): ReactNode;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { FilePreviewDirectoryTab, FilePreviewFileTab } from '../../components/file-preview/index.js';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { FileTreeEntryRow, FileTreeRow } from '../../components/file-tree/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* 目录接口返回的一行。`ls` 的 `output=agent` 不返回 `name`,名称从 URI 末段取。
|
|
6
|
+
* One row from the directory API. `ls` with `output=agent` returns no `name`, so
|
|
7
|
+
* the name comes from the last URI segment.
|
|
8
|
+
*/
|
|
9
|
+
export interface FsEntry {
|
|
10
|
+
uri: string;
|
|
11
|
+
isDir?: boolean;
|
|
12
|
+
size?: number;
|
|
13
|
+
modTime?: string;
|
|
14
|
+
abstract?: string;
|
|
15
|
+
}
|
|
16
|
+
/** 一个目录已加载的子节点与分页状态。 */
|
|
17
|
+
export interface DirState {
|
|
18
|
+
entries: FsEntry[];
|
|
19
|
+
hasMore: boolean;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
error: Error | null;
|
|
22
|
+
}
|
|
23
|
+
/** 语义搜索返回的分组结果。Grouped results of a semantic search. */
|
|
24
|
+
/** 空目录状态。An empty directory state. */
|
|
25
|
+
export declare const emptyDir: () => DirState;
|
|
26
|
+
/**
|
|
27
|
+
* 把新到的一页并入目录状态:`offset` 为 0 是首屏、直接替换,否则追加到已有
|
|
28
|
+
* 子节点之后。
|
|
29
|
+
*
|
|
30
|
+
* 追加而不是替换,是因为分页要保留前几页;替换会让「加载更多」把列表截成最后
|
|
31
|
+
* 一页。
|
|
32
|
+
*
|
|
33
|
+
* Merges an arriving page into a directory's state: `offset` 0 is the first page and
|
|
34
|
+
* replaces, anything else appends to the children already loaded.
|
|
35
|
+
*
|
|
36
|
+
* It appends rather than replaces because paging has to keep the earlier pages;
|
|
37
|
+
* replacing would truncate the list to its last page on "load more".
|
|
38
|
+
*/
|
|
39
|
+
export declare function mergePage(current: DirState | undefined, page: {
|
|
40
|
+
entries: FsEntry[];
|
|
41
|
+
hasMore: boolean;
|
|
42
|
+
}, offset: number): DirState;
|
|
43
|
+
/** 从 URI 取末段名称。最后一段为空时回退到整个 URI。 */
|
|
44
|
+
export declare function nameFromUri(uri: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* 把接口返回的一行映射成树行。目录未提供子节点信息,按「可以展开」处理。
|
|
47
|
+
*
|
|
48
|
+
* `index` 用于搜索结果:同一个 URI 可能出现在两个类别里,行 id 必须唯一,
|
|
49
|
+
* 否则选中与滚动定位会命中错的行。
|
|
50
|
+
*
|
|
51
|
+
* Maps one API entry onto a tree row. A directory carries no child information,
|
|
52
|
+
* so it is treated as expandable.
|
|
53
|
+
*
|
|
54
|
+
* `index` is for search results: one URI can appear in two categories, and row
|
|
55
|
+
* ids must be unique or selection and scroll targeting hit the wrong row.
|
|
56
|
+
*/
|
|
57
|
+
export declare function toEntryRow(entry: FsEntry, depth: number, expanded: boolean, index?: number, busy?: boolean): FileTreeEntryRow;
|
|
58
|
+
/**
|
|
59
|
+
* 一个文件的预览页签。行数达到上限时按截断处理——接口不返回总行数,只能由
|
|
60
|
+
* 「读满了」推断出「可能还有」。
|
|
61
|
+
*
|
|
62
|
+
* A preview tab for one file. Reaching the line cap is reported as truncation:
|
|
63
|
+
* the API returns no total, so "the cap was filled" is the only signal that more
|
|
64
|
+
* content may exist.
|
|
65
|
+
*/
|
|
66
|
+
export declare function toFileTab(entry: FsEntry, content: string, maxLines: number, icon?: ReactNode, openParent?: (uri: string) => Promise<void>): FilePreviewFileTab;
|
|
67
|
+
/**
|
|
68
|
+
* 目录的预览页签:两级摘要各自成一级,走 `directory` 页签,而不是文件页签。
|
|
69
|
+
*
|
|
70
|
+
* 文件页签只有正文,目录还要在标题行与正文之间多一层同级切换——这正是
|
|
71
|
+
* `directory` 这一类存在的理由。
|
|
72
|
+
*
|
|
73
|
+
* A preview tab for a directory: each summary level is one level of a `directory`
|
|
74
|
+
* tab rather than a file tab.
|
|
75
|
+
*
|
|
76
|
+
* A file tab is just a body; a directory also needs one more level of sibling
|
|
77
|
+
* switching between its header and body, which is exactly why the `directory` kind
|
|
78
|
+
* exists.
|
|
79
|
+
*/
|
|
80
|
+
export interface DirectorySummary {
|
|
81
|
+
/** L0 摘要正文。The L0 abstract body. */
|
|
82
|
+
abstract: string;
|
|
83
|
+
/** L1 总览正文。The L1 overview body. */
|
|
84
|
+
overview: string;
|
|
85
|
+
/**
|
|
86
|
+
* 该级摘要的请求失败原因。为 `undefined` 表示请求成功(正文可能是空串,即
|
|
87
|
+
* 「还没生成」);有值表示「取不到」,与「没生成」是两件事,必须让用户分得清。
|
|
88
|
+
*
|
|
89
|
+
* Why that level's request failed. `undefined` means the request succeeded (the body
|
|
90
|
+
* may be empty, meaning "not generated yet"); a value means "could not load", which
|
|
91
|
+
* is a different situation the user has to be able to tell apart.
|
|
92
|
+
*/
|
|
93
|
+
abstractError?: string;
|
|
94
|
+
overviewError?: string;
|
|
95
|
+
}
|
|
96
|
+
export declare function toDirectoryTab(uri: string, summary: DirectorySummary, labels: {
|
|
97
|
+
l0: string;
|
|
98
|
+
l1: string;
|
|
99
|
+
failure: string;
|
|
100
|
+
}, openParent?: (uri: string) => Promise<void>, icon?: ReactNode): FilePreviewDirectoryTab;
|
|
101
|
+
/** 把目录状态展开成按渲染顺序排列的行,只展开已打开的分支。 */
|
|
102
|
+
export declare function flattenTree(uri: string, depth: number, dirs: Record<string, DirState>, expanded: ReadonlySet<string>): FileTreeRow[];
|
|
103
|
+
/** 请求被取消时不需要写回状态。A cancelled request has no state to write. */
|
|
104
|
+
export declare function isAbort(error: unknown): boolean;
|
|
105
|
+
/** 把任意抛出物归一成 Error。Normalises a thrown value into an Error. */
|
|
106
|
+
export declare function toError(cause: unknown): Error;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { OvClient, OvRequestOptions } from '../../client/types.js';
|
|
2
|
+
import type { FsEntry } from './fs-model.js';
|
|
3
|
+
/** 一次取多少个子节点。One page of children. */
|
|
4
|
+
export declare const PAGE_SIZE = 200;
|
|
5
|
+
/**
|
|
6
|
+
* 读一页子节点。单独成文件是因为它是纯请求逻辑:没有状态、没有取消管理,调用方
|
|
7
|
+
* 传入 signal 即可;留在 Hook 里只会让那个文件超出行数上限。
|
|
8
|
+
*
|
|
9
|
+
* Reads one page of children. It lives in its own file because it is pure request
|
|
10
|
+
* logic with no state and no cancellation of its own — the caller supplies the
|
|
11
|
+
* signal — and keeping it in the Hook would only push that file past the line limit.
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadPage(client: OvClient, uri: string, offset: number, signal: AbortSignal, requestOptions?: OvRequestOptions): Promise<{
|
|
14
|
+
entries: FsEntry[];
|
|
15
|
+
hasMore: boolean;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 从根到目标路径之间的目录,按由浅到深排列;目标本身也包含在内——展开一个目录
|
|
3
|
+
* 才能看到它的子节点。路径不在根之下时返回空数组。
|
|
4
|
+
*
|
|
5
|
+
* 拼接时保留根自带的斜杠:`viking://` 去掉末尾斜杠会变成 `viking:`,拼出来就是
|
|
6
|
+
* `viking:/user` 这种不存在的路径。
|
|
7
|
+
*
|
|
8
|
+
* The directories from the root down to the target, shallowest first, including
|
|
9
|
+
* the target itself: a directory must be open for its children to show. Returns an
|
|
10
|
+
* empty array when the path is not under the root.
|
|
11
|
+
*
|
|
12
|
+
* The root keeps its own slashes when joined: stripping the trailing ones from
|
|
13
|
+
* `viking://` yields `viking:`, and joining that produces a path like
|
|
14
|
+
* `viking:/user` that does not exist.
|
|
15
|
+
*/
|
|
16
|
+
export declare function expandChain(rootUri: string, targetUri?: string): string[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { OvClient, OvRequestOptions } from '../../client/types.js';
|
|
2
|
+
import type { FilePreviewDirectoryTab } from '../../components/file-preview/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* 读目录的两级摘要,各自成一个页签:L0 是摘要,L1 是总览。
|
|
5
|
+
*
|
|
6
|
+
* 两个接口分别请求,一个失败不影响另一个;两个都为空时仍给出两个空页签,
|
|
7
|
+
* 让使用者知道目录存在但没有生成内容,而不是看到一片空白。
|
|
8
|
+
*
|
|
9
|
+
* Reads a directory's two summary levels, one tab each: L0 is the abstract and L1
|
|
10
|
+
* the overview.
|
|
11
|
+
*
|
|
12
|
+
* The two endpoints are requested separately so one failing does not hide the
|
|
13
|
+
* other; when both are empty the tabs still appear, so the user sees that the
|
|
14
|
+
* directory exists but has no generated content instead of blank space.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readDirectory(client: OvClient, uri: string, options: OvRequestOptions, labels: {
|
|
17
|
+
l0: string;
|
|
18
|
+
l1: string;
|
|
19
|
+
failure: string;
|
|
20
|
+
}, openParent?: (uri: string) => Promise<void>): Promise<FilePreviewDirectoryTab>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { OvClient, OvRequestOptions } from '../../client/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 一次请求的**有效作用域**:客户端实例加上逐请求覆盖的身份字段。
|
|
4
|
+
*
|
|
5
|
+
* 只按客户端实例判定是不够的——宿主可以在同一个 Provider 下把
|
|
6
|
+
* `requestOptions.accountId` 从 A 换成 B,客户端对象不变,但数据空间已经换了;
|
|
7
|
+
* 上一个账号在途的响应同样不能落到新账号的树上。
|
|
8
|
+
*
|
|
9
|
+
* The **effective scope** of one request: the client instance plus the per-request
|
|
10
|
+
* identity overrides.
|
|
11
|
+
*
|
|
12
|
+
* The client instance alone is not enough — a host can switch
|
|
13
|
+
* `requestOptions.accountId` from A to B under the same Provider, leaving the client
|
|
14
|
+
* object unchanged while the data space has changed; a response still in flight for
|
|
15
|
+
* the previous account must not land on the new account's tree either.
|
|
16
|
+
*/
|
|
17
|
+
export declare function scopeKeyOf(client: OvClient | null, options: OvRequestOptions | undefined, rootUri?: string): string;
|
|
18
|
+
/** 一次请求所属的作用域:键与它的控制器。One request's scope: its key and controller. */
|
|
19
|
+
export interface RequestScope {
|
|
20
|
+
key: string;
|
|
21
|
+
controller: AbortController;
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { OvClient, OvRequestOptions } from '../../client/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 问服务端一个 URI 是不是目录。
|
|
4
|
+
*
|
|
5
|
+
* 只在类型未知时调用:树只认识已加载的层,宿主直接传一个尚未展开过的目录 URI 时
|
|
6
|
+
* 它不在已知集合里,仅凭这一点按文件处理会让目录丢掉 L0/L1 摘要、改去读正文。
|
|
7
|
+
*
|
|
8
|
+
* 查不到(404、无权限)时按文件处理:调用方本来就要读这个资源,让那次读取去报
|
|
9
|
+
* 真正的失败比在这里拦下来更直接。
|
|
10
|
+
*
|
|
11
|
+
* Asks the server whether a URI is a directory.
|
|
12
|
+
*
|
|
13
|
+
* Only called when the type is unknown: the tree only knows the levels it has loaded,
|
|
14
|
+
* so a directory URI the host passes directly, before it was ever expanded, is absent
|
|
15
|
+
* from the known set — and treating that as a file would make the directory lose its
|
|
16
|
+
* L0/L1 summary and read content instead.
|
|
17
|
+
*
|
|
18
|
+
* A lookup failure (404, no permission) falls back to "file": the caller is about to
|
|
19
|
+
* read the resource anyway, and letting that read report the real failure is more
|
|
20
|
+
* direct than stopping here.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveIsDirectory(client: OvClient, uri: string, options: OvRequestOptions): Promise<boolean>;
|
|
23
|
+
/** 一个带 `AbortError` 名字的错误,交给既有的取消分支处理。 */
|
|
24
|
+
/** An error named `AbortError`, for the existing cancellation branch. */
|
|
25
|
+
export declare function abortError(): Error;
|