streamlit 1.48.0__py3-none-any.whl → 1.49.0__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 +3 -10
- streamlit/commands/logo.py +4 -3
- streamlit/commands/navigation.py +1 -1
- streamlit/commands/page_config.py +4 -1
- streamlit/components/v1/custom_component.py +2 -2
- streamlit/config.py +82 -1
- streamlit/connections/snowflake_connection.py +3 -1
- streamlit/delta_generator.py +3 -0
- streamlit/elements/arrow.py +155 -70
- streamlit/elements/bokeh_chart.py +13 -3
- streamlit/elements/deck_gl_json_chart.py +0 -1
- streamlit/elements/dialog_decorator.py +7 -59
- streamlit/elements/form.py +10 -1
- streamlit/elements/graphviz_chart.py +57 -6
- streamlit/elements/heading.py +17 -16
- streamlit/elements/iframe.py +13 -22
- streamlit/elements/image.py +64 -37
- streamlit/elements/layouts.py +2 -2
- streamlit/elements/lib/built_in_chart_utils.py +2 -5
- streamlit/elements/lib/column_config_utils.py +18 -4
- streamlit/elements/lib/column_types.py +75 -30
- streamlit/elements/lib/dialog.py +3 -3
- streamlit/elements/lib/image_utils.py +19 -11
- streamlit/elements/lib/layout_utils.py +15 -2
- streamlit/elements/lib/utils.py +20 -41
- streamlit/elements/markdown.py +7 -6
- streamlit/elements/media.py +6 -13
- streamlit/elements/metric.py +78 -1
- streamlit/elements/pdf.py +192 -0
- streamlit/elements/plotly_chart.py +3 -2
- streamlit/elements/pyplot.py +53 -11
- streamlit/elements/toast.py +81 -5
- streamlit/elements/vega_charts.py +3 -8
- streamlit/elements/widgets/audio_input.py +0 -1
- streamlit/elements/widgets/button.py +0 -4
- streamlit/elements/widgets/button_group.py +5 -4
- streamlit/elements/widgets/camera_input.py +0 -1
- streamlit/elements/widgets/chat.py +11 -13
- streamlit/elements/widgets/checkbox.py +0 -1
- streamlit/elements/widgets/color_picker.py +0 -1
- streamlit/elements/widgets/data_editor.py +142 -62
- streamlit/elements/widgets/file_uploader.py +74 -37
- streamlit/elements/widgets/multiselect.py +0 -1
- streamlit/elements/widgets/number_input.py +0 -1
- streamlit/elements/widgets/radio.py +0 -1
- streamlit/elements/widgets/select_slider.py +0 -1
- streamlit/elements/widgets/selectbox.py +0 -1
- streamlit/elements/widgets/slider.py +0 -1
- streamlit/elements/widgets/text_widgets.py +0 -2
- streamlit/elements/widgets/time_widgets.py +0 -2
- streamlit/errors.py +11 -0
- streamlit/material_icon_names.py +1 -1
- streamlit/proto/Arrow_pb2.py +14 -8
- streamlit/proto/Arrow_pb2.pyi +11 -3
- streamlit/proto/Block_pb2.py +16 -16
- streamlit/proto/Block_pb2.pyi +2 -0
- streamlit/proto/ChatInput_pb2.py +3 -3
- streamlit/proto/ChatInput_pb2.pyi +2 -0
- streamlit/proto/FileUploader_pb2.py +2 -2
- streamlit/proto/FileUploader_pb2.pyi +5 -1
- streamlit/proto/GraphVizChart_pb2.py +4 -2
- streamlit/proto/GraphVizChart_pb2.pyi +1 -1
- streamlit/proto/IFrame_pb2.py +8 -2
- streamlit/proto/IFrame_pb2.pyi +3 -0
- streamlit/proto/Image_pb2.py +4 -2
- streamlit/proto/Image_pb2.pyi +1 -10
- streamlit/proto/Metric_pb2.py +8 -6
- streamlit/proto/Metric_pb2.pyi +34 -10
- streamlit/proto/Toast_pb2.py +2 -2
- streamlit/proto/Toast_pb2.pyi +10 -1
- streamlit/runtime/caching/__init__.py +14 -2
- streamlit/runtime/caching/cache_data_api.py +0 -17
- streamlit/runtime/caching/cache_resource_api.py +0 -16
- streamlit/runtime/caching/cached_message_replay.py +8 -20
- streamlit/runtime/caching/hashing.py +31 -1
- streamlit/runtime/credentials.py +4 -4
- streamlit/runtime/fragment.py +0 -42
- streamlit/runtime/websocket_session_manager.py +1 -1
- streamlit/static/index.html +2 -2
- streamlit/static/manifest.json +224 -252
- streamlit/static/static/css/{index.CJVRHjQZ.css → index.C8X8rNzw.css} +1 -1
- streamlit/static/static/css/index.COe1010n.css +1 -0
- streamlit/static/static/js/{ErrorOutline.esm.D_4oFNKB.js → ErrorOutline.esm.u9XvzxL8.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.NPgaLlUE.js → FileDownload.esm.CaRyZ-b2.js} +1 -1
- streamlit/static/static/js/FileHelper.Dk2SwIi3.js +5 -0
- streamlit/static/static/js/FormClearHelper.l_UPPvkg.js +1 -0
- streamlit/static/static/js/{Hooks.BGm9sd4U.js → Hooks.BxrVEftw.js} +1 -1
- streamlit/static/static/js/InputInstructions.C254RU9X.js +1 -0
- streamlit/static/static/js/Particles.DkY6FDnc.js +1 -0
- streamlit/static/static/js/ProgressBar.BPtSM82n.js +2 -0
- streamlit/static/static/js/Toolbar.BO_3WBaS.js +1 -0
- streamlit/static/static/js/{base-input.DeBqm5mN.js → base-input.egUI4LjJ.js} +4 -4
- streamlit/static/static/js/{checkbox.C0odQfKb.js → checkbox.ButpszcE.js} +2 -2
- streamlit/static/static/js/createSuper.DYJA5xa6.js +1 -0
- streamlit/static/static/js/data-grid-overlay-editor.C9gQLEnU.js +1 -0
- streamlit/static/static/js/{downloader.Bx1D0jhz.js → downloader.B3TjsSPZ.js} +1 -1
- streamlit/static/static/js/es6.BYSNuG4D.js +2 -0
- streamlit/static/static/js/iframeResizer.contentWindow.CNPHJsF2.js +1 -0
- streamlit/static/static/js/index.0tDq1WXk.js +1 -0
- streamlit/static/static/js/index.BBnWuh07.js +976 -0
- streamlit/static/static/js/index.BDZorv41.js +1 -0
- streamlit/static/static/js/{index.DwaoC4Zp.js → index.BH79B25f.js} +3 -3
- streamlit/static/static/js/index.BeTC4Yl-.js +197 -0
- streamlit/static/static/js/index.BnOd05Ko.js +2 -0
- streamlit/static/static/js/index.BoJaJReB.js +1 -0
- streamlit/static/static/js/index.Bp1Of6L8.js +1 -0
- streamlit/static/static/js/index.Bpe4-O2W.js +1 -0
- streamlit/static/static/js/index.BrD9sbpx.js +1 -0
- streamlit/static/static/js/index.C1qCS-sd.js +1 -0
- streamlit/static/static/js/index.C3EXAI-u.js +1 -0
- streamlit/static/static/js/index.C77g9sAQ.js +3 -0
- streamlit/static/static/js/{index.PyIqRRSR.js → index.CFePF7s4.js} +1 -1
- streamlit/static/static/js/index.CFjU0x00.js +1 -0
- streamlit/static/static/js/index.Ca3y4ztK.js +1 -0
- streamlit/static/static/js/{index.ClRTsv8m.js → index.Cb9gN2T2.js} +2 -2
- streamlit/static/static/js/{index.wDYef4mQ.js → index.CbwuUwu4.js} +9 -9
- streamlit/static/static/js/index.CeXLlclc.js +1 -0
- streamlit/static/static/js/index.CfiZGqj3.js +3 -0
- streamlit/static/static/js/index.CjQnYKID.js +1 -0
- streamlit/static/static/js/index.Cl_966eE.js +3858 -0
- streamlit/static/static/js/{index.DCpyIFTV.js → index.CqSRo6zQ.js} +1 -1
- streamlit/static/static/js/index.CuEFSQ-o.js +1 -0
- streamlit/static/static/js/index.D4jR1m1z.js +1 -0
- streamlit/static/static/js/index.DGcW849X.js +1 -0
- streamlit/static/static/js/index.DKb-BAE2.js +1 -0
- streamlit/static/static/js/index.DP1rDFP0.js +1 -0
- streamlit/static/static/js/{index.HeVbRh9H.js → index.DStzYLqM.js} +2 -2
- streamlit/static/static/js/index.DVKQKDLu.js +1 -0
- streamlit/static/static/js/index.DWedOrkQ.js +1 -0
- streamlit/static/static/js/index.DYbRPmVF.js +1 -0
- streamlit/static/static/js/index.DgpIMUsr.js +1 -0
- streamlit/static/static/js/index.DtwkPJs5.js +5367 -0
- streamlit/static/static/js/{index.CnfWsQzS.js → index.MQLQLR5Z.js} +1 -1
- streamlit/static/static/js/index.uInpwWAP.js +1 -0
- streamlit/static/static/js/index.z992t-BQ.js +7 -0
- streamlit/static/static/js/{input.BL2buuce.js → input.CbP5ZuQ7.js} +2 -2
- streamlit/static/static/js/{memory.CUxjUWS7.js → memory.BuacVo2L.js} +1 -1
- streamlit/static/static/js/number-overlay-editor.BZb9zRl_.js +9 -0
- streamlit/static/static/js/{possibleConstructorReturn.DbvQboK3.js → possibleConstructorReturn.DSM84rOS.js} +1 -1
- streamlit/static/static/js/{sandbox.6lnFVWhX.js → sandbox.C480llMG.js} +1 -1
- streamlit/static/static/js/{timepicker.Bg4xAK95.js → timepicker.BunxCVp7.js} +4 -4
- streamlit/static/static/js/{toConsumableArray.D9x7Ktv4.js → toConsumableArray.B4o8rEx1.js} +3 -3
- streamlit/static/static/js/uniqueId.tii0yosY.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.CUSYQZpm.js → useBasicWidgetState.Bnm4FD6K.js} +1 -1
- streamlit/static/static/js/useTextInputAutoExpand.Dgtwc1m0.js +2 -0
- streamlit/static/static/js/useUpdateUiValue.DjXdMFGw.js +1 -0
- streamlit/static/static/js/withFullScreenWrapper.0cy2pVf5.js +1 -0
- streamlit/static/static/media/MaterialSymbols-Rounded.CBxVaFdk.woff2 +0 -0
- streamlit/user_info.py +16 -13
- streamlit/web/server/browser_websocket_handler.py +15 -0
- streamlit/web/server/oauth_authlib_routes.py +3 -59
- {streamlit-1.48.0.dist-info → streamlit-1.49.0.dist-info}/METADATA +4 -2
- {streamlit-1.48.0.dist-info → streamlit-1.49.0.dist-info}/RECORD +157 -160
- streamlit/static/static/css/index.CQt5TjGB.css +0 -1
- streamlit/static/static/js/FileHelper.B2t9ikoS.js +0 -5
- streamlit/static/static/js/FormClearHelper.BLEIUk6L.js +0 -1
- streamlit/static/static/js/InputInstructions.DtUxCBS8.js +0 -1
- streamlit/static/static/js/Particles.BDRPO7r3.js +0 -1
- streamlit/static/static/js/ProgressBar.B64DUUqp.js +0 -2
- streamlit/static/static/js/Toolbar.B3FquPk5.js +0 -1
- streamlit/static/static/js/createSuper.DqQ5L3XG.js +0 -1
- streamlit/static/static/js/data-grid-overlay-editor.DbNsQa8Y.js +0 -1
- streamlit/static/static/js/es6.CbPK4m0H.js +0 -2
- streamlit/static/static/js/iframeResizer.contentWindow.CfLKrptA.js +0 -1
- streamlit/static/static/js/index.0XDwe9RV.js +0 -203
- streamlit/static/static/js/index.4lI9TuZm.js +0 -3
- streamlit/static/static/js/index.6s0nVIis.js +0 -3855
- streamlit/static/static/js/index.9E7bRUBU.js +0 -1
- streamlit/static/static/js/index.B9PgeLrZ.js +0 -1
- streamlit/static/static/js/index.B9vzGbOt.js +0 -1
- streamlit/static/static/js/index.BDrQKMCm.js +0 -1
- streamlit/static/static/js/index.BPsoiGgP.js +0 -1
- streamlit/static/static/js/index.CJzdLAun.js +0 -1
- streamlit/static/static/js/index.CNNlC1NL.js +0 -1
- streamlit/static/static/js/index.CO1sClzJ.js +0 -2
- streamlit/static/static/js/index.CZnagxXD.js +0 -1
- streamlit/static/static/js/index.Cb0xSF7V.js +0 -5366
- streamlit/static/static/js/index.CgUt3tz_.js +0 -1
- streamlit/static/static/js/index.CjImmcsV.js +0 -1
- streamlit/static/static/js/index.CrJ1XD_V.js +0 -1
- streamlit/static/static/js/index.CtiKsjSC.js +0 -1
- streamlit/static/static/js/index.CwAuytgV.js +0 -1
- streamlit/static/static/js/index.D7GB-kly.js +0 -1
- streamlit/static/static/js/index.DA5wU0mQ.js +0 -1
- streamlit/static/static/js/index.DE9wNOje.js +0 -1
- streamlit/static/static/js/index.DHnB-C8A.js +0 -1
- streamlit/static/static/js/index.DRTn9zvD.js +0 -1
- streamlit/static/static/js/index.DjMjyJl9.js +0 -7
- streamlit/static/static/js/index.DvRPFfw6.js +0 -781
- streamlit/static/static/js/index.F9tSej94.js +0 -1
- streamlit/static/static/js/index.J2D_m7LY.js +0 -197
- streamlit/static/static/js/index.dfivzJNz.js +0 -1
- streamlit/static/static/js/index.mRztGO69.js +0 -3
- streamlit/static/static/js/index.tB1kn_7z.js +0 -1
- streamlit/static/static/js/mergeWith.C1kp1zIi.js +0 -1
- streamlit/static/static/js/number-overlay-editor.WpheGpmR.js +0 -9
- streamlit/static/static/js/threshold.DjX0wlsa.js +0 -1
- streamlit/static/static/js/timer.CAwTRJ_g.js +0 -1
- streamlit/static/static/js/uniqueId.Bm8FHN92.js +0 -1
- streamlit/static/static/js/useTextInputAutoExpand.Bf2egQOG.js +0 -2
- streamlit/static/static/js/useUpdateUiValue.lE5xnYWF.js +0 -1
- streamlit/static/static/js/value.CgPGBV_l.js +0 -1
- streamlit/static/static/js/withFullScreenWrapper.CCOXR7N6.js +0 -1
- streamlit/static/static/media/MaterialSymbols-Rounded.DsbC8sYI.woff2 +0 -0
- {streamlit-1.48.0.data → streamlit-1.49.0.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.48.0.dist-info → streamlit-1.49.0.dist-info}/WHEEL +0 -0
- {streamlit-1.48.0.dist-info → streamlit-1.49.0.dist-info}/entry_points.txt +0 -0
- {streamlit-1.48.0.dist-info → streamlit-1.49.0.dist-info}/top_level.txt +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{v as l,r as i,w as A,j as f,x as g}from"./index.BBnWuh07.js";const T=l("div",{target:"ea9qfvi0"})(()=>({lineHeight:0})),y=l("audio",{target:"ea9qfvi1"})(({theme:t})=>({width:"100%",height:t.sizes.minElementHeight,margin:0,padding:0})),h=g.getLogger("Audio");function L({element:t,endpoints:a,elementMgr:s}){const o=i.useRef(null),{startTime:n,endTime:d,loop:u,autoplay:p}=t,E=i.useMemo(()=>{if(!t.id)return!0;const e=s.getElementState(t.id,"preventAutoplay");return e||s.setElementState(t.id,"preventAutoplay",!0),e??!1},[t.id,s]);i.useEffect(()=>{o.current&&(o.current.currentTime=n)},[n]),i.useEffect(()=>{const e=o.current,r=()=>{e&&(e.currentTime=t.startTime)};return e&&e.addEventListener("loadedmetadata",r),()=>{e&&e.removeEventListener("loadedmetadata",r)}},[t]),i.useEffect(()=>{const e=o.current;if(!e)return;let r=!1;const c=()=>{d>0&&e.currentTime>=d&&(u?(e.currentTime=n||0,e.play()):r||(r=!0,e.pause()))};return d>0&&e.addEventListener("timeupdate",c),()=>{e&&d>0&&e.removeEventListener("timeupdate",c)}},[d,u,n]),i.useEffect(()=>{const e=o.current;if(!e)return;const r=()=>{u&&(e.currentTime=n||0,e.play())};return e.addEventListener("ended",r),()=>{e&&e.removeEventListener("ended",r)}},[u,n]);const m=A(t.url),v=a.buildMediaURL(t.url);return f(T,{children:f(y,{className:"stAudio","data-testid":"stAudio",ref:o,controls:!0,autoPlay:p&&!E,src:v,onError:e=>{const r=e.currentTarget.src;h.error(`Client Error: Audio source error - ${r}`),a.sendClientErrorToHost("Audio","Audio source failed to load","onerror triggered",r)},crossOrigin:m})})}const C=i.memo(L);export{C as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as p,u as T,h as k,j as n,e as C,l as y,S,f as L,T as W,P as B,g as w,t as R,C as E,i as P}from"./index.BBnWuh07.js";import{u as $}from"./useBasicWidgetState.Bnm4FD6K.js";import{S as v,L as X,a as m}from"./checkbox.ButpszcE.js";import"./FormClearHelper.l_UPPvkg.js";function H({element:e,disabled:a,widgetMgr:s,fragmentId:d}){const[f,g]=$({getStateFromWidgetMgr:M,getDefaultStateFromProto:V,getCurrStateFromProto:I,updateWidgetMgrState:j,element:e,widgetMgr:s,fragmentId:d}),x=p.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),t=T(),{colors:o,spacing:h,sizes:r}=t,u=k(t),b=a?o.fadedText40:o.bodyText;return n(P,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:n(v,{checked:f,disabled:a,onChange:x,"aria-label":e.label,checkmarkType:e.type===E.StyleType.TOGGLE?m.toggle:m.default,labelPlacement:X.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?o.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let c=u?o.bgColor:o.bodyText;return a&&(c=u?o.gray70:o.gray90),{width:`calc(${r.checkbox} - ${t.spacing.twoXS})`,height:`calc(${r.checkbox} - ${t.spacing.twoXS})`,transform:i?`translateX(${r.checkbox})`:"",backgroundColor:c,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:c})=>{let l=o.fadedText40;return c&&!a&&(l=o.fadedText20),i&&!a&&(l=o.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:t.spacing.twoXS,paddingLeft:t.spacing.threeXS,paddingRight:t.spacing.threeXS,width:`calc(2 * ${r.checkbox})`,minWidth:`calc(2 * ${r.checkbox})`,height:r.checkbox,minHeight:r.checkbox,borderBottomLeftRadius:t.radii.full,borderTopLeftRadius:t.radii.full,borderBottomRightRadius:t.radii.full,borderTopRightRadius:t.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:c})=>{const l=c&&!a?o.primary:o.fadedText40;return{outline:0,width:r.checkbox,height:r.checkbox,marginTop:t.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&c?`0 0 0 0.2rem ${R(o.primary,.5)}`:"",borderLeftWidth:r.borderWidth,borderRightWidth:r.borderWidth,borderTopWidth:r.borderWidth,borderBottomWidth:r.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:t.lineHeights.small,paddingLeft:t.spacing.sm,position:"relative",color:b}}},children:C(w,{visibility:y(e.labelVisibility?.value),"data-testid":"stWidgetLabel",children:[n(S,{source:e.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),e.help&&n(L,{color:b,children:n(W,{content:e.help,placement:B.TOP_RIGHT})})]})})})}function M(e,a){return e.getBoolValue(a)}function V(e){return e.default??null}function I(e){return e.value??null}function j(e,a,s,d){a.setBoolValue(e,s.value,{fromUi:s.fromUi},d)}const z=p.memo(H);export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,E as j,_ as k,u as B,aJ as R,aK as G,m as x,aL as X,aM as $,aN as z,aO as L,aP as K,aQ as Q,o as F,aR as I,x as _,aS as Y,aT as Z,aU as q,J as ee,a6 as te,j as N,e as ne,aV as se,aW as ae,aX as re}from"./index.BBnWuh07.js";import{w as oe,E as ie}from"./withFullScreenWrapper.0cy2pVf5.js";import{a as M,S as W,T as ce}from"./Toolbar.BO_3WBaS.js";import{R as le}from"./index.BeTC4Yl-.js";import{u as ue}from"./FormClearHelper.l_UPPvkg.js";import"./sprintf.D7DtBTRn.js";import"./checkbox.ButpszcE.js";import"./createDownloadLinkElement.ZaXNnPK4.js";import"./toConsumableArray.B4o8rEx1.js";import"./possibleConstructorReturn.DSM84rOS.js";import"./createSuper.DYJA5xa6.js";import"./FileDownload.esm.CaRyZ-b2.js";var J=r.forwardRef(function(n,t){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(j,k({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},n,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM7 10h2v7H7zm4-3h2v10h-2zm4 6h2v4h-2z"}))});J.displayName="InsertChart";var P=r.forwardRef(function(n,t){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(j,k({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},n,{ref:t}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M20 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 2v3H5V5h15zm-5 14h-5v-9h5v9zM5 10h3v9H5v-9zm12 9v-9h3v9h-3z"}))});P.displayName="TableChart";const fe=20;function de(n){"params"in n&&"encoding"in n&&n.params.forEach(t=>{"select"in t&&(["interval","point"].includes(t.select)&&(t.select={type:t.select}),"type"in t.select&&t.select.type==="point"&&!("encodings"in t.select)&&x(t.select.encodings)&&(t.select.encodings=Object.keys(n.encoding)))})}const me=(n,t,a,s,o,f,u,h)=>{const e=JSON.parse(n);if(a==="streamlit"?e.config=R(e.config,o):e.usermeta?.embedOptions?.theme==="streamlit"?(e.config=R(e.config,o),e.usermeta.embedOptions.theme=void 0):e.config=G(e.config,o),e.title&&(typeof e.title=="string"&&(e.title={text:e.title}),e.title.limit=e.title.limit??Math.max(u-40,0)),f?(e.width=u,e.height=h,"vconcat"in e&&e.vconcat.forEach(l=>{l.width=u})):t&&(e.width=u,"vconcat"in e&&e.vconcat.forEach(l=>{l.width=u})),e.padding||(e.padding={}),x(e.padding.bottom)&&(e.padding.bottom=fe),e.datasets)throw new Error("Datasets should not be passed as part of the spec");return s.length>0&&de(e),e},he=(n,t,a,s)=>{const o=B(),{id:f,formId:u,spec:h,data:e,datasets:l,useContainerWidth:i,vegaLiteTheme:p,selectionMode:c}=n,S=r.useMemo(()=>c,[JSON.stringify(c)]),y=r.useMemo(()=>me(h,i,p,S,o,t,a||0,s),[h,i,p,S,o,t,a,s]);return{id:f,formId:u,vegaLiteTheme:p,spec:y,selectionMode:S,data:e,datasets:l,useContainerWidth:i}},pe={DATAFRAME_INDEX:"(index)"};function ge(n){return!n||n.dimensions.numDataRows===0?null:A(n)}function Se(n){const t=D(n);if(x(t))return null;const a={};for(const[s,o]of Object.entries(t))a[s]=A(o);return a}function D(n){if(n?.length===0)return null;const t={};return n.forEach(a=>{if(!a)return;const s=a.hasName?a.name:null;t[s]=a.data}),t}function A(n,t=0){if(n.dimensions.numDataRows===0)return[];const a=[],{numDataRows:s,numDataColumns:o,numIndexColumns:f}=n.dimensions,u=n.columnTypes[0]??void 0,h=u&&u.type===X.INDEX&&($(u)||z(u)||L(u));for(let e=t;e<s;e++){const l={};if(h){const{content:i}=n.getCell(e,0);l[pe.DATAFRAME_INDEX]=typeof i=="bigint"?Number(i):i}for(let i=0;i<o;i++){const p=i+f,{content:c,contentType:S}=n.getCell(e,p);if((c instanceof Date||typeof c=="number"&&Number.isFinite(c))&&(z(S)||L(S))&&!K(S)){const y=new Date(c).getTimezoneOffset()*60*1e3;l[n.columnNames[0][p]]=c.valueOf()+y}else l[n.columnNames[0][p]]=typeof c=="bigint"?Number(c):c}a.push(l)}return a}const ye=150,we=_.getLogger("useVegaLiteSelections"),Ce=(n,t,a)=>{const{id:s,formId:o,selectionMode:f}=n,u=r.useCallback(e=>{f.forEach(i=>{e.addSignalListener(i,Q(ye,(p,c)=>{const S=e.getState({data:(w,C)=>f.some(V=>`${V}_store`===w),recurse:!1});F(S)&&t.setElementState(s,"viewState",S);let y=c;"vlPoint"in c&&"or"in c.vlPoint&&(y=c.vlPoint.or);const E={id:s,formId:o},g=JSON.parse(t.getStringValue(E)||"{}"),d={selection:{...g?.selection||{},[p]:y||{}}};I(g,d)||t.setStringValue(E,JSON.stringify(d),{fromUi:!0},a)}))});const l=t.getElementState(s,"viewState");if(F(l))try{return e.setState(l)}catch(i){we.warn("Failed to restore view state",i)}return e},[s,f,t,o,a]),h=r.useCallback(()=>{const e={selection:{}};f.forEach(c=>{e.selection[c]={}});const l={id:s,formId:o},i=t.getStringValue(l),p=i?JSON.parse(i):e;I(p,e)||t.setStringValue(l,JSON.stringify(e),{fromUi:!0},a)},[s,o,a,f,t]);return{maybeConfigureSelections:u,onFormCleared:h}},H="source",be=_.getLogger("useVegaEmbed");function Ee(n,t,a){const s=r.useRef(null),o=r.useRef(null),f=r.useRef(H),u=r.useRef(null),h=r.useRef([]),{maybeConfigureSelections:e,onFormCleared:l}=Ce(n,t,a);ue({widgetMgr:t,element:n,onFormCleared:l});const{data:i,datasets:p}=n;r.useEffect(()=>{s.current===null&&(u.current=i,h.current=p)},[i,p]);const c=r.useCallback(()=>{o.current&&o.current(),o.current=null,s.current=null},[]),S=r.useCallback(async(g,d)=>{if(g.current===null)throw new Error("Element missing.");c();const w={ast:!0,expr:Z,tooltip:{disableDefaultStyle:!0},defaultStyle:!1,forceActionsMenu:!0},{vgSpec:C,view:V,finalize:b}=await Y(g.current,d,w);s.current=e(V),o.current=b;const m=Se(h.current),v=m?Object.keys(m):[];if(v.length===1){const[O]=v;f.current=O}else v.length===0&&C.data&&(f.current=H);const T=ge(u.current);if(T&&s.current.insert(f.current,T),m)for(const[O,U]of Object.entries(m))s.current.insert(O,U);return await s.current.runAsync(),await s.current.resize().runAsync(),s.current},[c,e]),y=r.useCallback((g,d,w,C)=>{if(!C||C.dimensions.numDataRows===0){try{g.remove(d,q)}finally{}return}if(!w||w.dimensions.numDataRows===0){g.insert(d,A(C));return}C.hash!==w.hash&&(g.data(d,A(C)),be.info(`Had to clear the ${d} dataset before inserting data through Vega view.`))},[]),E=r.useCallback(async(g,d)=>{if(s.current===null)return null;const w=u.current,C=h.current;(w||g)&&y(s.current,f.current,w,g);const V=D(C)??{},b=D(d)??{};for(const[m,v]of Object.entries(b)){const T=m||f.current,O=V[T];y(s.current,T,O,v)}for(const m of Object.keys(V))!Object.hasOwn(b,m)&&m!==f.current&&y(s.current,m,null,null);return await s.current?.resize().runAsync(),u.current=g,h.current=d,s.current},[y]);return{createView:S,updateView:E,finalizeView:c}}function Ve(n){try{const t=typeof n=="string"?JSON.parse(n):n;return!!(t.facet||t.encoding?.row||t.encoding?.column||t.encoding?.facet)}catch{return!1}}const ve=({disableFullscreenMode:n,element:t,fragmentId:a,widgetMgr:s})=>{const[o,f]=r.useState(!1),[u,h]=r.useState(!1),{expanded:e,height:l,width:i,expand:p,collapse:c}=ee(ie),{width:S,height:y,elementRef:E}=te([o],0),g=Ve(t.spec),d=he(t,e,g?i??0:S,l??0),{createView:w,updateView:C,finalizeView:V}=Ee(d,s,a),{data:b,datasets:m,spec:v}=d;return r.useLayoutEffect(()=>(E.current!==null&&w(E,v),V),[w,V,v,i,l,o,E]),r.useEffect(()=>{C(b,m)},[b,m,C]),r.useEffect(()=>{b||m&&m[0]?.data?h(!0):h(!1)},[b,m]),o?N(le,{data:b??m[0]?.data,height:l??y??void 0,customToolbarActions:[N(M,{label:"Show chart",icon:J,onClick:()=>{f(!1)}},"show-chart")]}):ne(W,{height:l,useContainerWidth:d.useContainerWidth,children:[N(ce,{target:W,isFullScreen:e,onExpand:p,onCollapse:c,disableFullscreenMode:n,children:u&&N(M,{label:"Show data",icon:P,onClick:()=>{f(!0)}})}),N(ae,{styles:[se]}),N(re,{"data-testid":"stVegaLiteChart",className:"stVegaLiteChart",useContainerWidth:d.useContainerWidth,isFullScreen:e,ref:E})]})},Ne=oe(ve),He=r.memo(Ne);export{se as StyledVegaLiteChartTooltips,R as applyStreamlitTheme,He as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function me(e,t){if(e){if(typeof e=="string")return
|
|
1
|
+
import{ad as q,p as J,r as c,au as Q,u as Y,av as ee,aw as l,j as E,e as te,l as re,f as ne,T as oe,P as ie,ax as ae,W as ue,ay as le,b as ce,B as P,c as x,D as se}from"./index.BBnWuh07.js";import{u as fe}from"./useBasicWidgetState.Bnm4FD6K.js";import"./FormClearHelper.l_UPPvkg.js";var pe={secondary:"secondary"},N={default:"default"},de={default:"default"},k=Object.freeze({radio:"radio",checkbox:"checkbox"}),z=q("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==N.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});z.displayName="StyledRoot";z.displayName="StyledRoot";function M(e){"@babel/helpers - typeof";return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(e)}function $(){return $=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$.apply(this,arguments)}function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ye(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?X(Object(r),!0).forEach(function(n){V(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function he(e,t){return ge(e)||Se(e,t)||me(e,t)||be()}function be(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function me(e,t){if(e){if(typeof e=="string")return K(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return K(e,t)}}function K(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Se(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,d;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(s){i=!0,d=s}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw d}}return n}}function ge(e){if(Array.isArray(e))return e}function ve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Oe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ee(e,t,r){return t&&Oe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&G(e,t)}function G(e,t){return G=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},G(e,t)}function we(e){var t=Re();return function(){var n=B(e),o;if(t){var i=B(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return Le(this,o)}}function Le(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F(e)}function F(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Re(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function B(e){return B=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},B(e)}function V(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ce(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var H=function(e){_e(r,e);var t=we(r);function r(){var n;ve(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),V(F(n),"childRefs",{}),n}return Ee(r,[{key:"render",value:function(){var o=this,i=this.props,a=i.overrides,d=a===void 0?{}:a,s=i.mode,y=s===void 0?k.checkbox:s,g=i.children,h=i.selected,_=i.disabled,f=i.onClick,b=i.kind,v=i.shape,m=i.size,T=J(d.Root,z),w=he(T,2),I=w[0],R=w[1],L=this.props["aria-label"]||this.props.ariaLabel,p=y===k.radio,W=c.Children.count(g);return c.createElement(Q.Consumer,null,function(Z){return c.createElement(I,$({"aria-label":L||Z.buttongroup.ariaLabel,"data-baseweb":"button-group",role:p?"radiogroup":"group",$shape:v,$length:g.length},R),c.Children.map(g,function(S,C){if(!c.isValidElement(S))return null;var A=S.props.isSelected?S.props.isSelected:Ce(h,C);return p&&(o.childRefs[C]=c.createRef()),c.cloneElement(S,{disabled:_||S.props.disabled,isSelected:A,ref:p?o.childRefs[C]:void 0,tabIndex:!p||A||p&&(!h||h===-1)&&C===0?0:-1,onKeyDown:function(u){if(p){var O=Number(h)?Number(h):0;if(u.key==="ArrowUp"||u.key==="ArrowLeft"){u.preventDefault&&u.preventDefault();var D=O-1<0?W-1:O-1;f&&f(u,D),o.childRefs[D].current&&o.childRefs[D].current.focus()}if(u.key==="ArrowDown"||u.key==="ArrowRight"){u.preventDefault&&u.preventDefault();var j=O+1>W-1?0:O+1;f&&f(u,j),o.childRefs[j].current&&o.childRefs[j].current.focus()}}},kind:b,onClick:function(u){_||(S.props.onClick&&S.props.onClick(u),f&&f(u,C))},shape:v,size:m,overrides:ye({BaseButton:{style:function(u){var O=u.$theme;return g.length===1?{}:v!==N.default?{marginLeft:O.sizing.scale100,marginRight:O.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":A,role:p?"radio":"checkbox"}}},S.props.overrides)})}))})}}]),r}(c.Component);V(H,"defaultProps",{disabled:!1,onClick:function(){},shape:N.default,size:de.default,kind:pe.secondary});function Pe(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function ke(e,t,r){return e==l.ClickMode.MULTI_SELECT?Pe(t,r??[]):r?.includes(t)?[]:[t]}function Be(e){return e.length===0?-1:e[0]}function Te(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Ie(e,t,r){const n=r===l.Style.PILLS?P.PILLS:r===l.Style.BORDERLESS?P.BORDERLESS_ICON:P.SEGMENTED_CONTROL,o=r===l.Style.BORDERLESS?x.XSMALL:x.MEDIUM,i=n===P.PILLS||n===P.SEGMENTED_CONTROL,a=r===l.Style.BORDERLESS?"lg":"base";return{element:E(se,{icon:t,label:e,iconSize:a,useSmallerFont:i}),kind:n,size:o}}function Ae(e,t,r,n){return r.indexOf(n)>-1?!0:t!==l.ClickMode.SINGLE_SELECT||e!==l.SelectionVisualization.ALL_UP_TO_SELECTED?!1:r.length>0&&n<r[0]}function De(e,t){return e&&(t=`${t}Active`),t}function je(e,t,r){const n={flexWrap:"wrap",maxWidth:"100%",margin:"0 0"},o=r?"100%":"auto",i=r?{}:{content:"''",flex:1e4};switch(e){case l.Style.BORDERLESS:return{...n,columnGap:t.threeXS,rowGap:t.threeXS};case l.Style.PILLS:return{...n,columnGap:t.twoXS,rowGap:t.twoXS,width:o};case l.Style.SEGMENTED_CONTROL:return{...n,columnGap:t.none,rowGap:t.twoXS,"::after":i,width:o};default:return n}}function Me(e,t,r,n,o,i,a){const d=Ae(r,n,o,t);let s=e.content,y=e.contentIcon;return d&&(s=e.selectedContent?e.selectedContent:s,y=e.selectedContentIcon?e.selectedContentIcon:y),c.forwardRef(function(h,_){const{element:f,kind:b,size:v}=Ie(s??"",y??void 0,i),m=De(!!(d&&!e.selectedContent&&!e.selectedContentIcon),b);return E(ce,{...h,size:v,kind:m,containerWidth:a,children:f})})}function $e(e,t){return e.getIntArrayValue(t)}function Ge(e){return e.default??null}function Ne(e){return e.value??null}function ze(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o,widthConfig:i}=e,{clickMode:a,options:d,selectionVisualization:s,style:y,label:g,labelVisibility:h,help:_}=r,f=Y(),[b,v]=fe({getStateFromWidgetMgr:$e,getDefaultStateFromProto:Ge,getCurrStateFromProto:Ne,updateWidgetMgrState:Te,element:r,widgetMgr:o,fragmentId:n}),m=ee(i),T=(R,L)=>{const p=ke(a,L,b);v({value:p,fromUi:!0})};let w;a===l.ClickMode.SINGLE_SELECT?w=k.radio:a===l.ClickMode.MULTI_SELECT&&(w=k.checkbox);const I=c.useMemo(()=>d.map((R,L)=>{const p=Me(R,L,s,a,b,y,m);return E(p,{},`${R.content}-${L}`)}),[a,d,s,y,b,m]);return te(le,{className:"stButtonGroup","data-testid":"stButtonGroup",containerWidth:m,children:[E(ue,{label:g,disabled:t,labelVisibility:re(h?.value??ae.LabelVisibilityOptions.COLLAPSED),children:_&&E(ne,{children:E(oe,{content:_,placement:ie.TOP})})}),E(H,{disabled:t,mode:w,onClick:T,selected:a===l.ClickMode.MULTI_SELECT?b:Be(b),overrides:{Root:{style:c.useCallback(()=>je(y,f.spacing,m),[y,f.spacing,m])}},children:I})]})}const xe=c.memo(ze);export{xe as default};
|