streamlit 1.45.1__py3-none-any.whl → 1.46.1__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/__init__.py +5 -1
- streamlit/auth_util.py +12 -12
- streamlit/cli_util.py +4 -3
- streamlit/column_config.py +11 -9
- streamlit/commands/echo.py +6 -4
- streamlit/commands/execution_control.py +33 -32
- streamlit/commands/experimental_query_params.py +2 -2
- streamlit/commands/logo.py +9 -4
- streamlit/commands/navigation.py +61 -18
- streamlit/commands/page_config.py +57 -47
- streamlit/components/types/base_custom_component.py +7 -7
- streamlit/components/v1/component_registry.py +7 -3
- streamlit/components/v1/components.py +1 -1
- streamlit/components/v1/custom_component.py +8 -8
- streamlit/config.py +289 -144
- streamlit/config_option.py +19 -15
- streamlit/config_util.py +29 -23
- streamlit/connections/__init__.py +2 -2
- streamlit/connections/base_connection.py +5 -5
- streamlit/connections/snowflake_connection.py +13 -11
- streamlit/connections/snowpark_connection.py +3 -3
- streamlit/connections/sql_connection.py +20 -18
- streamlit/connections/util.py +2 -2
- streamlit/cursor.py +6 -6
- streamlit/dataframe_util.py +52 -52
- streamlit/delta_generator.py +46 -48
- streamlit/delta_generator_singletons.py +3 -3
- streamlit/deprecation_util.py +6 -6
- streamlit/elements/alert.py +37 -29
- streamlit/elements/arrow.py +40 -22
- streamlit/elements/code.py +46 -13
- streamlit/elements/deck_gl_json_chart.py +38 -27
- streamlit/elements/dialog_decorator.py +3 -4
- streamlit/elements/doc_string.py +64 -58
- streamlit/elements/exception.py +23 -27
- streamlit/elements/form.py +41 -0
- streamlit/elements/graphviz_chart.py +1 -1
- streamlit/elements/heading.py +60 -9
- streamlit/elements/html.py +3 -4
- streamlit/elements/image.py +8 -9
- streamlit/elements/json.py +21 -2
- streamlit/elements/layouts.py +120 -31
- streamlit/elements/lib/built_in_chart_utils.py +96 -73
- streamlit/elements/lib/color_util.py +3 -3
- streamlit/elements/lib/column_config_utils.py +2 -4
- streamlit/elements/lib/column_types.py +14 -8
- streamlit/elements/lib/dialog.py +9 -5
- streamlit/elements/lib/image_utils.py +39 -40
- streamlit/elements/lib/js_number.py +4 -4
- streamlit/elements/lib/layout_utils.py +65 -1
- streamlit/elements/lib/mutable_status_container.py +14 -3
- streamlit/elements/lib/options_selector_utils.py +22 -12
- streamlit/elements/lib/pandas_styler_utils.py +25 -21
- streamlit/elements/lib/policies.py +6 -5
- streamlit/elements/lib/streamlit_plotly_theme.py +54 -53
- streamlit/elements/lib/subtitle_utils.py +6 -9
- streamlit/elements/lib/utils.py +20 -5
- streamlit/elements/map.py +32 -56
- streamlit/elements/markdown.py +101 -12
- streamlit/elements/media.py +78 -21
- streamlit/elements/metric.py +32 -16
- streamlit/elements/plotly_chart.py +15 -15
- streamlit/elements/progress.py +33 -15
- streamlit/elements/spinner.py +31 -6
- streamlit/elements/text.py +21 -1
- streamlit/elements/toast.py +1 -2
- streamlit/elements/vega_charts.py +54 -23
- streamlit/elements/widgets/audio_input.py +24 -7
- streamlit/elements/widgets/button.py +26 -19
- streamlit/elements/widgets/button_group.py +10 -15
- streamlit/elements/widgets/camera_input.py +27 -7
- streamlit/elements/widgets/chat.py +91 -38
- streamlit/elements/widgets/checkbox.py +45 -4
- streamlit/elements/widgets/color_picker.py +40 -17
- streamlit/elements/widgets/data_editor.py +76 -37
- streamlit/elements/widgets/file_uploader.py +42 -13
- streamlit/elements/widgets/multiselect.py +7 -10
- streamlit/elements/widgets/number_input.py +123 -47
- streamlit/elements/widgets/radio.py +59 -13
- streamlit/elements/widgets/select_slider.py +35 -30
- streamlit/elements/widgets/selectbox.py +56 -9
- streamlit/elements/widgets/slider.py +190 -99
- streamlit/elements/widgets/text_widgets.py +54 -8
- streamlit/elements/widgets/time_widgets.py +53 -14
- streamlit/elements/write.py +5 -8
- streamlit/env_util.py +2 -7
- streamlit/error_util.py +16 -9
- streamlit/errors.py +69 -48
- streamlit/external/langchain/streamlit_callback_handler.py +10 -5
- streamlit/file_util.py +27 -10
- streamlit/git_util.py +29 -24
- streamlit/hello/animation_demo.py +9 -9
- streamlit/hello/dataframe_demo.py +5 -5
- streamlit/hello/hello.py +1 -0
- streamlit/hello/mapping_demo.py +7 -8
- streamlit/hello/plotting_demo.py +3 -3
- streamlit/hello/streamlit_app.py +28 -26
- streamlit/hello/utils.py +2 -1
- streamlit/logger.py +10 -11
- streamlit/navigation/page.py +11 -8
- streamlit/proto/Audio_pb2.py +4 -3
- streamlit/proto/Audio_pb2.pyi +8 -1
- streamlit/proto/Block_pb2.py +38 -29
- streamlit/proto/Block_pb2.pyi +72 -4
- streamlit/proto/ClientState_pb2.py +4 -4
- streamlit/proto/ClientState_pb2.pyi +7 -2
- streamlit/proto/Code_pb2.py +4 -2
- streamlit/proto/Code_pb2.pyi +1 -0
- streamlit/proto/DataFrame_pb2.pyi +1 -1
- streamlit/proto/DeckGlJsonChart_pb2.pyi +1 -1
- streamlit/proto/Element_pb2.py +5 -3
- streamlit/proto/Element_pb2.pyi +20 -3
- streamlit/proto/GapSize_pb2.py +29 -0
- streamlit/proto/GapSize_pb2.pyi +70 -0
- streamlit/proto/HeightConfig_pb2.py +27 -0
- streamlit/proto/HeightConfig_pb2.pyi +48 -0
- streamlit/proto/NamedDataSet_pb2.pyi +1 -1
- streamlit/proto/Navigation_pb2.py +3 -3
- streamlit/proto/Navigation_pb2.pyi +4 -0
- streamlit/proto/NewSession_pb2.py +18 -16
- streamlit/proto/NewSession_pb2.pyi +29 -3
- streamlit/proto/PageConfig_pb2.py +7 -7
- streamlit/proto/PageConfig_pb2.pyi +21 -1
- streamlit/proto/Video_pb2.py +8 -7
- streamlit/proto/Video_pb2.pyi +8 -1
- streamlit/proto/WidthConfig_pb2.py +2 -2
- streamlit/proto/WidthConfig_pb2.pyi +15 -1
- streamlit/runtime/__init__.py +1 -1
- streamlit/runtime/app_session.py +53 -40
- streamlit/runtime/caching/__init__.py +9 -9
- streamlit/runtime/caching/cache_data_api.py +36 -30
- streamlit/runtime/caching/cache_errors.py +4 -4
- streamlit/runtime/caching/cache_resource_api.py +8 -8
- streamlit/runtime/caching/cache_utils.py +15 -14
- streamlit/runtime/caching/cached_message_replay.py +14 -8
- streamlit/runtime/caching/hashing.py +91 -97
- streamlit/runtime/caching/legacy_cache_api.py +2 -2
- streamlit/runtime/caching/storage/cache_storage_protocol.py +1 -1
- streamlit/runtime/caching/storage/dummy_cache_storage.py +1 -1
- streamlit/runtime/caching/storage/in_memory_cache_storage_wrapper.py +12 -14
- streamlit/runtime/caching/storage/local_disk_cache_storage.py +6 -6
- streamlit/runtime/connection_factory.py +36 -36
- streamlit/runtime/context.py +58 -9
- streamlit/runtime/credentials.py +29 -40
- streamlit/runtime/forward_msg_queue.py +11 -11
- streamlit/runtime/fragment.py +7 -7
- streamlit/runtime/media_file_manager.py +3 -4
- streamlit/runtime/memory_media_file_storage.py +6 -5
- streamlit/runtime/memory_uploaded_file_manager.py +2 -2
- streamlit/runtime/metrics_util.py +11 -12
- streamlit/runtime/pages_manager.py +4 -6
- streamlit/runtime/runtime.py +8 -6
- streamlit/runtime/runtime_util.py +7 -6
- streamlit/runtime/scriptrunner/__init__.py +4 -4
- streamlit/runtime/scriptrunner/exec_code.py +12 -5
- streamlit/runtime/scriptrunner/magic.py +16 -12
- streamlit/runtime/scriptrunner/script_cache.py +1 -1
- streamlit/runtime/scriptrunner/script_runner.py +53 -29
- streamlit/runtime/scriptrunner_utils/exceptions.py +1 -1
- streamlit/runtime/scriptrunner_utils/script_requests.py +7 -4
- streamlit/runtime/scriptrunner_utils/script_run_context.py +10 -23
- streamlit/runtime/secrets.py +40 -35
- streamlit/runtime/session_manager.py +2 -1
- streamlit/runtime/state/__init__.py +5 -5
- streamlit/runtime/state/common.py +2 -2
- streamlit/runtime/state/query_params.py +13 -15
- streamlit/runtime/state/query_params_proxy.py +17 -13
- streamlit/runtime/state/safe_session_state.py +2 -2
- streamlit/runtime/state/session_state.py +52 -34
- streamlit/runtime/stats.py +2 -2
- streamlit/runtime/uploaded_file_manager.py +1 -1
- streamlit/runtime/websocket_session_manager.py +10 -6
- streamlit/source_util.py +8 -6
- streamlit/static/index.html +3 -17
- streamlit/static/manifest.json +1180 -0
- streamlit/static/static/css/{index.DqDwtg6_.css → index.CJVRHjQZ.css} +1 -1
- streamlit/static/static/js/{ErrorOutline.esm.DU9IrB3M.js → ErrorOutline.esm.DitPpe1Y.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.P9rKwKo8.js → FileDownload.esm.AI3watX9.js} +1 -1
- streamlit/static/static/js/{FileHelper.D7RMkx0e.js → FileHelper.kt7mhnu8.js} +5 -5
- streamlit/static/static/js/{FormClearHelper.B67tgll0.js → FormClearHelper.D1M9GM_c.js} +1 -1
- streamlit/static/static/js/{Hooks.ncTJktu9.js → Hooks.BGwHKeUc.js} +1 -1
- streamlit/static/static/js/{InputInstructions.D-Y8geDN.js → InputInstructions.DaZ89mzH.js} +1 -1
- streamlit/static/static/js/{ProgressBar.B-kexwwD.js → ProgressBar.C0zPMe-p.js} +2 -2
- streamlit/static/static/js/{RenderInPortalIfExists.BgaoZgep.js → RenderInPortalIfExists.Ox8gQvdz.js} +1 -1
- streamlit/static/static/js/Toolbar.KhlcEc0K.js +1 -0
- streamlit/static/static/js/UploadFileInfo.0DCkpDDf.js +6 -0
- streamlit/static/static/js/{base-input.BoAa1U94.js → base-input.BJ4qsfSq.js} +4 -4
- streamlit/static/static/js/{checkbox.Z6iSfe5F.js → checkbox.DSDh78Xz.js} +2 -2
- streamlit/static/static/js/{createSuper.B4oGDYRm.js → createSuper.wQ9SIXEJ.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.msYws2Ou.js → data-grid-overlay-editor.DvbdPJ15.js} +1 -1
- streamlit/static/static/js/{downloader.kc14n2Hv.js → downloader.CD9rzih5.js} +1 -1
- streamlit/static/static/js/{es6.CxQz807-.js → es6.48Q9Qjgb.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.B19u0ONI.js → iframeResizer.contentWindow.CKdem3Bn.js} +1 -1
- streamlit/static/static/js/{index.LaIasviC.js → index.6md5Qhod.js} +1 -1
- streamlit/static/static/js/index.7hy6AeJ1.js +1 -0
- streamlit/static/static/js/index.B4CGJiBW.js +1 -0
- streamlit/static/static/js/index.B8oW0ZTD.js +1 -0
- streamlit/static/static/js/index.BU6RnlHI.js +73 -0
- streamlit/static/static/js/index.BUq9Wcf8.js +197 -0
- streamlit/static/static/js/{index.BFz9U2y0.js → index.BXXo-Yoj.js} +1 -1
- streamlit/static/static/js/index.Bae9H0OS.js +1 -0
- streamlit/static/static/js/{index.-5ruC9At.js → index.BhTl2Uyb.js} +1 -1
- streamlit/static/static/js/{index.BpILzHf_.js → index.BiSaCB1o.js} +20 -20
- streamlit/static/static/js/{index.xNQq3Ei5.js → index.BulSAJ9z.js} +1 -1
- streamlit/static/static/js/{index.9V1KdxfP.js → index.Bv-EuTKR.js} +1 -1
- streamlit/static/static/js/index.BvMLYCHi.js +1 -0
- streamlit/static/static/js/index.C1NIn1Y2.js +783 -0
- streamlit/static/static/js/index.CP-fthOJ.js +2 -0
- streamlit/static/static/js/{index.BoigZiu7.js → index.CS9guO3p.js} +1 -1
- streamlit/static/static/js/index.CYTBHth8.js +1 -0
- streamlit/static/static/js/{index.CmTAF0dM.js → index.CcJufcuD.js} +1 -1
- streamlit/static/static/js/index.CnENU1yn.js +1 -0
- streamlit/static/static/js/index.Cns13qBb.js +1 -0
- streamlit/static/static/js/index.Ct_xXq7w.js +1 -0
- streamlit/static/static/js/{index.BqfdT8-Q.js → index.CxGSemHL.js} +1 -1
- streamlit/static/static/js/index.D5S0ldVb.js +1 -0
- streamlit/static/static/js/index.D72B_ksb.js +2 -0
- streamlit/static/static/js/index.DI4yZ27M.js +1 -0
- streamlit/static/static/js/index.DN51vLxR.js +1 -0
- streamlit/static/static/js/index.DRtq5dka.js +1 -0
- streamlit/static/static/js/{index.BHXxWdde.js → index.DX-oiXlb.js} +1 -1
- streamlit/static/static/js/index.DlFE4_Aq.js +12 -0
- streamlit/static/static/js/{index.BHGGDa8K.js → index.J7BJwXOi.js} +2 -2
- streamlit/static/static/js/index.Jg38kJPP.js +1 -0
- streamlit/static/static/js/index.JhIO6abf.js +3 -0
- streamlit/static/static/js/{index.DeB9iKFW.js → index.NkRcWwc5.js} +255 -255
- streamlit/static/static/js/{index.BGga-hcS.js → index.prekPLrm.js} +25 -25
- streamlit/static/static/js/{index.BRXmLIsC.js → index.wyzngKUE.js} +1 -1
- streamlit/static/static/js/index.xW7mVdI8.js +1 -0
- streamlit/static/static/js/index.yk07dYGx.js +1 -0
- streamlit/static/static/js/{input.DsCfafm0.js → input.CxKZ5Wrc.js} +2 -2
- streamlit/static/static/js/{memory.nY_lMTtu.js → memory.DeZ9VUvl.js} +1 -1
- streamlit/static/static/js/{mergeWith.B_7zmsM4.js → mergeWith.CVkhrWUb.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.CSeVhHRU.js → number-overlay-editor.Bpkm3nTq.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.nNhsvgRd.js → possibleConstructorReturn.CIDCId52.js} +1 -1
- streamlit/static/static/js/{sandbox.Cgm3iuL6.js → sandbox.TrkMaokR.js} +1 -1
- streamlit/static/static/js/{textarea.BR8rlyih.js → textarea.QKjxR64N.js} +2 -2
- streamlit/static/static/js/{timepicker.w4XhAenH.js → timepicker.DJYmE1dK.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.CgkEPBwD.js → toConsumableArray.BZoworE-.js} +1 -1
- streamlit/static/static/js/{uniqueId.j-1rlNNH.js → uniqueId.O0UbJ2Bu.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.zXY9CjFS.js → useBasicWidgetState.Ci89jaH5.js} +1 -1
- streamlit/static/static/js/useOnInputChange.Cxh6ExEn.js +1 -0
- streamlit/static/static/js/{withFullScreenWrapper.Ov13692o.js → withFullScreenWrapper.iW37lS8Z.js} +1 -1
- streamlit/static/static/media/SourceCodeVF-Italic.ttf.Ba1oaZG1.woff2 +0 -0
- streamlit/static/static/media/SourceCodeVF-Upright.ttf.BjWn63N-.woff2 +0 -0
- streamlit/static/static/media/SourceSansVF-Italic.ttf.Bt9VkdQ3.woff2 +0 -0
- streamlit/static/static/media/SourceSansVF-Upright.ttf.BsWL4Kly.woff2 +0 -0
- streamlit/static/static/media/SourceSerifVariable-Italic.ttf.CVdzAtxO.woff2 +0 -0
- streamlit/static/static/media/SourceSerifVariable-Roman.ttf.mdpVL9bi.woff2 +0 -0
- streamlit/string_util.py +14 -19
- streamlit/temporary_directory.py +13 -4
- streamlit/testing/v1/app_test.py +15 -10
- streamlit/testing/v1/element_tree.py +157 -178
- streamlit/testing/v1/local_script_runner.py +11 -15
- streamlit/testing/v1/util.py +11 -4
- streamlit/type_util.py +8 -12
- streamlit/url_util.py +1 -1
- streamlit/user_info.py +6 -5
- streamlit/util.py +25 -1
- streamlit/vendor/pympler/asizeof.py +3 -2
- streamlit/watcher/event_based_path_watcher.py +21 -2
- streamlit/watcher/folder_black_list.py +2 -2
- streamlit/watcher/local_sources_watcher.py +64 -18
- streamlit/watcher/path_watcher.py +6 -10
- streamlit/watcher/polling_path_watcher.py +8 -7
- streamlit/watcher/util.py +7 -6
- streamlit/web/bootstrap.py +16 -14
- streamlit/web/cli.py +52 -45
- streamlit/web/server/__init__.py +7 -3
- streamlit/web/server/app_static_file_handler.py +1 -1
- streamlit/web/server/authlib_tornado_integration.py +9 -4
- streamlit/web/server/browser_websocket_handler.py +8 -2
- streamlit/web/server/component_request_handler.py +14 -10
- streamlit/web/server/media_file_handler.py +14 -7
- streamlit/web/server/oauth_authlib_routes.py +41 -9
- streamlit/web/server/oidc_mixin.py +35 -17
- streamlit/web/server/routes.py +32 -22
- streamlit/web/server/server.py +13 -24
- streamlit/web/server/server_util.py +43 -9
- streamlit/web/server/stats_request_handler.py +7 -5
- streamlit/web/server/upload_file_request_handler.py +22 -19
- streamlit/web/server/websocket_headers.py +1 -1
- {streamlit-1.45.1.dist-info → streamlit-1.46.1.dist-info}/METADATA +4 -4
- streamlit-1.46.1.dist-info/RECORD +559 -0
- {streamlit-1.45.1.dist-info → streamlit-1.46.1.dist-info}/WHEEL +1 -1
- streamlit/elements/lib/event_utils.py +0 -39
- streamlit/static/static/js/Toolbar.D9RUZv9G.js +0 -1
- streamlit/static/static/js/UploadFileInfo.C-jY39rj.js +0 -1
- streamlit/static/static/js/index.8jhZBWF2.js +0 -3
- streamlit/static/static/js/index.BCx3C6e_.js +0 -1
- streamlit/static/static/js/index.BRuTz_S4.js +0 -1
- streamlit/static/static/js/index.Bcru_ti-.js +0 -1
- streamlit/static/static/js/index.Bl1FMJRd.js +0 -1
- streamlit/static/static/js/index.C1z8KpLA.js +0 -779
- streamlit/static/static/js/index.C32I2PUe.js +0 -2
- streamlit/static/static/js/index.C5GnDRB7.js +0 -1
- streamlit/static/static/js/index.CG4qPaaW.js +0 -2
- streamlit/static/static/js/index.C_msmT1u.js +0 -1
- streamlit/static/static/js/index.CbeNTdd6.js +0 -1
- streamlit/static/static/js/index.CnGQVJcw.js +0 -12
- streamlit/static/static/js/index.CopVVq4l.js +0 -1
- streamlit/static/static/js/index.CtXupx4d.js +0 -197
- streamlit/static/static/js/index.DGmCchO7.js +0 -1
- streamlit/static/static/js/index.DH6zBk0e.js +0 -1
- streamlit/static/static/js/index.DHVlVWsm.js +0 -1
- streamlit/static/static/js/index.DRKIVBoi.js +0 -1
- streamlit/static/static/js/index.DUd-lFXx.js +0 -73
- streamlit/static/static/js/index.D_uRBA4B.js +0 -1
- streamlit/static/static/js/index.QHNfgPJd.js +0 -1
- streamlit/static/static/js/index.a-RJocYL.js +0 -1
- streamlit/static/static/js/index.cvz4B1gy.js +0 -1
- streamlit/static/static/js/index.t--hEgTQ.js +0 -6
- streamlit/static/static/js/useOnInputChange.z04u96A8.js +0 -1
- streamlit/static/static/media/SourceCodePro-Bold.CFEfr7-q.woff2 +0 -0
- streamlit/static/static/media/SourceCodePro-BoldItalic.C-LkFXxa.woff2 +0 -0
- streamlit/static/static/media/SourceCodePro-Italic.CxFOx7N-.woff2 +0 -0
- streamlit/static/static/media/SourceCodePro-Regular.CBOlD63d.woff2 +0 -0
- streamlit/static/static/media/SourceCodePro-SemiBold.CFHwW3Wd.woff2 +0 -0
- streamlit/static/static/media/SourceCodePro-SemiBoldItalic.Cg2yRu82.woff2 +0 -0
- streamlit/static/static/media/SourceSansPro-Bold.-6c9oR8J.woff2 +0 -0
- streamlit/static/static/media/SourceSansPro-BoldItalic.DmM_grLY.woff2 +0 -0
- streamlit/static/static/media/SourceSansPro-Italic.I1ipWe7Q.woff2 +0 -0
- streamlit/static/static/media/SourceSansPro-Regular.DZLUzqI4.woff2 +0 -0
- streamlit/static/static/media/SourceSansPro-SemiBold.sKQIyTMz.woff2 +0 -0
- streamlit/static/static/media/SourceSansPro-SemiBoldItalic.C0wP0icr.woff2 +0 -0
- streamlit/static/static/media/SourceSerifPro-Bold.8TUnKj4x.woff2 +0 -0
- streamlit/static/static/media/SourceSerifPro-BoldItalic.CBVO7Ve7.woff2 +0 -0
- streamlit/static/static/media/SourceSerifPro-Italic.DkFgL2HZ.woff2 +0 -0
- streamlit/static/static/media/SourceSerifPro-Regular.CNJNET2S.woff2 +0 -0
- streamlit/static/static/media/SourceSerifPro-SemiBold.CHyh9GC5.woff2 +0 -0
- streamlit/static/static/media/SourceSerifPro-SemiBoldItalic.CBtz8sWN.woff2 +0 -0
- streamlit-1.45.1.dist-info/RECORD +0 -568
- {streamlit-1.45.1.data → streamlit-1.46.1.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.45.1.dist-info → streamlit-1.46.1.dist-info}/entry_points.txt +0 -0
- {streamlit-1.45.1.dist-info → streamlit-1.46.1.dist-info}/top_level.txt +0 -0
streamlit/elements/image.py
CHANGED
|
@@ -167,15 +167,14 @@ class ImageMixin:
|
|
|
167
167
|
elif use_column_width == "never" or use_column_width is False:
|
|
168
168
|
image_width = WidthBehavior.ORIGINAL
|
|
169
169
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
image_width = WidthBehavior.MIN_IMAGE_OR_CONTAINER
|
|
170
|
+
elif use_container_width is True:
|
|
171
|
+
image_width = WidthBehavior.MAX_IMAGE_OR_CONTAINER
|
|
172
|
+
elif image_width is not None and image_width > 0:
|
|
173
|
+
# Use the given width. It will be capped on the frontend if it
|
|
174
|
+
# exceeds the container width.
|
|
175
|
+
pass
|
|
176
|
+
elif use_container_width is False:
|
|
177
|
+
image_width = WidthBehavior.MIN_IMAGE_OR_CONTAINER
|
|
179
178
|
|
|
180
179
|
image_list_proto = ImageListProto()
|
|
181
180
|
marshall_images(
|
streamlit/elements/json.py
CHANGED
|
@@ -19,6 +19,11 @@ import types
|
|
|
19
19
|
from collections import ChainMap, UserDict
|
|
20
20
|
from typing import TYPE_CHECKING, Any, cast
|
|
21
21
|
|
|
22
|
+
from streamlit.elements.lib.layout_utils import (
|
|
23
|
+
LayoutConfig,
|
|
24
|
+
WidthWithoutContent,
|
|
25
|
+
validate_width,
|
|
26
|
+
)
|
|
22
27
|
from streamlit.proto.Json_pb2 import Json as JsonProto
|
|
23
28
|
from streamlit.runtime.metrics_util import gather_metrics
|
|
24
29
|
from streamlit.type_util import (
|
|
@@ -46,6 +51,7 @@ class JsonMixin:
|
|
|
46
51
|
body: object,
|
|
47
52
|
*, # keyword-only arguments:
|
|
48
53
|
expanded: bool | int = True,
|
|
54
|
+
width: WidthWithoutContent = "stretch",
|
|
49
55
|
) -> DeltaGenerator:
|
|
50
56
|
"""Display an object or string as a pretty-printed, interactive JSON string.
|
|
51
57
|
|
|
@@ -69,6 +75,16 @@ class JsonMixin:
|
|
|
69
75
|
Regardless of the initial expansion state, users can collapse or
|
|
70
76
|
expand any key-value pair to show or hide any part of the object.
|
|
71
77
|
|
|
78
|
+
width : "stretch" or int
|
|
79
|
+
The width of the JSON element. This can be one of the following:
|
|
80
|
+
|
|
81
|
+
- ``"stretch"`` (default): The width of the element matches the
|
|
82
|
+
width of the parent container.
|
|
83
|
+
- An integer specifying the width in pixels: The element has a
|
|
84
|
+
fixed width. If the specified width is greater than the width of
|
|
85
|
+
the parent container, the width of the element matches the width
|
|
86
|
+
of the parent container.
|
|
87
|
+
|
|
72
88
|
Example
|
|
73
89
|
-------
|
|
74
90
|
>>> import streamlit as st
|
|
@@ -127,11 +143,14 @@ class JsonMixin:
|
|
|
127
143
|
json_proto.max_expand_depth = expanded
|
|
128
144
|
else:
|
|
129
145
|
raise TypeError(
|
|
130
|
-
f"The type {
|
|
146
|
+
f"The type {type(expanded)} of `expanded` is not supported"
|
|
131
147
|
", must be bool or int."
|
|
132
148
|
)
|
|
133
149
|
|
|
134
|
-
|
|
150
|
+
validate_width(width)
|
|
151
|
+
layout_config = LayoutConfig(width=width)
|
|
152
|
+
|
|
153
|
+
return self.dg._enqueue("json", json_proto, layout_config=layout_config)
|
|
135
154
|
|
|
136
155
|
@property
|
|
137
156
|
def dg(self) -> DeltaGenerator:
|
streamlit/elements/layouts.py
CHANGED
|
@@ -20,6 +20,11 @@ from typing import TYPE_CHECKING, Literal, Union, cast
|
|
|
20
20
|
from typing_extensions import TypeAlias
|
|
21
21
|
|
|
22
22
|
from streamlit.delta_generator_singletons import get_dg_singleton_instance
|
|
23
|
+
from streamlit.elements.lib.layout_utils import (
|
|
24
|
+
WidthWithoutContent,
|
|
25
|
+
get_width_config,
|
|
26
|
+
validate_width,
|
|
27
|
+
)
|
|
23
28
|
from streamlit.elements.lib.utils import Key, compute_and_register_element_id, to_key
|
|
24
29
|
from streamlit.errors import (
|
|
25
30
|
StreamlitAPIException,
|
|
@@ -28,6 +33,8 @@ from streamlit.errors import (
|
|
|
28
33
|
StreamlitInvalidVerticalAlignmentError,
|
|
29
34
|
)
|
|
30
35
|
from streamlit.proto.Block_pb2 import Block as BlockProto
|
|
36
|
+
from streamlit.proto.GapSize_pb2 import GapConfig, GapSize
|
|
37
|
+
from streamlit.proto.HeightConfig_pb2 import HeightConfig
|
|
31
38
|
from streamlit.runtime.metrics_util import gather_metrics
|
|
32
39
|
from streamlit.string_util import validate_icon_or_emoji
|
|
33
40
|
|
|
@@ -67,10 +74,11 @@ class LayoutsMixin:
|
|
|
67
74
|
to visually separate its scroll surface from the rest of the app.
|
|
68
75
|
|
|
69
76
|
.. note::
|
|
70
|
-
Use containers
|
|
71
|
-
|
|
72
|
-
surface of the container might cover the majority of
|
|
73
|
-
on mobile devices, which makes it hard to scroll the
|
|
77
|
+
Use scrolling containers sparingly. If you use scrolling
|
|
78
|
+
containers, avoid heights that exceed 500 pixels. Otherwise,
|
|
79
|
+
the scroll surface of the container might cover the majority of
|
|
80
|
+
the screen on mobile devices, which makes it hard to scroll the
|
|
81
|
+
rest of the app.
|
|
74
82
|
|
|
75
83
|
border : bool or None
|
|
76
84
|
Whether to show a border around the container. If ``None`` (default), a
|
|
@@ -149,17 +157,23 @@ class LayoutsMixin:
|
|
|
149
157
|
key = to_key(key)
|
|
150
158
|
block_proto = BlockProto()
|
|
151
159
|
block_proto.allow_empty = False
|
|
152
|
-
block_proto.
|
|
160
|
+
block_proto.flex_container.border = border or False
|
|
161
|
+
block_proto.flex_container.wrap = False
|
|
153
162
|
|
|
154
163
|
if height:
|
|
155
164
|
# Activate scrolling container behavior:
|
|
156
165
|
block_proto.allow_empty = True
|
|
157
|
-
|
|
166
|
+
|
|
167
|
+
height_config = HeightConfig()
|
|
168
|
+
height_config.pixel_height = height
|
|
169
|
+
# Use block-level height_config instead of flex_container
|
|
170
|
+
block_proto.height_config.CopyFrom(height_config)
|
|
171
|
+
|
|
158
172
|
if border is None:
|
|
159
173
|
# If border is None, we activated the
|
|
160
174
|
# border as default setting for scrolling
|
|
161
175
|
# containers.
|
|
162
|
-
block_proto.
|
|
176
|
+
block_proto.flex_container.border = True
|
|
163
177
|
|
|
164
178
|
if key:
|
|
165
179
|
# At the moment, the ID is only used for extracting the
|
|
@@ -178,7 +192,7 @@ class LayoutsMixin:
|
|
|
178
192
|
self,
|
|
179
193
|
spec: SpecType,
|
|
180
194
|
*,
|
|
181
|
-
gap: Literal["small", "medium", "large"] = "small",
|
|
195
|
+
gap: Literal["small", "medium", "large"] | None = "small",
|
|
182
196
|
vertical_alignment: Literal["top", "center", "bottom"] = "top",
|
|
183
197
|
border: bool = False,
|
|
184
198
|
) -> list[DeltaGenerator]:
|
|
@@ -191,11 +205,9 @@ class LayoutsMixin:
|
|
|
191
205
|
(preferred) or just call methods directly on the returned object. See
|
|
192
206
|
examples below.
|
|
193
207
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
Columns cannot be placed inside other columns in the sidebar. This
|
|
198
|
-
is only possible in the main area of the app.
|
|
208
|
+
.. note::
|
|
209
|
+
To follow best design practices and maintain a good appearance on
|
|
210
|
+
all screen sizes, don't nest columns more than once.
|
|
199
211
|
|
|
200
212
|
Parameters
|
|
201
213
|
----------
|
|
@@ -210,8 +222,17 @@ class LayoutsMixin:
|
|
|
210
222
|
Or ``[1, 2, 3]`` creates three columns where the second one is two times
|
|
211
223
|
the width of the first one, and the third one is three times that width.
|
|
212
224
|
|
|
213
|
-
gap : "small", "medium",
|
|
214
|
-
The size of the gap between the columns.
|
|
225
|
+
gap : "small", "medium", "large", or None
|
|
226
|
+
The size of the gap between the columns. This can be one of the
|
|
227
|
+
following:
|
|
228
|
+
|
|
229
|
+
- ``"small"`` (default): 1rem gap between the columns.
|
|
230
|
+
- ``"medium"``: 2rem gap between the columns.
|
|
231
|
+
- ``"large"``: 4rem gap between the columns.
|
|
232
|
+
- ``None``: No gap between the columns.
|
|
233
|
+
|
|
234
|
+
The rem unit is relative to the ``theme.baseFontSize``
|
|
235
|
+
configuration option.
|
|
215
236
|
|
|
216
237
|
vertical_alignment : "top", "center", or "bottom"
|
|
217
238
|
The vertical alignment of the content inside the columns. The
|
|
@@ -351,22 +372,32 @@ class LayoutsMixin:
|
|
|
351
372
|
vertical_alignment=vertical_alignment
|
|
352
373
|
)
|
|
353
374
|
|
|
354
|
-
def column_gap(gap):
|
|
375
|
+
def column_gap(gap: str | None) -> GapSize.ValueType:
|
|
376
|
+
gap_mapping = {
|
|
377
|
+
"small": GapSize.SMALL,
|
|
378
|
+
"medium": GapSize.MEDIUM,
|
|
379
|
+
"large": GapSize.LARGE,
|
|
380
|
+
}
|
|
381
|
+
|
|
355
382
|
if isinstance(gap, str):
|
|
356
383
|
gap_size = gap.lower()
|
|
357
|
-
valid_sizes =
|
|
384
|
+
valid_sizes = gap_mapping.keys()
|
|
358
385
|
|
|
359
386
|
if gap_size in valid_sizes:
|
|
360
|
-
return gap_size
|
|
387
|
+
return gap_mapping[gap_size]
|
|
388
|
+
elif gap is None:
|
|
389
|
+
return GapSize.NONE
|
|
361
390
|
|
|
362
391
|
raise StreamlitInvalidColumnGapError(gap=gap)
|
|
363
392
|
|
|
364
393
|
gap_size = column_gap(gap)
|
|
394
|
+
gap_config = GapConfig()
|
|
395
|
+
gap_config.gap_size = gap_size
|
|
365
396
|
|
|
366
397
|
def column_proto(normalized_weight: float) -> BlockProto:
|
|
367
398
|
col_proto = BlockProto()
|
|
368
399
|
col_proto.column.weight = normalized_weight
|
|
369
|
-
col_proto.column.
|
|
400
|
+
col_proto.column.gap_config.CopyFrom(gap_config)
|
|
370
401
|
col_proto.column.vertical_alignment = vertical_alignment_mapping[
|
|
371
402
|
vertical_alignment
|
|
372
403
|
]
|
|
@@ -375,13 +406,23 @@ class LayoutsMixin:
|
|
|
375
406
|
return col_proto
|
|
376
407
|
|
|
377
408
|
block_proto = BlockProto()
|
|
378
|
-
block_proto.
|
|
409
|
+
block_proto.flex_container.direction = (
|
|
410
|
+
BlockProto.FlexContainer.Direction.HORIZONTAL
|
|
411
|
+
)
|
|
412
|
+
block_proto.flex_container.wrap = True
|
|
413
|
+
block_proto.flex_container.gap_config.CopyFrom(gap_config)
|
|
414
|
+
block_proto.flex_container.scale = 1
|
|
379
415
|
row = self.dg._block(block_proto)
|
|
380
416
|
total_weight = sum(weights)
|
|
381
417
|
return [row._block(column_proto(w / total_weight)) for w in weights]
|
|
382
418
|
|
|
383
419
|
@gather_metrics("tabs")
|
|
384
|
-
def tabs(
|
|
420
|
+
def tabs(
|
|
421
|
+
self,
|
|
422
|
+
tabs: Sequence[str],
|
|
423
|
+
*,
|
|
424
|
+
width: WidthWithoutContent = "stretch",
|
|
425
|
+
) -> Sequence[DeltaGenerator]:
|
|
385
426
|
r"""Insert containers separated into tabs.
|
|
386
427
|
|
|
387
428
|
Inserts a number of multi-element containers as tabs.
|
|
@@ -392,9 +433,12 @@ class LayoutsMixin:
|
|
|
392
433
|
(preferred) or just call methods directly on the returned object. See
|
|
393
434
|
examples below.
|
|
394
435
|
|
|
395
|
-
..
|
|
396
|
-
All
|
|
397
|
-
|
|
436
|
+
.. note::
|
|
437
|
+
All content within every tab is computed and sent to the frontend,
|
|
438
|
+
regardless of which tab is selected. Tabs do not currently support
|
|
439
|
+
conditional rendering. If you have a slow-loading tab, consider
|
|
440
|
+
using a widget like ``st.segmented_control`` to conditionally
|
|
441
|
+
render content instead.
|
|
398
442
|
|
|
399
443
|
Parameters
|
|
400
444
|
----------
|
|
@@ -417,6 +461,16 @@ class LayoutsMixin:
|
|
|
417
461
|
.. |st.markdown| replace:: ``st.markdown``
|
|
418
462
|
.. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
|
|
419
463
|
|
|
464
|
+
width : "stretch" or int
|
|
465
|
+
The width of the tab container. This can be one of the following:
|
|
466
|
+
|
|
467
|
+
- ``"stretch"`` (default): The width of the container matches the
|
|
468
|
+
width of the parent container.
|
|
469
|
+
- An integer specifying the width in pixels: The container has a
|
|
470
|
+
fixed width. If the specified width is greater than the width of
|
|
471
|
+
the parent container, the width of the container matches the width
|
|
472
|
+
of the parent container.
|
|
473
|
+
|
|
420
474
|
Returns
|
|
421
475
|
-------
|
|
422
476
|
list of containers
|
|
@@ -482,6 +536,8 @@ class LayoutsMixin:
|
|
|
482
536
|
|
|
483
537
|
block_proto = BlockProto()
|
|
484
538
|
block_proto.tab_container.SetInParent()
|
|
539
|
+
validate_width(width)
|
|
540
|
+
block_proto.width_config.CopyFrom(get_width_config(width))
|
|
485
541
|
tab_container = self.dg._block(block_proto)
|
|
486
542
|
return tuple(tab_container._block(tab_proto(tab_label)) for tab_label in tabs)
|
|
487
543
|
|
|
@@ -492,6 +548,7 @@ class LayoutsMixin:
|
|
|
492
548
|
expanded: bool = False,
|
|
493
549
|
*,
|
|
494
550
|
icon: str | None = None,
|
|
551
|
+
width: WidthWithoutContent = "stretch",
|
|
495
552
|
) -> DeltaGenerator:
|
|
496
553
|
r"""Insert a multi-element container that can be expanded/collapsed.
|
|
497
554
|
|
|
@@ -503,8 +560,12 @@ class LayoutsMixin:
|
|
|
503
560
|
(preferred) or just call methods directly on the returned object. See
|
|
504
561
|
examples below.
|
|
505
562
|
|
|
506
|
-
..
|
|
507
|
-
|
|
563
|
+
.. note::
|
|
564
|
+
All content within the expander is computed and sent to the
|
|
565
|
+
frontend, even if the expander is closed.
|
|
566
|
+
|
|
567
|
+
To follow best design practices and maintain a good appearance on
|
|
568
|
+
all screen sizes, don't nest expanders.
|
|
508
569
|
|
|
509
570
|
Parameters
|
|
510
571
|
----------
|
|
@@ -546,6 +607,16 @@ class LayoutsMixin:
|
|
|
546
607
|
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
|
|
547
608
|
font library.
|
|
548
609
|
|
|
610
|
+
width : "stretch" or int
|
|
611
|
+
The width of the expander container. This can be one of the following:
|
|
612
|
+
|
|
613
|
+
- ``"stretch"`` (default): The width of the container matches the
|
|
614
|
+
width of the parent container.
|
|
615
|
+
- An integer specifying the width in pixels: The container has a
|
|
616
|
+
fixed width. If the specified width is greater than the width of
|
|
617
|
+
the parent container, the width of the container matches the width
|
|
618
|
+
of the parent container.
|
|
619
|
+
|
|
549
620
|
Examples
|
|
550
621
|
--------
|
|
551
622
|
You can use the ``with`` notation to insert any element into an expander
|
|
@@ -597,6 +668,8 @@ class LayoutsMixin:
|
|
|
597
668
|
block_proto = BlockProto()
|
|
598
669
|
block_proto.allow_empty = False
|
|
599
670
|
block_proto.expandable.CopyFrom(expandable_proto)
|
|
671
|
+
validate_width(width)
|
|
672
|
+
block_proto.width_config.CopyFrom(get_width_config(width))
|
|
600
673
|
|
|
601
674
|
return self.dg._block(block_proto=block_proto)
|
|
602
675
|
|
|
@@ -623,8 +696,8 @@ class LayoutsMixin:
|
|
|
623
696
|
notation (preferred) or just call methods directly on the returned object.
|
|
624
697
|
See examples below.
|
|
625
698
|
|
|
626
|
-
..
|
|
627
|
-
|
|
699
|
+
.. note::
|
|
700
|
+
To follow best design practices, don't nest popovers.
|
|
628
701
|
|
|
629
702
|
Parameters
|
|
630
703
|
----------
|
|
@@ -747,6 +820,7 @@ class LayoutsMixin:
|
|
|
747
820
|
*,
|
|
748
821
|
expanded: bool = False,
|
|
749
822
|
state: Literal["running", "complete", "error"] = "running",
|
|
823
|
+
width: WidthWithoutContent = "stretch",
|
|
750
824
|
) -> StatusContainer:
|
|
751
825
|
r"""Insert a status container to display output from long-running tasks.
|
|
752
826
|
|
|
@@ -764,6 +838,13 @@ class LayoutsMixin:
|
|
|
764
838
|
``with`` notation, it automatically updates to the "complete" state at the end
|
|
765
839
|
of the "with" block. See examples below for more details.
|
|
766
840
|
|
|
841
|
+
.. note::
|
|
842
|
+
All content within the status container is computed and sent to the
|
|
843
|
+
frontend, even if the status container is closed.
|
|
844
|
+
|
|
845
|
+
To follow best design practices and maintain a good appearance on
|
|
846
|
+
all screen sizes, don't nest status containers.
|
|
847
|
+
|
|
767
848
|
Parameters
|
|
768
849
|
----------
|
|
769
850
|
label : str
|
|
@@ -792,11 +873,19 @@ class LayoutsMixin:
|
|
|
792
873
|
shown:
|
|
793
874
|
|
|
794
875
|
- ``running`` (default): A spinner icon is shown.
|
|
795
|
-
|
|
796
876
|
- ``complete``: A checkmark icon is shown.
|
|
797
|
-
|
|
798
877
|
- ``error``: An error icon is shown.
|
|
799
878
|
|
|
879
|
+
width : "stretch" or int
|
|
880
|
+
The width of the status container. This can be one of the following:
|
|
881
|
+
|
|
882
|
+
- ``"stretch"`` (default): The width of the container matches the
|
|
883
|
+
width of the parent container.
|
|
884
|
+
- An integer specifying the width in pixels: The container has a
|
|
885
|
+
fixed width. If the specified width is greater than the width of
|
|
886
|
+
the parent container, the width of the container matches the width
|
|
887
|
+
of the parent container.
|
|
888
|
+
|
|
800
889
|
Returns
|
|
801
890
|
-------
|
|
802
891
|
StatusContainer
|
|
@@ -849,7 +938,7 @@ class LayoutsMixin:
|
|
|
849
938
|
|
|
850
939
|
"""
|
|
851
940
|
return get_dg_singleton_instance().status_container_cls._create(
|
|
852
|
-
self.dg, label, expanded=expanded, state=state
|
|
941
|
+
self.dg, label, expanded=expanded, state=state, width=width
|
|
853
942
|
)
|
|
854
943
|
|
|
855
944
|
def _dialog(
|