mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-25 10:20:34 +03:00
types: update new features
This commit is contained in:
+11
-7
@@ -19,16 +19,20 @@ const BarMetaInfo: MetaInfo = {
|
|||||||
__dangerouslyDisableSanitizersByTagID: {
|
__dangerouslyDisableSanitizersByTagID: {
|
||||||
ldjson: ['innerHTML']
|
ldjson: ['innerHTML']
|
||||||
},
|
},
|
||||||
script: [{
|
link: [
|
||||||
src: '', crossorigin: '', async: true
|
{ vmid: '', rel: '', href: '', callback: () => {} }
|
||||||
}],
|
],
|
||||||
|
script: [
|
||||||
|
{ src: '', crossorigin: '', async: true },
|
||||||
|
{ vmid: '', src: '', callback: () => {} }
|
||||||
|
],
|
||||||
meta: [
|
meta: [
|
||||||
{ charset: 'utf-8' },
|
{ charset: 'utf-8' },
|
||||||
{
|
{
|
||||||
'property': 'og:title',
|
property: 'og:title',
|
||||||
'content': 'Test title',
|
content: 'Test title',
|
||||||
'template': chunk => `${chunk} - My page`, //or as string template: '%s - My page',
|
template: chunk => `${chunk} - My page`, //or as string template: '%s - My page',
|
||||||
'vmid': 'og:title'
|
vmid: 'og:title'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
changed(newdata: MetaInfo, newTags: HTMLElement[], oldTags: HTMLElement[]) {
|
changed(newdata: MetaInfo, newTags: HTMLElement[], oldTags: HTMLElement[]) {
|
||||||
|
|||||||
Vendored
+42
-10
@@ -2,11 +2,13 @@ import './vue'
|
|||||||
import Vue, { ComponentOptions, PluginFunction } from 'vue'
|
import Vue, { ComponentOptions, PluginFunction } from 'vue'
|
||||||
|
|
||||||
type Component = ComponentOptions<Vue> | typeof Vue
|
type Component = ComponentOptions<Vue> | typeof Vue
|
||||||
|
type CallbackFn = () => void
|
||||||
type elements = HTMLElement[]
|
type elements = HTMLElement[]
|
||||||
|
|
||||||
export interface VueMetaOptions {
|
export interface VueMetaOptions {
|
||||||
keyName: string, // the component option name that vue-meta looks for meta info on.
|
keyName: string, // the component option name that vue-meta looks for meta info on.
|
||||||
attribute: string, // the attribute name vue-meta adds to the tags it observes
|
attribute: string, // the attribute name vue-meta adds to the tags it observes
|
||||||
|
ssrAppId: string, // the app id used for ssr app
|
||||||
ssrAttribute: string, // the attribute name that lets vue-meta know that meta info has already been server-rendered
|
ssrAttribute: string, // the attribute name that lets vue-meta know that meta info has already been server-rendered
|
||||||
tagIDKeyName: string // the property name that vue-meta uses to determine whether to overwrite or append a tag
|
tagIDKeyName: string // the property name that vue-meta uses to determine whether to overwrite or append a tag
|
||||||
refreshOnceOnNavigation: boolean
|
refreshOnceOnNavigation: boolean
|
||||||
@@ -43,6 +45,10 @@ export interface AttributeProperty {
|
|||||||
|
|
||||||
export interface MetaDataProperty {
|
export interface MetaDataProperty {
|
||||||
vmid?: string,
|
vmid?: string,
|
||||||
|
once?: boolean,
|
||||||
|
skip?: boolean,
|
||||||
|
body?: boolean,
|
||||||
|
pbody?: boolean,
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,20 +81,32 @@ export interface MetaPropertyProperty extends MetaDataProperty {
|
|||||||
template?: (chunk: string) => string
|
template?: (chunk: string) => string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LinkProperty extends MetaDataProperty {
|
export interface LinkPropertyBase extends MetaDataProperty {
|
||||||
rel: string,
|
rel: string,
|
||||||
crossOrigin?: string | null,
|
crossOrigin?: string | null,
|
||||||
href?: string,
|
|
||||||
hreflang?: string,
|
|
||||||
media?: string,
|
media?: string,
|
||||||
nonce?: string,
|
nonce?: string,
|
||||||
referrerPolicy?: string,
|
referrerPolicy?: string,
|
||||||
rev?: string,
|
rev?: string,
|
||||||
type?: string,
|
type?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LinkPropertyHref extends LinkPropertyBase {
|
||||||
|
href?: string,
|
||||||
|
hreflang?: string,
|
||||||
|
callback?: void
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LinkPropertyHrefCallback extends LinkPropertyBase {
|
||||||
|
vmid: string,
|
||||||
|
callback: CallbackFn,
|
||||||
|
href?: string,
|
||||||
|
hreflang?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StyleProperty extends MetaDataProperty {
|
export interface StyleProperty extends MetaDataProperty {
|
||||||
cssText: string,
|
cssText: string,
|
||||||
|
callback?: CallbackFn
|
||||||
media?: string,
|
media?: string,
|
||||||
nonce?: string,
|
nonce?: string,
|
||||||
type?: string,
|
type?: string,
|
||||||
@@ -97,7 +115,6 @@ export interface StyleProperty extends MetaDataProperty {
|
|||||||
export interface ScriptPropertyBase extends MetaDataProperty {
|
export interface ScriptPropertyBase extends MetaDataProperty {
|
||||||
type?: string,
|
type?: string,
|
||||||
charset?: string,
|
charset?: string,
|
||||||
body?: boolean,
|
|
||||||
async?: boolean,
|
async?: boolean,
|
||||||
defer?: boolean,
|
defer?: boolean,
|
||||||
crossOrigin?: string,
|
crossOrigin?: string,
|
||||||
@@ -105,11 +122,17 @@ export interface ScriptPropertyBase extends MetaDataProperty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ScriptPropertyText extends ScriptPropertyBase {
|
export interface ScriptPropertyText extends ScriptPropertyBase {
|
||||||
innerHTML: string,
|
innerHTML: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ScriptPropertySrc extends ScriptPropertyBase {
|
export interface ScriptPropertySrc extends ScriptPropertyBase {
|
||||||
src: string,
|
src: string,
|
||||||
|
callback?: void
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScriptPropertySrcCallback extends ScriptPropertyBase {
|
||||||
|
vmid: string,
|
||||||
|
callback: CallbackFn
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NoScriptProperty extends MetaDataProperty {
|
export interface NoScriptProperty extends MetaDataProperty {
|
||||||
@@ -130,9 +153,9 @@ export interface MetaInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
meta?: (MetaPropertyCharset | MetaPropertyEquiv | MetaPropertyName | MetaPropertyMicrodata | MetaPropertyProperty)[]
|
meta?: (MetaPropertyCharset | MetaPropertyEquiv | MetaPropertyName | MetaPropertyMicrodata | MetaPropertyProperty)[]
|
||||||
link?: LinkProperty[]
|
link?: (LinkPropertyBase | LinkPropertyHref | LinkPropertyHrefCallback)[]
|
||||||
style?: StyleProperty[]
|
style?: StyleProperty[]
|
||||||
script?: (ScriptPropertyText | ScriptPropertySrc)[]
|
script?: (ScriptPropertyText | ScriptPropertySrc | ScriptPropertySrcCallback)[]
|
||||||
noscript?: NoScriptProperty[]
|
noscript?: NoScriptProperty[]
|
||||||
|
|
||||||
__dangerouslyDisableSanitizers?: string[]
|
__dangerouslyDisableSanitizers?: string[]
|
||||||
@@ -150,16 +173,25 @@ interface ToText {
|
|||||||
text(): string
|
text(): string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ToTextBooleanArg {
|
||||||
|
text(addSrrAttribute?: boolean): string
|
||||||
|
}
|
||||||
|
|
||||||
interface ToBodyTextOption {
|
interface ToBodyTextOption {
|
||||||
body: boolean
|
body: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ToPbodyTextOption {
|
||||||
|
pbody: boolean
|
||||||
|
}
|
||||||
|
|
||||||
interface ToBodyText {
|
interface ToBodyText {
|
||||||
text(options?: ToBodyTextOption): string
|
text(options?: (ToBodyTextOption | ToPbodyTextOption)): string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MetaInfoSSR {
|
export interface MetaInfoSSR {
|
||||||
title?: ToText
|
title?: ToText
|
||||||
htmlAttrs?: ToText
|
htmlAttrs?: ToTextBooleanArg
|
||||||
headAttrs?: ToText
|
headAttrs?: ToText
|
||||||
bodyAttrs?: ToText
|
bodyAttrs?: ToText
|
||||||
base?: ToText
|
base?: ToText
|
||||||
|
|||||||
Reference in New Issue
Block a user