@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
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 入口条的两个图标。
|
|
3
|
+
*
|
|
4
|
+
* 路径取自控制台 `assets/context-console/` 下的 `connect-agent.svg` 与
|
|
5
|
+
* `upload.svg`,只把 `vector-effect="non-scaling-stroke"` 去掉——本包的图标按
|
|
6
|
+
* viewBox 原尺寸渲染,不需要它。描边宽度 1.4 与圆头圆角保持原值。
|
|
7
|
+
*
|
|
8
|
+
* The two icons of the entry row.
|
|
9
|
+
*
|
|
10
|
+
* The paths come from `connect-agent.svg` and `upload.svg` under the console's
|
|
11
|
+
* `assets/context-console/`; only `vector-effect="non-scaling-stroke"` is dropped,
|
|
12
|
+
* because this package renders icons at their viewBox size and does not need it.
|
|
13
|
+
* The 1.4 stroke width and the round caps and joins are kept as-is.
|
|
14
|
+
*/
|
|
15
|
+
/** 连接 Agent 图标,14 × 14 的插头。Connect-agent icon: a 14 × 14 plug. */
|
|
16
|
+
export declare function ConnectAgentIcon(): import("react").JSX.Element;
|
|
17
|
+
/** 导入资源图标,12 × 12 的方框向上箭头。Import-resources icon: a 12 × 12 box with an up arrow. */
|
|
18
|
+
export declare function ImportResourcesIcon(): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FileBrowserEntriesProps } from './types.js';
|
|
2
|
+
export type { FileBrowserEntriesLabels, FileBrowserEntriesProps, } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* 文件浏览入口条:连接 Agent 与导入资源。
|
|
5
|
+
*
|
|
6
|
+
* 两项都省略回调时不渲染任何东西,入口条因此整块消失——宿主既没接连接也没接
|
|
7
|
+
* 导入时,留一条空白底色只会让人以为还有内容没加载出来。
|
|
8
|
+
*
|
|
9
|
+
* The file browser entry row: connect an agent, import resources.
|
|
10
|
+
*
|
|
11
|
+
* With both callbacks omitted nothing renders and the row disappears entirely —
|
|
12
|
+
* leaving an empty tinted strip would suggest something failed to load.
|
|
13
|
+
*/
|
|
14
|
+
export declare function FileBrowserEntries({ onConnectAgent, onImportResources, labels, className, ...rest }: FileBrowserEntriesProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './file-browser-entries.js';
|
|
@@ -0,0 +1,155 @@
|
|
|
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
|
+
|
|
82
|
+
.ov-divider {
|
|
83
|
+
box-sizing: border-box;
|
|
84
|
+
display: block;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ov-file-browser-entries {
|
|
88
|
+
--ov-file-browser-entries-height: 32px;
|
|
89
|
+
box-sizing: border-box;
|
|
90
|
+
height: var(--ov-file-browser-entries-height);
|
|
91
|
+
background: color-mix(in srgb,
|
|
92
|
+
var(--ov-ui-color-primary, var(--ov-ui-primary-default, #5252ff)) 6%,
|
|
93
|
+
var(--ov-ui-color-bg-1, var(--ov-ui-bg-1-default, #fff)));
|
|
94
|
+
border-radius: 8px;
|
|
95
|
+
justify-content: center;
|
|
96
|
+
align-items: center;
|
|
97
|
+
gap: 6px;
|
|
98
|
+
display: flex;
|
|
99
|
+
overflow: hidden;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ov-file-browser-entries__entry {
|
|
103
|
+
min-width: 1px;
|
|
104
|
+
height: var(--ov-file-browser-entries-height);
|
|
105
|
+
color: var(--ov-ui-color-primary, var(--ov-ui-primary-default, #5252ff));
|
|
106
|
+
font: inherit;
|
|
107
|
+
letter-spacing: .039px;
|
|
108
|
+
white-space: nowrap;
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
background: none;
|
|
111
|
+
border: 0;
|
|
112
|
+
border-radius: 6px;
|
|
113
|
+
flex: 1 0 0;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
align-items: center;
|
|
116
|
+
gap: 6px;
|
|
117
|
+
padding: 0;
|
|
118
|
+
font-size: 13px;
|
|
119
|
+
font-weight: 500;
|
|
120
|
+
line-height: 22px;
|
|
121
|
+
transition: background-color .16s;
|
|
122
|
+
display: inline-flex;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.ov-file-browser-entries__entry:hover:not(:disabled) {
|
|
127
|
+
background: color-mix(in srgb,
|
|
128
|
+
var(--ov-ui-color-primary, var(--ov-ui-primary-default, #5252ff)) 10%,
|
|
129
|
+
transparent);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ov-file-browser-entries__entry:focus-visible {
|
|
133
|
+
outline: 2px solid
|
|
134
|
+
var(--ov-ui-color-focus, var(--ov-ui-focus-default, #5252ff));
|
|
135
|
+
outline-offset: -2px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.ov-file-browser-entries__entry:disabled {
|
|
139
|
+
color: var(--ov-ui-color-text-disabled, var(--ov-ui-text-disabled-default, #a5a7bb));
|
|
140
|
+
cursor: not-allowed;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.ov-file-browser-entries__icon {
|
|
144
|
+
flex: none;
|
|
145
|
+
align-items: center;
|
|
146
|
+
display: inline-flex;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.ov-file-browser-entries__label {
|
|
150
|
+
text-overflow: ellipsis;
|
|
151
|
+
overflow: hidden;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 文件浏览入口条的文案。两项的文案都可替换,缺省为英文。
|
|
4
|
+
* Copy of the file browser entry row. Both labels are replaceable, English by
|
|
5
|
+
* default.
|
|
6
|
+
*/
|
|
7
|
+
export interface FileBrowserEntriesLabels {
|
|
8
|
+
/** 连接 Agent 的文案。Label of the connect-agent entry. */
|
|
9
|
+
connectAgent?: string;
|
|
10
|
+
/** 导入资源的文案。Label of the import-resources entry. */
|
|
11
|
+
importResources?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 文件浏览入口条的属性。
|
|
15
|
+
*
|
|
16
|
+
* 它固定是两个入口:连接 Agent 与导入资源。宿主只决定显示哪几个、点击后做
|
|
17
|
+
* 什么,图标、文案、等分排布与两者之间的分隔线都由组件负责——这两项在每个
|
|
18
|
+
* 宿主下外观都相同,差别只在点击行为。
|
|
19
|
+
*
|
|
20
|
+
* 只显示一个入口时不画分隔线:线分隔的是两个相邻项,只剩一个就无从分隔。
|
|
21
|
+
*
|
|
22
|
+
* Props of the file browser entry row.
|
|
23
|
+
*
|
|
24
|
+
* It is fixed to two entries: connect an agent, import resources. The host only
|
|
25
|
+
* decides which appear and what a click does; the icons, copy, equal-width layout
|
|
26
|
+
* and the divider between them belong to the component, because both look the same
|
|
27
|
+
* under every host and differ only in behaviour.
|
|
28
|
+
*
|
|
29
|
+
* With a single entry no divider is drawn: a divider separates two neighbours, and
|
|
30
|
+
* there is nothing left to separate.
|
|
31
|
+
*/
|
|
32
|
+
export interface FileBrowserEntriesProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
33
|
+
/**
|
|
34
|
+
* 连接 Agent 成功后触发。省略时不显示该入口。
|
|
35
|
+
* Called after the connect-agent entry is clicked. Omit it to hide that entry.
|
|
36
|
+
*/
|
|
37
|
+
onConnectAgent?: () => void;
|
|
38
|
+
/**
|
|
39
|
+
* 导入资源成功后触发。省略时不显示该入口。
|
|
40
|
+
* Called after the import-resources entry is clicked. Omit it to hide that entry.
|
|
41
|
+
*/
|
|
42
|
+
onImportResources?: () => void;
|
|
43
|
+
/** 可替换文案,缺省为英文。Replaceable copy; English by default. */
|
|
44
|
+
labels?: FileBrowserEntriesLabels;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FileBrowserEntries } from "../2~0.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { MarkdownAdapterOptions } from '@ark-design/ui/file-viewer/adapters/markdown';
|
|
2
|
+
import type { FileViewerCoreProps } from '@ark-design/ui/file-viewer/core';
|
|
3
|
+
/**
|
|
4
|
+
* 组件内置的格式集合:文本、文档、图片与音视频。
|
|
5
|
+
*
|
|
6
|
+
* 图片是内容式 Adapter,音视频是引用式 Adapter;底座会按 Adapter 声明的读取
|
|
7
|
+
* 方式自动转换 `source`,宿主只需给出内容、文件或链接,不用区分。
|
|
8
|
+
*
|
|
9
|
+
* CAD 与 3D 需要额外的引擎与伴随资源,不放进公共组件。
|
|
10
|
+
*
|
|
11
|
+
* 本模块会静态引入底座,因此只能被懒加载的正文模块引用,不能进入包的顶层
|
|
12
|
+
* 导入链——底座会静态引入浏览器专用组件,顶层导入会破坏服务端渲染。
|
|
13
|
+
*
|
|
14
|
+
* The formats the component ships: text, documents, images and media. The image
|
|
15
|
+
* adapter reads content while the media adapter reads a reference; the base
|
|
16
|
+
* converts `source` according to the adapter's declared mode, so the host only
|
|
17
|
+
* supplies content, a file or a URL. CAD and 3D need extra engines and companion
|
|
18
|
+
* resources, so they stay out of the shared component. This module statically
|
|
19
|
+
* imports the base, so only the lazily loaded body may reference it: the base
|
|
20
|
+
* pulls in browser-only packages, and a top-level import would break server
|
|
21
|
+
* rendering.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createFilePreviewAdapterList({ onLinkClick, }?: {
|
|
24
|
+
/**
|
|
25
|
+
* Markdown 正文里的链接被点击时调用。传入后由回调接管导航,底座不再自行
|
|
26
|
+
* 跳转;只有 Markdown Adapter 支持这个回调,其余格式忽略它。
|
|
27
|
+
*
|
|
28
|
+
* Called when a link inside a Markdown body is clicked. Supplying it hands
|
|
29
|
+
* navigation to the callback and the base no longer jumps on its own. Only the
|
|
30
|
+
* Markdown adapter supports this; other formats ignore it.
|
|
31
|
+
*/
|
|
32
|
+
onLinkClick?: MarkdownAdapterOptions['onLinkClick'];
|
|
33
|
+
}): FileViewerCoreProps['adapters'];
|
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ViewerHandle, ViewerViewModeOption } from '@ark-design/ui/file-viewer/core';
|
|
2
|
+
import type { MarkdownAdapterOptions } from '@ark-design/ui/file-viewer/adapters/markdown';
|
|
3
|
+
import type { useFilePreviewEditing } from './use-file-preview-editing.js';
|
|
4
|
+
import type { FilePreviewFileTab, FilePreviewLabels, FilePreviewViewMode } from './types.js';
|
|
2
5
|
export interface FilePreviewBodyProps {
|
|
3
|
-
fileTab
|
|
4
|
-
contentTab?: FilePreviewContentTab;
|
|
6
|
+
fileTab: FilePreviewFileTab;
|
|
5
7
|
text: Required<FilePreviewLabels>;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
locale?: 'en-US' | 'zh-CN';
|
|
9
|
+
viewMode: FilePreviewViewMode;
|
|
10
|
+
editing: ReturnType<typeof useFilePreviewEditing>;
|
|
11
|
+
onViewModeChange: (mode: FilePreviewViewMode) => void;
|
|
12
|
+
onHandleChange: (handle: ViewerHandle | null) => void;
|
|
13
|
+
onViewModesChange: (modes: readonly ViewerViewModeOption[]) => void;
|
|
14
|
+
onDownload: () => void;
|
|
15
|
+
/** Markdown 正文里的链接被点击时调用。 */
|
|
16
|
+
onLinkClick?: MarkdownAdapterOptions['onLinkClick'];
|
|
17
|
+
/** 读取失败后退出编辑态。Leaves editing after a failed load. */
|
|
18
|
+
onCancelEditing: () => void;
|
|
13
19
|
}
|
|
14
|
-
/**
|
|
15
|
-
|
|
20
|
+
/**
|
|
21
|
+
* 文件页签的正文:按编辑态、空文件、底座依次短路。内容页签不走这里——它的
|
|
22
|
+
* 正文整块由宿主渲染。
|
|
23
|
+
*
|
|
24
|
+
* The body of a file tab: it short-circuits through editing, empty file and then
|
|
25
|
+
* the base component. A content tab never reaches this — its body is the host's.
|
|
26
|
+
*/
|
|
27
|
+
export declare function FilePreviewBody({ fileTab, text, locale, viewMode, editing, onViewModeChange, onHandleChange, onViewModesChange, onDownload, onLinkClick, onCancelEditing, }: FilePreviewBodyProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PathSegment } from './file-preview-path.js';
|
|
2
|
+
export interface FilePreviewBreadcrumbMenuProps {
|
|
3
|
+
segments: readonly PathSegment[];
|
|
4
|
+
canOpen: boolean;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
onOpen: (uri: string) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 折叠层级的菜单。用 Tooltip 的 `click` 形态承载:点击「…」展开,按 Esc 或
|
|
10
|
+
* 点外部关闭,浮层渲染到 body,因此不受面包屑容器的布局约束。
|
|
11
|
+
*
|
|
12
|
+
* The menu of collapsed levels, carried by Tooltip's `click` shape: clicking "…"
|
|
13
|
+
* opens it, Escape or a press outside closes it, and because the surface renders
|
|
14
|
+
* into `body` the breadcrumb's own layout cannot clip it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function FilePreviewBreadcrumbMenu({ segments, canOpen, disabled, onOpen, }: FilePreviewBreadcrumbMenuProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PathSegment } from './file-preview-path.js';
|
|
2
|
+
export interface FilePreviewBreadcrumbProps {
|
|
3
|
+
segments: readonly PathSegment[];
|
|
4
|
+
title: string;
|
|
5
|
+
canOpen: boolean;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
onOpen: (uri: string) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 路径面包屑:祖先逐段可点,放不下时按「保两端、缩中间」折叠。
|
|
11
|
+
*
|
|
12
|
+
* 折叠顺序与内部版一致:先保留首段与末段,从紧邻首段的那一级开始逐级收进
|
|
13
|
+
* 「…」;中间全部收起后仍放不下,才连首段一起收起,只留末段。
|
|
14
|
+
*
|
|
15
|
+
* Path breadcrumb: every ancestor is clickable, and overflow collapses by keeping
|
|
16
|
+
* both ends and shrinking the middle. The first level and the trailing name stay
|
|
17
|
+
* as long as possible; ancestors are folded into a "…" menu starting next to the
|
|
18
|
+
* first level, and only when even that does not fit is the first level dropped
|
|
19
|
+
* too, leaving the trailing name alone.
|
|
20
|
+
*/
|
|
21
|
+
export declare function FilePreviewBreadcrumb({ segments, title, canOpen, disabled, onOpen, }: FilePreviewBreadcrumbProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 路径旁的复制按钮。有 `source.path` 的文件在任何宿主下都需要它,因此内置在
|
|
3
|
+
* 外壳里,而不是交给宿主渲染。
|
|
4
|
+
*
|
|
5
|
+
* The copy-path button beside the path. Any file with a `source.path` needs it
|
|
6
|
+
* under every host, so it lives in the shell rather than being left to the host.
|
|
7
|
+
*/
|
|
8
|
+
export declare function FilePreviewCopyPath({ label, disabled, onClick, }: {
|
|
9
|
+
label: string;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ViewerHandle, ViewerViewModeOption } from '@ark-design/ui/file-viewer/core';
|
|
2
|
+
import type { FilePreviewActions } from './types.js';
|
|
3
|
+
import type { useFilePreviewEditing } from './use-file-preview-editing.js';
|
|
4
|
+
import type { FilePreviewDirectoryTab, FilePreviewLabels, FilePreviewViewMode } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* 目录页签的正文:标题行之下多一层同级视图切换(L0 摘要 / L1 总览),每一级
|
|
7
|
+
* 各自是一份 Markdown,走与文件页签相同的渲染路径。
|
|
8
|
+
*
|
|
9
|
+
* 这一层属于目录这种实体:文件没有同级视图可切,给它加同样的插槽只会留一个
|
|
10
|
+
* 永远空着的位置。
|
|
11
|
+
*
|
|
12
|
+
* The body of a directory tab: one extra level of sibling switching between
|
|
13
|
+
* summary levels (L0 / L1) under the header, each level its own Markdown going
|
|
14
|
+
* through the same rendering path as a file tab.
|
|
15
|
+
*
|
|
16
|
+
* That level belongs to the directory entity: a file has no sibling views to
|
|
17
|
+
* switch, so giving it the same slot would only leave a permanently empty space.
|
|
18
|
+
*/
|
|
19
|
+
export interface FilePreviewDirectoryBodyProps {
|
|
20
|
+
tab: FilePreviewDirectoryTab;
|
|
21
|
+
text: Required<FilePreviewLabels>;
|
|
22
|
+
locale?: 'en-US' | 'zh-CN';
|
|
23
|
+
actions: FilePreviewActions;
|
|
24
|
+
editing: ReturnType<typeof useFilePreviewEditing>;
|
|
25
|
+
viewMode: FilePreviewViewMode;
|
|
26
|
+
onViewModeChange: (mode: FilePreviewViewMode) => void;
|
|
27
|
+
onHandleChange: (handle: ViewerHandle | null) => void;
|
|
28
|
+
onViewModesChange: (modes: readonly ViewerViewModeOption[]) => void;
|
|
29
|
+
onDownload: () => void;
|
|
30
|
+
onCancelEditing: () => void;
|
|
31
|
+
}
|
|
32
|
+
export declare function FilePreviewDirectoryBody({ tab, text, locale, actions, editing, viewMode, onViewModeChange, onHandleChange, onViewModesChange, onDownload, onCancelEditing, }: FilePreviewDirectoryBodyProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FilePreviewLabels } from './types.js';
|
|
2
|
+
export interface FilePreviewEditorProps {
|
|
3
|
+
draft: string;
|
|
4
|
+
text: Required<FilePreviewLabels>;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
failed: boolean;
|
|
7
|
+
saveFailed: boolean;
|
|
8
|
+
saving: boolean;
|
|
9
|
+
onChange: (value: string) => void;
|
|
10
|
+
onCancel: () => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 编辑态正文:纯文本编辑区,不经过底座。
|
|
14
|
+
*
|
|
15
|
+
* 编辑区独立于 `FileViewerCore`,因此进入编辑不会重建渲染器,退出编辑也
|
|
16
|
+
* 不会重新解析内容。
|
|
17
|
+
*
|
|
18
|
+
* The editing body: a plain-text area that bypasses the base component. Keeping
|
|
19
|
+
* it separate means entering or leaving editing never remounts the renderer nor
|
|
20
|
+
* reparses the content.
|
|
21
|
+
*/
|
|
22
|
+
export declare function FilePreviewEditor({ draft, text, loading, failed, saveFailed, saving, onChange, onCancel, }: FilePreviewEditorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FileViewerCoreProps, ViewerHandle, ViewerViewModeOption } from '@ark-design/ui/file-viewer/core';
|
|
2
|
+
import type { MarkdownAdapterOptions } from '@ark-design/ui/file-viewer/adapters/markdown';
|
|
3
|
+
export interface FilePreviewAdapterOptions {
|
|
4
|
+
/** 底座交出或收回命令式句柄时调用。 */
|
|
5
|
+
onHandleChange: (handle: ViewerHandle | null) => void;
|
|
6
|
+
/** 命中的 Adapter 加载完成时,上报它支持的视图模式。 */
|
|
7
|
+
onViewModesChange: (modes: readonly ViewerViewModeOption[]) => void;
|
|
8
|
+
/** Markdown 正文里的链接被点击时调用;传入即由宿主接管导航。 */
|
|
9
|
+
onLinkClick?: MarkdownAdapterOptions['onLinkClick'];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 给每个 Adapter 套一层:接住底座交出来的命令式句柄,并上报命中格式支持
|
|
13
|
+
* 的视图模式。
|
|
14
|
+
*
|
|
15
|
+
* 底座没有 forwardRef,句柄是通过渲染组件的 `registerHandle` 属性交出的;
|
|
16
|
+
* `load()` 只会对命中的那个 Adapter 调用一次,因此在这里上报视图模式就等价
|
|
17
|
+
* 于「当前文件支持哪些视图」,组件据此决定是否显示预览/源码切换。
|
|
18
|
+
*
|
|
19
|
+
* Wraps every adapter to capture the imperative handle and to report the view
|
|
20
|
+
* modes the matched format supports. The base has no forwardRef: the handle
|
|
21
|
+
* arrives through the renderer's `registerHandle` prop. `load()` runs once for
|
|
22
|
+
* the matched adapter only, so reporting there is equivalent to "which views
|
|
23
|
+
* this file supports", and the component uses it to decide whether to render the
|
|
24
|
+
* preview/source switch.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createFilePreviewAdapters({ onHandleChange, onViewModesChange, onLinkClick, }: FilePreviewAdapterOptions): FileViewerCoreProps['adapters'];
|
|
@@ -1,16 +1,43 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { FilePreviewActions } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* 标题行需要的最少信息。它按字段而不是按页签类型取值,文件页签与目录页签因此
|
|
5
|
+
* 共用同一条渲染路径——两者的路径行本来就一样。
|
|
6
|
+
*
|
|
7
|
+
* The least a header needs. It reads fields rather than a tab kind, so a file tab
|
|
8
|
+
* and a directory tab share one rendering path — their path rows are the same.
|
|
9
|
+
*/
|
|
2
10
|
export interface FilePreviewHeaderProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
/** 完整路径,显示为面包屑;省略时面包屑退化为文件名。 */
|
|
12
|
+
path?: string;
|
|
13
|
+
/** 无路径时回落到文件名。Falls back to the file name when there is no path. */
|
|
14
|
+
fileName: string;
|
|
15
|
+
/** 能否沿路径向上打开。Whether an ancestor can be opened. */
|
|
16
|
+
canOpenParent: boolean;
|
|
17
|
+
/** 标题旁的额外内容。Extra content next to the title. */
|
|
18
|
+
titleExtra?: ReactNode;
|
|
19
|
+
/** 标题行动作区,节点或接收上下文的函数。 */
|
|
20
|
+
/** The header action area: a node, or a function of the actions context. */
|
|
21
|
+
slotActions?: ReactNode | ((actions: FilePreviewActions) => ReactNode);
|
|
22
|
+
actions: FilePreviewActions;
|
|
23
|
+
text: {
|
|
24
|
+
copyPath: string;
|
|
25
|
+
};
|
|
26
|
+
onOpenParent: (uri: string) => void;
|
|
14
27
|
}
|
|
15
|
-
/**
|
|
16
|
-
|
|
28
|
+
/**
|
|
29
|
+
* 内容区标题行:路径面包屑、复制路径与宿主提供的动作区。
|
|
30
|
+
*
|
|
31
|
+
* 复制路径是外壳的一部分——有 `source.path` 的文件在任何宿主下都需要它,因此
|
|
32
|
+
* 内置在面包屑末尾。其余动作(复制正文、下载、视图切换、编辑)依赖宿主的产品
|
|
33
|
+
* 语义与文案,由宿主在 `slots.actions` 里用 `actions` 上下文自行渲染。
|
|
34
|
+
*
|
|
35
|
+
* The content header: the path breadcrumb, copy-path, and a host-supplied action
|
|
36
|
+
* area.
|
|
37
|
+
*
|
|
38
|
+
* Copy-path belongs to the shell — any file with a `source.path` needs it under
|
|
39
|
+
* every host — so it sits at the end of the breadcrumb. The other actions (copy
|
|
40
|
+
* body, download, view switch, edit) carry host product semantics and copy, and
|
|
41
|
+
* the host renders them in `slots.actions` from the `actions` context.
|
|
42
|
+
*/
|
|
43
|
+
export declare function FilePreviewHeader({ path, fileName, canOpenParent, titleExtra, slotActions, actions, text, onOpenParent, }: FilePreviewHeaderProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/**
|
|
1
|
+
import type { FilePreviewLabels } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 组件内置文案,宿主可通过 `labels` 逐项覆盖。
|
|
4
|
+
*
|
|
5
|
+
* 只包含组件自己渲染的文案:复制路径按钮、加载与失败态、格式不支持、空文件
|
|
6
|
+
* 与截断提示。其余动作按钮(复制正文、下载、预览/源码切换、编辑)由宿主在
|
|
7
|
+
* `slots.actions` 里自绘,文案归宿主,这里不重复提供。
|
|
8
|
+
*
|
|
9
|
+
* Built-in copy, overridable field by field through `labels`.
|
|
10
|
+
*
|
|
11
|
+
* Only what the component renders itself: the copy-path button, loading and
|
|
12
|
+
* failure states, unsupported formats, empty files and the truncation notice.
|
|
13
|
+
* Every other action button (copy content, download, preview/source, edit) is
|
|
14
|
+
* drawn by the host in `slots.actions` and carries its own copy.
|
|
15
|
+
*/
|
|
3
16
|
export declare const DEFAULT_LABELS: Required<FilePreviewLabels>;
|
|
4
|
-
/** 从文件页签的 `source` 里取出可复制的纯文本;拿不到时返回 `undefined`。 */
|
|
5
|
-
export declare function readCopyableText(tab: FilePreviewFileTab): string | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { MarkdownAdapterOptions } from '@ark-design/ui/file-viewer/adapters/markdown';
|
|
2
|
+
import type { ViewerHandle, ViewerViewModeOption } from '@ark-design/ui/file-viewer/core';
|
|
3
|
+
import type { HTMLAttributes } from 'react';
|
|
4
|
+
import type { useFilePreviewActions } from './use-file-preview-actions.js';
|
|
5
|
+
import type { FilePreviewActions } from './types.js';
|
|
6
|
+
import type { useFilePreviewEditing } from './use-file-preview-editing.js';
|
|
7
|
+
import type { FilePreviewContentTab, FilePreviewDirectoryTab, FilePreviewFileTab, FilePreviewLabels, FilePreviewTab, FilePreviewViewMode } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* 页签正文的三种渲染分支:内容页签整块交给宿主,目录页签多一层摘要切换,文件
|
|
10
|
+
* 页签走底座。
|
|
11
|
+
*
|
|
12
|
+
* 单独成文件是因为三条分支的参数加起来让主组件超出了行数上限;分支本身仍是
|
|
13
|
+
* 主组件的一次渲染,没有引入新的状态。
|
|
14
|
+
*
|
|
15
|
+
* The three ways a tab body renders: a content tab hands the whole body to the
|
|
16
|
+
* host, a directory tab adds one summary-switching layer, and a file tab goes
|
|
17
|
+
* through the base component.
|
|
18
|
+
*
|
|
19
|
+
* It lives in its own file because the three branches' parameters pushed the main
|
|
20
|
+
* component past the line limit; it is still one render of that component and
|
|
21
|
+
* introduces no state of its own.
|
|
22
|
+
*/
|
|
23
|
+
export interface FilePreviewPanelsProps {
|
|
24
|
+
contentTab?: FilePreviewContentTab;
|
|
25
|
+
directoryTab?: FilePreviewDirectoryTab;
|
|
26
|
+
fileTab?: FilePreviewFileTab;
|
|
27
|
+
panelProps: HTMLAttributes<HTMLDivElement>;
|
|
28
|
+
panelClass: string;
|
|
29
|
+
text: Required<FilePreviewLabels>;
|
|
30
|
+
locale?: 'en-US' | 'zh-CN';
|
|
31
|
+
actions: ReturnType<typeof useFilePreviewActions>;
|
|
32
|
+
actionContext: FilePreviewActions;
|
|
33
|
+
editing: ReturnType<typeof useFilePreviewEditing>;
|
|
34
|
+
viewMode: FilePreviewViewMode;
|
|
35
|
+
setViewMode: (mode: FilePreviewViewMode) => void;
|
|
36
|
+
onHandleChange: (handle: ViewerHandle | null) => void;
|
|
37
|
+
onViewModesChange: (modes: readonly ViewerViewModeOption[]) => void;
|
|
38
|
+
linkClickHandler?: MarkdownAdapterOptions['onLinkClick'];
|
|
39
|
+
activeTab: FilePreviewTab;
|
|
40
|
+
}
|
|
41
|
+
export declare function FilePreviewPanels({ contentTab, directoryTab, fileTab, panelProps, panelClass, text, locale, actions, actionContext, editing, viewMode, setViewMode, onHandleChange, onViewModesChange, linkClickHandler, activeTab, }: FilePreviewPanelsProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface PathSegment {
|
|
2
|
+
/** 该段的展示文本,不含协议前缀。 */
|
|
3
|
+
label: string;
|
|
4
|
+
/** 点击该段时要打开的完整 URI。 */
|
|
5
|
+
uri: string;
|
|
6
|
+
/** 是否首段,渲染时在它前面补上协议前缀。 */
|
|
7
|
+
isFirst: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 把完整路径拆成可逐级打开的祖先段,最后一段(文件名)不包含在内。
|
|
11
|
+
*
|
|
12
|
+
* 带协议前缀时首段带 `isFirst` 标记,渲染时补上前缀:`viking://a/b/c.md` 拆成
|
|
13
|
+
* `a`、`b`,首段显示为 `viking://a`。
|
|
14
|
+
*
|
|
15
|
+
* 绝对路径(`/a/b/c.md`)保留开头的斜杠:丢掉它祖先会变成相对路径 `a`、
|
|
16
|
+
* `a/b`,宿主按相对路径解析就跳到了错误的目录。相对路径(`a/b/c.md`)保持
|
|
17
|
+
* 原样,不加斜杠。
|
|
18
|
+
*
|
|
19
|
+
* Splits a full path into the ancestor levels that can be opened one by one,
|
|
20
|
+
* excluding the trailing file name. The first segment carries `isFirst` so the
|
|
21
|
+
* renderer can prepend the scheme: `viking://a/b/c.md` yields `a` and `b`, the
|
|
22
|
+
* first rendering as `viking://a`.
|
|
23
|
+
*
|
|
24
|
+
* An absolute path (`/a/b/c.md`) keeps its leading slash: dropping it turns the
|
|
25
|
+
* ancestors into relative paths (`a`, `a/b`) that a host resolves against the
|
|
26
|
+
* wrong directory. A relative path (`a/b/c.md`) is left as-is with no slash added.
|
|
27
|
+
*/
|
|
28
|
+
export declare function splitPathSegments(path?: string): PathSegment[];
|
|
29
|
+
/** 取路径里的文件名,用于面包屑末段与标题回落。 */
|
|
30
|
+
export declare function getPathFileName(path?: string): string | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FileSource } from '@ark-design/ui/file-viewer';
|
|
2
|
+
import type { FilePreviewSource } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* 把宿主的 `source` 映射成底座的 `FileSource`,按 `content`、`file`、`url`
|
|
5
|
+
* 的顺序取第一个有值的来源。都没有时返回 `undefined`,由组件渲染不支持态。
|
|
6
|
+
*
|
|
7
|
+
* Maps the host `source` onto the base `FileSource`, taking the first available
|
|
8
|
+
* of `content`, `file` and `url`. Returns `undefined` when none is present, and
|
|
9
|
+
* the component then renders the unsupported state.
|
|
10
|
+
*/
|
|
11
|
+
export declare function toFileSource(source: FilePreviewSource): FileSource | undefined;
|
|
12
|
+
/** 取页签上可用于复制的正文;拿不到时返回 `undefined`。 */
|
|
13
|
+
export declare function readCopyableText(source: FilePreviewSource): string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* 判断文件是否为严格空文件。
|
|
16
|
+
*
|
|
17
|
+
* 只把长度为 0 视为空文件;空白字符组成的文件有内容但无可见文本,属于
|
|
18
|
+
* 「暂无内容」,两者提示不同,不能合并成 `trim()` 判断。
|
|
19
|
+
*
|
|
20
|
+
* Whether the file itself is empty. Only a zero-length body counts as empty; a
|
|
21
|
+
* body made of whitespace has content but nothing visible, which is a different
|
|
22
|
+
* message. The two must not be merged into a `trim()` check.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isEmptyFile(source: FilePreviewSource): boolean;
|