Skip to content

Commit dd50651

Browse files
committed
Merge branch 'main' into release/reflex-0.8.8
2 parents 02a0dd4 + 817b8b4 commit dd50651

File tree

15 files changed

+72
-78
lines changed

15 files changed

+72
-78
lines changed

pyi_hashes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@
3939
"reflex/components/el/elements/tables.pyi": "e3f299e59bb8ff87aa949c6b606551c9",
4040
"reflex/components/el/elements/typography.pyi": "b4ec4ffb448f7a9b5f94712404448d9e",
4141
"reflex/components/gridjs/datatable.pyi": "98a7e1b3f3b60cafcdfcd8879750ee42",
42-
"reflex/components/lucide/icon.pyi": "69e5b61d7a914321fdc03280960d511c",
42+
"reflex/components/lucide/icon.pyi": "9ac28107e4f03fbdee21864b022325d2",
4343
"reflex/components/markdown/markdown.pyi": "2f84254a548e908020949564fc289339",
4444
"reflex/components/moment/moment.pyi": "93fa4c6009390fe9400197ab52735b84",
4545
"reflex/components/plotly/plotly.pyi": "4311a0aae2abcc9226abb6a273f96372",
4646
"reflex/components/radix/__init__.pyi": "5d8e3579912473e563676bfc71f29191",
4747
"reflex/components/radix/primitives/__init__.pyi": "68fcf93acb9a40d94561d375a3a5fdb1",
4848
"reflex/components/radix/primitives/accordion.pyi": "9192299dac04a5172edd7b2f6b125f53",
4949
"reflex/components/radix/primitives/base.pyi": "336f5e26669a809454bb343e698ab563",
50-
"reflex/components/radix/primitives/drawer.pyi": "5c04c3598100aa4d562c242fabf7e404",
50+
"reflex/components/radix/primitives/drawer.pyi": "c6ad2f60217fe25952f3a1ba88fbd72a",
5151
"reflex/components/radix/primitives/form.pyi": "8a5ec180a50acdc35dfe53e4e65c20e0",
5252
"reflex/components/radix/primitives/progress.pyi": "b26c99c1d827c0f599fff344746aeec3",
5353
"reflex/components/radix/primitives/slider.pyi": "c03b716ffbbc3e1a0c766951de04e83b",

