streamlit-nightly 1.45.2.dev20250602__py3-none-any.whl → 1.45.2.dev20250605__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/config.py +56 -26
- streamlit/config_option.py +4 -2
- streamlit/elements/arrow.py +2 -4
- streamlit/elements/deck_gl_json_chart.py +1 -1
- streamlit/elements/heading.py +32 -0
- streamlit/elements/metric.py +11 -1
- streamlit/elements/plotly_chart.py +1 -1
- streamlit/elements/text.py +13 -1
- streamlit/elements/vega_charts.py +27 -2
- streamlit/elements/widgets/checkbox.py +23 -1
- streamlit/elements/widgets/color_picker.py +20 -1
- streamlit/file_util.py +14 -0
- streamlit/proto/ClientState_pb2.py +4 -4
- streamlit/proto/ClientState_pb2.pyi +7 -2
- streamlit/proto/NewSession_pb2.py +16 -16
- streamlit/proto/NewSession_pb2.pyi +7 -2
- streamlit/runtime/context.py +33 -1
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +214 -214
- streamlit/static/static/js/{ErrorOutline.esm.D5NgCh5m.js → ErrorOutline.esm.tNLvotRM.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.NuObx1Tl.js → FileDownload.esm.C_4VXOrN.js} +1 -1
- streamlit/static/static/js/{FileHelper.BH7o4_P9.js → FileHelper.60q2rqnv.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.BAxB8JFY.js → FormClearHelper.NJdi-ZLd.js} +1 -1
- streamlit/static/static/js/{Hooks.Bjt8oBOT.js → Hooks.CaYtegs-.js} +1 -1
- streamlit/static/static/js/{InputInstructions.BZZLp6t9.js → InputInstructions.WOkLURYg.js} +1 -1
- streamlit/static/static/js/{ProgressBar.BwRgGfI0.js → ProgressBar.C8qv5JmE.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.C_c286r8.js → RenderInPortalIfExists.tUlEGlzo.js} +1 -1
- streamlit/static/static/js/{Toolbar.5tXjF_eX.js → Toolbar.CMYJPS_Q.js} +1 -1
- streamlit/static/static/js/{base-input.wfBDFTlB.js → base-input.DFrC09vO.js} +1 -1
- streamlit/static/static/js/{checkbox.D1GhNngU.js → checkbox.BnwpL_LT.js} +1 -1
- streamlit/static/static/js/{createSuper.CudEEVs2.js → createSuper.NiynzP3k.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.DUTI_Rbg.js → data-grid-overlay-editor.CYEI83P5.js} +1 -1
- streamlit/static/static/js/{downloader.BwLpAoXN.js → downloader.9Wy4dgxg.js} +1 -1
- streamlit/static/static/js/{es6.B_HLnUb9.js → es6.JGDen1xD.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.BNcjOcan.js → iframeResizer.contentWindow.nFuzbEci.js} +1 -1
- streamlit/static/static/js/{index.DA7wmIe4.js → index.3h_mMb74.js} +1 -1
- streamlit/static/static/js/{index.jyqBAhvH.js → index.5Z_KRF3q.js} +1 -1
- streamlit/static/static/js/{index.D3wYqvI6.js → index.91OyW-Gr.js} +1 -1
- streamlit/static/static/js/{index.flyQEkeT.js → index.B7S_H7I8.js} +1 -1
- streamlit/static/static/js/{index.BJQPxOFd.js → index.BBDrA2tn.js} +1 -1
- streamlit/static/static/js/{index.B4PbMsBe.js → index.BFYl-rZt.js} +1 -1
- streamlit/static/static/js/{index.PR2mcvVR.js → index.BNZGa4XA.js} +1 -1
- streamlit/static/static/js/{index.D8i27llu.js → index.BRvAGIBI.js} +1 -1
- streamlit/static/static/js/{index.BkvVxUIW.js → index.BfYf3Wpe.js} +1 -1
- streamlit/static/static/js/{index.CxtkoiKl.js → index.Bj3saWDN.js} +1 -1
- streamlit/static/static/js/{index.Bj6uLiaA.js → index.BtrjwWEk.js} +1 -1
- streamlit/static/static/js/{index.Ca-9xoC2.js → index.C064I556.js} +1 -1
- streamlit/static/static/js/{index.CfzaRR6P.js → index.C37654wn.js} +1 -1
- streamlit/static/static/js/{index.df4uuSoD.js → index.C4zPKjq1.js} +1 -1
- streamlit/static/static/js/{index.BPGAPI9w.js → index.CBPqvzle.js} +1 -1
- streamlit/static/static/js/{index.CL0UH4WF.js → index.CIqU--y_.js} +1 -1
- streamlit/static/static/js/{index.Cf8KcH2X.js → index.CRliFDNK.js} +1 -1
- streamlit/static/static/js/{index.B0h616Th.js → index.CX-fCNEA.js} +1 -1
- streamlit/static/static/js/{index.NveskZ7j.js → index.C_U6DmFf.js} +1 -1
- streamlit/static/static/js/{index.BtpsTdHN.js → index.CgzkiPeB.js} +76 -76
- streamlit/static/static/js/{index.BGKVW2u9.js → index.Chouo5Qe.js} +1 -1
- streamlit/static/static/js/{index.DNR4wKJg.js → index.CsrXF9Cj.js} +1 -1
- streamlit/static/static/js/{index.sYLAHlH0.js → index.DM5GB-cu.js} +1 -1
- streamlit/static/static/js/{index.B3vWaIrN.js → index.DOOJNTFS.js} +1 -1
- streamlit/static/static/js/{index.CXP5ffxh.js → index.DOmrs5iq.js} +1 -1
- streamlit/static/static/js/{index.B0paBg5x.js → index.DQLD-hJX.js} +1 -1
- streamlit/static/static/js/{index.DIG9Mo9J.js → index.DdiZdMRx.js} +1 -1
- streamlit/static/static/js/{index.BOHEcsVb.js → index.DlPy-f9y.js} +1 -1
- streamlit/static/static/js/{index.CjRwuAdg.js → index.DsBk6ofW.js} +1 -1
- streamlit/static/static/js/{index.C1GNiWbH.js → index.DwohHcrt.js} +1 -1
- streamlit/static/static/js/{index.iF9jUtwl.js → index.FqXTo5A0.js} +1 -1
- streamlit/static/static/js/{index.3WJoJFGb.js → index.OVkzDHNi.js} +1 -1
- streamlit/static/static/js/{index.DNS8a-dx.js → index.fuysp8C5.js} +26 -26
- streamlit/static/static/js/{index.Cdd7Ri21.js → index.o3iaAZx6.js} +25 -25
- streamlit/static/static/js/{index.Bs0m0eUy.js → index.ttXUdWmg.js} +1 -1
- streamlit/static/static/js/{index.zq3LdRhj.js → index.yBwY5kh0.js} +1 -1
- streamlit/static/static/js/{index.CkOUlPYT.js → index.yUKivH8E.js} +1 -1
- streamlit/static/static/js/{input.CtZjQ6Pv.js → input.Bfr-6m-t.js} +1 -1
- streamlit/static/static/js/{memory.Ddl3R0up.js → memory.Dbw4SfUa.js} +1 -1
- streamlit/static/static/js/{mergeWith.D-TqDY0-.js → mergeWith.moXRXMIt.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.Dndf05Hx.js → number-overlay-editor.xIeRsh_h.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DNEY6J9G.js → possibleConstructorReturn.BpF6cUQr.js} +1 -1
- streamlit/static/static/js/{sandbox.B_XDPkfx.js → sandbox.CD6NZtqo.js} +1 -1
- streamlit/static/static/js/{textarea.BZ9lTMhV.js → textarea.45gncRdV.js} +1 -1
- streamlit/static/static/js/{timepicker.D9UUwpRT.js → timepicker.T96XABz2.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.DNJjbOUS.js → toConsumableArray.De5UEugE.js} +1 -1
- streamlit/static/static/js/{uniqueId.psBJ_tSg.js → uniqueId.sYiuwCOd.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.CTpx4w-3.js → useBasicWidgetState.BdPzYDh_.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.WKTDSC4O.js → useOnInputChange.B9Jrbmab.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.oyWCn2-3.js → withFullScreenWrapper.BJVHzNAl.js} +1 -1
- streamlit/util.py +24 -0
- streamlit/web/bootstrap.py +2 -2
- streamlit/web/cli.py +8 -5
- streamlit/web/server/server.py +0 -12
- streamlit/web/server/server_util.py +1 -1
- {streamlit_nightly-1.45.2.dev20250602.dist-info → streamlit_nightly-1.45.2.dev20250605.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.45.2.dev20250602.dist-info → streamlit_nightly-1.45.2.dev20250605.dist-info}/RECORD +96 -97
- streamlit/elements/lib/event_utils.py +0 -39
- {streamlit_nightly-1.45.2.dev20250602.data → streamlit_nightly-1.45.2.dev20250605.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.45.2.dev20250602.dist-info → streamlit_nightly-1.45.2.dev20250605.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.45.2.dev20250602.dist-info → streamlit_nightly-1.45.2.dev20250605.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.45.2.dev20250602.dist-info → streamlit_nightly-1.45.2.dev20250605.dist-info}/top_level.txt +0 -0
@@ -20,6 +20,11 @@ from textwrap import dedent
|
|
20
20
|
from typing import TYPE_CHECKING, cast
|
21
21
|
|
22
22
|
from streamlit.elements.lib.form_utils import current_form_id
|
23
|
+
from streamlit.elements.lib.layout_utils import (
|
24
|
+
LayoutConfig,
|
25
|
+
Width,
|
26
|
+
validate_width,
|
27
|
+
)
|
23
28
|
from streamlit.elements.lib.policies import (
|
24
29
|
check_widget_policies,
|
25
30
|
maybe_raise_label_warnings,
|
@@ -71,6 +76,7 @@ class ColorPickerMixin:
|
|
71
76
|
*, # keyword-only arguments:
|
72
77
|
disabled: bool = False,
|
73
78
|
label_visibility: LabelVisibility = "visible",
|
79
|
+
width: Width = "content",
|
74
80
|
) -> str:
|
75
81
|
r"""Display a color picker widget.
|
76
82
|
|
@@ -136,6 +142,11 @@ class ColorPickerMixin:
|
|
136
142
|
label, which can help keep the widget aligned with other widgets.
|
137
143
|
If this is ``"collapsed"``, Streamlit displays no label or spacer.
|
138
144
|
|
145
|
+
width : int or "stretch" or "content"
|
146
|
+
The width of the color picker. Can be an integer (pixels),
|
147
|
+
"stretch" to use the full width of the container, or "content"
|
148
|
+
(default) to size based on the content.
|
149
|
+
|
139
150
|
Returns
|
140
151
|
-------
|
141
152
|
str
|
@@ -164,6 +175,7 @@ class ColorPickerMixin:
|
|
164
175
|
kwargs=kwargs,
|
165
176
|
disabled=disabled,
|
166
177
|
label_visibility=label_visibility,
|
178
|
+
width=width,
|
167
179
|
ctx=ctx,
|
168
180
|
)
|
169
181
|
|
@@ -179,6 +191,7 @@ class ColorPickerMixin:
|
|
179
191
|
*, # keyword-only arguments:
|
180
192
|
disabled: bool = False,
|
181
193
|
label_visibility: LabelVisibility = "visible",
|
194
|
+
width: Width = "content",
|
182
195
|
ctx: ScriptRunContext | None = None,
|
183
196
|
) -> str:
|
184
197
|
key = to_key(key)
|
@@ -191,6 +204,9 @@ class ColorPickerMixin:
|
|
191
204
|
)
|
192
205
|
maybe_raise_label_warnings(label, label_visibility)
|
193
206
|
|
207
|
+
validate_width(width, allow_content=True)
|
208
|
+
layout_config = LayoutConfig(width=width)
|
209
|
+
|
194
210
|
element_id = compute_and_register_element_id(
|
195
211
|
"color_picker",
|
196
212
|
user_key=key,
|
@@ -199,6 +215,7 @@ class ColorPickerMixin:
|
|
199
215
|
label=label,
|
200
216
|
value=str(value),
|
201
217
|
help=help,
|
218
|
+
width=width,
|
202
219
|
)
|
203
220
|
|
204
221
|
# set value default
|
@@ -251,7 +268,9 @@ like '#00FFAA' or '#000'.
|
|
251
268
|
color_picker_proto.value = widget_state.value
|
252
269
|
color_picker_proto.set_value = True
|
253
270
|
|
254
|
-
self.dg._enqueue(
|
271
|
+
self.dg._enqueue(
|
272
|
+
"color_picker", color_picker_proto, layout_config=layout_config
|
273
|
+
)
|
255
274
|
return widget_state.value
|
256
275
|
|
257
276
|
@property
|
streamlit/file_util.py
CHANGED
@@ -156,6 +156,20 @@ def get_project_streamlit_file_path(*filepath: str) -> str:
|
|
156
156
|
return str(Path.cwd() / CONFIG_FOLDER_NAME / Path(*filepath))
|
157
157
|
|
158
158
|
|
159
|
+
def get_main_script_streamlit_file_path(main_script_path: str, filename: str) -> str:
|
160
|
+
"""Return the full path to a file in the .streamlit folder relative to the
|
161
|
+
main script's path.
|
162
|
+
|
163
|
+
This doesn't guarantee that the file (or its directory) exists.
|
164
|
+
"""
|
165
|
+
|
166
|
+
return str(
|
167
|
+
Path(os.path.abspath(os.path.dirname(main_script_path)))
|
168
|
+
/ CONFIG_FOLDER_NAME
|
169
|
+
/ filename
|
170
|
+
)
|
171
|
+
|
172
|
+
|
159
173
|
def file_is_in_folder_glob(filepath: str, folderpath_glob: str) -> bool:
|
160
174
|
"""Test whether a file is in some folder with globbing support.
|
161
175
|
|
@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()
|
|
15
15
|
from streamlit.proto import WidgetStates_pb2 as streamlit_dot_proto_dot_WidgetStates__pb2
|
16
16
|
|
17
17
|
|
18
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!streamlit/proto/ClientState.proto\x1a\"streamlit/proto/WidgetStates.proto\"\
|
18
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!streamlit/proto/ClientState.proto\x1a\"streamlit/proto/WidgetStates.proto\"\xf3\x01\n\x0b\x43ontextInfo\x12\x15\n\x08timezone\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1c\n\x0ftimezone_offset\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x13\n\x06locale\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x10\n\x03url\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x18\n\x0bis_embedded\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x19\n\x0c\x63olor_scheme\x18\x06 \x01(\tH\x05\x88\x01\x01\x42\x0b\n\t_timezoneB\x12\n\x10_timezone_offsetB\t\n\x07_localeB\x06\n\x04_urlB\x0e\n\x0c_is_embeddedB\x0f\n\r_color_scheme\"\xe5\x01\n\x0b\x43lientState\x12\x14\n\x0cquery_string\x18\x01 \x01(\t\x12$\n\rwidget_states\x18\x02 \x01(\x0b\x32\r.WidgetStates\x12\x18\n\x10page_script_hash\x18\x03 \x01(\t\x12\x11\n\tpage_name\x18\x04 \x01(\t\x12\x13\n\x0b\x66ragment_id\x18\x05 \x01(\t\x12\x15\n\ris_auto_rerun\x18\x06 \x01(\x08\x12\x1d\n\x15\x63\x61\x63hed_message_hashes\x18\x07 \x03(\t\x12\"\n\x0c\x63ontext_info\x18\x08 \x01(\x0b\x32\x0c.ContextInfoB0\n\x1c\x63om.snowflake.apps.streamlitB\x10\x43lientStateProtob\x06proto3')
|
19
19
|
|
20
20
|
_globals = globals()
|
21
21
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
@@ -24,7 +24,7 @@ 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\020ClientStateProto'
|
26
26
|
_globals['_CONTEXTINFO']._serialized_start=74
|
27
|
-
_globals['_CONTEXTINFO']._serialized_end=
|
28
|
-
_globals['_CLIENTSTATE']._serialized_start=
|
29
|
-
_globals['_CLIENTSTATE']._serialized_end=
|
27
|
+
_globals['_CONTEXTINFO']._serialized_end=317
|
28
|
+
_globals['_CLIENTSTATE']._serialized_start=320
|
29
|
+
_globals['_CLIENTSTATE']._serialized_end=549
|
30
30
|
# @@protoc_insertion_point(module_scope)
|
@@ -36,11 +36,13 @@ class ContextInfo(google.protobuf.message.Message):
|
|
36
36
|
LOCALE_FIELD_NUMBER: builtins.int
|
37
37
|
URL_FIELD_NUMBER: builtins.int
|
38
38
|
IS_EMBEDDED_FIELD_NUMBER: builtins.int
|
39
|
+
COLOR_SCHEME_FIELD_NUMBER: builtins.int
|
39
40
|
timezone: builtins.str
|
40
41
|
timezone_offset: builtins.int
|
41
42
|
locale: builtins.str
|
42
43
|
url: builtins.str
|
43
44
|
is_embedded: builtins.bool
|
45
|
+
color_scheme: builtins.str
|
44
46
|
def __init__(
|
45
47
|
self,
|
46
48
|
*,
|
@@ -49,9 +51,12 @@ class ContextInfo(google.protobuf.message.Message):
|
|
49
51
|
locale: builtins.str | None = ...,
|
50
52
|
url: builtins.str | None = ...,
|
51
53
|
is_embedded: builtins.bool | None = ...,
|
54
|
+
color_scheme: builtins.str | None = ...,
|
52
55
|
) -> None: ...
|
53
|
-
def HasField(self, field_name: typing.Literal["_is_embedded", b"_is_embedded", "_locale", b"_locale", "_timezone", b"_timezone", "_timezone_offset", b"_timezone_offset", "_url", b"_url", "is_embedded", b"is_embedded", "locale", b"locale", "timezone", b"timezone", "timezone_offset", b"timezone_offset", "url", b"url"]) -> builtins.bool: ...
|
54
|
-
def ClearField(self, field_name: typing.Literal["_is_embedded", b"_is_embedded", "_locale", b"_locale", "_timezone", b"_timezone", "_timezone_offset", b"_timezone_offset", "_url", b"_url", "is_embedded", b"is_embedded", "locale", b"locale", "timezone", b"timezone", "timezone_offset", b"timezone_offset", "url", b"url"]) -> None: ...
|
56
|
+
def HasField(self, field_name: typing.Literal["_color_scheme", b"_color_scheme", "_is_embedded", b"_is_embedded", "_locale", b"_locale", "_timezone", b"_timezone", "_timezone_offset", b"_timezone_offset", "_url", b"_url", "color_scheme", b"color_scheme", "is_embedded", b"is_embedded", "locale", b"locale", "timezone", b"timezone", "timezone_offset", b"timezone_offset", "url", b"url"]) -> builtins.bool: ...
|
57
|
+
def ClearField(self, field_name: typing.Literal["_color_scheme", b"_color_scheme", "_is_embedded", b"_is_embedded", "_locale", b"_locale", "_timezone", b"_timezone", "_timezone_offset", b"_timezone_offset", "_url", b"_url", "color_scheme", b"color_scheme", "is_embedded", b"is_embedded", "locale", b"locale", "timezone", b"timezone", "timezone_offset", b"timezone_offset", "url", b"url"]) -> None: ...
|
58
|
+
@typing.overload
|
59
|
+
def WhichOneof(self, oneof_group: typing.Literal["_color_scheme", b"_color_scheme"]) -> typing.Literal["color_scheme"] | None: ...
|
55
60
|
@typing.overload
|
56
61
|
def WhichOneof(self, oneof_group: typing.Literal["_is_embedded", b"_is_embedded"]) -> typing.Literal["is_embedded"] | None: ...
|
57
62
|
@typing.overload
|
@@ -16,7 +16,7 @@ from streamlit.proto import AppPage_pb2 as streamlit_dot_proto_dot_AppPage__pb2
|
|
16
16
|
from streamlit.proto import SessionStatus_pb2 as streamlit_dot_proto_dot_SessionStatus__pb2
|
17
17
|
|
18
18
|
|
19
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n streamlit/proto/NewSession.proto\x1a\x1dstreamlit/proto/AppPage.proto\x1a#streamlit/proto/SessionStatus.proto\"\xa5\x02\n\nNewSession\x12\x1f\n\ninitialize\x18\x01 \x01(\x0b\x32\x0b.Initialize\x12\x15\n\rscript_run_id\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x18\n\x10main_script_path\x18\x04 \x01(\t\x12\x17\n\x06\x63onfig\x18\x06 \x01(\x0b\x32\x07.Config\x12(\n\x0c\x63ustom_theme\x18\x07 \x01(\x0b\x32\x12.CustomThemeConfig\x12\x1b\n\tapp_pages\x18\x08 \x03(\x0b\x32\x08.AppPage\x12\x18\n\x10page_script_hash\x18\t \x01(\t\x12\x1d\n\x15\x66ragment_ids_this_run\x18\n \x03(\t\x12\x18\n\x10main_script_hash\x18\x0b \x01(\tJ\x04\x08\x05\x10\x06\"\xba\x01\n\nInitialize\x12\x1c\n\tuser_info\x18\x01 \x01(\x0b\x32\t.UserInfo\x12*\n\x10\x65nvironment_info\x18\x03 \x01(\x0b\x32\x10.EnvironmentInfo\x12&\n\x0esession_status\x18\x04 \x01(\x0b\x32\x0e.SessionStatus\x12\x14\n\x0c\x63ommand_line\x18\x05 \x01(\t\x12\x12\n\nsession_id\x18\x06 \x01(\t\x12\x10\n\x08is_hello\x18\x07 \x01(\x08\"\x97\x02\n\x06\x43onfig\x12\x1a\n\x12gather_usage_stats\x18\x02 \x01(\x08\x12\x1e\n\x16max_cached_message_age\x18\x03 \x01(\x05\x12\x14\n\x0cmapbox_token\x18\x04 \x01(\t\x12\x19\n\x11\x61llow_run_on_save\x18\x05 \x01(\x08\x12\x14\n\x0chide_top_bar\x18\x06 \x01(\x08\x12\x18\n\x10hide_sidebar_nav\x18\x07 \x01(\x08\x12)\n\x0ctoolbar_mode\x18\x08 \x01(\x0e\x32\x13.Config.ToolbarMode\"?\n\x0bToolbarMode\x12\x08\n\x04\x41UTO\x10\x00\x12\r\n\tDEVELOPER\x10\x01\x12\n\n\x06VIEWER\x10\x02\x12\x0b\n\x07MINIMAL\x10\x03J\x04\x08\x01\x10\x02\"\
|
19
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n streamlit/proto/NewSession.proto\x1a\x1dstreamlit/proto/AppPage.proto\x1a#streamlit/proto/SessionStatus.proto\"\xa5\x02\n\nNewSession\x12\x1f\n\ninitialize\x18\x01 \x01(\x0b\x32\x0b.Initialize\x12\x15\n\rscript_run_id\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x18\n\x10main_script_path\x18\x04 \x01(\t\x12\x17\n\x06\x63onfig\x18\x06 \x01(\x0b\x32\x07.Config\x12(\n\x0c\x63ustom_theme\x18\x07 \x01(\x0b\x32\x12.CustomThemeConfig\x12\x1b\n\tapp_pages\x18\x08 \x03(\x0b\x32\x08.AppPage\x12\x18\n\x10page_script_hash\x18\t \x01(\t\x12\x1d\n\x15\x66ragment_ids_this_run\x18\n \x03(\t\x12\x18\n\x10main_script_hash\x18\x0b \x01(\tJ\x04\x08\x05\x10\x06\"\xba\x01\n\nInitialize\x12\x1c\n\tuser_info\x18\x01 \x01(\x0b\x32\t.UserInfo\x12*\n\x10\x65nvironment_info\x18\x03 \x01(\x0b\x32\x10.EnvironmentInfo\x12&\n\x0esession_status\x18\x04 \x01(\x0b\x32\x0e.SessionStatus\x12\x14\n\x0c\x63ommand_line\x18\x05 \x01(\t\x12\x12\n\nsession_id\x18\x06 \x01(\t\x12\x10\n\x08is_hello\x18\x07 \x01(\x08\"\x97\x02\n\x06\x43onfig\x12\x1a\n\x12gather_usage_stats\x18\x02 \x01(\x08\x12\x1e\n\x16max_cached_message_age\x18\x03 \x01(\x05\x12\x14\n\x0cmapbox_token\x18\x04 \x01(\t\x12\x19\n\x11\x61llow_run_on_save\x18\x05 \x01(\x08\x12\x14\n\x0chide_top_bar\x18\x06 \x01(\x08\x12\x18\n\x10hide_sidebar_nav\x18\x07 \x01(\x08\x12)\n\x0ctoolbar_mode\x18\x08 \x01(\x0e\x32\x13.Config.ToolbarMode\"?\n\x0bToolbarMode\x12\x08\n\x04\x41UTO\x10\x00\x12\r\n\tDEVELOPER\x10\x01\x12\n\n\x06VIEWER\x10\x02\x12\x0b\n\x07MINIMAL\x10\x03J\x04\x08\x01\x10\x02\"\xa4\x08\n\x11\x43ustomThemeConfig\x12\x15\n\rprimary_color\x18\x01 \x01(\t\x12\"\n\x1asecondary_background_color\x18\x02 \x01(\t\x12\x18\n\x10\x62\x61\x63kground_color\x18\x03 \x01(\t\x12\x12\n\ntext_color\x18\x04 \x01(\t\x12+\n\x04\x66ont\x18\x05 \x01(\x0e\x32\x1d.CustomThemeConfig.FontFamily\x12*\n\x04\x62\x61se\x18\x06 \x01(\x0e\x32\x1c.CustomThemeConfig.BaseTheme\x12\x1f\n\x17widget_background_color\x18\x07 \x01(\t\x12\x1b\n\x13widget_border_color\x18\x08 \x01(\t\x12\x15\n\x05radii\x18\t \x01(\x0b\x32\x06.Radii\x12\x14\n\x0cheading_font\x18\x0c \x01(\t\x12\x11\n\tbody_font\x18\r \x01(\t\x12\x11\n\tcode_font\x18\x0e \x01(\t\x12\x1d\n\nfont_faces\x18\x0f \x03(\x0b\x32\t.FontFace\x12\x1e\n\nfont_sizes\x18\x10 \x01(\x0b\x32\n.FontSizes\x12!\n\x19skeleton_background_color\x18\x11 \x01(\t\x12\x18\n\x0b\x62\x61se_radius\x18\x12 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rbutton_radius\x18\x1a \x01(\tH\x01\x88\x01\x01\x12\x19\n\x0c\x62order_color\x18\x13 \x01(\tH\x02\x88\x01\x01\x12#\n\x16\x64\x61taframe_border_color\x18\x1b \x01(\tH\x03\x88\x01\x01\x12\x1f\n\x12show_widget_border\x18\x14 \x01(\x08H\x04\x88\x01\x01\x12\x17\n\nlink_color\x18\x15 \x01(\tH\x05\x88\x01\x01\x12\x1b\n\x0e\x62\x61se_font_size\x18\x16 \x01(\x05H\x06\x88\x01\x01\x12 \n\x13show_sidebar_border\x18\x17 \x01(\x08H\x07\x88\x01\x01\x12(\n\x07sidebar\x18\x18 \x01(\x0b\x32\x12.CustomThemeConfigH\x08\x88\x01\x01\x12\"\n\x15\x63ode_background_color\x18\x19 \x01(\tH\t\x88\x01\x01\" \n\tBaseTheme\x12\t\n\x05LIGHT\x10\x00\x12\x08\n\x04\x44\x41RK\x10\x01\"6\n\nFontFamily\x12\x0e\n\nSANS_SERIF\x10\x00\x12\t\n\x05SERIF\x10\x01\x12\r\n\tMONOSPACE\x10\x02\x42\x0e\n\x0c_base_radiusB\x10\n\x0e_button_radiusB\x0f\n\r_border_colorB\x19\n\x17_dataframe_border_colorB\x15\n\x13_show_widget_borderB\r\n\x0b_link_colorB\x11\n\x0f_base_font_sizeB\x16\n\x14_show_sidebar_borderB\n\n\x08_sidebarB\x18\n\x16_code_background_color\"F\n\x08\x46ontFace\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x0e\n\x06\x66\x61mily\x18\x02 \x01(\t\x12\x0e\n\x06weight\x18\x03 \x01(\x05\x12\r\n\x05style\x18\x04 \x01(\t\"<\n\x05Radii\x12\x1a\n\x12\x62\x61se_widget_radius\x18\x01 \x01(\x05\x12\x17\n\x0f\x63heckbox_radius\x18\x02 \x01(\x05\"T\n\tFontSizes\x12\x16\n\x0etiny_font_size\x18\x01 \x01(\x05\x12\x17\n\x0fsmall_font_size\x18\x02 \x01(\x05\x12\x16\n\x0e\x62\x61se_font_size\x18\x03 \x01(\x05\"a\n\x08UserInfo\x12\x17\n\x0finstallation_id\x18\x01 \x01(\t\x12\x1a\n\x12installation_id_v3\x18\x05 \x01(\t\x12\x1a\n\x12installation_id_v4\x18\x06 \x01(\tJ\x04\x08\x02\x10\x03\"l\n\x0f\x45nvironmentInfo\x12\x19\n\x11streamlit_version\x18\x01 \x01(\t\x12\x16\n\x0epython_version\x18\x02 \x01(\t\x12\x11\n\tserver_os\x18\x03 \x01(\t\x12\x13\n\x0bhas_display\x18\x04 \x01(\x08\x42/\n\x1c\x63om.snowflake.apps.streamlitB\x0fNewSessionProtob\x06proto3')
|
20
20
|
|
21
21
|
_globals = globals()
|
22
22
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
@@ -33,19 +33,19 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
33
|
_globals['_CONFIG_TOOLBARMODE']._serialized_start=800
|
34
34
|
_globals['_CONFIG_TOOLBARMODE']._serialized_end=863
|
35
35
|
_globals['_CUSTOMTHEMECONFIG']._serialized_start=872
|
36
|
-
_globals['_CUSTOMTHEMECONFIG']._serialized_end=
|
37
|
-
_globals['_CUSTOMTHEMECONFIG_BASETHEME']._serialized_start=
|
38
|
-
_globals['_CUSTOMTHEMECONFIG_BASETHEME']._serialized_end=
|
39
|
-
_globals['_CUSTOMTHEMECONFIG_FONTFAMILY']._serialized_start=
|
40
|
-
_globals['_CUSTOMTHEMECONFIG_FONTFAMILY']._serialized_end=
|
41
|
-
_globals['_FONTFACE']._serialized_start=
|
42
|
-
_globals['_FONTFACE']._serialized_end=
|
43
|
-
_globals['_RADII']._serialized_start=
|
44
|
-
_globals['_RADII']._serialized_end=
|
45
|
-
_globals['_FONTSIZES']._serialized_start=
|
46
|
-
_globals['_FONTSIZES']._serialized_end=
|
47
|
-
_globals['_USERINFO']._serialized_start=
|
48
|
-
_globals['_USERINFO']._serialized_end=
|
49
|
-
_globals['_ENVIRONMENTINFO']._serialized_start=
|
50
|
-
_globals['_ENVIRONMENTINFO']._serialized_end=
|
36
|
+
_globals['_CUSTOMTHEMECONFIG']._serialized_end=1932
|
37
|
+
_globals['_CUSTOMTHEMECONFIG_BASETHEME']._serialized_start=1647
|
38
|
+
_globals['_CUSTOMTHEMECONFIG_BASETHEME']._serialized_end=1679
|
39
|
+
_globals['_CUSTOMTHEMECONFIG_FONTFAMILY']._serialized_start=1681
|
40
|
+
_globals['_CUSTOMTHEMECONFIG_FONTFAMILY']._serialized_end=1735
|
41
|
+
_globals['_FONTFACE']._serialized_start=1934
|
42
|
+
_globals['_FONTFACE']._serialized_end=2004
|
43
|
+
_globals['_RADII']._serialized_start=2006
|
44
|
+
_globals['_RADII']._serialized_end=2066
|
45
|
+
_globals['_FONTSIZES']._serialized_start=2068
|
46
|
+
_globals['_FONTSIZES']._serialized_end=2152
|
47
|
+
_globals['_USERINFO']._serialized_start=2154
|
48
|
+
_globals['_USERINFO']._serialized_end=2251
|
49
|
+
_globals['_ENVIRONMENTINFO']._serialized_start=2253
|
50
|
+
_globals['_ENVIRONMENTINFO']._serialized_end=2361
|
51
51
|
# @@protoc_insertion_point(module_scope)
|
@@ -287,6 +287,7 @@ class CustomThemeConfig(google.protobuf.message.Message):
|
|
287
287
|
BASE_RADIUS_FIELD_NUMBER: builtins.int
|
288
288
|
BUTTON_RADIUS_FIELD_NUMBER: builtins.int
|
289
289
|
BORDER_COLOR_FIELD_NUMBER: builtins.int
|
290
|
+
DATAFRAME_BORDER_COLOR_FIELD_NUMBER: builtins.int
|
290
291
|
SHOW_WIDGET_BORDER_FIELD_NUMBER: builtins.int
|
291
292
|
LINK_COLOR_FIELD_NUMBER: builtins.int
|
292
293
|
BASE_FONT_SIZE_FIELD_NUMBER: builtins.int
|
@@ -312,6 +313,7 @@ class CustomThemeConfig(google.protobuf.message.Message):
|
|
312
313
|
base_radius: builtins.str
|
313
314
|
button_radius: builtins.str
|
314
315
|
border_color: builtins.str
|
316
|
+
dataframe_border_color: builtins.str
|
315
317
|
show_widget_border: builtins.bool
|
316
318
|
link_color: builtins.str
|
317
319
|
base_font_size: builtins.int
|
@@ -350,6 +352,7 @@ class CustomThemeConfig(google.protobuf.message.Message):
|
|
350
352
|
base_radius: builtins.str | None = ...,
|
351
353
|
button_radius: builtins.str | None = ...,
|
352
354
|
border_color: builtins.str | None = ...,
|
355
|
+
dataframe_border_color: builtins.str | None = ...,
|
353
356
|
show_widget_border: builtins.bool | None = ...,
|
354
357
|
link_color: builtins.str | None = ...,
|
355
358
|
base_font_size: builtins.int | None = ...,
|
@@ -357,8 +360,8 @@ class CustomThemeConfig(google.protobuf.message.Message):
|
|
357
360
|
sidebar: global___CustomThemeConfig | None = ...,
|
358
361
|
code_background_color: builtins.str | None = ...,
|
359
362
|
) -> None: ...
|
360
|
-
def HasField(self, field_name: typing.Literal["_base_font_size", b"_base_font_size", "_base_radius", b"_base_radius", "_border_color", b"_border_color", "_button_radius", b"_button_radius", "_code_background_color", b"_code_background_color", "_link_color", b"_link_color", "_show_sidebar_border", b"_show_sidebar_border", "_show_widget_border", b"_show_widget_border", "_sidebar", b"_sidebar", "base_font_size", b"base_font_size", "base_radius", b"base_radius", "border_color", b"border_color", "button_radius", b"button_radius", "code_background_color", b"code_background_color", "font_sizes", b"font_sizes", "link_color", b"link_color", "radii", b"radii", "show_sidebar_border", b"show_sidebar_border", "show_widget_border", b"show_widget_border", "sidebar", b"sidebar"]) -> builtins.bool: ...
|
361
|
-
def ClearField(self, field_name: typing.Literal["_base_font_size", b"_base_font_size", "_base_radius", b"_base_radius", "_border_color", b"_border_color", "_button_radius", b"_button_radius", "_code_background_color", b"_code_background_color", "_link_color", b"_link_color", "_show_sidebar_border", b"_show_sidebar_border", "_show_widget_border", b"_show_widget_border", "_sidebar", b"_sidebar", "background_color", b"background_color", "base", b"base", "base_font_size", b"base_font_size", "base_radius", b"base_radius", "body_font", b"body_font", "border_color", b"border_color", "button_radius", b"button_radius", "code_background_color", b"code_background_color", "code_font", b"code_font", "font", b"font", "font_faces", b"font_faces", "font_sizes", b"font_sizes", "heading_font", b"heading_font", "link_color", b"link_color", "primary_color", b"primary_color", "radii", b"radii", "secondary_background_color", b"secondary_background_color", "show_sidebar_border", b"show_sidebar_border", "show_widget_border", b"show_widget_border", "sidebar", b"sidebar", "skeleton_background_color", b"skeleton_background_color", "text_color", b"text_color", "widget_background_color", b"widget_background_color", "widget_border_color", b"widget_border_color"]) -> None: ...
|
363
|
+
def HasField(self, field_name: typing.Literal["_base_font_size", b"_base_font_size", "_base_radius", b"_base_radius", "_border_color", b"_border_color", "_button_radius", b"_button_radius", "_code_background_color", b"_code_background_color", "_dataframe_border_color", b"_dataframe_border_color", "_link_color", b"_link_color", "_show_sidebar_border", b"_show_sidebar_border", "_show_widget_border", b"_show_widget_border", "_sidebar", b"_sidebar", "base_font_size", b"base_font_size", "base_radius", b"base_radius", "border_color", b"border_color", "button_radius", b"button_radius", "code_background_color", b"code_background_color", "dataframe_border_color", b"dataframe_border_color", "font_sizes", b"font_sizes", "link_color", b"link_color", "radii", b"radii", "show_sidebar_border", b"show_sidebar_border", "show_widget_border", b"show_widget_border", "sidebar", b"sidebar"]) -> builtins.bool: ...
|
364
|
+
def ClearField(self, field_name: typing.Literal["_base_font_size", b"_base_font_size", "_base_radius", b"_base_radius", "_border_color", b"_border_color", "_button_radius", b"_button_radius", "_code_background_color", b"_code_background_color", "_dataframe_border_color", b"_dataframe_border_color", "_link_color", b"_link_color", "_show_sidebar_border", b"_show_sidebar_border", "_show_widget_border", b"_show_widget_border", "_sidebar", b"_sidebar", "background_color", b"background_color", "base", b"base", "base_font_size", b"base_font_size", "base_radius", b"base_radius", "body_font", b"body_font", "border_color", b"border_color", "button_radius", b"button_radius", "code_background_color", b"code_background_color", "code_font", b"code_font", "dataframe_border_color", b"dataframe_border_color", "font", b"font", "font_faces", b"font_faces", "font_sizes", b"font_sizes", "heading_font", b"heading_font", "link_color", b"link_color", "primary_color", b"primary_color", "radii", b"radii", "secondary_background_color", b"secondary_background_color", "show_sidebar_border", b"show_sidebar_border", "show_widget_border", b"show_widget_border", "sidebar", b"sidebar", "skeleton_background_color", b"skeleton_background_color", "text_color", b"text_color", "widget_background_color", b"widget_background_color", "widget_border_color", b"widget_border_color"]) -> None: ...
|
362
365
|
@typing.overload
|
363
366
|
def WhichOneof(self, oneof_group: typing.Literal["_base_font_size", b"_base_font_size"]) -> typing.Literal["base_font_size"] | None: ...
|
364
367
|
@typing.overload
|
@@ -370,6 +373,8 @@ class CustomThemeConfig(google.protobuf.message.Message):
|
|
370
373
|
@typing.overload
|
371
374
|
def WhichOneof(self, oneof_group: typing.Literal["_code_background_color", b"_code_background_color"]) -> typing.Literal["code_background_color"] | None: ...
|
372
375
|
@typing.overload
|
376
|
+
def WhichOneof(self, oneof_group: typing.Literal["_dataframe_border_color", b"_dataframe_border_color"]) -> typing.Literal["dataframe_border_color"] | None: ...
|
377
|
+
@typing.overload
|
373
378
|
def WhichOneof(self, oneof_group: typing.Literal["_link_color", b"_link_color"]) -> typing.Literal["link_color"] | None: ...
|
374
379
|
@typing.overload
|
375
380
|
def WhichOneof(self, oneof_group: typing.Literal["_show_sidebar_border", b"_show_sidebar_border"]) -> typing.Literal["show_sidebar_border"] | None: ...
|
streamlit/runtime/context.py
CHANGED
@@ -17,12 +17,13 @@ from __future__ import annotations
|
|
17
17
|
from collections.abc import Iterable, Iterator, Mapping
|
18
18
|
from functools import lru_cache
|
19
19
|
from types import MappingProxyType
|
20
|
-
from typing import TYPE_CHECKING, Any, cast
|
20
|
+
from typing import TYPE_CHECKING, Any, Literal, cast
|
21
21
|
|
22
22
|
from streamlit import runtime
|
23
23
|
from streamlit.runtime.context_util import maybe_add_page_path, maybe_trim_page_path
|
24
24
|
from streamlit.runtime.metrics_util import gather_metrics
|
25
25
|
from streamlit.runtime.scriptrunner_utils.script_run_context import get_script_run_ctx
|
26
|
+
from streamlit.util import AttributeDictionary
|
26
27
|
|
27
28
|
if TYPE_CHECKING:
|
28
29
|
from http.cookies import Morsel
|
@@ -63,6 +64,26 @@ def _normalize_header(name: str) -> str:
|
|
63
64
|
return "-".join(w.capitalize() for w in name.split("-"))
|
64
65
|
|
65
66
|
|
67
|
+
class StreamlitTheme(AttributeDictionary):
|
68
|
+
"""A dictionary-like object containing theme information.
|
69
|
+
|
70
|
+
This class extends the functionality of a standard dictionary to allow items
|
71
|
+
to be accessed via attribute-style dot notation in addition to the traditional
|
72
|
+
key-based access. If a dictionary item is accessed and is itself a dictionary,
|
73
|
+
it is automatically wrapped in another `AttributeDictionary`, enabling recursive
|
74
|
+
attribute-style access.
|
75
|
+
"""
|
76
|
+
|
77
|
+
type: Literal["dark", "light"] | None
|
78
|
+
|
79
|
+
def __init__(self, theme_info: dict[str, str | None]):
|
80
|
+
super().__init__(theme_info)
|
81
|
+
|
82
|
+
@classmethod
|
83
|
+
def from_context_info(cls, context_dict: dict[str, str | None]) -> StreamlitTheme:
|
84
|
+
return cls(context_dict)
|
85
|
+
|
86
|
+
|
66
87
|
class StreamlitHeaders(Mapping[str, str]):
|
67
88
|
def __init__(self, headers: Iterable[tuple[str, str]]) -> None:
|
68
89
|
dict_like_headers: dict[str, list[str]] = {}
|
@@ -215,6 +236,17 @@ class ContextProxy:
|
|
215
236
|
cookies = session_client_request.cookies
|
216
237
|
return StreamlitCookies.from_tornado_cookies(cookies)
|
217
238
|
|
239
|
+
@property
|
240
|
+
@gather_metrics("context.theme")
|
241
|
+
def theme(self) -> StreamlitTheme:
|
242
|
+
"""A read-only object containing information about the current Streamlit app theme."""
|
243
|
+
ctx = get_script_run_ctx()
|
244
|
+
|
245
|
+
if ctx is None or ctx.context_info is None:
|
246
|
+
return StreamlitTheme({"type": None})
|
247
|
+
|
248
|
+
return StreamlitTheme.from_context_info({"type": ctx.context_info.color_scheme})
|
249
|
+
|
218
250
|
@property
|
219
251
|
@gather_metrics("context.timezone")
|
220
252
|
def timezone(self) -> str | None:
|
streamlit/static/index.html
CHANGED
@@ -51,7 +51,7 @@
|
|
51
51
|
<script>
|
52
52
|
window.prerenderReady = false
|
53
53
|
</script>
|
54
|
-
<script type="module" crossorigin src="./static/js/index.
|
54
|
+
<script type="module" crossorigin src="./static/js/index.CgzkiPeB.js"></script>
|
55
55
|
<link rel="stylesheet" crossorigin href="./static/css/index.C6rq3aMZ.css">
|
56
56
|
</head>
|
57
57
|
<body>
|