提交 e0e24878 编写于 作者: E Eugene Pankov

SVG icons

上级 deca9a20
module.export = {
}
import { SafeHtml } from '@angular/platform-browser'
export interface IToolbarButton {
icon: string
icon: SafeHtml
title: string
touchBarTitle?: string
weight?: number
......
......@@ -36,8 +36,8 @@ title-bar(
*ngFor='let button of leftToolbarButtons',
[title]='button.title',
(click)='button.click()',
[innerHTML]='button.icon',
)
i.fa([class]='"fa fa-" + button.icon')
.drag-space.background([class.persistent]='config.store.appearance.frame == "thin" && hostApp.platform != Platform.macOS')
......@@ -46,15 +46,15 @@ title-bar(
*ngFor='let button of rightToolbarButtons',
[title]='button.title',
(click)='button.click()',
[innerHTML]='button.icon',
)
i.fa([class]='"fa fa-" + button.icon')
button.btn.btn-secondary.btn-tab-bar(
button.btn.btn-secondary.btn-tab-bar.btn-update(
*ngIf='appUpdate',
title='Update available',
(click)='updateApp()',
[innerHTML]='updateIcon'
)
i.fa.fa-arrow-up.text-info
span.text-info Update
window-controls.background(
*ngIf='config.store.appearance.frame == "thin" && (hostApp.platform == Platform.Windows || hostApp.platform == Platform.Linux)',
......
......@@ -35,6 +35,7 @@ $tab-border-radius: 4px;
line-height: $tabs-height + 2px;
cursor: pointer;
display: flex;
padding: 0 15px;
flex: 0 0 auto;
border-bottom: 2px solid transparent;
......@@ -46,7 +47,6 @@ $tab-border-radius: 4px;
color: #aaa;
border: none;
border-radius: 0;
}
&>.tabs {
......@@ -87,3 +87,13 @@ hotkey-hint {
right: 0;
max-width: 300px;
}
::ng-deep .btn-tab-bar svg {
height: 16px;
fill: white;
fill-opacity: 0.75;
}
::ng-deep .btn-update svg {
fill: cyan;
}
import { Component, Inject, Input, HostListener, HostBinding } from '@angular/core'
import { trigger, style, animate, transition, state } from '@angular/animations'
import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { ElectronService } from '../services/electron.service'
......@@ -58,6 +59,7 @@ export class AppRootComponent {
@HostBinding('class') hostClass = `platform-${process.platform}`
tabsDragging = false
unsortedTabs: BaseTabComponent[] = []
updateIcon: SafeHtml
private logger: Logger
private appUpdate: Update
......@@ -74,6 +76,7 @@ export class AppRootComponent {
@Inject(ToolbarButtonProvider) private toolbarButtonProviders: ToolbarButtonProvider[],
log: LogService,
ngbModal: NgbModal,
domSanitizer: DomSanitizer,
_themes: ThemesService,
) {
this.logger = log.create('main')
......@@ -82,6 +85,8 @@ export class AppRootComponent {
this.leftToolbarButtons = this.getToolbarButtons(false)
this.rightToolbarButtons = this.getToolbarButtons(true)
this.updateIcon = domSanitizer.bypassSecurityTrustHtml(require('../icons/gift.svg')),
this.hotkeys.matchedHotkey.subscribe((hotkey) => {
if (hotkey.startsWith('tab-')) {
let index = parseInt(hotkey.split('-')[1])
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M32 448c0 17.7 14.3 32 32 32h160V320H32v128zm448-288h-42.1c6.2-12.1 10.1-25.5 10.1-40 0-48.5-39.5-88-88-88-41.6 0-68.5 21.3-103 68.3-34.5-47-61.4-68.3-103-68.3-48.5 0-88 39.5-88 88 0 14.5 3.8 27.9 10.1 40H32c-17.7 0-32 14.3-32 32v80c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-80c0-17.7-14.3-32-32-32zm-326.1 0c-22.1 0-40-17.9-40-40s17.9-40 40-40c19.9 0 34.6 3.3 86.1 80h-86.1zm206.1 0h-86.1c51.4-76.5 65.7-80 86.1-80 22.1 0 40 17.9 40 40s-17.9 40-40 40zm-72 320h160c17.7 0 32-14.3 32-32V320H288v160z"/></svg>
\ No newline at end of file
......@@ -39,6 +39,7 @@ module.exports = {
{ test: /\.css$/, use: ['to-string-loader', 'css-loader'], include: /component\.css/ },
{ test: /\.css$/, use: ['style-loader', 'css-loader'], exclude: /component\.css/ },
{ test: /\.yaml$/, use: ['json-loader', 'yaml-loader'] },
{ test: /\.svg/, use: ['svg-inline-loader'] },
]
},
externals: [
......
......@@ -185,6 +185,10 @@ ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
ng2-dnd@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/ng2-dnd/-/ng2-dnd-5.0.2.tgz#862278ac7dedfa14f5783bbf34014d5d73dfefb4"
ngx-perfect-scrollbar@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/ngx-perfect-scrollbar/-/ngx-perfect-scrollbar-6.0.0.tgz#92b51957c04ed6a6d416beca2707bab005667b68"
......
import { Injectable } from '@angular/core'
import { DomSanitizer } from '@angular/platform-browser'
import { ToolbarButtonProvider, IToolbarButton, AppService, HostAppService } from 'terminus-core'
import { SettingsTabComponent } from './components/settingsTab.component'
......@@ -8,6 +9,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
constructor (
hostApp: HostAppService,
private app: AppService,
private domSanitizer: DomSanitizer,
) {
super()
hostApp.preferencesMenu$.subscribe(() => this.open())
......@@ -15,7 +17,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
provide (): IToolbarButton[] {
return [{
icon: 'sliders',
icon: this.domSanitizer.bypassSecurityTrustHtml(require('./icons/cog.svg')),
title: 'Settings',
touchBarTitle: '⚙️',
weight: 10,
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M482.696 299.276l-32.61-18.827a195.168 195.168 0 0 0 0-48.899l32.61-18.827c9.576-5.528 14.195-16.902 11.046-27.501-11.214-37.749-31.175-71.728-57.535-99.595-7.634-8.07-19.817-9.836-29.437-4.282l-32.562 18.798a194.125 194.125 0 0 0-42.339-24.48V38.049c0-11.13-7.652-20.804-18.484-23.367-37.644-8.909-77.118-8.91-114.77 0-10.831 2.563-18.484 12.236-18.484 23.367v37.614a194.101 194.101 0 0 0-42.339 24.48L105.23 81.345c-9.621-5.554-21.804-3.788-29.437 4.282-26.36 27.867-46.321 61.847-57.535 99.595-3.149 10.599 1.47 21.972 11.046 27.501l32.61 18.827a195.168 195.168 0 0 0 0 48.899l-32.61 18.827c-9.576 5.528-14.195 16.902-11.046 27.501 11.214 37.748 31.175 71.728 57.535 99.595 7.634 8.07 19.817 9.836 29.437 4.283l32.562-18.798a194.08 194.08 0 0 0 42.339 24.479v37.614c0 11.13 7.652 20.804 18.484 23.367 37.645 8.909 77.118 8.91 114.77 0 10.831-2.563 18.484-12.236 18.484-23.367v-37.614a194.138 194.138 0 0 0 42.339-24.479l32.562 18.798c9.62 5.554 21.803 3.788 29.437-4.283 26.36-27.867 46.321-61.847 57.535-99.595 3.149-10.599-1.47-21.972-11.046-27.501zm-65.479 100.461l-46.309-26.74c-26.988 23.071-36.559 28.876-71.039 41.059v53.479a217.145 217.145 0 0 1-87.738 0v-53.479c-33.621-11.879-43.355-17.395-71.039-41.059l-46.309 26.74c-19.71-22.09-34.689-47.989-43.929-75.958l46.329-26.74c-6.535-35.417-6.538-46.644 0-82.079l-46.329-26.74c9.24-27.969 24.22-53.869 43.929-75.969l46.309 26.76c27.377-23.434 37.063-29.065 71.039-41.069V44.464a216.79 216.79 0 0 1 87.738 0v53.479c33.978 12.005 43.665 17.637 71.039 41.069l46.309-26.76c19.709 22.099 34.689 47.999 43.929 75.969l-46.329 26.74c6.536 35.426 6.538 46.644 0 82.079l46.329 26.74c-9.24 27.968-24.219 53.868-43.929 75.957zM256 160c-52.935 0-96 43.065-96 96s43.065 96 96 96 96-43.065 96-96-43.065-96-96-96zm0 160c-35.29 0-64-28.71-64-64s28.71-64 64-64 64 28.71 64 64-28.71 64-64 64z"/></svg>
\ No newline at end of file
......@@ -36,6 +36,7 @@ module.exports = {
{ test: /\.pug$/, use: ['apply-loader', 'pug-loader'] },
{ test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
{ test: /\.css$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
{ test: /\.svg/, use: ['svg-inline-loader'] },
]
},
externals: [
......
import { Injectable } from '@angular/core'
import { DomSanitizer } from '@angular/platform-browser'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { HotkeysService, ToolbarButtonProvider, IToolbarButton } from 'terminus-core'
import { SSHModalComponent } from './components/sshModal.component'
......@@ -7,6 +8,7 @@ import { SSHModalComponent } from './components/sshModal.component'
export class ButtonProvider extends ToolbarButtonProvider {
constructor (
private ngbModal: NgbModal,
private domSanitizer: DomSanitizer,
hotkeys: HotkeysService,
) {
super()
......@@ -23,7 +25,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
provide (): IToolbarButton[] {
return [{
icon: 'globe',
icon: this.domSanitizer.bypassSecurityTrustHtml(require('./icons/globe.svg')),
weight: 5,
title: 'SSH connections',
touchBarTitle: 'SSH',
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm179.3 160h-67.2c-6.7-36.5-17.5-68.8-31.2-94.7 42.9 19 77.7 52.7 98.4 94.7zM248 56c18.6 0 48.6 41.2 63.2 112H184.8C199.4 97.2 229.4 56 248 56zM48 256c0-13.7 1.4-27.1 4-40h77.7c-1 13.1-1.7 26.3-1.7 40s.7 26.9 1.7 40H52c-2.6-12.9-4-26.3-4-40zm20.7 88h67.2c6.7 36.5 17.5 68.8 31.2 94.7-42.9-19-77.7-52.7-98.4-94.7zm67.2-176H68.7c20.7-42 55.5-75.7 98.4-94.7-13.7 25.9-24.5 58.2-31.2 94.7zM248 456c-18.6 0-48.6-41.2-63.2-112h126.5c-14.7 70.8-44.7 112-63.3 112zm70.1-160H177.9c-1.1-12.8-1.9-26-1.9-40s.8-27.2 1.9-40h140.3c1.1 12.8 1.9 26 1.9 40s-.9 27.2-2 40zm10.8 142.7c13.7-25.9 24.4-58.2 31.2-94.7h67.2c-20.7 42-55.5 75.7-98.4 94.7zM366.3 296c1-13.1 1.7-26.3 1.7-40s-.7-26.9-1.7-40H444c2.6 12.9 4 26.3 4 40s-1.4 27.1-4 40h-77.7z"/></svg>
\ No newline at end of file
......@@ -34,6 +34,7 @@ module.exports = {
},
{ test: /\.pug$/, use: ['apply-loader', 'pug-loader'] },
{ test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
{ test: /\.svg/, use: ['svg-inline-loader'] },
]
},
externals: [
......
......@@ -2,6 +2,7 @@ import * as fs from 'mz/fs'
import * as path from 'path'
import { first } from 'rxjs/operators'
import { Injectable } from '@angular/core'
import { DomSanitizer } from '@angular/platform-browser'
import { HotkeysService, ToolbarButtonProvider, IToolbarButton, ConfigService, HostAppService, ElectronService } from 'terminus-core'
import { TerminalService } from './services/terminal.service'
......@@ -10,6 +11,7 @@ import { TerminalService } from './services/terminal.service'
export class ButtonProvider extends ToolbarButtonProvider {
constructor (
private terminal: TerminalService,
private domSanitizer: DomSanitizer,
private config: ConfigService,
hostApp: HostAppService,
electron: ElectronService,
......@@ -51,7 +53,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
provide (): IToolbarButton[] {
return [{
icon: 'plus',
icon: this.domSanitizer.bypassSecurityTrustHtml(require('./icons/plus.svg')),
title: 'New terminal',
touchBarTitle: 'New',
click: async () => {
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M368 224H224V80c0-8.84-7.16-16-16-16h-32c-8.84 0-16 7.16-16 16v144H16c-8.84 0-16 7.16-16 16v32c0 8.84 7.16 16 16 16h144v144c0 8.84 7.16 16 16 16h32c8.84 0 16-7.16 16-16V288h144c8.84 0 16-7.16 16-16v-32c0-8.84-7.16-16-16-16z"/></svg>
\ No newline at end of file
......@@ -36,6 +36,7 @@ module.exports = {
{ test: /\.pug$/, use: ['apply-loader', 'pug-loader'] },
{ test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
{ test: /\.css$/, use: ['to-string-loader', 'css-loader'] },
{ test: /\.svg/, use: ['svg-inline-loader'] },
{
test: /\.(ttf|eot|otf|woff|woff2|ogg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: {
......
......@@ -209,7 +209,7 @@ acorn@^3.1.0, acorn@~3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
acorn@^4.0.4, acorn@~4.0.2:
acorn@^4.0.1, acorn@^4.0.4, acorn@~4.0.2:
version "4.0.13"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"
......@@ -2095,6 +2095,10 @@ css-loader@0.28.0:
postcss-modules-values "^1.1.0"
source-list-map "^0.1.7"
css-selector-parser@^1.1.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/css-selector-parser/-/css-selector-parser-1.3.0.tgz#5f1ad43e2d8eefbfdc304fcd39a521664943e3eb"
css-selector-tokenizer@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/css-selector-tokenizer/-/css-selector-tokenizer-0.7.0.tgz#e6988474ae8c953477bf5e7efecfceccd9cf4c86"
......@@ -2543,7 +2547,7 @@ electron-rebuild@^1.7.3:
debug "^2.6.3"
detect-libc "^1.0.3"
fs-extra "^3.0.1"
node-abi "^2.4.1"
node-abi "^2.0.0"
node-gyp "^3.6.0"
ora "^1.2.0"
rimraf "^2.6.1"
......@@ -2900,6 +2904,10 @@ find-cache-dir@^1.0.0:
make-dir "^1.0.0"
pkg-dir "^2.0.0"
find-line-column@^0.5.2:
version "0.5.2"
resolved "https://registry.yarnpkg.com/find-line-column/-/find-line-column-0.5.2.tgz#db00238ff868551a182e74a103416d295a98c8ca"
find-up@^1.0.0:
version "1.1.2"
resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f"
......@@ -4426,7 +4434,7 @@ loader-runner@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2"
loader-utils@0.2.x, loader-utils@^0.2.14, loader-utils@^0.2.15, loader-utils@^0.2.16, loader-utils@^0.2.5, loader-utils@^0.2.7, loader-utils@~0.2.6:
loader-utils@0.2.x, loader-utils@^0.2.11, loader-utils@^0.2.14, loader-utils@^0.2.15, loader-utils@^0.2.16, loader-utils@^0.2.5, loader-utils@^0.2.7, loader-utils@~0.2.6:
version "0.2.17"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348"
dependencies:
......@@ -4954,6 +4962,12 @@ no-case@^2.2.0:
dependencies:
lower-case "^1.1.1"
node-abi@^2.0.0:
version "2.4.3"
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.4.3.tgz#43666b7b17e57863e572409edbb82115ac7af28b"
dependencies:
semver "^5.4.1"
node-abi@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.4.1.tgz#7628c4d4ec4e9cd3764ceb3652f36b2e7f8d4923"
......@@ -6060,21 +6074,21 @@ public-encrypt@^4.0.0:
parse-asn1 "^5.0.0"
randombytes "^2.0.1"
pug-attrs@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/pug-attrs/-/pug-attrs-2.0.2.tgz#8be2b2225568ffa75d1b866982bff9f4111affcb"
pug-attrs@^2.0.1, pug-attrs@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/pug-attrs/-/pug-attrs-2.0.3.tgz#a3095f970e64151f7bdad957eef55fb5d7905d15"
dependencies:
constantinople "^3.0.1"
js-stringify "^1.0.1"
pug-runtime "^2.0.3"
pug-runtime "^2.0.4"
pug-attrs@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/pug-attrs/-/pug-attrs-2.0.3.tgz#a3095f970e64151f7bdad957eef55fb5d7905d15"
pug-attrs@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/pug-attrs/-/pug-attrs-2.0.2.tgz#8be2b2225568ffa75d1b866982bff9f4111affcb"
dependencies:
constantinople "^3.0.1"
js-stringify "^1.0.1"
pug-runtime "^2.0.4"
pug-runtime "^2.0.3"
pug-code-gen@^2.0.0:
version "2.0.0"
......@@ -6102,7 +6116,7 @@ pug-code-gen@^2.0.1:
void-elements "^2.0.1"
with "^5.0.0"
pug-error@^1.3.2:
pug-error@^1.3.0, pug-error@^1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/pug-error/-/pug-error-1.3.2.tgz#53ae7d9d29bb03cf564493a026109f54c47f5f26"
......@@ -6137,6 +6151,14 @@ pug-html-loader@1.0.9:
loader-utils "^0.2.14"
pug "^2.0.0-beta6"
pug-lexer@^2.0.1:
version "2.3.2"
resolved "https://registry.yarnpkg.com/pug-lexer/-/pug-lexer-2.3.2.tgz#68b19d96ea5dc0e4a86148b01cb966c17815a614"
dependencies:
character-parser "^2.1.1"
is-expression "^3.0.0"
pug-error "^1.3.2"
pug-lexer@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/pug-lexer/-/pug-lexer-3.1.0.tgz#fd087376d4a675b4f59f8fef422883434e9581a2"
......@@ -6167,6 +6189,24 @@ pug-linker@^3.0.5:
pug-error "^1.3.2"
pug-walk "^1.1.7"
pug-lint@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/pug-lint/-/pug-lint-2.5.0.tgz#4419ee301aeca45f54061b0eca4a9a471f3aa9a9"
dependencies:
acorn "^4.0.1"
commander "^2.9.0"
css-selector-parser "^1.1.0"
find-line-column "^0.5.2"
glob "^7.0.3"
minimatch "^3.0.3"
path-is-absolute "^1.0.0"
pug-attrs "^2.0.1"
pug-error "^1.3.0"
pug-lexer "^2.0.1"
resolve "^1.1.7"
strip-json-comments "^2.0.1"
void-elements "^2.0.1"
pug-load@^2.0.11:
version "2.0.11"
resolved "https://registry.yarnpkg.com/pug-load/-/pug-load-2.0.11.tgz#e648e57ed113fe2c1f45d57858ea2bad6bc01527"
......@@ -7038,6 +7078,10 @@ signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
simple-html-tokenizer@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/simple-html-tokenizer/-/simple-html-tokenizer-0.1.1.tgz#05c2eec579ffffe145a030ac26cfea61b980fabe"
single-line-log@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/single-line-log/-/single-line-log-1.1.2.tgz#c2f83f273a3e1a16edb0995661da0ed5ef033364"
......@@ -7401,7 +7445,7 @@ strip-indent@^1.0.1:
dependencies:
get-stdin "^4.0.1"
strip-json-comments@~2.0.1:
strip-json-comments@^2.0.1, strip-json-comments@~2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
......@@ -7452,6 +7496,14 @@ supports-color@^5.3.0:
dependencies:
has-flag "^3.0.0"
svg-inline-loader@^0.8.0:
version "0.8.0"
resolved "https://registry.yarnpkg.com/svg-inline-loader/-/svg-inline-loader-0.8.0.tgz#7e9d905d80d0b4e68d2df21afcd08ee9e9a3ea6e"
dependencies:
loader-utils "^0.2.11"
object-assign "^4.0.1"
simple-html-tokenizer "^0.1.1"
svgo@^0.7.0:
version "0.7.2"
resolved "https://registry.yarnpkg.com/svgo/-/svgo-0.7.2.tgz#9f5772413952135c6fefbf40afe6a4faa88b4bb5"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册