2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-24 04:30:34 +03:00

feat(ts): update types for v2 (#338)

* chore: update types for v2

* fix: script.type shouldnt be required

fix: define meta.http-equiv as string, too many options to list

* chore: improve types

* chore: update typescript dependency

* chore: remove unnecessary gitignore

* chore: add metainfocomputed type

* chore: use camelcase for type

* chore: add interfaces for metaInfo properties

* chore: add missing body boolen for script types

* chore: include all type files on build

* chore: remove unused import
This commit is contained in:
Pim
2019-04-03 13:41:37 +02:00
committed by GitHub
parent 111c76970b
commit 7b85ff22f5
7 changed files with 487 additions and 424 deletions
+9 -49
View File
@@ -1,51 +1,11 @@
import './vue';
import { PluginFunction } from 'vue/types/plugin';
import './vue'
import { VueMeta } from './vue-meta'
/**
* Installation function
*
* @param {Vue} Vue - the Vue constructor.
* @param {{
* 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
* 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
* }} options
*/
declare const Meta: PluginFunction<{
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
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
}>;
export default VueMeta
export default Meta;
export interface MetaInfo {
title?: string
titleTemplate?: string | ((titleChunk: string) => string)
htmlAttrs?: { [key: string]: string }
bodyAttrs?: { [key: string]: string }
base?: { target: string, href: string }
meta?: {
vmid?: string,
charset?: string,
content?: string,
'http-equiv'?: 'content-security-policy' | 'refresh',
name?: string,
[key: string]: any
}[]
link?: { rel: string, href: string, [key: string]: any }[]
style?: { cssText: string, type: string, [key: string]: any }[]
script?: { innerHTML?: string, src?: string, type: string, [key: string]: any }[]
noscript?: { innerHTML: string, [key: string]: any }[]
__dangerouslyDisableSanitizers?: string[]
__dangerouslyDisableSanitizersByTagID?: string[]
changed?: <T extends object>(newInfo: T, addedTags: HTMLElement[], removedTags: HTMLElement[]) => void
afterNavigation?: <T extends object>(vm: Vue, newInfo: T) => void
refreshOnceOnNavigation?: boolean
}
export {
VueMetaOptions,
VueMetaPlugin,
MetaInfo,
MetaInfoSSR
} from './vue-meta'