From ed5363e8659d142fc170cb978389e34102135e8f Mon Sep 17 00:00:00 2001 From: kieferrm Date: Wed, 2 Jan 2019 08:30:56 -0800 Subject: [PATCH] Rest well, see you next year --- src/tsconfig.strictNullChecks.json | 1 - .../electron-browser/holidays.contribution.ts | 129 ------------------ .../holidays/electron-browser/media/cap.svg | 41 ------ .../electron-browser/media/holidays.css | 66 --------- .../parts/update/electron-browser/update.ts | 6 - src/vs/workbench/workbench.main.ts | 2 - 6 files changed, 245 deletions(-) delete mode 100644 src/vs/workbench/parts/holidays/electron-browser/holidays.contribution.ts delete mode 100644 src/vs/workbench/parts/holidays/electron-browser/media/cap.svg delete mode 100644 src/vs/workbench/parts/holidays/electron-browser/media/holidays.css diff --git a/src/tsconfig.strictNullChecks.json b/src/tsconfig.strictNullChecks.json index e91ed4a902c..619af3f174e 100644 --- a/src/tsconfig.strictNullChecks.json +++ b/src/tsconfig.strictNullChecks.json @@ -589,7 +589,6 @@ "./vs/workbench/parts/files/common/explorerModel.ts", "./vs/workbench/parts/files/common/files.ts", "./vs/workbench/parts/files/electron-browser/views/explorerDecorationsProvider.ts", - "./vs/workbench/parts/holidays/electron-browser/holidays.contribution.ts", "./vs/workbench/parts/localizations/electron-browser/localizationsActions.ts", "./vs/workbench/parts/logs/common/logConstants.ts", "./vs/workbench/parts/logs/electron-browser/logs.contribution.ts", diff --git a/src/vs/workbench/parts/holidays/electron-browser/holidays.contribution.ts b/src/vs/workbench/parts/holidays/electron-browser/holidays.contribution.ts deleted file mode 100644 index f5074e7dbbe..00000000000 --- a/src/vs/workbench/parts/holidays/electron-browser/holidays.contribution.ts +++ /dev/null @@ -1,129 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -'use strict'; - -import 'vs/css!./media/holidays'; -import { Action } from 'vs/base/common/actions'; -import { $, append, addClass, removeClass, scheduleAtNextAnimationFrame } from 'vs/base/browser/dom'; -import { Event } from 'vs/base/common/event'; -import { domEvent, stop } from 'vs/base/browser/event'; -import { IDisposable, toDisposable, dispose, Disposable } from 'vs/base/common/lifecycle'; -import { Registry } from 'vs/platform/registry/common/platform'; -import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; -import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; - -function animate(drawFn: () => void): IDisposable { - let disposed = false; - let scheduled = Disposable.None; - - const fn = () => { - if (!disposed) { - drawFn(); - scheduled = scheduleAtNextAnimationFrame(fn); - } - }; - - fn(); - - return toDisposable(() => { - scheduled.dispose(); - disposed = true; - }); -} - -function makeItSnow(canvas: HTMLCanvasElement): IDisposable { - const ctx = canvas.getContext('2d')!; - const flakes: any[] = []; - - function update() { - const spawnCount = Math.ceil(Math.max(200 - flakes.length, 10) * Math.random() * 0.0005); - - for (let i = 0; i < spawnCount; i++) { - const distance = Math.random(); - - flakes.push({ - x: Math.random() * (canvas.width + 180 /* for wind */), - y: -5, - vx: (-(0.5 * distance)) * window.devicePixelRatio, - vy: (0.2 + 1.5 * distance) * window.devicePixelRatio, - size: (2 + 2 * distance) * window.devicePixelRatio, - color: 170 + distance * 50 - }); - } - - for (let i = 0; i < flakes.length; i++) { - const flake = flakes[i]; - flake.x += flake.vx; - flake.y += flake.vy; - - if (flake.y > canvas.height) { - flakes.splice(i--, 1); - } - } - } - - function draw() { - ctx.clearRect(0, 0, canvas.width, canvas.height); - - for (const flake of flakes) { - ctx.beginPath(); - ctx.arc(flake.x, flake.y, flake.size, 0, 2 * Math.PI); - ctx.fillStyle = `rgba(${flake.color}, ${flake.color}, ${flake.color}, 1)`; - ctx.fill(); - } - } - - return animate(() => { - update(); - draw(); - }); -} - -export class HappyHolidaysAction extends Action { - - static ID = 'happyholidays'; - static LABEL = 'Happy Holidays!'; - - constructor( - id: string, - label: string - ) { - super(id, label, '', true); - } - - async run(): Promise { - const disposables: IDisposable[] = []; - - const workbench = document.querySelector('.monaco-workbench') as HTMLElement; - addClass(workbench, 'blur'); - disposables.push(toDisposable(() => removeClass(workbench, 'blur'))); - - const el = append(document.body, $('.happy-holidays')); - disposables.push(toDisposable(() => document.body.removeChild(el))); - - const canvas: HTMLCanvasElement = append(el, $('canvas.happy-holidays-snow')); - canvas.width = document.body.clientWidth * window.devicePixelRatio; - canvas.height = document.body.clientHeight * window.devicePixelRatio; - canvas.style.width = `${document.body.clientWidth}px`; - canvas.style.height = `${document.body.clientHeight}px`; - disposables.push(makeItSnow(canvas)); - - const text = append(el, $('.happy-holidays-text')); - text.innerText = `The VS Code team wishes you a great Holiday season!`; - setTimeout(() => addClass(text, 'animate'), 50); - - const onKeyDown = domEvent(document.body, 'keydown', true); - const onClick = domEvent(document.body, 'click', true); - const onInteraction = Event.any(onKeyDown, onClick); - - const close = () => dispose(disposables); - Event.once(domEvent(window, 'resize'))(close, null, disposables); - stop(Event.once(onInteraction))(close, null, disposables); - } -} - -Registry.as(ActionExtensions.WorkbenchActions) - .registerWorkbenchAction(new SyncActionDescriptor(HappyHolidaysAction, HappyHolidaysAction.ID, HappyHolidaysAction.LABEL), 'Show Release Notes'); diff --git a/src/vs/workbench/parts/holidays/electron-browser/media/cap.svg b/src/vs/workbench/parts/holidays/electron-browser/media/cap.svg deleted file mode 100644 index abeda410242..00000000000 --- a/src/vs/workbench/parts/holidays/electron-browser/media/cap.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - -image/svg+xml - - - - -Openclipart - - - - - - - - - - - diff --git a/src/vs/workbench/parts/holidays/electron-browser/media/holidays.css b/src/vs/workbench/parts/holidays/electron-browser/media/holidays.css deleted file mode 100644 index 669cb846ab5..00000000000 --- a/src/vs/workbench/parts/holidays/electron-browser/media/holidays.css +++ /dev/null @@ -1,66 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -.activitybar .global-activity .actions-container:before { - content: ''; - width: 100%; - height: 30px; - background-image: url(cap.svg); - position: absolute; - background-size: 21px; - background-repeat: no-repeat; - background-position: 16px 7px; - z-index: 1; - pointer-events: none; -} - -.monaco-workbench { - transition: 0.6s filter ease-out; -} - -.monaco-workbench.blur { - filter: blur(5px) brightness(60%); -} - -.vs-dark .monaco-workbench.blur { - filter: blur(5px); -} - -.happy-holidays { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - z-index: 100; -} - -.happy-holidays-text { - text-align: center; - width: 35%; - font-size: 4vw; - font-weight: 200; - opacity: 0; - line-height: 1.4em; - transform: translate(0,-40px); - transition-delay: 0.2s; - transition-duration: 0.8s; - transition-property: transform, opacity; - transition-timing-function: ease-out; - color: #ddd; -} - -.happy-holidays-text.animate { - transform: translate(0,0); - opacity: 1; -} - -.happy-holidays-snow { - position: absolute; -} \ No newline at end of file diff --git a/src/vs/workbench/parts/update/electron-browser/update.ts b/src/vs/workbench/parts/update/electron-browser/update.ts index ad019655f5d..afd15901fb1 100644 --- a/src/vs/workbench/parts/update/electron-browser/update.ts +++ b/src/vs/workbench/parts/update/electron-browser/update.ts @@ -27,7 +27,6 @@ import { IWindowService } from 'vs/platform/windows/common/windows'; import { ReleaseNotesManager } from './releaseNotesEditor'; import { isWindows } from 'vs/base/common/platform'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { HappyHolidaysAction } from 'vs/workbench/parts/holidays/electron-browser/holidays.contribution'; let releaseNotesManager: ReleaseNotesManager | undefined = undefined; @@ -492,11 +491,6 @@ export class UpdateContribution implements IGlobalActivity { result.push(new Separator(), updateAction); } - result.push( - new Separator(), - this.instantiationService.createInstance(HappyHolidaysAction, HappyHolidaysAction.ID, HappyHolidaysAction.LABEL) - ); - return result; } diff --git a/src/vs/workbench/workbench.main.ts b/src/vs/workbench/workbench.main.ts index 497eaadf6d3..dc6ef56c636 100644 --- a/src/vs/workbench/workbench.main.ts +++ b/src/vs/workbench/workbench.main.ts @@ -139,5 +139,3 @@ import 'vs/workbench/parts/outline/electron-browser/outline.contribution'; import 'vs/workbench/services/bulkEdit/electron-browser/bulkEditService'; import 'vs/workbench/parts/experiments/electron-browser/experiments.contribution'; - -import 'vs/workbench/parts/holidays/electron-browser/holidays.contribution';