@marimo-team/frontend 0.23.14-dev7 → 0.23.14-dev9
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/dist/assets/{command-palette-D5bwfa36.js → command-palette-MczSEobn.js} +1 -1
- package/dist/assets/{edit-page-aHoWe_ZD.js → edit-page-B9Nh19TH.js} +3 -3
- package/dist/assets/{index-BWxVNMl8.js → index-Bs8gxNWl.js} +2 -2
- package/dist/assets/{useNotebookActions-CL7ZID9s.js → useNotebookActions-BGojpXqb.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/components/editor/actions/useNotebookActions.tsx +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as ze}from"./chunk-LvLJmgfZ.js";import{d as T,l as rt,p as dt,u as I}from"./useEvent-D91BmmQi.js";import{t as ct}from"./react-Bj1aDYRI.js";import{An as ht,D as We,E as pt,En as mt,Gi as be,Nn as ut,Pn as ft,Qt as bt,_ as yt,br as Me,ct as kt,dt as Ae,h as Se,jn as wt,kn as xt,kr as gt,lt as jt,ri as vt,t as Ct,wr as zt,xr as Wt,yr as Mt}from"./cells-B7YKR2ed.js";import{t as z}from"./compiler-runtime-B3qBwwSJ.js";import{n as At,r as St,x as _t}from"./ai-model-dropdown-Btglrejh.js";import{_ as H,d as _e}from"./useEventListener-BakX-tnw.js";import{r as Dt,x as Nt}from"./utils-Dev6I_Kv.js";import{n as W,t as De}from"./constants-B9JJ72XE.js";import{T as X,v as Pt,w as It}from"./config-3clPIEB9.js";import{t as Et}from"./jsx-runtime-PbYoItBR.js";import{o as Lt}from"./alert-dialog-CC0gG4Av.js";import{a as Tt,c as Ht,i as Ft,n as Rt,r as qt,s as Bt,t as Ot}from"./select-Cjly7tmx.js";import{Ft as Vt}from"./JsonOutput-BkFXuRpB.js";import{c as Ne,d as ye,n as Yt,o as $t,r as ke,t as Kt}from"./download-DiInTgPW.js";import{t as Ut}from"./tooltip-CgQpRVyN.js";import{r as Gt,t as we}from"./button-BF7GSjhW.js";import{i as Jt,t as Pe}from"./strings-DvZlHYnD.js";import{r as F}from"./requests-KshNNAOp.js";import{t as m}from"./createLucideIcon-BTp1tQDO.js";import{F as Qt,I as Xt,L as Ie,P as Zt,a as Ee,i as Le,u as Te}from"./layout-BI4PmskA.js";import{t as He}from"./check-DQmqoJgr.js";import{r as ea}from"./useCellActionButton-BjcJ6BLJ.js";import{t as ta}from"./code-DP40S9ln.js";import{t as aa}from"./copy-IBNGDypD.js";import{t as Fe}from"./eye-off-DI0EQXw0.js";import{t as oa}from"./external-link-BktyywYg.js";import{t as Z}from"./file-BvoBtS_V.js";import{u as na}from"./form-ChOi66u2.js";import{n as ia,r as sa,t as la}from"./youtube-NfBeYlaL.js";import{i as ra,n as Re}from"./add-connection-dialog-CyoxEDp-.js";import{t as da}from"./house-DHu4JLi3.js";import{t as ca}from"./image-BzUcK6ho.js";import{t as ha}from"./link-e5mRDDOC.js";import{r as pa}from"./input-DB2LiTiQ.js";import{t as ma}from"./settings-1WkYMLdR.js";import{t as ua}from"./sparkles-COaEc8Qn.js";import{y as fa}from"./textarea-BYXnNYSr.js";import{t as ba}from"./square-35tXIgiR.js";import{t as M}from"./use-toast-kCNiuc-_.js";import{n as qe,t as ya}from"./paths-DhuNSnZ_.js";import{o as ka}from"./session-CsT5Gg9j.js";import{n as ee}from"./copy-D8MtpXgN.js";import{r as wa}from"./useRunCells-BQPsvZjd.js";import{a as xa,c as ga,i as ja,n as va,r as Ca}from"./dialog-DkJmIrsG.js";import{n as xe}from"./ImperativeModal-B62Q6S9l.js";import{r as za,t as Be}from"./share-DQjChRJG.js";import{a as Wa}from"./cell-link-DO4acQD0.js";import{a as Ma}from"./renderShortcut-LpVarhnQ.js";import{t as Aa}from"./icons-avFV3lBF.js";import{t as Sa}from"./pair-with-agent-modal-Q9Od23Rh.js";import{t as _a}from"./github-DghuZBnj.js";import{n as Oe}from"./marimo-icons-DuRILrB8.js";import{t as Da}from"./links-Bof3pNQU.js";import{r as Na,t as Ve}from"./hooks-QlMczg0I.js";import{t as Ye}from"./types-BLEgJ92v.js";var Pa=m("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Ia=m("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),$e=m("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Ke=m("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Ue=m("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Ea=m("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),La=m("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),Ta=m("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),Ha=m("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Fa=m("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ge=m("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),Ra=m("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),qa=m("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Je=m("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Qe=z(),Xe=ze(ct(),1),a=ze(Et(),1),te="https://static.marimo.app";const Ba=e=>{let t=(0,Qe.c)(25),{onClose:n}=e,[o,i]=(0,Xe.useState)(""),{exportAsHTML:d}=F(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,s=`${te}/static/${l}`,r;t[0]!==d||t[1]!==n||t[2]!==l?(r=async v=>{v.preventDefault(),n();let L=await d({download:!1,includeCode:!0,files:Zt.INSTANCE.filenames()}),A=M({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${te}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:L,path:l})}).catch(()=>{A.dismiss(),M({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:W.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),A.dismiss(),M({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=d,t[1]=n,t[2]=l,t[3]=r):r=t[3];let h;t[4]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsx)(ga,{children:"Share static notebook"}),t[4]=h):h=t[4];let p;t[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsxs)(xa,{children:[h,(0,a.jsxs)(Ca,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:te,target:"_blank",children:te}),"."]})]}),t[5]=p):p=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{i(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let f;t[7]===o?f=t[8]:(f=(0,a.jsx)(pa,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=f);let b;t[9]===s?b=t[10]:(b=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Oa,{text:s}),(0,a.jsx)("span",{className:"text-primary",children:s})]})]}),t[9]=s,t[10]=b);let y;t[11]!==f||t[12]!==b?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[f,b]}),t[11]=f,t[12]=b,t[13]=y):y=t[13];let k;t[14]===n?k=t[15]:(k=(0,a.jsx)(we,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=k);let w;t[16]===s?w=t[17]:(w=(0,a.jsx)(we,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await ee(s)},children:"Create"}),t[16]=s,t[17]=w);let x;t[18]!==k||t[19]!==w?(x=(0,a.jsxs)(ja,{children:[k,w]}),t[18]=k,t[19]=w,t[20]=x):x=t[20];let j;return t[21]!==r||t[22]!==x||t[23]!==y?(j=(0,a.jsx)(va,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:r,children:[p,y,x]})}),t[21]=r,t[22]=x,t[23]=y,t[24]=j):j=t[24],j};var Oa=e=>{let t=(0,Qe.c)(8),[n,o]=Xe.useState(!1),i;t[0]===e.text?i=t[1]:(i=Gt.stopPropagation(async h=>{h.preventDefault(),await ee(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=i);let d=i,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let s;t[3]===d?s=t[4]:(s=(0,a.jsx)(we,{"data-testid":"copy-static-notebook-url-button",onClick:d,size:"xs",variant:"secondary",children:l}),t[3]=d,t[4]=s);let r;return t[5]!==n||t[6]!==s?(r=(0,a.jsx)(Ut,{content:"Copied!",open:n,children:s}),t[5]=n,t[6]=s,t[7]=r):r=t[7],r},Va=z();function Ya(){let e=document.getElementsByClassName(De.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=be.findElement(t);if(!o){H.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:be.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function $a(e){if(!e){H.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(be.create(e.cellId));if(!t){H.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${De.outputArea}`)){H.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ze(){let e=(0,Va.c)(2),t=T(Ae),n;return e[0]===t?n=e[1]:(n=()=>{let o=Ya();t(i=>({mode:jt(i.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{$a(o)})})},e[0]=t,e[1]=n),n}const et=dt(!1);var Ka=z();const Ua=()=>{let e=(0,Ka.c)(7),{selectedLayout:t}=Ee(),{setLayoutView:n}=Le();if(X()&&!ft("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=s=>n(s),e[0]=n,e[1]=o);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(Bt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Ht,{placeholder:"Select a view"})}),e[2]=i):i=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)(Rt,{children:(0,a.jsxs)(qt,{children:[(0,a.jsx)(Tt,{children:"View as"}),Ye.map(Ja)]})}),e[3]=d):d=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Ot,{"data-testid":"layout-select",value:t,onValueChange:o,children:[i,d]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function Ga(e){return(0,a.jsx)(tt(e),{className:"h-4 w-4"})}function tt(e){switch(e){case"vertical":return Ta;case"grid":return sa;case"slides":return Ge;default:return Jt(e),ba}}function at(e){return Pe.startCase(e)}function Ja(e){return(0,a.jsx)(Ft,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ga(e),(0,a.jsx)("span",{children:at(e)})]})},e)}async function Qa(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Xa=z();function Za(e){let t=(0,Xa.c)(5),{openPrompt:n,closeModal:o}=xe(),{sendCopy:i}=F(),d;return t[0]!==o||t[1]!==n||t[2]!==i||t[3]!==e?(d=()=>{if(!e)return null;let l=ya.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${qe.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:s=>{let r=l.join(qe.dirname(e),s);i({source:e,destination:r}).then(()=>{o(),M({title:"Notebook copied",description:"A copy of the notebook has been created."}),Da(r)})}})},t[0]=o,t[1]=n,t[2]=i,t[3]=e,t[4]=d):d=t[4],d}var eo=z();function ot(){let e=(0,eo.c)(4),{openConfirm:t}=xe(),n=T(Pt),{sendRestart:o}=F(),i;return e[0]!==t||e[1]!==o||e[2]!==n?(i=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Lt,{onClick:async()=>{n({state:It.CLOSING}),await o(),za()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=i):i=e[3],i}var to=z(),ao=new bt,oo=e=>ao.isSupported(e)?"markdown":"code";const nt=()=>{let e=(0,to.c)(3),{updateCellConfig:t}=We(),{saveCellConfig:n}=F(),o;return e[0]!==n||e[1]!==t?(o=async(i,d)=>{let l=Se(),s={};for(let h of l.cellIds.inOrderIds){let p=l.cellData[h];p===void 0||p.config.hide_code===i||oo(p.code)===d&&(s[h]={hide_code:i})}let r=_e.entries(s);if(r.length!==0){await n({configs:s});for(let[h,p]of r)t({cellId:h,config:p})}},e[0]=n,e[1]=t,e[2]=o):o=e[2],o};var no=z(),E=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function io(){var je,ve,Ce;let e=(0,no.c)(56),t=Wa(),{openModal:n,closeModal:o}=xe(),{toggleApplication:i}=xt(),{selectedPanel:d}=ht(),[l]=rt(Ae),s=I(kt),r=nt(),[h]=Nt(),p=I(mt),g=I(Dt),{updateCellConfig:f,undoDeleteCell:b,clearAllCellOutputs:y,addSetupCellIfDoesntExist:k,collapseAllCells:w,expandAllCells:x}=We(),j=ot(),v=wa(),L=Za(t),A=T(et),oe=T(At),{handleClick:ne}=St(),ie=T(_t),{exportAsIPYNB:se,exportAsMarkdown:le,readCode:S,saveCellConfig:re,updateCellOutputs:_}=F(),D=Na(),de=I(yt),ce=I(Ct),he=I(pt),{selectedLayout:R}=Ee(),{setLayoutView:pe}=Le(),q=Ze(),B=((je=h.sharing)==null?void 0:je.html)??!0,O=((ve=h.sharing)==null?void 0:ve.wasm)??!0,V=((Ce=h.sharing)==null?void 0:Ce.molab)??!0,ge=!X(),me=R==="slides",it=Co,st=vo,Y;e[0]!==t||e[1]!==D||e[2]!==_?(Y=async c=>{let{preset:u,title:C}=c;if(!t){ae();return}await Ne(C,async fe=>{await Ve({takeScreenshots:()=>D({progress:fe}),updateCellOutputs:_}),await Qa({filename:t,preset:u,downloadPDF:Yt})})},e[0]=t,e[1]=D,e[2]=_,e[3]=Y):Y=e[3];let N=Y,$;e[4]===N?$=e[5]:($=async()=>{if(ge){await N({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),u=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(jo,0),setTimeout(()=>window.dispatchEvent(u),0)},e[4]=N,e[5]=$);let K=$,U;e[6]!==se||e[7]!==t||e[8]!==D||e[9]!==_?(U=async()=>{if(!t){ae();return}await Ne("Downloading IPYNB...",async c=>{await Ve({takeScreenshots:()=>D({progress:c}),updateCellOutputs:_});let u=await se({download:!1});ke(new Blob([u],{type:"application/x-ipynb+json"}),ye.toIPYNB(document.title))})},e[6]=se,e[7]=t,e[8]=D,e[9]=_,e[10]=U):U=e[10];let ue=U,G;e[11]===Symbol.for("react.memo_cache_sentinel")?(G=(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),e[11]=G):G=e[11];let J;e[12]===Symbol.for("react.memo_cache_sentinel")?(J=(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),e[12]=J):J=e[12];let P;e[13]===t?P=e[14]:(P=async()=>{if(!t){ae();return}await Te({filename:t,includeCode:!0})},e[13]=t,e[14]=P);let Q;return e[15]!==k||e[16]!==g||e[17]!==ce||e[18]!==p||e[19]!==y||e[20]!==o||e[21]!==w||e[22]!==L||e[23]!==N||e[24]!==x||e[25]!==le||e[26]!==t||e[27]!==K||e[28]!==ue||e[29]!==de||e[30]!==me||e[31]!==s||e[32]!==n||e[33]!==ne||e[34]!==S||e[35]!==j||e[36]!==v||e[37]!==re||e[38]!==R||e[39]!==d||e[40]!==r||e[41]!==A||e[42]!==ie||e[43]!==pe||e[44]!==oe||e[45]!==B||e[46]!==V||e[47]!==O||e[48]!==P||e[49]!==i||e[50]!==q||e[51]!==b||e[52]!==he||e[53]!==f||e[54]!==l.mode?(Q=[{icon:G,label:"Download",handle:E,dropdown:[{icon:J,label:"Download as HTML",handle:P},{icon:(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ae();return}await Te({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(Aa,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await le({download:!1});ke(new Blob([c],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ha,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ue},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await S();ke(new Blob([c.contents],{type:"text/plain"}),ye.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Ma("global.hideCode",!1)]}),handle:go},me?{divider:!0,icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:E,dropdown:[{icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:K},{icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:st(!0),hidden:!ge,handle:async()=>{await N({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:K}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:X(),handle:async()=>{n((0,a.jsx)(Sa,{onClose:o}))}},{icon:(0,a.jsx)(Ra,{size:14,strokeWidth:1.5}),label:"Share",handle:E,hidden:!B&&!O&&!V,dropdown:[{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!B,handle:async()=>{n((0,a.jsx)(Ba,{onClose:o}))}},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!O,handle:async()=>{await ee(Be({code:(await S()).contents})),M({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Oe,{size:14,strokeWidth:1.5}),label:"Create molab notebook",hidden:!V,handle:async()=>{let c=Be({code:(await S()).contents,baseUrl:`${W.molab}/new`});window.open(c,"_blank")}}]},{icon:(0,a.jsx)(Fa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:E,dropdown:wt.flatMap(c=>{let u=c.type==="ai"&&!g;if(ut({panel:c,capabilities:p,aiEnabled:g})&&!u)return[];let{type:C,Icon:fe,additionalKeywords:lt}=c;return{label:Pe.startCase(C),rightElement:it(d===C),icon:(0,a.jsx)(fe,{size:14,strokeWidth:1.5}),handle:()=>{if(u){ne("ai","ai-features");return}i(C)},additionalKeywords:lt}})},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Present as",handle:E,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(fa,{size:14,strokeWidth:1.5}):(0,a.jsx)(Qt,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{q()}},...Ye.map((c,u)=>{let C=tt(c);return{divider:u===0,label:at(c),icon:(0,a.jsx)(C,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:R===c&&(0,a.jsx)(He,{size:14})}),handle:()=>{pe(c),l.mode==="edit"&&q()}}})]},{icon:(0,a.jsx)(La,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||X(),handle:L},{icon:(0,a.jsx)($e,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await ee((await S()).contents),M({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!de||s,handle:async()=>{let c=vt(Se());await re({configs:_e.fromEntries(c.map(xo))});for(let u of c)f({cellId:u,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ue,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{k({})}},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Re,{onClose:o}))}},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Re,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:he,hidden:!ce||s,handle:()=>{b()}},{icon:(0,a.jsx)(qa,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:j,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{v()}},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{y()}},{icon:(0,a.jsx)(Me,{size:14,strokeWidth:1.5}),label:"Show all code",hotkey:"global.showAllCode",handle:()=>r(!1,"code"),redundant:!0},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Hide all code",hotkey:"global.hideAllCode",handle:()=>r(!0,"code"),redundant:!0},{icon:(0,a.jsx)(Me,{size:14,strokeWidth:1.5}),label:"Show all markdown code",hotkey:"global.showAllMarkdownCode",handle:()=>r(!1,"markdown"),redundant:!0},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",hotkey:"global.hideAllMarkdownCode",handle:()=>r(!0,"markdown"),redundant:!0},{icon:(0,a.jsx)(Ia,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:w,redundant:!0},{icon:(0,a.jsx)(Pa,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:x,redundant:!0},{divider:!0,icon:(0,a.jsx)(Ke,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>A(wo)},{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>ie(ko)},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>oe(yo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Resources",handle:E,dropdown:[{icon:(0,a.jsx)(gt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:bo},{icon:(0,a.jsx)(_a,{className:"h-3.5 w-3.5"}),label:"GitHub",handle:fo},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:uo},{icon:(0,a.jsx)(la,{className:"h-3.5 w-3.5"}),label:"YouTube",handle:mo},{icon:(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:po}]},{divider:!0,icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:ho},{icon:(0,a.jsx)(Oe,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:co}].filter(ro).map(so),e[15]=k,e[16]=g,e[17]=ce,e[18]=p,e[19]=y,e[20]=o,e[21]=w,e[22]=L,e[23]=N,e[24]=x,e[25]=le,e[26]=t,e[27]=K,e[28]=ue,e[29]=de,e[30]=me,e[31]=s,e[32]=n,e[33]=ne,e[34]=S,e[35]=j,e[36]=v,e[37]=re,e[38]=R,e[39]=d,e[40]=r,e[41]=A,e[42]=ie,e[43]=pe,e[44]=oe,e[45]=B,e[46]=V,e[47]=O,e[48]=P,e[49]=i,e[50]=q,e[51]=b,e[52]=he,e[53]=f,e[54]=l.mode,e[55]=Q):Q=e[55],Q}function so(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(lo)}:e}function lo(e){return!e.hidden}function ro(e){return!e.hidden}function co(){let e=ka();window.open(e,"_blank")}function ho(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function po(){window.open(W.releasesPage,"_blank")}function mo(){window.open(W.youtube,"_blank")}function uo(){window.open(W.discordLink,"_blank")}function fo(){window.open(W.githubPage,"_blank")}function bo(){window.open(W.docsPage,"_blank")}function yo(e){return!e}function ko(e){return!e}function wo(e){return!e}function xo(e){return[e,{disabled:!1}]}async function go(){let e=document.getElementById("App");e&&await $t({element:e,filename:document.title,prepare:Kt})}function jo(){return window.print()}function vo(e){return e?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function Co(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(He,{size:14})})}function ae(){M({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{et as a,Ue as c,Ua as i,Ke as l,nt as n,Ze as o,ot as r,Je as s,io as t,$e as u};
|
|
1
|
+
import{s as ze}from"./chunk-LvLJmgfZ.js";import{d as T,l as rt,p as dt,u as I}from"./useEvent-D91BmmQi.js";import{t as ct}from"./react-Bj1aDYRI.js";import{An as ht,D as We,E as pt,En as mt,Gi as be,Nn as ut,Pn as ft,Qt as bt,_ as yt,br as Me,ct as kt,dt as Ae,h as Se,jn as wt,kn as xt,kr as gt,lt as jt,ri as vt,t as Ct,wr as zt,xr as Wt,yr as Mt}from"./cells-B7YKR2ed.js";import{t as z}from"./compiler-runtime-B3qBwwSJ.js";import{n as At,r as St,x as _t}from"./ai-model-dropdown-Btglrejh.js";import{_ as H,d as _e}from"./useEventListener-BakX-tnw.js";import{r as Dt,x as Nt}from"./utils-Dev6I_Kv.js";import{n as W,t as De}from"./constants-B9JJ72XE.js";import{T as X,v as Pt,w as It}from"./config-3clPIEB9.js";import{t as Et}from"./jsx-runtime-PbYoItBR.js";import{o as Lt}from"./alert-dialog-CC0gG4Av.js";import{a as Tt,c as Ht,i as Ft,n as qt,r as Ot,s as Rt,t as Bt}from"./select-Cjly7tmx.js";import{Ft as Vt}from"./JsonOutput-BkFXuRpB.js";import{c as Ne,d as ye,n as Yt,o as $t,r as ke,t as Kt}from"./download-DiInTgPW.js";import{t as Ut}from"./tooltip-CgQpRVyN.js";import{r as Gt,t as we}from"./button-BF7GSjhW.js";import{i as Jt,t as Pe}from"./strings-DvZlHYnD.js";import{r as F}from"./requests-KshNNAOp.js";import{t as m}from"./createLucideIcon-BTp1tQDO.js";import{F as Qt,I as Xt,L as Ie,P as Zt,a as Ee,i as Le,u as Te}from"./layout-BI4PmskA.js";import{t as He}from"./check-DQmqoJgr.js";import{r as ea}from"./useCellActionButton-BjcJ6BLJ.js";import{t as ta}from"./code-DP40S9ln.js";import{t as aa}from"./copy-IBNGDypD.js";import{t as Fe}from"./eye-off-DI0EQXw0.js";import{t as oa}from"./external-link-BktyywYg.js";import{t as Z}from"./file-BvoBtS_V.js";import{u as na}from"./form-ChOi66u2.js";import{n as ia,r as sa,t as la}from"./youtube-NfBeYlaL.js";import{i as ra,n as qe}from"./add-connection-dialog-CyoxEDp-.js";import{t as da}from"./house-DHu4JLi3.js";import{t as ca}from"./image-BzUcK6ho.js";import{t as ha}from"./link-e5mRDDOC.js";import{r as pa}from"./input-DB2LiTiQ.js";import{t as ma}from"./settings-1WkYMLdR.js";import{t as ua}from"./sparkles-COaEc8Qn.js";import{y as fa}from"./textarea-BYXnNYSr.js";import{t as ba}from"./square-35tXIgiR.js";import{t as M}from"./use-toast-kCNiuc-_.js";import{n as Oe,t as ya}from"./paths-DhuNSnZ_.js";import{o as ka}from"./session-CsT5Gg9j.js";import{n as ee}from"./copy-D8MtpXgN.js";import{r as wa}from"./useRunCells-BQPsvZjd.js";import{a as xa,c as ga,i as ja,n as va,r as Ca}from"./dialog-DkJmIrsG.js";import{n as xe}from"./ImperativeModal-B62Q6S9l.js";import{r as za,t as Re}from"./share-DQjChRJG.js";import{a as Wa}from"./cell-link-DO4acQD0.js";import{a as Ma}from"./renderShortcut-LpVarhnQ.js";import{t as Aa}from"./icons-avFV3lBF.js";import{t as Sa}from"./pair-with-agent-modal-Q9Od23Rh.js";import{t as _a}from"./github-DghuZBnj.js";import{n as Be}from"./marimo-icons-DuRILrB8.js";import{t as Da}from"./links-Bof3pNQU.js";import{r as Na,t as Ve}from"./hooks-QlMczg0I.js";import{t as Ye}from"./types-BLEgJ92v.js";var Pa=m("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Ia=m("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),$e=m("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Ke=m("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Ue=m("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Ea=m("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),La=m("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),Ta=m("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),Ha=m("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Fa=m("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ge=m("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),qa=m("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Oa=m("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),Je=m("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Qe=z(),Xe=ze(ct(),1),a=ze(Et(),1),te="https://static.marimo.app";const Ra=e=>{let t=(0,Qe.c)(25),{onClose:n}=e,[o,i]=(0,Xe.useState)(""),{exportAsHTML:d}=F(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,s=`${te}/static/${l}`,r;t[0]!==d||t[1]!==n||t[2]!==l?(r=async v=>{v.preventDefault(),n();let L=await d({download:!1,includeCode:!0,files:Zt.INSTANCE.filenames()}),A=M({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${te}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:L,path:l})}).catch(()=>{A.dismiss(),M({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:W.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),A.dismiss(),M({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},t[0]=d,t[1]=n,t[2]=l,t[3]=r):r=t[3];let h;t[4]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsx)(ga,{children:"Share static notebook"}),t[4]=h):h=t[4];let p;t[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsxs)(xa,{children:[h,(0,a.jsxs)(Ca,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:te,target:"_blank",children:te}),"."]})]}),t[5]=p):p=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{i(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let f;t[7]===o?f=t[8]:(f=(0,a.jsx)(pa,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=f);let b;t[9]===s?b=t[10]:(b=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Ba,{text:s}),(0,a.jsx)("span",{className:"text-primary",children:s})]})]}),t[9]=s,t[10]=b);let y;t[11]!==f||t[12]!==b?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[f,b]}),t[11]=f,t[12]=b,t[13]=y):y=t[13];let k;t[14]===n?k=t[15]:(k=(0,a.jsx)(we,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=k);let w;t[16]===s?w=t[17]:(w=(0,a.jsx)(we,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await ee(s)},children:"Create"}),t[16]=s,t[17]=w);let x;t[18]!==k||t[19]!==w?(x=(0,a.jsxs)(ja,{children:[k,w]}),t[18]=k,t[19]=w,t[20]=x):x=t[20];let j;return t[21]!==r||t[22]!==x||t[23]!==y?(j=(0,a.jsx)(va,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:r,children:[p,y,x]})}),t[21]=r,t[22]=x,t[23]=y,t[24]=j):j=t[24],j};var Ba=e=>{let t=(0,Qe.c)(8),[n,o]=Xe.useState(!1),i;t[0]===e.text?i=t[1]:(i=Gt.stopPropagation(async h=>{h.preventDefault(),await ee(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=i);let d=i,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let s;t[3]===d?s=t[4]:(s=(0,a.jsx)(we,{"data-testid":"copy-static-notebook-url-button",onClick:d,size:"xs",variant:"secondary",children:l}),t[3]=d,t[4]=s);let r;return t[5]!==n||t[6]!==s?(r=(0,a.jsx)(Ut,{content:"Copied!",open:n,children:s}),t[5]=n,t[6]=s,t[7]=r):r=t[7],r},Va=z();function Ya(){let e=document.getElementsByClassName(De.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=be.findElement(t);if(!o){H.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:be.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function $a(e){if(!e){H.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(be.create(e.cellId));if(!t){H.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${De.outputArea}`)){H.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ze(){let e=(0,Va.c)(2),t=T(Ae),n;return e[0]===t?n=e[1]:(n=()=>{let o=Ya();t(i=>({mode:jt(i.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{$a(o)})})},e[0]=t,e[1]=n),n}const et=dt(!1);var Ka=z();const Ua=()=>{let e=(0,Ka.c)(7),{selectedLayout:t}=Ee(),{setLayoutView:n}=Le();if(X()&&!ft("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=s=>n(s),e[0]=n,e[1]=o);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(Rt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Ht,{placeholder:"Select a view"})}),e[2]=i):i=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)(qt,{children:(0,a.jsxs)(Ot,{children:[(0,a.jsx)(Tt,{children:"View as"}),Ye.map(Ja)]})}),e[3]=d):d=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Bt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[i,d]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function Ga(e){return(0,a.jsx)(tt(e),{className:"h-4 w-4"})}function tt(e){switch(e){case"vertical":return Ta;case"grid":return sa;case"slides":return Ge;default:return Jt(e),ba}}function at(e){return Pe.startCase(e)}function Ja(e){return(0,a.jsx)(Ft,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ga(e),(0,a.jsx)("span",{children:at(e)})]})},e)}async function Qa(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Xa=z();function Za(e){let t=(0,Xa.c)(5),{openPrompt:n,closeModal:o}=xe(),{sendCopy:i}=F(),d;return t[0]!==o||t[1]!==n||t[2]!==i||t[3]!==e?(d=()=>{if(!e)return null;let l=ya.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Oe.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:s=>{let r=l.join(Oe.dirname(e),s);i({source:e,destination:r}).then(()=>{o(),M({title:"Notebook copied",description:"A copy of the notebook has been created."}),Da(r)})}})},t[0]=o,t[1]=n,t[2]=i,t[3]=e,t[4]=d):d=t[4],d}var eo=z();function ot(){let e=(0,eo.c)(4),{openConfirm:t}=xe(),n=T(Pt),{sendRestart:o}=F(),i;return e[0]!==t||e[1]!==o||e[2]!==n?(i=()=>{t({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Lt,{onClick:async()=>{n({state:It.CLOSING}),await o(),za()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=i):i=e[3],i}var to=z(),ao=new bt,oo=e=>ao.isSupported(e)?"markdown":"code";const nt=()=>{let e=(0,to.c)(3),{updateCellConfig:t}=We(),{saveCellConfig:n}=F(),o;return e[0]!==n||e[1]!==t?(o=async(i,d)=>{let l=Se(),s={};for(let h of l.cellIds.inOrderIds){let p=l.cellData[h];p===void 0||p.config.hide_code===i||oo(p.code)===d&&(s[h]={hide_code:i})}let r=_e.entries(s);if(r.length!==0){await n({configs:s});for(let[h,p]of r)t({cellId:h,config:p})}},e[0]=n,e[1]=t,e[2]=o):o=e[2],o};var no=z(),E=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function io(){var je,ve,Ce;let e=(0,no.c)(56),t=Wa(),{openModal:n,closeModal:o}=xe(),{toggleApplication:i}=xt(),{selectedPanel:d}=ht(),[l]=rt(Ae),s=I(kt),r=nt(),[h]=Nt(),p=I(mt),g=I(Dt),{updateCellConfig:f,undoDeleteCell:b,clearAllCellOutputs:y,addSetupCellIfDoesntExist:k,collapseAllCells:w,expandAllCells:x}=We(),j=ot(),v=wa(),L=Za(t),A=T(et),oe=T(At),{handleClick:ne}=St(),ie=T(_t),{exportAsIPYNB:se,exportAsMarkdown:le,readCode:S,saveCellConfig:re,updateCellOutputs:_}=F(),D=Na(),de=I(yt),ce=I(Ct),he=I(pt),{selectedLayout:q}=Ee(),{setLayoutView:pe}=Le(),O=Ze(),R=((je=h.sharing)==null?void 0:je.html)??!0,B=((ve=h.sharing)==null?void 0:ve.wasm)??!0,V=((Ce=h.sharing)==null?void 0:Ce.molab)??!0,ge=!X(),me=q==="slides",it=Co,st=vo,Y;e[0]!==t||e[1]!==D||e[2]!==_?(Y=async c=>{let{preset:u,title:C}=c;if(!t){ae();return}await Ne(C,async fe=>{await Ve({takeScreenshots:()=>D({progress:fe}),updateCellOutputs:_}),await Qa({filename:t,preset:u,downloadPDF:Yt})})},e[0]=t,e[1]=D,e[2]=_,e[3]=Y):Y=e[3];let N=Y,$;e[4]===N?$=e[5]:($=async()=>{if(ge){await N({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),u=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(jo,0),setTimeout(()=>window.dispatchEvent(u),0)},e[4]=N,e[5]=$);let K=$,U;e[6]!==se||e[7]!==t||e[8]!==D||e[9]!==_?(U=async()=>{if(!t){ae();return}await Ne("Downloading IPYNB...",async c=>{await Ve({takeScreenshots:()=>D({progress:c}),updateCellOutputs:_});let u=await se({download:!1});ke(new Blob([u],{type:"application/x-ipynb+json"}),ye.toIPYNB(document.title))})},e[6]=se,e[7]=t,e[8]=D,e[9]=_,e[10]=U):U=e[10];let ue=U,G;e[11]===Symbol.for("react.memo_cache_sentinel")?(G=(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),e[11]=G):G=e[11];let J;e[12]===Symbol.for("react.memo_cache_sentinel")?(J=(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),e[12]=J):J=e[12];let P;e[13]===t?P=e[14]:(P=async()=>{if(!t){ae();return}await Te({filename:t,includeCode:!0})},e[13]=t,e[14]=P);let Q;return e[15]!==k||e[16]!==g||e[17]!==ce||e[18]!==p||e[19]!==y||e[20]!==o||e[21]!==w||e[22]!==L||e[23]!==N||e[24]!==x||e[25]!==le||e[26]!==t||e[27]!==K||e[28]!==ue||e[29]!==de||e[30]!==me||e[31]!==s||e[32]!==n||e[33]!==ne||e[34]!==S||e[35]!==j||e[36]!==v||e[37]!==re||e[38]!==q||e[39]!==d||e[40]!==r||e[41]!==A||e[42]!==ie||e[43]!==pe||e[44]!==oe||e[45]!==R||e[46]!==V||e[47]!==B||e[48]!==P||e[49]!==i||e[50]!==O||e[51]!==b||e[52]!==he||e[53]!==f||e[54]!==l.mode?(Q=[{icon:G,label:"Download",handle:E,dropdown:[{icon:J,label:"Download as HTML",handle:P},{icon:(0,a.jsx)(Ie,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){ae();return}await Te({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(Aa,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await le({download:!1});ke(new Blob([c],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ha,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ue},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await S();ke(new Blob([c.contents],{type:"text/plain"}),ye.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(ca,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",Ma("global.hideCode",!1)]}),handle:go},me?{divider:!0,icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:E,dropdown:[{icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:K},{icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:st(!0),hidden:!ge,handle:async()=>{await N({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(Z,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:K}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Pair with an agent",hidden:X(),handle:async()=>{n((0,a.jsx)(Sa,{onClose:o}))}},{icon:(0,a.jsx)(qa,{size:14,strokeWidth:1.5}),label:"Share",handle:E,hidden:!R&&!B&&!V,dropdown:[{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!R,handle:async()=>{n((0,a.jsx)(Ra,{onClose:o}))}},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!B,handle:async()=>{await ee(Re({code:(await S()).contents})),M({title:"Copied",description:"Link copied to clipboard."})}},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Create molab notebook",hidden:!V,handle:async()=>{let c=Re({code:(await S()).contents,baseUrl:`${W.molab}/new`});window.open(c,"_blank")}}]},{icon:(0,a.jsx)(Fa,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:E,dropdown:wt.flatMap(c=>{let u=c.type==="ai"&&!g;if(ut({panel:c,capabilities:p,aiEnabled:g})&&!u)return[];let{type:C,Icon:fe,additionalKeywords:lt}=c;return{label:Pe.startCase(C),rightElement:it(d===C),icon:(0,a.jsx)(fe,{size:14,strokeWidth:1.5}),handle:()=>{if(u){ne("ai","ai-features");return}i(C)},additionalKeywords:lt}})},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Present as",handle:E,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(fa,{size:14,strokeWidth:1.5}):(0,a.jsx)(Qt,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{O()}},...Ye.map((c,u)=>{let C=tt(c);return{divider:u===0,label:at(c),icon:(0,a.jsx)(C,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:q===c&&(0,a.jsx)(He,{size:14})}),handle:()=>{pe(c),l.mode==="edit"&&O()}}})]},{icon:(0,a.jsx)(La,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||X(),handle:L},{icon:(0,a.jsx)($e,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await ee((await S()).contents),M({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!de||s,handle:async()=>{let c=vt(Se());await re({configs:_e.fromEntries(c.map(xo))});for(let u of c)f({cellId:u,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ue,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{k({})}},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(qe,{onClose:o}))}},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(qe,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:he,hidden:!ce||s,handle:()=>{b()}},{icon:(0,a.jsx)(Oa,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:j,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{v()}},{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{y()}},{icon:(0,a.jsx)(Me,{size:14,strokeWidth:1.5}),label:"Show all code",hotkey:"global.showAllCode",handle:()=>r(!1,"code"),redundant:!0},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Hide all code",hotkey:"global.hideAllCode",handle:()=>r(!0,"code"),redundant:!0},{icon:(0,a.jsx)(Me,{size:14,strokeWidth:1.5}),label:"Show all markdown code",hotkey:"global.showAllMarkdownCode",handle:()=>r(!1,"markdown"),redundant:!0},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",hotkey:"global.hideAllMarkdownCode",handle:()=>r(!0,"markdown"),redundant:!0},{icon:(0,a.jsx)(Ia,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:w,redundant:!0},{icon:(0,a.jsx)(Pa,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:x,redundant:!0},{divider:!0,icon:(0,a.jsx)(Ke,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>A(wo)},{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>ie(ko)},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>oe(yo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Resources",handle:E,dropdown:[{icon:(0,a.jsx)(gt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:bo},{icon:(0,a.jsx)(_a,{className:"h-3.5 w-3.5"}),label:"GitHub",handle:fo},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:uo},{icon:(0,a.jsx)(la,{className:"h-3.5 w-3.5"}),label:"YouTube",handle:mo},{icon:(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:po}]},{divider:!0,icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Open home",hidden:!location.search.includes("file"),handle:ho},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:co}].filter(ro).map(so),e[15]=k,e[16]=g,e[17]=ce,e[18]=p,e[19]=y,e[20]=o,e[21]=w,e[22]=L,e[23]=N,e[24]=x,e[25]=le,e[26]=t,e[27]=K,e[28]=ue,e[29]=de,e[30]=me,e[31]=s,e[32]=n,e[33]=ne,e[34]=S,e[35]=j,e[36]=v,e[37]=re,e[38]=q,e[39]=d,e[40]=r,e[41]=A,e[42]=ie,e[43]=pe,e[44]=oe,e[45]=R,e[46]=V,e[47]=B,e[48]=P,e[49]=i,e[50]=O,e[51]=b,e[52]=he,e[53]=f,e[54]=l.mode,e[55]=Q):Q=e[55],Q}function so(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(lo)}:e}function lo(e){return!e.hidden}function ro(e){return!e.hidden}function co(){let e=ka();window.open(e,"_blank")}function ho(){let e=document.baseURI.split("?")[0];window.open(e,"_blank","noopener")}function po(){window.open(W.releasesPage,"_blank")}function mo(){window.open(W.youtube,"_blank")}function uo(){window.open(W.discordLink,"_blank")}function fo(){window.open(W.githubPage,"_blank")}function bo(){window.open(W.docsPage,"_blank")}function yo(e){return!e}function ko(e){return!e}function wo(e){return!e}function xo(e){return[e,{disabled:!1}]}async function go(){let e=document.getElementById("App");e&&await $t({element:e,filename:document.title,prepare:Kt})}function jo(){return window.print()}function vo(e){return e?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function Co(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(He,{size:14})})}function ae(){M({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{et as a,Ue as c,Ua as i,Ke as l,nt as n,Ze as o,ot as r,Je as s,io as t,$e as u};
|
package/dist/index.html
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
|
|
67
67
|
<!-- /TODO -->
|
|
68
68
|
<title>{{ title }}</title>
|
|
69
|
-
<script type="module" crossorigin src="./assets/index-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-Bs8gxNWl.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-BW0IMuFq.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/react-Bj1aDYRI.js">
|
package/package.json
CHANGED
|
@@ -688,13 +688,13 @@ export function useNotebookActions() {
|
|
|
688
688
|
{
|
|
689
689
|
divider: true,
|
|
690
690
|
icon: <Home size={14} strokeWidth={1.5} />,
|
|
691
|
-
label: "
|
|
691
|
+
label: "Open home",
|
|
692
692
|
// If file is in the url, then we ran `marimo edit`
|
|
693
693
|
// without a specific file
|
|
694
694
|
hidden: !location.search.includes("file"),
|
|
695
695
|
handle: () => {
|
|
696
696
|
const withoutSearch = document.baseURI.split("?")[0];
|
|
697
|
-
window.open(withoutSearch, "
|
|
697
|
+
window.open(withoutSearch, "_blank", "noopener");
|
|
698
698
|
},
|
|
699
699
|
},
|
|
700
700
|
|