reflex/.templates/web/utils/state.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ export const applyRestEvent = async (event, socket, navigate, params) => {
415415
if (event.payload.files === undefined || event.payload.files.length === 0) {
416416
// Submit the event over the websocket to trigger the event handler.
417417
return await applyEvent(
418-
Event(event.name, { files: [] }),
418+
ReflexEvent(event.name, { files: [] }),
419419
socket,
420420
navigate,
421421
params,
@@ -775,7 +775,7 @@ export const uploadFiles = async (
775775
* @param {string} handler The client handler to process event.
776776
* @returns The event object.
777777
*/
778-
export const Event = (
778+
export const ReflexEvent = (
779779
name,
780780
payload = {},
781781
event_actions = {},
@@ -987,7 +987,7 @@ export const useEventLoop = (
987987

988988
window.onerror = function (msg, url, lineNo, columnNo, error) {
989989
addEvents([
990-
Event(`${exception_state_name}.handle_frontend_exception`, {
990+
ReflexEvent(`${exception_state_name}.handle_frontend_exception`, {
991991
info: error.name + ": " + error.message + "\n" + error.stack,
992992
component_stack: "",
993993
}),
@@ -999,7 +999,7 @@ export const useEventLoop = (
999999
//https://github.com/mknichel/javascript-errors?tab=readme-ov-file#promise-rejection-events
10001000
window.onunhandledrejection = function (event) {
10011001
addEvents([
1002-
Event(`${exception_state_name}.handle_frontend_exception`, {
1002+
ReflexEvent(`${exception_state_name}.handle_frontend_exception`, {
10031003
info:
10041004
event.reason?.name +
10051005
": " +
@@ -1072,7 +1072,7 @@ export const useEventLoop = (
10721072
if (storage_to_state_map[e.key]) {
10731073
const vars = {};
10741074
vars[storage_to_state_map[e.key]] = e.newValue;
1075-
const event = Event(
1075+
const event = ReflexEvent(
10761076
`${state_name}.reflex___state____update_vars_internal_state.update_vars_internal`,
10771077
{ vars: vars },
10781078
);

reflex/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,9 +1311,9 @@ def memoized_toast_provider():
13111311
self.head_components,
13121312
html_lang=self.html_lang,
13131313
html_custom_attrs=(
1314-
{"suppressHydrationWarning": "true", **self.html_custom_attrs}
1314+
{"suppressHydrationWarning": True, **self.html_custom_attrs}
13151315
if self.html_custom_attrs
1316-
else {"suppressHydrationWarning": "true"}
1316+
else {"suppressHydrationWarning": True}
13171317
),
13181318
)
13191319
)

reflex/compiler/compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from collections.abc import Callable, Iterable, Sequence
77
from inspect import getmodule
88
from pathlib import Path
9-
from typing import TYPE_CHECKING
9+
from typing import TYPE_CHECKING, Any
1010

1111
from reflex import constants
1212
from reflex.compiler import templates, utils
@@ -465,7 +465,7 @@ def get_shared_components_recursive(component: BaseComponent):
465465
def compile_document_root(
466466
head_components: list[Component],
467467
html_lang: str | None = None,
468-
html_custom_attrs: dict[str, Var | str] | None = None,
468+
html_custom_attrs: dict[str, Var | Any] | None = None,
469469
) -> tuple[str, str]:
470470
"""Compile the document root.
471471

reflex/compiler/templates.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def context_template(
303303
// But only send the vars if any are actually set in the browser.
304304
if (client_storage_vars && Object.keys(client_storage_vars).length !== 0) {{
305305
internal_events.push(
306-
Event(
306+
ReflexEvent(
307307
'{state_name}.{constants.CompileVars.UPDATE_VARS_INTERNAL}',
308308
{{vars: client_storage_vars}},
309309
),
@@ -312,14 +312,14 @@ def context_template(
312312
313313
// `on_load_internal` triggers the correct on_load event(s) for the current page.
314314
// If the page does not define any on_load event, this will just set `is_hydrated = true`.
315-
internal_events.push(Event('{state_name}.{constants.CompileVars.ON_LOAD_INTERNAL}'));
315+
internal_events.push(ReflexEvent('{state_name}.{constants.CompileVars.ON_LOAD_INTERNAL}'));
316316
317317
return internal_events;
318318
}}
319319
320320
// The following events are sent when the websocket connects or reconnects.
321321
export const initialEvents = () => [
322-
Event('{state_name}.{constants.CompileVars.HYDRATE}'),
322+
ReflexEvent('{state_name}.{constants.CompileVars.HYDRATE}'),
323323
...onLoadInternalEvent()
324324
]
325325
"""
@@ -351,7 +351,7 @@ def context_template(
351351
)
352352

353353
return rf"""import {{ createContext, useContext, useMemo, useReducer, useState, createElement, useEffect }} from "react"
354-
import {{ applyDelta, Event, hydrateClientStorage, useEventLoop, refs }} from "$/utils/state"
354+
import {{ applyDelta, ReflexEvent, hydrateClientStorage, useEventLoop, refs }} from "$/utils/state"
355355
import {{ jsx }} from "@emotion/react";
356356
357357
export const initialState = {"{}" if not initial_state else json_dumps(initial_state)}

reflex/compiler/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def compile_custom_component(
350350
def create_document_root(
351351
head_components: Sequence[Component] | None = None,
352352
html_lang: str | None = None,
353-
html_custom_attrs: dict[str, Var | str] | None = None,
353+
html_custom_attrs: dict[str, Var | Any] | None = None,
354354
) -> Component:
355355
"""Create the document root.
356356

reflex/components/component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2599,7 +2599,7 @@ def _get_memoized_event_triggers(
25992599
memo_name = f"{event_trigger}_{chain_hash}"
26002600

26012601
# Calculate Var dependencies accessed by the handler for useCallback dep array.
2602-
var_deps = ["addEvents", "Event"]
2602+
var_deps = ["addEvents", "ReflexEvent"]
26032603

26042604
# Get deps from event trigger var data.
26052605
var_deps.extend(cls._get_deps_from_event_trigger(event))

reflex/components/lucide/icon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from reflex.vars.base import LiteralVar, Var
77
from reflex.vars.sequence import LiteralStringVar, StringVar
88

9-
LUCIDE_LIBRARY = "lucide-react@0.540.0"
9+
LUCIDE_LIBRARY = "lucide-react@0.541.0"
1010

1111

1212
class LucideIconComponent(Component):

reflex/components/radix/primitives/drawer.py

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ class DrawerContent(DrawerComponent):
124124
alias = "Vaul" + tag
125125

126126
# Style set partially based on the source code at https://ui.shadcn.com/docs/components/drawer
127-
def _get_style(self) -> dict:
127+
def add_style(self) -> dict:
128128
"""Get the style for the component.
129129
130130
Returns:
131131
The dictionary of the component style as value and the style notation as key.
132132
"""
133-
base_style = {
133+
return {
134134
"left": "0",
135135
"right": "0",
136136
"bottom": "0",
@@ -139,9 +139,6 @@ def _get_style(self) -> dict:
139139
"z_index": 50,
140140
"display": "flex",
141141
}
142-
style = self.style or {}
143-
base_style.update(style)
144-
return {"css": base_style}
145142

146143
# Fired when the drawer content is opened.
147144
on_open_auto_focus: EventHandler[no_args_event_spec]
@@ -186,13 +183,13 @@ class DrawerOverlay(DrawerComponent):
186183
alias = "Vaul" + tag
187184

188185
# Style set based on the source code at https://ui.shadcn.com/docs/components/drawer
189-
def _get_style(self) -> dict:
186+
def add_style(self) -> dict:
190187
"""Get the style for the component.
191188
192189
Returns:
193190
The dictionary of the component style as value and the style notation as key.
194191
"""
195-
base_style = {
192+
return {
196193
"position": "fixed",
197194
"left": "0",
198195
"right": "0",
@@ -201,9 +198,6 @@ def _get_style(self) -> dict:
201198
"z_index": 50,
202199
"background": "rgba(0, 0, 0, 0.5)",
203200
}
204-
style = self.style or {}
205-
base_style.update(style)
206-
return {"css": base_style}
207201

208202

209203
class DrawerClose(DrawerTrigger):
@@ -222,21 +216,18 @@ class DrawerTitle(DrawerComponent):
222216
alias = "Vaul" + tag
223217

224218
# Style set based on the source code at https://ui.shadcn.com/docs/components/drawer
225-
def _get_style(self) -> dict:
219+
def add_style(self) -> dict:
226220
"""Get the style for the component.
227221
228222
Returns:
229223
The dictionary of the component style as value and the style notation as key.
230224
"""
231-
base_style = {
225+
return {
232226
"font-size": "1.125rem",
233227
"font-weight": "600",
234-
"line-weight": "1",
228+
"line-height": "1",
235229
"letter-spacing": "-0.05em",
236230
}
237-
style = self.style or {}
238-
base_style.update(style)
239-
return {"css": base_style}
240231

241232

242233
class DrawerDescription(DrawerComponent):
@@ -247,18 +238,15 @@ class DrawerDescription(DrawerComponent):
247238
alias = "Vaul" + tag
248239

249240
# Style set based on the source code at https://ui.shadcn.com/docs/components/drawer
250-
def _get_style(self) -> dict:
241+
def add_style(self) -> dict:
251242
"""Get the style for the component.
252243
253244
Returns:
254245
The dictionary of the component style as value and the style notation as key.
255246
"""
256-
base_style = {
247+
return {
257248
"font-size": "0.875rem",
258249
}
259-
style = self.style or {}
260-
base_style.update(style)
261-
return {"css": base_style}
262250

263251

264252
class DrawerHandle(DrawerComponent):

reflex/constants/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class CompileVars(SimpleNamespace):
6464
# The name of the var storing any connection error.
6565
CONNECT_ERROR = "connectErrors"
6666
# The name of the function for converting a dict to an event.
67-
TO_EVENT = "Event"
67+
TO_EVENT = "ReflexEvent"
6868
# The name of the internal on_load event.
6969
ON_LOAD_INTERNAL = "reflex___state____on_load_internal_state.on_load_internal"
7070
# The name of the internal event to update generic state vars.

0 commit comments

Comments
 (0)