// #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 { Disableable } from '../../../Behaviors/Disableable';
import { Variantable } from '../../../Behaviors/Variantable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Watch } from '../../../Decorators/WatchDecorator';
import { TextAlignment } from '../../../Types/TextAlignment';
import { CustomElement } from '../../Abstracts/CustomElement';
import { numberCounterElementTemplate } from './NumberCounterElementTemplate';
import { numberCounterElementJoyStyle } from './Themes/NumberCounterElement.Joy';
import { numberCounterElementRetroStyle } from './Themes/NumberCounterElement.Retro';
import { numberCounterElementCosmopolitanStyle } from './Themes/NumberCounterElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
import { CssTime } from '@breadstone/mosaik-themes';
// #endregion
/**
 * Number - The number element is used to display a number.
 *
 * @description
 * TBD
 *
 * @element mosaik-number-counter
 * @category Display
 *
 * @slot number - The number slot.
 *
 * @example
 * ```html
 * <mosaik-number-counter from="0" to="100">
 * </mosaik-number-counter>
 * ```
 *
 * @public
 */
let NumberCounterElement = class NumberCounterElement extends Themeable(Variantable(Disableable(CustomElement))) {
    // #region Fieldss
    _from = 0;
    _to;
    _duration = '1s';
    _readonly;
    _alignment;
    // #endregion
    // #region Ctor
    /**
     * Constructs a new instance of the `NumberCounterElement` class.
     *
     * @public
     */
    constructor() {
        super();
        this._from = 0;
        this._to = 0;
        this._duration = '1s';
        this._readonly = false;
        this._alignment = TextAlignment.Left;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     *
     * @public
     * @static
     * @readonly
    */
    static get is() {
        return 'mosaik-number-counter';
    }
    /**
     * Gets or sets the `from` property.
     *
     * @public
     * @attr
     */
    get from() {
        return this._from;
    }
    set from(value) {
        if (this._from !== value) {
            this._from = value;
            this.requestUpdate('from');
        }
    }
    /**
     * Gets or sets the `to` property.
     *
     * @public
     * @attr
     */
    get to() {
        return this._to;
    }
    set to(value) {
        if (this._to !== value) {
            this._to = value;
            this.requestUpdate('to');
        }
    }
    /**
     * Gets or sets the `duration` property.
     *
     * @public
     * @attr
     */
    get duration() {
        return this._duration;
    }
    set duration(value) {
        if (this._duration !== value) {
            this._duration = value;
            this.requestUpdate('duration');
        }
    }
    /**
     * Gets or sets the `readonly` property.
     *
     * @public
     * @attr
     */
    get readonly() {
        return this._readonly;
    }
    set readonly(value) {
        if (this._readonly !== value) {
            this._readonly = value;
            this.requestUpdate('readonly');
        }
    }
    /**
     * Gets or sets the `alignment` property.
     *
     * Posible values are:
     * * `center`
     * * `justify`
     * * `left`
     * * `right`
     *
     * @public
     * @attr
     */
    get alignment() {
        return this._alignment;
    }
    set alignment(value) {
        if (this._alignment !== value) {
            this._alignment = value;
            this.requestUpdate('alignment');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     */
    onFromPropertyChanged(_prev, next) {
        if (next !== undefined) {
            RendererServiceLocator.current.setStyle(this, '--from', next.toString());
        }
    }
    /**
     * @protected
     */
    onToPropertyChanged(_prev, next) {
        if (next !== undefined) {
            RendererServiceLocator.current.setStyle(this, '--to', next.toString());
        }
    }
    /**
     * @protected
     */
    onDurationPropertyChanged(_prev, next) {
        if (next !== undefined) {
            RendererServiceLocator.current.setStyle(this, '--duration', next.toString());
        }
    }
};
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], NumberCounterElement.prototype, "from", null);
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], NumberCounterElement.prototype, "to", null);
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [Object])
], NumberCounterElement.prototype, "duration", null);
__decorate([
    Attribute({ type: Boolean, useDefault: true }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], NumberCounterElement.prototype, "readonly", null);
__decorate([
    Attribute({ type: TextAlignment }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], NumberCounterElement.prototype, "alignment", null);
__decorate([
    Watch('from'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", void 0)
], NumberCounterElement.prototype, "onFromPropertyChanged", null);
__decorate([
    Watch('to'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", void 0)
], NumberCounterElement.prototype, "onToPropertyChanged", null);
__decorate([
    Watch('duration'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", void 0)
], NumberCounterElement.prototype, "onDurationPropertyChanged", null);
NumberCounterElement = __decorate([
    Component({
        selector: 'mosaik-number-counter',
        template: numberCounterElementTemplate,
        themes: {
            joy: numberCounterElementJoyStyle,
            retro: numberCounterElementRetroStyle,
            cosmopolitan: numberCounterElementCosmopolitanStyle
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], NumberCounterElement);
export { NumberCounterElement };
//# sourceMappingURL=NumberCounterElement.js.map