streamlit-nightly 1.38.1.dev20240907__py2.py3-none-any.whl → 1.38.1.dev20240909__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.
@@ -14,14 +14,12 @@
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
- import hashlib
18
17
  import json
19
18
  from typing import TYPE_CHECKING, Any, Dict, Final, Mapping, cast
20
19
 
21
20
  from streamlit import config
22
21
  from streamlit.proto.DeckGlJsonChart_pb2 import DeckGlJsonChart as PydeckProto
23
22
  from streamlit.runtime.metrics_util import gather_metrics
24
- from streamlit.util import HASHLIB_KWARGS
25
23
 
26
24
  if TYPE_CHECKING:
27
25
  from pydeck import Deck
@@ -170,17 +168,13 @@ def marshall(
170
168
  ) -> None:
171
169
  if pydeck_obj is None:
172
170
  spec = json.dumps(EMPTY_MAP)
173
- id = ""
174
171
  else:
175
172
  spec = pydeck_obj.to_json()
176
- json_string = json.dumps(spec)
177
- json_bytes = json_string.encode("utf-8")
178
- id = hashlib.md5(json_bytes, **HASHLIB_KWARGS).hexdigest()
179
173
 
180
174
  pydeck_proto.json = spec
181
175
  pydeck_proto.use_container_width = use_container_width
182
176
 
183
- pydeck_proto.id = id
177
+ pydeck_proto.id = ""
184
178
 
185
179
  tooltip = _get_pydeck_tooltip(pydeck_obj)
186
180
  if tooltip:
streamlit/elements/map.py CHANGED
@@ -17,7 +17,6 @@
17
17
  from __future__ import annotations
18
18
 
19
19
  import copy
20
- import hashlib
21
20
  import json
22
21
  from typing import TYPE_CHECKING, Any, Collection, Final, cast
23
22
 
@@ -27,7 +26,6 @@ from streamlit.color_util import Color, IntColorTuple, is_color_like, to_int_col
27
26
  from streamlit.errors import StreamlitAPIException
28
27
  from streamlit.proto.DeckGlJsonChart_pb2 import DeckGlJsonChart as DeckGlJsonChartProto
29
28
  from streamlit.runtime.metrics_util import gather_metrics
30
- from streamlit.util import HASHLIB_KWARGS
31
29
 
32
30
  if TYPE_CHECKING:
33
31
  from pandas import DataFrame
@@ -469,10 +467,7 @@ def marshall(
469
467
  pydeck_json: str,
470
468
  use_container_width: bool,
471
469
  ) -> None:
472
- json_bytes = pydeck_json.encode("utf-8")
473
- id = hashlib.md5(json_bytes, **HASHLIB_KWARGS).hexdigest()
474
-
475
470
  pydeck_proto.json = pydeck_json
476
471
  pydeck_proto.use_container_width = use_container_width
477
472
 
478
- pydeck_proto.id = id
473
+ pydeck_proto.id = ""
@@ -39,7 +39,7 @@ class DeckGlJsonChart(google.protobuf.message.Message):
39
39
  use_container_width: builtins.bool
40
40
  """If True, will overwrite the chart width spec to fit to container."""
41
41
  id: builtins.str
42
- """the hash of the json so the the frontend doesn't always have to parse the pydeck json object"""
42
+ """ID"""
43
43
  mapbox_token: builtins.str
44
44
  """The user-configured Mapbox token. If empty, the token id fetched from https://data.streamlit.io/tokens.json"""
45
45
  def __init__(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.5513bd04.css",
4
- "main.js": "./static/js/main.abc0ee04.js",
4
+ "main.js": "./static/js/main.5d1dd93c.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",
@@ -12,7 +12,7 @@
12
12
  "static/js/5711.28939a95.chunk.js": "./static/js/5711.28939a95.chunk.js",
13
13
  "static/js/3861.0dedcd19.chunk.js": "./static/js/3861.0dedcd19.chunk.js",
14
14
  "static/js/8642.dfef7dcb.chunk.js": "./static/js/8642.dfef7dcb.chunk.js",
15
- "static/js/6364.7ec8417d.chunk.js": "./static/js/6364.7ec8417d.chunk.js",
15
+ "static/js/7493.95e79b96.chunk.js": "./static/js/7493.95e79b96.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",
@@ -153,6 +153,6 @@
153
153
  },
