Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 1x 1x 1x 79x 1x 1x 5x 5x 5x 5x 5x 35x 35x 5x 35x 5x 1x | import { CustomElementMetadata, CustomElementPropertyMetadata, CustomElementStateMetadata } from "../interfaces";
const htmlElementProperties: Set<string> = new Set<string>();
const element = new HTMLElement();
for (const key in element) {
//if (Object.prototype.hasOwnProperty.call(object, key)) {
htmlElementProperties.add(key)
//}
}
/**
*
* @param Base Merges the metadata of the custom element
* @returns
*/
const MetadataMergerMixin = Base =>
class MetadataMerger extends Base {
static _metadata: CustomElementMetadata;
protected static get metadata(): CustomElementMetadata {
const properties = new Map<string, CustomElementPropertyMetadata>();
const state = new Map<string, CustomElementStateMetadata>();
const observedAttributes: string[] = [];
let ctor = this as any;
while (ctor !== HTMLElement) {
Iif (ctor.properties !== undefined) {
Object.values(ctor.properties).forEach((p: CustomElementPropertyMetadata) => {
properties.set(p.name, p);
observedAttributes.push(p.attribute.toLowerCase());
});
}
if (ctor.state !== undefined) {
Object.values(ctor.state).forEach((s: CustomElementStateMetadata) => state.set(s.name, s));
}
ctor = Object.getPrototypeOf(ctor.prototype).constructor;
}
return {
properties,
state,
observedAttributes,
htmlElementProperties
};
}
}
export default MetadataMergerMixin;
|