Commit Graph
64 Commits
Author SHA1 Message Date
Youn Mélois fd65c12bf5 fix(rsx): formatted attribute merging (#3719)
* test(rsx): add better tests for attributes merging

* fix(rsx): zero-lengthed source with non-empty segments is non-trivial

* refactor(rsx): use `is_empty` instead of `len() == 0` (clippy)

* fix(rsx): different asserts whether in release or not
2025-04-15 14:28:14 -07:00
Evan Almloff 4676171861 Fix hot reloading components with keys (#2886)
* Fix hot reloading components with keys

* include component formatted segment keys, but not dynamic component value

* Fix component_literal_dyn_idx index

* add a new test for hot reloading components with keys

* Even more tests

* make clippy happy

* fix typo
2024-08-28 18:53:11 -05:00
Jonathan Kelley ae4a2464b3 fix: use prettier-please just in tests - no custom wrapper (#2767)
* fix: use prettier-please just in tests - no custom wrapper
2024-08-01 17:46:51 -07:00
Evan Almloff 74e51b7e0d Fix hot reloading spreads (#2750) 2024-07-30 15:34:27 -07:00
Evan Almloff 34bdcd15cf Switch to a pool of dynamic values for hot reloading (#2705)
* create the dynamic value pool

* assign ids to dynamic formatted segments

* separate the rendering and literal pools

* rsx output compiles again

* more examples compiling with new rsx expansion

* update template body explanation

* all workspace examples compile

* fix formatted segments in keys

* start hot reload diffing

* fix component literal hot reloading

* start integrate new hot reloading with the CLI

* simple hot reloads working

* Fix hot reloading blocks with components

* implement hot reloading for if chains

* Fix hot reloading after a template requires a full rebuild

* Fix hot reloading any attribute values

* remove unsafe from hot reload utils

* Fix hot reloading empty rsx

* add more hot reloading tests

* reorganize hot reload module

* fix web hydration

* fix empty rsx nodes in autoformatting

* fix tests

* remove path sorting logic from core

* make template names more consistent in debug mode

* fix quote_as_hot_reload_literal for explicitly typed literals

* fix can_be_shorthand for string literals

* fix formatted single dynamic expression

* Fix usize component properties and playwright tests

* remove default implementation for TemplateBody

* add a bunch more comments for diffing, scoring and why this scoring system is optimal
2024-07-30 17:16:27 +00:00
Evan AlmloffandJonathan Kelley 7f210633eb fix formatting and merging if chains in attributes (#2697)
* fix formatting and merging if chains in attributes

* fix autoformat if attribute chains

* Fix IfAttributeValue ToTokens implementation

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-07-24 18:56:21 -07:00
Evan Almloff bd484842bd Fix playwright tests (#2695) 2024-07-24 12:48:30 -07:00
Tristan F.andJonathan Kelley 9167cd9dec fix most typos, add crate-ci/typos to CI (#2653)
* fix most typos, add crate-ci/typos to CI

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-07-23 17:49:33 -07:00
Evan AlmloffandJonathan Kelley 3bb9a535d8 Parse raw elements, attributes, and web components in rsx (#2655)
* parse raw elements and attributes in rsx

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-07-23 16:48:40 -07:00
Evan AlmloffandJonathan Kelley fa4e5dbf62 Fix rsx autocomplete and diagnostics in the root; provide better completions after attributes are finished (#2656)
* fix rsx autocomplete and diagnostics in the root; provide better completions after attributes are finished

* clean up pr to use internal child parsing

* Fix peek_lowercase name

* fix comma diagnostics in the root

* Fix parsing components with a path

* remove simple routes trailing comma

* Fix incomplete_root_elements test

* Remove trailing commas from root body node in tests

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-07-23 16:34:50 -07:00
88af3e7eff Hotreloading of for/if/body, formatted strings, literals, component props, nested rsx, light CLI rewrite, cli TUI (#2258)
Hotreload the contents of for loops, if chains, component bodies, props, attributes, and any literals discovered in rsx!
Add a TUI renderer to the CLI.
Improve the CLI build system to be async and parallel.
Refactor RSX to allow partial expansion of expressions.
Merge autofmt implementations for consistency.
Merge the representation of elements and components under the hood.
Add a diagnostics system for rsx for improved error messages.
Drop interprocess and move to websockets for communication between the CLI and the server.
Assign IDs to nodes and attributes in a stable way to be used in non compiler contexts.
Add hotreloading to any body of component/for loop/if chain/etc.

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
Co-authored-by: Liam Mitchell <liamkarlmitchell@gmail.com>
2024-07-17 19:11:18 -07:00
Evan Almloff 2f387604a8 remove double braces in shorthand children error message 2024-06-12 14:45:17 -05:00
Evan AlmloffandJonathan Kelley 2523581cf4 Autocomplete rsx (#2421)
* autocomplete rsx

* hide the completions module

* fix autocomplete for identifiers that start with a raw identifier

* add field completion hints for props

* remove extra import

* Revert "add field completion hints for props"

This reverts commit 194899c73783e0f9b5d601d53365746d838f2048.

* fix autocomplete inside raw expressions

* fix autofmt

* feat: just use regular ifmt if it's compatible

reuses the tokens for ifmt so RA provides its HIR lowering on simple formatted strings

* fix merging ifmt strings

* add a better error message for components called like functions

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-05-22 07:24:50 -05:00
Evan Almloff af524d979b Fix empty for loop, if statements and children (#2275)
* fix empty for loop, if statements and children

* fix clippy
2024-04-08 19:23:55 -07:00
Jonathan Kelley ae352f8958 Feat: reject invalid keys 2024-03-07 16:03:00 -08:00
Jonathan Kelley 0bd9692e45 Fix cargo test and a number of little cleanup bugs 2024-01-30 17:33:14 -08:00
Evan Almloff 300a7dc12b Create a new function for dioxus-rsx Element 2024-01-30 11:10:45 -06:00
Evan Almloff 8d14671520 fix spreading attributes 2024-01-16 11:04:37 -06:00
Evan Almloff af1749d7be re export renderers in dioxus 2024-01-15 19:14:11 -06:00
Jonathan Kelley 2ae3241cc0 Merge branch 'master' into jk/breaking-merged 2024-01-11 16:04:36 -08:00
Jonathan Kelley 4f077ec664 Merge pull request #1812 from ealmloff/duplicate-event-listener-rsx
check for duplicate event listeners in the rsx macro
2024-01-11 14:34:01 -08:00
Jonathan Kelley 8ff13c3c1b Fix some basic clippy stuff 2024-01-11 12:13:38 -08:00
Jonathan Kelley 8881b8a473 Use error instead of panic for span location in rsx macro shorthand 2024-01-11 11:37:12 -08:00
Evan Almloff 9b5a797008 check for duplicate event listeners in the rsx macro 2024-01-11 10:34:08 -06:00
Jonathan Kelley 8a77d2560e fix tests around children elements 2024-01-10 23:42:36 -08:00
Jonathan Kelley f1e8faffb5 fix tests 2024-01-10 23:17:01 -08:00
Evan Almloff 4013341b6c hello world example working 2024-01-05 18:01:05 -06:00
Evan Almloff 5b65c4cfb4 implement spreading props in the rsx macro 2023-09-22 10:04:34 -05:00
Evan Almloff 9e167dfdb7 Merge branch 'many_optional_attributes' into pr/atty303/1349 2023-09-22 09:32:05 -05:00
Evan Almloff fc8c25280a allow many attributes to be attached to one element 2023-09-20 16:02:04 -05:00
Evan Almloff ab2b9fb34e fix autoformatting 2023-09-19 09:39:53 -05:00
Evan Almloff d297e2baa2 Add optional attributes 2023-09-18 19:50:02 -05:00
Evan Almloff 9f1c735cf1 combine style and class attributes when there are multiple 2023-09-14 16:40:49 -05:00
Evan Almloff 8c47dfaf78 clean up attribute parsing 2023-09-14 14:08:39 -05:00
Koji AGAWA d573f5dfd5 feat: props spread 2023-08-13 16:45:17 +09:00
Evan Almloff 05fb8c1e91 Merge branch 'master' into router-typesafe 2023-07-07 18:31:48 -07:00
Torstein Grindvik a3169ac17b Change missing trailing comma span to point to span where comma is missing from
Signed-off-by: Torstein Grindvik <torstein.grindvik@nordicsemi.no>
2023-07-02 15:19:03 +02:00
Evan Almloff 8f67d0aafd make creating rsx nodes from macros possible 2023-06-29 12:52:27 -07:00
Evan Almloff f74854b38c fix formatting with raw elements 2023-03-20 07:21:31 -05:00
Evan Almloff 03413a68ab fix formatting 2023-03-19 20:47:16 -05:00
Evan Almloff 209a55da69 allow raw elements if they include a dash 2023-03-19 20:37:40 -05:00
Jonathan Kelley 1940855e39 feat: implement comments in zero children nodes 2023-01-10 17:47:58 -08:00
Evan Almloff c5672650f1 use the namespace and volitity defined in the html crate 2023-01-03 09:03:20 -06:00
Jonathan Kelley 4aac2cdae1 fix: raw attr names 2022-12-26 22:57:45 -05:00
Jonathan Kelley c240aebfa1 chore: start instead of flart 2022-12-26 09:58:41 -05:00
Jonathan Kelley 8b854963e9 fix: serialize custom attrs properly 2022-12-25 23:58:31 -05:00
Jonathan Kelley d160f38bc2 fix: parsing of attributes without trailing commas 2022-12-12 11:18:36 -08:00
Jonathan Kelley 0bf4725639 fix: namespacing of dynamic attributes 2022-12-07 15:11:51 -08:00
Jonathan Kelley 47d0f51e00 wip: overhaul event system 2022-11-15 16:05:22 -08:00
Jonathan Kelley 7cbb4d52dd wip: more modifications to templates 2022-10-21 18:54:14 -07:00