@marimo-team/frontend 0.19.5-dev40 → 0.19.5-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.
Files changed (48) hide show
  1. package/dist/assets/{JsonOutput-Cm5B4ITW.js → JsonOutput-BJKlFcc0.js} +3 -3
  2. package/dist/assets/{add-cell-with-ai-DcCKbUTJ.js → add-cell-with-ai-2okCoA2d.js} +1 -1
  3. package/dist/assets/{agent-panel-UTyb4ZWt.js → agent-panel-DS2YyDty.js} +1 -1
  4. package/dist/assets/ai-model-dropdown-C-5PlP5A.js +2 -0
  5. package/dist/assets/{app-config-button-BZRH0Vm5.js → app-config-button-CWGnhJfC.js} +1 -1
  6. package/dist/assets/{cell-editor-DvMYGVZI.js → cell-editor-1qg6DEg8.js} +1 -1
  7. package/dist/assets/{chat-panel-OQJ3Uzfy.js → chat-panel-Biq3a7V5.js} +2 -2
  8. package/dist/assets/{column-preview-D7tpBZ8D.js → column-preview-oXDBchsB.js} +1 -1
  9. package/dist/assets/{command-palette-CM7uPgIZ.js → command-palette-Dk8PKzC6.js} +1 -1
  10. package/dist/assets/{dependency-graph-panel-BnTjJemH.js → dependency-graph-panel-BkcSye1r.js} +1 -1
  11. package/dist/assets/download-C_slsU-7.js +1 -0
  12. package/dist/assets/{edit-page-BH1Zauk_.js → edit-page-qFmf6UNC.js} +3 -3
  13. package/dist/assets/{file-explorer-panel-DHdkeWlc.js → file-explorer-panel-BmTuxLH7.js} +1 -1
  14. package/dist/assets/{home-page-CEjjqCrm.js → home-page-dF6IF-l_.js} +1 -1
  15. package/dist/assets/hooks-BKBouwbG.js +1 -0
  16. package/dist/assets/{index-DlwPGlGp.js → index-iQfK7AJ4.js} +3 -3
  17. package/dist/assets/{layout-CmYdEP97.js → layout-wTVz6YE7.js} +2 -2
  18. package/dist/assets/{packages-panel-g0Q5mmiP.js → packages-panel-CFeF0dwu.js} +1 -1
  19. package/dist/assets/{panels-aGfk1Uim.js → panels-CuOtdNMV.js} +1 -1
  20. package/dist/assets/{run-page-Dl5uK1BA.js → run-page-BYrxd_KZ.js} +1 -1
  21. package/dist/assets/{scratchpad-panel-DM1IMG_b.js → scratchpad-panel-B5-yknRc.js} +1 -1
  22. package/dist/assets/{session-panel-Cb33DPYR.js → session-panel-kCLI973D.js} +1 -1
  23. package/dist/assets/state-DYlTWGKl.js +1 -0
  24. package/dist/assets/useCellActionButton-DSlxpMvt.js +1 -0
  25. package/dist/assets/{useDependencyPanelTab-CelOV6ll.js → useDependencyPanelTab-BzMsMr2G.js} +1 -1
  26. package/dist/assets/useNotebookActions-sYRj2R7H.js +1 -0
  27. package/dist/assets/{utilities.esm-h8Z3Fnc4.js → utilities.esm-Dx7lHb2R.js} +1 -1
  28. package/dist/index.html +7 -7
  29. package/package.json +1 -1
  30. package/src/components/ai/__tests__/ai-utils.test.ts +276 -0
  31. package/src/components/ai/ai-utils.ts +101 -0
  32. package/src/components/app-config/ai-config.tsx +56 -16
  33. package/src/components/app-config/user-config-form.tsx +29 -0
  34. package/src/components/chat/chat-panel.tsx +3 -3
  35. package/src/components/editor/actions/useCellActionButton.tsx +2 -2
  36. package/src/components/editor/actions/useNotebookActions.tsx +18 -10
  37. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +1 -1
  38. package/src/core/ai/model-registry.ts +21 -3
  39. package/src/core/export/hooks.ts +7 -11
  40. package/src/utils/__tests__/download.test.tsx +398 -2
  41. package/src/utils/download.ts +107 -6
  42. package/dist/assets/ai-model-dropdown-DlakzOQz.js +0 -2
  43. package/dist/assets/download-B1tR5R3Y.js +0 -1
  44. package/dist/assets/hooks-DXFCXuj4.js +0 -1
  45. package/dist/assets/state-AqERlXYZ.js +0 -1
  46. package/dist/assets/useCellActionButton-CYhHKo1M.js +0 -1
  47. package/dist/assets/useNotebookActions-73PWLiXf.js +0 -1
  48. package/src/components/export/export-output-button.tsx +0 -14
