1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-22 20:55:03 +03:00
This commit is contained in:
Eugene Pankov 2017-04-11 22:45:59 +02:00
parent 0ea346a6ae
commit dc513b427d
114 changed files with 454 additions and 374 deletions

View File

@ -6,17 +6,29 @@ SHORT_VERSION=$(shell python -c 'import subprocess; v = subprocess.check_output(
all: run all: run
run: run:
DEV=1 ./node_modules/.bin/electron ./app --debug DEV=1 NODE_PATH=./app/node_modules ./node_modules/.bin/electron ./app --debug
lint: lint:
tslint -c tslint.json app/src/*.ts app/src/**/*.ts tslint -c tslint.json app/src/*.ts app/src/**/*.ts
build: build:
DEV=1 ./node_modules/.bin/webpack --progress DEV=1 ./node_modules/.bin/webpack --progress --display-modules
build-plugins:
cd terminus-core; npm run build
cd terminus-settings; npm run build
cd terminus-terminal; npm run build
cd terminus-community-color-schemes; npm run build
cd terminus-clickable-links; npm run build
watch: watch:
DEV=1 ./node_modules/.bin/webpack --progress -w DEV=1 ./node_modules/.bin/webpack --progress -w
build-native:
./node_modules/.bin/electron-rebuild -f -w terminus-terminal/node_modules/node-pty -m terminus-terminal
./node_modules/.bin/electron-rebuild -f -w terminus-terminal/node_modules/font-manager -m terminus-terminal
build-native-windows: build-native-windows:
echo :: Building native extensions echo :: Building native extensions
rm -r ./native/windows/build || true rm -r ./native/windows/build || true

View File

@ -1,58 +0,0 @@
// Core variables and mixins
@import "../../../node_modules/bootstrap/less/variables.less";
@import "variables.less";
@import "../../../node_modules/bootstrap/less/mixins.less";
//@import "mixin-overrides.less";
// Reset and dependencies
@import "../../../node_modules/bootstrap/less/normalize.less";
@import "../../../node_modules/bootstrap/less/print.less";
@import "../../../node_modules/bootstrap/less/glyphicons.less";
// Core CSS
@import "../../../node_modules/bootstrap/less/scaffolding.less";
@import "../../../node_modules/bootstrap/less/type.less";
@import "../../../node_modules/bootstrap/less/code.less";
@import "../../../node_modules/bootstrap/less/grid.less";
@import "../../../node_modules/bootstrap/less/tables.less";
@import "../../../node_modules/bootstrap/less/forms.less";
@import "../../../node_modules/bootstrap/less/buttons.less";
// Components
@import "../../../node_modules/bootstrap/less/component-animations.less";
@import "../../../node_modules/bootstrap/less/dropdowns.less";
@import "../../../node_modules/bootstrap/less/button-groups.less";
@import "../../../node_modules/bootstrap/less/input-groups.less";
@import "../../../node_modules/bootstrap/less/navs.less";
@import "../../../node_modules/bootstrap/less/navbar.less";
@import "../../../node_modules/bootstrap/less/breadcrumbs.less";
@import "../../../node_modules/bootstrap/less/pagination.less";
@import "../../../node_modules/bootstrap/less/pager.less";
@import "../../../node_modules/bootstrap/less/labels.less";
@import "../../../node_modules/bootstrap/less/badges.less";
@import "../../../node_modules/bootstrap/less/jumbotron.less";
@import "../../../node_modules/bootstrap/less/thumbnails.less";
@import "../../../node_modules/bootstrap/less/alerts.less";
@import "../../../node_modules/bootstrap/less/progress-bars.less";
@import "../../../node_modules/bootstrap/less/media.less";
@import "../../../node_modules/bootstrap/less/list-group.less";
@import "../../../node_modules/bootstrap/less/panels.less";
@import "../../../node_modules/bootstrap/less/responsive-embed.less";
@import "../../../node_modules/bootstrap/less/wells.less";
@import "../../../node_modules/bootstrap/less/close.less";
// Components w/ JavaScript
@import "../../../node_modules/bootstrap/less/modals.less";
@import "../../../node_modules/bootstrap/less/tooltip.less";
@import "../../../node_modules/bootstrap/less/popovers.less";
@import "../../../node_modules/bootstrap/less/carousel.less";
// Utility classes
@import "../../../node_modules/bootstrap/less/utilities.less";
@import "../../../node_modules/bootstrap/less/responsive-utilities.less";
@import "overrides.less";
body {
background: transparent;
}

View File

@ -1,4 +0,0 @@
// Core variables and mixins
@import "../../../node_modules/bootstrap/less/variables.less";
@import "variables.less";
@import "../../../node_modules/bootstrap/less/mixins.less";

View File

@ -143,7 +143,7 @@ start = () => {
Object.assign(options, windowConfig.get('windowBoundaries')) Object.assign(options, windowConfig.get('windowBoundaries'))
if (platform == 'darwin') { if (platform == 'darwin') {
options.titleBarStyle = 'hidden' options.titleBarStyle = 'hidden-inset'
} }
if ((configData.appearance || {}).useNativeFrame) { if ((configData.appearance || {}).useNativeFrame) {

View File

@ -1,18 +1,23 @@
{ {
"name": "term", "name": "terminus",
"version": "1.0.0", "version": "0.0.1",
"main": "main.js", "main": "main.js",
"dependencies": { "dependencies": {
"child-process-promise": "2.2.0", "@angular/animations": "4.0.1",
"@angular/common": "4.0.1",
"@angular/compiler": "4.0.1",
"@angular/core": "4.0.1",
"@angular/forms": "4.0.1",
"@angular/platform-browser": "4.0.1",
"@angular/platform-browser-dynamic": "4.0.1",
"@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.22",
"devtron": "1.4.0", "devtron": "1.4.0",
"electron-config": "0.2.1", "electron-config": "0.2.1",
"electron-debug": "1.0.1", "electron-debug": "1.0.1",
"electron-is-dev": "0.1.2", "electron-is-dev": "0.1.2",
"fs-promise": "^2.0.1", "js-yaml": "3.8.2",
"node-pty": "0.6.3", "path": "0.12.7",
"path": "0.12.7" "rxjs": "5.3.0",
}, "zone.js": "0.8.4"
"devDependencies": {
"js-yaml": "3.8.2"
} }
} }

View File

@ -1,21 +1,27 @@
import { NgModule } from '@angular/core' import { NgModule } from '@angular/core'
import { NgbModule } from '@ng-bootstrap/ng-bootstrap' import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
const projectRoot = '/home/eugene/Work/term/'
if (process.env.DEV) {
(<any>global).require('module').globalPaths.push(projectRoot);
(<any>global).require('module').globalPaths.push(projectRoot + 'app/node_modules')
}
let plugins = [ let plugins = [
(<any>global).require('../terminus-settings').default, (<any>global).require(projectRoot + 'terminus-settings').default,
(<any>global).require('../terminus-terminal').default, (<any>global).require(projectRoot + 'terminus-terminal').default,
(<any>global).require('../terminus-clickable-links').default, (<any>global).require(projectRoot + 'terminus-clickable-links').default,
(<any>global).require('../terminus-community-color-schemes').default, (<any>global).require(projectRoot + 'terminus-community-color-schemes').default,
] ]
const core = (<any>global).require('../terminus-core').default, const core = (<any>global).require(projectRoot + 'terminus-core')
@NgModule({ @NgModule({
imports: [ imports: [
core.forRoot(), core.AppRootModule.forRoot(),
...plugins, ...plugins,
NgbModule.forRoot(), NgbModule.forRoot(),
] ],
//bootstrap: [AppRootComponent] bootstrap: [core.AppRootComponent]
}) })
export class RootModule { } export class RootModule { }

View File

@ -1,3 +1,3 @@
import 'source-sans-pro' import 'source-sans-pro'
import 'font-awesome/css/font-awesome.css' import 'font-awesome/css/font-awesome.css'
import '../assets/toaster-custom.less' import '../assets/toaster-custom.scss'

View File

@ -1,4 +1,4 @@
console.timeStamp('entry point') (<any>console).timeStamp('entry point')
import 'core-js' import 'core-js'
import 'zone.js/dist/zone.js' import 'zone.js/dist/zone.js'
@ -18,7 +18,7 @@ if ((<any>global).require('electron-is-dev')) {
enableProdMode() enableProdMode()
} }
console.timeStamp('angular bootstrap started') (<any>console).timeStamp('angular bootstrap started')
platformBrowserDynamic().bootstrapModule(RootModule); platformBrowserDynamic().bootstrapModule(RootModule);

View File

@ -0,0 +1,7 @@
import { Component } from '@angular/core'
@Component({
template: '<app-root></app-root>'
})
export class RootComponent { }

View File

@ -1,6 +1,12 @@
{ {
"name": "term", "name": "term",
"devDependencies": { "devDependencies": {
"angular2-perfect-scrollbar": "2.0.0",
"jquery": "^3.1.1",
"@types/fs-promise": "^1.0.1",
"@types/core-js": "^0.9.35",
"@types/electron": "1.4.34",
"@types/node": "^7.0.5",
"@types/webpack-env": "^1.13.0", "@types/webpack-env": "^1.13.0",
"apply-loader": "^0.1.0", "apply-loader": "^0.1.0",
"awesome-typescript-loader": "3.1.2", "awesome-typescript-loader": "3.1.2",
@ -12,6 +18,7 @@
"file-loader": "^0.9.0", "file-loader": "^0.9.0",
"font-awesome": "4.7.0", "font-awesome": "4.7.0",
"html-loader": "^0.4.4", "html-loader": "^0.4.4",
"source-sans-pro": "^2.0.10",
"less": "^2.7.1", "less": "^2.7.1",
"less-loader": "^2.2.3", "less-loader": "^2.2.3",
"node-gyp": "^3.4.0", "node-gyp": "^3.4.0",
@ -25,7 +32,7 @@
"to-string-loader": "^1.1.5", "to-string-loader": "^1.1.5",
"tslint": "5.0.0", "tslint": "5.0.0",
"tslint-eslint-rules": "4.0.0", "tslint-eslint-rules": "4.0.0",
"typescript": "2.2.2", "typescript": "~2.1.0",
"url-loader": "^0.5.7", "url-loader": "^0.5.7",
"val-loader": "^0.5.0", "val-loader": "^0.5.0",
"vrsource-tslint-rules": "^4.0.1", "vrsource-tslint-rules": "^4.0.1",
@ -54,15 +61,5 @@
"pack": "build --dir", "pack": "build --dir",
"postinstall": "install-app-deps", "postinstall": "install-app-deps",
"dist": "build" "dist": "build"
},
"dependencies": {
"@angular/platform-server": "4.0.1",
"@angular/router": "4.0.1",
"@types/fs-promise": "^1.0.1",
"@types/core-js": "^0.9.35",
"@types/electron": "1.4.34",
"@types/node": "^7.0.5",
"angular2-perfect-scrollbar": "2.0.0",
"jquery": "^3.1.1"
} }
} }

View File

@ -15,10 +15,12 @@
"typescript": "^2.2.2", "typescript": "^2.2.2",
"webpack": "^2.3.3" "webpack": "^2.3.3"
}, },
"dependencies": { "peerDependencies": {
"@angular/core": "^4.0.1", "@angular/core": "^4.0.1",
"terminus-core": "*", "terminus-core": "*",
"terminus-terminal": "*", "terminus-terminal": "*"
},
"dependencies": {
"untildify": "^3.0.2" "untildify": "^3.0.2"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": "src",
"module": "commonjs", "module": "commonjs",
"target": "es5", "target": "es5",
"declaration": false, "declaration": false,
@ -22,7 +22,8 @@
"es7" "es7"
], ],
"paths": { "paths": {
"terminus-*": ["../terminus-*"] "*": ["../../app/node_modules/*"],
"terminus-*": ["../../terminus-*"]
} }
}, },
"compileOnSave": false, "compileOnSave": false,

