{"action":"created","comment":{"url":"https://api.github.com/repos/angular/material2/pulls/comments/146389391","pull_request_review_id":71324621,"id":146389391,"diff_hunk":"@@ -0,0 +1,146 @@\n+/**\n+ * @license\n+ * Copyright Google LLC All Rights Reserved.\n+ *\n+ * Use of this source code is governed by an MIT-style license that can be\n+ * found in the LICENSE file at https://angular.io/license\n+ */\n+\n+import {Directive, Input, Renderer2, ElementRef} from '@angular/core';\n+import {coerceBooleanProperty} from '@angular/cdk/coercion';\n+import {ThemePalette} from '@angular/material/core';\n+\n+let nextId = 0;\n+\n+/** Directive to display a text badge. */\n+@Directive({\n+  selector: '[matBadge]',\n+  inputs: ['matBadgeColor', 'matBadgeOverlap', 'matBadgePosition'],\n+  host: {\n+    'class': 'mat-badge',\n+    '[class.mat-badge-overlap]': '_overlap',\n+    '[class.mat-badge-above]': '_isAbove',\n+    '[class.mat-badge-below]': '!_isAbove',\n+    '[class.mat-badge-before]': '!_isAfter',\n+    '[class.mat-badge-after]': '_isAfter',\n+    '[class.mat-badge-small]': 'matBadgeSize === \"small\"',\n+    '[class.mat-badge-medium]': 'matBadgeSize === \"medium\"',\n+    '[class.mat-badge-large]': 'matBadgeSize === \"large\"',\n+    '[class.mat-badge-hidden]': 'matBadgeHidden',\n+  },\n+})\n+export class MatBadge {\n+\n+  /** Theme for the badge */\n+  @Input()\n+  get matBadgeColor(): ThemePalette { return this._color; }\n+  set matBadgeColor(value: ThemePalette) {\n+    const colorPalette = value;\n+    if (colorPalette !== this._color) {\n+      if (this._color) {\n+        this._renderer.removeClass(this._elementRef.nativeElement, `mat-badge-${this._color}`);\n+      }\n+      if (colorPalette) {\n+        this._renderer.addClass(this._elementRef.nativeElement, `mat-badge-${colorPalette}`);\n+      }\n+\n+      this._color = colorPalette;\n+    }\n+  }\n+  private _color: ThemePalette = 'primary';\n+\n+  /** Whether the badge should overlap its contents or not */\n+  @Input()\n+  set matBadgeOverlap(val: boolean) {\n+    this._overlap = coerceBooleanProperty(val);\n+  }\n+  get matBadgeOverlap(): boolean {\n+    return this._overlap;\n+  }\n+  private _overlap: boolean = true;\n+\n+  /** Position the badge should reside; 'above|below before|after' */\n+  @Input()\n+  set matBadgePosition(val: string) {\n+    this._position = val;\n+    this._isAbove = val.indexOf('below') === -1;\n+    this._isAfter = val.indexOf('before') === -1;\n+  }\n+  get matBadgePosition(): string {\n+    return this._position;\n+  }\n+  private _position: string = 'above after';\n+\n+  @Input('matBadge')\n+  set content(val: string) {\n+    this._content = val;\n+    this._setContent();\n+  }\n+  get content(): string { return this._content; }\n+  private _content: string;\n+\n+  /** Aria description */\n+  @Input()\n+  set matBadgeDescription(val: string) {\n+    this._description = val;\n+    this._setLabel();\n+  }\n+  get matBadgeDescription(): string { return this._description; }\n+  private _description: string;\n+\n+  /** Size of the badge */\n+  @Input() matBadgeSize: string = 'medium';\n+\n+  @Input()\n+  set matBadgeHidden(val: boolean) {\n+    this._hidden = coerceBooleanProperty(val);\n+  }\n+  get matBadgeHidden(): boolean {\n+    return this._hidden;\n+  }\n+  private _hidden: boolean;\n+\n+  _id: number = nextId++;\n+  _isAbove: boolean = true;\n+  _isAfter: boolean = true;\n+\n+  constructor(private _renderer: Renderer2, private _elementRef: ElementRef) {}\n+\n+  /** Injects a span element into the DOM with the content. */\n+  private _setContent(): HTMLSpanElement {\n+    let content = document.getElementById(`badge-content-${this._id}`);\n+\n+    if (!content) {\n+      content = document.createElement('span');\n+      content.setAttribute('id', `badge-content-${this._id}`);\n+      content.classList.add('mat-badge-content');\n+      content.textContent = this.content;\n+\n+      if (this.matBadgeDescription) {\n+        content.setAttribute('aria-label', this.matBadgeDescription);\n+      }\n+\n+      this._elementRef.nativeElement.appendChild(content);\n+\n+      // animate in after insertion\n+      setTimeout(() => {","path":"src/lib/badge/badge.ts","position":126,"original_position":126,"commit_id":"ec10e441f807aa043b292874651456f308c7fde7","original_commit_id":"ec10e441f807aa043b292874651456f308c7fde7","user":{"login":"amcdnl","id":227909,"avatar_url":"https://avatars3.githubusercontent.com/u/227909?v=4","gravatar_id":"","url":"https://api.github.com/users/amcdnl","html_url":"https://github.com/amcdnl","followers_url":"https://api.github.com/users/amcdnl/followers","following_url":"https://api.github.com/users/amcdnl/following{/other_user}","gists_url":"https://api.github.com/users/amcdnl/gists{/gist_id}","starred_url":"https://api.github.com/users/amcdnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amcdnl/subscriptions","organizations_url":"https://api.github.com/users/amcdnl/orgs","repos_url":"https://api.github.com/users/amcdnl/repos","events_url":"https://api.github.com/users/amcdnl/events{/privacy}","received_events_url":"https://api.github.com/users/amcdnl/received_events","type":"User","site_admin":false},"body":"Want to wait a short duration before the animation is activated. Do you think it should be removed and be instant?","created_at":"2017-10-23T20:48:29Z","updated_at":"2017-10-23T20:48:29Z","html_url":"https://github.com/angular/material2/pull/7483#discussion_r146389391","pull_request_url":"https://api.github.com/repos/angular/material2/pulls/7483","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/angular/material2/pulls/comments/146389391"},"html":{"href":"https://github.com/angular/material2/pull/7483#discussion_r146389391"},"pull_request":{"href":"https://api.github.com/repos/angular/material2/pulls/7483"}},"in_reply_to_id":146357452},"pull_request":{"url":"https://api.github.com/repos/angular/material2/pulls/7483","id":144284723,"html_url":"https://github.com/angular/material2/pull/7483","diff_url":"https://github.com/angular/material2/pull/7483.diff","patch_url":"https://github.com/angular/material2/pull/7483.patch","issue_url":"https://api.github.com/repos/angular/material2/issues/7483","number":7483,"state":"open","locked":false,"title":"feat(badge): add badge component","user":{"login":"amcdnl","id":227909,"avatar_url":"https://avatars3.githubusercontent.com/u/227909?v=4","gravatar_id":"","url":"https://api.github.com/users/amcdnl","html_url":"https://github.com/amcdnl","followers_url":"https://api.github.com/users/amcdnl/followers","following_url":"https://api.github.com/users/amcdnl/following{/other_user}","gists_url":"https://api.github.com/users/amcdnl/gists{/gist_id}","starred_url":"https://api.github.com/users/amcdnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amcdnl/subscriptions","organizations_url":"https://api.github.com/users/amcdnl/orgs","repos_url":"https://api.github.com/users/amcdnl/repos","events_url":"https://api.github.com/users/amcdnl/events{/privacy}","received_events_url":"https://api.github.com/users/amcdnl/received_events","type":"User","site_admin":false},"body":"Implements a badge component.\r\n\r\n## Design Document \r\nhttps://docs.google.com/document/d/12sksu2GHcITFBidL8nyRzIt8lnVUoGnzwQx4tXWesEw/edit?usp=sharing","created_at":"2017-10-02T21:10:13Z","updated_at":"2017-10-23T20:48:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"71c3ef2ba70eb8be50dd2f9a98bd25bdff634949","assignee":{"login":"amcdnl","id":227909,"avatar_url":"https://avatars3.githubusercontent.com/u/227909?v=4","gravatar_id":"","url":"https://api.github.com/users/amcdnl","html_url":"https://github.com/amcdnl","followers_url":"https://api.github.com/users/amcdnl/followers","following_url":"https://api.github.com/users/amcdnl/following{/other_user}","gists_url":"https://api.github.com/users/amcdnl/gists{/gist_id}","starred_url":"https://api.github.com/users/amcdnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amcdnl/subscriptions","organizations_url":"https://api.github.com/users/amcdnl/orgs","repos_url":"https://api.github.com/users/amcdnl/repos","events_url":"https://api.github.com/users/amcdnl/events{/privacy}","received_events_url":"https://api.github.com/users/amcdnl/received_events","type":"User","site_admin":false},"assignees":[{"login":"amcdnl","id":227909,"avatar_url":"https://avatars3.githubusercontent.com/u/227909?v=4","gravatar_id":"","url":"https://api.github.com/users/amcdnl","html_url":"https://github.com/amcdnl","followers_url":"https://api.github.com/users/amcdnl/followers","following_url":"https://api.github.com/users/amcdnl/following{/other_user}","gists_url":"https://api.github.com/users/amcdnl/gists{/gist_id}","starred_url":"https://api.github.com/users/amcdnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amcdnl/subscriptions","organizations_url":"https://api.github.com/users/amcdnl/orgs","repos_url":"https://api.github.com/users/amcdnl/repos","events_url":"https://api.github.com/users/amcdnl/events{/privacy}","received_events_url":"https://api.github.com/users/amcdnl/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/angular/material2/pulls/7483/commits","review_comments_url":"https://api.github.com/repos/angular/material2/pulls/7483/comments","review_comment_url":"https://api.github.com/repos/angular/material2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/angular/material2/issues/7483/comments","statuses_url":"https://api.github.com/repos/angular/material2/statuses/ec10e441f807aa043b292874651456f308c7fde7","head":{"label":"amcdnl:badge","ref":"badge","sha":"ec10e441f807aa043b292874651456f308c7fde7","user":{"login":"amcdnl","id":227909,"avatar_url":"https://avatars3.githubusercontent.com/u/227909?v=4","gravatar_id":"","url":"https://api.github.com/users/amcdnl","html_url":"https://github.com/amcdnl","followers_url":"https://api.github.com/users/amcdnl/followers","following_url":"https://api.github.com/users/amcdnl/following{/other_user}","gists_url":"https://api.github.com/users/amcdnl/gists{/gist_id}","starred_url":"https://api.github.com/users/amcdnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amcdnl/subscriptions","organizations_url":"https://api.github.com/users/amcdnl/orgs","repos_url":"https://api.github.com/users/amcdnl/repos","events_url":"https://api.github.com/users/amcdnl/events{/privacy}","received_events_url":"https://api.github.com/users/amcdnl/received_events","type":"User","site_admin":false},"repo":{"id":94944874,"name":"material2","full_name":"amcdnl/material2","owner":{"login":"amcdnl","id":227909,"avatar_url":"https://avatars3.githubusercontent.com/u/227909?v=4","gravatar_id":"","url":"https://api.github.com/users/amcdnl","html_url":"https://github.com/amcdnl","followers_url":"https://api.github.com/users/amcdnl/followers","following_url":"https://api.github.com/users/amcdnl/following{/other_user}","gists_url":"https://api.github.com/users/amcdnl/gists{/gist_id}","starred_url":"https://api.github.com/users/amcdnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amcdnl/subscriptions","organizations_url":"https://api.github.com/users/amcdnl/orgs","repos_url":"https://api.github.com/users/amcdnl/repos","events_url":"https://api.github.com/users/amcdnl/events{/privacy}","received_events_url":"https://api.github.com/users/amcdnl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amcdnl/material2","description":"Material Design components for Angular","fork":true,"url":"https://api.github.com/repos/amcdnl/material2","forks_url":"https://api.github.com/repos/amcdnl/material2/forks","keys_url":"https://api.github.com/repos/amcdnl/material2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amcdnl/material2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amcdnl/material2/teams","hooks_url":"https://api.github.com/repos/amcdnl/material2/hooks","issue_events_url":"https://api.github.com/repos/amcdnl/material2/issues/events{/number}","events_url":"https://api.github.com/repos/amcdnl/material2/events","assignees_url":"https://api.github.com/repos/amcdnl/material2/assignees{/user}","branches_url":"https://api.github.com/repos/amcdnl/material2/branches{/branch}","tags_url":"https://api.github.com/repos/amcdnl/material2/tags","blobs_url":"https://api.github.com/repos/amcdnl/material2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amcdnl/material2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amcdnl/material2/git/refs{/sha}","trees_url":"https://api.github.com/repos/amcdnl/material2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amcdnl/material2/statuses/{sha}","languages_url":"https://api.github.com/repos/amcdnl/material2/languages","stargazers_url":"https://api.github.com/repos/amcdnl/material2/stargazers","contributors_url":"https://api.github.com/repos/amcdnl/material2/contributors","subscribers_url":"https://api.github.com/repos/amcdnl/material2/subscribers","subscription_url":"https://api.github.com/repos/amcdnl/material2/subscription","commits_url":"https://api.github.com/repos/amcdnl/material2/commits{/sha}","git_commits_url":"https://api.github.com/repos/amcdnl/material2/git/commits{/sha}","comments_url":"https://api.github.com/repos/amcdnl/material2/comments{/number}","issue_comment_url":"https://api.github.com/repos/amcdnl/material2/issues/comments{/number}","contents_url":"https://api.github.com/repos/amcdnl/material2/contents/{+path}","compare_url":"https://api.github.com/repos/amcdnl/material2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amcdnl/material2/merges","archive_url":"https://api.github.com/repos/amcdnl/material2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amcdnl/material2/downloads","issues_url":"https://api.github.com/repos/amcdnl/material2/issues{/number}","pulls_url":"https://api.github.com/repos/amcdnl/material2/pulls{/number}","milestones_url":"https://api.github.com/repos/amcdnl/material2/milestones{/number}","notifications_url":"https://api.github.com/repos/amcdnl/material2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amcdnl/material2/labels{/name}","releases_url":"https://api.github.com/repos/amcdnl/material2/releases{/id}","deployments_url":"https://api.github.com/repos/amcdnl/material2/deployments","created_at":"2017-06-20T23:57:37Z","updated_at":"2017-06-20T23:57:41Z","pushed_at":"2017-10-23T20:24:36Z","git_url":"git://github.com/amcdnl/material2.git","ssh_url":"git@github.com:amcdnl/material2.git","clone_url":"https://github.com/amcdnl/material2.git","svn_url":"https://github.com/amcdnl/material2","homepage":"https://material.angular.io/","size":9922,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"angular:master","ref":"master","sha":"76a6e7beab28a30d6c215600e1122808049ed83c","user":{"login":"angular","id":139426,"avatar_url":"https://avatars3.githubusercontent.com/u/139426?v=4","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"repo":{"id":49016322,"name":"material2","full_name":"angular/material2","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars3.githubusercontent.com/u/139426?v=4","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/angular/material2","description":"Material Design components for Angular","fork":false,"url":"https://api.github.com/repos/angular/material2","forks_url":"https://api.github.com/repos/angular/material2/forks","keys_url":"https://api.github.com/repos/angular/material2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/material2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/material2/teams","hooks_url":"https://api.github.com/repos/angular/material2/hooks","issue_events_url":"https://api.github.com/repos/angular/material2/issues/events{/number}","events_url":"https://api.github.com/repos/angular/material2/events","assignees_url":"https://api.github.com/repos/angular/material2/assignees{/user}","branches_url":"https://api.github.com/repos/angular/material2/branches{/branch}","tags_url":"https://api.github.com/repos/angular/material2/tags","blobs_url":"https://api.github.com/repos/angular/material2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/material2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/material2/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/material2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/material2/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/material2/languages","stargazers_url":"https://api.github.com/repos/angular/material2/stargazers","contributors_url":"https://api.github.com/repos/angular/material2/contributors","subscribers_url":"https://api.github.com/repos/angular/material2/subscribers","subscription_url":"https://api.github.com/repos/angular/material2/subscription","commits_url":"https://api.github.com/repos/angular/material2/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/material2/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/material2/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/material2/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/material2/contents/{+path}","compare_url":"https://api.github.com/repos/angular/material2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/material2/merges","archive_url":"https://api.github.com/repos/angular/material2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/material2/downloads","issues_url":"https://api.github.com/repos/angular/material2/issues{/number}","pulls_url":"https://api.github.com/repos/angular/material2/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/material2/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/material2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/material2/labels{/name}","releases_url":"https://api.github.com/repos/angular/material2/releases{/id}","deployments_url":"https://api.github.com/repos/angular/material2/deployments","created_at":"2016-01-04T18:50:02Z","updated_at":"2017-10-23T20:25:09Z","pushed_at":"2017-10-23T20:24:38Z","git_url":"git://github.com/angular/material2.git","ssh_url":"git@github.com:angular/material2.git","clone_url":"https://github.com/angular/material2.git","svn_url":"https://github.com/angular/material2","homepage":"https://material.angular.io","size":9862,"stargazers_count":11451,"watchers_count":11451,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2716,"mirror_url":null,"archived":false,"open_issues_count":883,"forks":2716,"open_issues":883,"watchers":11451,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/material2/pulls/7483"},"html":{"href":"https://github.com/angular/material2/pull/7483"},"issue":{"href":"https://api.github.com/repos/angular/material2/issues/7483"},"comments":{"href":"https://api.github.com/repos/angular/material2/issues/7483/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/material2/pulls/7483/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/material2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/angular/material2/pulls/7483/commits"},"statuses":{"href":"https://api.github.com/repos/angular/material2/statuses/ec10e441f807aa043b292874651456f308c7fde7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"amcdnl"}}