"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const namespaceURI_1 = require("../../../../../client/component/namespaceURI");
const element_1 = require("../../../../../client/element");
const style_1 = require("../../../../../client/style");
const DEFAULT_STYLE = {
    fill: 'currentColor',
};
class SVGRect extends element_1.Element {
    constructor($props, $system) {
        super($props, $system);
        const { className, style = {}, x = 0, y = 0, rx = 0, ry = 0, width = 100, height = 100, } = $props;
        const rect_el = this.$system.api.document.createElementNS(namespaceURI_1.namespaceURI, 'rect');
        if (className !== undefined) {
            rect_el.classList.value = className;
        }
        (0, style_1.applyStyle)(rect_el, Object.assign(Object.assign({}, DEFAULT_STYLE), style));
        rect_el.setAttribute('x', `${x}`);
        rect_el.setAttribute('y', `${y}`);
        rect_el.setAttribute('rx', `${rx}`);
        rect_el.setAttribute('ry', `${ry}`);
        rect_el.setAttribute('width', `${width}`);
        rect_el.setAttribute('height', `${height}`);
        this._rect_el = rect_el;
        this.$element = rect_el;
    }
    onPropChanged(prop, current) {
        if (prop === 'className') {
            this._rect_el.className.value = current;
        }
        else if (prop === 'style') {
            (0, style_1.applyStyle)(this._rect_el, Object.assign(Object.assign({}, DEFAULT_STYLE), current));
        }
        else if (prop === 'x' ||
            prop === 'y' ||
            prop === 'rx' ||
            prop === 'ry' ||
            prop === 'width' ||
            prop === 'height') {
            this._rect_el.setAttribute(prop, `${current}`);
        }
    }
}
exports.default = SVGRect;
//# sourceMappingURL=Component.js.map