streamlit-nightly 1.38.1.dev20240925__py2.py3-none-any.whl → 1.38.1.dev20240927__py2.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.
Files changed (46) hide show
  1. streamlit/commands/logo.py +22 -14
  2. streamlit/commands/navigation.py +12 -7
  3. streamlit/components/v1/component_registry.py +2 -2
  4. streamlit/components/v1/custom_component.py +2 -2
  5. streamlit/config.py +31 -9
  6. streamlit/elements/arrow.py +11 -9
  7. streamlit/elements/deck_gl_json_chart.py +140 -26
  8. streamlit/elements/empty.py +38 -13
  9. streamlit/elements/form.py +26 -8
  10. streamlit/elements/lib/column_types.py +14 -0
  11. streamlit/elements/plotly_chart.py +7 -7
  12. streamlit/elements/vega_charts.py +8 -8
  13. streamlit/elements/widgets/audio_input.py +13 -9
  14. streamlit/elements/widgets/button.py +25 -11
  15. streamlit/elements/widgets/button_group.py +3 -4
  16. streamlit/elements/widgets/camera_input.py +12 -8
  17. streamlit/elements/widgets/chat.py +3 -3
  18. streamlit/elements/widgets/checkbox.py +4 -6
  19. streamlit/elements/widgets/color_picker.py +3 -4
  20. streamlit/elements/widgets/data_editor.py +5 -4
  21. streamlit/elements/widgets/file_uploader.py +6 -7
  22. streamlit/elements/widgets/multiselect.py +3 -4
  23. streamlit/elements/widgets/number_input.py +3 -4
  24. streamlit/elements/widgets/radio.py +3 -4
  25. streamlit/elements/widgets/select_slider.py +3 -4
  26. streamlit/elements/widgets/selectbox.py +3 -4
  27. streamlit/elements/widgets/slider.py +3 -4
  28. streamlit/elements/widgets/text_widgets.py +6 -8
  29. streamlit/elements/widgets/time_widgets.py +6 -8
  30. streamlit/navigation/page.py +7 -5
  31. streamlit/runtime/state/common.py +0 -51
  32. streamlit/runtime/state/widgets.py +17 -53
  33. streamlit/static/asset-manifest.json +4 -4
  34. streamlit/static/index.html +1 -1
  35. streamlit/static/static/css/{5711.c24b25fa.chunk.css → 5711.a29b5d98.chunk.css} +1 -1
  36. streamlit/static/static/js/3710.b80be2b0.chunk.js +1 -0
  37. streamlit/static/static/js/{main.e9d8ce9e.js → main.db770de6.js} +2 -2
  38. streamlit/testing/v1/app_test.py +2 -2
  39. {streamlit_nightly-1.38.1.dev20240925.dist-info → streamlit_nightly-1.38.1.dev20240927.dist-info}/METADATA +1 -1
  40. {streamlit_nightly-1.38.1.dev20240925.dist-info → streamlit_nightly-1.38.1.dev20240927.dist-info}/RECORD +45 -45
  41. streamlit/static/static/js/3710.d73e609f.chunk.js +0 -1
  42. /streamlit/static/static/js/{main.e9d8ce9e.js.LICENSE.txt → main.db770de6.js.LICENSE.txt} +0 -0
  43. {streamlit_nightly-1.38.1.dev20240925.data → streamlit_nightly-1.38.1.dev20240927.data}/scripts/streamlit.cmd +0 -0
  44. {streamlit_nightly-1.38.1.dev20240925.dist-info → streamlit_nightly-1.38.1.dev20240927.dist-info}/WHEEL +0 -0
  45. {streamlit_nightly-1.38.1.dev20240925.dist-info → streamlit_nightly-1.38.1.dev20240927.dist-info}/entry_points.txt +0 -0
  46. {streamlit_nightly-1.38.1.dev20240925.dist-info → streamlit_nightly-1.38.1.dev20240927.dist-info}/top_level.txt +0 -0
@@ -227,8 +227,7 @@ class SelectSliderMixin:
227
227
  key : str or int
228
228
  An optional string or integer to use as the unique key for the widget.
229
229
  If this is omitted, a key will be generated for the widget
230
- based on its content. Multiple widgets of the same type may
231
- not share the same key.
230
+ based on its content. No two widgets may have the same key.
232
231
 
233
232
  help : str
234
233
  An optional tooltip that gets displayed next to the select slider.
@@ -399,14 +398,14 @@ class SelectSliderMixin:
399
398
  serde = SelectSliderSerde(opt, slider_value, _is_range_value(value))
400
399
 
401
400
  widget_state = register_widget(
402
- "slider",
403
- slider_proto,
401
+ slider_proto.id,
404
402
  on_change_handler=on_change,
405
403
  args=args,
406
404
  kwargs=kwargs,
407
405
  deserializer=serde.deserialize,
408
406
  serializer=serde.serialize,
409
407
  ctx=ctx,
408
+ value_type="double_array_value",
410
409
  )
411
410
  if isinstance(widget_state.value, tuple):
