Skip to content
Closed
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
8 changes: 8 additions & 0 deletions .cargo/audit.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[advisories]
# quick-xml is pinned by vendored wayland-scanner and zed-scap; compatible refresh is blocked upstream.
# crossbeam-epoch is pinned by the vendored Zed snapshot; compatible refresh is blocked upstream.
ignore = [
"RUSTSEC-2026-0194",
"RUSTSEC-2026-0195",
"RUSTSEC-2026-0204",
]
19 changes: 17 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,22 @@ jobs:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25
with:
command: check licenses bans
command: check advisories licenses bans sources

# Keep cargo-audit output visible while the pinned vendored snapshot carries
# the advisories recorded in deny.toml. This is informational until the
# dependency refresh removes those exceptions.
audit:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- uses: dtolnay/rust-toolchain@d124f86f28ff42855784ff3319f48ac182c248f8
- uses: taiki-e/install-action@97888a140839b7239d62fbf6af4e20adb5be3666
with:
tool: cargo-audit
- name: Cargo audit
run: cargo audit

# fluent-* zed-rev metadata equals vendor/zed/UPSTREAM.md (CONTRIBUTING.md §4).
zed-rev:
Expand All @@ -105,7 +120,7 @@ jobs:
# The one required check: Windows and Linux tests plus every guard.
ci:
if: always()
needs: [test, examples-and-docs, layering, deny, zed-rev]
needs: [test, examples-and-docs, layering, deny, audit, zed-rev]
runs-on: ubuntu-latest
steps:
- name: All jobs passed
Expand Down
18 changes: 9 additions & 9 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions crates/fluent-app/src/app_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub struct FluentApp {
}

