From df479e983e5bf600c0c34180f0b8906172808cb7 Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Wed, 27 Dec 2023 19:02:59 -0800 Subject: [PATCH] Renaming crate to Cushy Refs #117 --- .crate-docs.md | 36 +++++----- .github/workflows/docs.yml | 2 +- .rustme/config.ron | 12 ++-- .rustme/docs.md | 32 ++++----- .rustme/header.md | 2 +- CHANGELOG.md | 29 ++++---- Cargo.lock | 72 +++++++++---------- Cargo.toml | 6 +- README.md | 42 +++++------ {gooey-macros => cushy-macros}/Cargo.toml | 6 +- cushy-macros/README.md | 5 ++ .../src/animation.rs | 6 +- {gooey-macros => cushy-macros}/src/lib.rs | 0 ...y_macros__animation__test__empty_enum.snap | 6 +- .../gooey_macros__animation__test__enum_.snap | 6 +- ...ooey_macros__animation__test__struct_.snap | 8 +-- ...macros__animation__test__tuple_struct.snap | 8 +-- examples/animation.rs | 16 ++--- examples/background-tasks.rs | 12 ++-- examples/basic-button.rs | 8 +-- examples/buttonception.rs | 10 +-- examples/buttons.rs | 10 +-- examples/canvas.rs | 6 +- examples/checkbox.rs | 10 +-- examples/collapse.rs | 10 +-- examples/contacts.rs | 10 +-- examples/container-shadow.rs | 16 ++--- examples/containers.rs | 12 ++-- examples/counter.rs | 8 +-- examples/cursor-icon.rs | 12 ++-- examples/custom-widgets.rs | 22 +++--- examples/focus-order.rs | 14 ++-- examples/focus.rs | 14 ++-- examples/gameui.rs | 10 +-- examples/image.rs | 16 ++--- examples/input.rs | 10 +-- examples/layers.rs | 8 +-- examples/login.rs | 14 ++-- examples/manual-tabs.rs | 8 +-- examples/multi-window.rs | 16 ++--- examples/nested-scroll.rs | 10 +-- examples/overlays.rs | 10 +-- examples/progress.rs | 12 ++-- examples/radio.rs | 8 +-- examples/scroll.rs | 6 +- examples/select.rs | 8 +-- examples/slider.rs | 18 ++--- examples/stack-align-test.rs | 6 +- examples/style.rs | 12 ++-- examples/switcher.rs | 8 +-- examples/theme.rs | 28 ++++---- examples/tic-tac-toe.rs | 10 +-- examples/tilemap.rs | 22 +++--- examples/typography.rs | 6 +- examples/validation.rs | 10 +-- examples/window-properties.rs | 10 +-- examples/wrap.rs | 12 ++-- gooey-macros/README.md | 5 -- src/animation.rs | 14 ++-- src/app.rs | 32 ++++----- src/context.rs | 2 +- src/lib.rs | 6 +- src/names.rs | 2 +- src/styles.rs | 6 +- src/styles/components.rs | 12 ++-- src/value.rs | 8 +-- src/widget.rs | 44 ++++++------ src/widgets/button.rs | 2 +- src/widgets/custom.rs | 2 +- src/widgets/layers.rs | 2 +- src/window.rs | 66 ++++++++--------- 71 files changed, 476 insertions(+), 473 deletions(-) rename {gooey-macros => cushy-macros}/Cargo.toml (72%) create mode 100644 cushy-macros/README.md rename {gooey-macros => cushy-macros}/src/animation.rs (95%) rename {gooey-macros => cushy-macros}/src/lib.rs (100%) rename {gooey-macros => cushy-macros}/src/snapshots/gooey_macros__animation__test__empty_enum.snap (77%) rename {gooey-macros => cushy-macros}/src/snapshots/gooey_macros__animation__test__enum_.snap (81%) rename {gooey-macros => cushy-macros}/src/snapshots/gooey_macros__animation__test__struct_.snap (67%) rename {gooey-macros => cushy-macros}/src/snapshots/gooey_macros__animation__test__tuple_struct.snap (66%) delete mode 100644 gooey-macros/README.md diff --git a/.crate-docs.md b/.crate-docs.md index f9a45a2..29396ae 100644 --- a/.crate-docs.md +++ b/.crate-docs.md @@ -1,14 +1,14 @@ -![Gooey is considered alpha and unsupported](https://img.shields.io/badge/status-alpha-orange) -[![crate version](https://img.shields.io/crates/v/gooey.svg)](https://crates.io/crates/gooey) -[![Documentation for `main` branch](https://img.shields.io/badge/docs-main-informational)](https://gooey.rs/main/docs/gooey/) +![Cushy is considered alpha and unsupported](https://img.shields.io/badge/status-alpha-orange) +[![crate version](https://img.shields.io/crates/v/cushy.svg)](https://crates.io/crates/cushy) +[![Documentation for `main` branch](https://img.shields.io/badge/docs-main-informational)](https://khonsu.dev/cushy/main/docs/cushy/) -Gooey is an experimental Graphical User Interface (GUI) crate for the Rust +Cushy is an experimental Graphical User Interface (GUI) crate for the Rust programming language. It features a reactive data model and aims to enable easily creating responsive, efficient user interfaces. To enable easy -cross-platform development, Gooey uses its own collection of consistently-styled +cross-platform development, Cushy uses its own collection of consistently-styled [`Widget`s][widget]. -Gooey is powered by: +Cushy is powered by: - [`Kludgine`][kludgine], a 2d graphics library powered by: - [`winit`][winit] for windowing/input @@ -18,19 +18,19 @@ Gooey is powered by: - [`arboard`][arboard] for clipboard support - [`figures`][figures] for integer-based 2d math -## Getting Started with Gooey +## Getting Started with Cushy -The [`Widget`][widget] trait is the building block of Gooey: Every user +The [`Widget`][widget] trait is the building block of Cushy: Every user interface element implements `Widget`. The `Widget` trait -[documentation][widget] has an overview of how Gooey works. A list of built-in -widgets can be found in the [`gooey::widgets`][widgets] module. +[documentation][widget] has an overview of how Cushy works. A list of built-in +widgets can be found in the [`cushy::widgets`][widgets] module. -Gooey uses a reactive data model. To see [an example][button-example] of how +Cushy uses a reactive data model. To see [an example][button-example] of how reactive data models work, consider this example that displays a button that increments its own label: ```rust,ignore -fn main() -> gooey::Result { +fn main() -> cushy::Result { // Create a dynamic usize. let count = Dynamic::new(0_isize); // Create a dynamic that contains `count.to_string()` @@ -46,8 +46,8 @@ fn main() -> gooey::Result { } ``` -A great way to learn more about Gooey is to explore the [examples -directory][examples]. Nearly every feature in Gooey was initially tested by +A great way to learn more about Cushy is to explore the [examples +directory][examples]. Nearly every feature in Cushy was initially tested by creating an example. ## Project Status @@ -61,12 +61,12 @@ If you would like to contribute, bug fixes are always appreciated. Before working on a new feature, please [open an issue][issues] proposing the feature and problem it aims to solve. Doing so will help prevent friction in merging pull requests, as it ensures changes fit the vision the maintainers have for -Gooey. +Cushy. [widget]: crate::widget::Widget [widgets]: mod@crate::widgets -[button-example]: https://github.com/khonsulabs/gooey/tree/main/examples/basic-button.rs -[examples]: https://github.com/khonsulabs/gooey/tree/main/examples/ +[button-example]: https://github.com/khonsulabs/cushy/tree/main/examples/basic-button.rs +[examples]: https://github.com/khonsulabs/cushy/tree/main/examples/ [kludgine]: https://github.com/khonsulabs/kludgine [figures]: https://github.com/khonsulabs/figures [wgpu]: https://github.com/gfx-rs/wgpu @@ -75,7 +75,7 @@ Gooey. [palette]: https://github.com/Ogeon/palette [arboard]: https://github.com/1Password/arboard [ecton]: https://github.com/khonsulabs/ecton -[issues]: https://github.com/khonsulabs/gooey/issues +[issues]: https://github.com/khonsulabs/cushy/issues ## Open-source Licenses diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6562309..5e7c422 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -30,6 +30,6 @@ jobs: url: ${{ secrets.DOSSIER_URL }} api-key-id: ${{ secrets.DOSSIER_API_KEY_ID }} api-key: ${{ secrets.DOSSIER_API_KEY }} - project: gooey + project: cushy from: target/doc/ to: /${{ github.ref_name }}/docs \ No newline at end of file diff --git a/.rustme/config.ron b/.rustme/config.ron index b157243..6122b39 100644 --- a/.rustme/config.ron +++ b/.rustme/config.ron @@ -37,17 +37,17 @@ Configuration( release: "v0.1.3", ), "docs": ( - default: "https://gooey.rs/main/docs/gooey/", - release: "https://docs.rs/gooey", + default: "https://khonsu.dev/cushy/main/docs/cushy/", + release: "https://docs.rs/cushy", ), "widget": ( - default: "https://gooey.rs/main/docs/gooey/widget/trait.Widget.html", - release: "https://docs.rs/gooey/*/gooey/widget/trait.Widget.html", + default: "https://khonsu.dev/cushy/main/docs/cushy/widget/trait.Widget.html", + release: "https://docs.rs/cushy/*/cushy/widget/trait.Widget.html", for_docs: "crate::widget::Widget", ), "widgets": ( - default: "https://gooey.rs/main/docs/gooey/widgets/index.html", - release: "https://docs.rs/gooey/*/gooey/widgets/index.html", + default: "https://khonsu.dev/cushy/main/docs/cushy/widgets/index.html", + release: "https://docs.rs/cushy/*/cushy/widgets/index.html", for_docs: "mod@crate::widgets", ), }, diff --git a/.rustme/docs.md b/.rustme/docs.md index 6937956..89a8d70 100644 --- a/.rustme/docs.md +++ b/.rustme/docs.md @@ -1,14 +1,14 @@ -![Gooey is considered alpha and unsupported](https://img.shields.io/badge/status-alpha-orange) -[![crate version](https://img.shields.io/crates/v/gooey.svg)](https://crates.io/crates/gooey) +![Cushy is considered alpha and unsupported](https://img.shields.io/badge/status-alpha-orange) +[![crate version](https://img.shields.io/crates/v/cushy.svg)](https://crates.io/crates/cushy) [![Documentation for `main` branch](https://img.shields.io/badge/docs-main-informational)]($docs$) -Gooey is an experimental Graphical User Interface (GUI) crate for the Rust +Cushy is an experimental Graphical User Interface (GUI) crate for the Rust programming language. It features a reactive data model and aims to enable easily creating responsive, efficient user interfaces. To enable easy -cross-platform development, Gooey uses its own collection of consistently-styled +cross-platform development, Cushy uses its own collection of consistently-styled [`Widget`s][widget]. -Gooey is powered by: +Cushy is powered by: - [`Kludgine`][kludgine], a 2d graphics library powered by: - [`winit`][winit] for windowing/input @@ -18,14 +18,14 @@ Gooey is powered by: - [`arboard`][arboard] for clipboard support - [`figures`][figures] for integer-based 2d math -## Getting Started with Gooey +## Getting Started with Cushy -The [`Widget`][widget] trait is the building block of Gooey: Every user +The [`Widget`][widget] trait is the building block of Cushy: Every user interface element implements `Widget`. The `Widget` trait -[documentation][widget] has an overview of how Gooey works. A list of built-in -widgets can be found in the [`gooey::widgets`][widgets] module. +[documentation][widget] has an overview of how Cushy works. A list of built-in +widgets can be found in the [`cushy::widgets`][widgets] module. -Gooey uses a reactive data model. To see [an example][button-example] of how +Cushy uses a reactive data model. To see [an example][button-example] of how reactive data models work, consider this example that displays a button that increments its own label: @@ -33,8 +33,8 @@ increments its own label: $../examples/basic-button.rs:readme$ ``` -A great way to learn more about Gooey is to explore the [examples -directory][examples]. Nearly every feature in Gooey was initially tested by +A great way to learn more about Cushy is to explore the [examples +directory][examples]. Nearly every feature in Cushy was initially tested by creating an example. ## Project Status @@ -48,12 +48,12 @@ If you would like to contribute, bug fixes are always appreciated. Before working on a new feature, please [open an issue][issues] proposing the feature and problem it aims to solve. Doing so will help prevent friction in merging pull requests, as it ensures changes fit the vision the maintainers have for -Gooey. +Cushy. [widget]: $widget$ [widgets]: $widgets$ -[button-example]: https://github.com/khonsulabs/gooey/tree/$ref-name$/examples/basic-button.rs -[examples]: https://github.com/khonsulabs/gooey/tree/$ref-name$/examples/ +[button-example]: https://github.com/khonsulabs/cushy/tree/$ref-name$/examples/basic-button.rs +[examples]: https://github.com/khonsulabs/cushy/tree/$ref-name$/examples/ [kludgine]: https://github.com/khonsulabs/kludgine [figures]: https://github.com/khonsulabs/figures [wgpu]: https://github.com/gfx-rs/wgpu @@ -62,4 +62,4 @@ Gooey. [palette]: https://github.com/Ogeon/palette [arboard]: https://github.com/1Password/arboard [ecton]: https://github.com/khonsulabs/ecton -[issues]: https://github.com/khonsulabs/gooey/issues +[issues]: https://github.com/khonsulabs/cushy/issues diff --git a/.rustme/header.md b/.rustme/header.md index 0155ff5..08a3154 100644 --- a/.rustme/header.md +++ b/.rustme/header.md @@ -1 +1 @@ -# Gooey +# Cushy diff --git a/CHANGELOG.md b/CHANGELOG.md index dd9f38c..9cad4c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Breaking Changes +- This crate has been renamed from `Gooey` to `Cushy`. Other than the name of + the library changing, the only type to change name is `Gooey` -> `Cushy`. This + changelog has had all references and links updated. - Many bounds required `UnwindSafe` due to a misunderstanding on how to handle this trait in `appit`. All requirements for `UnwindSafe` have been removed. -- `Gooey` no longer implements default. To gain access to a `Gooey` instance, +- `Cushy` no longer implements default. To gain access to a `Cushy` instance, create a `PendingApp` or get a reference to the running `App`. -- `Window::new` no longer accepts a `Gooey` parameter. The window now adopts the - `Gooey` from the application it is opened within. +- `Window::new` no longer accepts a `Cushy` parameter. The window now adopts the + `Cushy` from the application it is opened within. - `MakeWidget::into_window()` no longer takes any parameters. ### Changed @@ -61,10 +64,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 application. The `multi-window` example demonstates using this feature to open multiple - windows before starting Gooey as well as dynamically opening windows at + windows before starting Cushy as well as dynamically opening windows at runtime. - `Window::on_close` sets a callback to be invoked when the window has closed. -- `WindowHandle` is a handle to a Gooey window. It enables requesting that the +- `WindowHandle` is a handle to a Cushy window. It enables requesting that the window closes, refreshing the window, or invalidating a widget contained in the window. - `RunningWindow::handle()` returns a `WindowHandle` for the current window. @@ -89,10 +92,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ensuring the callback stays alive as long as the dynamic has an instance alive. -[91]: https://github.com/khonsulabs/gooey/issues/91 -[92]: https://github.com/khonsulabs/gooey/issues/92 -[112]: https://github.com/khonsulabs/gooey/issues/112 -[113]: https://github.com/khonsulabs/gooey/issues/113 +[91]: https://github.com/khonsulabs/cushy/issues/91 +[92]: https://github.com/khonsulabs/cushy/issues/92 +[112]: https://github.com/khonsulabs/cushy/issues/112 +[113]: https://github.com/khonsulabs/cushy/issues/113 ## v0.1.3 (2023-12-19) @@ -120,14 +123,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - An integer underflow has been fixed in the Grid/Stack widgets. - Padding is now rounded to the nearest whole pixel when applied across widgets. -[94]: https://github.com/khonsulabs/gooey/pull/94 -[97]: https://github.com/khonsulabs/gooey/issues/97 +[94]: https://github.com/khonsulabs/cushy/pull/94 +[97]: https://github.com/khonsulabs/cushy/issues/97 ## v0.1.2 (2023-12-18) ### Fixed -- Gooey now compiles for Windows. An indirect dependency, `appit`, also needs to +- Cushy now compiles for Windows. An indirect dependency, `appit`, also needs to be updated to v0.1.1. Running `cargo update` should be enough to update `appit`. @@ -137,4 +140,4 @@ This release only contains fixed links in the README. No code was changed. ## v0.1.0 (2023-12-18) -This is the initial alpha release of Gooey. +This is the initial alpha release of Cushy. diff --git a/Cargo.lock b/Cargo.lock index b7f8883..f171546 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -567,6 +567,42 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" +[[package]] +name = "cushy" +version = "0.1.3" +dependencies = [ + "ahash", + "alot", + "arboard", + "cushy-macros", + "image", + "intentional", + "interner", + "kempt", + "kludgine", + "palette", + "pollster", + "rand", + "tracing", + "tracing-subscriber", + "unicode-segmentation", + "zeroize", +] + +[[package]] +name = "cushy-macros" +version = "0.1.0" +dependencies = [ + "attribute-derive", + "insta", + "manyhow 0.10.4", + "prettyplease", + "proc-macro2", + "quote", + "quote-use 0.8.0", + "syn", +] + [[package]] name = "d3d12" version = "0.7.0" @@ -897,42 +933,6 @@ dependencies = [ "gl_generator", ] -[[package]] -name = "gooey" -version = "0.1.3" -dependencies = [ - "ahash", - "alot", - "arboard", - "gooey-macros", - "image", - "intentional", - "interner", - "kempt", - "kludgine", - "palette", - "pollster", - "rand", - "tracing", - "tracing-subscriber", - "unicode-segmentation", - "zeroize", -] - -[[package]] -name = "gooey-macros" -version = "0.1.0" -dependencies = [ - "attribute-derive", - "insta", - "manyhow 0.10.4", - "prettyplease", - "proc-macro2", - "quote", - "quote-use 0.8.0", - "syn", -] - [[package]] name = "gpu-alloc" version = "0.6.0" diff --git a/Cargo.toml b/Cargo.toml index a399635..67d0cbb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [workspace] [package] -name = "gooey" +name = "cushy" version = "0.1.3" edition = "2021" description = "A wgpu-powered graphical user interface (GUI) library with a reactive data model" -repository = "https://github.com/khonsulabs/gooey" +repository = "https://github.com/khonsulabs/cushy" license = "MIT OR Apache-2.0" keywords = ["gui", "ui", "widgets", "reactive"] categories = ["gui"] @@ -33,7 +33,7 @@ tracing-subscriber = { version = "0.3", optional = true, features = [ ] } palette = "0.7.3" ahash = "0.8.6" -gooey-macros = { version = "0.1.0", path = "gooey-macros" } +cushy-macros = { version = "0.1.0", path = "cushy-macros" } arboard = "3.2.1" zeroize = "1.6.1" unicode-segmentation = "1.10.1" diff --git a/README.md b/README.md index 9228c1d..b910e9e 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ -# Gooey +# Cushy -![Gooey is considered alpha and unsupported](https://img.shields.io/badge/status-alpha-orange) -[![crate version](https://img.shields.io/crates/v/gooey.svg)](https://crates.io/crates/gooey) -[![Documentation for `main` branch](https://img.shields.io/badge/docs-main-informational)](https://gooey.rs/main/docs/gooey/) +![Cushy is considered alpha and unsupported](https://img.shields.io/badge/status-alpha-orange) +[![crate version](https://img.shields.io/crates/v/cushy.svg)](https://crates.io/crates/cushy) +[![Documentation for `main` branch](https://img.shields.io/badge/docs-main-informational)](https://cushy.rs/main/docs/cushy/) -Gooey is an experimental Graphical User Interface (GUI) crate for the Rust +Cushy is an experimental Graphical User Interface (GUI) crate for the Rust programming language. It features a reactive data model and aims to enable easily creating responsive, efficient user interfaces. To enable easy -cross-platform development, Gooey uses its own collection of consistently-styled +cross-platform development, Cushy uses its own collection of consistently-styled [`Widget`s][widget]. -Gooey is powered by: +Cushy is powered by: - [`Kludgine`][kludgine], a 2d graphics library powered by: - [`winit`][winit] for windowing/input @@ -20,19 +20,19 @@ Gooey is powered by: - [`arboard`][arboard] for clipboard support - [`figures`][figures] for integer-based 2d math -## Getting Started with Gooey +## Getting Started with Cushy -The [`Widget`][widget] trait is the building block of Gooey: Every user +The [`Widget`][widget] trait is the building block of Cushy: Every user interface element implements `Widget`. The `Widget` trait -[documentation][widget] has an overview of how Gooey works. A list of built-in -widgets can be found in the [`gooey::widgets`][widgets] module. +[documentation][widget] has an overview of how Cushy works. A list of built-in +widgets can be found in the [`cushy::widgets`][widgets] module. -Gooey uses a reactive data model. To see [an example][button-example] of how +Cushy uses a reactive data model. To see [an example][button-example] of how reactive data models work, consider this example that displays a button that increments its own label: ```rust,ignore -fn main() -> gooey::Result { +fn main() -> cushy::Result { // Create a dynamic usize. let count = Dynamic::new(0_isize); // Create a dynamic that contains `count.to_string()` @@ -48,8 +48,8 @@ fn main() -> gooey::Result { } ``` -A great way to learn more about Gooey is to explore the [examples -directory][examples]. Nearly every feature in Gooey was initially tested by +A great way to learn more about Cushy is to explore the [examples +directory][examples]. Nearly every feature in Cushy was initially tested by creating an example. ## Project Status @@ -63,12 +63,12 @@ If you would like to contribute, bug fixes are always appreciated. Before working on a new feature, please [open an issue][issues] proposing the feature and problem it aims to solve. Doing so will help prevent friction in merging pull requests, as it ensures changes fit the vision the maintainers have for -Gooey. +Cushy. -[widget]: https://gooey.rs/main/docs/gooey/widget/trait.Widget.html -[widgets]: https://gooey.rs/main/docs/gooey/widgets/index.html -[button-example]: https://github.com/khonsulabs/gooey/tree/main/examples/basic-button.rs -[examples]: https://github.com/khonsulabs/gooey/tree/main/examples/ +[widget]: https://cushy.rs/main/docs/cushy/widget/trait.Widget.html +[widgets]: https://cushy.rs/main/docs/cushy/widgets/index.html +[button-example]: https://github.com/khonsulabs/cushy/tree/main/examples/basic-button.rs +[examples]: https://github.com/khonsulabs/cushy/tree/main/examples/ [kludgine]: https://github.com/khonsulabs/kludgine [figures]: https://github.com/khonsulabs/figures [wgpu]: https://github.com/gfx-rs/wgpu @@ -77,7 +77,7 @@ Gooey. [palette]: https://github.com/Ogeon/palette [arboard]: https://github.com/1Password/arboard [ecton]: https://github.com/khonsulabs/ecton -[issues]: https://github.com/khonsulabs/gooey/issues +[issues]: https://github.com/khonsulabs/cushy/issues ## Open-source Licenses diff --git a/gooey-macros/Cargo.toml b/cushy-macros/Cargo.toml similarity index 72% rename from gooey-macros/Cargo.toml rename to cushy-macros/Cargo.toml index 4380c16..fcd5ed6 100644 --- a/gooey-macros/Cargo.toml +++ b/cushy-macros/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "gooey-macros" +name = "cushy-macros" version = "0.1.0" edition = "2021" -description = "Macros for the Gooey GUI framework" -repository = "https://github.com/khonsulabs/gooey" +description = "Macros for the Cushy GUI framework" +repository = "https://github.com/khonsulabs/cushy" license = "MIT OR Apache-2.0" readme = "./README.md" diff --git a/cushy-macros/README.md b/cushy-macros/README.md new file mode 100644 index 0000000..9c090f8 --- /dev/null +++ b/cushy-macros/README.md @@ -0,0 +1,5 @@ +# cushy-macros + +This crate contains procedural macros that [Cushy][cushy] exposes. + +[cushy]: https://github.com/khonsulabs/cushy diff --git a/gooey-macros/src/animation.rs b/cushy-macros/src/animation.rs similarity index 95% rename from gooey-macros/src/animation.rs rename to cushy-macros/src/animation.rs index 15a7a12..b1ae8cf 100644 --- a/gooey-macros/src/animation.rs +++ b/cushy-macros/src/animation.rs @@ -29,7 +29,7 @@ pub fn linear_interpolate( let ident = ident .map(ToTokens::into_token_stream) .unwrap_or_else(|| proc_macro2::Literal::usize_unsuffixed(idx).into_token_stream()); - quote!(#ident: ::gooey::animation::LinearInterpolate::lerp(&self.#ident, &__target.#ident, __percent),) + quote!(#ident: ::cushy::animation::LinearInterpolate::lerp(&self.#ident, &__target.#ident, __percent),) }), }; doc = "# Panics\n Panics if any field's lerp panics (this should only happen on percentages outside 0..1 range)."; @@ -62,7 +62,7 @@ pub fn linear_interpolate( let idx: Vec<_> = (0..variants.len()).collect(); doc = "# Panics\n Panics if the the enum variants are overflown (this can only happen on percentages outside 0..1 range)."; quote! { - # use ::gooey::animation::LinearInterpolate; + # use ::cushy::animation::LinearInterpolate; fn variant_to_index(__v: &#item_ident) -> usize { match __v { #(#variants => #idx,)* @@ -80,7 +80,7 @@ pub fn linear_interpolate( }; Ok(quote! { - impl ::gooey::animation::LinearInterpolate for #item_ident { + impl ::cushy::animation::LinearInterpolate for #item_ident { #[doc = #doc] fn lerp(&self, __target: &Self, __percent: f32) -> Self { #body diff --git a/gooey-macros/src/lib.rs b/cushy-macros/src/lib.rs similarity index 100% rename from gooey-macros/src/lib.rs rename to cushy-macros/src/lib.rs diff --git a/gooey-macros/src/snapshots/gooey_macros__animation__test__empty_enum.snap b/cushy-macros/src/snapshots/gooey_macros__animation__test__empty_enum.snap similarity index 77% rename from gooey-macros/src/snapshots/gooey_macros__animation__test__empty_enum.snap rename to cushy-macros/src/snapshots/gooey_macros__animation__test__empty_enum.snap index 792d903..5893d85 100644 --- a/gooey-macros/src/snapshots/gooey_macros__animation__test__empty_enum.snap +++ b/cushy-macros/src/snapshots/gooey_macros__animation__test__empty_enum.snap @@ -1,8 +1,8 @@ --- -source: gooey-macros/src/animation.rs +source: cushy-macros/src/animation.rs expression: unparse(ok) --- -impl ::gooey::animation::LinearInterpolate for Enum { +impl ::cushy::animation::LinearInterpolate for Enum { /**# Panics Panics if the the enum variants are overflown (this can only happen on percentages outside 0..1 range).*/ fn lerp(&self, __target: &Self, __percent: f32) -> Self { @@ -11,7 +11,7 @@ impl ::gooey::animation::LinearInterpolate for Enum { } let __self = variant_to_index(&self); let __target = variant_to_index(&self); - match ::gooey::animation::LinearInterpolate::lerp( + match ::cushy::animation::LinearInterpolate::lerp( &__self, &__target, __percent, diff --git a/gooey-macros/src/snapshots/gooey_macros__animation__test__enum_.snap b/cushy-macros/src/snapshots/gooey_macros__animation__test__enum_.snap similarity index 81% rename from gooey-macros/src/snapshots/gooey_macros__animation__test__enum_.snap rename to cushy-macros/src/snapshots/gooey_macros__animation__test__enum_.snap index 7076744..4ac47c7 100644 --- a/gooey-macros/src/snapshots/gooey_macros__animation__test__enum_.snap +++ b/cushy-macros/src/snapshots/gooey_macros__animation__test__enum_.snap @@ -1,8 +1,8 @@ --- -source: gooey-macros/src/animation.rs +source: cushy-macros/src/animation.rs expression: unparse(ok) --- -impl ::gooey::animation::LinearInterpolate for Enum { +impl ::cushy::animation::LinearInterpolate for Enum { /**# Panics Panics if the the enum variants are overflown (this can only happen on percentages outside 0..1 range).*/ fn lerp(&self, __target: &Self, __percent: f32) -> Self { @@ -14,7 +14,7 @@ impl ::gooey::animation::LinearInterpolate for Enum { } let __self = variant_to_index(&self); let __target = variant_to_index(&self); - match ::gooey::animation::LinearInterpolate::lerp( + match ::cushy::animation::LinearInterpolate::lerp( &__self, &__target, __percent, diff --git a/gooey-macros/src/snapshots/gooey_macros__animation__test__struct_.snap b/cushy-macros/src/snapshots/gooey_macros__animation__test__struct_.snap similarity index 67% rename from gooey-macros/src/snapshots/gooey_macros__animation__test__struct_.snap rename to cushy-macros/src/snapshots/gooey_macros__animation__test__struct_.snap index f32fcd0..2f886e8 100644 --- a/gooey-macros/src/snapshots/gooey_macros__animation__test__struct_.snap +++ b/cushy-macros/src/snapshots/gooey_macros__animation__test__struct_.snap @@ -1,18 +1,18 @@ --- -source: gooey-macros/src/animation.rs +source: cushy-macros/src/animation.rs expression: unparse(ok) --- -impl ::gooey::animation::LinearInterpolate for HelloWorld { +impl ::cushy::animation::LinearInterpolate for HelloWorld { /**# Panics Panics if any field's lerp panics (this should only happen on percentages outside 0..1 range).*/ fn lerp(&self, __target: &Self, __percent: f32) -> Self { HelloWorld { - fielda: ::gooey::animation::LinearInterpolate::lerp( + fielda: ::cushy::animation::LinearInterpolate::lerp( &self.fielda, &__target.fielda, __percent, ), - fieldb: ::gooey::animation::LinearInterpolate::lerp( + fieldb: ::cushy::animation::LinearInterpolate::lerp( &self.fieldb, &__target.fieldb, __percent, diff --git a/gooey-macros/src/snapshots/gooey_macros__animation__test__tuple_struct.snap b/cushy-macros/src/snapshots/gooey_macros__animation__test__tuple_struct.snap similarity index 66% rename from gooey-macros/src/snapshots/gooey_macros__animation__test__tuple_struct.snap rename to cushy-macros/src/snapshots/gooey_macros__animation__test__tuple_struct.snap index 6152743..7eb6ec8 100644 --- a/gooey-macros/src/snapshots/gooey_macros__animation__test__tuple_struct.snap +++ b/cushy-macros/src/snapshots/gooey_macros__animation__test__tuple_struct.snap @@ -1,18 +1,18 @@ --- -source: gooey-macros/src/animation.rs +source: cushy-macros/src/animation.rs expression: unparse(ok) --- -impl ::gooey::animation::LinearInterpolate for HelloWorld { +impl ::cushy::animation::LinearInterpolate for HelloWorld { /**# Panics Panics if any field's lerp panics (this should only happen on percentages outside 0..1 range).*/ fn lerp(&self, __target: &Self, __percent: f32) -> Self { HelloWorld { - 0: ::gooey::animation::LinearInterpolate::lerp( + 0: ::cushy::animation::LinearInterpolate::lerp( &self.0, &__target.0, __percent, ), - 1: ::gooey::animation::LinearInterpolate::lerp( + 1: ::cushy::animation::LinearInterpolate::lerp( &self.1, &__target.1, __percent, diff --git a/examples/animation.rs b/examples/animation.rs index c28e255..f8f015d 100644 --- a/examples/animation.rs +++ b/examples/animation.rs @@ -1,21 +1,21 @@ use std::time::Duration; -use gooey::animation::{AnimationHandle, AnimationTarget, IntoAnimate, Spawn}; -use gooey::value::Dynamic; -use gooey::widget::MakeWidget; -use gooey::widgets::progress::Progressable; -use gooey::{Run, WithClone}; +use cushy::animation::{AnimationHandle, AnimationTarget, IntoAnimate, Spawn}; +use cushy::value::Dynamic; +use cushy::widget::MakeWidget; +use cushy::widgets::progress::Progressable; +use cushy::{Run, WithClone}; use kludgine::figures::units::Lp; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let animation = Dynamic::new(AnimationHandle::new()); let value = Dynamic::new(50); - // Gooey's animation system supports using a `Duration` as a step in + // Cushy's animation system supports using a `Duration` as a step in // animation to create a delay. This can also be used to call a function // after a specified amount of time: Duration::from_secs(1) - .on_complete(|| println!("Gooey animations are neat!")) + .on_complete(|| println!("Cushy animations are neat!")) .launch(); "To 0" diff --git a/examples/background-tasks.rs b/examples/background-tasks.rs index 433a5fe..a07c57a 100644 --- a/examples/background-tasks.rs +++ b/examples/background-tasks.rs @@ -3,18 +3,18 @@ use std::time::Duration; -use gooey::animation::ZeroToOne; -use gooey::value::{Dynamic, Switchable}; -use gooey::widget::MakeWidget; -use gooey::widgets::progress::{Progress, Progressable}; -use gooey::Run; +use cushy::animation::ZeroToOne; +use cushy::value::{Dynamic, Switchable}; +use cushy::widget::MakeWidget; +use cushy::widgets::progress::{Progress, Progressable}; +use cushy::Run; #[derive(Debug, Default, Eq, PartialEq)] struct Task { progress: Dynamic, } -fn main() -> gooey::Result { +fn main() -> cushy::Result { let task = Dynamic::new(None::); task.switcher(|task, dynamic| { diff --git a/examples/basic-button.rs b/examples/basic-button.rs index 5dd6cde..356be50 100644 --- a/examples/basic-button.rs +++ b/examples/basic-button.rs @@ -1,9 +1,9 @@ -use gooey::value::Dynamic; -use gooey::widget::MakeWidget; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::MakeWidget; +use cushy::Run; // begin rustme snippet: readme -fn main() -> gooey::Result { +fn main() -> cushy::Result { // Create a dynamic usize. let count = Dynamic::new(0_isize); // Create a dynamic that contains `count.to_string()` diff --git a/examples/buttonception.rs b/examples/buttonception.rs index 6b5e297..bd61bec 100644 --- a/examples/buttonception.rs +++ b/examples/buttonception.rs @@ -16,13 +16,13 @@ //! ┃ ┃ ┣ clicked_button Label //! ``` -use gooey::value::Dynamic; -use gooey::widget::MakeWidget; -use gooey::widgets::button::{ButtonHoverBackground, ButtonHoverForeground}; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::MakeWidget; +use cushy::widgets::button::{ButtonHoverBackground, ButtonHoverForeground}; +use cushy::Run; use kludgine::Color; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let clicked_button = Dynamic::<&'static str>::default(); let inner_button = "So I put buttons in your buttons" diff --git a/examples/buttons.rs b/examples/buttons.rs index 509d676..281602a 100644 --- a/examples/buttons.rs +++ b/examples/buttons.rs @@ -1,9 +1,9 @@ -use gooey::value::Dynamic; -use gooey::widget::MakeWidget; -use gooey::widgets::button::ButtonKind; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::MakeWidget; +use cushy::widgets::button::ButtonKind; +use cushy::Run; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let clicked_label = Dynamic::new(String::from("Click a Button")); let default_is_outline = Dynamic::new(false); let default_button_style = default_is_outline.map_each(|is_outline| { diff --git a/examples/canvas.rs b/examples/canvas.rs index 9b6af76..ada9b49 100644 --- a/examples/canvas.rs +++ b/examples/canvas.rs @@ -1,11 +1,11 @@ -use gooey::widgets::Canvas; -use gooey::{Run, Tick}; +use cushy::widgets::Canvas; +use cushy::{Run, Tick}; use kludgine::figures::{Angle, IntoSigned, Point, Px2D, Rect, Size}; use kludgine::shapes::Shape; use kludgine::text::{Text, TextOrigin}; use kludgine::{Color, DrawableExt}; -fn main() -> gooey::Result<()> { +fn main() -> cushy::Result<()> { let mut angle = Angle::degrees(0); Canvas::new(move |context| { angle += Angle::degrees(1); diff --git a/examples/checkbox.rs b/examples/checkbox.rs index 9108f5a..cce6cec 100644 --- a/examples/checkbox.rs +++ b/examples/checkbox.rs @@ -1,9 +1,9 @@ -use gooey::value::Dynamic; -use gooey::widget::MakeWidget; -use gooey::widgets::checkbox::{Checkable, CheckboxState}; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::MakeWidget; +use cushy::widgets::checkbox::{Checkable, CheckboxState}; +use cushy::Run; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let checkbox_state = Dynamic::new(CheckboxState::Checked); let label = checkbox_state.map_each(|state| format!("Check Me! Current: {state:?}")); diff --git a/examples/collapse.rs b/examples/collapse.rs index 29d0faa..3e3dc62 100644 --- a/examples/collapse.rs +++ b/examples/collapse.rs @@ -1,12 +1,12 @@ -use gooey::value::Dynamic; -use gooey::widget::MakeWidget; -use gooey::widgets::checkbox::Checkable; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::MakeWidget; +use cushy::widgets::checkbox::Checkable; +use cushy::Run; const EXPLANATION: &str = "The collapse widget allows showing and hiding another widget based on a Dynamic."; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let collapse = Dynamic::new(false); collapse diff --git a/examples/contacts.rs b/examples/contacts.rs index 4070d49..c5b53ab 100644 --- a/examples/contacts.rs +++ b/examples/contacts.rs @@ -1,9 +1,9 @@ use std::collections::HashMap; -use gooey::value::{Dynamic, MapEach}; -use gooey::widget::{Children, MakeWidget}; -use gooey::widgets::input::InputValue; -use gooey::Run; +use cushy::value::{Dynamic, MapEach}; +use cushy::widget::{Children, MakeWidget}; +use cushy::widgets::input::InputValue; +use cushy::Run; #[derive(Debug, Clone, Eq, PartialEq)] pub struct Contact { @@ -13,7 +13,7 @@ pub struct Contact { pub title: String, } -fn main() -> gooey::Result { +fn main() -> cushy::Result { let initial_contacts = vec![ Contact { id: 0, diff --git a/examples/container-shadow.rs b/examples/container-shadow.rs index 4cc1062..d192546 100644 --- a/examples/container-shadow.rs +++ b/examples/container-shadow.rs @@ -1,15 +1,15 @@ -use gooey::styles::components::CornerRadius; -use gooey::styles::Dimension; -use gooey::value::{Dynamic, MapEachCloned}; -use gooey::widget::MakeWidget; -use gooey::widgets::container::ContainerShadow; -use gooey::widgets::slider::Slidable; -use gooey::Run; +use cushy::styles::components::CornerRadius; +use cushy::styles::Dimension; +use cushy::value::{Dynamic, MapEachCloned}; +use cushy::widget::MakeWidget; +use cushy::widgets::container::ContainerShadow; +use cushy::widgets::slider::Slidable; +use cushy::Run; use kludgine::figures::units::Lp; use kludgine::figures::{Point, Size}; use kludgine::shapes::CornerRadii; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let top_left = Dynamic::new(Lp::mm(1)); let top_right = Dynamic::new(Lp::mm(1)); let bottom_right = Dynamic::new(Lp::mm(1)); diff --git a/examples/containers.rs b/examples/containers.rs index 9b30d60..965a8d6 100644 --- a/examples/containers.rs +++ b/examples/containers.rs @@ -1,12 +1,12 @@ -use gooey::value::Dynamic; -use gooey::widget::{MakeWidget, WidgetInstance}; -use gooey::widgets::container::ContainerShadow; -use gooey::window::ThemeMode; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::{MakeWidget, WidgetInstance}; +use cushy::widgets::container::ContainerShadow; +use cushy::window::ThemeMode; +use cushy::Run; use kludgine::figures::units::Lp; use kludgine::figures::Point; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let theme_mode = Dynamic::default(); set_of_containers(3, theme_mode.clone()) .centered() diff --git a/examples/counter.rs b/examples/counter.rs index 3ceebc6..e302daf 100644 --- a/examples/counter.rs +++ b/examples/counter.rs @@ -1,11 +1,11 @@ use std::string::ToString; -use gooey::value::Dynamic; -use gooey::widget::MakeWidget; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::MakeWidget; +use cushy::Run; use kludgine::figures::units::Lp; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let counter = Dynamic::new(0i32); let label = counter.map_each(ToString::to_string); diff --git a/examples/cursor-icon.rs b/examples/cursor-icon.rs index 35c0b8c..1b21014 100644 --- a/examples/cursor-icon.rs +++ b/examples/cursor-icon.rs @@ -1,11 +1,11 @@ -use gooey::value::Dynamic; -use gooey::widget::MakeWidget; -use gooey::widgets::input::InputValue; -use gooey::widgets::Custom; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::MakeWidget; +use cushy::widgets::input::InputValue; +use cushy::widgets::Custom; +use cushy::Run; use kludgine::app::winit::window::CursorIcon; -fn main() -> gooey::Result { +fn main() -> cushy::Result { Custom::new( "Try hovering the mouse cursor around this window" .and( diff --git a/examples/custom-widgets.rs b/examples/custom-widgets.rs index 624739d..ecb3db1 100644 --- a/examples/custom-widgets.rs +++ b/examples/custom-widgets.rs @@ -1,15 +1,15 @@ //! This example shows two approaches to writing custom widgets: implementing //! traits or using the [`Custom`] widget with callbacks. -use gooey::value::Dynamic; -use gooey::widget::{MakeWidget, MakeWidgetWithTag, Widget, WidgetInstance, WidgetTag, HANDLED}; -use gooey::widgets::Custom; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::{MakeWidget, MakeWidgetWithTag, Widget, WidgetInstance, WidgetTag, HANDLED}; +use cushy::widgets::Custom; +use cushy::Run; use kludgine::figures::units::{Lp, UPx}; use kludgine::figures::{ScreenScale, Size}; use kludgine::Color; -fn main() -> gooey::Result { +fn main() -> cushy::Result { "Inline Widgets" .and(callback_widget()) .into_rows() @@ -90,14 +90,14 @@ impl Default for Toggle { } impl Widget for Toggle { - fn redraw(&mut self, context: &mut gooey::context::GraphicsContext<'_, '_, '_, '_, '_>) { + fn redraw(&mut self, context: &mut cushy::context::GraphicsContext<'_, '_, '_, '_, '_>) { context.fill(self.color.get_tracking_redraw(context)); } fn layout( &mut self, - available_space: Size, - context: &mut gooey::context::LayoutContext<'_, '_, '_, '_, '_>, + available_space: Size, + context: &mut cushy::context::LayoutContext<'_, '_, '_, '_, '_>, ) -> Size { Size::new( available_space.width.min(), @@ -108,7 +108,7 @@ impl Widget for Toggle { fn hit_test( &mut self, _location: kludgine::figures::Point, - _context: &mut gooey::context::EventContext<'_, '_>, + _context: &mut cushy::context::EventContext<'_, '_>, ) -> bool { true } @@ -118,8 +118,8 @@ impl Widget for Toggle { _location: kludgine::figures::Point, _device_id: kludgine::app::winit::event::DeviceId, _button: kludgine::app::winit::event::MouseButton, - _context: &mut gooey::context::EventContext<'_, '_>, - ) -> gooey::widget::EventHandling { + _context: &mut cushy::context::EventContext<'_, '_>, + ) -> cushy::widget::EventHandling { self.value.toggle(); HANDLED diff --git a/examples/focus-order.rs b/examples/focus-order.rs index 4f0a25a..adb6606 100644 --- a/examples/focus-order.rs +++ b/examples/focus-order.rs @@ -1,17 +1,17 @@ use std::process::exit; -use gooey::value::{Dynamic, MapEach}; -use gooey::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag}; -use gooey::widgets::grid::{Grid, GridDimension, GridWidgets}; -use gooey::widgets::input::{InputValue, MaskedString}; -use gooey::widgets::Expand; -use gooey::Run; +use cushy::value::{Dynamic, MapEach}; +use cushy::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag}; +use cushy::widgets::grid::{Grid, GridDimension, GridWidgets}; +use cushy::widgets::input::{InputValue, MaskedString}; +use cushy::widgets::Expand; +use cushy::Run; use kludgine::figures::units::Lp; /// This example is the same as login, but it has an explicit tab order to /// change from the default order (username, password, cancel, log in) to /// username, password, log in, cancel. -fn main() -> gooey::Result { +fn main() -> cushy::Result { let username = Dynamic::default(); let password = Dynamic::default(); diff --git a/examples/focus.rs b/examples/focus.rs index 20a030a..d7b20b2 100644 --- a/examples/focus.rs +++ b/examples/focus.rs @@ -1,12 +1,12 @@ -use gooey::value::Dynamic; -use gooey::widget::MakeWidget; -use gooey::widgets::input::InputValue; -use gooey::widgets::slider::Slidable; -use gooey::widgets::Custom; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::MakeWidget; +use cushy::widgets::input::InputValue; +use cushy::widgets::slider::Slidable; +use cushy::widgets::Custom; +use cushy::Run; use kludgine::figures::units::Lp; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let allow_blur = Dynamic::new(true); "Input Field" .and(Dynamic::::default().into_input()) diff --git a/examples/gameui.rs b/examples/gameui.rs index a9e2474..814bd86 100644 --- a/examples/gameui.rs +++ b/examples/gameui.rs @@ -1,12 +1,12 @@ -use gooey::value::Dynamic; -use gooey::widget::{MakeWidget, HANDLED, IGNORED}; -use gooey::widgets::input::InputValue; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::{MakeWidget, HANDLED, IGNORED}; +use cushy::widgets::input::InputValue; +use cushy::Run; use kludgine::app::winit::event::ElementState; use kludgine::app::winit::keyboard::{Key, NamedKey}; use kludgine::Color; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let chat_log = Dynamic::new("Chat log goes here.\n".repeat(100)); let chat_message = Dynamic::new(String::new()); diff --git a/examples/image.rs b/examples/image.rs index 7ac677c..c22c00d 100644 --- a/examples/image.rs +++ b/examples/image.rs @@ -1,14 +1,14 @@ -use gooey::animation::ZeroToOne; -use gooey::value::{Dynamic, MapEachCloned}; -use gooey::widget::MakeWidget; -use gooey::widgets::image::{Aspect, ImageScaling}; -use gooey::widgets::slider::Slidable; -use gooey::widgets::Image; -use gooey::Run; +use cushy::animation::ZeroToOne; +use cushy::value::{Dynamic, MapEachCloned}; +use cushy::widget::MakeWidget; +use cushy::widgets::image::{Aspect, ImageScaling}; +use cushy::widgets::slider::Slidable; +use cushy::widgets::Image; +use cushy::Run; use kludgine::figures::Size; use kludgine::include_texture; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let mode = Dynamic::::default(); let scale = Dynamic::new(1f32); let orientation_width = Dynamic::::default(); diff --git a/examples/input.rs b/examples/input.rs index 871cf32..4896dfb 100644 --- a/examples/input.rs +++ b/examples/input.rs @@ -1,10 +1,10 @@ -use gooey::value::Dynamic; -use gooey::widget::MakeWidget; -use gooey::widgets::input::{InputValue, MaskedString}; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::MakeWidget; +use cushy::widgets::input::{InputValue, MaskedString}; +use cushy::Run; use kludgine::figures::units::Px; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let contents = Dynamic::from("Hello World"); let password = Dynamic::new(MaskedString::default()); diff --git a/examples/layers.rs b/examples/layers.rs index 8b6db69..e634e4d 100644 --- a/examples/layers.rs +++ b/examples/layers.rs @@ -1,9 +1,9 @@ -use gooey::widget::MakeWidget; -use gooey::widgets::Space; -use gooey::Run; +use cushy::widget::MakeWidget; +use cushy::widgets::Space; +use cushy::Run; use kludgine::Color; -fn main() -> gooey::Result { +fn main() -> cushy::Result { Space::colored(Color::RED) .and("Layers stack widgets on top of each other") .into_layers() diff --git a/examples/login.rs b/examples/login.rs index 19462b6..491cebe 100644 --- a/examples/login.rs +++ b/examples/login.rs @@ -1,14 +1,14 @@ use std::process::exit; -use gooey::value::{Dynamic, Validations}; -use gooey::widget::MakeWidget; -use gooey::widgets::input::{InputValue, MaskedString}; -use gooey::widgets::layers::OverlayLayer; -use gooey::widgets::Expand; -use gooey::Run; +use cushy::value::{Dynamic, Validations}; +use cushy::widget::MakeWidget; +use cushy::widgets::input::{InputValue, MaskedString}; +use cushy::widgets::layers::OverlayLayer; +use cushy::widgets::Expand; +use cushy::Run; use kludgine::figures::units::Lp; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let tooltips = OverlayLayer::default(); let username = Dynamic::default(); let password = Dynamic::default(); diff --git a/examples/manual-tabs.rs b/examples/manual-tabs.rs index 2520fc3..3e3ff04 100644 --- a/examples/manual-tabs.rs +++ b/examples/manual-tabs.rs @@ -3,9 +3,9 @@ use std::collections::HashMap; -use gooey::value::{Dynamic, Switchable}; -use gooey::widget::MakeWidget; -use gooey::Run; +use cushy::value::{Dynamic, Switchable}; +use cushy::widget::MakeWidget; +use cushy::Run; #[derive(Debug, Eq, PartialEq, Clone, Hash)] enum Tab { @@ -14,7 +14,7 @@ enum Tab { Missing, } -fn main() -> gooey::Result { +fn main() -> cushy::Result { let mut tab_contents = HashMap::new(); tab_contents.insert(Tab::First, "This is the first tab!".make_widget()); tab_contents.insert(Tab::Second, "This is the second tab!".make_widget()); diff --git a/examples/multi-window.rs b/examples/multi-window.rs index 3dfbd96..add53fb 100644 --- a/examples/multi-window.rs +++ b/examples/multi-window.rs @@ -1,16 +1,16 @@ -use gooey::kludgine::include_texture; -use gooey::value::{Dynamic, MapEach}; -use gooey::widget::MakeWidget; -use gooey::widgets::Image; -use gooey::window::PendingWindow; -use gooey::{Application, Open, PendingApp, Run}; +use cushy::kludgine::include_texture; +use cushy::value::{Dynamic, MapEach}; +use cushy::widget::MakeWidget; +use cushy::widgets::Image; +use cushy::window::PendingWindow; +use cushy::{Application, Open, PendingApp, Run}; use kludgine::LazyTexture; -fn main() -> gooey::Result { +fn main() -> cushy::Result { // To open multiple applications, we need a handle to the application. This // starts with the `PendingApp` type. let app = PendingApp::default(); - // Gooey ensures it's easy to share resources between windows. + // Cushy ensures it's easy to share resources between windows. let texture = include_texture!("assets/ferris-happy.png").expect("valid image"); let open_windows = Dynamic::new(0_usize); diff --git a/examples/nested-scroll.rs b/examples/nested-scroll.rs index 7446639..dcf5eb7 100644 --- a/examples/nested-scroll.rs +++ b/examples/nested-scroll.rs @@ -1,11 +1,11 @@ -use gooey::styles::components::FontFamily; -use gooey::styles::FontFamilyList; -use gooey::widget::MakeWidget; -use gooey::Run; +use cushy::styles::components::FontFamily; +use cushy::styles::FontFamilyList; +use cushy::widget::MakeWidget; +use cushy::Run; use kludgine::cosmic_text::FamilyOwned; use kludgine::figures::units::Lp; -fn main() -> gooey::Result { +fn main() -> cushy::Result { include_str!("./nested-scroll.rs") .vertical_scroll() .with(&FontFamily, FontFamilyList::from(FamilyOwned::Monospace)) diff --git a/examples/overlays.rs b/examples/overlays.rs index 1add22c..90f61de 100644 --- a/examples/overlays.rs +++ b/examples/overlays.rs @@ -1,13 +1,13 @@ -use gooey::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag}; -use gooey::widgets::container::ContainerShadow; -use gooey::widgets::layers::{OverlayBuilder, OverlayLayer}; -use gooey::Run; +use cushy::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag}; +use cushy::widgets::container::ContainerShadow; +use cushy::widgets::layers::{OverlayBuilder, OverlayLayer}; +use cushy::Run; use kludgine::figures::units::Lp; use kludgine::figures::Point; use kludgine::Color; use rand::{thread_rng, Rng}; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let overlay = OverlayLayer::default(); test_widget(&overlay, true) diff --git a/examples/progress.rs b/examples/progress.rs index 4770fbe..ee66230 100644 --- a/examples/progress.rs +++ b/examples/progress.rs @@ -1,12 +1,12 @@ -use gooey::value::{Dynamic, MapEach}; -use gooey::widget::MakeWidget; -use gooey::widgets::progress::Progressable; -use gooey::widgets::slider::Slidable; -use gooey::Run; +use cushy::value::{Dynamic, MapEach}; +use cushy::widget::MakeWidget; +use cushy::widgets::progress::Progressable; +use cushy::widgets::slider::Slidable; +use cushy::Run; use kludgine::figures::units::Lp; use kludgine::figures::Size; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let indeterminant = Dynamic::new(false); let value = Dynamic::new(0_u8); let progress = (&indeterminant, &value) diff --git a/examples/radio.rs b/examples/radio.rs index 9b52684..4e02db7 100644 --- a/examples/radio.rs +++ b/examples/radio.rs @@ -1,6 +1,6 @@ -use gooey::value::Dynamic; -use gooey::widget::MakeWidget; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::MakeWidget; +use cushy::Run; #[derive(Default, Eq, PartialEq, Debug, Clone, Copy)] pub enum Choice { @@ -10,7 +10,7 @@ pub enum Choice { C, } -fn main() -> gooey::Result { +fn main() -> cushy::Result { let option = Dynamic::default(); option diff --git a/examples/scroll.rs b/examples/scroll.rs index 89daf67..6814a86 100644 --- a/examples/scroll.rs +++ b/examples/scroll.rs @@ -1,7 +1,7 @@ -use gooey::widget::MakeWidget; -use gooey::Run; +use cushy::widget::MakeWidget; +use cushy::Run; -fn main() -> gooey::Result { +fn main() -> cushy::Result { include_str!("../src/widgets/scroll.rs") .scroll() .expand() diff --git a/examples/select.rs b/examples/select.rs index 29d8b63..d9f5848 100644 --- a/examples/select.rs +++ b/examples/select.rs @@ -1,6 +1,6 @@ -use gooey::value::Dynamic; -use gooey::widget::MakeWidget; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::MakeWidget; +use cushy::Run; #[derive(Default, Eq, PartialEq, Debug, Clone, Copy)] pub enum Choice { @@ -10,7 +10,7 @@ pub enum Choice { C, } -fn main() -> gooey::Result { +fn main() -> cushy::Result { let option = Dynamic::default(); option diff --git a/examples/slider.rs b/examples/slider.rs index 524ff82..d06c639 100644 --- a/examples/slider.rs +++ b/examples/slider.rs @@ -1,14 +1,14 @@ -use gooey::animation::{LinearInterpolate, PercentBetween}; -use gooey::value::{Dynamic, ForEach}; -use gooey::widget::MakeWidget; -use gooey::widgets::checkbox::Checkable; -use gooey::widgets::input::InputValue; -use gooey::widgets::slider::Slidable; -use gooey::Run; +use cushy::animation::{LinearInterpolate, PercentBetween}; +use cushy::value::{Dynamic, ForEach}; +use cushy::widget::MakeWidget; +use cushy::widgets::checkbox::Checkable; +use cushy::widgets::input::InputValue; +use cushy::widgets::slider::Slidable; +use cushy::Run; use kludgine::figures::units::Lp; use kludgine::figures::Ranged; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let enabled = Dynamic::new(true); u8_slider() .and(u8_range_slider()) @@ -86,7 +86,7 @@ enum SlidableEnum { } impl PercentBetween for SlidableEnum { - fn percent_between(&self, min: &Self, max: &Self) -> gooey::animation::ZeroToOne { + fn percent_between(&self, min: &Self, max: &Self) -> cushy::animation::ZeroToOne { let min = *min as u8; let max = *max as u8; let value = *self as u8; diff --git a/examples/stack-align-test.rs b/examples/stack-align-test.rs index f7453a2..9d26186 100644 --- a/examples/stack-align-test.rs +++ b/examples/stack-align-test.rs @@ -1,5 +1,5 @@ -use gooey::widget::MakeWidget; -use gooey::Run; +use cushy::widget::MakeWidget; +use cushy::Run; /// This example shows a tricky layout problem. The hierarchy of widgets is /// this: @@ -40,7 +40,7 @@ use gooey::Run; /// a Stack is asked to layout with the Stack's non-primary being a size-to-fit /// measurement, a second layout call for all children is required with Known /// measurements to allow layouts like this example to work correctly. -fn main() -> gooey::Result { +fn main() -> cushy::Result { // TODO once we have offscreen rendering, turn this into a test case "Really Long Label" .and("Short".into_button().centered()) diff --git a/examples/style.rs b/examples/style.rs index 8eae862..bbf51b9 100644 --- a/examples/style.rs +++ b/examples/style.rs @@ -1,12 +1,12 @@ -use gooey::styles::components::{TextColor, TextSize}; -use gooey::widget::MakeWidget; -use gooey::widgets::stack::Stack; -use gooey::widgets::Style; -use gooey::Run; +use cushy::styles::components::{TextColor, TextSize}; +use cushy::widget::MakeWidget; +use cushy::widgets::stack::Stack; +use cushy::widgets::Style; +use cushy::Run; use kludgine::figures::units::Lp; use kludgine::Color; -fn main() -> gooey::Result { +fn main() -> cushy::Result { Stack::rows("Green".and(red_text("Red"))) .with(&TextColor, Color::GREEN) // Local styles are not inherited. In this situation, the text size is diff --git a/examples/switcher.rs b/examples/switcher.rs index 4b2d246..e0fe1e4 100644 --- a/examples/switcher.rs +++ b/examples/switcher.rs @@ -1,6 +1,6 @@ -use gooey::value::{Dynamic, Switchable}; -use gooey::widget::{MakeWidget, WidgetInstance}; -use gooey::Run; +use cushy::value::{Dynamic, Switchable}; +use cushy::widget::{MakeWidget, WidgetInstance}; +use cushy::Run; #[derive(Debug, Eq, PartialEq)] enum ActiveContent { @@ -8,7 +8,7 @@ enum ActiveContent { Success, } -fn main() -> gooey::Result { +fn main() -> cushy::Result { let active = Dynamic::new(ActiveContent::Intro); active diff --git a/examples/theme.rs b/examples/theme.rs index 5093462..482359e 100644 --- a/examples/theme.rs +++ b/examples/theme.rs @@ -1,24 +1,24 @@ use std::fmt::Write; -use gooey::styles::components::{TextColor, WidgetBackground}; -use gooey::styles::{ +use cushy::styles::components::{TextColor, WidgetBackground}; +use cushy::styles::{ ColorScheme, ColorSchemeBuilder, ColorSource, ColorTheme, FixedTheme, SurfaceTheme, Theme, ThemePair, }; -use gooey::value::{Dynamic, MapEachCloned}; -use gooey::widget::MakeWidget; -use gooey::widgets::checkbox::Checkable; -use gooey::widgets::color::ColorSourcePicker; -use gooey::widgets::input::InputValue; -use gooey::widgets::slider::Slidable; -use gooey::widgets::Space; -use gooey::window::ThemeMode; -use gooey::{Open, PendingApp}; +use cushy::value::{Dynamic, MapEachCloned}; +use cushy::widget::MakeWidget; +use cushy::widgets::checkbox::Checkable; +use cushy::widgets::color::ColorSourcePicker; +use cushy::widgets::input::InputValue; +use cushy::widgets::slider::Slidable; +use cushy::widgets::Space; +use cushy::window::ThemeMode; +use cushy::{Open, PendingApp}; use kludgine::figures::units::Lp; use kludgine::Color; use palette::OklabHue; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let app = PendingApp::default(); let (theme_mode, theme_switcher) = dark_mode_picker(); @@ -79,9 +79,9 @@ fn main() -> gooey::Result { .and(editors.neutral.1) .and(editors.neutral_variant.1) .and("Copy to Clipboard".into_button().on_click({ - let gooey = app.gooey().clone(); + let cushy = app.cushy().clone(); move |()| { - if let Some(mut clipboard) = gooey.clipboard_guard() { + if let Some(mut clipboard) = cushy.clipboard_guard() { let builder = color_scheme_builder.get(); let mut source = String::default(); builder.format_rust_into(&mut source); diff --git a/examples/tic-tac-toe.rs b/examples/tic-tac-toe.rs index d0159b5..5ac68fe 100644 --- a/examples/tic-tac-toe.rs +++ b/examples/tic-tac-toe.rs @@ -3,13 +3,13 @@ use std::iter; use std::ops::Not; use std::time::SystemTime; -use gooey::value::Dynamic; -use gooey::widget::MakeWidget; -use gooey::widgets::button::ButtonKind; -use gooey::{Run, WithClone}; +use cushy::value::Dynamic; +use cushy::widget::MakeWidget; +use cushy::widgets::button::ButtonKind; +use cushy::{Run, WithClone}; use kludgine::figures::units::Lp; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let app = Dynamic::default(); app.map_each(app.with_clone(|app| { move |state: &AppState| match state { diff --git a/examples/tilemap.rs b/examples/tilemap.rs index 83c080c..287775c 100644 --- a/examples/tilemap.rs +++ b/examples/tilemap.rs @@ -2,18 +2,18 @@ use std::array; use std::cmp::Ordering; use std::time::Duration; -use gooey::kludgine::app::winit::keyboard::Key; -use gooey::kludgine::figures::units::Px; -use gooey::kludgine::figures::{Point, Rect, Size}; -use gooey::kludgine::render::Renderer; -use gooey::kludgine::shapes::Shape; -use gooey::kludgine::tilemap::{ +use cushy::kludgine::app::winit::keyboard::Key; +use cushy::kludgine::figures::units::Px; +use cushy::kludgine::figures::{Point, Rect, Size}; +use cushy::kludgine::render::Renderer; +use cushy::kludgine::shapes::Shape; +use cushy::kludgine::tilemap::{ DebugGrid, Object, ObjectLayer, TileArray, TileKind, TileMapFocus, TILE_SIZE, }; -use gooey::kludgine::Color; -use gooey::value::Dynamic; -use gooey::widgets::TileMap; -use gooey::{Run, Tick}; +use cushy::kludgine::Color; +use cushy::value::Dynamic; +use cushy::widgets::TileMap; +use cushy::{Run, Tick}; use kludgine::app::winit::keyboard::NamedKey; use kludgine::figures::FloatConversion; use kludgine::sprite::{Sprite, SpriteSource}; @@ -21,7 +21,7 @@ use kludgine::{include_aseprite_sprite, DrawableExt}; const PLAYER_SIZE: Px = Px::new(16); -fn main() -> gooey::Result { +fn main() -> cushy::Result { let mut characters = ObjectLayer::new(); let mut sprite = include_aseprite_sprite!("assets/stickguy").unwrap(); diff --git a/examples/typography.rs b/examples/typography.rs index 8916701..8629786 100644 --- a/examples/typography.rs +++ b/examples/typography.rs @@ -1,7 +1,7 @@ -use gooey::widget::MakeWidget; -use gooey::Run; +use cushy::widget::MakeWidget; +use cushy::Run; -fn main() -> gooey::Result { +fn main() -> cushy::Result { "Heading 1" .h1() .and("Heading 2".h2()) diff --git a/examples/validation.rs b/examples/validation.rs index 8426546..25d14b4 100644 --- a/examples/validation.rs +++ b/examples/validation.rs @@ -1,10 +1,10 @@ -use gooey::value::{Dynamic, Validations}; -use gooey::widget::MakeWidget; -use gooey::widgets::input::InputValue; -use gooey::Run; +use cushy::value::{Dynamic, Validations}; +use cushy::widget::MakeWidget; +use cushy::widgets::input::InputValue; +use cushy::Run; use kludgine::figures::units::Lp; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let text = Dynamic::default(); let validations = Validations::default(); diff --git a/examples/window-properties.rs b/examples/window-properties.rs index 46bf8c3..658706f2 100644 --- a/examples/window-properties.rs +++ b/examples/window-properties.rs @@ -1,9 +1,9 @@ -use gooey::value::Dynamic; -use gooey::widget::{MakeWidget, WidgetInstance}; -use gooey::Run; +use cushy::value::Dynamic; +use cushy::widget::{MakeWidget, WidgetInstance}; +use cushy::Run; use kludgine::figures::Size; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let focused = Dynamic::new(false); let occluded = Dynamic::new(false); let inner_size = Dynamic::new(Size::default()); @@ -15,7 +15,7 @@ fn main() -> gooey::Result { .into_rows() .centered(); - gooey::window::Window::::for_widget(widgets) + cushy::window::Window::::for_widget(widgets) .focused(focused) .occluded(occluded) .inner_size(inner_size) diff --git a/examples/wrap.rs b/examples/wrap.rs index afcddf3..54230e8 100644 --- a/examples/wrap.rs +++ b/examples/wrap.rs @@ -1,14 +1,14 @@ -use gooey::styles::components::{LineHeight, TextSize}; -use gooey::value::Dynamic; -use gooey::widget::{Children, MakeWidget}; -use gooey::widgets::wrap::{VerticalAlign, WrapAlign}; -use gooey::Run; +use cushy::styles::components::{LineHeight, TextSize}; +use cushy::value::Dynamic; +use cushy::widget::{Children, MakeWidget}; +use cushy::widgets::wrap::{VerticalAlign, WrapAlign}; +use cushy::Run; use kludgine::figures::units::Lp; use rand::{thread_rng, Rng}; const EXPLANATION: &str = "This example demonstrates the Wrap widget. Each word shown here is an individual Label widget that is being positioned by the Wrap widget."; -fn main() -> gooey::Result { +fn main() -> cushy::Result { let mut rng = thread_rng(); let words = EXPLANATION .split_ascii_whitespace() diff --git a/gooey-macros/README.md b/gooey-macros/README.md deleted file mode 100644 index d7d5d65..0000000 --- a/gooey-macros/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# gooey-macros - -This crate contains procedural macros that [Gooey][gooey] exposes. - -[gooey]: https://github.com/khonsulabs/gooey diff --git a/src/animation.rs b/src/animation.rs index dd73c02..f404fb0 100644 --- a/src/animation.rs +++ b/src/animation.rs @@ -1,6 +1,6 @@ //! Types for creating animations. //! -//! Animations in Gooey are performed by transitioning a [`Dynamic`]'s contained +//! Animations in Cushy are performed by transitioning a [`Dynamic`]'s contained //! value over time. This starts with [`Dynamic::transition_to()`], which //! returns a [`DynamicTransition`]. //! @@ -17,9 +17,9 @@ //! ```rust //! use std::time::Duration; //! -//! use gooey::animation::easings::EaseInOutElastic; -//! use gooey::animation::{AnimationTarget, Spawn}; -//! use gooey::value::Dynamic; +//! use cushy::animation::easings::EaseInOutElastic; +//! use cushy::animation::{AnimationTarget, Spawn}; +//! use cushy::value::Dynamic; //! //! let value = Dynamic::new(0); //! let mut reader = value.create_reader(); @@ -775,8 +775,8 @@ impl Animate for Duration { /// the wrappers [`BinaryLerp`] and [`ImmediateLerp`] can be used. /// /// ``` -/// use gooey::animation::{BinaryLerp, ImmediateLerp, LinearInterpolate}; -/// use gooey::kludgine::Color; +/// use cushy::animation::{BinaryLerp, ImmediateLerp, LinearInterpolate}; +/// use cushy::kludgine::Color; /// /// #[derive(LinearInterpolate, PartialEq, Debug)] /// struct Struct(Color, BinaryLerp<&'static str>, ImmediateLerp<&'static str>); @@ -811,7 +811,7 @@ pub trait LinearInterpolate: PartialEq { } /// Derives [`LinerarInterpolate`](trait@LinearInterpolate) for structs and fieldless enums. -pub use gooey_macros::LinearInterpolate; +pub use cushy_macros::LinearInterpolate; macro_rules! impl_lerp_for_int { ($type:ident, $unsigned:ident, $float:ident) => { diff --git a/src/app.rs b/src/app.rs index b3a74a9..b952837 100644 --- a/src/app.rs +++ b/src/app.rs @@ -7,16 +7,16 @@ use crate::utils::IgnorePoison; use crate::window::sealed::WindowCommand; use crate::window::WindowHandle; -/// A Gooey application that has not started running yet. +/// A Cushy application that has not started running yet. pub struct PendingApp { app: kludgine::app::PendingApp, - gooey: Gooey, + cushy: Cushy, } impl PendingApp { /// The shared resources this application utilizes. - pub const fn gooey(&self) -> &Gooey { - &self.gooey + pub const fn cushy(&self) -> &Cushy { + &self.cushy } } @@ -30,7 +30,7 @@ impl Default for PendingApp { fn default() -> Self { Self { app: kludgine::app::PendingApp::default(), - gooey: Gooey { + cushy: Cushy { clipboard: Clipboard::new() .ok() .map(|clipboard| Arc::new(Mutex::new(clipboard))), @@ -47,11 +47,11 @@ impl AsApplication> for PendingApp { /// Shared resources for a GUI application. #[derive(Clone)] -pub struct Gooey { +pub struct Cushy { pub(crate) clipboard: Option>>, } -impl Gooey { +impl Cushy { /// Returns a locked mutex guard to the OS's clipboard, if one was able to be /// initialized when the window opened. #[must_use] @@ -62,37 +62,37 @@ impl Gooey { } } -/// A type that is a Gooey application. +/// A type that is a Cushy application. pub trait Application: AsApplication> { /// Returns the shared resources for the application. - fn gooey(&self) -> &Gooey; + fn cushy(&self) -> &Cushy; /// Returns this type as an [`App`] handle. fn as_app(&self) -> App; } impl Application for PendingApp { - fn gooey(&self) -> &Gooey { - &self.gooey + fn cushy(&self) -> &Cushy { + &self.cushy } fn as_app(&self) -> App { App { app: self.app.as_app(), - gooey: self.gooey.clone(), + cushy: self.cushy.clone(), } } } -/// A handle to a Gooey application. +/// A handle to a Cushy application. #[derive(Clone)] pub struct App { app: kludgine::app::App, - gooey: Gooey, + cushy: Cushy, } impl Application for App { - fn gooey(&self) -> &Gooey { - &self.gooey + fn cushy(&self) -> &Cushy { + &self.cushy } fn as_app(&self) -> App { diff --git a/src/context.rs b/src/context.rs index 79bd7ff..e03ff63 100644 --- a/src/context.rs +++ b/src/context.rs @@ -1,4 +1,4 @@ -//! Types that provide access to the Gooey runtime. +//! Types that provide access to the Cushy runtime. use std::borrow::Cow; use std::ops::{Deref, DerefMut}; use std::sync::atomic::{AtomicBool, Ordering}; diff --git a/src/lib.rs b/src/lib.rs index 2dd36af..1e5506a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ #![allow(clippy::module_name_repetitions, clippy::missing_errors_doc)] // for proc-macros -extern crate self as gooey; +extern crate self as cushy; #[macro_use] mod utils; @@ -23,7 +23,7 @@ pub mod widgets; pub mod window; use std::ops::Sub; -pub use app::{App, Application, Gooey, Open, PendingApp, Run}; +pub use app::{App, Application, Cushy, Open, PendingApp, Run}; pub use kludgine; use kludgine::app::winit::error::EventLoopError; use kludgine::figures::units::UPx; @@ -119,7 +119,7 @@ pub type Result = std::result::Result; /// Counts the number of expressions passed to it. /// -/// This is used inside of Gooey macros to preallocate collections. +/// This is used inside of Cushy macros to preallocate collections. #[macro_export] #[doc(hidden)] macro_rules! count { diff --git a/src/names.rs b/src/names.rs index f638888..0f23a31 100644 --- a/src/names.rs +++ b/src/names.rs @@ -7,7 +7,7 @@ use interner::global::{GlobalString, StringPool}; static NAMES: StringPool = StringPool::with_hasher(ahash::RandomState::with_seeds(0, 0, 0, 0)); -/// A smart-string type that is used as a "name" in Gooey. +/// A smart-string type that is used as a "name" in Cushy. /// /// This type ensures that globably only one instance of any unique wrapped /// string exists. By ensuring all instances of each unique string are the same diff --git a/src/styles.rs b/src/styles.rs index e8c31a2..09a63ae 100644 --- a/src/styles.rs +++ b/src/styles.rs @@ -1103,7 +1103,7 @@ pub trait ComponentDefinition: NamedComponent { /// Describes whether a type should invalidate a widget. pub trait RequireInvalidation { - /// Gooey tracks two different states: + /// Cushy tracks two different states: /// /// - Whether to repaint the window /// - Whether to relayout a widget @@ -1535,7 +1535,7 @@ impl Default for ThemePair { } } -/// A Gooey Color theme. +/// A Cushy Color theme. #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct Theme { /// The primary color theme. @@ -2408,7 +2408,7 @@ where } } -/// A color scheme for a Gooey application. +/// A color scheme for a Cushy application. #[derive(Debug, Clone, Copy, PartialEq)] pub struct ColorScheme { /// The primary accent color. diff --git a/src/styles/components.rs b/src/styles/components.rs index 5783290..2a26589 100644 --- a/src/styles/components.rs +++ b/src/styles/components.rs @@ -9,18 +9,18 @@ use crate::animation::easings::{EaseInOutQuadradic, EaseInQuadradic, EaseOutQuad use crate::animation::{EasingFunction, ZeroToOne}; use crate::styles::{Dimension, FocusableWidgets, FontFamilyList, VisualOrder}; -/// Defines a set of style components for Gooey. +/// Defines a set of style components for Cushy. /// /// These macros implement [`NamedComponent`](crate::styles::NamedComponent) and /// [`ComponentDefinition`](crate::styles::ComponentDefinition) for each entry /// defined. The syntax is: /// /// ```rust -/// use gooey::define_components; -/// use gooey::styles::Dimension; -/// use gooey::styles::components::{SurfaceColor, TextColor}; -/// use gooey::kludgine::Color; -/// use gooey::kludgine::figures::Zero; +/// use cushy::define_components; +/// use cushy::styles::Dimension; +/// use cushy::styles::components::{SurfaceColor, TextColor}; +/// use cushy::kludgine::Color; +/// use cushy::kludgine::figures::Zero; /// /// define_components! { /// GroupName { diff --git a/src/value.rs b/src/value.rs index 7a2f518..e5f3a4e 100644 --- a/src/value.rs +++ b/src/value.rs @@ -325,7 +325,7 @@ impl Dynamic { /// code may produce slightly more readable code. /// /// ```rust - /// let value = gooey::value::Dynamic::new(1); + /// let value = cushy::value::Dynamic::new(1); /// /// // Using with_clone /// value.with_clone(|value| { @@ -950,7 +950,7 @@ pub enum ReplaceError { /// A deadlock occurred accessing a [`Dynamic`]. /// -/// Currently Gooey is only able to detect deadlocks where a single thread tries +/// Currently Cushy is only able to detect deadlocks where a single thread tries /// to lock the same [`Dynamic`] multiple times. #[derive(Debug)] struct DeadlockError; @@ -2709,7 +2709,7 @@ fn map_cycle_is_finite() { let a = Dynamic::new(0_usize); // This callback updates a each time a is updated with a + 1, causing an - // infinite cycle if not broken by Gooey. + // infinite cycle if not broken by Cushy. a.for_each_cloned({ let a = a.clone(); move |current| { @@ -2718,7 +2718,7 @@ fn map_cycle_is_finite() { }) .persist(); - // Gooey will invoke the callback for the first set call, but the set call + // Cushy will invoke the callback for the first set call, but the set call // within the callback will not cause the callback to be invoked again. // Thus, we expect setting the value to 1 to result in `a` containing 2. a.set(1); diff --git a/src/widget.rs b/src/widget.rs index 9c58b39..a4a74b2 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -52,13 +52,13 @@ use crate::ConstraintLimit; /// /// # Widgets are hierarchical /// -/// Gooey's widgets are organized in a hierarchical structure: widgets can -/// contain other widgets. A window in Gooey contains a single root widget, +/// Cushy's widgets are organized in a hierarchical structure: widgets can +/// contain other widgets. A window in Cushy contains a single root widget, /// which may contain one or more additional widgets. /// /// # How Widgets are created /// -/// Gooey offers several approaches to creating widgets. The primary trait that +/// Cushy offers several approaches to creating widgets. The primary trait that /// is used to instantiate a widget is [`MakeWidget`]. This trait is /// automatically implemented for all types that implement [`Widget`]. /// @@ -119,8 +119,8 @@ use crate::ConstraintLimit; /// /// Next, the window sets the root's layout. When a widget contains another /// widget, it must call [`LayoutContext::set_child_layout`] for the child to be -/// able to be rendered. This tells Gooey the location to draw the widget. While -/// it is possible to provide any rectangle, Gooey clips all widgets and their +/// able to be rendered. This tells Cushy the location to draw the widget. While +/// it is possible to provide any rectangle, Cushy clips all widgets and their /// children so that they cannot draw outside of their assigned bounds. /// /// Once the layout has been determined, the window will invoke the root @@ -136,13 +136,13 @@ use crate::ConstraintLimit; /// /// # Controlling Invalidation and Redrawing /// -/// Gooey only redraws window contents when requested by the operating system or -/// a tracked [`Dynamic`] is updated. Similarly, Gooey caches the known layout +/// Cushy only redraws window contents when requested by the operating system or +/// a tracked [`Dynamic`] is updated. Similarly, Cushy caches the known layout /// sizes and locations for widgets unless they are *invalidated*. Invalidation /// is done automatically when the window size changes or a tracked [`Dynamic`] /// is updated. /// -/// These systems require Gooey to track which [`Dynamic`] values a widget +/// These systems require Cushy to track which [`Dynamic`] values a widget /// depends on for redrawing and invalidation. During a widget's redraw and /// layout functions, it needs to ensure that all depended upon [`Dynamic`]s are /// tracked using one of the various @@ -231,33 +231,33 @@ use crate::ConstraintLimit; /// /// # Styling /// -/// Gooey allows widgets to receive styling information through the widget -/// hierarchy using [`Styles`]. Gooey calculates the effectives styles for each +/// Cushy allows widgets to receive styling information through the widget +/// hierarchy using [`Styles`]. Cushy calculates the effectives styles for each /// widget by inheriting all inheritable styles from its parent. /// /// The [`Style`] widget allows assigining [`Styles`] to all of its children -/// widget. It works by calling [`WidgetContext::attach_styles`], and Gooey +/// widget. It works by calling [`WidgetContext::attach_styles`], and Cushy /// takes care of the rest. /// -/// Styling in Gooey aims to be simple, easy-to-understand, and extensible. +/// Styling in Cushy aims to be simple, easy-to-understand, and extensible. /// /// # Color Themes /// -/// Gooey aims to make it easy for developers to customize the appearance of its -/// applications. The way color themes work in Gooey begins with the +/// Cushy aims to make it easy for developers to customize the appearance of its +/// applications. The way color themes work in Cushy begins with the /// [`ColorScheme`](crate::styles::ColorScheme). A color scheme is a set of /// [`ColorSource`](crate::styles::ColorSource) that are used to generate a /// variety of shades of colors for various roles color plays in a user -/// interface. In a way, coloring Gooey apps is a bit like paint-by-number, +/// interface. In a way, coloring Cushy apps is a bit like paint-by-number, /// where the number is the name of the color role. /// /// A `ColorScheme` can be used to create a [`ThemePair`], which is theme /// definition that a theme for light and dark mode. /// /// In [the repository][repo], the `theme` example is a good way to explore how -/// the color system works in Gooey. +/// the color system works in Cushy. /// -/// [repo]: https://github.com/khonsulabs/gooey +/// [repo]: https://github.com/khonsulabs/cushy pub trait Widget: Send + Debug + 'static { /// Redraw the contents of this widget. fn redraw(&mut self, context: &mut GraphicsContext<'_, '_, '_, '_, '_>); @@ -327,7 +327,7 @@ pub trait Widget: Send + Debug + 'static { fn unhover(&mut self, context: &mut EventContext<'_, '_>) {} /// This widget has been targeted to be focused. If this function returns - /// true, the widget will be focused. If false, Gooey will continue + /// true, the widget will be focused. If false, Cushy will continue /// searching for another focus target. #[allow(unused_variables)] fn accept_focus(&mut self, context: &mut EventContext<'_, '_>) -> bool { @@ -487,7 +487,7 @@ pub enum RootBehavior { PassThrough, /// This widget will try to expand to fill the window. Expand, - /// This widget will measure its contents to fit its child, but Gooey should + /// This widget will measure its contents to fit its child, but Cushy should /// still stretch this widget to fill the window. Align, /// This widget adjusts its child layout with padding. @@ -643,7 +643,7 @@ pub trait WrapperWidget: Debug + Send + 'static { fn unhover(&mut self, context: &mut EventContext<'_, '_>) {} /// This widget has been targeted to be focused. If this function returns - /// true, the widget will be focused. If false, Gooey will continue + /// true, the widget will be focused. If false, Cushy will continue /// searching for another focus target. #[allow(unused_variables)] fn accept_focus(&mut self, context: &mut EventContext<'_, '_>) -> bool { @@ -1061,7 +1061,7 @@ pub trait MakeWidget: Sized { /// Sets the widget that should be focused next. /// - /// Gooey automatically determines reverse tab order by using this same + /// Cushy automatically determines reverse tab order by using this same /// relationship. fn with_next_focus(self, next_focus: impl IntoValue>) -> WidgetInstance { self.make_widget().with_next_focus(next_focus) @@ -1441,7 +1441,7 @@ impl WidgetInstance { /// Sets the widget that should be focused next. /// - /// Gooey automatically determines reverse tab order by using this same + /// Cushy automatically determines reverse tab order by using this same /// relationship. /// /// # Panics diff --git a/src/widgets/button.rs b/src/widgets/button.rs index 8f8b593..6cfd391 100644 --- a/src/widgets/button.rs +++ b/src/widgets/button.rs @@ -372,7 +372,7 @@ impl Widget for Button { // colors. most_contrasting from a 0-alpha color is not a // meaningful measurement, so we only start measuring contrast // once we reach 50% opacity. If we ever add solid background - // tracking (), + // tracking (), // we should use that color for most_contrasting always. let color = if style.background.alpha() > 128 { style diff --git a/src/widgets/custom.rs b/src/widgets/custom.rs index 82753e7..a4d9471 100644 --- a/src/widgets/custom.rs +++ b/src/widgets/custom.rs @@ -266,7 +266,7 @@ impl Custom { /// Invokes `advance_focus` when this widget has focus and focus is /// requested to advance to another widget. Returning - /// [`HANDLED`](crate::widget::HANDLED) will signal to Gooey that the focus + /// [`HANDLED`](crate::widget::HANDLED) will signal to Cushy that the focus /// has moved and the request should not be processed any further. /// /// This callback corresponds to [`WrapperWidget::advance_focus`]. diff --git a/src/widgets/layers.rs b/src/widgets/layers.rs index f543a0c..12c9316 100644 --- a/src/widgets/layers.rs +++ b/src/widgets/layers.rs @@ -5,7 +5,7 @@ use std::sync::{Arc, Mutex}; use std::time::Duration; use alot::{LotId, OrderedLots}; -use gooey::widget::{RootBehavior, WidgetInstance}; +use cushy::widget::{RootBehavior, WidgetInstance}; use intentional::Assert; use kludgine::figures::units::{Lp, Px, UPx}; use kludgine::figures::{IntoSigned, IntoUnsigned, Point, Rect, Size, Zero}; diff --git a/src/window.rs b/src/window.rs index b6a58bd..1849d4c 100644 --- a/src/window.rs +++ b/src/window.rs @@ -27,7 +27,7 @@ use kludgine::Kludgine; use tracing::Level; use crate::animation::{LinearInterpolate, PercentBetween, ZeroToOne}; -use crate::app::{Application, Gooey, Open, PendingApp, Run}; +use crate::app::{Application, Cushy, Open, PendingApp, Run}; use crate::context::{ AsEventContext, EventContext, Exclusive, GraphicsContext, InvalidationStatus, LayoutContext, WidgetContext, @@ -44,11 +44,11 @@ use crate::widget::{ use crate::window::sealed::WindowCommand; use crate::{initialize_tracing, ConstraintLimit}; -/// A currently running Gooey window. +/// A currently running Cushy window. pub struct RunningWindow<'window> { window: kludgine::app::Window<'window, WindowCommand>, invalidation_status: InvalidationStatus, - gooey: Gooey, + cushy: Cushy, focused: Dynamic, occluded: Dynamic, inner_size: Dynamic>, @@ -58,7 +58,7 @@ impl<'window> RunningWindow<'window> { pub(crate) fn new( window: kludgine::app::Window<'window, WindowCommand>, invalidation_status: &InvalidationStatus, - gooey: &Gooey, + cushy: &Cushy, focused: &Dynamic, occluded: &Dynamic, inner_size: &Dynamic>, @@ -66,7 +66,7 @@ impl<'window> RunningWindow<'window> { Self { window, invalidation_status: invalidation_status.clone(), - gooey: gooey.clone(), + cushy: cushy.clone(), focused: focused.clone(), occluded: occluded.clone(), inner_size: inner_size.clone(), @@ -116,7 +116,7 @@ impl<'window> RunningWindow<'window> { /// initialized when the window opened. #[must_use] pub fn clipboard_guard(&self) -> Option> { - self.gooey.clipboard_guard() + self.cushy.clipboard_guard() } } @@ -134,10 +134,10 @@ impl<'window> DerefMut for RunningWindow<'window> { } } -/// The attributes of a Gooey window. +/// The attributes of a Cushy window. pub type WindowAttributes = kludgine::app::WindowAttributes; -/// A Gooey window that is not yet running. +/// A Cushy window that is not yet running. #[must_use] pub struct Window where @@ -305,7 +305,7 @@ where .and_then(OsStr::to_str) .map(ToString::to_string) }) - .unwrap_or_else(|| String::from("Gooey App")) + .unwrap_or_else(|| String::from("Cushy App")) }) .clone(); Self { @@ -355,14 +355,14 @@ where where App: Application, { - let gooey = app.gooey().clone(); + let cushy = app.cushy().clone(); - let handle = GooeyWindow::::open_with( + let handle = CushyWindow::::open_with( app, sealed::Context { user: self.context, settings: RefCell::new(sealed::WindowSettings { - gooey, + cushy, redraw_status: self.pending.0.redraw_status.clone(), on_closed: self.on_closed, transparent: self.attributes.transparent, @@ -391,7 +391,7 @@ where } } -/// The behavior of a Gooey window. +/// The behavior of a Cushy window. pub trait WindowBehavior: Sized + 'static { /// The type that is provided when initializing this window. type Context: Send + 'static; @@ -424,7 +424,7 @@ pub trait WindowBehavior: Sized + 'static { } } -struct GooeyWindow { +struct CushyWindow { behavior: T, tree: Tree, root: MountedWidget, @@ -446,11 +446,11 @@ struct GooeyWindow { theme_mode: Value, transparent: bool, fonts: FontState, - gooey: Gooey, + cushy: Cushy, on_closed: Option, } -impl GooeyWindow +impl CushyWindow where T: WindowBehavior, { @@ -675,7 +675,7 @@ enum RootMode { Align, } -impl kludgine::app::WindowBehavior for GooeyWindow +impl kludgine::app::WindowBehavior for CushyWindow where T: WindowBehavior, { @@ -687,7 +687,7 @@ where context: Self::Context, ) -> Self { let mut settings = context.settings.borrow_mut(); - let gooey = settings.gooey.clone(); + let cushy = settings.cushy.clone(); let occluded = settings.occluded.take().unwrap_or_default(); let focused = settings.focused.take().unwrap_or_default(); let theme = settings.theme.take().expect("theme always present"); @@ -712,7 +712,7 @@ where &mut RunningWindow::new( window, &redraw_status, - &gooey, + &cushy, &focused, &occluded, &inner_size, @@ -752,7 +752,7 @@ where theme_mode, transparent, fonts, - gooey, + cushy, on_closed, } } @@ -778,7 +778,7 @@ where let mut window = RunningWindow::new( window, &self.redraw_status, - &self.gooey, + &self.cushy, &self.focused, &self.occluded, &self.inner_size, @@ -914,7 +914,7 @@ where &mut RunningWindow::new( window, &self.redraw_status, - &self.gooey, + &self.cushy, &self.focused, &self.occluded, &self.inner_size, @@ -988,7 +988,7 @@ where let mut window = RunningWindow::new( window, &self.redraw_status, - &self.gooey, + &self.cushy, &self.focused, &self.occluded, &self.inner_size, @@ -1093,7 +1093,7 @@ where let mut window = RunningWindow::new( window, &self.redraw_status, - &self.gooey, + &self.cushy, &self.focused, &self.occluded, &self.inner_size, @@ -1129,7 +1129,7 @@ where let mut window = RunningWindow::new( window, &self.redraw_status, - &self.gooey, + &self.cushy, &self.focused, &self.occluded, &self.inner_size, @@ -1162,7 +1162,7 @@ where let mut window = RunningWindow::new( window, &self.redraw_status, - &self.gooey, + &self.cushy, &self.focused, &self.occluded, &self.inner_size, @@ -1214,7 +1214,7 @@ where let mut window = RunningWindow::new( window, &self.redraw_status, - &self.gooey, + &self.cushy, &self.focused, &self.occluded, &self.inner_size, @@ -1244,7 +1244,7 @@ where let mut window = RunningWindow::new( window, &self.redraw_status, - &self.gooey, + &self.cushy, &self.focused, &self.occluded, &self.inner_size, @@ -1356,7 +1356,7 @@ where let mut window = RunningWindow::new( window, &self.redraw_status, - &self.gooey, + &self.cushy, &self.focused, &self.occluded, &self.inner_size, @@ -1369,7 +1369,7 @@ where } } -impl Drop for GooeyWindow { +impl Drop for CushyWindow { fn drop(&mut self) { if let Some(on_closed) = self.on_closed.take() { on_closed.invoke(()); @@ -1401,7 +1401,7 @@ pub(crate) mod sealed { use kludgine::figures::units::UPx; use kludgine::figures::Size; - use crate::app::Gooey; + use crate::app::Cushy; use crate::context::InvalidationStatus; use crate::styles::{FontFamilyList, ThemePair}; use crate::value::{Dynamic, Value}; @@ -1414,7 +1414,7 @@ pub(crate) mod sealed { } pub struct WindowSettings { - pub gooey: Gooey, + pub cushy: Cushy, pub redraw_status: InvalidationStatus, pub attributes: Option, pub occluded: Option>, @@ -1537,7 +1537,7 @@ fn default_family(query: Family<'_>) -> Option { .map(FamilyOwned::Name) } -/// A handle to an open Gooey window. +/// A handle to an open Cushy window. #[derive(Clone)] pub struct WindowHandle { inner: InnerWindowHandle,