<!DOCTYPE html>
<html>

  <head>
    <base href="." />
    <script type="text/javascript" charset="utf-8">
      window.AngularVersionForThisPlunker = 'latest'
    </script>
    <title>angular playground</title>
    <link rel="stylesheet" href="style.css" />
    <script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script>
    <script src="https://unpkg.com/zone.js/dist/zone.js"></script>
    <script src="https://unpkg.com/zone.js/dist/long-stack-trace-zone.js"></script>
    <script src="https://unpkg.com/reflect-metadata@0.1.3/Reflect.js"></script>
    <script src="https://unpkg.com/systemjs@0.19.31/dist/system.js"></script>
    <script src="config.js"></script>
    <script>
    System.import('app')
      .catch(console.error.bind(console));
  </script>
  </head>

  <body>
    <my-app>
    loading...
  </my-app>
  </body>

</html>
/* Styles go here */

### Angular Starter Plunker - Typescript
var angularVersion;
if(window.AngularVersionForThisPlunker === 'latest'){
  angularVersion = ''; //picks up latest
}
else {
  angularVersion = '@' + window.AngularVersionForThisPlunker;
}

System.config({
  //use typescript for compilation
  transpiler: 'typescript',
  //typescript compiler options
  typescriptOptions: {
    emitDecoratorMetadata: true
  },
  paths: {
    'npm:': 'https://unpkg.com/'
  },
  //map tells the System loader where to look for things
  map: {
    
    'app': './src',
    '@angular/core': 'npm:@angular/core'+ angularVersion + '/bundles/core.umd.js',
    '@angular/common': 'npm:@angular/common' + angularVersion + '/bundles/common.umd.js',
    '@angular/compiler': 'npm:@angular/compiler' + angularVersion  + '/bundles/compiler.umd.js',
    '@angular/platform-browser': 'npm:@angular/platform-browser' + angularVersion + '/bundles/platform-browser.umd.js',
    '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic' + angularVersion + '/bundles/platform-browser-dynamic.umd.js',
    '@angular/http': 'npm:@angular/http' + angularVersion + '/bundles/http.umd.js',
    '@angular/router': 'npm:@angular/router' + angularVersion +'/bundles/router.umd.js',
    '@angular/forms': 'npm:@angular/forms' + angularVersion + '/bundles/forms.umd.js',
    '@angular/animations': 'npm:@angular/animations' + angularVersion + '/bundles/animations.umd.js',
    '@angular/platform-browser/animations': 'npm:@angular/platform-browser' + angularVersion + '/bundles/platform-browser-animations.umd.js',
    '@angular/animations/browser': 'npm:@angular/animations' + angularVersion + '/bundles/animations-browser.umd.js',
    
    '@angular/core/testing': 'npm:@angular/core' + angularVersion + '/bundles/core-testing.umd.js',
    '@angular/common/testing': 'npm:@angular/common' + angularVersion + '/bundles/common-testing.umd.js',
    '@angular/compiler/testing': 'npm:@angular/compiler' + angularVersion + '/bundles/compiler-testing.umd.js',
    '@angular/platform-browser/testing': 'npm:@angular/platform-browser' + angularVersion + '/bundles/platform-browser-testing.umd.js',
    '@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic' + angularVersion + '/bundles/platform-browser-dynamic-testing.umd.js',
    '@angular/http/testing': 'npm:@angular/http' + angularVersion + '/bundles/http-testing.umd.js',
    '@angular/router/testing': 'npm:@angular/router' + angularVersion + '/bundles/router-testing.umd.js',
    'tslib': 'npm:tslib@1.6.1',
    'rxjs': 'npm:rxjs',
    'typescript': 'npm:typescript@2.2.1/lib/typescript.js'
  },
  //packages defines our app package
  packages: {
    app: {
      main: './main.ts',
      defaultExtension: 'ts'
    },
    rxjs: {
      defaultExtension: 'js'
    }
  }
});
//main entry point
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app';

platformBrowserDynamic().bootstrapModule(AppModule)
//our root app component
import {Component, NgModule, VERSION} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'
import {CustomInput} from './custom-input.component'
import {CustomButton} from './custom-button.component'

