@kabmo-labs/kabmo 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -0
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +336 -336
- package/dist/client/static/js/index-18xe7655.css +1 -0
- package/dist/client/static/js/{index-qwpvd9fv.js → index-nxpe7835.js} +933 -898
- package/package.json +11 -1
- package/src/client/components/common/code-surface/bracket-guide.test.ts +249 -0
- package/src/client/components/common/code-surface/bracket-guide.ts +131 -0
- package/src/client/components/common/code-surface/documents.test.ts +122 -0
- package/src/client/components/common/code-surface/documents.ts +286 -0
- package/src/client/components/common/code-surface/extensions.test.ts +115 -0
- package/src/client/components/common/code-surface/extensions.ts +295 -0
- package/src/client/components/common/code-surface/fold-stack.test.ts +218 -0
- package/src/client/components/common/code-surface/fold.test.ts +148 -0
- package/src/client/components/common/code-surface/fold.ts +118 -0
- package/src/client/components/common/code-surface/handle.ts +102 -0
- package/src/client/components/common/code-surface/indent-guide.ts +104 -0
- package/src/client/components/common/code-surface/indent.test.ts +239 -0
- package/src/client/components/common/code-surface/indent.ts +124 -0
- package/src/client/components/common/code-surface/index.tsx +283 -314
- package/src/client/components/common/code-surface/keymap.test.ts +133 -0
- package/src/client/components/common/code-surface/keymap.ts +256 -0
- package/src/client/components/common/code-surface/line-commands.test.ts +90 -0
- package/src/client/components/common/code-surface/line-commands.ts +103 -0
- package/src/client/components/common/code-surface/marks.ts +74 -0
- package/src/client/components/common/code-surface/props.ts +87 -0
- package/src/client/components/common/code-surface/shiki.ts +234 -0
- package/src/client/components/common/code-surface/stream-language.test.ts +118 -0
- package/src/client/components/common/code-surface/stream-language.ts +123 -0
- package/src/client/components/common/code-surface/sync.test.ts +185 -0
- package/src/client/components/common/code-surface/sync.ts +58 -0
- package/src/client/components/common/code-surface/theme.test.ts +237 -0
- package/src/client/components/common/code-surface/theme.ts +224 -0
- package/src/client/components/common/code-surface/typing.test.ts +97 -0
- package/src/client/components/common/code-surface/typing.ts +111 -0
- package/src/client/components/common/editor-view-buttons/index.test.tsx +148 -0
- package/src/client/components/common/editor-view-buttons/index.tsx +109 -0
- package/src/client/components/common/shell-update-button/Modal.tsx +163 -0
- package/src/client/components/common/shell-update-button/index.test.tsx +251 -0
- package/src/client/components/common/shell-update-button/index.tsx +125 -0
- package/src/client/components/common/toolbar-row/index.test.tsx +215 -0
- package/src/client/components/common/toolbar-row/index.tsx +260 -0
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +58 -78
- package/src/client/components/layout/desktop-layout/index.tsx +65 -67
- package/src/client/components/layout/desktop-layout/resizer/index.tsx +6 -3
- package/src/client/components/layout/session-sidebar/Footer.tsx +8 -15
- package/src/client/components/mobile/LayoutWrapper.tsx +1 -0
- package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +3 -0
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +98 -71
- package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +20 -1
- package/src/client/components/mobile/mobile-right-sidebar/OutlineButton.test.tsx +137 -0
- package/src/client/components/mobile/mobile-right-sidebar/OutlineButton.tsx +14 -3
- package/src/client/components/mobile/mobile-right-sidebar/editor-props.ts +25 -0
- package/src/client/components/mobile/mobile-session-sidebar/Footer.tsx +9 -21
- package/src/client/components/settings/Modal.tsx +8 -0
- package/src/client/components/settings/categories/AppearanceSettings.tsx +9 -0
- package/src/client/components/settings/categories/appearance-settings/EditorIndentSection.tsx +87 -0
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.test.tsx +167 -0
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +184 -0
- package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +99 -0
- package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +8 -2
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +16 -8
- package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +9 -4
- package/src/client/components/workspace/chat-timeline/TaskResultContent.tsx +9 -7
- package/src/client/components/workspace/chat-timeline/chat-input/expansion.ts +9 -4
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +15 -11
- package/src/client/components/workspace/chat-timeline/chat-input/stretch-send.test.tsx +165 -0
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.test.tsx +132 -0
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +120 -0
- package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.test.tsx +319 -0
- package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +285 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.test.ts +2 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/hashline-patch/index.tsx +34 -29
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AstEdit.tsx +11 -9
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +10 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +25 -8
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Eval.tsx +8 -11
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/FileMatches.test.ts +114 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/FileMatches.tsx +111 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +7 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchTool.tsx +9 -59
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactBody.tsx +2 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.test.ts +43 -30
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.tsx +49 -32
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ExcerptCode.tsx +8 -8
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/HighlightedCode.tsx +35 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/JsonCodeBlock.tsx +4 -4
- package/src/client/components/workspace/diff-panel/MergeDiffView.tsx +179 -0
- package/src/client/components/workspace/diff-panel/ThemedMergeDiffView.tsx +24 -0
- package/src/client/components/workspace/diff-panel/Toolbar.tsx +224 -186
- package/src/client/components/workspace/diff-panel/ToolbarSegments.tsx +98 -0
- package/src/client/components/workspace/diff-panel/index.tsx +76 -145
- package/src/client/components/workspace/diff-panel/merge.ts +315 -0
- package/src/client/components/workspace/editor/Body.tsx +28 -7
- package/src/client/components/workspace/editor/CommandPalette.tsx +6 -6
- package/src/client/components/workspace/editor/ConflictStrip.tsx +77 -0
- package/src/client/components/workspace/editor/Dialogs.tsx +53 -0
- package/src/client/components/workspace/editor/EmptyEditor.tsx +23 -0
- package/src/client/components/workspace/editor/ExternalChangeStrip.tsx +61 -0
- package/src/client/components/workspace/editor/FileDocument.tsx +146 -63
- package/src/client/components/workspace/editor/FilePane.tsx +47 -7
- package/src/client/components/workspace/editor/FindWidget.test.ts +9 -5
- package/src/client/components/workspace/editor/FindWidget.tsx +36 -2
- package/src/client/components/workspace/editor/GoToLineModal.tsx +123 -0
- package/src/client/components/workspace/editor/Notices.tsx +71 -0
- package/src/client/components/workspace/editor/Pane.tsx +118 -0
- package/src/client/components/workspace/editor/PluginColumn.tsx +32 -0
- package/src/client/components/workspace/editor/QuickOpenModal.tsx +146 -0
- package/src/client/components/workspace/editor/SaveAsModal.tsx +175 -0
- package/src/client/components/workspace/editor/SplitColumn.tsx +98 -0
- package/src/client/components/workspace/editor/SplitPane.tsx +57 -0
- package/src/client/components/workspace/editor/StatusBar.tsx +106 -0
- package/src/client/components/workspace/editor/TabContextMenu.tsx +75 -0
- package/src/client/components/workspace/editor/Tabs.tsx +195 -18
- package/src/client/components/workspace/editor/Toolbar.tsx +110 -140
- package/src/client/components/workspace/editor/index.tsx +201 -193
- package/src/client/components/workspace/editor/props.ts +64 -0
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +300 -0
- package/src/client/components/workspace/file-explorer/Modals.tsx +14 -1
- package/src/client/components/workspace/file-explorer/OutlineSection.test.tsx +18 -0
- package/src/client/components/workspace/file-explorer/OutlineSection.tsx +10 -3
- package/src/client/components/workspace/file-explorer/TreeItem.tsx +2 -1
- package/src/client/components/workspace/file-explorer/clipboard.test.ts +3 -1
- package/src/client/components/workspace/file-explorer/index.test.ts +61 -0
- package/src/client/components/workspace/file-explorer/index.tsx +10 -48
- package/src/client/components/workspace/file-explorer/local-edit.test.ts +8 -3
- package/src/client/components/workspace/search-panel/Body.tsx +7 -2
- package/src/client/components/workspace/worktree-modal/index.test.tsx +118 -0
- package/src/client/hooks/chat/composer/file-drop.ts +22 -37
- package/src/client/hooks/chat/composer/pipeline.test.ts +76 -0
- package/src/client/hooks/chat/composer/pipeline.ts +12 -1
- package/src/client/hooks/chat/omp/reconnect.test.ts +338 -0
- package/src/client/hooks/chat/omp/reconnect.ts +187 -0
- package/src/client/hooks/chat/omp/run-liveness.test.ts +71 -0
- package/src/client/hooks/chat/omp/run-liveness.ts +65 -0
- package/src/client/hooks/chat/omp/session-list.activity.test.ts +114 -0
- package/src/client/hooks/chat/omp/session-list.test-util.ts +164 -0
- package/src/client/hooks/chat/omp/session-list.test.ts +30 -150
- package/src/client/hooks/chat/omp/session-list.tsx +69 -9
- package/src/client/hooks/chat/timeline/generating.ts +19 -2
- package/src/client/hooks/chat/timeline/index.ts +19 -24
- package/src/client/hooks/chat/timeline/lost-run.test.ts +329 -0
- package/src/client/hooks/chat/timeline/lost-run.ts +177 -0
- package/src/client/hooks/chat/timeline/session-load.test-util.ts +205 -0
- package/src/client/hooks/chat/timeline/session-load.test.ts +61 -162
- package/src/client/hooks/chat/timeline/session-load.ts +69 -37
- package/src/client/hooks/chat/timeline/session-switch.test.ts +65 -0
- package/src/client/hooks/chat/timeline/session-switch.ts +63 -0
- package/src/client/hooks/code/deferred-highlight.test.ts +182 -0
- package/src/client/hooks/code/deferred-highlight.ts +129 -0
- package/src/client/hooks/editor/caret-position.test.ts +58 -0
- package/src/client/hooks/editor/caret-position.ts +48 -0
- package/src/client/hooks/editor/file-editor-types.ts +200 -0
- package/src/client/hooks/editor/find-history.test.ts +132 -0
- package/src/client/hooks/editor/find-history.ts +46 -0
- package/src/client/hooks/editor/find-selection-range.test.ts +100 -0
- package/src/client/hooks/editor/find-selection-range.ts +49 -0
- package/src/client/hooks/editor/find-state.ts +14 -1
- package/src/client/hooks/editor/font.test.ts +0 -93
- package/src/client/hooks/editor/indent-settings.test.ts +104 -0
- package/src/client/hooks/editor/indent-settings.ts +88 -0
- package/src/client/hooks/editor/quick-open.test.ts +141 -0
- package/src/client/hooks/editor/quick-open.ts +127 -0
- package/src/client/hooks/editor/save-as.test.ts +156 -0
- package/src/client/hooks/editor/save-as.ts +122 -0
- package/src/client/hooks/editor/save-file.test.ts +179 -0
- package/src/client/hooks/editor/save-file.ts +73 -28
- package/src/client/hooks/editor/theme.test.ts +206 -0
- package/src/client/hooks/editor/theme.ts +82 -0
- package/src/client/hooks/editor/typing-settings.test.ts +73 -0
- package/src/client/hooks/editor/typing-settings.ts +65 -0
- package/src/client/hooks/editor/use-close-guard.ts +98 -0
- package/src/client/hooks/editor/use-editor-drop-overlay.test.ts +159 -0
- package/src/client/hooks/editor/use-editor-drop.shell.test.ts +224 -0
- package/src/client/hooks/editor/use-editor-drop.test.ts +101 -0
- package/src/client/hooks/editor/use-editor-drop.ts +120 -77
- package/src/client/hooks/editor/use-editor-find.test.ts +2 -2
- package/src/client/hooks/editor/use-editor-find.ts +45 -10
- package/src/client/hooks/editor/use-editor-panel-keys.ts +152 -0
- package/src/client/hooks/editor/use-editor-tab-state.ts +71 -0
- package/src/client/hooks/editor/use-external-change-notice.ts +71 -0
- package/src/client/hooks/editor/use-external-change.test.ts +88 -0
- package/src/client/hooks/editor/use-external-change.ts +146 -0
- package/src/client/hooks/editor/use-file-editor.ts +83 -116
- package/src/client/hooks/editor/use-file-read.ts +16 -8
- package/src/client/hooks/editor/use-file-writes.ts +28 -3
- package/src/client/hooks/editor/use-mobile-editor-find.ts +69 -0
- package/src/client/hooks/editor/use-mobile-reveal.ts +53 -0
- package/src/client/hooks/editor/use-outline-view.test.ts +182 -0
- package/src/client/hooks/editor/use-outline-view.ts +94 -7
- package/src/client/hooks/editor/use-scroll-restore.test.ts +55 -2
- package/src/client/hooks/editor/use-scroll-restore.ts +124 -4
- package/src/client/hooks/editor/use-search-reveal-jump.ts +57 -0
- package/src/client/hooks/editor/use-search-reveal.ts +1 -1
- package/src/client/hooks/editor/use-split-editor.test.tsx +169 -0
- package/src/client/hooks/editor/use-split-editor.ts +91 -0
- package/src/client/hooks/editor/use-unload-guard.tsx +117 -0
- package/src/client/hooks/editor/use-write-conflict.test.ts +164 -0
- package/src/client/hooks/editor/use-write-conflict.ts +152 -0
- package/src/client/hooks/editor/wheel-zoom.test.ts +141 -0
- package/src/client/hooks/editor/wheel-zoom.ts +96 -0
- package/src/client/hooks/ui/drag-presence.test.ts +193 -0
- package/src/client/hooks/ui/drag-presence.ts +108 -0
- package/src/client/hooks/ui/settings-modal.test.ts +115 -0
- package/src/client/hooks/ui/settings-modal.ts +56 -0
- package/src/client/hooks/ui/updates/shell-download.test.ts +2 -0
- package/src/client/hooks/ui/updates/shell-download.ts +55 -14
- package/src/client/hooks/ui/updates/shell-offer.test.ts +26 -0
- package/src/client/hooks/ui/updates/shell-update.test.ts +140 -0
- package/src/client/hooks/ui/updates/shell-update.ts +119 -0
- package/src/client/hooks/workspace/diff-file.ts +29 -10
- package/src/client/hooks/workspace/diff-git-actions.ts +147 -0
- package/src/client/hooks/workspace/editor-view.ts +61 -0
- package/src/client/hooks/workspace/file-listing.ts +36 -24
- package/src/client/hooks/workspace/file-tabs.test.ts +152 -5
- package/src/client/hooks/workspace/file-tabs.ts +70 -11
- package/src/client/hooks/workspace/file-tree-edits.ts +103 -0
- package/src/client/hooks/workspace/navbar-session-actions.ts +72 -0
- package/src/client/hooks/workspace/worktree/index.ts +20 -5
- package/src/client/lib/desktop/bridge.ts +45 -0
- package/src/client/lib/desktop/dropped-paths.ts +83 -0
- package/src/client/lib/editor/tab-menu.test.ts +127 -0
- package/src/client/lib/editor/tab-menu.ts +127 -0
- package/src/client/lib/editor-dirty-tabs.test.ts +102 -0
- package/src/client/lib/editor-dirty-tabs.ts +103 -0
- package/src/client/lib/native/resume.test.ts +66 -0
- package/src/client/lib/native/resume.ts +42 -0
- package/src/client/lib/search-reveal.ts +1 -1
- package/src/client/main.tsx +13 -1
- package/src/client/tailwind.css +75 -8
- package/src/server/lib/auth/guard.test.ts +28 -0
- package/src/server/lib/auth/guard.ts +10 -0
- package/src/server/lib/bundler/css.test.ts +31 -0
- package/src/server/lib/fs/listing.test.ts +81 -16
- package/src/server/lib/fs/listing.ts +72 -5
- package/src/server/lib/fs/worktree/create.ts +2 -3
- package/src/server/lib/fs/worktree/list.ts +13 -0
- package/src/server/lib/fs/worktree/remove.ts +3 -3
- package/src/server/lib/fs/write-conflict.test.ts +68 -0
- package/src/server/lib/fs/write-conflict.ts +84 -0
- package/src/server/lib/lifecycle/claim-port.test.ts +156 -0
- package/src/server/lib/lifecycle/port-guard.test.ts +20 -164
- package/src/server/lib/lifecycle/port-guard.ts +39 -7
- package/src/server/lib/lifecycle/probe-health.test.ts +166 -0
- package/src/server/lib/lifecycle/probe.test.ts +77 -164
- package/src/server/lib/lifecycle/probe.ts +121 -13
- package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +112 -0
- package/src/server/lib/omp/rpc/frame-fold.ts +10 -5
- package/src/server/lib/omp/session/sidebar-activity.server.test.ts +162 -0
- package/src/server/lib/omp/session/sidebar-activity.server.ts +70 -0
- package/src/server/lib/omp/session/telemetry/compute.ts +13 -1
- package/src/server/lib/omp/session/telemetry.test.ts +33 -0
- package/src/server/lib/realtime/signals.server.ts +10 -0
- package/src/server/lib/realtime/topics/catalog.server.ts +4 -1
- package/src/server/lib/realtime/topics.server.ts +16 -0
- package/src/server/lib/updates/shell-assets.ts +94 -3
- package/src/server/lib/updates/shell-cache.ts +105 -0
- package/src/server/lib/updates/shell-pages.test.ts +33 -2
- package/src/server/lib/updates/shell-pages.ts +17 -5
- package/src/server/lib/updates/shell-release-desktop.test.ts +166 -0
- package/src/server/lib/updates/shell-release.test.ts +10 -27
- package/src/server/lib/updates/shell-release.ts +107 -111
- package/src/server/routes/fs/action-save-as.test.ts +82 -0
- package/src/server/routes/fs/action.test.ts +82 -0
- package/src/server/routes/fs/action.ts +54 -1
- package/src/server/routes/fs/exists.ts +11 -1
- package/src/server/routes/fs/git-merge.test.ts +11 -1
- package/src/server/routes/fs/read.test.ts +24 -7
- package/src/server/routes/fs/read.ts +6 -1
- package/src/server/routes/fs/scope.test.ts +15 -10
- package/src/server/routes/fs/scope.ts +3 -14
- package/src/server/routes/updates/android.ts +6 -1
- package/src/server/routes/updates/desktop.ts +29 -7
- package/src/server/routes/updates/ios.ts +5 -1
- package/src/server/routes/worktrees/list.ts +11 -1
- package/src/server/routes/worktrees/routes.test.ts +17 -0
- package/src/shared/lib/chat/timeline/omp-callbacks.test.ts +36 -0
- package/src/shared/lib/chat/timeline/omp-callbacks.ts +18 -0
- package/src/shared/lib/chat/timeline/run-signals.test.ts +2 -0
- package/src/shared/lib/code/editor/comment-syntax.test.ts +37 -0
- package/src/shared/lib/code/editor/comment-syntax.ts +55 -0
- package/src/shared/lib/code/editor/find-replace.test.ts +134 -0
- package/src/shared/lib/code/editor/{find.ts → find-replace.ts} +23 -107
- package/src/shared/lib/code/editor/{find.test.ts → find-scan.test.ts} +20 -74
- package/src/shared/lib/code/editor/find-scan.ts +198 -0
- package/src/shared/lib/code/editor/find-selection.test.ts +56 -0
- package/src/shared/lib/code/editor/indent-guide-rule.test.ts +65 -0
- package/src/shared/lib/code/editor/indent-guide-rule.ts +47 -0
- package/src/shared/lib/code/editor/indent-rules.test.ts +219 -0
- package/src/shared/lib/code/editor/indent-rules.ts +198 -0
- package/src/shared/lib/code/editor/keymap.test.ts +23 -0
- package/src/shared/lib/code/editor/keymap.ts +43 -6
- package/src/shared/lib/code/editor/lines.test.ts +7 -55
- package/src/shared/lib/code/editor/lines.ts +8 -48
- package/src/shared/lib/code/editor/marks.test.ts +4 -5
- package/src/shared/lib/code/editor/marks.ts +13 -25
- package/src/shared/lib/code/editor/palette.test.ts +25 -2
- package/src/shared/lib/code/editor/palette.ts +10 -0
- package/src/shared/lib/code/editor/stream-modes.ts +225 -0
- package/src/shared/lib/code/editor/theme-loader.ts +97 -0
- package/src/shared/lib/code/editor/themes.generated.ts +156 -0
- package/src/shared/lib/code/editor/themes.test.ts +165 -0
- package/src/shared/lib/code/editor/themes.ts +165 -0
- package/src/shared/lib/code/highlight-memo.test.ts +103 -0
- package/src/shared/lib/code/highlight-memo.ts +149 -0
- package/src/shared/lib/code/highlighter-warmup.ts +112 -0
- package/src/shared/lib/code/highlighter.ts +3 -1
- package/src/shared/lib/code/idle.ts +37 -0
- package/src/shared/lib/code/outline/rows.test.ts +96 -0
- package/src/shared/lib/code/outline/rows.ts +94 -0
- package/src/shared/lib/code/syntax-highlight.test.ts +2 -80
- package/src/shared/lib/code/syntax-highlight.ts +2 -3
- package/src/shared/lib/fs/file-kind-classify.test.ts +25 -11
- package/src/shared/lib/fs/file-kind.ts +47 -13
- package/src/shared/lib/fs/file-tree.test.ts +41 -0
- package/src/shared/lib/fs/file-tree.ts +126 -34
- package/src/shared/lib/fs/file-url.test.ts +52 -0
- package/src/shared/lib/fs/file-url.ts +37 -0
- package/src/shared/lib/fs/folder-chain.test.ts +87 -0
- package/src/shared/lib/fs/folder-chain.ts +91 -0
- package/src/shared/lib/fs/fs-helpers.test.ts +4 -50
- package/src/shared/lib/fs/patch-sides.test.ts +114 -0
- package/src/shared/lib/fs/patch-sides.ts +139 -0
- package/src/shared/lib/realtime/connection.test.ts +5 -1
- package/src/shared/lib/realtime/connection.ts +25 -119
- package/src/shared/lib/realtime/frozen-recovery.test.ts +93 -0
- package/src/shared/lib/realtime/protocol.ts +16 -0
- package/src/shared/lib/realtime/resume.ts +223 -0
- package/src/shared/lib/realtime/state.ts +22 -0
- package/src/shared/lib/realtime/watchdog-wiring.test.ts +224 -0
- package/src/shared/lib/realtime/watchdog.test.ts +99 -0
- package/src/shared/lib/realtime/watchdog.ts +72 -0
- package/src/shared/lib/ui/toolbar-overflow.test.ts +83 -0
- package/src/shared/lib/ui/toolbar-overflow.ts +86 -0
- package/src/shared/lib/updates/shell-arch.ts +54 -0
- package/src/shared/lib/updates/shell-ua.ts +4 -4
- package/src/shared/lib/workspace/editor-view-mode.test.ts +70 -0
- package/src/shared/lib/workspace/editor-view-mode.ts +48 -0
- package/src/shared/lib/workspace/panel-widths.test.ts +30 -0
- package/src/shared/lib/workspace/panel-widths.ts +25 -5
- package/src/shared/lib/workspace/session-state/cache.ts +159 -0
- package/src/shared/lib/workspace/session-state/harness.test-util.ts +55 -0
- package/src/shared/lib/workspace/session-state/merge.ts +100 -0
- package/src/shared/lib/workspace/session-state/store-load.test.ts +206 -0
- package/src/shared/lib/workspace/session-state/store.test.ts +17 -139
- package/src/shared/lib/workspace/session-state/store.ts +92 -130
- package/src/shared/lib/workspace/split-editor.test.ts +104 -0
- package/src/shared/lib/workspace/split-editor.ts +129 -0
- package/src/shared/lib/workspace/workspace-panel-widths.ts +124 -0
- package/src/shared/types/realtime.ts +29 -0
- package/src/shared/types/settings/state.ts +10 -0
- package/src/test-support/file-explorer-disk.test-util.ts +30 -3
- package/src/test-support/loopback.ts +183 -0
- package/src/test-support/pristine-globals.ts +7 -0
- package/dist/client/static/js/index-gtbpewr7.css +0 -1
- package/src/client/components/common/code-editor/handler.test.ts +0 -274
- package/src/client/components/common/code-editor/handler.ts +0 -175
- package/src/client/components/common/code-editor/index.tsx +0 -314
- package/src/client/components/common/code-surface/measure.ts +0 -148
- package/src/client/components/workspace/chat-timeline/target-picker/index.test.tsx +0 -227
- package/src/client/components/workspace/chat-timeline/target-picker/index.tsx +0 -260
- package/src/client/components/workspace/diff-panel/SplitView.tsx +0 -209
- package/src/client/components/workspace/diff-panel/UnifiedView.tsx +0 -150
- package/src/client/hooks/editor/scroll-container.test.ts +0 -102
- package/src/client/hooks/editor/scroll-container.ts +0 -26
- package/src/client/hooks/editor/use-code-window.ts +0 -100
- package/src/client/hooks/editor/use-editor-history.test.ts +0 -216
- package/src/client/hooks/editor/use-editor-history.ts +0 -134
- package/src/client/hooks/editor/use-occurrences.test.ts +0 -236
- package/src/client/hooks/editor/use-occurrences.ts +0 -98
- package/src/shared/lib/code/editor/commands.test.ts +0 -155
- package/src/shared/lib/code/editor/commands.ts +0 -260
- package/src/shared/lib/code/editor/edits.test.ts +0 -100
- package/src/shared/lib/code/editor/edits.ts +0 -122
- package/src/shared/lib/code/editor/history.test.ts +0 -118
- package/src/shared/lib/code/editor/history.ts +0 -101
- package/src/shared/lib/code/editor/layers.test.ts +0 -77
- package/src/shared/lib/code/editor/layers.ts +0 -67
- package/src/shared/lib/code/editor/line-edits.test.ts +0 -131
- package/src/shared/lib/code/editor/line-edits.ts +0 -159
- package/src/shared/lib/code/editor/occurrences.test.ts +0 -117
- package/src/shared/lib/code/editor/occurrences.ts +0 -111
- package/src/shared/lib/code/editor/reset-css.test.ts +0 -35
- package/src/shared/lib/code/editor/reset-css.ts +0 -32
- package/src/shared/lib/code/editor/text-commands.test.ts +0 -178
- package/src/shared/lib/code/editor/text-commands.ts +0 -154
- package/src/shared/lib/code/lazy-window.test.ts +0 -161
- package/src/shared/lib/code/lazy-window.ts +0 -156
- package/src/shared/lib/code/windowed-highlight.ts +0 -114
- package/src/shared/lib/fs/diff-parser.test.ts +0 -116
- package/src/shared/lib/fs/diff-parser.ts +0 -213
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The New worktree dialog, rendered.
|
|
8
|
+
*
|
|
9
|
+
* Three rules here are the ones a reader would otherwise discover in a browser
|
|
10
|
+
* and nowhere else:
|
|
11
|
+
*
|
|
12
|
+
* - the generated branch is in the FIRST paint (before any effect flushes),
|
|
13
|
+
* because the window between paint and the effect is exactly when a user
|
|
14
|
+
* types — measured: a field filled with `main` was replaced by the generated
|
|
15
|
+
* name and the dialog created `wt/calm-iguana` instead of reporting that
|
|
16
|
+
* `main` is taken;
|
|
17
|
+
* - the folder follows the branch, so it is never named after a previous one;
|
|
18
|
+
* - a closed dialog renders nothing at all, so no field is focusable while it
|
|
19
|
+
* is shut.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
23
|
+
import { Window } from 'happy-dom';
|
|
24
|
+
import { h, render } from 'preact';
|
|
25
|
+
import { act } from 'preact/test-utils';
|
|
26
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
27
|
+
import { NewWorktreeModal } from '@/client/components/workspace/worktree-modal/index';
|
|
28
|
+
|
|
29
|
+
const nativeFetch = Bun.fetch;
|
|
30
|
+
const mounted: HTMLElement[] = [];
|
|
31
|
+
|
|
32
|
+
beforeAll(() => {
|
|
33
|
+
installDomGlobals(new Window({ url: 'http://localhost' }));
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
afterEach(() => {
|
|
37
|
+
for (const host of mounted.splice(0)) {
|
|
38
|
+
render(null, host);
|
|
39
|
+
host.remove();
|
|
40
|
+
}
|
|
41
|
+
(globalThis as unknown as Record<string, unknown>).fetch = nativeFetch;
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
afterAll(() => {
|
|
45
|
+
restoreDomGlobals();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Mount, with the first render FLUSHED. Preact batches a state update into a
|
|
50
|
+
* microtask, so a `useEffect` that seeds a field has not run when `render`
|
|
51
|
+
* returns — reading the inputs then reads empty ones, which is a property of the
|
|
52
|
+
* test harness and not of the dialog.
|
|
53
|
+
*/
|
|
54
|
+
async function mount(node: h.JSX.Element): Promise<HTMLElement> {
|
|
55
|
+
const host = document.createElement('div');
|
|
56
|
+
document.body.appendChild(host);
|
|
57
|
+
await act(async () => {
|
|
58
|
+
render(node, host);
|
|
59
|
+
});
|
|
60
|
+
mounted.push(host);
|
|
61
|
+
return host;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function textOf(host: HTMLElement): string {
|
|
65
|
+
return (host.textContent ?? '').replace(/\s+/g, ' ').trim();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
describe('NewWorktreeModal', () => {
|
|
69
|
+
test('opens on a generated branch, with the folder following it', async () => {
|
|
70
|
+
const host = await mount(
|
|
71
|
+
h(NewWorktreeModal, { isOpen: true, onClose: () => {}, root: '/repo', folderId: 1, folderName: 'kabmo', onCreated: () => {} }),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const inputs = [...host.querySelectorAll('input')] as HTMLInputElement[];
|
|
75
|
+
const branch = inputs[0]?.value ?? '';
|
|
76
|
+
const folderName = inputs[2]?.value ?? '';
|
|
77
|
+
expect(branch).toMatch(/^wt\/[a-z]+-[a-z]+$/);
|
|
78
|
+
// The folder is the branch without our namespace, so it is never `wt-x`.
|
|
79
|
+
expect(folderName).toBe(branch.replace(/^wt\//, ''));
|
|
80
|
+
expect(folderName.startsWith('wt-')).toBe(false);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('the generated branch is in the FIRST paint, before any effect flushes', () => {
|
|
84
|
+
const host = document.createElement('div');
|
|
85
|
+
document.body.appendChild(host);
|
|
86
|
+
// Deliberately NOT `mount`: no `act`, so no effect has run. A field seeded
|
|
87
|
+
// by an effect reads empty here, and the browser's own window between paint
|
|
88
|
+
// and the effect flush is exactly when a user types into it.
|
|
89
|
+
render(
|
|
90
|
+
h(NewWorktreeModal, { isOpen: true, onClose: () => {}, root: '/repo', folderId: 1, folderName: 'kabmo', onCreated: () => {} }),
|
|
91
|
+
host,
|
|
92
|
+
);
|
|
93
|
+
mounted.push(host);
|
|
94
|
+
|
|
95
|
+
const inputs = [...host.querySelectorAll('input')] as HTMLInputElement[];
|
|
96
|
+
const branch = inputs[0]?.value ?? '';
|
|
97
|
+
expect(branch).toMatch(/^wt\/[a-z]+-[a-z]+$/);
|
|
98
|
+
// One generated name for both fields: deriving the folder from a SECOND
|
|
99
|
+
// call would show a folder the branch does not have.
|
|
100
|
+
expect(inputs[2]?.value ?? '').toBe(branch.replace(/^wt\//, ''));
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('states what happens to uncommitted changes, and on which project', async () => {
|
|
104
|
+
const host = await mount(
|
|
105
|
+
h(NewWorktreeModal, { isOpen: true, onClose: () => {}, root: '/repo', folderId: 1, folderName: 'kabmo', onCreated: () => {} }),
|
|
106
|
+
);
|
|
107
|
+
const text = textOf(host);
|
|
108
|
+
expect(text).toContain('Uncommitted changes stay in');
|
|
109
|
+
expect(text).toContain('kabmo');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('renders nothing while closed', async () => {
|
|
113
|
+
const host = await mount(
|
|
114
|
+
h(NewWorktreeModal, { isOpen: false, onClose: () => {}, root: '/repo', folderId: 1, onCreated: () => {} }),
|
|
115
|
+
);
|
|
116
|
+
expect(host.textContent).toBe('');
|
|
117
|
+
});
|
|
118
|
+
});
|
|
@@ -30,9 +30,10 @@
|
|
|
30
30
|
* awaits.
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
import { useCallback, useEffect, useRef
|
|
33
|
+
import { useCallback, useEffect, useRef } from 'preact/hooks';
|
|
34
34
|
import type { TargetedDragEvent } from 'preact';
|
|
35
35
|
import { collectDroppedFileUris, hasDraggedFiles } from '@/client/hooks/chat/composer/drop-payload';
|
|
36
|
+
import { useDragPresence } from '@/client/hooks/ui/drag-presence';
|
|
36
37
|
import { primeFileReads, primedPrefix } from '@/client/hooks/chat/composer/file-reads';
|
|
37
38
|
import type { PrimedReads } from '@/client/hooks/chat/composer/file-reads';
|
|
38
39
|
import {
|
|
@@ -73,11 +74,12 @@ export interface UseFileDropResult {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
export function useFileDrop({ onFiles, disabled = false }: UseFileDropOptions): UseFileDropResult {
|
|
76
|
-
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
|
|
77
|
+
// `relatedTarget`-based, not a counter: `dragenter` fires for every nested
|
|
78
|
+
// child the pointer crosses (the card's toolbar, the textarea, the attachment
|
|
79
|
+
// chips), so a counter rose with each crossing while a matching `dragleave` to
|
|
80
|
+
// a node still inside was ignored — and the overlay stayed on after the
|
|
81
|
+
// pointer left. See `useDragPresence`.
|
|
82
|
+
const presence = useDragPresence();
|
|
81
83
|
// Latest callback and flag behind refs, so the handlers stay referentially
|
|
82
84
|
// stable and the window guard sees the current `disabled`.
|
|
83
85
|
const onFilesRef = useRef(onFiles);
|
|
@@ -85,24 +87,6 @@ export function useFileDrop({ onFiles, disabled = false }: UseFileDropOptions):
|
|
|
85
87
|
const disabledRef = useRef(disabled);
|
|
86
88
|
disabledRef.current = disabled;
|
|
87
89
|
|
|
88
|
-
const reset = useCallback(() => {
|
|
89
|
-
depthRef.current = 0;
|
|
90
|
-
setIsDragging(false);
|
|
91
|
-
}, []);
|
|
92
|
-
|
|
93
|
-
// A drag can end without reaching this element again — released over the
|
|
94
|
-
// page, cancelled with Escape, or its source node unmounted mid-drag. The
|
|
95
|
-
// composer's own handlers have already run by the time these fire, so this
|
|
96
|
-
// only clears state the drop handler did not.
|
|
97
|
-
useEffect(() => {
|
|
98
|
-
window.addEventListener('dragend', reset);
|
|
99
|
-
window.addEventListener('drop', reset);
|
|
100
|
-
return () => {
|
|
101
|
-
window.removeEventListener('dragend', reset);
|
|
102
|
-
window.removeEventListener('drop', reset);
|
|
103
|
-
};
|
|
104
|
-
}, [reset]);
|
|
105
|
-
|
|
106
90
|
// Files dropped anywhere else would navigate the tab to `file://` and discard
|
|
107
91
|
// Kabmo, so the default is cancelled app-wide. This runs after the
|
|
108
92
|
// composer's own drop handler (the event bubbles up to window), by which point
|
|
@@ -123,27 +107,28 @@ export function useFileDrop({ onFiles, disabled = false }: UseFileDropOptions):
|
|
|
123
107
|
if (!hasDraggedFiles(e.dataTransfer)) return;
|
|
124
108
|
e.preventDefault();
|
|
125
109
|
if (disabledRef.current) return;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}, []);
|
|
110
|
+
presence.enter();
|
|
111
|
+
}, [presence]);
|
|
129
112
|
|
|
130
113
|
const onDragOver = useCallback((e: TargetedDragEvent<HTMLElement>) => {
|
|
131
114
|
if (!hasDraggedFiles(e.dataTransfer)) return;
|
|
132
115
|
// Required: without it the browser refuses the drop and navigates to the
|
|
133
116
|
// file instead of handing it to the app.
|
|
134
117
|
e.preventDefault();
|
|
118
|
+
// Every `dragover` here is proof the pointer is over the card; a child
|
|
119
|
+
// crossing fires the enter/leave pair in between, and this re-asserts the
|
|
120
|
+
// overlay without counting anything.
|
|
121
|
+
if (!disabledRef.current) presence.enter();
|
|
135
122
|
if (!e.dataTransfer) return;
|
|
136
123
|
// `none` is the only cursor that tells the truth about a closed composer.
|
|
137
124
|
e.dataTransfer.dropEffect = disabledRef.current ? 'none' : 'copy';
|
|
138
|
-
}, []);
|
|
125
|
+
}, [presence]);
|
|
139
126
|
|
|
140
127
|
// Not gated on the payload: `dataTransfer.types` can already be empty on
|
|
141
|
-
// dragleave.
|
|
142
|
-
const onDragLeave = useCallback(() => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (depthRef.current === 0) setIsDragging(false);
|
|
146
|
-
}, []);
|
|
128
|
+
// dragleave. `useDragPresence.leave` is the gate.
|
|
129
|
+
const onDragLeave = useCallback((e: TargetedDragEvent<HTMLElement>) => {
|
|
130
|
+
presence.leave(e);
|
|
131
|
+
}, [presence]);
|
|
147
132
|
|
|
148
133
|
const onDrop = useCallback((e: TargetedDragEvent<HTMLElement>) => {
|
|
149
134
|
const dt = e.dataTransfer;
|
|
@@ -155,7 +140,7 @@ export function useFileDrop({ onFiles, disabled = false }: UseFileDropOptions):
|
|
|
155
140
|
|
|
156
141
|
if (!dt || !hasDraggedFiles(dt)) return;
|
|
157
142
|
e.preventDefault();
|
|
158
|
-
|
|
143
|
+
presence.clear();
|
|
159
144
|
if (disabledRef.current) return;
|
|
160
145
|
|
|
161
146
|
// START THE READS NOW, in the drop handler's own tick. A dropped File's
|
|
@@ -192,9 +177,9 @@ export function useFileDrop({ onFiles, disabled = false }: UseFileDropOptions):
|
|
|
192
177
|
// reports the ones that never produced content.
|
|
193
178
|
if (resolved.length > 0) onFilesRef.current(resolved, incomplete, [], primed);
|
|
194
179
|
});
|
|
195
|
-
}, [
|
|
180
|
+
}, [presence]);
|
|
196
181
|
|
|
197
|
-
return { isDragging, dropProps: { onDragEnter, onDragOver, onDragLeave, onDrop } };
|
|
182
|
+
return { isDragging: presence.active, dropProps: { onDragEnter, onDragOver, onDragLeave, onDrop } };
|
|
198
183
|
}
|
|
199
184
|
|
|
200
185
|
/**
|
|
@@ -60,6 +60,7 @@ afterEach(() => {
|
|
|
60
60
|
container?.remove();
|
|
61
61
|
globalThis.fetch = nativeFetch;
|
|
62
62
|
sent.length = 0;
|
|
63
|
+
sentHooks = 0;
|
|
63
64
|
current = [];
|
|
64
65
|
value = '';
|
|
65
66
|
rootPath = null;
|
|
@@ -98,6 +99,8 @@ let current: Attachment[] = [];
|
|
|
98
99
|
let seed: (next: Attachment[]) => void;
|
|
99
100
|
/** Every dispatch, so a test can assert what was NOT sent. */
|
|
100
101
|
const sent: Array<{ attachments: Attachment[] }> = [];
|
|
102
|
+
/** Every `onSent`, so a test can assert the collapse followed a real dispatch. */
|
|
103
|
+
let sentHooks = 0;
|
|
101
104
|
let value = '';
|
|
102
105
|
let rootPath: string | null = null;
|
|
103
106
|
|
|
@@ -112,6 +115,7 @@ function PipelineProbe() {
|
|
|
112
115
|
disabled: false,
|
|
113
116
|
rootPath,
|
|
114
117
|
onSend: (attachmentsOut) => sent.push({ attachments: attachmentsOut }),
|
|
118
|
+
onSent: () => { sentHooks += 1; },
|
|
115
119
|
});
|
|
116
120
|
return null;
|
|
117
121
|
}
|
|
@@ -121,6 +125,15 @@ async function mountPipeline() {
|
|
|
121
125
|
await act(async () => { render(h(PipelineProbe, {}), container); });
|
|
122
126
|
}
|
|
123
127
|
|
|
128
|
+
/** A `DataTransfer` carrying a `text/uri-list` reference, as a Finder drag does. */
|
|
129
|
+
function fileTransfer(reference: string): DataTransfer {
|
|
130
|
+
return {
|
|
131
|
+
types: ['text/uri-list'],
|
|
132
|
+
files: [],
|
|
133
|
+
getData: (type: string) => (type.toLowerCase() === 'text/uri-list' ? reference : ''),
|
|
134
|
+
} as unknown as DataTransfer;
|
|
135
|
+
}
|
|
136
|
+
|
|
124
137
|
function textFile(name: string, body: string): File {
|
|
125
138
|
return new File([body], name, { type: 'text/markdown' });
|
|
126
139
|
}
|
|
@@ -189,6 +202,38 @@ describe('useComposerPipeline', () => {
|
|
|
189
202
|
expect(sent[0].attachments.map((a) => a.id)).toEqual(['i']);
|
|
190
203
|
});
|
|
191
204
|
|
|
205
|
+
test('a dispatched send reports onSent, which is what collapses the stretch', async () => {
|
|
206
|
+
await mountPipeline();
|
|
207
|
+
value = 'collapse me';
|
|
208
|
+
await act(async () => { render(h(PipelineProbe, {}), container); });
|
|
209
|
+
await act(async () => { api.submit(); });
|
|
210
|
+
await waitFor(() => sent.length === 1);
|
|
211
|
+
// `onSent` runs immediately BEFORE the dispatch, so the composer is already
|
|
212
|
+
// docked when the optimistic row lands.
|
|
213
|
+
expect(sentHooks).toBe(1);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
test('a refused send reports nothing, so a stretched composer stays stretched', async () => {
|
|
217
|
+
// The desktop bug this pins: the collapse used to happen in the click
|
|
218
|
+
// handler, so a press that dispatched NOTHING (here: an attachment whose
|
|
219
|
+
// read produced no body) shrank the box over content that was never sent.
|
|
220
|
+
await mountPipeline();
|
|
221
|
+
await act(async () => { api.acceptFiles([new File([], 'empty.md', { type: 'text/markdown' })]); });
|
|
222
|
+
await waitFor(() => api.notice !== null);
|
|
223
|
+
await act(async () => { api.submit(); });
|
|
224
|
+
await settle();
|
|
225
|
+
|
|
226
|
+
expect(sent).toEqual([]);
|
|
227
|
+
expect(sentHooks).toBe(0);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
test('an empty composer reports nothing either', async () => {
|
|
231
|
+
await mountPipeline();
|
|
232
|
+
await act(async () => { api.submit(); });
|
|
233
|
+
await settle();
|
|
234
|
+
expect(sentHooks).toBe(0);
|
|
235
|
+
});
|
|
236
|
+
|
|
192
237
|
test('a second click during the send does not dispatch the batch twice', async () => {
|
|
193
238
|
await mountPipeline();
|
|
194
239
|
await act(async () => {
|
|
@@ -257,4 +302,35 @@ describe('useComposerPipeline', () => {
|
|
|
257
302
|
expect(api.isDragging).toBe(false);
|
|
258
303
|
expect(typeof api.dropProps.onDrop).toBe('function');
|
|
259
304
|
});
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* The overlay's state. The counter this replaced drifted upward on every child
|
|
308
|
+
* crossing, so the card stayed lit after the pointer had left it.
|
|
309
|
+
*/
|
|
310
|
+
test('child crossings keep the drop overlay lit, and one real exit clears it', async () => {
|
|
311
|
+
await mountPipeline();
|
|
312
|
+
const card = document.body.appendChild(document.createElement('div'));
|
|
313
|
+
const child = card.appendChild(document.createElement('div'));
|
|
314
|
+
const transfer = fileTransfer('file:///tmp/note.txt');
|
|
315
|
+
const event = (related?: Node | null) => {
|
|
316
|
+
const ev = new window.Event('dragover', { bubbles: true, cancelable: true });
|
|
317
|
+
Object.defineProperty(ev, 'dataTransfer', { value: transfer });
|
|
318
|
+
Object.defineProperty(ev, 'currentTarget', { value: card });
|
|
319
|
+
Object.defineProperty(ev, 'relatedTarget', { value: related ?? null });
|
|
320
|
+
return ev as never;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
await act(async () => { api.dropProps.onDragEnter(event()); });
|
|
324
|
+
expect(api.isDragging).toBe(true);
|
|
325
|
+
|
|
326
|
+
for (let pass = 0; pass < 5; pass += 1) {
|
|
327
|
+
await act(async () => { api.dropProps.onDragOver(event()); });
|
|
328
|
+
await act(async () => { api.dropProps.onDragLeave(event(child)); });
|
|
329
|
+
}
|
|
330
|
+
expect(api.isDragging).toBe(true);
|
|
331
|
+
|
|
332
|
+
await act(async () => { api.dropProps.onDragLeave(event(null)); });
|
|
333
|
+
expect(api.isDragging).toBe(false);
|
|
334
|
+
card.remove();
|
|
335
|
+
});
|
|
260
336
|
});
|
|
@@ -49,6 +49,15 @@ export interface UseComposerPipelineOptions {
|
|
|
49
49
|
/** Workspace root, used to resolve a dropped path reference. */
|
|
50
50
|
rootPath?: string | null;
|
|
51
51
|
onSend: (attachments: Attachment[], options?: { steering?: boolean }) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Runs when a send is actually DISPATCHED — after every guard, immediately
|
|
54
|
+
* before `onSend`. The composer returns to its docked size from here rather
|
|
55
|
+
* than from its own click handler, so the collapse follows the SEND: a click
|
|
56
|
+
* that dispatched nothing (an empty draft, an unreadable attachment) leaves
|
|
57
|
+
* the stretched box alone, and a send that arrives any other way — Enter,
|
|
58
|
+
* Cmd+Enter, a queued follow-up, a plugin — collapses it too.
|
|
59
|
+
*/
|
|
60
|
+
onSent?: () => void;
|
|
52
61
|
}
|
|
53
62
|
|
|
54
63
|
export interface ComposerPipeline {
|
|
@@ -74,6 +83,7 @@ export function useComposerPipeline({
|
|
|
74
83
|
disabled,
|
|
75
84
|
rootPath,
|
|
76
85
|
onSend,
|
|
86
|
+
onSent,
|
|
77
87
|
}: UseComposerPipelineOptions): ComposerPipeline {
|
|
78
88
|
const { addFiles, removeAttachment, readyForSend, peek, clear } = useComposerAttachments({ attachments, setAttachments });
|
|
79
89
|
// Guards a double click: the composer is cleared only after the reads land, so
|
|
@@ -165,11 +175,12 @@ export function useComposerPipeline({
|
|
|
165
175
|
setNotice(describeUnreadable(outgoing.map((a) => attachmentName(a))));
|
|
166
176
|
return;
|
|
167
177
|
}
|
|
178
|
+
onSent?.();
|
|
168
179
|
onSend(outgoing, options);
|
|
169
180
|
}).finally(() => {
|
|
170
181
|
sendingRef.current = false;
|
|
171
182
|
});
|
|
172
|
-
}, [clear, onSend, peek, readyForSend, value]);
|
|
183
|
+
}, [clear, onSend, onSent, peek, readyForSend, value]);
|
|
173
184
|
|
|
174
185
|
return {
|
|
175
186
|
notice,
|