View File

@ -1,15 +1,15 @@
module.exports = { module.exports = {
target: 'node', target: 'node',
entry: './index.ts', entry: 'src/index.ts',
devtool: 'source-map', devtool: 'source-map',
output: { output: {
filename: './dist/index.js', filename: './dist/index.js',
pathinfo: true, pathinfo: true,
library: 'terminusClickableLinks',
libraryTarget: 'umd', libraryTarget: 'umd',
devtoolModuleFilenameTemplate: 'webpack-terminus-clickable-links:///[resource-path]',
}, },
resolve: { resolve: {
modules: ['.', 'node_modules', '..'], modules: ['.', 'node_modules', '../app/node_modules'],
extensions: ['.ts', '.js'], extensions: ['.ts', '.js'],
}, },
module: { module: {
@ -20,11 +20,12 @@ module.exports = {
}, },
] ]
}, },
externals: [{ externals: [
'fs': true, 'fs',
'untildify': true, 'untildify',
'@angular/core': true, /^rxjs/,
'terminus-core': true, /^@angular/,
'terminus-terminal': true, /^@ng-bootstrap/,
}] /^terminus-/,
]
} }

View File

@ -10,8 +10,9 @@
}, },
"author": "Eugene Pankov", "author": "Eugene Pankov",
"license": "MIT", "license": "MIT",
"dependencies": { "peerDependencies": {
"@angular/core": "4.0.1", "@angular/core": "4.0.1",
"terminus-core": "*",
"terminus-terminal": "*" "terminus-terminal": "*"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { TerminalColorSchemeProvider, ITerminalColorScheme } from 'terminus-terminal' import { TerminalColorSchemeProvider, ITerminalColorScheme } from 'terminus-terminal'
const schemeContents = require.context('./schemes/', true, /.*/) const schemeContents = require.context('../schemes/', true, /.*/)
@Injectable() @Injectable()

View File

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": "src",
"module": "commonjs", "module": "commonjs",
"target": "es5", "target": "es5",
"declaration": false, "declaration": false,
@ -22,7 +22,8 @@
"es7" "es7"
], ],
"paths": { "paths": {
"terminus-*": ["../terminus-*"] "*": ["../../app/node_modules/*"],
"terminus-*": ["../../terminus-*"]
} }
}, },
"compileOnSave": false, "compileOnSave": false,

