@nextclaw/ui 0.15.3 → 0.15.5
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/CHANGELOG.md +38 -0
- package/dist/assets/abnfDiagram-VRR7QNED-BYpK0F5F.js +1 -0
- package/dist/assets/aiden0z-pptx-renderer.es-D87ywFdC.js +94 -0
- package/dist/assets/api-IlX_CbwU.js +13 -0
- package/dist/assets/app-presenter-provider-Bbl_MVbg.js +106 -0
- package/dist/assets/app-presenter-provider-D3BuuOyZ.css +1 -0
- package/dist/assets/appearance-settings-page-80fLa4-9.js +1 -0
- package/dist/assets/arc-DFELHWM2.js +1 -0
- package/dist/assets/architecture-TIHT7OUA-ClwVFq-K.js +1 -0
- package/dist/assets/architectureDiagram-ZJ3FMSHR-CvRhdovL.js +36 -0
- package/dist/assets/array-BqYdCIE6.js +1 -0
- package/dist/assets/blockDiagram-677ZJIJ3-DVYNkbR_.js +132 -0
- package/dist/assets/{book-open-C3mJGwiy.js → book-open-CN7Shpij.js} +1 -1
- package/dist/assets/c4Diagram-LMCZKHZV-B1w-iwRe.js +10 -0
- package/dist/assets/channel-BEHOSFc5.js +1 -0
- package/dist/assets/channels-list-page-R7M6pzp6.js +8 -0
- package/dist/assets/chat-page-152YuwfU.js +1 -0
- package/dist/assets/chunk-2Q5K7J3B-DrIhesSX.js +1 -0
- package/dist/assets/chunk-32BRIVSS-kG3lg0bC.js +1 -0
- package/dist/assets/chunk-52WLFC77-BLeB7iGk.js +10 -0
- package/dist/assets/chunk-5FCAYU7R-BQga1Rr7.js +1 -0
- package/dist/assets/chunk-5HE753X5-DU81hkcF.js +1 -0
- package/dist/assets/chunk-5JV3BV7I-C2bAx0m7.js +1 -0
- package/dist/assets/chunk-5TONJI2A-BExIIgWY.js +2 -0
- package/dist/assets/chunk-5VM5RSS4-C3XB05yh.js +15 -0
- package/dist/assets/chunk-7BUUIJ7U-JiyRtrGu.js +1 -0
- package/dist/assets/chunk-BIQX33UG-BZRV20pI.js +1 -0
- package/dist/assets/chunk-C7G6YPKG-AsyDSQ9j.js +1 -0
- package/dist/assets/chunk-CQNSW5MT-iN-fiXVA.js +1 -0
- package/dist/assets/chunk-CYSBUYHQ-DhC_TRzI.js +1 -0
- package/dist/assets/chunk-DseTPa7n.js +1 -0
- package/dist/assets/chunk-EMLP6XTP-QFLK8R6d.js +1 -0
- package/dist/assets/chunk-EX3LRPZG-DzUwhkCz.js +231 -0
- package/dist/assets/chunk-FWX5IMBZ-DFelpZBy.js +2 -0
- package/dist/assets/chunk-HOUHSVGY-BMPwFEwN.js +1 -0
- package/dist/assets/chunk-ICXQ74PX-DH8NJMok.js +2 -0
- package/dist/assets/chunk-JG7HCLWE-D-95AsO4.js +2 -0
- package/dist/assets/chunk-JWPE2WC7-DIaTv8kx.js +1 -0
- package/dist/assets/chunk-KEIR6QF5-A3jEqwzn.js +161 -0
- package/dist/assets/chunk-MOJQB5TN-BPFLzWgj.js +88 -0
- package/dist/assets/chunk-MOZMSUNE-DR_fzxG0.js +1 -0
- package/dist/assets/chunk-OGEWGWER-TIcEoPPH.js +1 -0
- package/dist/assets/chunk-OSBZ3O6U-BALNvSfG.js +1 -0
- package/dist/assets/chunk-PUDLZKDR-I-EXhf_k.js +156 -0
- package/dist/assets/chunk-Q4XR5HBZ-uvIGstBS.js +70 -0
- package/dist/assets/chunk-QBLGF6JB-r-TjLdxa.js +1 -0
- package/dist/assets/chunk-R7FJI6CG-N-1LDgvy.js +1 -0
- package/dist/assets/chunk-RYQCIY6F-jxNASx65.js +1 -0
- package/dist/assets/chunk-U6XO7XAA-Cphbuc7q.js +2 -0
- package/dist/assets/chunk-V7JOEXUC-BLEuBf1s.js +206 -0
- package/dist/assets/chunk-VAUOI2AC-Dpcz6BhT.js +1 -0
- package/dist/assets/chunk-VR4S4FIN-BAUbR0ke.js +1 -0
- package/dist/assets/chunk-WYO6CB5R-Do6SJrnY.js +127 -0
- package/dist/assets/chunk-XXDRQBXY-C2QjjwYX.js +1 -0
- package/dist/assets/chunk-Y2CYZVJY-BGrd8tLy.js +1 -0
- package/dist/assets/chunk-YOTPTUD7-CQqvMTCr.js +1 -0
- package/dist/assets/chunk-ZGVPDNZ5-B7kWWaXv.js +62 -0
- package/dist/assets/chunk-ZIRB5QZD-DTU0cDNh.js +32 -0
- package/dist/assets/classDiagram-OUVF2IWQ-DESMaY3_.js +1 -0
- package/dist/assets/classDiagram-v2-EOCWNBFH-DwOlByYH.js +1 -0
- package/dist/assets/config-split-page-BlfvfmTm.js +1 -0
- package/dist/assets/confirm-dialog-Dt8Kdbgp.js +5 -0
- package/dist/assets/cose-bilkent-JH36ORCC-B9LrtV-q.js +1 -0
- package/dist/assets/cynefin-VYW2F7L2-CzjeeOq9.js +1 -0
- package/dist/assets/cynefinDiagram-TSTJHNR4-BfjvW4su.js +62 -0
- package/dist/assets/cytoscape.esm-CRW8q92n.js +321 -0
- package/dist/assets/dagre-DkiXZKkL.js +1 -0
- package/dist/assets/dagre-VKFMJZFB-B1pQKQSY.js +4 -0
- package/dist/assets/defaultLocale-Cdv9x6q7.js +1 -0
- package/dist/assets/desktop-update-config-DreMJu9z.js +1 -0
- package/dist/assets/diagram-FQU43EPY-cB4EZdaP.js +3 -0
- package/dist/assets/diagram-G47NLZAW-CtW8im1B.js +24 -0
- package/dist/assets/diagram-NH7WQ7WH-BDCtrCCm.js +24 -0
- package/dist/assets/diagram-OA4YK3LP-DEMJ42Gt.js +30 -0
- package/dist/assets/diagram-WEI45ONY-CdCcxSYU.js +41 -0
- package/dist/assets/dist-D5ycbwCo.js +41 -0
- package/dist/assets/dist-dw-gAfM_.js +1 -0
- package/dist/assets/doc-browser-C9u7N9vH.js +1 -0
- package/dist/assets/doc-browser-DJQ5XPsi2.js +1 -0
- package/dist/assets/doc-browser-context-CCdW9TJf.js +1 -0
- package/dist/assets/docx-preview-zis3U0Fa.js +20 -0
- package/dist/assets/download-CyPgglKr.js +1 -0
- package/dist/assets/ebnfDiagram-CCIWWBDH-DBZETBwE.js +1 -0
- package/dist/assets/erDiagram-Q63AITRT-y2zDXprP.js +85 -0
- package/dist/assets/eventmodeling-45OFAUF4-C38BqG8w.js +1 -0
- package/dist/assets/{external-link-CU0kzzIP.js → external-link-BahW1sl3.js} +1 -1
- package/dist/assets/eye-D8gGXMkD.js +1 -0
- package/dist/assets/flowDiagram-23GEKE2U-BoKk8RRq.js +1 -0
- package/dist/assets/folder-DGWqFDvE.js +1 -0
- package/dist/assets/{form-actions-BvCp_0lS.js → form-actions-D2imZLnU.js} +1 -1
- package/dist/assets/ganttDiagram-NO4QXBWP-D2DP344e.js +292 -0
- package/dist/assets/gitGraph-TEB2WS4Q-IsQHHJuS.js +1 -0
- package/dist/assets/gitGraphDiagram-IHSO6WYX-D37uiwA2.js +106 -0
- package/dist/assets/graphlib-BcNFQr5y.js +1 -0
- package/dist/assets/index-0av6WO9-.css +1 -0
- package/dist/assets/index-CT0iYlxV.js +2 -0
- package/dist/assets/info-DKCQHKI2-ofy2qlHI.js +1 -0
- package/dist/assets/infoDiagram-FWYZ7A6U-CG-WAIRi.js +2 -0
- package/dist/assets/init-D8TjIqfm.js +1 -0
- package/dist/assets/ishikawaDiagram-FXEZZL3T-WeCTnW0f.js +70 -0
- package/dist/assets/journeyDiagram-5HDEW3XC-DUFBW9Td.js +139 -0
- package/dist/assets/jszip.min-CP5uPNQa.js +2 -0
- package/dist/assets/kanban-definition-HUTT4EX6-B0lxgMpg.js +89 -0
- package/dist/assets/katex-wEmrEFTg.js +257 -0
- package/dist/assets/line-B78frP_c.js +1 -0
- package/dist/assets/linear-C6lVEcb2.js +1 -0
- package/dist/assets/loader-circle-DtKek-qG.js +1 -0
- package/dist/assets/logo-badge-CuPetu-v.js +1 -0
- package/dist/assets/map-Bdri5UL5.js +1 -0
- package/dist/assets/mcp-marketplace-page-4qMwFDpz.js +1 -0
- package/dist/assets/mcp-marketplace-page-BbxN5aZF.js +9 -0
- package/dist/assets/mermaid-parser.core-Cue18vLo.js +4 -0
- package/dist/assets/mermaid.core-CXwWRh5i.js +11 -0
- package/dist/assets/mindmap-definition-LN4V7U3C-CFxz0P0-.js +96 -0
- package/dist/assets/model-config-page-DiJcvBML.js +1 -0
- package/dist/assets/ordinal-Cbd8t4LB.js +1 -0
- package/dist/assets/packet-7NZHBO7P-Rfopfa1o.js +1 -0
- package/dist/assets/path-DzBnMI1r.js +1 -0
- package/dist/assets/pegDiagram-2B236MQR-B_Qt9zyT.js +1 -0
- package/dist/assets/pie-RZYD4A2V-CJR1xKEv.js +1 -0
- package/dist/assets/pieDiagram-ENE6RG2P-CRQdSuwS.js +39 -0
- package/dist/assets/plus-BwgE-Zwf.js +1 -0
- package/dist/assets/popover-Btp7KVc3.js +1 -0
- package/dist/assets/preload-helper-D4M6sveU.js +1 -0
- package/dist/assets/provider-models-BoUhFo9R.js +1 -0
- package/dist/assets/provider-scoped-model-input-DZMtoAJG.js +1 -0
- package/dist/assets/providers-config-page-DfiWveEF.js +1 -0
- package/dist/assets/quadrantDiagram-ABIIQ3AL-D5kPpttq.js +7 -0
- package/dist/assets/radar-I7S5WNFK-CDg8Z-1r.js +1 -0
- package/dist/assets/railroad-3IZDKUUU-BHnNmjxO.js +1 -0
- package/dist/assets/railroad-abnf-AHOZXSZD-DGtNcusW.js +1 -0
- package/dist/assets/railroad-ebnf-EBAXGLYW-BRFtsQmm.js +1 -0
- package/dist/assets/railroad-peg-LSFZ7HO6-Bj5IypCA.js +1 -0
- package/dist/assets/railroadDiagram-RFXS5EU6-DGh_TGlQ.js +1 -0
- package/dist/assets/react-BY-U3h3t.js +8 -0
- package/dist/assets/{refresh-cw-CILd1vAP.js → refresh-cw-Cme5qFej.js} +1 -1
- package/dist/assets/remote-BaVECEZw.js +1 -0
- package/dist/assets/requirementDiagram-TGXJPOKE-EmFph0H_.js +84 -0
- package/dist/assets/rotate-cw-CMRZxIkH.js +1 -0
- package/dist/assets/rough.esm-wJ1d3nQl.js +1 -0
- package/dist/assets/runtime-config-page-wygwvMB4.js +1 -0
- package/dist/assets/sankeyDiagram-HTMAVEWB-BXWB5Ugi.js +40 -0
- package/dist/assets/{save-ByJqcPTP.js → save-DNg2yJTS.js} +1 -1
- package/dist/assets/{search-DVIV6pfD.js → search-3ykfrAFt.js} +1 -1
- package/dist/assets/search-config-page-DrVKa_Ls.js +1 -0
- package/dist/assets/secrets-config-page-B39uQ5kF.js +3 -0
- package/dist/assets/security-config-BPzet76z.js +1 -0
- package/dist/assets/select-B5EecXJt.js +1 -0
- package/dist/assets/sequenceDiagram-DBY2YBRQ-ClKnO7v0.js +162 -0
- package/dist/assets/setting-row-Qv1Ps79v.js +1 -0
- package/dist/assets/{settings-2-CH5shGg_.js → settings-2-D-3um9Az.js} +1 -1
- package/dist/assets/sizeCapture-X5ZJPWSS-DSo-t5ou.js +1 -0
- package/dist/assets/{skeleton-DeX1FKw7.js → skeleton-BgkzQd4U.js} +1 -1
- package/dist/assets/src-Dad2ZbCt.js +1 -0
- package/dist/assets/stateDiagram-2N3HPSRC-BvAalBfz.js +1 -0
- package/dist/assets/stateDiagram-v2-6OUMAXLB-CfMU38yc.js +1 -0
- package/dist/assets/swimlanes-5IMT3BWC-DdVqVa1a.js +2 -0
- package/dist/assets/swimlanesDiagram-G3AALYLV-D9Zb9X57.js +8 -0
- package/dist/assets/tabs-BVD8gp3y.js +1 -0
- package/dist/assets/tag-chip-0qn-f3Bo.js +1 -0
- package/dist/assets/timeline-definition-FHXFAJF6-D4ar8IQY.js +120 -0
- package/dist/assets/trash-2-cnsMppRC.js +1 -0
- package/dist/assets/treeView-QDETBFTQ-Uy7M0WvH.js +1 -0
- package/dist/assets/treemap-6X3UGDF4-BJfGV7KX.js +1 -0
- package/dist/assets/use-config-D6yx0lb0.js +1 -0
- package/dist/assets/use-confirm-dialog-C_o0eQeH.js +1 -0
- package/dist/assets/use-viewport-layout-BWav4KCL.js +1 -0
- package/dist/assets/vennDiagram-L72KCM5P-CDXJ_i3p.js +34 -0
- package/dist/assets/wardley-OPB4EBWU-q263iF3K.js +1 -0
- package/dist/assets/wardleyDiagram-EHGQE667-D-dSuT_7.js +78 -0
- package/dist/assets/x-B3o1dWR5.js +1 -0
- package/dist/assets/xlsx-DUqJhg5u.js +64 -0
- package/dist/assets/xychartDiagram-FW5EYKEG-C9JCzsZF.js +7 -0
- package/dist/index.html +35 -28
- package/package.json +11 -6
- package/src/features/chat/components/chat-popover-content.tsx +1 -0
- package/src/features/chat/components/conversation/__tests__/chat-conversation-content.test.tsx +13 -0
- package/src/features/chat/components/conversation/__tests__/chat-conversation-header-section.test.tsx +21 -11
- package/src/features/chat/components/conversation/__tests__/chat-conversation-header.test.tsx +2 -2
- package/src/features/chat/components/conversation/__tests__/chat-conversation-workspace-section.test.tsx +28 -1
- package/src/features/chat/components/conversation/chat-conversation-content.tsx +5 -4
- package/src/features/chat/components/conversation/chat-conversation-header-section.tsx +9 -18
- package/src/features/chat/components/conversation/chat-conversation-track.tsx +35 -0
- package/src/features/chat/components/conversation/chat-conversation-workspace-section.tsx +2 -0
- package/src/features/chat/components/layout/chat-sidebar-toolbar.tsx +7 -7
- package/src/features/chat/components/layout/chat-sidebar-utility-menu.tsx +3 -14
- package/src/features/chat/features/conversation/components/__tests__/session-conversation-input.streaming.test.tsx +20 -1
- package/src/features/chat/features/conversation/components/session-conversation-input.tsx +97 -65
- package/src/features/chat/features/input/input-surface-plugins/__tests__/slash-command-plugin.test.ts +43 -0
- package/src/features/chat/features/input/input-surface-plugins/slash-command-plugin.utils.ts +14 -10
- package/src/features/chat/features/input/utils/__tests__/chat-input-bar.utils.test.ts +51 -0
- package/src/features/chat/features/input/utils/chat-input-bar.utils.ts +61 -21
- package/src/features/chat/features/message/components/__tests__/chat-message-list.container.test.tsx +42 -10
- package/src/features/chat/features/message/components/chat-inline-file-preview.tsx +80 -0
- package/src/features/chat/features/message/components/chat-message-list.container.tsx +66 -56
- package/src/features/chat/features/message/utils/__tests__/chat-message-file-operation.utils.test.ts +30 -0
- package/src/features/chat/features/message/utils/chat-message-texts.utils.ts +2 -0
- package/src/features/chat/features/session/components/__tests__/chat-sidebar-session-item.test.tsx +37 -0
- package/src/features/chat/features/session/components/chat-sidebar-project-groups.tsx +4 -3
- package/src/features/chat/features/session/components/chat-sidebar-session-item.tsx +3 -8
- package/src/features/chat/features/session/components/session-header/__tests__/chat-session-header-actions.test.tsx +65 -20
- package/src/features/chat/features/session/components/session-header/chat-session-header-actions.tsx +26 -28
- package/src/features/chat/features/session/components/session-header/chat-session-project-badge.tsx +3 -3
- package/src/features/chat/features/session/components/session-header/chat-session-title-switcher.tsx +3 -3
- package/src/features/chat/features/welcome/components/chat-welcome-project-picker.tsx +3 -3
- package/src/features/chat/features/welcome/components/chat-welcome-session-type-picker.tsx +3 -3
- package/src/features/chat/features/workspace/components/__tests__/chat-session-workspace-file-preview.test.tsx +424 -129
- package/src/features/chat/features/workspace/components/__tests__/chat-session-workspace-panel-content.test.tsx +113 -2
- package/src/features/chat/features/workspace/components/__tests__/chat-session-workspace-panel.test.tsx +3 -1
- package/src/features/chat/features/workspace/components/chat-session-workspace-directory-browser.tsx +197 -44
- package/src/features/chat/features/workspace/components/chat-session-workspace-file-breadcrumb-browser.tsx +9 -3
- package/src/features/chat/features/workspace/components/chat-session-workspace-file-breadcrumbs.tsx +13 -22
- package/src/features/chat/features/workspace/components/chat-session-workspace-file-preview.tsx +96 -194
- package/src/features/chat/features/workspace/components/chat-session-workspace-panel-content.tsx +239 -1
- package/src/features/chat/features/workspace/components/chat-session-workspace-panel-nav.tsx +61 -7
- package/src/features/chat/features/workspace/components/chat-session-workspace-panel.tsx +34 -8
- package/src/features/chat/features/workspace/components/file-content-preview/use-workspace-file-buffer.ts +42 -0
- package/src/features/chat/features/workspace/components/file-content-preview/workspace-document-preview-state.tsx +18 -0
- package/src/features/chat/features/workspace/components/file-content-preview/workspace-docx-preview.css +89 -0
- package/src/features/chat/features/workspace/components/file-content-preview/workspace-docx-preview.tsx +87 -0
- package/src/features/chat/features/workspace/components/file-content-preview/workspace-presentation-preview.tsx +82 -0
- package/src/features/chat/features/workspace/components/file-content-preview/workspace-spreadsheet-preview.tsx +180 -0
- package/src/features/chat/features/workspace/components/workspace-file-content-preview.tsx +191 -0
- package/src/features/chat/features/workspace/hooks/use-chat-conversation-workspace-state.ts +1 -4
- package/src/features/chat/features/workspace/utils/__tests__/chat-workspace-panel-view-model.utils.test.ts +157 -13
- package/src/features/chat/features/workspace/utils/chat-thread-workspace-session.utils.ts +151 -2
- package/src/features/chat/features/workspace/utils/chat-workspace-file-tab-persistence.utils.ts +17 -0
- package/src/features/chat/features/workspace/utils/chat-workspace-file-tab.utils.ts +66 -0
- package/src/features/chat/features/workspace/utils/chat-workspace-file-viewer.utils.ts +49 -0
- package/src/features/chat/features/workspace/utils/chat-workspace-panel-layout.utils.ts +13 -0
- package/src/features/chat/features/workspace/utils/chat-workspace-panel-view-model.utils.ts +196 -43
- package/src/features/chat/index.ts +1 -0
- package/src/features/chat/managers/__tests__/chat-thread-workspace.manager.test.ts +101 -0
- package/src/features/chat/managers/__tests__/chat-thread.manager.test.ts +48 -60
- package/src/features/chat/managers/chat-session-list.manager.ts +1 -0
- package/src/features/chat/managers/chat-thread.manager.ts +137 -162
- package/src/features/chat/pages/ncp-chat-page.tsx +1 -2
- package/src/features/chat/stores/__tests__/chat-thread.store.test.ts +87 -1
- package/src/features/chat/stores/chat-message-layout.store.test.ts +37 -0
- package/src/features/chat/stores/chat-message-layout.store.ts +41 -0
- package/src/features/chat/stores/chat-thread.store.ts +77 -40
- package/src/features/chat/types/chat-input-bar.types.ts +2 -0
- package/src/features/settings/pages/__tests__/appearance-settings-page.test.tsx +25 -8
- package/src/features/settings/pages/appearance-settings-page.tsx +92 -13
- package/src/index.css +36 -2
- package/src/shared/components/__tests__/file-type-icon.test.tsx +61 -0
- package/src/shared/components/common/__tests__/brand-header.test.tsx +17 -7
- package/src/shared/components/common/brand-header.tsx +34 -34
- package/src/shared/components/doc-browser/__tests__/doc-browser-context.test.tsx +19 -0
- package/src/shared/components/doc-browser/__tests__/doc-browser.test.tsx +16 -0
- package/src/shared/components/doc-browser/doc-browser-context.tsx +1 -0
- package/src/shared/components/doc-browser/doc-browser.tsx +11 -3
- package/src/shared/components/doc-browser/managers/doc-browser.manager.ts +5 -0
- package/src/shared/components/doc-browser/stores/doc-browser.store.ts +6 -1
- package/src/shared/components/doc-browser/types/doc-browser.types.ts +2 -0
- package/src/shared/components/doc-browser/utils/doc-browser-state.utils.ts +11 -0
- package/src/shared/components/file-type-icon.tsx +272 -0
- package/src/shared/components/resizable-right-panel/__tests__/resizable-right-panel.test.tsx +22 -0
- package/src/shared/components/resizable-right-panel/resizable-right-panel.tsx +17 -2
- package/src/shared/components/ui/tab-strip/__tests__/compact-tab-strip.test.tsx +38 -0
- package/src/shared/components/ui/tab-strip/compact-tab-strip.tsx +82 -2
- package/src/shared/hooks/use-server-path-read.ts +10 -5
- package/src/shared/lib/api/__tests__/server-path.utils.test.ts +28 -0
- package/src/shared/lib/api/types.ts +3 -3
- package/src/shared/lib/api/utils/server-path.utils.ts +20 -20
- package/src/shared/lib/i18n/locales/en-US/chat.json +25 -1
- package/src/shared/lib/i18n/locales/en-US/core.json +6 -0
- package/src/shared/lib/i18n/locales/zh-CN/chat.json +25 -1
- package/src/shared/lib/i18n/locales/zh-CN/core.json +6 -0
- package/src/shared/lib/session-project/__tests__/workspace-file-breadcrumb.test.ts +1 -4
- package/src/shared/lib/session-project/workspace-file-breadcrumb.utils.ts +1 -18
- package/dist/assets/api-iNBpppzj.js +0 -13
- package/dist/assets/appearance-settings-page-DMffQFR3.js +0 -1
- package/dist/assets/channels-list-page-CCtp0BRS.js +0 -8
- package/dist/assets/chat-page-H5a0dWvO.js +0 -1
- package/dist/assets/config-split-page-CrOJgB-Y.js +0 -1
- package/dist/assets/confirm-dialog-Chv50USy.js +0 -5
- package/dist/assets/desktop-update-config-KzTuXRf_.js +0 -1
- package/dist/assets/dist-BunzmC4B.js +0 -1
- package/dist/assets/dist-ChmGwvtK.js +0 -1
- package/dist/assets/doc-browser-DNRL4Zvd.js +0 -1
- package/dist/assets/doc-browser-Dg0pmkOg.js +0 -1
- package/dist/assets/doc-browser-context-BHY-0FSD.js +0 -1
- package/dist/assets/es2015-DQZ5JWwK.js +0 -41
- package/dist/assets/i18n-provider-Cu8XyZb_.js +0 -1
- package/dist/assets/index-CzfBdvK1.css +0 -1
- package/dist/assets/index-DGqHne1Q.js +0 -104
- package/dist/assets/loader-circle-CDSFuzmk.js +0 -1
- package/dist/assets/mcp-marketplace-page-BeEQK0DL.js +0 -9
- package/dist/assets/mcp-marketplace-page-D6idOTLp.js +0 -1
- package/dist/assets/model-config-page-bNNo-XyG.js +0 -1
- package/dist/assets/plus-D4DsdLN-.js +0 -1
- package/dist/assets/provider-scoped-model-input-IlgQCsoT.js +0 -1
- package/dist/assets/providers-config-page-wLo6CAJw.js +0 -1
- package/dist/assets/react-BPIsQIlO.js +0 -8
- package/dist/assets/remote-uKEYp7AR.js +0 -1
- package/dist/assets/rotate-cw-wPFPg1kH.js +0 -1
- package/dist/assets/runtime-config-page-DDn1sP4G.js +0 -1
- package/dist/assets/search-config-page-B-Cf4iiB.js +0 -1
- package/dist/assets/secrets-config-page-DPKsY8Iw.js +0 -3
- package/dist/assets/security-config-e9SSBlKr.js +0 -1
- package/dist/assets/select-BdgczSNw.js +0 -1
- package/dist/assets/setting-row-BkTVUTKx.js +0 -1
- package/dist/assets/side-dock-BsBvcJ9i.js +0 -3
- package/dist/assets/switch-Cv8Ekb3x.js +0 -1
- package/dist/assets/tag-chip-RB9uKcoC.js +0 -1
- package/dist/assets/tooltip-oQlEN-l6.js +0 -1
- package/dist/assets/use-config-l3W7y8Qz.js +0 -1
- package/dist/assets/use-confirm-dialog-BAxaVOJI.js +0 -1
- package/dist/assets/x-BBMffEN0.js +0 -1
- package/src/features/chat/components/layout/__tests__/chat-sidebar-utility-menu.test.tsx +0 -55
- /package/dist/assets/{config-hints-C_iP1zl_.js → config-hints-LxG80Uj5.js} +0 -0
- /package/dist/assets/{host-capabilities-9bB_998Z.js → host-capabilities-CFbAfrrA.js} +0 -0
- /package/dist/assets/{middleware-BILWbJE4.js → middleware-CAXxl-af.js} +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { useWorkspaceFileBuffer } from "./use-workspace-file-buffer";
|
|
3
|
+
import { WorkspaceDocumentPreviewState } from "./workspace-document-preview-state";
|
|
4
|
+
import "./workspace-docx-preview.css";
|
|
5
|
+
|
|
6
|
+
function applyResponsiveDocxFallback(container: HTMLDivElement): void {
|
|
7
|
+
const pages = Array.from(
|
|
8
|
+
container.querySelectorAll<HTMLElement>(".docx-wrapper > section.docx"),
|
|
9
|
+
);
|
|
10
|
+
const needsFallback = pages.some(
|
|
11
|
+
(page) => !page.style.width && !page.style.padding,
|
|
12
|
+
);
|
|
13
|
+
container.classList.toggle("workspace-docx-preview--reflow", needsFallback);
|
|
14
|
+
if (!needsFallback) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
for (const table of container.querySelectorAll<HTMLTableElement>("table")) {
|
|
18
|
+
if (table.querySelectorAll("col").length < 5) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const scrollContainer = document.createElement("div");
|
|
22
|
+
scrollContainer.className = "workspace-docx-wide-table";
|
|
23
|
+
table.before(scrollContainer);
|
|
24
|
+
scrollContainer.append(table);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function WorkspaceDocxPreview({ contentUrl }: { contentUrl: string }) {
|
|
29
|
+
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
30
|
+
const fileBuffer = useWorkspaceFileBuffer(contentUrl);
|
|
31
|
+
const [renderState, setRenderState] = useState<{
|
|
32
|
+
contentUrl: string;
|
|
33
|
+
status: "ready" | "error";
|
|
34
|
+
} | null>(null);
|
|
35
|
+
const renderStatus =
|
|
36
|
+
renderState?.contentUrl === contentUrl ? renderState.status : "loading";
|
|
37
|
+
const status =
|
|
38
|
+
fileBuffer.status === "ready" ? renderStatus : fileBuffer.status;
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const container = containerRef.current;
|
|
42
|
+
if (!container || !fileBuffer.data) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
let disposed = false;
|
|
46
|
+
container.replaceChildren();
|
|
47
|
+
void import("docx-preview")
|
|
48
|
+
.then(async (docxPreview) => {
|
|
49
|
+
await docxPreview.renderAsync(
|
|
50
|
+
fileBuffer.data as ArrayBuffer,
|
|
51
|
+
container,
|
|
52
|
+
container,
|
|
53
|
+
{
|
|
54
|
+
breakPages: true,
|
|
55
|
+
inWrapper: true,
|
|
56
|
+
ignoreLastRenderedPageBreak: false,
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
if (!disposed) {
|
|
60
|
+
applyResponsiveDocxFallback(container);
|
|
61
|
+
setRenderState({ contentUrl, status: "ready" });
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
.catch((error: unknown) => {
|
|
65
|
+
if (!disposed) {
|
|
66
|
+
console.error("Failed to render DOCX preview", error);
|
|
67
|
+
setRenderState({ contentUrl, status: "error" });
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
return () => {
|
|
72
|
+
disposed = true;
|
|
73
|
+
container.replaceChildren();
|
|
74
|
+
};
|
|
75
|
+
}, [contentUrl, fileBuffer.data]);
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<div className="relative h-full overflow-auto bg-muted/40 p-4 custom-scrollbar">
|
|
79
|
+
<WorkspaceDocumentPreviewState status={status} />
|
|
80
|
+
<div
|
|
81
|
+
ref={containerRef}
|
|
82
|
+
className="workspace-docx-preview min-h-full"
|
|
83
|
+
data-testid="workspace-content-docx"
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { useWorkspaceFileBuffer } from "./use-workspace-file-buffer";
|
|
3
|
+
import { WorkspaceDocumentPreviewState } from "./workspace-document-preview-state";
|
|
4
|
+
|
|
5
|
+
export function WorkspacePresentationPreview({
|
|
6
|
+
contentUrl,
|
|
7
|
+
}: {
|
|
8
|
+
contentUrl: string;
|
|
9
|
+
}) {
|
|
10
|
+
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
11
|
+
const fileBuffer = useWorkspaceFileBuffer(contentUrl);
|
|
12
|
+
const [renderState, setRenderState] = useState<{
|
|
13
|
+
contentUrl: string;
|
|
14
|
+
status: "ready" | "error";
|
|
15
|
+
} | null>(null);
|
|
16
|
+
const renderStatus =
|
|
17
|
+
renderState?.contentUrl === contentUrl ? renderState.status : "loading";
|
|
18
|
+
const status =
|
|
19
|
+
fileBuffer.status === "ready" ? renderStatus : fileBuffer.status;
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const container = containerRef.current;
|
|
23
|
+
if (!container || !fileBuffer.data) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const abortController = new AbortController();
|
|
27
|
+
let viewer: { destroy: () => void } | null = null;
|
|
28
|
+
container.replaceChildren();
|
|
29
|
+
void import("@aiden0z/pptx-renderer")
|
|
30
|
+
.then(async ({ PptxViewer, RECOMMENDED_ZIP_LIMITS }) => {
|
|
31
|
+
viewer = await PptxViewer.open(
|
|
32
|
+
fileBuffer.data as ArrayBuffer,
|
|
33
|
+
container,
|
|
34
|
+
{
|
|
35
|
+
renderMode: "list",
|
|
36
|
+
fitMode: "contain",
|
|
37
|
+
lazySlides: true,
|
|
38
|
+
lazyMedia: true,
|
|
39
|
+
pdfjs: false,
|
|
40
|
+
scrollContainer: container,
|
|
41
|
+
signal: abortController.signal,
|
|
42
|
+
zipLimits: RECOMMENDED_ZIP_LIMITS,
|
|
43
|
+
listOptions: {
|
|
44
|
+
windowed: true,
|
|
45
|
+
batchSize: 8,
|
|
46
|
+
initialSlides: 4,
|
|
47
|
+
overscanViewport: 1.5,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
if (abortController.signal.aborted) {
|
|
52
|
+
viewer.destroy();
|
|
53
|
+
viewer = null;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
setRenderState({ contentUrl, status: "ready" });
|
|
57
|
+
})
|
|
58
|
+
.catch((error: unknown) => {
|
|
59
|
+
if (!abortController.signal.aborted) {
|
|
60
|
+
console.error("Failed to render presentation preview", error);
|
|
61
|
+
setRenderState({ contentUrl, status: "error" });
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return () => {
|
|
66
|
+
abortController.abort();
|
|
67
|
+
viewer?.destroy();
|
|
68
|
+
container.replaceChildren();
|
|
69
|
+
};
|
|
70
|
+
}, [contentUrl, fileBuffer.data]);
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div className="relative h-full bg-muted/40">
|
|
74
|
+
<WorkspaceDocumentPreviewState status={status} />
|
|
75
|
+
<div
|
|
76
|
+
ref={containerRef}
|
|
77
|
+
className="h-full overflow-auto p-4 custom-scrollbar"
|
|
78
|
+
data-testid="workspace-content-presentation"
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { useWorkspaceFileBuffer } from "./use-workspace-file-buffer";
|
|
3
|
+
import { WorkspaceDocumentPreviewState } from "./workspace-document-preview-state";
|
|
4
|
+
import { t } from "@/shared/lib/i18n";
|
|
5
|
+
import { cn } from "@/shared/lib/utils";
|
|
6
|
+
|
|
7
|
+
const MAX_PREVIEW_ROWS = 500;
|
|
8
|
+
const MAX_PREVIEW_COLUMNS = 100;
|
|
9
|
+
|
|
10
|
+
type SpreadsheetSheet = {
|
|
11
|
+
name: string;
|
|
12
|
+
rows: string[][];
|
|
13
|
+
columnCount: number;
|
|
14
|
+
truncated: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type SpreadsheetState = {
|
|
18
|
+
contentUrl: string;
|
|
19
|
+
status: "ready" | "error";
|
|
20
|
+
sheets: SpreadsheetSheet[];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function spreadsheetColumnLabel(index: number): string {
|
|
24
|
+
let label = "";
|
|
25
|
+
let value = index + 1;
|
|
26
|
+
while (value > 0) {
|
|
27
|
+
value -= 1;
|
|
28
|
+
label = String.fromCharCode(65 + (value % 26)) + label;
|
|
29
|
+
value = Math.floor(value / 26);
|
|
30
|
+
}
|
|
31
|
+
return label;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function WorkspaceSpreadsheetPreview({
|
|
35
|
+
contentUrl,
|
|
36
|
+
}: {
|
|
37
|
+
contentUrl: string;
|
|
38
|
+
}) {
|
|
39
|
+
const fileBuffer = useWorkspaceFileBuffer(contentUrl);
|
|
40
|
+
const [spreadsheetState, setSpreadsheetState] =
|
|
41
|
+
useState<SpreadsheetState | null>(null);
|
|
42
|
+
const [selectedSheetName, setSelectedSheetName] = useState("");
|
|
43
|
+
const currentState =
|
|
44
|
+
spreadsheetState?.contentUrl === contentUrl ? spreadsheetState : null;
|
|
45
|
+
const status =
|
|
46
|
+
fileBuffer.status === "ready"
|
|
47
|
+
? (currentState?.status ?? "loading")
|
|
48
|
+
: fileBuffer.status;
|
|
49
|
+
const activeSheet =
|
|
50
|
+
currentState?.sheets.find((sheet) => sheet.name === selectedSheetName) ??
|
|
51
|
+
currentState?.sheets[0] ??
|
|
52
|
+
null;
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (!fileBuffer.data) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
let disposed = false;
|
|
59
|
+
void import("xlsx")
|
|
60
|
+
.then((xlsx) => {
|
|
61
|
+
const workbook = xlsx.read(fileBuffer.data as ArrayBuffer, {
|
|
62
|
+
dense: true,
|
|
63
|
+
sheetRows: MAX_PREVIEW_ROWS + 1,
|
|
64
|
+
});
|
|
65
|
+
const sheets = workbook.SheetNames.map((name) => {
|
|
66
|
+
const worksheet = workbook.Sheets[name];
|
|
67
|
+
const allRows = worksheet
|
|
68
|
+
? xlsx.utils.sheet_to_json<unknown[]>(worksheet, {
|
|
69
|
+
header: 1,
|
|
70
|
+
raw: false,
|
|
71
|
+
defval: "",
|
|
72
|
+
blankrows: false,
|
|
73
|
+
})
|
|
74
|
+
: [];
|
|
75
|
+
const rows = allRows
|
|
76
|
+
.slice(0, MAX_PREVIEW_ROWS)
|
|
77
|
+
.map((row) =>
|
|
78
|
+
row
|
|
79
|
+
.slice(0, MAX_PREVIEW_COLUMNS)
|
|
80
|
+
.map((cell) => String(cell ?? "")),
|
|
81
|
+
);
|
|
82
|
+
return {
|
|
83
|
+
name,
|
|
84
|
+
rows,
|
|
85
|
+
columnCount: Math.min(
|
|
86
|
+
MAX_PREVIEW_COLUMNS,
|
|
87
|
+
rows.reduce((maximum, row) => Math.max(maximum, row.length), 0),
|
|
88
|
+
),
|
|
89
|
+
truncated:
|
|
90
|
+
allRows.length > MAX_PREVIEW_ROWS ||
|
|
91
|
+
allRows.some((row) => row.length > MAX_PREVIEW_COLUMNS),
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
if (!disposed) {
|
|
95
|
+
setSpreadsheetState({ contentUrl, status: "ready", sheets });
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
.catch((error: unknown) => {
|
|
99
|
+
if (!disposed) {
|
|
100
|
+
console.error("Failed to render spreadsheet preview", error);
|
|
101
|
+
setSpreadsheetState({ contentUrl, status: "error", sheets: [] });
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return () => {
|
|
105
|
+
disposed = true;
|
|
106
|
+
};
|
|
107
|
+
}, [contentUrl, fileBuffer.data]);
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<div
|
|
111
|
+
className="relative flex h-full min-h-0 flex-col bg-white"
|
|
112
|
+
data-testid="workspace-content-spreadsheet"
|
|
113
|
+
>
|
|
114
|
+
<WorkspaceDocumentPreviewState status={status} />
|
|
115
|
+
{currentState && currentState.sheets.length > 1 ? (
|
|
116
|
+
<div className="flex shrink-0 gap-1 overflow-x-auto border-b border-border px-2 py-1.5 custom-scrollbar">
|
|
117
|
+
{currentState.sheets.map((sheet) => (
|
|
118
|
+
<button
|
|
119
|
+
key={sheet.name}
|
|
120
|
+
type="button"
|
|
121
|
+
className={cn(
|
|
122
|
+
"h-7 shrink-0 rounded-md px-2.5 text-xs transition-colors",
|
|
123
|
+
sheet.name === activeSheet?.name
|
|
124
|
+
? "bg-accent font-medium text-accent-foreground"
|
|
125
|
+
: "text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
126
|
+
)}
|
|
127
|
+
onClick={() => setSelectedSheetName(sheet.name)}
|
|
128
|
+
>
|
|
129
|
+
{sheet.name}
|
|
130
|
+
</button>
|
|
131
|
+
))}
|
|
132
|
+
</div>
|
|
133
|
+
) : null}
|
|
134
|
+
{activeSheet ? (
|
|
135
|
+
<div className="min-h-0 flex-1 overflow-auto custom-scrollbar">
|
|
136
|
+
<table className="min-w-full border-collapse text-xs text-foreground">
|
|
137
|
+
<thead className="sticky top-0 z-[1] bg-muted">
|
|
138
|
+
<tr>
|
|
139
|
+
<th className="sticky left-0 z-[2] h-7 min-w-10 border border-border bg-muted px-2" />
|
|
140
|
+
{Array.from({ length: activeSheet.columnCount }, (_, index) => (
|
|
141
|
+
<th
|
|
142
|
+
key={index}
|
|
143
|
+
className="h-7 min-w-24 border border-border px-2 text-center font-medium text-muted-foreground"
|
|
144
|
+
>
|
|
145
|
+
{spreadsheetColumnLabel(index)}
|
|
146
|
+
</th>
|
|
147
|
+
))}
|
|
148
|
+
</tr>
|
|
149
|
+
</thead>
|
|
150
|
+
<tbody>
|
|
151
|
+
{activeSheet.rows.map((row, rowIndex) => (
|
|
152
|
+
<tr key={rowIndex}>
|
|
153
|
+
<th className="sticky left-0 min-w-10 border border-border bg-muted px-2 text-right font-normal text-muted-foreground">
|
|
154
|
+
{rowIndex + 1}
|
|
155
|
+
</th>
|
|
156
|
+
{Array.from(
|
|
157
|
+
{ length: activeSheet.columnCount },
|
|
158
|
+
(_, columnIndex) => (
|
|
159
|
+
<td
|
|
160
|
+
key={columnIndex}
|
|
161
|
+
className="max-w-80 whitespace-pre-wrap border border-border px-2 py-1.5 align-top"
|
|
162
|
+
>
|
|
163
|
+
{row[columnIndex] ?? ""}
|
|
164
|
+
</td>
|
|
165
|
+
),
|
|
166
|
+
)}
|
|
167
|
+
</tr>
|
|
168
|
+
))}
|
|
169
|
+
</tbody>
|
|
170
|
+
</table>
|
|
171
|
+
</div>
|
|
172
|
+
) : null}
|
|
173
|
+
{activeSheet?.truncated ? (
|
|
174
|
+
<div className="shrink-0 border-t border-border bg-muted/60 px-3 py-1.5 text-xs text-muted-foreground">
|
|
175
|
+
{t("chatWorkspaceSpreadsheetPreviewTruncated")}
|
|
176
|
+
</div>
|
|
177
|
+
) : null}
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { WorkspaceDocxPreview } from "./file-content-preview/workspace-docx-preview";
|
|
2
|
+
import { WorkspacePresentationPreview } from "./file-content-preview/workspace-presentation-preview";
|
|
3
|
+
import { WorkspaceSpreadsheetPreview } from "./file-content-preview/workspace-spreadsheet-preview";
|
|
4
|
+
import { t } from "@/shared/lib/i18n";
|
|
5
|
+
|
|
6
|
+
export type WorkspaceFileContentKind =
|
|
7
|
+
| "image"
|
|
8
|
+
| "audio"
|
|
9
|
+
| "video"
|
|
10
|
+
| "pdf"
|
|
11
|
+
| "html"
|
|
12
|
+
| "docx"
|
|
13
|
+
| "spreadsheet"
|
|
14
|
+
| "presentation"
|
|
15
|
+
| "other";
|
|
16
|
+
|
|
17
|
+
export function resolveWorkspaceFileContentKind(params: {
|
|
18
|
+
path: string;
|
|
19
|
+
mimeType?: string | null;
|
|
20
|
+
}): WorkspaceFileContentKind {
|
|
21
|
+
const mime = params.mimeType?.trim().toLowerCase() ?? "";
|
|
22
|
+
const path = params.path.trim().toLowerCase();
|
|
23
|
+
if (
|
|
24
|
+
mime.startsWith("image/") ||
|
|
25
|
+
/\.(avif|bmp|gif|heic|heif|ico|jpe?g|png|svg|tiff?|webp)$/i.test(path)
|
|
26
|
+
) {
|
|
27
|
+
return "image";
|
|
28
|
+
}
|
|
29
|
+
if (
|
|
30
|
+
mime.startsWith("audio/") ||
|
|
31
|
+
/\.(aac|flac|m4a|mp3|ogg|opus|wav|weba)$/i.test(path)
|
|
32
|
+
) {
|
|
33
|
+
return "audio";
|
|
34
|
+
}
|
|
35
|
+
if (
|
|
36
|
+
mime.startsWith("video/") ||
|
|
37
|
+
/\.(avi|m4v|mkv|mov|mp4|webm|wmv)$/i.test(path)
|
|
38
|
+
) {
|
|
39
|
+
return "video";
|
|
40
|
+
}
|
|
41
|
+
if (mime.includes("pdf") || path.endsWith(".pdf")) {
|
|
42
|
+
return "pdf";
|
|
43
|
+
}
|
|
44
|
+
if (
|
|
45
|
+
mime ===
|
|
46
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" ||
|
|
47
|
+
path.endsWith(".docx")
|
|
48
|
+
) {
|
|
49
|
+
return "docx";
|
|
50
|
+
}
|
|
51
|
+
if (
|
|
52
|
+
mime.includes("spreadsheet") ||
|
|
53
|
+
mime.includes("excel") ||
|
|
54
|
+
/\.(ods|xls|xlsb|xlsm|xlsx)$/i.test(path)
|
|
55
|
+
) {
|
|
56
|
+
return "spreadsheet";
|
|
57
|
+
}
|
|
58
|
+
if (
|
|
59
|
+
mime ===
|
|
60
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation" ||
|
|
61
|
+
path.endsWith(".pptx")
|
|
62
|
+
) {
|
|
63
|
+
return "presentation";
|
|
64
|
+
}
|
|
65
|
+
if (mime.includes("html") || /\.html?$/i.test(path)) {
|
|
66
|
+
return "html";
|
|
67
|
+
}
|
|
68
|
+
return "other";
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function WorkspaceUnsupportedContent({
|
|
72
|
+
contentUrl,
|
|
73
|
+
label,
|
|
74
|
+
}: {
|
|
75
|
+
contentUrl: string;
|
|
76
|
+
label: string;
|
|
77
|
+
}) {
|
|
78
|
+
return (
|
|
79
|
+
<div
|
|
80
|
+
className="flex h-full flex-col items-center justify-center gap-4 px-6 text-center"
|
|
81
|
+
data-testid="workspace-content-unsupported"
|
|
82
|
+
>
|
|
83
|
+
<div className="max-w-sm space-y-1.5">
|
|
84
|
+
<p
|
|
85
|
+
className="truncate text-sm font-medium text-foreground"
|
|
86
|
+
title={label}
|
|
87
|
+
>
|
|
88
|
+
{label}
|
|
89
|
+
</p>
|
|
90
|
+
<p className="text-sm text-muted-foreground">
|
|
91
|
+
{t("chatWorkspacePreviewUnsupported")}
|
|
92
|
+
</p>
|
|
93
|
+
<p className="text-xs leading-5 text-muted-foreground/80">
|
|
94
|
+
{t("chatWorkspacePreviewUnsupportedHint")}
|
|
95
|
+
</p>
|
|
96
|
+
</div>
|
|
97
|
+
<div className="flex flex-wrap items-center justify-center gap-2">
|
|
98
|
+
<a
|
|
99
|
+
href={contentUrl}
|
|
100
|
+
download={label}
|
|
101
|
+
className="inline-flex h-8 items-center rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-muted"
|
|
102
|
+
>
|
|
103
|
+
{t("chatWorkspacePreviewDownload")}
|
|
104
|
+
</a>
|
|
105
|
+
<a
|
|
106
|
+
href={contentUrl}
|
|
107
|
+
target="_blank"
|
|
108
|
+
rel="noreferrer"
|
|
109
|
+
className="inline-flex h-8 items-center rounded-lg bg-primary px-3 text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90"
|
|
110
|
+
>
|
|
111
|
+
{t("chatWorkspacePreviewOpenExternally")}
|
|
112
|
+
</a>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function WorkspaceFileContentPreview({
|
|
119
|
+
contentUrl,
|
|
120
|
+
kind,
|
|
121
|
+
label,
|
|
122
|
+
}: {
|
|
123
|
+
contentUrl: string;
|
|
124
|
+
kind: WorkspaceFileContentKind;
|
|
125
|
+
label: string;
|
|
126
|
+
}) {
|
|
127
|
+
if (kind === "image") {
|
|
128
|
+
return (
|
|
129
|
+
<div className="flex h-full items-center justify-center overflow-auto bg-white p-4 custom-scrollbar">
|
|
130
|
+
<img
|
|
131
|
+
src={contentUrl}
|
|
132
|
+
alt={label}
|
|
133
|
+
className="max-h-full max-w-full object-contain"
|
|
134
|
+
data-testid="workspace-content-image"
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
if (kind === "audio") {
|
|
140
|
+
return (
|
|
141
|
+
<div className="flex h-full items-center justify-center bg-white px-6">
|
|
142
|
+
<audio
|
|
143
|
+
controls
|
|
144
|
+
preload="metadata"
|
|
145
|
+
aria-label={label}
|
|
146
|
+
className="w-full max-w-xl"
|
|
147
|
+
data-testid="workspace-content-audio"
|
|
148
|
+
src={contentUrl}
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
if (kind === "video") {
|
|
154
|
+
return (
|
|
155
|
+
<div className="flex h-full items-center justify-center bg-black">
|
|
156
|
+
<video
|
|
157
|
+
controls
|
|
158
|
+
playsInline
|
|
159
|
+
preload="metadata"
|
|
160
|
+
aria-label={label}
|
|
161
|
+
className="max-h-full max-w-full"
|
|
162
|
+
data-testid="workspace-content-video"
|
|
163
|
+
src={contentUrl}
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
if (kind === "pdf" || kind === "html") {
|
|
169
|
+
return (
|
|
170
|
+
<iframe
|
|
171
|
+
allowFullScreen
|
|
172
|
+
className="h-full w-full border-0 bg-white"
|
|
173
|
+
data-testid={
|
|
174
|
+
kind === "pdf" ? "workspace-content-pdf" : "workspace-html-preview"
|
|
175
|
+
}
|
|
176
|
+
src={contentUrl}
|
|
177
|
+
title={label}
|
|
178
|
+
/>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
if (kind === "docx") {
|
|
182
|
+
return <WorkspaceDocxPreview contentUrl={contentUrl} />;
|
|
183
|
+
}
|
|
184
|
+
if (kind === "spreadsheet") {
|
|
185
|
+
return <WorkspaceSpreadsheetPreview contentUrl={contentUrl} />;
|
|
186
|
+
}
|
|
187
|
+
if (kind === "presentation") {
|
|
188
|
+
return <WorkspacePresentationPreview contentUrl={contentUrl} />;
|
|
189
|
+
}
|
|
190
|
+
return <WorkspaceUnsupportedContent contentUrl={contentUrl} label={label} />;
|
|
191
|
+
}
|
|
@@ -64,9 +64,6 @@ export function useChatConversationWorkspaceState(
|
|
|
64
64
|
sessionCronJobs,
|
|
65
65
|
showWorkspacePanel:
|
|
66
66
|
snapshot.workspacePanelParentKey === sessionKey &&
|
|
67
|
-
|
|
68
|
-
childSessionTabs.length > 0 ||
|
|
69
|
-
workspaceFileTabs.length > 0 ||
|
|
70
|
-
sessionCronJobs.length > 0),
|
|
67
|
+
snapshot.activeWorkspacePanelKind != null,
|
|
71
68
|
};
|
|
72
69
|
}
|