Commit Graph

1383 Commits

Author SHA1 Message Date
Nikhil Rao
7903a1020d
Clean up config and app API (#3197) 2024-05-02 18:15:28 -07:00
Elijah Ahianyo
db47d39979
Windows --frontend-only fix ctrl + c (#3181) 2024-05-01 17:40:27 -07:00
Masen Furer
c636c91c9c
[REF-2273] Implement .setvar special EventHandler (#3163)
* Allow EventHandler args to be partially applied

When an EventHandler is called with an incomplete set of args it creates a
partial EventSpec. This change allows Component._create_event_chain to apply
remaining args from an args_spec to an existing EventSpec to make it
functional.

Instead of requiring the use of `lambda` functions to pass arguments to an
EventHandler, they can now be passed directly and any remaining args defined in
the event trigger will be applied after those.

* [REF-2273] Implement `.setvar` special EventHandler

All State subclasses will now have a special `setvar` EventHandler which
appears in the autocomplete drop down, passes static analysis, and canbe used
to set State Vars in response to event triggers.

Before:
    rx.input(value=State.a, on_change=State.set_a)

After:
    rx.input(value=State.a, on_change=State.setvar("a"))

This reduces the "magic" because `setvar` is statically defined on all State
subclasses.

* Catch invalid Var names and types at compile time

* Add test cases for State.setvar

* Use a proper redis-compatible token
2024-05-01 17:13:55 -07:00
benedikt-bartscher
9ead091fec
Improved get_attribute_access_type tests (#3180)
* test get_attribute_access_type against attrs

* add union and hybrid_property tests
2024-05-01 17:13:23 -07:00
Masen Furer
aeca983290
Allow StatefulComponent to also be rendered via __str__ (#3211)
This makes it easier to implement React "render functions" when wrapping
components that require children to be a callable.
2024-05-01 17:03:40 -07:00
khhan0130
be93b1280c
Update CodeBlock class to accept rx.color in custom_style (#3168) 2024-05-01 14:48:33 -07:00
Elijah Ahianyo
93c4f5024e
Windows Pin Bun version (#3192) 2024-05-01 14:47:03 -07:00
Masen Furer
19d8f6c752
[REF-2523] Implement new public Component API (#3203) 2024-05-01 14:46:27 -07:00
benedikt-bartscher
e31b458a69
allow optional props with None default value (#3179) 2024-05-01 13:33:38 -07:00
benedikt-bartscher
73e9123733
migrate deprecated redis.close to redis.aclose (#3199) 2024-05-01 12:05:00 -07:00
Martin Xu
fe731e385d
custom component install as editable mode (#3200) 2024-04-30 18:12:16 -07:00
Masen Furer
b7e85ecec4
[REF-2574] Default width for Stack (+children) and default padding for container (#3104) 2024-04-30 13:15:57 -07:00
Nikhil Rao
8bb736111a
Change readme back to use 0.4.x (#3188) 2024-04-30 00:50:02 +02:00
Angelina Sheyko
4b6a7ff8e3
Fixed unused kwargs in reflex.App (#3170) 2024-04-29 13:53:27 -07:00
Masen Furer
3564df7620
Implement throttle and debounce as event actions (#3091) 2024-04-26 17:28:51 -07:00
benedikt-bartscher
c2017b295e
Improved get_attribute_access_type (#3156) 2024-04-26 17:28:30 -07:00
Masen Furer
74eaab5e19
Integration testing: Firefox compatibility (#3162)
* Integration testing: Firefox compatibility

* test_client_side_storage: ruff format
2024-04-26 13:44:08 -07:00
Thomas Brandého
92cdc15896
IconButton for color_mode with nice default and a position props to control it (#3165) 2024-04-26 12:08:09 -07:00
Elijah Ahianyo
3a58558166
Bump bun version to 1.1.5 (#3176) 2024-04-26 11:50:51 -07:00
Thomas Brandého
0ef695d842
add default underline for links (#3148) 2024-04-26 11:42:05 -07:00
Masen Furer
0a8aaea599
[REF-2682] Foreach over dict uses Tuple arg value (#3160)
* test_foreach: assert on arg _var_type

* [REF-2682] Foreach over dict uses Tuple arg value

When iterating over a Var with _var_type dict, the resulting arg value
_var_type should be Tuple[key, value] so it can be correctly used with other
var operations.

Fix #3157

* Correct _var_type for iteration over Tuple of multiple types

The arg value when iterating over a tuple could be any of the possible values
mentioned in the annotation.

When only one type is used, the Union collapses to the base type, at least in py3.11

* Add comments
2024-04-25 09:10:55 -07:00
Thomas Brandého
ac36bfc6ea
Radix 3.0 (#3159) 2024-04-25 08:33:29 -07:00
JLDev
ebb0e79232
a little correction in the "es" docs (#3127) 2024-04-24 20:58:10 -07:00
Thomas Brandého
0c0477cffb
extend rx.input allowed types (#3149) 2024-04-24 16:04:56 -07:00
Ogidi Ifechukwu
ce2bd2286e
Refactor upload component and add styled upload component (#3035) 2024-04-24 13:45:22 -07:00
Angelina Sheyko
cd1a30d758
Fixed app name validation (#3146) 2024-04-24 13:32:36 -07:00
Martin Xu
a5f9001cf9
send template info in init telemetry event (#3153) 2024-04-24 06:47:33 -07:00
Thomas Brandého
b084c805d4
sync ruff version in pyproject.toml with the precommit one (#3150) 2024-04-23 16:53:36 -07:00
Jirka Borovec
4d567b7ec1
ruff-format: unify Black with Ruff v0.1 (#2837)
* ruff-format: unify Black with Ruff

* ruff lint.

* v0.1.0

* run precommit

* hand fixing

* fix `not isinstance(...)`

Co-authored-by: Thomas Brandého <thomas.brandeho@gmail.com>

* rev isinstance(...) with noqa

* exclude = ["*.pyi"]

* apply precommit

* apply format

* revert pyi

* fixing

* Fix or

Co-authored-by: Thomas Brandého <thomas.brandeho@gmail.com>

* Update reflex/components/datadisplay/code.pyi

* Apply suggestions from code review

Co-authored-by: Thomas Brandého <thomas.brandeho@gmail.com>

* Update tests/components/core/test_colors.py

* Update reflex/app.py

* Update reflex/app.py

* Update benchmarks/test_benchmark_compile_pages.py

* Update benchmarks/test_benchmark_compile_pages.py

* Update benchmarks/test_benchmark_compile_pages.py

---------

Co-authored-by: Thomas Brandého <thomas.brandeho@gmail.com>
2024-04-23 14:40:06 -07:00
Elijah Ahianyo
8e4d6a4781
[REF-2636]Improve Error message for unsupported event trigger (#3147)
* Improve Error message for unsupported event trigger

* typo fix

* fix ci

* add tests

* Update reflex/components/component.py

Co-authored-by: Masen Furer <m_github@0x26.net>

* fix typo

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-04-23 14:36:26 -07:00
Masen Furer
25b84107da
bump to 0.4.9 (#3142) 2024-04-23 09:52:17 -07:00
Thomas Brandého
fd3375394b
pin macos version for CI (#3145)
* fix macos version for CI

* pin macos to 12 for CI

* replace macos-latest with macos-12
2024-04-23 17:38:12 +02:00
Masen Furer
cd4f6bd056
[REF-2620] Fallback to npm (not bun) (#3138)
get_package_manager() will always resolve to npm
2024-04-22 18:17:54 -07:00
Ihor
415ce5557c
fix: args issue in __init__ of App class (#3140) (#3141) 2024-04-22 15:43:16 -07:00
benedikt-bartscher
0a1ff38920
separate DECORATED_PAGES per reflex app (#3102) 2024-04-22 11:32:31 -07:00
Masen Furer
041abb39c8
[REF-2619] Re-init when the template is out of date (#3121) 2024-04-22 11:32:00 -07:00
Masen Furer
19007ee2a1
pin react-focus-lock to 2.11.3 (#3123) 2024-04-19 21:12:42 -07:00
Tom Gotsman
a23faa2c50
add color dalle code example (#3108) 2024-04-19 17:54:10 -07:00
Masen Furer
6ca5f48ae7
[REF-2587] Ignore top-level theme appearance (#3119)
* pyi_generator: ignore `app.py` and single files

When running pyi_generator in pre-commit, it passes individual changed files on
the command line as targets, and these were not being properly excluded
according to the EXCLUDED_FILES list.

Add app.py to the EXCLUDED_FILES list so it does not get regenerated
automatically.

* [REF-2587] Ignore top-level theme appearance

From the Radix docs, it is not recommended to actually set `appearance`, but
instead use next-themes to set and switch the appearance dynamically.

Because Reflex already compiles the top-level theme into the next-themes
ThemeProvider, we can blank out the appearance prop after compiling contexts.js
to avoid a mismatch between the selected app appearance and the appearance in
the rx.theme when displaying overlay components.

Fix #2992
2024-04-19 14:43:45 -07:00
Elijah Ahianyo
7b61e7e4bc
Use Fallback command on all platforms (#3099)
* Use Fallback command on all platforms

* precommit fix

* obtain the loglevel cmd for fallback as well

* address PR comment
2024-04-18 20:00:41 -07:00
Martin Xu
c567334c92
allow set in var.contains (#3113)
* allow set in var.contains

* fix UT
2024-04-18 20:00:18 -07:00
benedikt-bartscher
98a4f58134
app_source can be partial (#3100) 2024-04-18 14:00:42 -07:00
Thomas Brandého
36f564d5b0
Experimental layout components (#3066) 2024-04-18 10:54:19 -07:00
Masen Furer
5466d0d9a6
Use errors='replace' with subprocess (#3096) 2024-04-17 12:59:52 -07:00
benedikt-bartscher
9b7e5f4710
improve auto-generated AppHarness app_name with partials (#3088) 2024-04-16 12:32:01 -07:00
Masen Furer
a84bc1e04f
[REF-2586] Pass child event_trigger through DebounceInput (#3092) 2024-04-16 12:31:46 -07:00
benedikt-bartscher
3014db1c1c
do not clear all decorated pages during AppHarness tests (#3093) 2024-04-16 09:17:43 -07:00
Masen Furer
aff0eb664e
bump to 0.4.8 (#3090) 2024-04-15 15:00:14 -07:00
Masen Furer
82279b4f1a
Simplify run_process_with_fallback logic (#3089)
* Simplify `run_process_with_fallback` logic

Include log streaming for initial command and fallback command. This is
necessary because if the command produces significant output that is not
consumed, it can fill the OS pipe and block the process from running.

* Avoid overwriting next.config.js when content has not changed

Windows cannot seem to detect when the file changes but the
content is the same and triggers a much longer hot-reload
cycle to deal with the "updated next.config.js"

* Handle case where `next.config.js` doesn't exist yet
2024-04-15 14:49:53 -07:00
Thomas Brandého
b8525261b5
add pathlib.Path serializer (#3082) 2024-04-13 01:27:10 +02:00