View File

@ -1,15 +1,15 @@
module.exports = { module.exports = {
target: 'node', target: 'node',
entry: 'index.ts', entry: 'src/index.ts',
devtool: 'source-map', devtool: 'source-map',
output: { output: {
filename: './dist/index.js', filename: './dist/index.js',
pathinfo: true, pathinfo: true,
library: 'terminusCommunityColorSchemes',
libraryTarget: 'umd', libraryTarget: 'umd',
devtoolModuleFilenameTemplate: 'webpack-terminus-community-color-schemes:///[resource-path]',
}, },
resolve: { resolve: {
modules: ['.', 'node_modules', '..'], modules: ['.', 'node_modules', '../app/node_modules'],
extensions: ['.ts', '.js'], extensions: ['.ts', '.js'],
}, },
module: { module: {
@ -18,9 +18,10 @@ module.exports = {
{ test: /\/schemes\//, loader: "raw-loader" }, { test: /\/schemes\//, loader: "raw-loader" },
] ]
}, },
externals: { externals: [
'fs': true, /^rxjs/,
'@angular/core': true, /^@angular/,
'terminus-terminal': true, /^@ng-bootstrap/,
} /^terminus-/,
]
} }

View File

@ -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) {
}
}

View File

@ -5,8 +5,8 @@
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"scripts": { "scripts": {
"build": "webpack --progress --color", "build": "rm -r dist; webpack --progress --color --display-modules",
"watch": "webpack --progress --color --watch" "watch": "rm -r dist; webpack --progress --color --watch"
}, },
"author": "Eugene Pankov", "author": "Eugene Pankov",
"license": "MIT", "license": "MIT",
@ -19,20 +19,22 @@
"webpack": "^2.3.3", "webpack": "^2.3.3",
"bootstrap": "4.0.0-alpha.6", "bootstrap": "4.0.0-alpha.6",
"core-js": "^2.4.1", "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/animations": "4.0.1",
"@angular/common": "4.0.1", "@angular/common": "4.0.1",
"@angular/core": "4.0.1", "@angular/core": "4.0.1",
"json-loader": "^0.5.4",
"@angular/forms": "4.0.1", "@angular/forms": "4.0.1",
"@angular/platform-browser": "4.0.1", "@angular/platform-browser": "4.0.1",
"@angular/platform-browser-dynamic": "4.0.1", "@angular/platform-browser-dynamic": "4.0.1",
"source-sans-pro": "^2.0.10",
"rxjs": "5.3.0", "rxjs": "5.3.0",
"yaml-loader": "^0.4.0",
"zone.js": "0.8.4" "zone.js": "0.8.4"
}, },
"dependencies": { "dependencies": {
"@angular/core": "^4.0.1",
"deepmerge": "^1.3.2", "deepmerge": "^1.3.2",
"js-yaml": "^3.8.3" "js-yaml": "^3.8.3"
} }

