1
1
mirror of https://github.com/bitgapp/eqMac.git synced 2024-11-22 04:33:53 +03:00

added eslint to the monorepo and fixed UI linting errors

This commit is contained in:
Nodeful 2021-03-24 16:42:45 +02:00
parent decf2673b1
commit c7419165b2
90 changed files with 2317 additions and 341 deletions

2
.eslintignore Normal file
View File

@ -0,0 +1,2 @@
node_modules
dist

40
.eslintrc.js Normal file
View File

@ -0,0 +1,40 @@
module.exports = {
extends: 'standard-with-typescript',
parserOptions: {
tsconfigRootDir: __dirname,
project: [
'./ui/tsconfig.eslint.json'
]
},
overrides: [{
files: ['*.ts'],
rules: {
radix: 'off',
'accessor-pairs': 'off',
'return-undefined': 'off',
'no-throw-literal': 'off',
'import-first': 'off',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-unused-vars': [2, { args: 'none' }],
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/promise-function-async': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'array-bracket-spacing': ['error', 'always'],
'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true }],
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/return-await': 'off',
'node/no-callback-literal': 'off',
'no-async-promise-executor': 'off',
'@typescript-eslint/no-dynamic-delete': 'off'
}
}],
env: {
node: true
}
}

1948
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

30
package.json Normal file
View File

@ -0,0 +1,30 @@
{
"name": "eqmac",
"version": "1.0.0",
"description": "eqMac Monorepo",
"main": ".eslintrc.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/bitgapp/eqMac.git"
},
"author": "Roman Kisil <Nodeful>",
"license": "ISC",
"bugs": {
"url": "https://github.com/bitgapp/eqMac/issues"
},
"homepage": "https://github.com/bitgapp/eqMac#readme",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.19.0",
"eslint": "^7.22.0",
"eslint-config-standard-with-typescript": "^20.0.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1"
},
"dependencies": {
"typescript": "^4.2.3"
}
}

2
ui/.eslintignore Normal file
View File

@ -0,0 +1,2 @@
node_modules
dist

3
ui/.eslintrc.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
extends: '../.eslintrc.js'
}

