Commit Graph
593 Commits
Author SHA1 Message Date
Jonathan Kelley d2bd175143 feat: allow providing context to the root component 2022-01-21 00:37:52 -05:00
Jonathan Kelley 8d3ac3ff14 Merge pull request #107 from autarch/autarch/half-assed-router
A partial implementation of the router and associated bits
2022-01-18 00:01:34 -05:00
Dave Rolsky 64080588d0 Add a warning when Link it called outside of a Router context 2022-01-17 15:52:01 -06:00
Jonathan Kelley 5bce294a86 Merge pull request #127 from DioxusLabs/jk/handler-tweak
fix: allow eventhandler to derive default
2022-01-16 21:30:34 -05:00
Jonathan Kelley 47bc4e4a44 feat: add "optional" flag for props 2022-01-16 15:27:41 -05:00
Jonathan Kelley 036a0ff49a docs: add comments for the Handler 2022-01-16 15:13:31 -05:00
Jonathan Kelley e47ead5347 fix: allow eventhandler to derive default 2022-01-15 20:17:48 -05:00
Dave Rolsky 9b282d877b Don't expect all components to have a scope in ScopeArena.ensure_drop_safety
Not all components will be mounted when using a Router, so we cannot assume
all components have a scope.
2022-01-14 15:40:01 -06:00
Dave Rolsky 81c094ed29 Fix handling of re-renders in the Router
Previously the router just stored a `root_found` boolean after it picked a
route. But on re-render it would just always return false from `should_render`
if this was true. This just aborted routing after a future resolved (or
anything else that triggered a re-render).

Now we store the matching ScopeId and check that against our routes in a
re-render so we actually do re-render the matching route.
2022-01-14 14:55:12 -06:00
Dave Rolsky e06eac1ce5 More WIP router implementation 2022-01-13 12:26:49 -06:00
Dave Rolsky c9408da731 Implement UseRoute segment method
This relies on the RouterService to capture path params when it does path
matching.
2022-01-13 12:21:06 -06:00
Dave Rolsky f8a7e1cd82 Implement router matching for path parameters
We don't want to have the router just always match paths as exact strings. If
a path contains a parameter like "/thing/:id" then the ":id" portion of the
route should match _any_ string, not a literal ":id".
2022-01-13 12:21:06 -06:00
Dave Rolsky 3c6142fb9d Commit WIP on router
There are a few different changes in here that probably need to be picked
apart. I'm sure much of this is wrong.

* Fix missing `dyn` that compiler complained about in router.rs

* Make UseRoute store a `Rc<RouterService>` rather than a string so we can get
information out of the router like current location.

* Implement `UseRoute`'s nth_segment and last_segment methods. I changed the
return type to a String because of the above.

* Remove some unused imports in platform/mod.rs and service.rs

* Implement the `use_route` fn. It panics if called outside a Router { } (I
think). I think that makes sense.

