Comparing version 0.1.5 to 0.1.6
@@ -105,2 +105,3 @@ (function (global, factory) { | ||
]; | ||
ObservableComponent.ctorParameters = function () { return []; }; | ||
@@ -107,0 +108,0 @@ var NgLetDirective = /** @class */ (function () { |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("observable-input")):"function"==typeof define&&define.amd?define("ng-sugar",["exports","@angular/core","rxjs","rxjs/operators","observable-input"],t):t((e=e||self)["ng-sugar"]={},e.ng.core,e.rxjs,e.rxjs.operators,e.observableInput)}(this,(function(e,t,n,r,o){"use strict";var i=Symbol("onChanges"),p=Symbol("onInit"),s=Symbol("doCheck"),a=Symbol("afterContentInit"),u=Symbol("afterContentChecked"),c=Symbol("afterViewInit"),f=Symbol("afterViewChecked"),b=Symbol("onDestroy"),l=function(){function e(){}return Object.defineProperty(e.prototype,"onChanges",{get:function(){return this.getObservable(i).pipe(r.takeUntil(this.onDestroy))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onInit",{get:function(){return this.getObservable(p).pipe(r.takeUntil(this.onDestroy),r.take(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"doCheck",{get:function(){return this.getObservable(s).pipe(r.takeUntil(this.onDestroy))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"afterContentInit",{get:function(){return this.getObservable(a).pipe(r.takeUntil(this.onDestroy),r.take(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"afterContentChecked",{get:function(){return this.getObservable(u).pipe(r.takeUntil(this.onDestroy))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"afterViewInit",{get:function(){return this.getObservable(c).pipe(r.takeUntil(this.onDestroy),r.take(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"afterViewChecked",{get:function(){return this.getObservable(f).pipe(r.takeUntil(this.onDestroy))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDestroy",{get:function(){return this.getObservable(b).pipe(r.take(1))},enumerable:!1,configurable:!0}),e.prototype.ngOnChanges=function(e){this.emit(i,e)},e.prototype.ngOnInit=function(){this.emit(p)},e.prototype.ngDoCheck=function(){this.emit(s)},e.prototype.ngAfterContentInit=function(){this.emit(a)},e.prototype.ngAfterContentChecked=function(){this.emit(u)},e.prototype.ngAfterViewInit=function(){this.emit(c)},e.prototype.ngAfterViewChecked=function(){this.emit(f)},e.prototype.ngOnDestroy=function(){this.emit(b)},e.prototype.getObservable=function(e){return(this[e]||(this[e]=new n.Subject)).asObservable()},e.prototype.emit=function(e,t){var n=this[e];n&&n.next(t)},e}();l.decorators=[{type:t.Component,args:[{selector:"lib-observable-component",template:""}]}];var y=function(){function e(e,t){this.letContext={ngLet:null},e.createEmbeddedView(t,this.letContext)}return Object.defineProperty(e.prototype,"ngLet",{set:function(e){this.letContext.ngLet=e},enumerable:!1,configurable:!0}),e}();y.decorators=[{type:t.Directive,args:[{selector:"[ngLet]"}]}],y.ctorParameters=function(){return[{type:t.ViewContainerRef},{type:t.TemplateRef}]},y.propDecorators={ngLet:[{type:t.Input}]};var g=function(){};g.decorators=[{type:t.NgModule,args:[{declarations:[l,y],imports:[],exports:[l,y]}]}],Object.keys(o).forEach((function(t){"default"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})})),e.NgSugarModule=g,e.ObservableComponent=l,e.ɵa=y,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("observable-input")):"function"==typeof define&&define.amd?define("ng-sugar",["exports","@angular/core","rxjs","rxjs/operators","observable-input"],t):t((e=e||self)["ng-sugar"]={},e.ng.core,e.rxjs,e.rxjs.operators,e.observableInput)}(this,(function(e,t,n,r,o){"use strict";var i=Symbol("onChanges"),a=Symbol("onInit"),p=Symbol("doCheck"),s=Symbol("afterContentInit"),u=Symbol("afterContentChecked"),c=Symbol("afterViewInit"),f=Symbol("afterViewChecked"),b=Symbol("onDestroy"),l=function(){function e(){}return Object.defineProperty(e.prototype,"onChanges",{get:function(){return this.getObservable(i).pipe(r.takeUntil(this.onDestroy))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onInit",{get:function(){return this.getObservable(a).pipe(r.takeUntil(this.onDestroy),r.take(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"doCheck",{get:function(){return this.getObservable(p).pipe(r.takeUntil(this.onDestroy))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"afterContentInit",{get:function(){return this.getObservable(s).pipe(r.takeUntil(this.onDestroy),r.take(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"afterContentChecked",{get:function(){return this.getObservable(u).pipe(r.takeUntil(this.onDestroy))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"afterViewInit",{get:function(){return this.getObservable(c).pipe(r.takeUntil(this.onDestroy),r.take(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"afterViewChecked",{get:function(){return this.getObservable(f).pipe(r.takeUntil(this.onDestroy))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDestroy",{get:function(){return this.getObservable(b).pipe(r.take(1))},enumerable:!1,configurable:!0}),e.prototype.ngOnChanges=function(e){this.emit(i,e)},e.prototype.ngOnInit=function(){this.emit(a)},e.prototype.ngDoCheck=function(){this.emit(p)},e.prototype.ngAfterContentInit=function(){this.emit(s)},e.prototype.ngAfterContentChecked=function(){this.emit(u)},e.prototype.ngAfterViewInit=function(){this.emit(c)},e.prototype.ngAfterViewChecked=function(){this.emit(f)},e.prototype.ngOnDestroy=function(){this.emit(b)},e.prototype.getObservable=function(e){return(this[e]||(this[e]=new n.Subject)).asObservable()},e.prototype.emit=function(e,t){var n=this[e];n&&n.next(t)},e}();l.decorators=[{type:t.Component,args:[{selector:"lib-observable-component",template:""}]}],l.ctorParameters=function(){return[]};var y=function(){function e(e,t){this.letContext={ngLet:null},e.createEmbeddedView(t,this.letContext)}return Object.defineProperty(e.prototype,"ngLet",{set:function(e){this.letContext.ngLet=e},enumerable:!1,configurable:!0}),e}();y.decorators=[{type:t.Directive,args:[{selector:"[ngLet]"}]}],y.ctorParameters=function(){return[{type:t.ViewContainerRef},{type:t.TemplateRef}]},y.propDecorators={ngLet:[{type:t.Input}]};var g=function(){};g.decorators=[{type:t.NgModule,args:[{declarations:[l,y],imports:[],exports:[l,y]}]}],Object.keys(o).forEach((function(t){"default"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})})),e.NgSugarModule=g,e.ObservableComponent=l,e.ɵa=y,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=ng-sugar.umd.min.js.map |
@@ -17,2 +17,3 @@ import { Component } from '@angular/core'; | ||
export class ObservableComponent { | ||
constructor() { } | ||
// all observables will complete on component destruction | ||
@@ -68,2 +69,3 @@ get onChanges() { | ||
]; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib2JzZXJ2YWJsZS1jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZy1zdWdhci9zcmMvbGliL29ic2VydmFibGUtY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFTTSxTQUFTLEVBQ3JCLE1BQU0sZUFBZSxDQUFDO0FBQ3ZCLE9BQU8sRUFBYyxPQUFPLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFDM0MsT0FBTyxFQUFFLFNBQVMsRUFBRSxJQUFJLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUVqRCxNQUFNLFlBQVksR0FBRyxNQUFNLENBQUMsV0FBVyxDQUFDLENBQUM7QUFDekMsTUFBTSxTQUFTLEdBQUcsTUFBTSxDQUFDLFFBQVEsQ0FBQ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H1cbiAgICBuZ0FmdGVyQ29udGVudEluaXQoKTogdm9pZCB7IHRoaXMuZW1pdChhZnRlckNvbnRlbnRJbml0S2V5KTsgfVxuICAgIG5nQWZ0ZXJDb250ZW50Q2hlY2tlZCgpOiB2b2lkIHsgdGhpcy5lbWl0KGFmdGVyQ29udGVudENoZWNrZWRLZXkpOyB9XG4gICAgbmdBZnRlclZpZXdJbml0KCk6IHZvaWQgeyB0aGlzLmVtaXQoYWZ0ZXJWaWV3SW5pdEtleSk7IH1cbiAgICBuZ0FmdGVyVmlld0NoZWNrZWQoKTogdm9pZCB7IHRoaXMuZW1pdChhZnRlclZpZXdDaGVja2VkS2V5KTsgfVxuICAgIG5nT25EZXN0cm95KCk6IHZvaWQgeyB0aGlzLmVtaXQob25EZXN0cm95S2V5KTsgfVxuXG4gICAgcHJpdmF0ZSBnZXRPYnNlcnZhYmxlKGtleTogc3ltYm9sKTogT2JzZXJ2YWJsZTxhbnk+IHtcbiAgICAgICAgcmV0dXJuICh0aGlzW2tleV0gfHwgKHRoaXNba2V5XSA9IG5ldyBTdWJqZWN0PGFueT4oKSkpLmFzT2JzZXJ2YWJsZSgpO1xuICAgIH1cblxuICAgIHByaXZhdGUgZW1pdChrZXk6IHN5bWJvbCwgdmFsdWU/OiBhbnkpOiB2b2lkIHtcbiAgICAgICAgY29uc3Qgc3ViamVjdCA9IHRoaXNba2V5XTtcbiAgICAgICAgaWYgKCFzdWJqZWN0KXtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIHN1YmplY3QubmV4dCh2YWx1ZSk7XG4gICAgfVxufVxuIl19 |
@@ -19,2 +19,3 @@ import { Component, Directive, ViewContainerRef, TemplateRef, Input, NgModule } from '@angular/core'; | ||
class ObservableComponent { | ||
constructor() { } | ||
// all observables will complete on component destruction | ||
@@ -70,2 +71,3 @@ get onChanges() { | ||
]; | ||
ObservableComponent.ctorParameters = () => []; | ||
@@ -72,0 +74,0 @@ class NgLetDirective { |
import { SimpleChanges, OnChanges, OnInit, DoCheck, AfterContentInit, AfterContentChecked, AfterViewInit, AfterViewChecked, OnDestroy } from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
export declare class ObservableComponent implements OnChanges, OnInit, DoCheck, AfterContentInit, AfterContentChecked, AfterViewInit, AfterViewChecked, OnDestroy { | ||
constructor(); | ||
protected get onChanges(): Observable<SimpleChanges>; | ||
@@ -5,0 +6,0 @@ protected get onInit(): Observable<void>; |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"exports":[{"from":"observable-input"}],"metadata":{"NgSugarModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":4,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"ObservableComponent"},{"__symbolic":"reference","name":"ɵa"}],"imports":[],"exports":[{"__symbolic":"reference","name":"ObservableComponent"},{"__symbolic":"reference","name":"ɵa"}]}]}],"members":{}},"ObservableComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":26,"character":1},"arguments":[{"selector":"lib-observable-component","template":""}]}],"members":{"ngOnChanges":[{"__symbolic":"method"}],"ngOnInit":[{"__symbolic":"method"}],"ngDoCheck":[{"__symbolic":"method"}],"ngAfterContentInit":[{"__symbolic":"method"}],"ngAfterContentChecked":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngAfterViewChecked":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"getObservable":[{"__symbolic":"method"}],"emit":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"class","arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":6,"character":1},"arguments":[{"selector":"[ngLet]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":12,"character":31},{"__symbolic":"reference","name":"TemplateRef","module":"@angular/core","arguments":[{"__symbolic":"reference","name":"any","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":12,"character":85,"context":{"typeName":"T"},"module":"./lib/ng-let.directive"}]}]}]}],"ngLet":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":16,"character":5}}]}]}}},"origins":{"NgSugarModule":"./lib/ng-sugar.module","ObservableComponent":"./lib/observable-component","ɵa":"./lib/ng-let.directive"},"importAs":"ng-sugar"} | ||
{"__symbolic":"module","version":4,"exports":[{"from":"observable-input"}],"metadata":{"NgSugarModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":4,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"ObservableComponent"},{"__symbolic":"reference","name":"ɵa"}],"imports":[],"exports":[{"__symbolic":"reference","name":"ObservableComponent"},{"__symbolic":"reference","name":"ɵa"}]}]}],"members":{}},"ObservableComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":26,"character":1},"arguments":[{"selector":"lib-observable-component","template":""}]}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnInit":[{"__symbolic":"method"}],"ngDoCheck":[{"__symbolic":"method"}],"ngAfterContentInit":[{"__symbolic":"method"}],"ngAfterContentChecked":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngAfterViewChecked":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"getObservable":[{"__symbolic":"method"}],"emit":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"class","arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":6,"character":1},"arguments":[{"selector":"[ngLet]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":12,"character":31},{"__symbolic":"reference","name":"TemplateRef","module":"@angular/core","arguments":[{"__symbolic":"reference","name":"any","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":12,"character":85,"context":{"typeName":"T"},"module":"./lib/ng-let.directive"}]}]}]}],"ngLet":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":16,"character":5}}]}]}}},"origins":{"NgSugarModule":"./lib/ng-sugar.module","ObservableComponent":"./lib/observable-component","ɵa":"./lib/ng-let.directive"},"importAs":"ng-sugar"} |
{ | ||
"name": "ng-sugar", | ||
"version": "0.1.5", | ||
"description": "Non-orthodox syntactic sugar utils for Angular.", | ||
"version": "0.1.6", | ||
"description": "Syntactic sugar utils for Angular.", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
111
README.md
## ng-sugar | ||
Non-orthodox, or somehow experimental syntactic sugar utils for Angular. | ||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.3 (boilerplate is threatening though). | ||
Syntactic sugar utils for Angular. | ||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.3 (boilerplate is frightening though). | ||
## Installation | ||
```bash | ||
npm install --save ng-sugar | ||
``` | ||
or | ||
```bash | ||
yarn add ng-sugar | ||
``` | ||
## Purpose | ||
Reduce the boilerplate in rxjs-first workflows. | ||
Reduce the boilerplate in rxjs-first workflows. Angular itself is not centered around rxjs yet it uses it to a degree, where at times logic starts looking convoluted and a bit boilerplaty when we start mixing observables with component lifecycle, Inputs, ViewChild, etc. | ||
For example, let's say we want to make a component that can define its own navigation items and pass it back to parent component that manages the appshell's navigation bar. One way would be to write: | ||
```ts | ||
@Component({ | ||
selector: 'hero-component', | ||
template: ` | ||
<p>Hero Component</p> | ||
<ng-template #items> | ||
<button mat-icon-button> | ||
<mat-icon>arrow_drop_up</mat-icon> | ||
</button> | ||
</ng-template> | ||
` | ||
}) | ||
export class HeroComponent { | ||
@ViewChild("items", {static: false}) items: TemplateRef<any> | ||
@Output() appbarItems = new EventEmitter<TemplateRef<any>>() | ||
ngAfterViewInit(): void { | ||
this.appbarItems.emit(this.items) | ||
} | ||
} | ||
``` | ||
Doing this is totally fine as long as there no code that will run prior to `ngAfterViewInit()` that touches `this.items` which are undefined in that case. | ||
As an alternative, we can utilize `ObservableComponent` that has lifecycle hooks as observables, then expessing our logic on top of this observable. Above will now look like: | ||
```ts | ||
import {ObservableComponent} from "ng-sugar"; | ||
//... | ||
export class HeroComponent extends ObservableComponent { | ||
@ViewChild("items", {static: false}) items: TemplateRef<any> | ||
// emits once on afterViewInit | ||
items$ = this.afterViewInit.pipe(map(() => this.items)) | ||
@Output() appbarItems = new EventEmitter<TemplateRef<any>>() | ||
constructor(){ | ||
super() | ||
this.items$.subscribe( | ||
items => this.appbarItems.emit(items), | ||
console.error) | ||
} | ||
} | ||
``` | ||
## About | ||
This is a small set of utils that might be part of Angular core itself one day. It consists of | ||
* ObservableComponent | ||
* ngLet directive | ||
* ObservableInput reimported from [insidewhy/observable-input](https://github.com/insidewhy/observable-input) | ||
## ObservableComponent | ||
Inheriting from `ObservableComponent` adds an observable counterpart to every lifecycle hook (with ng prefix removed). | ||
ngAfterViewInit in the below example is available as `this.afterViewInit`: | ||
```ts | ||
import {ObservableComponent} from "ng-sugar"; | ||
//... | ||
export class HeroComponent extends ObservableComponent { | ||
@ViewChild("items", {static: false}) items: TemplateRef<any> | ||
// emits once on afterViewInit | ||
items$ = this.afterViewInit.pipe(map(() => this.items)) | ||
} | ||
``` | ||
## NgLet | ||
We can unwrap an observable inside a template using *ngIf directive utilizing `as` binding, like: | ||
```html | ||
<ng-container *ngIf="groupId$ | async as groupId"> | ||
</ng-container> | ||
``` | ||
Before groupId$ emits or if it is null, above `ng-container` won't be rendered to the DOM. When it is not desired, replacing the above with `*ngLet` handles this usecase: | ||
```html | ||
<ng-container *ngLet="groupId$ | async as groupId"> | ||
</ng-container> | ||
``` | ||
## ObservableInput | ||
See [insidewhy/observable-input](https://github.com/insidewhy/observable-input) | ||
## Contributing | ||
Check [CONTIBUTING.md](CONTRIBUTING.md) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63593
457
117