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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["examples/showcase"]
resolver = "3"

[workspace.package]
version = "0.1.0"
version = "0.5.0"
edition = "2024"
rust-version = "1.95"
license = "MIT"
Expand All @@ -15,7 +15,7 @@ slint-build = "=1.19.1"

[package]
name = "tempo-ui"
description = "Rust helpers for the Tempo UI component library for Slint"
description = "Tempo UI — a crisp, cross-platform Slint component library and Rust host helpers"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
Expand All @@ -25,7 +25,7 @@ publish = false

[features]
default = []
finui-font-fallback = ["dep:slint"]
cjk-font-fallback = ["dep:slint"]

[dependencies]
slint = { workspace = true, optional = true, features = ["std", "unstable-fontique-012", "compat-1-2"] }
Expand Down
78 changes: 57 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,48 @@
# Tempo UI
# Tempo UI `v0.5.0`

Tempo UI is a Slint component library derived from FinUI. It includes themed controls, responsive navigation, dialogs and sheets, refreshable and reorderable lists, motion helpers, and a set of Fluent icons. The Slint components share a single import. The optional Rust helpers cover route history and CJK font fallback.
**Tempo UI** 是一套面向 Rust + Slint 跨平台应用的现代组件库,专注于克制的几何比例、清晰的多层表面对比与一致的交互动效,覆盖桌面宽屏与移动窄屏的完整使用场景。

![Tempo UI desktop component gallery](docs/images/catalog-desktop.png)

## Run the showcase
## 设计特色

Use Rust 1.95 or later and a desktop graphical session.
- **克制圆角与柔和配色**:采用 `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 上的汉字豆腐块与混排错字问题。

## 组件一览(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
```

| Arguments after `--` | Showcase |
| --- | --- |
| `--compact --dark` | Narrow dark layout |
| `--layout --wide` | Three-pane layout |
| `--lists` | Virtualized list, queue reordering, and action menu |
| `--music` | FMusic-inspired sample browser with simulated playback |
常用预览参数:

The showcase prefers FemtoVG and includes a software renderer. Set `SLINT_BACKEND=winit-software` to select software rendering. See the [narrow layout](docs/images/catalog-compact.png) and [list controls](docs/images/flutter-replacements-compact.png).
```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 # 移动端暗色
```

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

Add Tempo UI to your application checkout, for example under `vendor/TempoUI`. Use Slint and `slint-build` 1.19.1 to match the tested version. Register the library entry from your application's `build.rs`.
## 快速接入

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

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

在 `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, TempoTheme } from "@tempo-ui";
import { TempoButton, TempoCard, TempoTheme } from "@tempo-ui";

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

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

The [showcase build script](examples/showcase/build.rs) uses this same import mechanism. For Rust route history, add `tempo-ui = { path = "vendor/TempoUI" }` under `[dependencies]`. Enable the `finui-font-fallback` feature to use `tempo_ui::fonts::configure_finui_fallbacks()` before constructing a window.

## Verification
## 验证与测试

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

The smoke checks require a graphical session and cover wide and narrow layouts, keyboard and pointer input, overlays, refresh, list virtualization, and animations. GitHub Actions runs the software-renderer checks on Linux. See the [FinUI component mapping](docs/PORTING.md) and [Flutter-to-Slint implementation notes](docs/REPLACEMENTS.md) for the scope of platform-specific behavior.
## 致谢

- 衷心感谢 **[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 引擎。

## License
## 许可证

Tempo UI uses the [MIT license](LICENSE). Attribution for the FinUI adaptation and Microsoft Fluent System Icons is in [LICENSES](LICENSES/).
本项目基于 [MIT License](LICENSE) 开源。第三方声明见 [LICENSES](LICENSES/)。
59 changes: 0 additions & 59 deletions docs/PORTING.md

This file was deleted.

30 changes: 0 additions & 30 deletions docs/REPLACEMENTS.md

This file was deleted.

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 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 removed docs/images/flutter-replacements-compact.png
Binary file not shown.
Binary file added 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.
2 changes: 1 addition & 1 deletion examples/showcase/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repository.workspace = true
publish = false

[dependencies]
tempo-ui = { path = "../..", features = ["finui-font-fallback"] }
tempo-ui = { path = "../..", features = ["cjk-font-fallback"] }
slint = { workspace = true, features = ["std", "backend-winit", "renderer-femtovg", "renderer-software", "accessibility", "compat-1-2"] }
png = "0.18"

Expand Down
3 changes: 2 additions & 1 deletion examples/showcase/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ fn main() {
let config = slint_build::CompilerConfiguration::new()
.with_library_paths(libraries)
.embed_resources(slint_build::EmbedResourcesKind::EmbedFiles);
slint_build::compile_with_config("ui/demo.slint", config).expect("compile Tempo UI showcase");
slint_build::compile_with_config("ui/catalog.slint", config)
.expect("compile Tempo UI showcase");
}
Loading
Loading