* Add a `current_location` method to `RouterService` that returns the current
location. I needed this both for the `UseRoute` implementation and _also_ so I
could get at this in my webapp code. I think having some way to get this will
be useful for others, whether or not this exact API is used. In my case, I
want to compare the current path to the `to` path of a `Link` so I can use a
different class for that `Link` if it is the currently active page.
2022-01-13 12:21:06 -06:00
Dave Rolsky 3a5b417ad1 Add more trace messages to the RouterService code
I was trying to debug some issues with my routes and this additional tracing
was quite helpful.
2022-01-13 12:21:06 -06:00
Dave Rolsky d367e0f89f Fix typo in RouterService struct's "registered_routes" field name
This was "registerd_routes", missing an "e".
2022-01-13 12:21:06 -06:00
Dave Rolsky e22ba5b1e5 Add title prop to Link
Every element can have a title, but it's particularly useful on links, so I
think making it an explicit option is worthwhile.
2022-01-13 12:21:06 -06:00
Jonathan Kelley ca0dd4aa71 Merge pull request #95 from DioxusLabs/jk/filedragindrop
File Drag and Drop support
2022-01-10 23:19:36 -05:00
Jonathan Kelley 0369fe72fb Merge pull request #111 from DioxusLabs/jk/props-attrs
Flatten optional prop attributes
2022-01-10 17:11:08 -05:00
Jonathan Kelley 6bc45b1c50 fix: clippy 2022-01-10 13:00:23 -05:00
Jonathan Kelley bad36162af fix: wry pathing 2022-01-10 12:57:43 -05:00
Jonathan Kelley 9ae981a1af wip: drag and drop support 2022-01-10 12:57:39 -05:00
Jonathan Kelley 20a29409b2 Merge pull request #113 from DioxusLabs/jk/desktop-cursor-jump
fix: cursor jumping in desktop inputs
2022-01-10 12:20:13 -05:00
Sven Assmann 007d06d602 feat(events:focus): add missing onfocusin event 2022-01-10 18:08:29 +01:00
Jonathan Kelley eb138848ec feat: also hide placeholder node 2022-01-10 12:06:55 -05:00
Jonathan Kelley be614e6535 fix: cursor jumping and use set instead of lsit 2022-01-10 12:04:54 -05:00
Sven Assmann 9849f68f25 feat(example:todomvc): add editing support
- implement "onfocusout" handler
- set autofocus
- handle enter, escape and tab on a todo item
- make the `<pre>` element between todo list items of margin 0 to be unnoticable
2022-01-10 14:46:23 +01:00
Jonathan Kelley d2372717bd feat: flatten props attrs 2022-01-10 02:57:03 -05:00
Jonathan Kelley 255f58af63 fix: ssr respects bool attrs 2022-01-10 01:32:32 -05:00
Jonathan Kelley f4132d1874 Merge pull request #108 from DioxusLabs/jk/fstring-component-fields
Fix: string formatting detection in component fields
2022-01-10 01:20:58 -05:00
Jonathan Kelley 90abd9c9a0 fix: detection of f-string formatting in components 2022-01-10 01:20:03 -05:00
Jonathan Kelley 29bf424b09 Merge pull request #101 from alexkirsz/ci
CI: Enable clippy
2022-01-08 20:28:10 -05:00
YuKun Liu 92561612c7 fix: format code 2022-01-09 02:25:11 +08:00
YuKun Liu 8f4aa84f1a feat: bool attr white list 2022-01-09 02:02:23 +08:00
Alexandre Kirszenberg b6903bf558 Enable clippy 2022-01-08 16:35:26 +01:00
Jonathan Kelley b804c691d5 Release dioxus-hooks v0.1.6, dioxus-mobile v0.0.3, dioxus-router v0.1.0, dioxus-ssr v0.1.2, dioxus-web v0.0.4, dioxus v0.1.7 2022-01-08 02:30:37 -05:00
Jonathan Kelley cd0dcacaf2 Release dioxus-desktop v0.1.5 2022-01-08 02:30:03 -05:00
Jonathan Kelley a36dab7f45 Release dioxus-html v0.1.4, dioxus-desktop v0.1.5, dioxus-hooks v0.1.6, dioxus-mobile v0.0.3, dioxus-router v0.1.0, dioxus-ssr v0.1.2, dioxus-web v0.0.4, dioxus v0.1.7 2022-01-08 02:28:25 -05:00
Jonathan Kelley 16d73b240f Release dioxus-core v0.1.7 2022-01-08 02:27:48 -05:00
Jonathan Kelley db0a5bd6ec Release dioxus-core-macro v0.1.6 2022-01-08 02:26:29 -05:00
Jonathan Kelley 40d1f85d0c Release dioxus-core v0.1.7, dioxus-core-macro v0.1.6, dioxus-html v0.1.4, dioxus-desktop v0.1.5, dioxus-hooks v0.1.6, dioxus-mobile v0.0.3, dioxus-router v0.1.0, dioxus-ssr v0.1.2, dioxus-web v0.0.4, dioxus v0.1.7 2022-01-08 02:25:03 -05:00
Jonathan Kelley 21232285d9 fix: add exclusion list 2022-01-08 02:14:05 -05:00
Jonathan Kelley 8d685f40b7 feat: handle bool attrs properly 2022-01-08 02:09:02 -05:00
Jonathan Kelley 9dff700c22 feat: enable prevent_default everywhere 2022-01-07 21:56:12 -05:00
Jonathan Kelley d11f322f55 docs: add title to doc comment 2022-01-07 12:12:33 -05:00
Jonathan Kelley be9f1a52ad docs: better document the EventHandler type 2022-01-07 12:12:13 -05:00
Jonathan Kelley c439b0ac7e fix: component pass thru events 2022-01-07 11:51:25 -05:00
Jonathan Kelley 211d44d363 Merge pull request #84 from DioxusLabs/jk/windows-lag
fix: windows and gtk startup lag
2022-01-07 10:52:28 -05:00
Jonathan Kelley cdc2d8ec6d Merge pull request #80 from DioxusLabs/jk/router2dotoh
feat: allow use_ref to be cloned into async and add support for for_async
2022-01-07 02:23:19 -05:00
Jonathan Kelley 175a6a199c wip: clear warnigns 2022-01-07 02:07:10 -05:00
Jonathan Kelley fd911584dc wip: remove lag by forcing update 2022-01-07 02:05:14 -05:00