Skip to content

Major rename #1244

@mhevery

Description

@mhevery

Goal:

@Component({
  // Public API
  selector: 'selector',
  properties: [],
  events: [],

  // View
  viewActions: []

  // HostElement
  hostSetters: {},
  hostListeners: {},
  hostActions: {},
  hostAttributes: {},
})

Existing Classes

  • View => RenderView / AppView
  • ProtoView => RenderProtoView / AppProtoView
  • INTERNAL API: ChangeDetector => Detector
  • PUNTING: Directive (annotation) => AbstractDirective
  • Template => View
  • PUNTING: Viewport => Template (Because now Template is free)
  • Have Component extend Decorator
  • Decorator => Directive

NOTE: Render prefix for Render and App for App

Class Component property renames

Class Template => View property renames

  • inline => template
  • url => templateUrl
  • introduce stylesheets (implement later)
  • introduce stylesheetUrls (implement later)

Emitter

  • Angular should autodetect the emitter type. That is it could be Rx.Subject or dart.Stream

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;
  }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions