Commit Graph

44 Commits

Author SHA1 Message Date
Khaleel Al-Adhami
458cbfac59
[REF-3228] implement LiteralStringVar and format/retrieval mechanism (#3669)
* implement LiteralStringVar and format/retrieval mechanism

* use create safe

* add cached properties to ConcatVarOperation

* fix caches

* also include self

* fix inconsistencies in typings

* use default factory not default

* add missing docstring

* experiment with immutable var data

* solve pydantic issues

* add sorted function

* missing docs

* forgot ellipses

* give up on frozen

* dang it darglint

* fix string serialization bugs and remove unused code

* add returns statement

* whitespace moment

* add simple test for string concat

* export ConcatVarOperation
2024-07-17 17:01:27 -07:00
Khaleel Al-Adhami
d4d077818c
[REF-3225] implement __format__ for immutable vars (#3617)
* implement format for immutable vars

* add some basic test

* make reference only after formatting

* win over pyright

* hopefully now pyright doesn't hate me

* forgot some _var_data

* i don't know how imports work

* use f_string var and remove assignments from pyi file

* override post_init to not break immutability

* add create_safe and test for it
2024-07-11 11:19:38 -07:00
benedikt-bartscher
3039b54a75
add module prefix to generated state names (#3214)
* add module prefix to state names

* fix state names in test_app

* update state names in test_state

* fix state names in test_var

* fix state name in test_component

* fix state names in test_format

* fix state names in test_foreach

* fix state names in test_cond

* fix state names in test_datatable

* fix state names in test_colors

* fix state names in test_script

* fix state names in test_match

* fix state name in event1 fixture

* fix pyright and darglint

* fix state names in state_tree

* fix state names in redis only test

* fix state names in test_client_storage

* fix state name in js template

* add `get_state_name` and `get_full_state_name` helpers for `AppHarness`

* fix state names in test_dynamic_routes

* use new state name helpers in test_client_storage

* fix state names in test_event_actions

* fix state names in test_event_chain

* fix state names in test_upload

* fix state name in test_login_flow

* fix state names in test_input

* fix state names in test_form_submit

* ruff

* validate state module names

* wtf is going on here?

* remove comments leftover from refactoring

* adjust new test_add_style_embedded_vars

* fix state name in state.js

* fix integration/test_client_state.py

new SessionStorage feature was added with more full state names that need to be formatted in

* fix pre-commit issues in test_client_storage.py

* adjust test_computed_vars

* adjust safe-guards

* fix redis tests with new exception state

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-07-11 11:13:57 -07:00
Jishnu N
690b719437
[REF-3160] fix rx.Var._replace raise TypeError on invalid kwargs (#3625)
* fix: unexpected kwargs raise type error, on _replace

* add: docstring for _replace, test for invalid kwargs replace

* add: parametrize var for replace test

* fix: computed_var _replace with invalid kwargs
2024-07-09 11:19:29 -07:00
benedikt-bartscher
44d27f9e4c
do not validate non-cached var deps (#3576)
* do not validate non-cached var deps

* further improve Exceptions for misconfigured var deps
2024-06-27 17:00:55 -07:00
benedikt-bartscher
41efe12e9a
Validate ComputedVar dependencies, add tests (#3527) 2024-06-24 16:11:42 -07:00
abulvenz
7c2056e960
feat: Optionally comparing fields in Var.contains, e.g. on rx.Base based types. (#3375)
* feat: Optionally comparing fields, e.g. on rx.Base based types.

* feat: Minimally invasive change.
Leave the current implementation as is. Added test.

* fix: Supporting old-school python versions.

* fix: Adding masenf's suggestions to use var instead of string.
2024-05-24 17:16:26 -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
Masen Furer
1a11941577
[REF-2392] Expose next.config.js transpilePackages key (#3006) 2024-04-11 13:50:42 -07:00
Thomas Brandého
34ee07ecd1
use dict instead of set to store hooks (#2995) 2024-04-03 17:13:42 -07:00
benedikt-bartscher
93f402c773
Initial values for computed vars (#2670)
* initial values for computed vars draft

* add tests, add computed_var overloads

* fix darglint

* pass initial to substates when calling dict

* add tests for for child states

* format black

* allow None as initial value

* rename runtime_only to raises_at_runtime

* cleanup unused arguments of ComputedVars

* refactor cached_var to be partial of computed_var
2024-02-24 13:45:07 -08:00
wassaf shahzad
0b771db10a
fixed bug in var type for iterable types (#2617)
* fixed bug in var type for iterable types

* added test cases

* formatting issue

* fixed black formatting  issues
2024-02-20 15:02:20 -08:00
invrainbow
e729a315f8
Fix fstrings being escaped improperly (#2571) 2024-02-13 14:32:44 -08:00
invrainbow
61234ae164
Fix operator precedence (#2573) 2024-02-12 19:30:25 -08:00
Elijah Ahianyo
d2fd0d3b92
[REF-1742] Radio group prop types fix (#2452) 2024-01-30 18:14:20 -08:00
Nikhil Rao
01c2a1ed7d
Set correct type when indexing into Var[str] (#2469)
* Index into strings

* Write tests
2024-01-28 21:57:02 -08:00
Alek Petuskey
d466c2aaa2
Radix Accordion (#2310) 2024-01-18 14:20:21 -08:00
Elijah Ahianyo
abfc099779
rx.match component (#2318)
* initial commit

* add more tests

* refactor match jinja template

* add docstrings

* cleanup

* possible fix for pyright

* fix conflicts

* fix conflicts again

* comments

* fixed bug from review

* fix tests

* address PR comment

* fix tests

* type error improvement

* formatting

* darglint fix

* more tests

* stringify switch condition and cases as js doesnt support complex types(lists and dicts) in switch cases.

* Update reflex/vars.py

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

* change usages

* Precommit fix

---------

Co-authored-by: Alek Petuskey <alek@pynecone.io>
Co-authored-by: Masen Furer <m_github@0x26.net>
Co-authored-by: Alek Petuskey <alekpetuskey@aleks-mbp.lan>
2024-01-04 09:48:18 -08:00
Masen Furer
414a879879
Handle VarData roundtrip when encoded value contains newline (#2350) 2024-01-03 09:46:22 -08:00
Elijah Ahianyo
e3ee98098a
RED-1052/rx.State as Base State (#2146) 2023-11-29 09:43:33 -08:00
Thomas Brandého
8fc254041b
fix name for import var when is default and add tests (#2214) 2023-11-26 12:46:43 -08:00
Masen Furer
1603144c7d
[REF-889] useContext per substate (#2149) 2023-11-21 11:52:06 -08:00
Elijah Ahianyo
06bdf9ed8a
Remove 0.3.0 deprecated features (#1947) 2023-10-19 09:44:32 -07:00
Masen Furer
024cb5fa9b
Var field cleanup (#1943) 2023-10-13 14:53:55 -07:00
Masen Furer
1430075bdc
Reassign state Var when fields on a Base instance change (#1748) 2023-09-18 13:52:10 -07:00
Nikhil Rao
1938a6cc58
Add serializers for different var types (#1816) 2023-09-15 17:19:26 -07:00
Elijah Ahianyo
f2b0915aff
Type Validation for Var Operations and Enhanced Compatibility (#1674) 2023-09-12 15:57:40 -07:00
Martin Xu
2e1aea9713
Add contains, reverse operations for Var (#1679) 2023-08-28 14:59:50 -07:00
Nikhil Rao
6d15326abf
Support f-strings in component children and non-style props (#1575) 2023-08-14 11:33:16 -07:00
Smit Parmar
ef78465f16
Added support for RelexSet wrapper (#1535) 2023-08-10 09:59:03 -07:00
Elijah Ahianyo
40953d05ac
Strict type checking for indexing with vars (#1333) 2023-07-13 15:46:15 -07:00
Elijah Ahianyo
7f0fc86816
Computed vars tuple and str indexing support (#1322) 2023-07-12 15:26:34 -07:00
Nikhil Rao
139ce38df1
Rename pynecone to reflex (#1236) 2023-06-25 16:56:55 -07:00
Elijah Ahianyo
3f56620870
Get Local Storage (#1234) 2023-06-23 12:56:05 -07:00
iron3oxide
32f3a387ae
Rename var module to vars (#983) 2023-05-09 23:01:25 -07:00
Elijah Ahianyo
9ea1a64d22
Throw error for unannotated computed vars (#941) 2023-05-06 12:26:49 -07:00
Elijah Ahianyo
18c715670a
Revamp Imports (#926) 2023-05-04 22:11:01 -07:00
jonatan
e811a84ed4
Use strict equality in generated JS (#750) 2023-04-02 15:40:52 -07:00
Xiaojing Chen
3bf7d1f722
Throw better error for invalid child component (#655) 2023-03-10 13:02:17 -08:00
Elijah Ahianyo
8de2163d84
Create PCDict (#503) 2023-02-12 12:52:45 -08:00
Elijah Ahianyo
69a9c95d73
Make PCList pickleable (#500) 2023-02-10 12:25:58 -08:00
Atharva Shah
2ccbfff223
General code cleanup (#312) 2023-01-22 10:58:07 -08:00
Nikhil Rao
8be411b81b
Implement var slicing (#289) 2023-01-18 17:53:04 -08:00
Nikhil Rao
29e37350e5
Add basic unit tests (#7)
* Unit tests for components, state, and utils
2022-11-20 14:34:25 -08:00