Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new notifications UX #43770

Merged
merged 73 commits into from
Feb 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
a10fc27
notifications - scaffold a notification service
bpasero Feb 12, 2018
549d1c0
notifications - show something top center
bpasero Feb 12, 2018
c5d4092
simple markdown with links support
bpasero Feb 12, 2018
41626d1
hook in opener service
bpasero Feb 12, 2018
e62cdf4
notifications - simple icons support
bpasero Feb 12, 2018
09ee4e5
notifications - simple expand/collapse
bpasero Feb 12, 2018
7b4a881
notifications - first cut source and actions support
bpasero Feb 12, 2018
b709b4d
notifications - some polish and validation
bpasero Feb 13, 2018
d366068
notifications - allow to click actions and links without expanding
bpasero Feb 13, 2018
c31c659
notifications - proper message size computation
bpasero Feb 13, 2018
f9ab699
notifications - add a toolbar with close action
bpasero Feb 13, 2018
9ec86ad
notifications - add more actions to expand/collapse
bpasero Feb 13, 2018
a897348
notifications - adjust height
bpasero Feb 13, 2018
fb8b4bb
notifications - tweak message size compute
bpasero Feb 13, 2018
5196bcb
notifications - details row should never overflow
bpasero Feb 13, 2018
1948bdb
notifications - add configure dropdown
bpasero Feb 14, 2018
27e6c3d
notifications - avoid action runner and use context instead
bpasero Feb 14, 2018
ddfc479
Merge branch 'master' into ben/notifications
bpasero Feb 14, 2018
dcc0724
notifications - shuffle things around
bpasero Feb 14, 2018
14f73a9
notifications - some polish and lifecycle handling
bpasero Feb 14, 2018
79c18d8
notifications - introduce and use model
bpasero Feb 14, 2018
e96078d
notifications - renames
bpasero Feb 14, 2018
43a4228
notifications - introduce simple alerts
bpasero Feb 14, 2018
fea2a8f
notifications - introduce action runner for buttons
bpasero Feb 14, 2018
329868a
notifications - :lipstick:
bpasero Feb 14, 2018
bdcb145
notifications - status bar support
bpasero Feb 14, 2018
2b5ba48
notifications - :lipstick:
bpasero Feb 14, 2018
fa20dfa
notifications - tweak status icon
bpasero Feb 14, 2018
5a78ea4
notifications - new icons
bpasero Feb 14, 2018
f208dc5
notifications - adjust height computation
bpasero Feb 15, 2018
32018e2
notifications - better status bar alignment
bpasero Feb 15, 2018
4e06e4d
notifications - position above status bar
bpasero Feb 15, 2018
e0fc916
notifications - bring back some borders
bpasero Feb 15, 2018
c411180
notifications - more ux tweaks
bpasero Feb 15, 2018
43de98c
notifications - max size tweaks
bpasero Feb 15, 2018
0ce36cb
notifications - introduce event for center visibility
bpasero Feb 15, 2018
9f5688e
notifications - introduce theming
bpasero Feb 15, 2018
068039d
fix compile errors
bpasero Feb 15, 2018
4eb771b
notifications - tweak colors and focus
bpasero Feb 15, 2018
9a3b1b4
notifications - first cut keybindings support with commands
bpasero Feb 15, 2018
9b1a541
notifications - better keyboard support
bpasero Feb 15, 2018
2505c44
notifications - dom focus back to tree on changes if it had focus
bpasero Feb 15, 2018
f31ee63
Merge branch 'master' into ben/notifications
bpasero Feb 15, 2018
34466c1
notifications - some :lipstick:
bpasero Feb 16, 2018
e3aa941
notifications - add tests
bpasero Feb 16, 2018
e9d6c02
notifications - introduce secondary actions
bpasero Feb 16, 2018
70ac21b
notifications - tooltip for overflowing messages
bpasero Feb 16, 2018
c371e0b
notifications - more markdown config
bpasero Feb 16, 2018
b6bfdd4
notifications - toggle expansion on double click
bpasero Feb 16, 2018
f67097d
notifications - extract a reusable notifications list
bpasero Feb 16, 2018
e18c452
notifications - introduce notifications center container
bpasero Feb 16, 2018
5f6c4dc
notifications - first cut of toasts
bpasero Feb 17, 2018
15540a1
notifications - purge toast after timeout
bpasero Feb 17, 2018
2b22b62
notifications - more commands for toasts
bpasero Feb 17, 2018
5bd22ef
notifications - fix drop shadows
bpasero Feb 17, 2018
5606436
notifications - add progress bar and API
bpasero Feb 18, 2018
b2b41d0
notifications - more work on progress bar
bpasero Feb 18, 2018
37b0eb1
notifications - more methods to update notification afterwards
bpasero Feb 18, 2018
a0515f0
notifications - animate toasts
bpasero Feb 18, 2018
18c60de
Merge branch 'master' into ben/notifications
bpasero Feb 18, 2018
f1ea69b
notifications - :lipstick:
bpasero Feb 18, 2018
911fb9e
notifications - allow to update severity too
bpasero Feb 18, 2018
892d697
notifications - tweak aria label
bpasero Feb 18, 2018
3dc87cf
notifications - some context view tweaks
bpasero Feb 18, 2018
b6072d0
notifications - add onDidHide to notifications handle
bpasero Feb 19, 2018
8a2df5e
notifications - extract choice/confirm service from message service
bpasero Feb 19, 2018
b55506b
Merge branch 'master' into ben/notifications
bpasero Feb 19, 2018
5fc7be8
notifications - clean up choice service
bpasero Feb 19, 2018
9ab2056
notifications - remove old message service and adopt new one
bpasero Feb 19, 2018
3891d2b
clean up
bpasero Feb 19, 2018
6079bc6
notifications - better error handling
bpasero Feb 19, 2018
0ab726b
notification - visual tweaks
bpasero Feb 19, 2018
b35f97e
notifications - back to showing actions when expanded
bpasero Feb 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions build/lib/i18n.resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@
"name": "vs/workbench/services/crashReporter",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/services/dialogs",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/services/editor",
"project": "vscode-workbench"
Expand All @@ -162,10 +166,6 @@
"name": "vs/workbench/services/keybinding",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/services/message",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/services/mode",
"project": "vscode-workbench"
Expand Down
2 changes: 1 addition & 1 deletion extensions/typescript/src/utils/projectStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ExcludeHintItem {
constructor(
private readonly telemetryReporter: TelemetryReporter
) {
this._item = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, Number.MIN_VALUE);
this._item = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 98 /* to the right of typescript version status (99) */);
this._item.command = 'js.projectStatus.command';
}

