Code Monkey home page Code Monkey logo

freya's People

Contributors

aspnxdd avatar dependabot[bot] avatar ealmloff avatar eventualbuddha avatar katyo avatar kobutri avatar marc2332 avatar olshamb avatar piny4man avatar renovate[bot] avatar shuai132 avatar tahatesser avatar tigerros avatar trickypr avatar tropix126 avatar wusyong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

freya's Issues

task: `NetworkImage` component

Freya currently has an image element that accepts raw bytes of an image, this is very low level. Therefore it's needed to have a easy way to load external images (e.g using http). This can be done via a NetworkImage component.

Considerations

It would be really useful to implement some kind of optional persisted cache to avoid getting the images when it's not needed.

tracking: Window related features

This tracks multiple features related to the app's windows.

  • Custom launch configuration
    • Window size
    • Window title
    • Window decoration
    • Window transparency
    • Window background color
  • #44

Issue building the counter example on macOS

HI Marc,
This is a really neat library.

I tried building the counter example on the latest version of macOS and got this compilation error:

   Compiling freya-hooks v0.1.0 (/Users/alex/Documents/projects/freya/hooks)
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
  --> hooks/src/use_animation.rs:39:29
   |
39 |     let tween = use_state::<AnimationMode>(&cx, || mode());
   |                             ^^^^^^^^^^^^^ explicit generic argument not allowed
   |
   = note: see issue #83701 <https://github.com/rust-lang/rust/issues/83701> for more information

For more information about this error, try `rustc --explain E0632`.
error: could not compile `freya-hooks` due to previous error
warning: build failed, waiting for other jobs to finish...

tracking: Testing support

This tracks the support for testing in Freya.

  • Headless running
  • Read text of a given Node
  • Get the NodeState of a given Node
  • Get the processed layout of a given Node
  • Simulate all supported events (mouse, keyboard, wheel, etc)

tracking: Events support

This issue tracks the support for events.

  • onclick
    • implemented
    • screen coordinates
    • element coordinates
    • global
  • onmousedown
    • implemented
    • screen coordinates
    • element coordinates
    • global
  • onmouseover
    • implemented
    • screen coordinates
    • element coordinates
    • global
  • onmouseleave
    • implemented
    • screen coordinates
    • element coordinates
  • onmouseenter
    • implemented
    • screen coordinates
    • element coordinates
  • onmouseup
    • implemented
    • screen coordinates
    • element coordinates
    • global
  • onwheel
    • implemented
    • y scroll
    • x scroll
  • keydown
    • implemented
    • Composable characters
    • Modifiers
  • keyup
    • implemented
    • Composable characters
    • Modifiers
  • onglobalclick
    • implemented
    • screen coordinates
  • ontouchcancel
    • screen coordinates
    • element coordinates
    • Finger ID
    • Force
    • global
  • ontouchend
    • screen coordinates
    • element coordinates
    • Finger ID
    • Force
    • global
  • ontouchmove
    • screen coordinates
    • element coordinates
    • Finger ID
    • Force
    • global
  • ontouchstart
    • screen coordinates
    • element coordinates
    • Finger ID
    • Force
    • global
  • onpointerdown
    • screen coordinates
    • element coordinates
    • Mouse type
    • Touch type
    • global
  • onpointerup
    • screen coordinates
    • element coordinates
    • Mouse type
    • Touch type
    • global
  • onpointerover
    • screen coordinates
    • element coordinates
    • Mouse type
    • Touch type
    • global
  • onpointerenter
    • screen coordinates
    • element coordinates
    • Mouse type
    • Touch type
  • onpointerleave
    • screen coordinates
    • element coordinates
    • Mouse type
    • Touch type

bug: Crash if width is a float

Reproduce

  1. Set the width to be a floating percentage (e.g. 23.5%)
  2. Run
  3. Crash

Error

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', /Users/school/.cargo/git/checkouts/dioxus-skia-2d7a6bc51af8408d/c27f004/state/src/node.rs:112:84
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', /Users/school/.cargo/git/checkouts/dioxus-skia-2d7a6bc51af8408d/c27f004/renderer/src/lib.rs:501:30