@@ -1 +0,0 @@
1
- import{s as le}from"./chunk-LvLJmgfZ.js";import{d as N,l as qe,p as Re,u as Q}from"./useEvent-DlWF5OMa.js";import{t as Ve}from"./react-BGmjiNul.js";import{$n as Oe,Gn as Ue,Jn as $e,Rt as Be,Un as Ye,ai as Z,dn as Fe,g as Ge,hn as se,jt as Je,ln as Ke,m as re,t as Xe,un as Qe,w as de,yr as Ze,zt as ce}from"./cells-CmJW_FeD.js";import{t as W}from"./compiler-runtime-DeeZ7FnK.js";import{i as et}from"./useLifecycle-CmDXEyIC.js";import{a as he}from"./type-BdyvjzTI.js";import{n as tt}from"./add-database-form-DKmQ7lVc.js";import{a as pe,d as D}from"./hotkeys-uKX61F1_.js";import{y as at}from"./utils-Czt8B2GX.js";import{n as _,t as me}from"./constants-Bkp4R3bQ.js";import{A as ot,f as it,j as ue,w as nt}from"./config-CENq_7Pd.js";import{t as lt}from"./jsx-runtime-DN_bIXfG.js";import{r as st,t as ee}from"./button-B8cGZzP5.js";import{r as P}from"./requests-C0HaHO6a.js";import{t as h}from"./createLucideIcon-CW2xpJ57.js";import{a as fe,f as rt,i as ye,m as dt,p as be,u as ke}from"./layout-CmYdEP97.js";import{t as xe}from"./check-CrAQug3q.js";import{a as ct,c as ht,i as pt,n as mt,r as ut,s as ft,t as yt}from"./select-D9lTzMzP.js";import{a as bt,i as kt,n as we,o as ge,t as xt}from"./download-B1tR5R3Y.js";import{f as wt}from"./maps-s2pQkyf5.js";import{r as gt}from"./useCellActionButton-CYhHKo1M.js";import{t as jt}from"./copy-gBVL4NN-.js";import{d as vt,t as Ct}from"./state-AqERlXYZ.js";import{t as zt}from"./download-DobaYJPt.js";import{t as Mt}from"./eye-off-D9zAYqG9.js";import{t as Wt}from"./file-plus-corner-BO_uS88s.js";import{t as _t}from"./file-BnFXtaZZ.js";import{i as At,n as St,r as Nt,t as Dt}from"./youtube-BJQRl2JC.js";import{n as Pt,t as It}from"./house-CncUa_LL.js";import{n as Et}from"./play-BJDBXApx.js";import{t as Tt}from"./link-54sBkoQp.js";import{r as Ht}from"./input-B80Yt1uu.js";import{t as Lt}from"./settings-MTlHVxz3.js";import{y as qt}from"./textarea-DzIuH-E_.js";import{t as Rt}from"./square-leQTJTJJ.js";import{t as C}from"./use-toast-Bzf3rpev.js";import{t as Vt}from"./tooltip-CvjcEpZC.js";import{a as je,i as Ot,r as Ut}from"./mode-CXc0VeQq.js";import{o as $t}from"./alert-dialog-jcHA5geR.js";import{a as Bt,c as Yt,i as Ft,n as Gt,r as Jt}from"./dialog-CF5DtF1E.js";import{n as te}from"./ImperativeModal-DVhvP4lH.js";import{r as Kt,t as Xt}from"./share-CXQVxivL.js";import{t as V}from"./copy-DRhpWiOq.js";import{r as Qt}from"./useRunCells-DNnhJ0Gs.js";import{a as Zt}from"./cell-link-CJpa2T01.js";import{a as ve}from"./renderShortcut-BzTDKVab.js";import{t as ea}from"./icons-9QU2Dup7.js";import{t as ta}from"./links-Dh2BjF0A.js";import{r as aa,t as oa}from"./hooks-DXFCXuj4.js";import{t as Ce}from"./types-DBNA0l6L.js";var ia=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),na=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),ze=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"}]]),Me=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"}]]),We=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"}]]),la=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"}]]),sa=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"}]]),ra=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"}]]),_e=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"}]]),da=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"}]]),ca=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ae=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"}]]),ha=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"}]]),pa=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"}]]),Se=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"}]]),Ne=W(),ae=le(Ve(),1),a=le(lt(),1),O="https://static.marimo.app";const ma=e=>{let t=(0,Ne.c)(25),{onClose:i}=e,[o,l]=(0,ae.useState)(""),{exportAsHTML:r}=P(),s=`${o}-${Math.random().toString(36).slice(2,6)}`,n=`${O}/static/${s}`,d;t[0]!==r||t[1]!==i||t[2]!==s?(d=async v=>{v.preventDefault(),i();let A=await r({download:!1,includeCode:!0,files:rt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${O}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:A,path:s})}).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:_.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]=i,t[2]=s,t[3]=d):d=t[3];let p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(Yt,{children:"Share static notebook"}),t[4]=p):p=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Bt,{children:[p,(0,a.jsxs)(Jt,{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:O,target:"_blank",children:O}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{l(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let m;t[7]===o?m=t[8]:(m=(0,a.jsx)(Ht,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=m);let u;t[9]===n?u=t[10]:(u=(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)(ua,{text:n}),(0,a.jsx)("span",{className:"text-primary",children:n})]})]}),t[9]=n,t[10]=u);let f;t[11]!==m||t[12]!==u?(f=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[m,u]}),t[11]=m,t[12]=u,t[13]=f):f=t[13];let y;t[14]===i?y=t[15]:(y=(0,a.jsx)(ee,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:i,children:"Cancel"}),t[14]=i,t[15]=y);let b;t[16]===n?b=t[17]:(b=(0,a.jsx)(ee,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await V(n)},children:"Create"}),t[16]=n,t[17]=b);let k;t[18]!==y||t[19]!==b?(k=(0,a.jsxs)(Ft,{children:[y,b]}),t[18]=y,t[19]=b,t[20]=k):k=t[20];let j;return t[21]!==d||t[22]!==k||t[23]!==f?(j=(0,a.jsx)(Gt,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,f,k]})}),t[21]=d,t[22]=k,t[23]=f,t[24]=j):j=t[24],j};var ua=e=>{let t=(0,Ne.c)(8),[i,o]=ae.useState(!1),l;t[0]===e.text?l=t[1]:(l=st.stopPropagation(async p=>{p.preventDefault(),await V(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=l);let r=l,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),t[2]=s):s=t[2];let n;t[3]===r?n=t[4]:(n=(0,a.jsx)(ee,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:s}),t[3]=r,t[4]=n);let d;return t[5]!==i||t[6]!==n?(d=(0,a.jsx)(Vt,{content:"Copied!",open:i,children:n}),t[5]=i,t[6]=n,t[7]=d):d=t[7],d},fa=W();function ya(){let e=document.getElementsByClassName(me.outputArea);for(let t of e){let i=t.getBoundingClientRect();if(i.bottom>0&&i.top<window.innerHeight){let o=Z.findElement(t);if(!o){D.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:Z.parse(o.id)}}}return D.warn("No visible output area found for scroll anchor"),null}function ba(e){if(!e){D.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(Z.create(e.cellId));if(!t){D.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${me.outputArea}`)){D.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function De(){let e=(0,fa.c)(2),t=N(je),i;return e[0]===t?i=e[1]:(i=()=>{let o=ya();t(l=>({mode:Ot(l.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ba(o)})})},e[0]=t,e[1]=i),i}const Pe=Re(!1);var ka=W();const xa=()=>{let e=(0,ka.c)(7),{selectedLayout:t}=fe(),{setLayoutView:i}=ye();if(ue()&&!se("wasm_layouts"))return null;let o;e[0]===i?o=e[1]:(o=n=>i(n),e[0]=i,e[1]=o);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(ft,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(ht,{placeholder:"Select a view"})}),e[2]=l):l=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(mt,{children:(0,a.jsxs)(ut,{children:[(0,a.jsx)(ct,{children:"View as"}),Ce.map(ga)]})}),e[3]=r):r=e[3];let s;return e[4]!==t||e[5]!==o?(s=(0,a.jsxs)(yt,{"data-testid":"layout-select",value:t,onValueChange:o,children:[l,r]}),e[4]=t,e[5]=o,e[6]=s):s=e[6],s};function wa(e){return(0,a.jsx)(Ie(e),{className:"h-4 w-4"})}function Ie(e){switch(e){case"vertical":return da;case"grid":return Nt;case"slides":return Ae;default:return et(e),Rt}}function Ee(e){return he(e)}function ga(e){return(0,a.jsx)(pt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[wa(e),(0,a.jsx)("span",{children:Ee(e)})]})},e)}var ja=W();function va(e){let t=(0,ja.c)(5),{openPrompt:i,closeModal:o}=te(),{sendCopy:l}=P(),r;return t[0]!==o||t[1]!==i||t[2]!==l||t[3]!==e?(r=()=>{if(!e)return null;let s=Be.guessDeliminator(e);i({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${ce.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:n=>{let d=s.join(ce.dirname(e),n);l({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),ta(d)})}})},t[0]=o,t[1]=i,t[2]=l,t[3]=e,t[4]=r):r=t[4],r}const Ca=()=>{let{updateCellConfig:e}=de(),{saveCellConfig:t}=P();return(0,ae.useCallback)(async()=>{let i=new Je,o=re(),l=o.cellIds.inOrderIds,r={};for(let n of l){if(o.cellData[n]===void 0)continue;let{code:d,config:p}=o.cellData[n];p.hide_code||i.isSupported(d)&&(r[n]={hide_code:!0})}let s=pe.entries(r);if(s.length!==0){await t({configs:r});for(let[n,d]of s)e({cellId:n,config:d})}},[e])};var za=W();function Te(){let e=(0,za.c)(4),{openConfirm:t}=te(),i=N(nt),{sendRestart:o}=P(),l;return e[0]!==t||e[1]!==o||e[2]!==i?(l=()=>{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)($t,{onClick:async()=>{i({state:ot.CLOSING}),await o(),Kt()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=i,e[3]=l):l=e[3],l}var Ma=W(),I=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Wa(){var ie,ne;let e=(0,Ma.c)(38),t=Zt(),{openModal:i,closeModal:o}=te(),{toggleApplication:l}=Ke(),{selectedPanel:r}=Qe(),[s]=qe(je),n=Q(Ut),d=Ca(),[p]=at(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:m,addSetupCellIfDoesntExist:u,collapseAllCells:f,expandAllCells:y}=de(),b=Te(),k=Qt(),j=va(t),v=N(Pe),A=N(Ct),z=N(vt),{exportAsMarkdown:U,readCode:S,saveCellConfig:$,updateCellOutputs:B}=P(),Y=Q(Ge),F=Q(Xe),{selectedLayout:G}=fe(),{setLayoutView:J}=ye(),E=De(),K=aa(),T=((ie=p.sharing)==null?void 0:ie.html)??!0,H=((ne=p.sharing)==null?void 0:ne.wasm)??!0,He=$a,L;e[0]===Symbol.for("react.memo_cache_sentinel")?(L=(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),e[0]=L):L=e[0];let q;e[1]===Symbol.for("react.memo_cache_sentinel")?(q=(0,a.jsx)(be,{size:14,strokeWidth:1.5}),e[1]=q):q=e[1];let M;e[2]===t?M=e[3]:(M=async()=>{if(!t){oe();return}await ke({filename:t,includeCode:!0})},e[2]=t,e[3]=M);let R;return e[4]!==u||e[5]!==F||e[6]!==m||e[7]!==o||e[8]!==f||e[9]!==j||e[10]!==y||e[11]!==U||e[12]!==t||e[13]!==Y||e[14]!==d||e[15]!==n||e[16]!==i||e[17]!==S||e[18]!==b||e[19]!==k||e[20]!==$||e[21]!==G||e[22]!==r||e[23]!==v||e[24]!==z||e[25]!==J||e[26]!==A||e[27]!==T||e[28]!==H||e[29]!==M||e[30]!==K||e[31]!==l||e[32]!==E||e[33]!==g||e[34]!==w||e[35]!==B||e[36]!==s.mode?(R=[{icon:L,label:"Download",handle:I,dropdown:[{icon:q,label:"Download as HTML",handle:M},{icon:(0,a.jsx)(be,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){oe();return}await ke({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(ea,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await U({download:!1});we(new Blob([c],{type:"text/plain"}),ge.toMarkdown(document.title))}},{icon:(0,a.jsx)(dt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await S();we(new Blob([c.contents],{type:"text/plain"}),ge.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:s.mode!=="present",tooltip:s.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",ve("global.hideCode",!1)]}),handle:Ua},{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Download as PDF",disabled:s.mode!=="present",tooltip:s.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",ve("global.hideCode",!1)]}),handle:async()=>{if(se("server_side_pdf_export")){if(!t){oe();return}await bt("Downloading PDF...",async()=>{await oa(K,B),await xt({filename:t,webpdf:!1})});return}let c=new Event("export-beforeprint"),x=new Event("export-afterprint");(function(){window.dispatchEvent(c),setTimeout(Oa,0),setTimeout(()=>window.dispatchEvent(x),0)})()}}]},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Share",handle:I,hidden:!T&&!H,dropdown:[{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!T,handle:async()=>{i((0,a.jsx)(ma,{onClose:o}))}},{icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!H,handle:async()=>{await V(Xt({code:(await S()).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:I,dropdown:Fe.flatMap(c=>{let{type:x,Icon:X,hidden:Le}=c;return Le?[]:{label:he(x),rightElement:He(r===x),icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),handle:()=>l(x)}})},{icon:(0,a.jsx)(Ae,{size:14,strokeWidth:1.5}),label:"Present as",handle:I,dropdown:[{icon:s.mode==="present"?(0,a.jsx)(qt,{size:14,strokeWidth:1.5}):(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{E()}},...Ce.map((c,x)=>{let X=Ie(c);return{divider:x===0,label:Ee(c),icon:(0,a.jsx)(X,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:G===c&&(0,a.jsx)(xe,{size:14})}),handle:()=>{J(c),s.mode==="edit"&&E()}}})]},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||ue(),handle:j},{icon:(0,a.jsx)(ze,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await V((await S()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(gt,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!Y||n,handle:async()=>{let c=Ze(re());await $({configs:pe.fromEntries(c.map(Va))});for(let x of c)w({cellId:x,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(We,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{u({})}},{icon:(0,a.jsx)(Ue,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{i((0,a.jsx)(tt,{onClose:o}))}},{icon:(0,a.jsx)(Se,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!F||n,handle:()=>{g()}},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b},{icon:(0,a.jsx)(la,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)($e,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{m()}},{icon:(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:f,redundant:!0},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:y,redundant:!0},{divider:!0,icon:(0,a.jsx)(Me,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(Ra)},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(qa)},{icon:(0,a.jsx)(Lt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>A(La),redundant:!0},{icon:(0,a.jsx)(wt,{size:14,strokeWidth:1.5}),label:"Resources",handle:I,dropdown:[{icon:(0,a.jsx)(Oe,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Ha},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Ta},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ea},{icon:(0,a.jsx)(Dt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:Ia},{icon:(0,a.jsx)(Ye,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Pa}]},{divider:!0,icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Da},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Na}].filter(Sa).map(_a),e[4]=u,e[5]=F,e[6]=m,e[7]=o,e[8]=f,e[9]=j,e[10]=y,e[11]=U,e[12]=t,e[13]=Y,e[14]=d,e[15]=n,e[16]=i,e[17]=S,e[18]=b,e[19]=k,e[20]=$,e[21]=G,e[22]=r,e[23]=v,e[24]=z,e[25]=J,e[26]=A,e[27]=T,e[28]=H,e[29]=M,e[30]=K,e[31]=l,e[32]=E,e[33]=g,e[34]=w,e[35]=B,e[36]=s.mode,e[37]=R):R=e[37],R}function _a(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Aa)}:e}function Aa(e){return!e.hidden}function Sa(e){return!e.hidden}function Na(){let e=it();window.open(e,"_blank")}function Da(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Pa(){window.open(_.releasesPage,"_blank")}function Ia(){window.open(_.youtube,"_blank")}function Ea(){window.open(_.discordLink,"_blank")}function Ta(){window.open(_.githubPage,"_blank")}function Ha(){window.open(_.docsPage,"_blank")}function La(e){return!e}function qa(e){return!e}function Ra(e){return!e}function Va(e){return[e,{disabled:!1}]}function Oa(){return window.print()}async function Ua(){let e=document.getElementById("App");e&&await kt(e,document.title)}function $a(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(xe,{size:14})})}function oe(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{De as a,We as c,Pe as i,Me as l,Te as n,Se as o,xa as r,_e as s,Wa as t,ze as u};
@@ -1,14 +0,0 @@
1
- /* Copyright 2026 Marimo. All rights reserved. */
2
-
3
- import { type CellId, CellOutputId } from "@/core/cells/ids";
4
- import { downloadHTMLAsImage } from "@/utils/download";
5
-
6
- export function downloadCellOutput(cellId: CellId) {
7
- const output = document.getElementById(CellOutputId.create(cellId));
8
- if (output) {
9
- output.classList.add("printing-output");
10
- downloadHTMLAsImage(output, "result.png").finally(() => {
11
- output.classList.remove("printing-output");
12
- });
13
- }
14
- }