412
411
  widget_state = maybe_coerce_enum_sequence(
@@ -170,8 +170,7 @@ class SelectboxMixin:
170
170
  key : str or int
171
171
  An optional string or integer to use as the unique key for the widget.
172
172
  If this is omitted, a key will be generated for the widget
173
- based on its content. Multiple widgets of the same type may
174
- not share the same key.
173
+ based on its content. No two widgets may have the same key.
175
174
 
176
175
  help : str
177
176
  An optional tooltip that gets displayed next to the selectbox.
@@ -328,14 +327,14 @@ class SelectboxMixin:
328
327
  serde = SelectboxSerde(opt, index)
329
328
 
330
329
  widget_state = register_widget(
331
- "selectbox",
332
- selectbox_proto,
330
+ selectbox_proto.id,
333
331
  on_change_handler=on_change,
334
332
  args=args,
335
333
  kwargs=kwargs,
336
334
  deserializer=serde.deserialize,
337
335
  serializer=serde.serialize,
338
336
  ctx=ctx,
337
+ value_type="int_value",
339
338
  )
340
339
  widget_state = maybe_coerce_enum(widget_state, options, opt)
341
340
 
@@ -423,8 +423,7 @@ class SliderMixin:
423
423
  key : str or int
424
424
  An optional string or integer to use as the unique key for the widget.
425
425
  If this is omitted, a key will be generated for the widget
426
- based on its content. Multiple widgets of the same type may
427
- not share the same key.
426
+ based on its content. No two widgets may have the same key.
428
427
 
429
428
  help : str
430
429
  An optional tooltip that gets displayed next to the slider.
@@ -822,14 +821,14 @@ class SliderMixin:
822
821
  serde = SliderSerde(value, data_type, single_value, orig_tz)
823
822
 
824
823
  widget_state = register_widget(
825
- "slider",
826
- slider_proto,
824
+ slider_proto.id,
827
825
  on_change_handler=on_change,
828
826
  args=args,
829
827
  kwargs=kwargs,
830
828
  deserializer=serde.deserialize,
831
829
  serializer=serde.serialize,
832
830
  ctx=ctx,
831
+ value_type="double_array_value",
833
832
  )
834
833
 
835
834
  if widget_state.value_changed:
@@ -168,8 +168,7 @@ class TextWidgetsMixin:
168
168
  key : str or int
169
169
  An optional string or integer to use as the unique key for the widget.
170
170
  If this is omitted, a key will be generated for the widget
171
- based on its content. Multiple widgets of the same type may
172
- not share the same key.
171
+ based on its content. No two widgets may have the same key.
173
172
 
174
173
  type : "default" or "password"
175
174
  The type of the text input. This can be either "default" (for
@@ -331,14 +330,14 @@ class TextWidgetsMixin:
331
330
  serde = TextInputSerde(value)
332
331
 
333
332
  widget_state = register_widget(
334
- "text_input",
335
- text_input_proto,
333
+ text_input_proto.id,
336
334
  on_change_handler=on_change,
337
335
  args=args,
338
336
  kwargs=kwargs,
339
337
  deserializer=serde.deserialize,
340
338
  serializer=serde.serialize,
341
339
  ctx=ctx,
340
+ value_type="string_value",
342
341
  )
343
342
 
344
343
  if widget_state.value_changed:
@@ -445,8 +444,7 @@ class TextWidgetsMixin:
445
444
  key : str or int
446
445
  An optional string or integer to use as the unique key for the widget.
447
446
  If this is omitted, a key will be generated for the widget
448
- based on its content. Multiple widgets of the same type may
449
- not share the same key.
447
+ based on its content. No two widgets may have the same key.
450
448
 
451
449
  help : str
452
450
  An optional tooltip that gets displayed next to the textarea.
@@ -586,14 +584,14 @@ class TextWidgetsMixin:
586
584
 
587
585
  serde = TextAreaSerde(value)
588
586
  widget_state = register_widget(
589
- "text_area",
590
- text_area_proto,
587
+ text_area_proto.id,
591
588
  on_change_handler=on_change,
592
589
  args=args,
593
590
  kwargs=kwargs,
594
591
  deserializer=serde.deserialize,
595
592
  serializer=serde.serialize,
596
593
  ctx=ctx,
594
+ value_type="string_value",
597
595
  )
598
596
 
599
597
  if widget_state.value_changed:
@@ -339,8 +339,7 @@ class TimeWidgetsMixin:
339
339
  key : str or int
340
340
  An optional string or integer to use as the unique key for the widget.
341
341
  If this is omitted, a key will be generated for the widget
342
- based on its content. Multiple widgets of the same type may
343
- not share the same key.
342
+ based on its content. No two widgets may have the same key.
344
343
 
345
344
  help : str
346
345
  An optional tooltip that gets displayed next to the input.
@@ -496,14 +495,14 @@ class TimeWidgetsMixin:
496
495
 
497
496
  serde = TimeInputSerde(parsed_time)
498
497
  widget_state = register_widget(
499
- "time_input",
500
- time_input_proto,
498
+ time_input_proto.id,
501
499
  on_change_handler=on_change,
502
500
  args=args,
503
501
  kwargs=kwargs,
504
502
  deserializer=serde.deserialize,
505
503
  serializer=serde.serialize,
506
504
  ctx=ctx,
505
+ value_type="string_value",
507
506
  )
508
507
 
509
508
  if widget_state.value_changed:
@@ -576,8 +575,7 @@ class TimeWidgetsMixin:
576
575
  key : str or int
577
576
  An optional string or integer to use as the unique key for the widget.
578
577
  If this is omitted, a key will be generated for the widget
579
- based on its content. Multiple widgets of the same type may
580
- not share the same key.
578
+ based on its content. No two widgets may have the same key.
581
579
 
582
580
  help : str
583
581
  An optional tooltip that gets displayed next to the input.
@@ -797,14 +795,14 @@ class TimeWidgetsMixin:
797
795
  serde = DateInputSerde(parsed_values)
798
796
 
799
797
  widget_state = register_widget(
800
- "date_input",
801
- date_input_proto,
798
+ date_input_proto.id,
802
799
  on_change_handler=on_change,
803
800
  args=args,
804
801
  kwargs=kwargs,
805
802
  deserializer=serde.deserialize,
806
803
  serializer=serde.serialize,
807
804
  ctx=ctx,
805
+ value_type="string_array_value",
808
806
  )
809
807
 
810
808
  if widget_state.value_changed:
@@ -55,21 +55,21 @@ def Page(
55
55
  Parameters
56
56
  ----------
57
57
 
58
- page: str, Path, or callable
58
+ page : str, Path, or callable
59
59
  The page source as a ``Callable`` or path to a Python file. If the page
60
60
  source is defined by a Python file, the path can be a string or
61
61
  ``pathlib.Path`` object, but must be declared relative to the
62
62
  entrypoint file. If the page source is defined by a ``Callable``, the
63
63
  ``Callable`` can't accept arguments.
64
64
 
65
- title: str or None
65
+ title : str or None
66
66
  The title of the page. If this is ``None`` (default), the page title
67
67
  (in the browser tab) and label (in the navigation menu) will be
68
68
  inferred from the filename or callable name in ``page``. For more
69
69
  information, see `Overview of multipage apps
70
70
  <https://docs.streamlit.io/st.page.automatic-page-labels>`_.
71
71
 
72
- icon: str or None
72
+ icon : str or None
73
73
  An optional emoji or icon to display next to the page title and label.
74
74
  If ``icon`` is ``None`` (default), no icon is displayed next to the
75
75
  page label in the navigation menu, and a Streamlit icon is displayed
@@ -88,7 +88,7 @@ def Page(
88
88
  <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
89
89
  font library.
90
90
 
91
- url_path: str or None
91
+ url_path : str or None
92
92
  The page's URL pathname, which is the path relative to the app's root
93
93
  URL. If this is ``None`` (default), the URL pathname will be inferred
94
94
  from the filename or callable name in ``page``. For more information,
@@ -97,8 +97,10 @@ def Page(
97
97
 
98
98
  The default page will have a pathname of ``""``, indicating the root
99
99
  URL of the app. If you set ``default=True``, ``url_path`` is ignored.
100
+ ``url_path`` can't include forward slashes; paths can't include
101
+ subdirectories.
100
102
 
101
- default: bool
103
+ default : bool
102
104
  Whether this page is the default page to be shown when the app is
103
105
  loaded. If ``default`` is ``False`` (default), the page will have a
104
106
  nonempty URL pathname. However, if no default page is passed to
@@ -26,7 +26,6 @@ from typing import (
26
26
  Literal,
27
27
  Tuple,
28
28
  TypeVar,
29
- Union,
30
29
  cast,
31
30
  get_args,
32
31
  )
@@ -37,56 +36,6 @@ from streamlit import util
37
36
  from streamlit.errors import (
38
37
  StreamlitAPIException,
39
38
  )
40
- from streamlit.proto.Arrow_pb2 import Arrow
41
- from streamlit.proto.ArrowVegaLiteChart_pb2 import ArrowVegaLiteChart
42
- from streamlit.proto.AudioInput_pb2 import AudioInput
43
- from streamlit.proto.Button_pb2 import Button
44
- from streamlit.proto.ButtonGroup_pb2 import ButtonGroup
45
- from streamlit.proto.CameraInput_pb2 import CameraInput
46
- from streamlit.proto.ChatInput_pb2 import ChatInput
47
- from streamlit.proto.Checkbox_pb2 import Checkbox
48
- from streamlit.proto.ColorPicker_pb2 import ColorPicker
49
- from streamlit.proto.Components_pb2 import ComponentInstance
50
- from streamlit.proto.DateInput_pb2 import DateInput
51
- from streamlit.proto.DeckGlJsonChart_pb2 import DeckGlJsonChart
52
- from streamlit.proto.DownloadButton_pb2 import DownloadButton
53
- from streamlit.proto.FileUploader_pb2 import FileUploader
54
- from streamlit.proto.MultiSelect_pb2 import MultiSelect
55
- from streamlit.proto.NumberInput_pb2 import NumberInput
56
- from streamlit.proto.PlotlyChart_pb2 import PlotlyChart
57
- from streamlit.proto.Radio_pb2 import Radio
58
- from streamlit.proto.Selectbox_pb2 import Selectbox
59
- from streamlit.proto.Slider_pb2 import Slider
60
- from streamlit.proto.TextArea_pb2 import TextArea
61
- from streamlit.proto.TextInput_pb2 import TextInput
62
- from streamlit.proto.TimeInput_pb2 import TimeInput
63
-
64
- # Protobuf types for all widgets.
65
- WidgetProto: TypeAlias = Union[
66
- Arrow,
67
- ArrowVegaLiteChart,
68
- AudioInput,
69
- Button,
70
- ButtonGroup,
71
- CameraInput,
72
- ChatInput,
73
- Checkbox,
74
- ColorPicker,
75
- ComponentInstance,
76
- DateInput,
77
- DeckGlJsonChart,
78
- DownloadButton,
79
- FileUploader,
80
- MultiSelect,
81
- NumberInput,
82
- PlotlyChart,
83
- Radio,
84
- Selectbox,
85
- Slider,
86
- TextArea,
87
- TextInput,
88
- TimeInput,
89
- ]
90
39
 
91
40
  GENERATED_ELEMENT_ID_PREFIX: Final = "$$ID"
92
41
  TESTING_KEY = "$$STREAMLIT_INTERNAL_KEY_TESTING"
@@ -14,10 +14,7 @@
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
- from types import MappingProxyType
18
- from typing import TYPE_CHECKING, Final, Mapping
19
-
20
- from typing_extensions import TypeAlias
17
+ from typing import TYPE_CHECKING
21
18
 
22
19
  from streamlit.runtime.state.common import (
23
20
  RegisterWidgetResult,
@@ -28,7 +25,6 @@ from streamlit.runtime.state.common import (
28
25
  WidgetDeserializer,
29
26
  WidgetKwargs,
30
27
  WidgetMetadata,
31
- WidgetProto,
32
28
  WidgetSerializer,
33
29
  user_key_from_element_id,
34
30
  )
@@ -37,65 +33,24 @@ if TYPE_CHECKING:
37
33
  from streamlit.runtime.scriptrunner import ScriptRunContext
38
34
 
39
35
 
40
- ElementType: TypeAlias = str
41
-
42
- # NOTE: We use this table to start with a best-effort guess for the value_type
43
- # of each widget. Once we actually receive a proto for a widget from the
44
- # frontend, the guess is updated to be the correct type. Unfortunately, we're
45
- # not able to always rely on the proto as the type may be needed earlier.
46
- # Thankfully, in these cases (when value_type == "trigger_value"), the static
47
- # table here being slightly inaccurate should never pose a problem.
48
- ELEMENT_TYPE_TO_VALUE_TYPE: Final[Mapping[ElementType, ValueFieldName]] = (
49
- MappingProxyType(
50
- {
51
- "audio_input": "file_uploader_state_value",
52
- "button": "trigger_value",
53
- "button_group": "int_array_value",
54
- "camera_input": "file_uploader_state_value",
55
- "chat_input": "string_trigger_value",
56
- "checkbox": "bool_value",
57
- "color_picker": "string_value",
58
- "component_instance": "json_value",
59
- "data_editor": "string_value",
60
- "dataframe": "string_value",
61
- "date_input": "string_array_value",
62
- "deck_gl_json_chart": "string_value",
63
- "download_button": "trigger_value",
64
- "file_uploader": "file_uploader_state_value",
65
- "multiselect": "int_array_value",
66
- "number_input": "double_value",
67
- "plotly_chart": "string_value",
68
- "radio": "int_value",
69
- "selectbox": "int_value",
70
- "slider": "double_array_value",
71
- "text_area": "string_value",
72
- "text_input": "string_value",
73
- "time_input": "string_value",
74
- "vega_lite_chart": "string_value",
75
- }
76
- )
77
- )
78
-
79
-
80
36
  def register_widget(
81
- element_type: ElementType,
82
- element_proto: WidgetProto,
37
+ element_id: str,
38
+ *,
83
39
  deserializer: WidgetDeserializer[T],
84
40
  serializer: WidgetSerializer[T],
85
41
  ctx: ScriptRunContext | None,
86
42
  on_change_handler: WidgetCallback | None = None,
87
43
  args: WidgetArgs | None = None,
88
44
  kwargs: WidgetKwargs | None = None,
45
+ value_type: ValueFieldName,
89
46
  ) -> RegisterWidgetResult[T]:
90
47
  """Register a widget with Streamlit, and return its current value.
91
48
  NOTE: This function should be called after the proto has been filled.
92
49
 
93
50
  Parameters
94
51
  ----------
95
- element_type : ElementType
96
- The type of the element as stored in proto.
97
- element_proto : WidgetProto
98
- The proto of the specified type (e.g. Button/Multiselect/Slider proto)
52
+ element_id : str
53
+ The id of the element. Must be unique.
99
54
  deserializer : WidgetDeserializer[T]
100
55
  Called to convert a widget's protobuf value to the value returned by
101
56
  its st.<widget_name> function.
@@ -109,6 +64,15 @@ def register_widget(
109
64
  args to pass to on_change_handler when invoked
110
65
  kwargs : WidgetKwargs or None
111
66
  kwargs to pass to on_change_handler when invoked
67
+ value_type: ValueType
68
+ The value_type the widget is going to use.
69
+ We use this information to start with a best-effort guess for the value_type
70
+ of each widget. Once we actually receive a proto for a widget from the
71
+ frontend, the guess is updated to be the correct type. Unfortunately, we're
72
+ not able to always rely on the proto as the type may be needed earlier.
73
+ Thankfully, in these cases (when value_type == "trigger_value"), the static
74
+ table here being slightly inaccurate should never pose a problem.
75
+
112
76
 
113
77
  Returns
114
78
  -------
@@ -136,10 +100,10 @@ def register_widget(
136
100
  """
137
101
  # Create the widget's updated metadata, and register it with session_state.
138
102
  metadata = WidgetMetadata(
139
- element_proto.id,
103
+ element_id,
140
104
  deserializer,
141
105
  serializer,
142
- value_type=ELEMENT_TYPE_TO_VALUE_TYPE[element_type],
106
+ value_type=value_type,
143
107
  callback=on_change_handler,
144
108
  callback_args=args,
145
109
  callback_kwargs=kwargs,
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.5513bd04.css",
4
- "main.js": "./static/js/main.e9d8ce9e.js",
4
+ "main.js": "./static/js/main.db770de6.js",
5
5
  "static/js/6679.265ca09c.chunk.js": "./static/js/6679.265ca09c.chunk.js",
6
6
  "static/js/9464.7e9a3c0a.chunk.js": "./static/js/9464.7e9a3c0a.chunk.js",
7
7
  "static/js/9077.e0a8db2a.chunk.js": "./static/js/9077.e0a8db2a.chunk.js",
8
8
  "static/js/3391.663b9d47.chunk.js": "./static/js/3391.663b9d47.chunk.js",
9
9
  "static/css/9943.93909c7e.chunk.css": "./static/css/9943.93909c7e.chunk.css",
10
10
  "static/js/9943.6af344bb.chunk.js": "./static/js/9943.6af344bb.chunk.js",
11
- "static/css/5711.c24b25fa.chunk.css": "./static/css/5711.c24b25fa.chunk.css",
11
+ "static/css/5711.a29b5d98.chunk.css": "./static/css/5711.a29b5d98.chunk.css",
12
12
  "static/js/5711.229cb7d0.chunk.js": "./static/js/5711.229cb7d0.chunk.js",
13
13
  "static/js/3861.0dedcd19.chunk.js": "./static/js/3861.0dedcd19.chunk.js",
14
14
  "static/js/8642.58110d15.chunk.js": "./static/js/8642.58110d15.chunk.js",
15
- "static/js/3710.d73e609f.chunk.js": "./static/js/3710.d73e609f.chunk.js",
15
+ "static/js/3710.b80be2b0.chunk.js": "./static/js/3710.b80be2b0.chunk.js",
16
16
  "static/js/8148.f51df66c.chunk.js": "./static/js/8148.f51df66c.chunk.js",
17
17
  "static/js/84.414fa87b.chunk.js": "./static/js/84.414fa87b.chunk.js",
18
18
  "static/js/9923.7061d124.chunk.js": "./static/js/9923.7061d124.chunk.js",
@@ -156,6 +156,6 @@
156
156
  },
157
157
  "entrypoints": [
158
158
  "static/css/main.5513bd04.css",
159
- "static/js/main.e9d8ce9e.js"
159
+ "static/js/main.db770de6.js"
160
160
  ]
161
161
  }
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.e9d8ce9e.js"></script><link href="./static/css/main.5513bd04.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.db770de6.js"></script><link href="./static/css/main.5513bd04.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
@@ -1 +1 @@
1
- .vega-embed{box-sizing:border-box;display:inline-block;position:relative}.vega-embed.has-actions{padding-right:38px}.vega-embed details:not([open])>:not(summary){display:none!important}.vega-embed summary{background:#fff;border:1px solid #aaa;border-radius:999px;box-shadow:1px 1px 3px rgba(0,0,0,.1);color:#1b1e23;cursor:pointer;line-height:0px;list-style:none;opacity:.2;padding:6px;position:absolute;right:0;top:0;transition:opacity .4s ease-in;z-index:1000}.vega-embed summary::-webkit-details-marker{display:none}.vega-embed summary:active{box-shadow:inset 0 0 0 1px #aaa}.vega-embed summary svg{height:14px;width:14px}.vega-embed details[open] summary{opacity:.7}.vega-embed:focus-within summary,.vega-embed:hover summary{opacity:1!important;transition:opacity .2s ease}.vega-embed .vega-actions{animation-duration:.15s;animation-name:scale-in;animation-timing-function:cubic-bezier(.2,0,.13,1.5);background:#fff;border:1px solid #d9d9d9;border-radius:4px;box-shadow:0 2px 8px 0 rgba(0,0,0,.2);display:flex;flex-direction:column;padding-bottom:8px;padding-top:8px;position:absolute;right:-9px;text-align:left;top:35px;z-index:1001}.vega-embed .vega-actions a{color:#434a56;font-family:sans-serif;font-size:14px;font-weight:600;padding:8px 16px;text-decoration:none;white-space:nowrap}.vega-embed .vega-actions a:focus,.vega-embed .vega-actions a:hover{background-color:#f7f7f9;color:#000}.vega-embed .vega-actions:after,.vega-embed .vega-actions:before{content:"";display:inline-block;position:absolute}.vega-embed .vega-actions:before{border:8px solid transparent;border-bottom-color:#d9d9d9;left:auto;right:14px;top:-16px}.vega-embed .vega-actions:after{border:7px solid transparent;border-bottom-color:#fff;left:auto;right:15px;top:-14px}.vega-embed .chart-wrapper.fit-x{width:100%}.vega-embed .chart-wrapper.fit-y{height:100%}.vega-embed-wrapper{max-width:100%;overflow:auto;padding-right:14px}@keyframes scale-in{0%{opacity:0;transform:scale(.6)}to{opacity:1;transform:scale(1)}}#vg-tooltip-element{border-radius:3px;box-shadow:2px 2px 4px rgba(0,0,0,.1);font-family:sans-serif;font-size:11px;padding:8px;position:fixed;visibility:hidden;z-index:1000}#vg-tooltip-element.visible{visibility:visible}#vg-tooltip-element h2{font-size:13px;margin-bottom:10px;margin-top:0}#vg-tooltip-element table{border-spacing:0}#vg-tooltip-element table tr{border:none}#vg-tooltip-element table tr td{overflow:hidden;padding-bottom:2px;padding-top:2px;text-overflow:ellipsis}#vg-tooltip-element table tr td.key{color:grey;max-width:150px;padding-right:4px;text-align:right}#vg-tooltip-element table tr td.value{display:block;max-height:7em;max-width:300px;text-align:left}
1
+ .vega-embed{box-sizing:border-box;display:inline-block;position:relative}.vega-embed.has-actions{padding-right:38px}.vega-embed details:not([open])>:not(summary){display:none!important}.vega-embed summary{background:#fff;border:1px solid #aaa;border-radius:999px;box-shadow:1px 1px 3px rgba(0,0,0,.1);color:#1b1e23;cursor:pointer;line-height:0px;list-style:none;opacity:.2;padding:6px;position:absolute;right:0;top:0;transition:opacity .4s ease-in;z-index:1000}.vega-embed summary::-webkit-details-marker{display:none}.vega-embed summary:active{box-shadow:inset 0 0 0 1px #aaa}.vega-embed summary svg{height:14px;width:14px}.vega-embed details[open] summary{opacity:.7}.vega-embed:focus-within summary,.vega-embed:hover summary{opacity:1!important;transition:opacity .2s ease}.vega-embed .vega-actions{animation-duration:.15s;animation-name:scale-in;animation-timing-function:cubic-bezier(.2,0,.13,1.5);background:#fff;border:1px solid #d9d9d9;border-radius:4px;box-shadow:0 2px 8px 0 rgba(0,0,0,.2);display:flex;flex-direction:column;padding-bottom:8px;padding-top:8px;position:absolute;right:-9px;text-align:left;top:35px;z-index:1001}.vega-embed .vega-actions a{color:#434a56;font-family:sans-serif;font-size:14px;font-weight:600;padding:8px 16px;text-decoration:none;white-space:nowrap}.vega-embed .vega-actions a:focus,.vega-embed .vega-actions a:hover{background-color:#f7f7f9;color:#000}.vega-embed .vega-actions:after,.vega-embed .vega-actions:before{content:"";display:inline-block;position:absolute}.vega-embed .vega-actions:before{border:8px solid transparent;border-bottom-color:#d9d9d9;left:auto;right:14px;top:-16px}.vega-embed .vega-actions:after{border:7px solid transparent;border-bottom-color:#fff;left:auto;right:15px;top:-14px}.vega-embed .chart-wrapper.fit-x{width:100%}.vega-embed .chart-wrapper.fit-y{height:100%}.vega-embed-wrapper{max-width:100%;overflow:auto;padding-right:14px}@keyframes scale-in{0%{opacity:0;transform:scale(.6)}to{opacity:1;transform:scale(1)}}#vg-tooltip-element{border-radius:3px;box-shadow:2px 2px 4px rgba(0,0,0,.1);font-family:sans-serif;font-size:11px;padding:8px;position:fixed;visibility:hidden;z-index:1000050}#vg-tooltip-element.visible{visibility:visible}#vg-tooltip-element h2{font-size:13px;margin-bottom:10px;margin-top:0}#vg-tooltip-element table{border-spacing:0}#vg-tooltip-element table tr{border:none}#vg-tooltip-element table tr td{overflow:hidden;padding-bottom:2px;padding-top:2px;text-overflow:ellipsis}#vg-tooltip-element table tr td.key{color:grey;max-width:150px;padding-right:4px;text-align:right}#vg-tooltip-element table tr td.value{display:block;max-height:7em;max-width:300px;text-align:left}
@@ -0,0 +1 @@
1
+ (self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[3710],{40223:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>xe});var i=o(58878),r=o(6334),n=o(72192),l=o(59353),a=o(78025),s=o(43338),c=o(8151),d=o(68994),h=o(58144),u=o(85850),g=o(22044),m=o(29669);var p=o(53124),b=o.n(p),f=o(32782),y=o(67253),v=o(1780),w=o(84152),S=o(6240),x=o(90782);const j=e=>{let{error:t,width:o,deltaType:i}=e;return t instanceof C?(0,x.jsx)(S.A,{width:o,name:"No Mapbox token provided",message:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("p",{children:["To use ",(0,x.jsxs)("code",{children:["st.",i]})," or ",(0,x.jsx)("code",{children:"st.map"})," you need to set up a Mapbox access token."]}),(0,x.jsxs)("p",{children:["To get a token, create an account at"," ",(0,x.jsx)("a",{href:"https://mapbox.com",children:"https://mapbox.com"}),". It's free for moderate usage levels!"]}),(0,x.jsxs)("p",{children:["Once you have a token, just set it using the Streamlit config option ",(0,x.jsx)("code",{children:"mapbox.token"})," and don't forget to restart your Streamlit server at this point if it's still running, then reload this tab."]}),(0,x.jsxs)("p",{children:["See"," ",(0,x.jsx)("a",{href:"https://docs.streamlit.io/develop/api-reference/configuration/config.toml",children:"our documentation"})," ","for more info on how to set config options."]})]})}):t instanceof k?(0,x.jsx)(S.A,{width:o,name:"Error fetching Streamlit Mapbox token",message:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("p",{children:"This app requires an internet connection."}),(0,x.jsx)("p",{children:"Please check your connection and try again."}),(0,x.jsxs)("p",{children:["If you think this is a bug, please file bug report"," ",(0,x.jsx)("a",{href:"https://github.com/streamlit/streamlit/issues/new/choose",children:"here"}),"."]})]})}):(0,x.jsx)(S.A,{width:o,name:"Error fetching Streamlit Mapbox token",message:t.message})};class C extends Error{}class k extends Error{}const A="https://data.streamlit.io/tokens.json",F="mapbox",M=e=>t=>{class o extends i.PureComponent{constructor(o){super(o),this.context=void 0,this.initMapboxToken=async()=>{try{const e=await f.A.get(A),{[F]:t}=e.data;if(!t)throw new Error(`Missing token ${F}`);this.setState({mapboxToken:t,isFetching:!1})}catch(e){const t=(0,y.$)(e);throw this.setState({mapboxTokenError:t,isFetching:!1}),new k(`${t.message} (${A})`)}},this.render=()=>{const{mapboxToken:o,mapboxTokenError:i,isFetching:r}=this.state,{width:n}=this.props;return i?(0,x.jsx)(j,{width:n,error:i,deltaType:e}):r?(0,x.jsx)(v.E,{element:m.EA.create({style:m.EA.SkeletonStyle.ELEMENT})}):(0,x.jsx)(t,{...this.props,mapboxToken:o,width:n})},this.state={isFetching:!0,mapboxToken:void 0,mapboxTokenError:void 0}}componentDidMount(){const e=this.props.element.mapboxToken||this.context.libConfig.mapboxToken;e?this.setState({mapboxToken:e,isFetching:!1}):this.initMapboxToken()}}return o.displayName=`withMapboxToken(${t.displayName||t.name})`,o.contextType=w.n,b()(o,t)};var T=o(89653);const N=(0,T.A)("div",{target:"e1az0zs51"})((e=>{let{width:t,height:o}=e;return{position:"relative",height:o,width:t}}),""),E=(0,T.A)("div",{target:"e1az0zs50"})((e=>{let{theme:t}=e;return{position:"absolute",right:"2.625rem",top:t.spacing.md,zIndex:1,".mapboxgl-ctrl.mapboxgl-ctrl-group":{overflow:"hidden",background:t.colors.bgColor},"button:not(:disabled)":{background:t.colors.bgColor,"& + button":{borderTopColor:t.colors.secondaryBg},"&.mapboxgl-ctrl-icon:hover":{backgroundColor:(0,h.iq)(t)?"":t.colors.darkenedBgMix25},"& span":{filter:(0,h.iq)(t)?"":"invert(100%)"}}}}),"");var I=o(21640),O=o(71034),V=o.n(O),$=o(32735);var W=o(3101),D=o(14251),U=o(86202),P=o(26592),_=o(64639),z=o(73417),J=o(27126),B=o(38287);const L={classes:{...z,...o(19720),...B,...o(14249),CartoLayer:D.A},functions:{colorBins:U.A,colorCategories:P.A,colorContinuous:_.A}},q=new J.A({configuration:L});var G=o(44605),X=o(24983),Z=o(68212),K=o(20302),R=o(52265),H=o(60152),Q=o(70023),Y=o(6934),ee=o(34676),te=o(36217),oe=o(79579),ie=o(5830),re=o(74839),ne=o(16554),le=o(10762),ae=o(71749),se=o(45310),ce=o(26642),de=o(38610),he=o(41881);const ue={[ie.A.layerName]:["getFillColor"],[re.A.layerName]:["getFillColor"],[ne.Ay.layerName]:["getFillColor"],[le.A.layerName]:["getFillColor"],[ae.A.layerName]:["getFillColor"],[se.A.layerName]:["getFillColor"],[ce.A.layerName]:["getColor"],[G.A.layerName]:["getTargetColor","getSourceColor"],[X.A.layerName]:["getFillColor"],[Z.A.layerName]:["getFillColor"],[K.A.layerName]:["getColor"],[R.A.layerName]:["getColor"],[H.A.layerName]:["getColor"],[Q.A.layerName]:["getColor"],[Y.A.layerName]:["getFillColor"],[ee.A.layerName]:["getFillColor","getColor","getLineColor"],[te.A.layerName]:["getFillColor"],[oe.A.layerName]:["getColor"],[de.A.layerName]:["getColor"],[he.A.layerName]:["getColor"]},ge=e=>{let{isSelected:t,object:o,objectInfo:i,opacity:r,originalFillFunction:n}=e;const l=(e=>{let{object:t,objectInfo:o,originalFillFunction:i}=e;const r="function"===typeof i?i(t,o):i;if(Array.isArray(r))return[r[0]||0,r[1]||0,r[2]||0,r[3]||255];if("string"===typeof r&&r.startsWith("@@=")){const e=q.convert({originalColor:r}).originalColor(t);return[e[0]||0,e[1]||0,e[2]||0,e[3]||255]}return null})({object:o,objectInfo:i,originalFillFunction:n});if(!l)return null;let a=0;return a=t?Math.max("number"===typeof l[3]?l[3]:r,r):Math.min("number"===typeof l[3]?l[3]:r,r),[l[0]||0,l[1]||0,l[2]||0,a]},me={selection:{indices:{},objects:{}}},pe=(e,t)=>{const o=t.match(/{(.*?)}/g);return o&&o.forEach((o=>{const i=o.substring(1,o.length-1);e.object.hasOwnProperty(i)?t=t.replace(o,e.object[i]):e.object.hasOwnProperty("properties")&&e.object.properties.hasOwnProperty(i)&&(t=t.replace(o,e.object.properties[i]))})),t};function be(e,t){if(!t.id)return me;const o=e.getElementState(t.id,"selection");return null!==o&&void 0!==o?o:me}function fe(e,t){if(!t.id)return me;const o=e.getStringValue(t),i=o?I.A.parse(o):null;return null!==i&&void 0!==i?i:me}function ye(e,t,o,i){e.id&&t.setStringValue(e,JSON.stringify(o.value),{fromUi:o.fromUi},i)}const ve=e=>{var t;const{element:o,fragmentId:r,height:n,isFullScreen:l,isLightTheme:a,theme:s,widgetMgr:c,width:d}=e,{selectionMode:h,tooltip:u,useContainerWidth:g}=o,m=null!==l&&void 0!==l&&l,[p,b]=(0,W._)({element:o,getDefaultState:be,getStateFromWidgetMgr:fe,updateWidgetMgrState:ye,widgetMgr:c,fragmentId:r}),[f,y]=(0,i.useState)({bearing:0,pitch:0,zoom:11}),{height:v,width:w}=(e=>{let{container:t,element:o,heightFallback:r="auto",isFullScreen:n,shouldUseContainerWidth:l,widthFallback:a="auto"}=e;return{width:(0,i.useMemo)((()=>l||n?"100%":o.width||t.width||a),[t.width,o.width,n,l,a]),height:(0,i.useMemo)((()=>n&&t.height?t.height:o.height||t.height||r),[n,o.height,t.height,r])}})({element:o,isFullScreen:m,shouldUseContainerWidth:g,container:{height:n,width:d},heightFallback:(null===(t=f.initialViewState)||void 0===t?void 0:t.height)||500}),[S,x]=(0,i.useState)({}),j=h[0],C=void 0!==j,k=C&&Object.keys(p.selection.indices).length>0,A=(0,i.useMemo)((()=>Object.freeze(I.A.parse(o.json))),[m,a,o.json]),F=(0,i.useMemo)((()=>{const e={...A};if(e.mapStyle||(e.mapStyle=`mapbox://styles/mapbox/${a?"light":"dark"}-v9`),m?Object.assign(e.initialViewState,{width:w,height:v}):(e.initialViewState.height||(e.initialViewState.height=500),g&&(e.initialViewState.width=w)),e.layers){const t=Object.values(p.selection.indices).some((e=>null===e||void 0===e?void 0:e.length)),o=e.layers.some((e=>Object.hasOwn(e,"pickable")));e.layers=e.layers.map((e=>{var i,r;if(!e||Array.isArray(e)||!C)return e;o||(e.pickable=!0);const n=`${e.id||null}`,l=(null===p||void 0===p||null===(i=p.selection)||void 0===i||null===(r=i.indices)||void 0===r?void 0:r[n])||[],a=ue[e["@@type"]];if(!a)return e;const c={...e};return a.forEach((o=>{var i;c.updateTriggers={[o]:[...(null===(i=c.updateTriggers)||void 0===i?void 0:i[o])||[],l,t]};const r=!t,n=e[o];if(r||!n)return c;const a=Math.floor(102),d=(0,$.Du)(s.colors.primary),h=[d[0],d[1],d[2],255],u=(0,$.Du)(s.colors.gray20),g=[u[0],u[1],u[2],a];c[o]=(e,t)=>(e=>{let{isSelected:t,object:o,objectInfo:i,originalFillFunction:r,selectedColor:n,selectedOpacity:l=255,unselectedColor:a,unselectedOpacity:s=Math.floor(102)}=e;return t?ge({opacity:l,isSelected:!0,object:o,objectInfo:i,originalFillFunction:r})||n:ge({opacity:s,isSelected:!1,object:o,objectInfo:i,originalFillFunction:r})||a})({isSelected:l.includes(t.index),object:e,objectInfo:t,originalFillFunction:n,selectedColor:h,unselectedColor:g,selectedOpacity:255,unselectedOpacity:a})})),c}))}return null===e||void 0===e||delete e.views,q.convert(e)}),[p.selection.indices,v,m,a,C,A,g,s.colors.gray20,s.colors.primary,w]);(0,i.useEffect)((()=>{if(!V()(F.initialViewState,S)){const e=Object.keys(F.initialViewState).reduce(((e,t)=>F.initialViewState[t]===S[t]?e:{...e,[t]:F.initialViewState[t]}),{});y({...f,...e}),x(F.initialViewState)}}),[F.initialViewState,S,f]);const M=(0,i.useCallback)((e=>{if(!e||!e.object||!u)return null;const t=I.A.parse(u);return t.html?t.html=pe(e,t.html):t.text=pe(e,t.text),t}),[u]),T=(0,i.useCallback)((e=>{let{viewState:t}=e;y(t)}),[y]);return{createTooltip:M,data:p,deck:F,hasActiveSelection:k,height:v,isSelectionModeActivated:C,onViewStateChange:T,selectionMode:j,setSelection:b,viewState:f,width:w}};o(93298);(0,s.mk)([l.y,a.B]);const we=me.selection,Se=[],xe=M("st.pydeck_chart")((0,g.A)((e=>{const{collapse:t,disabled:o,disableFullscreenMode:l,element:a,expand:s,fragmentId:g,height:p,isFullScreen:b,mapboxToken:f,widgetMgr:y,width:v}=e,{mapboxToken:w}=a,S=(0,c.u)(),{createTooltip:j,data:C,deck:k,hasActiveSelection:A,height:F,isSelectionModeActivated:M,onViewStateChange:T,selectionMode:I,setSelection:O,viewState:V,width:$}=ve({element:a,fragmentId:g,height:p,isFullScreen:b,isLightTheme:(0,h.iq)(S),theme:S,widgetMgr:y,width:v}),[W,D]=(0,i.useState)(!1);(0,i.useEffect)((()=>{D(!0)}),[]);const U=(0,i.useCallback)((e=>{var t;if(void 0===I)return;const{index:o,object:i}=e,r=`${(null===(t=e.layer)||void 0===t?void 0:t.id)||null}`,n=C,l=-1===o,a=(()=>{if(l)return we;switch(I){case m.Xw.SelectionMode.SINGLE_OBJECT:var e;return(null===(e=n.selection.indices[r])||void 0===e?void 0:e[0])===o?we:{indices:{[`${r}`]:[o]},objects:{[`${r}`]:[i]}};case m.Xw.SelectionMode.MULTI_OBJECT:{const e=new Map(((null===n||void 0===n||null===(t=n.selection)||void 0===t||null===(a=t.indices)||void 0===a?void 0:a[r])||[]).map(((e,t)=>{var o,i,l;return[e,null===(o=n.selection)||void 0===o||null===(i=o.objects)||void 0===i||null===(l=i[r])||void 0===l?void 0:l[t]]})));if(e.has(o)?e.delete(o):e.set(o,i),0===e.size){const{[r]:e,...t}=n.selection.indices,{[r]:o,...i}=n.selection.objects;return{indices:t,objects:i}}return{indices:{...n.selection.indices,[`${r}`]:Array.from(e.keys())},objects:{...n.selection.objects,[`${r}`]:Array.from(e.values())}}}default:throw(e=>{throw new Error(`Reached a branch with non-exhaustive item: ${e}`)})(I),new Error("Invalid selection mode")}var t,a})();JSON.stringify(a)!==JSON.stringify(n.selection)&&O({fromUi:!0,value:{selection:a}})}),[I,C,O]),P=(0,i.useCallback)((()=>{O({value:{selection:we},fromUi:!0})}),[O]);return(0,x.jsxs)(N,{className:"stDeckGlJsonChart","data-testid":"stDeckGlJsonChart",width:$,height:F,children:[(0,x.jsx)(u.A,{isFullScreen:b,disableFullscreenMode:l,onExpand:s,onCollapse:t,target:N,locked:!(!A||o)||void 0,children:A&&!o&&(0,x.jsx)(u.K,{label:"Clear selection",onClick:P,icon:d.b})}),(0,x.jsxs)(r.A,{viewState:V,onViewStateChange:T,height:F,width:$,layers:W?k.layers:Se,getTooltip:j,ContextProvider:n.wZ.Provider,controller:!0,onClick:M&&!o?U:void 0,children:[(0,x.jsx)(n.b,{height:F,width:$,mapStyle:k.mapStyle&&("string"===typeof k.mapStyle?k.mapStyle:k.mapStyle[0]),mapboxApiAccessToken:w||f}),(0,x.jsx)(E,{children:(0,x.jsx)(n.ov,{"data-testid":"stDeckGlJsonChartZoomButton",showCompass:!1})})]})]})}),!0))},3101:(e,t,o)=>{"use strict";o.d(t,{_:()=>l,t:()=>a});var i=o(58878),r=o(34752),n=o(25571);function l(e){let{getStateFromWidgetMgr:t,getDefaultState:o,updateWidgetMgrState:l,element:a,widgetMgr:s,fragmentId:c}=e;const[d,h]=(0,i.useState)((()=>{var e;return null!==(e=t(s,a))&&void 0!==e?e:o(s,a)})),[u,g]=(0,i.useState)({value:d,fromUi:!1});(0,i.useEffect)((()=>{(0,n.hX)(u)||(g(null),h(u.value),l(a,s,u,c))}),[u,l,a,s,c]);const m=(0,i.useCallback)((()=>{g({value:o(s,a),fromUi:!0})}),[g,a,o,s]);return(0,r.X)({widgetMgr:s,element:a,onFormCleared:m}),[d,g]}function a(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:o,getCurrStateFromProto:r,updateWidgetMgrState:n,element:a,widgetMgr:s,fragmentId:c}=e;const d=(0,i.useCallback)(((e,t)=>o(t)),[o]),[h,u]=l({getStateFromWidgetMgr:t,getDefaultState:d,updateWidgetMgrState:n,element:a,widgetMgr:s,fragmentId:c});return(0,i.useEffect)((()=>{a.setValue&&(a.setValue=!1,u({value:r(a),fromUi:!1}))}),[a,r,u]),[h,u]}},63872:()=>{},35111:()=>{}}]);