// #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 { Disableable } from '../../../Behaviors/Disableable';
import { Themeable } from '../../../Behaviors/Themeable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { colorThumbElementTemplate } from './ColorThumbElementTemplate';
import { colorThumbElementCosmopolitanStyle } from './Themes/ColorThumbElement.Cosmopolitan';
import { colorThumbElementJoyStyle } from './Themes/ColorThumbElement.Joy';
import { colorThumbElementMemphisStyle } from './Themes/ColorThumbElement.Memphis';
// #endregion
/**
 * Color Thumb - A user interface component used for selecting or adjusting colors.
 *
 * @description
 * The Color Thumb component is designed to enable users to interact with and modify colors in various applications.
 * It typically appears as a draggable or clickable element that can be used to select a color from a palette, adjust
 * color values, or perform color-related actions. Color thumbs are commonly found in color pickers, design tools,
 * and applications where color customization is essential.
 *
 * @element mosaik-color-thumb
 * @category Media
 *
 * @csspart inner - The inner part.
 *
 * @cssprop {String} --color-thumb-background-color - The thumb background color CSS custom property.
 * @cssprop {String} --color-thumb-border-color - The thumb border color CSS custom property.
 * @cssprop {String} --color-thumb-border-radius - The thumb border radius CSS custom property.
 * @cssprop {String} --color-thumb-border-style - The thumb border style CSS custom property.
 * @cssprop {String} --color-thumb-border-width - The thumb border width CSS custom property.
 * @cssprop {String} --color-thumb-font-family - The thumb font family CSS custom property.
 * @cssprop {String} --color-thumb-font-letter-spacing - The thumb font letter spacing CSS custom property.
 * @cssprop {String} --color-thumb-font-line-height - The thumb font line height CSS custom property.
 * @cssprop {String} --color-thumb-font-size - The thumb font size CSS custom property.
 * @cssprop {String} --color-thumb-font-text-decoration - The thumb font text decoration CSS custom property.
 * @cssprop {String} --color-thumb-font-text-transform - The thumb font text transform CSS custom property.
 * @cssprop {String} --color-thumb-font-weight - The thumb font weight CSS custom property.
 * @cssprop {String} --color-thumb-foreground-color - The thumb foreground color CSS custom property.
 * @cssprop {String} --color-thumb-gap - The thumb gap CSS custom property.
 * @cssprop {String} --color-thumb-padding-bottom - The thumb padding bottom CSS custom property.
 * @cssprop {String} --color-thumb-padding-left - The thumb padding left CSS custom property.
 * @cssprop {String} --color-thumb-padding-right - The thumb padding right CSS custom property.
 * @cssprop {String} --color-thumb-padding-top - The thumb padding top CSS custom property.
 * @cssprop {String} --color-thumb-shadow - The thumb shadow CSS custom property.
 * @cssprop {String} --color-thumb-shadow-blur - The thumb shadow blur CSS custom property.
 * @cssprop {String} --color-thumb-shadow-color - The thumb shadow color CSS custom property.
 * @cssprop {String} --color-thumb-shadow-offset-x - The thumb shadow offset x CSS custom property.
 * @cssprop {String} --color-thumb-shadow-offset-y - The thumb shadow offset y CSS custom property.
 * @cssprop {String} --color-thumb-shadow-spread - The thumb shadow spread CSS custom property.
 * @cssprop {String} --color-thumb-size - The thumb size CSS custom property.
 * @cssprop {String} --color-thumb-transition-duration - The thumb transition duration CSS custom property.
 * @cssprop {String} --color-thumb-transition-mode - The thumb transition mode CSS custom property.
 * @cssprop {String} --color-thumb-transition-property - The thumb transition property CSS custom property.
 * @cssprop {String} --color-thumb-translate - The thumb translate CSS custom property.
 *
 * @example
 * Basic usage with a color:
 * ```html
 * <mosaik-color-thumb color="#e91e63"></mosaik-color-thumb>
 * ```
 *
 * @example
 * Open state (tooltip visible):
 * ```html
 * <mosaik-color-thumb color="#1976d2" is-open></mosaik-color-thumb>
 * ```
 *
 * @example
 * Disabled state:
 * ```html
 * <mosaik-color-thumb color="#388e3c" disabled></mosaik-color-thumb>
 * ```
 *
 * @public
 */
let ColorThumbElement = class ColorThumbElement extends Themeable(Disableable(CustomElement)) {
    // #region Fields
    _color;
    _isOpen;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._color = '';
        this._isOpen = false;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     * The `is` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-color-thumb';
    }
    /**
     * Gets or sets the `color` property.
     *
     * @public
     * @attr
     */
    get color() {
        return this._color;
    }
    set color(value) {
        if (this._color !== value) {
            this._color = value;
            this.requestUpdate('color');
        }
    }
    /**
     * Gets or sets the `isOpen` property.
     *
     * @public
     * @attr
     */
    get isOpen() {
        return this._isOpen;
    }
    set isOpen(value) {
        if (this._isOpen !== value) {
            this._isOpen = value;
            this.requestUpdate('isOpen');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     * @overload
     */
    onApplyTemplate() {
        super.onApplyTemplate();
        this.on('pointerdown', (e) => this.handlePointerdown(e));
        this.on('pointerup', (e) => this.handlePointerup(e));
        this.on('pointercancel', (e) => this.handlePointerup(e));
    }
    /**
     * @private
     */
    handlePointerdown(event) {
        if (event.pointerType === 'touch') {
            this.isOpen = true;
        }
        this.setPointerCapture(event.pointerId);
    }
    /**
     * @private
     */
    handlePointerup(event) {
        this.isOpen = false;
        this.releasePointerCapture(event.pointerId);
    }
};
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ColorThumbElement.prototype, "color", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], ColorThumbElement.prototype, "isOpen", null);
ColorThumbElement = __decorate([
    Component({
        selector: 'mosaik-color-thumb',
        template: colorThumbElementTemplate,
        themes: {
            joy: colorThumbElementJoyStyle,
            memphis: colorThumbElementMemphisStyle,
            cosmopolitan: colorThumbElementCosmopolitanStyle
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], ColorThumbElement);
export { ColorThumbElement };
//# sourceMappingURL=ColorThumbElement.js.map