// #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 { CssLength } from '@breadstone/mosaik-themes';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { Watch } from '../../../Decorators/WatchDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { stickyElementTemplate } from './StickyElementTemplate';
import { stickyElementJoyStyle } from './Themes/StickyElement.Joy';
import { stickyElementMemphisStyle } from './Themes/StickyElement.Memphis';
import { stickyElementCosmopolitanStyle } from './Themes/StickyElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * Sticky - A container that maintains fixed positioning within the viewport during scrolling.
 *
 * @description
 * The Sticky element provides CSS sticky positioning behavior with configurable top and left offsets.
 * Content inside this element will "stick" to its specified position when the user scrolls past it,
 * remaining fixed within its containing block until the container's edge is reached. Commonly used
 * for sticky headers, navigation bars, floating action buttons, and persistent UI elements that
 * should remain accessible during page scrolling.
 *
 * @name Sticky
 * @element mosaik-sticky
 * @category Primitives
 *
 * @slot - Default slot for content that should exhibit sticky positioning
 *
 * @cssprop {String} --sticky-left - Left offset when sticky positioning is applied
 * @cssprop {String} --sticky-top - Top offset when sticky positioning is applied
 *
 * @example
 * Basic sticky header:
 * ```html
 * <div class="page-content">
 *   <mosaik-sticky top="0px">
 *     <header class="site-header">
 *       <h1>My Site</h1>
 *       <nav>...</nav>
 *     </header>
 *   </mosaik-sticky>
 *   <main>
 *     <!-- Long scrollable content -->
 *   </main>
 * </div>
 * ```
 *
 * @example
 * Sticky sidebar navigation:
 * ```html
 * <div class="layout">
 *   <aside class="sidebar">
 *     <mosaik-sticky top="80px">
 *       <nav class="side-nav">
 *         <a href="#section1">Section 1</a>
 *         <a href="#section2">Section 2</a>
 *         <a href="#section3">Section 3</a>
 *       </nav>
 *     </mosaik-sticky>
 *   </aside>
 *   <main>...</main>
 * </div>
 * ```
 *
 * @example
 * Floating action button with custom offset:
 * ```html
 * <mosaik-sticky top="auto" left="calc(100% - 80px)">
 *   <button class="fab">
 *     <mosaik-icon data="add-icon"></mosaik-icon>
 *   </button>
 * </mosaik-sticky>
 * ```
 *
 * @example
 * Programmatic offset adjustment:
 * ```html
 * <mosaik-sticky id="stickyNav" top="0px">
 *   <nav>Navigation</nav>
 * </mosaik-sticky>
 *
 * <script>
 *   const stickyNav = document.getElementById('stickyNav');
 *
 *   // Adjust offset when another sticky element appears
 *   window.addEventListener('resize', () => {
 *     const headerHeight = document.querySelector('.top-banner')?.offsetHeight || 0;
 *     stickyNav.top = `${headerHeight}px`;
 *   });
 * </script>
 * ```
 *
 * @public
 */
let StickyElement = class StickyElement extends Themeable(CustomElement) {
    // #region Fields
    // private readonly _stickyController: StickyController;
    _top;
    _left;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._top = '0px';
        this._left = '0px';
        // this._stickyController = new StickyController(this, {
        //     top: this._top,
        //     left: this._left
        // });
    }
    // #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-sticky';
    }
    /**
     * Gets or sets the `top` property.
     *
     * @public
     */
    get top() {
        return this._top;
    }
    set top(value) {
        if (this._top !== value) {
            this._top = value;
            this.requestUpdate('top');
        }
    }
    /**
     * Gets or sets the `left` property.
     *
     * @public
     */
    get left() {
        return this._left;
    }
    set left(value) {
        if (this._left !== value) {
            this._left = value;
            this.requestUpdate('left');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @public
     * @override
     */
    connectedCallback() {
        super.connectedCallback();
        // this._stickyController.hostConnected();
    }
    /**
     * @public
     * @override
     */
    disconnectedCallback() {
        // this._stickyController.hostDisconnected();
        super.disconnectedCallback();
    }
    /**
     * @protected
     */
    onTopPropertyChanged(prev, next) {
        if (prev !== next) {
            RendererServiceLocator.current.setStyle(this, '--sticky-top', next);
        }
    }
    /**
     * @protected
     */
    onLeftPropertyChanged(prev, next) {
        if (prev !== next) {
            RendererServiceLocator.current.setStyle(this, '--sticky-left', next);
        }
    }
};
__decorate([
    Property({ type: String }),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [Object])
], StickyElement.prototype, "top", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [Object])
], StickyElement.prototype, "left", null);
__decorate([
    Watch('top'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", void 0)
], StickyElement.prototype, "onTopPropertyChanged", null);
__decorate([
    Watch('left'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", void 0)
], StickyElement.prototype, "onLeftPropertyChanged", null);
StickyElement = __decorate([
    Component({
        selector: 'mosaik-sticky',
        template: stickyElementTemplate,
        themes: {
            joy: stickyElementJoyStyle,
            memphis: stickyElementMemphisStyle,
            cosmopolitan: stickyElementCosmopolitanStyle
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], StickyElement);
export { StickyElement };
//# sourceMappingURL=StickyElement.js.map