import { h } from "@stencil/core";
/**
 * ConfigProvider 全局配置组件
 * 在组件树的最外层设置全局配置
 */
export class ConfigProvider {
    el;
    /** 主题：light / dark / 自定义 */
    theme = 'light';
    /** 全局默认尺寸 */
    size = 'default';
    /** 语言 */
    locale = 'zh-CN';
    render() {
        return h("slot", { key: '2f5645093f96615556fea763173dc339b8dfb515' });
    }
    componentDidLoad() {
        this.applyConfig();
    }
    componentDidUpdate() {
        this.applyConfig();
    }
    applyConfig() {
        // 主题：light / dark（自定义主题由消费者通过 CSS 变量设置）
        if (this.theme === 'dark') {
            this.el.setAttribute('data-theme', 'dark');
        }
        else if (this.theme === 'light') {
            this.el.removeAttribute('data-theme');
        }
        // 全局尺寸：写入 data-size，子组件或全局 CSS 可通过 [data-size] 消费
        this.el.setAttribute('data-size', this.size);
        // 语言：写入 data-locale（i18n 文案接入为后续工作，当前先透出配置）
        this.el.setAttribute('data-locale', this.locale);
    }
    static get is() { return "hb-config-provider"; }
    static get properties() {
        return {
            "theme": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'light' | 'dark' | string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "\u4E3B\u9898\uFF1Alight / dark / \u81EA\u5B9A\u4E49"
                },
                "getter": false,
                "setter": false,
                "attribute": "theme",
                "reflect": false,
                "defaultValue": "'light'"
            },
            "size": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'small' | 'default' | 'large'",
                    "resolved": "\"default\" | \"large\" | \"small\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "\u5168\u5C40\u9ED8\u8BA4\u5C3A\u5BF8"
                },
                "getter": false,
                "setter": false,
                "attribute": "size",
                "reflect": false,
                "defaultValue": "'default'"
            },
            "locale": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "\u8BED\u8A00"
                },
                "getter": false,
                "setter": false,
                "attribute": "locale",
                "reflect": false,
                "defaultValue": "'zh-CN'"
            }
        };
    }
    static get elementRef() { return "el"; }
}
//# sourceMappingURL=ConfigProvider.js.map
