@marimo-team/frontend 0.23.14-dev15 → 0.23.14-dev17
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-B3xvHnzm.js → JsonOutput-CkXJwn8J.js} +16 -16
- package/dist/assets/{add-connection-dialog-eFUDnHSy.js → add-connection-dialog--pz-XpsT.js} +1 -1
- package/dist/assets/{agent-panel-BGCbua1N.js → agent-panel-DY1YEHWw.js} +1 -1
- package/dist/assets/{cell-editor-_AISMwze.js → cell-editor-BnUCBSjC.js} +10 -10
- package/dist/assets/{column-preview-CRLyhWfr.js → column-preview-Bg3hDGJD.js} +1 -1
- package/dist/assets/{command-palette-CURV9AtB.js → command-palette-BbdDofd1.js} +1 -1
- package/dist/assets/{edit-page-Cd-kRjle.js → edit-page-LQnB3t-T.js} +5 -5
- package/dist/assets/{file-explorer-panel-BDDhE9ga.js → file-explorer-panel-DMwNb6Bg.js} +1 -1
- package/dist/assets/{form-DLyKzVpg.js → form-CQTcitBT.js} +2 -2
- package/dist/assets/{hooks-Dcm9QPMI.js → hooks-ckvJhsKD.js} +1 -1
- package/dist/assets/index-DqUQke09.js +38 -0
- package/dist/assets/{layout-Cy69mJ4R.js → layout-BQlueWdU.js} +5 -5
- package/dist/assets/{panels-D1nMzvUE.js → panels-CJMr5_0N.js} +1 -1
- package/dist/assets/{reveal-component-Bd93re9J.js → reveal-component-CNQCJm8q.js} +1 -1
- package/dist/assets/{run-page-CHEVBMSK.js → run-page-XJQF29mv.js} +1 -1
- package/dist/assets/{scratchpad-panel-Yk9GKgbH.js → scratchpad-panel-9LuOS7Lm.js} +1 -1
- package/dist/assets/session-panel-D1SRta-0.js +1 -0
- package/dist/assets/{useNotebookActions-D1WisUZZ.js → useNotebookActions-Dh4T1ZtI.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/src/components/data-table/__tests__/column-explorer.test.tsx +25 -0
- package/src/components/data-table/__tests__/column-visibility-dropdown.test.tsx +60 -3
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +33 -12
- package/src/components/data-table/column-visibility-dropdown.tsx +15 -0
- package/dist/assets/index-CB7HgmZd.js +0 -38
- package/dist/assets/session-panel-BoVyS6Gh.js +0 -1
|
@@ -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 qt,r as Ot,s as Rt,t as Bt}from"./select-Cjly7tmx.js";import{Ft as Vt}from"./JsonOutput-B3xvHnzm.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-Cy69mJ4R.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-DLyKzVpg.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-eFUDnHSy.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-Dcm9QPMI.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};
|
|
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 qt,n as Ft,r as Ot,s as Rt,t as Bt}from"./select-Cjly7tmx.js";import{It as Vt}from"./JsonOutput-CkXJwn8J.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 q}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-BQlueWdU.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 qe}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-CQTcitBT.js";import{n as ia,r as sa,t as la}from"./youtube-NfBeYlaL.js";import{i as ra,n as Fe}from"./add-connection-dialog--pz-XpsT.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-ckvJhsKD.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"}]]),qa=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"}]]),Fa=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}=q(),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)(Ft,{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)(qt,{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}=q(),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}=q(),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}=q(),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:_}=q(),D=Na(),de=I(yt),ce=I(Ct),he=I(pt),{selectedLayout:F}=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=F==="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]!==F||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)(Fa,{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)(qa,{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:F===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)(Fe,{onClose:o}))}},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Fe,{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)(qe,{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)(qe,{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]=F,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-DqUQke09.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">
|
|
@@ -199,11 +199,11 @@
|
|
|
199
199
|
<link rel="modulepreload" crossorigin href="./assets/plus-ZXRHY1up.js">
|
|
200
200
|
<link rel="modulepreload" crossorigin href="./assets/trash-2-CqTUwVuU.js">
|
|
201
201
|
<link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-Ce2ksurd.js">
|
|
202
|
-
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-
|
|
202
|
+
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-CkXJwn8J.js">
|
|
203
203
|
<link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-DVEV2j1H.js">
|
|
204
204
|
<link rel="modulepreload" crossorigin href="./assets/square-function-Dx0pKHko.js">
|
|
205
205
|
<link rel="modulepreload" crossorigin href="./assets/spec-CDgWI0fT.js">
|
|
206
|
-
<link rel="modulepreload" crossorigin href="./assets/column-preview-
|
|
206
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-Bg3hDGJD.js">
|
|
207
207
|
<link rel="modulepreload" crossorigin href="./assets/icons-avFV3lBF.js">
|
|
208
208
|
<link rel="modulepreload" crossorigin href="./assets/radio-group-CGYJUACh.js">
|
|
209
209
|
<link rel="modulepreload" crossorigin href="./assets/floating-outline-DHsNGe6F.js">
|
|
@@ -226,7 +226,7 @@
|
|
|
226
226
|
<link rel="modulepreload" crossorigin href="./assets/label-CFvCMYuj.js">
|
|
227
227
|
<link rel="modulepreload" crossorigin href="./assets/textarea-BYXnNYSr.js">
|
|
228
228
|
<link rel="modulepreload" crossorigin href="./assets/refresh-ccw-Bee7JLOl.js">
|
|
229
|
-
<link rel="modulepreload" crossorigin href="./assets/form-
|
|
229
|
+
<link rel="modulepreload" crossorigin href="./assets/form-CQTcitBT.js">
|
|
230
230
|
<link rel="modulepreload" crossorigin href="./assets/renderShortcut-LpVarhnQ.js">
|
|
231
231
|
<link rel="modulepreload" crossorigin href="./assets/useBoolean-BMzj74q1.js">
|
|
232
232
|
<link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-CWcgQCbT.js">
|
package/package.json
CHANGED
|
@@ -126,3 +126,28 @@ describe("ColumnExplorerPanel header counts", () => {
|
|
|
126
126
|
expect(screen.queryByText(/hidden/)).not.toBeInTheDocument();
|
|
127
127
|
});
|
|
128
128
|
});
|
|
129
|
+
|
|
130
|
+
describe("ColumnExplorerPanel visibility actions", () => {
|
|
131
|
+
const showAll = () => screen.getByRole("button", { name: /Show all/ });
|
|
132
|
+
const hideAll = () => screen.getByRole("button", { name: /Hide all/ });
|
|
133
|
+
|
|
134
|
+
it("disables 'Show all' when every column is visible", () => {
|
|
135
|
+
renderPanel();
|
|
136
|
+
expect(showAll()).toBeDisabled();
|
|
137
|
+
expect(hideAll()).toBeEnabled();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it("disables 'Hide all' when every column is hidden", () => {
|
|
141
|
+
renderPanel({
|
|
142
|
+
initiallyHidden: ["customer_name", "cust_age", "order_total"],
|
|
143
|
+
});
|
|
144
|
+
expect(showAll()).toBeEnabled();
|
|
145
|
+
expect(hideAll()).toBeDisabled();
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("enables both actions when some columns are hidden", () => {
|
|
149
|
+
renderPanel({ initiallyHidden: ["cust_age"] });
|
|
150
|
+
expect(showAll()).toBeEnabled();
|
|
151
|
+
expect(hideAll()).toBeEnabled();
|
|
152
|
+
});
|
|
153
|
+
});
|
|
@@ -21,10 +21,17 @@ beforeAll(() => {
|
|
|
21
21
|
|
|
22
22
|
type Row = Record<string, unknown>;
|
|
23
23
|
|
|
24
|
+
// Select, index, and nameless columns are non-hideable in production
|
|
25
|
+
// (see columns.tsx), so the harness mirrors that to keep visibility counts
|
|
26
|
+
// aligned with the real table.
|
|
24
27
|
const TEST_COLUMNS: ColumnDef<Row>[] = [
|
|
25
|
-
{ id: SELECT_COLUMN_ID, accessorKey: SELECT_COLUMN_ID },
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
+
{ id: SELECT_COLUMN_ID, accessorKey: SELECT_COLUMN_ID, enableHiding: false },
|
|
29
|
+
{
|
|
30
|
+
id: INDEX_COLUMN_NAME,
|
|
31
|
+
accessorKey: INDEX_COLUMN_NAME,
|
|
32
|
+
enableHiding: false,
|
|
33
|
+
},
|
|
34
|
+
{ id: "__m_column__0", accessorKey: "__m_column__0", enableHiding: false },
|
|
28
35
|
{
|
|
29
36
|
id: "customer_name",
|
|
30
37
|
accessorKey: "customer_name",
|
|
@@ -101,6 +108,7 @@ describe("ColumnVisibilityDropdown", () => {
|
|
|
101
108
|
renderAndOpen({ initiallyHidden: ["cust_age"] });
|
|
102
109
|
expect(getOptionTexts()).toEqual([
|
|
103
110
|
"Show all",
|
|
111
|
+
"Hide all",
|
|
104
112
|
"cust_age",
|
|
105
113
|
"customer_name",
|
|
106
114
|
"order_total",
|
|
@@ -117,6 +125,7 @@ describe("ColumnVisibilityDropdown", () => {
|
|
|
117
125
|
|
|
118
126
|
expect(getOptionTexts()).toEqual([
|
|
119
127
|
"Show all",
|
|
128
|
+
"Hide all",
|
|
120
129
|
"cust_age",
|
|
121
130
|
"customer_name",
|
|
122
131
|
"order_total",
|
|
@@ -132,6 +141,7 @@ describe("ColumnVisibilityDropdown", () => {
|
|
|
132
141
|
fireEvent.click(getColumnOption("customer_name"));
|
|
133
142
|
expect(getOptionTexts()).toEqual([
|
|
134
143
|
"Show all",
|
|
144
|
+
"Hide all",
|
|
135
145
|
"cust_age",
|
|
136
146
|
"customer_name",
|
|
137
147
|
"order_total",
|
|
@@ -144,6 +154,7 @@ describe("ColumnVisibilityDropdown", () => {
|
|
|
144
154
|
// Reopen sorts both hidden columns first, preserving table order.
|
|
145
155
|
expect(getOptionTexts()).toEqual([
|
|
146
156
|
"Show all",
|
|
157
|
+
"Hide all",
|
|
147
158
|
"customer_name",
|
|
148
159
|
"cust_age",
|
|
149
160
|
"order_total",
|
|
@@ -189,6 +200,52 @@ describe("ColumnVisibilityDropdown", () => {
|
|
|
189
200
|
);
|
|
190
201
|
});
|
|
191
202
|
|
|
203
|
+
it("'Hide all' hides every hideable column", () => {
|
|
204
|
+
renderAndOpen();
|
|
205
|
+
fireEvent.click(getColumnOption("Hide all"));
|
|
206
|
+
|
|
207
|
+
expect(
|
|
208
|
+
getColumnOption("customer_name").querySelector(".lucide-eye-off"),
|
|
209
|
+
).not.toBeNull();
|
|
210
|
+
expect(
|
|
211
|
+
getColumnOption("cust_age").querySelector(".lucide-eye-off"),
|
|
212
|
+
).not.toBeNull();
|
|
213
|
+
expect(
|
|
214
|
+
getColumnOption("order_total").querySelector(".lucide-eye-off"),
|
|
215
|
+
).not.toBeNull();
|
|
216
|
+
expect(getColumnOption("Hide all")).toHaveAttribute(
|
|
217
|
+
"aria-disabled",
|
|
218
|
+
"true",
|
|
219
|
+
);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it("disables 'Hide all' when every column is already hidden", () => {
|
|
223
|
+
renderAndOpen({
|
|
224
|
+
initiallyHidden: ["customer_name", "cust_age", "order_total"],
|
|
225
|
+
});
|
|
226
|
+
expect(getColumnOption("Hide all")).toHaveAttribute(
|
|
227
|
+
"aria-disabled",
|
|
228
|
+
"true",
|
|
229
|
+
);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it("'Hide all' leaves non-hideable columns visible", () => {
|
|
233
|
+
renderAndOpen({ nonHideable: ["customer_name"] });
|
|
234
|
+
fireEvent.click(getColumnOption("Hide all"));
|
|
235
|
+
|
|
236
|
+
expect(
|
|
237
|
+
getColumnOption("cust_age").querySelector(".lucide-eye-off"),
|
|
238
|
+
).not.toBeNull();
|
|
239
|
+
const nonHideable = getColumnOption("customer_name");
|
|
240
|
+
expect(nonHideable).toHaveAttribute("aria-disabled", "true");
|
|
241
|
+
expect(nonHideable.querySelector(".lucide-eye-off")).toBeNull();
|
|
242
|
+
// Every hideable column is now hidden, so the action gates off.
|
|
243
|
+
expect(getColumnOption("Hide all")).toHaveAttribute(
|
|
244
|
+
"aria-disabled",
|
|
245
|
+
"true",
|
|
246
|
+
);
|
|
247
|
+
});
|
|
248
|
+
|
|
192
249
|
it("hides and shows matching columns via bulk actions while searching", () => {
|
|
193
250
|
renderAndOpen();
|
|
194
251
|
fireEvent.change(getSearchInput(), { target: { value: "cust" } });
|
|
@@ -50,7 +50,10 @@ import {
|
|
|
50
50
|
import { smartMatch } from "@/utils/smartMatch";
|
|
51
51
|
import type { Column, Table } from "@tanstack/react-table";
|
|
52
52
|
import { cn } from "@/utils/cn";
|
|
53
|
-
import {
|
|
53
|
+
import {
|
|
54
|
+
getColumnCountForDisplay,
|
|
55
|
+
getUserColumnVisibilityCounts,
|
|
56
|
+
} from "../hooks/use-column-visibility";
|
|
54
57
|
|
|
55
58
|
interface ColumnExplorerPanelProps<TData> {
|
|
56
59
|
previewColumn: PreviewColumn;
|
|
@@ -90,6 +93,7 @@ export function ColumnExplorerPanel<TData>({
|
|
|
90
93
|
totalColumns: effectiveTotalColumns,
|
|
91
94
|
hiddenColumns: hiddenColumnCount,
|
|
92
95
|
} = getColumnCountForDisplay(table, totalColumns);
|
|
96
|
+
const { visible: visibleColumnCount } = getUserColumnVisibilityCounts(table);
|
|
93
97
|
|
|
94
98
|
const { rowsAndColumns, hiddenSuffix } = prettifyRowColumnCount({
|
|
95
99
|
numRows: totalRows,
|
|
@@ -108,17 +112,34 @@ export function ColumnExplorerPanel<TData>({
|
|
|
108
112
|
value={columns?.map(([columnName]) => columnName).join(",\n") || ""}
|
|
109
113
|
className="h-3 w-3"
|
|
110
114
|
/>
|
|
111
|
-
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
<div className="ml-auto flex items-center gap-1">
|
|
116
|
+
<Tooltip content="Show all columns" delayDuration={400}>
|
|
117
|
+
<Button
|
|
118
|
+
type="button"
|
|
119
|
+
variant="ghost"
|
|
120
|
+
size="xs"
|
|
121
|
+
className="gap-1"
|
|
122
|
+
disabled={hiddenColumnCount === 0}
|
|
123
|
+
onClick={() => table.toggleAllColumnsVisible(true)}
|
|
124
|
+
>
|
|
125
|
+
<EyeIcon className="w-3 h-3" />
|
|
126
|
+
Show all
|
|
127
|
+
</Button>
|
|
128
|
+
</Tooltip>
|
|
129
|
+
<Tooltip content="Hide all columns" delayDuration={400}>
|
|
130
|
+
<Button
|
|
131
|
+
type="button"
|
|
132
|
+
variant="ghost"
|
|
133
|
+
size="xs"
|
|
134
|
+
className="gap-1"
|
|
135
|
+
disabled={visibleColumnCount === 0}
|
|
136
|
+
onClick={() => table.toggleAllColumnsVisible(false)}
|
|
137
|
+
>
|
|
138
|
+
<EyeOffIcon className="w-3 h-3" />
|
|
139
|
+
Hide all
|
|
140
|
+
</Button>
|
|
141
|
+
</Tooltip>
|
|
142
|
+
</div>
|
|
122
143
|
</div>
|
|
123
144
|
<Command className="h-5/6 bg-background" shouldFilter={false}>
|
|
124
145
|
<CommandInput
|
|
@@ -59,6 +59,12 @@ export const ColumnVisibilityDropdown = <TData,>({
|
|
|
59
59
|
const hiddenIds = userColumns
|
|
60
60
|
.filter((column) => !column.getIsVisible())
|
|
61
61
|
.map((column) => column.id);
|
|
62
|
+
const hideableIds = userColumns
|
|
63
|
+
.filter((column) => column.getCanHide())
|
|
64
|
+
.map((column) => column.id);
|
|
65
|
+
const visibleHideableCount = hideableIds.filter(
|
|
66
|
+
(id) => !hiddenIds.includes(id),
|
|
67
|
+
).length;
|
|
62
68
|
|
|
63
69
|
const applyHidden = (next: string[] | string | null) => {
|
|
64
70
|
const hidden = new Set(Array.isArray(next) ? next : []);
|
|
@@ -127,6 +133,15 @@ export const ColumnVisibilityDropdown = <TData,>({
|
|
|
127
133
|
<EyeIcon className="w-3 h-3 mr-1.5" />
|
|
128
134
|
Show all
|
|
129
135
|
</CommandItem>
|
|
136
|
+
<CommandItem
|
|
137
|
+
value="__hide_all__"
|
|
138
|
+
disabled={visibleHideableCount === 0}
|
|
139
|
+
onSelect={() => applyHidden(hideableIds)}
|
|
140
|
+
className="cursor-pointer"
|
|
141
|
+
>
|
|
142
|
+
<EyeOffIcon className="w-3 h-3 mr-1.5" />
|
|
143
|
+
Hide all
|
|
144
|
+
</CommandItem>
|
|
130
145
|
<CommandSeparator />
|
|
131
146
|
</>
|
|
132
147
|
) : (
|