@stlite/desktop 0.90.13 → 0.90.14
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.
- package/CHANGELOG.md +6 -0
- package/build/assets/{ErrorOutline.esm-CJGMKtXr.js → ErrorOutline.esm-BnBxotPi.js} +1 -1
- package/build/assets/{FileDownload.esm-DVbGfwz7.js → FileDownload.esm-RGPPDhk8.js} +1 -1
- package/build/assets/{FileHelper-BAjDG49X.js → FileHelper-tNTMbDMm.js} +1 -1
- package/build/assets/{FormClearHelper-CaLJK07N.js → FormClearHelper-DGQP9oxJ.js} +1 -1
- package/build/assets/{Hooks-D54IehuR.js → Hooks-Bo61ucn1.js} +1 -1
- package/build/assets/{InputInstructions-BLplNLW9.js → InputInstructions-Ck_istEY.js} +1 -1
- package/build/assets/{Particles-VYhfVp_p.js → Particles-BlxXqWnI.js} +1 -1
- package/build/assets/{ProgressBar-DX8k7XSZ.js → ProgressBar-C-iICo4w.js} +1 -1
- package/build/assets/{Toolbar-BbbydoLD.js → Toolbar-ByIPpsVy.js} +1 -1
- package/build/assets/{base-input-d4WKPeU6.js → base-input-DRJDHdAL.js} +1 -1
- package/build/assets/{checkbox-DUA9ewQT.js → checkbox-2-JpNSRW.js} +1 -1
- package/build/assets/{createSuper-CoIMxZYP.js → createSuper-vJD5mbw5.js} +1 -1
- package/build/assets/{data-grid-overlay-editor-cvHWuOOd.js → data-grid-overlay-editor-BIgAXG8E.js} +1 -1
- package/build/assets/{downloader-CR6bzPv-.js → downloader-JpXWtQ-P.js} +1 -1
- package/build/assets/{es6-BCBcAdQS.js → es6-Lsq1Gov6.js} +2 -2
- package/build/assets/{iframeResizer.contentWindow-CEqjsNrn.js → iframeResizer.contentWindow-Guiwg0xE.js} +1 -1
- package/build/assets/{index-CJWk1YT9.js → index-0HifpjrJ.js} +1 -1
- package/build/assets/{index-gb2ePejP.js → index-B-7gUeK8.js} +1 -1
- package/build/assets/{index-D9P3ZYiC.js → index-B5XMuJqP.js} +1 -1
- package/build/assets/{index-BRiK5gVx.js → index-B7T6_RXn.js} +1 -1
- package/build/assets/{index-VVwti7cA.js → index-B9RImrnB.js} +1 -1
- package/build/assets/{index-NigQ67t-.js → index-BYmSaStp.js} +1 -1
- package/build/assets/{index-BMSSeqlt.js → index-BZmLxv-D.js} +1 -1
- package/build/assets/{index-BD2ZweM9.js → index-Bb6UZSFO.js} +1 -1
- package/build/assets/{index-B3GOsGpL.js → index-BhFJX5Vn.js} +1 -1
- package/build/assets/{index-CHBxMYoz.js → index-BhoSXjxz.js} +1 -1
- package/build/assets/{index-wnKDraWU.js → index-BwsrXI9O.js} +87 -87
- package/build/assets/{index-BGUuVZft.js → index-C0jxm_PH.js} +1 -1
- package/build/assets/{index-BJK2Ym_S.js → index-C636A-W7.js} +1 -1
- package/build/assets/{index-CD0SY35r.js → index-C9n8vq5U.js} +1 -1
- package/build/assets/{index-PHqcnj3c.js → index-CE3r0KWL.js} +1 -1
- package/build/assets/{index-j6pFDYKO.js → index-CFCb7WWw.js} +1 -1
- package/build/assets/{index-CdAXvPf5.js → index-CO2Aw19y.js} +1 -1
- package/build/assets/{index-CIRTE79j.js → index-CRhYEwNP.js} +1 -1
- package/build/assets/{index-Dynm-1sH.js → index-CRiFLKI5.js} +1 -1
- package/build/assets/{index-B7yzG-4X.js → index-CRtbPdb-.js} +5 -5
- package/build/assets/{index-C91sP-jG.js → index-CoAdDGfF.js} +1 -1
- package/build/assets/{index-wUVGuFfU.js → index-D4BdQDBD.js} +1 -1
- package/build/assets/{index-DOiS7VE9.js → index-D94FJ5GB.js} +1 -1
- package/build/assets/{index-B58bWjQH.js → index-DIjJwKUC.js} +1 -1
- package/build/assets/{index-DoQHaClc.js → index-DImx2D5B.js} +1 -1
- package/build/assets/{index-CTZrIDfL.js → index-DV5icRRG.js} +1 -1
- package/build/assets/{index-CwPp5UqK.js → index-DgEYnWf9.js} +1 -1
- package/build/assets/{index-mHvUvPYI.js → index-DkqUDAbB.js} +1 -1
- package/build/assets/{index-Bhgfj5y5.js → index-DqH3HG1G.js} +1 -1
- package/build/assets/{index-vLb3c1eZ.js → index-Dtvm0G3c.js} +1 -1
- package/build/assets/{index-Bwfh73dd.js → index-Q623jih7.js} +1 -1
- package/build/assets/{index-DCv3Ovf7.js → index-Zd5xxmFR.js} +1 -1
- package/build/assets/{index-CeNNLDtJ.js → index-a4tM28AE.js} +1 -1
- package/build/assets/{index-HqlJZ3Ag.js → index-lw_DueTS.js} +1 -1
- package/build/assets/{index-BdVfRySM.js → index-m7vCKamN.js} +1 -1
- package/build/assets/{index-D_4iXBI5.js → index-mytcrsu7.js} +1 -1
- package/build/assets/{index-XsxWL5x-.js → index-pOokbnGQ.js} +1 -1
- package/build/assets/{inherits-xHSaJdUZ.js → inherits-DgEBZpYa.js} +1 -1
- package/build/assets/{input-PliHooUw.js → input-BRw1nRj1.js} +1 -1
- package/build/assets/{memory-BJMhKXeY.js → memory-Do9YV2fF.js} +1 -1
- package/build/assets/{number-overlay-editor-DRf5xgI3.js → number-overlay-editor-CBg6iMqb.js} +1 -1
- package/build/assets/{sandbox-DBdCCxaG.js → sandbox-DO_nuL9g.js} +1 -1
- package/build/assets/{slicedToArray-Cuk3tbTR.js → slicedToArray-CCKNURYu.js} +1 -1
- package/build/assets/{timepicker-DjzHzJAt.js → timepicker-CBaJIVEG.js} +1 -1
- package/build/assets/{uniqueId-ikSpJ9AP.js → uniqueId-7HN9pV-Z.js} +1 -1
- package/build/assets/{useBasicWidgetState-raTjAqZP.js → useBasicWidgetState-CQoPeUHV.js} +1 -1
- package/build/assets/{useTextInputAutoExpand-Uac3U0I_.js → useTextInputAutoExpand-CJ0SgjFi.js} +1 -1
- package/build/assets/{useUpdateUiValue-BbEmiOZQ.js → useUpdateUiValue-CakBWvqR.js} +1 -1
- package/build/assets/{withFullScreenWrapper-C7u7nPsK.js → withFullScreenWrapper-6omMDHWT.js} +1 -1
- package/build/assets/{worker-CiNU4sgs.js → worker-CO569BKa.js} +4 -4
- package/build/electron/worker.js +5 -5
- package/build/index.html +1 -1
- package/package.json +4 -4
- package/wheels/streamlit-1.50.0-cp313-none-any.whl +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{be as lE,r as Dt,bO as Br,c2 as vt,a3 as dh,c3 as IN,aB as Uu,_ as Z4,c4 as PN,j as Jl,s as Y4,h as K4,c5 as MN,c6 as RN,J as Q4,c7 as mb,c8 as cE,aV as BN,L as ON,u as DN,bp as LN,c9 as uE}from"./index-
|
|
1
|
+
import{be as lE,r as Dt,bO as Br,c2 as vt,a3 as dh,c3 as IN,aB as Uu,_ as Z4,c4 as PN,j as Jl,s as Y4,h as K4,c5 as MN,c6 as RN,J as Q4,c7 as mb,c8 as cE,aV as BN,L as ON,u as DN,bp as LN,c9 as uE}from"./index-BwsrXI9O.js";import{_ as gs,C as kN}from"./slicedToArray-CCKNURYu.js";import{d as Ju,c as ef,b as X2,_ as gp,a as Z2}from"./inherits-DgEBZpYa.js";import{E as J4,w as FN}from"./withFullScreenWrapper-6omMDHWT.js";import{T as NN,a as UN}from"./Toolbar-ByIPpsVy.js";import{a as zN}from"./useBasicWidgetState-CQoPeUHV.js";import"./FormClearHelper-DGQP9oxJ.js";function VN(r,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in r)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(r,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}async function g0(r,e,t,n){return n._parse(r,e,t,n)}function _i(r,e){if(!r)throw new Error(e||"loader assertion failed.")}const M_=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),fE=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);fE&&parseFloat(fE[1]);const hE=globalThis,dE=globalThis.process||{},jN=globalThis.navigator||{};function eB(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;const t=typeof navigator<"u"&&navigator.userAgent;return!!(t&&t.indexOf("Electron")>=0)}function ph(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||eB()}function HN(r){return ph()?eB()?"Electron":(jN.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node"}const tB="4.1.0";function GN(r){try{const e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}class WN{constructor(e,t,n="sessionStorage"){this.storage=GN(n),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function $N(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function qN(r,e=8){const t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var Vm;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Vm||(Vm={}));const XN=10;function pE(r){return typeof r!="string"?r:(r=r.toUpperCase(),Vm[r]||Vm.WHITE)}function ZN(r,e,t){return!ph&&typeof r=="string"&&(e&&(r=`\x1B[${pE(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${pE(t)+XN}m${r}\x1B[49m`)),r}function YN(r,e=["constructor"]){const t=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(t),i=r;for(const s of n){const o=i[s];typeof o=="function"&&(e.find(l=>s===l)||(i[s]=o.bind(r)))}}function Y2(r,e){if(!r)throw new Error("Assertion failed")}function gd(){let r;if(ph()&&hE.performance)r=hE?.performance?.now?.();else if("hrtime"in dE){const e=dE?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}const md={debug:ph()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},KN={enabled:!0,level:0};function _d(){}const AE={},gE={once:!0};class Rp{constructor({id:e}={id:""}){this.VERSION=tB,this._startTs=gd(),this._deltaTs=gd(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new WN(`__probe-${this.id}__`,KN),this.timeStamp(`${this.id} started`),YN(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((gd()-this._startTs).toPrecision(10))}getDelta(){return Number((gd()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,md.warn,arguments,gE)}error(e){return this._getLogFunction(0,e,md.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,md.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,md.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,md.debug||md.info,arguments,gE)}table(e,t,n){return t?this._getLogFunction(e,t,console.table||_d,n&&[n],{tag:JN(t)}):_d}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||_d)}group(e,t,n={collapsed:!1}){const i=mE({logLevel:e,message:t,opts:n}),{collapsed:s}=n;return i.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,t,n={}){return this.group(e,t,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||_d)}withGroup(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=rB(e)}_getLogFunction(e,t,n,i,s){if(this._shouldLog(e)){s=mE({logLevel:e,message:t,args:i,opts:s}),n=n||s.method,Y2(n),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=gd();const o=s.tag||s.message;if(s.once&&o)if(!AE[o])AE[o]=gd();else return _d;return t=QN(this.id,s.message,s),n.bind(console,t,...s.args)}return _d}}Rp.VERSION=tB;function rB(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return Y2(Number.isFinite(e)&&e>=0),e}function mE(r){const{logLevel:e,message:t}=r;r.logLevel=rB(e);const n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&n.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break}typeof r.message=="function"&&(r.message=r.message());const i=typeof r.message;return Y2(i==="string"||i==="object"),Object.assign(r,{args:n},r.opts)}function QN(r,e,t){if(typeof e=="string"){const n=t.time?qN($N(t.total)):"";e=t.time?`${r}: ${n} ${e}`:`${r}: ${e}`,e=ZN(e,t.color,t.background)}return e}function JN(r){for(const e in r)for(const t in r[e])return t||"untitled";return"empty"}globalThis.probe={};const nB=new Rp({id:"@probe.gl/log"}),cv="4.3.3",e5=cv[0]>="0"&&cv[0]<="9"?`v${cv}`:"";function t5(){const r=new Rp({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=r,globalThis.loaders.version=e5,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=r,r}const r5=t5();function iB(r,e){return sB(r||{},e)}function sB(r,e,t=0){if(t>3)return e;const n={...r};for(const[i,s]of Object.entries(e))s&&typeof s=="object"&&!Array.isArray(s)?n[i]=sB(n[i]||{},e[i],t+1):n[i]=e[i];return n}function n5(r){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,r)}function i5(r){return globalThis.loaders?.modules?.[r]||null}const s5="latest";function o5(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.3"),globalThis._loadersgl_.version}const oB=o5();function Yc(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}const ka=typeof process!="object"||String(process)!=="[object process]"||process.browser,K2=typeof importScripts=="function",a5=typeof window<"u"&&typeof window.orientation<"u",_E=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);_E&&parseFloat(_E[1]);class l5{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(e,t){this.name=e,this.workerThread=t,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){Yc(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){Yc(this.isRunning),this.isRunning=!1,this._reject(e)}}class uv{terminate(){}}const fv=new Map;function c5(r){Yc(r.source&&!r.url||!r.source&&r.url);let e=fv.get(r.source||r.url);return e||(r.url&&(e=u5(r.url),fv.set(r.url,e)),r.source&&(e=aB(r.source),fv.set(r.source,e))),Yc(e),e}function u5(r){if(!r.startsWith("http"))return r;const e=f5(r);return aB(e)}function aB(r){const e=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(e)}function f5(r){return`try {
|
|
2
2
|
importScripts('${r}');
|
|
3
3
|
} catch (error) {
|
|
4
4
|
console.error(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,r as t,j as r,f as a}from"./index-
|
|
1
|
+
import{s as e,r as t,j as r,f as a}from"./index-BwsrXI9O.js";import{P as o}from"./ProgressBar-C-iICo4w.js";const i=e("div",{target:"e18r7x300"})(({theme:s})=>({paddingBottom:s.spacing.sm,lineHeight:"normal"}),"");function l({element:s}){return r.jsxs("div",{className:"stProgress","data-testid":"stProgress",children:[r.jsx(i,{children:r.jsx(a,{source:s.text,allowHTML:!1,isLabel:!0})}),r.jsx(o,{value:s.value})]})}const m=t.memo(l);export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,E as J,_ as W,u as G,aN as F,aO as X,k as R,aP as $,aQ as Q,aR as j,aS as L,aT as Y,aU as Z,n as I,aV as M,x as P,aW as K,aX as q,aY as ee,J as te,a4 as ne,av as se,aZ as re,j as T,a_ as ae,a$ as oe,b0 as ce}from"./index-
|
|
1
|
+
import{r as a,E as J,_ as W,u as G,aN as F,aO as X,k as R,aP as $,aQ as Q,aR as j,aS as L,aT as Y,aU as Z,n as I,aV as M,x as P,aW as K,aX as q,aY as ee,J as te,a4 as ne,av as se,aZ as re,j as T,a_ as ae,a$ as oe,b0 as ce}from"./index-BwsrXI9O.js";import{w as ie,E as le}from"./withFullScreenWrapper-6omMDHWT.js";import{a as H,S as _,T as ue}from"./Toolbar-ByIPpsVy.js";import{R as fe}from"./index-CRtbPdb-.js";import{u as de}from"./FormClearHelper-DGQP9oxJ.js";import"./sprintf-DpPCfzXw.js";import"./checkbox-2-JpNSRW.js";import"./createDownloadLinkElement-ZaXNnPK4.js";import"./slicedToArray-CCKNURYu.js";import"./inherits-DgEBZpYa.js";import"./createSuper-vJD5mbw5.js";import"./FileDownload.esm-RGPPDhk8.js";var U=a.forwardRef(function(n,t){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(J,W({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},n,{ref:t}),a.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),a.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"}))});U.displayName="InsertChart";var B=a.forwardRef(function(n,t){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(J,W({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},n,{ref:t}),a.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),a.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"}))});B.displayName="TableChart";const me=20;function he(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)&&R(t.select.encodings)&&(t.select.encodings=Object.keys(n.encoding)))})}const pe=(n,t,r,s,u,i,l,p)=>{const e=JSON.parse(n);if(s==="streamlit"?e.config=F(e.config,i):e.usermeta?.embedOptions?.theme==="streamlit"?(e.config=F(e.config,i),e.usermeta.embedOptions.theme=void 0):e.config=X(e.config,i),e.title&&(typeof e.title=="string"&&(e.title={text:e.title}),e.title.limit=e.title.limit??Math.max(l-40,0)),r&&(e.height=p),t&&(e.width=l,"vconcat"in e&&e.vconcat.forEach(d=>{d.width=l})),e.padding||(e.padding={}),R(e.padding.bottom)&&(e.padding.bottom=me),e.datasets)throw new Error("Datasets should not be passed as part of the spec");return u.length>0&&he(e),e},ge=(n,t,r,s,u)=>{const i=G(),{id:l,formId:p,spec:e,data:d,datasets:o,vegaLiteTheme:f,selectionMode:c}=n,g=a.useMemo(()=>c,[JSON.stringify(c)]),w=a.useMemo(()=>pe(e,s,u,f,g,i,t,r),[e,s,u,f,g,i,t,r]);return{id:l,formId:p,vegaLiteTheme:f,spec:w,selectionMode:g,data:d,datasets:o,useContainerWidth:s}},Se={DATAFRAME_INDEX:"(index)"};function ye(n){return!n||n.dimensions.numDataRows===0?null:A(n)}function we(n){const t=D(n);if(R(t))return null;const r={};for(const[s,u]of Object.entries(t))r[s]=A(u);return r}function D(n){if(n?.length===0)return null;const t={};return n.forEach(r=>{if(!r)return;const s=r.hasName?r.name:null;t[s]=r.data}),t}function A(n,t=0){if(n.dimensions.numDataRows===0)return[];const r=[],{numDataRows:s,numDataColumns:u,numIndexColumns:i}=n.dimensions,l=n.columnTypes[0]??void 0,p=l&&l.type===$.INDEX&&(Q(l)||j(l)||L(l));for(let e=t;e<s;e++){const d={};if(p){const{content:o}=n.getCell(e,0);d[Se.DATAFRAME_INDEX]=typeof o=="bigint"?Number(o):o}for(let o=0;o<u;o++){const f=o+i,{content:c,contentType:g}=n.getCell(e,f);if((c instanceof Date||typeof c=="number"&&Number.isFinite(c))&&(j(g)||L(g))&&!Y(g)){const w=new Date(c).getTimezoneOffset()*60*1e3;d[n.columnNames[0][f]]=c.valueOf()+w}else d[n.columnNames[0][f]]=typeof c=="bigint"?Number(c):c}r.push(d)}return r}const be=150,Ce=P.getLogger("useVegaLiteSelections"),Ee=(n,t,r)=>{const{id:s,formId:u,selectionMode:i}=n,l=a.useCallback(e=>{i.forEach(o=>{e.addSignalListener(o,Z(be,(f,c)=>{const g=e.getState({data:(S,y)=>i.some(E=>`${E}_store`===S),recurse:!1});I(g)&&t.setElementState(s,"viewState",g);let w=c;"vlPoint"in c&&"or"in c.vlPoint&&(w=c.vlPoint.or);const O={id:s,formId:u},h=JSON.parse(t.getStringValue(O)||"{}"),m={selection:{...h?.selection||{},[f]:w||{}}};M(h,m)||t.setStringValue(O,JSON.stringify(m),{fromUi:!0},r)}))});const d=t.getElementState(s,"viewState");if(I(d))try{return e.setState(d)}catch(o){Ce.warn("Failed to restore view state",o)}return e},[s,i,t,u,r]),p=a.useCallback(()=>{const e={selection:{}};i.forEach(c=>{e.selection[c]={}});const d={id:s,formId:u},o=t.getStringValue(d),f=o?JSON.parse(o):e;M(f,e)||t.setStringValue(d,JSON.stringify(e),{fromUi:!0},r)},[s,u,r,i,t]);return{maybeConfigureSelections:l,onFormCleared:p}},k="source",Ve=P.getLogger("useVegaEmbed");function ve(n,t,r){const s=a.useRef(null),u=a.useRef(null),i=a.useRef(k),l=a.useRef(null),p=a.useRef([]),{maybeConfigureSelections:e,onFormCleared:d}=Ee(n,t,r);de({widgetMgr:t,element:n,onFormCleared:d});const{data:o,datasets:f}=n;a.useEffect(()=>{s.current===null&&(l.current=o,p.current=f)},[o,f]);const c=a.useCallback(()=>{u.current&&u.current(),u.current=null,s.current=null},[]),g=a.useCallback(async(h,m)=>{if(h.current===null)throw new Error("Element missing.");c();const S={ast:!0,expr:q,tooltip:{disableDefaultStyle:!0},defaultStyle:!1,forceActionsMenu:!0},{vgSpec:y,view:E,finalize:x}=await K(h.current,m,S);s.current=e(E),u.current=x;const b=we(p.current),V=b?Object.keys(b):[];if(V.length===1){const[C]=V;i.current=C}else V.length===0&&y.data&&(i.current=k);const v=ye(l.current);if(v&&s.current.insert(i.current,v),b)for(const[C,N]of Object.entries(b))s.current.insert(C,N);return await s.current.runAsync(),await s.current.resize().runAsync(),s.current},[c,e]),w=a.useCallback((h,m,S,y)=>{if(!y||y.dimensions.numDataRows===0){try{h.remove(m,ee)}finally{}return}if(!S||S.dimensions.numDataRows===0){h.insert(m,A(y));return}y.hash!==S.hash&&(h.data(m,A(y)),Ve.info(`Had to clear the ${m} dataset before inserting data through Vega view.`))},[]),O=a.useCallback(async(h,m)=>{if(s.current===null)return null;const S=l.current,y=p.current;(S||h)&&w(s.current,i.current,S,h);const E=D(y)??{},x=D(m)??{};for(const[b,V]of Object.entries(x)){const v=b||i.current,C=E[v];w(s.current,v,C,V)}for(const b of Object.keys(E))!Object.hasOwn(x,b)&&b!==i.current&&w(s.current,b,null,null);return await s.current?.resize().runAsync(),l.current=h,p.current=m,s.current},[w]);return{createView:g,updateView:O,finalizeView:c}}function xe(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 Ne=({disableFullscreenMode:n,element:t,fragmentId:r,widgetMgr:s,widthConfig:u,heightConfig:i})=>{const[l,p]=a.useState(!1),[e,d]=a.useState(!1),{expanded:o,height:f,width:c,expand:g,collapse:w}=te(le),{width:O,height:h,elementRef:m}=ne([l],0),S=se(u)||t.useContainerWidth,y=re(i),E=xe(t.spec),x=ge(t,E?c??0:O,(o?f:h)??0,o?!0:S,o?!0:y),{createView:b,updateView:V,finalizeView:v}=ve(x,s,r),{data:C,datasets:N,spec:z}=x;return a.useLayoutEffect(()=>(m.current!==null&&b(m,z),v),[b,v,z,c,f,l,m]),a.useEffect(()=>{V(C,N)},[C,N,V]),a.useEffect(()=>{C||N?.[0]?.data?d(!0):d(!1)},[C,N]),l?T.jsx(fe,{data:C??N[0]?.data,height:f??h??void 0,customToolbarActions:[T.jsx(H,{label:"Show chart",icon:U,onClick:()=>{p(!1)}},"show-chart")]}):T.jsxs(_,{height:y?o?f:"100%":f,useContainerWidth:o?!0:S,children:[T.jsx(ue,{target:_,isFullScreen:o,onExpand:g,onCollapse:w,disableFullscreenMode:n,children:e&&T.jsx(H,{label:"Show data",icon:B,onClick:()=>{p(!0)}})}),T.jsx(ae,{styles:oe}),T.jsx(ce,{"data-testid":"stVegaLiteChart",className:"stVegaLiteChart",useContainerWidth:S,useContainerHeight:y,ref:m})]})},Te=ie(Ne),ke=a.memo(Te);export{oe as StyledVegaLiteChartTooltips,F as applyStreamlitTheme,ke as default};
|