// #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 { HTMLElementEventEmitter } from '@breadstone/mosaik-elements';
import { Emit } from '../../../../events/Decorators/EmitDecorator';
import { Disableable } from '../../../Behaviors/Disableable';
import { Insetable } from '../../../Behaviors/Insetable';
import { Themeable } from '../../../Behaviors/Themeable';
import { Component } from '../../../Decorators/ComponentDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { menuElementTemplate } from './MenuElementTemplate';
import { menuElementCosmopolitanStyle } from './Themes/MenuElement.Cosmopolitan';
import { menuElementJoyStyle } from './Themes/MenuElement.Joy';
import { menuElementMemphisStyle } from './Themes/MenuElement.Memphis';
// #endregion
/**
 * Menu - A vertical list container for presenting navigation options and actionable commands.
 *
 * Provides structured menu layouts with support for menu items, dividers, and hierarchical organization.
 * Handles selection states, keyboard navigation, and accessibility features. Essential for context menus,
 * navigation menus, and dropdown command lists.
 *
 * @name MenuElement
 * @element mosaik-menu
 * @category Selectors
 *
 * @csspart menu - The main menu container element
 * @csspart menu-list - Container for menu items and content
 *
 * @cssprop {Color} --menu-background-color - Background color of the menu container
 * @cssprop {Color} --menu-border-color - Border color around the menu
 * @cssprop {String} --menu-border-radius - Border radius for menu corners
 * @cssprop {String} --menu-padding - Internal padding of the menu
 * @cssprop {String} --menu-min-width - Minimum width constraint for the menu
 * @cssprop {String} --menu-max-height - Maximum height before scrolling
 * @cssprop {String} --menu-item-height - Standard height for menu items
 * @cssprop {Color} --menu-divider-color - Color of menu section dividers
 *
 * @example
 * ```html
 * <!-- Basic context menu -->
 * <mosaik-menu>
 *   <mosaik-menu-item>Cut</mosaik-menu-item>
 *   <mosaik-menu-item>Copy</mosaik-menu-item>
 *   <mosaik-menu-item>Paste</mosaik-menu-item>
 *   <mosaik-divider></mosaik-divider>
 *   <mosaik-menu-item disabled>Delete</mosaik-menu-item>
 * </mosaik-menu>
 *
 * <!-- Navigation menu with icons -->
 * <mosaik-menu>
 *   <mosaik-menu-item selected>
 *     <mosaik-icon slot="prefix" data="home"></mosaik-icon>
 *     Home
 *   </mosaik-menu-item>
 *   <mosaik-menu-item>
 *     <mosaik-icon slot="prefix" data="user"></mosaik-icon>
 *     Profile
 *   </mosaik-menu-item>
 *   <mosaik-menu-item>
 *     <mosaik-icon slot="prefix" data="settings"></mosaik-icon>
 *     Settings
 *   </mosaik-menu-item>
 * </mosaik-menu>
 *
 * <!-- Hierarchical menu with submenus -->
 * <mosaik-menu>
 *   <mosaik-menu-item>File</mosaik-menu-item>
 *   <mosaik-menu-item>
 *     Edit
 *     <mosaik-menu slot="submenu">
 *       <mosaik-menu-item>Undo</mosaik-menu-item>
 *       <mosaik-menu-item>Redo</mosaik-menu-item>
 *     </mosaik-menu>
 *   </mosaik-menu-item>
 *   <mosaik-menu-item>View</mosaik-menu-item>
 * </mosaik-menu>
 *
 * <!-- Context-style menu with popover submenus -->
 * <mosaik-menu>
 *   <mosaik-menu-item>File</mosaik-menu-item>
 *   <mosaik-menu-item menu-mode="popover">
 *     Edit
 *     <mosaik-menu slot="submenu">
 *       <mosaik-menu-item>Undo</mosaik-menu-item>
 *       <mosaik-menu-item>Redo</mosaik-menu-item>
 *     </mosaik-menu>
 *   </mosaik-menu-item>
 *   <mosaik-menu-item>View</mosaik-menu-item>
 * </mosaik-menu>
 * ```
 *
 * @fires activated {ActivatedEvent} - Emitted when a menu item is activated or selected
 *
 * @public
 */
let MenuElement = class MenuElement extends Themeable(Disableable(Insetable(CustomElement))) {
    // #region Fields
    _activated;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._activated = new HTMLElementEventEmitter(this, 'activated');
    }
    // #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-menu';
    }
    /**
     * Called when a menu item is activated.
     * Provides reference to `{@link IEventDetail}` as event detail.
     *
     * @public
     * @readonly
     * @eventProperty
     */
    get activated() {
        return this._activated;
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     * @template
     */
    onSlotChange(x) {
        const target = x.target;
        if (target.assignedElements().length === 0) {
            this.setAttribute('empty', '');
        }
        else {
            this.removeAttribute('empty');
        }
    }
};
__decorate([
    Emit({ eventName: 'activated' }),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [])
], MenuElement.prototype, "activated", null);
MenuElement = __decorate([
    Component({
        selector: 'mosaik-menu',
        template: menuElementTemplate,
        themes: {
            joy: menuElementJoyStyle,
            memphis: menuElementMemphisStyle,
            cosmopolitan: menuElementCosmopolitanStyle
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], MenuElement);
export { MenuElement };
//# sourceMappingURL=MenuElement.js.map