@marimo-team/frontend 0.21.2-dev42 → 0.21.2-dev44
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/{JsonOutput-BIbkaOuk.js → JsonOutput-C8n2adQU.js} +1 -1
- package/dist/assets/RenderHTML-DZEdwTKg.js +1 -0
- package/dist/assets/{agent-panel-CtAqa-P9.js → agent-panel-CMKb0kBM.js} +1 -1
- package/dist/assets/{cell-editor-Ti3F6axu.js → cell-editor-DjGgPwea.js} +1 -1
- package/dist/assets/{chat-display-B0hV2K6L.js → chat-display-CzIhohcg.js} +1 -1
- package/dist/assets/{chat-panel-CNGIGWIs.js → chat-panel-Tpw-g4u6.js} +1 -1
- package/dist/assets/{column-preview-CVqBaB8R.js → column-preview-spf8QkrL.js} +1 -1
- package/dist/assets/{command-palette-BfuIslSf.js → command-palette-m6zjf1mJ.js} +1 -1
- package/dist/assets/{context-aware-panel-DEVrXLoa.js → context-aware-panel-8zsSzo4I.js} +1 -1
- package/dist/assets/{documentation-panel-BQRmNRb_.js → documentation-panel-CLmW4d8W.js} +1 -1
- package/dist/assets/{edit-page-Cqvk7zWH.js → edit-page-CYExFTHL.js} +3 -3
- package/dist/assets/{file-explorer-panel-D706RRJ-.js → file-explorer-panel-tu8DbMx1.js} +1 -1
- package/dist/assets/{hooks-W-qT5c6l.js → hooks-CoWPGOoO.js} +1 -1
- package/dist/assets/{index-D3rIJiKM.css → index-BmoocKR0.css} +1 -1
- package/dist/assets/{index-BSzIstPK.js → index-DjFdxvph.js} +3 -3
- package/dist/assets/{layout-C_JVKYrz.js → layout-DUyfJ223.js} +1 -1
- package/dist/assets/{panels-B2DAaT1E.js → panels-Dlg173Zj.js} +1 -1
- package/dist/assets/{run-page-DMpRvHgf.js → run-page-CrIB5BPv.js} +1 -1
- package/dist/assets/{scratchpad-panel-ClDi2sdV.js → scratchpad-panel-Bqxu1lHr.js} +1 -1
- package/dist/assets/{session-panel-C-RbWN-G.js → session-panel-QeOgsjGY.js} +1 -1
- package/dist/assets/{snippets-panel-DCdeI2hB.js → snippets-panel-DPXLsOeT.js} +1 -1
- package/dist/assets/{useNotebookActions-CooxVonM.js → useNotebookActions-C3Av22ea.js} +1 -1
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/src/css/md-tooltip.css +4 -39
- package/src/plugins/core/RenderHTML.tsx +17 -0
- package/src/plugins/core/__test__/RenderHTML.test.ts +45 -0
- package/dist/assets/RenderHTML-DduaBOBv.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as we}from"./chunk-LvLJmgfZ.js";import{d as L,l as Qe,p as Xe,u as de}from"./useEvent-O0nX5vok.js";import{t as et}from"./react-Bj1aDYRI.js";import{E as ge,Ft as tt,Tr as at,Yn as ot,Zn as nt,_ as it,ar as st,di as ce,dn as lt,er as rt,fn as dt,gn as ct,h as je,pn as ht,t as pt}from"./cells-DqKJsMUm.js";import{t as _}from"./compiler-runtime-B3qBwwSJ.js";import{n as mt}from"./assertNever-DWSyoPEi.js";import{s as ve}from"./useLifecycle-DA9DjSPo.js";import{i as ut,n as Ce}from"./add-connection-dialog-BewAq3li.js";import{n as ft,x as yt}from"./ai-model-dropdown-DgMZ5T_L.js";import{c as ze,m as T}from"./useEventListener-Dy81QR4n.js";import{y as kt}from"./utils-tNbLd14P.js";import{n as A,t as Me}from"./constants-Rz_lD4HK.js";import{S as he,h as bt,x as xt}from"./config-3Aq84phF.js";import{t as wt}from"./jsx-runtime-icT_Ltz2.js";import{r as gt,t as pe}from"./button-Ej3vmCIF.js";import{r as H}from"./requests-Bgjtqo_1.js";import{t as h}from"./createLucideIcon-Cm-Z7dYr.js";import{a as We,f as jt,i as Se,m as vt,p as De,u as _e}from"./layout-C_JVKYrz.js";import{t as Ae}from"./check-BE0hEwVo.js";import{c as Ne,d as me,n as Ct,o as zt,r as ue,t as Mt}from"./download-DtyAt8iO.js";import{f as Wt}from"./maps-OKerBHH8.js";import{r as St}from"./useCellActionButton-fJ6SGX-Z.js";import{t as Dt}from"./copy-CkudG0Ej.js";import{t as _t}from"./download-DBW9RXtT.js";import{t as At}from"./eye-off-vwi9L975.js";import{t as Nt}from"./file-plus-corner-lLQw9OnR.js";import{t as J}from"./file-DzHkbIdO.js";import{t as Pt}from"./github-BVtI-3F1.js";import{m as It}from"./form--K3o18rQ.js";import{n as Et,r as Lt,t as Tt}from"./youtube-DE-Ej6FR.js";import{n as Ht,t as qt}from"./square-CxAsQQ77.js";import{t as Rt}from"./image-DXfkah9d.js";import{t as Bt}from"./link-Cf10mh3t.js";import{r as Ft}from"./input-CUwqpKjd.js";import{t as Vt}from"./settings-CzQUw9rV.js";import{x as Yt}from"./azure-BeB26UeM.js";import{t as C}from"./use-toast-Hc8CXlvz.js";import{n as Pe,t as Ot}from"./paths-D2lG83Oh.js";import{o as Kt}from"./session-BrEm7qNv.js";import{a as Ut,c as $t,i as Gt,n as Jt,r as Zt,s as Qt,t as Xt}from"./select-CxT2Geqr.js";import{t as ea}from"./tooltip-D9723Brr.js";import{a as Ie,i as ta,r as aa}from"./mode-Bn_XF6AW.js";import{o as oa}from"./alert-dialog-9WfvUF7e.js";import{a as na,c as ia,i as sa,n as la,r as ra}from"./dialog-CVN1lcMF.js";import{n as fe}from"./ImperativeModal-qEtcJ95s.js";import{r as da,t as ca}from"./share-BdH_5I58.js";import{n as Z}from"./copy-CA4fP28I.js";import{r as ha}from"./useRunCells-D5wCIJdU.js";import{a as pa}from"./cell-link-BEnixmCb.js";import{a as ma}from"./renderShortcut-CnD1Dah5.js";import{t as ua}from"./icons-CrUXojcA.js";import{t as fa}from"./links-CIQwYQ48.js";import{r as ya,t as Ee}from"./hooks-W-qT5c6l.js";import{t as Le}from"./types-BfP_kuAY.js";var ka=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),ba=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Te=h("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"}]]),He=h("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"}]]),qe=h("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"}]]),xa=h("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"}]]),wa=h("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"}]]),ga=h("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Re=h("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),ja=h("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"}]]),va=h("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"}]]),Ca=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Be=h("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"}]]),za=h("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"}]]),Ma=h("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"}]]),Fe=h("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"}]]),Ve=_(),ye=we(et(),1),a=we(wt(),1),Q="https://static.marimo.app";const Wa=e=>{let t=(0,Ve.c)(25),{onClose:n}=e,[o,s]=(0,ye.useState)(""),{exportAsHTML:r}=H(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${Q}/static/${l}`,d;t[0]!==r||t[1]!==n||t[2]!==l?(d=async v=>{v.preventDefault(),n();let P=await r({download:!1,includeCode:!0,files:jt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Q}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:P,path:l})}).catch(()=>{z.dismiss(),C({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:A.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({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]=r,t[1]=n,t[2]=l,t[3]=d):d=t[3];let m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(ia,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(na,{children:[m,(0,a.jsxs)(ra,{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:Q,target:"_blank",children:Q}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{s(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(Ft,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(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)(Sa,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let y;t[11]!==u||t[12]!==f?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=y):y=t[13];let k;t[14]===n?k=t[15]:(k=(0,a.jsx)(pe,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=k);let b;t[16]===i?b=t[17]:(b=(0,a.jsx)(pe,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await Z(i)},children:"Create"}),t[16]=i,t[17]=b);let x;t[18]!==k||t[19]!==b?(x=(0,a.jsxs)(sa,{children:[k,b]}),t[18]=k,t[19]=b,t[20]=x):x=t[20];let j;return t[21]!==d||t[22]!==x||t[23]!==y?(j=(0,a.jsx)(la,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,y,x]})}),t[21]=d,t[22]=x,t[23]=y,t[24]=j):j=t[24],j};var Sa=e=>{let t=(0,Ve.c)(8),[n,o]=ye.useState(!1),s;t[0]===e.text?s=t[1]:(s=gt.stopPropagation(async m=>{m.preventDefault(),await Z(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(pe,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:l}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(ea,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},Da=_();function _a(){let e=document.getElementsByClassName(Me.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=ce.findElement(t);if(!o){T.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:ce.parse(o.id)}}}return T.warn("No visible output area found for scroll anchor"),null}function Aa(e){if(!e){T.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(ce.create(e.cellId));if(!t){T.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${Me.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ye(){let e=(0,Da.c)(2),t=L(Ie),n;return e[0]===t?n=e[1]:(n=()=>{let o=_a();t(s=>({mode:ta(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Aa(o)})})},e[0]=t,e[1]=n),n}const Oe=Xe(!1);var Na=_();const Pa=()=>{let e=(0,Na.c)(7),{selectedLayout:t}=We(),{setLayoutView:n}=Se();if(he()&&!ct("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Qt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)($t,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Jt,{children:(0,a.jsxs)(Zt,{children:[(0,a.jsx)(Ut,{children:"View as"}),Le.map(Ea)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Xt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function Ia(e){return(0,a.jsx)(Ke(e),{className:"h-4 w-4"})}function Ke(e){switch(e){case"vertical":return ja;case"grid":return Lt;case"slides":return Be;default:return mt(e),qt}}function Ue(e){return ve(e)}function Ea(e){return(0,a.jsx)(Gt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ia(e),(0,a.jsx)("span",{children:Ue(e)})]})},e)}async function La(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Ta=_();function Ha(e){let t=(0,Ta.c)(5),{openPrompt:n,closeModal:o}=fe(),{sendCopy:s}=H(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=Ot.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Pe.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Pe.dirname(e),i);s({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),fa(d)})}})},t[0]=o,t[1]=n,t[2]=s,t[3]=e,t[4]=r):r=t[4],r}const qa=()=>{let{updateCellConfig:e}=ge(),{saveCellConfig:t}=H();return(0,ye.useCallback)(async()=>{let n=new tt,o=je(),s=o.cellIds.inOrderIds,r={};for(let i of s){if(o.cellData[i]===void 0)continue;let{code:d,config:m}=o.cellData[i];m.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let l=ze.entries(r);if(l.length!==0){await t({configs:r});for(let[i,d]of l)e({cellId:i,config:d})}},[e])};var Ra=_();function $e(){let e=(0,Ra.c)(4),{openConfirm:t}=fe(),n=L(bt),{sendRestart:o}=H(),s;return e[0]!==t||e[1]!==o||e[2]!==n?(s=()=>{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)(oa,{onClick:async()=>{n({state:xt.CLOSING}),await o(),da()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=s):s=e[3],s}var Ba=_(),N=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Fa(){var be,xe;let e=(0,Ba.c)(51),t=pa(),{openModal:n,closeModal:o}=fe(),{toggleApplication:s}=lt(),{selectedPanel:r}=dt(),[l]=Qe(Ie),i=de(aa),d=qa(),[m]=kt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:k}=ge(),b=$e(),x=ha(),j=Ha(t),v=L(Oe),P=L(ft),z=L(yt),{exportAsIPYNB:ee,exportAsMarkdown:te,readCode:I,saveCellConfig:ae,updateCellOutputs:M}=H(),W=ya(),oe=de(it),ne=de(pt),{selectedLayout:q}=We(),{setLayoutView:ie}=Se(),R=Ye(),B=((be=m.sharing)==null?void 0:be.html)??!0,F=((xe=m.sharing)==null?void 0:xe.wasm)??!0,ke=!he(),se=q==="slides",Ge=so,Je=io,V;e[0]!==t||e[1]!==W||e[2]!==M?(V=async c=>{let{preset:p,title:E}=c;if(!t){X();return}await Ne(E,async re=>{await Ee({takeScreenshots:()=>W({progress:re}),updateCellOutputs:M}),await La({filename:t,preset:p,downloadPDF:Ct})})},e[0]=t,e[1]=W,e[2]=M,e[3]=V):V=e[3];let S=V,Y;e[4]===S?Y=e[5]:(Y=async()=>{if(ke){await S({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),p=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(no,0),setTimeout(()=>window.dispatchEvent(p),0)},e[4]=S,e[5]=Y);let O=Y,K;e[6]!==ee||e[7]!==t||e[8]!==W||e[9]!==M?(K=async()=>{if(!t){X();return}await Ne("Downloading IPYNB...",async c=>{await Ee({takeScreenshots:()=>W({progress:c}),updateCellOutputs:M});let p=await ee({download:!1});ue(new Blob([p],{type:"application/x-ipynb+json"}),me.toIPYNB(document.title))})},e[6]=ee,e[7]=t,e[8]=W,e[9]=M,e[10]=K):K=e[10];let le=K,U;e[11]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let $;e[12]===Symbol.for("react.memo_cache_sentinel")?($=(0,a.jsx)(De,{size:14,strokeWidth:1.5}),e[12]=$):$=e[12];let D;e[13]===t?D=e[14]:(D=async()=>{if(!t){X();return}await _e({filename:t,includeCode:!0})},e[13]=t,e[14]=D);let G;return e[15]!==f||e[16]!==ne||e[17]!==u||e[18]!==o||e[19]!==y||e[20]!==j||e[21]!==S||e[22]!==k||e[23]!==te||e[24]!==t||e[25]!==O||e[26]!==le||e[27]!==oe||e[28]!==d||e[29]!==se||e[30]!==i||e[31]!==n||e[32]!==I||e[33]!==b||e[34]!==x||e[35]!==ae||e[36]!==q||e[37]!==r||e[38]!==v||e[39]!==z||e[40]!==ie||e[41]!==P||e[42]!==B||e[43]!==F||e[44]!==D||e[45]!==s||e[46]!==R||e[47]!==g||e[48]!==w||e[49]!==l.mode?(G=[{icon:U,label:"Download",handle:N,dropdown:[{icon:$,label:"Download as HTML",handle:D},{icon:(0,a.jsx)(De,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){X();return}await _e({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(ua,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await te({download:!1});ue(new Blob([c],{type:"text/plain"}),me.toMarkdown(document.title))}},{icon:(0,a.jsx)(va,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:le},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await I();ue(new Blob([c.contents],{type:"text/plain"}),me.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(Rt,{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:oo},se?{divider:!0,icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:N,dropdown:[{icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:O},{icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:Je(!0),hidden:!ke,handle:async()=>{await S({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:O}]},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!B&&!F,dropdown:[{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!B,handle:async()=>{n((0,a.jsx)(Wa,{onClose:o}))}},{icon:(0,a.jsx)(Bt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!F,handle:async()=>{await Z(ca({code:(await I()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:N,dropdown:ht.flatMap(c=>{let{type:p,Icon:E,hidden:re,additionalKeywords:Ze}=c;return re?[]:{label:ve(p),rightElement:Ge(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:Ze}})},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Yt,{size:14,strokeWidth:1.5}):(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{R()}},...Le.map((c,p)=>{let E=Ke(c);return{divider:p===0,label:Ue(c),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:q===c&&(0,a.jsx)(Ae,{size:14})}),handle:()=>{ie(c),l.mode==="edit"&&R()}}})]},{icon:(0,a.jsx)(wa,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||he(),handle:j},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await Z((await I()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!oe||i,handle:async()=>{let c=at(je());await ae({configs:ze.fromEntries(c.map(ao))});for(let p of c)w({cellId:p,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(qe,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(nt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Ce,{onClose:o}))}},{icon:(0,a.jsx)(ut,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Ce,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ne||i,handle:()=>{g()}},{icon:(0,a.jsx)(Ma,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{x()}},{icon:(0,a.jsx)(rt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(ka,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:k,redundant:!0},{divider:!0,icon:(0,a.jsx)(He,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(to)},{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(eo)},{icon:(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>P(Xa),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(st,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Qa},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Za},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ja},{icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:Ga},{icon:(0,a.jsx)(ot,{size:14,strokeWidth:1.5}),label:"Changelog",handle:$a}]},{divider:!0,icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ua},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ka}].filter(Oa).map(Va),e[15]=f,e[16]=ne,e[17]=u,e[18]=o,e[19]=y,e[20]=j,e[21]=S,e[22]=k,e[23]=te,e[24]=t,e[25]=O,e[26]=le,e[27]=oe,e[28]=d,e[29]=se,e[30]=i,e[31]=n,e[32]=I,e[33]=b,e[34]=x,e[35]=ae,e[36]=q,e[37]=r,e[38]=v,e[39]=z,e[40]=ie,e[41]=P,e[42]=B,e[43]=F,e[44]=D,e[45]=s,e[46]=R,e[47]=g,e[48]=w,e[49]=l.mode,e[50]=G):G=e[50],G}function Va(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ya)}:e}function Ya(e){return!e.hidden}function Oa(e){return!e.hidden}function Ka(){let e=Kt();window.open(e,"_blank")}function Ua(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function $a(){window.open(A.releasesPage,"_blank")}function Ga(){window.open(A.youtube,"_blank")}function Ja(){window.open(A.discordLink,"_blank")}function Za(){window.open(A.githubPage,"_blank")}function Qa(){window.open(A.docsPage,"_blank")}function Xa(e){return!e}function eo(e){return!e}function to(e){return!e}function ao(e){return[e,{disabled:!1}]}async function oo(){let e=document.getElementById("App");e&&await zt({element:e,filename:document.title,prepare:Mt})}function no(){return window.print()}function io(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 so(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Ae,{size:14})})}function X(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ye as a,qe as c,Oe as i,He as l,$e as n,Fe as o,Pa as r,Re as s,Fa as t,Te as u};
|
|
1
|
+
import{s as we}from"./chunk-LvLJmgfZ.js";import{d as L,l as Qe,p as Xe,u as de}from"./useEvent-O0nX5vok.js";import{t as et}from"./react-Bj1aDYRI.js";import{E as ge,Ft as tt,Tr as at,Yn as ot,Zn as nt,_ as it,ar as st,di as ce,dn as lt,er as rt,fn as dt,gn as ct,h as je,pn as ht,t as pt}from"./cells-DqKJsMUm.js";import{t as _}from"./compiler-runtime-B3qBwwSJ.js";import{n as mt}from"./assertNever-DWSyoPEi.js";import{s as ve}from"./useLifecycle-DA9DjSPo.js";import{i as ut,n as Ce}from"./add-connection-dialog-BewAq3li.js";import{n as ft,x as yt}from"./ai-model-dropdown-DgMZ5T_L.js";import{c as ze,m as T}from"./useEventListener-Dy81QR4n.js";import{y as kt}from"./utils-tNbLd14P.js";import{n as A,t as Me}from"./constants-Rz_lD4HK.js";import{S as he,h as bt,x as xt}from"./config-3Aq84phF.js";import{t as wt}from"./jsx-runtime-icT_Ltz2.js";import{r as gt,t as pe}from"./button-Ej3vmCIF.js";import{r as H}from"./requests-Bgjtqo_1.js";import{t as h}from"./createLucideIcon-Cm-Z7dYr.js";import{a as We,f as jt,i as Se,m as vt,p as De,u as _e}from"./layout-DUyfJ223.js";import{t as Ae}from"./check-BE0hEwVo.js";import{c as Ne,d as me,n as Ct,o as zt,r as ue,t as Mt}from"./download-DtyAt8iO.js";import{f as Wt}from"./maps-OKerBHH8.js";import{r as St}from"./useCellActionButton-fJ6SGX-Z.js";import{t as Dt}from"./copy-CkudG0Ej.js";import{t as _t}from"./download-DBW9RXtT.js";import{t as At}from"./eye-off-vwi9L975.js";import{t as Nt}from"./file-plus-corner-lLQw9OnR.js";import{t as J}from"./file-DzHkbIdO.js";import{t as Pt}from"./github-BVtI-3F1.js";import{m as It}from"./form--K3o18rQ.js";import{n as Et,r as Lt,t as Tt}from"./youtube-DE-Ej6FR.js";import{n as Ht,t as qt}from"./square-CxAsQQ77.js";import{t as Rt}from"./image-DXfkah9d.js";import{t as Bt}from"./link-Cf10mh3t.js";import{r as Ft}from"./input-CUwqpKjd.js";import{t as Vt}from"./settings-CzQUw9rV.js";import{x as Yt}from"./azure-BeB26UeM.js";import{t as C}from"./use-toast-Hc8CXlvz.js";import{n as Pe,t as Ot}from"./paths-D2lG83Oh.js";import{o as Kt}from"./session-BrEm7qNv.js";import{a as Ut,c as $t,i as Gt,n as Jt,r as Zt,s as Qt,t as Xt}from"./select-CxT2Geqr.js";import{t as ea}from"./tooltip-D9723Brr.js";import{a as Ie,i as ta,r as aa}from"./mode-Bn_XF6AW.js";import{o as oa}from"./alert-dialog-9WfvUF7e.js";import{a as na,c as ia,i as sa,n as la,r as ra}from"./dialog-CVN1lcMF.js";import{n as fe}from"./ImperativeModal-qEtcJ95s.js";import{r as da,t as ca}from"./share-BdH_5I58.js";import{n as Z}from"./copy-CA4fP28I.js";import{r as ha}from"./useRunCells-D5wCIJdU.js";import{a as pa}from"./cell-link-BEnixmCb.js";import{a as ma}from"./renderShortcut-CnD1Dah5.js";import{t as ua}from"./icons-CrUXojcA.js";import{t as fa}from"./links-CIQwYQ48.js";import{r as ya,t as Ee}from"./hooks-CoWPGOoO.js";import{t as Le}from"./types-BfP_kuAY.js";var ka=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),ba=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Te=h("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"}]]),He=h("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"}]]),qe=h("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"}]]),xa=h("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"}]]),wa=h("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"}]]),ga=h("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Re=h("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),ja=h("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"}]]),va=h("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"}]]),Ca=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Be=h("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"}]]),za=h("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"}]]),Ma=h("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"}]]),Fe=h("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"}]]),Ve=_(),ye=we(et(),1),a=we(wt(),1),Q="https://static.marimo.app";const Wa=e=>{let t=(0,Ve.c)(25),{onClose:n}=e,[o,s]=(0,ye.useState)(""),{exportAsHTML:r}=H(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${Q}/static/${l}`,d;t[0]!==r||t[1]!==n||t[2]!==l?(d=async v=>{v.preventDefault(),n();let P=await r({download:!1,includeCode:!0,files:jt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Q}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:P,path:l})}).catch(()=>{z.dismiss(),C({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:A.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({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]=r,t[1]=n,t[2]=l,t[3]=d):d=t[3];let m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(ia,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(na,{children:[m,(0,a.jsxs)(ra,{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:Q,target:"_blank",children:Q}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{s(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(Ft,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(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)(Sa,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let y;t[11]!==u||t[12]!==f?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=y):y=t[13];let k;t[14]===n?k=t[15]:(k=(0,a.jsx)(pe,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=k);let b;t[16]===i?b=t[17]:(b=(0,a.jsx)(pe,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await Z(i)},children:"Create"}),t[16]=i,t[17]=b);let x;t[18]!==k||t[19]!==b?(x=(0,a.jsxs)(sa,{children:[k,b]}),t[18]=k,t[19]=b,t[20]=x):x=t[20];let j;return t[21]!==d||t[22]!==x||t[23]!==y?(j=(0,a.jsx)(la,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,y,x]})}),t[21]=d,t[22]=x,t[23]=y,t[24]=j):j=t[24],j};var Sa=e=>{let t=(0,Ve.c)(8),[n,o]=ye.useState(!1),s;t[0]===e.text?s=t[1]:(s=gt.stopPropagation(async m=>{m.preventDefault(),await Z(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(pe,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:l}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(ea,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},Da=_();function _a(){let e=document.getElementsByClassName(Me.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=ce.findElement(t);if(!o){T.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:ce.parse(o.id)}}}return T.warn("No visible output area found for scroll anchor"),null}function Aa(e){if(!e){T.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(ce.create(e.cellId));if(!t){T.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${Me.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ye(){let e=(0,Da.c)(2),t=L(Ie),n;return e[0]===t?n=e[1]:(n=()=>{let o=_a();t(s=>({mode:ta(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Aa(o)})})},e[0]=t,e[1]=n),n}const Oe=Xe(!1);var Na=_();const Pa=()=>{let e=(0,Na.c)(7),{selectedLayout:t}=We(),{setLayoutView:n}=Se();if(he()&&!ct("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Qt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)($t,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Jt,{children:(0,a.jsxs)(Zt,{children:[(0,a.jsx)(Ut,{children:"View as"}),Le.map(Ea)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(Xt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function Ia(e){return(0,a.jsx)(Ke(e),{className:"h-4 w-4"})}function Ke(e){switch(e){case"vertical":return ja;case"grid":return Lt;case"slides":return Be;default:return mt(e),qt}}function Ue(e){return ve(e)}function Ea(e){return(0,a.jsx)(Gt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ia(e),(0,a.jsx)("span",{children:Ue(e)})]})},e)}async function La(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Ta=_();function Ha(e){let t=(0,Ta.c)(5),{openPrompt:n,closeModal:o}=fe(),{sendCopy:s}=H(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=Ot.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Pe.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Pe.dirname(e),i);s({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),fa(d)})}})},t[0]=o,t[1]=n,t[2]=s,t[3]=e,t[4]=r):r=t[4],r}const qa=()=>{let{updateCellConfig:e}=ge(),{saveCellConfig:t}=H();return(0,ye.useCallback)(async()=>{let n=new tt,o=je(),s=o.cellIds.inOrderIds,r={};for(let i of s){if(o.cellData[i]===void 0)continue;let{code:d,config:m}=o.cellData[i];m.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let l=ze.entries(r);if(l.length!==0){await t({configs:r});for(let[i,d]of l)e({cellId:i,config:d})}},[e])};var Ra=_();function $e(){let e=(0,Ra.c)(4),{openConfirm:t}=fe(),n=L(bt),{sendRestart:o}=H(),s;return e[0]!==t||e[1]!==o||e[2]!==n?(s=()=>{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)(oa,{onClick:async()=>{n({state:xt.CLOSING}),await o(),da()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=s):s=e[3],s}var Ba=_(),N=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Fa(){var be,xe;let e=(0,Ba.c)(51),t=pa(),{openModal:n,closeModal:o}=fe(),{toggleApplication:s}=lt(),{selectedPanel:r}=dt(),[l]=Qe(Ie),i=de(aa),d=qa(),[m]=kt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:k}=ge(),b=$e(),x=ha(),j=Ha(t),v=L(Oe),P=L(ft),z=L(yt),{exportAsIPYNB:ee,exportAsMarkdown:te,readCode:I,saveCellConfig:ae,updateCellOutputs:M}=H(),W=ya(),oe=de(it),ne=de(pt),{selectedLayout:q}=We(),{setLayoutView:ie}=Se(),R=Ye(),B=((be=m.sharing)==null?void 0:be.html)??!0,F=((xe=m.sharing)==null?void 0:xe.wasm)??!0,ke=!he(),se=q==="slides",Ge=so,Je=io,V;e[0]!==t||e[1]!==W||e[2]!==M?(V=async c=>{let{preset:p,title:E}=c;if(!t){X();return}await Ne(E,async re=>{await Ee({takeScreenshots:()=>W({progress:re}),updateCellOutputs:M}),await La({filename:t,preset:p,downloadPDF:Ct})})},e[0]=t,e[1]=W,e[2]=M,e[3]=V):V=e[3];let S=V,Y;e[4]===S?Y=e[5]:(Y=async()=>{if(ke){await S({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),p=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(no,0),setTimeout(()=>window.dispatchEvent(p),0)},e[4]=S,e[5]=Y);let O=Y,K;e[6]!==ee||e[7]!==t||e[8]!==W||e[9]!==M?(K=async()=>{if(!t){X();return}await Ne("Downloading IPYNB...",async c=>{await Ee({takeScreenshots:()=>W({progress:c}),updateCellOutputs:M});let p=await ee({download:!1});ue(new Blob([p],{type:"application/x-ipynb+json"}),me.toIPYNB(document.title))})},e[6]=ee,e[7]=t,e[8]=W,e[9]=M,e[10]=K):K=e[10];let le=K,U;e[11]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let $;e[12]===Symbol.for("react.memo_cache_sentinel")?($=(0,a.jsx)(De,{size:14,strokeWidth:1.5}),e[12]=$):$=e[12];let D;e[13]===t?D=e[14]:(D=async()=>{if(!t){X();return}await _e({filename:t,includeCode:!0})},e[13]=t,e[14]=D);let G;return e[15]!==f||e[16]!==ne||e[17]!==u||e[18]!==o||e[19]!==y||e[20]!==j||e[21]!==S||e[22]!==k||e[23]!==te||e[24]!==t||e[25]!==O||e[26]!==le||e[27]!==oe||e[28]!==d||e[29]!==se||e[30]!==i||e[31]!==n||e[32]!==I||e[33]!==b||e[34]!==x||e[35]!==ae||e[36]!==q||e[37]!==r||e[38]!==v||e[39]!==z||e[40]!==ie||e[41]!==P||e[42]!==B||e[43]!==F||e[44]!==D||e[45]!==s||e[46]!==R||e[47]!==g||e[48]!==w||e[49]!==l.mode?(G=[{icon:U,label:"Download",handle:N,dropdown:[{icon:$,label:"Download as HTML",handle:D},{icon:(0,a.jsx)(De,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){X();return}await _e({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(ua,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await te({download:!1});ue(new Blob([c],{type:"text/plain"}),me.toMarkdown(document.title))}},{icon:(0,a.jsx)(va,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:le},{icon:(0,a.jsx)(vt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await I();ue(new Blob([c.contents],{type:"text/plain"}),me.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(Rt,{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:oo},se?{divider:!0,icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:N,dropdown:[{icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:O},{icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:Je(!0),hidden:!ke,handle:async()=>{await S({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:O}]},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!B&&!F,dropdown:[{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!B,handle:async()=>{n((0,a.jsx)(Wa,{onClose:o}))}},{icon:(0,a.jsx)(Bt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!F,handle:async()=>{await Z(ca({code:(await I()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:N,dropdown:ht.flatMap(c=>{let{type:p,Icon:E,hidden:re,additionalKeywords:Ze}=c;return re?[]:{label:ve(p),rightElement:Ge(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:Ze}})},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Yt,{size:14,strokeWidth:1.5}):(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{R()}},...Le.map((c,p)=>{let E=Ke(c);return{divider:p===0,label:Ue(c),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:q===c&&(0,a.jsx)(Ae,{size:14})}),handle:()=>{ie(c),l.mode==="edit"&&R()}}})]},{icon:(0,a.jsx)(wa,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||he(),handle:j},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await Z((await I()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!oe||i,handle:async()=>{let c=at(je());await ae({configs:ze.fromEntries(c.map(ao))});for(let p of c)w({cellId:p,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(qe,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(nt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Ce,{onClose:o}))}},{icon:(0,a.jsx)(ut,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Ce,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ne||i,handle:()=>{g()}},{icon:(0,a.jsx)(Ma,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{x()}},{icon:(0,a.jsx)(rt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(ka,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:k,redundant:!0},{divider:!0,icon:(0,a.jsx)(He,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(to)},{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(eo)},{icon:(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>P(Xa),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(st,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Qa},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Za},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ja},{icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:Ga},{icon:(0,a.jsx)(ot,{size:14,strokeWidth:1.5}),label:"Changelog",handle:$a}]},{divider:!0,icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ua},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ka}].filter(Oa).map(Va),e[15]=f,e[16]=ne,e[17]=u,e[18]=o,e[19]=y,e[20]=j,e[21]=S,e[22]=k,e[23]=te,e[24]=t,e[25]=O,e[26]=le,e[27]=oe,e[28]=d,e[29]=se,e[30]=i,e[31]=n,e[32]=I,e[33]=b,e[34]=x,e[35]=ae,e[36]=q,e[37]=r,e[38]=v,e[39]=z,e[40]=ie,e[41]=P,e[42]=B,e[43]=F,e[44]=D,e[45]=s,e[46]=R,e[47]=g,e[48]=w,e[49]=l.mode,e[50]=G):G=e[50],G}function Va(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ya)}:e}function Ya(e){return!e.hidden}function Oa(e){return!e.hidden}function Ka(){let e=Kt();window.open(e,"_blank")}function Ua(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function $a(){window.open(A.releasesPage,"_blank")}function Ga(){window.open(A.youtube,"_blank")}function Ja(){window.open(A.discordLink,"_blank")}function Za(){window.open(A.githubPage,"_blank")}function Qa(){window.open(A.docsPage,"_blank")}function Xa(e){return!e}function eo(e){return!e}function to(e){return!e}function ao(e){return[e,{disabled:!1}]}async function oo(){let e=document.getElementById("App");e&&await zt({element:e,filename:document.title,prepare:Mt})}function no(){return window.print()}function io(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 so(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Ae,{size:14})})}function X(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ye as a,qe as c,Oe as i,He as l,$e as n,Fe as o,Pa as r,Re as s,Fa as t,Te 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-DjFdxvph.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-BW0IMuFq.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/clsx-BDxNtGmi.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/cn-BoaCR37F.js">
|
|
@@ -195,7 +195,7 @@
|
|
|
195
195
|
<link rel="modulepreload" crossorigin href="./assets/command-DpusMohg.js">
|
|
196
196
|
<link rel="modulepreload" crossorigin href="./assets/download-DtyAt8iO.js">
|
|
197
197
|
<link rel="modulepreload" crossorigin href="./assets/useRunCells-D5wCIJdU.js">
|
|
198
|
-
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-
|
|
198
|
+
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-DZEdwTKg.js">
|
|
199
199
|
<link rel="modulepreload" crossorigin href="./assets/useIframeCapabilities-DTN9kFDq.js">
|
|
200
200
|
<link rel="modulepreload" crossorigin href="./assets/formats-rhOJovGE.js">
|
|
201
201
|
<link rel="modulepreload" crossorigin href="./assets/en-US-BO8E69bZ.js">
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
<link rel="modulepreload" crossorigin href="./assets/useDateFormatter-CpE7XQLs.js">
|
|
208
208
|
<link rel="modulepreload" crossorigin href="./assets/range-CJeRXUtp.js">
|
|
209
209
|
<link rel="modulepreload" crossorigin href="./assets/table-BCnp9gKC.js">
|
|
210
|
-
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-
|
|
210
|
+
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-C8n2adQU.js">
|
|
211
211
|
<link rel="modulepreload" crossorigin href="./assets/useDeleteCell-B4nKRnTM.js">
|
|
212
212
|
<link rel="modulepreload" crossorigin href="./assets/icons-CrUXojcA.js">
|
|
213
213
|
<link rel="modulepreload" crossorigin href="./assets/process-output-BewZuQwI.js">
|
|
@@ -220,19 +220,19 @@
|
|
|
220
220
|
<link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-Cbktc1B0.js">
|
|
221
221
|
<link rel="modulepreload" crossorigin href="./assets/isEmpty-CfmnKtgL.js">
|
|
222
222
|
<link rel="modulepreload" crossorigin href="./assets/bot-message-square-CK6eoGWy.js">
|
|
223
|
-
<link rel="modulepreload" crossorigin href="./assets/chat-display-
|
|
223
|
+
<link rel="modulepreload" crossorigin href="./assets/chat-display-CzIhohcg.js">
|
|
224
224
|
<link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-DV8gdCvH.js">
|
|
225
225
|
<link rel="modulepreload" crossorigin href="./assets/square-function-B006EYFX.js">
|
|
226
226
|
<link rel="modulepreload" crossorigin href="./assets/spec-DbmSqx09.js">
|
|
227
227
|
<link rel="modulepreload" crossorigin href="./assets/ellipsis-vertical-CAB7tdza.js">
|
|
228
228
|
<link rel="modulepreload" crossorigin href="./assets/components-C4dDqD7U.js">
|
|
229
|
-
<link rel="modulepreload" crossorigin href="./assets/column-preview-
|
|
229
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-spf8QkrL.js">
|
|
230
230
|
<link rel="modulepreload" crossorigin href="./assets/toggle-RCwU-rnE.js">
|
|
231
231
|
<link rel="modulepreload" crossorigin href="./assets/globals-C_t1YYpc.js">
|
|
232
232
|
<link rel="modulepreload" crossorigin href="./assets/share-BdH_5I58.js">
|
|
233
233
|
<link rel="modulepreload" crossorigin href="./assets/_baseSet-D5BgdrnX.js">
|
|
234
234
|
<link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-DDRqG5ui.js">
|
|
235
|
-
<link rel="modulepreload" crossorigin href="./assets/context-aware-panel-
|
|
235
|
+
<link rel="modulepreload" crossorigin href="./assets/context-aware-panel-8zsSzo4I.js">
|
|
236
236
|
<link rel="modulepreload" crossorigin href="./assets/floating-outline-B86gVj23.js">
|
|
237
237
|
<link rel="modulepreload" crossorigin href="./assets/useAddCell-BpBkEpP6.js">
|
|
238
238
|
<link rel="modulepreload" crossorigin href="./assets/eye-off-vwi9L975.js">
|
|
@@ -259,7 +259,7 @@
|
|
|
259
259
|
<link rel="stylesheet" crossorigin href="./assets/cells-jmgGt1lS.css">
|
|
260
260
|
<link rel="stylesheet" crossorigin href="./assets/markdown-renderer-DdDKmWlR.css">
|
|
261
261
|
<link rel="stylesheet" crossorigin href="./assets/JsonOutput-B7vuddcd.css">
|
|
262
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
262
|
+
<link rel="stylesheet" crossorigin href="./assets/index-BmoocKR0.css">
|
|
263
263
|
</head>
|
|
264
264
|
<body>
|
|
265
265
|
<div id="root"></div>
|
package/package.json
CHANGED
package/src/css/md-tooltip.css
CHANGED
|
@@ -3,50 +3,15 @@
|
|
|
3
3
|
/*
|
|
4
4
|
This allows you to create a basic tooltip using the data-tooltip attribute
|
|
5
5
|
e.g. <span data-tooltip="Hello, World!">Hover me</span>
|
|
6
|
+
|
|
7
|
+
The tooltip content is rendered via the React Tooltip component (Radix UI portal),
|
|
8
|
+
which prevents clipping inside containers with overflow:hidden.
|
|
9
|
+
See: RenderHTML.tsx -> wrapTooltipTargets
|
|
6
10
|
*/
|
|
7
11
|
|
|
8
12
|
.markdown {
|
|
9
13
|
[data-tooltip] {
|
|
10
|
-
position: relative;
|
|
11
14
|
cursor: pointer;
|
|
12
15
|
text-decoration: underline dotted;
|
|
13
16
|
}
|
|
14
|
-
|
|
15
|
-
[data-tooltip]::before,
|
|
16
|
-
[data-tooltip]::after {
|
|
17
|
-
visibility: hidden;
|
|
18
|
-
opacity: 0;
|
|
19
|
-
pointer-events: none;
|
|
20
|
-
transition: all 0.2s ease;
|
|
21
|
-
position: absolute;
|
|
22
|
-
z-index: 1000;
|
|
23
|
-
left: 50%;
|
|
24
|
-
transform: translateX(-50%);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
[data-tooltip]::before {
|
|
28
|
-
content: attr(data-tooltip);
|
|
29
|
-
bottom: calc(100% + 10px);
|
|
30
|
-
padding: 5px 10px;
|
|
31
|
-
width: max-content;
|
|
32
|
-
max-width: 300px;
|
|
33
|
-
border-radius: 6px;
|
|
34
|
-
background-color: ;
|
|
35
|
-
text-align: center;
|
|
36
|
-
line-height: 1.4;
|
|
37
|
-
white-space: pre-wrap;
|
|
38
|
-
|
|
39
|
-
@apply bg-background text-foreground shadow-md border text-base;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
[data-tooltip]:hover::before,
|
|
43
|
-
[data-tooltip]:hover::after {
|
|
44
|
-
visibility: visible;
|
|
45
|
-
opacity: 1;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
[data-tooltip]:hover::before {
|
|
49
|
-
/* stylelint-disable-next-line unit-allowed-list */
|
|
50
|
-
transform: translateX(-50%) translateY(10px);
|
|
51
|
-
}
|
|
52
17
|
}
|
|
@@ -14,6 +14,7 @@ import React, {
|
|
|
14
14
|
} from "react";
|
|
15
15
|
import { CopyClipboardIcon } from "@/components/icons/copy-icon";
|
|
16
16
|
import { QueryParamPreservingLink } from "@/components/ui/query-param-preserving-link";
|
|
17
|
+
import { Tooltip } from "@/components/ui/tooltip";
|
|
17
18
|
import { DocHoverTarget } from "@/core/documentation/DocHoverTarget";
|
|
18
19
|
import { sanitizeHtml, useSanitizeHtml } from "./sanitize";
|
|
19
20
|
|
|
@@ -160,6 +161,21 @@ const wrapDocHoverTargets: TransformFn = (
|
|
|
160
161
|
}
|
|
161
162
|
};
|
|
162
163
|
|
|
164
|
+
// Wrap elements with data-tooltip attribute in a Tooltip component.
|
|
165
|
+
// This renders the tooltip in a portal (top layer), fixing clipping inside
|
|
166
|
+
// containers with overflow:hidden (e.g. grid cells).
|
|
167
|
+
const wrapTooltipTargets: TransformFn = (
|
|
168
|
+
reactNode: ReactNode,
|
|
169
|
+
domNode: DOMNode,
|
|
170
|
+
): JSX.Element | undefined => {
|
|
171
|
+
if (domNode instanceof Element && domNode.attribs?.["data-tooltip"]) {
|
|
172
|
+
const tooltipContent = domNode.attribs["data-tooltip"];
|
|
173
|
+
return (
|
|
174
|
+
<Tooltip content={tooltipContent}>{reactNode as JSX.Element}</Tooltip>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
163
179
|
const CopyableCode = ({ children }: { children: ReactNode }) => {
|
|
164
180
|
const ref = useRef<HTMLDivElement>(null);
|
|
165
181
|
return (
|
|
@@ -239,6 +255,7 @@ function parseHtml({
|
|
|
239
255
|
addCopyButtonToCodehilite,
|
|
240
256
|
preserveQueryParamsInAnchorLinks,
|
|
241
257
|
wrapDocHoverTargets,
|
|
258
|
+
wrapTooltipTargets,
|
|
242
259
|
removeWrappingBodyTags,
|
|
243
260
|
removeWrappingHtmlTags,
|
|
244
261
|
];
|
|
@@ -197,6 +197,51 @@ describe("parseHtml", () => {
|
|
|
197
197
|
});
|
|
198
198
|
});
|
|
199
199
|
|
|
200
|
+
describe("wrapTooltipTargets", () => {
|
|
201
|
+
test("data-tooltip wraps element in Tooltip component", () => {
|
|
202
|
+
const html = '<span data-tooltip="Hello world">Hover me</span>';
|
|
203
|
+
expect(parseHtml({ html })).toMatchInlineSnapshot(`
|
|
204
|
+
<Tooltip
|
|
205
|
+
content="Hello world"
|
|
206
|
+
>
|
|
207
|
+
<span
|
|
208
|
+
data-tooltip="Hello world"
|
|
209
|
+
>
|
|
210
|
+
Hover me
|
|
211
|
+
</span>
|
|
212
|
+
</Tooltip>
|
|
213
|
+
`);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
test("element without data-tooltip is not wrapped", () => {
|
|
217
|
+
const html = "<span>No tooltip</span>";
|
|
218
|
+
expect(parseHtml({ html })).toMatchInlineSnapshot(`
|
|
219
|
+
<span>
|
|
220
|
+
No tooltip
|
|
221
|
+
</span>
|
|
222
|
+
`);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
test("data-tooltip on nested element wraps only that element", () => {
|
|
226
|
+
const html = '<p>Outer <span data-tooltip="tip">inner</span> text</p>';
|
|
227
|
+
expect(parseHtml({ html })).toMatchInlineSnapshot(`
|
|
228
|
+
<p>
|
|
229
|
+
Outer
|
|
230
|
+
<Tooltip
|
|
231
|
+
content="tip"
|
|
232
|
+
>
|
|
233
|
+
<span
|
|
234
|
+
data-tooltip="tip"
|
|
235
|
+
>
|
|
236
|
+
inner
|
|
237
|
+
</span>
|
|
238
|
+
</Tooltip>
|
|
239
|
+
text
|
|
240
|
+
</p>
|
|
241
|
+
`);
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
|
|
200
245
|
describe("parseHtml with < nad >", () => {
|
|
201
246
|
const html =
|
|
202
247
|
'thread <unnamed> panicked at "assertion failed: `(left == right)`"';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as v}from"./chunk-LvLJmgfZ.js";import{i as y,p as j,u as w}from"./useEvent-O0nX5vok.js";import{t as R}from"./react-Bj1aDYRI.js";import{Gr as m,Wr as S,m as _,ot as H,rn as I,sn as M}from"./cells-DqKJsMUm.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{m as N}from"./useEventListener-Dy81QR4n.js";import{o as T}from"./utils-tNbLd14P.js";import{t as z}from"./jsx-runtime-icT_Ltz2.js";import{t as C}from"./mode-Bn_XF6AW.js";import{t as F}from"./usePress-BHGkpw8X.js";import{n as L}from"./useDebounce-B0dx2Gp0.js";import{t as V}from"./copy-icon-C6n2vWSW.js";import{t as W}from"./useRunCells-D5wCIJdU.js";var k=E(),c=v(R(),1),o=v(z(),1);const q=r=>{let t=(0,k.c)(16),e,n,i;t[0]===r?(e=t[1],n=t[2],i=t[3]):({href:n,children:e,...i}=r,t[0]=r,t[1]=e,t[2]=n,t[3]=i);let a=(0,c.useRef)(null),s;t[4]===n?s=t[5]:(s=()=>{let u=new URL(globalThis.location.href);u.hash=n,globalThis.history.pushState({},"",u.toString()),globalThis.dispatchEvent(new HashChangeEvent("hashchange"));let x=n.slice(1),g=document.getElementById(x);g&&g.scrollIntoView({behavior:"smooth",block:"start"})},t[4]=n,t[5]=s);let l=s,f;t[6]===l?f=t[7]:(f={onPress:()=>{l()}},t[6]=l,t[7]=f);let{pressProps:h}=F(f),d;t[8]===l?d=t[9]:(d=u=>{u.preventDefault(),l()},t[8]=l,t[9]=d);let b=d,p;return t[10]!==e||t[11]!==b||t[12]!==n||t[13]!==h||t[14]!==i?(p=(0,o.jsx)("a",{ref:a,href:n,...h,onClick:b,...i,children:e}),t[10]=e,t[11]=b,t[12]=n,t[13]=h,t[14]=i,t[15]=p):p=t[15],p};async function A(r){let t=_().inOrderIds.at(0);if(t)try{let e=await I.request({document:r,cellId:t});if(!e||e.options.length===0)return;let n=r.split(".").pop()??r,i=e.options[0],a=e.options.find(s=>s.name===n)??i;a!=null&&a.completion_info&&y.set(M,{documentation:a.completion_info})}catch(e){N.debug(`Doc lookup failed for "${r}"`,e)}}var D=E();const O=r=>{let t=(0,D.c)(8),{qualifiedName:e,children:n}=r,i;t[0]===e?i=t[1]:(i=()=>{A(e)},t[0]=e,t[1]=i);let a=L(i,100),s;t[2]===a?s=t[3]:(s=()=>a.cancel(),t[2]=a,t[3]=s);let l;return t[4]!==n||t[5]!==a||t[6]!==s?(l=(0,o.jsx)("span",{onMouseEnter:a,onMouseLeave:s,children:n}),t[4]=n,t[5]=a,t[6]=s,t[7]=l):l=t[7],l};var P=j(r=>{let t=r(W),e=r(T);if(t||e)return!1;let n=!0;try{n=C()==="read"}catch{return!0}return!n});function $(){return w(P)}var B=E(),G=r=>{if(r instanceof m.Element&&!/^[A-Za-z][\w-]*$/.test(r.name))return c.createElement(c.Fragment)},U=(r,t)=>{if(t instanceof m.Element&&t.name==="body"){if((0,c.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},Z=(r,t)=>{if(t instanceof m.Element&&t.name==="html"){if((0,c.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},J=r=>{if(r instanceof m.Element&&r.attribs&&r.name==="iframe"){let t=document.createElement("iframe");return Object.entries(r.attribs).forEach(([e,n])=>{e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1)),t.setAttribute(e,n)}),(0,o.jsx)("div",{dangerouslySetInnerHTML:{__html:t.outerHTML}})}},K=r=>{if(r instanceof m.Element&&r.name==="script"){let t=r.attribs.src;if(!t)return;if(!document.querySelector(`script[src="${t}"]`)){let e=document.createElement("script");e.src=t,document.head.append(e)}return(0,o.jsx)(o.Fragment,{})}},Q=(r,t)=>{if(t instanceof m.Element&&t.name==="a"){let e=t.attribs.href;if(e!=null&&e.startsWith("#")&&!e.startsWith("#code/")){let n=null;return(0,c.isValidElement)(r)&&"props"in r&&(n=r.props.children),(0,o.jsx)(q,{href:e,...t.attribs,children:n})}}},X=(r,t,e)=>{var n,i;if(t instanceof m.Element&&t.name==="div"&&((i=(n=t.attribs)==null?void 0:n.class)!=null&&i.includes("codehilite")))return(0,o.jsx)(tt,{children:r},e)},Y=(r,t)=>{var e;if(t instanceof m.Element&&((e=t.attribs)!=null&&e["data-marimo-doc"])){let n=t.attribs["data-marimo-doc"];return(0,o.jsx)(O,{qualifiedName:n,children:r})}},tt=r=>{let t=(0,B.c)(3),{children:e}=r,n=(0,c.useRef)(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,o.jsx)("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,o.jsx)(V,{tooltip:!1,className:"p-1",value:()=>{var l;let s=(l=n.current)==null?void 0:l.firstChild;return s&&s.textContent||""}})}),t[0]=i):i=t[0];let a;return t[1]===e?a=t[2]:(a=(0,o.jsxs)("div",{className:"relative group codehilite-wrapper",ref:n,children:[e,i]}),t[1]=e,t[2]=a),a};const et=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e=!0})=>(0,o.jsx)(rt,{html:r,alwaysSanitizeHtml:e,additionalReplacements:t});var rt=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e})=>{let n=$();return nt({html:(0,c.useMemo)(()=>e||n?H(r):r,[r,e,n]),additionalReplacements:t})};function nt({html:r,additionalReplacements:t=[]}){let e=[G,J,K,...t],n=[X,Q,Y,U,Z];return S(r,{replace:(i,a)=>{for(let s of e){let l=s(i,a);if(l)return l}return i},transform:(i,a,s)=>{for(let l of n){let f=l(i,a,s);if(f)return f}return i}})}export{et as t};
|