2
ui/package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "eqmac",
"version": "1.2.2",
"version": "1.3.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -9,7 +9,7 @@ const cf = Cloudflare({
})
;(async () => {
const [ major, minor ] = version.split('.')
const [ major ] = version.split('.')
const domain = `https://ui-v${major}.eqmac.app`
await cf.zones.purgeCache(process.env.CLOUDFLARE_ZONE_ID, {
files: [ domain ]

View File

@ -75,7 +75,7 @@ export class AppComponent implements OnInit, AfterContentInit {
async syncHeight (dimensions?: UIDimensions) {
await this.utils.delay(10)
let height = this.container.nativeElement.offsetHeight
let height: number = this.container.nativeElement.offsetHeight
if (dimensions) {
if (dimensions.heightDiff) {
height += dimensions.heightDiff
@ -88,7 +88,7 @@ export class AppComponent implements OnInit, AfterContentInit {
async syncWidth (dimensions?: UIDimensions) {
await this.utils.delay(10)
let width = this.container.nativeElement.offsetWidth
let width: number = this.container.nativeElement.offsetWidth
if (dimensions) {
if (dimensions.widthDiff) {
width += dimensions.widthDiff
@ -100,8 +100,8 @@ export class AppComponent implements OnInit, AfterContentInit {
}
startDimensionsSync () {
this.ui.dimensionsChanged.subscribe(dimensions => this.syncDimensions(dimensions))
setInterval(() => this.syncDimensions(), 1000)
this.ui.dimensionsChanged.subscribe(async dimensions => await this.syncDimensions(dimensions))
setInterval(async () => await this.syncDimensions(), 1000)
}
toggleDropdownSection (section: string) {
@ -123,7 +123,7 @@ export class AppComponent implements OnInit, AfterContentInit {
closeDropdownSection (section: string, event?: any) {
// if (event && event.target && ['backdrop', 'mat-dialog'].some(e => event.target.className.includes(e))) return
if (this.matDialog.openDialogs.length) return
if (this.matDialog.openDialogs.length > 0) return
if (section in this.showDropdownSections) {
this.showDropdownSections[section] = false
}

View File

@ -9,10 +9,6 @@ import {
AppComponent
} from './app.component'
import {
environment
} from '../environments/environment'
import {
FlexLayoutModule
} from '@angular/flex-layout'
@ -70,9 +66,6 @@ import {
import {
VolumeBoosterBalanceComponent
} from './sections/volume/booster-balance/volume-booster-balance.component'
import {
VolumeMixerComponent
} from './sections/volume/volume-mixer/volume-mixer.component'
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
import { SettingsComponent } from './sections/settings/settings.component'
@ -115,7 +108,6 @@ import { OptionsDialogComponent } from './components/options-dialog/options-dial
BasicEqualizerComponent,
AdvancedEqualizerComponent,
VolumeBoosterBalanceComponent,
VolumeMixerComponent,
SettingsComponent,
OptionsComponent,
HelpComponent,

View File

@ -43,5 +43,4 @@ export class ConfirmDialogComponent implements OnInit {
this.dialogRef.close(true)
}
}
}

View File

@ -27,5 +27,4 @@ export class OptionsDialogComponent implements OnInit {
}
}
}
}

View File

@ -74,8 +74,8 @@ export interface BreadcrumbsOption extends BaseOptions {
}
export interface InputOption extends BaseOptions {
type: 'input',
value?: string,
type: 'input'
value?: string
placeholder?: string
changed?: (value: string) => any
enter?: () => any
@ -138,7 +138,7 @@ export class OptionsComponent {
) {}
getOptionStyle (option: Option, row: Option[]) {
let style = option.style || {}
const style = option.style || {}
if (!style.width) {
style.width = `${100 / row.length}%`
}
@ -146,7 +146,7 @@ export class OptionsComponent {
style.width = '100%'
}
if (!!option.isEnabled && option.isEnabled() === false) {
if (!!option.isEnabled && !option.isEnabled()) {
style.filter = 'grayscale(1)'
}
@ -154,7 +154,7 @@ export class OptionsComponent {
}
toggleCheckbox (checkbox: CheckboxOption) {
if (!!checkbox.isEnabled && checkbox.isEnabled() === false) {
if (!!checkbox.isEnabled && !checkbox.isEnabled()) {
return
}
checkbox.value = !checkbox.value
@ -163,7 +163,7 @@ export class OptionsComponent {
}
selectedOption (option: SelectOption, selectOption: SelectOptionOption) {
if (!!option.isEnabled && option.isEnabled() === false) {
if (!!option.isEnabled && !option.isEnabled()) {
return
}
if (option.selectedId !== selectOption.id) {

View File

@ -1,4 +1,4 @@
import { trigger, style, animate, transition, state } from '@angular/animations'
import { trigger, style, animate, transition } from '@angular/animations'
const DURATION = 100

View File

@ -32,8 +32,8 @@ export class AnalyzerComponent implements OnInit {
// Get canvas context
const gridCanvas: HTMLCanvasElement = this.gridCanvas.nativeElement
gridCanvas.style.height = this.container.nativeElement.offsetHeight + 'px'
gridCanvas.style.width = this.container.nativeElement.offsetWidth + 'px'
gridCanvas.style.height = `${parseInt(this.container.nativeElement.offsetHeight)}px`
gridCanvas.style.width = `${parseInt(this.container.nativeElement.offsetWidth)}px`
this.width = gridCanvas.offsetWidth
this.height = gridCanvas.offsetHeight

View File

@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
@Component({
selector: 'eqm-breadcrumbs',
@ -9,9 +9,7 @@ export class BreadcrumbsComponent implements OnInit {
@Input() crumbs: string[]
@Input() underline = true
@Output() crumbClicked = new EventEmitter<{ crumb: string, index: number }>()
constructor() { }
ngOnInit (): void {
}
}

View File

@ -15,7 +15,6 @@ export class ButtonComponent implements OnInit {
@Input() hoverable = true
@Input() disabled = false
@Output() pressed = new EventEmitter()
constructor () { }
ngOnInit () {
}
@ -55,5 +54,4 @@ export class ButtonComponent implements OnInit {
this.pressed.emit()
}
}
}

View File

@ -1,5 +1,5 @@
import { Component, ContentChildren, QueryList, Directive, ViewChild, ElementRef, Input, TemplateRef, ViewContainerRef, AfterViewInit, Output, EventEmitter, HostBinding, ViewChildren, OnDestroy } from '@angular/core'
import { AnimationPlayer, AnimationFactory, animate, style, AnimationBuilder } from '@angular/animations'
import { Component, ContentChildren, QueryList, Directive, ViewChild, ElementRef, Input, TemplateRef, AfterViewInit, Output, EventEmitter, ViewChildren, OnDestroy } from '@angular/core'
import { AnimationFactory, animate, style, AnimationBuilder } from '@angular/animations'
@Directive({
selector: '[eqmCarouselItem]'
@ -41,6 +41,7 @@ export class CarouselComponent implements AfterViewInit, OnDestroy {
this.heightDiff.emit(diff)
}
}
@Output() heightDiff = new EventEmitter<number>()
@Output() heightChange = new EventEmitter<number>()
public recalculateHeightTimer
@ -54,6 +55,7 @@ export class CarouselComponent implements AfterViewInit, OnDestroy {
this.recalculateHeight()
this.itemCameIntoView.emit(this.selectedItemId)
}
get selectedItemId () { return this._selectedItemId }
@Output() selectedItemIdChange = new EventEmitter<string>()
@Output() animationCompleted = new EventEmitter<string>()
@ -75,13 +77,13 @@ export class CarouselComponent implements AfterViewInit, OnDestroy {
ngAfterViewInit () {
for (const item of this.items.toArray()) {
if (!item.eqmCarouselItem || typeof item.eqmCarouselItem !== 'string') {
throw new Error(`eqmCarouselItem directive was not provided an item ID`)
throw new Error('eqmCarouselItem directive was not provided an item ID')
}
}
this.animate()
this.recalculateHeight()
this.recalculateHeightTimer = setInterval(this.recalculateHeight.bind(this), 1000)
this.recalculateHeightTimer = setInterval(() => this.recalculateHeight(), 1000)
}
ngOnDestroy () {
@ -127,8 +129,7 @@ export class CarouselComponent implements AfterViewInit, OnDestroy {
}
public recalculateHeight () {
const itemEl = this.itemElems && this.itemElems.toArray()[this.currentIndex].nativeElement.nextElementSibling
itemEl && itemEl.offsetHeight && (this.height = itemEl.offsetHeight)
const itemEl = this.itemElems?.toArray()[this.currentIndex].nativeElement.nextElementSibling
itemEl?.offsetHeight && (this.height = itemEl.offsetHeight)
}
}

View File

@ -1,4 +1,4 @@
import { Component, OnInit, Input, Output, EventEmitter, HostBinding } from '@angular/core'
import { Component, Input, Output, EventEmitter, HostBinding } from '@angular/core'
@Component({
selector: 'eqm-checkbox',

View File

@ -7,9 +7,7 @@ import { Component, OnInit, HostBinding, Input } from '@angular/core'
})
export class ContainerComponent implements OnInit {
@HostBinding('class.disabled') @Input() disabled = false
constructor () { }
ngOnInit () {
}
}

View File

@ -1,4 +1,4 @@
import { Component, OnInit, Input, ElementRef, HostBinding } from '@angular/core'
import { Component, Input, ElementRef, HostBinding } from '@angular/core'
@Component({
selector: 'eqm-divider',
@ -41,5 +41,4 @@ export class DividerComponent {
get bottomtBorder () {
return this.orientation === 'horizontal' ? '1px solid rgb(96, 97, 101)' : undefined
}
}

View File

@ -1,7 +1,6 @@
import { Component, OnInit, Input, ViewChild, ElementRef, EventEmitter, Output, NgZone, HostBinding, HostListener } from '@angular/core'
import { SelectBoxComponent } from '../select-box/select-box.component'
import { UtilitiesService } from '../../services/utilities.service'
import { InputFieldComponent } from '../input-field/input-field.component'
import { FadeInOutAnimation } from 'src/app/modules/animations'
@Component({
@ -24,11 +23,13 @@ export class DropdownComponent implements OnInit {
get items () {
return this._items
}
set items (newItems) {
if (!newItems || !Array.isArray(newItems)) return
this.searchText = null
this._items = newItems
}
@Output() refChanged = new EventEmitter<DropdownComponent>()
@HostBinding('class.disabled') @Input() disabled = false
@Input() selectedItem = null
@ -54,7 +55,8 @@ export class DropdownComponent implements OnInit {
if (!this.items) this.items = []
this.setDimensions()
this.calculateYCoordinate()
for (let _ in [...Array(3)]) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const _ of [ ...Array(3) ]) {
await this.utils.delay(100)
this.calculateYCoordinate()
}
@ -78,19 +80,19 @@ export class DropdownComponent implements OnInit {
this.direction = preferredDirection
const inputEl = this.container.nativeElement
const inputHeight = inputEl.offsetHeight
const inputHeight = parseInt(inputEl.offsetHeight)
const inputPosition = inputEl.getBoundingClientRect()
const boxHeight = this.boxComponent.height
const downY = inputPosition.y + inputHeight + this.padding / 2
const downY = parseInt(inputPosition.y) + inputHeight + this.padding / 2
const downSpaceLeft = viewHeight - (downY + boxHeight)
const upY = inputPosition.top - boxHeight - this.padding
const upSpaceLeft = upY
this.direction = this.forceDirection ?? (downSpaceLeft > upSpaceLeft ? 'down' : 'up')
let y = this.direction === 'down' ? downY : upY
const y = this.direction === 'down' ? downY : upY
this.yCoordinate = y
}

View File

@ -1,6 +1,5 @@
import {
Component,
OnInit,
ViewChild,
Input,
Output,
@ -13,7 +12,7 @@ import {
UtilitiesService
} from '../../services/utilities.service'
import { FadeInOutAnimation } from '../../../animations'
import { SafeStyle, DomSanitizer } from '@angular/platform-browser'
import { DomSanitizer } from '@angular/platform-browser'
export interface FlatSliderValueChangedEvent {
value: number
@ -61,6 +60,7 @@ export class FlatSliderComponent {
this._enabled = shouldBeEnabled
this._color = this._enabled ? this.defaultColor : '#777'
}
get enabled () { return this._enabled }
public _color = this.defaultColor
@ -69,6 +69,7 @@ export class FlatSliderComponent {
this.defaultColor = newColor
this._color = this._enabled ? this.defaultColor : '#777'
}
get color () {
return this._color
}
@ -85,7 +86,7 @@ export class FlatSliderComponent {
public dragging = false
public thumbRadius = 4
public _value = .5
public _value = 0.5
@Input()
set value (newValue) {
let value = this.clampValue(newValue)
@ -116,6 +117,7 @@ export class FlatSliderComponent {
this._value = this.clampValue(value)
this.valueChange.emit(this._value)
}
get value () { return this._value }
@Output() valueChange = new EventEmitter()
@ -128,6 +130,7 @@ export class FlatSliderComponent {
get width () {
return this.containerRef.nativeElement.offsetWidth
}
public clampValue (value) {
if (value < this.min) return this.min
if (value > this.max) return this.max
@ -165,7 +168,8 @@ export class FlatSliderComponent {
if (progress > inMax) progress = inMax
return this.mapValue({
value: progress,
inMin, inMax,
inMin,
inMax,
outMin: this.min,
outMax: this.max
})
@ -195,6 +199,7 @@ export class FlatSliderComponent {
onMouseEnter (): void {
this.mouseInside = true
}
@HostListener('mouseleave')
onMouseLeave (): void {
this.mouseInside = false
@ -229,13 +234,13 @@ export class FlatSliderComponent {
value += step
this.value = value
}
return
}
@HostListener('mouseup', [ '$event' ])
onMouseUp () {
this.dragging = false
}
mouseup (event) {
this.dragging = false
}
@ -259,10 +264,10 @@ export class FlatSliderComponent {
const styles: { [style: string]: string } = {}
const narrow = this.thumbRadius * 2 + 2
if (this.orientation === 'horizontal') {
styles.width = `100%`
styles.width = '100%'
styles.height = `${narrow}px`
} else {
styles.height = `100%`
styles.height = '100%'
styles.width = `${narrow}px`
}
@ -351,13 +356,16 @@ export class FlatSliderComponent {
}
private mapValue ({ value, inMin, inMax, outMin, outMax, logInverse }: {
value: number, inMin: number, inMax: number, outMin: number, outMax: number
value: number
inMin: number
inMax: number
outMin: number
outMax: number
logInverse?: boolean
}) {
switch (this.scale) {
case 'linear': return this.utils.mapValue(value, inMin, inMax, outMin, outMax)
case 'logarithmic': return (logInverse ? this.utils.logMapValueInverse : this.utils.logMapValue)
({ value, inMin, inMax, outMin, outMax })
case 'logarithmic': return (logInverse ? this.utils.logMapValueInverse : this.utils.logMapValue)({ value, inMin, inMax, outMin, outMax })
}
}
}

View File

@ -18,10 +18,12 @@ export class IconComponent implements OnInit {
@Input() height = 20
svg: SafeHtml
icons = svgs
@Input() set size (newSize) {
this.width = newSize
this.height = newSize
}
_color = '#979aa0'
@Input()
set color (newColor) {
@ -47,6 +49,7 @@ export class IconComponent implements OnInit {
get rotate () {
return this._rotate
}
set rotate (angle: number) {
this._rotate = angle
}
@ -57,6 +60,7 @@ export class IconComponent implements OnInit {
this._name = iconName
this.svg = this.sanitizer.bypassSecurityTrustHtml(this.icons[this.name])
}
get name () { return this._name }
@Input() stroke: number = 0

View File

@ -14,7 +14,6 @@ export class InputFieldComponent implements OnInit {
@HostBinding('class.disabled') @Input() disabled = false
@Input() fontSize = 12
@ViewChild('container', { static: true }) container
constructor () { }
ngOnInit () {
}
@ -26,5 +25,4 @@ export class InputFieldComponent implements OnInit {
enterPressed () {
this.enter.emit()
}
}

View File

@ -59,7 +59,6 @@ export class KnobComponent implements OnInit {
if (this._value === newValue || typeof newValue !== 'number') return
let value = newValue
if (this.stickToMiddle) {
let diffFromMiddle = this.middleValue - value
if (diffFromMiddle < 0) {
diffFromMiddle *= -1
@ -77,6 +76,7 @@ export class KnobComponent implements OnInit {
this._value = this.clampValue(value)
this.valueChange.emit(this._value)
}
get value () {
return this._value
}
@ -133,7 +133,6 @@ export class KnobComponent implements OnInit {
mousemove (event) {
if (!this.disabled) {
if (this.setDraggingFalseTimeout) {
window.clearTimeout(this.setDraggingFalseTimeout)
}
@ -236,7 +235,6 @@ export class KnobComponent implements OnInit {
}
}
this.continueAnimation = false
return
}
public getDegreesFromEvent (event) {

View File

@ -1,4 +1,4 @@
import { Component, OnInit, Input, HostBinding } from '@angular/core'
import { Component, Input, HostBinding } from '@angular/core'
@Component({
selector: 'eqm-label',
@ -9,7 +9,6 @@ export class LabelComponent {
@Input() fontSize: number
@Input() color: string
@Input() clickable = false
constructor () { }
get style () {
return {

View File

@ -1,4 +1,4 @@
import { Component, ViewChild, ElementRef, OnInit, AfterViewInit } from '@angular/core'
import { Component, ViewChild, ElementRef, AfterViewInit } from '@angular/core'
@Component({
selector: 'eqm-loading',
@ -10,6 +10,7 @@ export class LoadingComponent implements AfterViewInit {
ngAfterViewInit () {
const path = this.wave.nativeElement
// eslint-disable-next-line no-loss-of-precision
const m = 0.512286623256592433
const w = 90
const h = 60

View File

@ -6,10 +6,6 @@ import { Component, OnInit } from '@angular/core'
styleUrls: [ './prompt.component.scss' ]
})
export class PromptComponent implements OnInit {
constructor () { }
ngOnInit () {
}
}

View File

@ -1,4 +1,4 @@
import { Component, OnInit, Input } from '@angular/core'
import { Component, OnInit } from '@angular/core'
@Component({
selector: 'eqm-question',
@ -6,8 +6,6 @@ import { Component, OnInit, Input } from '@angular/core'
styles: [ ':host { height: 12px; width: 12px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background-color: #2c2c2e; }' ]
})
export class QuestionComponent implements OnInit {
constructor () { }
ngOnInit () {
}
}

View File

@ -6,10 +6,6 @@ import { Component, OnInit } from '@angular/core'
styleUrls: [ './screw.component.scss' ]
})
export class ScrewComponent implements OnInit {
constructor () { }
ngOnInit () {
}
}

View File

@ -6,13 +6,13 @@ import { Component, OnInit, Input, Output, EventEmitter, ViewChild, ElementRef }
styleUrls: [ './select-box.component.scss' ]
})
export class SelectBoxComponent implements OnInit {
_items: any[] = []
@Input()
set items (newItems: any[]) {
this._items = newItems
this.setHeight()
}
get items () {
return this._items
}
@ -67,5 +67,4 @@ export class SelectBoxComponent implements OnInit {
this.selectedItem = item
this.itemSelected.emit(item)
}
}

View File

@ -24,7 +24,6 @@ export interface SkeuomorphSliderValueChangedEvent {
styleUrls: [ './skeuomorph-slider.component.scss' ]
})
export class SkeuomorphSliderComponent implements OnInit {
constructor (public utils: UtilitiesService, public elRef: ElementRef) {}
@Input() min: number = 0
@ -50,7 +49,7 @@ export class SkeuomorphSliderComponent implements OnInit {
@HostBinding('class.disabled') @Input() disabled = false
public _value = .5
public _value = 0.5
@Input()
set value (newValue) {
let value = this.clampValue(newValue)
@ -74,8 +73,8 @@ export class SkeuomorphSliderComponent implements OnInit {
}
this._value = this.clampValue(value)
this.valueChange.emit(this._value)
}
get value () { return this._value }
@HostListener('mousewheel', [ '$event' ])
@ -154,7 +153,7 @@ export class SkeuomorphSliderComponent implements OnInit {
ngOnInit () {
if (this.showNotches) {
this.drawNotches()
setTimeout(this.drawNotches.bind(this))
setTimeout(() => this.drawNotches())
}
}
@ -171,7 +170,6 @@ export class SkeuomorphSliderComponent implements OnInit {
value += step
this.value = value
}
return
}
@HostListener('window:resize')
@ -186,7 +184,7 @@ export class SkeuomorphSliderComponent implements OnInit {
const gap = (height - padding * 2) / 10
ctx.strokeStyle = '#559e7d'
for (let i = 0; i <= 10; i++) {
const y = Math.round(padding + gap * i) - .5
const y = Math.round(padding + gap * i) - 0.5
ctx.beginPath()
const lineWidth = [ 0, 5, 10 ].includes(i) ? width : (width * 0.9)
ctx.moveTo((width - lineWidth) / 1, y)
@ -198,6 +196,6 @@ export class SkeuomorphSliderComponent implements OnInit {
}
calculateTop () {
return this.utils.mapValue(this._value, this.min, this.max, this.elRef.nativeElement.offsetHeight - 25, 0) + 'px'
return `${this.utils.mapValue(this._value, this.min, this.max, parseInt(this.elRef.nativeElement.offsetHeight) - 25, 0)}px`
}
}

View File

@ -6,9 +6,6 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
styleUrls: [ './toggle.component.scss' ]
})
export class ToggleComponent implements OnInit {
constructor () { }
@Input() state = false
@Output() stateChange = new EventEmitter()

View File

@ -19,7 +19,5 @@ import { FadeInOutAnimation } from '../../../animations/fade-in-out'
animations: [ FadeInOutAnimation ]
})
export class TooltipContainerComponent {
constructor (public tooltipService: TooltipService) {}
}

View File

@ -6,7 +6,7 @@ import {
ViewChild
} from '@angular/core'
import { UtilitiesService } from '../../services/utilities.service'
import { SafeStyle, DomSanitizer } from '@angular/platform-browser'
import { DomSanitizer } from '@angular/platform-browser'
export type TooltipPositionSide = 'top' | 'bottom' | 'left' | 'right'
@Component({
@ -49,12 +49,11 @@ export class TooltipComponent implements OnInit {
const viewHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight)
const viewWidth = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth)
const tooltipEl = this.tooltip.nativeElement
const tooltipWidth = tooltipEl.offsetWidth + 3
const tooltipHeight = tooltipEl.offsetHeight + 2
const tooltipWidth = parseInt(tooltipEl.offsetWidth) + 3
const tooltipHeight = parseInt(tooltipEl.offsetHeight) + 2
const parentEl = this.parent.nativeElement
const parentPosition = this.utils.getElementPosition(parentEl)
const parentWidth = parentEl.offsetWidth
const parentHeight = parentEl.offsetHeight
const parentHeight = parseInt(parentEl.offsetHeight)
x = parentPosition.x
y = parentPosition.y
@ -98,14 +97,12 @@ export class TooltipComponent implements OnInit {
let angle = 0
const style: { [style: string]: string } = {}
const tooltipEl = this.tooltip.nativeElement
const tooltipWidth = tooltipEl.offsetWidth
const tooltipHeight = tooltipEl.offsetHeight
const tooltipPosition = this.utils.getElementPosition(tooltipEl)
const parentEl = this.parent.nativeElement
const parentPosition = this.utils.getElementPosition(parentEl)
const parentWidth = parentEl.offsetWidth
const parentHeight = parentEl.offsetHeight
x = parentPosition.x + parentWidth / 2 - tooltipPosition.x - arrowSize / 2 + 3
if (this.positionSide === 'top') {
@ -126,5 +123,4 @@ export class TooltipComponent implements OnInit {
return style
}
}

View File

@ -51,5 +51,4 @@ export class TooltipDirective implements OnDestroy {
destroy (): void {
this.tooltipService.components = []
}
}

View File

@ -4,6 +4,5 @@ import { Injectable } from '@angular/core'
providedIn: 'root'
})
export class TooltipService {
components: any[] = []
}

View File

@ -1,8 +1,7 @@
import {
Component,
OnInit,
Input,
HostBinding
Input
} from '@angular/core'
@Component({
@ -13,8 +12,6 @@ import {
export class ValueScreenComponent implements OnInit {
@Input() fontSize = 10
@Input() disabled = false
constructor () {}
ngOnInit () {}
}

View File

@ -6,8 +6,6 @@ import { Component, OnInit } from '@angular/core'
styleUrls: [ './vent.component.scss' ]
})
export class VentComponent implements OnInit {
constructor () { }
ngOnInit () {
}
}

View File

@ -1,6 +1,6 @@
import { Component, Directive, EventEmitter, HostListener, Output } from "@angular/core";
import { Directive, EventEmitter, HostListener, Output } from '@angular/core'
@Directive({ selector: `[clickedOutside]` })
@Directive({ selector: '[clickedOutside]' })
export class ClickedOutsideDirective {
@Output() clickedOutside = new EventEmitter()
@ -9,6 +9,7 @@ export class ClickedOutsideDirective {
insideClick () {
this.inside = true
}
@HostListener('document:click')
outsideClick () {
if (!this.inside) {

View File

@ -18,7 +18,6 @@ export class MouseWheelDirective {
mouseWheelFunc (event: any) {
event = window.event || event // old IE support
const delta = Math.max(-1, Math.min(1, (event.wheelDelta || -event.detail)))
this.mouseWheel.emit(event)
// for IE
event.returnValue = false
@ -27,5 +26,4 @@ export class MouseWheelDirective {
event.preventDefault()
}
}
}

View File

@ -1,5 +1,5 @@
import {
NgModule, TemplateRef
NgModule
} from '@angular/core'
import {
CommonModule
@ -46,7 +46,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
import { CarouselComponent, CarouselItemDirective, CarouselItemElement } from './components/carousel/carousel.component'
import { QuestionComponent } from './components/question/question.component'
import { ClickedOutsideDirective } from './directives/clicked-outside.directive'
import { ScrollingModule } from '@angular/cdk/scrolling';
import { ScrollingModule } from '@angular/cdk/scrolling'
import { BreadcrumbsComponent } from './components/breadcrumbs/breadcrumbs.component'
@NgModule({

View File

@ -2,14 +2,16 @@ import { Injectable } from '@angular/core'
@Injectable()
export class UtilitiesService {
constructor () { }
mapValue (value: number, inMin: number, inMax: number, outMin: number, outMax: number): number {
return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin
}
logMapValue ({ value, inMin, inMax, outMin, outMax }: {
value: number, inMin: number, inMax: number, outMin: number, outMax: number
value: number
inMin: number
inMax: number
outMin: number
outMax: number
}) {
outMin = Math.log(outMin)
outMax = Math.log(outMax)
@ -18,7 +20,11 @@ export class UtilitiesService {
}
logMapValueInverse ({ value, inMin, inMax, outMin, outMax }: {
value: number, inMin: number, inMax: number, outMin: number, outMax: number
value: number
inMin: number
inMax: number
outMin: number
outMax: number
}) {
inMin = Math.log(inMin || 1)
inMax = Math.log(inMax)
@ -52,12 +58,12 @@ export class UtilitiesService {
return this.getImageFromSrcWhenLoaded(this.getBackgroundImageSrcFromClass(className))
}
getRandomFloatInRange (min, max) {
getRandomFloatInRange (min: number, max: number) {
return (Math.random() * (max - min) + min)
}
getCoordinatesInsideElementFromEvent (event: MouseEvent, element?) {
let el = element || event.target
const el = element || event.target
const rect = el.getBoundingClientRect()
return {
x: event.clientX - rect.left,
@ -75,7 +81,7 @@ export class UtilitiesService {
const rect = el.getBoundingClientRect()
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft
const scrollTop = window.pageYOffset || document.documentElement.scrollTop
return { y: rect.top + scrollTop, x: rect.left + scrollLeft }
return { y: parseInt(rect.top) + scrollTop, x: parseInt(rect.left) + scrollLeft }
}
hexToRgb (hex: string) {
@ -99,5 +105,4 @@ export class UtilitiesService {
rgbToHex ({ r, g, b }: { r: number, g: number, b: number }) {
return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)
}
}

View File

@ -4,11 +4,9 @@ import { Pipe, PipeTransform } from '@angular/core'
name: 'clipValue'
})
export class ClipValuePipe implements PipeTransform {
transform (value: number, min: number, max: number): number {
if (value < min) { return min }
if (value > max) { return max }
return value
}
}

View File

@ -4,7 +4,6 @@ import { Pipe, PipeTransform } from '@angular/core'
name: 'fixFloat'
})
export class FixFloatPipe implements PipeTransform {
transform (value: number, fixTo: number, showZeros = true) {
let fixedValue: any = value.toFixed(fixTo)
if (!showZeros) {
@ -12,5 +11,4 @@ export class FixFloatPipe implements PipeTransform {
}
return fixedValue
}
}

View File

@ -4,9 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core'
name: 'mapValue'
})
export class MapValuePipe implements PipeTransform {
constructor () {}
transform (value: number, inMin: number, inMax: number, outMin: number, outMax: number): number {
return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin
}
}

View File

@ -17,6 +17,6 @@ export class EffectService extends DataService {
}
onEnabledChanged (callback: (enabled: boolean) => void) {
this.on(`/enabled`, ({ enabled }) => callback(enabled))
this.on('/enabled', ({ enabled }) => callback(enabled))
}
}

View File

@ -26,6 +26,7 @@ export class AdvancedEqualizerComponent extends EqualizerComponent implements On
value: false,
toggled: (show) => this.service.setShowDefaultPresets(show)
}
settings: Options = [ [
{
type: 'button',
@ -39,6 +40,7 @@ export class AdvancedEqualizerComponent extends EqualizerComponent implements On
], [
this.ShowDefaultPresetsCheckbox
] ]
public _presets: AdvancedEqualizerPreset[]
@Output() presetsChange = new EventEmitter<AdvancedEqualizerPreset[]>()
set presets (newPresets: AdvancedEqualizerPreset[]) {
@ -50,6 +52,7 @@ export class AdvancedEqualizerComponent extends EqualizerComponent implements On
]
this.presetsChange.emit(this.presets)
}
get presets () { return this._presets }
public _selectedPreset: AdvancedEqualizerPreset
@ -58,6 +61,7 @@ export class AdvancedEqualizerComponent extends EqualizerComponent implements On
this._selectedPreset = newSelectedPreset
this.selectedPresetChange.emit(this.selectedPreset)
}
get selectedPreset () { return this._selectedPreset }
bandFrequencyLabels = [ '32', '64', '125', '250', '500', '1K', '2K', '4K', '8K', '16K' ]
@ -134,6 +138,7 @@ export class AdvancedEqualizerComponent extends EqualizerComponent implements On
)
}
}
public async syncPresets () {
const [ presets, selectedPreset ] = await Promise.all([
this.service.getPresets(),

View File

@ -24,27 +24,27 @@ export class AdvancedEqualizerService extends EqualizersService {
}
createPreset (preset: AdvancedEqualizerPreset, select: boolean = false) {
return this.request({ method: 'POST', endpoint: `/presets`, data: { ...preset, select } })
return this.request({ method: 'POST', endpoint: '/presets', data: { ...preset, select } })
}
updatePreset (preset: AdvancedEqualizerPreset, opts?: { select?: boolean, transition?: boolean }) {
return this.request({
method: 'POST',
endpoint: `/presets`,
endpoint: '/presets',
data: {
...preset,
select: opts && opts.select,
transition: opts && opts.transition
// ...preset,
select: opts?.select,
transition: opts?.transition
}
})
}
selectPreset (preset: AdvancedEqualizerPreset) {
return this.request({ method: 'POST', endpoint: `/presets/select`, data: { ...preset } })
return this.request({ method: 'POST', endpoint: '/presets/select', data: { ...preset } })
}
deletePreset (preset: AdvancedEqualizerPreset) {
return this.request({ method: 'DELETE', endpoint: `/presets`, data: { ...preset } })
return this.request({ method: 'DELETE', endpoint: '/presets', data: { ...preset } })
}
async getImportLegacyAvailable () {
@ -81,10 +81,10 @@ export class AdvancedEqualizerService extends EqualizersService {
}
onPresetsChanged (callback: (presets: AdvancedEqualizerPreset[]) => void) {
this.on(`/presets`, (presets) => callback(presets))
this.on('/presets', (presets) => callback(presets))
}
onSelectedPresetChanged (callback: (preset: AdvancedEqualizerPreset) => void) {
this.on(`/presets/selected`, (preset) => callback(preset))
this.on('/presets/selected', (preset) => callback(preset))
}
}

View File

@ -1,11 +1,10 @@
import { Component, OnInit, Input, Output, EventEmitter, ChangeDetectorRef } from '@angular/core'
import { BasicEqualizerService, BasicEqualizerPreset, BasicEqualizerBand, BasicEqualizerPresetGains } from './basic-equalizer.service'
import { BridgeService } from '../../../../services/bridge.service'
import { EqualizerComponent } from '../equalizer.component'
import { KnobValueChangedEvent } from '../../../../modules/eqmac-components/components/knob/knob.component'
import { TransitionService } from '../../../../services/transitions.service'
import { ApplicationService } from '../../../../services/app.service'
import { UISettings, UIService } from '../../../../services/ui.service'
import { UIService } from '../../../../services/ui.service'
@Component({
selector: 'eqm-basic-equalizer',
@ -20,6 +19,7 @@ export class BasicEqualizerComponent extends EqualizerComponent implements OnIni
mid: 0,
treble: 0
}
peakLimiter = false
replaceKnobsWithSliders = false
@ -35,6 +35,7 @@ export class BasicEqualizerComponent extends EqualizerComponent implements OnIni
]
this.presetsChange.emit(this.presets)
}
get presets () { return this._presets }
public _selectedPreset: BasicEqualizerPreset
@ -43,6 +44,7 @@ export class BasicEqualizerComponent extends EqualizerComponent implements OnIni
this._selectedPreset = newSelectedPreset
this.selectedPresetChange.emit(this.selectedPreset)
}
get selectedPreset () { return this._selectedPreset }
settings = []
@ -109,7 +111,7 @@ export class BasicEqualizerComponent extends EqualizerComponent implements OnIni
this.peakLimiter = this.selectedPreset.peakLimiter || false
for (const [ type, gain ] of Object.entries(this.selectedPreset.gains)) {
const currentGain: number = this.gains[type]
const currentGain = this.gains[type] as number
if (currentGain !== gain) {
this.stickSlidersToMiddle = false
this.change.detectChanges()

View File

@ -1,9 +1,8 @@
import { Injectable } from '@angular/core'
import { EqualizersService } from '../equalizers.service'
import { EqualizerPreset } from '../presets/equalizer-presets.component'
import { JSONEncodable, JSONData } from '../../../../services/data.service'
export type BasicEqualizerPresetGains = {
export interface BasicEqualizerPresetGains {
bass: number
mid: number
treble: number
@ -31,34 +30,34 @@ export class BasicEqualizerService extends EqualizersService {
}
createPreset (preset: BasicEqualizerPreset, select: boolean = false) {
return this.request({ method: 'POST', endpoint: `/presets`, data: { ...preset, select } })
return this.request({ method: 'POST', endpoint: '/presets', data: { ...preset, select } as any })
}
updatePreset (preset: BasicEqualizerPreset, opts?: { select?: boolean, transition?: boolean }) {
return this.request({
method: 'POST',
endpoint: `/presets`,
endpoint: '/presets',
data: {
...preset,
select: opts && opts.select,
transition: opts && opts.transition
}
select: opts?.select,
transition: opts?.transition
} as any
})
}
selectPreset (preset: BasicEqualizerPreset) {
return this.request({ method: 'POST', endpoint: `/presets/select`, data: { ...preset } })
return this.request({ method: 'POST', endpoint: '/presets/select', data: { ...preset } as any })
}
deletePreset (preset: BasicEqualizerPreset) {
return this.request({ method: 'DELETE', endpoint: `/presets`, data: { ...preset } })
return this.request({ method: 'DELETE', endpoint: '/presets', data: { ...preset } as any })
}
onPresetsChanged (callback: (presets: BasicEqualizerPreset[]) => void) {
this.on(`/presets`, (presets) => callback(presets))
this.on('/presets', (presets) => callback(presets))
}
onSelectedPresetChanged (callback: (preset: BasicEqualizerPreset) => void) {
this.on(`/presets/selected`, (preset) => callback(preset))
this.on('/presets/selected', (preset) => callback(preset))
}
}

View File

@ -1,9 +1,10 @@
import { Option, Options } from 'src/app/components/options/options.component'
import { Options } from 'src/app/components/options/options.component'
import { AdditionalPresetOption, EqualizerPreset } from './presets/equalizer-presets.component'
import { Input } from '@angular/core'
import { Component, Input } from '@angular/core'
import { MatDialogRef } from '@angular/material/dialog'
import { OptionsDialogComponent } from '../../../components/options-dialog/options-dialog.component'
@Component({ template: '' })
export abstract class EqualizerComponent {
@Input() animationDuration = 500
@Input() animationFps = 30

View File

@ -38,6 +38,7 @@ export class EqualizersComponent implements OnInit {
this.changeRef.detectChanges()
this.activeEqualizer = this.getEqualizerFromType(this.type)
}
get type () { return this._type }
gain: number = 0
@ -48,7 +49,7 @@ export class EqualizersComponent implements OnInit {
public equalizersService: EqualizersService,
public dialog: MatDialog,
public ui: UIService,
private changeRef: ChangeDetectorRef
private readonly changeRef: ChangeDetectorRef
) { }
async ngOnInit () {
@ -132,5 +133,4 @@ export class EqualizersComponent implements OnInit {
selectPreset (preset: EqualizerPreset) {
return this.activeEqualizer.selectPreset(preset)
}
}

View File

@ -62,7 +62,7 @@ export class EqualizerPresetsComponent implements OnInit {
data: {
confirmText: 'Yes, save',
cancelText: 'No, cancel',
text: `A Default preset with this name already exists. Would you like to use this name anyway? You might see Duplicate names in the Preset list.`
text: 'A Default preset with this name already exists. Would you like to use this name anyway? You might see Duplicate names in the Preset list.'
}
}).afterClosed().toPromise()
if (!saveAnyway) return this.savePreset(presetName)
@ -73,7 +73,7 @@ export class EqualizerPresetsComponent implements OnInit {
data: {
confirmText: 'Yes, overwrite',
cancelText: 'No, cancel',
text: `A preset with this name already exists. Would you like to overwrite it?`
text: 'A preset with this name already exists. Would you like to overwrite it?'
}
}).afterClosed().toPromise()
if (!overwrite) return this.savePreset(presetName)
@ -90,7 +90,7 @@ export class EqualizerPresetsComponent implements OnInit {
data: {
confirmText: 'Yes, remove',
cancelText: 'No, cancel',
text: `Are you sure you want to remove this Preset?`
text: 'Are you sure you want to remove this Preset?'
}
}).afterClosed().toPromise()
@ -98,5 +98,4 @@ export class EqualizerPresetsComponent implements OnInit {
this.presetDeleted.emit()
}
}
}

View File

@ -51,7 +51,6 @@ export class ReverbComponent implements OnInit {
this.getSelectedPreset()
this.getMix()
this.getEnabled()
}
async getPresets () {
@ -87,5 +86,4 @@ export class ReverbComponent implements OnInit {
this.hide = !this.hide
this.visibilityToggled.emit()
}
}

View File

@ -41,8 +41,8 @@ export class HeaderComponent implements OnInit {
this.uiMode = await this.ui.getMode()
}
setShowBoolean (name, bool) {
if (this.showBooleanDebouncers.hasOwnProperty(name)) {
setShowBoolean (name: string, bool: boolean) {
if (name in this.showBooleanDebouncers) {
clearTimeout(this.showBooleanDebouncers[name])
delete this.showBooleanDebouncers[name]
this[name] = bool
@ -104,5 +104,4 @@ export class HeaderComponent implements OnInit {
// this.mode = this.mode === 'window' ? 'popover' : 'window'
// return this.ui.setMode(this.mode)
// }
}

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'
import { Option, Options } from 'src/app/components/options/options.component'
import { Options } from 'src/app/components/options/options.component'
import { ApplicationService, MacInfo } from 'src/app/services/app.service'
import { ConstantsService } from 'src/app/services/constants.service'
import { version } from '../../../../package.json'

View File

@ -18,7 +18,7 @@ export type DeviceTransportType =
export interface Output {
id: number
name: string
transportType: DeviceTransportType,
transportType: DeviceTransportType
icon?: IconName
}
@Injectable({

View File

@ -29,5 +29,4 @@ export class RecorderComponent implements OnInit {
}, 1000)
}
}
}

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'
import { Option, CheckboxOption, ButtonOption, Options, SelectOption } from 'src/app/components/options/options.component'
import { CheckboxOption, ButtonOption, Options, SelectOption } from 'src/app/components/options/options.component'
import { SettingsService, IconMode } from './settings.service'
import { ApplicationService } from '../../services/app.service'
import { MatDialog } from '@angular/material/dialog'
@ -48,6 +48,7 @@ export class SettingsComponent implements OnInit {
await this.settingsService.setIconMode(iconMode as IconMode)
}
}
uninstallOption: ButtonOption = {
type: 'button',
label: 'Uninstall eqMac',

View File

@ -27,6 +27,7 @@ export class FileComponent implements OnInit, OnDestroy {
name: null,
duration: 0
}
public syncedOnce = false
public progressProjectionInterval = null
public progressSetDebouncer = null
@ -102,7 +103,6 @@ export class FileComponent implements OnInit, OnDestroy {
}
await Promise.all(thingsToSync)
this.syncedOnce = true
}
async getSelected () {
@ -112,6 +112,7 @@ export class FileComponent implements OnInit, OnDestroy {
this.selected = false
}
}
async getFile () {
try {
this.meta = await this.fileService.getMeta()

View File

@ -46,10 +46,10 @@ export class FileService extends SourceService {
}
onPlayingChanged (callback: (playing: boolean) => void) {
this.on(`/playing`, ({ playing }) => callback(playing))
this.on('/playing', ({ playing }) => callback(playing))
}
onProgressChanged (callback: (progress: number) => void) {
this.on(`/progress`, ({ progress }) => callback(progress))
this.on('/progress', ({ progress }) => callback(progress))
}
}

View File

@ -13,7 +13,6 @@ export interface InputDevice {
styleUrls: [ './input.component.scss' ]
})
export class InputComponent implements OnInit {
constructor (public inputService: InputService) { }
devices: InputDevice[] = []
@ -36,7 +35,7 @@ export class InputComponent implements OnInit {
}
async syncSelectedDevice () {
const selectedDevice = await this.inputService.getDevice()
await this.inputService.getDevice()
}
protected setupEvents () {

View File

@ -7,7 +7,6 @@ import { SourceService, SourceType } from './source.service'
styleUrls: [ './source.component.scss' ]
})
export class SourceComponent implements OnInit {
source: SourceType = 'File'
constructor (public sourceService: SourceService) { }
@ -27,5 +26,4 @@ export class SourceComponent implements OnInit {
this.sourceService.setSource(this.source)
}
}
}

View File

@ -6,10 +6,6 @@ import { Component, OnInit } from '@angular/core'
styleUrls: [ './system.component.scss' ]
})
export class SystemComponent implements OnInit {
constructor () { }
ngOnInit () {
}
}

View File

@ -3,7 +3,7 @@ import { BalanceService } from './balance.service'
import { ApplicationService } from '../../../../services/app.service'
import { KnobValueChangedEvent } from '../../../../modules/eqmac-components/components/knob/knob.component'
import { FlatSliderValueChangedEvent } from '../../../../modules/eqmac-components/components/flat-slider/flat-slider.component'
import { UIService, UISettings } from '../../../../services/ui.service'
import { UIService } from '../../../../services/ui.service'
@Component({
selector: 'eqm-balance',

View File

@ -5,7 +5,6 @@ import { VolumeService } from '../../../../services/volume.service'
providedIn: 'root'
})
export class BalanceService extends VolumeService {
async getBalance () {
const resp = await this.request({ method: 'GET', endpoint: '/balance' })
return resp.balance

View File

@ -7,7 +7,7 @@ import {
import { BoosterService } from './booster.service'
import { ApplicationService } from '../../../../services/app.service'
import { UIService, UISettings } from '../../../../services/ui.service'
import { UIService } from '../../../../services/ui.service'
@Component({
selector: 'eqm-booster',

View File

@ -34,5 +34,4 @@ export class VolumeBoosterBalanceComponent implements OnInit {
this.hide = !this.hide
this.visibilityToggled.emit()
}
}

View File

@ -1,3 +0,0 @@
<p>
volume-mixer works!
</p>

View File

@ -1,15 +0,0 @@
import { Component, OnInit } from '@angular/core'
@Component({
selector: 'eqm-volume-mixer',
templateUrl: './volume-mixer.component.html',
styleUrls: ['./volume-mixer.component.scss']
})
export class VolumeMixerComponent implements OnInit {
constructor () { }
ngOnInit () {
}
}

View File

@ -78,6 +78,7 @@ export class BridgeService {
bridge.registerHandler(event, async (data, cb) => {
const handleError = (err: string | Error) => {
console.error(err)
// eslint-disable-next-line @typescript-eslint/no-base-to-string
cb({ error: err.toString() })
}
try {

View File

@ -7,6 +7,6 @@ export class ConstantsService {
readonly DOMAIN = 'eqmac.app'
readonly FAQ_URL = new URL(`https://${this.DOMAIN}/faq`)
readonly BUG_REPORT_URL = new URL(`https://${this.DOMAIN}/report-bug`)
readonly LOCAL_API_URL = `https://127.0.0.1`
readonly LOCAL_API_URL = 'https://127.0.0.1'
readonly REMOTE_API_URL = `https://api.${this.DOMAIN}`
}

View File

@ -10,6 +10,7 @@ export class CookiesService {
constructor (
public CONST: ConstantsService
) {}
set (key: string, value: any) {
if (typeof value !== 'string') {
value = JSON.stringify(value)

View File

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core'
import { BridgeService } from './bridge.service'
import { Logger } from './logger.service'
import { CookiesService } from './cookies.service'
export type JSONEncodable = null | boolean | number | string | JSONData

View File

@ -38,7 +38,7 @@ export class TransitionService extends DataService {
const step = distance / this.FRAME_COUNT
const frames = [ ...Array(this.FRAME_COUNT) ].map((_, i) => i + 1)
for (const frame of frames) {
let delay = Math.round(this.FRAME_DURATION * frame)
const delay = Math.round(this.FRAME_DURATION * frame)
setTimeout(() => {
cb(from + step * frame)
}, delay)

View File

@ -1,8 +1,8 @@
import { Injectable, EventEmitter } from '@angular/core'
import { Injectable } from '@angular/core'
import { DataService } from './data.service'
import { Observable, Subject } from 'rxjs'
import { Subject } from 'rxjs'
export type UISettings = {
export interface UISettings {
replaceKnobsWithSliders?: boolean
}
@ -24,12 +24,12 @@ export class UIService extends DataService {
settingsChanged = new Subject<UISettings>()
readonly colors = {
'accent': '#4f8d71',
'warning': '#e80415',
accent: '#4f8d71',
warning: '#e80415',
'gradient-start': '#5a5b5f',
'gradient-end': '#2c2c2e',
'light': '#c9cdd0',
'dark': '#16191c'
light: '#c9cdd0',
dark: '#16191c'
}
get isLocal () {
@ -84,5 +84,4 @@ export class UIService extends DataService {
settings = await this.request({ method: 'POST', endpoint: '/settings', data: settings })
this.settingsChanged.next(settings)
}
}

View File

@ -14,7 +14,7 @@ platformBrowserDynamic()
.then(() => {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistration('ngsw-worker.js')
.then(registration => registration && registration.unregister())
.then(async registration => await registration?.unregister())
}
})
.catch(err => console.error(err))

View File

@ -72,8 +72,7 @@ import 'web-animations-js' // Run `npm install --save web-animations-js`.
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
import 'zone.js/dist/zone' // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS

View File

@ -6,7 +6,8 @@
"resolveJsonModule": true
},
"angularCompilerOptions": {
"enableIvy": false
"enableIvy": true,
"strictTemplates": true
},
"exclude": []
}

17
ui/tsconfig.eslint.json Normal file
View File

@ -0,0 +1,17 @@
{
// extend your base config to share compilerOptions, etc
"extends": "./tsconfig.json",
"compilerOptions": {
// ensure that nobody can accidentally use this config for a build
"noEmit": true
},
"include": [
// whatever paths you intend to lint
"src",
"scripts"
],
"exclude": [
"node_modules",
"dist"
]
}

View File

@ -18,6 +18,6 @@
"lib": [
"es2018",
"dom"
]
],
}
}

View File

@ -1,6 +0,0 @@
{
"extends": "tslint-config-standard",
"rules": {
"no-empty": false
}
}