design: added selector interface

This commit is contained in:
Misko Hevery 2014-10-02 20:39:27 -07:00
parent 33af1d0b39
commit fd0c2d8063
5 changed files with 47 additions and 2 deletions

View File

@ -0,0 +1,9 @@
import {Type, FIELD} from 'facade/lang';
import {Directive} from '../annotations/directive'
export class AnnotatedType {
constructor(annotation:Directive, type:Type) {
this.annotation = annotation;
this.type = type;
}
}

View File

@ -0,0 +1,16 @@
import {Type} from 'facade/lang';
import {Directive} from '../annotations/directive'
/**
* Interface representing a way of extracting [Directive] annotations from
* [Type]. This interface has three native implementations:
*
* 1) JavaScript native implementation
* 2) Dart reflective implementation
* 3) Dart transformer generated implementation
*/
export class AnnotationsExtractor {
extract(type:Type):Directive {
return null;
}
}

View File

@ -0,0 +1,19 @@
import {Set} from 'facade/lang';
//import {AnnotatedType} from './annotated_type';
export class Selector {
constructor(directives:Set<AnnotatedType>) {
this.directives = directives;
}
/**
* When presented with an element description it will return the current set of
* directives which are present on the element.
*
* @param elementName Name of the element
* @param attributes Attributes on the Element.
*/
visitElement(elementName:String, attributes:Map<string, string>):List<AnnotatedType> {
return null;
}
}

View File

@ -1,8 +1,7 @@
library facade.collection; library facade.collection;
import 'dart:collection' show HashMap; import 'dart:collection' show HashMap;
export 'dart:collection' show Map; export 'dart:core' show Map, List, Set;
export 'dart:core' show List;
class MapWrapper { class MapWrapper {
static HashMap create() => new HashMap(); static HashMap create() => new HashMap();

View File

@ -1,5 +1,7 @@
export var List = window.Array; export var List = window.Array;
export var Map = window.Map; export var Map = window.Map;
export var Set = window.Set;
export class MapWrapper { export class MapWrapper {
static create():HashMap { return new HashMap(); } static create():HashMap { return new HashMap(); }
static get(m, k) { return m[k]; } static get(m, k) { return m[k]; }