{"version":3,"file":"registry.mjs","sourceRoot":"","sources":["../../../src/decorators/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAoB,MAAM,mBAAmB,CAAC;AAYtE,MAAM,mBAAmB,YAAqC,EAAE,MAAqB;IACpF,MAAM,CAAC,eAAe,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC9C,MAAM,CAAC,YAAY,CAAC,kBAAkB,EAAE;YACvC,EAAE,CAAC,CAAC,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACtC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YAC5C,CAAC;YAAC,IAAI,CAAC,CAAC;gBACP,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;oBAC1C,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;gBAChD,CAAC,CAAC,CAAC;YACJ,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC","sourcesContent":["import { handleDecorator, DecoratorHandler } from './handleDecorator';\nimport { RegistryItem } from '../Registry';\n\nexport interface RegistryConfig {\n\t[name: string]: RegistryItem;\n}\n\n/**\n * Decorator that can be used to register a widget with the calling widgets local registry\n */\nexport function registry(nameOrConfig: string, loader: RegistryItem): DecoratorHandler;\nexport function registry(nameOrConfig: RegistryConfig): DecoratorHandler;\nexport function registry(nameOrConfig: string | RegistryConfig, loader?: RegistryItem) {\n\treturn handleDecorator((target, propertyKey) => {\n\t\ttarget.addDecorator('afterConstructor', function(this: any) {\n\t\t\tif (typeof nameOrConfig === 'string') {\n\t\t\t\tthis.registry.define(nameOrConfig, loader);\n\t\t\t} else {\n\t\t\t\tObject.keys(nameOrConfig).forEach((name) => {\n\t\t\t\t\tthis.registry.define(name, nameOrConfig[name]);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t});\n}\n\nexport default registry;\n"]}