@vueuse/head
Advanced tools
Comparing version
@@ -1,28 +0,29 @@ | ||
import { HeadTag, MaybeComputedRef, ReactiveHead, MergeHead } from '@unhead/vue'; | ||
import { HeadTag, MergeHead, MaybeComputedRef, ReactiveHead, VueHeadClient } from '@unhead/vue'; | ||
export { HeadEntryOptions, MaybeComputedRef, Unhead, VueHeadMixin, useHead, useServerHead } from '@unhead/vue'; | ||
import * as _unhead_schema from '@unhead/schema'; | ||
import { Head as Head$1, HeadEntryOptions, ActiveHeadEntry, Unhead } from '@unhead/schema'; | ||
import { HeadEntry, HeadEntryOptions, ActiveHeadEntry, Unhead, Head as Head$1 } from '@unhead/schema'; | ||
import * as vue from 'vue'; | ||
import { Plugin } from 'vue'; | ||
import { App, Plugin } from 'vue'; | ||
declare type HookBeforeDomUpdate = ((tags: Record<string, HeadTag[]>) => void | boolean)[]; | ||
declare type HookTagsResolved = ((tags: HeadTag[]) => void)[]; | ||
interface LegacyHeadClient<T> { | ||
headTags: () => Promise<HeadTag[]>; | ||
declare type HookBeforeDomUpdate = (() => Promise<void | boolean> | void | boolean); | ||
declare type HookTagsResolved = ((tags: HeadTag[]) => Promise<void> | void); | ||
declare type HookEntriesResolved = ((entries: HeadEntry<any>[]) => Promise<void> | void); | ||
interface HeadClient<T extends MergeHead = {}> { | ||
install: (app: App) => void; | ||
resolveTags: () => Promise<HeadTag[]>; | ||
headEntries: () => HeadEntry<MaybeComputedRef<ReactiveHead<T>>>[]; | ||
push: (entry: MaybeComputedRef<ReactiveHead<T>>, options?: HeadEntryOptions) => ActiveHeadEntry<MaybeComputedRef<ReactiveHead<T>>>; | ||
/** | ||
* @deprecated | ||
* @deprecated use `push` | ||
*/ | ||
addEntry: (objs: Head$1, options?: HeadEntryOptions) => ActiveHeadEntry<Head$1>; | ||
addEntry: (entry: MaybeComputedRef<ReactiveHead<T>>, options?: HeadEntryOptions) => ActiveHeadEntry<MaybeComputedRef<ReactiveHead<T>>>; | ||
/** | ||
* @deprecated | ||
* @deprecated use `push` | ||
*/ | ||
addReactiveEntry: (objs: MaybeComputedRef<ReactiveHead>, options?: HeadEntryOptions) => ActiveHeadEntry<MaybeComputedRef<ReactiveHead>>; | ||
addReactiveEntry: (objs: MaybeComputedRef<ReactiveHead<T>>, options?: HeadEntryOptions) => () => void; | ||
/** | ||
* @deprecated | ||
* @deprecated use `@unhead/dom` | ||
*/ | ||
addHeadObjs: (objs: T, options?: HeadEntryOptions) => ActiveHeadEntry<T>; | ||
/** | ||
* @deprecated | ||
*/ | ||
updateDOM: (document?: Document, force?: boolean) => void; | ||
hooks: | ||
/** | ||
@@ -35,18 +36,33 @@ * Array of user provided functions to hook into before the DOM is updated. | ||
* You are able to modify the payload of hook using this. | ||
*/ | ||
Record<'before:dom', HookBeforeDomUpdate[]> & Record<'resolved:entries', HookEntriesResolved[]> & | ||
/** | ||
* Array of user provided functions to hook into after the tags have been resolved (deduped and sorted). | ||
*/ | ||
Record<'resolved:tags', HookTagsResolved[]> | Unhead['hooks']; | ||
/** | ||
* Backwards compatibility function to fetch the headTags. | ||
* | ||
* @deprecated | ||
* This function forces reactivity resolving and is not performant. | ||
* | ||
* @deprecated Use `unhead.resolveTags()`. | ||
*/ | ||
hookBeforeDomUpdate: HookBeforeDomUpdate; | ||
headTags: () => Promise<HeadTag[]>; | ||
/** | ||
* Array of user provided functions to hook into after the tags have been resolved (deduped and sorted). | ||
* @deprecated | ||
* Backwards compatibility function to add a head obj. | ||
* | ||
* Note: This will not support reactivity. Use `addReactiveEntry` instead. | ||
* | ||
* @deprecated Use addEntry | ||
*/ | ||
hookTagsResolved: HookTagsResolved; | ||
addHeadObjs: (entry: MaybeComputedRef<ReactiveHead<T>>, options?: HeadEntryOptions) => ActiveHeadEntry<MaybeComputedRef<ReactiveHead<T>>>; | ||
/** | ||
* Access the underlying unhead instance. | ||
*/ | ||
unhead: VueHeadClient<T>; | ||
} | ||
declare type UseHeadInput<T extends MergeHead> = MaybeComputedRef<ReactiveHead<T>>; | ||
declare type VueUseHead<T extends MergeHead = {}> = Unhead<UseHeadInput<T>> & LegacyHeadClient<UseHeadInput<T>> & Plugin; | ||
declare function createHead<T extends MergeHead = {}>(initHeadObject?: Head$1<T>): VueUseHead<T>; | ||
declare function createHead<T extends MergeHead = {}>(initHeadObject?: Head$1<T>): HeadClient<T>; | ||
declare const HeadVuePlugin: Plugin; | ||
declare const renderHeadToString: <T extends MergeHead = {}>(head: VueUseHead<T>) => Promise<_unhead_schema.SSRHeadPayload>; | ||
declare const renderHeadToString: <T extends MergeHead = {}>(head: HeadClient<T>) => Promise<_unhead_schema.SSRHeadPayload>; | ||
declare type HeadObjectPlain = Head$1; | ||
@@ -57,2 +73,2 @@ declare type HeadObject = ReactiveHead; | ||
export { Head, HeadObject, HeadObjectPlain, HeadVuePlugin, HookBeforeDomUpdate, HookTagsResolved, LegacyHeadClient, UseHeadInput, VueUseHead, createHead, renderHeadToString }; | ||
export { Head, HeadClient, HeadObject, HeadObjectPlain, HeadVuePlugin, HookBeforeDomUpdate, HookEntriesResolved, HookTagsResolved, createHead, renderHeadToString }; |
{ | ||
"name": "@vueuse/head", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"packageManager": "pnpm@7.5.0", | ||
@@ -5,0 +5,0 @@ "description": "Document head manager for Vue 3. SSR ready.", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
17399
6.91%312
11.43%