// #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 { IntlController } from '../../../../Intl/IntlController';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { ButtonElement } from '../../Buttons/Button/ButtonElement';
import { DividerElement } from '../../Primitives/Divider/DividerElement';
import { TooltipElement } from '../../Primitives/Tooltip/TooltipElement';
import { RichTextBoxElementIntl } from './Intl/RichTextBoxElementIntl';
import { richTextBoxToolboxElementTemplate } from './RichTextBoxToolboxElementTemplate';
import { richTextBoxToolboxElementJoyStyle } from './Themes/RichTextBoxToolboxElement.Joy';
import { richTextBoxToolboxElementMemphisStyle } from './Themes/RichTextBoxToolboxElement.Memphis';
import { richTextBoxToolboxElementCosmopolitanStyle } from './Themes/RichTextBoxToolboxElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * Rich Text Box Toolbox - A formatting toolbar for rich text editing controls.
 *
 * @description
 * The Rich Text Box Toolbox component provides a collection of formatting buttons
 * for text editing operations within a rich text editor. It includes common text
 * formatting tools like bold, italic, strikethrough, and monospace/code formatting.
 * The toolbox is internationalized with tooltip labels and integrates seamlessly
 * with Rich Text Box editors through a connected editor reference. Each tool button
 * includes hover tooltips and executes formatting commands on the associated editor.
 * The component is organized into logical groups separated by dividers.
 *
 * @name Rich Text Box Toolbox
 * @element mosaik-richtextbox-toolbox
 * @category Inputs
 *
 * @csspart group - A logical grouping of related formatting buttons
 * @csspart divider - The vertical separator between tool groups
 *
 * @cssprop {String} --rich-text-box-toolbox-background-color - The background color of the toolbox
 * @cssprop {String} --rich-text-box-toolbox-foreground-color - The button icon/text color
 * @cssprop {String} --rich-text-box-toolbox-border-color - The border color
 * @cssprop {String} --rich-text-box-toolbox-border-width - The border thickness
 * @cssprop {String} --rich-text-box-toolbox-border-style - The border line style
 * @cssprop {String} --rich-text-box-toolbox-border-radius - The corner rounding radius
 * @cssprop {String} --rich-text-box-toolbox-gap - The spacing between tool groups
 * @cssprop {String} --rich-text-box-toolbox-padding-top - The top padding inside the toolbox
 * @cssprop {String} --rich-text-box-toolbox-padding-right - The right padding inside the toolbox
 * @cssprop {String} --rich-text-box-toolbox-padding-bottom - The bottom padding inside the toolbox
 * @cssprop {String} --rich-text-box-toolbox-padding-left - The left padding inside the toolbox
 * @cssprop {String} --rich-text-box-toolbox-shadow - The drop shadow or elevation effect
 *
 * @dependency {ButtonElement} - Button component for formatting action triggers
 * @dependency {TooltipElement} - Tooltip component for tool descriptions
 * @dependency {DividerElement} - Divider component for separating tool groups
 *
 * @example
 * Basic toolbox with editor reference:
 * ```html
 * <mosaik-richtextbox-toolbox .editor="${editorElement}"></mosaik-richtextbox-toolbox>
 * ```
 *
 * @example
 * Toolbox within a rich text editing layout:
 * ```html
 * <div class="editor-container">
 *   <mosaik-richtextbox-toolbox .editor="${editor}"></mosaik-richtextbox-toolbox>
 *   <mosaik-richtextbox id="editor"></mosaik-richtextbox>
 * </div>
 * <script>
 *   const editor = document.getElementById('editor');
 *   const toolbox = document.querySelector('mosaik-richtextbox-toolbox');
 *   toolbox.editor = editor;
 * </script>
 * ```
 *
 * @example
 * Standalone toolbox (editor connected later):
 * ```html
 * <mosaik-richtextbox-toolbox id="toolbox"></mosaik-richtextbox-toolbox>
 * ```
 *
 * @public
 */
let RichTextBoxToolboxElement = class RichTextBoxToolboxElement extends Themeable(CustomElement) {
    // #region Fields
    _intl;
    _editor;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._intl = new IntlController(this, {
            factory: () => new RichTextBoxElementIntl()
        });
        this._editor = null;
    }
    // #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-richtextbox-toolbox';
    }
    /**
     * Gets or sets the `editor` property.
     *
     * @public
     */
    get editor() {
        return this._editor;
    }
    set editor(value) {
        if (this._editor !== value) {
            this._editor = value;
            this.requestUpdate('editor');
        }
    }
    /**
     * Returns the `intl` property.
     *
     * @public
     * @readonly
     */
    get intl() {
        return this._intl.intl;
    }
    // #endregion
    // #region Methods
    /**
     * @internal
     * @template
     *
     * @param name - The toolbox action.
     */
    onAction(name) {
        switch (name) {
            case 'bold':
            case 'italic':
            case 'monospace':
            case 'strikethrough':
                console.debug(`[RichTextBoxToolboxComponent] Action ${name} was called.`);
                this._editor?.command(name);
                break;
        }
    }
};
__decorate([
    Property({ type: Object }),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [Object])
], RichTextBoxToolboxElement.prototype, "editor", null);
RichTextBoxToolboxElement = __decorate([
    Component({
        selector: 'mosaik-richtextbox-toolbox',
        template: richTextBoxToolboxElementTemplate,
        themes: {
            joy: richTextBoxToolboxElementJoyStyle,
            memphis: richTextBoxToolboxElementMemphisStyle,
            cosmopolitan: richTextBoxToolboxElementCosmopolitanStyle
        },
        imports: [
            ButtonElement,
            TooltipElement,
            DividerElement
        ]
    }),
    __metadata("design:paramtypes", [])
], RichTextBoxToolboxElement);
export { RichTextBoxToolboxElement };
//# sourceMappingURL=RichTextBoxToolboxElement.js.map