Expand Down
2 changes: 1 addition & 1 deletion extensions/typescript/src/utils/versionStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class VersionStatus {
constructor(
private readonly normalizePath: (resource: vscode.Uri) => string | null
) {
this.versionBarEntry = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, Number.MIN_VALUE);
this.versionBarEntry = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 99 /* to the right of editor status (100) */);
this.onChangeEditorSub = vscode.window.onDidChangeActiveTextEditor(this.showHideStatus, this);
}

Expand Down
19 changes: 15 additions & 4 deletions src/vs/base/browser/htmlContentRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ import * as DOM from 'vs/base/browser/dom';
import { defaultGenerator } from 'vs/base/common/idGenerator';
import { escape } from 'vs/base/common/strings';
import { removeMarkdownEscapes, IMarkdownString } from 'vs/base/common/htmlContent';
import { marked } from 'vs/base/common/marked/marked';
import { marked, MarkedRenderer, MarkedOptions } from 'vs/base/common/marked/marked';
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
import { assign } from 'vs/base/common/objects';

export interface RenderOptions {
className?: string;
inline?: boolean;
actionCallback?: (content: string, event?: IMouseEvent) => void;
codeBlockRenderer?: (modeId: string, value: string) => Thenable<string>;
codeBlockRenderCallback?: () => void;
joinRendererConfiguration?: (renderer: MarkedRenderer) => MarkedOptions;
}

function createElement(options: RenderOptions): HTMLElement {
Expand Down Expand Up @@ -108,7 +110,7 @@ export function renderMarkdown(markdown: IMarkdownString, options: RenderOptions
return text;

} else {
return `<a href="#" data-href="${href}" title="${title || text}">${text}</a>`;
return `<a href="#" data-href="${href}" title="${title || href}">${text}</a>`;
}
};
renderer.paragraph = (text): string => {
Expand Down Expand Up @@ -156,10 +158,19 @@ export function renderMarkdown(markdown: IMarkdownString, options: RenderOptions
});
}

