Goal:
@Component({
// Public API
selector: 'selector',
properties: [],
events: [],
// View
viewActions: []
// HostElement
hostSetters: {},
hostListeners: {},
hostActions: {},
hostAttributes: {},
})
Existing Classes
NOTE: Render prefix for Render and App for App
Class Component property renames
Class Template => View property renames
Emitter
Example:
// Component annotation
// <prompt question="What is your name?" (answer)="greet($event)"></prompt>
@Component({
// PUBLIC BINDINGS
selector: 'prompt',
properties: ['question'],
events: ['answer'],
// VIEW PRIVATE
commands: ['focus'],
listen: { 'click': 'ask()' }
})
// View Annotation
@View({
template: `
<form (submit)="onAnswer(input.value)" [hidden]="!show">
{{question}}
<input #input @focus="input.focus()">
</form>
`,
stylesheets: [],
directives: []
})
// Component Controller
class Prompt {
// PUBLIC BINDINGS
question:string;
answer:Emitter;
// VIEW PRIVATE
show:bool;
focus:Emitter;
constructor() {
this.focus = new Emitter();
this.success = new Emitter();
}
ask() {
this.show = true;
this.focus.call();
}
onAnswer(value) {
this.answer.call(value);
this.show = false;
}
}
Goal:
Existing Classes
View=>RenderView/AppViewProtoView=>RenderProtoView/AppProtoViewChangeDetector=>DetectorPUNTING:Directive(annotation) =>AbstractDirectiveTemplate=>ViewPUNTING:Viewport=>Template(Because now Template is free)ComponentextendDecoratorDecorator=>DirectiveNOTE:
Renderprefix for Render andAppfor AppClass
Componentproperty renamesservices=>injectablessee Rename Directive.services to Directive.injectables #973bind=>properties(change from map to just a list)events(create implement later, replacement for@EventEmitter) feat(view): replaced EventEmitter callback with EventEmitter observable #1376viewActions(create implement later) Create actions concept (View & Host) #1251events=>hostListeners(map)hostSetters(map, declare, implement later) List attribute setters in the @Component annotation #1256hostActions(map, declare, implement later) Create actions concept (View & Host) #1251hostAttributes(map, declare, implement later) Create hostAttributes support #1402Class
Template=>Viewproperty renamesinline=>templateurl=>templateUrlstylesheets(implement later)stylesheetUrls(implement later)Emitter
Rx.Subjectordart.StreamExample: