// #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 { CssLength } from '@breadstone/mosaik-themes';
import { RendererServiceLocator } from '../../../../Dom/Renderer';
import { Dimensionable } from '../../../Behaviors/Dimensionable';
import { Themeable } from '../../../Behaviors/Themeable';
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 { skeletonElementCosmopolitanStyle } from './Themes/SkeletonElement.Cosmopolitan';
import { skeletonElementJoyStyle } from './Themes/SkeletonElement.Joy';
import { skeletonElementMemphisStyle } from './Themes/SkeletonElement.Memphis';
/**
 * Skeleton - A placeholder element that mimics content structure during loading states.
 *
 * @description
 * The Skeleton component is a fundamental loading indicator that provides visual feedback while
 * content is being fetched or processed. It displays placeholder shapes that approximate the final
 * content layout, reducing perceived loading time and improving user experience by showing the
 * structure of upcoming content. The component supports multiple shape variants (rectangle, circle,
 * text) through the SkeletonShape enumeration, configurable dimensions via the Dimensionable behavior,
 * and an optional shimmer animation effect that creates a subtle sweeping highlight to indicate
 * loading activity. Skeleton screens are proven to reduce bounce rates and increase user engagement
 * during asynchronous operations.
 *
 * @name Skeleton
 * @element mosaik-skeleton
 * @category Primitives
 *
 * @csspart shimmer - The animated shimmer highlight overlay element
 *
 * @cssprop {String} --skeleton-background-color - The base background color of the skeleton placeholder
 * @cssprop {String} --skeleton-border-color - The border color of the skeleton placeholder
 * @cssprop {String} --skeleton-border-radius - The border radius for rounded skeleton shapes
 * @cssprop {String} --skeleton-border-style - The border style for the skeleton placeholder
 * @cssprop {String} --skeleton-border-width - The border width for the skeleton placeholder
 * @cssprop {String} --skeleton-foreground-color - The foreground color (typically unused but available)
 *
 * @example
 * Text line skeleton placeholder:
 * ```html
 * <mosaik-skeleton shape="text" width="200px" height="16px"></mosaik-skeleton>
 * ```
 *
 * @example
 * Avatar skeleton with shimmer animation:
 * ```html
 * <mosaik-skeleton shape="circle" width="48px" height="48px" shimmer></mosaik-skeleton>
 * ```
 *
 * @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,
            memphis: skeletonElementMemphisStyle,
            cosmopolitan: skeletonElementCosmopolitanStyle
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], SkeletonElement);
export { SkeletonElement };
//# sourceMappingURL=SkeletonElement.js.map