mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-04 14:04:56 +00:00
done
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { HostAppService } from 'services/hostApp'
|
||||
|
||||
@Component({
|
||||
selector: 'title-bar',
|
||||
template: require('./titleBar.pug'),
|
||||
styles: [require('./titleBar.scss')],
|
||||
})
|
||||
export class TitleBarComponent {
|
||||
constructor (public hostApp: HostAppService) {
|
||||
}
|
||||
}
|
@@ -5,8 +5,8 @@
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "webpack --progress --color",
|
||||
"watch": "webpack --progress --color --watch"
|
||||
"build": "rm -r dist; webpack --progress --color --display-modules",
|
||||
"watch": "rm -r dist; webpack --progress --color --watch"
|
||||
},
|
||||
"author": "Eugene Pankov",
|
||||
"license": "MIT",
|
||||
@@ -19,20 +19,22 @@
|
||||
"webpack": "^2.3.3",
|
||||
"bootstrap": "4.0.0-alpha.6",
|
||||
"core-js": "^2.4.1",
|
||||
"style-loader": "^0.13.1",
|
||||
"to-string-loader": "^1.1.5",
|
||||
"json-loader": "^0.5.4",
|
||||
"yaml-loader": "^0.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/animations": "4.0.1",
|
||||
"@angular/common": "4.0.1",
|
||||
"@angular/core": "4.0.1",
|
||||
"json-loader": "^0.5.4",
|
||||
"@angular/forms": "4.0.1",
|
||||
"@angular/platform-browser": "4.0.1",
|
||||
"@angular/platform-browser-dynamic": "4.0.1",
|
||||
"source-sans-pro": "^2.0.10",
|
||||
"rxjs": "5.3.0",
|
||||
"yaml-loader": "^0.4.0",
|
||||
"zone.js": "0.8.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular/core": "^4.0.1",
|
||||
"deepmerge": "^1.3.2",
|
||||
"js-yaml": "^3.8.3"
|
||||
}
|
||||
|
@@ -1,28 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class ModalService {
|
||||
constructor(
|
||||
private ngbModal: NgbModal,
|
||||
) {}
|
||||
|
||||
open(content: any, config?: any) {
|
||||
config = config || {}
|
||||
config.windowClass = 'out'
|
||||
let modal = this.ngbModal.open(content, config)
|
||||
|
||||
let fx = (<any>modal)._removeModalElements.bind(modal);
|
||||
|
||||
(<any>modal)._removeModalElements = () => {
|
||||
(<any>modal)._windowCmptRef.instance.windowClass = 'out'
|
||||
setTimeout(() => fx(), 500)
|
||||
}
|
||||
setTimeout(() => {
|
||||
(<any>modal)._windowCmptRef.instance.windowClass = ''
|
||||
}, 1)
|
||||
|
||||
return modal
|
||||
}
|
||||
}
|
@@ -7,6 +7,8 @@ export { DefaultTabProvider } from './defaultTabProvider'
|
||||
|
||||
export { AppService } from '../services/app'
|
||||
export { ConfigService } from '../services/config'
|
||||
export { DockingService } from '../services/docking'
|
||||
export { ElectronService } from '../services/electron'
|
||||
export { Logger, LogService } from '../services/log'
|
||||
export { HotkeysService } from '../services/hotkeys'
|
||||
export { HostAppService, Platform } from '../services/hostApp'
|
@@ -6,7 +6,3 @@ declare interface Window {
|
||||
}
|
||||
|
||||
declare var window: Window
|
||||
|
||||
declare interface Console {
|
||||
timeStamp(...args: any[])
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
title-bar(*ngIf='!config.full().appearance.useNativeFrame && config.store.appearance.dock == "off"')
|
||||
title-bar(*ngIf='!config.full().appearance.useNativeFrame && config.full().appearance.dock == "off"')
|
||||
|
||||
.content(
|
||||
[class.tabs-on-top]='config.full().appearance.tabsOnTop'
|
@@ -2,16 +2,16 @@ import { Component, Inject } from '@angular/core'
|
||||
import { trigger, style, animate, transition, state } from '@angular/animations'
|
||||
import { ToasterConfig } from 'angular2-toaster'
|
||||
|
||||
import { ElectronService } from 'services/electron'
|
||||
import { HostAppService } from 'services/hostApp'
|
||||
import { HotkeysService } from 'services/hotkeys'
|
||||
import { Logger, LogService } from 'services/log'
|
||||
import { QuitterService } from 'services/quitter'
|
||||
import { ConfigService } from 'services/config'
|
||||
import { DockingService } from 'services/docking'
|
||||
import { TabRecoveryService } from 'services/tabRecovery'
|
||||
import { ElectronService } from '../services/electron'
|
||||
import { HostAppService } from '../services/hostApp'
|
||||
import { HotkeysService } from '../services/hotkeys'
|
||||
import { Logger, LogService } from '../services/log'
|
||||
import { QuitterService } from '../services/quitter'
|
||||
import { ConfigService } from '../services/config'
|
||||
import { DockingService } from '../services/docking'
|
||||
import { TabRecoveryService } from '../services/tabRecovery'
|
||||
|
||||
import { AppService, IToolbarButton, ToolbarButtonProvider } from 'api'
|
||||
import { AppService, IToolbarButton, ToolbarButtonProvider } from '../api'
|
||||
|
||||
import 'angular2-toaster/toaster.css'
|
||||
import 'overrides.scss'
|
||||
@@ -57,7 +57,7 @@ export class AppRootComponent {
|
||||
log: LogService,
|
||||
_quitter: QuitterService,
|
||||
) {
|
||||
console.timeStamp('AppComponent ctor')
|
||||
(<any>console).timeStamp('AppComponent ctor')
|
||||
|
||||
this.logger = log.create('main')
|
||||
this.logger.info('v', electron.app.getVersion())
|
@@ -1,5 +1,5 @@
|
||||
import { Component, Input, ViewChild, HostBinding, ViewContainerRef } from '@angular/core'
|
||||
import { BaseTabComponent } from 'components/baseTab'
|
||||
import { BaseTabComponent } from '../components/baseTab'
|
||||
|
||||
@Component({
|
||||
selector: 'tab-body',
|
@@ -1,5 +1,5 @@
|
||||
import { Component, Input, Output, EventEmitter, HostBinding } from '@angular/core'
|
||||
import { BaseTabComponent } from 'components/baseTab'
|
||||
import { BaseTabComponent } from '../components/baseTab'
|
||||
|
||||
import './tabHeader.scss'
|
||||
|
@@ -32,4 +32,17 @@ $titlebar-height: 30px;
|
||||
.btn-close {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
&.inset-titlebar {
|
||||
flex-basis: 36px;
|
||||
|
||||
.title {
|
||||
padding-left: 80px;
|
||||
line-height: 36px;
|
||||
}
|
||||
|
||||
button {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
15
terminus-core/src/components/titleBar.ts
Normal file
15
terminus-core/src/components/titleBar.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Component, HostBinding } from '@angular/core'
|
||||
import { HostAppService, Platform } from '../services/hostApp'
|
||||
|
||||
@Component({
|
||||
selector: 'title-bar',
|
||||
template: require('./titleBar.pug'),
|
||||
styles: [require('./titleBar.scss')],
|
||||
})
|
||||
export class TitleBarComponent {
|
||||
@HostBinding('class.inset-titlebar') insetTitlebar = false
|
||||
|
||||
constructor (public hostApp: HostAppService) {
|
||||
this.insetTitlebar = hostApp.platform == Platform.macOS
|
||||
}
|
||||
}
|
@@ -3,6 +3,7 @@ appearance:
|
||||
dockScreen: 'current'
|
||||
dockFill: 50
|
||||
tabsOnTop: true
|
||||
useNativeFrame: false
|
||||
hotkeys:
|
||||
close-tab:
|
||||
- 'Ctrl-Shift-W'
|
@@ -1,29 +1,29 @@
|
||||
import { NgModule, ModuleWithProviders } from '@angular/core'
|
||||
console.info((<any>global).require.resolve('@angular/core'))
|
||||
import { BrowserModule } from '@angular/platform-browser'
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
|
||||
import { FormsModule } from '@angular/forms'
|
||||
import { ToasterModule } from 'angular2-toaster'
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
||||
|
||||
import { AppService } from 'services/app'
|
||||
import { ConfigService } from 'services/config'
|
||||
import { ElectronService } from 'services/electron'
|
||||
import { HostAppService } from 'services/hostApp'
|
||||
import { LogService } from 'services/log'
|
||||
import { HotkeysService, AppHotkeyProvider } from 'services/hotkeys'
|
||||
import { ModalService } from 'services/modal'
|
||||
import { NotifyService } from 'services/notify'
|
||||
import { PluginsService } from 'services/plugins'
|
||||
import { QuitterService } from 'services/quitter'
|
||||
import { DockingService } from 'services/docking'
|
||||
import { TabRecoveryService } from 'services/tabRecovery'
|
||||
import { AppService } from './services/app'
|
||||
import { ConfigService } from './services/config'
|
||||
import { ElectronService } from './services/electron'
|
||||
import { HostAppService } from './services/hostApp'
|
||||
import { LogService } from './services/log'
|
||||
import { HotkeysService, AppHotkeyProvider } from './services/hotkeys'
|
||||
import { NotifyService } from './services/notify'
|
||||
import { PluginsService } from './services/plugins'
|
||||
import { QuitterService } from './services/quitter'
|
||||
import { DockingService } from './services/docking'
|
||||
import { TabRecoveryService } from './services/tabRecovery'
|
||||
|
||||
import { AppRootComponent } from 'components/appRoot'
|
||||
import { TabBodyComponent } from 'components/tabBody'
|
||||
import { TabHeaderComponent } from 'components/tabHeader'
|
||||
import { TitleBarComponent } from 'components/titleBar'
|
||||
import { AppRootComponent } from './components/appRoot'
|
||||
import { TabBodyComponent } from './components/tabBody'
|
||||
import { TabHeaderComponent } from './components/tabHeader'
|
||||
import { TitleBarComponent } from './components/titleBar'
|
||||
|
||||
import { HotkeyProvider } from 'api/hotkeyProvider'
|
||||
import { HotkeyProvider } from './api/hotkeyProvider'
|
||||
|
||||
|
||||
const PROVIDERS = [
|
||||
@@ -34,7 +34,6 @@ const PROVIDERS = [
|
||||
HostAppService,
|
||||
HotkeysService,
|
||||
LogService,
|
||||
ModalService,
|
||||
NotifyService,
|
||||
PluginsService,
|
||||
TabRecoveryService,
|
||||
@@ -52,19 +51,17 @@ const PROVIDERS = [
|
||||
NgbModule,
|
||||
],
|
||||
providers: PROVIDERS,
|
||||
entryComponents: [
|
||||
],
|
||||
declarations: [
|
||||
AppRootComponent,
|
||||
TabBodyComponent,
|
||||
TabHeaderComponent,
|
||||
TitleBarComponent,
|
||||
],
|
||||
bootstrap: [
|
||||
AppRootComponent,
|
||||
]
|
||||
})
|
||||
export default class AppModule {
|
||||
}
|
||||
|
||||
export class AppRootModule {
|
||||
static forRoot(): ModuleWithProviders {
|
||||
return {
|
||||
ngModule: AppModule,
|
||||
@@ -73,5 +70,5 @@ export default class AppModule {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export { AppRootComponent }
|
||||
export * from './api'
|
@@ -2,20 +2,28 @@ import { Injectable, NgZone, EventEmitter } from '@angular/core'
|
||||
import { ElectronService } from '../services/electron'
|
||||
import { Logger, LogService } from '../services/log'
|
||||
|
||||
export const PLATFORM_WINDOWS = 'win32'
|
||||
export const PLATFORM_MAC = 'darwin'
|
||||
export const PLATFORM_LINUX = 'linux'
|
||||
export enum Platform {
|
||||
Linux, macOS, Windows,
|
||||
}
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class HostAppService {
|
||||
platform: Platform
|
||||
nodePlatform: string
|
||||
|
||||
constructor(
|
||||
private zone: NgZone,
|
||||
private electron: ElectronService,
|
||||
log: LogService,
|
||||
) {
|
||||
this.platform = require('os').platform()
|
||||
this.logger = log.create('hostApp')
|
||||
this.nodePlatform = require('os').platform()
|
||||
this.platform = {
|
||||
win32: Platform.Windows,
|
||||
darwin: Platform.macOS,
|
||||
linux: Platform.Linux
|
||||
}[this.nodePlatform]
|
||||
|
||||
electron.ipcRenderer.on('host:quit-request', () => this.zone.run(() => this.quitRequested.emit()))
|
||||
|
||||
@@ -36,7 +44,6 @@ export class HostAppService {
|
||||
})
|
||||
}
|
||||
|
||||
platform: string;
|
||||
quitRequested = new EventEmitter<any>()
|
||||
ready = new EventEmitter<any>()
|
||||
shown = new EventEmitter<any>()
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"baseUrl": "./src",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"declaration": false,
|
||||
@@ -22,11 +22,11 @@
|
||||
"es7"
|
||||
],
|
||||
"paths": {
|
||||
"terminus-*": ["../terminus-*"]
|
||||
"*": ["../../app/node_modules/*"],
|
||||
"terminus-*": ["../../terminus-*"]
|
||||
}
|
||||
},
|
||||
"compileOnSave": false,
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
|
@@ -1,33 +1,37 @@
|
||||
module.exports = {
|
||||
target: 'node',
|
||||
entry: './index.ts',
|
||||
entry: 'src/index.ts',
|
||||
devtool: 'source-map',
|
||||
output: {
|
||||
filename: './dist/index.js',
|
||||
pathinfo: true,
|
||||
library: 'terminusCore',
|
||||
libraryTarget: 'commonjs',
|
||||
libraryTarget: 'umd',
|
||||
devtoolModuleFilenameTemplate: 'webpack-terminus-core:///[resource-path]',
|
||||
},
|
||||
resolve: {
|
||||
modules: ['.', 'node_modules', '..'],
|
||||
modules: ['.', 'src', 'node_modules', '../app/node_modules'],
|
||||
extensions: ['.ts', '.js'],
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.ts$/, use: 'awesome-typescript-loader' },
|
||||
{ test: /schemes\/.*$/, use: "raw-loader" },
|
||||
{ test: /\.pug$/, use: ['apply-loader', 'pug-loader'] },
|
||||
{ test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
|
||||
{ test: /\.css$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
|
||||
{ test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'], exclude: /components\// },
|
||||
{ test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'], include: /components\// },
|
||||
{ test: /\.css$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
|
||||
{ test: /\.yaml$/, use: ['json-loader', 'yaml-loader'] },
|
||||
]
|
||||
},
|
||||
externals: [{
|
||||
'fs': true,
|
||||
'os': true,
|
||||
'path': true,
|
||||
'deepmerge': true,
|
||||
'untildify': true,
|
||||
'@angular/core': true,
|
||||
}]
|
||||
externals: [
|
||||
'electron',
|
||||
'fs',
|
||||
'os',
|
||||
'path',
|
||||
'deepmerge',
|
||||
'untildify',
|
||||
'js-yaml',
|
||||
/^rxjs/,
|
||||
/^@angular/,
|
||||
/^@ng-bootstrap/,
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user