@codingame/monaco-vscode-api 2.2.0 → 2.2.2
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/package.json +8 -8
- package/service-override/tools/views.d.ts +10 -9
- package/service-override/tools/views.js +22 -9
- package/services.d.ts +1 -0
- package/services.js +1 -0
- package/vscode/src/vs/base/browser/mouseEvent.d.ts +10 -1
- package/vscode/src/vs/base/browser/ui/scrollbar/scrollableElement.d.ts +81 -0
- package/vscode/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.d.ts +160 -0
- package/vscode/src/vs/base/common/scrollable.d.ts +68 -1
- package/vscode/src/vs/editor/browser/config/editorConfiguration.js +8 -4
- package/vscode/src/vs/editor/browser/widget/codeEditorWidget.js +9 -3
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffEditorWidget.js +1 -0
- package/vscode/src/vs/editor/standalone/browser/standaloneCodeEditor.js +3 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-api",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "VSCode public API plugged on the monaco editor",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": {
|
|
@@ -96,12 +96,12 @@
|
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"vscode-marked": "npm:marked@=3.0.2",
|
|
98
98
|
"vscode-semver": "npm:semver@=5.5.0",
|
|
99
|
-
"@codingame/monaco-vscode-
|
|
100
|
-
"@codingame/monaco-vscode-
|
|
101
|
-
"@codingame/monaco-vscode-
|
|
102
|
-
"@codingame/monaco-vscode-environment-service-override": "2.2.
|
|
103
|
-
"@codingame/monaco-vscode-layout-service-override": "2.2.
|
|
104
|
-
"@codingame/monaco-vscode-host-service-override": "2.2.
|
|
105
|
-
"@codingame/monaco-vscode-base-service-override": "2.2.
|
|
99
|
+
"@codingame/monaco-vscode-extensions-service-override": "2.2.2",
|
|
100
|
+
"@codingame/monaco-vscode-files-service-override": "2.2.2",
|
|
101
|
+
"@codingame/monaco-vscode-quickaccess-service-override": "2.2.2",
|
|
102
|
+
"@codingame/monaco-vscode-environment-service-override": "2.2.2",
|
|
103
|
+
"@codingame/monaco-vscode-layout-service-override": "2.2.2",
|
|
104
|
+
"@codingame/monaco-vscode-host-service-override": "2.2.2",
|
|
105
|
+
"@codingame/monaco-vscode-base-service-override": "2.2.2"
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -3,21 +3,22 @@ export { IViewContainerDescriptor, IViewDescriptor } from '../../vscode/src/vs/w
|
|
|
3
3
|
import { BrandedService, ServicesAccessor } from '../../vscode/src/vs/platform/instantiation/common/instantiation.js';
|
|
4
4
|
import { IDisposable } from '../../vscode/src/vs/base/common/lifecycle.js';
|
|
5
5
|
import { Dimension } from '../../vscode/src/vs/base/browser/dom.js';
|
|
6
|
+
import { Event } from '../../vscode/src/vs/base/common/event.js';
|
|
7
|
+
import { DomScrollableElement } from '../../vscode/src/vs/base/browser/ui/scrollbar/scrollableElement.js';
|
|
8
|
+
import { CancellationToken } from '../../vscode/src/vs/base/common/cancellation.js';
|
|
6
9
|
import { URI } from '../../vscode/src/vs/base/common/uri.js';
|
|
10
|
+
import { IStorageService } from '../../vscode/src/vs/platform/storage/common/storage.js';
|
|
11
|
+
import { ITelemetryService } from '../../vscode/src/vs/platform/telemetry/common/telemetry.js';
|
|
12
|
+
import { IThemeService } from '../../vscode/src/vs/platform/theme/common/themeService.js';
|
|
13
|
+
import { IEditorOptions } from '../../vscode/src/vs/platform/editor/common/editor.js';
|
|
14
|
+
import { Parts, Position } from '../../vscode/src/vs/workbench/services/layout/browser/layoutService.js';
|
|
7
15
|
import { Codicon } from '../../vscode/src/vs/base/common/codicons.js';
|
|
8
16
|
import { RegisteredEditorInfo, RegisteredEditorOptions, EditorInputFactoryObject } from '../../vscode/src/vs/workbench/services/editor/common/editorResolverService.js';
|
|
9
17
|
export { RegisteredEditorPriority } from '../../vscode/src/vs/workbench/services/editor/common/editorResolverService.js';
|
|
10
18
|
import { EditorInput, IEditorCloseHandler } from '../../vscode/src/vs/workbench/common/editor/editorInput.js';
|
|
11
19
|
import { IEditorOpenContext, EditorInputCapabilities, Verbosity, IEditorSerializer } from '../../vscode/src/vs/workbench/common/editor.js';
|
|
12
|
-
import { IEditorOptions } from '../../vscode/src/vs/platform/editor/common/editor.js';
|
|
13
20
|
import { EditorPane } from '../../vscode/src/vs/workbench/browser/parts/editor/editorPane.js';
|
|
14
|
-
import { ITelemetryService } from '../../vscode/src/vs/platform/telemetry/common/telemetry.js';
|
|
15
|
-
import { IStorageService } from '../../vscode/src/vs/platform/storage/common/storage.js';
|
|
16
|
-
import { IThemeService } from '../../vscode/src/vs/platform/theme/common/themeService.js';
|
|
17
|
-
import { CancellationToken } from '../../vscode/src/vs/base/common/cancellation.js';
|
|
18
|
-
import { Event } from '../../vscode/src/vs/base/common/event.js';
|
|
19
21
|
import '../../vscode/src/vs/editor/editor.api.js';
|
|
20
|
-
import { Parts, Position } from '../../vscode/src/vs/workbench/services/layout/browser/layoutService.js';
|
|
21
22
|
|
|
22
23
|
type Label = string | {
|
|
23
24
|
short: string;
|
|
@@ -27,7 +28,7 @@ type Label = string | {
|
|
|
27
28
|
declare abstract class SimpleEditorPane extends EditorPane {
|
|
28
29
|
protected container: HTMLElement;
|
|
29
30
|
protected wrapper: HTMLElement;
|
|
30
|
-
|
|
31
|
+
protected scrollbar: DomScrollableElement | undefined;
|
|
31
32
|
private inputDisposable;
|
|
32
33
|
constructor(id: string, telemetryService: ITelemetryService, themeService: IThemeService, storageService: IStorageService);
|
|
33
34
|
protected createEditor(parent: HTMLElement): void;
|
|
@@ -70,7 +71,7 @@ interface CustomViewOption {
|
|
|
70
71
|
readonly id: string;
|
|
71
72
|
name: string;
|
|
72
73
|
order?: number;
|
|
73
|
-
renderBody(container: HTMLElement): IDisposable;
|
|
74
|
+
renderBody(container: HTMLElement, scrollbar: DomScrollableElement): IDisposable;
|
|
74
75
|
location: ViewContainerLocation;
|
|
75
76
|
icon?: string;
|
|
76
77
|
canMoveView?: boolean;
|
|
@@ -3,7 +3,7 @@ import { SyncDescriptor } from '../../vscode/src/vs/platform/instantiation/commo
|
|
|
3
3
|
import { Extensions } from '../../vscode/src/vs/workbench/common/views.js';
|
|
4
4
|
export { ViewContainerLocation } from '../../vscode/src/vs/workbench/common/views.js';
|
|
5
5
|
import { MutableDisposable, DisposableStore } from '../../vscode/src/vs/base/common/lifecycle.js';
|
|
6
|
-
import { size,
|
|
6
|
+
import { size, $ } from '../../vscode/src/vs/base/browser/dom.js';
|
|
7
7
|
import { ViewPane } from '../../vscode/src/vs/workbench/browser/parts/views/viewPane.js';
|
|
8
8
|
import { Registry } from '../../vscode/src/vs/platform/registry/common/platform.js';
|
|
9
9
|
import { ViewPaneContainer } from '../../vscode/src/vs/workbench/browser/parts/views/viewPaneContainer.js';
|
|
@@ -178,11 +178,23 @@ function registerCustomView(options) {
|
|
|
178
178
|
ctorDescriptor: new SyncDescriptor(class extends ViewPane {
|
|
179
179
|
renderBody(container) {
|
|
180
180
|
super.renderBody(container);
|
|
181
|
-
this.
|
|
182
|
-
this.
|
|
183
|
-
this.
|
|
184
|
-
|
|
185
|
-
this.
|
|
181
|
+
this.wrapper = document.createElement('div');
|
|
182
|
+
this.scrollbar = this._register(new DomScrollableElement(this.wrapper, { horizontal: 1 , vertical: 1 }));
|
|
183
|
+
this.container = $('.view-pane-content');
|
|
184
|
+
this.container.style.display = 'flex';
|
|
185
|
+
this.container.style.alignItems = 'stretch';
|
|
186
|
+
this._register(options.renderBody(this.container, this.scrollbar));
|
|
187
|
+
this.wrapper.append(this.container);
|
|
188
|
+
container.appendChild(this.scrollbar.getDomNode());
|
|
189
|
+
const observer = new ResizeObserver(() => {
|
|
190
|
+
assertIsDefined(this.scrollbar).scanDomNode();
|
|
191
|
+
});
|
|
192
|
+
observer.observe(this.container);
|
|
193
|
+
this._register({
|
|
194
|
+
dispose() {
|
|
195
|
+
observer.disconnect();
|
|
196
|
+
}
|
|
197
|
+
});
|
|
186
198
|
}
|
|
187
199
|
getActionViewItem(action, actionOptions) {
|
|
188
200
|
const customAction = (options.actions ?? []).find(customAction => customAction.id === action.id);
|
|
@@ -197,8 +209,9 @@ function registerCustomView(options) {
|
|
|
197
209
|
return super.getActionViewItem(action, actionOptions);
|
|
198
210
|
}
|
|
199
211
|
layoutBody(height, width) {
|
|
200
|
-
this.
|
|
201
|
-
|
|
212
|
+
const [wrapper, scrollbar] = assertAllDefined(this.wrapper, this.scrollbar);
|
|
213
|
+
size(wrapper, width, height);
|
|
214
|
+
scrollbar.scanDomNode();
|
|
202
215
|
}
|
|
203
216
|
}),
|
|
204
217
|
canMoveView: options.canMoveView ?? true,
|
|
@@ -260,4 +273,4 @@ const onDidChangeSideBarPosition = (listener) => {
|
|
|
260
273
|
function getSideBarPosition() {
|
|
261
274
|
return StandaloneServices.get(IWorkbenchLayoutService).getSideBarPosition();
|
|
262
275
|
}
|
|
263
|
-
export { EditorInput, EditorPane, SimpleEditorInput, SimpleEditorPane, getPanelPosition, getSideBarPosition, isPartVisibile, onDidChangePanelPosition, onDidChangeSideBarPosition, registerCustomView, registerEditor, registerEditorPane, registerEditorSerializer, setPartVisibility, viewContainerRegistry, viewRegistry };
|
|
276
|
+
export { EditorInput, EditorPane, SimpleEditorInput, SimpleEditorPane, ViewPaneContainer, getPanelPosition, getSideBarPosition, isPartVisibile, onDidChangePanelPosition, onDidChangeSideBarPosition, registerCustomView, registerEditor, registerEditorPane, registerEditorSerializer, setPartVisibility, viewContainerRegistry, viewRegistry };
|
package/services.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export { IAction } from './vscode/src/vs/base/common/actions.js';
|
|
|
22
22
|
export { IAudioCueService } from './vscode/src/vs/platform/audioCues/browser/audioCueService.js';
|
|
23
23
|
export { ILanguageFeaturesService } from './vscode/src/vs/editor/common/services/languageFeatures.js';
|
|
24
24
|
export { ILogService, ILoggerService, LogLevel } from './vscode/src/vs/platform/log/common/log.js';
|
|
25
|
+
export { IKeybindingService } from './vscode/src/vs/platform/keybinding/common/keybinding.js';
|
|
25
26
|
export { IWorkspaceContextService } from './vscode/src/vs/platform/workspace/common/workspace.js';
|
|
26
27
|
export { IClipboardService } from './vscode/src/vs/platform/clipboard/common/clipboardService.js';
|
|
27
28
|
export { IEditorWorkerService } from './vscode/src/vs/editor/common/services/editorWorker.js';
|
package/services.js
CHANGED
|
@@ -139,6 +139,7 @@ export { IStatusbarService } from './vscode/src/vs/workbench/services/statusbar/
|
|
|
139
139
|
export { ITitleService } from './vscode/src/vs/workbench/services/title/browser/titleService.js';
|
|
140
140
|
export { IBannerService } from './vscode/src/vs/workbench/services/banner/browser/bannerService.js';
|
|
141
141
|
export { IWorkspaceTrustEnablementService, IWorkspaceTrustManagementService, IWorkspaceTrustRequestService } from './vscode/src/vs/platform/workspace/common/workspaceTrust.js';
|
|
142
|
+
export { IKeybindingService } from './vscode/src/vs/platform/keybinding/common/keybinding.js';
|
|
142
143
|
export { IDialogService, IFileDialogService } from './vscode/src/vs/platform/dialogs/common/dialogs.js';
|
|
143
144
|
async function initialize(overrides, container = document.body, configuration = {}, productConfiguration = {}) {
|
|
144
145
|
checkServicesNotInitialized();
|
|
@@ -35,5 +35,14 @@ declare class StandardMouseEvent implements IMouseEvent {
|
|
|
35
35
|
preventDefault(): void;
|
|
36
36
|
stopPropagation(): void;
|
|
37
37
|
}
|
|
38
|
+
interface IMouseWheelEvent extends MouseEvent {
|
|
39
|
+
readonly wheelDelta: number;
|
|
40
|
+
readonly wheelDeltaX: number;
|
|
41
|
+
readonly wheelDeltaY: number;
|
|
42
|
+
readonly deltaX: number;
|
|
43
|
+
readonly deltaY: number;
|
|
44
|
+
readonly deltaZ: number;
|
|
45
|
+
readonly deltaMode: number;
|
|
46
|
+
}
|
|
38
47
|
|
|
39
|
-
export { type IMouseEvent, StandardMouseEvent };
|
|
48
|
+
export { type IMouseEvent, type IMouseWheelEvent, StandardMouseEvent };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { IMouseWheelEvent } from '../../mouseEvent.js';
|
|
2
|
+
import { ScrollableElementCreationOptions, ScrollableElementResolvedOptions, ScrollableElementChangeOptions } from './scrollableElementOptions.js';
|
|
3
|
+
import { Widget } from '../widget.js';
|
|
4
|
+
import { Event } from '../../../common/event.js';
|
|
5
|
+
import { INewScrollPosition, IScrollPosition, Scrollable, ScrollEvent, IScrollDimensions, INewScrollDimensions } from '../../../common/scrollable.js';
|
|
6
|
+
|
|
7
|
+
interface IOverviewRulerLayoutInfo {
|
|
8
|
+
parent: HTMLElement;
|
|
9
|
+
insertBefore: HTMLElement;
|
|
10
|
+
}
|
|
11
|
+
declare abstract class AbstractScrollableElement extends Widget {
|
|
12
|
+
private readonly _options;
|
|
13
|
+
protected readonly _scrollable: Scrollable;
|
|
14
|
+
private readonly _verticalScrollbar;
|
|
15
|
+
private readonly _horizontalScrollbar;
|
|
16
|
+
private readonly _domNode;
|
|
17
|
+
private readonly _leftShadowDomNode;
|
|
18
|
+
private readonly _topShadowDomNode;
|
|
19
|
+
private readonly _topLeftShadowDomNode;
|
|
20
|
+
private readonly _listenOnDomNode;
|
|
21
|
+
private _mouseWheelToDispose;
|
|
22
|
+
private _isDragging;
|
|
23
|
+
private _mouseIsOver;
|
|
24
|
+
private readonly _hideTimeout;
|
|
25
|
+
private _shouldRender;
|
|
26
|
+
private _revealOnScroll;
|
|
27
|
+
private readonly _onScroll;
|
|
28
|
+
readonly onScroll: Event<ScrollEvent>;
|
|
29
|
+
private readonly _onWillScroll;
|
|
30
|
+
readonly onWillScroll: Event<ScrollEvent>;
|
|
31
|
+
get options(): Readonly<ScrollableElementResolvedOptions>;
|
|
32
|
+
protected constructor(element: HTMLElement, options: ScrollableElementCreationOptions, scrollable: Scrollable);
|
|
33
|
+
dispose(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Get the generated 'scrollable' dom node
|
|
36
|
+
*/
|
|
37
|
+
getDomNode(): HTMLElement;
|
|
38
|
+
getOverviewRulerLayoutInfo(): IOverviewRulerLayoutInfo;
|
|
39
|
+
/**
|
|
40
|
+
* Delegate a pointer down event to the vertical scrollbar.
|
|
41
|
+
* This is to help with clicking somewhere else and having the scrollbar react.
|
|
42
|
+
*/
|
|
43
|
+
delegateVerticalScrollbarPointerDown(browserEvent: PointerEvent): void;
|
|
44
|
+
getScrollDimensions(): IScrollDimensions;
|
|
45
|
+
setScrollDimensions(dimensions: INewScrollDimensions): void;
|
|
46
|
+
/**
|
|
47
|
+
* Update the class name of the scrollable element.
|
|
48
|
+
*/
|
|
49
|
+
updateClassName(newClassName: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Update configuration options for the scrollbar.
|
|
52
|
+
*/
|
|
53
|
+
updateOptions(newOptions: ScrollableElementChangeOptions): void;
|
|
54
|
+
setRevealOnScroll(value: boolean): void;
|
|
55
|
+
delegateScrollFromMouseWheelEvent(browserEvent: IMouseWheelEvent): void;
|
|
56
|
+
private _setListeningToMouseWheel;
|
|
57
|
+
private _onMouseWheel;
|
|
58
|
+
private _onDidScroll;
|
|
59
|
+
/**
|
|
60
|
+
* Render / mutate the DOM now.
|
|
61
|
+
* Should be used together with the ctor option `lazyRender`.
|
|
62
|
+
*/
|
|
63
|
+
renderNow(): void;
|
|
64
|
+
private _render;
|
|
65
|
+
private _onDragStart;
|
|
66
|
+
private _onDragEnd;
|
|
67
|
+
private _onMouseLeave;
|
|
68
|
+
private _onMouseOver;
|
|
69
|
+
private _reveal;
|
|
70
|
+
private _hide;
|
|
71
|
+
private _scheduleHide;
|
|
72
|
+
}
|
|
73
|
+
declare class DomScrollableElement extends AbstractScrollableElement {
|
|
74
|
+
private _element;
|
|
75
|
+
constructor(element: HTMLElement, options: ScrollableElementCreationOptions);
|
|
76
|
+
setScrollPosition(update: INewScrollPosition): void;
|
|
77
|
+
getScrollPosition(): IScrollPosition;
|
|
78
|
+
scanDomNode(): void;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { AbstractScrollableElement, DomScrollableElement, type IOverviewRulerLayoutInfo };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { ScrollbarVisibility } from '../../../common/scrollable.js';
|
|
2
|
+
|
|
3
|
+
interface ScrollableElementCreationOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The scrollable element should not do any DOM mutations until renderNow() is called.
|
|
6
|
+
* Defaults to false.
|
|
7
|
+
*/
|
|
8
|
+
lazyRender?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* CSS Class name for the scrollable element.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Drop subtle horizontal and vertical shadows.
|
|
15
|
+
* Defaults to false.
|
|
16
|
+
*/
|
|
17
|
+
useShadows?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Handle mouse wheel (listen to mouse wheel scrolling).
|
|
20
|
+
* Defaults to true
|
|
21
|
+
*/
|
|
22
|
+
handleMouseWheel?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* If mouse wheel is handled, make mouse wheel scrolling smooth.
|
|
25
|
+
* Defaults to true.
|
|
26
|
+
*/
|
|
27
|
+
mouseWheelSmoothScroll?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Flip axes. Treat vertical scrolling like horizontal and vice-versa.
|
|
30
|
+
* Defaults to false.
|
|
31
|
+
*/
|
|
32
|
+
flipAxes?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* If enabled, will scroll horizontally when scrolling vertical.
|
|
35
|
+
* Defaults to false.
|
|
36
|
+
*/
|
|
37
|
+
scrollYToX?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Consume all mouse wheel events if a scrollbar is needed (i.e. scrollSize > size).
|
|
40
|
+
* Defaults to false.
|
|
41
|
+
*/
|
|
42
|
+
consumeMouseWheelIfScrollbarIsNeeded?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Always consume mouse wheel events, even when scrolling is no longer possible.
|
|
45
|
+
* Defaults to false.
|
|
46
|
+
*/
|
|
47
|
+
alwaysConsumeMouseWheel?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.
|
|
50
|
+
* Defaults to 1.
|
|
51
|
+
*/
|
|
52
|
+
mouseWheelScrollSensitivity?: number;
|
|
53
|
+
/**
|
|
54
|
+
* FastScrolling mulitplier speed when pressing `Alt`
|
|
55
|
+
* Defaults to 5.
|
|
56
|
+
*/
|
|
57
|
+
fastScrollSensitivity?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the scrollable will only scroll along the predominant axis when scrolling both
|
|
60
|
+
* vertically and horizontally at the same time.
|
|
61
|
+
* Prevents horizontal drift when scrolling vertically on a trackpad.
|
|
62
|
+
* Defaults to true.
|
|
63
|
+
*/
|
|
64
|
+
scrollPredominantAxis?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Height for vertical arrows (top/bottom) and width for horizontal arrows (left/right).
|
|
67
|
+
* Defaults to 11.
|
|
68
|
+
*/
|
|
69
|
+
arrowSize?: number;
|
|
70
|
+
/**
|
|
71
|
+
* The dom node events should be bound to.
|
|
72
|
+
* If no listenOnDomNode is provided, the dom node passed to the constructor will be used for event listening.
|
|
73
|
+
*/
|
|
74
|
+
listenOnDomNode?: HTMLElement;
|
|
75
|
+
/**
|
|
76
|
+
* Control the visibility of the horizontal scrollbar.
|
|
77
|
+
* Accepted values: 'auto' (on mouse over), 'visible' (always visible), 'hidden' (never visible)
|
|
78
|
+
* Defaults to 'auto'.
|
|
79
|
+
*/
|
|
80
|
+
horizontal?: ScrollbarVisibility;
|
|
81
|
+
/**
|
|
82
|
+
* Height (in px) of the horizontal scrollbar.
|
|
83
|
+
* Defaults to 10.
|
|
84
|
+
*/
|
|
85
|
+
horizontalScrollbarSize?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Height (in px) of the horizontal scrollbar slider.
|
|
88
|
+
* Defaults to `horizontalScrollbarSize`
|
|
89
|
+
*/
|
|
90
|
+
horizontalSliderSize?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Render arrows (left/right) for the horizontal scrollbar.
|
|
93
|
+
* Defaults to false.
|
|
94
|
+
*/
|
|
95
|
+
horizontalHasArrows?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Control the visibility of the vertical scrollbar.
|
|
98
|
+
* Accepted values: 'auto' (on mouse over), 'visible' (always visible), 'hidden' (never visible)
|
|
99
|
+
* Defaults to 'auto'.
|
|
100
|
+
*/
|
|
101
|
+
vertical?: ScrollbarVisibility;
|
|
102
|
+
/**
|
|
103
|
+
* Width (in px) of the vertical scrollbar.
|
|
104
|
+
* Defaults to 10.
|
|
105
|
+
*/
|
|
106
|
+
verticalScrollbarSize?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Width (in px) of the vertical scrollbar slider.
|
|
109
|
+
* Defaults to `verticalScrollbarSize`
|
|
110
|
+
*/
|
|
111
|
+
verticalSliderSize?: number;
|
|
112
|
+
/**
|
|
113
|
+
* Render arrows (top/bottom) for the vertical scrollbar.
|
|
114
|
+
* Defaults to false.
|
|
115
|
+
*/
|
|
116
|
+
verticalHasArrows?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Scroll gutter clicks move by page vs. jump to position.
|
|
119
|
+
* Defaults to false.
|
|
120
|
+
*/
|
|
121
|
+
scrollByPage?: boolean;
|
|
122
|
+
}
|
|
123
|
+
interface ScrollableElementChangeOptions {
|
|
124
|
+
handleMouseWheel?: boolean;
|
|
125
|
+
mouseWheelScrollSensitivity?: number;
|
|
126
|
+
fastScrollSensitivity?: number;
|
|
127
|
+
scrollPredominantAxis?: boolean;
|
|
128
|
+
horizontal?: ScrollbarVisibility;
|
|
129
|
+
horizontalScrollbarSize?: number;
|
|
130
|
+
vertical?: ScrollbarVisibility;
|
|
131
|
+
verticalScrollbarSize?: number;
|
|
132
|
+
scrollByPage?: boolean;
|
|
133
|
+
}
|
|
134
|
+
interface ScrollableElementResolvedOptions {
|
|
135
|
+
lazyRender: boolean;
|
|
136
|
+
className: string;
|
|
137
|
+
useShadows: boolean;
|
|
138
|
+
handleMouseWheel: boolean;
|
|
139
|
+
flipAxes: boolean;
|
|
140
|
+
scrollYToX: boolean;
|
|
141
|
+
consumeMouseWheelIfScrollbarIsNeeded: boolean;
|
|
142
|
+
alwaysConsumeMouseWheel: boolean;
|
|
143
|
+
mouseWheelScrollSensitivity: number;
|
|
144
|
+
fastScrollSensitivity: number;
|
|
145
|
+
scrollPredominantAxis: boolean;
|
|
146
|
+
mouseWheelSmoothScroll: boolean;
|
|
147
|
+
arrowSize: number;
|
|
148
|
+
listenOnDomNode: HTMLElement | null;
|
|
149
|
+
horizontal: ScrollbarVisibility;
|
|
150
|
+
horizontalScrollbarSize: number;
|
|
151
|
+
horizontalSliderSize: number;
|
|
152
|
+
horizontalHasArrows: boolean;
|
|
153
|
+
vertical: ScrollbarVisibility;
|
|
154
|
+
verticalScrollbarSize: number;
|
|
155
|
+
verticalSliderSize: number;
|
|
156
|
+
verticalHasArrows: boolean;
|
|
157
|
+
scrollByPage: boolean;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export type { ScrollableElementChangeOptions, ScrollableElementCreationOptions, ScrollableElementResolvedOptions };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Event } from './event.js';
|
|
2
|
+
import { Disposable, IDisposable } from './lifecycle.js';
|
|
3
|
+
|
|
1
4
|
declare const enum ScrollbarVisibility {
|
|
2
5
|
Auto = 1,
|
|
3
6
|
Hidden = 2,
|
|
@@ -24,5 +27,69 @@ interface ScrollEvent {
|
|
|
24
27
|
scrollHeightChanged: boolean;
|
|
25
28
|
scrollTopChanged: boolean;
|
|
26
29
|
}
|
|
30
|
+
interface IScrollDimensions {
|
|
31
|
+
readonly width: number;
|
|
32
|
+
readonly scrollWidth: number;
|
|
33
|
+
readonly height: number;
|
|
34
|
+
readonly scrollHeight: number;
|
|
35
|
+
}
|
|
36
|
+
interface INewScrollDimensions {
|
|
37
|
+
width?: number;
|
|
38
|
+
scrollWidth?: number;
|
|
39
|
+
height?: number;
|
|
40
|
+
scrollHeight?: number;
|
|
41
|
+
}
|
|
42
|
+
interface IScrollPosition {
|
|
43
|
+
readonly scrollLeft: number;
|
|
44
|
+
readonly scrollTop: number;
|
|
45
|
+
}
|
|
46
|
+
interface INewScrollPosition {
|
|
47
|
+
scrollLeft?: number;
|
|
48
|
+
scrollTop?: number;
|
|
49
|
+
}
|
|
50
|
+
interface IScrollableOptions {
|
|
51
|
+
/**
|
|
52
|
+
* Define if the scroll values should always be integers.
|
|
53
|
+
*/
|
|
54
|
+
forceIntegerValues: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Set the duration (ms) used for smooth scroll animations.
|
|
57
|
+
*/
|
|
58
|
+
smoothScrollDuration: number;
|
|
59
|
+
/**
|
|
60
|
+
* A function to schedule an update at the next frame (used for smooth scroll animations).
|
|
61
|
+
*/
|
|
62
|
+
scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable;
|
|
63
|
+
}
|
|
64
|
+
declare class Scrollable extends Disposable {
|
|
65
|
+
_scrollableBrand: void;
|
|
66
|
+
private _smoothScrollDuration;
|
|
67
|
+
private readonly _scheduleAtNextAnimationFrame;
|
|
68
|
+
private _state;
|
|
69
|
+
private _smoothScrolling;
|
|
70
|
+
private _onScroll;
|
|
71
|
+
readonly onScroll: Event<ScrollEvent>;
|
|
72
|
+
constructor(options: IScrollableOptions);
|
|
73
|
+
dispose(): void;
|
|
74
|
+
setSmoothScrollDuration(smoothScrollDuration: number): void;
|
|
75
|
+
validateScrollPosition(scrollPosition: INewScrollPosition): IScrollPosition;
|
|
76
|
+
getScrollDimensions(): IScrollDimensions;
|
|
77
|
+
setScrollDimensions(dimensions: INewScrollDimensions, useRawScrollPositions: boolean): void;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the final scroll position that the instance will have once the smooth scroll animation concludes.
|
|
80
|
+
* If no scroll animation is occurring, it will return the current scroll position instead.
|
|
81
|
+
*/
|
|
82
|
+
getFutureScrollPosition(): IScrollPosition;
|
|
83
|
+
/**
|
|
84
|
+
* Returns the current scroll position.
|
|
85
|
+
* Note: This result might be an intermediate scroll position, as there might be an ongoing smooth scroll animation.
|
|
86
|
+
*/
|
|
87
|
+
getCurrentScrollPosition(): IScrollPosition;
|
|
88
|
+
setScrollPositionNow(update: INewScrollPosition): void;
|
|
89
|
+
setScrollPositionSmooth(update: INewScrollPosition, reuseAnimation?: boolean): void;
|
|
90
|
+
hasPendingScrollAnimation(): boolean;
|
|
91
|
+
private _performSmoothScrolling;
|
|
92
|
+
private _setState;
|
|
93
|
+
}
|
|
27
94
|
|
|
28
|
-
export { type ScrollEvent, ScrollbarVisibility };
|
|
95
|
+
export { type INewScrollDimensions, type INewScrollPosition, type IScrollDimensions, type IScrollPosition, type IScrollableOptions, type ScrollEvent, Scrollable, ScrollbarVisibility };
|
|
@@ -14,7 +14,7 @@ import { EditorZoom } from '../../common/config/editorZoom.js';
|
|
|
14
14
|
import { BareFontInfo } from '../../common/config/fontInfo.js';
|
|
15
15
|
import { IAccessibilityService } from '../../../platform/accessibility/common/accessibility.js';
|
|
16
16
|
let EditorConfiguration = class EditorConfiguration extends Disposable {
|
|
17
|
-
constructor(isSimpleWidget, options, container, _accessibilityService) {
|
|
17
|
+
constructor(isSimpleWidget, isStandaloneEditor, options, container, _accessibilityService) {
|
|
18
18
|
super();
|
|
19
19
|
this._accessibilityService = _accessibilityService;
|
|
20
20
|
this._onDidChange = this._register(( new Emitter()));
|
|
@@ -28,6 +28,7 @@ let EditorConfiguration = class EditorConfiguration extends Disposable {
|
|
|
28
28
|
this._glyphMarginDecorationLaneCount = 1;
|
|
29
29
|
this._computeOptionsMemory = ( new ComputeOptionsMemory());
|
|
30
30
|
this.isSimpleWidget = isSimpleWidget;
|
|
31
|
+
this.isStandaloneEditor = isStandaloneEditor;
|
|
31
32
|
this._containerObserver = this._register(( new ElementSizeObserver(container, options.dimension)));
|
|
32
33
|
this._rawOptions = deepCloneAndMigrateOptions(options);
|
|
33
34
|
this._validatedOptions = EditorOptionsUtil.validateOptions(this._rawOptions);
|
|
@@ -75,7 +76,7 @@ let EditorConfiguration = class EditorConfiguration extends Disposable {
|
|
|
75
76
|
}
|
|
76
77
|
_readEnvConfiguration() {
|
|
77
78
|
return {
|
|
78
|
-
extraEditorClassName: getExtraEditorClassName(),
|
|
79
|
+
extraEditorClassName: getExtraEditorClassName(this.isStandaloneEditor),
|
|
79
80
|
outerWidth: this._containerObserver.getWidth(),
|
|
80
81
|
outerHeight: this._containerObserver.getHeight(),
|
|
81
82
|
emptySelectionClipboard: isWebKit || isFirefox,
|
|
@@ -141,7 +142,7 @@ let EditorConfiguration = class EditorConfiguration extends Disposable {
|
|
|
141
142
|
}
|
|
142
143
|
};
|
|
143
144
|
EditorConfiguration = ( __decorate([
|
|
144
|
-
( __param(
|
|
145
|
+
( __param(4, IAccessibilityService))
|
|
145
146
|
], EditorConfiguration));
|
|
146
147
|
function digitCount(n) {
|
|
147
148
|
let r = 0;
|
|
@@ -151,7 +152,7 @@ function digitCount(n) {
|
|
|
151
152
|
}
|
|
152
153
|
return r ? r : 1;
|
|
153
154
|
}
|
|
154
|
-
function getExtraEditorClassName() {
|
|
155
|
+
function getExtraEditorClassName(isStandaloneEditor) {
|
|
155
156
|
let extra = '';
|
|
156
157
|
if (!isSafari && !isWebkitWebView) {
|
|
157
158
|
extra += 'no-user-select ';
|
|
@@ -163,6 +164,9 @@ function getExtraEditorClassName() {
|
|
|
163
164
|
if (isMacintosh) {
|
|
164
165
|
extra += 'mac ';
|
|
165
166
|
}
|
|
167
|
+
if (isStandaloneEditor) {
|
|
168
|
+
extra += 'standalone ';
|
|
169
|
+
}
|
|
166
170
|
return extra;
|
|
167
171
|
}
|
|
168
172
|
class ValidatedEditorOptions {
|
|
@@ -163,7 +163,7 @@ let CodeEditorWidget = class CodeEditorWidget extends Disposable {
|
|
|
163
163
|
this._decorationTypeKeysToIds = {};
|
|
164
164
|
this._decorationTypeSubtypes = {};
|
|
165
165
|
this._telemetryData = codeEditorWidgetOptions.telemetryData;
|
|
166
|
-
this._configuration = this._register(this._createConfiguration(codeEditorWidgetOptions.isSimpleWidget || false, options, accessibilityService));
|
|
166
|
+
this._configuration = this._register(this._createConfiguration(codeEditorWidgetOptions.isSimpleWidget || false, codeEditorWidgetOptions.isStandaloneEditor || false, options, accessibilityService));
|
|
167
167
|
this._register(this._configuration.onDidChange((e) => {
|
|
168
168
|
this._onDidChangeConfiguration.fire(e);
|
|
169
169
|
const options = this._configuration.options;
|
|
@@ -255,8 +255,14 @@ let CodeEditorWidget = class CodeEditorWidget extends Disposable {
|
|
|
255
255
|
writeScreenReaderContent(reason) {
|
|
256
256
|
this._modelData?.view.writeScreenReaderContent(reason);
|
|
257
257
|
}
|
|
258
|
-
_createConfiguration(isSimpleWidget, options, accessibilityService) {
|
|
259
|
-
return ( new EditorConfiguration(
|
|
258
|
+
_createConfiguration(isSimpleWidget, isStandaloneEditor, options, accessibilityService) {
|
|
259
|
+
return ( new EditorConfiguration(
|
|
260
|
+
isSimpleWidget,
|
|
261
|
+
isStandaloneEditor,
|
|
262
|
+
options,
|
|
263
|
+
this._domElement,
|
|
264
|
+
accessibilityService
|
|
265
|
+
));
|
|
260
266
|
}
|
|
261
267
|
getId() {
|
|
262
268
|
return this.getEditorType() + ':' + this._id;
|
|
@@ -86,6 +86,7 @@ let DiffEditorWidget = class DiffEditorWidget extends DelegatingEditor {
|
|
|
86
86
|
this.onDidUpdateDiff = Event.fromObservableLight(this._diffValue);
|
|
87
87
|
codeEditorService.willCreateDiffEditor();
|
|
88
88
|
this._contextKeyService.createKey('isInDiffEditor', true);
|
|
89
|
+
this.elements.root.classList.toggle('standalone', codeEditorWidgetOptions.isStandaloneEditor || false);
|
|
89
90
|
this._domElement.appendChild(this.elements.root);
|
|
90
91
|
this._register(toDisposable(() => this._domElement.removeChild(this.elements.root)));
|
|
91
92
|
this._rootSizeObserver = this._register(( new ObservableElementSizeObserver(this.elements.root, options.dimension)));
|
|
@@ -44,7 +44,7 @@ let StandaloneCodeEditor = class StandaloneCodeEditor extends CodeEditorWidget {
|
|
|
44
44
|
const options = { ..._options };
|
|
45
45
|
options.ariaLabel = options.ariaLabel || StandaloneCodeEditorNLS.editorViewAccessibleLabel;
|
|
46
46
|
options.ariaLabel = options.ariaLabel + ';' + (StandaloneCodeEditorNLS.accessibilityHelpMessage);
|
|
47
|
-
super(domElement, options, {}, instantiationService, codeEditorService, commandService, contextKeyService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService);
|
|
47
|
+
super(domElement, options, { isStandaloneEditor: true }, instantiationService, codeEditorService, commandService, contextKeyService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService);
|
|
48
48
|
if (keybindingService instanceof StandaloneKeybindingService) {
|
|
49
49
|
this._standaloneKeybindingService = keybindingService;
|
|
50
50
|
}
|
|
@@ -148,10 +148,7 @@ StandaloneCodeEditor = ( __decorate([
|
|
|
148
148
|
], StandaloneCodeEditor));
|
|
149
149
|
let StandaloneEditor = class StandaloneEditor extends StandaloneCodeEditor {
|
|
150
150
|
constructor(domElement, _options, instantiationService, codeEditorService, commandService, contextKeyService, keybindingService, themeService, notificationService, configurationService, accessibilityService, modelService, languageService, languageConfigurationService, languageFeaturesService) {
|
|
151
|
-
const options = {
|
|
152
|
-
extraEditorClassName: 'standalone-monaco-editor',
|
|
153
|
-
..._options
|
|
154
|
-
};
|
|
151
|
+
const options = { ..._options };
|
|
155
152
|
updateConfigurationService(configurationService, options, false);
|
|
156
153
|
const themeDomRegistration = themeService.registerEditorContainer(domElement);
|
|
157
154
|
if (typeof options.theme === 'string') {
|
|
@@ -232,7 +229,7 @@ let StandaloneDiffEditor2 = class StandaloneDiffEditor2 extends DiffEditorWidget
|
|
|
232
229
|
if (typeof options.autoDetectHighContrast !== 'undefined') {
|
|
233
230
|
themeService.setAutoDetectHighContrast(Boolean(options.autoDetectHighContrast));
|
|
234
231
|
}
|
|
235
|
-
super(domElement, options, {}, contextKeyService, instantiationService, codeEditorService, audioCueService, editorProgressService);
|
|
232
|
+
super(domElement, options, { isStandaloneEditor: true }, contextKeyService, instantiationService, codeEditorService, audioCueService, editorProgressService);
|
|
236
233
|
this._configurationService = configurationService;
|
|
237
234
|
this._standaloneThemeService = themeService;
|
|
238
235
|
this._register(themeDomRegistration);
|