Code

cx.render(rsx! {
        view {
            height: "32",
            width: "auto",
            padding: "16",
            onscroll: onscroll,
            view {
                width: "23.5%",
                height: "stretch",
                background: "blue",
            }
        }
    })

suggestion: Enable x11 feature by default

Given that we currently have no support for alternative windowing systems (i.e. wayland), I think that we should enable the x11 feature by default on all linux compiles. Is there any specific technical limitation that would prevent this?

tracking: Hooks support

This issue tracks the implementation of the built-in hooks for Freya.

  • use_animation

    • Implemented
    • Bounce in
    • Ease in
    • Ease in out
    • Ease out
  • use_animation_transition

    • Implemented
    • Bounce in
    • Ease in
    • Ease in out
    • Ease out
  • use_focus

    • Implemented
  • use_init_focus

    • Implemented
  • use_editable

    • Implemented
  • use_node

    • Implemented
  • use_theme

    • Implemented
  • use_camera

    • Implemented
  • use_platform

    • Implemented
  • use_accessibility

    • Implemented
  • use_canvas

    • Implemented

bug: Support Composable key shortcuts

Currently, I am getting incoming keyboard presses from winit but I don't know how to get the resulting key. For example, let's say the user presses shift + 7, that will make a / on my keyboard, how could I actually know it's a /, is there any library to calculate this, or maybe there is a feature on winit that I am missing?

tracking: Text editing

This tracks the current support for different text editing features.

