@ts-core/angular 11.0.88 → 11.0.89

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.
@@ -0,0 +1,21 @@
1
+ import { Compiler, Injector, NgModuleFactory, NgModuleRef, Type } from '@angular/core';
2
+ import { Loadable } from '@ts-core/common';
3
+ import { MapCollection } from '@ts-core/common/map';
4
+ export declare class LazyModuleLoader<T extends ILazyModuleData = ILazyModuleData> extends Loadable {
5
+ protected compiler: Compiler;
6
+ protected injector: Injector;
7
+ protected _modules: MapCollection<T>;
8
+ constructor(compiler: Compiler, injector: Injector);
9
+ protected load(item: T): Promise<void>;
10
+ protected loadReference<T>(path: LazyModulePath<T>): Promise<NgModuleRef<T>>;
11
+ protected isNeedLoad(item: T): boolean;
12
+ loadIfNeed(id: string): Promise<T>;
13
+ destroy(): void;
14
+ get modules(): MapCollection<T>;
15
+ }
16
+ export interface ILazyModuleData<T = any> {
17
+ id: string;
18
+ path?: LazyModulePath<T>;
19
+ reference?: NgModuleRef<T>;
20
+ }
21
+ export declare type LazyModulePath<T> = () => Promise<NgModuleFactory<T> | Type<T>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-core/angular",
3
- "version": "11.0.88",
3
+ "version": "11.0.89",
4
4
  "description": "Modules for frontend based on angular",
5
5
  "main": "bundles/ts-core-angular.umd.js",
6
6
  "author": {
package/public-api.d.ts CHANGED
@@ -103,6 +103,10 @@ export * from './theme/ThemeModule';
103
103
  export * from './theme/ThemeToggleDirective';
104
104
  export * from './user/IUser';
105
105
  export * from './user/UserBaseService';
106
+ export * from './module/LazyModuleLoader';
107
+ export * from './transport/TransportLazy';
108
+ export * from './transport/TransportLazyModule';
109
+ export * from './transport/TransportLazyModuleLoadedEvent';
106
110
  export * from './util/ViewUtil';
107
111
  export * from './VICommonModule';
108
112
  export * from './window/IWindow';
@@ -0,0 +1,15 @@
1
+ import { ITransportCommand, ITransportCommandOptions, ITransportEvent, ITransportSettings } from '@ts-core/common/transport';
2
+ import { TransportLocal } from '@ts-core/common/transport/local';
3
+ import { LazyModuleLoader } from '../module/LazyModuleLoader';
4
+ import { ILogger } from '@ts-core/common/logger';
5
+ import { ITransportLazyModuleData } from './TransportLazyModule';
6
+ export declare class TransportLazy extends TransportLocal {
7
+ protected loader: LazyModuleLoader<ITransportLazyModuleData>;
8
+ constructor(logger: ILogger, loader: LazyModuleLoader<ITransportLazyModuleData>, settings?: ITransportSettings);
9
+ protected moduleLoadedHandler(module: ITransportLazyModuleData): void;
10
+ protected dispatchCommand<U>(command: ITransportCommand<U>, options: ITransportCommandOptions, isNeedReply: boolean): Promise<void>;
11
+ protected getModuleByCommand(name: string): ITransportLazyModuleData;
12
+ protected getModuleByEvent(name: string): ITransportLazyModuleData;
13
+ dispatch<T>(event: ITransportEvent<T>): void;
14
+ destroy(): void;
15
+ }
@@ -0,0 +1,16 @@
1
+ import { NgModuleRef } from '@angular/core';
2
+ import { Transport } from '@ts-core/common/transport';
3
+ import { ILazyModuleData } from '../module/LazyModuleLoader';
4
+ export declare abstract class TransportLazyModule<T> implements ITransportLazyModuleData<T> {
5
+ reference: NgModuleRef<T>;
6
+ protected transport: Transport;
7
+ constructor(reference: NgModuleRef<T>, transport: Transport);
8
+ protected moduleLoadedDispatch(): void;
9
+ abstract get id(): string;
10
+ get events(): Array<string>;
11
+ get commands(): Array<string>;
12
+ }
13
+ export interface ITransportLazyModuleData<T = any> extends ILazyModuleData<T> {
14
+ events?: Array<string>;
15
+ commands?: Array<string>;
16
+ }
@@ -0,0 +1,6 @@
1
+ import { TransportEvent } from '@ts-core/common/transport';
2
+ import { ITransportLazyModuleData } from './TransportLazyModule';
3
+ export declare class TransportLazyModuleLoadedEvent<T extends ITransportLazyModuleData = ITransportLazyModuleData> extends TransportEvent<T> {
4
+ static readonly NAME = "TransportLazyModuleLoadedEvent";
5
+ constructor(request: T);
6
+ }