Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/sessions/browser/parts/mobile/mobileAuxiliaryBarPart.ts
13399 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { Parts } from '../../../../workbench/services/layout/browser/layoutService.js';
7
import { AbstractPaneCompositePart } from '../../../../workbench/browser/parts/paneCompositePart.js';
8
import { AuxiliaryBarPart } from '../auxiliaryBarPart.js';
9
import { isPhoneLayout } from './mobileLayout.js';
10
11
/**
12
* Mobile variant of AuxiliaryBarPart.
13
*
14
* On phone-sized viewports the auxiliary bar fills the full grid cell
15
* without card margins or border insets. On tablet/desktop it falls
16
* back to the desktop behavior so runtime viewport transitions keep
17
* working.
18
*/
19
export class MobileAuxiliaryBarPart extends AuxiliaryBarPart {
20
21
override updateStyles(): void {
22
// Always run the desktop implementation first so inline card styles
23
// are set on tablet/desktop transitions. In phone mode we then
24
// clear them so CSS can take over (inline styles have the highest
25
// specificity).
26
super.updateStyles();
27
28
if (!isPhoneLayout(this.layoutService)) {
29
return;
30
}
31
32
const container = this.getContainer();
33
if (container) {
34
container.style.backgroundColor = '';
35
container.style.removeProperty('--part-background');
36
container.style.removeProperty('--part-border-color');
37
}
38
}
39
40
override layout(width: number, height: number, top: number, left: number): void {
41
if (!isPhoneLayout(this.layoutService)) {
42
super.layout(width, height, top, left);
43
return;
44
}
45
46
if (!this.layoutService.isVisible(Parts.AUXILIARYBAR_PART)) {
47
return;
48
}
49
50
// Full dimensions — no card margins or border subtraction.
51
// AbstractPaneCompositePart.layout internally calls Part.layout.
52
AbstractPaneCompositePart.prototype.layout.call(this, width, height, top, left);
53
}
54
}
55
56