impl FluentApp {
/// Public API item.
pub fn new(title: impl Into<SharedString>) -> Self {
Self {
title: title.into(),
Expand All @@ -95,12 +96,14 @@ impl FluentApp {
}
}

/// Public API item.
pub fn window_size(mut self, w: f32, h: f32) -> Self {
self.window_w = w;
self.window_h = h;
self
}

/// Public API item.
pub fn window_min_size(mut self, w: f32, h: f32) -> Self {
self.window_min_size = Some((w, h));
self
Expand Down Expand Up @@ -129,11 +132,13 @@ impl FluentApp {
self
}

/// Public API item.
pub fn dark_theme(mut self) -> Self {
self.theme_mode = ThemeMode::Dark;
self
}

/// Public API item.
pub fn light_theme(mut self) -> Self {
self.theme_mode = ThemeMode::Light;
self
Expand All @@ -145,6 +150,7 @@ impl FluentApp {
self
}

/// Public API item.
pub fn assets(mut self, assets: impl AssetSource) -> Self {
self.assets = Some(Arc::new(assets));
self
Expand Down
1 change: 1 addition & 0 deletions crates/fluent-app/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub struct FluentAssets {
}

impl FluentAssets {
/// Public API item.
pub fn new(fallback: Option<Arc<dyn AssetSource>>) -> Self {
Self { fallback }
}
Expand Down
1 change: 1 addition & 0 deletions crates/fluent-app/src/chrome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct WindowChrome<V: Render + 'static> {
}

impl<V: Render + 'static> WindowChrome<V> {
/// Public API item.
pub fn new(content: Entity<V>) -> Self {
Self { content }
}
Expand Down
3 changes: 3 additions & 0 deletions crates/fluent-app/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! Public API for this crate.
#![deny(missing_docs)]

mod app_builder;
mod assets;
mod chrome;
Expand Down
9 changes: 9 additions & 0 deletions crates/fluent-app/src/pickers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct ExtensionFilter {
}

impl ExtensionFilter {
/// Public API item.
pub fn new(
label: impl Into<SharedString>,
extensions: impl IntoIterator<Item = impl Into<String>>,
Expand All @@ -34,10 +35,12 @@ impl ExtensionFilter {
}
}

/// Public API item.
pub fn label(&self) -> &SharedString {
&self.label
}

/// Public API item.
pub fn extensions(&self) -> &[String] {
&self.extensions
}
Expand Down Expand Up @@ -161,6 +164,7 @@ pub struct FilePickerField {
}

impl FilePickerField {
/// Public API item.
pub fn new(id: impl Into<ElementId>) -> Self {
Self {
id: id.into(),
Expand All @@ -172,26 +176,31 @@ impl FilePickerField {
}
}

/// Public API item.
pub fn path(mut self, path: impl Into<PathBuf>) -> Self {
self.path = Some(path.into());
self
}

/// Public API item.
pub fn placeholder(mut self, placeholder: impl Into<SharedString>) -> Self {
self.placeholder = placeholder.into();
self
}

/// Public API item.
pub fn browse_label(mut self, label: impl Into<SharedString>) -> Self {
self.browse_label = label.into();
self
}

/// Public API item.
pub fn disabled(mut self, disabled: bool) -> Self {
self.disabled = disabled;
self
}

/// Public API item.
pub fn on_browse(
mut self,
handler: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
Expand Down
8 changes: 8 additions & 0 deletions crates/fluent-app/src/title_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@ const DOUBLE_CLICK_WINDOW_MS: u64 = 350;
/// window controls (min/max/close) on the right. Enable frameless mode with
/// `TitlebarOptions { appears_transparent: true }` + `WindowDecorations::Client`.
pub struct TitleBar {
/// Public API item.
pub title: SharedString,
/// Public API item.
pub icon: Option<SharedString>,
/// Public API item.
pub show_controls: bool,
follow_window_title: bool,
last_press_ms: u64,
}

impl TitleBar {
/// Public API item.
pub fn new(cx: &mut Context<Self>, title: impl Into<SharedString>) -> Self {
cx.observe_global::<Theme>(|_, cx| cx.notify()).detach();
cx.observe_global::<LayoutDirection>(|_, cx| cx.notify())
Expand All @@ -39,6 +43,7 @@ impl TitleBar {
}
}

/// Public API item.
pub fn from_window_title(cx: &mut Context<Self>) -> Self {
let title = cx
.try_global::<WindowTitle>()
Expand All @@ -48,17 +53,20 @@ impl TitleBar {
Self::new(cx, title).follow_window_title(true)
}

/// Public API item.
pub fn set_title(&mut self, title: impl Into<SharedString>, cx: &mut Context<Self>) {
self.title = title.into();
self.follow_window_title = false;
cx.notify();
}

/// Public API item.
pub fn show_controls(mut self, show: bool) -> Self {
self.show_controls = show;
self
}

/// Public API item.
pub fn follow_window_title(mut self, follow: bool) -> Self {
self.follow_window_title = follow;
self
Expand Down
8 changes: 8 additions & 0 deletions crates/fluent-app/src/window_title.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,36 @@ pub struct WindowTitle {
impl Global for WindowTitle {}

impl WindowTitle {
/// Public API item.
pub fn new(title: impl Into<SharedString>) -> Self {
Self {
title: title.into(),
status: None,
}
}

/// Public API item.
pub fn with_status(mut self, status: impl Into<SharedString>) -> Self {
self.status = Some(status.into());
self
}

/// Public API item.
pub fn title(&self) -> &SharedString {
&self.title
}

/// Public API item.
pub fn status(&self) -> Option<&SharedString> {
self.status.as_ref()
}

/// Public API item.
pub fn init(cx: &mut App, title: impl Into<SharedString>) {
cx.set_global(Self::new(title));
}

/// Public API item.
pub fn set_title(cx: &mut App, title: impl Into<SharedString>) {
if cx.has_global::<Self>() {
cx.global_mut::<Self>().title = title.into();
Expand All @@ -45,6 +51,7 @@ impl WindowTitle {
}
}

/// Public API item.
pub fn set_status(cx: &mut App, status: impl Into<SharedString>) {
if cx.has_global::<Self>() {
cx.global_mut::<Self>().status = Some(status.into());
Expand All @@ -53,6 +60,7 @@ impl WindowTitle {
}
}

/// Public API item.
pub fn clear_status(cx: &mut App) {
if cx.has_global::<Self>() {
cx.global_mut::<Self>().status = None;
Expand Down
Loading
Loading