streamlit-nightly 1.53.2.dev20260125__py3-none-any.whl → 1.53.2.dev20260127__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.
- streamlit/commands/logo.py +81 -25
- streamlit/deprecation_util.py +19 -1
- streamlit/elements/arrow.py +2 -1
- streamlit/elements/lib/built_in_chart_utils.py +2 -2
- streamlit/elements/lib/options_selector_utils.py +72 -22
- streamlit/elements/widgets/select_slider.py +123 -37
- streamlit/hello/plotting_demo.py +19 -12
- streamlit/proto/Logo_pb2.py +5 -3
- streamlit/proto/Logo_pb2.pyi +25 -1
- streamlit/proto/Slider_pb2.py +6 -6
- streamlit/proto/Slider_pb2.pyi +9 -1
- streamlit/runtime/scriptrunner/script_runner.py +17 -0
- streamlit/runtime/scriptrunner_utils/script_run_context.py +13 -10
- streamlit/runtime/state/__init__.py +7 -1
- streamlit/runtime/state/common.py +13 -0
- streamlit/runtime/state/query_params.py +494 -6
- streamlit/runtime/state/session_state.py +178 -3
- streamlit/runtime/state/widgets.py +26 -1
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +304 -304
- streamlit/static/static/js/{ErrorOutline.esm.CIFYUdwC.js → ErrorOutline.esm.DiaGWPsE.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.DWVTnTHm.js → FileDownload.esm.D-Qgpk5d.js} +1 -1
- streamlit/static/static/js/{FileHelper.BPYQIPd1.js → FileHelper.DmtDDGp0.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.CypmvhYZ.js → FormClearHelper.BM3uDLnU.js} +1 -1
- streamlit/static/static/js/{InputInstructions.Bi62hDTQ.js → InputInstructions.B2YZ5Lle.js} +1 -1
- streamlit/static/static/js/{Particles.yebG0VuV.js → Particles.BzfZrl-0.js} +1 -1
- streamlit/static/static/js/{ProgressBar.Dy9CI6w4.js → ProgressBar.DWErD3j3.js} +1 -1
- streamlit/static/static/js/{StreamlitSyntaxHighlighter.Btk92CPv.js → StreamlitSyntaxHighlighter.DB31rUPf.js} +1 -1
- streamlit/static/static/js/{TableChart.esm.DBeVaFNt.js → TableChart.esm.D3oUYYYd.js} +1 -1
- streamlit/static/static/js/{Toolbar.DC2Tp-qb.js → Toolbar.CPyjMABY.js} +1 -1
- streamlit/static/static/js/{WidgetLabelHelpIconInline.3DnEd9BK.js → WidgetLabelHelpIconInline.C1NBCx-y.js} +1 -1
- streamlit/static/static/js/{base-input.7Sj6pVk0.js → base-input.C_CrNgNd.js} +1 -1
- streamlit/static/static/js/{checkbox.CcUx3XuQ.js → checkbox.S6O8DPFl.js} +1 -1
- streamlit/static/static/js/{createDownloadLinkElement.DZuwkCqy.js → createDownloadLinkElement.B-5tIJBw.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.Dw-AewlN.js → data-grid-overlay-editor.BW5aAEJN.js} +1 -1
- streamlit/static/static/js/{downloader.Bsx5M2Du.js → downloader.BswLlj7p.js} +1 -1
- streamlit/static/static/js/embed.QjYZXbaW.js +193 -0
- streamlit/static/static/js/{es6.BpAqZaR_.js → es6.Dm_kl6Cp.js} +2 -2
- streamlit/static/static/js/{formatNumber.DjehVPVS.js → formatNumber.CH39oSMw.js} +1 -1
- streamlit/static/static/js/{iconPosition.D02OPE-d.js → iconPosition.Dp9f2jam.js} +1 -1
- streamlit/static/static/js/{iframeResizer.contentWindow.xtstqPd7.js → iframeResizer.contentWindow.DOprY46-.js} +1 -1
- streamlit/static/static/js/{index.S-mjkUeF.js → index.-7yn3zqE.js} +1 -1
- streamlit/static/static/js/{index.Bri1T2TS.js → index.4QSKV4yi.js} +1 -1
- streamlit/static/static/js/{index.ZIA43eTF.js → index.6OwBTJdz.js} +1 -1
- streamlit/static/static/js/{index.x1B588Xu.js → index.6UQ__fP7.js} +1 -1
- streamlit/static/static/js/{index.CEwnDCn9.js → index.6iOQDEVC.js} +1 -1
- streamlit/static/static/js/index.B0Wcvg8a.js +2 -0
- streamlit/static/static/js/{index.DO2T-QzF.js → index.B6Sk5Jwr.js} +1 -1
- streamlit/static/static/js/{index.D_TIyPF4.js → index.B9XI6y3j.js} +1 -1
- streamlit/static/static/js/{index.B9gbSNsw.js → index.BBVcEzWu.js} +1 -1
- streamlit/static/static/js/{index.CA0RmxJF.js → index.BFxjXeYb.js} +1 -1
- streamlit/static/static/js/{index.B5tD5YeV.js → index.BNsCI-Q1.js} +1 -1
- streamlit/static/static/js/{index.DJjSqPAx.js → index.BQu5Qf_i.js} +1 -1
- streamlit/static/static/js/{index.BvZbnSMC.js → index.BUOjbZl6.js} +1 -1
- streamlit/static/static/js/{index.XFMDBL5n.js → index.BUbgW8RJ.js} +1 -1
- streamlit/static/static/js/{index.BOkpEbJS.js → index.BYjec3-R.js} +1 -1
- streamlit/static/static/js/{index.D6Z9hKJY.js → index.BaKZ4ira.js} +1 -1
- streamlit/static/static/js/{index.BIcJe97b.js → index.BcUwq6kI.js} +1 -1
- streamlit/static/static/js/{index.C9v49R-a.js → index.BlchQrZL.js} +1 -1
- streamlit/static/static/js/{index.D9RL5sRp.js → index.BlgpfTUq.js} +1 -1
- streamlit/static/static/js/{index.BV6XgCij.js → index.Bwaj-9Zv.js} +1 -1
- streamlit/static/static/js/{index.DDu_qTm0.js → index.BxtweGcn.js} +1 -1
- streamlit/static/static/js/{index.CGbvkEtg.js → index.C57ViuAX.js} +1 -1
- streamlit/static/static/js/{index.CdRwiHPm.js → index.CAzk7fUP.js} +1 -1
- streamlit/static/static/js/{index.BK9S5qug.js → index.CDZffl1q.js} +1 -1
- streamlit/static/static/js/{index.JL0uGAeJ.js → index.CYxcFtYt.js} +1 -1
- streamlit/static/static/js/index.Cb7V19H9.js +2 -0
- streamlit/static/static/js/{index.CgARjn28.js → index.CfXTal6g.js} +1 -1
- streamlit/static/static/js/{index.CyDHwK5P.js → index.Ci3x7GcT.js} +1 -1
- streamlit/static/static/js/{index.BVhVdVeE.js → index.CivdhE_9.js} +1 -1
- streamlit/static/static/js/{index.m3dn5Bai.js → index.CkSzTTpO.js} +5 -5
- streamlit/static/static/js/{index.8FPw0_gD.js → index.CuJ82OKQ.js} +1 -1
- streamlit/static/static/js/{index.BDlI2pRp.js → index.Cw5Xlisw.js} +1 -1
- streamlit/static/static/js/{index.DdxofXV8.js → index.D1tkD8Lg.js} +3 -3
- streamlit/static/static/js/{index.iXzAofuY.js → index.DK9Im19R.js} +2 -2
- streamlit/static/static/js/{index.iF5zYERg.js → index.DMwRlpNi.js} +1 -1
- streamlit/static/static/js/index.DTUAvbJ0.js +1 -0
- streamlit/static/static/js/{index.DSSapl3Q.js → index.DoRYpzHm.js} +1 -1
- streamlit/static/static/js/{index.D6J2UPzF.js → index.DsZNm1_D.js} +1 -1
- streamlit/static/static/js/{index.5H98WqjT.js → index.DypwtfIh.js} +1 -1
- streamlit/static/static/js/{index.DgLRJfs3.js → index.JKOtpaMf.js} +1 -1
- streamlit/static/static/js/{index.B8-HOwf1.js → index.OI2eh_me.js} +1 -1
- streamlit/static/static/js/{index.CKUBdVQ9.js → index.TTO_Lb69.js} +1 -1
- streamlit/static/static/js/{index.-faJDV20.js → index.X1r5cenD.js} +1 -1
- streamlit/static/static/js/{index.BqfJJr3c.js → index.gsc49XzN.js} +1 -1
- streamlit/static/static/js/{index.BB_iwaVr.js → index.lMhsw-5K.js} +32 -32
- streamlit/static/static/js/{index.DZv5AoR1.js → index.s9zpEF8P.js} +1 -1
- streamlit/static/static/js/{index.BGTMh3Uu.js → index.tjRGlTlQ.js} +1 -1
- streamlit/static/static/js/{index.Bo1ztye0.js → index.wKGUZfH4.js} +1 -1
- streamlit/static/static/js/{input.VYKyGuhi.js → input.CIKqvWjB.js} +1 -1
- streamlit/static/static/js/{main.u5Bb3MY7.js → main.BkNqoTrd.js} +1 -1
- streamlit/static/static/js/{memory.BOMt4yAV.js → memory.DNcbFok2.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.CihlAHgl.js → number-overlay-editor.DwjiYKav.js} +1 -1
- streamlit/static/static/js/{pandasStylerUtils.BuqSgXpk.js → pandasStylerUtils.BSc50we3.js} +1 -1
- streamlit/static/static/js/{sandbox.COGR4pqz.js → sandbox.DJL9Gdcf.js} +1 -1
- streamlit/static/static/js/{styled-components.BEf3c4IJ.js → styled-components.D4jE1G9j.js} +1 -1
- streamlit/static/static/js/{throttle.Bl-XsA9N.js → throttle.dHeXiPIK.js} +1 -1
- streamlit/static/static/js/{timepicker.B-HgBYlK.js → timepicker.CIpoSUyW.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.BrQebwtE.js → toConsumableArray.AOXQx2YY.js} +1 -1
- streamlit/static/static/js/uniqueId.DRPc21MO.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.8WwISl9r.js → useBasicWidgetState.BwQxG7iA.js} +1 -1
- streamlit/static/static/js/{useIntlLocale.D37LWdCR.js → useIntlLocale.JXPZPWaJ.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.Bb_KqJvq.js → useTextInputAutoExpand.CD_nhoE_.js} +1 -1
- streamlit/static/static/js/{useUpdateUiValue.D1BLS5t7.js → useUpdateUiValue.Cl1Y22Ao.js} +1 -1
- streamlit/static/static/js/{useWaveformController.Ce0-qTws.js → useWaveformController.DJhScSDn.js} +1 -1
- streamlit/static/static/js/{withCalculatedWidth.BX2K3UVv.js → withCalculatedWidth.CrAfFzO9.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.CqfGs8T2.js → withFullScreenWrapper.EdE3zOz5.js} +1 -1
- streamlit/testing/v1/element_tree.py +23 -8
- {streamlit_nightly-1.53.2.dev20260125.dist-info → streamlit_nightly-1.53.2.dev20260127.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.53.2.dev20260125.dist-info → streamlit_nightly-1.53.2.dev20260127.dist-info}/RECORD +114 -114
- streamlit/static/static/js/embed.C7by6AoE.js +0 -195
- streamlit/static/static/js/index.Bhy8EBYI.js +0 -2
- streamlit/static/static/js/index.C5ehUqNt.js +0 -2
- streamlit/static/static/js/index.m4WkwGMu.js +0 -1
- streamlit/static/static/js/uniqueId.8R4hbkYl.js +0 -1
- {streamlit_nightly-1.53.2.dev20260125.data → streamlit_nightly-1.53.2.dev20260127.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.53.2.dev20260125.dist-info → streamlit_nightly-1.53.2.dev20260127.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.53.2.dev20260125.dist-info → streamlit_nightly-1.53.2.dev20260127.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.53.2.dev20260125.dist-info → streamlit_nightly-1.53.2.dev20260127.dist-info}/top_level.txt +0 -0
streamlit/proto/Logo_pb2.pyi
CHANGED
|
@@ -19,6 +19,7 @@ limitations under the License.
|
|
|
19
19
|
|
|
20
20
|
from google.protobuf import descriptor as _descriptor
|
|
21
21
|
from google.protobuf import message as _message
|
|
22
|
+
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
|
22
23
|
import builtins as _builtins
|
|
23
24
|
import sys
|
|
24
25
|
import typing as _typing
|
|
@@ -36,14 +37,35 @@ class Logo(_message.Message):
|
|
|
36
37
|
|
|
37
38
|
DESCRIPTOR: _descriptor.Descriptor
|
|
38
39
|
|
|
40
|
+
class _ImageType:
|
|
41
|
+
ValueType = _typing.NewType("ValueType", _builtins.int)
|
|
42
|
+
V: _TypeAlias = ValueType # noqa: Y015
|
|
43
|
+
|
|
44
|
+
class _ImageTypeEnumTypeWrapper(_enum_type_wrapper._EnumTypeWrapper[Logo._ImageType.ValueType], _builtins.type):
|
|
45
|
+
DESCRIPTOR: _descriptor.EnumDescriptor
|
|
46
|
+
IMAGE: Logo._ImageType.ValueType # 0
|
|
47
|
+
EMOJI: Logo._ImageType.ValueType # 1
|
|
48
|
+
ICON: Logo._ImageType.ValueType # 2
|
|
49
|
+
|
|
50
|
+
class ImageType(_ImageType, metaclass=_ImageTypeEnumTypeWrapper):
|
|
51
|
+
"""Type of the logo image (image file, emoji, or material icon)"""
|
|
52
|
+
|
|
53
|
+
IMAGE: Logo.ImageType.ValueType # 0
|
|
54
|
+
EMOJI: Logo.ImageType.ValueType # 1
|
|
55
|
+
ICON: Logo.ImageType.ValueType # 2
|
|
56
|
+
|
|
39
57
|
IMAGE_FIELD_NUMBER: _builtins.int
|
|
40
58
|
LINK_FIELD_NUMBER: _builtins.int
|
|
41
59
|
ICON_IMAGE_FIELD_NUMBER: _builtins.int
|
|
42
60
|
SIZE_FIELD_NUMBER: _builtins.int
|
|
61
|
+
IMAGE_TYPE_FIELD_NUMBER: _builtins.int
|
|
62
|
+
ICON_IMAGE_TYPE_FIELD_NUMBER: _builtins.int
|
|
43
63
|
image: _builtins.str
|
|
44
64
|
link: _builtins.str
|
|
45
65
|
icon_image: _builtins.str
|
|
46
66
|
size: _builtins.str
|
|
67
|
+
image_type: Global___Logo.ImageType.ValueType
|
|
68
|
+
icon_image_type: Global___Logo.ImageType.ValueType
|
|
47
69
|
def __init__(
|
|
48
70
|
self,
|
|
49
71
|
*,
|
|
@@ -51,8 +73,10 @@ class Logo(_message.Message):
|
|
|
51
73
|
link: _builtins.str = ...,
|
|
52
74
|
icon_image: _builtins.str = ...,
|
|
53
75
|
size: _builtins.str = ...,
|
|
76
|
+
image_type: Global___Logo.ImageType.ValueType = ...,
|
|
77
|
+
icon_image_type: Global___Logo.ImageType.ValueType = ...,
|
|
54
78
|
) -> None: ...
|
|
55
|
-
_ClearFieldArgType: _TypeAlias = _typing.Literal["icon_image", b"icon_image", "image", b"image", "link", b"link", "size", b"size"] # noqa: Y015
|
|
79
|
+
_ClearFieldArgType: _TypeAlias = _typing.Literal["icon_image", b"icon_image", "icon_image_type", b"icon_image_type", "image", b"image", "image_type", b"image_type", "link", b"link", "size", b"size"] # noqa: Y015
|
|
56
80
|
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
|
|
57
81
|
|
|
58
82
|
Global___Logo: _TypeAlias = Logo # noqa: Y015
|
streamlit/proto/Slider_pb2.py
CHANGED
|
@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()
|
|
|
15
15
|
from streamlit.proto import LabelVisibilityMessage_pb2 as streamlit_dot_proto_dot_LabelVisibilityMessage__pb2
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cstreamlit/proto/Slider.proto\x1a,streamlit/proto/LabelVisibilityMessage.proto\"\
|
|
18
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cstreamlit/proto/Slider.proto\x1a,streamlit/proto/LabelVisibilityMessage.proto\"\xd1\x03\n\x06Slider\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07\x66orm_id\x18\x02 \x01(\t\x12\r\n\x05label\x18\x03 \x01(\t\x12\x0e\n\x06\x66ormat\x18\x04 \x01(\t\x12#\n\tdata_type\x18\x05 \x01(\x0e\x32\x10.Slider.DataType\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x06 \x03(\x01\x12\x0b\n\x03min\x18\x07 \x01(\x01\x12\x0b\n\x03max\x18\x08 \x01(\x01\x12\x0c\n\x04step\x18\t \x01(\x01\x12\r\n\x05value\x18\n \x03(\x01\x12\x11\n\tset_value\x18\x0b \x01(\x08\x12\x0f\n\x07options\x18\r \x03(\t\x12\x0c\n\x04help\x18\x0e \x01(\t\x12\x10\n\x08\x64isabled\x18\x0f \x01(\x08\x12\x31\n\x10label_visibility\x18\x10 \x01(\x0b\x32\x17.LabelVisibilityMessage\x12\x1a\n\x04type\x18\x11 \x01(\x0e\x32\x0c.Slider.Type\x12\x11\n\traw_value\x18\x12 \x03(\t\"@\n\x08\x44\x61taType\x12\x07\n\x03INT\x10\x00\x12\t\n\x05\x46LOAT\x10\x01\x12\x0c\n\x08\x44\x41TETIME\x10\x02\x12\x08\n\x04\x44\x41TE\x10\x03\x12\x08\n\x04TIME\x10\x04\"6\n\x04Type\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\n\n\x06SLIDER\x10\x01\x12\x11\n\rSELECT_SLIDER\x10\x02\x42+\n\x1c\x63om.snowflake.apps.streamlitB\x0bSliderProtob\x06proto3')
|
|
19
19
|
|
|
20
20
|
_globals = globals()
|
|
21
21
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
@@ -24,9 +24,9 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
24
24
|
_globals['DESCRIPTOR']._loaded_options = None
|
|
25
25
|
_globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\013SliderProto'
|
|
26
26
|
_globals['_SLIDER']._serialized_start=79
|
|
27
|
-
_globals['_SLIDER']._serialized_end=
|
|
28
|
-
_globals['_SLIDER_DATATYPE']._serialized_start=
|
|
29
|
-
_globals['_SLIDER_DATATYPE']._serialized_end=
|
|
30
|
-
_globals['_SLIDER_TYPE']._serialized_start=
|
|
31
|
-
_globals['_SLIDER_TYPE']._serialized_end=
|
|
27
|
+
_globals['_SLIDER']._serialized_end=544
|
|
28
|
+
_globals['_SLIDER_DATATYPE']._serialized_start=424
|
|
29
|
+
_globals['_SLIDER_DATATYPE']._serialized_end=488
|
|
30
|
+
_globals['_SLIDER_TYPE']._serialized_start=490
|
|
31
|
+
_globals['_SLIDER_TYPE']._serialized_end=544
|
|
32
32
|
# @@protoc_insertion_point(module_scope)
|
streamlit/proto/Slider_pb2.pyi
CHANGED
|
@@ -96,6 +96,7 @@ class Slider(_message.Message):
|
|
|
96
96
|
DISABLED_FIELD_NUMBER: _builtins.int
|
|
97
97
|
LABEL_VISIBILITY_FIELD_NUMBER: _builtins.int
|
|
98
98
|
TYPE_FIELD_NUMBER: _builtins.int
|
|
99
|
+
RAW_VALUE_FIELD_NUMBER: _builtins.int
|
|
99
100
|
id: _builtins.str
|
|
100
101
|
form_id: _builtins.str
|
|
101
102
|
label: _builtins.str
|
|
@@ -116,6 +117,12 @@ class Slider(_message.Message):
|
|
|
116
117
|
def options(self) -> _containers.RepeatedScalarFieldContainer[_builtins.str]: ...
|
|
117
118
|
@_builtins.property
|
|
118
119
|
def label_visibility(self) -> _LabelVisibilityMessage_pb2.LabelVisibilityMessage: ...
|
|
120
|
+
@_builtins.property
|
|
121
|
+
def raw_value(self) -> _containers.RepeatedScalarFieldContainer[_builtins.str]:
|
|
122
|
+
"""String-based value for select_slider to support dynamic option changes.
|
|
123
|
+
Stores formatted option strings instead of indices.
|
|
124
|
+
"""
|
|
125
|
+
|
|
119
126
|
def __init__(
|
|
120
127
|
self,
|
|
121
128
|
*,
|
|
@@ -135,10 +142,11 @@ class Slider(_message.Message):
|
|
|
135
142
|
disabled: _builtins.bool = ...,
|
|
136
143
|
label_visibility: _LabelVisibilityMessage_pb2.LabelVisibilityMessage | None = ...,
|
|
137
144
|
type: Global___Slider.Type.ValueType = ...,
|
|
145
|
+
raw_value: _abc.Iterable[_builtins.str] | None = ...,
|
|
138
146
|
) -> None: ...
|
|
139
147
|
_HasFieldArgType: _TypeAlias = _typing.Literal["label_visibility", b"label_visibility"] # noqa: Y015
|
|
140
148
|
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
|
|
141
|
-
_ClearFieldArgType: _TypeAlias = _typing.Literal["data_type", b"data_type", "default", b"default", "disabled", b"disabled", "form_id", b"form_id", "format", b"format", "help", b"help", "id", b"id", "label", b"label", "label_visibility", b"label_visibility", "max", b"max", "min", b"min", "options", b"options", "set_value", b"set_value", "step", b"step", "type", b"type", "value", b"value"] # noqa: Y015
|
|
149
|
+
_ClearFieldArgType: _TypeAlias = _typing.Literal["data_type", b"data_type", "default", b"default", "disabled", b"disabled", "form_id", b"form_id", "format", b"format", "help", b"help", "id", b"id", "label", b"label", "label_visibility", b"label_visibility", "max", b"max", "min", b"min", "options", b"options", "raw_value", b"raw_value", "set_value", b"set_value", "step", b"step", "type", b"type", "value", b"value"] # noqa: Y015
|
|
142
150
|
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
|
|
143
151
|
|
|
144
152
|
Global___Slider: _TypeAlias = Slider # noqa: Y015
|
|
@@ -528,6 +528,23 @@ class ScriptRunner:
|
|
|
528
528
|
and rerun_data.widget_states.widgets is not None
|
|
529
529
|
):
|
|
530
530
|
widget_ids = {w.id for w in rerun_data.widget_states.widgets}
|
|
531
|
+
|
|
532
|
+
# For MPA page transitions: filter query params BEFORE cleanup.
|
|
533
|
+
# This uses existing bindings to remove params from other pages,
|
|
534
|
+
# ensuring st.query_params is accurate when the new page runs.
|
|
535
|
+
# (st.query_params in user code will reflect the correct params for the new page)
|
|
536
|
+
main_script_hash = self._pages_manager.main_script_hash
|
|
537
|
+
valid_script_hashes = {main_script_hash, page_script_hash}
|
|
538
|
+
with self._session_state.query_params() as qp:
|
|
539
|
+
qp.populate_from_query_string(
|
|
540
|
+
rerun_data.query_string, valid_script_hashes
|
|
541
|
+
)
|
|
542
|
+
# Set initial params from FILTERED state for widget seeding.
|
|
543
|
+
# This prevents stale params from previous pages from seeding
|
|
544
|
+
# widgets on the new page if keys collide.
|
|
545
|
+
qp.set_initial_query_params_from_current()
|
|
546
|
+
|
|
547
|
+
# Now safe to do normal cleanup - filtering already done
|
|
531
548
|
self._session_state.on_script_finished(widget_ids)
|
|
532
549
|
|
|
533
550
|
fragment_ids_this_run: list[str] | None = (
|
|
@@ -24,7 +24,6 @@ from typing import (
|
|
|
24
24
|
Final,
|
|
25
25
|
TypeAlias,
|
|
26
26
|
)
|
|
27
|
-
from urllib import parse
|
|
28
27
|
|
|
29
28
|
from streamlit.errors import (
|
|
30
29
|
NoSessionContext,
|
|
@@ -142,6 +141,9 @@ class ScriptRunContext:
|
|
|
142
141
|
cached_message_hashes: set[str] | None = None,
|
|
143
142
|
context_info: ContextInfo | None = None,
|
|
144
143
|
) -> None:
|
|
144
|
+
# Check if this is a same-page rerun BEFORE updating page_script_hash
|
|
145
|
+
is_same_page = self.page_script_hash == page_script_hash
|
|
146
|
+
|
|
145
147
|
self.cursors = {}
|
|
146
148
|
self.widget_ids_this_run = set()
|
|
147
149
|
self.widget_user_keys_this_run = set()
|
|
@@ -163,16 +165,17 @@ class ScriptRunContext:
|
|
|
163
165
|
|
|
164
166
|
in_cached_function.set(False)
|
|
165
167
|
|
|
166
|
-
parsed_query_params = parse.parse_qs(query_string, keep_blank_values=True)
|
|
167
168
|
with self.session_state.query_params() as qp:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
169
|
+
# For same-page reruns (widget interactions), populate _query_params from URL
|
|
170
|
+
# and set initial params for widget seeding.
|
|
171
|
+
# For page transitions, both populate_from_query_string() AND
|
|
172
|
+
# set_initial_query_params_from_current() are called in script_runner.py
|
|
173
|
+
# BEFORE reset() to ensure filtering is applied to both _query_params
|
|
174
|
+
# AND _initial_query_params, preventing stale params from previous pages
|
|
175
|
+
# from seeding widgets on the new page.
|
|
176
|
+
if is_same_page:
|
|
177
|
+
qp.set_initial_query_params(query_string)
|
|
178
|
+
qp.populate_from_query_string(query_string)
|
|
176
179
|
|
|
177
180
|
def on_script_start(self) -> None:
|
|
178
181
|
self._has_script_started = True
|
|
@@ -12,7 +12,12 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
from streamlit.runtime.state.common import
|
|
15
|
+
from streamlit.runtime.state.common import (
|
|
16
|
+
BindOption,
|
|
17
|
+
WidgetArgs,
|
|
18
|
+
WidgetCallback,
|
|
19
|
+
WidgetKwargs,
|
|
20
|
+
)
|
|
16
21
|
from streamlit.runtime.state.query_params_proxy import QueryParamsProxy
|
|
17
22
|
from streamlit.runtime.state.safe_session_state import SafeSessionState
|
|
18
23
|
from streamlit.runtime.state.session_state import (
|
|
@@ -28,6 +33,7 @@ from streamlit.runtime.state.widgets import register_widget
|
|
|
28
33
|
|
|
29
34
|
__all__ = [
|
|
30
35
|
"SCRIPT_RUN_WITHOUT_ERRORS_KEY",
|
|
36
|
+
"BindOption",
|
|
31
37
|
"QueryParamsProxy",
|
|
32
38
|
"SafeSessionState",
|
|
33
39
|
"SessionState",
|
|
@@ -51,6 +51,10 @@ WidgetArgs: TypeAlias = tuple[Any, ...] | list[Any]
|
|
|
51
51
|
WidgetKwargs: TypeAlias = dict[str, Any]
|
|
52
52
|
WidgetCallback: TypeAlias = Callable[..., None]
|
|
53
53
|
|
|
54
|
+
# Type for the bind parameter on widgets
|
|
55
|
+
# Currently only supports binding to query params
|
|
56
|
+
BindOption: TypeAlias = Literal["query-params"] | None
|
|
57
|
+
|
|
54
58
|
# A deserializer receives the value from whatever field is set on the
|
|
55
59
|
# WidgetState proto, and returns a regular python value. A serializer
|
|
56
60
|
# receives a regular python value, and returns something suitable for
|
|
@@ -147,6 +151,15 @@ class WidgetMetadata(Generic[T]):
|
|
|
147
151
|
# multiple internal widget states.
|
|
148
152
|
presenter: WidgetValuePresenter | None = None
|
|
149
153
|
|
|
154
|
+
# Optional binding for the widget's value to external state (e.g. query params)
|
|
155
|
+
bind: BindOption = None
|
|
156
|
+
|
|
157
|
+
# TODO(query-params): Remove formatted_options once all selection widgets use
|
|
158
|
+
# string-based wire formats (string_value/string_array_value).
|
|
159
|
+
# Currently used for query param binding to convert indices back to human-readable
|
|
160
|
+
# option strings in URLs when auto-correcting filtered values.
|
|
161
|
+
formatted_options: list[str] | None = None
|
|
162
|
+
|
|
150
163
|
def __repr__(self) -> str:
|
|
151
164
|
return util.repr_(self)
|
|
152
165
|
|