Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Aug 9, 2023
1 parent 6a9a512 commit 2ae633e
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 23 deletions.
2 changes: 2 additions & 0 deletions book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@
- [Testing](./guides/testing.md)
- [Animating](./guides/animating.md)
- [Virtualizing](./guides/virtualizing.md)
- [Devtools](./guides/devtools.md)
- [Publishing]()

4 changes: 2 additions & 2 deletions book/src/differences_with_dioxus.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ These are the main differences between Freya and the different Dioxus renderers
| Category | Freya | Dioxus |
|--------------------------------------|------------------|---------------------------------|
| **Elements, attributes and events** | Custom | HTML |
| **Layout** | Custom ([`torin`](https://github.com/marc2332/freya/tree/main/torin)) | Browser and [`taffy`](https://github.com/DioxusLabs/taffy) |
| **Layout** | Custom ([`torin`](https://github.com/marc2332/freya/tree/main/torin)) | WebView and [`taffy`](https://github.com/DioxusLabs/taffy) |
| **Renderer** | Skia | WebView or WGPU |
| **Components library** | Custom | None, but can use CSS libraries |
| **Devtools** | Custom | Webviews already ship them |
| **Devtools** | Custom | Provided in Webview |
| **Headless testing runner** | Custom | None |
13 changes: 13 additions & 0 deletions book/src/guides/devtools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Devtools

Devtools can be enabled by adding the `devtools` to Freya.


```toml
// Cargo.toml

[dependencies]
freya = { version = "0.1", features = ["devtools"] }

```

7 changes: 5 additions & 2 deletions book/src/guides/getting_started.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Getting started

I encourage you to learn how [Dioxus works](https://dioxuslabs.com/docs/0.3/guide/en/describing_ui/index.html), when you are done you can continue here. Also make sure you have the followed the [environment setup](../setup.html) guide.
I encourage you to learn how [Dioxus works](https://dioxuslabs.com/learn/0.4/guide/your_first_component), when you are done you can continue here. Also make sure you have the followed the [environment setup](../setup.html) guide.

Now, let's start by creating a hello world project.

Expand Down Expand Up @@ -48,7 +48,6 @@ fn app(cx: Scope) -> Element {
render!(
rect {
overflow: "clip",
height: "100%",
width: "100%",
background: "rgb(35, 35, 35)",
Expand All @@ -67,3 +66,7 @@ Simply run with `cargo`:
```sh
cargo run
```

Nice! You have created your first Freya app.

You can learn more with the [examples](https://github.com/marc2332/freya/tree/main/examples) in the repository.
2 changes: 1 addition & 1 deletion book/src/guides/hot_reload.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hot reload

Freya supports Dioxus [hot reload](https://dioxuslabs.com/docs/0.3/guide/en/getting_started/hot_reload.html), this means you can update the `layout` and `styling` of your app on the fly, without having to compile any rust code.
Freya supports Dioxus hot reload, this means you can update the `layout` and `styling` of your app on the fly, without having to compile any rust code.

## Setup

Expand Down
2 changes: 1 addition & 1 deletion book/src/guides/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Learn how the layout attributes work.
- [`min_width & min_height`](#min_width_&_min_height)
- [`max_width & max_height`](#max_width_&_max_height)
- [`Size units`](#size_units)
- [`Static values`](#static-values)
- [`Logical pixels`](#logical-pixels)
- [`Percentages`](#percentages)
- [`calc()`](#calc)
- [`direction`](#direction)
Expand Down
18 changes: 9 additions & 9 deletions book/src/guides/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

Learn how the style attributes work.

- [background](#background)
- [shadow](#shadow)
- [corner\_radius & corner\_smoothing](#corner_radius-&-corner_smoothing)
- [border](#border)
- [overflow](#overflow)
- [Color syntax](#color-syntax)
- [Static colors](#static-colors)
- [rgb() / hsl()](#rgb--hsl)
- [Inheritance](#inheritance)
- [`background`](#background)
- [`shadow`](#shadow)
- [`corner radius & corner smoothing`](#corner_radius--corner_smoothing)
- [`border`](#border)
- [`overflow`](#overflow)
- [`Color syntax`](#color-syntax)
- [`Static colors`](#static-colors)
- [`rgb() / hsl(`)](#rgb--hsl)
- [`Inheritance`](#inheritance)

### background

Expand Down
8 changes: 4 additions & 4 deletions book/src/guides/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ Here, the component has a state that is `false` by default, but, once mounted it
async fn dynamic_test() {
fn dynamic_component(cx: Scope) -> Element {
let state = use_state(cx, || false);
let state_setter = state.setter();
use_effect(cx, (), move |_| async move {
state_setter(true);
use_effect(cx, (), |_| {
state.set(true);
async move { }
});
render!(
Expand Down Expand Up @@ -123,7 +123,7 @@ async fn event_test() {

## Testing configuration

The `launch_test` comes with a default configuration, but you can also pass your own with the `launch_test_with_config` function.
The `launch_test` comes with a default configuration, but you can also pass your own config with the `launch_test_with_config` function.

Here is an example of how to can set our custom window size:

Expand Down
2 changes: 1 addition & 1 deletion hooks/src/use_camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use std::{
time::Duration,
};

use crate::use_platform;
use dioxus_core::{AttributeValue, ScopeState};
use dioxus_hooks::{to_owned, use_effect, use_state, UseState};
use freya_common::EventMessage;
use freya_node_state::{CustomAttributeValues, ImageReference};
use nokhwa::{pixel_format::RgbFormat, utils::RequestedFormat, Camera, NokhwaError};
use tokio::time::sleep;
use crate::use_platform;

pub use nokhwa::utils::{CameraIndex, RequestedFormatType, Resolution};

Expand Down
6 changes: 3 additions & 3 deletions testing/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ async fn no_state() {
async fn with_state() {
fn stateful_app(cx: Scope) -> Element {
let state = use_state(cx, || false);
let state_setter = state.setter();

use_effect(cx, (), move |_| async move {
state_setter(true);
use_effect(cx, (), |_| {
state.set(true);
async move {}
});

render!(
Expand Down

0 comments on commit 2ae633e

Please sign in to comment.