Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 42 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,56 @@
# Tempo UI `v0.5.0`

**Tempo UI** 是一套面向 Rust + Slint 跨平台应用的现代组件库,专注于克制的几何比例、清晰的多层表面对比与一致的交互动效,覆盖桌面宽屏与移动窄屏的完整使用场景。
**English** | [简体中文](README.zh-CN.md)

![Tempo UI desktop component gallery](docs/images/catalog-desktop.png)
**Tempo UI** is a modern, cross-platform component library for Rust + Slint applications. It focuses on restrained geometry, crisp `1px` borders, layered light/dark surfaces, and cohesive decelerated motion across both desktop and mobile viewports.

## 设计特色
![Tempo UI Desktop & Mobile Overview](docs/images/catalog-desktop.png)

- **克制圆角与柔和配色**:采用 `4px / 6px / 8px / 10px` 克制圆角与清晰 `1px` 描边;亮/暗两套主题均避免刺眼的纯白(`#FFFFFF`)与纯黑(`#000000`),通过画布、侧边栏、卡片与浮层四级表面色自然拉开空间层次。
- **桌面与移动一体化适配**:`TempoNavigationShell` 自动在桌面展开侧边栏、窄 Rail(含贴底统一页面切换的 `footer-destinations`)与移动端底部导航栏之间切换;`TempoToastHost` 在桌面端以右上角通知卡片展示,在移动端以底部居中紧凑条展示;`TempoTransfer`、`TempoDatePicker`、`TempoTimePicker` 均内置窄屏布局与视口边界防溢出。
- **统一动效体系**:全库统一使用快速响应、平滑落位的减速缓动曲线,提供 `TempoRouteTransition`(`none` / `fade-through` / `shared-axis-x` / `shared-axis-y`)及全局 `TempoMotionSettings.reduced` 减弱动态开关。
- **跨平台 CJK 字体回退**:内置 `tempo_ui::fonts::configure_cjk_fallbacks()`,为 Slint/fontique 补全简体/繁体中文、日文、韩文的多区域与通用无衬线回退链,解决 Linux / Windows / macOS / Android 上的汉字豆腐块与混排错字问题。
## Highlights

## 组件一览(58+)
- **Restrained Geometry & Soft Layered Surfaces**: Compact `4px / 6px / 8px / 10px` radii and crisp hairline borders. Both light and dark themes avoid harsh pure white (`#FFFFFF`) and pure black (`#000000`), separating canvas, navigation rail, cards, and elevated overlays cleanly.
- **Unified Desktop & Mobile Adaptation**: `TempoNavigationShell` seamlessly adapts between an expanded desktop sidebar, a compact navigation rail (with bottom-pinned unified `footer-destinations`), and a mobile bottom bar. `TempoToastHost` renders as a top-right notification card on desktop and a compact bottom bar on mobile; pickers and `TempoTransfer` automatically adapt to narrow viewports.
- **Cohesive Motion System**: Standardized decelerated easing across transitions, drawers, dialogs, dropdowns, and sliding controls, with `TempoRouteTransition` (`none` / `fade-through` / `shared-axis-x` / `shared-axis-y`) and global `TempoMotionSettings.reduced` support.
- **Cross-Platform CJK Font Fallbacks**: Built-in `tempo_ui::fonts::configure_cjk_fallbacks()` configures locale-aware Simplified/Traditional Chinese, Japanese, and Korean fallback chains plus `GenericFamily::SansSerif` for Slint/fontique across Linux, Windows, macOS, and Android.

| 分类 | 组件 |
### Dark Theme & Mobile Layouts

![Tempo UI Dark Desktop](docs/images/catalog-desktop-dark.png)

![Tempo UI Mobile Light, Dark, and Lists](docs/images/catalog-compact.png)

## Component Inventory (58+)

