@lithiumjs/angular
Version:
Reactive components made easy. Lithium provides utilities that enable seamless reactive state and event interactions for Angular components.
63 lines (62 loc) • 2.45 kB
TypeScript
import { Subject, Observable } from "rxjs";
/** @deprecated */
export type EmitterType = string;
/** @deprecated */
export declare namespace EmitterMetadata {
const BOOTSTRAPPED_KEY = "$$STATEEMITTER_BOOTSTRAPPED";
type ProxyMode = keyof {
None: any;
From: any;
Alias: any;
Merge: any;
};
namespace ProxyMode {
const None: ProxyMode;
const From: ProxyMode;
const Alias: ProxyMode;
const Merge: ProxyMode;
}
interface SubjectInfo extends SubjectInfo.CoreDetails {
propertyKey: string | symbol;
observable: Subject<any> | Observable<any>;
}
namespace SubjectInfo {
interface CoreDetails {
initial?: () => any;
initialValue?: any;
readOnly?: boolean;
writeOnly?: boolean;
proxyMode?: ProxyMode;
proxyPath?: string;
proxyMergeUpdates?: boolean;
unmanaged?: boolean;
}
interface WithDynamicAlias extends SubjectInfo {
observable: Observable<any>;
}
interface WithStaticAlias extends SubjectInfo {
observable: Subject<any>;
}
function IsDynamicAlias(subjectInfo: SubjectInfo): subjectInfo is SubjectInfo.WithDynamicAlias;
function IsStaticAlias(subjectInfo: SubjectInfo): subjectInfo is SubjectInfo.WithStaticAlias;
function IsSelfProxy(subjectInfo: SubjectInfo): boolean;
}
type MetadataMap = Map<EmitterType, SubjectInfo>;
const EmitterMapSymbol: unique symbol;
/** @description Gets the metadata map object for the given target class (or its inheritted classes). */
function GetMetadataMap(target: Object): MetadataMap;
/** @description Gets the metadata map object for the given target class. */
function GetOwnMetadataMap(target: Object): MetadataMap;
function HasOwnMetadataMap(target: Object): boolean;
function SetMetadataMap(target: Object, map: MetadataMap): void;
/** @description Copy all metadata from the source map to the target map.
*
* Note: This mutates the target map.
**/
function CopyMetadata(target: MetadataMap, source: MetadataMap, overwrite?: boolean): MetadataMap;
/** @description Merge own and inheritted metadata into a single map.
*
* Note: This mutates the object's metadata.
**/
function CopyInherittedMetadata(object: any): MetadataMap;
}