Path: blob/main/src/vs/sessions/browser/parts/mobile/mobileChatBarPart.ts
13399 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { Parts } from '../../../../workbench/services/layout/browser/layoutService.js';6import { AbstractPaneCompositePart } from '../../../../workbench/browser/parts/paneCompositePart.js';7import { ChatBarPart } from '../chatBarPart.js';8import { isPhoneLayout } from './mobileLayout.js';910/**11* Mobile variant of ChatBarPart.12*13* On phone-sized viewports the chat bar fills the full grid cell without14* card margins, border insets, or session-bar height adjustments. When15* the viewport transitions to tablet/desktop (e.g., device rotation16* crossing the phone breakpoint) this delegates to the desktop17* implementation so layout math stays correct.18*/19export class MobileChatBarPart extends ChatBarPart {2021override updateStyles(): void {22// Always run the desktop implementation first so inline styles are23// set on tablet/desktop transitions. In phone mode we then clear24// the card-specific inline styles so CSS can take over.25super.updateStyles();2627if (!isPhoneLayout(this.layoutService)) {28return;29}3031const container = this.getContainer();32if (container) {33container.style.backgroundColor = '';34container.style.removeProperty('--part-background');35container.style.removeProperty('--part-border-color');36container.style.color = '';37}38}3940override layout(width: number, height: number, top: number, left: number): void {41if (!isPhoneLayout(this.layoutService)) {42super.layout(width, height, top, left);43return;44}4546if (!this.layoutService.isVisible(Parts.CHATBAR_PART)) {47return;48}4950this._lastLayout = { width, height, top, left };5152// Full dimensions — no card margins or session-bar subtraction.53// AbstractPaneCompositePart.layout internally calls Part.layout so54// there is no need to invoke Part.prototype.layout separately.55AbstractPaneCompositePart.prototype.layout.call(this, width, height, top, left);56}57}585960