| Category | Components |
| :--- | :--- |
| **按钮与操作** | `TempoButton`(7 种语义变体)、`TempoIconButton`、`TempoSplitButton`、`TempoFloatingActionButton`、`TempoLink`、`TempoMenuButton` |
| **表单与选择** | `TempoTextField`(内置清除与密码显隐)、`TempoTextArea`、`TempoSearch`、`TempoComboBox`、`TempoDatePicker`、`TempoTimePicker`、`TempoCheckBox`、`TempoRadioButton`、`TempoSwitch`、`TempoSpinBox`、`TempoSlider`、`TempoRangeSlider`、`TempoRate`、`TempoChip`、`TempoColorPicker`、`TempoSelectionTile`、`TempoRadioTile`、`TempoSwitchTile`、`TempoSegmentedControl` |
| **导航与布局** | `TempoNavigationShell`、`TempoNav`、`TempoAppBar`、`TempoPageHead`、`TempoPage`、`TempoAdaptiveSplit`、`TempoSplitPane`、`TempoTabBar`、`TempoButtonGroupTabBar`、`TempoBreadcrumb`、`TempoPagination`、`TempoStepBar`、`TempoIndexedStack`、`TempoVirtualList`、`TempoReorderList`、`TempoRefresh` |
| **反馈与浮层** | `TempoDialog`、`TempoSheet`、`TempoDrawer`、`TempoPopover`、`TempoImageViewer`、`TempoToastHost`、`TempoInfoBar`、`TempoBanner`、`TempoProgressBar`、`TempoProgressRing`、`TempoLoadingOverlay`、`TempoEmptyState`、`TempoSkeleton` |
| **数据与展示** | `TempoSurface`、`TempoClickableSurface`、`TempoCard`、`TempoSection`、`TempoTile`、`TempoExpander`、`TempoTable`、`TempoTreeView`、`TempoCalendar`、`TempoCarousel`、`TempoTransfer`、`TempoTimeline`、`TempoStatCard`、`TempoKeyValue`、`TempoAvatar`、`TempoBadge`、`TempoTag`、`TempoStatusDot`、`TempoKeyCap`、`TempoDivider` |
| **Actions & Buttons** | `TempoButton` (7 semantic variants), `TempoIconButton`, `TempoSplitButton`, `TempoFloatingActionButton`, `TempoLink`, `TempoMenuButton` |
| **Inputs & Selection** | `TempoTextField` (clear button & password reveal), `TempoTextArea`, `TempoSearch`, `TempoComboBox`, `TempoDatePicker`, `TempoTimePicker`, `TempoCheckBox`, `TempoRadioButton`, `TempoSwitch`, `TempoSpinBox`, `TempoSlider`, `TempoRangeSlider`, `TempoRate`, `TempoChip`, `TempoColorPicker`, `TempoSelectionTile`, `TempoRadioTile`, `TempoSwitchTile`, `TempoSegmentedControl` |
| **Navigation & Layout** | `TempoNavigationShell`, `TempoNav`, `TempoAppBar`, `TempoPageHead`, `TempoPage`, `TempoAdaptiveSplit`, `TempoSplitPane`, `TempoTabBar`, `TempoButtonGroupTabBar`, `TempoBreadcrumb`, `TempoPagination`, `TempoStepBar`, `TempoIndexedStack`, `TempoVirtualList`, `TempoReorderList`, `TempoRefresh` |
| **Feedback & Overlays** | `TempoDialog`, `TempoSheet`, `TempoDrawer`, `TempoPopover`, `TempoImageViewer`, `TempoToastHost`, `TempoInfoBar`, `TempoBanner`, `TempoProgressBar`, `TempoProgressRing`, `TempoLoadingOverlay`, `TempoEmptyState`, `TempoSkeleton` |
| **Data & Display** | `TempoSurface`, `TempoClickableSurface`, `TempoCard`, `TempoSection`, `TempoTile`, `TempoExpander`, `TempoTable`, `TempoTreeView`, `TempoCalendar`, `TempoCarousel`, `TempoTransfer`, `TempoTimeline`, `TempoStatCard`, `TempoKeyValue`, `TempoAvatar`, `TempoBadge`, `TempoTag`, `TempoStatusDot`, `TempoKeyCap`, `TempoDivider` |

## 运行 Showcase
## Run the Showcase

需要 Rust 1.95+ 及图形环境:
Requires Rust 1.95+ and a graphical session:

```sh
cargo run --release --locked -p tempo-ui-showcase
```

常用预览参数:
Preview presets:

```sh
cargo run -p tempo-ui-showcase -- --dark # 暗色桌面
cargo run -p tempo-ui-showcase -- --wide # 宽屏展开侧边栏与三栏布局
cargo run -p tempo-ui-showcase -- --compact # 移动端窄屏布局
cargo run -p tempo-ui-showcase -- --compact --dark # 移动端暗色
cargo run -p tempo-ui-showcase -- --dark # Dark desktop
cargo run -p tempo-ui-showcase -- --wide # Wide expanded sidebar & three-pane split
cargo run -p tempo-ui-showcase -- --compact # Compact mobile light
cargo run -p tempo-ui-showcase -- --compact --dark # Compact mobile dark
```

支持 FemtoVG 与软件渲染器,可通过 `SLINT_BACKEND=winit-software` 切换软件渲染。
Both FemtoVG and software rendering are supported (`SLINT_BACKEND=winit-software`).

## 快速接入
## Quick Start

