<commit_before>import { Injectable } from "@jable/inject";
import "reflect-metadata";
import { ComponentRegistry, StyleSymbol } from "./ComponentRegistry";

const paramTypes = "design:paramtypes";
const inject = Injectable({exclude: {HTMLElement: true, Element: true}})

export type IOptions = {
    selector: string;
    styles: string;
}

export function Component(options: IOptions) {
    return function(constructor: Function) {
        constructor = inject(constructor);

        var metadata = Reflect.getMetadata(paramTypes, constructor);

        var htmlElementIndex = -1;
        for (var i = 0; i < metadata.length; i++) {
            if (metadata[i] === Element || metadata[i] === HTMLElement) {
                htmlElementIndex = i;
                break;
            }
        }

        var newConstructor = function() {
            var elements: NodeListOf<Element> = document.getElementsByTagName(options.selector);
            
            var params: any[] = [];
            for (var i = 0; i < elements.length; i++) {<commit_msg>refactor: use query selector all<commit_after>import { Injectable } from "@jable/inject";
import "reflect-metadata";
import { ComponentRegistry, StyleSymbol } from "./ComponentRegistry";

const paramTypes = "design:paramtypes";
const inject = Injectable({exclude: {HTMLElement: true, Element: true}})

export type IOptions = {
    selector: string;
    styles: string;
}

export function Component(options: IOptions) {
    return function(constructor: Function) {
        constructor = inject(constructor);

        var metadata = Reflect.getMetadata(paramTypes, constructor);

        var htmlElementIndex = -1;
        for (var i = 0; i < metadata.length; i++) {
            if (metadata[i] === Element || metadata[i] === HTMLElement) {
                htmlElementIndex = i;
                break;
            }
        }

        var newConstructor = function() {
            var elements: NodeListOf<Element> = document.querySelectorAll(options.selector);
            
            var params: any[] = [];
            for (var i = 0; i < elements.length; i++) {
{'fraction_non_alphanumeric': 0.11973497397065783, 'fraction_numerical': 0.002839564600094652, 'mean_word_length': 2.63855421686747, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6976373', 'n_tokens_mistral': 564, 'n_tokens_neox': 552, 'n_words': 156}