@rs-x/angular 0.4.5 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, APP_INITIALIZER, NgModule, inject, ChangeDetectorRef, Pipe } from '@angular/core';
2
+ import { InjectionToken, APP_INITIALIZER, inject, ChangeDetectorRef, Pipe } from '@angular/core';
3
3
  import { InjectionContainer } from '@rs-x/core';
4
4
  import { RsXExpressionParserInjectionTokens, RsXExpressionParserModule } from '@rs-x/expression-parser';
5
5
 
@@ -12,37 +12,19 @@ function initializeRsx() {
12
12
  return InjectionContainer.load(RsXExpressionParserModule);
13
13
  };
14
14
  }
15
- class RsxModule {
16
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: RsxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
17
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.1", ngImport: i0, type: RsxModule });
18
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: RsxModule, providers: [
19
- {
20
- provide: APP_INITIALIZER,
21
- useFactory: initializeRsx,
22
- multi: true
23
- },
24
- {
25
- provide: IExpressionFactoryToken,
26
- useFactory: () => InjectionContainer.get(RsXExpressionParserInjectionTokens.IExpressionFactory)
27
- }
28
- ] });
15
+ function providexRsx() {
16
+ return [
17
+ {
18
+ provide: APP_INITIALIZER,
19
+ useFactory: initializeRsx,
20
+ multi: true
21
+ },
22
+ {
23
+ provide: IExpressionFactoryToken,
24
+ useFactory: () => InjectionContainer.get(RsXExpressionParserInjectionTokens.IExpressionFactory)
25
+ }
26
+ ];
29
27
  }
30
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: RsxModule, decorators: [{
31
- type: NgModule,
32
- args: [{
33
- providers: [
34
- {
35
- provide: APP_INITIALIZER,
36
- useFactory: initializeRsx,
37
- multi: true
38
- },
39
- {
40
- provide: IExpressionFactoryToken,
41
- useFactory: () => InjectionContainer.get(RsXExpressionParserInjectionTokens.IExpressionFactory)
42
- }
43
- ],
44
- }]
45
- }] });
46
28
 
