/**  
 * @since Last modified: 2023-11-20 17:54:44
 * @class CustomElement
 * @description The father of all custom elements.
 * @example
 * class xxxElement extends CustomElement;
 */
import Observe from '../modules/Observe';
import attrJoinValue from '../utils/attrJoinValue';
import extend from '../utils/extend';
import strToJson from '../utils/strToJson';
class CustomElement extends HTMLElement {
    shadowDOM: any;
    slotDom: any;
    wrapperDom: any;
    instance: any;
    props: T_obj;
    observer: any;
    constructor() {
        super();
    }
    createObserver() {
        this.props = {};
        this.observer = new Observe(this.props);
        this.observer.ins.on('complete', () => {
            this.instance.update(this.props);
        });
    }
    updateProxy(name: string, newVal: string, map: any) {
        let value: any;
        if (newVal === null) {
            delete this.observer.proxy[name];
        } else {
            if (name === 'options') {
                value = strToJson(newVal);
            } else {
                value = attrJoinValue(name, newVal, map);
            }
            extend(this.observer.proxy, value, { arrAppend: true })
        }
    }
}
window.customElements.define("ax-custom", CustomElement);
export default CustomElement;
