// #region Imports
import { noChange } from 'lit';
import { PartType, directive } from 'lit/directive.js';
import { RendererServiceLocator } from '../../../Dom/Renderer';
import { DirectiveBase } from '../Abstracts/DirectiveBase';
// #endregion
/**
 * @private
 */
class TypographyDirective extends DirectiveBase {
    // #region Fields
    _type;
    _themeName;
    // #endregion
    // #region Ctor
    /**
     * Constructs a new instance of the `TypographyDirective` class.
     *
     * @public
     */
    constructor(args) {
        super(args);
        if (args.type !== PartType.ELEMENT) {
            throw new Error('The `typography` directive can only be used on elements.');
        }
        this._type = undefined;
        this._themeName = undefined;
    }
    // #endregion
    /**
     * @public
     */
    render(type, themeName) {
        this._type = type;
        this._themeName = themeName;
        return noChange;
    }
    /**
     * @public
     * @override
     */
    update(part, [type, themeName]) {
        const element = part.element;
        const theme = themeName ?? document.documentElement.getAttribute('theme');
        if (!theme) {
            return;
        }
        if (type) {
            RendererServiceLocator.current.setStyle(element, 'font-family', `var(--${theme}-typography-${type}-font-family)`);
            RendererServiceLocator.current.setStyle(element, 'font-size', `var(--${theme}-typography-${type}-font-size)`);
            RendererServiceLocator.current.setStyle(element, 'line-height', `var(--${theme}-typography-${type}-line-height)`);
            RendererServiceLocator.current.setStyle(element, 'font-weight', `var(--${theme}-typography-${type}-font-weight)`);
            RendererServiceLocator.current.setStyle(element, 'letter-spacing', `var(--${theme}-typography-${type}-letter-spacing)`);
            RendererServiceLocator.current.setStyle(element, 'text-decoration', `var(--${theme}-typography-${type}-text-decoration)`);
            RendererServiceLocator.current.setStyle(element, 'text-transform', `var(--${theme}-typography-${type}-text-transform)`);
        }
        // eslint-disable-next-line @typescript-eslint/consistent-return
        return this.render(type);
    }
}
/**
 * @public
 */
export const typography = directive(TypographyDirective);
//# sourceMappingURL=TypographyDirective.js.map