Supported

  • Multi line editing
  • Enter key
  • Backspace key
  • Move cursor to cursor on click
  • Move cursor using arrows key
  • Delete key
  • Highlight/select text
  • Delete/replace the selected text (#356)
  • Copy/cut/paste (#473)

bug: High DPI not supported

Application text is too small when compared to other system applications.

Screen Shot 2022-08-30 at 8 31 45 pm

Left: Example application
Right: Color meter for text size reference.

tracking: Styling

Tracks styling attributes and features.

Text elements

  • Color
  • Font size
  • Font style
  • Built-in Font family
  • Custom fonts
  • Text decorations
  • Text align
  • Text max lines
  • Font style
  • Font weight
  • Font width
  • Text shadow
  • Letter spacing
  • Word spacing
  • linear-gradient()
  • rgb()
  • hsl()

Other

  • Background color
  • Shadow
  • Corner radius and smoothing
  • Rotate effect
  • Border
  • Opacity

windows build error - procmacro2 conflict

> cargo build
    Blocking waiting for file lock on package cache
    Updating git repository `https://github.com/DioxusLabs/dioxus`
    Updating git repository `https://github.com/marc2332/freya`
    Updating crates.io index
error: failed to select a version for `proc-macro2`.
    ... required by package `syn v2.0.3`
    ... which satisfies dependency `syn = "^2.0.3"` of package `serde_derive v1.0.158`
    ... which satisfies git dependency `dioxus-router` of package `freya v0.1.0 (https://github.com/marc2332/freya#a1625237)`
    ... which satisfies git dependency `freya` of package `ticktick v0.1.0 (F:\GITHUB REPOS\ninetynin\todowo)`versions that meet the requirements `^1.0.52` are: 1.0.52
all possible versions conflict with previously selected packages.
  previously selected package `proc-macro2 v1.0.50`
    ... which satisfies dependency `proc-macro2 = ">=1.0.0, <2.0.0"` (locked to 1.0.50) of package `bindgen v0.56.0`
    ... which satisfies dependency `bindgen = "^0.56.0"` of package `v4l2-sys-mit v0.2.0`
    ... which satisfies dependency `v4l2-sys-mit = "^0.2"` of package `nokhwa-bindings-linux v0.1.0`
    ... which satisfies dependency `nokhwa-bindings-linux = "^0.1.0"` of package `nokhwa v0.10.3`
    ... which satisfies dependency `nokhwa = "^0.10.3"` of package `freya-hooks v0.1.0 (https://github.com/marc2332/freya#a1625237)`
    ... which satisfies git dependency `freya-hooks` of package `freya v0.1.0 (https://github.com/marc2332/freya#a1625237)`
    ... which satisfies git dependency `freya` of package `ticktick v0.1.0 (F:\GITHUB REPOS\ninetynin\todowo)`

failed to select a version for `proc-macro2` which could resolve this conflictPS F:\GITHUB REPOS\ninetynin\todowo>

cargo.toml ->

[package]
name = "ticktick"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
#cairo-rs = "0.16.7"
wallpaper = { version = "3.2.0", features = ["from_url"] }
imageproc = "0.23.0"
image = "0.24.5"
rusttype = "0.9.3"
# clap = "4.1.4"
clap = { version = "4.1.4", features = ["cargo"] }

freya = { git="https://github.com/marc2332/freya" }
dioxus = { git="https://github.com/DioxusLabs/dioxus", rev="49c5a5043a16fc82210af146c345793dd448e519"}

feat: Scoped themes

Currently, themes are global, this means that you cannot have scoped themes. Implementing a ThemeProvider component leveraging the context API from Dioxus it would scoped (aka nested) themes.

It would also be useful to have third-party defines values via some HashMap or something like that.

feat: Cursor support

Components with editable content such as Inputs should display a cursor.

My idea is to implement a new attribute that specifies the character index where the cursor must be positioned, lately in the layout engine it can calculate the proper position for the cursor using Skia's Font::measure_str()

Some random thing I coded that seems to work:

let p = Paint::default();
let f_t = SkFontStyle::default();
let fonts = font_collection.find_typefaces(&[node.state.font_style.font_family.clone()], f_t);
let f = fonts.get(0).unwrap();   
let f = Font::from_typeface(f, node.state.font_style.font_size);
let l = f.measure_str("l", Some(&p));
// This calculates with width of "l"

task: `LocalImage` component

Freya currently has an image element that accepts raw bytes of an image, this is very low level. Therefore it's needed to have a easy way to load ocal images (dynamically loaded images from the file system). This can be done via a LocalImage component.

Considerations

It would be really useful to implement some kind of optional persisted cache to avoid getting the images when it's not needed.

tracking: Devtools support

This issue tracks the support for Devtools.

To enable DevTools, simply run Freya with the devtools feature.

image

  • Isolate the devtools into it's own VirtualDOM
  • Node Tree inspector
  • Draw a purple border over the selected node in the tree
  • Node inspector
    • Style
    • Layout
    • Event listeners

suggestion: Add more cargo features

I think it would be useful to have some already-enabled features from other crates like rust-skia's svg to be as a standalone freya feature, that way, it could be disabled, although enabled by default.

suggestion: Controlled scrolling

Actual implementation https://github.com/marc2332/freya-editor/blob/main/src/controlled_virtual_scroll_view.rs

Currently, both ScrollView and VirtualScrollView have uncontrolled scrolling, meaning you cannot manually control the behavior/state of their scroll.

This could be a good way to make the scrolling optionally controllable:

fn app(cx: Scope) -> Element {
    let scroll_controller = use_new_scroll_controller();

    render!(
        rect {
            height: "100%",
            width: "100%",
            padding: "100",
            background: "white",
            Button {
                onclick: move |_| scroll_controller.scroll_to_bottom(),
                label {
                    "Scroll to bottom"
                }
            }
            ScrollView {
                controller: scroll_controller,
                show_scrollbar: true,
                rect {
                    height: "100%",
                    width: "100%",
                    background: "rgb(27, 38, 59)",
                    padding: "25",
                    onclick: move |_| scroll_controller.scroll_to(0),
                    label { "Click to go up" }
                }
            }
        }
    )
}

Both ScrollView and VirtualScrollView would have an option parameter that would accept a trait object that implements a certain trait that controls how the scroll behaves and would also allow to modify the current scroll position.

Maybe it could even be accessed by their children if it was passed via a context provider.

fn app(cx: Scope) -> Element {
    let scroll_controller = use_new_scroll_controller();
    
    // internally calls use_context_provider
    scroll_controller.provide(&cx);

    render!(
        rect {
            height: "100%",
            width: "100%",
            padding: "100",
            background: "white",
            ScrollView {
                controller: scroll_controller,
                show_scrollbar: true,
                CoolComponent { },
                rect {
                    height: "100%",
                    width: "100%",
                    background: "rgb(27, 38, 59)",
                    padding: "25",
                    onclick: move |_| scroll_controller.scroll_to(0),
                    label { "Click to go up" }
                }
            }
        }
    )
}

#[allow(non_snake_case)]
fn CoolComponent(cx: Scope) -> Element {
   let scroll_component = use_scroll_controller(&cx);

   render!(
     Button {
        onclick: move |_| scroll_controller.scroll_to_bottom(),
        label {
            "Scroll to bottom"
        }
    }
  )
}

tracking: SVG Support

Having SVG support quires enabling a cargo feature on rust-skia, but, there isn't available any prebuilt binaries of Skia with the SVG feature, so, I guess I'll need to make a PR to their repo.

Because the other option would be to make the users build Skia on their own... but that's not funny.

Some days ago, I made an attempt trying to build a Windows binary with the SVG feature enabled, it seemed to build just fine, but I didn't test it.

suggestion: More flexible `use_editable` hook

  • Make a more flexible hook based on use_editable that would allow you passing your own Rope and cursor state instead of being hold by the same hook.
  • Make use_editable use this same hook in order to not duplicate code
  • Name idea: use_edit

Why?

use_editable is great but it doesn't work well when for example you aremapping some values into multiple Components that call this hook, but you want to save the rope and cursor state outside of this component (e.g global state).

feat: Move away from dioxus_html

Use custom events data instead of dioxus_html's MouseData and WheelData which doesn't completely fit in Freya since it's designed to be used in for web/web-like renderers

tracking: calc() attribute

This issue tracks the state of the calc() function.

Summary

calc() is inspired by the CSS's spec. It allows specifying a certain calculation instead of using a static value.

For example, this way we can draw a rectangle whose width will be the half of the window plus 100:

fn app(cx: Scope) -> Element {
    cx.render(rsx!(rect {
        background: "black",
        width: "calc(50% + 100)",
        height: "100%",
    }))
}

Downsides

  • Calculations are made in order, so there is no priority for divisions or multiplications.
    For example, the expected result of calc(100 + 250 * 2) would be 600, but it's 700 since it goes one by one.

tracking: Components library

Tracking the implementation of the components library:

  • Switch
    • Implemented
  • Button
    • Implemented
    • Partial Accessibility
  • Slider
    • Implemented
  • Input
    • Implemented
    • Cursor support
  • ScrollView
    • Implemented
    • show_scrollbar
    • Vertical direction
    • Horizontal direction
    • Both directions
    • Scroll events
    • Custom Scrollbar component
  • VirtualScrollView
    • Implemented
    • Vertical direction
    • Horizontal direction
    • Scroll events
    • Custom Scrollbar component
  • LocalImage
    • Implemented (#111)
  • NetworkImage
    • Implemented
    • Partial Accessibility
  • Dropdown
    • Implemented
    • Partial Accessibility
    • Multiselect
  • Accordion
    • Implemented
    • Group-awareness (example)
  • GestureArea
    • Implemented
    • TapUp
    • TapDown
    • DoubleTap
    • LongPress
    • Drag
  • Drag & Drop
    • Implemented
    • DragZone
    • DropZone
  • CursorArea
    • Implemented
  • Graph
    • Implemented
    • Customizable
  • Table
    • Implemented
  • ProgressBar
    • Implemented

task: Devtools improvements

  • Draw wireframe around the selected node
  • Use VirtualScrollView
  • Computed layout tab
  • Improve the overall design
  • Simulated events in DevTools
  • Persisted ScrollViews position between route changes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.