@simon_he/vue-tui 0.0.7 → 1.0.0-rc.0
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 +222 -444
- package/dist/TSelect-BmSkar0D.js +8697 -0
- package/dist/ansi-palette-Bv5Vqr4k.js +1499 -0
- package/dist/ansi-styles.d.ts +200 -0
- package/dist/cli/headless-renderer.d.ts +29 -0
- package/dist/cli/input.d.ts +49 -0
- package/dist/cli/node-file-writers.d.ts +12 -0
- package/dist/cli/node-module.d.ts +2 -0
- package/dist/cli/parse-kitty.d.ts +2 -0
- package/dist/cli/parse-mouse.d.ts +2 -0
- package/dist/cli/parse-utils.d.ts +14 -0
- package/dist/cli/parse-xterm.d.ts +2 -0
- package/dist/cli/path-provider-types.d.ts +1 -0
- package/dist/cli/path-provider.d.ts +4 -0
- package/dist/cli/path-suggest-core.d.ts +1 -0
- package/dist/cli/path-suggest.d.ts +15 -0
- package/dist/cli/recording.d.ts +4 -0
- package/dist/cli/stdin-buffer.d.ts +33 -0
- package/dist/cli.cjs +10664 -0
- package/dist/cli.d.cts +22 -0
- package/dist/cli.d.ts +22 -0
- package/dist/cli.js +9521 -0
- package/dist/core/ansi/capability.d.ts +20 -0
- package/dist/core/ansi/colors.d.ts +41 -0
- package/dist/core/ansi/sgr.d.ts +7 -0
- package/dist/core/ansi/theme.d.ts +6 -0
- package/dist/core/ansi-palette.d.ts +14 -0
- package/dist/core/buffer/buffer.d.ts +54 -0
- package/dist/core/buffer/width.d.ts +4 -0
- package/dist/core/debug-logger.d.ts +18 -0
- package/dist/core/hyperlink.d.ts +9 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/path-provider-types.d.ts +24 -0
- package/dist/core/path-suggest.d.ts +35 -0
- package/dist/core/render-plane.d.ts +3 -0
- package/dist/core/terminal/create-terminal.d.ts +7 -0
- package/dist/core/terminal/emitter.d.ts +7 -0
- package/dist/core/types.d.ts +107 -0
- package/dist/core.cjs +3072 -0
- package/dist/core.d.cts +14 -0
- package/dist/core.d.ts +14 -0
- package/dist/core.js +422 -0
- package/dist/create-terminal-app.d.ts +34 -0
- package/dist/dom-renderer-CDVQIcIL.js +1172 -0
- package/dist/events/index.d.ts +6 -0
- package/dist/events/manager/cli-event-manager.d.ts +22 -0
- package/dist/events/manager/event-manager.d.ts +30 -0
- package/dist/events/manager/selection-suppression.d.ts +3 -0
- package/dist/events/manager/types.d.ts +108 -0
- package/dist/events/recording.d.ts +44 -0
- package/dist/experimental.cjs +9380 -0
- package/dist/experimental.d.cts +39 -0
- package/dist/experimental.d.ts +39 -0
- package/dist/experimental.js +7624 -0
- package/dist/frame-perf-C-w8mjJL.js +98 -0
- package/dist/hyperlink-B5PD7a3Q.js +331 -0
- package/dist/index.cjs +12037 -16507
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -1353
- package/dist/index.js +13 -18738
- package/dist/markdown.cjs +21929 -0
- package/dist/markdown.d.cts +10 -0
- package/dist/markdown.d.ts +10 -0
- package/dist/markdown.js +1649 -0
- package/dist/observability/cli-latency-node.d.ts +3 -0
- package/dist/observability/cli-latency-types.d.ts +41 -0
- package/dist/observability/cli-latency.d.ts +3 -0
- package/dist/observability/frame-perf-store.d.ts +13 -0
- package/dist/observability/frame-perf.d.ts +40 -0
- package/dist/observability/trace.d.ts +40 -0
- package/dist/observability/tui-profiler.d.ts +33 -0
- package/dist/observability.cjs +99 -0
- package/dist/observability.d.cts +6 -0
- package/dist/observability.d.ts +6 -0
- package/dist/observability.js +3 -0
- package/dist/path-DDiSCXrQ.js +99 -0
- package/dist/path-suggest-0Q2BDsuj.js +274 -0
- package/dist/path-suggest-Dk9TRLh5.js +3 -0
- package/dist/{path-suggest-CZQYJIIg.js → path-suggest-bvR9SY6Q.js} +86 -18
- package/dist/renderer/capabilities.d.ts +13 -0
- package/dist/renderer/cli/index.d.ts +2 -0
- package/dist/renderer/cli/stdout-metrics.d.ts +18 -0
- package/dist/renderer/cli/stdout-renderer.d.ts +48 -0
- package/dist/renderer/dom/dom-renderer.d.ts +157 -0
- package/dist/renderer/dom/index.d.ts +2 -0
- package/dist/renderer/index.d.ts +2 -0
- package/dist/renderer-dom.cjs +1511 -0
- package/dist/renderer-dom.d.cts +4 -0
- package/dist/renderer-dom.d.ts +4 -0
- package/dist/renderer-dom.js +6 -0
- package/dist/runtime/index.d.ts +36 -0
- package/dist/runtime/osc52.d.ts +9 -0
- package/dist/runtime-DtrcQidD.js +1197 -0
- package/dist/runtime.cjs +1697 -0
- package/dist/runtime.d.cts +9 -0
- package/dist/runtime.d.ts +9 -0
- package/dist/runtime.js +4 -0
- package/dist/selection/terminal-selection.d.ts +122 -0
- package/dist/sgr-DMK2AvuT.js +304 -0
- package/dist/style-cache-i0ZABZRq.js +178 -0
- package/dist/terminal-selection-BCOh9jsL.js +329 -0
- package/dist/utils/env.d.ts +3 -0
- package/dist/utils/newlines.d.ts +1 -0
- package/dist/utils/path.d.ts +7 -0
- package/dist/utils/url-safety.d.ts +2 -0
- package/dist/vue/components/TAnchor.d.ts +108 -0
- package/dist/vue/components/TBox.d.ts +144 -0
- package/dist/vue/components/TDebugOverlay.d.ts +43 -0
- package/dist/vue/components/TDialog.d.ts +256 -0
- package/dist/vue/components/TFlow.d.ts +85 -0
- package/dist/vue/components/TInput.d.ts +554 -0
- package/dist/vue/components/TInputBox.d.ts +158 -0
- package/dist/vue/components/TJsonEditor.d.ts +165 -0
- package/dist/vue/components/TList.d.ts +119 -0
- package/dist/vue/components/TLogLinksPanel.d.ts +238 -0
- package/dist/vue/components/TLogMinimap.d.ts +263 -0
- package/dist/vue/components/TLogScrollbar.d.ts +236 -0
- package/dist/vue/components/TLogSearchBar.d.ts +267 -0
- package/dist/vue/components/TLogSearchPager.d.ts +162 -0
- package/dist/vue/components/TLogSearchResults.d.ts +200 -0
- package/dist/vue/components/TLogView.d.ts +502 -0
- package/dist/vue/components/TLogVirtualLinksPanel.d.ts +141 -0
- package/dist/vue/components/TLogVirtualSearchResults.d.ts +146 -0
- package/dist/vue/components/TMarkdownText.d.ts +134 -0
- package/dist/vue/components/TMultilineModal.d.ts +62 -0
- package/dist/vue/components/TPathPicker.d.ts +213 -0
- package/dist/vue/components/TRenderLayer.d.ts +16 -0
- package/dist/vue/components/TRenderPlane.d.ts +17 -0
- package/dist/vue/components/TSelect.d.ts +215 -0
- package/dist/vue/components/TText.d.ts +116 -0
- package/dist/vue/components/TTransition.d.ts +83 -0
- package/dist/vue/components/TView.d.ts +127 -0
- package/dist/vue/components/TVirtualList.d.ts +182 -0
- package/dist/vue/components/TVirtualMarkdown.d.ts +168 -0
- package/dist/vue/components/TerminalProvider.d.ts +195 -0
- package/dist/vue/components/input/host.d.ts +17 -0
- package/dist/vue/components/input/plugins/hostPlugin.d.ts +7 -0
- package/dist/vue/components/input/plugins/hostPlugin.node.d.ts +15 -0
- package/dist/vue/components/input/plugins/mentionUtils.d.ts +17 -0
- package/dist/vue/components/input/plugins/nodeMentionPathProvider.d.ts +2 -0
- package/dist/vue/components/input/plugins/promptMentionPlugin.d.ts +8 -0
- package/dist/vue/components/input/plugins/promptMentionState.d.ts +98 -0
- package/dist/vue/components/input/plugins/restrictText.d.ts +27 -0
- package/dist/vue/components/input/plugins/types.d.ts +90 -0
- package/dist/vue/components/input/utils/inlineText.d.ts +57 -0
- package/dist/vue/components/input/utils/inlineTextTokens.d.ts +34 -0
- package/dist/vue/components/input/utils/primitives.d.ts +3 -0
- package/dist/vue/components/input/utils/wordNavigation.d.ts +6 -0
- package/dist/vue/components/list/list-geometry.d.ts +16 -0
- package/dist/vue/components/list/list-paint.d.ts +1 -0
- package/dist/vue/components/list/scroll-state.d.ts +25 -0
- package/dist/vue/components/list/selection-state.d.ts +6 -0
- package/dist/vue/components/terminal-provider/copy-toast.d.ts +6 -0
- package/dist/vue/components/terminal-provider/portals.d.ts +17 -0
- package/dist/vue/components/terminal-provider/scheduler.d.ts +29 -0
- package/dist/vue/components/terminal-provider/selection-config.d.ts +15 -0
- package/dist/vue/components/terminal-provider/utils.d.ts +5 -0
- package/dist/vue/composables/use-layout.d.ts +2 -0
- package/dist/vue/composables/use-render-node.d.ts +19 -0
- package/dist/vue/composables/use-render-stack.d.ts +3 -0
- package/dist/vue/composables/use-runtime.d.ts +5 -0
- package/dist/vue/composables/use-terminal-node.d.ts +14 -0
- package/dist/vue/composables/use-terminal.d.ts +2 -0
- package/dist/vue/composables/use-visibility.d.ts +12 -0
- package/dist/vue/context.d.ts +153 -0
- package/dist/vue/index.d.ts +39 -0
- package/dist/vue/injection-key.d.ts +2 -0
- package/dist/vue/log/append-only-log-store.d.ts +2 -0
- package/dist/vue/log/tlog-keymap.d.ts +28 -0
- package/dist/vue/log/tlog-plugins.d.ts +144 -0
- package/dist/vue/log/tlog-session.d.ts +81 -0
- package/dist/vue/log/tlog-theme.d.ts +68 -0
- package/dist/vue/log/types.d.ts +43 -0
- package/dist/vue/log/use-tlog-link-controller.d.ts +31 -0
- package/dist/vue/log/use-tlog-retained-index.d.ts +26 -0
- package/dist/vue/log/use-tlog-search-controller.d.ts +51 -0
- package/dist/vue/log/use-tlog-search-results-page.d.ts +31 -0
- package/dist/vue/log/use-tlog-virtual-search-results.d.ts +22 -0
- package/dist/vue/markdown/ast.d.ts +3 -0
- package/dist/vue/markdown/block-source.d.ts +22 -0
- package/dist/vue/markdown/document.d.ts +18 -0
- package/dist/vue/markdown/layout.d.ts +16 -0
- package/dist/vue/markdown/parser.d.ts +11 -0
- package/dist/vue/markdown/render.d.ts +10 -0
- package/dist/vue/markdown/theme.d.ts +186 -0
- package/dist/vue/markdown/types.d.ts +47 -0
- package/dist/vue/render/context.d.ts +3 -0
- package/dist/vue/render/render-manager.d.ts +94 -0
- package/dist/vue/router/RouterView.d.ts +25 -0
- package/dist/vue/router/composables.d.ts +4 -0
- package/dist/vue/router/context.d.ts +4 -0
- package/dist/vue/router/router.d.ts +7 -0
- package/dist/vue/router/types.d.ts +29 -0
- package/dist/vue/scheduler/frame-mailbox.d.ts +55 -0
- package/dist/vue/scheduler/frame-scheduler.d.ts +51 -0
- package/dist/vue/utils/frame-task.d.ts +6 -0
- package/dist/vue/utils/rect.d.ts +4 -0
- package/dist/vue/utils/style-cache.d.ts +3 -0
- package/dist/vue/utils/text.d.ts +26 -0
- package/dist/vue/utils/wheel-scroll.d.ts +18 -0
- package/dist/vue.cjs +18882 -0
- package/dist/vue.d.cts +3 -0
- package/dist/vue.d.ts +3 -0
- package/dist/vue.js +3066 -0
- package/dist/wheel-scroll-B-WlFuNB.js +819 -0
- package/package.json +226 -58
- package/dist/path-suggest-DIMby3r0.js +0 -3
package/README.md
CHANGED
|
@@ -1,526 +1,304 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @simon_he/vue-tui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Vue TUI is a Vue 3 terminal UI toolkit for building terminal-style interfaces that can render in a browser or in a real CLI. It gives you Vue components, terminal cell rendering, event dispatch, markdown rendering, and high-throughput primitives for lists, logs, and streaming transcripts.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- ANSI 样式渲染(颜色、加粗、下划线等)
|
|
7
|
-
- 事件机制(点击、移动、滚动、拖拽)
|
|
8
|
-
- Vue 组件 + 响应式数据驱动终端界面更新
|
|
5
|
+
Use it when you want:
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
- Browser-hosted terminal interfaces, dashboards, demos, and playgrounds.
|
|
8
|
+
- CLI apps that use Vue component composition instead of imperative stdout drawing.
|
|
9
|
+
- Shared UI code that can run against a DOM renderer, a stdout renderer, or headless tests.
|
|
10
|
+
- Large terminal surfaces such as virtual lists, append-only logs, markdown transcripts, and agent console UIs.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
```vue
|
|
15
|
-
<script setup lang="ts">
|
|
16
|
-
import { computed, ref } from 'vue'
|
|
17
|
-
import {
|
|
18
|
-
TerminalProvider,
|
|
19
|
-
TBox,
|
|
20
|
-
TInput,
|
|
21
|
-
TText,
|
|
22
|
-
useLayout,
|
|
23
|
-
} from '@simon_he/vue-tui'
|
|
24
|
-
|
|
25
|
-
const layout = useLayout()
|
|
26
|
-
const cols = computed(() => layout.clipRect?.w ?? 80)
|
|
27
|
-
const rows = computed(() => layout.clipRect?.h ?? 24)
|
|
28
|
-
const input = ref('')
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
<template>
|
|
32
|
-
<TerminalProvider
|
|
33
|
-
:cols="80"
|
|
34
|
-
:rows="24"
|
|
35
|
-
:default-style="{ fg: 'whiteBright' }"
|
|
36
|
-
>
|
|
37
|
-
<TBox
|
|
38
|
-
:x="0"
|
|
39
|
-
:y="0"
|
|
40
|
-
:w="80"
|
|
41
|
-
:h="24"
|
|
42
|
-
border
|
|
43
|
-
title="Demo"
|
|
44
|
-
:padding="1"
|
|
45
|
-
:style="{ fg: 'blueBright' }"
|
|
46
|
-
>
|
|
47
|
-
<TText :x="0" :y="0" :w="78" :value="`cols=${cols} rows=${rows}`" />
|
|
48
|
-
<TInput :x="0" :y="20" :w="78" v-model="input" placeholder="Type..." />
|
|
49
|
-
</TBox>
|
|
50
|
-
</TerminalProvider>
|
|
51
|
-
</template>
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## 组件文档与验收标准
|
|
55
|
-
|
|
56
|
-
- VitePress 文档站点(本地):`bun run --filter '@simon_he/vue-tui' docs:dev`(入口 `docs/index.md`)
|
|
57
|
-
- 组件使用文档:`docs/components.md`
|
|
58
|
-
- 组件 Props/Events(自动生成):`docs/generated/components-api.md`(脚本:`scripts/generate-component-api-docs.ts`)
|
|
59
|
-
- 组件验收标准(可信赖组件定义 + 测试范围):`docs/components-acceptance.md`
|
|
60
|
-
- Terminal 兼容性与颜色一致性:`docs/terminal-compatibility.md`
|
|
61
|
-
- 性能关注点与回归策略:`docs/performance.md`
|
|
62
|
-
|
|
63
|
-
### 终端(真实 CLI)渲染
|
|
64
|
-
|
|
65
|
-
内置 `vue-terminal run`,直接在真实终端中跑 UI(stdout renderer + stdin driver):
|
|
12
|
+
## Install
|
|
66
13
|
|
|
67
14
|
```bash
|
|
68
|
-
pnpm
|
|
69
|
-
node cli.mjs --app basic
|
|
15
|
+
pnpm add @simon_he/vue-tui@rc vue
|
|
70
16
|
```
|
|
71
17
|
|
|
72
|
-
|
|
18
|
+
Vue is a peer dependency. The current package supports Vue `>=3.3.0 <4`.
|
|
73
19
|
|
|
74
|
-
|
|
20
|
+
## Runtime Support
|
|
75
21
|
|
|
76
|
-
|
|
22
|
+
The published package supports Node.js `>=16.17` for CLI/runtime consumers.
|
|
77
23
|
|
|
78
|
-
|
|
79
|
-
# 浏览器示例(交互测试)
|
|
80
|
-
pnpm -C examples/basic dev
|
|
81
|
-
pnpm -C examples/goatchain dev
|
|
24
|
+
Development, release validation, and documentation builds are run on Node.js 20 in CI because the repository toolchain uses modern build/test tooling.
|
|
82
25
|
|
|
83
|
-
|
|
84
|
-
pnpm build:examples
|
|
85
|
-
|
|
86
|
-
# 打包成 terminal 产物并运行
|
|
87
|
-
pnpm build:examples:terminal
|
|
88
|
-
pnpm run:basic:terminal
|
|
89
|
-
pnpm run:goatchain:terminal
|
|
90
|
-
```
|
|
26
|
+
## Entry Points
|
|
91
27
|
|
|
92
|
-
|
|
28
|
+
| Import | Stability | Use it for |
|
|
29
|
+
| --------------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------- |
|
|
30
|
+
| `@simon_he/vue-tui` | Public | Browser-safe terminal core, DOM renderer, stable Vue components, and input host plugin factory |
|
|
31
|
+
| `@simon_he/vue-tui/core` | Public | Terminal core, buffer-facing types, ANSI/theme/path/hyperlink helpers |
|
|
32
|
+
| `@simon_he/vue-tui/renderer/dom` | Public | DOM renderer factory and renderer capabilities |
|
|
33
|
+
| `@simon_he/vue-tui/vue` | Advanced | Extended Vue components, composables, router helpers, and Vue runtime internals |
|
|
34
|
+
| `@simon_he/vue-tui/runtime` | Advanced | Runtime wiring, selection helpers, and clipboard abstraction |
|
|
35
|
+
| `@simon_he/vue-tui/observability` | Advanced | Frame perf store, profiler hooks, and trace helpers |
|
|
36
|
+
| `@simon_he/vue-tui/cli` | Public | Node-only headless Vue app runtime, stdin driver, stdout renderer, path provider, recording, and terminal clipboard helpers |
|
|
37
|
+
| `@simon_he/vue-tui/markdown` | Public | `TMarkdownText`, `TVirtualMarkdown`, markdown parser and layout helpers, streaming markdown block sources |
|
|
38
|
+
| `@simon_he/vue-tui/experimental` | Experimental | `TVirtualList`, `TLogView`, TLog search/link/minimap companions, append-only log store, and TLog plugins |
|
|
93
39
|
|
|
94
|
-
|
|
40
|
+
The stable surface is terminal core, DOM rendering, CLI runtime, basic Vue components, and markdown APIs. High-throughput log and virtualization APIs stay under `/experimental` until their public surface settles; keep those imports isolated in application code.
|
|
95
41
|
|
|
96
|
-
|
|
42
|
+
Do not deep import from `@simon_he/vue-tui/dist/...`; only the entry points above are part of the supported package contract.
|
|
97
43
|
|
|
98
|
-
|
|
44
|
+
### Migration: Node Host Adapter Moved To `/cli`
|
|
99
45
|
|
|
100
|
-
|
|
101
|
-
2. tool_call 的执行可以交给 agent 侧(推荐,和 GoatChain CLI 一致),UI 只负责渲染与“暂停→继续”的用户输入。
|
|
102
|
-
3. 在 UI 侧维护 token 统计与 context window(真实 tokenizer 或近似估算均可)。
|
|
46
|
+
Node-specific input host defaults are no longer exported from the browser-safe root entrypoint.
|
|
103
47
|
|
|
104
|
-
|
|
48
|
+
Before:
|
|
105
49
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- `apps/goatchain/src/core/store.ts`
|
|
109
|
-
- `apps/goatchain/src/tools-mock.ts`
|
|
110
|
-
|
|
111
|
-
你只需要实现一个 `GoatChainAgent`(`receiveMessage(messages, metadata)` → `AsyncGenerator<ACPMessage>`),并传给 `GoatChainShell/GoatChainProvider`,其余 UI 与交互可以复用。
|
|
112
|
-
|
|
113
|
-
## 核心概念
|
|
114
|
-
|
|
115
|
-
- Buffer: 以 Cell 网格存储字符与样式,负责最小化更新
|
|
116
|
-
- Renderer: 将 Buffer diff 渲染为 DOM(后续可扩展 canvas)
|
|
117
|
-
- EventManager: DOM 事件 -> cell 坐标 -> 命中测试 -> 派发给组件
|
|
118
|
-
- Vue Layer: 提供 `TerminalProvider` 与内置组件 (TText/TBox/TView)
|
|
119
|
-
- UI Layer: 通用组件与指令(`select`, `v-if`, `v-show` 等)
|
|
120
|
-
- Vue3 对齐: 事件名称/修饰符/行为尽量与浏览器 Vue3 保持一致
|
|
121
|
-
|
|
122
|
-
## 模块分层(建议结构)
|
|
123
|
-
|
|
124
|
-
```
|
|
125
|
-
src/
|
|
126
|
-
core/
|
|
127
|
-
buffer/ # Cell 网格、dirty 标记、宽字符
|
|
128
|
-
terminal/ # Terminal API(write/clear/resize/batch/commit)
|
|
129
|
-
ansi/ # ANSI 解析 -> Style
|
|
130
|
-
renderer/
|
|
131
|
-
dom/ # 行/Span 渲染、diff 更新
|
|
132
|
-
events/
|
|
133
|
-
manager/ # 坐标映射、hit test、事件派发
|
|
134
|
-
vue/
|
|
135
|
-
components/ # TerminalProvider, TText, TBox, TView
|
|
136
|
-
composables/ # useTerminal, useTerminalNode
|
|
137
|
-
directives/ # v-if, v-show, v-model, v-focus 等
|
|
138
|
-
runtime/ # 动态插入、组件工厂、命令式渲染
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## 数据流
|
|
142
|
-
|
|
143
|
-
```
|
|
144
|
-
Vue 组件 -> Terminal API -> Buffer -> Diff -> Renderer -> DOM
|
|
145
|
-
DOM 事件 -> EventManager -> HitTest -> Vue 组件事件回调
|
|
50
|
+
```ts
|
|
51
|
+
import { createDefaultTInputHostAdapter, defaultTInputHostPlugin } from "@simon_he/vue-tui";
|
|
146
52
|
```
|
|
147
53
|
|
|
148
|
-
|
|
54
|
+
After:
|
|
149
55
|
|
|
150
56
|
```ts
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
bg?: string
|
|
154
|
-
bold?: boolean
|
|
155
|
-
dim?: boolean
|
|
156
|
-
italic?: boolean
|
|
157
|
-
underline?: boolean
|
|
158
|
-
inverse?: boolean
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
type Cell = {
|
|
162
|
-
ch: string
|
|
163
|
-
style: Style
|
|
164
|
-
width: 1 | 2 // 宽字符支持
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
type Buffer = {
|
|
168
|
-
rows: Cell[][]
|
|
169
|
-
cols: number
|
|
170
|
-
rowsCount: number
|
|
171
|
-
dirtyRows: boolean[]
|
|
172
|
-
}
|
|
57
|
+
import { createTInputHostPlugin } from "@simon_he/vue-tui";
|
|
58
|
+
import { createDefaultTInputHostAdapter, defaultTInputHostPlugin } from "@simon_he/vue-tui/cli";
|
|
173
59
|
```
|
|
174
60
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
- `write()` 默认不解析 ANSI,仅做“就地写入”,越界裁剪
|
|
178
|
-
- `writeAnsi()` 解析 ANSI 样式与基础控制序列
|
|
179
|
-
- 光标与换行:`write()` 未提供 `x/y` 时使用内部 cursor,带 `x/y` 不更新全局 cursor
|
|
180
|
-
- `scroll()` 仅滚动可视区域(是否保留 scrollback 由实现决定)
|
|
61
|
+
### Migration: Root Entry Was Narrowed
|
|
181
62
|
|
|
182
|
-
|
|
63
|
+
The root entrypoint now keeps only stable browser-safe APIs. Extended Vue components and Vue router/composable helpers move to `@simon_he/vue-tui/vue`.
|
|
183
64
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
65
|
+
| Before root import | New import |
|
|
66
|
+
| ------------------ | ----------------------- |
|
|
67
|
+
| `TAnchor` | `@simon_he/vue-tui/vue` |
|
|
68
|
+
| `TFlow` | `@simon_he/vue-tui/vue` |
|
|
69
|
+
| `TInputBox` | `@simon_he/vue-tui/vue` |
|
|
70
|
+
| `TPathPicker` | `@simon_he/vue-tui/vue` |
|
|
71
|
+
| `TJsonEditor` | `@simon_he/vue-tui/vue` |
|
|
72
|
+
| `TRenderPlane` | `@simon_he/vue-tui/vue` |
|
|
73
|
+
| `TRenderLayer` | `@simon_he/vue-tui/vue` |
|
|
74
|
+
| `TTransition` | `@simon_he/vue-tui/vue` |
|
|
75
|
+
| router/composables | `@simon_he/vue-tui/vue` |
|
|
76
|
+
| Node host defaults | `@simon_he/vue-tui/cli` |
|
|
188
77
|
|
|
189
|
-
|
|
78
|
+
Before:
|
|
190
79
|
|
|
191
80
|
```ts
|
|
192
|
-
|
|
193
|
-
resize(cols: number, rows: number): void
|
|
194
|
-
clear(x?: number, y?: number, w?: number, h?: number): void
|
|
195
|
-
write(text: string, opts?: { x?: number; y?: number; style?: Style }): void
|
|
196
|
-
writeAnsi(text: string, opts?: { x?: number; y?: number }): void
|
|
197
|
-
put(x: number, y: number, ch: string, style?: Style): void
|
|
198
|
-
fill(
|
|
199
|
-
x: number,
|
|
200
|
-
y: number,
|
|
201
|
-
w: number,
|
|
202
|
-
h: number,
|
|
203
|
-
ch?: string,
|
|
204
|
-
style?: Style,
|
|
205
|
-
): void
|
|
206
|
-
scroll(lines: number): void
|
|
207
|
-
setCursor(x: number, y: number, visible?: boolean): void
|
|
208
|
-
batch(fn: () => void): void
|
|
209
|
-
commit(): void
|
|
210
|
-
on(event: TerminalEvent, cb: (e: TerminalEventPayload) => void): () => void
|
|
211
|
-
dispose(): void
|
|
212
|
-
}
|
|
81
|
+
import { TAnchor, TFlow } from "@simon_he/vue-tui";
|
|
213
82
|
```
|
|
214
83
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
- 事件名称与 Vue3 DOM 事件对齐(`@click`, `@keydown`, `@input` 等)
|
|
218
|
-
- DOM 事件转换为 cell 坐标 (cellX/cellY)
|
|
219
|
-
- hit test 查找当前坐标命中的节点 (支持 zIndex)
|
|
84
|
+
After:
|
|
220
85
|
|
|
221
86
|
```ts
|
|
222
|
-
|
|
223
|
-
| 'click'
|
|
224
|
-
| 'dblclick'
|
|
225
|
-
| 'contextmenu'
|
|
226
|
-
| 'pointerdown'
|
|
227
|
-
| 'pointerup'
|
|
228
|
-
| 'pointermove'
|
|
229
|
-
| 'pointerenter'
|
|
230
|
-
| 'pointerleave'
|
|
231
|
-
| 'mousedown'
|
|
232
|
-
| 'mouseup'
|
|
233
|
-
| 'mousemove'
|
|
234
|
-
| 'mouseenter'
|
|
235
|
-
| 'mouseleave'
|
|
236
|
-
| 'wheel'
|
|
237
|
-
| 'keydown'
|
|
238
|
-
| 'keyup'
|
|
239
|
-
| 'input'
|
|
240
|
-
| 'change'
|
|
241
|
-
| 'compositionstart'
|
|
242
|
-
| 'compositionupdate'
|
|
243
|
-
| 'compositionend'
|
|
244
|
-
| 'focus'
|
|
245
|
-
| 'blur'
|
|
246
|
-
| 'drag'
|
|
247
|
-
|
|
248
|
-
type TerminalBaseEvent = {
|
|
249
|
-
type: TerminalEvent
|
|
250
|
-
target: TerminalNode | null
|
|
251
|
-
currentTarget: TerminalNode | null
|
|
252
|
-
bubbles: boolean
|
|
253
|
-
cancelable: boolean
|
|
254
|
-
defaultPrevented: boolean
|
|
255
|
-
timeStamp: number
|
|
256
|
-
stopPropagation(): void
|
|
257
|
-
preventDefault(): void
|
|
258
|
-
nativeEvent?: Event
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
type TerminalPointerEvent = TerminalBaseEvent & {
|
|
262
|
-
clientX: number
|
|
263
|
-
clientY: number
|
|
264
|
-
cellX: number
|
|
265
|
-
cellY: number
|
|
266
|
-
button?: number
|
|
267
|
-
buttons?: number
|
|
268
|
-
ctrlKey?: boolean
|
|
269
|
-
shiftKey?: boolean
|
|
270
|
-
altKey?: boolean
|
|
271
|
-
metaKey?: boolean
|
|
272
|
-
deltaY?: number
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
type TerminalKeyboardEvent = TerminalBaseEvent & {
|
|
276
|
-
key: string
|
|
277
|
-
code: string
|
|
278
|
-
ctrlKey?: boolean
|
|
279
|
-
shiftKey?: boolean
|
|
280
|
-
altKey?: boolean
|
|
281
|
-
metaKey?: boolean
|
|
282
|
-
repeat?: boolean
|
|
283
|
-
}
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
## 事件派发与冒泡(建议)
|
|
287
|
-
|
|
288
|
-
- 默认冒泡,支持 `stopPropagation()`/`preventDefault()`,语义与 DOM 一致
|
|
289
|
-
- 支持捕获阶段(可选),用于全局拦截(与 `.capture` 对齐)
|
|
290
|
-
- 拖拽使用 pointer capture,保证按下后持续命中
|
|
291
|
-
- 支持 `contextmenu` 事件(右键菜单)
|
|
292
|
-
|
|
293
|
-
## 事件桥接(建议)
|
|
294
|
-
|
|
295
|
-
- Terminal 事件与 Vue 组件事件做统一归一化
|
|
296
|
-
- 事件路径包含命中节点链,便于冒泡与拦截
|
|
297
|
-
- `pointer` 事件优先于 `mouse`,便于兼容触控
|
|
298
|
-
|
|
299
|
-
## Vue3 浏览器事件对齐(约定)
|
|
300
|
-
|
|
301
|
-
- 事件名称:与浏览器 DOM 事件一致(`click`, `keydown`, `input`, `focus` 等)
|
|
302
|
-
- 事件修饰符:支持 `.stop` `.prevent` `.capture` `.once` `.passive` `.self` `.exact`
|
|
303
|
-
- 键盘修饰符:`.ctrl` `.shift` `.alt` `.meta` `.enter` `.esc` 等与 Vue3 行为一致
|
|
304
|
-
- 指针/鼠标:`pointer*` 优先,`mouse*` 兼容;`clientX/clientY` 保留
|
|
305
|
-
- 事件对象:保留原生字段,并额外提供 `cellX/cellY` 与 `nativeEvent`
|
|
306
|
-
- `v-model`:保持 `modelValue` + `update:modelValue` 的 Vue3 约定
|
|
307
|
-
|
|
308
|
-
## 事件映射表(核心字段)
|
|
309
|
-
|
|
87
|
+
import { TAnchor, TFlow } from "@simon_he/vue-tui/vue";
|
|
310
88
|
```
|
|
311
|
-
DOM Mouse/Pointer Event -> TerminalPointerEvent
|
|
312
|
-
- clientX/clientY 保留,额外提供 cellX/cellY
|
|
313
|
-
- button/buttons/ctrlKey/shiftKey/altKey/metaKey 保留
|
|
314
|
-
DOM Keyboard Event -> TerminalKeyboardEvent
|
|
315
|
-
- key/code/repeat/ctrlKey/shiftKey/altKey/metaKey 保留
|
|
316
|
-
DOM Input/Composition Event -> TerminalBaseEvent
|
|
317
|
-
- inputType/data 通过 nativeEvent 获取
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
## `@input` / `@change` 触发规则(建议)
|
|
321
89
|
|
|
322
|
-
|
|
323
|
-
- `compositionstart/update/end` 与浏览器一致,结束后触发一次 `input`
|
|
324
|
-
- `v-model` 绑定:`input` 时更新 `modelValue`,`change` 作为提交确认
|
|
90
|
+
### Hyperlinks
|
|
325
91
|
|
|
326
|
-
|
|
92
|
+
DOM renderer link rendering is opt-in through `domRendererOptions.links`. Once enabled, DOM anchors allow safe absolute and relative targets such as `https:`, `http:`, `mailto:`, `/path`, `./path`, `../path`, `#hash`, and `?q=1`. Link callbacks preserve native browser behavior unless they return `false`.
|
|
327
93
|
|
|
328
|
-
|
|
329
|
-
- `focus` 由点击或 `v-focus` 触发,`blur` 由切换焦点或卸载触发
|
|
330
|
-
- `focusin/focusout` 可选支持,用于冒泡式焦点事件
|
|
94
|
+
CLI/stdout rendering uses OSC8 hyperlinks and keeps a stricter boundary: only safe absolute `https:`, `http:`, and `mailto:` hrefs are emitted by default. `file:` links stay opt-in for terminal-specific providers.
|
|
331
95
|
|
|
332
|
-
##
|
|
96
|
+
## Browser Usage
|
|
333
97
|
|
|
334
98
|
```vue
|
|
335
|
-
<
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
<TBox border />
|
|
339
|
-
</TView>
|
|
340
|
-
</TerminalProvider>
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
- `TerminalProvider`: 创建 terminal、绑定 renderer 和 event manager
|
|
344
|
-
- `TView`: 提供局部坐标系、事件区域、zIndex
|
|
345
|
-
- `TText`: 响应式写入文字
|
|
346
|
-
- `TBox`: 绘制边框、标题
|
|
347
|
-
|
|
348
|
-
## 通用组件与指令
|
|
349
|
-
|
|
350
|
-
- 通用组件:`TSelect`, `TInput`, `TList`, `TTable`, `TDialog`
|
|
351
|
-
- 指令:
|
|
352
|
-
- `v-if`: 条件渲染/卸载组件,释放 buffer 区域
|
|
353
|
-
- `v-show`: 仅隐藏展示,保持节点存在以保留事件与状态
|
|
354
|
-
- `v-model`: 绑定 `TInput` 文本与光标状态
|
|
355
|
-
- `v-focus`: 让组件获得焦点(键盘输入)
|
|
356
|
-
|
|
357
|
-
## 动态插入组件(命令式)
|
|
99
|
+
<script setup lang="ts">
|
|
100
|
+
import { ref } from "vue";
|
|
101
|
+
import { TerminalProvider, TBox, TInput, TText } from "@simon_he/vue-tui";
|
|
358
102
|
|
|
359
|
-
|
|
360
|
-
|
|
103
|
+
const input = ref("");
|
|
104
|
+
</script>
|
|
361
105
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
w: 20,
|
|
371
|
-
h: 6,
|
|
372
|
-
options: ['a', 'b', 'c'],
|
|
373
|
-
onSelect: (v) => console.log(v),
|
|
374
|
-
})
|
|
375
|
-
}
|
|
376
|
-
}
|
|
106
|
+
<template>
|
|
107
|
+
<TerminalProvider :cols="80" :rows="24" :default-style="{ fg: 'whiteBright' }">
|
|
108
|
+
<TBox :x="0" :y="0" :w="80" :h="24" border title="Demo" :padding="1">
|
|
109
|
+
<TText :x="0" :y="0" :w="78" value="Vue TUI is running" />
|
|
110
|
+
<TInput :x="0" :y="20" :w="78" v-model="input" placeholder="Type..." />
|
|
111
|
+
</TBox>
|
|
112
|
+
</TerminalProvider>
|
|
113
|
+
</template>
|
|
377
114
|
```
|
|
378
115
|
|
|
379
|
-
|
|
116
|
+
`TerminalProvider` wires the terminal buffer, DOM renderer, event manager, scheduler, runtime, layout context, and input plugins for browser Vue apps.
|
|
380
117
|
|
|
381
|
-
|
|
382
|
-
- 插入/卸载会触发局部重绘,不影响其它区域
|
|
118
|
+
## CLI Usage
|
|
383
119
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
- `mount()` 返回 handle,包含 `update()` / `unmount()` / `move()` 等操作
|
|
387
|
-
- 允许传入 `key` 复用实例,避免频繁销毁
|
|
388
|
-
- `TerminalProvider` 卸载时自动清理所有命令式节点
|
|
120
|
+
For a real terminal, mount a headless Vue app and attach stdout/stdin:
|
|
389
121
|
|
|
390
122
|
```ts
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
123
|
+
import {
|
|
124
|
+
createStdinDriver,
|
|
125
|
+
createStdoutRenderer,
|
|
126
|
+
createTerminalApp,
|
|
127
|
+
installTerminalCleanup,
|
|
128
|
+
type TerminalCleanupHandle,
|
|
129
|
+
} from "@simon_he/vue-tui/cli";
|
|
130
|
+
import App from "./App.vue";
|
|
131
|
+
|
|
132
|
+
const app = createTerminalApp({
|
|
133
|
+
cols: process.stdout.columns || 80,
|
|
134
|
+
rows: process.stdout.rows || 24,
|
|
135
|
+
component: App as any,
|
|
136
|
+
defaultStyle: { fg: "whiteBright" },
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
app.mount();
|
|
140
|
+
|
|
141
|
+
const renderer = createStdoutRenderer(app.terminal, {
|
|
142
|
+
output: process.stdout,
|
|
143
|
+
hideCursor: true,
|
|
144
|
+
colorMode: "auto",
|
|
145
|
+
allowFileUrls: true,
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
app.scheduler.flush();
|
|
149
|
+
|
|
150
|
+
let driver: ReturnType<typeof createStdinDriver> | null = null;
|
|
151
|
+
let terminalCleanup: TerminalCleanupHandle | null = null;
|
|
152
|
+
let disposed = false;
|
|
153
|
+
|
|
154
|
+
const cleanup = () => {
|
|
155
|
+
if (disposed) return;
|
|
156
|
+
disposed = true;
|
|
157
|
+
terminalCleanup?.uninstall();
|
|
158
|
+
driver?.dispose();
|
|
159
|
+
renderer.dispose();
|
|
160
|
+
app.dispose();
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const exit = () => {
|
|
164
|
+
cleanup();
|
|
165
|
+
process.exit(0);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
terminalCleanup = installTerminalCleanup(cleanup, {
|
|
169
|
+
signalPolicy: "reraise",
|
|
170
|
+
cleanupOnUnhandledRejection: false,
|
|
171
|
+
});
|
|
172
|
+
driver = createStdinDriver({
|
|
173
|
+
dispatch(event) {
|
|
174
|
+
const prevented = app.events.dispatch(event);
|
|
175
|
+
app.scheduler.flush();
|
|
176
|
+
return prevented;
|
|
177
|
+
},
|
|
178
|
+
enableMouse: true,
|
|
179
|
+
onExit: exit,
|
|
180
|
+
});
|
|
396
181
|
```
|
|
397
182
|
|
|
398
|
-
|
|
183
|
+
Signal cleanup restores terminal state first. `installTerminalCleanup()` returns a cleanup handle: call `handle.uninstall()` to remove process listeners without disposing the app, or `handle.cleanup()` to run cleanup manually. By default, signal handling uses `signalPolicy: "reraise"`: the helper cleans up, removes its own listeners, and re-sends the original signal when no other listener owns that signal. If the host process has other listeners for the same signal, those listeners keep ownership of termination. Set `signalPolicy: "cleanup-only"` only when the host explicitly owns termination, or `signalPolicy: "exit"` when vue-tui should exit with the conventional signal exit code after cleanup.
|
|
399
184
|
|
|
400
|
-
-
|
|
401
|
-
- 更新:清理旧区域 + 写入新内容,保持最小 dirty 范围
|
|
402
|
-
- 卸载:释放事件节点、清理 buffer 区域、移除焦点/输入绑定
|
|
185
|
+
Unhandled promise rejections stay host-owned by default. Setting `cleanupOnUnhandledRejection: true` cleans up and rethrows by default. Set `rethrowUnhandledRejection: false` only when the host explicitly wants to suppress the rejection.
|
|
403
186
|
|
|
404
|
-
|
|
187
|
+
## Core Concepts
|
|
405
188
|
|
|
406
|
-
- `
|
|
407
|
-
- `
|
|
189
|
+
- `createTerminal({ cols, rows })` owns the cell buffer, cursor, planes, scrollback, and commit events.
|
|
190
|
+
- `createDomRenderer(terminal, container)` renders terminal cells to DOM with row caching and fast paths for plain and styled rows.
|
|
191
|
+
- `createStdoutRenderer(terminal, options)` emits ANSI output for real terminal UIs from `/cli`.
|
|
192
|
+
- `TerminalProvider` is the browser-facing Vue runtime provider.
|
|
193
|
+
- `createTerminalApp()` is the headless runtime for CLI apps and deterministic tests.
|
|
194
|
+
- `TRenderPlane` separates transcript, chrome, input, and overlay surfaces so small updates do not repaint large panes.
|
|
408
195
|
|
|
409
|
-
##
|
|
196
|
+
## Components
|
|
410
197
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
-
|
|
414
|
-
- `
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
198
|
+
| Area | Import | Components / APIs |
|
|
199
|
+
| -------------- | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
200
|
+
| Stable layout | `@simon_he/vue-tui` | `TBox`, `TView` |
|
|
201
|
+
| Stable text | `@simon_he/vue-tui` | `TText` |
|
|
202
|
+
| Stable input | `@simon_he/vue-tui` | `TInput`, `TList`, `TSelect` |
|
|
203
|
+
| Stable overlay | `@simon_he/vue-tui` | `TDialog` |
|
|
204
|
+
| Vue extended | `@simon_he/vue-tui/vue` | `TAnchor`, `TFlow`, `TRenderPlane`, `TRenderLayer`, `TTransition`, `TInputBox`, `TPathPicker`, `TJsonEditor`, `TMultilineModal`, `TDebugOverlay`, composables, router APIs |
|
|
205
|
+
| Markdown | `@simon_he/vue-tui/markdown` | `TMarkdownText`, `TVirtualMarkdown` |
|
|
206
|
+
| Experimental | `@simon_he/vue-tui/experimental` | `TVirtualList`, `TLogView`, `TLogSearchBar`, `TLogLinksPanel`, `TLogScrollbar`, `TLogMinimap` |
|
|
207
|
+
| Runtime | `@simon_he/vue-tui/runtime` | runtime, event, and selection APIs |
|
|
208
|
+
| CLI | `@simon_he/vue-tui/cli` | `createTerminalApp`, `createStdoutRenderer`, `createStdinDriver`, Node host adapters |
|
|
418
209
|
|
|
419
|
-
|
|
210
|
+
See [docs/components.md](./docs/components.md) and [docs/generated/components-api.md](./docs/generated/components-api.md) for props and events.
|
|
420
211
|
|
|
421
|
-
|
|
422
|
-
- 仅焦点组件接收输入,支持全局快捷键注册
|
|
423
|
-
- 支持组合键与平台差异(macOS/Windows/Linux)
|
|
212
|
+
## Documentation
|
|
424
213
|
|
|
425
|
-
|
|
214
|
+
| Page | Purpose |
|
|
215
|
+
| ---------------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
216
|
+
| [Docs home](./docs/index.md) | Product overview and reading path |
|
|
217
|
+
| [Examples index](./docs/examples.md) | Browser, terminal, and smoke example commands |
|
|
218
|
+
| [Core API](./docs/api.md) | Terminal, renderer, events, runtime, planes, and scheduler contracts |
|
|
219
|
+
| [Performance](./docs/performance.md) | Practical performance guidance |
|
|
220
|
+
| [High-throughput rendering](./docs/high-throughput-rendering.md) | Scheduler, dirty rows, mailbox, log, and renderer architecture |
|
|
221
|
+
| [Component acceptance](./docs/components-acceptance.md) | Release readiness checks for component API and behavior |
|
|
222
|
+
| [Agent Console](./docs/agent-console.md) | Streaming transcript example stack |
|
|
223
|
+
| [Release candidate](./docs/release-candidate.md) | 1.0 RC validation, package export checks, and migration notes |
|
|
224
|
+
| [Security policy](./SECURITY.md) | Vulnerability reporting and terminal permission boundaries |
|
|
426
225
|
|
|
427
|
-
|
|
428
|
-
- 上下键切换选项,Enter 确认,Esc 取消
|
|
429
|
-
- `onOpen`/`onClose` 用于显示/隐藏下拉
|
|
430
|
-
- `TList`:
|
|
431
|
-
- 支持滚动、虚拟化(列表过长时)
|
|
432
|
-
- `TDialog`:
|
|
433
|
-
- 居中布局、遮罩区域、阻止底层事件
|
|
226
|
+
Run the docs locally:
|
|
434
227
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
- 布局建议:
|
|
440
|
-
- `TView` 支持 `w/h` 为百分比或 `auto`(依赖父容器)
|
|
441
|
-
- resize 时触发局部重排,避免全量重绘
|
|
442
|
-
|
|
443
|
-
## 布局与坐标系统(建议)
|
|
444
|
-
|
|
445
|
-
- 坐标系基于 cell 网格,所有位置/尺寸以整数为主
|
|
446
|
-
- 布局模式:
|
|
447
|
-
- `absolute`: `x/y/w/h` 明确指定
|
|
448
|
-
- `flow`: 垂直/水平流布局(简化版)
|
|
449
|
-
- `anchor`: 支持 `left/right/top/bottom` 锚定
|
|
450
|
-
- 约束:`minW/maxW/minH/maxH`,超出时裁剪
|
|
451
|
-
- 容器提供 `padding` 与 `clip`,子组件默认裁剪到内容区域
|
|
452
|
-
|
|
453
|
-
## 布局计算(简版规则)
|
|
454
|
-
|
|
455
|
-
- 先计算父容器 contentRect,再计算子组件布局
|
|
456
|
-
- `absolute` 优先:有明确 `x/y/w/h` 时直接裁剪
|
|
457
|
-
- `anchor` 次之:根据边距计算剩余空间
|
|
458
|
-
- `flow` 最后:按方向累积尺寸,支持 `gap` 与 `wrap`
|
|
459
|
-
- `auto` 尺寸:基于内容测量(文本/子组件)得到
|
|
460
|
-
|
|
461
|
-
## 带边框 Box 的内容保护
|
|
462
|
-
|
|
463
|
-
当 `TBox` 带边框时,需要保护内容区域不被破坏:
|
|
464
|
-
|
|
465
|
-
- 外框占 1 cell 边距,内容区域为 `(x+1, y+1, w-2, h-2)`
|
|
466
|
-
- 内容写入必须裁剪到内容区域,避免覆盖边框
|
|
467
|
-
- 当内容超出时,支持 `overflow: clip | scroll`
|
|
468
|
-
- 建议 `TBox` 内部提供 `padding` 与 `contentRect`,子组件写入基于 `contentRect`
|
|
228
|
+
```bash
|
|
229
|
+
pnpm run docs:dev
|
|
230
|
+
pnpm run docs:build
|
|
231
|
+
```
|
|
469
232
|
|
|
470
|
-
##
|
|
233
|
+
## Examples
|
|
471
234
|
|
|
472
|
-
|
|
473
|
-
-
|
|
474
|
-
|
|
235
|
+
```bash
|
|
236
|
+
pnpm -C examples/basic dev
|
|
237
|
+
pnpm run build:examples
|
|
238
|
+
pnpm run build:examples:terminal
|
|
239
|
+
pnpm run run:basic:terminal
|
|
240
|
+
pnpm run example:tlog-view-lab
|
|
241
|
+
pnpm run example:agent-console
|
|
242
|
+
pnpm run example:agent-console:smoke
|
|
243
|
+
pnpm run example:agent-console:terminal:smoke
|
|
244
|
+
```
|
|
475
245
|
|
|
476
|
-
|
|
246
|
+
The smoke commands are deterministic and avoid real LLM APIs, real TTY dependencies, and timing-only pass/fail gates.
|
|
477
247
|
|
|
478
|
-
|
|
479
|
-
- `batch()` 在同一帧内合并多个写入,减少 diff 次数
|
|
480
|
-
- 支持 `flush()` 立即渲染(用于调试或关键交互)
|
|
248
|
+
## Performance Notes
|
|
481
249
|
|
|
482
|
-
|
|
250
|
+
- Use `TVirtualList` instead of rendering thousands of row components.
|
|
251
|
+
- Use `TLogView` with `createAppendOnlyLogStore({ maxLines })` for retained streaming logs.
|
|
252
|
+
- Provide stable line keys for custom `TLogView` sources; mutable rows should change keys or call the explicit invalidation APIs.
|
|
253
|
+
- Split high-volume content and frequently changing chrome into different `TRenderPlane`s.
|
|
254
|
+
- Style objects are treated as immutable. Reuse stable style objects on hot paths, but pass a new object when a style changes.
|
|
483
255
|
|
|
484
|
-
|
|
485
|
-
- 设备像素比变化时重新测量并触发重排
|
|
486
|
-
- 支持固定 `cellSize` 覆盖测量结果(用于稳定布局)
|
|
256
|
+
Useful checks:
|
|
487
257
|
|
|
488
|
-
|
|
258
|
+
```bash
|
|
259
|
+
pnpm run bench:dom-renderer
|
|
260
|
+
pnpm run bench:scroll-mailbox
|
|
261
|
+
pnpm run bench:phase2
|
|
262
|
+
```
|
|
489
263
|
|
|
490
|
-
|
|
491
|
-
- 可先实现轻量解析器,后续切换到更完整的 ANSI 样式库(如 `ansis`)
|
|
264
|
+
## Issues And Feedback
|
|
492
265
|
|
|
493
|
-
|
|
266
|
+
- Report bugs: [new bug report](https://github.com/Simon-He95/vue-tui/issues/new?template=bug_report.yml)
|
|
267
|
+
- Request features: [new feature request](https://github.com/Simon-He95/vue-tui/issues/new?template=feature_request.yml)
|
|
268
|
+
- Report documentation issues: [new docs issue](https://github.com/Simon-He95/vue-tui/issues/new?template=docs.yml)
|
|
269
|
+
- Report vulnerabilities privately: [Security policy](./SECURITY.md)
|
|
270
|
+
- Browse existing issues: [GitHub issues](https://github.com/Simon-He95/vue-tui/issues)
|
|
494
271
|
|
|
495
|
-
|
|
496
|
-
- 宽字符占用 2 cell,后续 cell 标记为 continuation
|
|
497
|
-
- 无法渲染的字符使用占位符(如 `?`)并记录告警
|
|
272
|
+
For renderer, scheduler, or terminal behavior bugs, include the renderer target (`DOM`, `stdout`, or headless), the relevant command, and a minimal reproduction when possible.
|
|
498
273
|
|
|
499
|
-
##
|
|
274
|
+
## Development
|
|
500
275
|
|
|
501
|
-
|
|
502
|
-
- ANSI 颜色映射依赖主题,可热更新
|
|
503
|
-
- 允许组件局部覆盖主题(如 `TDialog`)
|
|
276
|
+
Use Node.js 20 for repository development, release validation, and documentation builds. This is a toolchain requirement, not the runtime requirement for the published package.
|
|
504
277
|
|
|
505
|
-
|
|
278
|
+
```bash
|
|
279
|
+
pnpm install
|
|
280
|
+
pnpm run format:check
|
|
281
|
+
pnpm run lint
|
|
282
|
+
pnpm run typecheck
|
|
283
|
+
pnpm run test
|
|
284
|
+
pnpm run build
|
|
285
|
+
```
|
|
506
286
|
|
|
507
|
-
|
|
508
|
-
- 选择:鼠标拖拽选区,支持跨行
|
|
509
|
-
- 剪贴板:复制/粘贴基于 Buffer 内容而非 DOM 文本
|
|
287
|
+
Release validation:
|
|
510
288
|
|
|
511
|
-
|
|
289
|
+
```bash
|
|
290
|
+
pnpm run release:dry-run
|
|
291
|
+
```
|
|
512
292
|
|
|
513
|
-
-
|
|
514
|
-
-
|
|
515
|
-
- 调度机制:统一 batch/commit,避免组件更新引发频繁重绘
|
|
516
|
-
- 事件映射:需基于字体度量映射 cell 坐标,resize 时重算
|
|
517
|
-
- 滚动与 resize:需要明确 scrollback 与重排策略
|
|
293
|
+
`release:dry-run` runs checks, tests, docs build, benchmarks, examples smoke, and packed package install smoke.
|
|
294
|
+
`release:ci` aliases `release:dry-run` for validation-only CI usage. The GitHub Release workflow is preferred because it publishes the already-verified tarball with npm provenance. If workflow token/provenance is unavailable, `release:local:dry-run` and `release:local` publish the locally verified tarball with the `rc` dist-tag. `release` and `release:workflow-only` intentionally fail to avoid accidental direct publishing.
|
|
518
295
|
|
|
519
|
-
##
|
|
296
|
+
## Package Notes
|
|
520
297
|
|
|
521
|
-
-
|
|
522
|
-
-
|
|
523
|
-
-
|
|
298
|
+
- The published package ships `dist` only.
|
|
299
|
+
- Root, core, runtime, DOM renderer, observability, Vue, CLI, markdown, and experimental entrypoints are available as ESM, CJS, and type declarations after build.
|
|
300
|
+
- The root browser/core API does not require a Node runtime, but CLI usage expects a Node-like stdout/stdin environment.
|
|
301
|
+
- Terminal emoji and East Asian width behavior still depends on the user terminal and font.
|
|
524
302
|
|
|
525
303
|
## License
|
|
526
304
|
|