reflex/reflex
Masen Furer 3715462eb4
Allow Component.add_style to return a regular dict (#3264)
* Allow `Component.add_style` to return a regular dict

It's more convenient to allow returning a regular dict without having to import
and wrap the value in `rx.style.Style`.

If the dict contains any Var or encoded VarData f-strings, these will be picked
up when the plain dicts are passed to Style.update().

Because Style.update already merges VarData, there is no reason to explicitly
merge it again in this function; this change keeps the merging logic inside the
Style class.

* Test for Style.update with existing Style with _var_data and kwargs

Should retain the _var_data from the original Style instance

* style: Avoid losing VarData in Style.update

If a Style class with _var_data is passed to `Style.update` along with kwargs,
then the _var_data was lost in the double-splat dictionary expansion.

Instead, only apply the kwargs to an existing or new Style instance to retain
_var_data and properly convert values.

* add_style return annotation is Dict[str, Any]

* nit: use lowercase dict in annotation
2024-05-10 20:25:04 -07:00
..
.templates #3185 fix tailwind.config.js: support corePlugins, important, prefix, separator (#3260) 2024-05-09 15:05:35 -07:00
compiler [REF-2764] dep update 0.5.0 (#3245) 2024-05-07 15:15:52 -07:00
components Allow Component.add_style to return a regular dict (#3264) 2024-05-10 20:25:04 -07:00
constants add_style api (#3202) 2024-05-06 16:59:11 -07:00
custom_components custom component install as editable mode (#3200) 2024-04-30 18:12:16 -07:00
experimental Radix 3.0 tweaks (#3257) 2024-05-08 14:02:37 -07:00
middleware feat: Synchronizing localStorage between tabs using browser events (#2533) 2024-02-20 15:14:55 -08:00
utils [REF-2774] Send runtime error in telemetry (#3276) 2024-05-10 18:15:03 -07:00
__init__.py Radix 3.0 tweaks (#3257) 2024-05-08 14:02:37 -07:00
__init__.pyi Radix 3.0 tweaks (#3257) 2024-05-08 14:02:37 -07:00
__main__.py add __main__ entry point to allow python -m reflex (#1516) 2023-08-03 14:26:50 -07:00
admin.py Allow view overrides for registering models with admin (#1249) 2023-06-27 14:08:09 -07:00
app_module_for_backend.py Clean up config and app API (#3197) 2024-05-02 18:15:28 -07:00
app.py [REF-2774] Send runtime error in telemetry (#3276) 2024-05-10 18:15:03 -07:00
base.py [REF-2774] Add ReflexError and subclasses, send in telemetry (#3271) 2024-05-10 12:12:42 -07:00
config.py [REF-2774] Add ReflexError and subclasses, send in telemetry (#3271) 2024-05-10 12:12:42 -07:00
config.pyi Lendemor/improve coverage (#2988) 2024-04-04 14:31:43 +02:00
event.py [REF-2774] Add ReflexError and subclasses, send in telemetry (#3271) 2024-05-10 12:12:42 -07:00
model.py [REF-2764] dep update 0.5.0 (#3245) 2024-05-07 15:15:52 -07:00
page.py separate DECORATED_PAGES per reflex app (#3102) 2024-04-22 11:32:31 -07:00
reflex.py Clean up config and app API (#3197) 2024-05-02 18:15:28 -07:00
route.py [REF-2643] Throw Errors for duplicate Routes (#3155) 2024-05-03 12:15:40 -07:00
state.py [REF-2774] Send runtime error in telemetry (#3276) 2024-05-10 18:15:03 -07:00
style.py Allow Component.add_style to return a regular dict (#3264) 2024-05-10 20:25:04 -07:00
testing.py prevent issues with #3214 (#3237) 2024-05-06 18:34:16 -07:00
vars.py [REF-2774] Add ReflexError and subclasses, send in telemetry (#3271) 2024-05-10 12:12:42 -07:00
vars.pyi use dict instead of set to store hooks (#2995) 2024-04-03 17:13:42 -07:00