View File

@ -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
}
}

View File

@ -7,6 +7,8 @@ export { DefaultTabProvider } from './defaultTabProvider'
export { AppService } from '../services/app' export { AppService } from '../services/app'
export { ConfigService } from '../services/config' export { ConfigService } from '../services/config'
export { DockingService } from '../services/docking'
export { ElectronService } from '../services/electron' export { ElectronService } from '../services/electron'
export { Logger, LogService } from '../services/log' export { Logger, LogService } from '../services/log'
export { HotkeysService } from '../services/hotkeys' export { HotkeysService } from '../services/hotkeys'
export { HostAppService, Platform } from '../services/hostApp'

View File

@ -6,7 +6,3 @@ declare interface Window {
} }
declare var window: Window declare var window: Window
declare interface Console {
timeStamp(...args: any[])
}

View File

@ -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( .content(
[class.tabs-on-top]='config.full().appearance.tabsOnTop' [class.tabs-on-top]='config.full().appearance.tabsOnTop'

View File

@ -2,16 +2,16 @@ import { Component, Inject } from '@angular/core'
import { trigger, style, animate, transition, state } from '@angular/animations' import { trigger, style, animate, transition, state } from '@angular/animations'
import { ToasterConfig } from 'angular2-toaster' import { ToasterConfig } from 'angular2-toaster'
import { ElectronService } from 'services/electron' import { ElectronService } from '../services/electron'
import { HostAppService } from 'services/hostApp' import { HostAppService } from '../services/hostApp'
import { HotkeysService } from 'services/hotkeys' import { HotkeysService } from '../services/hotkeys'
import { Logger, LogService } from 'services/log' import { Logger, LogService } from '../services/log'
import { QuitterService } from 'services/quitter' import { QuitterService } from '../services/quitter'
import { ConfigService } from 'services/config' import { ConfigService } from '../services/config'
import { DockingService } from 'services/docking' import { DockingService } from '../services/docking'
import { TabRecoveryService } from 'services/tabRecovery' import { TabRecoveryService } from '../services/tabRecovery'
import { AppService, IToolbarButton, ToolbarButtonProvider } from 'api' import { AppService, IToolbarButton, ToolbarButtonProvider } from '../api'
import 'angular2-toaster/toaster.css' import 'angular2-toaster/toaster.css'
import 'overrides.scss' import 'overrides.scss'
@ -57,7 +57,7 @@ export class AppRootComponent {
log: LogService, log: LogService,
_quitter: QuitterService, _quitter: QuitterService,
) { ) {
console.timeStamp('AppComponent ctor') (<any>console).timeStamp('AppComponent ctor')
this.logger = log.create('main') this.logger = log.create('main')
this.logger.info('v', electron.app.getVersion()) this.logger.info('v', electron.app.getVersion())

View File

@ -1,5 +1,5 @@
import { Component, Input, ViewChild, HostBinding, ViewContainerRef } from '@angular/core' import { Component, Input, ViewChild, HostBinding, ViewContainerRef } from '@angular/core'
import { BaseTabComponent } from 'components/baseTab' import { BaseTabComponent } from '../components/baseTab'
@Component({ @Component({
selector: 'tab-body', selector: 'tab-body',

View File

@ -1,5 +1,5 @@
import { Component, Input, Output, EventEmitter, HostBinding } from '@angular/core' import { Component, Input, Output, EventEmitter, HostBinding } from '@angular/core'
import { BaseTabComponent } from 'components/baseTab' import { BaseTabComponent } from '../components/baseTab'
import './tabHeader.scss' import './tabHeader.scss'

View File

@ -32,4 +32,17 @@ $titlebar-height: 30px;
.btn-close { .btn-close {
font-size: 12px; font-size: 12px;
} }
}
&.inset-titlebar {
flex-basis: 36px;
.title {
padding-left: 80px;
line-height: 36px;
}
button {
display: none;
}
}
}

View 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
}
}

View File

@ -3,6 +3,7 @@ appearance:
dockScreen: 'current' dockScreen: 'current'
dockFill: 50 dockFill: 50
tabsOnTop: true tabsOnTop: true
useNativeFrame: false
hotkeys: hotkeys:
close-tab: close-tab:
- 'Ctrl-Shift-W' - 'Ctrl-Shift-W'

View File

@ -1,29 +1,29 @@
import { NgModule, ModuleWithProviders } from '@angular/core' import { NgModule, ModuleWithProviders } from '@angular/core'
console.info((<any>global).require.resolve('@angular/core'))
import { BrowserModule } from '@angular/platform-browser' import { BrowserModule } from '@angular/platform-browser'
import { BrowserAnimationsModule } from '@angular/platform-browser/animations' import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
import { FormsModule } from '@angular/forms' import { FormsModule } from '@angular/forms'
import { ToasterModule } from 'angular2-toaster' import { ToasterModule } from 'angular2-toaster'
import { NgbModule } from '@ng-bootstrap/ng-bootstrap' import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
import { AppService } from 'services/app' import { AppService } from './services/app'
import { ConfigService } from 'services/config' import { ConfigService } from './services/config'
import { ElectronService } from 'services/electron' import { ElectronService } from './services/electron'
import { HostAppService } from 'services/hostApp' import { HostAppService } from './services/hostApp'
import { LogService } from 'services/log' import { LogService } from './services/log'
import { HotkeysService, AppHotkeyProvider } from 'services/hotkeys' import { HotkeysService, AppHotkeyProvider } from './services/hotkeys'
import { ModalService } from 'services/modal' import { NotifyService } from './services/notify'
import { NotifyService } from 'services/notify' import { PluginsService } from './services/plugins'
import { PluginsService } from 'services/plugins' import { QuitterService } from './services/quitter'
import { QuitterService } from 'services/quitter' import { DockingService } from './services/docking'
import { DockingService } from 'services/docking' import { TabRecoveryService } from './services/tabRecovery'
import { TabRecoveryService } from 'services/tabRecovery'
import { AppRootComponent } from 'components/appRoot' import { AppRootComponent } from './components/appRoot'
import { TabBodyComponent } from 'components/tabBody' import { TabBodyComponent } from './components/tabBody'
import { TabHeaderComponent } from 'components/tabHeader' import { TabHeaderComponent } from './components/tabHeader'
import { TitleBarComponent } from 'components/titleBar' import { TitleBarComponent } from './components/titleBar'
import { HotkeyProvider } from 'api/hotkeyProvider' import { HotkeyProvider } from './api/hotkeyProvider'
const PROVIDERS = [ const PROVIDERS = [
@ -34,7 +34,6 @@ const PROVIDERS = [
HostAppService, HostAppService,
HotkeysService, HotkeysService,
LogService, LogService,
ModalService,
NotifyService, NotifyService,
PluginsService, PluginsService,
TabRecoveryService, TabRecoveryService,
@ -52,19 +51,17 @@ const PROVIDERS = [
NgbModule, NgbModule,
], ],
providers: PROVIDERS, providers: PROVIDERS,
entryComponents: [
],
declarations: [ declarations: [
AppRootComponent, AppRootComponent,
TabBodyComponent, TabBodyComponent,
TabHeaderComponent, TabHeaderComponent,
TitleBarComponent, TitleBarComponent,
], ],
bootstrap: [
AppRootComponent,
]
}) })
export default class AppModule { export default class AppModule {
}
export class AppRootModule {
static forRoot(): ModuleWithProviders { static forRoot(): ModuleWithProviders {
return { return {
ngModule: AppModule, ngModule: AppModule,
@ -73,5 +70,5 @@ export default class AppModule {
} }
} }
export { AppRootComponent }
export * from './api' export * from './api'

View File

@ -2,20 +2,28 @@ import { Injectable, NgZone, EventEmitter } from '@angular/core'
import { ElectronService } from '../services/electron' import { ElectronService } from '../services/electron'
import { Logger, LogService } from '../services/log' import { Logger, LogService } from '../services/log'
export const PLATFORM_WINDOWS = 'win32' export enum Platform {
export const PLATFORM_MAC = 'darwin' Linux, macOS, Windows,
export const PLATFORM_LINUX = 'linux' }
@Injectable() @Injectable()
export class HostAppService { export class HostAppService {
platform: Platform
nodePlatform: string
constructor( constructor(
private zone: NgZone, private zone: NgZone,
private electron: ElectronService, private electron: ElectronService,
log: LogService, log: LogService,
) { ) {
this.platform = require('os').platform()
this.logger = log.create('hostApp') 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())) 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>() quitRequested = new EventEmitter<any>()
ready = new EventEmitter<any>() ready = new EventEmitter<any>()
shown = new EventEmitter<any>() shown = new EventEmitter<any>()

View File

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": "./src",
"module": "commonjs", "module": "commonjs",
"target": "es5", "target": "es5",
"declaration": false, "declaration": false,
@ -22,11 +22,11 @@
"es7" "es7"
], ],
"paths": { "paths": {
"terminus-*": ["../terminus-*"] "*": ["../../app/node_modules/*"],
"terminus-*": ["../../terminus-*"]
} }
}, },
"compileOnSave": false, "include": [
"exclude": [ "src"
"node_modules"
] ]
} }

