From fb9a3836b130942c0c219e2de5fa4f3a9ac2c267 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Fri, 13 Jan 2023 17:08:45 +0000 Subject: [PATCH 1/7] Move most of kas_theme to kas_core::theme --- .../src => kas-core/src/theme}/anim.rs | 4 +-- .../src => kas-core/src/theme}/colors.rs | 8 +++--- .../src => kas-core/src/theme}/config.rs | 7 +++-- .../src/theme/dimensions.rs} | 26 +++++++++---------- crates/kas-core/src/theme/mod.rs | 17 ++++++++++++ .../src => kas-core/src/theme}/multi.rs | 12 ++++----- .../src => kas-core/src/theme}/theme_dst.rs | 8 +++--- .../src => kas-core/src/theme}/traits.rs | 14 +++++----- crates/kas-theme/src/flat_theme.rs | 4 ++- crates/kas-theme/src/lib.rs | 15 ----------- crates/kas-theme/src/shaded_theme.rs | 5 ++-- crates/kas-theme/src/simple_theme.rs | 3 ++- crates/kas-wgpu/src/draw/draw_pipe.rs | 2 +- crates/kas-wgpu/src/draw/text_pipe.rs | 2 +- crates/kas-wgpu/src/event_loop.rs | 6 ++--- crates/kas-wgpu/src/lib.rs | 10 +++---- crates/kas-wgpu/src/options.rs | 2 +- crates/kas-wgpu/src/shared.rs | 4 +-- crates/kas-wgpu/src/window.rs | 10 +++---- 19 files changed, 82 insertions(+), 77 deletions(-) rename crates/{kas-theme/src => kas-core/src/theme}/anim.rs (98%) rename crates/{kas-theme/src => kas-core/src/theme}/colors.rs (99%) rename crates/{kas-theme/src => kas-core/src/theme}/config.rs (98%) rename crates/{kas-theme/src/dim.rs => kas-core/src/theme/dimensions.rs} (96%) rename crates/{kas-theme/src => kas-core/src/theme}/multi.rs (94%) rename crates/{kas-theme/src => kas-core/src/theme}/theme_dst.rs (95%) rename crates/{kas-theme/src => kas-core/src/theme}/traits.rs (93%) diff --git a/crates/kas-theme/src/anim.rs b/crates/kas-core/src/theme/anim.rs similarity index 98% rename from crates/kas-theme/src/anim.rs rename to crates/kas-core/src/theme/anim.rs index 9eb784dac..7be58be46 100644 --- a/crates/kas-theme/src/anim.rs +++ b/crates/kas-core/src/theme/anim.rs @@ -5,8 +5,8 @@ //! Animation helpers -use kas::draw::DrawImpl; -use kas::WidgetId; +use crate::draw::DrawImpl; +use crate::WidgetId; use std::marker::PhantomData; use std::time::{Duration, Instant}; diff --git a/crates/kas-theme/src/colors.rs b/crates/kas-core/src/theme/colors.rs similarity index 99% rename from crates/kas-theme/src/colors.rs rename to crates/kas-core/src/theme/colors.rs index 0271bce3e..ac392f57f 100644 --- a/crates/kas-theme/src/colors.rs +++ b/crates/kas-core/src/theme/colors.rs @@ -5,10 +5,10 @@ //! Colour schemes -use kas::draw::color::{Rgba, Rgba8Srgb}; -use kas::event::EventState; -use kas::theme::Background; -use kas::WidgetId; +use crate::draw::color::{Rgba, Rgba8Srgb}; +use crate::event::EventState; +use crate::theme::Background; +use crate::WidgetId; use std::str::FromStr; const MULT_DEPRESS: f32 = 0.75; diff --git a/crates/kas-theme/src/config.rs b/crates/kas-core/src/theme/config.rs similarity index 98% rename from crates/kas-theme/src/config.rs rename to crates/kas-core/src/theme/config.rs index 87c78a107..4d36d9c4a 100644 --- a/crates/kas-theme/src/config.rs +++ b/crates/kas-core/src/theme/config.rs @@ -5,10 +5,9 @@ //! Theme configuration -use crate::{ColorsSrgb, ThemeConfig}; -use kas::text::fonts::{fonts, AddMode, FontSelector}; -use kas::theme::TextClass; -use kas::TkAction; +use super::{ColorsSrgb, TextClass, ThemeConfig}; +use crate::text::fonts::{fonts, AddMode, FontSelector}; +use crate::TkAction; use std::collections::BTreeMap; use std::time::Duration; diff --git a/crates/kas-theme/src/dim.rs b/crates/kas-core/src/theme/dimensions.rs similarity index 96% rename from crates/kas-theme/src/dim.rs rename to crates/kas-core/src/theme/dimensions.rs index 01c378cf4..d8e119fc3 100644 --- a/crates/kas-theme/src/dim.rs +++ b/crates/kas-core/src/theme/dimensions.rs @@ -10,15 +10,15 @@ use std::any::Any; use std::f32; use std::rc::Rc; -use crate::anim::AnimState; -use kas::cast::traits::*; -use kas::dir::Directional; -use kas::geom::{Rect, Size, Vec2}; -use kas::layout::{AlignPair, AxisInfo, FrameRules, Margins, SizeRules, Stretch}; -use kas::text::{fonts::FontId, TextApi, TextApiExt}; -use kas::theme::{Feature, FrameStyle, MarginStyle, MarkStyle, TextClass, ThemeSize}; - -kas::impl_scope! { +use super::anim::AnimState; +use super::{Config, Feature, FrameStyle, MarginStyle, MarkStyle, TextClass, ThemeSize}; +use crate::cast::traits::*; +use crate::dir::Directional; +use crate::geom::{Rect, Size, Vec2}; +use crate::layout::{AlignPair, AxisInfo, FrameRules, Margins, SizeRules, Stretch}; +use crate::text::{fonts::FontId, TextApi, TextApiExt}; + +crate::impl_scope! { /// Parameterisation of [`Dimensions`] /// /// All dimensions are multiplied by the DPI factor, then rounded to the @@ -154,7 +154,7 @@ pub struct Window { impl Window { pub fn new( dims: &Parameters, - config: &crate::Config, + config: &Config, scale: f32, fonts: Rc>, ) -> Self { @@ -165,12 +165,12 @@ impl Window { } } - pub fn update(&mut self, dims: &Parameters, config: &crate::Config, scale: f32) { + pub fn update(&mut self, dims: &Parameters, config: &Config, scale: f32) { self.dims = Dimensions::new(dims, config.font_size(), scale); } } -impl crate::Window for Window { +impl super::Window for Window { fn size(&self) -> &dyn ThemeSize { self } @@ -302,7 +302,7 @@ impl ThemeSize for Window { fn line_height(&self, class: TextClass) -> i32 { let font_id = self.fonts.get(&class).cloned().unwrap_or_default(); - kas::text::fonts::fonts() + crate::text::fonts::fonts() .get_first_face(font_id) .expect("invalid font_id") .height(self.dims.dpem) diff --git a/crates/kas-core/src/theme/mod.rs b/crates/kas-core/src/theme/mod.rs index 62ca234d8..3ee1b36ab 100644 --- a/crates/kas-core/src/theme/mod.rs +++ b/crates/kas-core/src/theme/mod.rs @@ -4,14 +4,31 @@ // https://www.apache.org/licenses/LICENSE-2.0 //! Theme interface +//! +//! Includes the [`Theme`] trait. +mod anim; +mod colors; +mod config; mod draw; +mod multi; mod size; mod style; +mod theme_dst; +mod traits; +#[cfg_attr(not(feature = "internal_doc"), doc(hidden))] +#[cfg_attr(doc_cfg, doc(cfg(internal_doc)))] +pub mod dimensions; + +pub use colors::{Colors, ColorsLinear, ColorsSrgb, InputState}; +pub use config::{Config, RasterConfig}; pub use draw::{Background, DrawMgr, ThemeDraw}; +pub use multi::{MultiTheme, MultiThemeBuilder}; pub use size::{SizeMgr, ThemeSize}; pub use style::*; +pub use theme_dst::{MaybeBoxed, ThemeDst}; +pub use traits::{Theme, ThemeConfig, Window}; #[allow(unused)] use crate::event::EventMgr; use crate::TkAction; diff --git a/crates/kas-theme/src/multi.rs b/crates/kas-core/src/theme/multi.rs similarity index 94% rename from crates/kas-theme/src/multi.rs rename to crates/kas-core/src/theme/multi.rs index 67974eb71..e56e49175 100644 --- a/crates/kas-theme/src/multi.rs +++ b/crates/kas-core/src/theme/multi.rs @@ -7,15 +7,15 @@ use std::collections::HashMap; -use crate::{Config, Theme, ThemeDst, Window}; -use kas::draw::{color, DrawIface, DrawSharedImpl, SharedState}; -use kas::event::EventState; -use kas::theme::{ThemeControl, ThemeDraw}; -use kas::TkAction; +use super::{Config, Theme, ThemeDst, Window}; +use crate::draw::{color, DrawIface, DrawSharedImpl, SharedState}; +use crate::event::EventState; +use crate::theme::{ThemeControl, ThemeDraw}; +use crate::TkAction; type DynTheme = Box>; -/// Wrapper around mutliple themes, supporting run-time switching +/// Wrapper around multiple themes, supporting run-time switching pub struct MultiTheme { names: HashMap, themes: Vec>, diff --git a/crates/kas-theme/src/theme_dst.rs b/crates/kas-core/src/theme/theme_dst.rs similarity index 95% rename from crates/kas-theme/src/theme_dst.rs rename to crates/kas-core/src/theme/theme_dst.rs index 8b68188e5..9956c1f61 100644 --- a/crates/kas-theme/src/theme_dst.rs +++ b/crates/kas-core/src/theme/theme_dst.rs @@ -10,10 +10,10 @@ use std::borrow::Cow; use std::ops::{Deref, DerefMut}; use super::{Theme, Window}; -use kas::draw::{color, DrawIface, DrawSharedImpl, SharedState}; -use kas::event::EventState; -use kas::theme::{ThemeControl, ThemeDraw, ThemeSize}; -use kas::TkAction; +use crate::draw::{color, DrawIface, DrawSharedImpl, SharedState}; +use crate::event::EventState; +use crate::theme::{ThemeControl, ThemeDraw, ThemeSize}; +use crate::TkAction; /// An optionally-owning (boxed) reference /// diff --git a/crates/kas-theme/src/traits.rs b/crates/kas-core/src/theme/traits.rs similarity index 93% rename from crates/kas-theme/src/traits.rs rename to crates/kas-core/src/theme/traits.rs index 602c427b3..8fb4e2766 100644 --- a/crates/kas-theme/src/traits.rs +++ b/crates/kas-core/src/theme/traits.rs @@ -5,10 +5,10 @@ //! Theme traits -use kas::draw::{color, DrawIface, DrawSharedImpl, SharedState}; -use kas::event::EventState; -use kas::theme::{ThemeControl, ThemeDraw, ThemeSize}; -use kas::{autoimpl, TkAction}; +use super::{RasterConfig, ThemeControl, ThemeDraw, ThemeSize}; +use crate::draw::{color, DrawIface, DrawSharedImpl, SharedState}; +use crate::event::EventState; +use crate::{autoimpl, TkAction}; use std::any::Any; use std::ops::{Deref, DerefMut}; @@ -19,7 +19,7 @@ pub trait ThemeConfig: Clone + std::fmt::Debug + 'static { fn apply_startup(&self); /// Get raster config - fn raster(&self) -> &crate::RasterConfig; + fn raster(&self) -> &RasterConfig; } /// Requirements on theme config (with `config` feature) @@ -34,7 +34,7 @@ pub trait ThemeConfig: fn apply_startup(&self); /// Get raster config - fn raster(&self) -> &crate::RasterConfig; + fn raster(&self) -> &RasterConfig; } /// A *theme* provides widget sizing and drawing implementations. @@ -67,7 +67,7 @@ pub trait Theme: ThemeControl { /// The toolkit must call this method before [`Theme::new_window`] /// to allow initialisation specific to the `DrawIface`. /// - /// At a minimum, a theme must load a font to [`kas::text::fonts`]. + /// At a minimum, a theme must load a font to [`crate::text::fonts`]. /// The first font loaded (by any theme) becomes the default font. fn init(&mut self, shared: &mut SharedState); diff --git a/crates/kas-theme/src/flat_theme.rs b/crates/kas-theme/src/flat_theme.rs index 6feef67cb..eddf35281 100644 --- a/crates/kas-theme/src/flat_theme.rs +++ b/crates/kas-theme/src/flat_theme.rs @@ -9,14 +9,16 @@ use std::f32; use std::ops::Range; use std::time::Instant; -use crate::{dim, ColorsLinear, Config, InputState, SimpleTheme, Theme}; +use super::SimpleTheme; use kas::cast::traits::*; use kas::dir::{Direction, Directional}; use kas::draw::{color::Rgba, *}; use kas::event::EventState; use kas::geom::*; use kas::text::{TextApi, TextDisplay}; +use kas::theme::dimensions as dim; use kas::theme::{Background, FrameStyle, MarkStyle, TextClass}; +use kas::theme::{ColorsLinear, Config, InputState, Theme}; use kas::theme::{ThemeControl, ThemeDraw, ThemeSize}; use kas::{TkAction, WidgetId}; diff --git a/crates/kas-theme/src/lib.rs b/crates/kas-theme/src/lib.rs index ace3872f8..77e01111a 100644 --- a/crates/kas-theme/src/lib.rs +++ b/crates/kas-theme/src/lib.rs @@ -16,27 +16,12 @@ #![cfg_attr(doc_cfg, feature(doc_cfg))] -mod anim; -mod colors; -mod config; mod draw_shaded; mod flat_theme; -mod multi; mod shaded_theme; mod simple_theme; -mod theme_dst; -mod traits; -#[cfg_attr(not(feature = "internal_doc"), doc(hidden))] -#[cfg_attr(doc_cfg, doc(cfg(internal_doc)))] -pub mod dim; - -pub use colors::{Colors, ColorsLinear, ColorsSrgb, InputState}; -pub use config::{Config, RasterConfig}; pub use draw_shaded::{DrawShaded, DrawShadedImpl}; pub use flat_theme::FlatTheme; -pub use multi::{MultiTheme, MultiThemeBuilder}; pub use shaded_theme::ShadedTheme; pub use simple_theme::SimpleTheme; -pub use theme_dst::{MaybeBoxed, ThemeDst}; -pub use traits::{Theme, ThemeConfig, Window}; diff --git a/crates/kas-theme/src/shaded_theme.rs b/crates/kas-theme/src/shaded_theme.rs index d5b848138..814957988 100644 --- a/crates/kas-theme/src/shaded_theme.rs +++ b/crates/kas-theme/src/shaded_theme.rs @@ -9,15 +9,16 @@ use std::f32; use std::ops::Range; use std::time::Instant; -use crate::{dim, ColorsLinear, Config, InputState, SimpleTheme, Theme}; -use crate::{DrawShaded, DrawShadedImpl}; +use crate::{DrawShaded, DrawShadedImpl, SimpleTheme}; use kas::cast::traits::*; use kas::dir::{Direction, Directional}; use kas::draw::{color::Rgba, *}; use kas::event::EventState; use kas::geom::*; use kas::text::{TextApi, TextDisplay}; +use kas::theme::dimensions as dim; use kas::theme::{Background, ThemeControl, ThemeDraw, ThemeSize}; +use kas::theme::{ColorsLinear, Config, InputState, Theme}; use kas::theme::{FrameStyle, MarkStyle, TextClass}; use kas::{TkAction, WidgetId}; diff --git a/crates/kas-theme/src/simple_theme.rs b/crates/kas-theme/src/simple_theme.rs index 0e9261369..372d56747 100644 --- a/crates/kas-theme/src/simple_theme.rs +++ b/crates/kas-theme/src/simple_theme.rs @@ -11,14 +11,15 @@ use std::ops::Range; use std::rc::Rc; use std::time::Instant; -use crate::{dim, ColorsLinear, Config, InputState, Theme}; use kas::cast::traits::*; use kas::dir::{Direction, Directional}; use kas::draw::{color::Rgba, *}; use kas::event::EventState; use kas::geom::*; use kas::text::{fonts, Effect, TextApi, TextDisplay}; +use kas::theme::dimensions as dim; use kas::theme::{Background, FrameStyle, MarkStyle, TextClass}; +use kas::theme::{ColorsLinear, Config, InputState, Theme}; use kas::theme::{ThemeControl, ThemeDraw, ThemeSize}; use kas::{TkAction, WidgetId}; diff --git a/crates/kas-wgpu/src/draw/draw_pipe.rs b/crates/kas-wgpu/src/draw/draw_pipe.rs index 044d68676..98ef433c1 100644 --- a/crates/kas-wgpu/src/draw/draw_pipe.rs +++ b/crates/kas-wgpu/src/draw/draw_pipe.rs @@ -21,7 +21,7 @@ impl DrawPipe { pub fn new>( mut custom: CB, (device, queue): (wgpu::Device, wgpu::Queue), - raster_config: &kas_theme::RasterConfig, + raster_config: &kas::theme::RasterConfig, ) -> Self { let shaders = ShaderManager::new(&device); diff --git a/crates/kas-wgpu/src/draw/text_pipe.rs b/crates/kas-wgpu/src/draw/text_pipe.rs index 119dbf728..ae2b94a5e 100644 --- a/crates/kas-wgpu/src/draw/text_pipe.rs +++ b/crates/kas-wgpu/src/draw/text_pipe.rs @@ -11,8 +11,8 @@ use kas::draw::{color::Rgba, PassId}; use kas::geom::{Quad, Rect, Vec2}; use kas::text::fonts::FaceId; use kas::text::{Effect, Glyph, TextDisplay}; +use kas::theme::RasterConfig; use kas_text::raster::{raster, Config, SpriteDescriptor}; -use kas_theme::RasterConfig; use rustc_hash::FxHashMap as HashMap; use std::mem::size_of; use std::num::NonZeroU32; diff --git a/crates/kas-wgpu/src/event_loop.rs b/crates/kas-wgpu/src/event_loop.rs index 535632fd2..788f2ebe5 100644 --- a/crates/kas-wgpu/src/event_loop.rs +++ b/crates/kas-wgpu/src/event_loop.rs @@ -13,8 +13,8 @@ use winit::event::{Event, StartCause}; use winit::event_loop::{ControlFlow, EventLoopWindowTarget}; use winit::window as ww; +use kas::theme::Theme; use kas::TkAction; -use kas_theme::Theme; use crate::draw::{CustomPipe, DrawPipe}; use crate::shared::{PendingAction, SharedState}; @@ -23,7 +23,7 @@ use crate::{ProxyAction, Window, WindowId}; /// Event-loop data structure (i.e. all run-time state) pub(crate) struct Loop>> where - T::Window: kas_theme::Window, + T::Window: kas::theme::Window, { /// Window states windows: HashMap>, @@ -37,7 +37,7 @@ where impl>> Loop where - T::Window: kas_theme::Window, + T::Window: kas::theme::Window, { pub(crate) fn new(mut windows: Vec>, shared: SharedState) -> Self { let id_map = windows diff --git a/crates/kas-wgpu/src/lib.rs b/crates/kas-wgpu/src/lib.rs index 49435f038..64ebcc418 100644 --- a/crates/kas-wgpu/src/lib.rs +++ b/crates/kas-wgpu/src/lib.rs @@ -9,8 +9,8 @@ //! GPU-accelerated rendering and [winit] for windowing, thus it should be //! portable to most desktop and potentially also mobile platforms. //! -//! This crate supports themes via the [`kas_theme`] crate, including shaded -//! drawing. +//! This crate supports themes via the [`kas::theme`], including shaded drawing +//! ([`kas_theme::DrawShaded`]). //! //! Custom GPU-accelerated drawing is supported via [`draw::CustomPipe`] //! (see the [Mandlebrot example](https://github.com/kas-gui/kas/blob/master/kas-wgpu/examples/mandlebrot.rs)). @@ -31,8 +31,8 @@ mod window; use kas::draw::DrawShared; use kas::event::UpdateId; use kas::model::SharedRc; +use kas::theme::Theme; use kas::WindowId; -use kas_theme::Theme; use thiserror::Error; use winit::error::OsError; use winit::event_loop::{EventLoop, EventLoopBuilder, EventLoopProxy, EventLoopWindowTarget}; @@ -102,7 +102,7 @@ pub struct Toolkit>> { impl> + 'static> Toolkit<(), T> where - T::Window: kas_theme::Window, + T::Window: kas::theme::Window, { /// Construct a new instance with default options. /// @@ -117,7 +117,7 @@ where impl> + 'static> Toolkit where - T::Window: kas_theme::Window, + T::Window: kas::theme::Window, { /// Construct an instance with custom options /// diff --git a/crates/kas-wgpu/src/options.rs b/crates/kas-wgpu/src/options.rs index 2f12dfc10..938772975 100644 --- a/crates/kas-wgpu/src/options.rs +++ b/crates/kas-wgpu/src/options.rs @@ -7,7 +7,7 @@ use super::Error; use kas::draw::DrawSharedImpl; -use kas_theme::{Theme, ThemeConfig}; +use kas::theme::{Theme, ThemeConfig}; use std::env::var; use std::num::NonZeroU32; use std::path::PathBuf; diff --git a/crates/kas-wgpu/src/shared.rs b/crates/kas-wgpu/src/shared.rs index d2ae988b3..7e386dae9 100644 --- a/crates/kas-wgpu/src/shared.rs +++ b/crates/kas-wgpu/src/shared.rs @@ -14,8 +14,8 @@ use kas::cast::Conv; use kas::draw; use kas::event::UpdateId; use kas::model::SharedRc; +use kas::theme::{Theme, ThemeConfig}; use kas::TkAction; -use kas_theme::{Theme, ThemeConfig}; #[cfg(feature = "clipboard")] use window_clipboard::Clipboard; @@ -38,7 +38,7 @@ pub struct SharedState { impl>> SharedState where - T::Window: kas_theme::Window, + T::Window: kas::theme::Window, { /// Construct pub fn new>( diff --git a/crates/kas-wgpu/src/window.rs b/crates/kas-wgpu/src/window.rs index 9ede4b683..9ea256862 100644 --- a/crates/kas-wgpu/src/window.rs +++ b/crates/kas-wgpu/src/window.rs @@ -11,8 +11,8 @@ use kas::event::{ConfigMgr, CursorIcon, EventState, UpdateId}; use kas::geom::{Coord, Rect, Size}; use kas::layout::SolveCache; use kas::theme::{DrawMgr, SizeMgr, ThemeControl, ThemeSize}; +use kas::theme::{Theme, Window as _}; use kas::{Layout, TkAction, WidgetCore, WidgetExt, WindowId}; -use kas_theme::{Theme, Window as _}; use std::time::Instant; use winit::dpi::PhysicalSize; use winit::error::OsError; @@ -462,7 +462,7 @@ fn to_wgpu_color(c: kas::draw::color::Rgba) -> wgpu::Color { struct TkWindow<'a, C: CustomPipe, T: Theme>> where - T::Window: kas_theme::Window, + T::Window: kas::theme::Window, { shared: &'a mut SharedState, window: Option<&'a winit::window::Window>, @@ -471,7 +471,7 @@ where impl<'a, C: CustomPipe, T: Theme>> TkWindow<'a, C, T> where - T::Window: kas_theme::Window, + T::Window: kas::theme::Window, { fn new( shared: &'a mut SharedState, @@ -490,7 +490,7 @@ impl<'a, C, T> kas::ShellWindow for TkWindow<'a, C, T> where C: CustomPipe, T: Theme>, - T::Window: kas_theme::Window, + T::Window: kas::theme::Window, { fn add_popup(&mut self, popup: kas::Popup) -> Option { self.window.map(|w| w.id()).map(|parent_id| { @@ -540,7 +540,7 @@ where } fn size_and_draw_shared(&mut self, f: &mut dyn FnMut(&mut dyn ThemeSize, &mut dyn DrawShared)) { - use kas_theme::Window; + use kas::theme::Window; let mut size = self.theme_window.size(); f(&mut size, &mut self.shared.draw); } From b6a927275146a9cc184d5cd2f6da4cf3d9a95172 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 14 Jan 2023 10:29:01 +0000 Subject: [PATCH 2/7] Move ThemeControl into traits; use #[autoimpl(for Box)] --- crates/kas-core/src/theme/mod.rs | 49 +--------------- crates/kas-core/src/theme/theme_dst.rs | 13 +---- crates/kas-core/src/theme/traits.rs | 77 ++++++++++++-------------- 3 files changed, 36 insertions(+), 103 deletions(-) diff --git a/crates/kas-core/src/theme/mod.rs b/crates/kas-core/src/theme/mod.rs index 3ee1b36ab..1f7d45142 100644 --- a/crates/kas-core/src/theme/mod.rs +++ b/crates/kas-core/src/theme/mod.rs @@ -28,51 +28,4 @@ pub use multi::{MultiTheme, MultiThemeBuilder}; pub use size::{SizeMgr, ThemeSize}; pub use style::*; pub use theme_dst::{MaybeBoxed, ThemeDst}; -pub use traits::{Theme, ThemeConfig, Window}; - -#[allow(unused)] use crate::event::EventMgr; -use crate::TkAction; -use std::ops::{Deref, DerefMut}; - -/// Interface through which a theme can be adjusted at run-time -/// -/// All methods return a [`TkAction`] to enable correct action when a theme -/// is updated via [`EventMgr::adjust_theme`]. When adjusting a theme before -/// the UI is started, this return value can be safely ignored. -pub trait ThemeControl { - /// Set font size - /// - /// Units: Points per Em (standard unit of font size) - fn set_font_size(&mut self, pt_size: f32) -> TkAction; - - /// Change the colour scheme - /// - /// If no scheme by this name is found the scheme is left unchanged. - fn set_scheme(&mut self, scheme: &str) -> TkAction; - - /// List available colour schemes - fn list_schemes(&self) -> Vec<&str>; - - /// Switch the theme - /// - /// Most themes do not react to this method; `kas_theme::MultiTheme` uses - /// it to switch themes. - fn set_theme(&mut self, _theme: &str) -> TkAction { - TkAction::empty() - } -} - -impl ThemeControl for Box { - fn set_font_size(&mut self, size: f32) -> TkAction { - self.deref_mut().set_font_size(size) - } - fn set_scheme(&mut self, scheme: &str) -> TkAction { - self.deref_mut().set_scheme(scheme) - } - fn list_schemes(&self) -> Vec<&str> { - self.deref().list_schemes() - } - fn set_theme(&mut self, theme: &str) -> TkAction { - self.deref_mut().set_theme(theme) - } -} +pub use traits::{Theme, ThemeConfig, ThemeControl, Window}; diff --git a/crates/kas-core/src/theme/theme_dst.rs b/crates/kas-core/src/theme/theme_dst.rs index 9956c1f61..490612845 100644 --- a/crates/kas-core/src/theme/theme_dst.rs +++ b/crates/kas-core/src/theme/theme_dst.rs @@ -7,12 +7,11 @@ use std::any::Any; use std::borrow::Cow; -use std::ops::{Deref, DerefMut}; use super::{Theme, Window}; use crate::draw::{color, DrawIface, DrawSharedImpl, SharedState}; use crate::event::EventState; -use crate::theme::{ThemeControl, ThemeDraw, ThemeSize}; +use crate::theme::{ThemeControl, ThemeDraw}; use crate::TkAction; /// An optionally-owning (boxed) reference @@ -112,13 +111,3 @@ impl> ThemeDst for T { self.clear_color() } } - -impl Window for Box { - fn size(&self) -> &dyn ThemeSize { - self.deref().size() - } - - fn as_any_mut(&mut self) -> &mut dyn Any { - self.deref_mut().as_any_mut() - } -} diff --git a/crates/kas-core/src/theme/traits.rs b/crates/kas-core/src/theme/traits.rs index 8fb4e2766..0d8ae131a 100644 --- a/crates/kas-core/src/theme/traits.rs +++ b/crates/kas-core/src/theme/traits.rs @@ -5,12 +5,42 @@ //! Theme traits -use super::{RasterConfig, ThemeControl, ThemeDraw, ThemeSize}; +use super::{RasterConfig, ThemeDraw, ThemeSize}; use crate::draw::{color, DrawIface, DrawSharedImpl, SharedState}; use crate::event::EventState; use crate::{autoimpl, TkAction}; use std::any::Any; -use std::ops::{Deref, DerefMut}; + +#[allow(unused)] use crate::event::EventMgr; + +/// Interface through which a theme can be adjusted at run-time +/// +/// All methods return a [`TkAction`] to enable correct action when a theme +/// is updated via [`EventMgr::adjust_theme`]. When adjusting a theme before +/// the UI is started, this return value can be safely ignored. +#[crate::autoimpl(for &mut T, Box)] +pub trait ThemeControl { + /// Set font size + /// + /// Units: Points per Em (standard unit of font size) + fn set_font_size(&mut self, pt_size: f32) -> TkAction; + + /// Change the colour scheme + /// + /// If no scheme by this name is found the scheme is left unchanged. + fn set_scheme(&mut self, scheme: &str) -> TkAction; + + /// List available colour schemes + fn list_schemes(&self) -> Vec<&str>; + + /// Switch the theme + /// + /// Most themes do not react to this method; `kas_theme::MultiTheme` uses + /// it to switch themes. + fn set_theme(&mut self, _theme: &str) -> TkAction { + TkAction::empty() + } +} /// Requirements on theme config (without `config` feature) #[cfg(not(feature = "config"))] @@ -43,6 +73,7 @@ pub trait ThemeConfig: /// /// Objects of this type are copied within each window's data structure. For /// large resources (e.g. fonts and icons) consider using external storage. +#[autoimpl(for Box)] pub trait Theme: ThemeControl { /// The associated config type type Config: ThemeConfig; @@ -116,50 +147,10 @@ pub trait Theme: ThemeControl { /// /// The main reason for this separation is to allow proper handling of /// multi-window applications across screens with differing DPIs. -#[autoimpl(for Box)] +#[autoimpl(for Box)] pub trait Window: 'static { /// Construct a [`ThemeSize`] object fn size(&self) -> &dyn ThemeSize; fn as_any_mut(&mut self) -> &mut dyn Any; } - -impl, DS: DrawSharedImpl> Theme for Box { - type Window = >::Window; - type Config = >::Config; - - type Draw<'a> = >::Draw<'a> - where - T: 'a; - - fn config(&self) -> std::borrow::Cow { - self.deref().config() - } - fn apply_config(&mut self, config: &Self::Config) -> TkAction { - self.deref_mut().apply_config(config) - } - - fn init(&mut self, shared: &mut SharedState) { - self.deref_mut().init(shared); - } - - fn new_window(&self, dpi_factor: f32) -> Self::Window { - self.deref().new_window(dpi_factor) - } - fn update_window(&self, window: &mut Self::Window, dpi_factor: f32) { - self.deref().update_window(window, dpi_factor); - } - - fn draw<'a>( - &'a self, - draw: DrawIface<'a, DS>, - ev: &'a mut EventState, - window: &'a mut Self::Window, - ) -> Self::Draw<'a> { - self.deref().draw(draw, ev, window) - } - - fn clear_color(&self) -> color::Rgba { - self.deref().clear_color() - } -} From 4e00e7fd511143c2c07c9e3fec7339103c438a5b Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 14 Jan 2023 11:58:29 +0000 Subject: [PATCH 3/7] Move SimpleTheme and FlatTheme to kas_core This required making some fields of SimpleTheme public to support ShadedTheme. The theme extension/inheritence needs mechanism needs to be reviewed. --- .../src => kas-core/src/theme}/flat_theme.rs | 19 ++++++++---- crates/kas-core/src/theme/mod.rs | 13 +++++++-- crates/kas-core/src/theme/multi.rs | 11 ++++++- .../src/theme}/simple_theme.rs | 18 ++++++++++-- crates/kas-core/src/theme/traits.rs | 13 ++++++++- crates/kas-theme/src/lib.rs | 4 --- crates/kas-theme/src/shaded_theme.rs | 29 ++++++++++--------- 7 files changed, 77 insertions(+), 30 deletions(-) rename crates/{kas-theme/src => kas-core/src/theme}/flat_theme.rs (97%) rename crates/{kas-theme/src => kas-core/src/theme}/simple_theme.rs (97%) diff --git a/crates/kas-theme/src/flat_theme.rs b/crates/kas-core/src/theme/flat_theme.rs similarity index 97% rename from crates/kas-theme/src/flat_theme.rs rename to crates/kas-core/src/theme/flat_theme.rs index eddf35281..a2ab6b36d 100644 --- a/crates/kas-theme/src/flat_theme.rs +++ b/crates/kas-core/src/theme/flat_theme.rs @@ -32,6 +32,9 @@ const SHADOW_HOVER: f32 = 1.1; const SHADOW_POPUP: f32 = 1.2; /// A theme with flat (unshaded) rendering +/// +/// This is a fully functional theme using only the basic drawing primitives +/// available by default. #[derive(Clone, Debug)] pub struct FlatTheme { base: SimpleTheme, @@ -57,7 +60,7 @@ impl FlatTheme { #[inline] #[must_use] pub fn with_font_size(mut self, pt_size: f32) -> Self { - self.base.config.set_font_size(pt_size); + self.base = self.base.with_font_size(pt_size); self } @@ -67,10 +70,7 @@ impl FlatTheme { #[inline] #[must_use] pub fn with_colours(mut self, scheme: &str) -> Self { - self.base.config.set_active_scheme(scheme); - if let Some(scheme) = self.base.config.get_color_scheme(scheme) { - self.base.cols = scheme.into(); - } + self.base = self.base.with_colours(scheme); self } } @@ -140,6 +140,15 @@ where } } + fn draw_upcast<'a>( + draw: DrawIface<'a, DS>, + ev: &'a mut EventState, + w: &'a mut Self::Window, + cols: &'a ColorsLinear, + ) -> Self::Draw<'a> { + DrawHandle { draw, ev, w, cols } + } + fn clear_color(&self) -> Rgba { self.base.cols.background } diff --git a/crates/kas-core/src/theme/mod.rs b/crates/kas-core/src/theme/mod.rs index 1f7d45142..df720a139 100644 --- a/crates/kas-core/src/theme/mod.rs +++ b/crates/kas-core/src/theme/mod.rs @@ -3,15 +3,22 @@ // You may obtain a copy of the License in the LICENSE-APACHE file or at: // https://www.apache.org/licenses/LICENSE-2.0 -//! Theme interface +//! Themes //! -//! Includes the [`Theme`] trait. +//! Widgets expect the theme to provide an implementation of [`SizeMgr`] and of +//! [`DrawMgr`]. +//! +//! Constructing a shell requires a [`Theme`]. Two implementations are provided +//! here: [`SimpleTheme`] and [`FlatTheme`]. +//! An adapter, [`MultiTheme`], is also provided. mod anim; mod colors; mod config; mod draw; +mod flat_theme; mod multi; +mod simple_theme; mod size; mod style; mod theme_dst; @@ -24,7 +31,9 @@ pub mod dimensions; pub use colors::{Colors, ColorsLinear, ColorsSrgb, InputState}; pub use config::{Config, RasterConfig}; pub use draw::{Background, DrawMgr, ThemeDraw}; +pub use flat_theme::FlatTheme; pub use multi::{MultiTheme, MultiThemeBuilder}; +pub use simple_theme::SimpleTheme; pub use size::{SizeMgr, ThemeSize}; pub use style::*; pub use theme_dst::{MaybeBoxed, ThemeDst}; diff --git a/crates/kas-core/src/theme/multi.rs b/crates/kas-core/src/theme/multi.rs index e56e49175..c7c611eb6 100644 --- a/crates/kas-core/src/theme/multi.rs +++ b/crates/kas-core/src/theme/multi.rs @@ -7,7 +7,7 @@ use std::collections::HashMap; -use super::{Config, Theme, ThemeDst, Window}; +use super::{ColorsLinear, Config, Theme, ThemeDst, Window}; use crate::draw::{color, DrawIface, DrawSharedImpl, SharedState}; use crate::event::EventState; use crate::theme::{ThemeControl, ThemeDraw}; @@ -125,6 +125,15 @@ impl Theme for MultiTheme { self.themes[self.active].draw(draw, ev, window) } + fn draw_upcast<'a>( + _draw: DrawIface<'a, DS>, + _ev: &'a mut EventState, + _w: &'a mut Self::Window, + _cols: &'a ColorsLinear, + ) -> Self::Draw<'a> { + unimplemented!() + } + fn clear_color(&self) -> color::Rgba { self.themes[self.active].clear_color() } diff --git a/crates/kas-theme/src/simple_theme.rs b/crates/kas-core/src/theme/simple_theme.rs similarity index 97% rename from crates/kas-theme/src/simple_theme.rs rename to crates/kas-core/src/theme/simple_theme.rs index 372d56747..d1ed2b76b 100644 --- a/crates/kas-theme/src/simple_theme.rs +++ b/crates/kas-core/src/theme/simple_theme.rs @@ -24,12 +24,15 @@ use kas::theme::{ThemeControl, ThemeDraw, ThemeSize}; use kas::{TkAction, WidgetId}; /// A simple theme +/// +/// This theme is functional, but not pretty. It is intended as a template for +/// other themes. #[derive(Clone, Debug)] pub struct SimpleTheme { - pub(crate) config: Config, - pub(crate) cols: ColorsLinear, + pub config: Config, + pub cols: ColorsLinear, dims: dim::Parameters, - pub(crate) fonts: Option>>, + pub fonts: Option>>, } impl Default for SimpleTheme { @@ -146,6 +149,15 @@ where } } + fn draw_upcast<'a>( + draw: DrawIface<'a, DS>, + ev: &'a mut EventState, + w: &'a mut Self::Window, + cols: &'a ColorsLinear, + ) -> Self::Draw<'a> { + DrawHandle { draw, ev, w, cols } + } + fn clear_color(&self) -> Rgba { self.cols.background } diff --git a/crates/kas-core/src/theme/traits.rs b/crates/kas-core/src/theme/traits.rs index 0d8ae131a..27217d304 100644 --- a/crates/kas-core/src/theme/traits.rs +++ b/crates/kas-core/src/theme/traits.rs @@ -5,7 +5,7 @@ //! Theme traits -use super::{RasterConfig, ThemeDraw, ThemeSize}; +use super::{ColorsLinear, RasterConfig, ThemeDraw, ThemeSize}; use crate::draw::{color, DrawIface, DrawSharedImpl, SharedState}; use crate::event::EventState; use crate::{autoimpl, TkAction}; @@ -137,6 +137,17 @@ pub trait Theme: ThemeControl { window: &'a mut Self::Window, ) -> Self::Draw<'a>; + /// Construct a draw object from parts + /// + /// This method allows a "derived" theme to construct a draw object for the + /// inherited theme. + fn draw_upcast<'a>( + draw: DrawIface<'a, DS>, + ev: &'a mut EventState, + w: &'a mut Self::Window, + cols: &'a ColorsLinear, + ) -> Self::Draw<'a>; + /// Background colour fn clear_color(&self) -> color::Rgba; } diff --git a/crates/kas-theme/src/lib.rs b/crates/kas-theme/src/lib.rs index 77e01111a..6673da222 100644 --- a/crates/kas-theme/src/lib.rs +++ b/crates/kas-theme/src/lib.rs @@ -17,11 +17,7 @@ #![cfg_attr(doc_cfg, feature(doc_cfg))] mod draw_shaded; -mod flat_theme; mod shaded_theme; -mod simple_theme; pub use draw_shaded::{DrawShaded, DrawShadedImpl}; -pub use flat_theme::FlatTheme; pub use shaded_theme::ShadedTheme; -pub use simple_theme::SimpleTheme; diff --git a/crates/kas-theme/src/shaded_theme.rs b/crates/kas-theme/src/shaded_theme.rs index 814957988..0cd4561d9 100644 --- a/crates/kas-theme/src/shaded_theme.rs +++ b/crates/kas-theme/src/shaded_theme.rs @@ -9,7 +9,7 @@ use std::f32; use std::ops::Range; use std::time::Instant; -use crate::{DrawShaded, DrawShadedImpl, SimpleTheme}; +use crate::{DrawShaded, DrawShadedImpl}; use kas::cast::traits::*; use kas::dir::{Direction, Directional}; use kas::draw::{color::Rgba, *}; @@ -18,7 +18,7 @@ use kas::geom::*; use kas::text::{TextApi, TextDisplay}; use kas::theme::dimensions as dim; use kas::theme::{Background, ThemeControl, ThemeDraw, ThemeSize}; -use kas::theme::{ColorsLinear, Config, InputState, Theme}; +use kas::theme::{ColorsLinear, Config, FlatTheme, InputState, SimpleTheme, Theme}; use kas::theme::{FrameStyle, MarkStyle, TextClass}; use kas::{TkAction, WidgetId}; @@ -46,7 +46,7 @@ impl ShadedTheme { /// Units: Points per Em (standard unit of font size) #[must_use] pub fn with_font_size(mut self, pt_size: f32) -> Self { - self.base.config.set_font_size(pt_size); + self.base = self.base.with_font_size(pt_size); self } @@ -55,10 +55,7 @@ impl ShadedTheme { /// If no scheme by this name is found the scheme is left unchanged. #[must_use] pub fn with_colours(mut self, scheme: &str) -> Self { - self.base.config.set_active_scheme(scheme); - if let Some(scheme) = self.base.config.get_color_scheme(scheme) { - self.base.cols = scheme.into(); - } + self.base = self.base.with_colours(scheme); self } } @@ -137,6 +134,15 @@ where } } + fn draw_upcast<'a>( + draw: DrawIface<'a, DS>, + ev: &'a mut EventState, + w: &'a mut Self::Window, + cols: &'a ColorsLinear, + ) -> Self::Draw<'a> { + DrawHandle { draw, ev, w, cols } + } + fn clear_color(&self) -> Rgba { >::clear_color(&self.base) } @@ -161,17 +167,12 @@ where DS::Draw: DrawRoundedImpl + DrawShadedImpl, { // Type-cast to flat_theme's DrawHandle. Should be equivalent to transmute. - fn as_flat<'b, 'c>(&'b mut self) -> super::flat_theme::DrawHandle<'c, DS> + fn as_flat<'b, 'c>(&'b mut self) -> >::Draw<'c> where 'a: 'c, 'b: 'c, { - super::flat_theme::DrawHandle { - draw: self.draw.re(), - ev: self.ev, - w: self.w, - cols: self.cols, - } + FlatTheme::draw_upcast(self.draw.re(), self.ev, self.w, self.cols) } /// Draw an edit box with optional navigation highlight. From 030f34e87a1b7470f3caa88f5145fb1fe532fbdf Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 14 Jan 2023 12:07:12 +0000 Subject: [PATCH 4/7] Move ShadedTheme to kas_wgpu This theme uses special WGPU shaders, hence it makes sense that it live here (unless/until another graphics backend supports it; not too likely since it isn't a popular theme). --- Cargo.toml | 2 +- crates/kas-theme/src/lib.rs | 6 ------ crates/kas-wgpu/Cargo.toml | 7 ------- crates/kas-wgpu/src/draw/draw_pipe.rs | 2 +- crates/{kas-theme => kas-wgpu}/src/draw_shaded.rs | 0 crates/kas-wgpu/src/lib.rs | 8 ++++++-- crates/{kas-theme => kas-wgpu}/src/shaded_theme.rs | 0 examples/calculator.rs | 2 +- examples/gallery.rs | 2 +- examples/splitter.rs | 2 +- examples/stopwatch.rs | 2 +- examples/sync-counter.rs | 2 +- 12 files changed, 13 insertions(+), 22 deletions(-) rename crates/{kas-theme => kas-wgpu}/src/draw_shaded.rs (100%) rename crates/{kas-theme => kas-wgpu}/src/shaded_theme.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index d9c316ea8..c698e04c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ minimal = ["theme", "wgpu"] dynamic = ["dep:kas-dylib"] # Enables usage of unstable Rust features -nightly = ["min_spec", "kas-theme?/nightly", "kas-wgpu?/nightly"] +nightly = ["min_spec"] # Use min_specialization (enables accelerator underlining for AccelLabel) min_spec = ["kas-widgets/min_spec"] diff --git a/crates/kas-theme/src/lib.rs b/crates/kas-theme/src/lib.rs index 6673da222..0ae43e31a 100644 --- a/crates/kas-theme/src/lib.rs +++ b/crates/kas-theme/src/lib.rs @@ -15,9 +15,3 @@ //! minimal shell with a custom fixed theme. #![cfg_attr(doc_cfg, feature(doc_cfg))] - -mod draw_shaded; -mod shaded_theme; - -pub use draw_shaded::{DrawShaded, DrawShadedImpl}; -pub use shaded_theme::ShadedTheme; diff --git a/crates/kas-wgpu/Cargo.toml b/crates/kas-wgpu/Cargo.toml index 0f5553192..54a6253c5 100644 --- a/crates/kas-wgpu/Cargo.toml +++ b/crates/kas-wgpu/Cargo.toml @@ -14,7 +14,6 @@ documentation = "https://docs.rs/kas-wgpu/" [features] # WARNING: if "raster" is disabled, an alternative like "kas-text/fontdue" is required! default = ["clipboard", "shaping", "raster"] -nightly = ["kas-theme/nightly"] shaping = ["kas-text/shaping"] harfbuzz = ["kas-text/harfbuzz"] @@ -42,12 +41,6 @@ package = "kas-core" path = "../kas-core" features = ["config", "winit"] -[dependencies.kas-theme] -path = "../kas-theme" -features = ["config"] -version = "0.12.0" -default-features = false - [dependencies.kas-text] version = "0.6.0" diff --git a/crates/kas-wgpu/src/draw/draw_pipe.rs b/crates/kas-wgpu/src/draw/draw_pipe.rs index 98ef433c1..ceffac69a 100644 --- a/crates/kas-wgpu/src/draw/draw_pipe.rs +++ b/crates/kas-wgpu/src/draw/draw_pipe.rs @@ -9,12 +9,12 @@ use std::f32::consts::FRAC_PI_2; use wgpu::util::DeviceExt; use super::*; +use crate::DrawShadedImpl; use kas::cast::traits::*; use kas::draw::color::Rgba; use kas::draw::*; use kas::geom::{Quad, Rect, Size, Vec2}; use kas::text::{Effect, TextDisplay}; -use kas_theme::DrawShadedImpl; impl DrawPipe { /// Construct diff --git a/crates/kas-theme/src/draw_shaded.rs b/crates/kas-wgpu/src/draw_shaded.rs similarity index 100% rename from crates/kas-theme/src/draw_shaded.rs rename to crates/kas-wgpu/src/draw_shaded.rs diff --git a/crates/kas-wgpu/src/lib.rs b/crates/kas-wgpu/src/lib.rs index 64ebcc418..d8b56d90a 100644 --- a/crates/kas-wgpu/src/lib.rs +++ b/crates/kas-wgpu/src/lib.rs @@ -9,8 +9,8 @@ //! GPU-accelerated rendering and [winit] for windowing, thus it should be //! portable to most desktop and potentially also mobile platforms. //! -//! This crate supports themes via the [`kas::theme`], including shaded drawing -//! ([`kas_theme::DrawShaded`]). +//! This crate supports themes via the [`kas::theme`], and provides one +//! additional theme, [`ShadedTheme`]. //! //! Custom GPU-accelerated drawing is supported via [`draw::CustomPipe`] //! (see the [Mandlebrot example](https://github.com/kas-gui/kas/blob/master/kas-wgpu/examples/mandlebrot.rs)). @@ -23,8 +23,10 @@ //! [clipboard]: https://crates.io/crates/clipboard pub mod draw; +mod draw_shaded; mod event_loop; pub mod options; +mod shaded_theme; mod shared; mod window; @@ -41,7 +43,9 @@ use crate::draw::{CustomPipe, CustomPipeBuilder, DrawPipe}; use crate::shared::SharedState; use window::Window; +pub use draw_shaded::{DrawShaded, DrawShadedImpl}; pub use options::Options; +pub use shaded_theme::ShadedTheme; pub extern crate wgpu; /// Possible failures from constructing a [`Toolkit`] diff --git a/crates/kas-theme/src/shaded_theme.rs b/crates/kas-wgpu/src/shaded_theme.rs similarity index 100% rename from crates/kas-theme/src/shaded_theme.rs rename to crates/kas-wgpu/src/shaded_theme.rs diff --git a/examples/calculator.rs b/examples/calculator.rs index fc429c2e0..58231733c 100644 --- a/examples/calculator.rs +++ b/examples/calculator.rs @@ -109,7 +109,7 @@ impl_scope! { fn main() -> kas::shell::Result<()> { env_logger::init(); - let theme = kas::theme::ShadedTheme::new().with_font_size(16.0); + let theme = kas_wgpu::ShadedTheme::new().with_font_size(16.0); kas::shell::Toolkit::new(theme)? .with(CalcUI::default())? .run() diff --git a/examples/gallery.rs b/examples/gallery.rs index 11182e7f4..5cf4b02d5 100644 --- a/examples/gallery.rs +++ b/examples/gallery.rs @@ -482,7 +482,7 @@ fn main() -> Result<(), Box> { let theme = kas::theme::MultiTheme::builder() .add("flat", kas::theme::FlatTheme::new()) .add("simple", kas::theme::SimpleTheme::new()) - .add("shaded", kas::theme::ShadedTheme::new()) + .add("shaded", kas_wgpu::ShadedTheme::new()) .build(); let mut toolkit = kas::shell::Toolkit::new(theme)?; diff --git a/examples/splitter.rs b/examples/splitter.rs index f90a1ef62..cb334a3d5 100644 --- a/examples/splitter.rs +++ b/examples/splitter.rs @@ -59,6 +59,6 @@ fn main() -> kas::shell::Result<()> { } }; - let theme = kas::theme::ShadedTheme::new(); + let theme = kas_wgpu::ShadedTheme::new(); kas::shell::Toolkit::new(theme)?.with(window)?.run() } diff --git a/examples/stopwatch.rs b/examples/stopwatch.rs index 4fe50e438..05e450644 100644 --- a/examples/stopwatch.rs +++ b/examples/stopwatch.rs @@ -81,7 +81,7 @@ fn make_window() -> Box { fn main() -> kas::shell::Result<()> { env_logger::init(); - let theme = kas::theme::ShadedTheme::new() + let theme = kas_wgpu::ShadedTheme::new() .with_colours("dark") .with_font_size(18.0); kas::shell::Toolkit::new(theme)? diff --git a/examples/sync-counter.rs b/examples/sync-counter.rs index 7de0e687d..3041515da 100644 --- a/examples/sync-counter.rs +++ b/examples/sync-counter.rs @@ -16,7 +16,7 @@ fn main() -> kas::shell::Result<()> { let c1 = SingleView::new_with_driver(driver, SharedRc::new(0)); let c2 = SingleView::new_with_driver(driver, c1.data().clone()); - let theme = kas::theme::ShadedTheme::new().with_font_size(24.0); + let theme = kas_wgpu::ShadedTheme::new().with_font_size(24.0); kas::shell::Toolkit::new(theme)? .with(Window::new("Counter 1", c1))? .with(Window::new("Counter 2", c2))? From c679f89a773b011cc41cef1e2eb4a6c90a157391 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 14 Jan 2023 12:10:56 +0000 Subject: [PATCH 5/7] Fix dark-light feature (move to kas-core) --- Cargo.toml | 2 +- crates/kas-core/Cargo.toml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index c698e04c1..670e1c7ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -93,7 +93,7 @@ resvg = ["dep:kas-resvg", "kas-resvg?/svg"] tiny-skia = ["dep:kas-resvg"] # Automatically detect usage of dark theme -dark-light = ["kas-theme?/dark-light"] +dark-light = ["kas-core/dark-light"] # Support SVG images diff --git a/crates/kas-core/Cargo.toml b/crates/kas-core/Cargo.toml index 52d95c662..834706310 100644 --- a/crates/kas-core/Cargo.toml +++ b/crates/kas-core/Cargo.toml @@ -59,6 +59,9 @@ winit = ["dep:winit"] # This is required by config but may be enabled independently serde = ["dep:serde"] +# Automatically detect usage of dark theme +dark-light = ["dep:dark-light"] + [dependencies] log = "0.4" smallvec = "1.6.1" @@ -71,6 +74,7 @@ serde_json = { version = "1.0.61", optional = true } serde_yaml = { version = "0.9.9", optional = true } ron = { version = "0.8.0", package = "ron", optional = true } num_enum = "0.5.6" +dark-light = { version = "0.2.2", optional = true } [dependencies.kas-macros] version = "0.12.0" From e21b5d0a2e7c6d971970edbd40506490c7eba9ae Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 14 Jan 2023 12:14:50 +0000 Subject: [PATCH 6/7] Remove 'theme' feature and remnants of kas-theme We don't have a reason to make theme components optional. --- Cargo.toml | 15 +-- README.md | 5 +- crates/kas-core/src/theme/traits.rs | 2 +- crates/kas-dylib/Cargo.toml | 1 - crates/kas-dylib/src/lib.rs | 1 - crates/kas-theme/COPYRIGHT | 5 - crates/kas-theme/Cargo.toml | 43 ------- crates/kas-theme/LICENSE | 176 ---------------------------- crates/kas-theme/README.md | 26 ---- crates/kas-theme/src/lib.rs | 17 --- crates/kas-wgpu/Cargo.toml | 6 + crates/kas-wgpu/src/lib.rs | 2 + src/lib.rs | 12 -- 13 files changed, 14 insertions(+), 297 deletions(-) delete mode 100644 crates/kas-theme/COPYRIGHT delete mode 100644 crates/kas-theme/Cargo.toml delete mode 100644 crates/kas-theme/LICENSE delete mode 100644 crates/kas-theme/README.md delete mode 100644 crates/kas-theme/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 670e1c7ea..dac6bda8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ default = ["minimal", "view", "yaml", "image", "resvg", "clipboard", "markdown", # # Note: only some examples build in this configuration; others need view, # markdown, resvg. Recommended also: clipboard, yaml (or some config format). -minimal = ["theme", "wgpu"] +minimal = ["wgpu"] # Enable dynamic linking (faster linking via an extra run-time dependency): dynamic = ["dep:kas-dylib"] @@ -50,8 +50,6 @@ spec = ["min_spec", "kas-core/spec"] # Enable view widgets view = ["dep:kas-view"] -# Enable theme support: -theme = ["dep:kas-theme"] #Enable WGPU backend: wgpu = ["dep:kas-wgpu"] @@ -59,7 +57,7 @@ wgpu = ["dep:kas-wgpu"] # This API is not intended for use by end-user applications and # thus is omitted from built documentation by default. # This flag does not change the API, only built documentation. -internal_doc = ["kas-core/internal_doc", "kas-theme?/internal_doc"] +internal_doc = ["kas-core/internal_doc", "kas-wgpu?/internal_doc"] # Enables clipboard read/write clipboard = ["kas-wgpu?/clipboard"] @@ -73,7 +71,7 @@ shaping = ["kas-core/shaping"] harfbuzz = ["kas-core/harfbuzz"] # Enable config read/write -config = ["kas-core/config", "kas-theme?/config"] +config = ["kas-core/config"] # Enable support for YAML (de)serialisation yaml = ["config", "kas-core/yaml"] @@ -110,12 +108,6 @@ kas-widgets = { version = "0.12.1", path = "crates/kas-widgets" } kas-view = { version = "0.12.0", path = "crates/kas-view", optional = true } kas-resvg = { version = "0.12.0", path = "crates/kas-resvg", optional = true } -[dependencies.kas-theme] -version = "0.12.0" # used in doc links -path = "crates/kas-theme" -optional = true -default-features = false - [dependencies.kas-wgpu] version = "0.12.1" path = "crates/kas-wgpu" @@ -134,7 +126,6 @@ members = [ "crates/kas-dylib", "crates/kas-macros", "crates/kas-resvg", - "crates/kas-theme", "crates/kas-wgpu", "crates/kas-widgets", "crates/kas-view", diff --git a/README.md b/README.md index d5d11684f..f30691ef1 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ KAS is a pure-Rust GUI toolkit with stateful widgets: [Troubleshooting](https://github.com/kas-gui/kas/wiki/Troubleshooting) - API docs: [kas](https://docs.rs/kas), [kas-core](https://docs.rs/kas-core), [kas-widgets](https://docs.rs/kas-widgets), - [kas-theme](https://docs.rs/kas-theme), [kas-wgpu](https://docs.rs/kas-wgpu) + [kas-wgpu](https://docs.rs/kas-wgpu) - Prose: [Tutorials](https://kas-gui.github.io/tutorials/), [Blog](https://kas-gui.github.io/blog/) @@ -78,8 +78,7 @@ Crates and features (`kas-widgets`), etc. [See here](https://kas-gui.github.io/tutorials/#kas). At this point in time, `kas-wgpu` is the only windowing/rendering implementation -and `kas-theme` the only theme (high-level drawing) implementation, thus `kas` -uses these crates by default, though they are optional. +thus `kas` uses this crate by default, though it is optional. ### Feature flags diff --git a/crates/kas-core/src/theme/traits.rs b/crates/kas-core/src/theme/traits.rs index 27217d304..6d1d139ec 100644 --- a/crates/kas-core/src/theme/traits.rs +++ b/crates/kas-core/src/theme/traits.rs @@ -35,7 +35,7 @@ pub trait ThemeControl { /// Switch the theme /// - /// Most themes do not react to this method; `kas_theme::MultiTheme` uses + /// Most themes do not react to this method; [`super::MultiTheme`] uses /// it to switch themes. fn set_theme(&mut self, _theme: &str) -> TkAction { TkAction::empty() diff --git a/crates/kas-dylib/Cargo.toml b/crates/kas-dylib/Cargo.toml index c77453795..81a362e50 100644 --- a/crates/kas-dylib/Cargo.toml +++ b/crates/kas-dylib/Cargo.toml @@ -21,5 +21,4 @@ resvg = ["dep:kas-resvg"] kas-core = { version = "0.12.0", path = "../kas-core" } kas-widgets = { version = "0.12.0", path = "../kas-widgets" } kas-resvg = { version = "0.12.0", path = "../kas-resvg", optional = true } -kas-theme = { version = "0.12.0", path = "../kas-theme" } kas-wgpu = { version = "0.12.0", path = "../kas-wgpu" } diff --git a/crates/kas-dylib/src/lib.rs b/crates/kas-dylib/src/lib.rs index 86e8d55e7..0c85a8709 100644 --- a/crates/kas-dylib/src/lib.rs +++ b/crates/kas-dylib/src/lib.rs @@ -13,6 +13,5 @@ use kas_core; #[cfg(feature = "kas-resvg")] use kas_resvg; -use kas_theme; use kas_wgpu; use kas_widgets; diff --git a/crates/kas-theme/COPYRIGHT b/crates/kas-theme/COPYRIGHT deleted file mode 100644 index b22c5af53..000000000 --- a/crates/kas-theme/COPYRIGHT +++ /dev/null @@ -1,5 +0,0 @@ -This work is copyrighted by the following contributors: - -Diggory Hardy - -This list may be incomplete. diff --git a/crates/kas-theme/Cargo.toml b/crates/kas-theme/Cargo.toml deleted file mode 100644 index 1b23427ba..000000000 --- a/crates/kas-theme/Cargo.toml +++ /dev/null @@ -1,43 +0,0 @@ -[package] -name = "kas-theme" -version = "0.12.0" -authors = ["Diggory Hardy "] -edition = "2021" -license = "Apache-2.0" -description = "KAS GUI / theme support" -keywords = ["gui"] -categories = ["gui"] -repository = "https://github.com/kas-gui/kas" -readme = "README.md" -documentation = "https://docs.rs/kas-theme/" - -[package.metadata.docs.rs] -features = ["nightly", "config"] -rustdoc-args = ["--cfg", "doc_cfg"] -# To build locally: -# RUSTDOCFLAGS="--cfg doc_cfg" cargo +nightly doc --features=internal_doc,nightly,config --open - -[features] -default = [] -nightly = [] - -# Enables documentation of APIs for shells and internal usage. -# This API is not intended for use by end-user applications and -# thus is omitted from built documentation by default. -# This flag does not change the API, only built documentation. -internal_doc = ["kas/internal_doc"] - -# Enable config read/write -config = ["dep:serde", "kas/config"] - -# Automatically detect usage of dark theme -dark-light = ["dep:dark-light"] - -[dependencies] -# Rename package purely for convenience: -kas = { version = "0.12.0", package = "kas-core", path = "../kas-core" } -linear-map = "1.2.0" -log = "0.4" -serde = { version = "1.0.123", features = ["derive"], optional = true } -bitflags = "1.3.1" -dark-light = { version = "0.2.2", optional = true } diff --git a/crates/kas-theme/LICENSE b/crates/kas-theme/LICENSE deleted file mode 100644 index 1b5ec8b78..000000000 --- a/crates/kas-theme/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS diff --git a/crates/kas-theme/README.md b/crates/kas-theme/README.md deleted file mode 100644 index 3beab848b..000000000 --- a/crates/kas-theme/README.md +++ /dev/null @@ -1,26 +0,0 @@ -KAS Theme -====== - -Theme support for [KAS]. - -[KAS]: https://crates.io/crates/kas - - -Optional features -------- - -This crate has the following feature flags: - -- `font-kit` (enabled by default): uses the `font-kit` crate to locate a - suitable system font; otherwise a hard-coded font path is used - -Copyright and Licence -------- - -The [COPYRIGHT](COPYRIGHT) file includes a list of contributors who claim -copyright on this project. This list may be incomplete; new contributors may -optionally add themselves to this list. - -The KAS library is published under the terms of the Apache License, Version 2.0. -You may obtain a copy of this licence from the [LICENSE](LICENSE) file or on -the following webpage: diff --git a/crates/kas-theme/src/lib.rs b/crates/kas-theme/src/lib.rs deleted file mode 100644 index 0ae43e31a..000000000 --- a/crates/kas-theme/src/lib.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License in the LICENSE-APACHE file or at: -// https://www.apache.org/licenses/LICENSE-2.0 - -//! KAS theme support -//! -//! This crate provides the [`Theme`] trait, [`MultiTheme`] adapter, color -//! schemes, some supporting items, and the themes [`FlatTheme`] and -//! [`ShadedTheme`]. -//! -//! Custom themes may be built over this crate, optionally including custom draw -//! routines (e.g. [`DrawShaded`]), provided that the shell implements support. -//! Alternatively this crate may be skipped altogether, especially for a -//! minimal shell with a custom fixed theme. - -#![cfg_attr(doc_cfg, feature(doc_cfg))] diff --git a/crates/kas-wgpu/Cargo.toml b/crates/kas-wgpu/Cargo.toml index 54a6253c5..e4e3aa177 100644 --- a/crates/kas-wgpu/Cargo.toml +++ b/crates/kas-wgpu/Cargo.toml @@ -15,6 +15,12 @@ documentation = "https://docs.rs/kas-wgpu/" # WARNING: if "raster" is disabled, an alternative like "kas-text/fontdue" is required! default = ["clipboard", "shaping", "raster"] +# Enables documentation of APIs for shells and internal usage. +# This API is not intended for use by end-user applications and +# thus is omitted from built documentation by default. +# This flag does not change the API, only built documentation. +internal_doc = [] + shaping = ["kas-text/shaping"] harfbuzz = ["kas-text/harfbuzz"] raster = ["kas-text/raster"] diff --git a/crates/kas-wgpu/src/lib.rs b/crates/kas-wgpu/src/lib.rs index d8b56d90a..bab4835db 100644 --- a/crates/kas-wgpu/src/lib.rs +++ b/crates/kas-wgpu/src/lib.rs @@ -22,6 +22,8 @@ //! [winit]: https://github.com/rust-windowing/winit //! [clipboard]: https://crates.io/crates/clipboard +#![cfg_attr(doc_cfg, feature(doc_cfg))] + pub mod draw; mod draw_shaded; mod event_loop; diff --git a/src/lib.rs b/src/lib.rs index d62aae43a..f648788b2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,7 +16,6 @@ //! - [`kas_widgets`](https://docs.rs/kas-widgets/0.11) is re-export as [`kas::widgets`](widgets) //! - [`kas_resvg`] is re-export as [`kas::resvg`](resvg) (`resvg` or `tiny-skia` feature) //! - [`kas_view`](https://docs.rs/kas-view/0.11) is re-export as [`kas::view`](view) (`view` feature) -//! - [`kas_theme`] (`theme` feature) is re-export under [`kas::theme`](theme) //! - [`kas_wgpu`](https://docs.rs/kas-wgpu/0.11) is re-export as [`kas::shell`](shell); in the current version //! this is dependant on [WGPU](https://github.com/gfx-rs/wgpu), but in the //! future this should become a shim over multiple back-ends @@ -71,17 +70,6 @@ pub mod resvg { pub use kas_resvg::*; } -/// Themes -/// -/// This module is the merger of [`kas_core::theme`] and [`kas_theme`]. -pub mod theme { - pub use kas_core::theme::*; - - #[cfg(feature = "theme")] - #[cfg_attr(doc_cfg, doc(cfg(feature = "theme")))] - pub use kas_theme::*; -} - #[cfg(feature = "wgpu")] #[cfg_attr(doc_cfg, doc(cfg(feature = "wgpu")))] #[doc(inline)] From f3f8ccf6bffb004f9002b8b4d79c9ac8acb0acc2 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 14 Jan 2023 12:43:27 +0000 Subject: [PATCH 7/7] CI: remove tests for kas-theme --- .github/workflows/test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 852d7e389..261965a07 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,8 +35,6 @@ jobs: run: cargo test --manifest-path crates/kas-widgets/Cargo.toml --all-features - name: Test kas-resvg run: cargo test --manifest-path crates/kas-resvg/Cargo.toml --all-features - - name: Test kas-theme - run: cargo test --manifest-path crates/kas-theme/Cargo.toml --all-features - name: Test kas-wgpu run: | cargo test --manifest-path crates/kas-wgpu/Cargo.toml --no-default-features --features raster @@ -89,8 +87,6 @@ jobs: run: cargo test --manifest-path crates/kas-widgets/Cargo.toml - name: Test kas-resvg run: cargo test --manifest-path crates/kas-resvg/Cargo.toml --all-features - - name: Test kas-theme - run: cargo test --manifest-path crates/kas-theme/Cargo.toml - name: Test kas-wgpu run: cargo test --manifest-path crates/kas-wgpu/Cargo.toml - name: Test kas-dylib