qwen-code/packages/web-shell/client/components/ChatPane.module.css
Heyang Wang e46586782c
feat: support drag and drop img in web-shell (#8696)
* feat(web-shell): support image drag and drop

Allow Web Shell composers to ingest image files reliably while
preserving the existing multimodal prompt protocol.

- Share ordered image ingestion across desktop and mobile editors
- Support image-only prompts and BMP preview and provider-safe handling
- Preserve queued payloads across retries and uncertain outcomes
- Add lifecycle guards, user feedback, unit coverage, and browser tests

* fix(web-shell): harden image prompt admission recovery

Preserve complete prompt payloads and prevent duplicate or uncertain
delivery states when admission responses race with queue lifecycle
events.

- Correlate admission, queue, and terminal events by prompt ID
- Restore images and input annotations across retry and edit flows
- Bound image reader concurrency and encoded attachment memory
- Reconcile confirmed removals and explain ambiguous queue entries

* docs(web-shell): align image drag design with review fixes

Document the reviewed admission, recovery, and resource invariants.
Keep the design aligned with the hardened Web Shell implementation.

- Record bounded image ingestion and encoded-data budgeting
- Clarify prompt lifecycle correlation and confirmed removal behavior
- Describe annotation restoration and internal action boundaries
- Update focused validation evidence and acceptance criteria

* fix(web-shell): avoid duplicate restored attachments

Skip payload attachments when restoring text is a no-op because the
same prompt text already exists in the composer.

- Restore images and annotations only when their text is inserted
- Preserve image-only restoration regardless of the current draft
- Add regression coverage for duplicate text with attachments

---------

Co-authored-by: heyang.why <heyang.why@alibaba-inc.com>
2026-08-10 05:48:17 +00:00

230 lines
5.1 KiB
CSS

.pane {
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
height: 100%;
background: var(--background);
border: 1px solid var(--border);
border-radius: 10px;
overflow: hidden;
}
.paneEmbedded {
border: 0;
border-radius: 0;
}
.paneEmbedded .footer {
padding-bottom: 0;
}
.header {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 10px;
/* On a multi-workspace pane, `--ws-accent` is set by a shared accent class
(workspaceAccent.module.css) and colorizes this divider into a per-workspace
strip; it falls back to the neutral border everywhere else, so single-
workspace panes are unchanged. */
border-bottom: 1px solid var(--ws-accent, var(--border));
background: color-mix(in srgb, var(--foreground) 3%, transparent);
flex: 0 0 auto;
}
/* The `--ws-accent` variable that colorizes the divider above and the tag below
is set by a shared accent class from workspaceAccent.module.css (also used by
the composer chip), applied to `.header` when the pane has a workspace. */
/* Which workspace this pane's session lives in — a compact colored chip at the
start of the header, shown only on a multi-workspace daemon. The dot never
shrinks, so panes stay distinguishable by color even when the name and the
session title both ellipsize on a narrow split; the full cwd is in the
native title tooltip. */
.workspaceTag {
display: inline-flex;
align-items: center;
gap: 5px;
flex: 0 1 auto;
min-width: 0;
max-width: 50%;
padding: 2px 8px 2px 6px;
border-radius: 999px;
background: color-mix(in srgb, var(--ws-accent) 14%, transparent);
color: color-mix(in srgb, var(--ws-accent) 70%, var(--foreground));
font-size: 11px;
font-weight: 600;
line-height: 1.4;
}
.workspaceTagDot {
width: 7px;
height: 7px;
flex: 0 0 7px;
border-radius: 999px;
background: var(--ws-accent);
}
.workspaceTagText {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Per-pane connection-loss indicator: each pane has its own daemon connection,
so a drop on one shouldn't silently leave stale messages with no signal. */
.connectionError {
flex: 0 0 auto;
padding: 6px 10px;
background: var(--warning-bg);
border-bottom: 1px solid var(--warning-border);
color: var(--warning-color);
font-size: 12px;
}
.connectionErrorText {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.title {
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 13px;
font-weight: 600;
color: var(--foreground);
}
.headerActions {
position: relative;
flex: 0 0 auto;
display: inline-flex;
align-items: center;
gap: 4px;
min-width: 0;
}
.headerActionsInline {
display: inline-flex;
align-items: center;
gap: 4px;
min-width: 0;
}
.headerActionSlot {
display: inline-flex;
align-items: center;
}
/* Keep host actions mounted while collapsed so stateful actions survive
resize. Absolutely positioned so they do not affect flex layout. */
.headerActionsHostHidden {
position: absolute;
visibility: hidden;
pointer-events: none;
display: inline-flex;
align-items: center;
gap: 4px;
white-space: nowrap;
}
/* The built-in maximize/close controls used to be direct children of `.header`
(gap 8px); keep that spacing now that they are grouped here. */
.headerTrailing {
display: inline-flex;
align-items: center;
gap: 8px;
flex: 0 0 auto;
}
.headerOverflowPanel {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 4px;
padding: 2px;
}
.headerActionButton,
.closeButton,
.maximizeButton {
flex: 0 0 auto;
display: inline-flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
border: none;
border-radius: 6px;
background: transparent;
color: var(--muted-foreground);
cursor: pointer;
}
.headerActionButton:hover,
.closeButton:hover,
.maximizeButton:hover {
color: var(--foreground);
background: color-mix(in srgb, var(--foreground) 8%, transparent);
}
/* The maximized pane keeps its toggle visually "active" so it's clear which
control returns to the tiled layout. */
.maximizeButton[aria-pressed='true'] {
color: var(--foreground);
background: color-mix(in srgb, var(--foreground) 10%, transparent);
}
/* The transcript takes the remaining height and scrolls independently per pane. */
.body {
flex: 1 1 auto;
min-height: 0;
overflow-y: auto;
display: flex;
flex-direction: column;
}
.footer {
flex: 0 0 auto;
padding: 8px;
position: relative;
}
.approval {
margin-bottom: 8px;
}
.admissionUnknown {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-bottom: 8px;
padding: 7px 9px;
border: 1px solid var(--warning-border);
border-radius: 8px;
background: var(--warning-bg);
color: var(--warning-color);
font-size: 12px;
}
.admissionUnknownActions {
display: inline-flex;
flex: 0 0 auto;
gap: 6px;
}
.admissionUnknownActions button {
border: 1px solid var(--warning-border);
border-radius: 6px;
padding: 3px 7px;
background: var(--background);
color: inherit;
cursor: pointer;
}