View File

@ -1,33 +1,37 @@
module.exports = { module.exports = {
target: 'node', target: 'node',
entry: './index.ts', entry: 'src/index.ts',
devtool: 'source-map', devtool: 'source-map',
output: { output: {
filename: './dist/index.js', filename: './dist/index.js',
pathinfo: true, pathinfo: true,
library: 'terminusCore', libraryTarget: 'umd',
libraryTarget: 'commonjs', devtoolModuleFilenameTemplate: 'webpack-terminus-core:///[resource-path]',
}, },
resolve: { resolve: {
modules: ['.', 'node_modules', '..'], modules: ['.', 'src', 'node_modules', '../app/node_modules'],
extensions: ['.ts', '.js'], extensions: ['.ts', '.js'],
}, },
module: { module: {
loaders: [ loaders: [
{ test: /\.ts$/, use: 'awesome-typescript-loader' }, { test: /\.ts$/, use: 'awesome-typescript-loader' },
{ test: /schemes\/.*$/, use: "raw-loader" },
{ test: /\.pug$/, use: ['apply-loader', 'pug-loader'] }, { test: /\.pug$/, use: ['apply-loader', 'pug-loader'] },
{ test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'] }, { test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'], exclude: /components\// },
{ test: /\.css$/, use: ['style-loader', 'css-loader', 'sass-loader'] }, { 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'] }, { test: /\.yaml$/, use: ['json-loader', 'yaml-loader'] },
] ]
}, },
externals: [{ externals: [
'fs': true, 'electron',
'os': true, 'fs',
'path': true, 'os',
'deepmerge': true, 'path',
'untildify': true, 'deepmerge',
'@angular/core': true, 'untildify',
}] 'js-yaml',
/^rxjs/,
/^@angular/,
/^@ng-bootstrap/,
]
} }

1
terminus-settings/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
dist

View File

@ -0,0 +1,36 @@
{
"name": "terminus-settings",
"version": "0.0.1",
"description": "Terminus terminal settings page",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"build": "webpack --progress --color --display-modules",
"watch": "webpack --progress --color --watch"
},
"author": "Eugene Pankov",
"license": "MIT",
"devDependencies": {
"@types/deep-equal": "1.0.0",
"@types/node": "7.0.12",
"@types/webpack-env": "1.13.0",
"awesome-typescript-loader": "3.1.2",
"css-loader": "^0.28.0",
"node-sass": "^4.5.2",
"pug": "^2.0.0-beta3",
"pug-loader": "^2.3.0",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.3",
"to-string-loader": "^1.1.5",
"webpack": "2.3.3"
},
"peerDependencies": {
"@angular/common": "4.0.1",
"@angular/core": "4.0.1",
"@angular/forms": "4.0.1",
"@angular/platform-browser": "4.0.1",
"@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.22",
"terminus-core": "*",
"rxjs": "5.3.0"
}
}