element.innerHTML = marked(markdown.value, {
const markedOptions: MarkedOptions = {
sanitize: true,
renderer
});
};

if (options.joinRendererConfiguration) {
const additionalMarkedOptions = options.joinRendererConfiguration(renderer);
if (additionalMarkedOptions) {
assign(markedOptions, additionalMarkedOptions);
}
}

element.innerHTML = marked(markdown.value, markedOptions);
signalInnerHTML();

return element;
Expand Down
7 changes: 0 additions & 7 deletions src/vs/base/browser/ui/button/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,4 @@
.monaco-button.disabled {
opacity: 0.4;
cursor: default;
}

/* Theming support */

.vs .monaco-text-button:focus,
.vs-dark .monaco-text-button:focus {
outline-color: rgba(255, 255, 255, .5); /* buttons have a blue color, so focus indication needs to be different */
}
22 changes: 18 additions & 4 deletions src/vs/base/browser/ui/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export class Button {
private _onDidClick = new Emitter<any>();
readonly onDidClick: Event<any> = this._onDidClick.event;

private focusTracker: DOM.IFocusTracker;

constructor(container: Builder, options?: IButtonOptions);
constructor(container: HTMLElement, options?: IButtonOptions);
constructor(container: any, options?: IButtonOptions) {
Expand Down Expand Up @@ -86,20 +88,29 @@ export class Button {

this.$el.on(DOM.EventType.MOUSE_OVER, (e) => {
if (!this.$el.hasClass('disabled')) {
const hoverBackground = this.buttonHoverBackground ? this.buttonHoverBackground.toString() : null;
if (hoverBackground) {
this.$el.style('background-color', hoverBackground);
}
this.setHoverBackground();
}
});

this.$el.on(DOM.EventType.MOUSE_OUT, (e) => {
this.applyStyles(); // restore standard styles
});

// Also set hover background when button is focused for feedback
this.focusTracker = DOM.trackFocus(this.$el.getHTMLElement());
this.focusTracker.onDidFocus(() => this.setHoverBackground());
this.focusTracker.onDidBlur(() => this.applyStyles()); // restore standard styles

this.applyStyles();
}

private setHoverBackground(): void {
const hoverBackground = this.buttonHoverBackground ? this.buttonHoverBackground.toString() : null;
if (hoverBackground) {
this.$el.style('background-color', hoverBackground);
}
}

style(styles: IButtonStyles): void {
this.buttonForeground = styles.buttonForeground;
this.buttonBackground = styles.buttonBackground;
Expand Down Expand Up @@ -165,6 +176,9 @@ export class Button {
if (this.$el) {
this.$el.dispose();
this.$el = null;

this.focusTracker.dispose();
this.focusTracker = null;
}

this._onDidClick.dispose();
Expand Down
4 changes: 0 additions & 4 deletions src/vs/base/browser/ui/dropdown/dropdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,4 @@

.dropdown > .dropdown-action, .dropdown > .dropdown-action > .action-label {
display: inline-block;
}

.dropdown > .dropdown-label:not(:empty) {
padding: 0 .5em;
}
83 changes: 81 additions & 2 deletions src/vs/base/browser/ui/dropdown/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import 'vs/css!./dropdown';
import { Builder, $ } from 'vs/base/browser/builder';
import { TPromise } from 'vs/base/common/winjs.base';
import { Gesture, EventType as GestureEventType } from 'vs/base/browser/touch';
import { ActionRunner, IAction } from 'vs/base/common/actions';
import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionRunner, IAction, IActionRunner } from 'vs/base/common/actions';
import { IActionItem, BaseActionItem, IActionItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
import { IMenuOptions } from 'vs/base/browser/ui/menu/menu';
Expand Down Expand Up @@ -242,4 +242,83 @@ export class DropdownMenu extends BaseDropdown {
public hide(): void {
// noop
}
}

export class DropdownMenuActionItem extends BaseActionItem {
private menuActionsOrProvider: any;
private dropdownMenu: DropdownMenu;
private contextMenuProvider: IContextMenuProvider;
private actionItemProvider: IActionItemProvider;
private keybindings: (action: IAction) => ResolvedKeybinding;
private clazz: string;

constructor(action: IAction, menuActions: IAction[], contextMenuProvider: IContextMenuProvider, actionItemProvider: IActionItemProvider, actionRunner: IActionRunner, keybindings: (action: IAction) => ResolvedKeybinding, clazz: string);
constructor(action: IAction, actionProvider: IActionProvider, contextMenuProvider: IContextMenuProvider, actionItemProvider: IActionItemProvider, actionRunner: IActionRunner, keybindings: (action: IAction) => ResolvedKeybinding, clazz: string);
constructor(action: IAction, menuActionsOrProvider: any, contextMenuProvider: IContextMenuProvider, actionItemProvider: IActionItemProvider, actionRunner: IActionRunner, keybindings: (action: IAction) => ResolvedKeybinding, clazz: string) {
super(null, action);

this.menuActionsOrProvider = menuActionsOrProvider;
this.contextMenuProvider = contextMenuProvider;
this.actionItemProvider = actionItemProvider;
this.actionRunner = actionRunner;
this.keybindings = keybindings;
this.clazz = clazz;
}

public render(container: HTMLElement): void {
let labelRenderer: ILabelRenderer = (el: HTMLElement): IDisposable => {
this.builder = $('a.action-label').attr({
tabIndex: '0',
role: 'button',
'aria-haspopup': 'true',
title: this._action.label || '',
class: this.clazz
});

this.builder.appendTo(el);

return null;
};

let options: IDropdownMenuOptions = {
contextMenuProvider: this.contextMenuProvider,
labelRenderer: labelRenderer
};

// Render the DropdownMenu around a simple action to toggle it
if (Array.isArray(this.menuActionsOrProvider)) {
options.actions = this.menuActionsOrProvider;
} else {
options.actionProvider = this.menuActionsOrProvider;
}

this.dropdownMenu = new DropdownMenu(container, options);

this.dropdownMenu.menuOptions = {
actionItemProvider: this.actionItemProvider,
actionRunner: this.actionRunner,
getKeyBinding: this.keybindings,
context: this._context
};
}

public setActionContext(newContext: any): void {
super.setActionContext(newContext);

if (this.dropdownMenu) {
this.dropdownMenu.menuOptions.context = newContext;
}
}

public show(): void {
if (this.dropdownMenu) {
this.dropdownMenu.show();
}
}

public dispose(): void {
this.dropdownMenu.dispose();

super.dispose();
}
}
1 change: 1 addition & 0 deletions src/vs/base/browser/ui/list/listWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {

if (styles.listFocusBackground) {
content.push(`.monaco-list.${this.idPrefix}:focus .monaco-list-row.focused { background-color: ${styles.listFocusBackground}; }`);
content.push(`.monaco-list.${this.idPrefix}:focus .monaco-list-row.focused:hover { background-color: ${styles.listFocusBackground}; }`); // overwrite :hover style in this case!
}

if (styles.listFocusForeground) {
Expand Down
12 changes: 8 additions & 4 deletions src/vs/base/browser/ui/progressbar/progressbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ export class ProgressBar {
private animationStopToken: ValueCallback;
private progressBarBackground: Color;

constructor(builder: Builder, options?: IProgressBarOptions) {
constructor(container: Builder, options?: IProgressBarOptions);
constructor(container: HTMLElement, options?: IProgressBarOptions);
constructor(container: any, options?: IProgressBarOptions) {
this.options = options || Object.create(null);
mixin(this.options, defaultOpts, false);

Expand All @@ -54,11 +56,13 @@ export class ProgressBar {

this.progressBarBackground = this.options.progressBarBackground;

this.create(builder);
this.create(container);
}

private create(parent: Builder): void {
parent.div({ 'class': css_progress_container }, (builder) => {
private create(container: Builder): void;
private create(container: HTMLElement): void;
private create(container: any): void {
$(container).div({ 'class': css_progress_container }, (builder) => {
this.element = builder.clone();

builder.div({ 'class': css_progress_bit }).on([DOM.EventType.ANIMATION_START, DOM.EventType.ANIMATION_END, DOM.EventType.ANIMATION_ITERATION], (e: Event) => {
Expand Down
4 changes: 0 additions & 4 deletions src/vs/base/browser/ui/toolbar/toolbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

.monaco-toolbar .dropdown > .dropdown-label:not(:empty) {
padding: 0;
}

.monaco-toolbar .toolbar-toggle-more {
display: inline-block;
padding: 0;
Expand Down