@vibe-forge/client 3.0.0-alpha.6 → 3.0.0-alpha.7
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/cli.cjs +55 -12
- package/dist/assets/{arc-CKcDlk7m.js → arc-BSmt4B2L.js} +1 -1
- package/dist/assets/{blockDiagram-c4efeb88-Si9lNhiR.js → blockDiagram-c4efeb88-CMloXPoq.js} +1 -1
- package/dist/assets/{c4Diagram-c83219d4-CRTN1Bme.js → c4Diagram-c83219d4-Cylc1eLZ.js} +1 -1
- package/dist/assets/channel-m79NtBIL.js +1 -0
- package/dist/assets/{classDiagram-beda092f-Cn0JFKaM.js → classDiagram-beda092f-BKPTtrKA.js} +1 -1
- package/dist/assets/{classDiagram-v2-2358418a-CCRguPFP.js → classDiagram-v2-2358418a-DDp5VQdl.js} +1 -1
- package/dist/assets/clone-BWgcAtDw.js +1 -0
- package/dist/assets/{createText-1719965b-B7ypMies.js → createText-1719965b-B4dHTOBF.js} +1 -1
- package/dist/assets/{cssMode-CGqPieqo.js → cssMode-DiwCtD5c.js} +1 -1
- package/dist/assets/{edges-96097737-DQTQ3TTh.js → edges-96097737-ytyiKXTw.js} +1 -1
- package/dist/assets/{erDiagram-0228fc6a-RWH9OCKP.js → erDiagram-0228fc6a-DmL6zY48.js} +1 -1
- package/dist/assets/{flowDb-c6c81e3f-ChBIZfFE.js → flowDb-c6c81e3f-BCSZkN1T.js} +1 -1
- package/dist/assets/{flowDiagram-50d868cf-B5L7Tbzq.js → flowDiagram-50d868cf-uwjrIJD-.js} +1 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-cwXzaLSf.js +1 -0
- package/dist/assets/{flowchart-elk-definition-6af322e1-B7X89gyf.js → flowchart-elk-definition-6af322e1-W_vSjYDz.js} +1 -1
- package/dist/assets/{freemarker2-DG-xlAsn.js → freemarker2-BQf1HvOR.js} +1 -1
- package/dist/assets/{ganttDiagram-a2739b55-BedUmaPf.js → ganttDiagram-a2739b55-CGeIfDSH.js} +1 -1
- package/dist/assets/{gitGraphDiagram-82fe8481-B8HGnn-5.js → gitGraphDiagram-82fe8481-26OgN5Ry.js} +1 -1
- package/dist/assets/{graph-D9-QnVc7.js → graph-2CS6-29E.js} +1 -1
- package/dist/assets/{handlebars-D3MqxNWf.js → handlebars-DFgyCEY2.js} +1 -1
- package/dist/assets/{html-DufmGZMV.js → html-BV8g5c9v.js} +1 -1
- package/dist/assets/{htmlMode-CUM_1bUX.js → htmlMode-JyRqPjN0.js} +1 -1
- package/dist/assets/{index-5325376f-DvDnB8Ym.js → index-5325376f-ClAEncJa.js} +1 -1
- package/dist/assets/{index-CFwJnHev.js → index-CZrkUnI3.js} +5 -5
- package/dist/assets/{infoDiagram-8eee0895-CEkPslG6.js → infoDiagram-8eee0895-CSgc-EfH.js} +1 -1
- package/dist/assets/{javascript-B6reuW3Q.js → javascript-BqCcEQX1.js} +1 -1
- package/dist/assets/{journeyDiagram-c64418c1-c8XBdi4a.js → journeyDiagram-c64418c1-DT-HZm5B.js} +1 -1
- package/dist/assets/{jsonMode-srNnX9pn.js → jsonMode-COyDpXxP.js} +1 -1
- package/dist/assets/{layout-XKv3I9bs.js → layout-CWQTznjY.js} +1 -1
- package/dist/assets/{line-BUKiwgio.js → line-D9dEs7Yu.js} +1 -1
- package/dist/assets/{linear-Dfad58q_.js → linear-B_kP7XTY.js} +1 -1
- package/dist/assets/{liquid-CEkxMSzk.js → liquid-Bz_nlZQO.js} +1 -1
- package/dist/assets/{lspLanguageFeatures-0mffeVGX.js → lspLanguageFeatures-Bfs5KZ7t.js} +1 -1
- package/dist/assets/{mdx-B-Qq5FgQ.js → mdx-DREXNfTL.js} +1 -1
- package/dist/assets/{mermaid.core-DDK6pwbH.js → mermaid.core-Qb_9exf_.js} +4 -4
- package/dist/assets/{mindmap-definition-8da855dc-CyIw0Vtn.js → mindmap-definition-8da855dc-BVneYgpV.js} +1 -1
- package/dist/assets/{pieDiagram-a8764435-DCdqfk2w.js → pieDiagram-a8764435-BnFEaAoD.js} +1 -1
- package/dist/assets/{python-CMoFKB7x.js → python-BaegM-qN.js} +1 -1
- package/dist/assets/{quadrantDiagram-1e28029f-mXna6sR0.js → quadrantDiagram-1e28029f-DwwRhwu5.js} +1 -1
- package/dist/assets/{razor-B6DD072n.js → razor-EZlNrkt1.js} +1 -1
- package/dist/assets/{requirementDiagram-08caed73-DgC33PUx.js → requirementDiagram-08caed73-CrOXjwl9.js} +1 -1
- package/dist/assets/{sankeyDiagram-a04cb91d-6DjDiGF1.js → sankeyDiagram-a04cb91d-BmrPbz9p.js} +1 -1
- package/dist/assets/{sequenceDiagram-c5b8d532-BHEC8MLz.js → sequenceDiagram-c5b8d532-KIdevHfA.js} +1 -1
- package/dist/assets/{stateDiagram-1ecb1508-CnQIc7IJ.js → stateDiagram-1ecb1508-Bvt_x0JW.js} +1 -1
- package/dist/assets/{stateDiagram-v2-c2b004d7-DyYVXqRY.js → stateDiagram-v2-c2b004d7-Ch7JhULG.js} +1 -1
- package/dist/assets/{styles-b4e223ce-BCRMXdaJ.js → styles-b4e223ce-CGsc8vM4.js} +1 -1
- package/dist/assets/{styles-ca3715f6-B0Uke183.js → styles-ca3715f6-D-kXthxO.js} +1 -1
- package/dist/assets/{styles-d45a18b0-CTIOlm5f.js → styles-d45a18b0-ByiElCZx.js} +1 -1
- package/dist/assets/{svgDrawCommon-b86b1483-DIsUSZPw.js → svgDrawCommon-b86b1483-BBAC26Ym.js} +1 -1
- package/dist/assets/{timeline-definition-faaaa080-Dioszvxi.js → timeline-definition-faaaa080-yHkv8c9O.js} +1 -1
- package/dist/assets/{tsMode-C8qimCsh.js → tsMode-CxUP_h7m.js} +1 -1
- package/dist/assets/{typescript-DIHO7TTQ.js → typescript-DK75tgf9.js} +1 -1
- package/dist/assets/{xml-DE5CGUCp.js → xml-CKJB1DbG.js} +1 -1
- package/dist/assets/{xychartDiagram-f5964ef8-bhTIJLJy.js → xychartDiagram-f5964ef8-BBHC7Rzd.js} +1 -1
- package/dist/assets/{yaml-Cac2zjUM.js → yaml-CJFgfFzM.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +22 -16
- package/preview-runtime.cjs +128 -0
- package/preview-server.cjs +198 -0
- package/AGENTS.md +0 -115
- package/dist/assets/channel-_Q_52ef7.js +0 -1
- package/dist/assets/clone-BicNByr8.js +0 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-CWSRSwc1.js +0 -1
- package/index.html +0 -18
- package/public/favicon.svg +0 -5
- package/public/manifest.webmanifest +0 -30
- package/public/pwa-icon-192.png +0 -0
- package/public/pwa-icon-512.png +0 -0
- package/public/sw.js +0 -105
- package/src/App.tsx +0 -40
- package/src/api/README.md +0 -27
- package/src/api/adapters.ts +0 -63
- package/src/api/auth-token.ts +0 -51
- package/src/api/auth.ts +0 -46
- package/src/api/automation.ts +0 -98
- package/src/api/base.ts +0 -166
- package/src/api/benchmark.ts +0 -50
- package/src/api/config.ts +0 -29
- package/src/api/git.ts +0 -90
- package/src/api/knowledge.ts +0 -131
- package/src/api/projects.ts +0 -15
- package/src/api/sessions.ts +0 -281
- package/src/api/skill-hub.ts +0 -126
- package/src/api/types.ts +0 -21
- package/src/api/workspace.ts +0 -51
- package/src/api/worktree-environments.ts +0 -53
- package/src/api.ts +0 -142
- package/src/assets/fonts/material-symbols-rounded.woff2 +0 -0
- package/src/client-build-info.ts +0 -19
- package/src/components/ArchiveView.scss +0 -257
- package/src/components/ArchiveView.tsx +0 -313
- package/src/components/CodeBlock.scss +0 -92
- package/src/components/CodeBlock.tsx +0 -181
- package/src/components/ConfigView.scss +0 -864
- package/src/components/ConfigView.tsx +0 -788
- package/src/components/MarkdownContent.tsx +0 -50
- package/src/components/NavRail.scss +0 -317
- package/src/components/NavRail.tsx +0 -198
- package/src/components/NavRailCompact.tsx +0 -107
- package/src/components/NavRailCompactMoreSheet.tsx +0 -141
- package/src/components/ShortcutDisplay.scss +0 -38
- package/src/components/ShortcutDisplay.tsx +0 -37
- package/src/components/ShortcutTooltip.scss +0 -36
- package/src/components/ShortcutTooltip.tsx +0 -86
- package/src/components/Sidebar.scss +0 -161
- package/src/components/Sidebar.tsx +0 -480
- package/src/components/auth/AuthGate.scss +0 -79
- package/src/components/auth/AuthGate.tsx +0 -174
- package/src/components/automation-view/@components/AutomationTaskComposer.tsx +0 -220
- package/src/components/automation-view/@components/AutomationTriggerRow.tsx +0 -192
- package/src/components/automation-view/@hooks/use-automation-startup-options-data.tsx +0 -289
- package/src/components/automation-view/@hooks/use-automation-startup-static-options.ts +0 -51
- package/src/components/automation-view/@utils/sender-model-options.tsx +0 -52
- package/src/components/automation-view/@utils/startup-options.ts +0 -26
- package/src/components/automation-view/AutomationEmptyGuide.tsx +0 -61
- package/src/components/automation-view/AutomationEmptyLanding.scss +0 -165
- package/src/components/automation-view/AutomationEmptyLanding.tsx +0 -211
- package/src/components/automation-view/AutomationRuleDetailPreview.tsx +0 -179
- package/src/components/automation-view/PanelTitleActions.tsx +0 -66
- package/src/components/automation-view/RuleFormPanel.scss +0 -279
- package/src/components/automation-view/RuleFormPanel.tsx +0 -365
- package/src/components/automation-view/RuleSidebar.scss +0 -332
- package/src/components/automation-view/RuleSidebar.tsx +0 -338
- package/src/components/automation-view/RunHistoryPanel.scss +0 -649
- package/src/components/automation-view/RunHistoryPanel.tsx +0 -382
- package/src/components/automation-view/TaskList.scss +0 -223
- package/src/components/automation-view/TaskList.tsx +0 -67
- package/src/components/automation-view/TriggerList.scss +0 -267
- package/src/components/automation-view/TriggerList.tsx +0 -68
- package/src/components/automation-view/index.scss +0 -230
- package/src/components/automation-view/index.tsx +0 -369
- package/src/components/automation-view/types.ts +0 -34
- package/src/components/benchmark-view/BenchmarkCasePanel.scss +0 -287
- package/src/components/benchmark-view/BenchmarkCasePanel.tsx +0 -309
- package/src/components/benchmark-view/BenchmarkSidebar.scss +0 -206
- package/src/components/benchmark-view/BenchmarkSidebar.tsx +0 -269
- package/src/components/benchmark-view/BenchmarkView.scss +0 -121
- package/src/components/benchmark-view/index.tsx +0 -237
- package/src/components/benchmark-view/types.ts +0 -11
- package/src/components/benchmark-view/utils.ts +0 -20
- package/src/components/chat/AGENTS.md +0 -177
- package/src/components/chat/ChatComposerCard.scss +0 -77
- package/src/components/chat/ChatComposerCard.tsx +0 -59
- package/src/components/chat/ChatHeader.scss +0 -865
- package/src/components/chat/ChatHeader.tsx +0 -832
- package/src/components/chat/ChatHistoryView.tsx +0 -887
- package/src/components/chat/ChatSettingsView.tsx +0 -24
- package/src/components/chat/ChatTimelineView.scss +0 -147
- package/src/components/chat/ChatTimelineView.tsx +0 -200
- package/src/components/chat/CurrentTodoList.scss +0 -256
- package/src/components/chat/CurrentTodoList.tsx +0 -171
- package/src/components/chat/NewSessionGuide.scss +0 -416
- package/src/components/chat/NewSessionGuide.tsx +0 -69
- package/src/components/chat/NewSessionGuideStarterList.tsx +0 -190
- package/src/components/chat/NewSessionGuideStarterSection.tsx +0 -121
- package/src/components/chat/QueuedMessagesCard.scss +0 -195
- package/src/components/chat/QueuedMessagesCard.tsx +0 -170
- package/src/components/chat/bottom-dock-constants.ts +0 -4
- package/src/components/chat/conversation-starter-apply.ts +0 -181
- package/src/components/chat/git-controls/BranchSwitcherDropdown.tsx +0 -162
- package/src/components/chat/git-controls/BranchSwitcherResults.tsx +0 -167
- package/src/components/chat/git-controls/BranchTreeEntries.tsx +0 -99
- package/src/components/chat/git-controls/ChatGitControls.scss +0 -1113
- package/src/components/chat/git-controls/ChatGitControls.tsx +0 -178
- package/src/components/chat/git-controls/DraftGitControls.tsx +0 -105
- package/src/components/chat/git-controls/DraftWorktreeEnvironmentDropdown.tsx +0 -115
- package/src/components/chat/git-controls/GitCommitModal.tsx +0 -199
- package/src/components/chat/git-controls/GitCommitModalParts.tsx +0 -151
- package/src/components/chat/git-controls/GitOperationsDropdown.tsx +0 -131
- package/src/components/chat/git-controls/GitPushModal.tsx +0 -106
- package/src/components/chat/git-controls/GitWorktreeDropdown.tsx +0 -341
- package/src/components/chat/git-controls/git-branch-tree.ts +0 -148
- package/src/components/chat/git-controls/git-branch-utils.ts +0 -88
- package/src/components/chat/git-controls/git-commit-utils.ts +0 -79
- package/src/components/chat/git-controls/git-mutation-utils.ts +0 -69
- package/src/components/chat/git-controls/git-operation-utils.ts +0 -98
- package/src/components/chat/git-controls/git-worktree-utils.ts +0 -49
- package/src/components/chat/git-controls/use-chat-draft-git-controls.ts +0 -168
- package/src/components/chat/git-controls/use-chat-git-commit.ts +0 -185
- package/src/components/chat/git-controls/use-chat-git-controls.ts +0 -273
- package/src/components/chat/git-controls/use-chat-git-push-state.ts +0 -19
- package/src/components/chat/git-controls/use-chat-git-worktrees.ts +0 -39
- package/src/components/chat/messages/MessageContextMenu.scss +0 -145
- package/src/components/chat/messages/MessageContextMenu.tsx +0 -110
- package/src/components/chat/messages/MessageContextMenuContent.tsx +0 -87
- package/src/components/chat/messages/MessageFooter.tsx +0 -68
- package/src/components/chat/messages/MessageItem.scss +0 -486
- package/src/components/chat/messages/MessageItem.tsx +0 -529
- package/src/components/chat/messages/MessageStatusNotice.scss +0 -163
- package/src/components/chat/messages/MessageStatusNotice.tsx +0 -56
- package/src/components/chat/messages/build-chat-history-status-notices.ts +0 -143
- package/src/components/chat/messages/build-message-context-menu-entries.ts +0 -166
- package/src/components/chat/messages/message-action-utils.ts +0 -29
- package/src/components/chat/messages/message-content-utils.ts +0 -121
- package/src/components/chat/messages/message-turns.ts +0 -88
- package/src/components/chat/messages/message-utils.ts +0 -189
- package/src/components/chat/new-session-guide-config.ts +0 -19
- package/src/components/chat/new-session-guide-items.ts +0 -172
- package/src/components/chat/new-session-guide-list-order.ts +0 -58
- package/src/components/chat/sender/@components/account-select/AccountSelectControl.scss +0 -112
- package/src/components/chat/sender/@components/account-select/AccountSelectControl.tsx +0 -280
- package/src/components/chat/sender/@components/account-select/AccountSelectDropdown.scss +0 -155
- package/src/components/chat/sender/@components/adapter-select/AdapterSelectControl.scss +0 -148
- package/src/components/chat/sender/@components/adapter-select/AdapterSelectControl.tsx +0 -54
- package/src/components/chat/sender/@components/adapter-select/AdapterSelectDropdown.scss +0 -56
- package/src/components/chat/sender/@components/effort-select/EffortSelectControl.scss +0 -104
- package/src/components/chat/sender/@components/effort-select/EffortSelectControl.tsx +0 -142
- package/src/components/chat/sender/@components/effort-select/EffortSelectDropdown.scss +0 -96
- package/src/components/chat/sender/@components/model-select/ModelSelectControl.scss +0 -144
- package/src/components/chat/sender/@components/model-select/ModelSelectControl.tsx +0 -176
- package/src/components/chat/sender/@components/model-select/ModelSelectMenu.scss +0 -97
- package/src/components/chat/sender/@components/model-select/ModelSelectMenuLabels.scss +0 -168
- package/src/components/chat/sender/@components/model-select/ModelSelectOptionLabel.tsx +0 -109
- package/src/components/chat/sender/@components/permission-mode-control/PermissionModeControl.scss +0 -199
- package/src/components/chat/sender/@components/permission-mode-control/PermissionModeControl.tsx +0 -172
- package/src/components/chat/sender/@components/reference-actions/ReferenceActionsControl.scss +0 -114
- package/src/components/chat/sender/@components/reference-actions/ReferenceActionsControl.tsx +0 -107
- package/src/components/chat/sender/@components/reference-actions/ReferenceActionsOption.scss +0 -34
- package/src/components/chat/sender/@components/sender-attachments/SenderAttachments.scss +0 -240
- package/src/components/chat/sender/@components/sender-attachments/SenderAttachments.tsx +0 -119
- package/src/components/chat/sender/@components/sender-body/SenderBody.tsx +0 -135
- package/src/components/chat/sender/@components/sender-header-controls/SenderHeaderControls.tsx +0 -157
- package/src/components/chat/sender/@components/sender-interaction-panel/SenderInteractionPanel.scss +0 -294
- package/src/components/chat/sender/@components/sender-interaction-panel/SenderInteractionPanel.tsx +0 -384
- package/src/components/chat/sender/@components/sender-monaco-editor/SenderMonacoEditor.scss +0 -47
- package/src/components/chat/sender/@components/sender-monaco-editor/SenderMonacoEditor.tsx +0 -139
- package/src/components/chat/sender/@components/sender-monaco-editor/monaco-runtime.ts +0 -83
- package/src/components/chat/sender/@components/sender-monaco-editor/use-sender-editor-handle.ts +0 -48
- package/src/components/chat/sender/@components/sender-monaco-editor/use-sender-monaco-editor.ts +0 -286
- package/src/components/chat/sender/@components/sender-monaco-editor/use-sender-monaco-theme.ts +0 -73
- package/src/components/chat/sender/@components/sender-submit-action/SenderSubmitAction.scss +0 -163
- package/src/components/chat/sender/@components/sender-submit-action/SenderSubmitAction.tsx +0 -200
- package/src/components/chat/sender/@components/sender-toolbar/SenderSelectBase.scss +0 -108
- package/src/components/chat/sender/@components/sender-toolbar/SenderSelectShared.scss +0 -156
- package/src/components/chat/sender/@components/sender-toolbar/SenderToolbar.scss +0 -164
- package/src/components/chat/sender/@components/sender-toolbar/SenderToolbar.tsx +0 -93
- package/src/components/chat/sender/@components/session-target/SenderSessionTargetBar.scss +0 -215
- package/src/components/chat/sender/@components/session-target/SenderSessionTargetBar.tsx +0 -185
- package/src/components/chat/sender/@core/build-sender-controller-result.ts +0 -119
- package/src/components/chat/sender/@core/build-sender-toolbar.ts +0 -151
- package/src/components/chat/sender/@core/content-attachments.ts +0 -76
- package/src/components/chat/sender/@core/create-sender-toolbar-handlers.ts +0 -142
- package/src/components/chat/sender/@core/get-sender-interaction-state.ts +0 -18
- package/src/components/chat/sender/@core/get-sender-runtime-state.ts +0 -15
- package/src/components/chat/sender/@core/interaction-request.ts +0 -5
- package/src/components/chat/sender/@core/sender-toolbar-bindings.ts +0 -191
- package/src/components/chat/sender/@hooks/use-model-select-browser.tsx +0 -191
- package/src/components/chat/sender/@hooks/use-sender-attachments.ts +0 -143
- package/src/components/chat/sender/@hooks/use-sender-autofocus.ts +0 -34
- package/src/components/chat/sender/@hooks/use-sender-completion.ts +0 -62
- package/src/components/chat/sender/@hooks/use-sender-composer-state.ts +0 -34
- package/src/components/chat/sender/@hooks/use-sender-controller.ts +0 -291
- package/src/components/chat/sender/@hooks/use-sender-focus-restore.ts +0 -72
- package/src/components/chat/sender/@hooks/use-sender-history.ts +0 -79
- package/src/components/chat/sender/@hooks/use-sender-keydown.ts +0 -177
- package/src/components/chat/sender/@hooks/use-sender-reference-actions.ts +0 -134
- package/src/components/chat/sender/@hooks/use-sender-reference-focus-restore.ts +0 -21
- package/src/components/chat/sender/@hooks/use-sender-refs.ts +0 -19
- package/src/components/chat/sender/@hooks/use-sender-select-overlays.ts +0 -83
- package/src/components/chat/sender/@hooks/use-sender-shortcuts.ts +0 -93
- package/src/components/chat/sender/@hooks/use-sender-submit.ts +0 -89
- package/src/components/chat/sender/@types/sender-composer.ts +0 -19
- package/src/components/chat/sender/@types/sender-editor.ts +0 -12
- package/src/components/chat/sender/@types/sender-props.ts +0 -82
- package/src/components/chat/sender/@types/sender-toolbar-types.ts +0 -101
- package/src/components/chat/sender/@types/sender-types.ts +0 -19
- package/src/components/chat/sender/@utils/sender-completion.ts +0 -164
- package/src/components/chat/sender/@utils/sender-constants.ts +0 -18
- package/src/components/chat/sender/@utils/sender-utils.ts +0 -45
- package/src/components/chat/sender/Sender.scss +0 -299
- package/src/components/chat/sender/Sender.tsx +0 -55
- package/src/components/chat/session-metadata.ts +0 -55
- package/src/components/chat/session-timeline-panel/EventList.scss +0 -146
- package/src/components/chat/session-timeline-panel/EventList.tsx +0 -264
- package/src/components/chat/session-timeline-panel/gantt.ts +0 -193
- package/src/components/chat/session-timeline-panel/git-graph.ts +0 -530
- package/src/components/chat/session-timeline-panel/index.scss +0 -41
- package/src/components/chat/session-timeline-panel/index.tsx +0 -197
- package/src/components/chat/session-timeline-panel/mermaid.ts +0 -4
- package/src/components/chat/session-timeline-panel/types.ts +0 -68
- package/src/components/chat/session-timeline-panel/utils.ts +0 -20
- package/src/components/chat/status-bar/ChatStatusBar.scss +0 -112
- package/src/components/chat/status-bar/ChatStatusBar.tsx +0 -87
- package/src/components/chat/terminal/@components/TerminalManagerList.tsx +0 -191
- package/src/components/chat/terminal/@components/TerminalPane.scss +0 -71
- package/src/components/chat/terminal/@components/TerminalPane.tsx +0 -137
- package/src/components/chat/terminal/@components/TerminalPanelActions.tsx +0 -75
- package/src/components/chat/terminal/@hooks/use-terminal-instance.ts +0 -188
- package/src/components/chat/terminal/@hooks/use-terminal-session.ts +0 -193
- package/src/components/chat/terminal/@hooks/use-terminal-title-editor.ts +0 -72
- package/src/components/chat/terminal/@utils/terminal-keyboard.ts +0 -141
- package/src/components/chat/terminal/@utils/terminal-panes.ts +0 -123
- package/src/components/chat/terminal/ChatTerminalView.scss +0 -334
- package/src/components/chat/terminal/ChatTerminalView.tsx +0 -192
- package/src/components/chat/tools/DefaultTool.tsx +0 -102
- package/src/components/chat/tools/adapter-claude/BashTool.scss +0 -87
- package/src/components/chat/tools/adapter-claude/BashTool.tsx +0 -116
- package/src/components/chat/tools/adapter-claude/ClaudeEditDiff.tsx +0 -30
- package/src/components/chat/tools/adapter-claude/GenericClaudeTool.scss +0 -128
- package/src/components/chat/tools/adapter-claude/GenericClaudeTool.tsx +0 -119
- package/src/components/chat/tools/adapter-claude/GlobTool.scss +0 -9
- package/src/components/chat/tools/adapter-claude/GlobTool.tsx +0 -65
- package/src/components/chat/tools/adapter-claude/GrepTool.scss +0 -9
- package/src/components/chat/tools/adapter-claude/GrepTool.tsx +0 -95
- package/src/components/chat/tools/adapter-claude/LSTool.scss +0 -6
- package/src/components/chat/tools/adapter-claude/LSTool.tsx +0 -94
- package/src/components/chat/tools/adapter-claude/ReadTool.scss +0 -1
- package/src/components/chat/tools/adapter-claude/ReadTool.tsx +0 -65
- package/src/components/chat/tools/adapter-claude/TodoTool.scss +0 -63
- package/src/components/chat/tools/adapter-claude/TodoTool.tsx +0 -73
- package/src/components/chat/tools/adapter-claude/WriteTool.scss +0 -44
- package/src/components/chat/tools/adapter-claude/WriteTool.tsx +0 -50
- package/src/components/chat/tools/adapter-claude/claude-tool-edit-builders.ts +0 -109
- package/src/components/chat/tools/adapter-claude/claude-tool-field-sections.tsx +0 -83
- package/src/components/chat/tools/adapter-claude/claude-tool-operation-builders.ts +0 -135
- package/src/components/chat/tools/adapter-claude/claude-tool-presentation.ts +0 -61
- package/src/components/chat/tools/adapter-claude/claude-tool-shared.ts +0 -185
- package/src/components/chat/tools/adapter-claude/claude-tool-summary.ts +0 -76
- package/src/components/chat/tools/adapter-claude/claude-tool-system-builders.ts +0 -125
- package/src/components/chat/tools/adapter-claude/claude-tool-task-builders.ts +0 -148
- package/src/components/chat/tools/adapter-claude/components/FileList.scss +0 -67
- package/src/components/chat/tools/adapter-claude/components/FileList.tsx +0 -185
- package/src/components/chat/tools/adapter-claude/index.ts +0 -31
- package/src/components/chat/tools/adapter-claude/utils.ts +0 -54
- package/src/components/chat/tools/core/ToolCallBox.scss +0 -700
- package/src/components/chat/tools/core/ToolCallBox.tsx +0 -77
- package/src/components/chat/tools/core/ToolDiffViewer.scss +0 -138
- package/src/components/chat/tools/core/ToolDiffViewer.tsx +0 -166
- package/src/components/chat/tools/core/ToolGroup.scss +0 -171
- package/src/components/chat/tools/core/ToolGroup.tsx +0 -156
- package/src/components/chat/tools/core/ToolRenderer.tsx +0 -47
- package/src/components/chat/tools/core/ToolResultContent.tsx +0 -66
- package/src/components/chat/tools/core/ToolSummaryHeader.tsx +0 -67
- package/src/components/chat/tools/core/generic-tool-presentation.ts +0 -661
- package/src/components/chat/tools/core/tool-content-presence.ts +0 -57
- package/src/components/chat/tools/core/tool-display.ts +0 -203
- package/src/components/chat/tools/core/tool-field-sections.tsx +0 -132
- package/src/components/chat/tools/core/tool-result-content-utils.ts +0 -171
- package/src/components/chat/tools/core/tool-summary.ts +0 -206
- package/src/components/chat/tools/defineToolRender.ts +0 -28
- package/src/components/chat/tools/plugin-chrome-devtools/ChromeDevtoolsTool.scss +0 -11
- package/src/components/chat/tools/plugin-chrome-devtools/ChromeDevtoolsTool.tsx +0 -81
- package/src/components/chat/tools/plugin-chrome-devtools/index.ts +0 -45
- package/src/components/chat/tools/task/GetTaskInfoTool.scss +0 -25
- package/src/components/chat/tools/task/GetTaskInfoTool.tsx +0 -115
- package/src/components/chat/tools/task/ListTasksTool.scss +0 -31
- package/src/components/chat/tools/task/ListTasksTool.tsx +0 -99
- package/src/components/chat/tools/task/StartTasksTool.scss +0 -31
- package/src/components/chat/tools/task/StartTasksTool.tsx +0 -106
- package/src/components/chat/tools/task/components/TaskRow.scss +0 -105
- package/src/components/chat/tools/task/components/TaskRow.tsx +0 -163
- package/src/components/chat/tools/task/components/TaskToolCard.scss +0 -185
- package/src/components/chat/tools/task/components/TaskToolCard.tsx +0 -179
- package/src/components/chat/tools/task/index.ts +0 -15
- package/src/components/chat/workspace-drawer/ChatWorkspaceDrawer.scss +0 -778
- package/src/components/chat/workspace-drawer/ChatWorkspaceDrawer.tsx +0 -112
- package/src/components/chat/workspace-drawer/ChatWorkspaceDrawerToolbar.tsx +0 -183
- package/src/components/chat/workspace-drawer/WorkspaceDrawerChangedFileRow.tsx +0 -75
- package/src/components/chat/workspace-drawer/WorkspaceDrawerChangedFiles.tsx +0 -161
- package/src/components/chat/workspace-drawer/WorkspaceDrawerChangedFolderTree.tsx +0 -191
- package/src/components/chat/workspace-drawer/WorkspaceDrawerTree.tsx +0 -35
- package/src/components/chat/workspace-drawer/WorkspaceDrawerTreeState.tsx +0 -17
- package/src/components/chat/workspace-drawer/changed-files-model.ts +0 -152
- package/src/components/chat/workspace-drawer/workspace-drawer-icons.ts +0 -110
- package/src/components/chat/workspace-file-editor/WorkspaceFileBreadcrumb.tsx +0 -17
- package/src/components/chat/workspace-file-editor/WorkspaceFileEditorView.scss +0 -283
- package/src/components/chat/workspace-file-editor/WorkspaceFileEditorView.tsx +0 -165
- package/src/components/chat/workspace-file-editor/WorkspaceFileTabs.tsx +0 -135
- package/src/components/chat/workspace-file-editor/use-workspace-file-editor-state.ts +0 -113
- package/src/components/chat/workspace-file-editor/workspace-file-editor-language.ts +0 -55
- package/src/components/composer-landing/ComposerLanding.scss +0 -75
- package/src/components/composer-landing/ComposerLanding.tsx +0 -47
- package/src/components/config/AGENTS.md +0 -45
- package/src/components/config/AdapterAccountsManager.scss +0 -540
- package/src/components/config/AdapterAccountsManager.tsx +0 -846
- package/src/components/config/AppSettingsPanel.tsx +0 -109
- package/src/components/config/ConfigAboutSection.scss +0 -117
- package/src/components/config/ConfigAboutSection.tsx +0 -104
- package/src/components/config/ConfigDisplayValue.scss +0 -22
- package/src/components/config/ConfigDisplayValue.tsx +0 -62
- package/src/components/config/ConfigEditors.scss +0 -91
- package/src/components/config/ConfigEditors.tsx +0 -98
- package/src/components/config/ConfigFieldRow.scss +0 -221
- package/src/components/config/ConfigFieldRow.tsx +0 -36
- package/src/components/config/ConfigSectionForm.scss +0 -185
- package/src/components/config/ConfigSectionForm.tsx +0 -1264
- package/src/components/config/ConfigSectionPanel.tsx +0 -250
- package/src/components/config/ConfigShortcutInput.scss +0 -11
- package/src/components/config/ConfigShortcutInput.tsx +0 -59
- package/src/components/config/ConfigSourceSwitch.tsx +0 -49
- package/src/components/config/DetailCollectionFieldActions.tsx +0 -63
- package/src/components/config/DetailListField.tsx +0 -413
- package/src/components/config/McpServerItemEditor.tsx +0 -154
- package/src/components/config/RecommendedModelsItemEditor.tsx +0 -146
- package/src/components/config/WorktreeEnvironmentDetailView.tsx +0 -126
- package/src/components/config/WorktreeEnvironmentListView.tsx +0 -126
- package/src/components/config/WorktreeEnvironmentPanel.scss +0 -430
- package/src/components/config/WorktreeEnvironmentPanel.tsx +0 -147
- package/src/components/config/WorktreeEnvironmentScriptEditorCard.tsx +0 -125
- package/src/components/config/WorktreeEnvironmentScriptEditors.tsx +0 -189
- package/src/components/config/channelDefinitions.ts +0 -6
- package/src/components/config/configConflict.ts +0 -41
- package/src/components/config/configDetail.ts +0 -381
- package/src/components/config/configSchema.ts +0 -1017
- package/src/components/config/configUtils.ts +0 -83
- package/src/components/config/index.tsx +0 -5
- package/src/components/config/record-editors/BooleanRecordEditor.scss +0 -1
- package/src/components/config/record-editors/BooleanRecordEditor.tsx +0 -75
- package/src/components/config/record-editors/ChannelRecordEditor.scss +0 -1
- package/src/components/config/record-editors/ChannelRecordEditor.tsx +0 -397
- package/src/components/config/record-editors/KeyValueEditor.scss +0 -1
- package/src/components/config/record-editors/KeyValueEditor.tsx +0 -97
- package/src/components/config/record-editors/McpServersRecordEditor.scss +0 -1
- package/src/components/config/record-editors/McpServersRecordEditor.tsx +0 -260
- package/src/components/config/record-editors/ModelServicesRecordEditor.scss +0 -1
- package/src/components/config/record-editors/ModelServicesRecordEditor.tsx +0 -265
- package/src/components/config/record-editors/RecordEditors.scss +0 -335
- package/src/components/config/record-editors/RecordJsonEditor.scss +0 -1
- package/src/components/config/record-editors/RecordJsonEditor.tsx +0 -140
- package/src/components/config/record-editors/SchemaObjectEditor.tsx +0 -183
- package/src/components/config/record-editors/SchemaRecordEditor.tsx +0 -184
- package/src/components/config/record-editors/index.tsx +0 -7
- package/src/components/config/record-editors/schemaRecordUtils.ts +0 -55
- package/src/components/config/use-worktree-environment-auto-save.ts +0 -386
- package/src/components/config/worktree-environment-panel-model.ts +0 -108
- package/src/components/dock-panel/DockPanel.scss +0 -223
- package/src/components/dock-panel/DockPanel.tsx +0 -194
- package/src/components/dock-panel/DockPanelHeader.tsx +0 -65
- package/src/components/dock-panel/use-dock-panel-fullscreen.ts +0 -51
- package/src/components/knowledge-base/KnowledgeBaseView.scss +0 -431
- package/src/components/knowledge-base/KnowledgeBaseView.tsx +0 -512
- package/src/components/knowledge-base/components/@hooks/use-skills-cli-modal-controller.ts +0 -157
- package/src/components/knowledge-base/components/@hooks/use-skills-tab-actions.ts +0 -63
- package/src/components/knowledge-base/components/ActionButton.scss +0 -35
- package/src/components/knowledge-base/components/ActionButton.tsx +0 -19
- package/src/components/knowledge-base/components/CreateSkillModal.tsx +0 -59
- package/src/components/knowledge-base/components/EmptyState.scss +0 -18
- package/src/components/knowledge-base/components/EmptyState.tsx +0 -42
- package/src/components/knowledge-base/components/EntitiesTab.scss +0 -5
- package/src/components/knowledge-base/components/EntitiesTab.tsx +0 -86
- package/src/components/knowledge-base/components/EntityItem.scss +0 -89
- package/src/components/knowledge-base/components/EntityItem.tsx +0 -79
- package/src/components/knowledge-base/components/EntityList.scss +0 -8
- package/src/components/knowledge-base/components/EntityList.tsx +0 -70
- package/src/components/knowledge-base/components/FilterBar.scss +0 -33
- package/src/components/knowledge-base/components/FilterBar.tsx +0 -55
- package/src/components/knowledge-base/components/FlowsTab.scss +0 -5
- package/src/components/knowledge-base/components/FlowsTab.tsx +0 -86
- package/src/components/knowledge-base/components/KnowledgeBaseHeader.scss +0 -6
- package/src/components/knowledge-base/components/KnowledgeBaseHeader.tsx +0 -25
- package/src/components/knowledge-base/components/KnowledgeContentControls.tsx +0 -35
- package/src/components/knowledge-base/components/KnowledgeList.scss +0 -39
- package/src/components/knowledge-base/components/KnowledgeList.tsx +0 -19
- package/src/components/knowledge-base/components/KnowledgeMobilePanel.tsx +0 -122
- package/src/components/knowledge-base/components/KnowledgeSidebar.tsx +0 -97
- package/src/components/knowledge-base/components/LoadingState.scss +0 -10
- package/src/components/knowledge-base/components/LoadingState.tsx +0 -11
- package/src/components/knowledge-base/components/MetaList.scss +0 -19
- package/src/components/knowledge-base/components/MetaList.tsx +0 -18
- package/src/components/knowledge-base/components/ProjectSkillsList.tsx +0 -79
- package/src/components/knowledge-base/components/RuleItem.scss +0 -86
- package/src/components/knowledge-base/components/RuleItem.tsx +0 -81
- package/src/components/knowledge-base/components/RuleList.scss +0 -8
- package/src/components/knowledge-base/components/RuleList.tsx +0 -70
- package/src/components/knowledge-base/components/RulesTab.scss +0 -5
- package/src/components/knowledge-base/components/RulesTab.tsx +0 -81
- package/src/components/knowledge-base/components/SectionHeader.scss +0 -19
- package/src/components/knowledge-base/components/SectionHeader.tsx +0 -19
- package/src/components/knowledge-base/components/SkillArchiveInput.tsx +0 -43
- package/src/components/knowledge-base/components/SkillHubResultItem.tsx +0 -112
- package/src/components/knowledge-base/components/SkillMarketResults.tsx +0 -98
- package/src/components/knowledge-base/components/SkillMarketView.tsx +0 -198
- package/src/components/knowledge-base/components/SkillMarketView.types.ts +0 -28
- package/src/components/knowledge-base/components/SkillRegistryErrors.tsx +0 -21
- package/src/components/knowledge-base/components/SkillRegistryModal.tsx +0 -74
- package/src/components/knowledge-base/components/SkillsCliModal.tsx +0 -154
- package/src/components/knowledge-base/components/SkillsTab.scss +0 -429
- package/src/components/knowledge-base/components/SkillsTab.tsx +0 -185
- package/src/components/knowledge-base/components/SkillsTabActions.tsx +0 -88
- package/src/components/knowledge-base/components/SpecItem.scss +0 -147
- package/src/components/knowledge-base/components/SpecItem.tsx +0 -131
- package/src/components/knowledge-base/components/SpecList.scss +0 -8
- package/src/components/knowledge-base/components/SpecList.tsx +0 -70
- package/src/components/knowledge-base/components/TabContent.scss +0 -9
- package/src/components/knowledge-base/components/TabContent.tsx +0 -17
- package/src/components/knowledge-base/components/TabLabel.scss +0 -10
- package/src/components/knowledge-base/components/TabLabel.tsx +0 -15
- package/src/components/knowledge-base/components/skill-hub-utils.ts +0 -108
- package/src/components/knowledge-base/components/use-skill-market-filters.ts +0 -37
- package/src/components/knowledge-base/components/use-skill-market-query-input.ts +0 -44
- package/src/components/knowledge-base/components/use-skill-market-search.ts +0 -49
- package/src/components/knowledge-base/components/use-skill-registry-modal.ts +0 -68
- package/src/components/knowledge-base/index.tsx +0 -1
- package/src/components/layout/@hooks/use-mobile-sidebar-modal.ts +0 -190
- package/src/components/layout/AppShell.scss +0 -157
- package/src/components/layout/AppShell.tsx +0 -168
- package/src/components/layout/PageShell.scss +0 -41
- package/src/components/layout/PageShell.tsx +0 -32
- package/src/components/layout/mobile-sidebar-constants.ts +0 -1
- package/src/components/monaco/monaco-runtime.ts +0 -44
- package/src/components/monaco/use-monaco-theme.ts +0 -63
- package/src/components/nav-rail-account-actions.tsx +0 -104
- package/src/components/nav-rail-compact-config.ts +0 -114
- package/src/components/nav-rail-items.tsx +0 -181
- package/src/components/server-connection/ServerConnectionGate.scss +0 -356
- package/src/components/server-connection/ServerConnectionGate.tsx +0 -238
- package/src/components/server-connection/ServerConnectionProfileModal.tsx +0 -145
- package/src/components/server-connection/ServerConnectionProfiles.tsx +0 -113
- package/src/components/server-connection/ServerConnectionUrlInput.tsx +0 -85
- package/src/components/sidebar/SessionContextMenu.scss +0 -143
- package/src/components/sidebar/SessionContextMenu.tsx +0 -198
- package/src/components/sidebar/SessionContextMenuContent.tsx +0 -89
- package/src/components/sidebar/SessionItem.scss +0 -417
- package/src/components/sidebar/SessionItem.tsx +0 -367
- package/src/components/sidebar/SessionList.scss +0 -122
- package/src/components/sidebar/SessionList.tsx +0 -187
- package/src/components/sidebar/SidebarHeader.scss +0 -372
- package/src/components/sidebar/SidebarHeader.tsx +0 -198
- package/src/components/sidebar/SidebarHeaderBatchActions.tsx +0 -85
- package/src/components/sidebar/SidebarHeaderSearchActions.tsx +0 -175
- package/src/components/sidebar/SidebarHeaderSelectField.tsx +0 -24
- package/src/components/sidebar/SidebarUtilityFooter.tsx +0 -69
- package/src/components/sidebar/filter-utils.ts +0 -23
- package/src/components/sidebar/sidebar-search-visibility.ts +0 -18
- package/src/components/sidebar-list/SidebarListHeader.scss +0 -246
- package/src/components/sidebar-list/SidebarListHeader.tsx +0 -146
- package/src/components/workspace/ContextFilePicker.scss +0 -47
- package/src/components/workspace/ContextFilePicker.tsx +0 -97
- package/src/components/workspace/context-file-types.ts +0 -36
- package/src/components/workspace/project-file-tree/ProjectFileTree.scss +0 -298
- package/src/components/workspace/project-file-tree/ProjectFileTree.tsx +0 -138
- package/src/components/workspace/project-file-tree/ProjectFileTreeRow.tsx +0 -167
- package/src/components/workspace/project-file-tree/ProjectFileTreeRowContextMenu.tsx +0 -106
- package/src/components/workspace/project-file-tree/ProjectFileTreeRows.tsx +0 -139
- package/src/components/workspace/project-file-tree/project-file-tree-helpers.ts +0 -101
- package/src/components/workspace/project-file-tree/project-file-tree-icons.ts +0 -93
- package/src/components/workspace/project-file-tree/project-file-tree-types.ts +0 -27
- package/src/components/workspace/project-file-tree/use-project-file-tree-data.ts +0 -197
- package/src/components/workspace/project-file-tree/use-project-file-tree-selection.ts +0 -144
- package/src/connectionManager.ts +0 -174
- package/src/hooks/chat/chat-session-target.ts +0 -69
- package/src/hooks/chat/chat-session-workspace-draft.ts +0 -32
- package/src/hooks/chat/interaction-state.ts +0 -125
- package/src/hooks/chat/model-selector-data-builders.ts +0 -146
- package/src/hooks/chat/model-selector-data-option-utils.ts +0 -62
- package/src/hooks/chat/model-selector-data-types.ts +0 -27
- package/src/hooks/chat/model-selector-data.ts +0 -109
- package/src/hooks/chat/model-selector-recommendations.ts +0 -69
- package/src/hooks/chat/model-selector.ts +0 -153
- package/src/hooks/chat/optimistic-session-creation.ts +0 -189
- package/src/hooks/chat/session-view-cache.ts +0 -83
- package/src/hooks/chat/use-chat-adapter-account-selection.tsx +0 -156
- package/src/hooks/chat/use-chat-adapter.ts +0 -97
- package/src/hooks/chat/use-chat-effort.ts +0 -55
- package/src/hooks/chat/use-chat-interaction.ts +0 -31
- package/src/hooks/chat/use-chat-model-adapter-selection.tsx +0 -562
- package/src/hooks/chat/use-chat-models.tsx +0 -347
- package/src/hooks/chat/use-chat-permission-mode.ts +0 -55
- package/src/hooks/chat/use-chat-route-bottom-panel.ts +0 -181
- package/src/hooks/chat/use-chat-route-deep-link-view.ts +0 -33
- package/src/hooks/chat/use-chat-scroll.ts +0 -68
- package/src/hooks/chat/use-chat-session-actions.ts +0 -520
- package/src/hooks/chat/use-chat-session-messages.ts +0 -607
- package/src/hooks/chat/use-chat-session.ts +0 -183
- package/src/hooks/chat/use-chat-view.ts +0 -59
- package/src/hooks/chat/use-composer-control-shortcuts.ts +0 -69
- package/src/hooks/chat/use-terminal-dock-visibility.ts +0 -39
- package/src/hooks/chat/workspace-file-panel-state.ts +0 -43
- package/src/hooks/session-subscription-cache.ts +0 -25
- package/src/hooks/use-app-preferences.ts +0 -51
- package/src/hooks/use-chat-layout-query-state.ts +0 -29
- package/src/hooks/use-responsive-layout.ts +0 -115
- package/src/hooks/use-roving-focus-list.ts +0 -104
- package/src/hooks/use-sender-header-query-state.ts +0 -35
- package/src/hooks/use-session-subscription.ts +0 -144
- package/src/hooks/use-sidebar-navigation.ts +0 -40
- package/src/hooks/use-sidebar-query-state.ts +0 -79
- package/src/hooks/useGlobalShortcut.ts +0 -26
- package/src/hooks/useQueryParams.ts +0 -124
- package/src/i18n-resources.ts +0 -44
- package/src/i18n.ts +0 -37
- package/src/main.tsx +0 -60
- package/src/pwa.ts +0 -46
- package/src/resources/adapters.ts +0 -46
- package/src/resources/locales/en.json +0 -1972
- package/src/resources/locales/zh.json +0 -1973
- package/src/routes/AppRoutes.tsx +0 -22
- package/src/routes/ArchiveRoute.tsx +0 -5
- package/src/routes/AutomationRoute.tsx +0 -5
- package/src/routes/BenchmarkRoute.tsx +0 -5
- package/src/routes/ChatRoute.scss +0 -529
- package/src/routes/ChatRoute.tsx +0 -40
- package/src/routes/ChatRouteBottomPanel.tsx +0 -47
- package/src/routes/ChatRouteView.tsx +0 -199
- package/src/routes/ConfigRoute.tsx +0 -5
- package/src/routes/KnowledgeRoute.tsx +0 -5
- package/src/runtime-config.ts +0 -239
- package/src/server-connection-history.ts +0 -179
- package/src/store/index.ts +0 -173
- package/src/styles/global.scss +0 -113
- package/src/styles/material-symbols-rounded.scss +0 -23
- package/src/utils/chat-links.ts +0 -21
- package/src/utils/copy.ts +0 -18
- package/src/utils/mobile-viewport.ts +0 -67
- package/src/utils/safe-serialize.ts +0 -84
- package/src/utils/shortcutUtils.ts +0 -198
- package/src/utils/strip-ansi.ts +0 -26
- package/src/version-compatibility.ts +0 -37
- package/src/vite-env.d.ts +0 -33
- package/src/ws.ts +0 -47
- package/vite.config.ts +0 -127
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
2
|
-
|
|
3
|
-
export const getLoopedIndex = (
|
|
4
|
-
currentIndex: number,
|
|
5
|
-
delta: number,
|
|
6
|
-
itemCount: number
|
|
7
|
-
) => {
|
|
8
|
-
if (itemCount <= 0) {
|
|
9
|
-
return -1
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const nextIndex = (currentIndex + delta) % itemCount
|
|
13
|
-
return nextIndex < 0 ? nextIndex + itemCount : nextIndex
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const useRovingFocusList = <T extends string>(
|
|
17
|
-
keys: T[],
|
|
18
|
-
initialKey?: T | null
|
|
19
|
-
) => {
|
|
20
|
-
const itemRefs = useRef(new Map<T, HTMLElement>())
|
|
21
|
-
const [activeKey, setActiveKey] = useState<T | null>(() => {
|
|
22
|
-
if (initialKey != null && keys.includes(initialKey)) {
|
|
23
|
-
return initialKey
|
|
24
|
-
}
|
|
25
|
-
return keys[0] ?? null
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (keys.length === 0) {
|
|
30
|
-
setActiveKey(null)
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (activeKey != null && keys.includes(activeKey)) {
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (initialKey != null && keys.includes(initialKey)) {
|
|
39
|
-
setActiveKey(initialKey)
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
setActiveKey(keys[0] ?? null)
|
|
44
|
-
}, [activeKey, initialKey, keys])
|
|
45
|
-
|
|
46
|
-
const registerItem = useCallback((key: T) => {
|
|
47
|
-
return (node: HTMLElement | null) => {
|
|
48
|
-
if (node == null) {
|
|
49
|
-
itemRefs.current.delete(key)
|
|
50
|
-
return
|
|
51
|
-
}
|
|
52
|
-
itemRefs.current.set(key, node)
|
|
53
|
-
}
|
|
54
|
-
}, [])
|
|
55
|
-
|
|
56
|
-
const focusKey = useCallback((key: T | null) => {
|
|
57
|
-
if (key == null) {
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
setActiveKey(key)
|
|
61
|
-
itemRefs.current.get(key)?.focus()
|
|
62
|
-
}, [])
|
|
63
|
-
|
|
64
|
-
const keyIndexMap = useMemo(() => {
|
|
65
|
-
return new Map(keys.map((key, index) => [key, index]))
|
|
66
|
-
}, [keys])
|
|
67
|
-
|
|
68
|
-
const moveFocus = useCallback((delta: number, fromKey?: T | null) => {
|
|
69
|
-
if (keys.length === 0) {
|
|
70
|
-
return null
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const sourceKey = fromKey ?? activeKey ?? keys[0] ?? null
|
|
74
|
-
const sourceIndex = sourceKey == null ? 0 : (keyIndexMap.get(sourceKey) ?? 0)
|
|
75
|
-
const nextIndex = getLoopedIndex(sourceIndex, delta, keys.length)
|
|
76
|
-
const nextKey = keys[nextIndex] ?? null
|
|
77
|
-
if (nextKey != null) {
|
|
78
|
-
focusKey(nextKey)
|
|
79
|
-
}
|
|
80
|
-
return nextKey
|
|
81
|
-
}, [activeKey, focusKey, keyIndexMap, keys])
|
|
82
|
-
|
|
83
|
-
const focusFirst = useCallback(() => {
|
|
84
|
-
const firstKey = keys[0] ?? null
|
|
85
|
-
focusKey(firstKey)
|
|
86
|
-
return firstKey
|
|
87
|
-
}, [focusKey, keys])
|
|
88
|
-
|
|
89
|
-
const focusLast = useCallback(() => {
|
|
90
|
-
const lastKey = keys.at(-1) ?? null
|
|
91
|
-
focusKey(lastKey)
|
|
92
|
-
return lastKey
|
|
93
|
-
}, [focusKey, keys])
|
|
94
|
-
|
|
95
|
-
return {
|
|
96
|
-
activeKey,
|
|
97
|
-
setActiveKey,
|
|
98
|
-
registerItem,
|
|
99
|
-
focusKey,
|
|
100
|
-
moveFocus,
|
|
101
|
-
focusFirst,
|
|
102
|
-
focusLast
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useAtomValue } from 'jotai'
|
|
2
|
-
|
|
3
|
-
import { useQueryParams } from '#~/hooks/useQueryParams.js'
|
|
4
|
-
import { senderHeaderDisplayAtom } from '#~/store/index.js'
|
|
5
|
-
|
|
6
|
-
const isSenderHeaderQueryValue = (
|
|
7
|
-
value: string | null
|
|
8
|
-
): value is 'collapsed' | 'expanded' => {
|
|
9
|
-
return value === 'collapsed' || value === 'expanded'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function useSenderHeaderQueryState() {
|
|
13
|
-
const senderHeaderDisplay = useAtomValue(senderHeaderDisplayAtom)
|
|
14
|
-
const { update, searchParams } = useQueryParams<{
|
|
15
|
-
senderHeader: string
|
|
16
|
-
}>({
|
|
17
|
-
keys: ['senderHeader'],
|
|
18
|
-
defaults: {
|
|
19
|
-
senderHeader: ''
|
|
20
|
-
},
|
|
21
|
-
omit: {
|
|
22
|
-
senderHeader: value => value === ''
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
const rawSenderHeader = searchParams.get('senderHeader')
|
|
27
|
-
const senderHeaderState = isSenderHeaderQueryValue(rawSenderHeader)
|
|
28
|
-
? rawSenderHeader
|
|
29
|
-
: senderHeaderDisplay
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
isHeaderCollapsed: senderHeaderState === 'collapsed',
|
|
33
|
-
setHeaderCollapsed: (collapsed: boolean) => update({ senderHeader: collapsed ? 'collapsed' : 'expanded' })
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react'
|
|
2
|
-
import { useSWRConfig } from 'swr'
|
|
3
|
-
|
|
4
|
-
import type { Session, WSEvent } from '@vibe-forge/core'
|
|
5
|
-
|
|
6
|
-
import { revalidateConfigRelatedCaches } from '#~/hooks/session-subscription-cache'
|
|
7
|
-
import { createSocket } from '#~/ws.js'
|
|
8
|
-
|
|
9
|
-
interface SessionListResponse {
|
|
10
|
-
sessions: Session[]
|
|
11
|
-
}
|
|
12
|
-
interface DeletedSessionUpdate {
|
|
13
|
-
id: string
|
|
14
|
-
isDeleted: boolean
|
|
15
|
-
}
|
|
16
|
-
type SessionUpdate = Session | DeletedSessionUpdate
|
|
17
|
-
|
|
18
|
-
const isDeletedSessionUpdate = (update: SessionUpdate): update is DeletedSessionUpdate => {
|
|
19
|
-
return 'isDeleted' in update && update.isDeleted
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const sortSessions = (sessions: Session[]) => {
|
|
23
|
-
return [...sessions].sort((a, b) => {
|
|
24
|
-
const starredDelta = Number(b.isStarred === true) - Number(a.isStarred === true)
|
|
25
|
-
if (starredDelta !== 0) return starredDelta
|
|
26
|
-
return (b.createdAt ?? 0) - (a.createdAt ?? 0)
|
|
27
|
-
})
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const mergeSessionList = (
|
|
31
|
-
prev: SessionListResponse | undefined,
|
|
32
|
-
updatedSession: SessionUpdate,
|
|
33
|
-
filter: 'active' | 'archived'
|
|
34
|
-
) => {
|
|
35
|
-
if (prev?.sessions == null) return prev
|
|
36
|
-
|
|
37
|
-
if (isDeletedSessionUpdate(updatedSession)) {
|
|
38
|
-
return {
|
|
39
|
-
...prev,
|
|
40
|
-
sessions: prev.sessions.filter((session) => session.id !== updatedSession.id)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const session = updatedSession
|
|
45
|
-
const shouldInclude = filter === 'archived'
|
|
46
|
-
? session.isArchived === true
|
|
47
|
-
: session.isArchived !== true
|
|
48
|
-
const existing = prev.sessions.find((session) => session.id === updatedSession.id)
|
|
49
|
-
|
|
50
|
-
if (!shouldInclude) {
|
|
51
|
-
return {
|
|
52
|
-
...prev,
|
|
53
|
-
sessions: prev.sessions.filter((session) => session.id !== updatedSession.id)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const nextSessions = existing
|
|
58
|
-
? prev.sessions.map((currentSession) =>
|
|
59
|
-
currentSession.id === updatedSession.id ? { ...currentSession, ...session } : currentSession
|
|
60
|
-
)
|
|
61
|
-
: [session, ...prev.sessions]
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
...prev,
|
|
65
|
-
sessions: sortSessions(nextSessions)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export function useSessionSubscription() {
|
|
70
|
-
const { mutate } = useSWRConfig()
|
|
71
|
-
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
let disposed = false
|
|
74
|
-
let socket: WebSocket | undefined
|
|
75
|
-
let connectTimer: ReturnType<typeof setTimeout> | undefined
|
|
76
|
-
|
|
77
|
-
const closeSocket = (target: WebSocket | undefined) => {
|
|
78
|
-
if (!target) return
|
|
79
|
-
if (target.readyState === WebSocket.CLOSED || target.readyState === WebSocket.CLOSING) {
|
|
80
|
-
return
|
|
81
|
-
}
|
|
82
|
-
if (target.readyState === WebSocket.CONNECTING) {
|
|
83
|
-
target.addEventListener('open', () => target.close(), { once: true })
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
target.close()
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const scheduleConnect = (delay = 0) => {
|
|
90
|
-
if (disposed) return
|
|
91
|
-
if (connectTimer) {
|
|
92
|
-
clearTimeout(connectTimer)
|
|
93
|
-
}
|
|
94
|
-
connectTimer = setTimeout(() => {
|
|
95
|
-
connectTimer = undefined
|
|
96
|
-
connect()
|
|
97
|
-
}, delay)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const connect = () => {
|
|
101
|
-
if (disposed) return
|
|
102
|
-
|
|
103
|
-
socket = createSocket({
|
|
104
|
-
onMessage: (data: WSEvent) => {
|
|
105
|
-
if (disposed) return
|
|
106
|
-
|
|
107
|
-
if (data.type === 'session_updated') {
|
|
108
|
-
const updatedSession = data.session as SessionUpdate
|
|
109
|
-
|
|
110
|
-
void mutate('/api/sessions', (prev: SessionListResponse | undefined) => {
|
|
111
|
-
return mergeSessionList(prev, updatedSession, 'active')
|
|
112
|
-
}, false)
|
|
113
|
-
|
|
114
|
-
void mutate('/api/sessions/archived', (prev: SessionListResponse | undefined) => {
|
|
115
|
-
return mergeSessionList(prev, updatedSession, 'archived')
|
|
116
|
-
}, false)
|
|
117
|
-
return
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (data.type === 'config_updated') {
|
|
121
|
-
void revalidateConfigRelatedCaches(mutate)
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
onClose: () => {
|
|
125
|
-
if (disposed) return
|
|
126
|
-
scheduleConnect(1000)
|
|
127
|
-
},
|
|
128
|
-
onError: () => {
|
|
129
|
-
closeSocket(socket)
|
|
130
|
-
}
|
|
131
|
-
}, { subscribe: 'sessions' })
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
scheduleConnect()
|
|
135
|
-
|
|
136
|
-
return () => {
|
|
137
|
-
disposed = true
|
|
138
|
-
if (connectTimer) {
|
|
139
|
-
clearTimeout(connectTimer)
|
|
140
|
-
}
|
|
141
|
-
closeSocket(socket)
|
|
142
|
-
}
|
|
143
|
-
}, [mutate])
|
|
144
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { useAtomValue } from 'jotai'
|
|
2
|
-
import { useCallback } from 'react'
|
|
3
|
-
import { matchPath, useLocation, useNavigate } from 'react-router-dom'
|
|
4
|
-
|
|
5
|
-
import type { Session } from '@vibe-forge/core'
|
|
6
|
-
|
|
7
|
-
import { sidebarWidthAtom } from '#~/store'
|
|
8
|
-
|
|
9
|
-
const SESSION_ROUTE_PATTERN = '/session/:sessionId'
|
|
10
|
-
|
|
11
|
-
export function useSidebarNavigation() {
|
|
12
|
-
const navigate = useNavigate()
|
|
13
|
-
const location = useLocation()
|
|
14
|
-
const sidebarWidth = useAtomValue(sidebarWidthAtom)
|
|
15
|
-
const sessionMatch = matchPath({ path: SESSION_ROUTE_PATTERN, end: true }, location.pathname)
|
|
16
|
-
const activeSessionId = sessionMatch?.params.sessionId
|
|
17
|
-
const showSidebar = location.pathname === '/' || activeSessionId != null
|
|
18
|
-
|
|
19
|
-
const getNavigationTarget = useCallback((pathname: string) => ({
|
|
20
|
-
pathname,
|
|
21
|
-
search: location.search
|
|
22
|
-
}), [location.search])
|
|
23
|
-
|
|
24
|
-
const handleSelectSession = useCallback((session: Session, _isNew?: boolean) => {
|
|
25
|
-
void navigate(getNavigationTarget(session.id === '' ? '/' : `/session/${session.id}`))
|
|
26
|
-
}, [getNavigationTarget, navigate])
|
|
27
|
-
|
|
28
|
-
const handleDeletedSession = useCallback((deletedId: string, nextId?: string) => {
|
|
29
|
-
if (activeSessionId !== deletedId) return
|
|
30
|
-
void navigate(getNavigationTarget(nextId ? `/session/${nextId}` : '/'))
|
|
31
|
-
}, [activeSessionId, getNavigationTarget, navigate])
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
activeSessionId,
|
|
35
|
-
handleDeletedSession,
|
|
36
|
-
handleSelectSession,
|
|
37
|
-
showSidebar,
|
|
38
|
-
sidebarWidth
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react'
|
|
2
|
-
|
|
3
|
-
import { useQueryParams } from '#~/hooks/useQueryParams.js'
|
|
4
|
-
|
|
5
|
-
export type SidebarSessionSortOrder = 'asc' | 'desc'
|
|
6
|
-
|
|
7
|
-
const splitFilterValues = (raw: string) => {
|
|
8
|
-
return Array.from(
|
|
9
|
-
new Set(
|
|
10
|
-
raw
|
|
11
|
-
.split(',')
|
|
12
|
-
.map((value) => value.trim())
|
|
13
|
-
.filter(Boolean)
|
|
14
|
-
)
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const joinFilterValues = (values: string[]) => {
|
|
19
|
-
return Array.from(
|
|
20
|
-
new Set(
|
|
21
|
-
values
|
|
22
|
-
.map((value) => value.trim())
|
|
23
|
-
.filter(Boolean)
|
|
24
|
-
)
|
|
25
|
-
).join(',')
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function useSidebarQueryState() {
|
|
29
|
-
const { values, update } = useQueryParams<{
|
|
30
|
-
adapter: string
|
|
31
|
-
search: string
|
|
32
|
-
sort: string
|
|
33
|
-
sidebar: string
|
|
34
|
-
tag: string
|
|
35
|
-
}>({
|
|
36
|
-
keys: ['sidebar', 'search', 'tag', 'adapter', 'sort'],
|
|
37
|
-
defaults: {
|
|
38
|
-
sidebar: '',
|
|
39
|
-
search: '',
|
|
40
|
-
tag: '',
|
|
41
|
-
adapter: '',
|
|
42
|
-
sort: ''
|
|
43
|
-
},
|
|
44
|
-
omit: {
|
|
45
|
-
sidebar: (value) => value === '',
|
|
46
|
-
search: (value) => value === '',
|
|
47
|
-
tag: (value) => value === '',
|
|
48
|
-
adapter: (value) => value === '',
|
|
49
|
-
sort: (value) => value === ''
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
const tagFilters = useMemo(() => splitFilterValues(values.tag), [values.tag])
|
|
54
|
-
const adapterFilters = useMemo(() => splitFilterValues(values.adapter), [values.adapter])
|
|
55
|
-
const searchQuery = values.search
|
|
56
|
-
const sortSelection: SidebarSessionSortOrder | undefined = values.sort === 'asc' || values.sort === 'desc'
|
|
57
|
-
? values.sort
|
|
58
|
-
: undefined
|
|
59
|
-
const sortOrder: SidebarSessionSortOrder = sortSelection ?? 'desc'
|
|
60
|
-
const isSidebarCollapsed = values.sidebar === 'collapsed'
|
|
61
|
-
const hasActiveFilterConditions = searchQuery.trim() !== '' || tagFilters.length > 0 || adapterFilters.length > 0
|
|
62
|
-
const hasActiveSearchControls = hasActiveFilterConditions || sortSelection != null
|
|
63
|
-
|
|
64
|
-
return {
|
|
65
|
-
adapterFilters,
|
|
66
|
-
hasActiveFilterConditions,
|
|
67
|
-
hasActiveSearchControls,
|
|
68
|
-
isSidebarCollapsed,
|
|
69
|
-
searchQuery,
|
|
70
|
-
setSortOrder: (sort?: SidebarSessionSortOrder) => update({ sort: sort ?? '' }),
|
|
71
|
-
setAdapterFilters: (filters: string[]) => update({ adapter: joinFilterValues(filters) }),
|
|
72
|
-
setSearchQuery: (search: string) => update({ search }),
|
|
73
|
-
setSidebarCollapsed: (collapsed: boolean) => update({ sidebar: collapsed ? 'collapsed' : '' }),
|
|
74
|
-
setTagFilters: (filters: string[]) => update({ tag: joinFilterValues(filters) }),
|
|
75
|
-
sortOrder,
|
|
76
|
-
sortSelection,
|
|
77
|
-
tagFilters
|
|
78
|
-
}
|
|
79
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react'
|
|
2
|
-
|
|
3
|
-
import { isShortcutMatch } from '../utils/shortcutUtils'
|
|
4
|
-
|
|
5
|
-
export const useGlobalShortcut = ({
|
|
6
|
-
shortcut,
|
|
7
|
-
enabled = true,
|
|
8
|
-
isMac,
|
|
9
|
-
onTrigger
|
|
10
|
-
}: {
|
|
11
|
-
shortcut?: string
|
|
12
|
-
enabled?: boolean
|
|
13
|
-
isMac: boolean
|
|
14
|
-
onTrigger: (event: KeyboardEvent) => void
|
|
15
|
-
}) => {
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
if (!enabled) return
|
|
18
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
19
|
-
if (isShortcutMatch(event, shortcut, isMac)) {
|
|
20
|
-
onTrigger(event)
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
window.addEventListener('keydown', handleKeyDown)
|
|
24
|
-
return () => window.removeEventListener('keydown', handleKeyDown)
|
|
25
|
-
}, [enabled, isMac, onTrigger, shortcut])
|
|
26
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo } from 'react'
|
|
2
|
-
import { useNavigate, useSearchParams } from 'react-router-dom'
|
|
3
|
-
|
|
4
|
-
import { getClientBase } from '#~/runtime-config.js'
|
|
5
|
-
|
|
6
|
-
type QueryParamKey<T> = Extract<keyof T, string>
|
|
7
|
-
|
|
8
|
-
interface QueryParamConfig<T extends Record<string, string>> {
|
|
9
|
-
keys: QueryParamKey<T>[]
|
|
10
|
-
defaults?: Partial<T>
|
|
11
|
-
omit?: Partial<Record<QueryParamKey<T>, (value: string) => boolean>>
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const resolveQueryParamPathname = (rawPathname: string, clientBase: string) => {
|
|
15
|
-
if (!rawPathname.startsWith(clientBase)) {
|
|
16
|
-
return rawPathname === '' ? '/' : rawPathname
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const relativePath = rawPathname.slice(clientBase.length)
|
|
20
|
-
if (relativePath === '') {
|
|
21
|
-
return '/'
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return relativePath.startsWith('/') ? relativePath : `/${relativePath}`
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const buildQueryParamNavigationTarget = <T extends Record<string, string>>({
|
|
28
|
-
clientBase,
|
|
29
|
-
currentHash,
|
|
30
|
-
currentPathname,
|
|
31
|
-
currentSearch,
|
|
32
|
-
defaults,
|
|
33
|
-
keySet,
|
|
34
|
-
keys,
|
|
35
|
-
omit,
|
|
36
|
-
patch
|
|
37
|
-
}: {
|
|
38
|
-
clientBase: string
|
|
39
|
-
currentHash: string
|
|
40
|
-
currentPathname: string
|
|
41
|
-
currentSearch: string
|
|
42
|
-
defaults?: Partial<T>
|
|
43
|
-
keySet: Set<string>
|
|
44
|
-
keys: QueryParamKey<T>[]
|
|
45
|
-
omit?: Partial<Record<QueryParamKey<T>, (value: string) => boolean>>
|
|
46
|
-
patch: Partial<T>
|
|
47
|
-
}) => {
|
|
48
|
-
const currentSearchParams = new URLSearchParams(currentSearch)
|
|
49
|
-
const nextParams = new URLSearchParams()
|
|
50
|
-
const merged = keys.reduce((acc, key) => {
|
|
51
|
-
const raw = currentSearchParams.get(key)
|
|
52
|
-
const fallback = defaults?.[key] ?? ''
|
|
53
|
-
acc[key] = (raw ?? fallback) as T[QueryParamKey<T>]
|
|
54
|
-
return acc
|
|
55
|
-
}, {} as T)
|
|
56
|
-
|
|
57
|
-
Object.assign(merged, patch)
|
|
58
|
-
|
|
59
|
-
keys.forEach((key) => {
|
|
60
|
-
const value = merged[key] ?? ''
|
|
61
|
-
const shouldOmit = value === '' || (omit?.[key] ? omit[key]!(value) : false)
|
|
62
|
-
if (!shouldOmit) nextParams.set(key, value)
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
for (const [key, value] of currentSearchParams.entries()) {
|
|
66
|
-
if (!keySet.has(key)) nextParams.append(key, value)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (nextParams.toString() === currentSearchParams.toString()) {
|
|
70
|
-
return null
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
pathname: resolveQueryParamPathname(currentPathname, clientBase),
|
|
75
|
-
search: nextParams.toString() === '' ? '' : `?${nextParams.toString()}`,
|
|
76
|
-
hash: currentHash
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export const useQueryParams = <T extends Record<string, string>>({
|
|
81
|
-
keys,
|
|
82
|
-
defaults,
|
|
83
|
-
omit
|
|
84
|
-
}: QueryParamConfig<T>) => {
|
|
85
|
-
const navigate = useNavigate()
|
|
86
|
-
const [searchParams] = useSearchParams()
|
|
87
|
-
const keySet = useMemo(() => new Set<string>(keys), [keys])
|
|
88
|
-
|
|
89
|
-
const values = useMemo(() => {
|
|
90
|
-
return keys.reduce((acc, key) => {
|
|
91
|
-
const raw = searchParams.get(key)
|
|
92
|
-
const fallback = defaults?.[key] ?? ''
|
|
93
|
-
acc[key] = (raw ?? fallback) as T[QueryParamKey<T>]
|
|
94
|
-
return acc
|
|
95
|
-
}, {} as T)
|
|
96
|
-
}, [defaults, keys, searchParams])
|
|
97
|
-
|
|
98
|
-
const update = useCallback((patch: Partial<T>) => {
|
|
99
|
-
const currentLocation = typeof window === 'undefined'
|
|
100
|
-
? {
|
|
101
|
-
hash: '',
|
|
102
|
-
pathname: '/',
|
|
103
|
-
search: searchParams.toString() === '' ? '' : `?${searchParams.toString()}`
|
|
104
|
-
}
|
|
105
|
-
: window.location
|
|
106
|
-
const target = buildQueryParamNavigationTarget<T>({
|
|
107
|
-
clientBase: getClientBase(),
|
|
108
|
-
currentHash: currentLocation.hash,
|
|
109
|
-
currentPathname: currentLocation.pathname,
|
|
110
|
-
currentSearch: currentLocation.search,
|
|
111
|
-
defaults,
|
|
112
|
-
keySet,
|
|
113
|
-
keys,
|
|
114
|
-
omit,
|
|
115
|
-
patch
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
if (target != null) {
|
|
119
|
-
void navigate(target, { replace: true })
|
|
120
|
-
}
|
|
121
|
-
}, [defaults, keySet, keys, navigate, omit, searchParams])
|
|
122
|
-
|
|
123
|
-
return { values, update, searchParams }
|
|
124
|
-
}
|
package/src/i18n-resources.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { Resource, i18n as I18nInstance } from 'i18next'
|
|
2
|
-
|
|
3
|
-
export type LocaleMessages = Record<string, unknown>
|
|
4
|
-
|
|
5
|
-
export interface LocaleModule {
|
|
6
|
-
default: LocaleMessages
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type LocaleModuleMap = Record<string, LocaleModule>
|
|
10
|
-
|
|
11
|
-
export const getLocaleCodeFromPath = (path: string) => (
|
|
12
|
-
path.match(/\/([^/]+)\.json$/)?.[1] ?? path
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
export const buildTranslationResources = (modules: LocaleModuleMap): Resource => (
|
|
16
|
-
Object.fromEntries(
|
|
17
|
-
Object.entries(modules).map(([path, mod]) => [
|
|
18
|
-
getLocaleCodeFromPath(path),
|
|
19
|
-
{ translation: mod.default }
|
|
20
|
-
])
|
|
21
|
-
)
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
export const applyHotTranslationUpdates = ({
|
|
25
|
-
instance,
|
|
26
|
-
modulePaths,
|
|
27
|
-
nextModules
|
|
28
|
-
}: {
|
|
29
|
-
instance: I18nInstance
|
|
30
|
-
modulePaths: string[]
|
|
31
|
-
nextModules: Array<LocaleModule | undefined>
|
|
32
|
-
}) => {
|
|
33
|
-
modulePaths.forEach((path, index) => {
|
|
34
|
-
const nextModule = nextModules[index]
|
|
35
|
-
if (nextModule == null) return
|
|
36
|
-
const localeCode = getLocaleCodeFromPath(path)
|
|
37
|
-
instance.removeResourceBundle(localeCode, 'translation')
|
|
38
|
-
instance.addResourceBundle(
|
|
39
|
-
localeCode,
|
|
40
|
-
'translation',
|
|
41
|
-
nextModule.default
|
|
42
|
-
)
|
|
43
|
-
})
|
|
44
|
-
}
|
package/src/i18n.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import i18n from 'i18next'
|
|
2
|
-
import LanguageDetector from 'i18next-browser-languagedetector'
|
|
3
|
-
import { initReactI18next } from 'react-i18next'
|
|
4
|
-
|
|
5
|
-
import { applyHotTranslationUpdates, buildTranslationResources } from './i18n-resources'
|
|
6
|
-
import type { LocaleModule, LocaleModuleMap } from './i18n-resources'
|
|
7
|
-
|
|
8
|
-
const localeModules = import.meta.glob('./resources/locales/*.json', {
|
|
9
|
-
eager: true
|
|
10
|
-
}) as LocaleModuleMap
|
|
11
|
-
const localeModulePaths = Object.keys(localeModules).sort()
|
|
12
|
-
|
|
13
|
-
void i18n
|
|
14
|
-
.use(LanguageDetector)
|
|
15
|
-
.use(initReactI18next)
|
|
16
|
-
.init({
|
|
17
|
-
resources: buildTranslationResources(localeModules),
|
|
18
|
-
fallbackLng: 'zh',
|
|
19
|
-
interpolation: {
|
|
20
|
-
escapeValue: false
|
|
21
|
-
},
|
|
22
|
-
react: {
|
|
23
|
-
bindI18nStore: 'added'
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
if (import.meta.hot) {
|
|
28
|
-
import.meta.hot.accept(localeModulePaths, (nextModules) => {
|
|
29
|
-
applyHotTranslationUpdates({
|
|
30
|
-
instance: i18n,
|
|
31
|
-
modulePaths: localeModulePaths,
|
|
32
|
-
nextModules: nextModules as Array<LocaleModule | undefined>
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export default i18n
|
package/src/main.tsx
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import 'devicon/devicon.min.css'
|
|
2
|
-
|
|
3
|
-
import './styles/material-symbols-rounded.scss'
|
|
4
|
-
import './styles/global.scss'
|
|
5
|
-
import './i18n'
|
|
6
|
-
|
|
7
|
-
import { App as AntdApp, ConfigProvider } from 'antd'
|
|
8
|
-
import zhCN from 'antd/locale/zh_CN'
|
|
9
|
-
import React from 'react'
|
|
10
|
-
import { createRoot } from 'react-dom/client'
|
|
11
|
-
import { BrowserRouter } from 'react-router-dom'
|
|
12
|
-
import { SWRConfig } from 'swr'
|
|
13
|
-
|
|
14
|
-
import { fetchApiJson } from '#~/api/base.js'
|
|
15
|
-
import { setupPwa } from '#~/pwa.js'
|
|
16
|
-
import { getClientBase, resolveDevDocumentTitle } from '#~/runtime-config.js'
|
|
17
|
-
import { setupMobileViewport } from '#~/utils/mobile-viewport.js'
|
|
18
|
-
|
|
19
|
-
import App from './App'
|
|
20
|
-
|
|
21
|
-
const gitRefLabel = import.meta.env.__VF_PROJECT_AI_GIT_REF_LABEL__ ?? ''
|
|
22
|
-
|
|
23
|
-
const appTitle = import.meta.env.DEV && gitRefLabel !== ''
|
|
24
|
-
? `Vibe Forge Web [${gitRefLabel}]`
|
|
25
|
-
: 'Vibe Forge Web'
|
|
26
|
-
|
|
27
|
-
document.title = appTitle
|
|
28
|
-
|
|
29
|
-
const root = createRoot(document.getElementById('root')!)
|
|
30
|
-
|
|
31
|
-
setupMobileViewport()
|
|
32
|
-
|
|
33
|
-
const clientBase = getClientBase()
|
|
34
|
-
setupPwa({
|
|
35
|
-
clientBase,
|
|
36
|
-
isProd: import.meta.env.PROD
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
document.title = resolveDevDocumentTitle(document.title, {
|
|
40
|
-
isDev: import.meta.env.DEV,
|
|
41
|
-
gitRef: import.meta.env.__VF_PROJECT_AI_DEV_GIT_REF__
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
root.render(
|
|
45
|
-
<React.StrictMode>
|
|
46
|
-
<ConfigProvider locale={zhCN} theme={{ token: { colorPrimary: '#000000' } }}>
|
|
47
|
-
<AntdApp>
|
|
48
|
-
<SWRConfig
|
|
49
|
-
value={{
|
|
50
|
-
fetcher: async (path: string) => fetchApiJson<unknown>(path)
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
<BrowserRouter basename={clientBase}>
|
|
54
|
-
<App />
|
|
55
|
-
</BrowserRouter>
|
|
56
|
-
</SWRConfig>
|
|
57
|
-
</AntdApp>
|
|
58
|
-
</ConfigProvider>
|
|
59
|
-
</React.StrictMode>
|
|
60
|
-
)
|