47
29
  class RsxPipe {
48
30
  _changeDetectorRef = inject(ChangeDetectorRef);
@@ -100,5 +82,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
100
82
  * Generated bundle index. Do not edit.
101
83
  */
102
84
 
103
- export { IExpressionFactoryToken, RsxModule, RsxPipe };
85
+ export { IExpressionFactoryToken, RsxPipe, providexRsx };
104
86
  //# sourceMappingURL=rs-x-angular.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"rs-x-angular.mjs","sources":["../../../projects/rsx/src/lib/rsx.module.ts","../../../projects/rsx/src/lib/rsx.pipe.ts","../../../projects/rsx/src/public-api.ts","../../../projects/rsx/src/rs-x-angular.ts"],"sourcesContent":["import { APP_INITIALIZER, InjectionToken, NgModule } from '@angular/core';\nimport { InjectionContainer } from '@rs-x/core';\nimport { IExpressionFactory, RsXExpressionParserInjectionTokens, RsXExpressionParserModule } from '@rs-x/expression-parser';\n\nexport const IExpressionFactoryToken = new InjectionToken<IExpressionFactory>('IExpressionFactoryProvider');\n\nfunction initializeRsx(): () => Promise<void> {\n return () => {\n if(InjectionContainer.isBound(RsXExpressionParserInjectionTokens.IExpressionFactory)) {\n return Promise.resolve();\n }\n return InjectionContainer.load(RsXExpressionParserModule);\n }\n}\n\n@NgModule({\n providers: [\n {\n provide: APP_INITIALIZER,\n useFactory: initializeRsx,\n multi: true\n },\n {\n provide: IExpressionFactoryToken,\n useFactory: () => InjectionContainer.get(RsXExpressionParserInjectionTokens.IExpressionFactory)\n }\n ],\n})\nexport class RsxModule { }","import {\n ChangeDetectorRef,\n inject,\n Pipe,\n type OnDestroy,\n type PipeTransform\n} from '@angular/core';\nimport {\n type IExpression\n} from '@rs-x/expression-parser';\nimport { Subscription } from 'rxjs';\nimport { IExpressionFactoryToken } from './rsx.module';\n\n@Pipe({\n name: 'rsx',\n pure: false,\n})\nexport class RsxPipe implements PipeTransform, OnDestroy {\n private readonly _changeDetectorRef = inject(ChangeDetectorRef);\n private readonly _expressionFactory = inject(IExpressionFactoryToken);\n private _expression?: IExpression<unknown>;\n private _changedSubscription?: Subscription;\n private _lastExpressionString?: string;\n private _lastContext?: object;\n private _value: unknown;\n \n public transform(expressionString: string, context: object): unknown {\n if (!expressionString || !context) {\n return null;\n }\n\n if (\n expressionString !== this._lastExpressionString ||\n context !== this._lastContext\n ) {\n this.disposeExpression();\n this.createExpression(expressionString, context);\n }\n\n return this._value;\n }\n\n public ngOnDestroy(): void {\n this.disposeExpression();\n }\n\n private createExpression(expressionString: string, context: object): void {\n this._lastExpressionString = expressionString;\n this._lastContext = context;\n this._expression = this._expressionFactory.create(context, expressionString)\n this._changedSubscription = this._expression.changed.subscribe(() => {\n this._value = this._expression!.value;\n this._changeDetectorRef.markForCheck();\n });\n }\n\n private disposeExpression(): void {\n this._changedSubscription?.unsubscribe();\n this._changedSubscription = undefined;\n\n this._expression?.dispose();\n this._expression = undefined;\n }\n}","/*\n * Public API Surface of rsx\n */\n\nexport * from './lib'\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAIa,uBAAuB,GAAG,IAAI,cAAc,CAAqB,4BAA4B;AAE1G,SAAS,aAAa,GAAA;AAClB,IAAA,OAAO,MAAK;QACR,IAAG,kBAAkB,CAAC,OAAO,CAAC,kCAAkC,CAAC,kBAAkB,CAAC,EAAE;AAClF,YAAA,OAAO,OAAO,CAAC,OAAO,EAAE;QAC5B;AACA,QAAA,OAAO,kBAAkB,CAAC,IAAI,CAAC,yBAAyB,CAAC;AAC7D,IAAA,CAAC;AACL;MAea,SAAS,CAAA;uGAAT,SAAS,EAAA,IAAA,EAAA,EAAA,E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,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACF,oBAAA,IAAI,EAAE,KAAK;AACX,oBAAA,IAAI,EAAE,KAAK;AACd,iBAAA;;;AChBD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"rs-x-angular.mjs","sources":["../../../projects/rsx/src/lib/rsx.providers.ts","../../../projects/rsx/src/lib/rsx.pipe.ts","../../../projects/rsx/src/public-api.ts","../../../projects/rsx/src/rs-x-angular.ts"],"sourcesContent":["import { APP_INITIALIZER, InjectionToken, type Provider } from '@angular/core';\nimport { InjectionContainer } from '@rs-x/core';\nimport { type IExpressionFactory, RsXExpressionParserInjectionTokens, RsXExpressionParserModule } from '@rs-x/expression-parser';\n\nexport const IExpressionFactoryToken = new InjectionToken<IExpressionFactory>('IExpressionFactoryProvider');\n\nfunction initializeRsx(): () => Promise<void> {\n return () => {\n if (InjectionContainer.isBound(RsXExpressionParserInjectionTokens.IExpressionFactory)) {\n return Promise.resolve();\n }\n return InjectionContainer.load(RsXExpressionParserModule);\n }\n}\n\nexport function providexRsx(): Provider[] {\n return [\n {\n provide: APP_INITIALIZER,\n useFactory: initializeRsx,\n multi: true\n },\n {\n provide: IExpressionFactoryToken,\n useFactory: () => InjectionContainer.get(RsXExpressionParserInjectionTokens.IExpressionFactory)\n }\n ];\n}","import {\n ChangeDetectorRef,\n inject,\n Pipe,\n type OnDestroy,\n type PipeTransform\n} from '@angular/core';\nimport {\n type IExpression\n} from '@rs-x/expression-parser';\nimport { Subscription } from 'rxjs';\nimport { IExpressionFactoryToken } from './rsx.providers';\n\n@Pipe({\n name: 'rsx',\n pure: false,\n})\nexport class RsxPipe implements PipeTransform, OnDestroy {\n private readonly _changeDetectorRef = inject(ChangeDetectorRef);\n private readonly _expressionFactory = inject(IExpressionFactoryToken);\n private _expression?: IExpression<unknown>;\n private _changedSubscription?: Subscription;\n private _lastExpressionString?: string;\n private _lastContext?: object;\n private _value: unknown;\n \n public transform(expressionString: string, context: object): unknown {\n if (!expressionString || !context) {\n return null;\n }\n\n if (\n expressionString !== this._lastExpressionString ||\n context !== this._lastContext\n ) {\n this.disposeExpression();\n this.createExpression(expressionString, context);\n }\n\n return this._value;\n }\n\n public ngOnDestroy(): void {\n this.disposeExpression();\n }\n\n private createExpression(expressionString: string, context: object): void {\n this._lastExpressionString = expressionString;\n this._lastContext = context;\n this._expression = this._expressionFactory.create(context, expressionString)\n this._changedSubscription = this._expression.changed.subscribe(() => {\n this._value = this._expression!.value;\n this._changeDetectorRef.markForCheck();\n });\n }\n\n private disposeExpression(): void {\n this._changedSubscription?.unsubscribe();\n this._changedSubscription = undefined;\n\n this._expression?.dispose();\n this._expression = undefined;\n }\n}","/*\n * Public API Surface of rsx\n */\n\nexport * from './lib'\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAIa,uBAAuB,GAAG,IAAI,cAAc,CAAqB,4BAA4B;AAE1G,SAAS,aAAa,GAAA;AACpB,IAAA,OAAO,MAAK;QACV,IAAI,kBAAkB,CAAC,OAAO,CAAC,kCAAkC,CAAC,kBAAkB,CAAC,EAAE;AACrF,YAAA,OAAO,OAAO,CAAC,OAAO,EAAE;QAC1B;AACA,QAAA,OAAO,kBAAkB,CAAC,IAAI,CAAC,yBAAyB,CAAC;AAC3D,IAAA,CAAC;AACH;SAEgB,WAAW,GAAA;IACzB,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,eAAe;AACxB,YAAA,UAAU,EAAE,aAAa;AACzB,YAAA,KAAK,EAAE;AACR,SAAA;AACD,QAAA;AACE,YAAA,OAAO,EAAE,uBAAuB;YAChC,UAAU,EAAE,MAAM,kBAAkB,CAAC,GAAG,CAAC,kCAAkC,CAAC,kBAAkB;AAC/F;KACF;AACH;;MCVa,OAAO,CAAA;AACC,IAAA,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC9C,IAAA,kBAAkB,GAAG,MAAM,CAAC,uBAAuB,CAAC;AAC7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AA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA;qGAAP,OAAO,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,KAAA,EAAA,IAAA,EAAA,KAAA,EAAA,CAAA;;2FAAP,OAAO,EAAA,UAAA,EAAA,CAAA;kBAJnB,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACF,oBAAA,IAAI,EAAE,KAAK;AACX,oBAAA,IAAI,EAAE,KAAK;AACd,iBAAA;;;AChBD;;AAEG;;ACFH;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rs-x/angular",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "Angular integration for RS-X, providing the RsxPipe",
5
5
  "type": "module",
6
6
  "module": "fesm2022/rs-x-angular.mjs",
@@ -38,8 +38,8 @@
38
38
  "@angular/core": "^21.1.0",
39
39
  "@angular/common": "^21.1.0",
40
40
  "rxjs": "^7.8.0",
41
- "@rs-x/core": "0.4.5",
42
- "@rs-x/expression-parser": "0.4.5"
41
+ "@rs-x/core": "^0.4.7",
42
+ "@rs-x/expression-parser": "^0.4.7"
43
43
  },
