chore: cleanup

This commit is contained in:
Nathan Walker
2020-07-06 23:27:18 -07:00
parent 49cd2f0df3
commit c6902538cf
62 changed files with 328 additions and 182 deletions

View File

@@ -1,6 +1,6 @@
import { Font as FontBase, parseFontFamily, genericFontFamilies, FontStyle, FontWeight } from './font-common';
import { Trace } from '../../trace';
import { device } from '../../platform';
import { Device } from '../../platform';
import * as fs from '../../file-system';
export * from './font-common';
@@ -8,7 +8,7 @@ const EMULATE_OBLIQUE = true;
const OBLIQUE_TRANSFORM = CGAffineTransformMake(1, 0, 0.2, 1, 0, 0);
const DEFAULT_SERIF = 'Times New Roman';
const DEFAULT_MONOSPACE = 'Courier New';
const SUPPORT_FONT_WEIGHTS = parseFloat(device.osVersion) >= 10.0;
const SUPPORT_FONT_WEIGHTS = parseFloat(Device.osVersion) >= 10.0;
export class Font extends FontBase {
public static default = new Font(undefined, undefined, FontStyle.NORMAL, FontWeight.NORMAL);

View File

@@ -157,7 +157,7 @@ class CSSSource {
return new CSSSource(undefined, url, file, keyframes, undefined);
}
@profile()
@profile
public static resolveCSSPathFromURL(url: string, importSource?: string): string {
const app = knownFolders.currentApp().path;
const file = resolveFileNameFromUrl(url, app, File.exists, importSource);
@@ -180,13 +180,13 @@ class CSSSource {
return this._source;
}
@profile()
@profile
private load(): void {
const file = File.fromPath(this._file);
this._source = file.readTextSync();
}
@profile()
@profile
private parse(): void {
try {
if (!this._ast) {
@@ -209,7 +209,7 @@ class CSSSource {
}
}
@profile()
@profile
private parseCSSAst() {
if (this._source) {
switch (parser) {
@@ -232,7 +232,7 @@ class CSSSource {
}
}
@profile()
@profile
private createSelectors() {
if (this._ast) {
this._selectors = [...this.createSelectorsFromImports(), ...this.createSelectorsFromSyntaxTree()];
@@ -447,7 +447,7 @@ export class CssState {
this.unsubscribeFromDynamicUpdates();
}
@profile()
@profile
private updateMatch() {
const view = this.viewRef.get();
if (view && view._styleScope) {
@@ -460,7 +460,7 @@ export class CssState {
this._matchInvalid = false;
}
@profile()
@profile
private updateDynamicState(): void {
const view = this.viewRef.get();
if (!view) {
@@ -716,7 +716,7 @@ export class StyleScope {
this.ensureSelectors();
}
@profile()
@profile
private setCss(cssString: string, cssFileName?): void {
this._css = cssString;
@@ -726,7 +726,7 @@ export class StyleScope {
this.ensureSelectors();
}
@profile()
@profile
private appendCss(cssString: string, cssFileName?): void {
if (!cssString && !cssFileName) {
return;
@@ -773,7 +773,7 @@ export class StyleScope {
return this._localCssSelectorsAppliedVersion === this._localCssSelectorVersion;
}
@profile()
@profile
private _createSelectors() {
let toMerge: RuleSet[][] = [];
toMerge.push(applicationCssSelectors);
@@ -793,7 +793,7 @@ export class StyleScope {
// HACK: This @profile decorator creates a circular dependency
// HACK: because the function parameter type is evaluated with 'typeof'
@profile()
@profile
public matchSelectors(view: any): SelectorsMatch<ViewBase> {
// should be (view: ViewBase): SelectorsMatch<ViewBase>
this.ensureSelectors();