@Component({
  selector: 'my-app',
  template: `
    <div [ngClass]="theme">
      <h2>{{name}}</h2>
      <div>Themes implemented</div> <br/><br/>
      Select Theme : <a href="#" (click)="setTheme('light')">Light </a>  | 
      <a href="#" (click)="setTheme('dark')">Dark</a> |
      <a href="#" (click)="setTheme('')">No theme</a><br/><br/>
      <p> <b>Current Theme : </b> {{ theme || 'none' }}   </p>
      
      
      
      <ul style="list-style:none;">
        <li>
          <b> Custom Input ( With no state ) </b>
        </li>
        <li>
              <custom-input [placeholder]="'Your name ...'" [state]="''"  ></custom-input>
        </li>
        <li>
          <b> Custom Input ( Success state ) </b>
        </li>
        <li>
              <custom-input [placeholder]="'Your name ...'" [state]="'success'"></custom-input>
        </li>
        <li>
          <b> Custom Input ( Failure state ) </b>
        </li>
        <li>
              <custom-input [placeholder]="'Your name ...'" [state]="'failure'"></custom-input>
        </li>
      </ul>
      
      <hr>
      <ul>
        <li>
          <b> Custom Button ( With no state ) </b>
        </li>
        <li>
              <custom-button [text]="'Sign In'" [state]="''"  ></custom-button>
        </li>
        <li>
          <b> Custom Button ( Primary state + normal size ) </b>
        </li>
        <li>
              <custom-button  [text]="'Sign In'" [state]="'primary'"></custom-button>
        </li>
        <li>
          <b> Custom Button ( Primary state + small size ) </b>
        </li>
        <li>
              <custom-button  [text]="'Sign In'" [state]="'primary'" [size]="'small'"></custom-button>
        </li>
      
        <li>
          <b> Custom Button ( Primary state + big size ) </b>
        </li>
        <li>
              <custom-button  [text]="'Sign In'" [state]="'primary'" [size]="'big'"></custom-button>
        </li>
        <li>
          <b> Custom Button ( Secondary state + normal size ) </b>
        </li>
        <li>
              <custom-button  [text]="'Sign In'" [state]="'secondary'"></custom-button>
        </li>
        <li>
          <b> Custom Button ( Secondary state + small size ) </b>
        </li>
        <li>
              <custom-button  [text]="'Sign In'" [state]="'secondary'" [size]="'small'"></custom-button>
        </li>
        <li>
          <b> Custom Button ( Secondary state + big size ) </b>
        </li>
        <li>
              <custom-button  [text]="'Sign In'" [state]="'secondary'" [size]="'big'"></custom-button>
        </li>
      </ul>
       
  
    </div>
  `
})
export class App {
  name:string;
  theme = ''; // No initial theme set
  constructor() {
    this.name = `Themeable Components - Part 2 - Angular! v${VERSION.full}`
  }
  
  setTheme(theme){
    this.theme = theme;
  }
}

@NgModule({
  imports: [ BrowserModule ],
  declarations: [ App, CustomInput, CustomButton ],
  bootstrap: [ App ]
})
export class AppModule {}
<div class="cell" [ngClass]="classes">
    <label class="label">
        <span [innerHTML]="label"></span>
    </label>
    <input type="text"
           class="input"
           [disabled]="disabled"
           [placeholder]="placeholder">
    <div class="alert"> {{ alert }} </div>
</div>
@import './common.component.css';  /* This will have the actual path of this file in your app */
@import './custom-input-light.component.css';
@import './custom-input-dark.component.css';
import { Component, Input } from '@angular/core';

@Component({
    selector: 'custom-button',
    templateUrl: 'src/custom-button.component.html',
    styleUrls: ['src/custom-button.component.css']
})
export class CustomButton {
  
  classes: string; 
  
  private _disabled : boolean;
  private _text : string;
  private _state : string; 
  private _alert : string; 
  private _size : string;
  
  @Input()
  get disabled(): boolean{ return this._disabled; }
  set disabled(v){ this._disabled = v; }
  
  @Input()
  get text(): boolean{ return this._text; }
  set text(v){ this._text = v; }
    
  @Input()
  get state(): string{ return this._state; }
  set state(value){ 
    this.classes = value;
  }
  
  @Input()
  get alert(): boolean{ return this._alert; }
  set alert(v){ this._alert = v; }
  
  @Input()
  get size(): boolean{ return this._size; }
  set size(v){ this._size = v; }

  
}
import { Component, Input } from '@angular/core';