View File

@ -1,5 +1,6 @@
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { ToolbarButtonProvider, IToolbarButton, AppService } from 'api' import { ToolbarButtonProvider, IToolbarButton, AppService } from 'terminus-core'
import { SettingsTabComponent } from './components/settingsTab' import { SettingsTabComponent } from './components/settingsTab'

View File

@ -4,7 +4,7 @@ import { Component, Input, trigger, style, animate, transition } from '@angular/
@Component({ @Component({
selector: 'hotkey-display', selector: 'hotkey-display',
template: require('./hotkeyDisplay.pug'), template: require('./hotkeyDisplay.pug'),
styles: [require('./hotkeyDisplay.less')], styles: [require('./hotkeyDisplay.scss')],
//changeDetection: ChangeDetectionStrategy.OnPush, //changeDetection: ChangeDetectionStrategy.OnPush,
animations: [ animations: [
trigger('animateKey', [ trigger('animateKey', [

View File

@ -1,5 +1,6 @@
import { Component, Input, Output, EventEmitter, HostListener, ChangeDetectionStrategy } from '@angular/core' import { Component, Input, Output, EventEmitter, HostListener, ChangeDetectionStrategy } from '@angular/core'
import { ModalService } from 'services/modal' import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { HotkeyInputModalComponent } from './hotkeyInputModal' import { HotkeyInputModalComponent } from './hotkeyInputModal'
@ -8,16 +9,16 @@ import { HotkeyInputModalComponent } from './hotkeyInputModal'
template: ` template: `
<hotkey-display [model]='model'></hotkey-display> <hotkey-display [model]='model'></hotkey-display>
`, `,
styles: [require('./hotkeyInput.less')], styles: [require('./hotkeyInput.scss')],
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class HotkeyInputComponent { export class HotkeyInputComponent {
constructor( constructor(
private modal: ModalService, private ngbModal: NgbModal,
) { } ) { }
@HostListener('click') public click() { @HostListener('click') public click() {
this.modal.open(HotkeyInputModalComponent).result.then((value: string[]) => { this.ngbModal.open(HotkeyInputModalComponent).result.then((value: string[]) => {
this.model = value this.model = value
this.modelChange.emit(this.model) this.modelChange.emit(this.model)
}) })

View File

@ -1,7 +1,7 @@
import { Component, Input, trigger, transition, style, animate } from '@angular/core' import { Component, Input, trigger, transition, style, animate } from '@angular/core'
import { HotkeysService } from 'services/hotkeys'
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
import { Subscription } from 'rxjs' import { Subscription } from 'rxjs'
import { HotkeysService } from 'terminus-core'
const INPUT_TIMEOUT = 1000 const INPUT_TIMEOUT = 1000

View File

@ -1,8 +1,5 @@
import { Component, Inject } from '@angular/core' import { Component, Inject } from '@angular/core'
import { ElectronService } from 'services/electron' import { ElectronService, DockingService, ConfigService, IHotkeyDescription, HotkeyProvider, BaseTabComponent } from 'terminus-core'
import { ConfigService } from 'services/config'
import { DockingService } from 'services/docking'
import { IHotkeyDescription, HotkeyProvider, BaseTabComponent } from 'api'
import { SettingsTabProvider } from '../api' import { SettingsTabProvider } from '../api'

View File

@ -1,6 +1,7 @@
import { Component, Input, ViewContainerRef, ViewChild, ComponentFactoryResolver, ComponentRef } from '@angular/core' import { Component, Input, ViewContainerRef, ViewChild, ComponentFactoryResolver, ComponentRef } from '@angular/core'
import { SettingsTabProvider } from '../api' import { SettingsTabProvider } from '../api'
@Component({ @Component({
selector: 'settings-tab-body', selector: 'settings-tab-body',
template: '<ng-template #placeholder></ng-template>', template: '<ng-template #placeholder></ng-template>',

View File

@ -2,6 +2,7 @@ import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser' import { BrowserModule } from '@angular/platform-browser'
import { FormsModule } from '@angular/forms' import { FormsModule } from '@angular/forms'
import { NgbModule } from '@ng-bootstrap/ng-bootstrap' import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
import { ToolbarButtonProvider, TabRecoveryProvider } from 'terminus-core'
import { HotkeyInputComponent } from './components/hotkeyInput' import { HotkeyInputComponent } from './components/hotkeyInput'
import { HotkeyDisplayComponent } from './components/hotkeyDisplay' import { HotkeyDisplayComponent } from './components/hotkeyDisplay'
@ -10,8 +11,6 @@ import { MultiHotkeyInputComponent } from './components/multiHotkeyInput'
import { SettingsTabComponent } from './components/settingsTab' import { SettingsTabComponent } from './components/settingsTab'
import { SettingsTabBodyComponent } from './components/settingsTabBody' import { SettingsTabBodyComponent } from './components/settingsTabBody'
import { ToolbarButtonProvider, TabRecoveryProvider } from 'api'
import { ButtonProvider } from './buttonProvider' import { ButtonProvider } from './buttonProvider'
import { RecoveryProvider } from './recoveryProvider' import { RecoveryProvider } from './recoveryProvider'
@ -39,8 +38,7 @@ import { RecoveryProvider } from './recoveryProvider'
SettingsTabBodyComponent, SettingsTabBodyComponent,
], ],
}) })
class SettingsModule { export default class SettingsModule {
} }
export * from './api'
export default SettingsModule

View File

@ -1,5 +1,6 @@
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { TabRecoveryProvider, AppService } from 'api' import { TabRecoveryProvider, AppService } from 'terminus-core'
import { SettingsTabComponent } from './components/settingsTab' import { SettingsTabComponent } from './components/settingsTab'

View File

@ -0,0 +1,32 @@
{
"compilerOptions": {
"baseUrl": "./src",
"module": "commonjs",
"target": "es5",
"declaration": false,
"noImplicitAny": false,
"removeComments": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"declaration": true,
"declarationDir": "dist",
"lib": [
"dom",
"es2015",
"es7"
],
"paths": {
"*": ["../../app/node_modules/*"],
"terminus-*": ["../../terminus-*"]
}
},
"include": [
"src"
]
}

View File

@ -0,0 +1,36 @@
module.exports = {
target: 'node',
entry: 'src/index.ts',
devtool: 'source-map',
output: {
filename: './dist/index.js',
pathinfo: true,
libraryTarget: 'commonjs',
devtoolModuleFilenameTemplate: 'webpack-terminus-settings:///[resource-path]',
},
resolve: {
modules: ['.', 'node_modules', '../app/node_modules'],
extensions: ['.ts', '.js'],
},
module: {
loaders: [
{ test: /\.ts$/, use: 'awesome-typescript-loader', exclude: [/node_modules/] },
{ test: /schemes\/.*$/, use: "raw-loader" },
{ 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'] },
]
},
externals: [
'fs',
'fs-promise',
'path',
'node-pty',
'child-process-promise',
'fs-promise',
/^rxjs/,
/^@angular/,
/^@ng-bootstrap/,
/^terminus-/,
]
}

View File

@ -5,7 +5,7 @@
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"scripts": { "scripts": {
"build": "webpack --progress --color", "build": "webpack --progress --color --display-modules",
"watch": "webpack --progress --color --watch" "watch": "webpack --progress --color --watch"
}, },
"author": "Eugene Pankov", "author": "Eugene Pankov",
@ -16,25 +16,30 @@
"@types/webpack-env": "1.13.0", "@types/webpack-env": "1.13.0",
"awesome-typescript-loader": "3.1.2", "awesome-typescript-loader": "3.1.2",
"css-loader": "^0.28.0", "css-loader": "^0.28.0",
"dataurl": "0.1.0",
"deep-equal": "1.0.1",
"pug": "^2.0.0-beta11", "pug": "^2.0.0-beta11",
"pug-loader": "^2.3.0", "pug-loader": "^2.3.0",
"raw-loader": "^0.5.1", "raw-loader": "^0.5.1",
"sass-loader": "^6.0.3", "sass-loader": "^6.0.3",
"style-loader": "^0.16.1", "to-string-loader": "^1.1.5",
"webpack": "2.3.3" "webpack": "2.3.3"
}, },
"dependencies": { "peerDependencies": {
"@angular/common": "4.0.1", "@angular/common": "4.0.1",
"@angular/core": "4.0.1", "@angular/core": "4.0.1",
"@angular/forms": "4.0.1", "@angular/forms": "4.0.1",
"@angular/platform-browser": "4.0.1", "@angular/platform-browser": "4.0.1",
"@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.22", "@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.22",
"child-process-promise": "2.2.1", "terminus-core": "*",
"dataurl": "0.1.0", "terminus-settings": "*",
"deep-equal": "1.0.1",
"fs-promise": "2.0.2",
"hterm-commonjs": "1.0.0",
"node-pty": "0.6.2",
"rxjs": "5.3.0" "rxjs": "5.3.0"
},
"dependencies": {
"child-process-promise": "2.2.1",
"fs-promise": "2.0.2",
"font-manager": "0.2.2",
"hterm-commonjs": "1.0.0",
"node-pty": "0.6.2"
} }
} }

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { HotkeysService, ToolbarButtonProvider, IToolbarButton, AppService } from 'terminus-core' import { HotkeysService, ToolbarButtonProvider, IToolbarButton, AppService, HostAppService, Platform } from 'terminus-core'
import { SessionsService } from './services/sessions' import { SessionsService } from './services/sessions'
import { TerminalTabComponent } from './components/terminalTab' import { TerminalTabComponent } from './components/terminalTab'
@ -10,6 +10,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
constructor ( constructor (
private app: AppService, private app: AppService,
private sessions: SessionsService, private sessions: SessionsService,
private hostApp: HostAppService,
hotkeys: HotkeysService, hotkeys: HotkeysService,
) { ) {
super() super()
@ -25,9 +26,14 @@ export class ButtonProvider extends ToolbarButtonProvider {
if (this.app.activeTab instanceof TerminalTabComponent) { if (this.app.activeTab instanceof TerminalTabComponent) {
cwd = await this.app.activeTab.session.getWorkingDirectory() cwd = await this.app.activeTab.session.getWorkingDirectory()
} }
let command = {
[Platform.macOS]: 'zsh',
[Platform.Linux]: 'zsh',
[Platform.Windows]: 'cmd.exe',
}[this.hostApp.platform]
this.app.openNewTab( this.app.openNewTab(
TerminalTabComponent, TerminalTabComponent,
{ session: await this.sessions.createNewSession({ command: 'zsh', cwd }) } { session: await this.sessions.createNewSession({ command, cwd }) }
) )
} }

View File

@ -43,6 +43,12 @@
span -> span ->
span([style.color]='config.full().terminal.colorScheme.colors[1]') link span([style.color]='config.full().terminal.colorScheme.colors[1]') link
div div
span
div
span john@doe-pc
span([style.color]='config.full().terminal.colorScheme.colors[1]') $
span rm -rf /
span([style.background-color]='config.full().terminal.colorScheme.cursor') &nbsp;
.col-lg-6 .col-lg-6
@ -85,7 +91,7 @@
title='BG', title='BG',
) )
color-picker( color-picker(
'[(model)]'='config.store.terminal.cursor.background', '[(model)]'='config.store.terminal.colorScheme.cursor',
(modelChange)='config.save()', (modelChange)='config.save()',
title='CU', title='CU',
) )

View File

@ -3,8 +3,10 @@ import 'rxjs/add/operator/map'
import 'rxjs/add/operator/debounceTime' import 'rxjs/add/operator/debounceTime'
import 'rxjs/add/operator/distinctUntilChanged' import 'rxjs/add/operator/distinctUntilChanged'
const equal = require('deep-equal') const equal = require('deep-equal')
const fontManager = require('font-manager')
import { Component, Inject } from '@angular/core' import { Component, Inject } from '@angular/core'
import { ConfigService } from 'terminus-core' import { ConfigService, HostAppService, Platform } from 'terminus-core'
const { exec } = require('child-process-promise') const { exec } = require('child-process-promise')
import { TerminalColorSchemeProvider, ITerminalColorScheme } from '../api' import { TerminalColorSchemeProvider, ITerminalColorScheme } from '../api'
@ -21,19 +23,26 @@ export class SettingsComponent {
constructor( constructor(
public config: ConfigService, public config: ConfigService,
private hostApp: HostAppService,
@Inject(TerminalColorSchemeProvider) private colorSchemeProviders: TerminalColorSchemeProvider[], @Inject(TerminalColorSchemeProvider) private colorSchemeProviders: TerminalColorSchemeProvider[],
) { } ) { }
async ngOnInit () { async ngOnInit () {
exec('fc-list :spacing=mono').then((result) => { if (this.hostApp.platform == Platform.Windows) {
this.fonts = result.stdout let fonts = await new Promise<any[]>((resolve) => fontManager.findFonts({ monospace: true }, resolve))
.split('\n') this.fonts = fonts.map(x => x.family)
.filter((x) => !!x)
.map((x) => x.split(':')[1].trim())
.map((x) => x.split(',')[0].trim())
this.fonts.sort() this.fonts.sort()
}) }
if (this.hostApp.platform == Platform.Linux) {
exec('fc-list :spacing=mono').then((result) => {
this.fonts = result.stdout
.split('\n')
.filter(x => !!x)
.map(x => x.split(':')[1].trim())
.map(x => x.split(',')[0].trim())
this.fonts.sort()
})
}
this.colorSchemes = (await Promise.all(this.colorSchemeProviders.map(x => x.getSchemes()))).reduce((a, b) => a.concat(b)) this.colorSchemes = (await Promise.all(this.colorSchemeProviders.map(x => x.getSchemes()))).reduce((a, b) => a.concat(b))
} }

Some files were not shown because too many files have changed in this diff Show More