UNPKG

pp-seo

Version:

`pp-seo` is a standalone Angular library that provides a highly configurable, sectioned form for managing all SEO (Search Engine Optimization) properties in your Angular applications. It supports a wide range of SEO fields, grouped into logical sections,

246 lines (243 loc) 7.2 kB
import * as i0 from '@angular/core'; import { EventEmitter } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { KeyValue } from '@angular/common'; declare enum FieldTypes { TEXT = "text", TEXTAREA = "textarea", ARRAY = "array", DROPDOWN = "dropdown", CHECKBOX = "checkbox", MULTISELECT = "multiselect" } declare enum HINTS { TEXT = "Enter text", TEXTAREA = "Enter text", ARRAY = "Enter text and press Enter to add", DROPDOWN = "Select an option", CHECKBOX = "Toggle the checkbox", DEFAULT = "Enter value" } interface PpSeo { sections: { coreMeta: CoreMetaSeoSection; crawlingAndIndex: CrawlingAndIndexSeoSection; cacheControl: CacheControlSeoSection; socialMedia: SocialMediaSeoSection; mobileApp: MobileAppSeoSection; structuredData: StructuredDataSeoSection; alternateTags: AlternateTagsSeoSection; siteVerification: SiteVerificationSeoSection; securityPrivacy: SecurityPrivacySeoSection; performance: PerformanceSeoSection; }; disabled?: boolean; hints?: boolean; } interface DropdownOption { title: string; value: string; } interface SeoField { value: any; label: string; description: string; type: FieldTypes; options?: DropdownOption[]; validation: { required: boolean; maxLength?: number; pattern?: RegExp; }; hidden: boolean; disabled: boolean; _input?: string; } interface CoreMetaSeoFields { title: SeoField; description: SeoField; keywords: SeoField; canonicalUrl: SeoField; robotsMeta: SeoField; viewport: SeoField; charset: SeoField; language: SeoField; author: SeoField; publisher: SeoField; rating: SeoField; copyright: SeoField; generator: SeoField; replyTo: SeoField; contentType: SeoField; } interface CrawlingAndIndexSeoFields { noindex: SeoField; nofollow: SeoField; noimageindex: SeoField; noarchive: SeoField; nosnippet: SeoField; notranslate: SeoField; unavailableAfter: SeoField; paginatedPrev: SeoField; paginatedNext: SeoField; } interface CacheControlSeoFields { cacheControl: SeoField; pragma: SeoField; expires: SeoField; refresh: SeoField; } interface SocialMediaSeoFields { ogTitle: SeoField; ogDescription: SeoField; ogType: SeoField; ogUrl: SeoField; ogImage: SeoField; ogImageAlt: SeoField; ogImageWidth: SeoField; ogImageHeight: SeoField; ogSiteName: SeoField; ogLocale: SeoField; twitterCard: SeoField; twitterTitle: SeoField; twitterDescription: SeoField; twitterImage: SeoField; twitterImageAlt: SeoField; twitterSite: SeoField; twitterCreator: SeoField; fbAppId: SeoField; pinterestDescription: SeoField; pinterestMedia: SeoField; pinterestNoPin: SeoField; } interface MobileAppSeoFields { appleTouchIcon: SeoField; appleMobileWebAppCapable: SeoField; appleStatusBarStyle: SeoField; mobileWebAppCapable: SeoField; themeColor: SeoField; msTileColor: SeoField; msTileImage: SeoField; } interface StructuredDataSeoFields { jsonLd: SeoField; } interface AlternateTagsSeoFields { hreflang: SeoField; alternateMedia: SeoField; alternateFormat: SeoField; } interface SiteVerificationSeoFields { googleSiteVerification: SeoField; bingSiteVerification: SeoField; yandexVerification: SeoField; pinterestVerification: SeoField; facebookDomainVerification: SeoField; nortonSafeWeb: SeoField; } interface SecurityPrivacySeoFields { referrerPolicy: SeoField; contentSecurityPolicy: SeoField; permissionsPolicy: SeoField; xuaCompatible: SeoField; xframeOptions: SeoField; } interface PerformanceSeoFields { preconnect: SeoField; prefetch: SeoField; preload: SeoField; dnsPrefetch: SeoField; prerender: SeoField; } interface CoreMetaSeoSection { label: string; fields: CoreMetaSeoFields; hidden: boolean; disabled: boolean; } interface CrawlingAndIndexSeoSection { label: string; fields: CrawlingAndIndexSeoFields; hidden: boolean; disabled: boolean; } interface CacheControlSeoSection { label: string; fields: CacheControlSeoFields; hidden: boolean; disabled: boolean; } interface SocialMediaSeoSection { label: string; fields: SocialMediaSeoFields; hidden: boolean; disabled: boolean; } interface MobileAppSeoSection { label: string; fields: MobileAppSeoFields; hidden: boolean; disabled: boolean; } interface StructuredDataSeoSection { label: string; fields: StructuredDataSeoFields; hidden: boolean; disabled: boolean; } interface AlternateTagsSeoSection { label: string; fields: AlternateTagsSeoFields; hidden: boolean; disabled: boolean; } interface SiteVerificationSeoSection { label: string; fields: SiteVerificationSeoFields; hidden: boolean; disabled: boolean; } interface SecurityPrivacySeoSection { label: string; fields: SecurityPrivacySeoFields; hidden: boolean; disabled: boolean; } interface PerformanceSeoSection { label: string; fields: PerformanceSeoFields; hidden: boolean; disabled: boolean; } declare class Seo implements ControlValueAccessor { properties: PpSeo; propertiesChange: EventEmitter<any>; FIELD_TYPES: typeof FieldTypes; HINTS: typeof HINTS; onChange: (_: any) => void; onTouched: () => void; updateProperty(sectionKey: keyof PpSeo['sections'], fieldKey: string, value: any): void; invalidFields: Record<string, Record<string, boolean>>; validateAll(): boolean; addArrayItem(sectionKey: keyof PpSeo['sections'], fieldKey: string, event: any): void; removeArrayItem(sectionKey: keyof PpSeo['sections'], fieldKey: string, idx: number): void; asField(entry: KeyValue<string, any>): { value: string; label: string; description: string; type?: string; validation?: { required?: boolean; maxLength?: number; pattern?: RegExp; }; }; writeValue(obj: any): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; getNewSeoProperties(): PpSeo; static ɵfac: i0.ɵɵFactoryDeclaration<Seo, never>; static ɵcmp: i0.ɵɵComponentDeclaration<Seo, "pp-seo", never, { "properties": { "alias": "properties"; "required": false; }; }, { "propertiesChange": "propertiesChange"; }, never, never, true, never>; } export { FieldTypes, Seo }; export type { AlternateTagsSeoFields, AlternateTagsSeoSection, CacheControlSeoFields, CacheControlSeoSection, CoreMetaSeoFields, CoreMetaSeoSection, CrawlingAndIndexSeoFields, CrawlingAndIndexSeoSection, DropdownOption, MobileAppSeoFields, MobileAppSeoSection, PerformanceSeoFields, PerformanceSeoSection, PpSeo, SecurityPrivacySeoFields, SecurityPrivacySeoSection, SeoField, SiteVerificationSeoFields, SiteVerificationSeoSection, SocialMediaSeoFields, SocialMediaSeoSection, StructuredDataSeoFields, StructuredDataSeoSection };