{"version":3,"file":"ng-cabled.mjs","sources":["../../ts/decorators.ts","../../ts/base.ts","../../ts/ng-cabled.ts"],"sourcesContent":["// tslint:disable:no-invalid-this\nimport { inject, Injectable, InjectFlags, InjectionToken, Provider, Type } from '@angular/core';\nimport 'reflect-metadata';\n\nexport type CycleType = 'destroy' | 'afterViewInit' | 'change' | 'init';\nexport type TestCase = {name: string, x: boolean, f: boolean};\nconst DECORATED_CLASSES = '__decoratedclasses__';\nconst DECORATORS = '__decorators__';\n\nconst CABLED_KEY = '__cabled__';\nconst TEST_UNITS = '__testunits__';\nconst CLASS_INSTANTIATED = '__classinstantiated__';\nconst CYCLES_KEY = '__cycles__';\nconst POST_CONSTRUCT_KEY = '__post-construct__';\nconst TESTS_KEY = '__testsunits__';\nconst WITH_SERVICES = '__service__';\nconst DEPENDENCIES = '__dependencies__';\nconst WATCHERS_KEY = '__watcherskey__';\nconst IS_PROXY = '__isproxy__';\nconst PROXY = '__proxy__';\n\nexport const TEST_CASES: Map<Function, Array<TestCase>> = new Map<Function, Array<TestCase>>();\nexport const TEST_CASES_ONLY: Map<Function, Array<TestCase>> = new Map<Function, Array<TestCase>>();\n\nexport type DecoratedClass = {ctor: ClassConstructor, args: Array<any>};\nexport type DecoratedClasses = Map<string, Array<DecoratedClass>>;\nexport interface AngularComponentCtor {\n    new (...args: any): any;\n    prototype: any;\n    ɵfac: any;\n    ɵdir: any;\n}\nexport interface ClassConstructor {\n    new (...args: any): any;\n    prototype: any;\n}\n// export type ClassConstructor = {new(...args: any): any, prototype: any};\nexport type ClassDecorators<T extends DecoratorParameterType> = Map<Function, Map<string, Array<DecoratorMetadata<T>>>>;\nexport type DecoratorMetadata<T extends DecoratorParameterType> = {prop: string, arg: T};\nexport type NgServiceParamType = Type<any> | string | InjectionToken<any>;\nexport type NgServiceArguments = {type: NgServiceParamType, def?: any};\nexport type DecoratorParameterType = CycleType | TestCase | NgServiceArguments | string;\n\nexport function Cabled(type: NgServiceParamType, def?: any) {\n    return __decorateProperty(CABLED_KEY, {type: type, def: def});\n}\n\nexport function Watcher(prop: string) {\n    return __decorateProperty(WATCHERS_KEY, prop);\n}\n\nexport function NgCycle(cycle: CycleType) {\n    return __decorateProperty(CYCLES_KEY, cycle);\n}\n\nexport function PostConstruct() {\n    return __decorateProperty(POST_CONSTRUCT_KEY, undefined);\n}\n\nexport function DecoratedClass(ctor: ClassConstructor | AngularComponentCtor): any {\n    return __decorateClass(ctor, WITH_SERVICES)\n}\n\nexport function NgTestUnit(providers?: Array<Provider>) {\n    return function(ctor: ClassConstructor) {\n        ctor.prototype.providers = providers;\n        return __decorateClass(ctor, TEST_UNITS);\n    }\n}\n\nexport function NgTest(name?: string) {\n    return __decorateProperty(TESTS_KEY, <TestCase>{ name: name, x: false, f: false });\n}\n\nexport function FNgTest(name?: string) {\n    return __decorateProperty(TESTS_KEY, <TestCase>{ name: name, x: false, f: true });\n}\n\nexport function XNgTest(name?: string) {\n    return __decorateProperty(TESTS_KEY, <TestCase>{ name: name, x: true, f: false });\n}\n\nexport function getDependencies<T extends DecoratorParameterType>(ctor: ClassConstructor): Array<DecoratorMetadata<T>> {\n    return __getDecorations(ctor.prototype, CABLED_KEY);\n}\n\nexport function getCycles<T extends DecoratorParameterType>(instance: Function): Array<DecoratorMetadata<T>> {\n    return __getDecorations(instance.prototype, CYCLES_KEY);\n}\n\nexport function getWatchers<T extends DecoratorParameterType>(instance: Function): Array<DecoratorMetadata<T>> {\n    return __getDecorations(instance.prototype, WATCHERS_KEY);\n}\n\nexport function getTestunits(): Array<{new(...args: any): any; prototype: any;}> {\n    const classes = __getDecoratedClasses(TEST_UNITS);\n    return classes.map(c => c.ctor);\n}\n\nexport function getTestcases<T extends DecoratorParameterType>(instance: Function): Array<DecoratorMetadata<T>> {\n    return __getDecorations(instance.prototype, TESTS_KEY);\n}\n\nexport function bootstrapModule(providers: Array<Provider>) {\n    providers\n        .map(p => typeof(p) == 'function' ? p : p['useClass'] ? p['provide'] : null)\n        .filter(p => !!p)\n        .forEach(p => {\n            const i = inject(p, InjectFlags.Optional)\n            if (!i) {\n                return ;\n            }\n            processDependencies(i as any);\n        });\n}\n\nfunction __createProperty(instance: Function, prop: string, value: any) {\n    Object.defineProperty(instance, prop, {\n        enumerable: true, configurable: true, writable: true,\n        value: value,\n    });\n}\n\nexport function processDependencies(instance: Function) {\n    if (instance[CLASS_INSTANTIATED]) {\n        return ;\n    }\n    if (instance[IS_PROXY]) {\n        Object.defineProperty(instance, PROXY, {configurable: true, enumerable: true, value: {}});\n    }\n    const ctor: ClassConstructor = instance.constructor as any;\n    const deps = getDependencies(ctor);\n    deps.forEach(d => {\n        const a = d.arg as NgServiceArguments;\n        const optional = typeof(a.def) != 'undefined';\n        let i = inject(a.type as Type<any>, InjectFlags.Optional);\n\n        if (i == null && optional) {\n            i = a.def;\n        }\n\n        if (i) {\n            processDependencies(i);\n        }\n        __createProperty(instance, d.prop, i);\n        if (instance[IS_PROXY]) {\n            __createProperty(instance[PROXY], d.prop, i);\n        }\n    });\n\n    const pc = __getDecorations(Object.getPrototypeOf(instance), POST_CONSTRUCT_KEY);\n    pc.forEach(p => instance[p.prop].bind(instance)());\n\n    instance[CLASS_INSTANTIATED] = true;\n\n    instance[DEPENDENCIES] = deps.map(d => d.prop);\n}\n\nexport function __decorateProperty<T extends DecoratorParameterType>(decorationName: string, arg: T): any {\n    return function(ctor: ClassConstructor, property: string) {\n        const c = ctor.constructor;\n        let map: ClassDecorators<DecoratorParameterType> = Reflect.getOwnMetadata(DECORATORS, Object);\n\n        if (!map) {\n            map = new Map<ClassConstructor, Map<string, Array<DecoratorMetadata<DecoratorParameterType>>>>();\n        }\n\n        if (!map.get(c)) {\n            map.set(c, new Map<string, Array<DecoratorMetadata<DecoratorParameterType>>>());\n        }\n        \n        if (!Array.isArray(map.get(c).get(decorationName))) {\n            map.get(c).set(decorationName, []);\n        }\n        map.get(c).get(decorationName).push({prop: property, arg: arg});\n\n        Reflect.defineProperty(ctor, property, { enumerable: true, writable: true, configurable: true });\n        Reflect.defineMetadata(DECORATORS, map, Object);\n        return ctor;\n    };\n}\n\nexport function __decorateClass(ctor: ClassConstructor, decoration: string, args?: any) {\n    let classes: DecoratedClasses = Reflect.getOwnMetadata(DECORATED_CLASSES, Object);\n    if (!classes) {\n        classes = new Map<string, Array<DecoratedClass>>();\n    }\n\n    if (!Array.isArray(classes.get(decoration))) {\n        classes.set(decoration, []);\n    }\n\n    classes.get(decoration).push({ctor: ctor, args: args});\n    Reflect.defineMetadata(DECORATED_CLASSES, classes, Object);\n    return ctor;\n}\n\nexport function __getDecorations<T extends DecoratorParameterType>(ctor: ClassConstructor, key: string): Array<DecoratorMetadata<T>> {\n    if (ctor == null) {\n        return [];\n    }\n    const decorators: ClassDecorators<T> = Reflect.getOwnMetadata(DECORATORS, Object);\n    let result: Array<DecoratorMetadata<T>> = [];\n    if (!decorators) {\n        return [];\n    }\n    const decorations = decorators.get(ctor.constructor);\n    if (decorations) {\n        result = decorations.get(key) || [];\n    }\n\n    return result.concat(__getDecorations(Object.getPrototypeOf(ctor), key));\n}\n\nexport function __getDecoratedClasses(key: string): Array<DecoratedClass> {\n    const classes: DecoratedClasses = Reflect.getOwnMetadata(DECORATED_CLASSES, Object);\n    if (!classes) {\n        return [];\n    }\n\n    return classes.get(key) || [];\n}\n","import { inject, Injector, Provider, runInInjectionContext, SimpleChanges, Type } from \"@angular/core\";\nimport { Observable, Subscription } from \"rxjs\";\nimport { bootstrapModule, CycleType, DecoratedClass, DecoratorMetadata, getCycles, getWatchers, processDependencies } from \"./decorators\";\n\nconst DEFAULT_SUBSCRIPTION_TYPE = '__defaultsubscriptiontype__';\n\ntype InternalSubscription = {\n    s: Subscription;\n    type: string;\n}\n\nexport function UUID(): string {\n    return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n        var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);\n        return v.toString(16);\n    });\n}\n\nexport function CabledClassFactory(type: Type<any>, deps?: Array<any>) {\n    const result = new type(...(deps || []));\n    processDependencies(result);\n    return result;\n}\n\n@DecoratedClass\nexport class BaseComponent {\n    public id: string;\n\n    private __injector__ = inject(Injector);\n    private __cycles__: Map<string, Array<string>> = new Map<string, Array<string>>();\n    private __watchers__: Array<DecoratorMetadata<string>> = [];\n    private __subscriptions__: Array<InternalSubscription> = [];\n\n    protected _isValid: boolean = true;\n\n    constructor() {\n        this.__watchers__ = getWatchers(this.constructor);\n        this.__watchers__.reverse();\n        const cycles = getCycles(this.constructor);\n        const m = this.__cycles__;\n        cycles.forEach(c => {\n            const key = c.arg as string;\n            if (!m.has(key)) {\n                m.set(key, []);\n            }\n\n            m.get(key).push(c.prop);\n        });\n    }\n\n    private _runCycle(cycle: CycleType, args?: any) {\n        const cycles = [].concat(this.__cycles__.get(cycle) || []);\n        cycles.reverse().forEach(method => this[method](args));\n    }\n\n    private ngOnDestroy() {\n        this._runCycle('destroy');\n        this.__subscriptions__.map(s => s.s).forEach(s => s.unsubscribe());\n    }\n\n    private ngAfterViewInit() {\n        this._runCycle('afterViewInit');\n    }\n\n    private ngOnChanges(changes: SimpleChanges) {\n        const toRun = new Map<string, Array<string>>();\n        this.__watchers__.filter(w => !!changes[w.arg]).forEach(w => {\n            if (!toRun.has(w.prop)) {\n                toRun.set(w.prop, []);\n            }\n            toRun.get(w.prop).push(w.arg);\n        });\n        Array.from(toRun.keys()).forEach(method => {\n            const args = toRun.get(method).reduce((acc, v) => Object.assign(acc, {[v]: changes[v]}), {});\n            this[method](args);\n        })\n        // this.__watchers__.filter(w => !!changes[w.arg]).forEach(w => this[w.prop](changes[w.arg], changes));\n        this._runCycle('change', changes);\n    }\n\n    private async ngOnInit() {\n        if (!this.id) {\n            this.id = UUID();\n        }\n        this._runCycle('init');\n    }\n\n    protected connect<T>(obs: Observable<T>, callback: (t: T) => void, type: string = DEFAULT_SUBSCRIPTION_TYPE) {\n        this.__subscriptions__.push({type: type, s: obs.subscribe(callback)});\n    }\n\n    protected getAllSubscriptions(): Array<Subscription> {\n        return this.__subscriptions__.map(s => s.s);\n    }\n\n    protected getSubscriptionsByType(type: string): Array<Subscription> {\n        return this.__subscriptions__.filter(s => s.type == type).map(s => s.s);\n    }\n\n    protected instance<T>(type: Type<T>, ...deps: any): T {\n        return runInInjectionContext(this.__injector__, () => CabledClassFactory(type, Array.isArray(deps) ? deps : []));\n    }\n\n    protected runInContext<T>(callback: () => T) {\n        return runInInjectionContext(this.__injector__, callback);\n    }\n}\n\nexport class BaseModule {\n    constructor(providers?: Array<Provider>) {\n        bootstrapModule(providers || this.constructor['ɵinj'].providers || []);\n    }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;AAMA,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AACjD,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAEpC,MAAM,UAAU,GAAG,YAAY,CAAC;AAChC,MAAM,UAAU,GAAG,eAAe,CAAC;AACnC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AACnD,MAAM,UAAU,GAAG,YAAY,CAAC;AAChC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAChD,MAAM,SAAS,GAAG,gBAAgB,CAAC;AACnC,MAAM,aAAa,GAAG,aAAa,CAAC;AACpC,MAAM,YAAY,GAAG,kBAAkB,CAAC;AACxC,MAAM,YAAY,GAAG,iBAAiB,CAAC;AACvC,MAAM,QAAQ,GAAG,aAAa,CAAC;AAC/B,MAAM,KAAK,GAAG,WAAW,CAAC;AAEb,MAAA,UAAU,GAAmC,IAAI,GAAG,GAA8B;AAClF,MAAA,eAAe,GAAmC,IAAI,GAAG,GAA8B;AAqBpF,SAAA,MAAM,CAAC,IAAwB,EAAE,GAAS,EAAA;AACtD,IAAA,OAAO,kBAAkB,CAAC,UAAU,EAAE,EAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAC,CAAC,CAAC;AAClE,CAAC;AAEK,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