154
154
  "entrypoints": [
155
155
  "static/css/main.5513bd04.css",
156
- "static/js/main.abc0ee04.js"
156
+ "static/js/main.5d1dd93c.js"
157
157
  ]
158
158
  }
@@ -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.abc0ee04.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.5d1dd93c.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>
@@ -0,0 +1 @@
1
+ (self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[7493],{85173:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>G});var i=o(58878),n=o(6334),s=o(72192),r=o(59353),a=o(78025),l=o(43338),h=o(8151),c=o(58144),d=o(22044),p=o(53124),m=o.n(p),u=o(32782),g=o(67253),x=o(29669),w=o(1780),b=o(84152),f=o(6240),S=o(90782);const y=e=>{let{error:t,width:o,deltaType:i}=e;return t instanceof v?(0,S.jsx)(f.A,{width:o,name:"No Mapbox token provided",message:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("p",{children:["To use ",(0,S.jsxs)("code",{children:["st.",i]})," or ",(0,S.jsx)("code",{children:"st.map"})," you need to set up a Mapbox access token."]}),(0,S.jsxs)("p",{children:["To get a token, create an account at"," ",(0,S.jsx)("a",{href:"https://mapbox.com",children:"https://mapbox.com"}),". It's free for moderate usage levels!"]}),(0,S.jsxs)("p",{children:["Once you have a token, just set it using the Streamlit config option ",(0,S.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,S.jsxs)("p",{children:["See"," ",(0,S.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,S.jsx)(f.A,{width:o,name:"Error fetching Streamlit Mapbox token",message:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("p",{children:"This app requires an internet connection."}),(0,S.jsx)("p",{children:"Please check your connection and try again."}),(0,S.jsxs)("p",{children:["If you think this is a bug, please file bug report"," ",(0,S.jsx)("a",{href:"https://github.com/streamlit/streamlit/issues/new/choose",children:"here"}),"."]})]})}):(0,S.jsx)(f.A,{width:o,name:"Error fetching Streamlit Mapbox token",message:t.message})};class v extends Error{}class k extends Error{}const j="https://data.streamlit.io/tokens.json",T="mapbox",C=e=>t=>{class o extends i.PureComponent{constructor(o){super(o),this.context=void 0,this.initMapboxToken=async()=>{try{const e=await u.A.get(j),{[T]:t}=e.data;if(!t)throw new Error(`Missing token ${T}`);this.setState({mapboxToken:t,isFetching:!1})}catch(e){const t=(0,g.$)(e);throw this.setState({mapboxTokenError:t,isFetching:!1}),new k(`${t.message} (${j})`)}},this.render=()=>{const{mapboxToken:o,mapboxTokenError:i,isFetching:n}=this.state,{width:s}=this.props;return i?(0,S.jsx)(y,{width:s,error:i,deltaType:e}):n?(0,S.jsx)(w.E,{element:x.EA.create({style:x.EA.SkeletonStyle.ELEMENT})}):(0,S.jsx)(t,{...this.props,mapboxToken:o,width:s})},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=b.n,m()(o,t)};var E=o(89653);const z=(0,E.A)("div",{target:"e1az0zs51"})((e=>{let{width:t,height:o,theme:i}=e;return{marginTop:i.spacing.sm,position:"relative",height:o,width:t}}),""),A=(0,E.A)("div",{target:"e1az0zs50"})((e=>{let{theme:t}=e;return{position:"absolute",right:"2.625rem",top:t.spacing.md,zIndex:1,"button:not(:disabled)":{background:t.colors.bgColor,"& + button":{borderTopColor:t.colors.secondaryBg},"& span":{filter:(0,c.iq)(t)?"":"invert(100%)"}}}}),"");var F=o(21640),V=o(14251),M=o(86202),I=o(26592),W=o(64639),O=o(73417),P=o(27126),D=o(92502),L=o(19720),H=o(14249),N=o(71034),$=o.n(N);const B={classes:{...O,...L,...D,...H,CartoLayer:V.A},functions:{colorBins:M.A,colorCategories:I.A,colorContinuous:W.A}},_=new P.A({configuration:B}),R=(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};o(93298);(0,l.mk)([r.y,a.B]);const q=[],G=C("st.pydeck_chart")((0,d.A)((e=>{const{element:t,height:o,isFullScreen:r,width:a}=e,l=(0,h.u)(),{createTooltip:d,deck:p,onViewStateChange:m,viewState:u}=(e=>{var t;const{element:o,height:n,isLightTheme:s,width:r}=e,{tooltip:a,useContainerWidth:l}=o,[h,c]=(0,i.useState)({bearing:0,pitch:0,zoom:11}),[d,p]=(0,i.useState)({}),m=null!==(t=e.isFullScreen)&&void 0!==t&&t,u=(0,i.useMemo)((()=>Object.freeze(F.A.parse(o.json))),[m,s,o.json]),g=(0,i.useMemo)((()=>{const e={...u};return e.mapStyle||(e.mapStyle=`mapbox://styles/mapbox/${s?"light":"dark"}-v9`),m?Object.assign(e.initialViewState,{width:r,height:n}):(e.initialViewState.height||(e.initialViewState.height=500),l&&(e.initialViewState.width=r)),null===e||void 0===e||delete e.views,_.convert(e)}),[n,m,s,u,l,r]);(0,i.useEffect)((()=>{if(!$()(g.initialViewState,d)){const e=Object.keys(g.initialViewState).reduce(((e,t)=>g.initialViewState[t]===d[t]?e:{...e,[t]:g.initialViewState[t]}),{});c({...h,...e}),p(g.initialViewState)}}),[g.initialViewState,d,h]);const x=(0,i.useCallback)((e=>{if(!e||!e.object||!a)return null;const t=F.A.parse(a);return t.html?t.html=R(e,t.html):t.text=R(e,t.text),t}),[a]),w=(0,i.useCallback)((e=>{let{viewState:t}=e;c(t)}),[c]);return{createTooltip:x,deck:g,onViewStateChange:w,viewState:h}})({element:t,isLightTheme:(0,c.iq)(l),width:a,height:o,isFullScreen:r}),[g,x]=(0,i.useState)(!1);return(0,i.useEffect)((()=>{x(!0)}),[]),(0,S.jsx)(z,{className:"stDeckGlJsonChart","data-testid":"stDeckGlJsonChart",width:a,height:p.initialViewState.height,children:(0,S.jsxs)(n.A,{viewState:u,onViewStateChange:m,height:p.initialViewState.height,width:a,layers:g?p.layers:q,getTooltip:d,ContextProvider:s.wZ.Provider,controller:!0,children:[(0,S.jsx)(s.b,{height:p.initialViewState.height,width:a,mapStyle:p.mapStyle&&("string"===typeof p.mapStyle?p.mapStyle:p.mapStyle[0]),mapboxApiAccessToken:e.element.mapboxToken||e.mapboxToken}),(0,S.jsx)(A,{children:(0,S.jsx)(s.ov,{"data-testid":"stDeckGlJsonChartZoomButton",showCompass:!1})})]})})})))},22044:(e,t,o)=>{"use strict";o.d(t,{A:()=>w});var i=o(58878),n=o(53124),s=o.n(n),r=o(8151),a=o(41514),l=o(67214),h=o(64611),c=o(84152),d=o(89653);const p=(0,d.A)("button",{target:"e1vs0wn31"})((e=>{let{isExpanded:t,theme:o}=e;const i=t?{right:"0.4rem",top:"0.5rem",backgroundColor:"transparent"}:{right:"-3.0rem",top:"-0.375rem",opacity:0,transform:"scale(0)",backgroundColor:o.colors.lightenedBg05};return{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",zIndex:o.zIndices.sidebar+1,height:"2.5rem",width:"2.5rem",transition:"opacity 300ms 150ms, transform 300ms 150ms",border:"none",color:o.colors.fadedText60,borderRadius:"50%",...i,"&:focus":{outline:"none"},"&:active, &:focus-visible, &:hover":{opacity:1,outline:"none",transform:"scale(1)",color:o.colors.bodyText,transition:"none"}}}),""),m=(0,d.A)("div",{target:"e1vs0wn30"})((e=>{let{theme:t,isExpanded:o}=e;return{"&:hover":{[p]:{opacity:1,transform:"scale(1)",transition:"none"}},...o?{position:"fixed",top:0,left:0,bottom:0,right:0,background:t.colors.bgColor,zIndex:t.zIndices.fullscreenWrapper,padding:t.spacing.md,paddingTop:t.sizes.fullScreenHeaderHeight,overflow:["auto","overlay"],display:"flex",alignItems:"center",justifyContent:"center"}:{}}}),"");var u=o(90782);class g extends i.PureComponent{constructor(e){super(e),this.context=void 0,this.controlKeys=e=>{const{expanded:t}=this.state;27===e.keyCode&&t&&this.zoomOut()},this.zoomIn=()=>{document.body.style.overflow="hidden",this.context.setFullScreen(!0),this.setState({expanded:!0})},this.zoomOut=()=>{document.body.style.overflow="unset",this.context.setFullScreen(!1),this.setState({expanded:!1})},this.convertScssRemValueToPixels=e=>parseFloat(e)*parseFloat(getComputedStyle(document.documentElement).fontSize),this.getWindowDimensions=()=>{const e=this.convertScssRemValueToPixels(this.props.theme.spacing.md),t=this.convertScssRemValueToPixels(this.props.theme.sizes.fullScreenHeaderHeight);return{fullWidth:window.innerWidth-2*e,fullHeight:window.innerHeight-(e+t)}},this.updateWindowDimensions=()=>{this.setState(this.getWindowDimensions())},this.state={expanded:!1,...this.getWindowDimensions()}}componentDidMount(){window.addEventListener("resize",this.updateWindowDimensions),document.addEventListener("keydown",this.controlKeys,!1)}componentWillUnmount(){window.removeEventListener("resize",this.updateWindowDimensions),document.removeEventListener("keydown",this.controlKeys,!1)}render(){const{expanded:e,fullWidth:t,fullHeight:o}=this.state,{children:i,width:n,height:s,disableFullscreenMode:r}=this.props;let c=a.u,d=this.zoomIn,g="View fullscreen";return e&&(c=l.Q,d=this.zoomOut,g="Exit fullscreen"),(0,u.jsxs)(m,{isExpanded:e,"data-testid":"stFullScreenFrame",children:[!r&&(0,u.jsx)(p,{"data-testid":"StyledFullScreenButton",onClick:d,title:g,isExpanded:e,children:(0,u.jsx)(h.A,{content:c})}),i(e?{width:t,height:o,expanded:e,expand:this.zoomIn,collapse:this.zoomOut}:{width:n,height:s,expanded:e,expand:this.zoomIn,collapse:this.zoomOut})]})}}g.contextType=c.n;const x=(0,r.b)(g);const w=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];class o extends i.PureComponent{constructor(){super(...arguments),this.render=()=>{const{width:o,height:i,disableFullscreenMode:n}=this.props;return(0,u.jsx)(x,{width:o,height:i,disableFullscreenMode:t||n,children:t=>{let{width:o,height:i,expanded:n,expand:s,collapse:r}=t;return(0,u.jsx)(e,{...this.props,width:o,height:i,isFullScreen:n,expand:s,collapse:r})}})}}}return o.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,s()(o,e)}},63872:()=>{},35111:()=>{}}]);