UNPKG

2.79 kBJavaScriptView Raw
1"use strict";
2// *****************************************************************************
3// Copyright (C) 2019 TypeFox and others.
4//
5// This program and the accompanying materials are made available under the
6// terms of the Eclipse Public License v. 2.0 which is available at
7// http://www.eclipse.org/legal/epl-2.0.
8//
9// This Source Code may also be made available under the following Secondary
10// Licenses when the conditions for such availability set forth in the Eclipse
11// Public License v. 2.0 are satisfied: GNU General Public License, version 2
12// with the GNU Classpath Exception which is available at
13// https://www.gnu.org/software/classpath/license.html.
14//
15// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16// *****************************************************************************
17var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21 return c > 3 && r && Object.defineProperty(target, key, r), r;
22};
23Object.defineProperty(exports, "__esModule", { value: true });
24exports.ColorRegistry = void 0;
25const inversify_1 = require("inversify");
26const disposable_1 = require("../common/disposable");
27const event_1 = require("../common/event");
28let ColorRegistry = class ColorRegistry {
29 constructor() {
30 this.onDidChangeEmitter = new event_1.Emitter();
31 this.onDidChange = this.onDidChangeEmitter.event;
32 }
33 fireDidChange() {
34 this.onDidChangeEmitter.fire(undefined);
35 }
36 *getColors() { }
37 getCurrentCssVariable(id) {
38 const value = this.getCurrentColor(id);
39 if (!value) {
40 return undefined;
41 }
42 const name = this.toCssVariableName(id);
43 return { name, value };
44 }
45 toCssVariableName(id, prefix = 'theia') {
46 return `--${prefix}-${id.replace(/\./g, '-')}`;
47 }
48 getCurrentColor(id) {
49 return undefined;
50 }
51 register(...definitions) {
52 const result = new disposable_1.DisposableCollection(...definitions.map(definition => this.doRegister(definition)));
53 this.fireDidChange();
54 return result;
55 }
56 doRegister(definition) {
57 return disposable_1.Disposable.NULL;
58 }
59};
60ColorRegistry = __decorate([
61 (0, inversify_1.injectable)()
62], ColorRegistry);
63exports.ColorRegistry = ColorRegistry;
64//# sourceMappingURL=color-registry.js.map
\No newline at end of file