// #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 { RendererServiceLocator } from '../../../../Dom/Renderer';
import { CssLength } from '@breadstone/mosaik-themes';
import { Dimensionable } from '../../../Behaviors/Dimensionable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Watch } from '../../../Decorators/WatchDecorator';
import { SkeletonShape } from '../../../Types/SkeletonShape';
import { CustomElement } from '../../Abstracts/CustomElement';
import { skeletonElementTemplate } from './SkeletonElementTemplate';
import { skeletonElementJoyStyle } from './Themes/SkeletonElement.Joy';
import { skeletonElementRetroStyle } from './Themes/SkeletonElement.Retro';
import { skeletonElementCosmopolitanStyle } from './Themes/SkeletonElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
/**
 * Skeleton - A placeholder element that mimics content structure during loading states.
 *
 * Provides visual feedback while content loads by displaying placeholder shapes that approximate
 * the final content layout. Reduces perceived loading time and improves user experience.
 * Supports various shapes (rectangle, circle, text) with optional shimmer animation.
 *
 * @name SkeletonElement
 * @element mosaik-skeleton
 * @category Primitive
 *
 * @csspart skeleton - The main skeleton placeholder element
 *
 * @cssprop --skeleton-color - Background color of the skeleton placeholder
 * @cssprop --skeleton-highlight-color - Color of the shimmer highlight animation
 * @cssprop --skeleton-animation-duration - Duration of the shimmer animation cycle
 * @cssprop --skeleton-border-radius - Border radius for rounded skeleton shapes
 *
 * @example
 * ```html
 * <!-- Text line skeleton -->
 * <mosaik-skeleton shape="text" width="200px" height="16px"></mosaik-skeleton>
 *
 * <!-- Avatar skeleton with shimmer -->
 * <mosaik-skeleton shape="circle" width="40px" height="40px" shimmer></mosaik-skeleton>
 *
 * <!-- Card skeleton -->
 * <mosaik-skeleton shape="rect" width="300px" height="200px" shimmer></mosaik-skeleton>
 *
 * <!-- Loading article layout -->
 * <div class="article-skeleton">
 *   <mosaik-skeleton shape="rect" width="100%" height="200px" shimmer></mosaik-skeleton>
 *   <mosaik-skeleton shape="text" width="80%" height="24px"></mosaik-skeleton>
 *   <mosaik-skeleton shape="text" width="60%" height="16px"></mosaik-skeleton>
 *   <mosaik-skeleton shape="text" width="90%" height="16px"></mosaik-skeleton>
 * </div>
 * ```
 *
 * @public
 */
let SkeletonElement = class SkeletonElement extends Themeable(Dimensionable(CustomElement)) {
    // #region Fields
    _shape;
    _shimmer;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._shape = SkeletonShape.rect;
        this._shimmer = false;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `{@link is}` property.
     * The `{@link is}` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-skeleton';
    }
    target;
    /**
     * Gets or sets the `shape` property.
     *
     * @public
     * @attr
     */
    get shape() {
        return this._shape;
    }
    set shape(value) {
        if (this._shape !== value) {
            this._shape = value;
            this.requestUpdate('shape');
        }
    }
    /**
     * Gets or sets the `shimmer` property.
     *
     * @public
     * @attr
     */
    get shimmer() {
        return this._shimmer;
    }
    set shimmer(value) {
        if (this._shimmer !== value) {
            this._shimmer = value;
            this.requestUpdate('shimmer');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     */
    onWidthPropertyChanged(prev, next) {
        RendererServiceLocator.current.setStyle(this, 'min-width', next);
        RendererServiceLocator.current.setStyle(this, 'width', next);
    }
    /**
     * @protected
     */
    onHeightPropertyChanged(prev, next) {
        RendererServiceLocator.current.setStyle(this, 'min-height', next);
        RendererServiceLocator.current.setStyle(this, 'height', next);
    }
};
__decorate([
    Attribute({ type: SkeletonShape }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], SkeletonElement.prototype, "shape", null);
__decorate([
    Attribute({ type: Boolean,
        useDefault: true }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], SkeletonElement.prototype, "shimmer", null);
__decorate([
    Watch('width'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", void 0)
], SkeletonElement.prototype, "onWidthPropertyChanged", null);
__decorate([
    Watch('height'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", void 0)
], SkeletonElement.prototype, "onHeightPropertyChanged", null);
SkeletonElement = __decorate([
    Component({
        selector: 'mosaik-skeleton',
        template: skeletonElementTemplate,
        themes: {
            joy: skeletonElementJoyStyle,
            retro: skeletonElementRetroStyle,
            cosmopolitan: skeletonElementCosmopolitanStyle
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], SkeletonElement);
export { SkeletonElement };
//# sourceMappingURL=SkeletonElement.js.map