import type { ShadowContainer } from './shadow' import type { I18nMessages } from '../i18n' // Phase-2 pet mode placeholder: not wired into the widget build and not part // of the public surface, so it stays unexported until the feature ships. class PetEntry { private el: HTMLDivElement private bubble: HTMLDivElement private onClick: () => void constructor( shadow: ShadowContainer, messages: I18nMessages, onClick: () => void, ) { this.onClick = onClick this.el = shadow.el('div', 'mtb-pet') this.el.innerHTML = this.buildSVG() this.el.setAttribute('role', 'button') this.el.setAttribute('aria-label', messages.tab) this.el.tabIndex = 0 this.bubble = shadow.el('div', 'mtb-pet-bubble') this.bubble.textContent = messages.pet.bubble this.el.appendChild(this.bubble) this.el.addEventListener('click', this.onClick) this.el.addEventListener('keydown', (e: KeyboardEvent) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault() this.onClick() } }) shadow.append(this.el) } private buildSVG(): string { return ` ` } setActive(active: boolean): void { this.el.classList.toggle('active', active) if (active) { this.bubble.classList.add('hidden') } } destroy(): void { this.el.removeEventListener('click', this.onClick) this.el.remove() } }