import * as i0 from '@angular/core'; import { EnvironmentProviders, InjectionToken } from '@angular/core'; /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** Open Graph (`og:*`) tag values. */ interface WrMetaOg { readonly title?: string; readonly description?: string; readonly image?: string; readonly url?: string; readonly type?: string; readonly siteName?: string; } /** Twitter card (`twitter:*`) tag values. */ interface WrMetaTwitter { readonly card?: 'summary' | 'summary_large_image' | 'app' | 'player'; readonly title?: string; readonly description?: string; readonly image?: string; readonly creator?: string; } /** * Declarative description of `
` metadata. Every field is optional — * unset values inherit from the layer below or fall back to defaults * registered via {@link provideWrMeta}. */ interface WrMetaConfig { readonly title?: string; /** Template applied to `title` when set — `{{ title }}` (or `%s`) is replaced with the page title. */ readonly titleTemplate?: string; readonly description?: string; readonly keywords?: readonly string[]; readonly canonical?: string; readonly themeColor?: string; readonly og?: WrMetaOg; readonly twitter?: WrMetaTwitter; } /** Returned by {@link WrMeta.push} — call `.pop()` to remove the layer. */ interface WrMetaHandle { readonly pop: () => void; } /** * Centralised `` metadata manager — title, description, keywords, * canonical, Open Graph and Twitter Card tags. * * Stack-based: `push(config)` adds a layer (returned handle pops it), * `set(config)` replaces the current top, `reset()` clears all overrides. * Layers merge via shallow merge for scalars and a one-level deep merge * for `og` / `twitter` groups. * * The resolved metadata is applied diff-style — only changed tags are * touched in the DOM, so reads of `document.head` stay cheap. * * @example * ```ts * const meta = inject(WrMeta); * meta.set({ title: 'Pricing', description: 'Plans for every team.' }); * * // From a route component — auto-pop on destroy via the directive: *