1- import { StyleFactory } from './style-factory' ;
2- import { protocol , Origin } from 'aurelia-metadata' ;
3- import { PLATFORM } from 'aurelia-pal' ;
4- import { StyleLocator } from './style-locator' ;
5- import { relativeToFile } from 'aurelia-path' ;
6- import { Container } from 'aurelia-dependency-injection' ;
7- import { StyleCompiler } from './style-compiler' ;
8- import { Loader } from 'aurelia-loader' ;
9- import { AureliaUX } from '../aurelia-ux' ;
1+ import { StyleFactory } from './style-factory' ;
2+ import { protocol , Origin } from 'aurelia-metadata' ;
3+ import { PLATFORM } from 'aurelia-pal' ;
4+ import { StyleLocator } from './style-locator' ;
5+ import { relativeToFile } from 'aurelia-path' ;
6+ import { Container } from 'aurelia-dependency-injection' ;
7+ import { StyleCompiler } from './style-compiler' ;
8+ import { Loader } from 'aurelia-loader' ;
9+ import { AureliaUX } from '../aurelia-ux' ;
1010
1111export interface StyleStrategy {
1212 moduleId ?: string ;
13- loadStyleFactory ( container : Container , styleObjectType : Function ) : Promise < StyleFactory > ;
13+ loadStyleFactory ( container : Container , styleObjectType : new ( ) => any ) : Promise < StyleFactory > ;
1414}
1515
1616/**
1717 * Decorator: Indicates that the decorated class/object is a style strategy.
1818 */
19- export const styleStrategy : Function = ( protocol as any ) . create ( 'aurelia:style-strategy' , {
19+ export const styleStrategy : ( ) => ( target : any ) => void = ( protocol as any ) . create ( 'aurelia:style-strategy' , {
2020 validate ( target : any ) : string | boolean {
2121 if ( ! ( typeof target . loadStyleFactory === 'function' ) ) {
2222 return 'Style strategies must implement: loadStyleFactory(): Promise<StyleFactory>' ;
@@ -70,7 +70,7 @@ export class RelativeStyleStrategy implements StyleStrategy {
7070 /**
7171 * Loads a style factory.
7272 */
73- public loadStyleFactory ( container : Container , styleObjectType : Function ) : Promise < StyleFactory > {
73+ public loadStyleFactory ( container : Container , styleObjectType : new ( ) => any ) : Promise < StyleFactory > {
7474 if ( this . absolutePath === null && this . moduleId ) {
7575 const path = resolveForDesign ( this . pathOrDesignMap , container ) ;
7676
@@ -128,7 +128,7 @@ export class ConventionalStyleStrategy implements StyleStrategy {
128128 /**
129129 * Loads a style factory.
130130 */
131- public loadStyleFactory ( container : Container , styleObjectType : Function ) : Promise < StyleFactory > {
131+ public loadStyleFactory ( container : Container , styleObjectType : new ( ) => any ) : Promise < StyleFactory > {
132132 return container . get ( Loader )
133133 . loadText ( this . styleUrl )
134134 . catch ( ( ) => null )
@@ -152,12 +152,12 @@ export class InlineStyleStrategy implements StyleStrategy {
152152 /**
153153 * Creates an instance of InlineStyleStrategy.
154154 */
155- constructor ( private cssOrDesignMap : string | any ) { }
155+ constructor ( private cssOrDesignMap : string | any ) { }
156156
157157 /**
158158 * Loads a style factory.
159159 */
160- public loadStyleFactory ( container : Container , styleObjectType : Function ) : Promise < StyleFactory > {
160+ public loadStyleFactory ( container : Container , styleObjectType : new ( ) => any ) : Promise < StyleFactory > {
161161 const css = resolveForDesign ( this . cssOrDesignMap , container ) ;
162162 this . transformedCSS = fixupCSSUrls ( this . moduleId , css ) ;
163163 const compiler = container . get ( StyleCompiler ) as StyleCompiler ;
0 commit comments