@marimo-team/frontend 0.20.5-dev74 → 0.20.5-dev75
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/{CellStatus-DEEA1fS0.js → CellStatus-D0IfrfUM.js} +1 -1
- package/dist/assets/{JsonOutput-BWuy9_Uo.js → JsonOutput-BRjuq1Jw.js} +5 -5
- package/dist/assets/{MarimoErrorOutput-Bk9Hzuph.js → MarimoErrorOutput-CimwFZPP.js} +1 -1
- package/dist/assets/{RenderHTML-D0xk61Nc.js → RenderHTML-B0MiHkXS.js} +1 -1
- package/dist/assets/{add-cell-with-ai-CexSYQ0N.js → add-cell-with-ai-U_En-o_I.js} +1 -1
- package/dist/assets/{add-connection-dialog-4WRVPyOw.js → add-connection-dialog-CIHDuGfD.js} +1 -1
- package/dist/assets/{agent-panel-K3vcKzY-.js → agent-panel-CvQx48V8.js} +1 -1
- package/dist/assets/{ai-model-dropdown-aOgZg8xJ.js → ai-model-dropdown-CZMwYbbD.js} +1 -1
- package/dist/assets/{app-config-button-8au35I9d.js → app-config-button-CaZJfEaI.js} +1 -1
- package/dist/assets/{azure-CJ1W3WXx.js → azure-Dy9N467C.js} +1 -1
- package/dist/assets/{cell-editor-DFG2roYm.js → cell-editor-BN72f4Y9.js} +1 -1
- package/dist/assets/{cell-link-C_p31_XK.js → cell-link-CL9widoN.js} +1 -1
- package/dist/assets/{cells-Dko3VJMa.js → cells-wT6clfi5.js} +42 -42
- package/dist/assets/{chat-display-aQXw_Hfq.js → chat-display-D2m36iog.js} +1 -1
- package/dist/assets/{chat-panel-Bl7VtH8V.js → chat-panel-jtJ2SKmP.js} +1 -1
- package/dist/assets/{column-preview-DAyznIPe.js → column-preview-DBQzaLrY.js} +1 -1
- package/dist/assets/{command-CTqhCaOG.js → command-DGKK2-4P.js} +1 -1
- package/dist/assets/{command-palette-BjiW6h5w.js → command-palette-Kjc4rXfu.js} +1 -1
- package/dist/assets/{common-BDVrbW3T.js → common-Msb-h79F.js} +1 -1
- package/dist/assets/{components-DKKThDlU.js → components-CNlTaOLK.js} +1 -1
- package/dist/assets/{components-COxjT57Q.js → components-U5Mj1xiO.js} +1 -1
- package/dist/assets/{context-aware-panel-0Q9D8Jbq.js → context-aware-panel-CaZEaV8C.js} +1 -1
- package/dist/assets/{datasource-BtRoXlPB.js → datasource-DIETDMi4.js} +2 -2
- package/dist/assets/{dependency-graph-panel-BZxjNNsC.js → dependency-graph-panel-RAEDBSLL.js} +1 -1
- package/dist/assets/{documentation-panel-BVF_mApj.js → documentation-panel-B5ZS7rdM.js} +1 -1
- package/dist/assets/{download-Cyc73C0z.js → download-RVcmZh1N.js} +1 -1
- package/dist/assets/{edit-page-BENR7bXv.js → edit-page-SV9Nzg27.js} +3 -3
- package/dist/assets/{error-panel-DbZWZXtT.js → error-panel-xO_Uo7Vu.js} +1 -1
- package/dist/assets/{file-explorer-panel-CU44M9sN.js → file-explorer-panel-DiJOGwKe.js} +1 -1
- package/dist/assets/{file-icons-BDF1KJ-g.js → file-icons-Br3viuqL.js} +1 -1
- package/dist/assets/{floating-outline-BjtTLnUQ.js → floating-outline-jCvD7_Ne.js} +1 -1
- package/dist/assets/{focus-BVyrnQFw.js → focus-q8oYkLV6.js} +1 -1
- package/dist/assets/{form-CpE6hRXk.js → form-BEIQJWib.js} +1 -1
- package/dist/assets/{globals-QM7QwL0F.js → globals-Bh7qAnqa.js} +1 -1
- package/dist/assets/{home-page-DCMIxtS2.js → home-page-CtTUaWn1.js} +1 -1
- package/dist/assets/{hooks-D159yuKK.js → hooks-ChoVWWrC.js} +1 -1
- package/dist/assets/{html-to-image-BVD_b3kv.js → html-to-image-DBFAQbWm.js} +1 -1
- package/dist/assets/{index-De9wDesI.js → index-mF9nW3EI.js} +23 -23
- package/dist/assets/{kiosk-mode-BlFqfq0v.js → kiosk-mode-DWLXbf9i.js} +1 -1
- package/dist/assets/{layout-BIzi0C7s.js → layout-OuSaBBrA.js} +1 -1
- package/dist/assets/{logs-panel-DQWPl648.js → logs-panel-Q1OMBsBk.js} +1 -1
- package/dist/assets/{markdown-renderer-BlkrJXmR.js → markdown-renderer-D2_DEfz5.js} +1 -1
- package/dist/assets/{name-cell-input-IZfaG56A.js → name-cell-input-BhRgpz9L.js} +1 -1
- package/dist/assets/{outline-panel-CmeddpZW.js → outline-panel-BXMNkx0G.js} +1 -1
- package/dist/assets/{packages-panel-BcH46fgB.js → packages-panel-Omrbq4eV.js} +1 -1
- package/dist/assets/{panels-DCVrpfqF.js → panels-Z0QtbAii.js} +1 -1
- package/dist/assets/{process-output-BDso6euY.js → process-output-BXIvuDcK.js} +1 -1
- package/dist/assets/{readonly-python-code-D1Ej5uPa.js → readonly-python-code-YmScI7wz.js} +1 -1
- package/dist/assets/{run-page-Bu-sabyM.js → run-page-D5R165Vz.js} +1 -1
- package/dist/assets/{scratchpad-panel-CRCCw4HK.js → scratchpad-panel-3qHOUid8.js} +1 -1
- package/dist/assets/{session-panel-DG6O4-Zb.js → session-panel-D2vq8N6n.js} +1 -1
- package/dist/assets/{snippets-panel-QEbbiX-r.js → snippets-panel-BReCSuHT.js} +1 -1
- package/dist/assets/{state-2aCkm3bk.js → state-BN6sGgkm.js} +1 -1
- package/dist/assets/{switch-DBwvTtpS.js → switch-BHXOZNHf.js} +1 -1
- package/dist/assets/{tracing-mL8VFfN6.js → tracing-D_eBhjGe.js} +1 -1
- package/dist/assets/{tracing-panel-D1fjM-Ql.js → tracing-panel-adLR9Xcg.js} +2 -2
- package/dist/assets/{useAddCell-Bixf-aSQ.js → useAddCell-ErFmQedu.js} +1 -1
- package/dist/assets/{useBoolean-BNysdr0s.js → useBoolean-B8gcV_C4.js} +1 -1
- package/dist/assets/{useCellActionButton-ze_8Hle6.js → useCellActionButton-5K5fLTMd.js} +1 -1
- package/dist/assets/{useDeleteCell-121EByuB.js → useDeleteCell-CmX8_XRr.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-CWDaIHvB.js → useDependencyPanelTab-CVeDMlz5.js} +1 -1
- package/dist/assets/{useNotebookActions-B1vkxmv-.js → useNotebookActions-CtZiwIc-.js} +1 -1
- package/dist/assets/{useSplitCell-DMaq6xCC.js → useSplitCell-CZQNZZ7B.js} +1 -1
- package/dist/index.html +30 -30
- package/package.json +1 -1
- package/src/core/cells/ids.ts +2 -1
- package/src/core/dom/ui-element-constants.ts +15 -0
- package/src/core/dom/ui-element.ts +3 -2
- package/src/core/islands/components/web-components.tsx +2 -1
- package/src/plugins/impl/DataTablePlugin.tsx +53 -3
- package/src/plugins/impl/FileBrowserPlugin.tsx +4 -1
- package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as we}from"./chunk-LvLJmgfZ.js";import{d as L,l as Ze,p as Qe,u as de}from"./useEvent-O0nX5vok.js";import{t as et}from"./react-Bj1aDYRI.js";import{Cn as tt,En as at,Gt as ot,Nr as nt,Sn as it,T as ge,_ as st,ar as lt,cr as rt,dt as je,h as ve,lt as dt,pr as ct,pt as ht,rr as pt,t as mt,ut,vi as ce,xn as ft}from"./cells-Dko3VJMa.js";import{t as _}from"./compiler-runtime-B3qBwwSJ.js";import{n as yt}from"./assertNever-CTRGz-ul.js";import{s as Ce}from"./useLifecycle-CWjBWFMI.js";import{i as kt,n as ze}from"./add-connection-dialog-4WRVPyOw.js";import{n as bt,x as xt}from"./ai-model-dropdown-aOgZg8xJ.js";import{c as Me,m as T}from"./useEventListener-BGihH8bs.js";import{y as wt}from"./utils-BvPM6Bro.js";import{n as A,t as We}from"./constants-Rz_lD4HK.js";import{S as he,h as gt,x as jt}from"./config-DeEqZTX7.js";import{t as vt}from"./jsx-runtime-icT_Ltz2.js";import{r as Ct,t as pe}from"./button-BZAv3veu.js";import{r as H}from"./requests-Bgjtqo_1.js";import{t as h}from"./createLucideIcon-Cm-Z7dYr.js";import{a as Se,f as zt,i as De,m as Mt,p as _e,u as Ae}from"./layout-BIzi0C7s.js";import{t as Ne}from"./check-BE0hEwVo.js";import{c as Pe,d as me,n as Wt,o as St,r as ue,t as Dt}from"./download-Cyc73C0z.js";import{f as _t}from"./maps-CqKCrVZ8.js";import{r as At}from"./useCellActionButton-ze_8Hle6.js";import{t as Nt}from"./copy-CkudG0Ej.js";import{t as Pt}from"./download-DBW9RXtT.js";import{t as It}from"./eye-off-vwi9L975.js";import{t as Et}from"./file-plus-corner-lLQw9OnR.js";import{t as J}from"./file-DzHkbIdO.js";import{t as Lt}from"./github-BVtI-3F1.js";import{m as Tt}from"./form-CpE6hRXk.js";import{n as Ht,r as qt,t as Rt}from"./youtube-DE-Ej6FR.js";import{n as Bt,t as Ft}from"./square-CxAsQQ77.js";import{t as Ot}from"./image-DXfkah9d.js";import{t as Vt}from"./link-Cf10mh3t.js";import{r as Yt}from"./input-C5eatTLl.js";import{t as Kt}from"./settings-CzQUw9rV.js";import{x as Ut}from"./azure-CJ1W3WXx.js";import{t as C}from"./use-toast-Hc8CXlvz.js";import{n as Ie,t as Gt}from"./paths-D2lG83Oh.js";import{o as $t}from"./session-CXChHxAw.js";import{a as Jt,c as Xt,i as Zt,n as Qt,r as ea,s as ta,t as aa}from"./select-Ch6m1k2G.js";import{t as oa}from"./tooltip-CNmaER6z.js";import{o as na}from"./alert-dialog-DbQ_TZC7.js";import{a as ia,c as sa,i as la,n as ra,r as da}from"./dialog-DCGn-_Ip.js";import{n as fe}from"./ImperativeModal-b5nJtLod.js";import{r as ca,t as ha}from"./share-DdWa0mV7.js";import{t as X}from"./copy-f2iEg0yL.js";import{a as pa}from"./cell-link-C_p31_XK.js";import{a as ma}from"./renderShortcut-C3rk7kIN.js";import{t as ua}from"./icons-T5yQRjuT.js";import{t as fa}from"./links-XdsYEk97.js";import{r as ya,t as Ee}from"./hooks-D159yuKK.js";import{t as Le}from"./types-DBNA0l6L.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"}]]),Oe=_(),ye=we(et(),1),a=we(vt(),1),Z="https://static.marimo.app";const Wa=e=>{let t=(0,Oe.c)(25),{onClose:n}=e,[o,s]=(0,ye.useState)(""),{exportAsHTML:r}=H(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${Z}/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:zt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Z}/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)(sa,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(ia,{children:[m,(0,a.jsxs)(da,{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:Z,target:"_blank",children:Z}),"."]})]}),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)(Yt,{"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 X(i)},children:"Create"}),t[16]=i,t[17]=b);let x;t[18]!==k||t[19]!==b?(x=(0,a.jsxs)(la,{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)(ra,{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,Oe.c)(8),[n,o]=ye.useState(!1),s;t[0]===e.text?s=t[1]:(s=Ct.stopPropagation(async m=>{m.preventDefault(),await X(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)(Nt,{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)(oa,{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(We.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(`.${We.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ve(){let e=(0,Da.c)(2),t=L(je),n;return e[0]===t?n=e[1]:(n=()=>{let o=_a();t(s=>({mode:ut(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Aa(o)})})},e[0]=t,e[1]=n),n}const Ye=Qe(!1);var Na=_();const Pa=()=>{let e=(0,Na.c)(7),{selectedLayout:t}=Se(),{setLayoutView:n}=De();if(he()&&!at("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)(ta,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Xt,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Qt,{children:(0,a.jsxs)(ea,{children:[(0,a.jsx)(Jt,{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)(aa,{"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 qt;case"slides":return Be;default:return yt(e),Ft}}function Ue(e){return Ce(e)}function Ea(e){return(0,a.jsx)(Zt,{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=Gt.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Ie.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Ie.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 ot,o=ve(),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=Me.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 Ge(){let e=(0,Ra.c)(4),{openConfirm:t}=fe(),n=L(gt),{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)(na,{onClick:async()=>{n({state:jt.CLOSING}),await o(),ca()},"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}=ft(),{selectedPanel:r}=it(),[l]=Ze(je),i=de(dt),d=qa(),[m]=wt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:k}=ge(),b=Ge(),x=ht(),j=Ha(t),v=L(Ye),P=L(bt),z=L(xt),{exportAsIPYNB:ee,exportAsMarkdown:te,readCode:I,saveCellConfig:ae,updateCellOutputs:M}=H(),W=ya(),oe=de(st),ne=de(mt),{selectedLayout:q}=Se(),{setLayoutView:ie}=De(),R=Ve(),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",$e=so,Je=io,O;e[0]!==t||e[1]!==W||e[2]!==M?(O=async c=>{let{preset:p,title:E}=c;if(!t){Q();return}await Pe(E,async re=>{await Ee({takeScreenshots:()=>W({progress:re}),updateCellOutputs:M}),await La({filename:t,preset:p,downloadPDF:Wt})})},e[0]=t,e[1]=W,e[2]=M,e[3]=O):O=e[3];let S=O,V;e[4]===S?V=e[5]:(V=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]=V);let Y=V,K;e[6]!==ee||e[7]!==t||e[8]!==W||e[9]!==M?(K=async()=>{if(!t){Q();return}await Pe("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)(Pt,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let G;e[12]===Symbol.for("react.memo_cache_sentinel")?(G=(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),e[12]=G):G=e[12];let D;e[13]===t?D=e[14]:(D=async()=>{if(!t){Q();return}await Ae({filename:t,includeCode:!0})},e[13]=t,e[14]=D);let $;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]!==Y||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?($=[{icon:U,label:"Download",handle:N,dropdown:[{icon:G,label:"Download as HTML",handle:D},{icon:(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){Q();return}await Ae({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)(Mt,{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)(Ot,{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:Y},{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:Y}]},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!B&&!F,dropdown:[{icon:(0,a.jsx)(Tt,{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)(Vt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!F,handle:async()=>{await X(ha({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:tt.flatMap(c=>{let{type:p,Icon:E,hidden:re,additionalKeywords:Xe}=c;return re?[]:{label:Ce(p),rightElement:$e(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:Xe}})},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Ut,{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)(Ne,{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 X((await I()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!oe||i,handle:async()=>{let c=nt(ve());await ae({configs:Me.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)(lt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(ze,{onClose:o}))}},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(ze,{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)(It,{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)(Kt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>P(Qa),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(ct,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Za},{icon:(0,a.jsx)(Lt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Xa},{icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ja},{icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:$a},{icon:(0,a.jsx)(pt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ga}]},{divider:!0,icon:(0,a.jsx)(Bt,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ua},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ka}].filter(Ya).map(Oa),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]=Y,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]=$):$=e[50],$}function Oa(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Va)}:e}function Va(e){return!e.hidden}function Ya(e){return!e.hidden}function Ka(){let e=$t();window.open(e,"_blank")}function Ua(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ga(){window.open(A.releasesPage,"_blank")}function $a(){window.open(A.youtube,"_blank")}function Ja(){window.open(A.discordLink,"_blank")}function Xa(){window.open(A.githubPage,"_blank")}function Za(){window.open(A.docsPage,"_blank")}function Qa(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 St({element:e,filename:document.title,prepare:Dt})}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)(Ne,{size:14})})}function Q(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ve as a,qe as c,Ye as i,He as l,Ge 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 Ze,p as Qe,u as de}from"./useEvent-O0nX5vok.js";import{t as et}from"./react-Bj1aDYRI.js";import{Cn as tt,En as at,Gt as ot,Nr as nt,Sn as it,T as ge,_ as st,ar as lt,cr as rt,dt as je,h as ve,lt as dt,pr as ct,pt as ht,rr as pt,t as mt,ut,vi as ce,xn as ft}from"./cells-wT6clfi5.js";import{t as _}from"./compiler-runtime-B3qBwwSJ.js";import{n as yt}from"./assertNever-CTRGz-ul.js";import{s as Ce}from"./useLifecycle-CWjBWFMI.js";import{i as kt,n as ze}from"./add-connection-dialog-CIHDuGfD.js";import{n as bt,x as xt}from"./ai-model-dropdown-CZMwYbbD.js";import{c as Me,m as T}from"./useEventListener-BGihH8bs.js";import{y as wt}from"./utils-BvPM6Bro.js";import{n as A,t as We}from"./constants-Rz_lD4HK.js";import{S as he,h as gt,x as jt}from"./config-DeEqZTX7.js";import{t as vt}from"./jsx-runtime-icT_Ltz2.js";import{r as Ct,t as pe}from"./button-BZAv3veu.js";import{r as H}from"./requests-Bgjtqo_1.js";import{t as h}from"./createLucideIcon-Cm-Z7dYr.js";import{a as Se,f as zt,i as De,m as Mt,p as _e,u as Ae}from"./layout-OuSaBBrA.js";import{t as Ne}from"./check-BE0hEwVo.js";import{c as Pe,d as me,n as Wt,o as St,r as ue,t as Dt}from"./download-RVcmZh1N.js";import{f as _t}from"./maps-CqKCrVZ8.js";import{r as At}from"./useCellActionButton-5K5fLTMd.js";import{t as Nt}from"./copy-CkudG0Ej.js";import{t as Pt}from"./download-DBW9RXtT.js";import{t as It}from"./eye-off-vwi9L975.js";import{t as Et}from"./file-plus-corner-lLQw9OnR.js";import{t as J}from"./file-DzHkbIdO.js";import{t as Lt}from"./github-BVtI-3F1.js";import{m as Tt}from"./form-BEIQJWib.js";import{n as Ht,r as qt,t as Rt}from"./youtube-DE-Ej6FR.js";import{n as Bt,t as Ft}from"./square-CxAsQQ77.js";import{t as Ot}from"./image-DXfkah9d.js";import{t as Vt}from"./link-Cf10mh3t.js";import{r as Yt}from"./input-C5eatTLl.js";import{t as Kt}from"./settings-CzQUw9rV.js";import{x as Ut}from"./azure-Dy9N467C.js";import{t as C}from"./use-toast-Hc8CXlvz.js";import{n as Ie,t as Gt}from"./paths-D2lG83Oh.js";import{o as $t}from"./session-CXChHxAw.js";import{a as Jt,c as Xt,i as Zt,n as Qt,r as ea,s as ta,t as aa}from"./select-Ch6m1k2G.js";import{t as oa}from"./tooltip-CNmaER6z.js";import{o as na}from"./alert-dialog-DbQ_TZC7.js";import{a as ia,c as sa,i as la,n as ra,r as da}from"./dialog-DCGn-_Ip.js";import{n as fe}from"./ImperativeModal-b5nJtLod.js";import{r as ca,t as ha}from"./share-DdWa0mV7.js";import{t as X}from"./copy-f2iEg0yL.js";import{a as pa}from"./cell-link-CL9widoN.js";import{a as ma}from"./renderShortcut-C3rk7kIN.js";import{t as ua}from"./icons-T5yQRjuT.js";import{t as fa}from"./links-XdsYEk97.js";import{r as ya,t as Ee}from"./hooks-ChoVWWrC.js";import{t as Le}from"./types-DBNA0l6L.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"}]]),Oe=_(),ye=we(et(),1),a=we(vt(),1),Z="https://static.marimo.app";const Wa=e=>{let t=(0,Oe.c)(25),{onClose:n}=e,[o,s]=(0,ye.useState)(""),{exportAsHTML:r}=H(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${Z}/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:zt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Z}/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)(sa,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(ia,{children:[m,(0,a.jsxs)(da,{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:Z,target:"_blank",children:Z}),"."]})]}),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)(Yt,{"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 X(i)},children:"Create"}),t[16]=i,t[17]=b);let x;t[18]!==k||t[19]!==b?(x=(0,a.jsxs)(la,{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)(ra,{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,Oe.c)(8),[n,o]=ye.useState(!1),s;t[0]===e.text?s=t[1]:(s=Ct.stopPropagation(async m=>{m.preventDefault(),await X(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)(Nt,{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)(oa,{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(We.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(`.${We.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ve(){let e=(0,Da.c)(2),t=L(je),n;return e[0]===t?n=e[1]:(n=()=>{let o=_a();t(s=>({mode:ut(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Aa(o)})})},e[0]=t,e[1]=n),n}const Ye=Qe(!1);var Na=_();const Pa=()=>{let e=(0,Na.c)(7),{selectedLayout:t}=Se(),{setLayoutView:n}=De();if(he()&&!at("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)(ta,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Xt,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Qt,{children:(0,a.jsxs)(ea,{children:[(0,a.jsx)(Jt,{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)(aa,{"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 qt;case"slides":return Be;default:return yt(e),Ft}}function Ue(e){return Ce(e)}function Ea(e){return(0,a.jsx)(Zt,{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=Gt.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Ie.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Ie.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 ot,o=ve(),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=Me.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 Ge(){let e=(0,Ra.c)(4),{openConfirm:t}=fe(),n=L(gt),{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)(na,{onClick:async()=>{n({state:jt.CLOSING}),await o(),ca()},"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}=ft(),{selectedPanel:r}=it(),[l]=Ze(je),i=de(dt),d=qa(),[m]=wt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:k}=ge(),b=Ge(),x=ht(),j=Ha(t),v=L(Ye),P=L(bt),z=L(xt),{exportAsIPYNB:ee,exportAsMarkdown:te,readCode:I,saveCellConfig:ae,updateCellOutputs:M}=H(),W=ya(),oe=de(st),ne=de(mt),{selectedLayout:q}=Se(),{setLayoutView:ie}=De(),R=Ve(),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",$e=so,Je=io,O;e[0]!==t||e[1]!==W||e[2]!==M?(O=async c=>{let{preset:p,title:E}=c;if(!t){Q();return}await Pe(E,async re=>{await Ee({takeScreenshots:()=>W({progress:re}),updateCellOutputs:M}),await La({filename:t,preset:p,downloadPDF:Wt})})},e[0]=t,e[1]=W,e[2]=M,e[3]=O):O=e[3];let S=O,V;e[4]===S?V=e[5]:(V=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]=V);let Y=V,K;e[6]!==ee||e[7]!==t||e[8]!==W||e[9]!==M?(K=async()=>{if(!t){Q();return}await Pe("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)(Pt,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let G;e[12]===Symbol.for("react.memo_cache_sentinel")?(G=(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),e[12]=G):G=e[12];let D;e[13]===t?D=e[14]:(D=async()=>{if(!t){Q();return}await Ae({filename:t,includeCode:!0})},e[13]=t,e[14]=D);let $;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]!==Y||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?($=[{icon:U,label:"Download",handle:N,dropdown:[{icon:G,label:"Download as HTML",handle:D},{icon:(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){Q();return}await Ae({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)(Mt,{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)(Ot,{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:Y},{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:Y}]},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!B&&!F,dropdown:[{icon:(0,a.jsx)(Tt,{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)(Vt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!F,handle:async()=>{await X(ha({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:tt.flatMap(c=>{let{type:p,Icon:E,hidden:re,additionalKeywords:Xe}=c;return re?[]:{label:Ce(p),rightElement:$e(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:Xe}})},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Ut,{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)(Ne,{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 X((await I()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!oe||i,handle:async()=>{let c=nt(ve());await ae({configs:Me.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)(lt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(ze,{onClose:o}))}},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(ze,{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)(It,{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)(Kt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>P(Qa),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(ct,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Za},{icon:(0,a.jsx)(Lt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Xa},{icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ja},{icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:$a},{icon:(0,a.jsx)(pt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ga}]},{divider:!0,icon:(0,a.jsx)(Bt,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ua},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ka}].filter(Ya).map(Oa),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]=Y,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]=$):$=e[50],$}function Oa(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Va)}:e}function Va(e){return!e.hidden}function Ya(e){return!e.hidden}function Ka(){let e=$t();window.open(e,"_blank")}function Ua(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ga(){window.open(A.releasesPage,"_blank")}function $a(){window.open(A.youtube,"_blank")}function Ja(){window.open(A.discordLink,"_blank")}function Xa(){window.open(A.githubPage,"_blank")}function Za(){window.open(A.docsPage,"_blank")}function Qa(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 St({element:e,filename:document.title,prepare:Dt})}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)(Ne,{size:14})})}function Q(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ve as a,qe as c,Ye as i,He as l,Ge as n,Fe as o,Pa as r,Re as s,Fa as t,Te as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as m}from"./chunk-LvLJmgfZ.js";import{n as p}from"./useEvent-O0nX5vok.js";import{T as d,_t as f,f as u}from"./cells-
|
|
1
|
+
import{s as m}from"./chunk-LvLJmgfZ.js";import{n as p}from"./useEvent-O0nX5vok.js";import{T as d,_t as f,f as u}from"./cells-wT6clfi5.js";import{t as c}from"./compiler-runtime-B3qBwwSJ.js";import{t as C}from"./jsx-runtime-icT_Ltz2.js";import{t as h}from"./use-toast-Hc8CXlvz.js";import{r as v}from"./useDeleteCell-CmX8_XRr.js";var x=c(),b=m(C(),1);function j(){let t=(0,x.c)(3),{splitCell:i,undoSplitCell:r}=d(),o;return t[0]!==i||t[1]!==r?(o=s=>{let l=u(s.cellId);if(!l)return;let a=f(l);i(s);let{dismiss:n}=h({title:"Cell split",action:(0,b.jsx)(v,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{r({...s,snapshot:a}),e()},children:"Undo"})}),e=n},t[0]=i,t[1]=r,t[2]=o):o=t[2],p(o)}export{j as t};
|
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-mF9nW3EI.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">
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
<link rel="modulepreload" crossorigin href="./assets/toInteger-CO3ppIfA.js">
|
|
135
135
|
<link rel="modulepreload" crossorigin href="./assets/database-zap-DTWCDKdn.js">
|
|
136
136
|
<link rel="modulepreload" crossorigin href="./assets/main-DrBRErTM.js">
|
|
137
|
-
<link rel="modulepreload" crossorigin href="./assets/cells-
|
|
137
|
+
<link rel="modulepreload" crossorigin href="./assets/cells-wT6clfi5.js">
|
|
138
138
|
<link rel="modulepreload" crossorigin href="./assets/spinner-C5JoisA7.js">
|
|
139
139
|
<link rel="modulepreload" crossorigin href="./assets/chevron-right-D0GQBpTb.js">
|
|
140
140
|
<link rel="modulepreload" crossorigin href="./assets/dropdown-menu-CJ-Wwa2I.js">
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
<link rel="modulepreload" crossorigin href="./assets/dist-CWEZ0LAs.js">
|
|
149
149
|
<link rel="modulepreload" crossorigin href="./assets/label-BuJDtc39.js">
|
|
150
150
|
<link rel="modulepreload" crossorigin href="./assets/useDebounce-DwTO_rGp.js">
|
|
151
|
-
<link rel="modulepreload" crossorigin href="./assets/azure-
|
|
151
|
+
<link rel="modulepreload" crossorigin href="./assets/azure-Dy9N467C.js">
|
|
152
152
|
<link rel="modulepreload" crossorigin href="./assets/numbers-BWhcwX6S.js">
|
|
153
153
|
<link rel="modulepreload" crossorigin href="./assets/SSRProvider-CwqN9FWV.js">
|
|
154
154
|
<link rel="modulepreload" crossorigin href="./assets/context-CRmPPhx9.js">
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
<link rel="modulepreload" crossorigin href="./assets/input-C5eatTLl.js">
|
|
158
158
|
<link rel="modulepreload" crossorigin href="./assets/links-CoGM-Inf.js">
|
|
159
159
|
<link rel="modulepreload" crossorigin href="./assets/popover-JNsSzROl.js">
|
|
160
|
-
<link rel="modulepreload" crossorigin href="./assets/switch-
|
|
160
|
+
<link rel="modulepreload" crossorigin href="./assets/switch-BHXOZNHf.js">
|
|
161
161
|
<link rel="modulepreload" crossorigin href="./assets/table-CKtrITeZ.js">
|
|
162
162
|
<link rel="modulepreload" crossorigin href="./assets/useAsyncData-a8f2Q_nk.js">
|
|
163
163
|
<link rel="modulepreload" crossorigin href="./assets/errors-0IrrdfSG.js">
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-CHAHPgkx.js">
|
|
172
172
|
<link rel="modulepreload" crossorigin href="./assets/trash-2-CAoNMkjq.js">
|
|
173
173
|
<link rel="modulepreload" crossorigin href="./assets/triangle-alert-qZo1ox6x.js">
|
|
174
|
-
<link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-
|
|
174
|
+
<link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-CZMwYbbD.js">
|
|
175
175
|
<link rel="modulepreload" crossorigin href="./assets/defaultLocale-CuYNS33t.js">
|
|
176
176
|
<link rel="modulepreload" crossorigin href="./assets/precisionRound-CCOoIlcP.js">
|
|
177
177
|
<link rel="modulepreload" crossorigin href="./assets/defaultLocale-CGfP-Ye3.js">
|
|
@@ -180,20 +180,20 @@
|
|
|
180
180
|
<link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-H5EQrcAX.js">
|
|
181
181
|
<link rel="modulepreload" crossorigin href="./assets/useInstallPackage-CO3hLMle.js">
|
|
182
182
|
<link rel="modulepreload" crossorigin href="./assets/ImperativeModal-b5nJtLod.js">
|
|
183
|
-
<link rel="modulepreload" crossorigin href="./assets/cell-link-
|
|
184
|
-
<link rel="modulepreload" crossorigin href="./assets/datasource-
|
|
185
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
186
|
-
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-
|
|
183
|
+
<link rel="modulepreload" crossorigin href="./assets/cell-link-CL9widoN.js">
|
|
184
|
+
<link rel="modulepreload" crossorigin href="./assets/datasource-DIETDMi4.js">
|
|
185
|
+
<link rel="modulepreload" crossorigin href="./assets/state-BN6sGgkm.js">
|
|
186
|
+
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-CimwFZPP.js">
|
|
187
187
|
<link rel="modulepreload" crossorigin href="./assets/copy-icon-Cu7az85f.js">
|
|
188
|
-
<link rel="modulepreload" crossorigin href="./assets/html-to-image-
|
|
189
|
-
<link rel="modulepreload" crossorigin href="./assets/focus-
|
|
188
|
+
<link rel="modulepreload" crossorigin href="./assets/html-to-image-DBFAQbWm.js">
|
|
189
|
+
<link rel="modulepreload" crossorigin href="./assets/focus-q8oYkLV6.js">
|
|
190
190
|
<link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-CwbmGJrl.js">
|
|
191
191
|
<link rel="modulepreload" crossorigin href="./assets/chunk-5FQGJX7Z-DEi7JZeU.js">
|
|
192
192
|
<link rel="modulepreload" crossorigin href="./assets/katex-0Z75JF53.js">
|
|
193
|
-
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-
|
|
194
|
-
<link rel="modulepreload" crossorigin href="./assets/command-
|
|
195
|
-
<link rel="modulepreload" crossorigin href="./assets/download-
|
|
196
|
-
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-
|
|
193
|
+
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-D2_DEfz5.js">
|
|
194
|
+
<link rel="modulepreload" crossorigin href="./assets/command-DGKK2-4P.js">
|
|
195
|
+
<link rel="modulepreload" crossorigin href="./assets/download-RVcmZh1N.js">
|
|
196
|
+
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-B0MiHkXS.js">
|
|
197
197
|
<link rel="modulepreload" crossorigin href="./assets/useIframeCapabilities-DG-6GyGn.js">
|
|
198
198
|
<link rel="modulepreload" crossorigin href="./assets/formats-DEgTLsde.js">
|
|
199
199
|
<link rel="modulepreload" crossorigin href="./assets/en-US-BO8E69bZ.js">
|
|
@@ -205,42 +205,42 @@
|
|
|
205
205
|
<link rel="modulepreload" crossorigin href="./assets/useDateFormatter-DOoVZUts.js">
|
|
206
206
|
<link rel="modulepreload" crossorigin href="./assets/range-CJeRXUtp.js">
|
|
207
207
|
<link rel="modulepreload" crossorigin href="./assets/table-BCnp9gKC.js">
|
|
208
|
-
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-
|
|
209
|
-
<link rel="modulepreload" crossorigin href="./assets/useDeleteCell-
|
|
208
|
+
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-BRjuq1Jw.js">
|
|
209
|
+
<link rel="modulepreload" crossorigin href="./assets/useDeleteCell-CmX8_XRr.js">
|
|
210
210
|
<link rel="modulepreload" crossorigin href="./assets/icons-T5yQRjuT.js">
|
|
211
|
-
<link rel="modulepreload" crossorigin href="./assets/process-output-
|
|
211
|
+
<link rel="modulepreload" crossorigin href="./assets/process-output-BXIvuDcK.js">
|
|
212
212
|
<link rel="modulepreload" crossorigin href="./assets/blob-DgooIGjS.js">
|
|
213
213
|
<link rel="modulepreload" crossorigin href="./assets/objectWithoutPropertiesLoose-CboCOq4o.js">
|
|
214
214
|
<link rel="modulepreload" crossorigin href="./assets/esm-BjfXuxxx.js">
|
|
215
215
|
<link rel="modulepreload" crossorigin href="./assets/file-DzHkbIdO.js">
|
|
216
216
|
<link rel="modulepreload" crossorigin href="./assets/image-DXfkah9d.js">
|
|
217
217
|
<link rel="modulepreload" crossorigin href="./assets/play-DKSqmedg.js">
|
|
218
|
-
<link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-
|
|
218
|
+
<link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-U_En-o_I.js">
|
|
219
219
|
<link rel="modulepreload" crossorigin href="./assets/isEmpty-CfmnKtgL.js">
|
|
220
220
|
<link rel="modulepreload" crossorigin href="./assets/bot-message-square-CK6eoGWy.js">
|
|
221
|
-
<link rel="modulepreload" crossorigin href="./assets/chat-display-
|
|
221
|
+
<link rel="modulepreload" crossorigin href="./assets/chat-display-D2m36iog.js">
|
|
222
222
|
<link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-DV8gdCvH.js">
|
|
223
223
|
<link rel="modulepreload" crossorigin href="./assets/square-function-B006EYFX.js">
|
|
224
224
|
<link rel="modulepreload" crossorigin href="./assets/spec-CYMZZDXr.js">
|
|
225
225
|
<link rel="modulepreload" crossorigin href="./assets/ellipsis-vertical-CAB7tdza.js">
|
|
226
|
-
<link rel="modulepreload" crossorigin href="./assets/components-
|
|
227
|
-
<link rel="modulepreload" crossorigin href="./assets/column-preview-
|
|
226
|
+
<link rel="modulepreload" crossorigin href="./assets/components-U5Mj1xiO.js">
|
|
227
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-DBQzaLrY.js">
|
|
228
228
|
<link rel="modulepreload" crossorigin href="./assets/toggle-AwCCScbH.js">
|
|
229
|
-
<link rel="modulepreload" crossorigin href="./assets/globals-
|
|
229
|
+
<link rel="modulepreload" crossorigin href="./assets/globals-Bh7qAnqa.js">
|
|
230
230
|
<link rel="modulepreload" crossorigin href="./assets/share-DdWa0mV7.js">
|
|
231
231
|
<link rel="modulepreload" crossorigin href="./assets/_baseSet-D5BgdrnX.js">
|
|
232
232
|
<link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-DTuXFbj-.js">
|
|
233
|
-
<link rel="modulepreload" crossorigin href="./assets/context-aware-panel-
|
|
234
|
-
<link rel="modulepreload" crossorigin href="./assets/floating-outline-
|
|
235
|
-
<link rel="modulepreload" crossorigin href="./assets/useAddCell-
|
|
233
|
+
<link rel="modulepreload" crossorigin href="./assets/context-aware-panel-CaZEaV8C.js">
|
|
234
|
+
<link rel="modulepreload" crossorigin href="./assets/floating-outline-jCvD7_Ne.js">
|
|
235
|
+
<link rel="modulepreload" crossorigin href="./assets/useAddCell-ErFmQedu.js">
|
|
236
236
|
<link rel="modulepreload" crossorigin href="./assets/eye-off-vwi9L975.js">
|
|
237
|
-
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-
|
|
237
|
+
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-YmScI7wz.js">
|
|
238
238
|
<link rel="modulepreload" crossorigin href="./assets/file-headphone-B5q2Ow55.js">
|
|
239
|
-
<link rel="modulepreload" crossorigin href="./assets/file-icons-
|
|
239
|
+
<link rel="modulepreload" crossorigin href="./assets/file-icons-Br3viuqL.js">
|
|
240
240
|
<link rel="modulepreload" crossorigin href="./assets/refresh-ccw-DLpfIr8v.js">
|
|
241
|
-
<link rel="modulepreload" crossorigin href="./assets/form-
|
|
241
|
+
<link rel="modulepreload" crossorigin href="./assets/form-BEIQJWib.js">
|
|
242
242
|
<link rel="modulepreload" crossorigin href="./assets/field-9GctqEPJ.js">
|
|
243
|
-
<link rel="modulepreload" crossorigin href="./assets/useBoolean-
|
|
243
|
+
<link rel="modulepreload" crossorigin href="./assets/useBoolean-B8gcV_C4.js">
|
|
244
244
|
<link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-BEmJ3M7I.js">
|
|
245
245
|
<link rel="modulepreload" crossorigin href="./assets/types-C1RN112u.js">
|
|
246
246
|
<link rel="modulepreload" crossorigin href="./assets/prop-types-C638SUfx.js">
|
package/package.json
CHANGED
package/src/core/cells/ids.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-redeclare */
|
|
3
3
|
|
|
4
|
+
import { OBJECT_ID_ATTR } from "@/core/dom/ui-element-constants";
|
|
4
5
|
import { invariant } from "@/utils/invariant";
|
|
5
6
|
import type { TypedString } from "../../utils/typed";
|
|
6
7
|
|
|
@@ -110,7 +111,7 @@ export function findCellId(element: HTMLElement): CellId | null {
|
|
|
110
111
|
export type UIElementId = `${CellId}-${string}`;
|
|
111
112
|
export const UIElementId = {
|
|
112
113
|
parse(element: Element): UIElementId | null {
|
|
113
|
-
return element.getAttribute(
|
|
114
|
+
return element.getAttribute(OBJECT_ID_ATTR) as UIElementId | null;
|
|
114
115
|
},
|
|
115
116
|
parseOrThrow(element: Element): UIElementId {
|
|
116
117
|
const id = UIElementId.parse(element);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Stable identifier for a UI element, deterministic across re-executions
|
|
5
|
+
* of the same cell (based on cell ID + creation order).
|
|
6
|
+
* Used to synchronize multiple instances and kernel state.
|
|
7
|
+
*/
|
|
8
|
+
export const OBJECT_ID_ATTR = "object-id";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Random token that changes every time a UI element is constructed
|
|
12
|
+
* (i.e., every cell execution). Used to detect stale elements and
|
|
13
|
+
* force re-renders when a cell re-runs.
|
|
14
|
+
*/
|
|
15
|
+
export const RANDOM_ID_ATTR = "random-id";
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
MarimoValueInputEvent,
|
|
9
9
|
type MarimoValueInputEventType,
|
|
10
10
|
} from "./events";
|
|
11
|
+
import { RANDOM_ID_ATTR } from "./ui-element-constants";
|
|
11
12
|
import { UI_ELEMENT_REGISTRY } from "./uiregistry";
|
|
12
13
|
|
|
13
14
|
import "./ui-element.css";
|
|
@@ -189,7 +190,7 @@ export function initializeUIElement() {
|
|
|
189
190
|
// used like a React key. If the random-id changes, we need to unmount and
|
|
190
191
|
// remount its child.
|
|
191
192
|
static get observedAttributes() {
|
|
192
|
-
return [
|
|
193
|
+
return [RANDOM_ID_ATTR];
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
attributeChangedCallback(
|
|
@@ -199,7 +200,7 @@ export function initializeUIElement() {
|
|
|
199
200
|
) {
|
|
200
201
|
if (this.initialized) {
|
|
201
202
|
const hasChanged = oldValue !== newValue;
|
|
202
|
-
if (name ===
|
|
203
|
+
if (name === RANDOM_ID_ATTR && hasChanged) {
|
|
203
204
|
// deregister/clean-up this instance
|
|
204
205
|
this.disconnectedCallback();
|
|
205
206
|
// remove and re-add its child to force it to re-render; note that
|
|
@@ -6,6 +6,7 @@ import ReactDOM, { type Root } from "react-dom/client";
|
|
|
6
6
|
import { ErrorBoundary } from "@/components/editor/boundary/ErrorBoundary";
|
|
7
7
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
8
8
|
import { notebookAtom } from "@/core/cells/cells";
|
|
9
|
+
import { OBJECT_ID_ATTR } from "@/core/dom/ui-element-constants";
|
|
9
10
|
import { UI_ELEMENT_REGISTRY } from "@/core/dom/uiregistry";
|
|
10
11
|
import { LocaleProvider } from "@/core/i18n/locale-provider";
|
|
11
12
|
import { renderHTML } from "@/plugins/core/RenderHTML";
|
|
@@ -60,7 +61,7 @@ export class MarimoIslandElement extends HTMLElement {
|
|
|
60
61
|
const codeCallback: () => string = optionalEditor
|
|
61
62
|
? () =>
|
|
62
63
|
`${UI_ELEMENT_REGISTRY.lookupValue(
|
|
63
|
-
optionalEditor.props[
|
|
64
|
+
optionalEditor.props[OBJECT_ID_ATTR],
|
|
64
65
|
)}`
|
|
65
66
|
: () => code;
|
|
66
67
|
|
|
@@ -60,7 +60,11 @@ import { ContextAwarePanelItem } from "@/components/editor/chrome/panels/context
|
|
|
60
60
|
import { Alert, AlertTitle } from "@/components/ui/alert";
|
|
61
61
|
import { Button } from "@/components/ui/button";
|
|
62
62
|
import { DelayMount } from "@/components/utils/delay-mount";
|
|
63
|
-
import { type CellId, findCellId } from "@/core/cells/ids";
|
|
63
|
+
import { type CellId, findCellId, UIElementId } from "@/core/cells/ids";
|
|
64
|
+
import {
|
|
65
|
+
OBJECT_ID_ATTR,
|
|
66
|
+
RANDOM_ID_ATTR,
|
|
67
|
+
} from "@/core/dom/ui-element-constants";
|
|
64
68
|
import { slotsController } from "@/core/slots/slots";
|
|
65
69
|
import { store } from "@/core/state/jotai";
|
|
66
70
|
import { isStaticNotebook } from "@/core/static/static-state";
|
|
@@ -361,6 +365,7 @@ export const DataTablePlugin = createPlugin<S>("marimo-table")
|
|
|
361
365
|
<LazyDataTableComponent
|
|
362
366
|
isLazy={props.data.lazy}
|
|
363
367
|
preload={props.data.preload}
|
|
368
|
+
host={props.host}
|
|
364
369
|
>
|
|
365
370
|
<LoadingDataTableComponent
|
|
366
371
|
{...props.data}
|
|
@@ -377,21 +382,66 @@ export const DataTablePlugin = createPlugin<S>("marimo-table")
|
|
|
377
382
|
);
|
|
378
383
|
});
|
|
379
384
|
|
|
385
|
+
/**
|
|
386
|
+
* Tracks which lazy tables have been previewed across remounts (e.g. tab switches).
|
|
387
|
+
* Keyed by uiElementId (stable across remounts) with randomId as value
|
|
388
|
+
* (changes on cell re-execution, so stale entries are naturally invalidated).
|
|
389
|
+
*/
|
|
390
|
+
const previewedTables = new Map<UIElementId, string>();
|
|
391
|
+
|
|
392
|
+
function wasTablePreviewed(
|
|
393
|
+
uiElementId: UIElementId | null | undefined,
|
|
394
|
+
randomId: string | null | undefined,
|
|
395
|
+
): boolean {
|
|
396
|
+
return (
|
|
397
|
+
uiElementId != null &&
|
|
398
|
+
randomId != null &&
|
|
399
|
+
previewedTables.get(uiElementId) === randomId
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function markTablePreviewed(
|
|
404
|
+
uiElementId: UIElementId | null | undefined,
|
|
405
|
+
randomId: string | null | undefined,
|
|
406
|
+
): void {
|
|
407
|
+
if (uiElementId != null && randomId != null) {
|
|
408
|
+
previewedTables.set(uiElementId, randomId);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
380
412
|
const LazyDataTableComponent = ({
|
|
381
413
|
isLazy: initialIsLazy,
|
|
382
414
|
children,
|
|
383
415
|
preload,
|
|
416
|
+
host,
|
|
384
417
|
}: {
|
|
385
418
|
isLazy: boolean;
|
|
386
419
|
children: React.ReactNode;
|
|
387
420
|
preload: boolean;
|
|
421
|
+
host: HTMLElement;
|
|
388
422
|
}) => {
|
|
389
|
-
const
|
|
423
|
+
const parentElement = host.closest(`[${OBJECT_ID_ATTR}]`);
|
|
424
|
+
const uiElementId = parentElement ? UIElementId.parse(parentElement) : null;
|
|
425
|
+
|
|
426
|
+
const randomId = host
|
|
427
|
+
.closest(`[${RANDOM_ID_ATTR}]`)
|
|
428
|
+
?.getAttribute(RANDOM_ID_ATTR);
|
|
429
|
+
|
|
430
|
+
const [isLazy, setIsLazy] = useState(
|
|
431
|
+
initialIsLazy && !preload && !wasTablePreviewed(uiElementId, randomId),
|
|
432
|
+
);
|
|
390
433
|
|
|
391
434
|
if (isLazy) {
|
|
392
435
|
return (
|
|
393
436
|
<div className="flex h-20 items-center justify-center">
|
|
394
|
-
<Button
|
|
437
|
+
<Button
|
|
438
|
+
variant="outline"
|
|
439
|
+
size="xs"
|
|
440
|
+
onClick={() => {
|
|
441
|
+
markTablePreviewed(uiElementId, randomId);
|
|
442
|
+
setIsLazy(false);
|
|
443
|
+
}}
|
|
444
|
+
>
|
|
395
445
|
<Table2Icon className="mr-2 h-4 w-4" />
|
|
396
446
|
Preview data
|
|
397
447
|
</Button>
|
|
@@ -15,6 +15,7 @@ import { Label } from "@/components/ui/label";
|
|
|
15
15
|
import { NativeSelect } from "@/components/ui/native-select";
|
|
16
16
|
import { Table, TableBody, TableCell, TableRow } from "@/components/ui/table";
|
|
17
17
|
import { toast } from "@/components/ui/use-toast";
|
|
18
|
+
import { RANDOM_ID_ATTR } from "@/core/dom/ui-element-constants";
|
|
18
19
|
import { useAsyncData } from "@/hooks/useAsyncData";
|
|
19
20
|
import { useInternalStateWithSync } from "@/hooks/useInternalStateWithSync";
|
|
20
21
|
import { cn } from "@/utils/cn";
|
|
@@ -150,7 +151,9 @@ export const FileBrowser = ({
|
|
|
150
151
|
|
|
151
152
|
// HACK: use the random-id of the host element to force a re-render
|
|
152
153
|
// when the random-id changes, this means the cell was re-rendered
|
|
153
|
-
const randomId = host
|
|
154
|
+
const randomId = host
|
|
155
|
+
.closest(`[${RANDOM_ID_ATTR}]`)
|
|
156
|
+
?.getAttribute(RANDOM_ID_ATTR);
|
|
154
157
|
|
|
155
158
|
const { data, error, isPending } = useAsyncData(() => {
|
|
156
159
|
return list_directory({ path: path });
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type { AnyWidget } from "@anywidget/types";
|
|
5
5
|
import { useEffect, useRef } from "react";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
+
import { RANDOM_ID_ATTR } from "@/core/dom/ui-element-constants";
|
|
7
8
|
import { useAsyncData } from "@/hooks/useAsyncData";
|
|
8
9
|
import type { HTMLElementNotDerivedFromRef } from "@/hooks/useEventListener";
|
|
9
10
|
import { createPlugin } from "@/plugins/core/builder";
|
|
@@ -145,7 +146,9 @@ const AnyWidgetSlot = (props: IPluginProps<ModelIdRef, Data>) => {
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
// Find the closest parent element with an attribute of `random-id`
|
|
148
|
-
const randomId = props.host
|
|
149
|
+
const randomId = props.host
|
|
150
|
+
.closest(`[${RANDOM_ID_ATTR}]`)
|
|
151
|
+
?.getAttribute(RANDOM_ID_ATTR);
|
|
149
152
|
const key = randomId ?? jsUrl;
|
|
150
153
|
|
|
151
154
|
return (
|