0.0.9 • Published 5 years ago

ng-vdom v0.0.9

Weekly downloads
19
License
MIT
Repository
github
Last release
5 years ago

NG-VDOM

Virtual DOM extension for Angular, heavily inspired by Inferno.

Installation

Install from NPM or Yarn:

npm install ng-vdom --save

Add to NgModule imports:

import { VDomModule } from 'ng-vdom';

@NgModule({
  imports: [
    VDomModule
  ]
})
export class SomeModule {}

Edit tsconfig JSX options:

{
  "compilerOptions": {
    "jsx": "react",
    "jsxFactory": "createElement"
  }
}

Usage

Online Demo.

Make an Angular Component extends Renderable with a render method:

import { Component } from '@angular/core'
import { createElement, Renderable } from 'ng-vdom'

@Component({
  template: ``
})
export class AppComponent extends Renderable {
  render() {
    return (
      <h1>Hello World!</h1>
    )
  }
}

Embedding Virtual DOM contents inside template

import { Component, NgModule } from '@angular/core'
import { VDomModule } from 'ng-vdom'

@Component({
  template: `
    <v-outlet [def]="element"></v-outlet>
  `
})
export class AppComponent {
  element = <h1>Hello World</h1>
}

@NgModule({
  imports: [ VDomModule ],
})
export class AppModule { }

What can be rendered?

  • Native component (DOM element in browser);
  • Class component (not fully react compatible);
  • Function component;
  • Angular component (need to be in entryComponents);

Roadmap

  • Global boostrap without Angular code;
  • Fragment render support;
  • Array render support;
  • React-compatible class component support;
  • HTML Attribute support;
0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1-alpha.0

6 years ago

0.0.1

7 years ago