efficient-shell 10.0.0 → 10.1.0
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/README.md +1 -1
- package/dist/{Browser-RFLTFP7Y.js → Browser-2S5V2RRU.js} +14 -14
- package/dist/Calculator-N2NLSDTW.js +29 -0
- package/dist/{CurrencyConverter-ELSCNMUT.js → CurrencyConverter-HW5HW3RH.js} +9 -9
- package/dist/{Documents-HKTTXLSR.js → Documents-JTURYN4D.js} +19 -19
- package/dist/{Files-ZSYGKZOV.js → Files-GP2LAGME.js} +79 -79
- package/dist/Notepad-OV66ANUO.js +24 -0
- package/dist/PdfViewer-WNKGFJD6.js +1 -0
- package/dist/{PomodoroTimer-XHNZGBDR.js → PomodoroTimer-TGUTV47T.js} +25 -25
- package/dist/{Preview-PLCASIZA.js → Preview-76A4GKGI.js} +19 -19
- package/dist/Sidebar-4OI4LP6G.js +44 -0
- package/dist/{Spreadsheet-Y7TJIBI5.js → Spreadsheet-FU5QIZA3.js} +11 -11
- package/dist/{Stock-KLYWTMMD.js → Stock-FEVMKWMS.js} +3 -3
- package/dist/{Weather-CT2IZHEW.js → Weather-2EGADOTH.js} +15 -15
- package/dist/{WorldClock-EJCUVIUW.js → WorldClock-U5DIGLOY.js} +6 -6
- package/dist/ai/index.js +38 -38
- package/dist/apps/index.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/charts/BoxPlotChart.js +1 -1
- package/dist/charts/CandlestickChart.js +1 -1
- package/dist/charts/CartesianPlot.js +1 -1
- package/dist/charts/ChordChart.js +1 -1
- package/dist/charts/ColumnChart.js +1 -1
- package/dist/charts/HeatmapChart.js +1 -1
- package/dist/charts/HistogramChart.js +1 -1
- package/dist/charts/RadarChart.js +1 -1
- package/dist/charts/RangeChart.js +1 -1
- package/dist/charts/SankeyChart.js +1 -1
- package/dist/charts/ScatterChart.js +1 -1
- package/dist/charts/SpecChart.js +1 -1
- package/dist/charts/SunburstChart.js +1 -1
- package/dist/charts/TimeSeriesChart.js +1 -1
- package/dist/charts/TreemapChart.js +1 -1
- package/dist/charts/WaterfallChart.js +1 -1
- package/dist/{chunk-PUIQFTCO.js → chunk-2OJ3HGFY.js} +5 -5
- package/dist/{chunk-PKIDVVAE.js → chunk-2SLQD57V.js} +5 -5
- package/dist/{chunk-NDEIZUMG.js → chunk-3V6ZERBS.js} +1 -1
- package/dist/{chunk-BXEKX4TB.js → chunk-3V74SUZO.js} +16 -16
- package/dist/{chunk-DL6QIWVR.js → chunk-42XMT5JN.js} +1 -1
- package/dist/{chunk-VG5NGCMQ.js → chunk-44PGFMSX.js} +6 -6
- package/dist/{chunk-IQWIYZB5.js → chunk-45XXERGA.js} +2 -2
- package/dist/{chunk-FRINAJU7.js → chunk-4UX6ET7G.js} +1 -1
- package/dist/{chunk-BFVL2VTS.js → chunk-4VDGVF5T.js} +1 -1
- package/dist/{chunk-D2WGDTWN.js → chunk-5EX6XXUX.js} +1 -1
- package/dist/{chunk-PA37I5ZX.js → chunk-5VDT4762.js} +2 -2
- package/dist/{chunk-EGAV5LSX.js → chunk-5VSP3TYU.js} +1 -1
- package/dist/{chunk-R2QDO7NY.js → chunk-6B4F5DWV.js} +3 -3
- package/dist/{chunk-66JYKX4T.js → chunk-6FPDOEOX.js} +1 -1
- package/dist/{chunk-3AZBI76O.js → chunk-7ILNRFEV.js} +1 -1
- package/dist/{chunk-GQK3U2IO.js → chunk-7TONF2PM.js} +1 -1
- package/dist/{chunk-LKW3YAZN.js → chunk-A3VJ4PRU.js} +6 -6
- package/dist/chunk-ACVKU6YW.js +7 -0
- package/dist/{chunk-ELUTQZGP.js → chunk-AEQFFD5I.js} +1 -1
- package/dist/{chunk-QRJRGP2K.js → chunk-AGLBDT7X.js} +8 -8
- package/dist/chunk-AKVB5TQD.js +29 -0
- package/dist/{chunk-ZBTDMQUI.js → chunk-ANTH2FBS.js} +61 -61
- package/dist/chunk-AXL7VTNM.js +11 -0
- package/dist/{chunk-7BDZZANS.js → chunk-B7HW6XZD.js} +1 -1
- package/dist/{chunk-XILZGSMX.js → chunk-BDFZNLFQ.js} +1 -1
- package/dist/{chunk-C6MV6IAX.js → chunk-BMXMSAQE.js} +8 -8
- package/dist/{chunk-PUCPFBYO.js → chunk-BNQRPLBW.js} +1 -1
- package/dist/{chunk-XS4HFUTW.js → chunk-BZPPDYEE.js} +1 -1
- package/dist/{chunk-DPDRFLBY.js → chunk-CLQFP42I.js} +3 -3
- package/dist/{chunk-UZ43AT4O.js → chunk-CUA6CREW.js} +8 -8
- package/dist/{chunk-RYS3URDC.js → chunk-DY2M6BIG.js} +10 -10
- package/dist/{chunk-EGEWU776.js → chunk-E3RHEEA6.js} +1 -1
- package/dist/{chunk-WFANOFHG.js → chunk-F7A6K3D5.js} +5 -5
- package/dist/{chunk-QTQQKQGQ.js → chunk-FFASZGNZ.js} +3 -3
- package/dist/{chunk-MPALY3CL.js → chunk-FMC2XNSP.js} +6 -6
- package/dist/{chunk-D7X2HMMA.js → chunk-FS2KWQJW.js} +10 -10
- package/dist/{chunk-AJ3R5QPD.js → chunk-GGIFS34Z.js} +5 -5
- package/dist/{chunk-HJPCHES5.js → chunk-GZYTCHPX.js} +4 -4
- package/dist/{chunk-ZREDCRTL.js → chunk-J7CIBRDS.js} +1 -1
- package/dist/{chunk-ZOBLEXIU.js → chunk-JJYAYMY7.js} +1 -1
- package/dist/{chunk-ZPCADTM5.js → chunk-JRBQLRAZ.js} +1 -1
- package/dist/{chunk-YFUMK2E7.js → chunk-JZK3UDOT.js} +1 -1
- package/dist/{chunk-O33CUGOI.js → chunk-K64JRGNE.js} +5 -5
- package/dist/{chunk-IU5KBQEQ.js → chunk-K7PCBUDC.js} +6 -6
- package/dist/{chunk-FSPFV4MI.js → chunk-KKSVRIMP.js} +2 -4
- package/dist/{chunk-T5V2GJ4D.js → chunk-KZQAGXME.js} +4 -4
- package/dist/{chunk-B7KD3DGY.js → chunk-LFVUDFVU.js} +1 -1
- package/dist/{chunk-FTWWJHFX.js → chunk-LOYCPZUB.js} +1 -1
- package/dist/{chunk-GBLMVFDW.js → chunk-LPDI5NL6.js} +1 -1
- package/dist/{chunk-FPGRKHUW.js → chunk-MH6DI6YY.js} +11 -11
- package/dist/{chunk-GQMS5657.js → chunk-MLKY5ESV.js} +1 -1
- package/dist/{chunk-TGLHJS3M.js → chunk-MUMQ6PW7.js} +1 -1
- package/dist/chunk-N6VP75F5.js +3 -0
- package/dist/{chunk-KAVFW5CU.js → chunk-NNOA7AVG.js} +5 -5
- package/dist/{chunk-6YQPLI5M.js → chunk-NQJKANUP.js} +11 -11
- package/dist/{chunk-UTQG344L.js → chunk-NW7Z3G7P.js} +11 -11
- package/dist/{chunk-LR77AS3N.js → chunk-O6ABVKHU.js} +4 -4
- package/dist/{chunk-25STFYV3.js → chunk-OPB3I4JH.js} +4 -4
- package/dist/{chunk-RBD7SB6M.js → chunk-P5YFQ4IQ.js} +1 -1
- package/dist/{chunk-JHZV4TN6.js → chunk-PF5CKD4C.js} +2 -2
- package/dist/chunk-PYQ6DD3F.js +1 -0
- package/dist/{chunk-NDKQDIWN.js → chunk-Q4LBBFLO.js} +5 -5
- package/dist/{chunk-X6TJR6M2.js → chunk-Q5YM65DZ.js} +8 -8
- package/dist/{chunk-XOKANFQD.js → chunk-QASKQDUR.js} +16 -16
- package/dist/{chunk-5F7HMNCX.js → chunk-QODTON7V.js} +1 -1
- package/dist/{chunk-7KDGW6BR.js → chunk-QXRRAADR.js} +1 -1
- package/dist/{chunk-VSAI5TH7.js → chunk-R4Q5653D.js} +20 -20
- package/dist/{chunk-DXHLUB36.js → chunk-RKFEJ5CX.js} +1 -1
- package/dist/{chunk-GKZUAT3K.js → chunk-RSIGTZMU.js} +1 -1
- package/dist/{chunk-GNU3U2TP.js → chunk-RZR3OAKV.js} +1 -1
- package/dist/chunk-SKY2NBTQ.js +6 -0
- package/dist/{chunk-MKEYXKZA.js → chunk-TDLU6GF5.js} +4 -4
- package/dist/{chunk-4E4GWE4L.js → chunk-TYK7VN73.js} +15 -15
- package/dist/{chunk-HKAQXFUR.js → chunk-UDKOJB2B.js} +2 -2
- package/dist/chunk-UP442DPT.js +9 -0
- package/dist/{chunk-OUKDGO4N.js → chunk-V4RYE6KA.js} +8 -8
- package/dist/{chunk-E7WY4GZ3.js → chunk-VMDBVXDJ.js} +1 -1
- package/dist/{chunk-F24QTMTY.js → chunk-VP63OOO4.js} +3 -3
- package/dist/{chunk-GRBBQ3VF.js → chunk-WKSNTMEJ.js} +1 -1
- package/dist/{chunk-UFXE363L.js → chunk-X6YT3I5F.js} +1 -1
- package/dist/{chunk-SGTZJMZ6.js → chunk-XABYSSXW.js} +1 -1
- package/dist/{chunk-GSBIJLTD.js → chunk-XAROKI7X.js} +1 -1
- package/dist/{chunk-ZMVCN4OA.js → chunk-XHMIJ7S3.js} +7 -7
- package/dist/{chunk-Q7HN6T3H.js → chunk-XNKIDGZW.js} +1 -1
- package/dist/{chunk-DVOQCAC2.js → chunk-XQQNA246.js} +1 -1
- package/dist/{chunk-ED3QFXBC.js → chunk-XZBQ3XXD.js} +1 -1
- package/dist/{chunk-6I6VSUKY.js → chunk-Y23TGQFN.js} +4 -4
- package/dist/chunk-ZLHPCPXS.js +19 -0
- package/dist/{chunk-LPUGK2MC.js → chunk-ZN2BFSQR.js} +2 -2
- package/dist/{chunk-TXMAWCR7.js → chunk-ZRZ5LOW3.js} +1 -1
- package/dist/data/ListLoadError.js +1 -1
- package/dist/format/index.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/Calendar.js +1 -1
- package/dist/forms/ColorPicker.js +1 -1
- package/dist/forms/ComposerAttachments.js +1 -1
- package/dist/forms/CornersInput.js +1 -1
- package/dist/forms/DatePicker.js +1 -1
- package/dist/forms/DateRangePicker.js +1 -1
- package/dist/forms/DisplayChips.js +1 -1
- package/dist/forms/FilePicker.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/InputNumber.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUploadField.js +1 -1
- package/dist/forms/MediaUploadGrid.js +1 -1
- package/dist/forms/MediaUsedInList.js +1 -1
- package/dist/forms/PositionInput.js +1 -1
- package/dist/forms/Select.js +1 -1
- package/dist/forms/SidesInput.js +1 -1
- package/dist/forms/Slider.js +1 -1
- package/dist/forms/Snippet.js +1 -1
- package/dist/forms/SplitButton.js +1 -1
- package/dist/forms/TagInput.js +1 -1
- package/dist/forms/TextToolbar.js +1 -1
- package/dist/forms/WidthsBar.js +1 -1
- package/dist/forms/mediaLibraryMenu.js +1 -1
- package/dist/forms/textAlign.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +121 -122
- package/dist/map/index.js +3 -3
- package/dist/markdown/index.js +1 -1
- package/dist/page-tabs/index.js +5 -5
- package/dist/pdf/index.js +1 -1
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/Banner.js +1 -1
- package/dist/shell/Breadcrumbs.js +1 -1
- package/dist/shell/ColoredBadge.js +1 -1
- package/dist/shell/ConfirmDialog.js +1 -1
- package/dist/shell/ContextMenu.js +1 -1
- package/dist/shell/Dialog.js +1 -1
- package/dist/shell/Drawer.js +1 -1
- package/dist/shell/DropdownMenu.js +1 -1
- package/dist/shell/EmptyState.js +1 -1
- package/dist/shell/HelpCenter.js +1 -1
- package/dist/shell/ImageLightbox.js +1 -1
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/PageHeader.js +1 -1
- package/dist/shell/PopupMenu.js +1 -1
- package/dist/shell/ProductionTimeline.js +1 -1
- package/dist/shell/Result.js +1 -1
- package/dist/shell/SearchableSelect.js +1 -1
- package/dist/shell/SettingReset.js +1 -1
- package/dist/shell/SettingRow.js +1 -1
- package/dist/shell/SidebarLayout.js +1 -1
- package/dist/shell/SidebarNav.js +1 -1
- package/dist/shell/SortableList.js +1 -1
- package/dist/shell/StepChain.js +1 -1
- package/dist/shell/Stepper.js +1 -1
- package/dist/shell/TopNav.js +1 -1
- package/dist/shell/Tree.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DashboardTemplate.js +1 -1
- package/dist/templates/DataTablePage.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-DV2R65OS.js +0 -29
- package/dist/Notepad-63Q3JSCV.js +0 -25
- package/dist/PdfViewer-DFBPEUY5.js +0 -1
- package/dist/Sidebar-QFT5WPK4.js +0 -44
- package/dist/chunk-5CH2RGL6.js +0 -29
- package/dist/chunk-7YU27U3Y.js +0 -19
- package/dist/chunk-AEJNFA2K.js +0 -6
- package/dist/chunk-IEAFSVXC.js +0 -1
- package/dist/chunk-POCQ7ZL4.js +0 -3
- package/dist/chunk-PVR4KU7H.js +0 -7
- package/dist/chunk-RBXSU25O.js +0 -9
- package/dist/chunk-XSJJPACH.js +0 -11
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
import{openPreviewFile as e}from"./chunk-KCV7BFKJ.js";import{SidebarLayout as t}from"./chunk-
|
|
1
|
+
import{openPreviewFile as e}from"./chunk-KCV7BFKJ.js";import{SidebarLayout as t}from"./chunk-2OJ3HGFY.js";import"./chunk-QWK6DRSN.js";import"./chunk-RBIGSJ2J.js";import{Breadcrumbs as a}from"./chunk-RSIGTZMU.js";import{formatBytes as n}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{getFilesDemoTree as r}from"./chunk-MUMQ6PW7.js";import{AboutApp as i}from"./chunk-UDKOJB2B.js";import{peekFilesViewRequest as s,consumeFilesViewRequest as o,FILES_SHOW_TRASH_EVENT as l,FILES_OPEN_DESKTOP_FOLDER_EVENT as c,subscribeDesktopFolders as d,getDesktopFoldersSnapshot as m,FolderGlyph as h,DesktopItemMiniIcon as p,desktopItemTypeLabel as u}from"./chunk-XAROKI7X.js";import"./chunk-ESL5TDNA.js";import"./chunk-VTVSMRFX.js";import{useWindowManager as f,WindowTitle as x}from"./chunk-ANTH2FBS.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-E3RHEEA6.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-3V6ZERBS.js";import{confirm as g,prompt as k}from"./chunk-TYK7VN73.js";import"./chunk-6B4F5DWV.js";import{ItemCount as b}from"./chunk-GMRZX2ET.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as y}from"./chunk-OQW42DOR.js";import"./chunk-RKFEJ5CX.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import"./chunk-KC3EX26K.js";import"./chunk-PYQ6DD3F.js";import"./chunk-MH6DI6YY.js";import"./chunk-5QFPTDQF.js";import"./chunk-URHGHXDN.js";import"./chunk-LNARMEEZ.js";import"./chunk-NHH2MXFU.js";import"./chunk-UQYNPYF4.js";import{Icon as N}from"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-HL6JSDN3.js";import{LoadingSpinner as w}from"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import{TH_ONE_LINE as v}from"./chunk-OZAAIE4E.js";import"./chunk-BCDG4N6L.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-X2PZMXDP.js";import"./chunk-C3QOHMR6.js";import{useState as j,useEffect as $,useSyncExternalStore as D,useRef as C,useCallback as R}from"react";import{jsxs as E,jsx as T,Fragment as L}from"react/jsx-runtime";var M="undefined"!=typeof window&&window.__REACT_OS_SHELL_FILE_SERVER__||"http://localhost:4000",S={pdf:"pdf",dxf:"dxf",csv:"csv",jpg:"image",jpeg:"image",png:"image",gif:"image",webp:"image",svg:"image",avif:"image",bmp:"image",stp:"3d",step:"3d",stl:"3d",obj:"3d",gltf:"3d",glb:"3d","3mf":"3d",iges:"3d",igs:"3d",ply:"3d",fbx:"3d"};function W(e,t){return"/"===e||""===e?"/"+t:e.replace(/\/$/,"")+"/"+t}function F(e){if(!e)return"—";try{const t=new Date(e);return isNaN(t.getTime())?"—":t.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})}catch{return e}}function P(){const P=M.replace(/\/$/,""),A=null!==r(),[I,U]=j("/"),[O,J]=j([]),[B,H]=j([]),[K,V]=j(null),[X,G]=j(!0),[Z,Q]=j(!1),[z,Y]=j(null),[_,q]=j(!1),[ee,te]=j(()=>{const e=s();return"trash"===e?"trash":e?{desktopFolderId:e.folderId}:"files"});$(()=>{o()},[]);const[ae,ne]=j([]);$(()=>{const e=()=>{o(),te("trash")},t=e=>{o();const t=e.detail?.folderId;t&&te({desktopFolderId:t})};return window.addEventListener(l,e),window.addEventListener(c,t),()=>{window.removeEventListener(l,e),window.removeEventListener(c,t)}},[]);const re=D(d,m,m),ie="object"==typeof ee?ee.desktopFolderId:null,se=ie?re?.folders.find(e=>e.id===ie)??null:null,oe=ie&&re?.itemsByFolder[ie]||[];$(()=>{ie&&re&&!re.folders.some(e=>e.id===ie)&&te("files")},[ie,re]);const le=C(0),ce=C(null),{openPage:de,openEntity:me}=f(),he=t=>{"preview-file"===t.entityType&&t.filePath&&t.fileKind?e({filePath:t.filePath,filename:t.label,kind:t.fileKind,onStaged:e=>de(e)}):"page"===t.entityType?de(t.entityId):me(t.entityType,t.entityId,null,t.label)},pe=R((e,t={})=>fetch(e,{...t,credentials:"include"}),[]),ue=R(async()=>{try{const e=await pe(`${P}/api/quota`);if(e.ok){const t=await e.json();Y({used:t.used,limit:t.limit})}}catch{}},[pe,P]),fe=R(async e=>{if(V(null),A){const t=function(e){const t=r();if(!t)return[];let a=t;for(const t of e.split("/").filter(Boolean)){const e=a.find(e=>"folder"===e.kind&&e.name===t);if(!e||!e.children)return[];a=e.children}return a.map(e=>({name:e.name,kind:e.kind,size:e.size??0,modifiedAt:e.modifiedAt??""}))}(e);return J(t),U(e),Q(!1),G(!1),void("/"===e&&H(t.filter(e=>"folder"===e.kind).map(e=>e.name)))}G(!0);try{const t=await pe(`${P}/api/files?path=${encodeURIComponent(e)}`);if(!t.ok){const e=await t.json().catch(()=>({}));return void y.error(e.error||`Failed to list (${t.status})`)}const a=await t.json(),n=a.entries||[];J(n),U(a.path||e),Q(!1),"/"===(a.path||e)&&H(n.filter(e=>"folder"===e.kind).map(e=>e.name))}catch(e){Q(!0)}finally{G(!1)}ue()},[pe,P,ue,A]),xe=R(async()=>{if(A)return ne([]),void G(!1);G(!0),V(null);try{const e=await pe(`${P}/api/trash`);if(!e.ok){const t=await e.json().catch(()=>({}));return void y.error(t.error||`Failed to list trash (${e.status})`)}const t=await e.json();ne(t.entries||[]),Q(!1)}catch{Q(!0)}finally{G(!1)}ue()},[pe,P,ue,A]);$(()=>{"files"===ee?fe(I):"trash"===ee&&xe()},[I,ee]);const ge=async e=>{const t=W(I,e.name);try{const a=await pe(`${P}/api/file?path=${encodeURIComponent(t)}`);if(!a.ok)return void y.error(`Download failed (${a.status})`);const n=await a.blob(),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=e.name,i.click(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch(e){y.error(e?.message||"Download failed")}},ke=async e=>{const t=Array.from(e);for(const e of t){const t=new FormData;t.append("file",e);try{const a=await pe(`${P}/api/upload?path=${encodeURIComponent(I)}`,{method:"POST",body:t});if(!a.ok){const t=await a.json().catch(()=>({}));if(413===a.status){const a=Math.max(0,(t.limit||0)-(t.used||0));y.error(`Quota exceeded — ${n(a)} free, ${e.name} is ${n(t.attempted||e.size)}`)}else y.error(`Upload ${e.name}: ${t.error||a.status}`)}}catch(t){y.error(`Upload ${e.name}: ${t?.message||"failed"}`)}}fe(I)},be=()=>{le.current=0,q(!1)};if($(()=>{const e=()=>be();return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[]),Z)/* @__PURE__ */
|
|
2
2
|
return E("div",{className:"flex flex-col h-full bg-white",children:[
|
|
3
|
-
/* @__PURE__ */
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
/* @__PURE__ */
|
|
6
|
-
/* @__PURE__ */
|
|
3
|
+
/* @__PURE__ */T(x,{title:"Files - offline"}),
|
|
4
|
+
/* @__PURE__ */T("div",{className:"flex-1 flex items-center justify-center p-8 text-center",children:/* @__PURE__ */E("div",{className:"max-w-md",children:[
|
|
5
|
+
/* @__PURE__ */T(N,{name:"close-circle",className:"h-12 w-12 mx-auto text-gray-300 mb-3",strokeWidth:1.4}),
|
|
6
|
+
/* @__PURE__ */T("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:"Can't reach the file server"}),
|
|
7
7
|
/* @__PURE__ */E("p",{className:"text-sm text-gray-500 mb-3",children:["No response from ",
|
|
8
|
-
/* @__PURE__ */
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */E("button",{onClick:()=>{te("files"),
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
return E("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */E("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-line bg-surface-sunken shrink-0 text-xs",children:[/* @__PURE__ */E(
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
8
|
+
/* @__PURE__ */T("span",{className:"font-mono",children:P}),". Make sure the server is running — see ",
|
|
9
|
+
/* @__PURE__ */T("span",{className:"font-mono",children:"examples/file-server/README.md"}),"."]}),
|
|
10
|
+
/* @__PURE__ */T("button",{onClick:()=>fe(I),className:"px-3 h-8 text-sm bg-blue-500 text-on-accent rounded hover:bg-blue-600",children:"Retry"})]})})]});const ye="/"===I?[]:I.split("/").filter(Boolean),Ne=z&&z.limit>0?Math.min(100,Math.round(z.used/z.limit*100)):0,we=Ne>90?"bg-red-500":Ne>75?"bg-amber-500":"bg-blue-500",ve=[{label:"My files",onClick:()=>U("/")},...ye.map((e,t)=>({label:e,onClick:()=>U("/"+ye.slice(0,t+1).join("/"))}))],je=e=>"flex w-full items-center gap-2 rounded-md px-3 min-h-(--row-height-menu) py-2 text-left text-sm transition-colors "+(e?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),$e=e=>/* @__PURE__ */T("svg",{className:"h-4 w-4 shrink-0 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.6,children:/* @__PURE__ */T("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})}),De=/* @__PURE__ */E("nav",{className:"p-2",children:[
|
|
11
|
+
/* @__PURE__ */T("div",{className:"px-2 py-2 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Locations"}),
|
|
12
|
+
/* @__PURE__ */E("button",{onClick:()=>{te("files"),U("/")},className:je("files"===ee&&"/"===I),children:[$e("M2.25 12l8.954-8.955a1.5 1.5 0 012.122 0L21.75 12M4.5 9.75v9.75a.75.75 0 00.75.75H9V15a.75.75 0 01.75-.75h4.5A.75.75 0 0115 15v5.25h3.75a.75.75 0 00.75-.75V9.75"),"My files"]}),B.map(e=>/* @__PURE__ */E("button",{onClick:()=>{te("files"),U("/"+e)},className:je("files"===ee&&I==="/"+e),children:[$e("M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"),
|
|
13
|
+
/* @__PURE__ */T("span",{className:"truncate",children:e})]},e)),!A&&/* @__PURE__ */E("button",{onClick:()=>te("trash"),className:je("trash"===ee),children:[$e("M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79"),"Trash"]}),re&&re.folders.length>0&&/* @__PURE__ */E(L,{children:[
|
|
14
|
+
/* @__PURE__ */T("div",{className:"px-2 pt-3 pb-2 text-2xs font-semibold uppercase tracking-wide text-ink-faintest",children:"Desktop"}),re.folders.map(e=>/* @__PURE__ */E("button",{onClick:()=>te({desktopFolderId:e.id}),className:je(ie===e.id),children:[
|
|
15
|
+
/* @__PURE__ */T(h,{className:"h-4 w-4 shrink-0 text-amber-500"}),
|
|
16
|
+
/* @__PURE__ */T("span",{className:"truncate",children:e.name}),
|
|
17
|
+
/* @__PURE__ */T(b,{count:e.itemCount,active:ie===e.id,className:"ml-auto"})]},e.id))]})]});/* @__PURE__ */
|
|
18
|
+
return E("div",{className:"relative flex flex-col h-full bg-white",onDragEnter:e=>{A||"object"==typeof ee||e.dataTransfer?.types?.includes?.("Files")&&(e.preventDefault(),le.current++,_||q(!0))},onDragOver:e=>{e.dataTransfer?.types?.includes?.("Files")&&e.preventDefault()},onDragLeave:()=>{le.current>0&&le.current--,0===le.current&&q(!1)},onDrop:e=>{e.preventDefault(),be(),A||"object"==typeof ee||e.dataTransfer.files?.length&&ke(e.dataTransfer.files)},children:[
|
|
19
|
+
/* @__PURE__ */T(x,{title:se?`Files - ${se.name}`:"Files"+("/"===I?"":" - "+I)}),
|
|
20
|
+
/* @__PURE__ */T(i,{app:"files"}),
|
|
21
|
+
/* @__PURE__ */T("input",{ref:ce,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files?.length&&ke(e.target.files),ce.current&&(ce.current.value="")}}),
|
|
22
|
+
/* @__PURE__ */T("div",{className:"flex-1 min-h-0",children:/* @__PURE__ */T(t,{sidebar:De,storageKey:"files.sidebarWidth",defaultWidth:200,minWidth:150,maxWidth:320,children:/* @__PURE__ */E("div",{className:"flex h-full min-w-0 flex-col",children:[
|
|
23
|
+
/* @__PURE__ */E("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-line bg-surface-sunken shrink-0 text-xs",children:[/* @__PURE__ */E(L,"files"===ee?{children:[
|
|
24
|
+
/* @__PURE__ */T("button",{onClick:()=>U(function(e){if("/"===e||""===e)return"/";const t=e.replace(/\/$/,""),a=t.lastIndexOf("/");return a<=0?"/":t.slice(0,a)}(I)),disabled:"/"===I,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",title:"Parent folder",children:/* @__PURE__ */T(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
25
|
+
/* @__PURE__ */T("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */T(a,{items:ve,maxItems:5})}),
|
|
26
|
+
/* @__PURE__ */T("button",{onClick:()=>fe(I),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */T(N,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),!A&&/* @__PURE__ */E(L,{children:[
|
|
27
27
|
/* @__PURE__ */E("button",{onClick:()=>te("trash"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",title:"Open trash",children:[
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */E("button",{onClick:async()=>{const e=await k({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void y.error("Folder names cannot contain slashes");const t=
|
|
30
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */T(N,{name:"trash",className:"h-3.5 w-3.5",strokeWidth:1.5}),"Trash"]}),
|
|
29
|
+
/* @__PURE__ */E("button",{onClick:async()=>{const e=await k({title:"New folder",placeholder:"Folder name",confirmLabel:"Create"});if(!e)return;if(/[\\/]/.test(e))return void y.error("Folder names cannot contain slashes");const t=W(I,e),a=await pe(`${P}/api/folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!a.ok){const e=await a.json().catch(()=>({}));return void y.error(e.error||`Create folder failed (${a.status})`)}fe(I)},className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600 flex items-center gap-1",children:[
|
|
30
|
+
/* @__PURE__ */T(N,{name:"folder-plus",className:"h-3.5 w-3.5",strokeWidth:1.5}),"New Folder"]}),
|
|
31
31
|
/* @__PURE__ */E("button",{onClick:()=>ce.current?.click(),className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 flex items-center gap-1",children:[
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */T(N,{name:"upload",className:"h-3.5 w-3.5",strokeWidth:1.8}),"Upload"]})]})]}:"trash"===ee?{children:[
|
|
33
|
+
/* @__PURE__ */T("button",{onClick:()=>te("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */T(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
34
|
+
/* @__PURE__ */T("span",{className:"flex-1 text-gray-700 font-medium px-2",children:"Trash"}),
|
|
35
|
+
/* @__PURE__ */T("button",{onClick:xe,className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Refresh",children:/* @__PURE__ */T(N,{name:"refresh",className:"h-3.5 w-3.5",strokeWidth:1.8})}),
|
|
36
|
+
/* @__PURE__ */T("button",{onClick:async()=>{if(0===ae.length)return;if(!await g({title:"Empty trash",message:`${ae.length} item${1===ae.length?"":"s"} will be permanently removed. This can't be undone.`,confirmLabel:"Empty trash",variant:"danger"}))return;const e=await pe(`${P}/api/trash`,{method:"DELETE"});if(!e.ok){const t=await e.json().catch(()=>({}));return void y.error(t.error||`Empty trash failed (${e.status})`)}xe()},disabled:0===ae.length,className:"px-2 py-1 rounded text-red-600 hover:bg-red-50 disabled:opacity-30 flex items-center gap-1",children:"Empty trash"})]}:{children:[
|
|
37
|
+
/* @__PURE__ */T("button",{onClick:()=>te("files"),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-600",title:"Back to files",children:/* @__PURE__ */T(N,{name:"arrow-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
|
|
38
|
+
/* @__PURE__ */T(h,{className:"h-4 w-4 text-amber-500 ml-1"}),
|
|
39
|
+
/* @__PURE__ */T("span",{className:"flex-1 text-gray-700 font-medium px-1 truncate",children:se?.name??"Desktop folder"}),
|
|
40
|
+
/* @__PURE__ */T("span",{className:"text-2xs text-ink-faintest px-2",children:"Desktop shortcuts"})]}),z&&/* @__PURE__ */E(L,{children:[
|
|
41
|
+
/* @__PURE__ */T("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
|
|
42
42
|
/* @__PURE__ */E("div",{className:"flex items-center gap-2",title:`${n(z.used)} of ${n(z.limit)} used`,children:[
|
|
43
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */T("div",{className:"w-20 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:/* @__PURE__ */T("div",{className:`h-full ${we} transition-all`,style:{width:`${Ne}%`}})}),
|
|
44
44
|
/* @__PURE__ */E("span",{className:"text-2xs text-ink-faint tabular-nums whitespace-nowrap",children:[n(z.used)," / ",n(z.limit)]})]})]})]}),
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
return E("tr",{onClick:()=>
|
|
45
|
+
/* @__PURE__ */T("div",{className:"flex-1 overflow-auto",children:"object"==typeof ee?0===oe.length?/* @__PURE__ */T("div",{className:"p-10 text-center text-sm text-gray-400",children:"This desktop folder is empty. Drag shortcuts onto it on the desktop."}):/* @__PURE__ */E("table",{className:"w-full text-sm",children:[
|
|
46
|
+
/* @__PURE__ */T("thead",{className:"bg-surface-sunken text-2xs uppercase tracking-wide text-ink-faint",children:/* @__PURE__ */E("tr",{children:[
|
|
47
|
+
/* @__PURE__ */T("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Name"}),
|
|
48
|
+
/* @__PURE__ */T("th",{className:`${v} text-left font-medium px-3 h-8 w-28`,children:"Type"}),
|
|
49
|
+
/* @__PURE__ */T("th",{className:`${v} w-56`})]})}),
|
|
50
|
+
/* @__PURE__ */T("tbody",{children:oe.map(e=>{const t=`${e.entityType}|${e.entityId}`;/* @__PURE__ */
|
|
51
|
+
return E("tr",{onClick:()=>V(t),onDoubleClick:()=>he(e),className:"cursor-default border-b border-gray-100 "+(K===t?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
52
52
|
/* @__PURE__ */E("td",{className:"px-3 h-8 flex items-center gap-2",children:[
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */T(p,{item:e}),
|
|
54
|
+
/* @__PURE__ */T("span",{className:"truncate",title:e.label,children:e.label})]}),
|
|
55
|
+
/* @__PURE__ */T("td",{className:"px-3 h-8 text-xs text-ink-faint",children:u(e)}),
|
|
56
56
|
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */E("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */T("button",{onClick:t=>{t.stopPropagation(),he(e)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Open"}),
|
|
58
|
+
/* @__PURE__ */T("button",{onClick:t=>{t.stopPropagation(),re?.moveToDesktop([e])},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-ink-faint text-2xs ml-1",children:"Move to desktop"}),
|
|
59
|
+
/* @__PURE__ */T("button",{onClick:t=>{t.stopPropagation(),re?.removeShortcuts([e])},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Remove"})]})]},t)})})]}):"trash"===ee?X&&0===ae.length?/* @__PURE__ */T(w,{size:"sm",padding:"p-6",label:"Loading"}):0===ae.length?/* @__PURE__ */T("div",{className:"p-10 text-center text-sm text-gray-400",children:"Trash is empty."}):/* @__PURE__ */E("table",{className:"w-full text-sm",children:[
|
|
60
|
+
/* @__PURE__ */T("thead",{className:"bg-surface-sunken text-2xs uppercase tracking-wide text-ink-faint",children:/* @__PURE__ */E("tr",{children:[
|
|
61
|
+
/* @__PURE__ */T("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Name"}),
|
|
62
|
+
/* @__PURE__ */T("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Original location"}),
|
|
63
|
+
/* @__PURE__ */T("th",{className:`${v} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
|
|
64
|
+
/* @__PURE__ */T("th",{className:`${v} text-right font-medium px-3 h-8 w-40`,children:"Deleted"}),
|
|
65
|
+
/* @__PURE__ */T("th",{className:`${v} w-44`})]})}),
|
|
66
|
+
/* @__PURE__ */T("tbody",{children:ae.map(e=>/* @__PURE__ */E("tr",{className:"border-b border-gray-100 hover:bg-gray-50",children:[
|
|
67
|
+
/* @__PURE__ */E("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===e.kind?/* @__PURE__ */T(N,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */T(N,{name:"page",className:"h-4 w-4 text-ink-faintest shrink-0",strokeWidth:1.5}),
|
|
68
|
+
/* @__PURE__ */T("span",{className:"truncate",title:e.name,children:e.name})]}),
|
|
69
|
+
/* @__PURE__ */T("td",{className:"px-3 h-8 text-ink-faint text-xs font-mono truncate",title:e.originalPath,children:e.originalPath||"—"}),
|
|
70
|
+
/* @__PURE__ */T("td",{className:"px-3 h-8 text-right tabular-nums text-ink-faint",children:n(e.size)}),
|
|
71
|
+
/* @__PURE__ */T("td",{className:"px-3 h-8 text-right text-ink-faint tabular-nums",children:e.deletedAt?F(e.deletedAt):"—"}),
|
|
72
72
|
/* @__PURE__ */E("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:[
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */E("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */T("button",{onClick:()=>(async e=>{const t=await pe(`${P}/api/trash/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id})});if(!t.ok){const e=await t.json().catch(()=>({}));return void y.error(e.error||`Restore failed (${t.status})`)}y.success(`Restored "${e.name}"`),xe()})(e),className:"px-2 py-0.5 rounded hover:bg-gray-200 text-blue-600 text-2xs",children:"Restore"}),
|
|
74
|
+
/* @__PURE__ */T("button",{onClick:()=>(async e=>{if(!await g({title:"Permanently delete",message:`"${e.name}" will be permanently removed. This can't be undone.`,confirmLabel:"Delete forever",variant:"danger"}))return;const t=await pe(`${P}/api/trash/${encodeURIComponent(e.id)}`,{method:"DELETE"});if(!t.ok){const e=await t.json().catch(()=>({}));return void y.error(e.error||`Delete failed (${t.status})`)}xe()})(e),className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete forever"})]})]},e.id))})]}):X&&0===O.length?/* @__PURE__ */T(w,{size:"sm",padding:"p-6",label:"Loading"}):0===O.length?/* @__PURE__ */E("div",{className:"p-10 text-center text-sm text-gray-400",children:["Empty folder.",!A&&/* @__PURE__ */E(L,{children:[" Drop files here or click ",
|
|
75
|
+
/* @__PURE__ */T("span",{className:"font-medium",children:"Upload"}),"."]})]}):/* @__PURE__ */E("table",{className:"w-full text-sm",children:[
|
|
76
|
+
/* @__PURE__ */T("thead",{className:"bg-surface-sunken text-2xs uppercase tracking-wide text-ink-faint",children:/* @__PURE__ */E("tr",{children:[
|
|
77
|
+
/* @__PURE__ */T("th",{className:`${v} text-left font-medium px-3 h-8`,children:"Name"}),
|
|
78
|
+
/* @__PURE__ */T("th",{className:`${v} text-right font-medium px-3 h-8 w-24`,children:"Size"}),
|
|
79
|
+
/* @__PURE__ */T("th",{className:`${v} text-right font-medium px-3 h-8 w-40`,children:"Modified"}),
|
|
80
|
+
/* @__PURE__ */T("th",{className:`${v} w-32`})]})}),
|
|
81
|
+
/* @__PURE__ */T("tbody",{children:O.map(t=>/* @__PURE__ */E("tr",{onClick:()=>V(t.name),onDoubleClick:()=>{"folder"===t.kind?U(W(I,t.name)):(async t=>{if(A)return;const a=W(I,t.name),n=(t.name.split(".").pop()||"").toLowerCase(),r=S[n];r?await e({filePath:a,filename:t.name,kind:r,onStaged:e=>de(e)}):ge(t)})(t)},className:"cursor-default border-b border-gray-100 "+(K===t.name?"bg-blue-50":"hover:bg-gray-50"),children:[
|
|
82
|
+
/* @__PURE__ */E("td",{className:"px-3 h-8 flex items-center gap-2",children:["folder"===t.kind?/* @__PURE__ */T(N,{name:"folder",look:"solid",className:"h-4 w-4 text-amber-500 shrink-0"}):/* @__PURE__ */T(N,{name:"page",className:"h-4 w-4 text-ink-faintest shrink-0",strokeWidth:1.5}),
|
|
83
|
+
/* @__PURE__ */T("span",{className:"truncate",title:t.name,children:t.name})]}),
|
|
84
|
+
/* @__PURE__ */T("td",{className:"px-3 h-8 text-right tabular-nums text-ink-faint",children:"folder"===t.kind?"—":n(t.size)}),
|
|
85
|
+
/* @__PURE__ */T("td",{className:"px-3 h-8 text-right text-ink-faint tabular-nums",children:F(t.modifiedAt)}),
|
|
86
|
+
/* @__PURE__ */T("td",{className:"px-3 h-8 text-right whitespace-nowrap",children:!A&&/* @__PURE__ */E(L,{children:["file"===t.kind&&/* @__PURE__ */T("button",{onClick:e=>{e.stopPropagation(),ge(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-ink-faint text-2xs",children:"Download"}),
|
|
87
|
+
/* @__PURE__ */T("button",{onClick:e=>{e.stopPropagation(),(async e=>{const t=await k({title:`Rename ${e.kind}`,defaultValue:e.name,confirmLabel:"Rename"});if(!t||t===e.name)return;if(/[\\/]/.test(t))return void y.error("Names cannot contain slashes");const a=W(I,e.name),n=W(I,t),r=await pe(`${P}/api/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:a,to:n})});if(!r.ok){const e=await r.json().catch(()=>({}));return void y.error(e.error||`Rename failed (${r.status})`)}fe(I)})(t)},className:"px-2 py-0.5 rounded hover:bg-gray-200 text-ink-faint text-2xs ml-1",children:"Rename"}),
|
|
88
|
+
/* @__PURE__ */T("button",{onClick:e=>{e.stopPropagation(),(async e=>{if(!await g({title:`Delete ${e.kind}`,message:`"${e.name}"${"folder"===e.kind?" and everything inside":""} will be permanently removed.`,confirmLabel:"Delete",variant:"danger"}))return;const t=W(I,e.name),a=await pe(`${P}/api/files?path=${encodeURIComponent(t)}`,{method:"DELETE"});if(!a.ok){const e=await a.json().catch(()=>({}));return void y.error(e.error||`Delete failed (${a.status})`)}fe(I)})(t)},className:"px-2 py-0.5 rounded hover:bg-red-100 text-red-600 text-2xs ml-1",children:"Delete"})]})})]},t.name))})]})})]})})}),_&&/* @__PURE__ */T("div",{className:"absolute inset-0 bg-blue-500/15 border-4 border-dashed border-blue-500 pointer-events-none flex items-center justify-center z-20",children:/* @__PURE__ */T("div",{className:"px-4 py-2 rounded-md bg-blue-600 text-white text-sm font-medium shadow-lg",children:"Drop to upload"})})]})}export{P as default};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import{getNumberingConfigs as e}from"./chunk-XQQNA246.js";import{SidebarLayout as t}from"./chunk-2OJ3HGFY.js";import"./chunk-QWK6DRSN.js";import"./chunk-RBIGSJ2J.js";import{timeAgo as r}from"./chunk-X2S2XDZI.js";import"./chunk-5OTS2G3M.js";import"./chunk-36BRD5J3.js";import{AboutApp as n}from"./chunk-UDKOJB2B.js";import{useWindowManager as o,client_default as i}from"./chunk-ANTH2FBS.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-E3RHEEA6.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-3V6ZERBS.js";import"./chunk-TYK7VN73.js";import"./chunk-6B4F5DWV.js";import"./chunk-GMRZX2ET.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import{toast_default as c}from"./chunk-OQW42DOR.js";import"./chunk-RKFEJ5CX.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import{useShellPrefs as s}from"./chunk-KC3EX26K.js";import"./chunk-PYQ6DD3F.js";import"./chunk-MH6DI6YY.js";import"./chunk-5QFPTDQF.js";import"./chunk-URHGHXDN.js";import"./chunk-LNARMEEZ.js";import"./chunk-NHH2MXFU.js";import"./chunk-UQYNPYF4.js";import{Icon as l}from"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-HL6JSDN3.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-OZAAIE4E.js";import"./chunk-BCDG4N6L.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-X2PZMXDP.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as p,useState as d,useCallback as m}from"react";import{useQuery as u}from"@tanstack/react-query";import{jsxs as h,Fragment as g,jsx as x}from"react/jsx-runtime";var y=[{key:"yellow",bg:"bg-yellow-100",border:"border-yellow-300",text:"text-yellow-900",dot:"bg-yellow-400"},{key:"blue",bg:"bg-blue-100",border:"border-blue-300",text:"text-blue-900",dot:"bg-blue-400"},{key:"green",bg:"bg-green-100",border:"border-green-300",text:"text-green-900",dot:"bg-green-400"},{key:"pink",bg:"bg-pink-100",border:"border-pink-300",text:"text-pink-900",dot:"bg-pink-400"},{key:"purple",bg:"bg-purple-100",border:"border-purple-300",text:"text-purple-900",dot:"bg-purple-400"},{key:"orange",bg:"bg-orange-100",border:"border-orange-300",text:"text-orange-900",dot:"bg-orange-400"},{key:"white",bg:"bg-white",border:"border-gray-300",text:"text-gray-900",dot:"bg-gray-300"}];var k={sales_order:{entityType:"order",endpoint:"/orders/sales-orders/"},purchase_order:{entityType:"purchase_order",endpoint:"/purchase-orders/"},invoice:{entityType:"invoice",endpoint:"/invoicing/invoices/"},vendor_invoice:{entityType:"vendor_invoice",endpoint:"/invoicing/vendor-invoices/"},shipment:{entityType:"shipment",endpoint:"/shipments/delivery-notes/"},receipt:{entityType:"payment",endpoint:"/invoicing/payments/"},vendor_payment:{entityType:"vendor_payment",endpoint:"/invoicing/vendor-payments/"},vendor_price_sheet:{entityType:"vendor_price_sheet",endpoint:"/pricing/manufacturer-price-sheets/"},client_price_sheet:{entityType:"price_sheet",endpoint:"/pricing/price-sheets/"},qc_report:{entityType:"qc_report",endpoint:"/qc-reports/"},warranty_claim:{entityType:"warranty_claim",endpoint:"/warranty-claims/claims/"},vendor_shipment:{entityType:"vendor_shipment",endpoint:"/shipments/goods-receipts/"}},b=/\[([ xX]?)\]/g;function f(){const{openEntity:f}=o(),{prefs:N,save:j}=s(),{data:v}=u({queryKey:["numbering-configs"],queryFn:()=>e(),retry:!1}),w=a({});p(()=>{if(!v)return;const e={};for(const t of v){const r=k[t.entity_type];if(!r)continue;const n=(t.prefix||"").replace("#","").toUpperCase();if(n&&(e[n]={...r,prefix:t.prefix}),t.alt_prefix){const n=t.alt_prefix.replace("#","").toUpperCase();n&&(e[n]={...r,prefix:t.alt_prefix})}}w.current=e},[v]);const T=N.notepad_notes||[],[_,D]=d(null),[C,R]=d(""),[S,W]=d(""),[X,$]=d("yellow"),[E,J]=d(!1),[M,H]=d(!1),K=a(null),O=a();p(()=>{if(!_&&T.length>0){const e=T[0];D(e.id),R(e.title),W(e.content),$(e.color)}},[T.length]);const U=m(e=>{j({notepad_notes:e})},[j]),A=m(()=>{if(!_||!E)return;const e=T.map(e=>e.id===_?{...e,title:C,content:S,color:X,updated_at:/* @__PURE__ */(new Date).toISOString()}:e);U(e),J(!1)},[_,E,C,S,X,T,U]);p(()=>{if(E)return O.current&&clearTimeout(O.current),O.current=setTimeout(A,800),()=>{O.current&&clearTimeout(O.current)}},[E,A]),p(()=>()=>{E&&A()},[]);const B=e=>{E&&A(),D(e.id),R(e.title),W(e.content),$(e.color),J(!1),H(!1)},G=e=>{const t=S.slice(0,e),r=S.slice(e).match(/^\[([ xX]?)\]/);if(!r)return;const n="x"===r[1]||"X"===r[1]?"[ ]":"[x]",o=S.slice(e+r[0].length);W(t+n+o),J(!0)},Z=async(e,t)=>{const r=w.current[e];if(!r)return;const n=`${e}#${t}`;try{const{data:e}=await i.get(r.endpoint,{params:{search:n,page_size:1}}),t=(e?.results??e??[])[0];t?f(r.entityType,t.id,t,n):c.error(`${n} not found`)}catch{c.error(`Failed to look up ${n}`)}},F="Start writing...\n\nTips:\n [] Type [] for a checkbox, click to toggle\n SO#35001 Type XX#NNNNN to link entities (SO, PO, CI, VI, PL, etc.)",I=/* @__PURE__ */h(g,{children:[
|
|
2
|
+
/* @__PURE__ */x("div",{className:"p-2 border-b border-gray-200",children:/* @__PURE__ */h("button",{onClick:()=>{E&&A();const e={id:`note-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:"",content:"",color:"yellow",updated_at:/* @__PURE__ */(new Date).toISOString()},t=[e,...T];U(t),D(e.id),R(""),W(""),$("yellow"),J(!1),H(!0),setTimeout(()=>K.current?.focus(),50)},className:"w-full flex items-center justify-center gap-2 rounded-lg bg-accent-fill text-on-accent px-3 min-h-8 py-1 text-sm font-medium hover:bg-accent-fill-hover transition-colors",children:[
|
|
3
|
+
/* @__PURE__ */x(l,{name:"add",className:"h-4 w-4",strokeWidth:2}),"New Note"]})}),
|
|
4
|
+
/* @__PURE__ */x("div",{className:"flex-1 overflow-y-auto",children:0===T.length?/* @__PURE__ */x("p",{className:"text-sm text-gray-400 text-center py-8 px-4",children:"No notes yet. Create one to get started."}):T.map(e=>{const t=(n=e.color,y.find(e=>e.key===n)||y[0]);var n;/* @__PURE__ */
|
|
5
|
+
return h("button",{onClick:()=>B(e),className:"w-full text-left px-3 py-3 border-b border-line-subtle transition-colors "+(_===e.id?"bg-accent-tint":"hover:bg-row-hover"),children:[
|
|
6
|
+
/* @__PURE__ */h("div",{className:"flex items-center gap-2",children:[
|
|
7
|
+
/* @__PURE__ */x("div",{className:`w-3 h-3 rounded-full shrink-0 ${t.dot}`}),
|
|
8
|
+
/* @__PURE__ */x("span",{className:"text-sm font-medium text-gray-900 truncate flex-1",children:e.title||"Untitled"})]}),
|
|
9
|
+
/* @__PURE__ */x("p",{className:"text-xs text-ink-faintest mt-0.5 truncate ml-5",children:e.content.replace(/\[[ xX]?\]/g,"").slice(0,60)||"Empty note"}),
|
|
10
|
+
/* @__PURE__ */x("p",{className:"text-2xs text-gray-300 mt-0.5 ml-5",children:r(e.updated_at)})]},e.id)})})]});/* @__PURE__ */
|
|
11
|
+
return h("div",{className:"h-full",children:[
|
|
12
|
+
/* @__PURE__ */x(n,{app:"notepad"}),
|
|
13
|
+
/* @__PURE__ */x(t,{sidebar:I,storageKey:"notepad.sidebarWidth",defaultWidth:224,minWidth:180,maxWidth:360,children:_?/* @__PURE__ */h("div",{className:"flex-1 flex flex-col min-w-0",children:[
|
|
14
|
+
/* @__PURE__ */h("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-gray-200",children:[
|
|
15
|
+
/* @__PURE__ */x("input",{value:C,onChange:e=>{R(e.target.value),J(!0)},placeholder:"Note title...",className:"flex-1 text-lg font-semibold text-gray-900 outline-none bg-transparent placeholder:text-gray-300"}),
|
|
16
|
+
/* @__PURE__ */x("div",{className:"flex gap-1",children:y.map(e=>/* @__PURE__ */x("button",{onClick:()=>{$(e.key),J(!0)},className:`w-5 h-5 rounded-full border-2 transition-all ${e.dot} ${X===e.key?"border-gray-600 scale-110":"border-transparent hover:border-gray-400"}`,title:e.key},e.key))}),
|
|
17
|
+
/* @__PURE__ */x("button",{onClick:()=>(e=>{const t=T.filter(t=>t.id!==e);if(U(t),_===e){const e=t[0];e?B(e):(D(null),R(""),W(""))}})(_),title:"Delete note",className:"p-1 rounded text-gray-300 hover:text-red-500 transition-colors",children:/* @__PURE__ */x(l,{name:"trash",className:"h-4 w-4",strokeWidth:1.5})})]}),M?/* @__PURE__ */x("textarea",{ref:K,value:S,onChange:e=>{W(e.target.value),J(!0)},onBlur:()=>{H(!1),E&&A()},placeholder:F,className:"flex-1 p-4 text-sm text-gray-700 outline-none resize-none bg-transparent leading-relaxed placeholder:text-gray-300 font-mono"}):/* @__PURE__ */x("div",{onClick:()=>{H(!0),setTimeout(()=>K.current?.focus(),50)},className:"flex-1 p-4 text-sm text-gray-700 overflow-y-auto leading-relaxed cursor-text",children:S?(e=>{if(!e)return[];const t=e.split("\n");return t.map((e,r)=>{const n=[];let o=0;const i=[],c=/([A-Z]{2,4})#(\d{4,6})/g;let s;for(;null!==(s=c.exec(e));){const e=s[1],t=s[2];if(w.current[e]){const n=s.index,o=s[0];i.push({idx:n,len:o.length,render:()=>/* @__PURE__ */x("button",{onClick:()=>Z(e,t),className:"text-blue-600 hover:text-blue-800 hover:underline font-medium cursor-pointer",children:o},`ref-${r}-${n}`)})}}b.lastIndex=0;let a=0;for(let e=0;e<r;e++)a+=t[e].length+1;for(;null!==(s=b.exec(e));){const e="x"===s[1]||"X"===s[1],t=s.index,n=a+t;i.push({idx:t,len:s[0].length,render:()=>/* @__PURE__ */x("button",{onClick:()=>G(n),className:`inline-flex items-center justify-center w-4 h-4 rounded border ${e?"bg-blue-500 border-blue-500 text-white":"border-gray-400 bg-white hover:border-blue-400"} cursor-pointer align-text-bottom mr-0.5`,children:e&&/* @__PURE__ */x(l,{name:"check",className:"w-3 h-3",strokeWidth:3})},`cb-${r}-${t}`)})}i.sort((e,t)=>e.idx-t.idx);for(const t of i)t.idx>o&&n.push(/* @__PURE__ */x("span",{children:e.slice(o,t.idx)},`t-${r}-${o}`)),n.push(t.render()),o=t.idx+t.len;o<e.length&&n.push(/* @__PURE__ */x("span",{children:e.slice(o)},`t-${r}-${o}`)),0===n.length&&n.push(/* @__PURE__ */x("span",{children:""},`empty-${r}`));const p=/^\[x\]/i.test(e.trimStart());/* @__PURE__ */
|
|
18
|
+
return x("div",{className:p?"line-through text-gray-400":"",children:n},r)})})(S):/* @__PURE__ */x("p",{className:"text-gray-300 whitespace-pre-line",children:F})}),
|
|
19
|
+
/* @__PURE__ */h("div",{className:"px-4 min-h-8 py-1 border-t border-line-subtle flex items-center gap-4 text-2xs text-ink-faintest",children:[
|
|
20
|
+
/* @__PURE__ */x("span",{children:"[] checkbox"}),
|
|
21
|
+
/* @__PURE__ */x("span",{children:"SO#35001 entity link"}),
|
|
22
|
+
/* @__PURE__ */x("span",{className:"ml-auto",children:M?"Editing":"Click to edit"})]})]}):/* @__PURE__ */x("div",{className:"flex-1 flex items-center justify-center",children:/* @__PURE__ */h("div",{className:"text-center text-gray-400",children:[
|
|
23
|
+
/* @__PURE__ */x(l,{name:"page",className:"h-12 w-12 mx-auto mb-3 text-gray-300",strokeWidth:1}),
|
|
24
|
+
/* @__PURE__ */x("p",{className:"text-sm",children:"Select a note or create a new one"})]})})})]})}export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PdfViewer as default,fitScale,pdfWasmParams}from"./chunk-V4RYE6KA.js";import"./chunk-OQW42DOR.js";import"./chunk-UQYNPYF4.js";import"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-X2PZMXDP.js";import"./chunk-C3QOHMR6.js";
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-
|
|
1
|
+
import{loadAppearance as e,WidgetSettingsModal as t}from"./chunk-XZBQ3XXD.js";import{subscribePomo as o,getPomoSnapshot as a,setPomoDurations as n,setPomoAlarm as r,setPomoAlarmConfig as s,setPomoBehaviour as l,setPomoFocusSound as i,useTodoTasks as c,migratePomodoroTasksOnce as d,pomoSwitchMode as u,pomoPause as m,pomoStart as h,ALARM_OPTIONS as p,playAlarm as g,FOCUS_SOUND_OPTIONS as f,previewFocusSound as k}from"./chunk-PF5CKD4C.js";import{PLACEHOLDER_INK as b}from"./chunk-AYZY3YNC.js";import{useWidgetSettings as x}from"./chunk-ANTH2FBS.js";import"./chunk-CY5N5OA3.js";import"./chunk-AW7TOB6N.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-E3RHEEA6.js";import"./chunk-ZDMZM7HD.js";import"./chunk-5A7MWTXX.js";import"./chunk-3V6ZERBS.js";import"./chunk-TYK7VN73.js";import"./chunk-6B4F5DWV.js";import"./chunk-GMRZX2ET.js";import"./chunk-4AJRHTTB.js";import"./chunk-VWGWZY7A.js";import"./chunk-PKXQDCNR.js";import"./chunk-OQW42DOR.js";import"./chunk-RKFEJ5CX.js";import"./chunk-UGTRSRIW.js";import"./chunk-CDAJKLGL.js";import{useShellPrefs as v}from"./chunk-KC3EX26K.js";import"./chunk-MH6DI6YY.js";import"./chunk-5QFPTDQF.js";import"./chunk-URHGHXDN.js";import"./chunk-LNARMEEZ.js";import"./chunk-NHH2MXFU.js";import"./chunk-UQYNPYF4.js";import{Icon as y}from"./chunk-KKSVRIMP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-HL6JSDN3.js";import"./chunk-R2VKEMZH.js";import"./chunk-MRJKZWWV.js";import"./chunk-OZAAIE4E.js";import"./chunk-BCDG4N6L.js";import"./chunk-PGN5ME7B.js";import"./chunk-62LW225J.js";import"./chunk-GLUJS42B.js";import"./chunk-D65T4H6J.js";import"./chunk-DTJRIWFR.js";import"./chunk-TWVUQUUD.js";import"./chunk-X2PZMXDP.js";import"./chunk-C3QOHMR6.js";import{useSyncExternalStore as N,useEffect as C,useMemo as S,useState as w,useRef as B,useCallback as j}from"react";import{jsxs as M,Fragment as T,jsx as P}from"react/jsx-runtime";var D="pomodoro_appearance",A="pomodoro_active_task_id",I={focus:"Pomodoro",short:"Short Break",long:"Long Break"},R={focus:"#0f172a",short:"#508a52",long:"#5b7898"};var V=25,L=5,E=15,$=!1,W=!1,F=4,H=!0,K=!0,J="bell",X=100,Z=1,U="none",_=50,O=(e,t,o,a)=>"number"==typeof e&&isFinite(e)?Math.max(t,Math.min(o,Math.round(e))):a;function G(){const t=N(o,a,a),{prefs:g,save:k}=v(),b=function(e){const t=e&&"object"==typeof e?e:{};return{focusMinutes:O(t.focusMinutes,1,120,V),shortBreakMinutes:O(t.shortBreakMinutes,1,120,L),longBreakMinutes:O(t.longBreakMinutes,1,120,E),autoStartBreaks:"boolean"==typeof t.autoStartBreaks?t.autoStartBreaks:$,autoStartPomodoros:"boolean"==typeof t.autoStartPomodoros?t.autoStartPomodoros:W,longBreakInterval:O(t.longBreakInterval,1,20,F),autoCheckTasks:"boolean"==typeof t.autoCheckTasks?t.autoCheckTasks:H,checkToBottom:"boolean"==typeof t.checkToBottom?t.checkToBottom:K,alarmSound:p.some(e=>e.id===t.alarmSound)?t.alarmSound:J,alarmVolume:O(t.alarmVolume,0,100,X),alarmRepeat:O(t.alarmRepeat,1,5,Z),focusSound:f.some(e=>e.id===t.focusSound)?t.focusSound:U,focusVolume:O(t.focusVolume,0,100,_)}}(g.pomodoro_settings);C(()=>{n({focus:60*b.focusMinutes,short:60*b.shortBreakMinutes,long:60*b.longBreakMinutes})},[b.focusMinutes,b.shortBreakMinutes,b.longBreakMinutes]),C(()=>{r(b.alarmSound),s(b.alarmVolume,b.alarmRepeat)},[b.alarmSound,b.alarmVolume,b.alarmRepeat]),C(()=>{l({autoStartBreaks:b.autoStartBreaks,autoStartPomodoros:b.autoStartPomodoros,longBreakInterval:b.longBreakInterval})},[b.autoStartBreaks,b.autoStartPomodoros,b.longBreakInterval]),C(()=>{i(b.focusSound,b.focusVolume)},[b.focusSound,b.focusVolume]),C(()=>{if("undefined"!=typeof Notification&&"default"===Notification.permission)try{Notification.requestPermission()}catch{}},[]);const G=c(),Q=G.tasks,z=S(()=>/* @__PURE__ */(new Date).toISOString().slice(0,10),[]),q=function(e,t){return S(()=>t?(e=>{const t=[],o=[];for(const a of e)(a.done?o:t).push(a);return[...t,...o]})(e):e,[e,t])}(S(()=>Q.filter(e=>!!e.dueDate&&(e.dueDate===z||e.dueDate<z&&!e.done)),[Q,z]),b.checkToBottom),[ee,te]=w(()=>localStorage.getItem(A)),[oe,ae]=w(!1),[ne,re]=w(null),se=B(!1);C(()=>{se.current||(se.current=!0,d(Q,G.setAllTasks))},[]),C(()=>{try{ee?localStorage.setItem(A,ee):localStorage.removeItem(A)}catch{}},[ee]),C(()=>{if(!ne)return;const e=()=>re(null),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[ne]);const le=B(t.streak);C(()=>{if(t.streak>le.current&&ee){const e=Q.find(e=>e.id===ee);if(e){const t=(e.completed??0)+1,o=e.estimated??0,a=b.autoCheckTasks&&o>0&&t>=o;G.updateTask(ee,{completed:t,done:e.done||a})}}le.current=t.streak},[t.streak,ee,b.autoCheckTasks,Q,G]);const ce=q.reduce((e,t)=>e+(t.completed??0),0),de=q.reduce((e,t)=>e+Math.max(t.estimated??0,t.completed??0),0),ue=q.reduce((e,t)=>t.done?e:e+Math.max(0,(t.estimated??0)-(t.completed??0)),0),me=t.running&&"focus"===t.mode?t.remaining:0,he=ue*b.focusMinutes*60+me,pe=new Date(Date.now()+1e3*he).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),ge=(he/3600).toFixed(1),fe=ee?Q.find(e=>e.id===ee)??null:null,ke=String(Math.floor(t.remaining/60)).padStart(2,"0"),be=String(t.remaining%60).padStart(2,"0"),[xe,ve]=w(()=>e(D)),[ye,Ne]=w(!1),[Ce,Se]=w(xe),[we,Be]=w(b);x(j(()=>{Se({...xe}),Be({...b}),Ne(!0)},[xe,b]));const je="focus"!==t.mode,Me=R[t.mode],Te=je?(Pe=Me,De=xe.activeOpacity/100,`rgba(${parseInt(Pe.slice(1,3),16)}, ${parseInt(Pe.slice(3,5),16)}, ${parseInt(Pe.slice(5,7),16)}, ${De})`):`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${xe.activeOpacity/100})`;var Pe,De;const Ae={primary:je?"text-white":"text-gray-900",secondary:je?"text-white/85":"text-gray-700",muted:je?"text-white/65":"text-gray-500",tabActive:je?"bg-white/15 text-white":"bg-gray-200 text-gray-900",tabInactive:je?"text-white/75 hover:bg-white/10":"text-gray-500 hover:bg-gray-200",divider:je?"border-white/30":"border-gray-200",softDivider:je?"border-white/20":"border-gray-200",iconBtn:je?"bg-black/15 hover:bg-black/25 text-white/85":"bg-gray-200 hover:bg-gray-300 text-gray-600",addTaskBtn:je?"border-white/45 text-white/90 hover:bg-white/[0.06]":"border-gray-300 text-gray-500 hover:bg-gray-200/50"},Ie=je?Me:"#0f172a";/* @__PURE__ */
|
|
2
2
|
return M(T,{children:[
|
|
3
|
-
/* @__PURE__ */M("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${
|
|
4
|
-
/* @__PURE__ */P("div",{className:"px-3 pt-3 flex justify-center gap-2",children:["focus","short","long"].map(e=>/* @__PURE__ */P("button",{onClick:()=>u(e),className:`px-3 py-1 text-sm font-bold rounded transition-colors ${t.mode===e?
|
|
3
|
+
/* @__PURE__ */M("div",{className:`flex flex-col h-full select-none transition-colors duration-300 ${Ae.primary}`,style:{backgroundColor:Te,backdropFilter:xe.activeBlur>0?`blur(${xe.activeBlur}px)`:void 0},children:[
|
|
4
|
+
/* @__PURE__ */P("div",{className:"px-3 pt-3 flex justify-center gap-2",children:["focus","short","long"].map(e=>/* @__PURE__ */P("button",{onClick:()=>u(e),className:`px-3 py-1 text-sm font-bold rounded transition-colors ${t.mode===e?Ae.tabActive:Ae.tabInactive}`,children:I[e]},e))}),
|
|
5
5
|
/* @__PURE__ */M("div",{className:"text-center font-bold tabular-nums leading-none tracking-tight mt-3",style:{fontSize:"4.5rem"},children:[ke,":",be]}),
|
|
6
|
-
/* @__PURE__ */P("div",{className:"flex justify-center mt-3 mb-2",children:/* @__PURE__ */P("button",{onClick:()=>t.running?m():h(),className:"bg-surface px-12 py-3 rounded-md font-bold text-base shadow-[0_4px_0_rgba(0,0,0,0.12)] hover:shadow-[0_3px_0_rgba(0,0,0,0.12)] active:translate-y-1 active:shadow-none transition-all",style:{color:
|
|
6
|
+
/* @__PURE__ */P("div",{className:"flex justify-center mt-3 mb-2",children:/* @__PURE__ */P("button",{onClick:()=>t.running?m():h(),className:"bg-surface px-12 py-3 rounded-md font-bold text-base shadow-[0_4px_0_rgba(0,0,0,0.12)] hover:shadow-[0_3px_0_rgba(0,0,0,0.12)] active:translate-y-1 active:shadow-none transition-all",style:{color:Ie,letterSpacing:"0.08em"},children:t.running?"PAUSE":"START"})}),
|
|
7
7
|
/* @__PURE__ */P("div",{className:"px-3 py-3 text-center",children:fe?/* @__PURE__ */M(T,{children:[
|
|
8
|
-
/* @__PURE__ */M("div",{className:`text-xs leading-tight ${
|
|
9
|
-
/* @__PURE__ */P("div",{className:`text-base font-medium leading-tight truncate mt-0.5 ${
|
|
8
|
+
/* @__PURE__ */M("div",{className:`text-xs leading-tight ${Ae.muted}`,children:["#",(fe.completed??0)+1]}),
|
|
9
|
+
/* @__PURE__ */P("div",{className:`text-base font-medium leading-tight truncate mt-0.5 ${Ae.primary}`,children:fe.name})]}):/* @__PURE__ */P("div",{className:`text-xs italic ${Ae.muted}`,children:"No task selected"})}),
|
|
10
10
|
/* @__PURE__ */M("div",{className:"px-3 mt-1 flex items-center justify-between",children:[
|
|
11
|
-
/* @__PURE__ */P("h3",{className:`text-base font-bold tracking-tight ${
|
|
12
|
-
/* @__PURE__ */P("button",{className:`rounded p-1 transition-colors ${
|
|
13
|
-
/* @__PURE__ */P("div",{className:`border-t mx-3 mt-2 ${
|
|
11
|
+
/* @__PURE__ */P("h3",{className:`text-base font-bold tracking-tight ${Ae.primary}`,children:"Tasks"}),
|
|
12
|
+
/* @__PURE__ */P("button",{className:`rounded p-1 transition-colors ${Ae.iconBtn}`,"aria-label":"Tasks menu",tabIndex:-1,children:/* @__PURE__ */P(y,{name:"more-vertical",look:"solid",className:"h-4 w-4"})})]}),
|
|
13
|
+
/* @__PURE__ */P("div",{className:`border-t mx-3 mt-2 ${Ae.divider}`}),
|
|
14
14
|
/* @__PURE__ */M("div",{className:"flex-1 px-3 py-3 space-y-2 overflow-y-auto",children:[q.map(e=>{const t=e.id===ee;/* @__PURE__ */
|
|
15
15
|
return M("div",{onClick:()=>te(e.id),className:"bg-surface text-ink-strong rounded-md flex items-center pr-2 py-3 shadow-sm cursor-pointer transition-shadow hover:shadow-(--elevation-panel) "+(t?"border-l-4 border-gray-700 pl-2":"pl-3 border-l-4 border-transparent"),children:[
|
|
16
|
-
/* @__PURE__ */P("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,
|
|
16
|
+
/* @__PURE__ */P("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,G.toggleDone(o)},className:"shrink-0",children:e.done?/* @__PURE__ */P("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",style:{color:Ie},children:/* @__PURE__ */P("path",{d:"M10 0a10 10 0 100 20 10 10 0 000-20zm-1 14.5l-4.5-4.5 1.4-1.4 3.1 3.1 6.1-6.1 1.4 1.4z"})}):/* @__PURE__ */P("svg",{className:"h-5 w-5 text-gray-300",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:/* @__PURE__ */P("circle",{cx:"12",cy:"12",r:"10"})})}),
|
|
17
17
|
/* @__PURE__ */P("span",{className:"ml-3 flex-1 font-semibold truncate "+(e.done?"line-through text-gray-400":"text-gray-800"),children:e.name}),
|
|
18
18
|
/* @__PURE__ */M("span",{className:"text-sm tabular-nums mr-2 shrink-0",children:[
|
|
19
19
|
/* @__PURE__ */P("span",{className:"font-bold text-gray-500",children:e.completed??0}),
|
|
20
20
|
/* @__PURE__ */P("span",{className:"text-gray-400",children:" / "}),
|
|
21
21
|
/* @__PURE__ */P("span",{className:"text-gray-400",children:e.estimated??"–"})]}),
|
|
22
22
|
/* @__PURE__ */M("div",{className:"relative",children:[
|
|
23
|
-
/* @__PURE__ */P("button",{onClick:t=>{t.stopPropagation(),re(ne===e.id?null:e.id)},className:"rounded p-1 bg-gray-100 hover:bg-gray-200",children:/* @__PURE__ */P(y,{name:"more-vertical",look:"solid",className:"h-4 w-4 text-ink-faint"})}),ne===e.id&&/* @__PURE__ */P("div",{className:"absolute right-0 top-full mt-1 bg-white text-gray-800 rounded shadow-lg border border-gray-200 z-10 min-w-[110px] overflow-hidden",onClick:e=>e.stopPropagation(),children:/* @__PURE__ */P("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,
|
|
23
|
+
/* @__PURE__ */P("button",{onClick:t=>{t.stopPropagation(),re(ne===e.id?null:e.id)},className:"rounded p-1 bg-gray-100 hover:bg-gray-200",children:/* @__PURE__ */P(y,{name:"more-vertical",look:"solid",className:"h-4 w-4 text-ink-faint"})}),ne===e.id&&/* @__PURE__ */P("div",{className:"absolute right-0 top-full mt-1 bg-white text-gray-800 rounded shadow-lg border border-gray-200 z-10 min-w-[110px] overflow-hidden",onClick:e=>e.stopPropagation(),children:/* @__PURE__ */P("button",{onClick:t=>{var o;t.stopPropagation(),o=e.id,G.removeTask(o),ee===o&&te(null),re(null)},className:"block w-full px-3 h-8 text-sm text-left hover:bg-red-50 text-red-600",children:"Delete"})})]})]},e.id)}),oe?/* @__PURE__ */P(ie,{onSubmit:(e,t)=>{const o=e.trim();if(!o)return;const a=G.addTask({name:o,estimated:t,completed:0,dueDate:z});ee||te(a),ae(!1)},onCancel:()=>ae(!1),accentColor:Ie}):/* @__PURE__ */M("button",{onClick:()=>ae(!0),className:`w-full border-2 border-dashed rounded-md py-3 font-semibold flex items-center justify-center gap-2 transition-colors ${Ae.addTaskBtn}`,children:[
|
|
24
24
|
/* @__PURE__ */P(y,{name:"add-circle",className:"h-5 w-5",strokeWidth:2}),"Add Task"]})]}),
|
|
25
|
-
/* @__PURE__ */M("div",{className:`border-t px-3 py-3 flex items-center justify-center gap-5 text-sm ${
|
|
26
|
-
/* @__PURE__ */M("span",{className:
|
|
27
|
-
/* @__PURE__ */P("span",{className:`font-bold ${
|
|
28
|
-
/* @__PURE__ */P("span",{className:
|
|
29
|
-
/* @__PURE__ */P("span",{className:`font-bold ${
|
|
30
|
-
/* @__PURE__ */P("span",{className:`font-bold ${
|
|
31
|
-
/* @__PURE__ */M("span",{className:
|
|
32
|
-
/* @__PURE__ */P(
|
|
25
|
+
/* @__PURE__ */M("div",{className:`border-t px-3 py-3 flex items-center justify-center gap-5 text-sm ${Ae.softDivider}`,children:[
|
|
26
|
+
/* @__PURE__ */M("span",{className:Ae.secondary,children:["Pomos: ",
|
|
27
|
+
/* @__PURE__ */P("span",{className:`font-bold ${Ae.primary}`,children:ce}),
|
|
28
|
+
/* @__PURE__ */P("span",{className:Ae.muted,children:" / "}),
|
|
29
|
+
/* @__PURE__ */P("span",{className:`font-bold ${Ae.primary}`,children:de})]}),he>0&&/* @__PURE__ */M("span",{className:Ae.secondary,children:["Finish At: ",
|
|
30
|
+
/* @__PURE__ */P("span",{className:`font-bold ${Ae.primary}`,children:pe}),
|
|
31
|
+
/* @__PURE__ */M("span",{className:Ae.muted,children:[" (",ge,"h)"]})]})]})]}),
|
|
32
|
+
/* @__PURE__ */P(Y,{open:ye,onClose:()=>Ne(!1),onSave:()=>{ve(Ce),localStorage.setItem(D,JSON.stringify(Ce)),k({pomodoro_settings:we}),Ne(!1)},configAppearance:Ce,setConfigAppearance:Se,configPrefs:we,setConfigPrefs:Be})]})}function Y({open:e,onClose:o,onSave:a,configAppearance:n,setConfigAppearance:r,configPrefs:s,setConfigPrefs:l}){const i=(e,t)=>l(o=>({...o,[e]:t}));/* @__PURE__ */
|
|
33
33
|
return M(t,{open:e,onClose:o,title:"Pomodoro Settings",appearance:n,onAppearanceChange:r,onSave:a,children:[
|
|
34
|
-
/* @__PURE__ */M(
|
|
34
|
+
/* @__PURE__ */M(Q,{icon:/* @__PURE__ */P(re,{}),label:"TIMER",children:[
|
|
35
35
|
/* @__PURE__ */M("div",{children:[
|
|
36
36
|
/* @__PURE__ */P("p",{className:"text-sm font-bold text-gray-800 mb-2",children:"Time (minutes)"}),
|
|
37
37
|
/* @__PURE__ */M("div",{className:"grid grid-cols-3 gap-3",children:[
|
|
@@ -41,17 +41,17 @@ return M(t,{open:e,onClose:o,title:"Pomodoro Settings",appearance:n,onAppearance
|
|
|
41
41
|
/* @__PURE__ */P(z,{label:"Auto Start Breaks",children:/* @__PURE__ */P(ae,{checked:s.autoStartBreaks,onChange:e=>i("autoStartBreaks",e)})}),
|
|
42
42
|
/* @__PURE__ */P(z,{label:"Auto Start Pomodoros",children:/* @__PURE__ */P(ae,{checked:s.autoStartPomodoros,onChange:e=>i("autoStartPomodoros",e)})}),
|
|
43
43
|
/* @__PURE__ */P(z,{label:"Long Break interval",children:/* @__PURE__ */P(te,{value:s.longBreakInterval,onChange:e=>i("longBreakInterval",e),min:1,max:20,className:"w-14 text-center"})})]}),
|
|
44
|
-
/* @__PURE__ */M(
|
|
44
|
+
/* @__PURE__ */M(Q,{icon:/* @__PURE__ */P(se,{}),label:"TASK",children:[
|
|
45
45
|
/* @__PURE__ */P(z,{label:"Auto Check Tasks",info:'If you enable "Auto Check Tasks", the active task will be automatically checked when the actual pomodoro count reaches the estimated count.',children:/* @__PURE__ */P(ae,{checked:s.autoCheckTasks,onChange:e=>i("autoCheckTasks",e)})}),
|
|
46
46
|
/* @__PURE__ */P(z,{label:"Check to Bottom",info:'If you enable "Check to Bottom", the checked task will be automatically moved to the bottom of the task list.',children:/* @__PURE__ */P(ae,{checked:s.checkToBottom,onChange:e=>i("checkToBottom",e)})})]}),
|
|
47
|
-
/* @__PURE__ */M(
|
|
47
|
+
/* @__PURE__ */M(Q,{icon:/* @__PURE__ */P(le,{}),label:"SOUND",children:[
|
|
48
48
|
/* @__PURE__ */P(z,{label:"Alarm Sound",children:/* @__PURE__ */M("div",{className:"flex items-center gap-2",children:[
|
|
49
49
|
/* @__PURE__ */P(oe,{value:s.alarmSound,onChange:e=>i("alarmSound",e),options:p.map(e=>({id:e.id,label:e.label}))}),"off"!==s.alarmSound&&/* @__PURE__ */P("button",{type:"button",onClick:()=>g(s.alarmSound,{volume:s.alarmVolume,repeat:1}),className:"px-2 py-1 text-2xs rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
|
|
50
50
|
/* @__PURE__ */P(q,{value:s.alarmVolume,onChange:e=>i("alarmVolume",e)}),
|
|
51
51
|
/* @__PURE__ */P(z,{label:"repeat",children:/* @__PURE__ */P(te,{value:s.alarmRepeat,onChange:e=>i("alarmRepeat",e),min:1,max:5,className:"w-14 text-center"})}),
|
|
52
52
|
/* @__PURE__ */P(z,{label:"Focus Sound",children:/* @__PURE__ */M("div",{className:"flex items-center gap-2",children:[
|
|
53
53
|
/* @__PURE__ */P(oe,{value:s.focusSound,onChange:e=>i("focusSound",e),options:f}),"none"!==s.focusSound&&/* @__PURE__ */P("button",{type:"button",onClick:()=>k(s.focusSound,s.focusVolume),className:"px-2 py-1 text-2xs rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:"Play"})]})}),
|
|
54
|
-
/* @__PURE__ */P(q,{value:s.focusVolume,onChange:e=>i("focusVolume",e)})]})]})}function
|
|
54
|
+
/* @__PURE__ */P(q,{value:s.focusVolume,onChange:e=>i("focusVolume",e)})]})]})}function Q({icon:e,label:t,children:o}){/* @__PURE__ */
|
|
55
55
|
return M("div",{className:"border-t border-gray-200 pt-3 first:border-0 first:pt-0",children:[
|
|
56
56
|
/* @__PURE__ */M("div",{className:"flex items-center gap-2 mb-3 text-ink-faintest",children:[e,
|
|
57
57
|
/* @__PURE__ */P("span",{className:"text-xs font-bold tracking-[0.15em]",children:t})]}),
|
|
@@ -80,7 +80,7 @@ return M("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"
|
|
|
80
80
|
/* @__PURE__ */P("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4"})]})}function le(){/* @__PURE__ */
|
|
81
81
|
return M("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[
|
|
82
82
|
/* @__PURE__ */P("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5L6 9H2v6h4l5 4V5z"}),
|
|
83
|
-
/* @__PURE__ */P("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.5 8.5a5 5 0 010 7M19 5a9 9 0 010 14"})]})}function ie({onSubmit:e,onCancel:t,accentColor:o}){const[a,n]=
|
|
83
|
+
/* @__PURE__ */P("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.5 8.5a5 5 0 010 7M19 5a9 9 0 010 14"})]})}function ie({onSubmit:e,onCancel:t,accentColor:o}){const[a,n]=w(""),[r,s]=w(1),l=()=>e(a,r);/* @__PURE__ */
|
|
84
84
|
return M("div",{className:"bg-surface text-ink-strong rounded-md p-3 shadow-(--elevation-panel)",children:[
|
|
85
85
|
/* @__PURE__ */P("input",{autoFocus:!0,value:a,onChange:e=>n(e.target.value),placeholder:"What are you working on?",onKeyDown:e=>{"Enter"===e.key&&l(),"Escape"===e.key&&t()},className:"w-full text-base font-medium bg-transparent border-0 outline-none placeholder-gray-400"}),
|
|
86
86
|
/* @__PURE__ */M("div",{className:"flex items-center justify-between mt-2",children:[
|
|
@@ -88,4 +88,4 @@ return M("div",{className:"bg-surface text-ink-strong rounded-md p-3 shadow-(--e
|
|
|
88
88
|
/* @__PURE__ */P("input",{type:"number",min:1,max:20,value:r,onChange:e=>s(Math.max(1,Math.min(20,parseInt(e.target.value,10)||1))),className:"w-16 bg-gray-100 rounded px-2 py-1 text-sm text-right border-0 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),
|
|
89
89
|
/* @__PURE__ */M("div",{className:"flex gap-2 mt-3 justify-end",children:[
|
|
90
90
|
/* @__PURE__ */P("button",{onClick:t,className:"px-3 py-1 text-sm text-gray-500 hover:bg-gray-100 rounded",children:"Cancel"}),
|
|
91
|
-
/* @__PURE__ */P("button",{onClick:l,className:"px-4 py-1 text-sm font-semibold text-white rounded shadow-sm",style:{backgroundColor:o},children:"Save"})]})]})}export{
|
|
91
|
+
/* @__PURE__ */P("button",{onClick:l,className:"px-4 py-1 text-sm font-semibold text-white rounded shadow-sm",style:{backgroundColor:o},children:"Save"})]})]})}export{G as default};
|