@marimo-team/islands 0.20.5-dev6 → 0.20.5-dev61
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/{Combination-Du-o_hC9.js → Combination-Dk6JxauT.js} +1 -1
- package/dist/{ConnectedDataExplorerComponent-DUS-zJoR.js → ConnectedDataExplorerComponent-DzTQ52Zs.js} +11 -11
- package/dist/{_baseIsEqual-5cAxzk6f.js → _baseIsEqual-CvgsjYoW.js} +38 -38
- package/dist/{_basePickBy-3JVb5wYm.js → _basePickBy-pTDW2_2A.js} +6 -6
- package/dist/{_baseUniq-DSSiFuIJ.js → _baseUniq-BUFhl85h.js} +1 -1
- package/dist/{any-language-editor-BL9o7y0_.js → any-language-editor-BIj11a2e.js} +19 -19
- package/dist/{architecture-7HQA4BMR-BxkNpYRp.js → architecture-7HQA4BMR-BmtmhGMc.js} +2 -2
- package/dist/{architectureDiagram-VXUJARFQ-DrJeyFHq.js → architectureDiagram-VXUJARFQ-Df0FNeBR.js} +14 -14
- package/dist/{blockDiagram-VD42YOAC-BJrP6qKc.js → blockDiagram-VD42YOAC-DszWqlLz.js} +7 -7
- package/dist/{button-KYalaJYu.js → button-DQpBib29.js} +24 -11
- package/dist/{c4Diagram-YG6GDRKO-Bo4gytQ5.js → c4Diagram-YG6GDRKO-Dyj8LoUX.js} +4 -4
- package/dist/{channel-IWLGkaBE.js → channel-CUFaIkTh.js} +1 -1
- package/dist/{check-C50jsehH.js → check-DpqPQmzz.js} +1 -1
- package/dist/{chunk-4F5CHEZ2-CxKDFd-t.js → chunk-4F5CHEZ2-CRwwZ2ED.js} +1 -1
- package/dist/{chunk-ABZYJK2D-CRwanrkd.js → chunk-ABZYJK2D-7QYXAAhe.js} +1 -1
- package/dist/{chunk-ATLVNIR6-CMMCMvOK.js → chunk-ATLVNIR6-pmHPAPSd.js} +1 -1
- package/dist/{chunk-B2363JML-e_W7KW1D.js → chunk-B2363JML-BuBMltZc.js} +1 -1
- package/dist/{chunk-B4BG7PRW-BNsHrGHG.js → chunk-B4BG7PRW-Dbta9cTX.js} +4 -4
- package/dist/{chunk-DI55MBZ5-DQeYbfMV.js → chunk-DI55MBZ5-DyKB35wC.js} +4 -4
- package/dist/{chunk-EXTU4WIE-CV_DQeaX.js → chunk-EXTU4WIE-BRFl4iNd.js} +1 -1
- package/dist/{chunk-FRFDVMJY-C7q09nvl.js → chunk-FRFDVMJY-Bk2LD5Te.js} +1 -1
- package/dist/{chunk-JA3XYJ7Z-Cmt--e0q.js → chunk-JA3XYJ7Z-BkrY9SdL.js} +2 -2
- package/dist/{chunk-JZLCHNYA-CkyMJnI9.js → chunk-JZLCHNYA-Bk_Lil-q.js} +4 -4
- package/dist/{chunk-N4CR4FBY-BJfHtJbD.js → chunk-N4CR4FBY-f5n6meOd.js} +5 -5
- package/dist/{chunk-PL6DKKU2-ChKBqnoD.js → chunk-PL6DKKU2-DiFkzMfM.js} +1 -1
- package/dist/{chunk-QN33PNHL-WOLIPUAJ.js → chunk-QN33PNHL-CXfJywHv.js} +1 -1
- package/dist/{chunk-QXUST7PY-DYuD50pU.js → chunk-QXUST7PY-D7-26sj3.js} +5 -5
- package/dist/{chunk-S3R3BYOJ-CsnX6RKs.js → chunk-S3R3BYOJ-BRT9vd1R.js} +3 -3
- package/dist/{chunk-SJTYNZTY-j6_1s5om.js → chunk-SJTYNZTY-BvVkbShU.js} +1 -1
- package/dist/{chunk-TCCFYFTB-DdLCbCTn.js → chunk-TCCFYFTB-DqxhgXG0.js} +31 -31
- package/dist/{chunk-TQ3KTPDO-CGsUIC73.js → chunk-TQ3KTPDO-CPkEruAA.js} +1 -1
- package/dist/{chunk-TZMSLE5B-B3eYTGCw.js → chunk-TZMSLE5B-DSfBOnzx.js} +1 -1
- package/dist/{chunk-UMXZTB3W--LdAK3Bv.js → chunk-UMXZTB3W-C4ypIY3V.js} +1 -1
- package/dist/{classDiagram-v2-WZHVMYZB-UTw37Gg8.js → classDiagram-2ON5EDUG-DphiMW3Y.js} +10 -10
- package/dist/{classDiagram-2ON5EDUG-C7C-oefv.js → classDiagram-v2-WZHVMYZB-BH1x5h4a.js} +10 -10
- package/dist/{clone-BJrS4PdE.js → clone-CEQ-pda1.js} +1 -1
- package/dist/{constants-D1Tbg_6B.js → constants-CytQ_3LM.js} +3 -3
- package/dist/{copy-oc-FcZzt.js → copy-BkBF0Xgk.js} +2 -2
- package/dist/{dagre-6UL2VRFP-BgsUhJrV.js → dagre-6UL2VRFP-DGEbtmgU.js} +12 -12
- package/dist/{dagre-CyZCGfV_.js → dagre-BVnNvbvD.js} +37 -37
- package/dist/{diagram-PSM6KHXK-BIUUOfKo.js → diagram-PSM6KHXK-CG_usglE.js} +15 -15
- package/dist/{diagram-QEK2KX5R-BFjolZQv.js → diagram-QEK2KX5R-CtGFEwzJ.js} +13 -13
- package/dist/{diagram-S2PKOQOG-4jfkWoZw.js → diagram-S2PKOQOG-ClKAGmbv.js} +13 -13
- package/dist/dist-B4MxkKHf.js +8 -0
- package/dist/{dist-De9X_Des.js → dist-B9EjSb9T.js} +1 -1
- package/dist/{dist-IW_ARJ3S.js → dist-BFxYppVR.js} +4 -4
- package/dist/{dist-D7ZGWV_9.js → dist-BGZ7TWS9.js} +3 -3
- package/dist/{dist-CwtEWuFb.js → dist-BSfYc7vq.js} +2 -2
- package/dist/{dist-DMS81OrU.js → dist-BUrWeMEP.js} +1 -1
- package/dist/dist-BYghZv6b.js +5 -0
- package/dist/dist-Be-uQhz5.js +6 -0
- package/dist/{dist-Ch_JuCvc.js → dist-BpMlUdNO.js} +3 -3
- package/dist/{dist-C6z8U-ms.js → dist-Bq5eYK43.js} +2 -2
- package/dist/{dist-BFL9TlzD.js → dist-Bq9zYwJs.js} +5 -5
- package/dist/{dist-7ZF--V_D.js → dist-C4K7pumm.js} +2 -2
- package/dist/{dist-Qjf6pcqK.js → dist-CAKwXCWI.js} +2 -2
- package/dist/dist-CB_xf0ju.js +5 -0
- package/dist/{dist-BwQHkjA9.js → dist-CDHl2i1x.js} +4 -4
- package/dist/dist-CK0qFAbF.js +8 -0
- package/dist/{dist-C4XMUaob.js → dist-CPlGUbk-.js} +2 -2
- package/dist/{dist-BT6_J2eq.js → dist-CSEWGuDq.js} +7 -2
- package/dist/dist-CYEk-qrr.js +8 -0
- package/dist/{dist-CYo3w-nC.js → dist-Cl5iM8xL.js} +3 -3
- package/dist/dist-CmKoWpMk.js +5 -0
- package/dist/{dist-I8MQW60_.js → dist-CseYuPtL.js} +2 -2
- package/dist/dist-D1nf4IQl.js +5 -0
- package/dist/{dist-CsqiXw7J.js → dist-D4gcY469.js} +2 -2
- package/dist/{dist-DUxS2paD.js → dist-D5NMgbbv.js} +2 -2
- package/dist/{dist-UYm1IE5s.js → dist-DERtJN02.js} +2 -2
- package/dist/{dist-CFToYDWO.js → dist-DEj2X26M.js} +2 -2
- package/dist/{dist-BuapEdlD.js → dist-DOoqn-VL.js} +70 -67
- package/dist/{dist-BLThQiU4.js → dist-DUretbKK.js} +2 -2
- package/dist/{dist-DEFZ7dnD.js → dist-D_-CGmlh.js} +2 -2
- package/dist/dist-Df3AcKpt.js +6 -0
- package/dist/dist-DgaFHt_I.js +5 -0
- package/dist/dist-Dk10C3ui.js +5 -0
- package/dist/{dist-D0f6Yrrb.js → dist-DodLQWPg.js} +1 -1
- package/dist/dist-DtyPVMHR.js +5 -0
- package/dist/{dist-Cb3cLT39.js → dist-HoZO6brh.js} +2 -2
- package/dist/{dist-Cqpjy6bK.js → dist-RNGn_-uD.js} +1 -1
- package/dist/{dist-BBcqvpvP.js → dist-Ux6dL_VB.js} +1 -1
- package/dist/{dist-B8Y11RWn.js → dist-WIWVvdBh.js} +2 -2
- package/dist/{dist-CB6qhQ8K.js → dist-gc9KgJuA.js} +1 -1
- package/dist/{dist-ovDpXuSB.js → dist-i-ud9aCA.js} +1 -1
- package/dist/dist-ko7WnHAO.js +5 -0
- package/dist/{dist-BTQbjEKU.js → dist-lNe4i1Nm.js} +1 -1
- package/dist/dist-of7gLRFK.js +8 -0
- package/dist/{erDiagram-Q2GNP2WA-Cq5Bz5lG.js → erDiagram-Q2GNP2WA-DPMseVVp.js} +10 -10
- package/dist/{error-banner-D0tXnwl4.js → error-banner-BctofTCP.js} +2 -2
- package/dist/{esm-BxMbHo0y.js → esm-BBkPJL8N.js} +29 -27
- package/dist/{flowDiagram-NV44I4VS-6WPJVFl7.js → flowDiagram-NV44I4VS-BpAIFwW7.js} +10 -10
- package/dist/{ganttDiagram-JELNMOA3-AfDhh9CI.js → ganttDiagram-JELNMOA3-DXYghZ9C.js} +3 -3
- package/dist/{gitGraph-G5XIXVHT-C0o6gecv.js → gitGraph-G5XIXVHT-ChHUSAop.js} +2 -2
- package/dist/{gitGraphDiagram-V2S2FVAM-BRSwuj0Q.js → gitGraphDiagram-V2S2FVAM-CBL-7g3_.js} +12 -12
- package/dist/{glide-data-editor-ByPNTNVG.js → glide-data-editor-DAqhWGKz.js} +63 -63
- package/dist/{graphlib-DZnBMcsX.js → graphlib-D18eZCT4.js} +10 -10
- package/dist/hasIn-B9AbGLj3.js +86 -0
- package/dist/{info-VBDWY6EO-Bzsods6X.js → info-VBDWY6EO-CwyXEo8E.js} +2 -2
- package/dist/{infoDiagram-HS3SLOUP-Cmxo6jKx.js → infoDiagram-HS3SLOUP-BXGbfBss.js} +12 -12
- package/dist/{isArrayLikeObject-Btu-i6_P.js → isArrayLikeObject-BrYl-ETg.js} +25 -26
- package/dist/{isEmpty-CZvUtYFp.js → isEmpty-C-xMag79.js} +2 -2
- package/dist/{isString-CBr7TEb7.js → isString-D-vNYDBA.js} +1 -1
- package/dist/{isSymbol-BuQsMXhk.js → isSymbol-Dyt2NSnN.js} +1 -1
- package/dist/{journeyDiagram-XKPGCS4Q-CKYr8cSR.js → journeyDiagram-XKPGCS4Q-D5BIjS4N.js} +3 -3
- package/dist/{kanban-definition-3W4ZIXB7-DVvAZzQD.js → kanban-definition-3W4ZIXB7-DhDkqxFB.js} +7 -7
- package/dist/{label-CV0KYhtH.js → label-BLDcDYdI.js} +6 -6
- package/dist/{loader-eJCvvApN.js → loader-DsE3MiYo.js} +2 -2
- package/dist/main.js +1587 -1108
- package/dist/{memoize-P1T1IGb9.js → memoize-Cs8aS5RW.js} +1 -1
- package/dist/merge-NuyC7LN7.js +51 -0
- package/dist/{mermaid-COOB_abB.js → mermaid-m5QS9ELR.js} +42 -42
- package/dist/{mermaid-parser.core-Cd-wu4tE.js → mermaid-parser.core-OkWZ8nr-.js} +8 -8
- package/dist/{min-CMDDtXJP.js → min-ECVRnCdn.js} +30 -30
- package/dist/{mindmap-definition-VGOIOE7T-1ExmnvYy.js → mindmap-definition-VGOIOE7T-BxQi78Vl.js} +9 -9
- package/dist/{now-BxlRp0OQ.js → now-BC2mX0ZT.js} +1 -1
- package/dist/{packet-DYOGHKS2-Bf1CvFco.js → packet-DYOGHKS2-C62XQjZh.js} +2 -2
- package/dist/{pie-VRWISCQL-LY_wbqji.js → pie-VRWISCQL-nfAKQJw3.js} +2 -2
- package/dist/{pieDiagram-ADFJNKIX-CJlIsdsU.js → pieDiagram-ADFJNKIX-DfSJXUHa.js} +13 -13
- package/dist/{purify.es-CyOIw8ru.js → purify.es-DGenX2XH.js} +67 -67
- package/dist/{quadrantDiagram-AYHSOK5B-BU78RiaH.js → quadrantDiagram-AYHSOK5B-CAcVWXc-.js} +2 -2
- package/dist/{radar-ZZBFDIW7-Ro3iXZCk.js → radar-ZZBFDIW7-lopS8_4j.js} +2 -2
- package/dist/{range-Dh0_-r8P.js → range-BKaWvVUE.js} +8 -8
- package/dist/reduce-CqQo8ppc.js +275 -0
- package/dist/{requirementDiagram-UZGBJVZJ-DACHtrFr.js → requirementDiagram-UZGBJVZJ-BU7dwzFM.js} +9 -9
- package/dist/{sankeyDiagram-TZEHDZUN-Bzg7_UWs.js → sankeyDiagram-TZEHDZUN-BVJnR4_b.js} +2 -2
- package/dist/{sequenceDiagram-WL72ISMW-agybEe9J.js → sequenceDiagram-WL72ISMW-CQcFQTwX.js} +4 -4
- package/dist/{slides-component-B0yK5GXP.js → slides-component-DwvL_HJi.js} +2 -2
- package/dist/{spec-Dq_reDGM.js → spec-DOGtAWuU.js} +5 -5
- package/dist/{stateDiagram-FKZM4ZOC-DehQAt8g.js → stateDiagram-FKZM4ZOC-Dx9AIGDe.js} +12 -12
- package/dist/{stateDiagram-v2-4FDKWEC3-8VzeREl9.js → stateDiagram-v2-4FDKWEC3-BIeUs-Ed.js} +10 -10
- package/dist/style.css +1 -1
- package/dist/{timeline-definition-IT6M3QCI-CdCfdaCF.js → timeline-definition-IT6M3QCI-D8B3p7ID.js} +2 -2
- package/dist/{toNumber-By7s5JC_.js → toNumber-CbZ70FdN.js} +2 -2
- package/dist/{toString-Ckpb50uw.js → toString-DbIAWQpF.js} +2 -2
- package/dist/{tooltip-CL8m4f9y.js → tooltip-SPkubVH3.js} +3 -3
- package/dist/{treemap-GDKQZRPO-DRxfDG65.js → treemap-GDKQZRPO-CkR-5ai2.js} +2 -2
- package/dist/{types-BwnzGcE4.js → types-Dzga1074.js} +519 -408
- package/dist/{uniq-cCc07Q8K.js → uniq-H2E5nMLq.js} +1 -1
- package/dist/{useAsyncData-B4hMFGnF.js → useAsyncData-BlSPOmJU.js} +1 -1
- package/dist/{useDeepCompareMemoize-DuPhOXzr.js → useDeepCompareMemoize-CpGehmfj.js} +5 -5
- package/dist/{useIframeCapabilities-CAt6D2EI.js → useIframeCapabilities-DFGZKWkO.js} +1 -1
- package/dist/{useTheme-BNYQnvu-.js → useTheme-BAtPEkUJ.js} +4 -4
- package/dist/{vega-component-DouPy8AI.js → vega-component-0KINBNtd.js} +10 -10
- package/dist/{xychartDiagram-PRI3JC2R-rEm_SIsC.js → xychartDiagram-PRI3JC2R-XO8FiQjU.js} +5 -5
- package/package.json +9 -9
- package/src/__mocks__/common.ts +41 -8
- package/src/__mocks__/requests.ts +1 -0
- package/src/components/app-config/ai-config.tsx +10 -0
- package/src/components/chat/__tests__/useFileState.test.tsx +2 -3
- package/src/components/chat/acp/__tests__/context-utils.test.ts +2 -6
- package/src/components/datasources/components.tsx +3 -6
- package/src/components/datasources/datasources.tsx +8 -21
- package/src/components/editor/__tests__/data-attributes.test.tsx +2 -11
- package/src/components/editor/actions/types.ts +6 -1
- package/src/components/editor/actions/useNotebookActions.tsx +50 -13
- package/src/components/editor/chrome/types.ts +17 -0
- package/src/components/editor/controls/command-palette.tsx +7 -0
- package/src/components/editor/controls/keyboard-shortcuts.tsx +3 -1
- package/src/components/editor/file-tree/__tests__/requesting-tree.test.ts +2 -3
- package/src/components/editor/file-tree/file-explorer.tsx +48 -62
- package/src/components/editor/file-tree/file-icons.tsx +132 -0
- package/src/components/editor/file-tree/file-viewer.tsx +1 -1
- package/src/components/editor/file-tree/tree-actions.tsx +107 -0
- package/src/components/editor/file-tree/types.ts +2 -96
- package/src/components/editor/header/filename-input.tsx +4 -1
- package/src/components/editor/navigation/__tests__/clipboard.test.ts +2 -4
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +2 -12
- package/src/components/icons/marimo-icons.tsx +2 -2
- package/src/components/pages/home-page.tsx +5 -5
- package/src/components/storage/__tests__/storage-snippets.test.ts +253 -0
- package/src/components/storage/components.tsx +0 -38
- package/src/components/storage/storage-file-viewer.tsx +1 -1
- package/src/components/storage/storage-inspector.tsx +65 -50
- package/src/components/storage/storage-snippets.ts +67 -0
- package/src/components/ui/command.tsx +2 -0
- package/src/components/ui/links.tsx +1 -0
- package/src/core/ai/tools/__tests__/run-cells-tool.test.ts +206 -0
- package/src/core/ai/tools/run-cells-tool.ts +75 -40
- package/src/core/cells/__tests__/cells.test.ts +62 -0
- package/src/core/cells/__tests__/session.test.ts +2 -7
- package/src/core/cells/cells.ts +25 -3
- package/src/core/codemirror/compat/__tests__/jupyter.test.ts +2 -3
- package/src/core/codemirror/markdown/__tests__/commands.test.ts +2 -3
- package/src/core/export/__tests__/hooks.test.ts +3 -10
- package/src/core/hotkeys/__tests__/hotkeys.test.ts +64 -1
- package/src/core/hotkeys/hotkeys.ts +29 -3
- package/src/core/islands/bridge.ts +1 -0
- package/src/core/network/__tests__/requests-network.test.ts +17 -0
- package/src/core/network/requests-lazy.ts +1 -0
- package/src/core/network/requests-network.ts +9 -0
- package/src/core/network/requests-static.ts +1 -0
- package/src/core/network/requests-toasting.tsx +1 -0
- package/src/core/network/types.ts +1 -0
- package/src/core/runtime/__tests__/runtime.test.ts +2 -8
- package/src/core/storage/__tests__/state.test.ts +1 -0
- package/src/core/wasm/bridge.ts +1 -0
- package/src/core/websocket/useMarimoKernelConnection.tsx +2 -0
- package/src/plugins/impl/FileBrowserPlugin.tsx +4 -4
- package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +2 -11
- package/src/plugins/impl/__tests__/DropdownPlugin.test.tsx +2 -11
- package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +309 -0
- package/src/plugins/impl/mpl-interactive/__tests__/mpl-websocket-shim.test.ts +110 -0
- package/src/plugins/impl/mpl-interactive/mpl-websocket-shim.ts +57 -0
- package/src/plugins/impl/plotly/PlotlyPlugin.tsx +8 -2
- package/src/plugins/plugins.ts +2 -0
- package/src/utils/__tests__/download.test.tsx +12 -14
- package/src/utils/__tests__/filenames.test.ts +7 -0
- package/src/utils/__tests__/smartMatch.test.ts +61 -0
- package/src/utils/filenames.ts +3 -0
- package/src/utils/smartMatch.ts +62 -0
- package/dist/_baseProperty-D1nWkRMz.js +0 -93
- package/dist/dist-BAeGo2rp.js +0 -5
- package/dist/dist-BqwCMSEa.js +0 -5
- package/dist/dist-Bum8FwTO.js +0 -6
- package/dist/dist-C0YiOwt_.js +0 -5
- package/dist/dist-C2uPv4iU.js +0 -5
- package/dist/dist-C5hOLsJN.js +0 -8
- package/dist/dist-C9NIAKMs.js +0 -8
- package/dist/dist-CCrzTtvk.js +0 -5
- package/dist/dist-CFS9i1rS.js +0 -8
- package/dist/dist-CyHZuhPH.js +0 -5
- package/dist/dist-CzcjWdIk.js +0 -6
- package/dist/dist-DaYyUSNC.js +0 -5
- package/dist/dist-DpDcJYNh.js +0 -8
- package/dist/dist-U_BfxcPn.js +0 -5
- package/dist/merge-CGQkMGzr.js +0 -51
- package/dist/reduce-BXFHs7IQ.js +0 -268
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
ChevronRightIcon,
|
|
5
|
+
MoreVerticalIcon,
|
|
6
|
+
RefreshCwIcon,
|
|
7
|
+
} from "lucide-react";
|
|
8
|
+
import React, { useCallback, useState } from "react";
|
|
9
|
+
import { Button } from "@/components/ui/button";
|
|
10
|
+
import { Tooltip } from "@/components/ui/tooltip";
|
|
11
|
+
import { cn } from "@/utils/cn";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Animated chevron for tree expand/collapse.
|
|
15
|
+
* Rotates 90° when `isExpanded` is true.
|
|
16
|
+
*/
|
|
17
|
+
export const TreeChevron: React.FC<{
|
|
18
|
+
isExpanded: boolean;
|
|
19
|
+
className?: string;
|
|
20
|
+
}> = ({ isExpanded, className }) => (
|
|
21
|
+
<ChevronRightIcon
|
|
22
|
+
className={cn(
|
|
23
|
+
"shrink-0 transition-transform",
|
|
24
|
+
isExpanded && "rotate-90",
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Refresh button that briefly spins its icon when clicked.
|
|
32
|
+
* Keeps spinning for at least 500ms, or until the onClick Promise resolves.
|
|
33
|
+
*/
|
|
34
|
+
export const RefreshIconButton: React.FC<{
|
|
35
|
+
onClick: (e: React.MouseEvent) => void | Promise<void>;
|
|
36
|
+
tooltip?: string;
|
|
37
|
+
className?: string;
|
|
38
|
+
iconClassName?: string;
|
|
39
|
+
}> = ({ onClick, tooltip = "Refresh", className, iconClassName }) => {
|
|
40
|
+
const [isSpinning, setIsSpinning] = useState(false);
|
|
41
|
+
|
|
42
|
+
const handleClick = useCallback(
|
|
43
|
+
async (e: React.MouseEvent) => {
|
|
44
|
+
setIsSpinning(true);
|
|
45
|
+
// Artificially spin for 500ms to show the user that the button is working.
|
|
46
|
+
const minDelay = new Promise<void>((r) => setTimeout(r, 500));
|
|
47
|
+
try {
|
|
48
|
+
await Promise.all([onClick(e), minDelay]);
|
|
49
|
+
} finally {
|
|
50
|
+
setIsSpinning(false);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
[onClick],
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const button = (
|
|
57
|
+
<Button
|
|
58
|
+
variant="text"
|
|
59
|
+
size="xs"
|
|
60
|
+
className={className}
|
|
61
|
+
onClick={handleClick}
|
|
62
|
+
>
|
|
63
|
+
<RefreshCwIcon
|
|
64
|
+
className={cn(
|
|
65
|
+
"h-4 w-4",
|
|
66
|
+
iconClassName,
|
|
67
|
+
isSpinning && "animate-[spin_0.5s]",
|
|
68
|
+
)}
|
|
69
|
+
/>
|
|
70
|
+
</Button>
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return <Tooltip content={tooltip}>{button}</Tooltip>;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Three-dot menu trigger that fades in on row hover.
|
|
78
|
+
* Must be inside a `group` container.
|
|
79
|
+
* Forwards ref so it works with Radix `asChild`.
|
|
80
|
+
*/
|
|
81
|
+
export const MoreActionsButton = React.forwardRef<
|
|
82
|
+
HTMLButtonElement,
|
|
83
|
+
{
|
|
84
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
85
|
+
className?: string;
|
|
86
|
+
iconClassName?: string;
|
|
87
|
+
} & Omit<React.ComponentPropsWithoutRef<typeof Button>, "variant" | "size">
|
|
88
|
+
>(({ className, iconClassName, ...props }, ref) => (
|
|
89
|
+
<Button
|
|
90
|
+
ref={ref}
|
|
91
|
+
variant="text"
|
|
92
|
+
tabIndex={-1}
|
|
93
|
+
size="xs"
|
|
94
|
+
className={cn(
|
|
95
|
+
"mb-0 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
96
|
+
className,
|
|
97
|
+
)}
|
|
98
|
+
aria-label="More options"
|
|
99
|
+
{...props}
|
|
100
|
+
>
|
|
101
|
+
<MoreVerticalIcon className={cn("w-4 h-4", iconClassName)} />
|
|
102
|
+
</Button>
|
|
103
|
+
));
|
|
104
|
+
MoreActionsButton.displayName = "MoreActionsButton";
|
|
105
|
+
|
|
106
|
+
/** Standard class string for icons inside dropdown menu items. */
|
|
107
|
+
export const MENU_ITEM_ICON_CLASS = "h-3.5 w-3.5 mr-2";
|
|
@@ -1,105 +1,11 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
-
import {
|
|
3
|
-
DatabaseIcon,
|
|
4
|
-
FileAudioIcon,
|
|
5
|
-
FileCodeIcon,
|
|
6
|
-
FileIcon,
|
|
7
|
-
FileImageIcon,
|
|
8
|
-
FileJsonIcon,
|
|
9
|
-
FileTextIcon,
|
|
10
|
-
FileVideo2Icon,
|
|
11
|
-
FolderArchiveIcon,
|
|
12
|
-
FolderIcon,
|
|
13
|
-
type LucideIcon,
|
|
14
|
-
} from "lucide-react";
|
|
15
2
|
|
|
16
|
-
|
|
17
|
-
export type FileType =
|
|
18
|
-
| "directory"
|
|
19
|
-
| "python"
|
|
20
|
-
| "code"
|
|
21
|
-
| "json"
|
|
22
|
-
| "text"
|
|
23
|
-
| "image"
|
|
24
|
-
| "audio"
|
|
25
|
-
| "video"
|
|
26
|
-
| "data"
|
|
27
|
-
| "pdf"
|
|
28
|
-
| "zip"
|
|
29
|
-
| "unknown";
|
|
30
|
-
|
|
31
|
-
export function guessFileType(name: string): FileType {
|
|
32
|
-
const ext = name.split(".").pop();
|
|
33
|
-
if (ext === undefined) {
|
|
34
|
-
return "unknown";
|
|
35
|
-
}
|
|
36
|
-
switch (ext.toLowerCase()) {
|
|
37
|
-
case "py":
|
|
38
|
-
return "python";
|
|
39
|
-
case "txt":
|
|
40
|
-
case "md":
|
|
41
|
-
case "qmd":
|
|
42
|
-
return "text";
|
|
43
|
-
case "png":
|
|
44
|
-
case "jpg":
|
|
45
|
-
case "jpeg":
|
|
46
|
-
case "gif":
|
|
47
|
-
return "image";
|
|
48
|
-
case "csv":
|
|
49
|
-
return "data";
|
|
50
|
-
case "json":
|
|
51
|
-
return "json";
|
|
52
|
-
// Non-exhaustive list of code file extensions
|
|
53
|
-
case "js":
|
|
54
|
-
case "ts":
|
|
55
|
-
case "tsx":
|
|
56
|
-
case "html":
|
|
57
|
-
case "css":
|
|
58
|
-
case "toml":
|
|
59
|
-
case "yaml":
|
|
60
|
-
case "yml":
|
|
61
|
-
case "wasm":
|
|
62
|
-
return "code";
|
|
63
|
-
case "mp3":
|
|
64
|
-
case "m4a":
|
|
65
|
-
case "m4v":
|
|
66
|
-
case "ogg":
|
|
67
|
-
case "wav":
|
|
68
|
-
return "audio";
|
|
69
|
-
case "mp4":
|
|
70
|
-
case "webm":
|
|
71
|
-
case "mkv":
|
|
72
|
-
return "video";
|
|
73
|
-
case "pdf":
|
|
74
|
-
return "pdf";
|
|
75
|
-
case "zip":
|
|
76
|
-
case "tar":
|
|
77
|
-
case "gz":
|
|
78
|
-
return "zip";
|
|
79
|
-
default:
|
|
80
|
-
return "unknown";
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export const FILE_TYPE_ICONS: Record<FileType, LucideIcon> = {
|
|
85
|
-
directory: FolderIcon,
|
|
86
|
-
python: FileCodeIcon,
|
|
87
|
-
json: FileJsonIcon,
|
|
88
|
-
code: FileCodeIcon,
|
|
89
|
-
text: FileTextIcon,
|
|
90
|
-
image: FileImageIcon,
|
|
91
|
-
audio: FileAudioIcon,
|
|
92
|
-
video: FileVideo2Icon,
|
|
93
|
-
pdf: FileCodeIcon,
|
|
94
|
-
zip: FolderArchiveIcon,
|
|
95
|
-
data: DatabaseIcon,
|
|
96
|
-
unknown: FileIcon,
|
|
97
|
-
};
|
|
3
|
+
import type { FileIconType } from "@/components/editor/file-tree/file-icons";
|
|
98
4
|
|
|
99
5
|
const TAB = " ";
|
|
100
6
|
|
|
101
7
|
export const PYTHON_CODE_FOR_FILE_TYPE: Record<
|
|
102
|
-
|
|
8
|
+
FileIconType,
|
|
103
9
|
(path: string) => string
|
|
104
10
|
> = {
|
|
105
11
|
directory: (path) => `os.listdir("${path}")`,
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
import { PopoverAnchor } from "@radix-ui/react-popover";
|
|
4
4
|
import { FilePenIcon } from "lucide-react";
|
|
5
5
|
import { type JSX, useEffect, useRef, useState } from "react";
|
|
6
|
+
import {
|
|
7
|
+
FILE_ICON as FILE_TYPE_ICONS,
|
|
8
|
+
guessFileIconType as guessFileType,
|
|
9
|
+
} from "@/components/editor/file-tree/file-icons";
|
|
6
10
|
import type { FileInfo } from "@/core/network/types";
|
|
7
11
|
import { useAsyncData } from "@/hooks/useAsyncData";
|
|
8
12
|
import { Paths } from "@/utils/paths";
|
|
@@ -15,7 +19,6 @@ import {
|
|
|
15
19
|
CommandList,
|
|
16
20
|
} from "../../ui/command";
|
|
17
21
|
import { Popover, PopoverContent } from "../../ui/popover";
|
|
18
|
-
import { FILE_TYPE_ICONS, guessFileType } from "../file-tree/types";
|
|
19
22
|
|
|
20
23
|
import "./filename-input.css";
|
|
21
24
|
import { getFeatureFlag } from "@/core/config/feature-flag";
|
|
@@ -3,15 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
import { act, renderHook } from "@testing-library/react";
|
|
5
5
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
|
-
import { asMock, Mocks, SetupMocks } from "@/__mocks__/common";
|
|
6
|
+
import { asMock, MockModules, Mocks, SetupMocks } from "@/__mocks__/common";
|
|
7
7
|
import type { CellActions, NotebookState } from "@/core/cells/cells";
|
|
8
8
|
import type { CellId } from "@/core/cells/ids";
|
|
9
9
|
import { useCellClipboard } from "../clipboard";
|
|
10
10
|
|
|
11
11
|
// Mock dependencies
|
|
12
|
-
vi.mock("@/components/ui/use-toast", () => (
|
|
13
|
-
toast: vi.fn(),
|
|
14
|
-
}));
|
|
12
|
+
vi.mock("@/components/ui/use-toast", () => MockModules.toast());
|
|
15
13
|
|
|
16
14
|
vi.mock("@/core/cells/cells", () => ({
|
|
17
15
|
getNotebook: vi.fn(),
|
|
@@ -2,24 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import { fireEvent, render, screen } from "@testing-library/react";
|
|
4
4
|
import { describe, expect, it, vi } from "vitest";
|
|
5
|
+
import { SetupMocks } from "@/__mocks__/common";
|
|
5
6
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
6
7
|
import type { CellId } from "@/core/cells/ids";
|
|
7
8
|
import type { WithResponse } from "@/core/cells/types";
|
|
8
9
|
import type { OutputMessage } from "@/core/kernel/messages";
|
|
9
10
|
import { ConsoleOutput } from "../ConsoleOutput";
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
global.ResizeObserver = class ResizeObserver {
|
|
13
|
-
observe() {
|
|
14
|
-
// noop
|
|
15
|
-
}
|
|
16
|
-
unobserve() {
|
|
17
|
-
// noop
|
|
18
|
-
}
|
|
19
|
-
disconnect() {
|
|
20
|
-
// noop
|
|
21
|
-
}
|
|
22
|
-
};
|
|
12
|
+
SetupMocks.resizeObserver();
|
|
23
13
|
|
|
24
14
|
const renderWithProvider = (ui: React.ReactElement) => {
|
|
25
15
|
return render(<TooltipProvider>{ui}</TooltipProvider>);
|
|
@@ -81,9 +81,9 @@ export const MarimoIcon = ({
|
|
|
81
81
|
width={width ?? size}
|
|
82
82
|
height={height ?? size}
|
|
83
83
|
viewBox={viewBox}
|
|
84
|
+
aria-hidden={true}
|
|
84
85
|
{...props}
|
|
85
86
|
>
|
|
86
|
-
<title>marimo icon</title>
|
|
87
87
|
<MarimoCirclePaths
|
|
88
88
|
fill={fill}
|
|
89
89
|
stroke={stroke ?? "currentColor"}
|
|
@@ -119,9 +119,9 @@ const MarimoMultiIcon = ({
|
|
|
119
119
|
width={width ?? size}
|
|
120
120
|
height={height ?? size}
|
|
121
121
|
viewBox={viewBox}
|
|
122
|
+
aria-hidden={true}
|
|
122
123
|
{...props}
|
|
123
124
|
>
|
|
124
|
-
<title>marimo multi icon</title>
|
|
125
125
|
<defs>
|
|
126
126
|
<mask id={maskId}>
|
|
127
127
|
<rect width="100%" height="100%" fill="white" />
|
|
@@ -23,6 +23,11 @@ import {
|
|
|
23
23
|
} from "react-arborist";
|
|
24
24
|
import { useLocale } from "react-aria";
|
|
25
25
|
import { MarkdownIcon } from "@/components/editor/cell/code/icons";
|
|
26
|
+
import {
|
|
27
|
+
FILE_ICON as FILE_TYPE_ICONS,
|
|
28
|
+
type FileIconType as FileType,
|
|
29
|
+
guessFileIconType as guessFileType,
|
|
30
|
+
} from "@/components/editor/file-tree/file-icons";
|
|
26
31
|
import { useImperativeModal } from "@/components/modal/ImperativeModal";
|
|
27
32
|
import { AlertDialogDestructiveAction } from "@/components/ui/alert-dialog";
|
|
28
33
|
import { Button } from "@/components/ui/button";
|
|
@@ -47,11 +52,6 @@ import { newNotebookURL } from "@/utils/urls";
|
|
|
47
52
|
import { ConfigButton } from "../app-config/app-config-button";
|
|
48
53
|
import { ErrorBoundary } from "../editor/boundary/ErrorBoundary";
|
|
49
54
|
import { ShutdownButton } from "../editor/controls/shutdown-button";
|
|
50
|
-
import {
|
|
51
|
-
FILE_TYPE_ICONS,
|
|
52
|
-
type FileType,
|
|
53
|
-
guessFileType,
|
|
54
|
-
} from "../editor/file-tree/types";
|
|
55
55
|
import {
|
|
56
56
|
Header,
|
|
57
57
|
OpenTutorialDropDown,
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import {
|
|
4
|
+
STORAGE_SNIPPETS,
|
|
5
|
+
type StorageSnippetContext,
|
|
6
|
+
} from "../storage-snippets";
|
|
7
|
+
|
|
8
|
+
const readSnippet = STORAGE_SNIPPETS.find((s) => s.id === "read-file")!;
|
|
9
|
+
const downloadSnippet = STORAGE_SNIPPETS.find((s) => s.id === "download-file")!;
|
|
10
|
+
|
|
11
|
+
function makeCtx(
|
|
12
|
+
overrides: Partial<StorageSnippetContext> = {},
|
|
13
|
+
): StorageSnippetContext {
|
|
14
|
+
return {
|
|
15
|
+
variableName: "store",
|
|
16
|
+
protocol: "s3",
|
|
17
|
+
entry: {
|
|
18
|
+
path: "data/file.csv",
|
|
19
|
+
kind: "object",
|
|
20
|
+
size: 1024,
|
|
21
|
+
lastModified: null,
|
|
22
|
+
},
|
|
23
|
+
backendType: "obstore",
|
|
24
|
+
...overrides,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
describe("read-file snippet", () => {
|
|
29
|
+
it("obstore backend", () => {
|
|
30
|
+
expect(readSnippet.getCode(makeCtx())).toMatchInlineSnapshot(`
|
|
31
|
+
"_data = store.get("data/file.csv").bytes()
|
|
32
|
+
_data"
|
|
33
|
+
`);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("fsspec backend", () => {
|
|
37
|
+
expect(
|
|
38
|
+
readSnippet.getCode(
|
|
39
|
+
makeCtx({ backendType: "fsspec", variableName: "fs" }),
|
|
40
|
+
),
|
|
41
|
+
).toMatchInlineSnapshot(`
|
|
42
|
+
"_data = fs.cat_file("data/file.csv")
|
|
43
|
+
_data"
|
|
44
|
+
`);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("returns null for directories", () => {
|
|
48
|
+
expect(
|
|
49
|
+
readSnippet.getCode(
|
|
50
|
+
makeCtx({
|
|
51
|
+
entry: {
|
|
52
|
+
path: "data/",
|
|
53
|
+
kind: "directory",
|
|
54
|
+
size: 0,
|
|
55
|
+
lastModified: null,
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
),
|
|
59
|
+
).toBeNull();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("escapes double quotes in paths", () => {
|
|
63
|
+
expect(
|
|
64
|
+
readSnippet.getCode(
|
|
65
|
+
makeCtx({
|
|
66
|
+
entry: {
|
|
67
|
+
path: 'data/"file".csv',
|
|
68
|
+
kind: "object",
|
|
69
|
+
size: 100,
|
|
70
|
+
lastModified: null,
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
),
|
|
74
|
+
).toMatchInlineSnapshot(`
|
|
75
|
+
"_data = store.get("data/\\"file\\".csv").bytes()
|
|
76
|
+
_data"
|
|
77
|
+
`);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("escapes backslashes in paths", () => {
|
|
81
|
+
expect(
|
|
82
|
+
readSnippet.getCode(
|
|
83
|
+
makeCtx({
|
|
84
|
+
entry: {
|
|
85
|
+
path: "data\\file.csv",
|
|
86
|
+
kind: "object",
|
|
87
|
+
size: 100,
|
|
88
|
+
lastModified: null,
|
|
89
|
+
},
|
|
90
|
+
}),
|
|
91
|
+
),
|
|
92
|
+
).toMatchInlineSnapshot(`
|
|
93
|
+
"_data = store.get("data\\\\file.csv").bytes()
|
|
94
|
+
_data"
|
|
95
|
+
`);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("escapes newlines and tabs in paths", () => {
|
|
99
|
+
expect(
|
|
100
|
+
readSnippet.getCode(
|
|
101
|
+
makeCtx({
|
|
102
|
+
entry: {
|
|
103
|
+
path: "data/file\nname\there.csv",
|
|
104
|
+
kind: "object",
|
|
105
|
+
size: 100,
|
|
106
|
+
lastModified: null,
|
|
107
|
+
},
|
|
108
|
+
}),
|
|
109
|
+
),
|
|
110
|
+
).toMatchInlineSnapshot(`
|
|
111
|
+
"_data = store.get("data/file\\nname\\there.csv").bytes()
|
|
112
|
+
_data"
|
|
113
|
+
`);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("escapes control characters in paths", () => {
|
|
117
|
+
expect(
|
|
118
|
+
readSnippet.getCode(
|
|
119
|
+
makeCtx({
|
|
120
|
+
entry: {
|
|
121
|
+
path: "data/\u0000\u001F.csv",
|
|
122
|
+
kind: "object",
|
|
123
|
+
size: 100,
|
|
124
|
+
lastModified: null,
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
),
|
|
128
|
+
).toMatchInlineSnapshot(`
|
|
129
|
+
"_data = store.get("data/\\u0000\\u001f.csv").bytes()
|
|
130
|
+
_data"
|
|
131
|
+
`);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe("download-file snippet", () => {
|
|
136
|
+
it("obstore s3 backend", () => {
|
|
137
|
+
expect(downloadSnippet.getCode(makeCtx())).toMatchInlineSnapshot(`
|
|
138
|
+
"from datetime import timedelta
|
|
139
|
+
from obstore import sign
|
|
140
|
+
|
|
141
|
+
signed_url = sign(
|
|
142
|
+
store, "GET", "data/file.csv",
|
|
143
|
+
expires_in=timedelta(hours=1),
|
|
144
|
+
)
|
|
145
|
+
signed_url"
|
|
146
|
+
`);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it("obstore gcs backend", () => {
|
|
150
|
+
expect(
|
|
151
|
+
downloadSnippet.getCode(makeCtx({ protocol: "gcs" })),
|
|
152
|
+
).toMatchInlineSnapshot(`
|
|
153
|
+
"from datetime import timedelta
|
|
154
|
+
from obstore import sign
|
|
155
|
+
|
|
156
|
+
signed_url = sign(
|
|
157
|
+
store, "GET", "data/file.csv",
|
|
158
|
+
expires_in=timedelta(hours=1),
|
|
159
|
+
)
|
|
160
|
+
signed_url"
|
|
161
|
+
`);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it("obstore cloudflare backend", () => {
|
|
165
|
+
expect(
|
|
166
|
+
downloadSnippet.getCode(makeCtx({ protocol: "cloudflare" })),
|
|
167
|
+
).toMatchInlineSnapshot(`
|
|
168
|
+
"from datetime import timedelta
|
|
169
|
+
from obstore import sign
|
|
170
|
+
|
|
171
|
+
signed_url = sign(
|
|
172
|
+
store, "GET", "data/file.csv",
|
|
173
|
+
expires_in=timedelta(hours=1),
|
|
174
|
+
)
|
|
175
|
+
signed_url"
|
|
176
|
+
`);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it("returns null for http obstore (not signable)", () => {
|
|
180
|
+
expect(downloadSnippet.getCode(makeCtx({ protocol: "http" }))).toBeNull();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it("returns null for file obstore (not signable)", () => {
|
|
184
|
+
expect(downloadSnippet.getCode(makeCtx({ protocol: "file" }))).toBeNull();
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it("returns null for in-memory obstore (not signable)", () => {
|
|
188
|
+
expect(
|
|
189
|
+
downloadSnippet.getCode(makeCtx({ protocol: "in-memory" })),
|
|
190
|
+
).toBeNull();
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it("fsspec backend", () => {
|
|
194
|
+
expect(
|
|
195
|
+
downloadSnippet.getCode(
|
|
196
|
+
makeCtx({ backendType: "fsspec", variableName: "fs" }),
|
|
197
|
+
),
|
|
198
|
+
).toMatchInlineSnapshot(`"fs.get("data/file.csv", "file.csv")"`);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it("fsspec backend with nested path", () => {
|
|
202
|
+
expect(
|
|
203
|
+
downloadSnippet.getCode(
|
|
204
|
+
makeCtx({
|
|
205
|
+
backendType: "fsspec",
|
|
206
|
+
variableName: "fs",
|
|
207
|
+
entry: {
|
|
208
|
+
path: "nested/dir/report.parquet",
|
|
209
|
+
kind: "file",
|
|
210
|
+
size: 500,
|
|
211
|
+
lastModified: null,
|
|
212
|
+
},
|
|
213
|
+
}),
|
|
214
|
+
),
|
|
215
|
+
).toMatchInlineSnapshot(
|
|
216
|
+
`"fs.get("nested/dir/report.parquet", "report.parquet")"`,
|
|
217
|
+
);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it("returns null for directories", () => {
|
|
221
|
+
expect(
|
|
222
|
+
downloadSnippet.getCode(
|
|
223
|
+
makeCtx({
|
|
224
|
+
entry: {
|
|
225
|
+
path: "data/",
|
|
226
|
+
kind: "directory",
|
|
227
|
+
size: 0,
|
|
228
|
+
lastModified: null,
|
|
229
|
+
},
|
|
230
|
+
}),
|
|
231
|
+
),
|
|
232
|
+
).toBeNull();
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
describe("all snippets return null for directories", () => {
|
|
237
|
+
for (const snippet of STORAGE_SNIPPETS) {
|
|
238
|
+
it(`${snippet.id} returns null for directory entries`, () => {
|
|
239
|
+
expect(
|
|
240
|
+
snippet.getCode(
|
|
241
|
+
makeCtx({
|
|
242
|
+
entry: {
|
|
243
|
+
path: "some-dir/",
|
|
244
|
+
kind: "directory",
|
|
245
|
+
size: 0,
|
|
246
|
+
lastModified: null,
|
|
247
|
+
},
|
|
248
|
+
}),
|
|
249
|
+
),
|
|
250
|
+
).toBeNull();
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
});
|
|
@@ -8,15 +8,9 @@ import CoreweaveIcon from "@marimo-team/llm-info/icons/coreweave.svg?inline";
|
|
|
8
8
|
import CoreweaveDarkIcon from "@marimo-team/llm-info/icons/coreweave-dark.svg?inline";
|
|
9
9
|
import {
|
|
10
10
|
DatabaseZapIcon,
|
|
11
|
-
FileCodeIcon,
|
|
12
|
-
FileIcon,
|
|
13
|
-
FileSpreadsheetIcon,
|
|
14
|
-
FileTextIcon,
|
|
15
|
-
FileVideoIcon,
|
|
16
11
|
GithubIcon,
|
|
17
12
|
GlobeIcon,
|
|
18
13
|
HardDriveIcon,
|
|
19
|
-
ImageIcon,
|
|
20
14
|
} from "lucide-react";
|
|
21
15
|
import GoogleCloudIcon from "@/components/databases/icons/google-cloud-storage.svg?inline";
|
|
22
16
|
import GoogleDriveIcon from "@/components/databases/icons/google-drive.svg?inline";
|
|
@@ -24,38 +18,6 @@ import type { KnownStorageProtocol } from "@/core/storage/types";
|
|
|
24
18
|
import { useTheme } from "@/theme/useTheme";
|
|
25
19
|
import { cn } from "@/utils/cn";
|
|
26
20
|
|
|
27
|
-
export function renderFileIcon(name: string): React.ReactNode {
|
|
28
|
-
const ext = name.split(".").pop()?.toLowerCase();
|
|
29
|
-
switch (ext) {
|
|
30
|
-
case "png":
|
|
31
|
-
case "jpg":
|
|
32
|
-
case "jpeg":
|
|
33
|
-
case "gif":
|
|
34
|
-
case "svg":
|
|
35
|
-
case "webp":
|
|
36
|
-
return <ImageIcon className="h-3.5 w-3.5 text-purple-500" />;
|
|
37
|
-
case "csv":
|
|
38
|
-
case "parquet":
|
|
39
|
-
case "arrow":
|
|
40
|
-
case "xlsx":
|
|
41
|
-
return <FileSpreadsheetIcon className="h-3.5 w-3.5 text-green-500" />;
|
|
42
|
-
case "py":
|
|
43
|
-
case "js":
|
|
44
|
-
case "ts":
|
|
45
|
-
case "json":
|
|
46
|
-
return <FileCodeIcon className="h-3.5 w-3.5 text-blue-500" />;
|
|
47
|
-
case "mp4":
|
|
48
|
-
case "mpeg":
|
|
49
|
-
return <FileVideoIcon className="h-3.5 w-3.5 text-orange-500" />;
|
|
50
|
-
case "txt":
|
|
51
|
-
case "md":
|
|
52
|
-
case "log":
|
|
53
|
-
return <FileTextIcon className="h-3.5 w-3.5 text-muted-foreground" />;
|
|
54
|
-
default:
|
|
55
|
-
return <FileIcon className="h-3.5 w-3.5 text-muted-foreground" />;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
21
|
type IconEntry =
|
|
60
22
|
| { src: string; dark?: string }
|
|
61
23
|
| React.ComponentType<{ className?: string }>;
|
|
@@ -5,6 +5,7 @@ import type React from "react";
|
|
|
5
5
|
import { useCallback } from "react";
|
|
6
6
|
import { useLocale } from "react-aria";
|
|
7
7
|
import { FilePreviewHeader } from "@/components/editor/file-tree/file-header";
|
|
8
|
+
import { renderFileIcon } from "@/components/editor/file-tree/file-icons";
|
|
8
9
|
import {
|
|
9
10
|
FileContentRenderer,
|
|
10
11
|
isMediaMime,
|
|
@@ -18,7 +19,6 @@ import { formatBytes } from "@/utils/formatting";
|
|
|
18
19
|
import { Logger } from "@/utils/Logger";
|
|
19
20
|
import { CopyClipboardIcon } from "../icons/copy-icon";
|
|
20
21
|
import { Button } from "../ui/button";
|
|
21
|
-
import { renderFileIcon } from "./components";
|
|
22
22
|
|
|
23
23
|
const MAX_MEDIA_PREVIEW_SIZE = 100 * 1024 * 1024; // 100 MB
|
|
24
24
|
|