44
44
  "peerDependenciesMeta": {
45
45
  "@rs-x/core": {
@@ -1,14 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, PipeTransform, OnDestroy } from '@angular/core';
2
+ import { PipeTransform, OnDestroy, InjectionToken, Provider } from '@angular/core';
3
3
  import { IExpressionFactory } from '@rs-x/expression-parser';
4
4
 
5
- declare const IExpressionFactoryToken: InjectionToken<IExpressionFactory>;
6
- declare class RsxModule {
7
- static ɵfac: i0.ɵɵFactoryDeclaration<RsxModule, never>;
8
- static ɵmod: i0.ɵɵNgModuleDeclaration<RsxModule, never, never, never>;
9
- static ɵinj: i0.ɵɵInjectorDeclaration<RsxModule>;
10
- }
11
-
12
5
  declare class RsxPipe implements PipeTransform, OnDestroy {
13
6
  private readonly _changeDetectorRef;
14
7
  private readonly _expressionFactory;
@@ -25,4 +18,7 @@ declare class RsxPipe implements PipeTransform, OnDestroy {
25
18
  static ɵpipe: i0.ɵɵPipeDeclaration<RsxPipe, "rsx", true>;
26
19
  }
27
20
 
28
- export { IExpressionFactoryToken, RsxModule, RsxPipe };
21
+ declare const IExpressionFactoryToken: InjectionToken<IExpressionFactory>;
22
+ declare function providexRsx(): Provider[];
23
+
24
+ export { IExpressionFactoryToken, RsxPipe, providexRsx };