From 54110b6249bd98cf00980c566d63982e8a0e8693 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Fri, 18 Oct 2024 15:21:33 -0400 Subject: [PATCH] update iced removes lots of stuff that is unused, as we don't plan on using cosmic-time long term --- Cargo.toml | 36 +- examples/pong/src/layer.rs | 4 +- src/keyframes.rs | 21 +- src/keyframes/button.rs | 212 --------- src/keyframes/column.rs | 215 --------- src/keyframes/container.rs | 224 --------- src/keyframes/helpers.rs | 104 +---- src/keyframes/row.rs | 215 --------- src/keyframes/space.rs | 176 ------- src/keyframes/style_button.rs | 238 ---------- src/keyframes/style_container.rs | 313 ------------- src/keyframes/toggler.rs | 15 +- src/lib.rs | 9 +- src/reexports/iced.rs | 2 +- src/reexports/libcosmic.rs | 3 +- src/reexports/mod.rs | 13 +- src/timeline.rs | 30 +- src/utils.rs | 2 - src/widget.rs | 240 +--------- src/widget/button.rs | 459 ------------------ src/widget/cards.rs | 22 +- src/widget/container.rs | 393 ---------------- src/widget/cosmic_button.rs | 780 ------------------------------- src/widget/cosmic_container.rs | 482 ------------------- src/widget/cosmic_toggler.rs | 85 ++-- src/widget/toggler.rs | 18 +- 26 files changed, 94 insertions(+), 4217 deletions(-) delete mode 100644 src/keyframes/button.rs delete mode 100644 src/keyframes/column.rs delete mode 100644 src/keyframes/container.rs delete mode 100644 src/keyframes/row.rs delete mode 100644 src/keyframes/space.rs delete mode 100644 src/keyframes/style_button.rs delete mode 100644 src/keyframes/style_container.rs delete mode 100644 src/widget/button.rs delete mode 100644 src/widget/container.rs delete mode 100644 src/widget/cosmic_button.rs delete mode 100644 src/widget/cosmic_container.rs diff --git a/Cargo.toml b/Cargo.toml index 51416ec..90f9d3b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,48 +2,28 @@ name = "cosmic-time" version = "0.4.0" edition = "2021" -description = "An animation Crate for Iced and Cosmic DE" +description = "An animation Crate for libcosmic and Cosmic DE" authors = ["Brock Szuszczewicz "] license = "MIT" repository = "https://github.com/pop-os/cosmic-time" documentation = "https://docs.rs/cosmic-time" -keywords = ["gui", "animation", "interface", "widgets", "iced"] +keywords = ["gui", "animation", "interface", "widgets", "libcosmic"] categories = ["gui"] [features] -default = ["iced"] -iced = [ - "dep:iced", - "dep:iced_runtime", - "dep:iced_widget", - "dep:iced_futures", - "dep:iced_core", - "dep:iced_style", -] once_cell = ["dep:once_cell"] -wayland-libcosmic = ["libcosmic", "libcosmic/wayland"] -winit-libcosmic = ["libcosmic", "libcosmic/winit"] -libcosmic = ["dep:libcosmic"] [workspace] -members = ["examples/*"] +members = [] [dependencies] -iced = { git = "https://github.com/iced-rs/iced", rev = "5540ac0", features = [ +libcosmic = { path = "../fork/libcosmic", default-features = false, features = [ "tokio", -], optional = true } -iced_runtime = { git = "https://github.com/iced-rs/iced", rev = "5540ac0", optional = true } -iced_widget = { git = "https://github.com/iced-rs/iced", rev = "5540ac0", optional = true } -iced_futures = { git = "https://github.com/iced-rs/iced", rev = "5540ac0", optional = true } -iced_core = { git = "https://github.com/iced-rs/iced", rev = "5540ac0", optional = true } -iced_style = { git = "https://github.com/iced-rs/iced", rev = "5540ac0", optional = true } -libcosmic = { git = "https://github.com/pop-os/libcosmic/", default-features = false, features = [ - "tokio", -], optional = true } +] } once_cell = { version = "1.18.0", optional = true } float-cmp = "0.9" # [patch.'https://github.com/pop-os/libcosmic'] -# libcosmic = { path = "../libcosmic" } -# cosmic-config = { path = "../libcosmic/cosmic-config" } -# cosmic-theme = { path = "../libcosmic/cosmic-theme" } +# libcosmic = { path = "../fork/libcosmic" } +# cosmic-config = { path = "../fork/libcosmic/cosmic-config" } +# cosmic-theme = { path = "../fork/libcosmic/cosmic-theme" } diff --git a/examples/pong/src/layer.rs b/examples/pong/src/layer.rs index fc92b62..6aef802 100644 --- a/examples/pong/src/layer.rs +++ b/examples/pong/src/layer.rs @@ -143,7 +143,7 @@ where state: &mut Tree, layout: Layout<'_>, renderer: &Renderer, - operation: &mut dyn widget::Operation, + operation: &mut dyn widget::Operation<()>, ) { self.base .as_widget() @@ -236,7 +236,7 @@ where &mut self, layout: Layout<'_>, renderer: &Renderer, - operation: &mut dyn widget::Operation, + operation: &mut dyn widget::Operation<()>, ) { self.content.as_widget().operate( self.tree, diff --git a/src/keyframes.rs b/src/keyframes.rs index 2dfec03..9758f4a 100644 --- a/src/keyframes.rs +++ b/src/keyframes.rs @@ -1,33 +1,14 @@ -mod button; -#[cfg(feature = "libcosmic")] mod cards; -mod column; -mod container; mod helpers; -mod row; -mod space; -mod style_button; -mod style_container; mod toggler; use crate::reexports::iced_core::{widget, Length}; -pub use button::Button; -#[cfg(feature = "libcosmic")] pub use cards::Cards; -pub use column::Column; -pub use container::Container; -#[cfg(feature = "libcosmic")] pub use helpers::cards; pub use helpers::id; pub use helpers::lazy; -pub use helpers::{ - button, chain, column, container, row, space, style_button, style_container, toggler, -}; -pub use row::Row; -pub use space::Space; -pub use style_button::StyleButton; -pub use style_container::StyleContainer; +pub use helpers::{chain, toggler}; pub use toggler::Toggler; use crate::Timeline; diff --git a/src/keyframes/button.rs b/src/keyframes/button.rs deleted file mode 100644 index b2d9237..0000000 --- a/src/keyframes/button.rs +++ /dev/null @@ -1,212 +0,0 @@ -use self::iced_core::{widget::Id as IcedId, Element, Length, Padding, Renderer as IcedRenderer}; -use crate::reexports::{iced_core, iced_style, iced_widget}; - -use crate::keyframes::{as_f32, get_length, Repeat}; -use crate::timeline::Frame; -use crate::{Ease, Linear, MovementType}; - -/// A Button's animation Id. Used for linking animation built in `update()` with widget output in `view()` -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Id(IcedId); - -impl Id { - /// Creates a custom [`Id`]. - pub fn new(id: impl Into>) -> Self { - Self(IcedId::new(id)) - } - - /// Creates a unique [`Id`]. - /// - /// This function produces a different [`Id`] every time it is called. - #[must_use] - pub fn unique() -> Self { - Self(IcedId::unique()) - } - - /// Used by [`crate::chain!`] macro - #[must_use] - pub fn into_chain(self) -> Chain { - Chain::new(self) - } - - /// Used by [`crate::chain!`] macro - #[must_use] - pub fn into_chain_with_children(self, children: Vec