// #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-font-family - The font family CSS custom property.
 * @cssprop {String} --sticky-font-letter-spacing - The font letter spacing CSS custom property.
 * @cssprop {String} --sticky-font-line-height - The font line height CSS custom property.
 * @cssprop {String} --sticky-font-size - The font size CSS custom property.
 * @cssprop {String} --sticky-font-text-decoration - The font text decoration CSS custom property.
 * @cssprop {String} --sticky-font-text-transform - The font text transform CSS custom property.
 * @cssprop {String} --sticky-font-weight - The font weight CSS custom property.
 * @cssprop {String} --sticky-gap - The gap CSS custom property.
 * @cssprop {String} --sticky-left - Left offset when sticky positioning is applied
 * @cssprop {String} --sticky-padding-bottom - The padding bottom CSS custom property.
 * @cssprop {String} --sticky-padding-left - The padding left CSS custom property.
 * @cssprop {String} --sticky-padding-right - The padding right CSS custom property.
 * @cssprop {String} --sticky-padding-top - The padding top CSS custom property.
 * @cssprop {String} --sticky-shadow - The shadow CSS custom property.
 * @cssprop {String} --sticky-shadow-blur - The shadow blur CSS custom property.
 * @cssprop {String} --sticky-shadow-color - The shadow color CSS custom property.
 * @cssprop {String} --sticky-shadow-offset-x - The shadow offset x CSS custom property.
 * @cssprop {String} --sticky-shadow-offset-y - The shadow offset y CSS custom property.
 * @cssprop {String} --sticky-shadow-spread - The shadow spread CSS custom property.
 * @cssprop {String} --sticky-top - Top offset when sticky positioning is applied
 * @cssprop {String} --sticky-transition-duration - The transition duration CSS custom property.
 * @cssprop {String} --sticky-transition-mode - The transition mode CSS custom property.
 * @cssprop {String} --sticky-transition-property - The transition property CSS custom property.
 * @cssprop {String} --sticky-translate - The translate CSS custom property.
 *
 * @example
 * Basic sticky header (top/left set via JavaScript):
 * ```html
 * <div class="page-content">
 *   <mosaik-sticky id="stickyHeader">
 *     <header class="site-header">
 *       <h1>My Site</h1>
 *       <nav>...</nav>
 *     </header>
 *   </mosaik-sticky>
 *   <main>
 *     <!-- Long scrollable content -->
 *   </main>
 * </div>
 * <script>
 *   document.querySelector('#stickyHeader').top = '0px';
 * </script>
 * ```
 *
 * @example
 * Sticky sidebar navigation:
 * ```html
 * <div class="layout">
 *   <aside class="sidebar">
 *     <mosaik-sticky id="stickySidebar">
 *       <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>
 * <script>
 *   document.querySelector('#stickySidebar').top = '80px';
 * </script>
 * ```
 *
 * @example
 * Programmatic offset adjustment:
 * ```html
 * <mosaik-sticky id="stickyNav">
 *   <nav>Navigation</nav>
 * </mosaik-sticky>
 * <script>
 *   const stickyNav = document.getElementById('stickyNav');
 *   stickyNav.top = '0px';
 *   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 `is` property.
     * The `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