reflex 0.4.1__py3-none-any.whl → 0.4.2a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of reflex might be problematic. Click here for more details.
- reflex/.templates/jinja/web/pages/_app.js.jinja2 +2 -2
- reflex/.templates/jinja/web/utils/context.js.jinja2 +9 -2
- reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +5 -3
- reflex/.templates/web/utils/state.js +35 -8
- reflex/app.py +5 -4
- reflex/base.py +4 -0
- reflex/compiler/compiler.py +14 -4
- reflex/compiler/templates.py +1 -0
- reflex/components/base/bare.pyi +84 -0
- reflex/components/component.py +23 -4
- reflex/components/core/cond.py +2 -2
- reflex/components/core/debounce.py +1 -1
- reflex/components/core/upload.py +2 -2
- reflex/components/core/upload.pyi +2 -2
- reflex/components/radix/primitives/accordion.py +5 -2
- reflex/components/radix/primitives/accordion.pyi +1 -1
- reflex/components/radix/primitives/progress.py +40 -8
- reflex/components/radix/primitives/progress.pyi +71 -2
- reflex/components/radix/themes/base.py +9 -2
- reflex/components/radix/themes/base.pyi +3 -1
- reflex/components/radix/themes/color_mode.py +1 -1
- reflex/components/radix/themes/layout/stack.py +6 -5
- reflex/components/radix/themes/layout/stack.pyi +6 -5
- reflex/constants/base.pyi +94 -0
- reflex/constants/compiler.py +2 -0
- reflex/constants/event.pyi +59 -0
- reflex/constants/installer.py +2 -2
- reflex/constants/route.pyi +50 -0
- reflex/constants/style.pyi +20 -0
- reflex/event.py +10 -0
- reflex/middleware/hydrate_middleware.py +0 -8
- reflex/state.py +194 -13
- reflex/testing.py +1 -0
- reflex/utils/prerequisites.py +31 -4
- reflex/utils/processes.py +12 -1
- reflex/utils/serializers.py +18 -2
- reflex/utils/types.py +6 -1
- reflex/vars.py +20 -1
- reflex/vars.pyi +2 -0
- {reflex-0.4.1.dist-info → reflex-0.4.2a1.dist-info}/METADATA +2 -1
- {reflex-0.4.1.dist-info → reflex-0.4.2a1.dist-info}/RECORD +44 -39
- {reflex-0.4.1.dist-info → reflex-0.4.2a1.dist-info}/WHEEL +1 -1
- {reflex-0.4.1.dist-info → reflex-0.4.2a1.dist-info}/LICENSE +0 -0
- {reflex-0.4.1.dist-info → reflex-0.4.2a1.dist-info}/entry_points.txt +0 -0
|
@@ -7,10 +7,12 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
|
-
from typing import Optional
|
|
10
|
+
from typing import Optional, Union
|
|
11
11
|
from reflex.components.component import Component, ComponentNamespace
|
|
12
|
+
from reflex.components.core.colors import color
|
|
12
13
|
from reflex.components.radix.primitives.accordion import DEFAULT_ANIMATION_DURATION
|
|
13
14
|
from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
|
|
15
|
+
from reflex.components.radix.themes.base import LiteralAccentColor
|
|
14
16
|
from reflex.style import Style
|
|
15
17
|
from reflex.vars import Var
|
|
16
18
|
|
|
@@ -188,6 +190,68 @@ class ProgressIndicator(ProgressComponent):
|
|
|
188
190
|
*children,
|
|
189
191
|
value: Optional[Union[Var[Optional[int]], Optional[int]]] = None,
|
|
190
192
|
max: Optional[Union[Var[Optional[int]], Optional[int]]] = None,
|
|
193
|
+
color_scheme: Optional[
|
|
194
|
+
Union[
|
|
195
|
+
Var[
|
|
196
|
+
Literal[
|
|
197
|
+
"tomato",
|
|
198
|
+
"red",
|
|
199
|
+
"ruby",
|
|
200
|
+
"crimson",
|
|
201
|
+
"pink",
|
|
202
|
+
"plum",
|
|
203
|
+
"purple",
|
|
204
|
+
"violet",
|
|
205
|
+
"iris",
|
|
206
|
+
"indigo",
|
|
207
|
+
"blue",
|
|
208
|
+
"cyan",
|
|
209
|
+
"teal",
|
|
210
|
+
"jade",
|
|
211
|
+
"green",
|
|
212
|
+
"grass",
|
|
213
|
+
"brown",
|
|
214
|
+
"orange",
|
|
215
|
+
"sky",
|
|
216
|
+
"mint",
|
|
217
|
+
"lime",
|
|
218
|
+
"yellow",
|
|
219
|
+
"amber",
|
|
220
|
+
"gold",
|
|
221
|
+
"bronze",
|
|
222
|
+
"gray",
|
|
223
|
+
]
|
|
224
|
+
],
|
|
225
|
+
Literal[
|
|
226
|
+
"tomato",
|
|
227
|
+
"red",
|
|
228
|
+
"ruby",
|
|
229
|
+
"crimson",
|
|
230
|
+
"pink",
|
|
231
|
+
"plum",
|
|
232
|
+
"purple",
|
|
233
|
+
"violet",
|
|
234
|
+
"iris",
|
|
235
|
+
"indigo",
|
|
236
|
+
"blue",
|
|
237
|
+
"cyan",
|
|
238
|
+
"teal",
|
|
239
|
+
"jade",
|
|
240
|
+
"green",
|
|
241
|
+
"grass",
|
|
242
|
+
"brown",
|
|
243
|
+
"orange",
|
|
244
|
+
"sky",
|
|
245
|
+
"mint",
|
|
246
|
+
"lime",
|
|
247
|
+
"yellow",
|
|
248
|
+
"amber",
|
|
249
|
+
"gold",
|
|
250
|
+
"bronze",
|
|
251
|
+
"gray",
|
|
252
|
+
],
|
|
253
|
+
]
|
|
254
|
+
] = None,
|
|
191
255
|
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
192
256
|
style: Optional[Style] = None,
|
|
193
257
|
key: Optional[Any] = None,
|
|
@@ -248,6 +312,7 @@ class ProgressIndicator(ProgressComponent):
|
|
|
248
312
|
*children: The children of the component.
|
|
249
313
|
value: The current progress value.
|
|
250
314
|
max: The maximum progress value.
|
|
315
|
+
color_scheme: The color scheme of the progress indicator.
|
|
251
316
|
as_child: Change the default rendered element for the one passed as a child.
|
|
252
317
|
style: The style of the component.
|
|
253
318
|
key: A unique key for the component.
|
|
@@ -270,6 +335,10 @@ class Progress(ComponentNamespace):
|
|
|
270
335
|
indicator = staticmethod(ProgressIndicator.create)
|
|
271
336
|
|
|
272
337
|
@staticmethod
|
|
273
|
-
def __call__(
|
|
338
|
+
def __call__(
|
|
339
|
+
width: Optional[str] = "100%",
|
|
340
|
+
color_scheme: Optional[Union[Var, LiteralAccentColor]] = None,
|
|
341
|
+
**props
|
|
342
|
+
) -> Component: ...
|
|
274
343
|
|
|
275
344
|
progress = Progress()
|
|
@@ -149,13 +149,18 @@ class Theme(RadixThemesComponent):
|
|
|
149
149
|
|
|
150
150
|
@classmethod
|
|
151
151
|
def create(
|
|
152
|
-
cls,
|
|
152
|
+
cls,
|
|
153
|
+
*children,
|
|
154
|
+
color_mode: LiteralAppearance | None = None,
|
|
155
|
+
theme_panel: bool = False,
|
|
156
|
+
**props,
|
|
153
157
|
) -> Component:
|
|
154
158
|
"""Create a new Radix Theme specification.
|
|
155
159
|
|
|
156
160
|
Args:
|
|
157
161
|
*children: Child components.
|
|
158
|
-
color_mode:
|
|
162
|
+
color_mode: Map to appearance prop.
|
|
163
|
+
theme_panel: Whether to include a panel for editing the theme.
|
|
159
164
|
**props: Component properties.
|
|
160
165
|
|
|
161
166
|
Returns:
|
|
@@ -163,6 +168,8 @@ class Theme(RadixThemesComponent):
|
|
|
163
168
|
"""
|
|
164
169
|
if color_mode is not None:
|
|
165
170
|
props["appearance"] = color_mode
|
|
171
|
+
if theme_panel:
|
|
172
|
+
children = [ThemePanel.create(), *children]
|
|
166
173
|
return super().create(*children, **props)
|
|
167
174
|
|
|
168
175
|
def _get_imports(self) -> imports.ImportDict:
|
|
@@ -265,6 +265,7 @@ class Theme(RadixThemesComponent):
|
|
|
265
265
|
cls,
|
|
266
266
|
*children,
|
|
267
267
|
color_mode: Optional[LiteralAppearance | None] = None,
|
|
268
|
+
theme_panel: Optional[bool] = False,
|
|
268
269
|
has_background: Optional[Union[Var[bool], bool]] = None,
|
|
269
270
|
appearance: Optional[
|
|
270
271
|
Union[
|
|
@@ -412,7 +413,8 @@ class Theme(RadixThemesComponent):
|
|
|
412
413
|
|
|
413
414
|
Args:
|
|
414
415
|
*children: Child components.
|
|
415
|
-
color_mode:
|
|
416
|
+
color_mode: Map to appearance prop.
|
|
417
|
+
theme_panel: Whether to include a panel for editing the theme.
|
|
416
418
|
has_background: Whether to apply the themes background color to the theme node. Defaults to True.
|
|
417
419
|
appearance: Override light or dark mode theme: "inherit" | "light" | "dark". Defaults to "inherit".
|
|
418
420
|
accent_color: The color used for default buttons, typography, backgrounds, etc
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from reflex.components.component import Component
|
|
6
|
+
from reflex.vars import Var
|
|
6
7
|
|
|
7
8
|
from ..base import LiteralAlign, LiteralSpacing
|
|
8
|
-
from .flex import Flex
|
|
9
|
+
from .flex import Flex, LiteralFlexDirection
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class Stack(Flex):
|
|
@@ -41,12 +42,12 @@ class Stack(Flex):
|
|
|
41
42
|
class VStack(Stack):
|
|
42
43
|
"""A vertical stack component."""
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
# The direction of the stack.
|
|
46
|
+
direction: Var[LiteralFlexDirection] = "column" # type: ignore
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
class HStack(Stack):
|
|
49
50
|
"""A horizontal stack component."""
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
# The direction of the stack.
|
|
53
|
+
direction: Var[LiteralFlexDirection] = "row" # type: ignore
|
|
@@ -8,8 +8,9 @@ from reflex.vars import Var, BaseVar, ComputedVar
|
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
10
|
from reflex.components.component import Component
|
|
11
|
+
from reflex.vars import Var
|
|
11
12
|
from ..base import LiteralAlign, LiteralSpacing
|
|
12
|
-
from .flex import Flex
|
|
13
|
+
from .flex import Flex, LiteralFlexDirection
|
|
13
14
|
|
|
14
15
|
class Stack(Flex):
|
|
15
16
|
@overload
|
|
@@ -178,13 +179,13 @@ class VStack(Stack):
|
|
|
178
179
|
*children,
|
|
179
180
|
spacing: Optional[LiteralSpacing] = "2",
|
|
180
181
|
align: Optional[LiteralAlign] = "start",
|
|
181
|
-
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
182
182
|
direction: Optional[
|
|
183
183
|
Union[
|
|
184
184
|
Var[Literal["row", "column", "row-reverse", "column-reverse"]],
|
|
185
185
|
Literal["row", "column", "row-reverse", "column-reverse"],
|
|
186
186
|
]
|
|
187
187
|
] = None,
|
|
188
|
+
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
188
189
|
justify: Optional[
|
|
189
190
|
Union[
|
|
190
191
|
Var[Literal["start", "center", "end", "between"]],
|
|
@@ -296,8 +297,8 @@ class VStack(Stack):
|
|
|
296
297
|
*children: The children of the stack.
|
|
297
298
|
spacing: The spacing between each stack item.
|
|
298
299
|
align: The alignment of the stack items.
|
|
299
|
-
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
300
300
|
direction: How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse"
|
|
301
|
+
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
301
302
|
justify: Alignment of children along the cross axis: "start" | "center" | "end" | "between"
|
|
302
303
|
wrap: Whether children should wrap when they reach the end of their container: "nowrap" | "wrap" | "wrap-reverse"
|
|
303
304
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
|
@@ -337,13 +338,13 @@ class HStack(Stack):
|
|
|
337
338
|
*children,
|
|
338
339
|
spacing: Optional[LiteralSpacing] = "2",
|
|
339
340
|
align: Optional[LiteralAlign] = "start",
|
|
340
|
-
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
341
341
|
direction: Optional[
|
|
342
342
|
Union[
|
|
343
343
|
Var[Literal["row", "column", "row-reverse", "column-reverse"]],
|
|
344
344
|
Literal["row", "column", "row-reverse", "column-reverse"],
|
|
345
345
|
]
|
|
346
346
|
] = None,
|
|
347
|
+
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
347
348
|
justify: Optional[
|
|
348
349
|
Union[
|
|
349
350
|
Var[Literal["start", "center", "end", "between"]],
|
|
@@ -455,8 +456,8 @@ class HStack(Stack):
|
|
|
455
456
|
*children: The children of the stack.
|
|
456
457
|
spacing: The spacing between each stack item.
|
|
457
458
|
align: The alignment of the stack items.
|
|
458
|
-
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
459
459
|
direction: How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse"
|
|
460
|
+
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
460
461
|
justify: Alignment of children along the cross axis: "start" | "center" | "end" | "between"
|
|
461
462
|
wrap: Whether children should wrap when they reach the end of their container: "nowrap" | "wrap" | "wrap-reverse"
|
|
462
463
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""Stub file for reflex/constants/base.py"""
|
|
2
|
+
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
+
# This file was generated by `scripts/pyi_generator.py`!
|
|
4
|
+
# ------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
7
|
+
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
|
+
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
|
+
from reflex.style import Style
|
|
10
|
+
import os
|
|
11
|
+
import platform
|
|
12
|
+
from enum import Enum
|
|
13
|
+
from importlib import metadata
|
|
14
|
+
from types import SimpleNamespace
|
|
15
|
+
from platformdirs import PlatformDirs
|
|
16
|
+
|
|
17
|
+
IS_WINDOWS = platform.system() == "Windows"
|
|
18
|
+
|
|
19
|
+
class Dirs(SimpleNamespace):
|
|
20
|
+
WEB = ".web"
|
|
21
|
+
APP_ASSETS = "assets"
|
|
22
|
+
UTILS = "utils"
|
|
23
|
+
STATIC = "_static"
|
|
24
|
+
STATE_PATH = "/".join([UTILS, "state"])
|
|
25
|
+
COMPONENTS_PATH = "/".join([UTILS, "components"])
|
|
26
|
+
CONTEXTS_PATH = "/".join([UTILS, "context"])
|
|
27
|
+
WEB_PAGES = os.path.join(WEB, "pages")
|
|
28
|
+
WEB_STATIC = os.path.join(WEB, STATIC)
|
|
29
|
+
WEB_UTILS = os.path.join(WEB, UTILS)
|
|
30
|
+
WEB_ASSETS = os.path.join(WEB, "public")
|
|
31
|
+
ENV_JSON = os.path.join(WEB, "env.json")
|
|
32
|
+
REFLEX_JSON = os.path.join(WEB, "reflex.json")
|
|
33
|
+
POSTCSS_JS = os.path.join(WEB, "postcss.config.js")
|
|
34
|
+
|
|
35
|
+
class Reflex(SimpleNamespace):
|
|
36
|
+
MODULE_NAME = "reflex"
|
|
37
|
+
VERSION = metadata.version(MODULE_NAME)
|
|
38
|
+
JSON = os.path.join(Dirs.WEB, "reflex.json")
|
|
39
|
+
_dir = os.environ.get("REFLEX_DIR", "")
|
|
40
|
+
DIR = _dir or PlatformDirs(MODULE_NAME, False).user_data_dir
|
|
41
|
+
ROOT_DIR = os.path.dirname(
|
|
42
|
+
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
class ReflexHostingCLI(SimpleNamespace):
|
|
46
|
+
MODULE_NAME = "reflex-hosting-cli"
|
|
47
|
+
|
|
48
|
+
class Templates(SimpleNamespace):
|
|
49
|
+
template_dir = os.path.join(Reflex.ROOT_DIR, Reflex.MODULE_NAME, ".templates/apps")
|
|
50
|
+
template_dirs = next(os.walk(template_dir))[1]
|
|
51
|
+
Kind = Enum("Kind", {template.upper(): template for template in template_dirs})
|
|
52
|
+
|
|
53
|
+
class Dirs(SimpleNamespace):
|
|
54
|
+
BASE = os.path.join(Reflex.ROOT_DIR, Reflex.MODULE_NAME, ".templates")
|
|
55
|
+
WEB_TEMPLATE = os.path.join(BASE, "web")
|
|
56
|
+
JINJA_TEMPLATE = os.path.join(BASE, "jinja")
|
|
57
|
+
CODE = "code"
|
|
58
|
+
|
|
59
|
+
class Next(SimpleNamespace):
|
|
60
|
+
CONFIG_FILE = "next.config.js"
|
|
61
|
+
SITEMAP_CONFIG_FILE = os.path.join(Dirs.WEB, "next-sitemap.config.js")
|
|
62
|
+
NODE_MODULES = "node_modules"
|
|
63
|
+
PACKAGE_LOCK = "package-lock.json"
|
|
64
|
+
FRONTEND_LISTENING_REGEX = "Local:[\\s]+(.*)"
|
|
65
|
+
|
|
66
|
+
class ColorMode(SimpleNamespace):
|
|
67
|
+
NAME = "colorMode"
|
|
68
|
+
USE = "useColorMode"
|
|
69
|
+
TOGGLE = "toggleColorMode"
|
|
70
|
+
|
|
71
|
+
class Env(str, Enum):
|
|
72
|
+
DEV = "dev"
|
|
73
|
+
PROD = "prod"
|
|
74
|
+
|
|
75
|
+
class LogLevel(str, Enum):
|
|
76
|
+
DEBUG = "debug"
|
|
77
|
+
INFO = "info"
|
|
78
|
+
WARNING = "warning"
|
|
79
|
+
ERROR = "error"
|
|
80
|
+
CRITICAL = "critical"
|
|
81
|
+
|
|
82
|
+
POLLING_MAX_HTTP_BUFFER_SIZE = 1000 * 1000
|
|
83
|
+
|
|
84
|
+
class Ping(SimpleNamespace):
|
|
85
|
+
INTERVAL = 25
|
|
86
|
+
TIMEOUT = 120
|
|
87
|
+
|
|
88
|
+
COOKIES = "cookies"
|
|
89
|
+
LOCAL_STORAGE = "local_storage"
|
|
90
|
+
SKIP_COMPILE_ENV_VAR = "__REFLEX_SKIP_COMPILE"
|
|
91
|
+
PYTEST_CURRENT_TEST = "PYTEST_CURRENT_TEST"
|
|
92
|
+
RELOAD_CONFIG = "__REFLEX_RELOAD_CONFIG"
|
|
93
|
+
REFLEX_VAR_OPENING_TAG = "<reflex.Var>"
|
|
94
|
+
REFLEX_VAR_CLOSING_TAG = "</reflex.Var>"
|
reflex/constants/compiler.py
CHANGED
|
@@ -60,6 +60,8 @@ class CompileVars(SimpleNamespace):
|
|
|
60
60
|
TO_EVENT = "Event"
|
|
61
61
|
# The name of the internal on_load event.
|
|
62
62
|
ON_LOAD_INTERNAL = "on_load_internal"
|
|
63
|
+
# The name of the internal event to update generic state vars.
|
|
64
|
+
UPDATE_VARS_INTERNAL = "update_vars_internal"
|
|
63
65
|
|
|
64
66
|
|
|
65
67
|
class PageNames(SimpleNamespace):
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""Stub file for reflex/constants/event.py"""
|
|
2
|
+
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
+
# This file was generated by `scripts/pyi_generator.py`!
|
|
4
|
+
# ------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
7
|
+
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
|
+
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
|
+
from reflex.style import Style
|
|
10
|
+
from enum import Enum
|
|
11
|
+
from types import SimpleNamespace
|
|
12
|
+
|
|
13
|
+
class Endpoint(Enum):
|
|
14
|
+
PING = "ping"
|
|
15
|
+
EVENT = "_event"
|
|
16
|
+
UPLOAD = "_upload"
|
|
17
|
+
|
|
18
|
+
def get_url(self) -> str: ...
|
|
19
|
+
|
|
20
|
+
class SocketEvent(SimpleNamespace):
|
|
21
|
+
PING = "ping"
|
|
22
|
+
EVENT = "event"
|
|
23
|
+
|
|
24
|
+
class EventTriggers(SimpleNamespace):
|
|
25
|
+
ON_FOCUS = "on_focus"
|
|
26
|
+
ON_BLUR = "on_blur"
|
|
27
|
+
ON_CANCEL = "on_cancel"
|
|
28
|
+
ON_CLICK = "on_click"
|
|
29
|
+
ON_CHANGE = "on_change"
|
|
30
|
+
ON_CHANGE_END = "on_change_end"
|
|
31
|
+
ON_CHANGE_START = "on_change_start"
|
|
32
|
+
ON_COMPLETE = "on_complete"
|
|
33
|
+
ON_CONTEXT_MENU = "on_context_menu"
|
|
34
|
+
ON_DOUBLE_CLICK = "on_double_click"
|
|
35
|
+
ON_DROP = "on_drop"
|
|
36
|
+
ON_EDIT = "on_edit"
|
|
37
|
+
ON_KEY_DOWN = "on_key_down"
|
|
38
|
+
ON_KEY_UP = "on_key_up"
|
|
39
|
+
ON_MOUSE_DOWN = "on_mouse_down"
|
|
40
|
+
ON_MOUSE_ENTER = "on_mouse_enter"
|
|
41
|
+
ON_MOUSE_LEAVE = "on_mouse_leave"
|
|
42
|
+
ON_MOUSE_MOVE = "on_mouse_move"
|
|
43
|
+
ON_MOUSE_OUT = "on_mouse_out"
|
|
44
|
+
ON_MOUSE_OVER = "on_mouse_over"
|
|
45
|
+
ON_MOUSE_UP = "on_mouse_up"
|
|
46
|
+
ON_OPEN_CHANGE = "on_open_change"
|
|
47
|
+
ON_OPEN_AUTO_FOCUS = "on_open_auto_focus"
|
|
48
|
+
ON_CLOSE_AUTO_FOCUS = "on_close_auto_focus"
|
|
49
|
+
ON_FOCUS_OUTSIDE = "on_focus_outside"
|
|
50
|
+
ON_ESCAPE_KEY_DOWN = "on_escape_key_down"
|
|
51
|
+
ON_POINTER_DOWN_OUTSIDE = "on_pointer_down_outside"
|
|
52
|
+
ON_INTERACT_OUTSIDE = "on_interact_outside"
|
|
53
|
+
ON_SCROLL = "on_scroll"
|
|
54
|
+
ON_SUBMIT = "on_submit"
|
|
55
|
+
ON_MOUNT = "on_mount"
|
|
56
|
+
ON_UNMOUNT = "on_unmount"
|
|
57
|
+
ON_CLEAR_SERVER_ERRORS = "on_clear_server_errors"
|
|
58
|
+
ON_VALUE_COMMIT = "on_value_commit"
|
|
59
|
+
ON_SELECT = "on_select"
|
reflex/constants/installer.py
CHANGED
|
@@ -103,11 +103,11 @@ class PackageJson(SimpleNamespace):
|
|
|
103
103
|
|
|
104
104
|
DEPENDENCIES = {
|
|
105
105
|
"@emotion/react": "11.11.1",
|
|
106
|
-
"axios": "1.
|
|
106
|
+
"axios": "1.6.0",
|
|
107
107
|
"json5": "2.2.3",
|
|
108
108
|
"next": "14.0.1",
|
|
109
109
|
"next-sitemap": "4.1.8",
|
|
110
|
-
"next-themes": "0.2.
|
|
110
|
+
"next-themes": "0.2.1",
|
|
111
111
|
"react": "18.2.0",
|
|
112
112
|
"react-dom": "18.2.0",
|
|
113
113
|
"socket.io-client": "4.6.1",
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Stub file for reflex/constants/route.py"""
|
|
2
|
+
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
+
# This file was generated by `scripts/pyi_generator.py`!
|
|
4
|
+
# ------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
7
|
+
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
|
+
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
|
+
from reflex.style import Style
|
|
10
|
+
import re
|
|
11
|
+
from types import SimpleNamespace
|
|
12
|
+
|
|
13
|
+
class RouteArgType(SimpleNamespace):
|
|
14
|
+
SINGLE = str("arg_single")
|
|
15
|
+
LIST = str("arg_list")
|
|
16
|
+
|
|
17
|
+
ROUTER = "router"
|
|
18
|
+
ROUTER_DATA = "router_data"
|
|
19
|
+
|
|
20
|
+
class RouteVar(SimpleNamespace):
|
|
21
|
+
CLIENT_IP = "ip"
|
|
22
|
+
CLIENT_TOKEN = "token"
|
|
23
|
+
HEADERS = "headers"
|
|
24
|
+
PATH = "pathname"
|
|
25
|
+
ORIGIN = "asPath"
|
|
26
|
+
SESSION_ID = "sid"
|
|
27
|
+
QUERY = "query"
|
|
28
|
+
COOKIE = "cookie"
|
|
29
|
+
|
|
30
|
+
ROUTER_DATA_INCLUDE = set((RouteVar.PATH, RouteVar.ORIGIN, RouteVar.QUERY))
|
|
31
|
+
|
|
32
|
+
class RouteRegex(SimpleNamespace):
|
|
33
|
+
ARG = re.compile("\\[(?!\\.)([^\\[\\]]+)\\]")
|
|
34
|
+
CATCHALL = re.compile("(\\[?\\[\\.{3}(?![0-9]).*\\]?\\])")
|
|
35
|
+
STRICT_CATCHALL = re.compile("\\[\\.{3}([a-zA-Z_][\\w]*)\\]")
|
|
36
|
+
OPT_CATCHALL = re.compile("\\[\\[\\.{3}([a-zA-Z_][\\w]*)\\]\\]")
|
|
37
|
+
|
|
38
|
+
class DefaultPage(SimpleNamespace):
|
|
39
|
+
TITLE = "Reflex App"
|
|
40
|
+
DESCRIPTION = "A Reflex app."
|
|
41
|
+
IMAGE = "favicon.ico"
|
|
42
|
+
META_LIST = []
|
|
43
|
+
|
|
44
|
+
class Page404(SimpleNamespace):
|
|
45
|
+
SLUG = "404"
|
|
46
|
+
TITLE = "404 - Not Found"
|
|
47
|
+
IMAGE = "favicon.ico"
|
|
48
|
+
DESCRIPTION = "The page was not found"
|
|
49
|
+
|
|
50
|
+
ROUTE_NOT_FOUND = "routeNotFound"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Stub file for reflex/constants/style.py"""
|
|
2
|
+
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
+
# This file was generated by `scripts/pyi_generator.py`!
|
|
4
|
+
# ------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
7
|
+
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
|
+
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
|
+
from reflex.style import Style
|
|
10
|
+
import os
|
|
11
|
+
from types import SimpleNamespace
|
|
12
|
+
from reflex.constants.base import Dirs
|
|
13
|
+
|
|
14
|
+
STYLES_DIR = os.path.join(Dirs.WEB, "styles")
|
|
15
|
+
|
|
16
|
+
class Tailwind(SimpleNamespace):
|
|
17
|
+
VERSION = "tailwindcss@3.3.2"
|
|
18
|
+
CONFIG = os.path.join(Dirs.WEB, "tailwind.config.js")
|
|
19
|
+
CONTENT = ["./pages/**/*.{js,ts,jsx,tsx}", "./utils/**/*.{js,ts,jsx,tsx}"]
|
|
20
|
+
ROOT_STYLE_PATH = "./tailwind.css"
|
reflex/event.py
CHANGED
|
@@ -41,6 +41,16 @@ class Event(Base):
|
|
|
41
41
|
# The event payload.
|
|
42
42
|
payload: Dict[str, Any] = {}
|
|
43
43
|
|
|
44
|
+
@property
|
|
45
|
+
def substate_token(self) -> str:
|
|
46
|
+
"""Get the substate token for the event.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
The substate token.
|
|
50
|
+
"""
|
|
51
|
+
substate = self.name.rpartition(".")[0]
|
|
52
|
+
return f"{self.token}_{substate}"
|
|
53
|
+
|
|
44
54
|
|
|
45
55
|
BACKGROUND_TASK_MARKER = "_reflex_background_task"
|
|
46
56
|
|
|
@@ -39,14 +39,6 @@ class HydrateMiddleware(Middleware):
|
|
|
39
39
|
# Mark state as not hydrated (until on_loads are complete)
|
|
40
40
|
setattr(state, constants.CompileVars.IS_HYDRATED, False)
|
|
41
41
|
|
|
42
|
-
# Apply client side storage values to state
|
|
43
|
-
for storage_type in (constants.COOKIES, constants.LOCAL_STORAGE):
|
|
44
|
-
if storage_type in event.payload:
|
|
45
|
-
for key, value in event.payload[storage_type].items():
|
|
46
|
-
state_name, _, var_name = key.rpartition(".")
|
|
47
|
-
var_state = state.get_substate(state_name.split("."))
|
|
48
|
-
setattr(var_state, var_name, value)
|
|
49
|
-
|
|
50
42
|
# Get the initial state.
|
|
51
43
|
delta = format.format_state(state.dict())
|
|
52
44
|
# since a full dict was captured, clean any dirtiness
|