Skip to content

feat: deprecate meta elements APIs v1 #955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions projects/ngx-meta/api-extractor/ngx-meta.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,21 @@ export interface JsonLdMetadata {
// @internal
export type _LazyInjectionToken<T> = () => InjectionToken<T>;

// @public
// @public @deprecated
export const makeComposedKeyValMetaDefinition: (names: ReadonlyArray<string>, options?: MakeComposedKeyValMetaDefinitionOptions) => NgxMetaMetaDefinition;

// @public
// @public @deprecated
export interface MakeComposedKeyValMetaDefinitionOptions extends MakeKeyValMetaDefinitionOptions {
separator?: string;
}

// @internal
export const _makeInjectionToken: <T>(description: string, factory?: () => T) => InjectionToken<T>;

// @public
// @public @deprecated
export const makeKeyValMetaDefinition: (keyName: string, options?: MakeKeyValMetaDefinitionOptions) => NgxMetaMetaDefinition;

// @public
// @public @deprecated
export interface MakeKeyValMetaDefinitionOptions {
extras?: MetaDefinition;
keyAttr?: string;
Expand Down Expand Up @@ -231,7 +231,7 @@ export class NgxMetaElementsService {
export class NgxMetaJsonLdModule {
}

// @public
// @public @deprecated
export type NgxMetaMetaContent = string | undefined | null;

// @public
Expand All @@ -245,15 +245,18 @@ export abstract class NgxMetaMetadataManager<Value = unknown> {
abstract readonly set: MetadataSetter<Value>;
}

// @public
// @public @deprecated
export interface NgxMetaMetaDefinition {
// @deprecated
readonly attrSelector: string;
// @deprecated
readonly withContent: (content: string) => MetaDefinition;
}

// @public
// @public @deprecated
export class NgxMetaMetaService {
constructor(meta: Meta);
// @deprecated
set(definition: NgxMetaMetaDefinition, content: NgxMetaMetaContent): void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Notice the use of [`NgxMetaElementsService`](/api/ngx-meta.ngxmetaelementsservic

??? tip "Were you looking for `NgxMetaMetaService`?"

Before [`NgxMetaElementsService`](/api/ngx-meta.ngxmetaelementsservice/) was introduced, the service managing those was [`NgxMetaMetaService`](/api/ngx-meta.ngxmetametaservice/). However, API design for it and its related util functions was a bit limited. It also didn't allow to manage multiple `#!html <meta>` elements. So they were replaced. See [the PR were newer APIs were introduced](https://github.com/davidlj95/ngx/pull/883) for more information.
Before [`NgxMetaElementsService`](/api/ngx-meta.ngxmetaelementsservice/) was introduced, the service managing those was [`NgxMetaMetaService`](/api/ngx-meta.ngxmetametaservice/). However, API design for it and its related util functions was a bit limited. It also didn't allow to manage multiple `#!html <meta>` elements. So they were replaced. And right now they are deprecated, so new ones should be used instead. See [the PR were newer APIs were introduced](https://github.com/davidlj95/ngx/pull/883) for more information.

You can still checkout the [example app file using it](https://github.com/davidlj95/ngx/blob/ngx-meta-v1.0.0-beta.16/projects/ngx-meta/example-apps/templates/standalone/src/app/meta-late-loaded/provide-custom-metadata-manager.ts) and the [custom metadata guide using that service instead](https://github.com/davidlj95/ngx/blob/ngx-meta-v1.0.0-beta.16/projects/ngx-meta/docs/content/guides/manage-your-custom-metadata.md)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// noinspection JSDeprecatedSymbols

import {
makeKeyValMetaDefinition,
MakeKeyValMetaDefinitionOptions,
Expand Down Expand Up @@ -25,6 +27,9 @@ import { NgxMetaMetaDefinition } from './ngx-meta-meta-definition'
* )
* ```
*
* @deprecated Use {@link NgxMetaElementsService} APIs instead.
* See {@link https://ngx-meta.dev/guides/manage-your-custom-metadata/ | custom metadata guide} for more info
*
* @param names - Names to create they key name
* @param options - Options object
* @public
Expand All @@ -39,6 +44,9 @@ export const makeComposedKeyValMetaDefinition = (
/**
* Options argument object for {@link makeComposedKeyValMetaDefinition}
*
* @deprecated Use {@link NgxMetaElementsService} APIs instead.
* See {@link https://ngx-meta.dev/guides/manage-your-custom-metadata/ | custom metadata guide} for more info
*
* @public
*/
export interface MakeComposedKeyValMetaDefinitionOptions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// noinspection JSDeprecatedSymbols

import { MetaDefinition } from '@angular/platform-browser'
import { NgxMetaMetaDefinition } from './ngx-meta-meta-definition'

Expand All @@ -19,6 +21,9 @@ import { NgxMetaMetaDefinition } from './ngx-meta-meta-definition'
* Value is set by {@link NgxMetaMetaService.set} by providing this model and an
* actual value
*
* @deprecated Use {@link NgxMetaElementsService} APIs instead.
* See {@link https://ngx-meta.dev/guides/manage-your-custom-metadata/ | custom metadata guide} for more info
*
* @param keyName - Name of the key in the key/value meta definition
* @param options - Specifies HTML attribute names and extras of the definition if any
*
Expand Down Expand Up @@ -46,6 +51,9 @@ export const makeKeyValMetaDefinition = (
/**
* Options argument object for {@link makeKeyValMetaDefinition}
*
* @deprecated Use {@link NgxMetaElementsService} APIs instead.
* See {@link https://ngx-meta.dev/guides/manage-your-custom-metadata/ | custom metadata guide} for more info
*
* @public
*/
export interface MakeKeyValMetaDefinitionOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*
* See {@link NgxMetaMetaService.set}
*
* @deprecated Use {@link NgxMetaElementsService} APIs instead.
* See {@link https://ngx-meta.dev/guides/manage-your-custom-metadata/ | custom metadata guide} for more info
*
* @public
*/
export type NgxMetaMetaContent = string | undefined | null
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { MetaDefinition } from '@angular/platform-browser'
*
* - {@link makeComposedKeyValMetaDefinition}
*
* @deprecated Use {@link NgxMetaElementsService} APIs instead.
* See {@link https://ngx-meta.dev/guides/manage-your-custom-metadata/ | custom metadata guide} for more info
*
* @remarks
*
* Inspired by Angular {@link https://angular.dev/api/platform-browser/MetaDefinition | MetaDefinition}.
Expand All @@ -22,6 +25,9 @@ export interface NgxMetaMetaDefinition {
*
* With the given content as value of the `<meta>` element.
*
* @deprecated Use {@link NgxMetaElementsService} APIs instead.
* See {@link https://ngx-meta.dev/guides/manage-your-custom-metadata/ | custom metadata guide} for more info
*
* @example
* For instance, `(content) => ({name: 'description', content})` to create a
* `<meta name='description' content='{content}'>` element. Where `content` will come from
Expand All @@ -33,6 +39,9 @@ export interface NgxMetaMetaDefinition {
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors | Attribute selector}
* to identify the `<meta>` element. In order to remove this specific `<meta>` element when needed.
*
* @deprecated Use {@link NgxMetaElementsService} APIs instead.
* See {@link https://ngx-meta.dev/guides/manage-your-custom-metadata/ | custom metadata guide} for more info
*
* @example
* For instance, `[name='description']` for the `<meta name='description'>` element.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// noinspection JSDeprecatedSymbols

import { Injectable } from '@angular/core'
import { Meta } from '@angular/platform-browser'
import { NgxMetaMetaDefinition } from './ngx-meta-meta-definition'
Expand All @@ -8,6 +10,9 @@ import { NgxMetaMetaContent } from './ngx-meta-meta-content'
*
* Uses Angular {@link https://angular.dev/api/platform-browser/Meta | Meta} APIs under the hood.
*
* @deprecated Use {@link NgxMetaElementsService} APIs instead.
* See {@link https://ngx-meta.dev/guides/manage-your-custom-metadata/ | custom metadata guide} for more info
*
* @public
*/
@Injectable({ providedIn: 'root' })
Expand All @@ -21,6 +26,9 @@ export class NgxMetaMetaService {
*
* The element is created with the provided content. If no content is given, element is removed.
*
* @deprecated Use {@link NgxMetaElementsService} APIs instead.
* See {@link https://ngx-meta.dev/guides/manage-your-custom-metadata/ | custom metadata guide} for more info
*
* @param definition - `<meta>` element to create, update or remove
* @param content - Content value to create or update the `<meta>` element.
* Use `null` or `undefined` to remove the element from the page.
Expand Down