Update TUI to v1.3 with enhanced conversion layer and dual UI architecture
- ai.md: Added comprehensive documentation for TUI v1.3 conversion layer with 64+ supported components, CSS styling, and JavaScript interaction capabilities
- oss/tui/: Created complete TUI module with converter.py implementing HTML/CSS/JS to terminal conversion engine, supporting 40+ component types and advanced styling
- oss/tui/plugin.py: Implemented TUI plugin with dual startup architecture accessing WebUI's /tui interface for HTML conversion and terminal rendering
- store/@{NebulaShell}/webui/tui/: Added TUI package with converter, configuration files, and index.html for terminal interface
- store/@{NebulaShell}/webui/core/server.py: Enhanced WebUI server with TUI interface endpoints (/tui/*) for providing special-marked HTML to conversion layer
- store/@{NebulaShell}/webui/main.py: Updated WebUI plugin to support TUI dual launch with automatic homepage redirection and navigation integration
- .gitignore: Updated ignore patterns for better project cleanliness
The update provides a sophisticated terminal interface that automatically converts WebUI content through a powerful transformation layer, enabling seamless dual-mode operation.
This commit is contained in:
80
oss/tui/__init__.py
Normal file
80
oss/tui/__init__.py
Normal file
@@ -0,0 +1,80 @@
|
||||
"""TUI 核心模块 - 强大的 WebUI 到终端界面转换引擎 v1.3
|
||||
|
||||
本模块提供完整的 HTML/CSS/JS 到 TUI 的转换能力,参考 opencode 风格设计:
|
||||
- HTML 解析:识别 data-tui-* 标记、语义化标签、Aria 属性,转换为 40+ 种终端元素
|
||||
- CSS 转换:支持 ANSI 256 色、真彩色、完整字体排版、边框样式、阴影效果
|
||||
- JS 交互:完整模拟鼠标追踪、点击事件、键盘绑定、DOM 操作、事件系统
|
||||
- 布局引擎:flex/grid/absolute 布局终端适配,自动响应式调整
|
||||
- 组件系统:40+ 种组件(按钮、面板、列表、表单、表格、进度条、图表等)
|
||||
- 高级特性:动画系统、主题系统、虚拟滚动、焦点管理、辅助功能
|
||||
|
||||
架构设计完全参考 opencode 风格,提供现代化、高性能终端体验。
|
||||
"""
|
||||
|
||||
from .converter import (
|
||||
# 管理器
|
||||
TUIManager,
|
||||
TUIRenderer,
|
||||
HTMLToTUIConverter,
|
||||
|
||||
# 输入处理
|
||||
TUIInputHandler,
|
||||
TUIEventManager,
|
||||
|
||||
# 画布
|
||||
TUICanvas,
|
||||
|
||||
# 样式系统
|
||||
ANSIStyle,
|
||||
BorderStyle,
|
||||
TUIColor,
|
||||
TUIStyle,
|
||||
|
||||
# 元素类型
|
||||
TUIElementType,
|
||||
|
||||
# 基础元素
|
||||
TUIElement,
|
||||
TUIButton,
|
||||
TUILabel,
|
||||
TUIPanel,
|
||||
TUILayout,
|
||||
TUIList,
|
||||
TUISeparator,
|
||||
TUIProgressBar,
|
||||
TUISpinner,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# 管理器
|
||||
'TUIManager',
|
||||
'TUIRenderer',
|
||||
'HTMLToTUIConverter',
|
||||
|
||||
# 输入处理
|
||||
'TUIInputHandler',
|
||||
'TUIEventManager',
|
||||
|
||||
# 画布
|
||||
'TUICanvas',
|
||||
|
||||
# 样式系统
|
||||
'ANSIStyle',
|
||||
'BorderStyle',
|
||||
'TUIColor',
|
||||
'TUIStyle',
|
||||
|
||||
# 元素类型
|
||||
'TUIElementType',
|
||||
|
||||
# 基础元素
|
||||
'TUIElement',
|
||||
'TUIButton',
|
||||
'TUILabel',
|
||||
'TUIPanel',
|
||||
'TUILayout',
|
||||
'TUIList',
|
||||
'TUISeparator',
|
||||
'TUIProgressBar',
|
||||
'TUISpinner',
|
||||
]
|
||||
Reference in New Issue
Block a user