@Component({
    selector: 'custom-input',
    templateUrl: 'src/custom-input.component.html',
    styleUrls: ['src/custom-input.component.css']
})
export class CustomInput {
  
  classes: string; 
  
  private _disabled : boolean;
  private _placeholder = ''; 
  private _label : string;
  private _state : string; 
  private _alert : string;
  
  @Input()
  get disabled(): boolean{ return this._disabled; }
  set disabled(v){ this._disabled = v; }
    
  @Input()
  get placeholder(): string{ return this._placeholder; }
  set placeholder(v){ this._placeholder = v; }

  @Input()
  get label(): string{ return this._label; }
  set label(v){ this._label = v; }
  
  @Input()
  get state(): string{ return this._state; }
  set state(value){ 
    this.classes = value;
  }
  
  @Input()
  get alert(): boolean{ return this._alert; }
  set alert(v){ this._alert = v; }
  
  constructor( ){ }
  
}
<div class="cell" [ngClass]="classes">
    <button [disabled]="disabled" [ngClass]="size">
      {{ text }} 
    </button> 
    <div class="alert"> {{ alert }} </div>
</div>
@import './common.component.css';  /* This will have the actual path of this file in your app */
@import './custom-button-light.component.css';
@import './custom-button-dark.component.css';
/* Styles here can easily be cleaned up using SCSS */

:host-context(.light) input {
  border:1px solid #0080ff;
  background-color:#fff;
  color:#0080ff;
}

:host-context(.light) input:disabled,
:host-context(.light) input[disabled]{
  border:1px solid #d3d3d3;
  background-color:#fafafa;
}

:host-context(.light) .failure input{
  background-color:#ffe5e5;
  border:1px solid red;
}

:host-context(.light) .success input {
  background-color:#e5ffe5;
  border:1px solid green;
}
/* Styles here can easily be cleaned up using SCSS */

:host-context(.dark) input {
  border:1px solid #0080ff;
  background-color:#4c4c4c;
  color:#0080ff;
}

:host-context(.dark) input:disabled,
:host-context(.dark) input[disabled]{
  border:1px solid #d3d3d3;
  background-color:#2e2e2e;
}

:host-context(.dark) .failure input{
  background-color:#DC143C;
  border:1px solid red;
  color:#fff;
}

:host-context(.dark) .success input {
  background-color:#3CB371;
  border:1px solid green;
  color:#fff;
}
/* Styles here can easily be cleaned up using SCSS */

/* Input */

input {
  cursor:pointer;
  padding:10px;
}

input:disabled,
input[disabled]{
  cursor:auto;
}

.failure input:disabled,
.failure input[disabled]{
   border:1px solid #d3d3d3; /* intentionally left here because we don't want to make them themeable */
}

.success input:disabled,
.success input[disabled]{
  border:1px solid #d3d3d3; /* intentionally left here because we don't want to make them themeable */
}

/* Button */

button {
  cursor:pointer;
  padding:10px;
}

button:disabled,
button[disabled]{
  cursor:auto;
}

.big {
  padding:20px;
}

.small {
  padding:5px;
}

.primary button:disabled,
.primary button[disabled]{
  border:1px solid #e5f2ff;
}

.secondary button:disabled,
.secondary button[disabled]{
  border:1px solid #e5f2ff;
}

/* Styles here can easily be cleaned up using SCSS */

:host-context(.light) .primary button {
  border:1px solid 	#0080ff;
  background:#fff;
  color:#0080ff;
}

:host-context(.light) .primary button:disabled,
:host-context(.light) .primary button[disabled]{
  color:#d3d3d3;
}

:host-context(.light) .secondary button {
  border:1px solid 	#0080ff;
  background-color:#0080ff;
  color:#fff;
}

:host-context(.light) .secondary button:disabled,
:host-context(.light) .secondary button[disabled]{
  background-color:#e5f2ff;
}
/* Styles here can easily be cleaned up using SCSS */

:host-context(.dark) .primary button {
  border:1px solid 	#3f00ff;
  background:#fff;
  color:#3f00ff;
}

:host-context(.dark) .primary button:disabled,
:host-context(.dark) .primary button[disabled]{
  color:#5a7cc2;
}

:host-context(.dark) .secondary button {
  border:1px solid 	#082567;
  background-color:#082567;
  color:#fff;
}

:host-context(.dark) .secondary button:disabled,
.secondary button[disabled]{
  background-color:#1d2951;
  color:#a9a9a9;
}