) {
super.firstUpdated(changedProperties);
this.dispatchEvent(
new CustomEvent('template-ready', {
detail: { template: 'base' },
bubbles: true,
composed: true,
})
);
}
/**
* Check if a slot has content
*/
private hasSlotContent(slotName: string): boolean {
return this.querySelector(`[slot="${slotName}"]`) !== null;
}
/**
* Render skip navigation
*/
private renderSkipNav() {
if (this.hasSlotContent('skipnav')) {
return html``;
}
return html` `;
}
/**
* Render government banner
*/
private renderBanner() {
if (!this.showBanner) {
return nothing;
}
if (this.hasSlotContent('banner')) {
return html``;
}
return html``;
}
/**
* Render identifier
*/
private renderIdentifier() {
if (!this.showIdentifier) {
return nothing;
}
if (this.hasSlotContent('identifier')) {
return html``;
}
// If no slotted content but we have agency info, render default identifier
if (this.agency || this.domain) {
return html`
`;
}
// Otherwise render placeholder identifier
return html``;
}
override render() {
return html`
${this.renderSkipNav()}
${this.renderBanner()}
${this.renderIdentifier()}
`;
}
/**
* Public API: Get main content element
*/
getMainContent(): HTMLElement | null {
return this.querySelector('#main-content');
}
/**
* Public API: Focus main content (for skip link)
*/
focusMainContent(): void {
const main = this.getMainContent();
if (main) {
main.setAttribute('tabindex', '-1');
main.focus();
}
}
}