在应用 `build.rs` 中注册 `@tempo-ui` 库入口(推荐匹配 Slint `1.19.1`):
Register the `@tempo-ui` library path in your application's `build.rs` (tested with Slint `1.19.1`):

```rust
use std::{collections::HashMap, env, path::PathBuf};
Expand All @@ -58,17 +66,17 @@ fn main() {
}
```

在 `main.rs` 创建窗口前启用 CJK 字体回退(开启 `cjk-font-fallback` feature):
Enable CJK font fallbacks before constructing your Slint window (with the `cjk-font-fallback` feature):

```rust
fn main() -> Result<(), Box<dyn std::error::Error>> {
tempo_ui::fonts::configure_cjk_fallbacks()?;
// 创建并运行 Slint 窗口...
// Create and run your Slint window...
Ok(())
}
```

在 `.slint` 中直接导入组件:
Import components directly in `.slint`:

```slint
import { TempoButton, TempoCard, TempoTheme } from "@tempo-ui";
Expand All @@ -86,19 +94,19 @@ export component App inherits Window {
}
```

## 验证与测试
## Verification

```sh
cargo test --workspace --locked
./scripts/check.sh
```

## 致谢
## Acknowledgements

- 衷心感谢 **[HandyControl](https://github.com/HandyOrg/HandyControl)**(WPF 开源控件库):Tempo UI `v0.5.0` 的视觉语言、克制圆角比例、亮暗色彩分层、Growl 通知、语义色体系及大量桌面组件设计均深受 HandyControl 启发。
- 感谢 **Microsoft Fluent Design** 与 **Fluent System Icons** 提供的交互规范与图标资源。
- 感谢 **Material Design 3** 的动效规范与 **Slint** 团队打造的跨平台 UI 引擎。
- Special thanks to **[HandyControl](https://github.com/HandyOrg/HandyControl)** for inspiring many of our desktop control patterns, semantic color hierarchies, restrained corner proportions, and notification ergonomics.
- Thanks to **Microsoft Fluent Design** and **Fluent System Icons** for interaction inspiration and the icon set.
- Thanks to **Material Design 3** for motion principles and the **Slint** team for the cross-platform UI toolkit.

## 许可证
## License

本项目基于 [MIT License](LICENSE) 开源。第三方声明见 [LICENSES](LICENSES/)。
Tempo UI is licensed under the [MIT License](LICENSE). Third-party notices are available in [LICENSES](LICENSES/).
112 changes: 112 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Tempo UI `v0.5.0`

[English](README.md) | **简体中文**

**Tempo UI** 是一套面向 Rust + Slint 跨平台应用的现代组件库,专注于克制的几何比例、清晰的多层表面对比与一致的交互动效,覆盖桌面宽屏与移动窄屏的完整使用场景。

![Tempo UI 桌面与移动端总览](docs/images/catalog-desktop.png)

## 设计特色

- **克制圆角与柔和配色**:采用 `4px / 6px / 8px / 10px` 克制圆角与清晰 `1px` 描边;亮/暗两套主题均避免刺眼的纯白(`#FFFFFF`)与纯黑(`#000000`),通过画布、侧边栏、卡片与浮层四级表面色自然拉开空间层次。
- **桌面与移动一体化适配**:`TempoNavigationShell` 自动在桌面展开侧边栏、窄 Rail(含贴底统一页面切换的 `footer-destinations`)与移动端底部导航栏之间切换;`TempoToastHost` 在桌面端以右上角通知卡片展示,在移动端以底部居中紧凑条展示;`TempoTransfer`、`TempoDatePicker`、`TempoTimePicker` 均内置窄屏布局与视口边界防溢出。
- **统一动效体系**:全库统一使用快速响应、平滑落位的减速缓动曲线,提供 `TempoRouteTransition`(`none` / `fade-through` / `shared-axis-x` / `shared-axis-y`)及全局 `TempoMotionSettings.reduced` 减弱动态开关。
- **跨平台 CJK 字体回退**:内置 `tempo_ui::fonts::configure_cjk_fallbacks()`,为 Slint/fontique 补全简体/繁体中文、日文、韩文的多区域与通用无衬线回退链,解决 Linux / Windows / macOS / Android 上的汉字豆腐块与混排错字问题。

### 暗色桌面与移动端布局

![Tempo UI 暗色桌面](docs/images/catalog-desktop-dark.png)

![Tempo UI 移动端亮色、暗色与列表](docs/images/catalog-compact.png)

## 组件一览(58+)

| 分类 | 组件 |
| :--- | :--- |
| **按钮与操作** | `TempoButton`(7 种语义变体)、`TempoIconButton`、`TempoSplitButton`、`TempoFloatingActionButton`、`TempoLink`、`TempoMenuButton` |
| **表单与选择** | `TempoTextField`(内置清除与密码显隐)、`TempoTextArea`、`TempoSearch`、`TempoComboBox`、`TempoDatePicker`、`TempoTimePicker`、`TempoCheckBox`、`TempoRadioButton`、`TempoSwitch`、`TempoSpinBox`、`TempoSlider`、`TempoRangeSlider`、`TempoRate`、`TempoChip`、`TempoColorPicker`、`TempoSelectionTile`、`TempoRadioTile`、`TempoSwitchTile`、`TempoSegmentedControl` |
| **导航与布局** | `TempoNavigationShell`、`TempoNav`、`TempoAppBar`、`TempoPageHead`、`TempoPage`、`TempoAdaptiveSplit`、`TempoSplitPane`、`TempoTabBar`、`TempoButtonGroupTabBar`、`TempoBreadcrumb`、`TempoPagination`、`TempoStepBar`、`TempoIndexedStack`、`TempoVirtualList`、`TempoReorderList`、`TempoRefresh` |
| **反馈与浮层** | `TempoDialog`、`TempoSheet`、`TempoDrawer`、`TempoPopover`、`TempoImageViewer`、`TempoToastHost`、`TempoInfoBar`、`TempoBanner`、`TempoProgressBar`、`TempoProgressRing`、`TempoLoadingOverlay`、`TempoEmptyState`、`TempoSkeleton` |
| **数据与展示** | `TempoSurface`、`TempoClickableSurface`、`TempoCard`、`TempoSection`、`TempoTile`、`TempoExpander`、`TempoTable`、`TempoTreeView`、`TempoCalendar`、`TempoCarousel`、`TempoTransfer`、`TempoTimeline`、`TempoStatCard`、`TempoKeyValue`、`TempoAvatar`、`TempoBadge`、`TempoTag`、`TempoStatusDot`、`TempoKeyCap`、`TempoDivider` |

## 运行 Showcase

需要 Rust 1.95+ 及图形环境:

```sh
cargo run --release --locked -p tempo-ui-showcase
```

常用预览参数:

```sh
cargo run -p tempo-ui-showcase -- --dark # 暗色桌面
cargo run -p tempo-ui-showcase -- --wide # 宽屏展开侧边栏与三栏布局
cargo run -p tempo-ui-showcase -- --compact # 移动端窄屏布局
cargo run -p tempo-ui-showcase -- --compact --dark # 移动端暗色
```

支持 FemtoVG 与软件渲染器,可通过 `SLINT_BACKEND=winit-software` 切换软件渲染。

## 快速接入

在应用 `build.rs` 中注册 `@tempo-ui` 库入口(推荐匹配 Slint `1.19.1`):

```rust
use std::{collections::HashMap, env, path::PathBuf};

fn main() {
let project = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let libraries = HashMap::from([(
"tempo-ui".into(),
project.join("vendor/TempoUI/ui/index.slint"),
)]);
let config = slint_build::CompilerConfiguration::new().with_library_paths(libraries);
slint_build::compile_with_config("ui/main.slint", config).unwrap();
}
```

在 `main.rs` 创建窗口前启用 CJK 字体回退(开启 `cjk-font-fallback` feature):

```rust
fn main() -> Result<(), Box<dyn std::error::Error>> {
tempo_ui::fonts::configure_cjk_fallbacks()?;
// 创建并运行 Slint 窗口...
Ok(())
}
```

在 `.slint` 中直接导入组件:

```slint
import { TempoButton, TempoCard, TempoTheme } from "@tempo-ui";

export component App inherits Window {
background: TempoTheme.background;

VerticalLayout {
padding: 16px;
TempoCard {
title: "Hello Tempo UI";
TempoButton { label: "Continue"; }
}
}
}
```

## 验证与测试

```sh
cargo test --workspace --locked
./scripts/check.sh
```

## 致谢

- 衷心感谢 **[HandyControl](https://github.com/HandyOrg/HandyControl)**(WPF 开源控件库):Tempo UI `v0.5.0` 的视觉语言、克制圆角比例、亮暗色彩分层、通知交互、语义色体系及大量桌面组件设计均深受 HandyControl 启发。
- 感谢 **Microsoft Fluent Design** 与 **Fluent System Icons** 提供的交互规范与图标资源。
- 感谢 **Material Design 3** 的动效规范与 **Slint** 团队打造的跨平台 UI 引擎。

## 许可证

本项目基于 [MIT License](LICENSE) 开源。第三方声明见 [LICENSES](LICENSES/)。
Binary file modified docs/images/catalog-compact.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/catalog-desktop-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/catalog-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/list-controls-compact.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading