-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/per-side-border-width
- Loading branch information
Showing
85 changed files
with
1,764 additions
and
1,071 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
# Differences with Dioxus | ||
|
||
**Freya** is built on top of the core crates from Dioxus, this means that you will effectively be creating Dioxus components, using RSX and hooks. But, you will **not** be using HTML, CSS, JS or any Web tech at all. | ||
**Freya** is built on top of the **core** crates from Dioxus, this means that you will effectively be creating Dioxus components, using RSX and hooks. | ||
|
||
Here you can find a list of the main differences between Freya and the official Dioxus renderers for Desktop (WebView and Blitz): | ||
**But**, thanks to Dioxus being a renderer-agnostic library you will **NOT** be using JavaScript, HTML, OR CSS, or any other abstraction that ends up using one of those or anything close to web. | ||
|
||
Freya does everything on its own when it comes to: | ||
- Elements | ||
- Styling | ||
- Layout | ||
- Events | ||
- Rendering | ||
- Testing | ||
- Built-in components and hooks, | ||
- Editing | ||
- Animating | ||
|
||
And more. Dioxus only is only used to run the app components (hooks, lifecycle, state, rsx), **everything else is managed by Freya**. | ||
|
||
**Freya is not mean to be drop-in alternative to Dioxus renderers but as GUI library on its own.** | ||
|
||
Here is the list of the main differences between Freya and the official Dioxus renderers for Desktop (WebView and Blitz): | ||
|
||
| Category | Freya | Dioxus Renderers | | ||
|--------------------------------------|------------------|---------------------------------| | ||
| **Elements, attributes and events** | Custom | HTML | | ||
| **Layout** | [`Torin`](https://github.com/marc2332/freya/tree/main/crates/torin) | CSS or [`Taffy`](https://github.com/DioxusLabs/taffy) | | ||
| **Styling** | Custom | CSS | | ||
| **Renderer** | Skia | WebView or WGPU | | ||
| **Components library** | Custom | None, but can use HTML elements and CSS libraries | | ||
| **Devtools** | Custom | Provided in Webview | | ||
| **Headless testing runner** | Custom | None, but there is Playwright and similar | | ||
| **Layout** | Custom ([`Torin`](https://github.com/marc2332/freya/tree/main/crates/torin)) | CSS or [`Taffy`](https://github.com/DioxusLabs/taffy) | | ||
| **Styling** | Custom | CSS | | ||
| **Renderer** | Skia | WebView or WGPU | | ||
| **Components library** | Custom ([`freya-comonents`](https://github.com/marc2332/freya/tree/main/crates/components)) | None, but can use HTML elements and CSS libraries | | ||
| **Devtools** | Custom ([`freya-devtools`](https://github.com/marc2332/freya/tree/main/crates/devtools)) | Provided in Webview | | ||
| **Headless testing runner** | Custom ([`freya-testing`](https://github.com/marc2332/freya/tree/main/crates/testing)) | None, but there is Playwright and similar | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/// Generate a Dioxus component rendering the specified image. | ||
/// | ||
/// Example: | ||
/// | ||
/// ```no_run | ||
/// # use freya::prelude::*; | ||
/// | ||
/// import_svg!(Ferris, "../../../examples/rust_logo.png", "100%", "100%"); | ||
/// import_svg!(FerrisWithRequiredSize, "../../../examples/rust_logo.png"); | ||
/// | ||
/// fn app() -> Element { | ||
/// rsx!(Ferris {}) | ||
/// } | ||
/// | ||
/// fn another_app() -> Element { | ||
/// rsx!(FerrisWithRequiredSize { | ||
/// width: "150", | ||
/// height: "40%", | ||
/// }) | ||
/// } | ||
/// ``` | ||
#[macro_export] | ||
macro_rules! import_image { | ||
($component_name:ident, $path:expr, $width: expr, $height: expr) => { | ||
// Generate a function with the name derived from the file name | ||
#[allow(non_snake_case)] | ||
#[dioxus::prelude::component] | ||
pub fn $component_name( | ||
#[props(default = $width.to_string())] width: String, | ||
#[props(default = $height.to_string())] height: String, | ||
) -> freya::prelude::Element { | ||
use freya::prelude::*; | ||
let image_data = static_bytes(include_bytes!($path)); | ||
|
||
rsx!(image { | ||
width, | ||
height, | ||
image_data | ||
}) | ||
} | ||
}; | ||
($component_name:ident, $path:expr) => { | ||
// Generate a function with the name derived from the file name | ||
#[allow(non_snake_case)] | ||
#[dioxus::prelude::component] | ||
pub fn $component_name(width: String, height: String) -> freya::prelude::Element { | ||
use freya::prelude::*; | ||
let image_data = static_bytes(include_bytes!($path)); | ||
|
||
rsx!(image { | ||
width, | ||
height, | ||
image_data | ||
}) | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ mod gesture_area; | |
mod graph; | ||
mod hooks; | ||
mod icons; | ||
mod image; | ||
mod input; | ||
mod link; | ||
mod loader; | ||
|
Oops, something went wrong.