# rxcomp

> Reactive component library for JavaScript

Latest version **1.0.0-beta.21** (published 2022-03-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install rxcomp
pnpm add rxcomp
yarn add rxcomp
bun add rxcomp
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-beta.21 |
| Published | 2022-03-21 |
| First published | 2019-11-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 603.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Author | Luca Zampetti |
| Maintainers | actarian |
| Keywords | rxcomp, framework, rxjs, es6, es2015 |

## Links

- npm: https://www.npmjs.com/package/rxcomp
- Repository: https://github.com/actarian/rxcomp
- Issues: https://github.com/actarian/rxcomp/issues
- npm.io page: https://npm.io/package/rxcomp

## Dependencies (2)

- [rxjs](https://npm.io/package/rxjs.md) ^6.6.7
- [tslib](https://npm.io/package/tslib.md) ^2.3.1

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@atlaskit/theme](https://npm.io/package/@atlaskit/theme.md) — 402.0K weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads

## Recent versions

- 1.0.0-beta.21 (latest) — 2022-03-21
- 1.0.0-beta.20 — 2020-11-25
- 1.0.0-beta.19 — 2020-10-19
- 1.0.0-beta.18 — 2020-09-08
- 1.0.0-beta.17 — 2020-09-05
- 1.0.0-beta.16 — 2020-09-04
- 1.0.0-beta.15 — 2020-09-04
- 1.0.0-beta.14 — 2020-08-28
- 1.0.0-beta.13 — 2020-08-27
- 1.0.0-beta.12 — 2020-08-06
- 1.0.0-beta.11 — 2020-07-25
- 1.0.0-beta.10 — 2020-05-08
- 1.0.0-beta.9 — 2020-04-10
- 1.0.0-beta.8 — 2020-03-05
- 1.0.0-beta.7 — 2020-03-04
- … 21 more at https://npm.io/package/rxcomp/versions

## README

# 💎 RxComp

[![Licence](https://img.shields.io/github/license/actarian/rxcomp.svg)](https://github.com/actarian/rxcomp)

[RxComp](https://github.com/actarian/rxcomp) is a reactive component library built on top of [RxJs](https://github.com/ReactiveX/rxjs) that mimics the [Angular](https://angular.io/) declarative syntax. 

If you like Angular declarative syntax but you just want go Vanilla, RxComp library come in useful.

 lib & dependancy | size
:-----------------|:----------------------------------------------------------------------------------------------|
rxcomp.min.js     | ![](https://img.badgesize.io/https://unpkg.com/rxcomp@1.0.0-beta.20/dist/umd/rxcomp.min.js.svg?compression=gzip)
rxcomp.min.js     | ![](https://img.badgesize.io/https://unpkg.com/rxcomp@1.0.0-beta.20/dist/umd/rxcomp.min.js.svg)
rxjs.min.js       | ![](https://img.badgesize.io/https://unpkg.com/rxjs@6.6.2/bundles/rxjs.umd.min.js.svg?compression=gzip)
rxjs.min.js       | ![](https://img.badgesize.io/https://unpkg.com/rxjs@6.6.2/bundles/rxjs.umd.min.js.svg)
 
> [TodoMvc Demo](https://actarian.github.io/rxcomp-todomvc/)  
> [TodoMvc Source](https://github.com/actarian/rxcomp-todomvc)  
> [TodoMvc Codepen](https://codepen.io/actarian/pen/QWWRZON?editors=0010)  
> [RxComp Codesandbox](https://codesandbox.io/s/rxcomp-template-2t3yu?fontsize=14&hidenavigation=1&theme=dark)  
> [RxComp Docs](https://actarian.github.io/rxcomp/typedoc/)   
___

### Modules

 module           | library
:-----------------|:----------------------------------------------------------------------------------------------|
CoreModule        | [rxcomp](https://github.com/actarian/rxcomp)
FormModule        | [rxcomp-form](https://github.com/actarian/rxcomp-form)
___

### What is included
* Modules *```imports```, ```exports```*
* Meta *```inputs```, ```outputs```, ```hosts```, ```template```*
* Components *```JsonComponent```*
* Structures *```ForStructure```, ```IfStructure```*
* Directives *```ClassDirective```, ```EventDirective```, ```HrefDirective```, ```InnerHtmlDirective```, ```SrcDirective```, ```StyleDirective```*
* Pipes *```JsonPipe```*
* Declarative Syntax
* OnPush Strategy via *```pushChanges```* method
* Automatic Subscription / Unsubscription
* Optional Chaining
* Component Template
* Http client with [RxComp HttpModule](https://github.com/actarian/rxcomp-http)
* Spa Router with [RxComp RouterModule](https://github.com/actarian/rxcomp-router)
* Reactive Forms with [RxComp FormModule](https://github.com/actarian/rxcomp-form)
* Form Validation with [RxComp FormModule](https://github.com/actarian/rxcomp-form)
* Server Side Rendering with [RxComp ServerModule](https://github.com/actarian/rxcomp-server)

___

### What is NOT included
* ~~Two-Way Data Binding~~
* ~~Dependency Injection~~

___

## Installation and Usage

### ES6 via npm
This library depend on [RxJs](https://github.com/ReactiveX/rxjs)  
install via npm or include via script   

```
npm install rxjs rxcomp --save
```
___

### CDN

For CDN, you can use unpkg

```html
<script src="https://unpkg.com/rxjs@6.6.2/bundles/rxjs.umd.min.js"></script>  
<script src="https://unpkg.com/rxcomp@1.0.0-beta.20/dist/umd/rxcomp.min.js"></script>  
```

The global namespace for RxComp is `rxcomp`

```javascript
import { CoreModule, Module } from 'rxcomp';
```
___

### Bootstrapping Module

```javascript
import { CoreModule, Module } from 'rxcomp';

export default class AppModule extends Module {}

AppModule.meta = {
  imports: [
    CoreModule
  ],
  declarations: [
    TodoItemComponent,
    DatePipe,
  ],
  bootstrap: AppComponent,
};
```
___

### Component Definition

```javascript
export default class TodoItemComponent extends Component {

  onChanges(changes) {
      this.color = color(changes.item.id);
  }

  onToggle($event) {
      this.toggle.next($event);
  }

  onRemove($event) {
      this.remove.next($event);
  }

}

TodoItemComponent.meta = {
  selector: '[todo-item-component]',
  inputs: ['item'],
	outputs: ['toggle', 'remove'],
	// hosts: { host: HostFactory },
  template: /* html */ `
      <button type="button" class="btn--toggle" (click)="onToggle(item)">
          <div class="date" [innerHTML]="item.date | date : 'en-US' : { month: 'short', day: '2-digit', year: 'numeric' }"></div>
          <div class="title" [innerHTML]="item.name"></div>
      </button>
      <button type="button" class="btn--remove" (click)="onRemove(item)">
          <i class="icon--remove"></i>
      </button>
  `,
};

```
___

### Declarative Syntax

```html
<li class="list__item" *for="let item of items" [class]="{ done: item.done }" [style]="{ background: background, color: foreground, '--accent': accent }" todo-item-component [item]="item" (toggle)="onToggleItem($event)" (remove)="onRemoveItem($event)">
  <button type="button" class="btn--toggle" (click)="onToggle(item)">
    <div class="date" [innerHTML]="item.date | date : 'en-US' : { month: 'short', day: '2-digit', year: 'numeric' }"></div>
    <div class="title" [innerHTML]="item.name"></div>
  </button>
  <button type="button" class="btn--remove" (click)="onRemove(item)">
    <i class="icon--remove"></i>
  </button>
</li>
```
___

### LifeCycle Hooks

```javascript
onInit() {
} 

onChanges(changes) {   
}

onView() { 
}

onDestroy() {
}
```
___
### Browser Compatibility
RxComp supports all browsers that are [ES5-compliant](http://kangax.github.io/compat-table/es5/) (IE8 and below are not supported).
___
## Contributing

*Pull requests are welcome and please submit bugs 🐞*
___

### Install packages
```
npm install
```
___

### Build, Serve & Watch 
```
gulp
```
___

### Build Dist
```
gulp build --target dist
```
___

*Thank you for taking the time to provide feedback and review. This feedback is appreciated and very helpful 🌈*

[![GitHub forks](https://img.shields.io/github/forks/actarian/rxcomp.svg?style=social&label=Fork&maxAge=2592000)](https://gitHub.com/actarian/rxcomp/network/)  [![GitHub stars](https://img.shields.io/github/stars/actarian/rxcomp.svg?style=social&label=Star&maxAge=2592000)](https://GitHub.com/actarian/rxcomp/stargazers/)  [![GitHub followers](https://img.shields.io/github/followers/actarian.svg?style=social&label=Follow&maxAge=2592000)](https://github.com/actarian?tab=followers)

* [Github Project Page](https://github.com/actarian/rxcomp)  

*If you find it helpful, feel free to contribute in keeping this library up to date via [PayPal](https://www.paypal.me/circledev/5)*

[![PayPal](https://www.paypalobjects.com/webstatic/en_US/i/buttons/PP_logo_h_100x26.png)](https://www.paypal.me/circledev/5)
___

## Contact

* Luca Zampetti <lzampetti@gmail.com>
* Follow [@actarian](https://twitter.com/actarian) on Twitter

[![Twitter Follow](https://img.shields.io/twitter/follow/actarian.svg?style=social&label=Follow%20@actarian)](https://twitter.com/actarian)
___

## Release Notes
Changelog [here](https://github.com/actarian/rxcomp/blob/master/CHANGELOG.md).

---
_Source: https://npm.io/package/rxcomp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
