{"version":3,"file":"di-controls-tokens.mjs","sources":["../../../../libs/di-controls/tokens/control-host.ts","../../../../libs/di-controls/tokens/di-controls-tokens.ts"],"sourcesContent":["import { inject, InjectionToken, InjectOptions, Provider, Type } from '@angular/core';\nimport { DIControl } from 'di-controls/controls';\n\nexport const DI_HOST_CONTROL: InjectionToken<DIControl<unknown>> = new InjectionToken<DIControl<unknown>>(\n\t'DI_HOST_CONTROL',\n);\n\n/**\n * Returns provider that can be used to provide host control. You can use it in the `providers` section\n * of your `@Component` or `@Directive`.\n *\n * ```ts {2} fileName=\"custom-control.component.ts\"\n * @Component({\n * \tproviders: [provideHostControl(CustomControlComponent)],\n * })\n * export class CustomControlComponent extends DIControl<string> {\n * \t\tconstructor() {\n * \t\t\tsuper();\n * \t\t}\n * \t}\n * ```\n *\n * @param useExisting - The `@Component` or `@Directive` class that should be used as a host control.\n */\nexport function provideHostControl<T extends DIControl<any>>(useExisting: Type<T>): Provider {\n\treturn {\n\t\tprovide: DI_HOST_CONTROL,\n\t\tuseExisting,\n\t};\n}\n\n/**\n * Injects host control. You can use it in the constructor of your `@Component` or `@Directive`.\n *\n * @param options - Options that can be used to configure injection.\n */\nexport function injectHostControl<T, C extends DIControl<T> = DIControl<T>>(): C;\nexport function injectHostControl<T, C extends DIControl<T> = DIControl<T>>(\n\toptions?: InjectOptions & {\n\t\toptional?: false;\n\t},\n): C;\nexport function injectHostControl<T, C extends DIControl<T> = DIControl<T>>(\n\toptions: InjectOptions,\n): C | null;\nexport function injectHostControl<T, C extends DIControl<T> = DIControl<T>>(\n\toptions?: InjectOptions & {\n\t\toptional?: boolean;\n\t},\n): C | null {\n\treturn options ? inject<C>(DI_HOST_CONTROL, options) : inject<C>(DI_HOST_CONTROL);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;MAGa,eAAe,GAAuC,IAAI,cAAc,CACpF,iBAAiB;AAGlB;;;;;;;;;;;;;;;;AAgBG;AACG,SAAU,kBAAkB,CAA2B,WAAoB,EAAA;IAChF,OAAO;AACN,QAAA,OAAO,EAAE,eAAe;QACxB,WAAW;KACX;AACF;AAgBM,SAAU,iBAAiB,CAChC,OAEC,EAAA;AAED,IAAA,OAAO,OAAO,GAAG,MAAM,CAAI,eAAe,EAAE,OAAO,CAAC,GAAG,MAAM,CAAI,eAAe,CAAC;AAClF;;ACnDA;;AAEG;;;;"}