Sha256: 1a5f4580676d6b3e9e3a6dd907e3f3ad91d154d876a868a86b4ce0bcda866449
Contents?: true
Size: 973 Bytes
Versions: 28
Compression:
Stored size: 973 Bytes
Contents
import {controller, target} from '@github/catalyst' declare global { interface HTMLElementEventMap { 'banner:dismiss': CustomEvent<void> } } @controller class XBannerElement extends HTMLElement { @target titleText: HTMLElement dismiss() { if (this.#dismissScheme === 'remove') { const parentElement = this.parentElement if (!parentElement) return parentElement.removeChild(this) } else { this.hide() } this.dispatchEvent(new CustomEvent('banner:dismiss')) } show() { this.style.setProperty('display', 'initial') } hide() { this.style.setProperty('display', 'none') } get #dismissScheme(): string { return this.getAttribute('data-dismiss-scheme')! } } declare global { interface Window { XBannerElement: typeof XBannerElement } } if (!window.customElements.get('x-banner')) { window.XBannerElement = XBannerElement window.customElements.define('x-banner', XBannerElement) }
Version data entries
28 entries across 28 versions & 2 rubygems