项目作者: magicoder10

项目描述 :
Cross-framework UI Component Framework in TypeScript
高级语言: JavaScript
项目地址: git://github.com/magicoder10/hero.git
创建时间: 2018-12-02T05:02:51Z
项目社区:https://github.com/magicoder10/hero

开源协议:MIT License

下载


Hero

Proof of Concept Cross-framework UI Component Framework in TypeScript

Supported Features

  • SCSS as default style preprocessor
  • Reference SCSS & HTML files in @Component decorator
  • One-way Data Binding for template
  • Hot Page Reloading
  • Data Binding for attributes
  • Input & Output

Get Started

Examples

Counter

counter.component.ts
  1. import {Component} from '@hero';
  2. @Component({
  3. selector: 'ui-counter',
  4. templateUrl: './counter.component.html',
  5. styleUrls: ['./counter.component.scss']
  6. })
  7. export class CounterComponent {
  8. seconds: number;
  9. constructor() {
  10. this.seconds = 0;
  11. setInterval(()=>{
  12. this.seconds++;
  13. }, 1000);
  14. }
  15. }
counter.component.html
  1. <div>{{seconds}} seconds have elapsed</div>
counter.component.scss
  1. ui-counter {
  2. width: 400px;
  3. color: white;
  4. display: block;
  5. font-weight: bold;
  6. margin-top: 20px;
  7. }

Prerequisites

  • Node.js v8.9.4
  • yarn v1.12.3

Installing Dependencies

  1. yarn

Development

Compiling project

  1. yarn watch

You should see the following files in dist:

  • index.html
  • ui.js

To view the example app, open index.html in the web browswer.

The page will automatically reload on code change through the magic provided by HotReload Webpack plugin.

Using components in exisiting app

You only need to include the generated ui.js file in the HTML to integrate hero UI components in your existing project.

Testing

  1. yarn test

Authors