// #region Imports
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Themeable } from '../../../../Controls/Behaviors/Themeable';
import { DomServiceLocator } from '../../../../Dom/Dom';
import { TextFormattable } from '../../../Behaviors/TextFormattable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { ContentElement } from '../../Primitives/Content/ContentElement';
import { TextElement } from '../../Primitives/Text/TextElement';
import { cardSubTitleElementTemplate } from './CardSubTitleElementTemplate';
import { cardSubTitleElementCosmopolitanStyle } from './Themes/CardSubTitleElement.Cosmopolitan';
import { cardSubTitleElementJoyStyle } from './Themes/CardSubTitleElement.Joy';
import { cardSubTitleElementMemphisStyle } from './Themes/CardSubTitleElement.Memphis';
// #endregion
/**
 * Card Sub Title - A component that represents the subtitle section of a card.
 *
 * @description This component is used to display the subtitle of a card, typically styled to differentiate it from the title and other content. It provides additional context or description for the card's main title.
 *
 * @name CardSubTitle
 * @element mosaik-card-sub-title
 * @category UI Components
 *
 * @slot - The default slot for placing the subtitle content.
 *
 * @cssprop {Color} --card-sub-title-background-color - The background-color property for the card subtitle.
 * @cssprop {Color} --card-sub-title-border-color - The border-color property for the card subtitle.
 * @cssprop {String} --card-sub-title-font-family - The font-family property for the card subtitle text.
 * @cssprop {String} --card-sub-title-font-letter-spacing - The letter-spacing property for the card subtitle text.
 * @cssprop {String} --card-sub-title-font-line-height - The line-height property for the card subtitle text.
 * @cssprop {String} --card-sub-title-font-size - The font-size property for the card subtitle text.
 * @cssprop {String} --card-sub-title-font-text-decoration - The text-decoration property for the card subtitle text.
 * @cssprop {String} --card-sub-title-font-text-transform - The text-transform property for the card subtitle text.
 * @cssprop {String} --card-sub-title-font-weight - The font-weight property for the card subtitle text.
 * @cssprop {Color} --card-sub-title-foreground-color - The foreground-color property for the card subtitle.
 * @cssprop {String} --card-sub-title-gap - The sub title gap CSS custom property.
 * @cssprop {String} --card-sub-title-padding-bottom - The sub title padding bottom CSS custom property.
 * @cssprop {String} --card-sub-title-padding-left - The sub title padding left CSS custom property.
 * @cssprop {String} --card-sub-title-padding-right - The sub title padding right CSS custom property.
 * @cssprop {String} --card-sub-title-padding-top - The sub title padding top CSS custom property.
 * @cssprop {String} --card-sub-title-shadow - The sub title shadow CSS custom property.
 * @cssprop {String} --card-sub-title-shadow-blur - The sub title shadow blur CSS custom property.
 * @cssprop {String} --card-sub-title-shadow-color - The sub title shadow color CSS custom property.
 * @cssprop {String} --card-sub-title-shadow-offset-x - The sub title shadow offset x CSS custom property.
 * @cssprop {String} --card-sub-title-shadow-offset-y - The sub title shadow offset y CSS custom property.
 * @cssprop {String} --card-sub-title-shadow-spread - The sub title shadow spread CSS custom property.
 * @cssprop {String} --card-sub-title-transition-duration - The sub title transition duration CSS custom property.
 * @cssprop {String} --card-sub-title-transition-mode - The sub title transition mode CSS custom property.
 * @cssprop {String} --card-sub-title-transition-property - The sub title transition property CSS custom property.
 * @cssprop {String} --card-sub-title-translate - The sub title translate CSS custom property.
 *
 * @dependency mosaik-text - The Text element.
 *
 * @example
 * Using text attribute:
 * ```html
 * <mosaik-card-sub-title text="Premium Edition"></mosaik-card-sub-title>
 * ```
 *
 * @example
 * Using default slot with text content:
 * ```html
 * <mosaik-card-sub-title>Premium Edition</mosaik-card-sub-title>
 * ```
 *
 * @public
 */
let CardSubTitleElement = class CardSubTitleElement extends Themeable(TextFormattable(ContentElement)) {
    // #region Fields
    _text;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._text = '';
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     *
     * @public
     * @static
     * @override
     * @readonly
    */
    static get is() {
        return 'mosaik-card-sub-title';
    }
    /**
     * Gets or sets the `text` property.
     *
     * @public
     * @attr
     */
    get text() {
        return this._text;
    }
    set text(value) {
        if (this._text !== value) {
            this._text = value;
            this.requestUpdate('text');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     * @override
     */
    onApplyTemplate() {
        super.onApplyTemplate();
        // TODO: create any kind of obsevation here
        const card = DomServiceLocator.current.findShadowDomHost(this, { strict: true });
        if (this._text === '' && card.text !== '') {
            this.text = card.text;
        }
        if (this.formatter === null && card.formatter !== null) {
            this.formatter = card.formatter;
        }
    }
};
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], CardSubTitleElement.prototype, "text", null);
CardSubTitleElement = __decorate([
    Component({
        selector: 'mosaik-card-sub-title',
        template: cardSubTitleElementTemplate,
        themes: {
            joy: cardSubTitleElementJoyStyle,
            memphis: cardSubTitleElementMemphisStyle,
            cosmopolitan: cardSubTitleElementCosmopolitanStyle
        },
        host: {
            slot: 'subHeader'
        },
        imports: [TextElement]
    }),
    __metadata("design:paramtypes", [])
], CardSubTitleElement);
export { CardSubTitleElement };
//# sourceMappingURL=CardSubTitleElement.js.map