Skip to main content

teksilo_widgets/styles/
recipe_grid_view_style.rs

1// SPDX-License-Identifier: MPL-2.0
2// SPDX-FileCopyrightText: 2026 FernTech
3
4//! Default [`GridViewStyle`] impl — the stock IntUI grid decoration.
5//!
6//! Every method falls through to the trait's default recipe (focus ring =
7//! `BorderRole::Focused` 1.5 px inset 1 px; marquee = translucent
8//! `Focused`; insertion bar = `BorderRole::Accent` 2 px; pinned header =
9//! `SurfaceRole::Raised`). Apps wanting a different look write their own
10//! `impl GridViewStyle` block and install it per-call (`GridView::style(...)`)
11//! or theme-wide (`theme.style_slots.grid_view = Some(Rc::new(...))`).
12
13use teksilo_core::styles::GridViewStyle;
14use teksilo_tokens::InputTokens;
15
16/// The stock grid decoration style. Unit struct — all chrome comes from the
17/// trait defaults.
18#[derive(Debug, Default, Clone, Copy)]
19pub struct RecipeGridViewStyle;
20
21impl RecipeGridViewStyle {
22    /// This style resolved against a density's [`InputTokens`], as
23    /// `RecipeGridViewStyle::for_tokens(&ctx.theme().input)` at the widget's own
24    /// build site.
25    ///
26    /// The style is a unit struct: every dimension it draws on comes from
27    /// the [`GridViewStyle`] trait defaults, none of which is a target or a
28    /// gap, so the projection is the identity at every density.
29    pub fn for_tokens(_tokens: &InputTokens) -> Self {
30        Self
31    }
32}
33
34impl GridViewStyle for RecipeGridViewStyle {}