reflex 0.7.7a1__py3-none-any.whl → 0.7.8a1__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/web/utils/state.js +26 -16
- reflex/admin.py +1 -1
- reflex/app.py +6 -17
- reflex/app_mixins/lifespan.py +1 -1
- reflex/base.py +2 -2
- reflex/compiler/compiler.py +8 -7
- reflex/compiler/utils.py +6 -5
- reflex/components/base/app_wrap.pyi +18 -17
- reflex/components/base/bare.py +2 -1
- reflex/components/base/body.pyi +214 -19
- reflex/components/base/document.pyi +82 -81
- reflex/components/base/error_boundary.pyi +19 -18
- reflex/components/base/fragment.pyi +18 -17
- reflex/components/base/head.pyi +34 -33
- reflex/components/base/link.pyi +425 -36
- reflex/components/base/meta.pyi +673 -92
- reflex/components/base/script.pyi +21 -20
- reflex/components/base/strict_mode.pyi +18 -17
- reflex/components/component.py +20 -36
- reflex/components/core/auto_scroll.pyi +18 -17
- reflex/components/core/banner.pyi +98 -97
- reflex/components/core/breakpoints.py +1 -1
- reflex/components/core/client_side_routing.pyi +34 -33
- reflex/components/core/clipboard.py +1 -1
- reflex/components/core/clipboard.pyi +19 -18
- reflex/components/core/cond.py +2 -2
- reflex/components/core/debounce.py +3 -3
- reflex/components/core/debounce.pyi +20 -19
- reflex/components/core/foreach.py +2 -1
- reflex/components/core/html.pyi +18 -17
- reflex/components/core/match.py +2 -2
- reflex/components/core/sticky.pyi +66 -65
- reflex/components/core/upload.py +7 -10
- reflex/components/core/upload.pyi +86 -85
- reflex/components/datadisplay/code.pyi +34 -33
- reflex/components/datadisplay/dataeditor.py +3 -2
- reflex/components/datadisplay/dataeditor.pyi +35 -68
- reflex/components/datadisplay/shiki_code_block.pyi +50 -49
- reflex/components/el/element.pyi +18 -17
- reflex/components/el/elements/base.pyi +18 -17
- reflex/components/el/elements/forms.py +10 -8
- reflex/components/el/elements/forms.pyi +290 -332
- reflex/components/el/elements/inline.pyi +450 -449
- reflex/components/el/elements/media.pyi +402 -401
- reflex/components/el/elements/metadata.pyi +99 -97
- reflex/components/el/elements/other.pyi +114 -113
- reflex/components/el/elements/scripts.pyi +50 -49
- reflex/components/el/elements/sectioning.pyi +242 -241
- reflex/components/el/elements/tables.pyi +162 -161
- reflex/components/el/elements/typography.pyi +242 -241
- reflex/components/gridjs/datatable.py +3 -2
- reflex/components/gridjs/datatable.pyi +35 -34
- reflex/components/lucide/icon.pyi +50 -49
- reflex/components/markdown/markdown.py +2 -1
- reflex/components/markdown/markdown.pyi +20 -19
- reflex/components/moment/moment.pyi +19 -18
- reflex/components/next/base.pyi +18 -17
- reflex/components/next/image.pyi +20 -19
- reflex/components/next/link.pyi +18 -17
- reflex/components/next/video.pyi +18 -17
- reflex/components/plotly/plotly.py +3 -3
- reflex/components/plotly/plotly.pyi +326 -325
- reflex/components/radix/primitives/accordion.py +2 -1
- reflex/components/radix/primitives/accordion.pyi +115 -114
- reflex/components/radix/primitives/base.pyi +34 -33
- reflex/components/radix/primitives/drawer.py +2 -1
- reflex/components/radix/primitives/drawer.pyi +187 -186
- reflex/components/radix/primitives/form.pyi +168 -182
- reflex/components/radix/primitives/progress.pyi +82 -81
- reflex/components/radix/primitives/slider.py +2 -1
- reflex/components/radix/primitives/slider.pyi +84 -83
- reflex/components/radix/themes/base.pyi +130 -129
- reflex/components/radix/themes/color_mode.pyi +51 -50
- reflex/components/radix/themes/components/alert_dialog.pyi +118 -117
- reflex/components/radix/themes/components/aspect_ratio.pyi +18 -17
- reflex/components/radix/themes/components/avatar.pyi +18 -17
- reflex/components/radix/themes/components/badge.pyi +18 -17
- reflex/components/radix/themes/components/button.pyi +18 -17
- reflex/components/radix/themes/components/callout.pyi +82 -81
- reflex/components/radix/themes/components/card.pyi +18 -17
- reflex/components/radix/themes/components/checkbox.pyi +53 -52
- reflex/components/radix/themes/components/checkbox_cards.pyi +34 -33
- reflex/components/radix/themes/components/checkbox_group.py +2 -1
- reflex/components/radix/themes/components/checkbox_group.pyi +34 -33
- reflex/components/radix/themes/components/context_menu.pyi +225 -224
- reflex/components/radix/themes/components/data_list.pyi +66 -65
- reflex/components/radix/themes/components/dialog.pyi +121 -120
- reflex/components/radix/themes/components/dropdown_menu.pyi +142 -141
- reflex/components/radix/themes/components/hover_card.pyi +68 -67
- reflex/components/radix/themes/components/icon_button.pyi +18 -17
- reflex/components/radix/themes/components/inset.pyi +18 -17
- reflex/components/radix/themes/components/popover.pyi +73 -72
- reflex/components/radix/themes/components/progress.pyi +18 -17
- reflex/components/radix/themes/components/radio.pyi +18 -17
- reflex/components/radix/themes/components/radio_cards.pyi +35 -34
- reflex/components/radix/themes/components/radio_group.py +2 -1
- reflex/components/radix/themes/components/radio_group.pyi +67 -66
- reflex/components/radix/themes/components/scroll_area.pyi +18 -17
- reflex/components/radix/themes/components/segmented_control.py +2 -1
- reflex/components/radix/themes/components/segmented_control.pyi +35 -34
- reflex/components/radix/themes/components/select.py +2 -1
- reflex/components/radix/themes/components/select.pyi +155 -154
- reflex/components/radix/themes/components/separator.pyi +18 -17
- reflex/components/radix/themes/components/skeleton.pyi +18 -17
- reflex/components/radix/themes/components/slider.py +2 -1
- reflex/components/radix/themes/components/slider.pyi +20 -31
- reflex/components/radix/themes/components/spinner.pyi +18 -17
- reflex/components/radix/themes/components/switch.pyi +19 -18
- reflex/components/radix/themes/components/table.pyi +114 -113
- reflex/components/radix/themes/components/tabs.pyi +84 -83
- reflex/components/radix/themes/components/text_area.pyi +21 -24
- reflex/components/radix/themes/components/text_field.pyi +56 -63
- reflex/components/radix/themes/components/tooltip.py +2 -2
- reflex/components/radix/themes/components/tooltip.pyi +21 -20
- reflex/components/radix/themes/layout/base.pyi +18 -17
- reflex/components/radix/themes/layout/box.pyi +18 -17
- reflex/components/radix/themes/layout/center.pyi +18 -17
- reflex/components/radix/themes/layout/container.pyi +18 -17
- reflex/components/radix/themes/layout/flex.pyi +18 -17
- reflex/components/radix/themes/layout/grid.pyi +18 -17
- reflex/components/radix/themes/layout/list.py +2 -1
- reflex/components/radix/themes/layout/list.pyi +473 -83
- reflex/components/radix/themes/layout/section.pyi +18 -17
- reflex/components/radix/themes/layout/spacer.pyi +18 -17
- reflex/components/radix/themes/layout/stack.pyi +50 -49
- reflex/components/radix/themes/typography/blockquote.pyi +18 -17
- reflex/components/radix/themes/typography/code.pyi +18 -17
- reflex/components/radix/themes/typography/heading.pyi +18 -17
- reflex/components/radix/themes/typography/link.pyi +18 -17
- reflex/components/radix/themes/typography/text.pyi +114 -113
- reflex/components/react_player/audio.pyi +34 -36
- reflex/components/react_player/react_player.pyi +34 -33
- reflex/components/react_player/video.pyi +34 -36
- reflex/components/recharts/cartesian.py +7 -6
- reflex/components/recharts/cartesian.pyi +302 -301
- reflex/components/recharts/charts.py +2 -1
- reflex/components/recharts/charts.pyi +177 -176
- reflex/components/recharts/general.py +3 -2
- reflex/components/recharts/general.pyi +99 -98
- reflex/components/recharts/polar.py +9 -8
- reflex/components/recharts/polar.pyi +62 -61
- reflex/components/recharts/recharts.pyi +34 -33
- reflex/components/sonner/toast.pyi +19 -18
- reflex/components/suneditor/editor.py +22 -24
- reflex/components/suneditor/editor.pyi +27 -28
- reflex/components/tags/cond_tag.py +3 -3
- reflex/components/tags/iter_tag.py +2 -1
- reflex/components/tags/tag.py +3 -2
- reflex/config.py +27 -17
- reflex/constants/installer.py +4 -4
- reflex/constants/route.py +2 -3
- reflex/constants/utils.py +4 -3
- reflex/event.py +56 -28
- reflex/experimental/client_state.py +3 -2
- reflex/experimental/layout.pyi +84 -83
- reflex/istate/data.py +1 -1
- reflex/istate/storage.py +2 -2
- reflex/model.py +3 -3
- reflex/page.py +3 -2
- reflex/state.py +56 -57
- reflex/style.py +3 -2
- reflex/testing.py +12 -21
- reflex/utils/codespaces.py +14 -15
- reflex/utils/decorator.py +2 -1
- reflex/utils/exec.py +1 -1
- reflex/utils/format.py +2 -2
- reflex/utils/imports.py +6 -8
- reflex/utils/misc.py +2 -1
- reflex/utils/net.py +2 -1
- reflex/utils/prerequisites.py +12 -5
- reflex/utils/processes.py +6 -5
- reflex/utils/pyi_generator.py +6 -5
- reflex/utils/serializers.py +13 -25
- reflex/utils/types.py +34 -46
- reflex/vars/base.py +60 -56
- reflex/vars/dep_tracking.py +4 -4
- reflex/vars/function.py +13 -36
- reflex/vars/number.py +5 -17
- reflex/vars/object.py +9 -16
- reflex/vars/sequence.py +11 -23
- {reflex-0.7.7a1.dist-info → reflex-0.7.8a1.dist-info}/METADATA +1 -1
- {reflex-0.7.7a1.dist-info → reflex-0.7.8a1.dist-info}/RECORD +185 -185
- {reflex-0.7.7a1.dist-info → reflex-0.7.8a1.dist-info}/WHEEL +0 -0
- {reflex-0.7.7a1.dist-info → reflex-0.7.8a1.dist-info}/entry_points.txt +0 -0
- {reflex-0.7.7a1.dist-info → reflex-0.7.8a1.dist-info}/licenses/LICENSE +0 -0
reflex/vars/function.py
CHANGED
|
@@ -3,19 +3,8 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import dataclasses
|
|
6
|
-
import
|
|
7
|
-
from typing import
|
|
8
|
-
Any,
|
|
9
|
-
Callable,
|
|
10
|
-
Concatenate,
|
|
11
|
-
Generic,
|
|
12
|
-
ParamSpec,
|
|
13
|
-
Protocol,
|
|
14
|
-
Sequence,
|
|
15
|
-
Type,
|
|
16
|
-
TypeVar,
|
|
17
|
-
overload,
|
|
18
|
-
)
|
|
6
|
+
from collections.abc import Callable, Sequence
|
|
7
|
+
from typing import Any, Concatenate, Generic, ParamSpec, Protocol, TypeVar, overload
|
|
19
8
|
|
|
20
9
|
from reflex.utils import format
|
|
21
10
|
from reflex.utils.types import GenericType
|
|
@@ -212,7 +201,7 @@ class FunctionStringVar(FunctionVar[CALLABLE_TYPE]):
|
|
|
212
201
|
def create(
|
|
213
202
|
cls,
|
|
214
203
|
func: str,
|
|
215
|
-
_var_type:
|
|
204
|
+
_var_type: type[OTHER_CALLABLE_TYPE] = ReflexCallable[Any, Any],
|
|
216
205
|
_var_data: VarData | None = None,
|
|
217
206
|
) -> FunctionStringVar[OTHER_CALLABLE_TYPE]:
|
|
218
207
|
"""Create a new function var from a string.
|
|
@@ -470,25 +459,13 @@ class ArgsFunctionOperationBuilder(CachedVarOperation, BuilderFunctionVar):
|
|
|
470
459
|
)
|
|
471
460
|
|
|
472
461
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
)
|
|
484
|
-
else:
|
|
485
|
-
JSON_STRINGIFY = FunctionStringVar.create(
|
|
486
|
-
"JSON.stringify", _var_type=ReflexCallable[Any, str]
|
|
487
|
-
)
|
|
488
|
-
ARRAY_ISARRAY = FunctionStringVar.create(
|
|
489
|
-
"Array.isArray", _var_type=ReflexCallable[Any, bool]
|
|
490
|
-
)
|
|
491
|
-
PROTOTYPE_TO_STRING = FunctionStringVar.create(
|
|
492
|
-
"((__to_string) => __to_string.toString())",
|
|
493
|
-
_var_type=ReflexCallable[Any, str],
|
|
494
|
-
)
|
|
462
|
+
JSON_STRINGIFY = FunctionStringVar.create(
|
|
463
|
+
"JSON.stringify", _var_type=ReflexCallable[[Any], str]
|
|
464
|
+
)
|
|
465
|
+
ARRAY_ISARRAY = FunctionStringVar.create(
|
|
466
|
+
"Array.isArray", _var_type=ReflexCallable[[Any], bool]
|
|
467
|
+
)
|
|
468
|
+
PROTOTYPE_TO_STRING = FunctionStringVar.create(
|
|
469
|
+
"((__to_string) => __to_string.toString())",
|
|
470
|
+
_var_type=ReflexCallable[[Any], str],
|
|
471
|
+
)
|
reflex/vars/number.py
CHANGED
|
@@ -5,16 +5,8 @@ from __future__ import annotations
|
|
|
5
5
|
import dataclasses
|
|
6
6
|
import json
|
|
7
7
|
import math
|
|
8
|
-
from
|
|
9
|
-
|
|
10
|
-
Any,
|
|
11
|
-
Callable,
|
|
12
|
-
NoReturn,
|
|
13
|
-
Type,
|
|
14
|
-
TypeVar,
|
|
15
|
-
Union,
|
|
16
|
-
overload,
|
|
17
|
-
)
|
|
8
|
+
from collections.abc import Callable
|
|
9
|
+
from typing import TYPE_CHECKING, Any, NoReturn, TypeVar, overload
|
|
18
10
|
|
|
19
11
|
from typing_extensions import TypeVar as TypeVarExt
|
|
20
12
|
|
|
@@ -491,10 +483,8 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
491
483
|
|
|
492
484
|
if format_spec:
|
|
493
485
|
raise VarValueError(
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
"If possible, use computed variables instead: https://reflex.dev/docs/vars/computed-vars/"
|
|
497
|
-
).format(format_spec)
|
|
486
|
+
f"Unknown format code '{format_spec}' for object of type 'NumberVar'. It is only supported to use ',', '_', and '.f' for float numbers."
|
|
487
|
+
"If possible, use computed variables instead: https://reflex.dev/docs/vars/computed-vars/"
|
|
498
488
|
)
|
|
499
489
|
|
|
500
490
|
return super().__format__(format_spec)
|
|
@@ -1114,9 +1104,7 @@ def ternary_operation(
|
|
|
1114
1104
|
Returns:
|
|
1115
1105
|
The ternary operation.
|
|
1116
1106
|
"""
|
|
1117
|
-
type_value:
|
|
1118
|
-
if_true._var_type, if_false._var_type
|
|
1119
|
-
)
|
|
1107
|
+
type_value: type[T] | type[U] = unionize(if_true._var_type, if_false._var_type)
|
|
1120
1108
|
value: CustomVarOperationReturn[T | U] = var_operation_return(
|
|
1121
1109
|
js_expression=f"({condition} ? {if_true} : {if_false})",
|
|
1122
1110
|
var_type=type_value,
|
reflex/vars/object.py
CHANGED
|
@@ -5,18 +5,11 @@ from __future__ import annotations
|
|
|
5
5
|
import collections.abc
|
|
6
6
|
import dataclasses
|
|
7
7
|
import typing
|
|
8
|
+
from collections.abc import Mapping
|
|
8
9
|
from inspect import isclass
|
|
9
|
-
from typing import
|
|
10
|
-
Any,
|
|
11
|
-
Mapping,
|
|
12
|
-
NoReturn,
|
|
13
|
-
Type,
|
|
14
|
-
TypeVar,
|
|
15
|
-
get_args,
|
|
16
|
-
get_type_hints,
|
|
17
|
-
overload,
|
|
18
|
-
)
|
|
10
|
+
from typing import Any, NoReturn, TypeVar, get_args, get_type_hints, overload
|
|
19
11
|
|
|
12
|
+
from rich.markup import escape
|
|
20
13
|
from typing_extensions import is_typeddict
|
|
21
14
|
|
|
22
15
|
from reflex.utils import types
|
|
@@ -78,7 +71,7 @@ def _determine_value_type(var_type: GenericType):
|
|
|
78
71
|
class ObjectVar(Var[OBJECT_TYPE], python_types=Mapping):
|
|
79
72
|
"""Base class for immutable object vars."""
|
|
80
73
|
|
|
81
|
-
def _key_type(self) ->
|
|
74
|
+
def _key_type(self) -> type:
|
|
82
75
|
"""Get the type of the keys of the object.
|
|
83
76
|
|
|
84
77
|
Returns:
|
|
@@ -89,7 +82,7 @@ class ObjectVar(Var[OBJECT_TYPE], python_types=Mapping):
|
|
|
89
82
|
@overload
|
|
90
83
|
def _value_type(
|
|
91
84
|
self: ObjectVar[Mapping[Any, VALUE_TYPE]],
|
|
92
|
-
) ->
|
|
85
|
+
) -> type[VALUE_TYPE]: ...
|
|
93
86
|
|
|
94
87
|
@overload
|
|
95
88
|
def _value_type(self) -> GenericType: ...
|
|
@@ -326,7 +319,7 @@ class ObjectVar(Var[OBJECT_TYPE], python_types=Mapping):
|
|
|
326
319
|
attribute_type = get_attribute_access_type(var_type, name)
|
|
327
320
|
if attribute_type is None:
|
|
328
321
|
raise VarAttributeError(
|
|
329
|
-
f"The State var `{self!s}` has no attribute '{name}' or may have been annotated "
|
|
322
|
+
f"The State var `{self!s}` of type {escape(str(self._var_type))} has no attribute '{name}' or may have been annotated "
|
|
330
323
|
f"wrongly."
|
|
331
324
|
)
|
|
332
325
|
return ObjectItemOperation.create(self, name, attribute_type).guess_type()
|
|
@@ -355,7 +348,7 @@ class LiteralObjectVar(CachedVarOperation, ObjectVar[OBJECT_TYPE], LiteralVar):
|
|
|
355
348
|
|
|
356
349
|
_var_value: Mapping[Var | Any, Var | Any] = dataclasses.field(default_factory=dict)
|
|
357
350
|
|
|
358
|
-
def _key_type(self) ->
|
|
351
|
+
def _key_type(self) -> type:
|
|
359
352
|
"""Get the type of the keys of the object.
|
|
360
353
|
|
|
361
354
|
Returns:
|
|
@@ -364,7 +357,7 @@ class LiteralObjectVar(CachedVarOperation, ObjectVar[OBJECT_TYPE], LiteralVar):
|
|
|
364
357
|
args_list = typing.get_args(self._var_type)
|
|
365
358
|
return args_list[0] if args_list else Any # pyright: ignore [reportReturnType]
|
|
366
359
|
|
|
367
|
-
def _value_type(self) ->
|
|
360
|
+
def _value_type(self) -> type:
|
|
368
361
|
"""Get the type of the values of the object.
|
|
369
362
|
|
|
370
363
|
Returns:
|
|
@@ -439,7 +432,7 @@ class LiteralObjectVar(CachedVarOperation, ObjectVar[OBJECT_TYPE], LiteralVar):
|
|
|
439
432
|
def create(
|
|
440
433
|
cls,
|
|
441
434
|
_var_value: Mapping,
|
|
442
|
-
_var_type:
|
|
435
|
+
_var_type: type[OBJECT_TYPE] | None = None,
|
|
443
436
|
_var_data: VarData | None = None,
|
|
444
437
|
) -> LiteralObjectVar[OBJECT_TYPE]:
|
|
445
438
|
"""Create the literal object var.
|
reflex/vars/sequence.py
CHANGED
|
@@ -7,20 +7,8 @@ import dataclasses
|
|
|
7
7
|
import inspect
|
|
8
8
|
import json
|
|
9
9
|
import re
|
|
10
|
-
from
|
|
11
|
-
|
|
12
|
-
Any,
|
|
13
|
-
Iterable,
|
|
14
|
-
List,
|
|
15
|
-
Literal,
|
|
16
|
-
Mapping,
|
|
17
|
-
Sequence,
|
|
18
|
-
Type,
|
|
19
|
-
TypeVar,
|
|
20
|
-
Union,
|
|
21
|
-
get_args,
|
|
22
|
-
overload,
|
|
23
|
-
)
|
|
10
|
+
from collections.abc import Iterable, Mapping, Sequence
|
|
11
|
+
from typing import TYPE_CHECKING, Any, Literal, TypeVar, get_args, overload
|
|
24
12
|
|
|
25
13
|
from typing_extensions import TypeVar as TypingExtensionsTypeVar
|
|
26
14
|
|
|
@@ -251,7 +239,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(Sequence, set)):
|
|
|
251
239
|
|
|
252
240
|
@overload
|
|
253
241
|
@classmethod
|
|
254
|
-
def range(cls, stop: int | NumberVar, /) -> ArrayVar[
|
|
242
|
+
def range(cls, stop: int | NumberVar, /) -> ArrayVar[list[int]]: ...
|
|
255
243
|
|
|
256
244
|
@overload
|
|
257
245
|
@classmethod
|
|
@@ -261,7 +249,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(Sequence, set)):
|
|
|
261
249
|
end: int | NumberVar,
|
|
262
250
|
step: int | NumberVar = 1,
|
|
263
251
|
/,
|
|
264
|
-
) -> ArrayVar[
|
|
252
|
+
) -> ArrayVar[list[int]]: ...
|
|
265
253
|
|
|
266
254
|
@overload
|
|
267
255
|
@classmethod
|
|
@@ -270,7 +258,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(Sequence, set)):
|
|
|
270
258
|
first_endpoint: int | NumberVar,
|
|
271
259
|
second_endpoint: int | NumberVar | None = None,
|
|
272
260
|
step: int | NumberVar | None = None,
|
|
273
|
-
) -> ArrayVar[
|
|
261
|
+
) -> ArrayVar[list[int]]: ...
|
|
274
262
|
|
|
275
263
|
@classmethod
|
|
276
264
|
def range(
|
|
@@ -278,7 +266,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(Sequence, set)):
|
|
|
278
266
|
first_endpoint: int | NumberVar,
|
|
279
267
|
second_endpoint: int | NumberVar | None = None,
|
|
280
268
|
step: int | NumberVar | None = None,
|
|
281
|
-
) -> ArrayVar[
|
|
269
|
+
) -> ArrayVar[list[int]]:
|
|
282
270
|
"""Create a range of numbers.
|
|
283
271
|
|
|
284
272
|
Args:
|
|
@@ -493,7 +481,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(Sequence, set)):
|
|
|
493
481
|
class LiteralArrayVar(CachedVarOperation, LiteralVar, ArrayVar[ARRAY_VAR_TYPE]):
|
|
494
482
|
"""Base class for immutable literal array vars."""
|
|
495
483
|
|
|
496
|
-
_var_value: Sequence[
|
|
484
|
+
_var_value: Sequence[Var | Any] = dataclasses.field(default=())
|
|
497
485
|
|
|
498
486
|
@cached_property_no_lock
|
|
499
487
|
def _cached_var_name(self) -> str:
|
|
@@ -557,7 +545,7 @@ class LiteralArrayVar(CachedVarOperation, LiteralVar, ArrayVar[ARRAY_VAR_TYPE]):
|
|
|
557
545
|
def create(
|
|
558
546
|
cls,
|
|
559
547
|
value: OTHER_ARRAY_VAR_TYPE,
|
|
560
|
-
_var_type:
|
|
548
|
+
_var_type: type[OTHER_ARRAY_VAR_TYPE] | None = None,
|
|
561
549
|
_var_data: VarData | None = None,
|
|
562
550
|
) -> LiteralArrayVar[OTHER_ARRAY_VAR_TYPE]:
|
|
563
551
|
"""Create a var from a string value.
|
|
@@ -1752,7 +1740,7 @@ def array_concat_operation(
|
|
|
1752
1740
|
"""
|
|
1753
1741
|
return var_operation_return(
|
|
1754
1742
|
js_expression=f"[...{lhs}, ...{rhs}]",
|
|
1755
|
-
var_type=
|
|
1743
|
+
var_type=lhs._var_type | rhs._var_type,
|
|
1756
1744
|
)
|
|
1757
1745
|
|
|
1758
1746
|
|
|
@@ -1774,7 +1762,7 @@ class LiteralColorVar(CachedVarOperation, LiteralVar, ColorVar):
|
|
|
1774
1762
|
def create(
|
|
1775
1763
|
cls,
|
|
1776
1764
|
value: Color,
|
|
1777
|
-
_var_type:
|
|
1765
|
+
_var_type: type[Color] | None = None,
|
|
1778
1766
|
_var_data: VarData | None = None,
|
|
1779
1767
|
) -> ColorVar:
|
|
1780
1768
|
"""Create a var from a string value.
|
|
@@ -1905,7 +1893,7 @@ class LiteralRangeVar(CachedVarOperation, LiteralVar, RangeVar):
|
|
|
1905
1893
|
def create(
|
|
1906
1894
|
cls,
|
|
1907
1895
|
value: range,
|
|
1908
|
-
_var_type:
|
|
1896
|
+
_var_type: type[range] | None = None,
|
|
1909
1897
|
_var_data: VarData | None = None,
|
|
1910
1898
|
) -> RangeVar:
|
|
1911
1899
|
"""Create a var from a string value.
|