{"version":3,"file":"customElement.mjs","sourceRoot":"","sources":["../../../src/decorators/customElement.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,QAAQ,MAAM,aAAa,CAAC;AAiCnC;;;GAGG;AACH,MAAM,wBAAqE,EAC1E,GAAG,EACH,UAAU,GAAG,EAAE,EACf,UAAU,GAAG,EAAE,EACf,MAAM,GAAG,EAAE,EACX,SAAS,GAAG,sBAAsB,CAAC,IAAI,EACvC,eAAe,GAAG,GAAG,EAAE,CAAC,IAAI,QAAQ,EAAE,EACd;IACxB,MAAM,CAAC,UAAqC,MAAS;QACpD,MAAM,CAAC,SAAS,CAAC,yBAAyB,GAAG;YAC5C,OAAO,EAAE,GAAG;YACZ,UAAU;YACV,UAAU;YACV,MAAM;YACN,SAAS;YACT,eAAe;SACf,CAAC;IACH,CAAC,CAAC;AACH,CAAC;AAED,eAAe,aAAa,CAAC","sourcesContent":["import { Constructor, WidgetProperties } from '../interfaces';\nimport { CustomElementChildType } from '../registerCustomElement';\nimport Registry from '../Registry';\n\nexport type CustomElementPropertyNames<P extends object> = ((keyof P) | (keyof WidgetProperties))[];\n\n/**\n * Defines the custom element configuration used by the customElement decorator\n */\nexport interface CustomElementConfig<P extends object = { [index: string]: any }> {\n\t/**\n\t * The tag of the custom element\n\t */\n\ttag: string;\n\n\t/**\n\t * List of widget properties to expose as properties on the custom element\n\t */\n\tproperties?: CustomElementPropertyNames<P>;\n\n\t/**\n\t * List of attributes on the custom element to map to widget properties\n\t */\n\tattributes?: CustomElementPropertyNames<P>;\n\n\t/**\n\t * List of events to expose\n\t */\n\tevents?: CustomElementPropertyNames<P>;\n\n\tchildType?: CustomElementChildType;\n\n\tregistryFactory?: () => Registry;\n}\n\n/**\n * This Decorator is provided properties that define the behavior of a custom element, and\n * registers that custom element.\n */\nexport function customElement<P extends object = { [index: string]: any }>({\n\ttag,\n\tproperties = [],\n\tattributes = [],\n\tevents = [],\n\tchildType = CustomElementChildType.DOJO,\n\tregistryFactory = () => new Registry()\n}: CustomElementConfig<P>) {\n\treturn function<T extends Constructor<any>>(target: T) {\n\t\ttarget.prototype.__customElementDescriptor = {\n\t\t\ttagName: tag,\n\t\t\tattributes,\n\t\t\tproperties,\n\t\t\tevents,\n\t\t\tchildType,\n\t\t\tregistryFactory\n\t\t};\n\t};\n}\n\nexport default customElement;\n"]}