feat: init
This commit is contained in:
21
node_modules/@unhead/vue/LICENSE
generated
vendored
Normal file
21
node_modules/@unhead/vue/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Harlan Wilton <harlan@harlanzw.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
183
node_modules/@unhead/vue/README.md
generated
vendored
Normal file
183
node_modules/@unhead/vue/README.md
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
# @unhead/vue
|
||||
|
||||
> Full-stack `<head>` management for Vue applications
|
||||
|
||||
[![npm version][npm-version-src]][npm-version-href]
|
||||
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
||||
[![License][license-src]][license-href]
|
||||
|
||||
## Features
|
||||
|
||||
- 🖖 Vue-optimized head management
|
||||
- 🔄 Reactive titles, meta tags, and other head elements
|
||||
- 🔍 SEO-friendly head control
|
||||
- 🖥️ Server-side rendering support
|
||||
- 📦 Lightweight with zero dependencies (except for Vue & unhead)
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm install @unhead/vue
|
||||
|
||||
# yarn
|
||||
yarn add @unhead/vue
|
||||
|
||||
# pnpm
|
||||
pnpm add @unhead/vue
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Setup
|
||||
|
||||
#### Client-side (SPA)
|
||||
|
||||
```ts
|
||||
import { createHead } from '@unhead/vue/client'
|
||||
// main.ts
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
const app = createApp(App)
|
||||
const head = createHead()
|
||||
app.use(head)
|
||||
|
||||
app.mount('#app')
|
||||
```
|
||||
|
||||
#### Server-side (SSR)
|
||||
|
||||
```ts
|
||||
import { createHead } from '@unhead/vue/server'
|
||||
// entry-server.ts
|
||||
import { renderToString } from 'vue/server-renderer'
|
||||
import { createApp } from './main'
|
||||
|
||||
export async function render(url: string) {
|
||||
const { app } = createApp()
|
||||
const head = createHead()
|
||||
app.use(head)
|
||||
|
||||
const html = await renderToString(app)
|
||||
return { html, head }
|
||||
}
|
||||
```
|
||||
|
||||
```ts
|
||||
import { createHead } from '@unhead/vue/client'
|
||||
// entry-client.ts (for hydration)
|
||||
import { createApp } from './main'
|
||||
|
||||
const { app } = createApp()
|
||||
const head = createHead()
|
||||
app.use(head)
|
||||
|
||||
app.mount('#app')
|
||||
```
|
||||
|
||||
### Basic Usage
|
||||
|
||||
```vue
|
||||
<!-- Home.vue -->
|
||||
<script setup lang="ts">
|
||||
import { useHead } from '@unhead/vue'
|
||||
|
||||
useHead({
|
||||
title: 'Home Page',
|
||||
meta: [
|
||||
{
|
||||
name: 'description',
|
||||
content: 'Welcome to our website'
|
||||
}
|
||||
]
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>Home</h1>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Setting Meta Tags
|
||||
|
||||
```vue
|
||||
<!-- About.vue -->
|
||||
<script setup lang="ts">
|
||||
import { useSeoMeta } from '@unhead/vue'
|
||||
|
||||
useSeoMeta({
|
||||
title: 'About Us',
|
||||
description: 'Learn more about our company',
|
||||
ogTitle: 'About Our Company',
|
||||
ogDescription: 'Our fantastic about page',
|
||||
ogImage: 'https://example.com/image.jpg',
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>About Us</h1>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Reactive Head Elements
|
||||
|
||||
```vue
|
||||
<!-- Profile.vue -->
|
||||
<script setup lang="ts">
|
||||
import { useHead } from '@unhead/vue'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const userName = ref('User')
|
||||
|
||||
// Vue automatically tracks reactive changes
|
||||
useHead({
|
||||
title: () => `${userName.value} - Profile`, // Reactive title
|
||||
meta: [
|
||||
{
|
||||
name: 'description',
|
||||
content: () => `${userName.value}'s profile page`, // Reactive description
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
function updateName() {
|
||||
userName.value = 'New Name'
|
||||
// Title and meta automatically update!
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>{{ userName }}'s Profile</h1>
|
||||
<button @click="updateName">
|
||||
Update Name
|
||||
</button>
|
||||
</template>
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
npm install
|
||||
|
||||
# Generate build files
|
||||
npm run build
|
||||
|
||||
# Run tests
|
||||
npm run test
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE)
|
||||
|
||||
<!-- Badges -->
|
||||
[npm-version-src]: https://img.shields.io/npm/v/@unhead/vue/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
|
||||
[npm-version-href]: https://npmjs.com/package/@unhead/vue
|
||||
|
||||
[npm-downloads-src]: https://img.shields.io/npm/dm/@unhead/vue.svg?style=flat&colorA=18181B&colorB=28CF8D
|
||||
[npm-downloads-href]: https://npmjs.com/package/@unhead/vue
|
||||
|
||||
[license-src]: https://img.shields.io/github/license/unjs/unhead.svg?style=flat&colorA=18181B&colorB=28CF8D
|
||||
[license-href]: https://github.com/unjs/unhead/blob/main/LICENSE
|
||||
1
node_modules/@unhead/vue/client.d.ts
generated
vendored
Normal file
1
node_modules/@unhead/vue/client.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dist/client.js'
|
||||
10
node_modules/@unhead/vue/dist/client.d.mts
generated
vendored
Normal file
10
node_modules/@unhead/vue/dist/client.d.mts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { CreateClientHeadOptions } from 'unhead/types';
|
||||
export { CreateClientHeadOptions } from 'unhead/types';
|
||||
export { V as VueHeadMixin } from './shared/vue.DnywREVF.mjs';
|
||||
export { renderDOMHead } from 'unhead/client';
|
||||
import { V as VueHeadClient } from './shared/vue.DoxLTFJk.mjs';
|
||||
import 'vue';
|
||||
|
||||
declare function createHead(options?: CreateClientHeadOptions): VueHeadClient;
|
||||
|
||||
export { VueHeadClient, createHead };
|
||||
10
node_modules/@unhead/vue/dist/client.d.ts
generated
vendored
Normal file
10
node_modules/@unhead/vue/dist/client.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { CreateClientHeadOptions } from 'unhead/types';
|
||||
export { CreateClientHeadOptions } from 'unhead/types';
|
||||
export { V as VueHeadMixin } from './shared/vue.DnywREVF.js';
|
||||
export { renderDOMHead } from 'unhead/client';
|
||||
import { V as VueHeadClient } from './shared/vue.DoxLTFJk.js';
|
||||
import 'vue';
|
||||
|
||||
declare function createHead(options?: CreateClientHeadOptions): VueHeadClient;
|
||||
|
||||
export { VueHeadClient, createHead };
|
||||
22
node_modules/@unhead/vue/dist/client.mjs
generated
vendored
Normal file
22
node_modules/@unhead/vue/dist/client.mjs
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { createHead as createHead$1, createDebouncedFn, renderDOMHead } from 'unhead/client';
|
||||
export { renderDOMHead } from 'unhead/client';
|
||||
import { v as vueInstall } from './shared/vue.Cr7xSEtD.mjs';
|
||||
export { V as VueHeadMixin } from './shared/vue.BM998iwd.mjs';
|
||||
import 'unhead/plugins';
|
||||
import 'unhead/utils';
|
||||
import 'vue';
|
||||
import './shared/vue.N9zWjxoK.mjs';
|
||||
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function createHead(options = {}) {
|
||||
const head = createHead$1({
|
||||
domOptions: {
|
||||
render: createDebouncedFn(() => renderDOMHead(head), (fn) => setTimeout(fn, 0))
|
||||
},
|
||||
...options
|
||||
});
|
||||
head.install = vueInstall(head);
|
||||
return head;
|
||||
}
|
||||
|
||||
export { createHead };
|
||||
5
node_modules/@unhead/vue/dist/components.d.mts
generated
vendored
Normal file
5
node_modules/@unhead/vue/dist/components.d.mts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { DefineComponent } from 'vue';
|
||||
|
||||
declare const Head: DefineComponent;
|
||||
|
||||
export { Head };
|
||||
5
node_modules/@unhead/vue/dist/components.d.ts
generated
vendored
Normal file
5
node_modules/@unhead/vue/dist/components.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { DefineComponent } from 'vue';
|
||||
|
||||
declare const Head: DefineComponent;
|
||||
|
||||
export { Head };
|
||||
65
node_modules/@unhead/vue/dist/components.mjs
generated
vendored
Normal file
65
node_modules/@unhead/vue/dist/components.mjs
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
import { defineComponent, ref, onBeforeUnmount, watchEffect } from 'vue';
|
||||
import { u as useHead } from './shared/vue.Cr7xSEtD.mjs';
|
||||
import 'unhead/plugins';
|
||||
import 'unhead/utils';
|
||||
import './shared/vue.N9zWjxoK.mjs';
|
||||
|
||||
function addVNodeToHeadObj(node, obj) {
|
||||
const nodeType = node.type;
|
||||
const type = nodeType === "html" ? "htmlAttrs" : nodeType === "body" ? "bodyAttrs" : nodeType;
|
||||
if (typeof type !== "string" || !(type in obj))
|
||||
return;
|
||||
const props = node.props || {};
|
||||
if (node.children) {
|
||||
const childrenAttr = "children";
|
||||
props.children = Array.isArray(node.children) ? node.children[0][childrenAttr] : node[childrenAttr];
|
||||
}
|
||||
if (Array.isArray(obj[type]))
|
||||
obj[type].push(props);
|
||||
else if (type === "title")
|
||||
obj.title = props.children;
|
||||
else
|
||||
obj[type] = props;
|
||||
}
|
||||
function vnodesToHeadObj(nodes) {
|
||||
const obj = {
|
||||
title: void 0,
|
||||
htmlAttrs: void 0,
|
||||
bodyAttrs: void 0,
|
||||
base: void 0,
|
||||
meta: [],
|
||||
link: [],
|
||||
style: [],
|
||||
script: [],
|
||||
noscript: []
|
||||
};
|
||||
for (const node of nodes) {
|
||||
if (typeof node.type === "symbol" && Array.isArray(node.children)) {
|
||||
for (const childNode of node.children)
|
||||
addVNodeToHeadObj(childNode, obj);
|
||||
} else {
|
||||
addVNodeToHeadObj(node, obj);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
const Head = /* @__PURE__ */ defineComponent({
|
||||
name: "Head",
|
||||
setup(_, { slots }) {
|
||||
const obj = ref({});
|
||||
const entry = useHead(obj);
|
||||
onBeforeUnmount(() => {
|
||||
entry.dispose();
|
||||
});
|
||||
return () => {
|
||||
watchEffect(() => {
|
||||
if (!slots.default)
|
||||
return;
|
||||
entry.patch(vnodesToHeadObj(slots.default()));
|
||||
});
|
||||
return null;
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
export { Head };
|
||||
45
node_modules/@unhead/vue/dist/index.d.mts
generated
vendored
Normal file
45
node_modules/@unhead/vue/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import { createUnhead } from 'unhead';
|
||||
export { createUnhead } from 'unhead';
|
||||
import { ActiveHeadEntry } from 'unhead/types';
|
||||
export { ActiveHeadEntry, AriaAttributes, BodyAttributesWithoutEvents, BodyEvents, DataKeys, GlobalAttributes, Head, HeadEntryOptions, HeadTag, HttpEventAttributes, LinkWithoutEvents, MergeHead, MetaFlat, MetaFlatInput, RawInput, RenderSSRHeadOptions, ResolvableHead, ScriptWithoutEvents, SerializableHead, SpeculationRules, Unhead } from 'unhead/types';
|
||||
import { V as VueHeadClient, U as UseHeadInput, a as UseHeadOptions, b as UseSeoMetaInput } from './shared/vue.DoxLTFJk.mjs';
|
||||
export { B as BodyAttr, D as DeepResolvableProperties, H as HtmlAttr, M as MaybeFalsy, l as ReactiveHead, n as ResolvableArray, d as ResolvableBase, k as ResolvableBodyAttributes, j as ResolvableHtmlAttributes, e as ResolvableLink, f as ResolvableMeta, i as ResolvableNoscript, o as ResolvableProperties, h as ResolvableScript, g as ResolvableStyle, R as ResolvableTitle, c as ResolvableTitleTemplate, p as ResolvableUnion, m as ResolvableValue } from './shared/vue.DoxLTFJk.mjs';
|
||||
import { U as UseHeadSafeInput } from './shared/vue.DMlT7xkj.mjs';
|
||||
export { H as HeadSafe, S as SafeBodyAttr, a as SafeHtmlAttr, c as SafeLink, b as SafeMeta, e as SafeNoscript, d as SafeScript, f as SafeStyle } from './shared/vue.DMlT7xkj.mjs';
|
||||
export { AsVoidFunctions, EventHandlerOptions, RecordingEntry, ScriptInstance, UseFunctionType, UseScriptResolvedInput, UseScriptStatus, WarmupStrategy, createSpyProxy, resolveScriptKey } from 'unhead/scripts';
|
||||
export { UseScriptContext, UseScriptInput, UseScriptOptions, UseScriptReturn, VueScriptInstance, useScript } from './scripts.mjs';
|
||||
export { Base, BodyAttributes, HtmlAttributes, Link, Meta, Noscript, Script, Style } from './types.mjs';
|
||||
export { resolveUnrefHeadInput } from './utils.mjs';
|
||||
export { V as VueHeadMixin } from './shared/vue.DnywREVF.mjs';
|
||||
import 'vue';
|
||||
import 'unhead/utils';
|
||||
|
||||
declare const unheadVueComposablesImports: {
|
||||
'@unhead/vue': string[];
|
||||
};
|
||||
|
||||
declare function injectHead(): VueHeadClient;
|
||||
declare function useHead<I = UseHeadInput>(input?: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<I>;
|
||||
declare function useHeadSafe(input?: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadSafeInput>;
|
||||
declare function useSeoMeta(input?: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<UseSeoMetaInput>;
|
||||
/**
|
||||
* @deprecated use `useHead` instead.Advanced use cases should tree shake using import.meta.* if statements.
|
||||
*/
|
||||
declare function useServerHead<I = UseHeadInput>(input?: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<I>;
|
||||
/**
|
||||
* @deprecated use `useHeadSafe` instead.Advanced use cases should tree shake using import.meta.* if statements.
|
||||
*/
|
||||
declare function useServerHeadSafe(input?: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadSafeInput>;
|
||||
/**
|
||||
* @deprecated use `useSeoMeta` instead.Advanced use cases should tree shake using import.meta.* if statements.
|
||||
*/
|
||||
declare function useServerSeoMeta(input?: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<UseSeoMetaInput>;
|
||||
|
||||
declare const headSymbol = "usehead";
|
||||
|
||||
/**
|
||||
* @deprecated Use createUnhead
|
||||
*/
|
||||
declare const createHeadCore: typeof createUnhead;
|
||||
|
||||
export { UseHeadInput, UseHeadOptions, UseHeadSafeInput, UseSeoMetaInput, VueHeadClient, createHeadCore, headSymbol, injectHead, unheadVueComposablesImports, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
||||
45
node_modules/@unhead/vue/dist/index.d.ts
generated
vendored
Normal file
45
node_modules/@unhead/vue/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import { createUnhead } from 'unhead';
|
||||
export { createUnhead } from 'unhead';
|
||||
import { ActiveHeadEntry } from 'unhead/types';
|
||||
export { ActiveHeadEntry, AriaAttributes, BodyAttributesWithoutEvents, BodyEvents, DataKeys, GlobalAttributes, Head, HeadEntryOptions, HeadTag, HttpEventAttributes, LinkWithoutEvents, MergeHead, MetaFlat, MetaFlatInput, RawInput, RenderSSRHeadOptions, ResolvableHead, ScriptWithoutEvents, SerializableHead, SpeculationRules, Unhead } from 'unhead/types';
|
||||
import { V as VueHeadClient, U as UseHeadInput, a as UseHeadOptions, b as UseSeoMetaInput } from './shared/vue.DoxLTFJk.js';
|
||||
export { B as BodyAttr, D as DeepResolvableProperties, H as HtmlAttr, M as MaybeFalsy, l as ReactiveHead, n as ResolvableArray, d as ResolvableBase, k as ResolvableBodyAttributes, j as ResolvableHtmlAttributes, e as ResolvableLink, f as ResolvableMeta, i as ResolvableNoscript, o as ResolvableProperties, h as ResolvableScript, g as ResolvableStyle, R as ResolvableTitle, c as ResolvableTitleTemplate, p as ResolvableUnion, m as ResolvableValue } from './shared/vue.DoxLTFJk.js';
|
||||
import { U as UseHeadSafeInput } from './shared/vue.CzjZUNjB.js';
|
||||
export { H as HeadSafe, S as SafeBodyAttr, a as SafeHtmlAttr, c as SafeLink, b as SafeMeta, e as SafeNoscript, d as SafeScript, f as SafeStyle } from './shared/vue.CzjZUNjB.js';
|
||||
export { AsVoidFunctions, EventHandlerOptions, RecordingEntry, ScriptInstance, UseFunctionType, UseScriptResolvedInput, UseScriptStatus, WarmupStrategy, createSpyProxy, resolveScriptKey } from 'unhead/scripts';
|
||||
export { UseScriptContext, UseScriptInput, UseScriptOptions, UseScriptReturn, VueScriptInstance, useScript } from './scripts.js';
|
||||
export { Base, BodyAttributes, HtmlAttributes, Link, Meta, Noscript, Script, Style } from './types.js';
|
||||
export { resolveUnrefHeadInput } from './utils.js';
|
||||
export { V as VueHeadMixin } from './shared/vue.DnywREVF.js';
|
||||
import 'vue';
|
||||
import 'unhead/utils';
|
||||
|
||||
declare const unheadVueComposablesImports: {
|
||||
'@unhead/vue': string[];
|
||||
};
|
||||
|
||||
declare function injectHead(): VueHeadClient;
|
||||
declare function useHead<I = UseHeadInput>(input?: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<I>;
|
||||
declare function useHeadSafe(input?: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadSafeInput>;
|
||||
declare function useSeoMeta(input?: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<UseSeoMetaInput>;
|
||||
/**
|
||||
* @deprecated use `useHead` instead.Advanced use cases should tree shake using import.meta.* if statements.
|
||||
*/
|
||||
declare function useServerHead<I = UseHeadInput>(input?: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<I>;
|
||||
/**
|
||||
* @deprecated use `useHeadSafe` instead.Advanced use cases should tree shake using import.meta.* if statements.
|
||||
*/
|
||||
declare function useServerHeadSafe(input?: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadSafeInput>;
|
||||
/**
|
||||
* @deprecated use `useSeoMeta` instead.Advanced use cases should tree shake using import.meta.* if statements.
|
||||
*/
|
||||
declare function useServerSeoMeta(input?: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<UseSeoMetaInput>;
|
||||
|
||||
declare const headSymbol = "usehead";
|
||||
|
||||
/**
|
||||
* @deprecated Use createUnhead
|
||||
*/
|
||||
declare const createHeadCore: typeof createUnhead;
|
||||
|
||||
export { UseHeadInput, UseHeadOptions, UseHeadSafeInput, UseSeoMetaInput, VueHeadClient, createHeadCore, headSymbol, injectHead, unheadVueComposablesImports, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
||||
19
node_modules/@unhead/vue/dist/index.mjs
generated
vendored
Normal file
19
node_modules/@unhead/vue/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { createUnhead } from 'unhead';
|
||||
export { createUnhead } from 'unhead';
|
||||
export { h as headSymbol, i as injectHead, u as useHead, a as useHeadSafe, b as useSeoMeta, c as useServerHead, d as useServerHeadSafe, e as useServerSeoMeta } from './shared/vue.Cr7xSEtD.mjs';
|
||||
export { resolveUnrefHeadInput } from './utils.mjs';
|
||||
export { V as VueHeadMixin } from './shared/vue.BM998iwd.mjs';
|
||||
export { u as useScript } from './shared/vue.eRs8ydhm.mjs';
|
||||
import 'unhead/plugins';
|
||||
import 'unhead/utils';
|
||||
import 'vue';
|
||||
import './shared/vue.N9zWjxoK.mjs';
|
||||
import 'unhead/scripts';
|
||||
|
||||
const unheadVueComposablesImports = {
|
||||
"@unhead/vue": ["injectHead", "useHead", "useSeoMeta", "useHeadSafe", "useServerHead", "useServerSeoMeta", "useServerHeadSafe"]
|
||||
};
|
||||
|
||||
const createHeadCore = createUnhead;
|
||||
|
||||
export { createHeadCore, unheadVueComposablesImports };
|
||||
34
node_modules/@unhead/vue/dist/legacy.d.mts
generated
vendored
Normal file
34
node_modules/@unhead/vue/dist/legacy.d.mts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import * as unhead_types from 'unhead/types';
|
||||
import { CreateClientHeadOptions, ActiveHeadEntry } from 'unhead/types';
|
||||
import { createUnhead } from 'unhead';
|
||||
import { V as VueHeadClient, U as UseHeadInput, a as UseHeadOptions, b as UseSeoMetaInput } from './shared/vue.DoxLTFJk.mjs';
|
||||
import { U as UseHeadSafeInput } from './shared/vue.DMlT7xkj.mjs';
|
||||
import 'vue';
|
||||
|
||||
declare const createHeadCore: typeof createUnhead;
|
||||
declare function resolveUnrefHeadInput(input: any): any;
|
||||
declare function CapoPlugin(): unhead_types.HeadPluginInput;
|
||||
declare function createHead(options?: CreateClientHeadOptions): VueHeadClient;
|
||||
declare function createServerHead(options?: CreateClientHeadOptions): VueHeadClient;
|
||||
/**
|
||||
* @deprecated Please switch to non-legacy version
|
||||
*/
|
||||
declare function setHeadInjectionHandler(handler: () => VueHeadClient<any> | undefined): void;
|
||||
declare function injectHead(): VueHeadClient<any> | undefined;
|
||||
declare function useHead(input: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadInput> | void;
|
||||
declare function useHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
||||
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
||||
/**
|
||||
* @deprecated use `useHead` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
||||
*/
|
||||
declare function useServerHead(input: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
||||
/**
|
||||
* @deprecated use `useHeadSafe` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
||||
*/
|
||||
declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
||||
/**
|
||||
* @deprecated use `useSeoMeta` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
||||
*/
|
||||
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
||||
|
||||
export { CapoPlugin, createHead, createHeadCore, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
||||
34
node_modules/@unhead/vue/dist/legacy.d.ts
generated
vendored
Normal file
34
node_modules/@unhead/vue/dist/legacy.d.ts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import * as unhead_types from 'unhead/types';
|
||||
import { CreateClientHeadOptions, ActiveHeadEntry } from 'unhead/types';
|
||||
import { createUnhead } from 'unhead';
|
||||
import { V as VueHeadClient, U as UseHeadInput, a as UseHeadOptions, b as UseSeoMetaInput } from './shared/vue.DoxLTFJk.js';
|
||||
import { U as UseHeadSafeInput } from './shared/vue.CzjZUNjB.js';
|
||||
import 'vue';
|
||||
|
||||
declare const createHeadCore: typeof createUnhead;
|
||||
declare function resolveUnrefHeadInput(input: any): any;
|
||||
declare function CapoPlugin(): unhead_types.HeadPluginInput;
|
||||
declare function createHead(options?: CreateClientHeadOptions): VueHeadClient;
|
||||
declare function createServerHead(options?: CreateClientHeadOptions): VueHeadClient;
|
||||
/**
|
||||
* @deprecated Please switch to non-legacy version
|
||||
*/
|
||||
declare function setHeadInjectionHandler(handler: () => VueHeadClient<any> | undefined): void;
|
||||
declare function injectHead(): VueHeadClient<any> | undefined;
|
||||
declare function useHead(input: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadInput> | void;
|
||||
declare function useHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
||||
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
||||
/**
|
||||
* @deprecated use `useHead` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
||||
*/
|
||||
declare function useServerHead(input: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
||||
/**
|
||||
* @deprecated use `useHeadSafe` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
||||
*/
|
||||
declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
||||
/**
|
||||
* @deprecated use `useSeoMeta` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
||||
*/
|
||||
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
||||
|
||||
export { CapoPlugin, createHead, createHeadCore, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
||||
114
node_modules/@unhead/vue/dist/legacy.mjs
generated
vendored
Normal file
114
node_modules/@unhead/vue/dist/legacy.mjs
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
import { createUnhead } from 'unhead';
|
||||
import { inject, ref, watchEffect, unref, watch, getCurrentInstance, onBeforeUnmount, onDeactivated, onActivated } from 'vue';
|
||||
import { createHead as createHead$1 } from './client.mjs';
|
||||
import { h as headSymbol } from './shared/vue.Cr7xSEtD.mjs';
|
||||
import { V as VueResolver } from './shared/vue.N9zWjxoK.mjs';
|
||||
import { createHead as createHead$2 } from './server.mjs';
|
||||
import { walkResolver } from 'unhead/utils';
|
||||
import { defineHeadPlugin, DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin, SafeInputPlugin, FlatMetaPlugin } from 'unhead/plugins';
|
||||
import 'unhead/client';
|
||||
import './shared/vue.BM998iwd.mjs';
|
||||
import 'unhead/server';
|
||||
|
||||
const createHeadCore = createUnhead;
|
||||
function resolveUnrefHeadInput(input) {
|
||||
return walkResolver(input, VueResolver);
|
||||
}
|
||||
function CapoPlugin() {
|
||||
return defineHeadPlugin({
|
||||
key: "capo"
|
||||
});
|
||||
}
|
||||
function createHead(options = {}) {
|
||||
return createHead$1({
|
||||
disableCapoSorting: true,
|
||||
...options,
|
||||
plugins: [
|
||||
DeprecationsPlugin,
|
||||
PromisesPlugin,
|
||||
TemplateParamsPlugin,
|
||||
AliasSortingPlugin,
|
||||
...options.plugins || []
|
||||
]
|
||||
});
|
||||
}
|
||||
function createServerHead(options = {}) {
|
||||
return createHead$2({
|
||||
disableCapoSorting: true,
|
||||
...options,
|
||||
plugins: [
|
||||
DeprecationsPlugin,
|
||||
PromisesPlugin,
|
||||
TemplateParamsPlugin,
|
||||
AliasSortingPlugin,
|
||||
...options.plugins || []
|
||||
]
|
||||
});
|
||||
}
|
||||
function setHeadInjectionHandler(handler) {
|
||||
}
|
||||
function injectHead() {
|
||||
return inject(headSymbol);
|
||||
}
|
||||
function useHead(input, options = {}) {
|
||||
const head = options.head || injectHead();
|
||||
if (head) {
|
||||
return head.ssr ? head.push(input, options) : clientUseHead(head, input, options);
|
||||
}
|
||||
}
|
||||
function clientUseHead(head, input, options = {}) {
|
||||
const deactivated = ref(false);
|
||||
const resolvedInput = ref({});
|
||||
watchEffect(() => {
|
||||
resolvedInput.value = deactivated.value ? {} : walkResolver(input, (v) => unref(v));
|
||||
});
|
||||
const entry = head.push(resolvedInput.value, options);
|
||||
watch(resolvedInput, (e) => {
|
||||
entry.patch(e);
|
||||
});
|
||||
const vm = getCurrentInstance();
|
||||
if (vm) {
|
||||
onBeforeUnmount(() => {
|
||||
entry.dispose();
|
||||
});
|
||||
onDeactivated(() => {
|
||||
deactivated.value = true;
|
||||
});
|
||||
onActivated(() => {
|
||||
deactivated.value = false;
|
||||
});
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
function useHeadSafe(input, options = {}) {
|
||||
const head = options.head || injectHead();
|
||||
if (head) {
|
||||
head.use(SafeInputPlugin);
|
||||
options._safe = true;
|
||||
return useHead(input, options);
|
||||
}
|
||||
}
|
||||
function useSeoMeta(input, options) {
|
||||
const head = options?.head || injectHead();
|
||||
if (head) {
|
||||
head.use(FlatMetaPlugin);
|
||||
const { title, titleTemplate, ...meta } = input;
|
||||
return useHead({
|
||||
title,
|
||||
titleTemplate,
|
||||
// @ts-expect-error runtime type
|
||||
_flatMeta: meta
|
||||
}, options);
|
||||
}
|
||||
}
|
||||
function useServerHead(input, options = {}) {
|
||||
return useHead(input, { ...options, mode: "server" });
|
||||
}
|
||||
function useServerHeadSafe(input, options = {}) {
|
||||
return useHeadSafe(input, { ...options, mode: "server" });
|
||||
}
|
||||
function useServerSeoMeta(input, options) {
|
||||
return useSeoMeta(input, { ...options, mode: "server" });
|
||||
}
|
||||
|
||||
export { CapoPlugin, createHead, createHeadCore, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
||||
1
node_modules/@unhead/vue/dist/plugins.d.mts
generated
vendored
Normal file
1
node_modules/@unhead/vue/dist/plugins.d.mts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from 'unhead/plugins';
|
||||
1
node_modules/@unhead/vue/dist/plugins.d.ts
generated
vendored
Normal file
1
node_modules/@unhead/vue/dist/plugins.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from 'unhead/plugins';
|
||||
1
node_modules/@unhead/vue/dist/plugins.mjs
generated
vendored
Normal file
1
node_modules/@unhead/vue/dist/plugins.mjs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from 'unhead/plugins';
|
||||
35
node_modules/@unhead/vue/dist/scripts.d.mts
generated
vendored
Normal file
35
node_modules/@unhead/vue/dist/scripts.d.mts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import { UseScriptOptions as UseScriptOptions$1, ScriptInstance, UseScriptStatus, UseFunctionType } from 'unhead/scripts';
|
||||
export { AsVoidFunctions, EventHandlerOptions, RecordingEntry, ScriptInstance, UseFunctionType, UseScriptResolvedInput, UseScriptStatus, WarmupStrategy, createSpyProxy, resolveScriptKey } from 'unhead/scripts';
|
||||
import { ScriptWithoutEvents, DataKeys, SchemaAugmentations, HeadEntryOptions } from 'unhead/types';
|
||||
import { Ref } from 'vue';
|
||||
import { o as ResolvableProperties, V as VueHeadClient } from './shared/vue.DoxLTFJk.mjs';
|
||||
|
||||
interface VueScriptInstance<T extends Record<symbol | string, any>> extends Omit<ScriptInstance<T>, 'status'> {
|
||||
status: Ref<UseScriptStatus>;
|
||||
}
|
||||
type UseScriptInput = string | (ResolvableProperties<Omit<ScriptWithoutEvents & DataKeys & SchemaAugmentations['script'], 'src'>> & {
|
||||
src: string;
|
||||
});
|
||||
interface UseScriptOptions<T extends Record<symbol | string, any> = Record<string, any>> extends Omit<HeadEntryOptions, 'head'>, Pick<UseScriptOptions$1<T>, 'use' | 'eventContext' | 'beforeInit'> {
|
||||
/**
|
||||
* The trigger to load the script:
|
||||
* - `undefined` | `client` - (Default) Load the script on the client when this js is loaded.
|
||||
* - `manual` - Load the script manually by calling `$script.load()`, exists only on the client.
|
||||
* - `Promise` - Load the script when the promise resolves, exists only on the client.
|
||||
* - `Function` - Register a callback function to load the script, exists only on the client.
|
||||
* - `server` - Have the script injected on the server.
|
||||
* - `Ref<boolean>` - Load the script when the ref becomes true.
|
||||
* - `() => boolean` - Getter function, load the script when return value becomes true.
|
||||
*/
|
||||
trigger?: UseScriptOptions$1['trigger'] | Ref<boolean> | (() => boolean);
|
||||
/**
|
||||
* Unhead instance.
|
||||
*/
|
||||
head?: VueHeadClient<any>;
|
||||
}
|
||||
type UseScriptContext<T extends Record<symbol | string, any>> = VueScriptInstance<T>;
|
||||
type UseScriptReturn<T extends Record<symbol | string, any>> = UseScriptContext<UseFunctionType<UseScriptOptions<T>, T>>;
|
||||
declare function useScript<T extends Record<symbol | string, any> = Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T>): UseScriptReturn<T>;
|
||||
|
||||
export { useScript };
|
||||
export type { UseScriptContext, UseScriptInput, UseScriptOptions, UseScriptReturn, VueScriptInstance };
|
||||
35
node_modules/@unhead/vue/dist/scripts.d.ts
generated
vendored
Normal file
35
node_modules/@unhead/vue/dist/scripts.d.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import { UseScriptOptions as UseScriptOptions$1, ScriptInstance, UseScriptStatus, UseFunctionType } from 'unhead/scripts';
|
||||
export { AsVoidFunctions, EventHandlerOptions, RecordingEntry, ScriptInstance, UseFunctionType, UseScriptResolvedInput, UseScriptStatus, WarmupStrategy, createSpyProxy, resolveScriptKey } from 'unhead/scripts';
|
||||
import { ScriptWithoutEvents, DataKeys, SchemaAugmentations, HeadEntryOptions } from 'unhead/types';
|
||||
import { Ref } from 'vue';
|
||||
import { o as ResolvableProperties, V as VueHeadClient } from './shared/vue.DoxLTFJk.js';
|
||||
|
||||
interface VueScriptInstance<T extends Record<symbol | string, any>> extends Omit<ScriptInstance<T>, 'status'> {
|
||||
status: Ref<UseScriptStatus>;
|
||||
}
|
||||
type UseScriptInput = string | (ResolvableProperties<Omit<ScriptWithoutEvents & DataKeys & SchemaAugmentations['script'], 'src'>> & {
|
||||
src: string;
|
||||
});
|
||||
interface UseScriptOptions<T extends Record<symbol | string, any> = Record<string, any>> extends Omit<HeadEntryOptions, 'head'>, Pick<UseScriptOptions$1<T>, 'use' | 'eventContext' | 'beforeInit'> {
|
||||
/**
|
||||
* The trigger to load the script:
|
||||
* - `undefined` | `client` - (Default) Load the script on the client when this js is loaded.
|
||||
* - `manual` - Load the script manually by calling `$script.load()`, exists only on the client.
|
||||
* - `Promise` - Load the script when the promise resolves, exists only on the client.
|
||||
* - `Function` - Register a callback function to load the script, exists only on the client.
|
||||
* - `server` - Have the script injected on the server.
|
||||
* - `Ref<boolean>` - Load the script when the ref becomes true.
|
||||
* - `() => boolean` - Getter function, load the script when return value becomes true.
|
||||
*/
|
||||
trigger?: UseScriptOptions$1['trigger'] | Ref<boolean> | (() => boolean);
|
||||
/**
|
||||
* Unhead instance.
|
||||
*/
|
||||
head?: VueHeadClient<any>;
|
||||
}
|
||||
type UseScriptContext<T extends Record<symbol | string, any>> = VueScriptInstance<T>;
|
||||
type UseScriptReturn<T extends Record<symbol | string, any>> = UseScriptContext<UseFunctionType<UseScriptOptions<T>, T>>;
|
||||
declare function useScript<T extends Record<symbol | string, any> = Record<symbol | string, any>>(_input: UseScriptInput, _options?: UseScriptOptions<T>): UseScriptReturn<T>;
|
||||
|
||||
export { useScript };
|
||||
export type { UseScriptContext, UseScriptInput, UseScriptOptions, UseScriptReturn, VueScriptInstance };
|
||||
7
node_modules/@unhead/vue/dist/scripts.mjs
generated
vendored
Normal file
7
node_modules/@unhead/vue/dist/scripts.mjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export { createSpyProxy, resolveScriptKey } from 'unhead/scripts';
|
||||
export { u as useScript } from './shared/vue.eRs8ydhm.mjs';
|
||||
import 'vue';
|
||||
import './shared/vue.Cr7xSEtD.mjs';
|
||||
import 'unhead/plugins';
|
||||
import 'unhead/utils';
|
||||
import './shared/vue.N9zWjxoK.mjs';
|
||||
10
node_modules/@unhead/vue/dist/server.d.mts
generated
vendored
Normal file
10
node_modules/@unhead/vue/dist/server.d.mts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { CreateServerHeadOptions } from 'unhead/types';
|
||||
export { CreateServerHeadOptions } from 'unhead/types';
|
||||
export { V as VueHeadMixin } from './shared/vue.DnywREVF.mjs';
|
||||
export { SSRHeadPayload, extractUnheadInputFromHtml, propsToString, renderSSRHead, transformHtmlTemplate } from 'unhead/server';
|
||||
import { V as VueHeadClient } from './shared/vue.DoxLTFJk.mjs';
|
||||
import 'vue';
|
||||
|
||||
declare function createHead(options?: Omit<CreateServerHeadOptions, 'propsResolver'>): VueHeadClient;
|
||||
|
||||
export { VueHeadClient, createHead };
|
||||
10
node_modules/@unhead/vue/dist/server.d.ts
generated
vendored
Normal file
10
node_modules/@unhead/vue/dist/server.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { CreateServerHeadOptions } from 'unhead/types';
|
||||
export { CreateServerHeadOptions } from 'unhead/types';
|
||||
export { V as VueHeadMixin } from './shared/vue.DnywREVF.js';
|
||||
export { SSRHeadPayload, extractUnheadInputFromHtml, propsToString, renderSSRHead, transformHtmlTemplate } from 'unhead/server';
|
||||
import { V as VueHeadClient } from './shared/vue.DoxLTFJk.js';
|
||||
import 'vue';
|
||||
|
||||
declare function createHead(options?: Omit<CreateServerHeadOptions, 'propsResolver'>): VueHeadClient;
|
||||
|
||||
export { VueHeadClient, createHead };
|
||||
20
node_modules/@unhead/vue/dist/server.mjs
generated
vendored
Normal file
20
node_modules/@unhead/vue/dist/server.mjs
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { createHead as createHead$1 } from 'unhead/server';
|
||||
export { extractUnheadInputFromHtml, propsToString, renderSSRHead, transformHtmlTemplate } from 'unhead/server';
|
||||
import { v as vueInstall } from './shared/vue.Cr7xSEtD.mjs';
|
||||
import { V as VueResolver } from './shared/vue.N9zWjxoK.mjs';
|
||||
export { V as VueHeadMixin } from './shared/vue.BM998iwd.mjs';
|
||||
import 'unhead/plugins';
|
||||
import 'unhead/utils';
|
||||
import 'vue';
|
||||
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function createHead(options = {}) {
|
||||
const head = createHead$1({
|
||||
...options,
|
||||
propResolvers: [VueResolver]
|
||||
});
|
||||
head.install = vueInstall(head);
|
||||
return head;
|
||||
}
|
||||
|
||||
export { createHead };
|
||||
18
node_modules/@unhead/vue/dist/shared/vue.BM998iwd.mjs
generated
vendored
Normal file
18
node_modules/@unhead/vue/dist/shared/vue.BM998iwd.mjs
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { getCurrentInstance } from 'vue';
|
||||
import { u as useHead } from './vue.Cr7xSEtD.mjs';
|
||||
|
||||
const VueHeadMixin = {
|
||||
created() {
|
||||
let source = false;
|
||||
const instance = getCurrentInstance();
|
||||
if (!instance)
|
||||
return;
|
||||
const options = instance.type;
|
||||
if (!options || !("head" in options))
|
||||
return;
|
||||
source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
|
||||
source && useHead(source);
|
||||
}
|
||||
};
|
||||
|
||||
export { VueHeadMixin as V };
|
||||
84
node_modules/@unhead/vue/dist/shared/vue.Cr7xSEtD.mjs
generated
vendored
Normal file
84
node_modules/@unhead/vue/dist/shared/vue.Cr7xSEtD.mjs
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
import { SafeInputPlugin, FlatMetaPlugin } from 'unhead/plugins';
|
||||
import { walkResolver } from 'unhead/utils';
|
||||
import { hasInjectionContext, inject, ref, watchEffect, getCurrentInstance, onBeforeUnmount, onDeactivated, onActivated } from 'vue';
|
||||
import { V as VueResolver } from './vue.N9zWjxoK.mjs';
|
||||
|
||||
const headSymbol = "usehead";
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function vueInstall(head) {
|
||||
const plugin = {
|
||||
install(app) {
|
||||
app.config.globalProperties.$unhead = head;
|
||||
app.config.globalProperties.$head = head;
|
||||
app.provide(headSymbol, head);
|
||||
}
|
||||
};
|
||||
return plugin.install;
|
||||
}
|
||||
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function injectHead() {
|
||||
if (hasInjectionContext()) {
|
||||
const instance = inject(headSymbol);
|
||||
if (instance) {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
throw new Error("useHead() was called without provide context, ensure you call it through the setup() function.");
|
||||
}
|
||||
function useHead(input, options = {}) {
|
||||
const head = options.head || /* @__PURE__ */ injectHead();
|
||||
return head.ssr ? head.push(input || {}, options) : clientUseHead(head, input, options);
|
||||
}
|
||||
function clientUseHead(head, input, options = {}) {
|
||||
const deactivated = ref(false);
|
||||
let entry;
|
||||
watchEffect(() => {
|
||||
const i = deactivated.value ? {} : walkResolver(input, VueResolver);
|
||||
if (entry) {
|
||||
entry.patch(i);
|
||||
} else {
|
||||
entry = head.push(i, options);
|
||||
}
|
||||
});
|
||||
const vm = getCurrentInstance();
|
||||
if (vm) {
|
||||
onBeforeUnmount(() => {
|
||||
entry.dispose();
|
||||
});
|
||||
onDeactivated(() => {
|
||||
deactivated.value = true;
|
||||
});
|
||||
onActivated(() => {
|
||||
deactivated.value = false;
|
||||
});
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
function useHeadSafe(input = {}, options = {}) {
|
||||
const head = options.head || /* @__PURE__ */ injectHead();
|
||||
head.use(SafeInputPlugin);
|
||||
options._safe = true;
|
||||
return useHead(input, options);
|
||||
}
|
||||
function useSeoMeta(input = {}, options = {}) {
|
||||
const head = options.head || /* @__PURE__ */ injectHead();
|
||||
head.use(FlatMetaPlugin);
|
||||
const { title, titleTemplate, ...meta } = input;
|
||||
return useHead({
|
||||
title,
|
||||
titleTemplate,
|
||||
_flatMeta: meta
|
||||
}, options);
|
||||
}
|
||||
function useServerHead(input, options = {}) {
|
||||
return useHead(input, { ...options, mode: "server" });
|
||||
}
|
||||
function useServerHeadSafe(input, options = {}) {
|
||||
return useHeadSafe(input, { ...options, mode: "server" });
|
||||
}
|
||||
function useServerSeoMeta(input, options = {}) {
|
||||
return useSeoMeta(input, { ...options, mode: "server" });
|
||||
}
|
||||
|
||||
export { useHeadSafe as a, useSeoMeta as b, useServerHead as c, useServerHeadSafe as d, useServerSeoMeta as e, headSymbol as h, injectHead as i, useHead as u, vueInstall as v };
|
||||
63
node_modules/@unhead/vue/dist/shared/vue.CzjZUNjB.d.ts
generated
vendored
Normal file
63
node_modules/@unhead/vue/dist/shared/vue.CzjZUNjB.d.ts
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
import { ResolvableHead, LinkWithoutEvents, DataKeys, SchemaAugmentations, UnheadMeta, Style, ScriptWithoutEvents, TagPriority, TagPosition, ResolvesDuplicates, ProcessesTemplateParams, Noscript, HtmlAttributes, BodyAttributesWithoutEvents } from 'unhead/types';
|
||||
import { m as ResolvableValue, o as ResolvableProperties } from './vue.DoxLTFJk.js';
|
||||
|
||||
type SafeBodyAttr = ResolvableProperties<Pick<BodyAttributesWithoutEvents, 'id' | 'class' | 'style'> & DataKeys & SchemaAugmentations['bodyAttrs']>;
|
||||
type SafeHtmlAttr = ResolvableProperties<Pick<HtmlAttributes, 'id' | 'class' | 'style' | 'lang' | 'dir'> & DataKeys & SchemaAugmentations['htmlAttrs']>;
|
||||
type SafeMeta = ResolvableProperties<Pick<UnheadMeta, 'id' | 'name' | 'property' | 'charset' | 'content' | 'media'> & DataKeys & SchemaAugmentations['meta']>;
|
||||
type SafeLink = ResolvableProperties<Pick<LinkWithoutEvents, 'id' | 'color' | 'crossorigin' | 'fetchpriority' | 'href' | 'hreflang' | 'imagesrcset' | 'imagesizes' | 'integrity' | 'media' | 'referrerpolicy' | 'rel' | 'sizes' | 'type'> & DataKeys & SchemaAugmentations['link']>;
|
||||
type SafeScript = ResolvableProperties<Pick<ScriptWithoutEvents, 'id' | 'type' | 'nonce' | 'blocking'> & DataKeys & {
|
||||
textContent?: string;
|
||||
} & TagPriority & TagPosition & ResolvesDuplicates & ProcessesTemplateParams>;
|
||||
type SafeNoscript = ResolvableProperties<Pick<Noscript, 'id'> & DataKeys & Omit<SchemaAugmentations['noscript'], 'innerHTML'>>;
|
||||
type SafeStyle = ResolvableProperties<Pick<Style, 'id' | 'media' | 'nonce' | 'title' | 'blocking'> & DataKeys & Omit<SchemaAugmentations['style'], 'innerHTML'>>;
|
||||
interface HeadSafe extends Pick<ResolvableHead, 'title' | 'titleTemplate' | 'templateParams'> {
|
||||
/**
|
||||
* The `<link>` HTML element specifies relationships between the current document and an external resource.
|
||||
* This element is most commonly used to link to stylesheets, but is also used to establish site icons
|
||||
* (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
|
||||
*/
|
||||
link?: ResolvableValue<ResolvableValue<SafeLink[]>>;
|
||||
/**
|
||||
* The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
||||
*/
|
||||
meta?: ResolvableValue<ResolvableValue<SafeMeta>[]>;
|
||||
/**
|
||||
* The `<style>` HTML element contains style information for a document, or part of a document.
|
||||
* It contains CSS, which is applied to the contents of the document containing the `<style>` element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
|
||||
*/
|
||||
style?: ResolvableValue<ResolvableValue<(SafeStyle | string)>[]>;
|
||||
/**
|
||||
* The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
||||
*/
|
||||
script?: ResolvableValue<ResolvableValue<(SafeScript | string)>[]>;
|
||||
/**
|
||||
* The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
|
||||
* or if scripting is currently turned off in the browser.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
|
||||
*/
|
||||
noscript?: ResolvableValue<ResolvableValue<(SafeNoscript | string)>[]>;
|
||||
/**
|
||||
* Attributes for the `<html>` HTML element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
|
||||
*/
|
||||
htmlAttrs?: ResolvableValue<SafeHtmlAttr>;
|
||||
/**
|
||||
* Attributes for the `<body>` HTML element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
|
||||
*/
|
||||
bodyAttrs?: ResolvableValue<SafeBodyAttr>;
|
||||
}
|
||||
type UseHeadSafeInput = ResolvableValue<HeadSafe>;
|
||||
|
||||
export type { HeadSafe as H, SafeBodyAttr as S, UseHeadSafeInput as U, SafeHtmlAttr as a, SafeMeta as b, SafeLink as c, SafeScript as d, SafeNoscript as e, SafeStyle as f };
|
||||
63
node_modules/@unhead/vue/dist/shared/vue.DMlT7xkj.d.mts
generated
vendored
Normal file
63
node_modules/@unhead/vue/dist/shared/vue.DMlT7xkj.d.mts
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
import { ResolvableHead, LinkWithoutEvents, DataKeys, SchemaAugmentations, UnheadMeta, Style, ScriptWithoutEvents, TagPriority, TagPosition, ResolvesDuplicates, ProcessesTemplateParams, Noscript, HtmlAttributes, BodyAttributesWithoutEvents } from 'unhead/types';
|
||||
import { m as ResolvableValue, o as ResolvableProperties } from './vue.DoxLTFJk.mjs';
|
||||
|
||||
type SafeBodyAttr = ResolvableProperties<Pick<BodyAttributesWithoutEvents, 'id' | 'class' | 'style'> & DataKeys & SchemaAugmentations['bodyAttrs']>;
|
||||
type SafeHtmlAttr = ResolvableProperties<Pick<HtmlAttributes, 'id' | 'class' | 'style' | 'lang' | 'dir'> & DataKeys & SchemaAugmentations['htmlAttrs']>;
|
||||
type SafeMeta = ResolvableProperties<Pick<UnheadMeta, 'id' | 'name' | 'property' | 'charset' | 'content' | 'media'> & DataKeys & SchemaAugmentations['meta']>;
|
||||
type SafeLink = ResolvableProperties<Pick<LinkWithoutEvents, 'id' | 'color' | 'crossorigin' | 'fetchpriority' | 'href' | 'hreflang' | 'imagesrcset' | 'imagesizes' | 'integrity' | 'media' | 'referrerpolicy' | 'rel' | 'sizes' | 'type'> & DataKeys & SchemaAugmentations['link']>;
|
||||
type SafeScript = ResolvableProperties<Pick<ScriptWithoutEvents, 'id' | 'type' | 'nonce' | 'blocking'> & DataKeys & {
|
||||
textContent?: string;
|
||||
} & TagPriority & TagPosition & ResolvesDuplicates & ProcessesTemplateParams>;
|
||||
type SafeNoscript = ResolvableProperties<Pick<Noscript, 'id'> & DataKeys & Omit<SchemaAugmentations['noscript'], 'innerHTML'>>;
|
||||
type SafeStyle = ResolvableProperties<Pick<Style, 'id' | 'media' | 'nonce' | 'title' | 'blocking'> & DataKeys & Omit<SchemaAugmentations['style'], 'innerHTML'>>;
|
||||
interface HeadSafe extends Pick<ResolvableHead, 'title' | 'titleTemplate' | 'templateParams'> {
|
||||
/**
|
||||
* The `<link>` HTML element specifies relationships between the current document and an external resource.
|
||||
* This element is most commonly used to link to stylesheets, but is also used to establish site icons
|
||||
* (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
|
||||
*/
|
||||
link?: ResolvableValue<ResolvableValue<SafeLink[]>>;
|
||||
/**
|
||||
* The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
||||
*/
|
||||
meta?: ResolvableValue<ResolvableValue<SafeMeta>[]>;
|
||||
/**
|
||||
* The `<style>` HTML element contains style information for a document, or part of a document.
|
||||
* It contains CSS, which is applied to the contents of the document containing the `<style>` element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
|
||||
*/
|
||||
style?: ResolvableValue<ResolvableValue<(SafeStyle | string)>[]>;
|
||||
/**
|
||||
* The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
||||
*/
|
||||
script?: ResolvableValue<ResolvableValue<(SafeScript | string)>[]>;
|
||||
/**
|
||||
* The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
|
||||
* or if scripting is currently turned off in the browser.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
|
||||
*/
|
||||
noscript?: ResolvableValue<ResolvableValue<(SafeNoscript | string)>[]>;
|
||||
/**
|
||||
* Attributes for the `<html>` HTML element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
|
||||
*/
|
||||
htmlAttrs?: ResolvableValue<SafeHtmlAttr>;
|
||||
/**
|
||||
* Attributes for the `<body>` HTML element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
|
||||
*/
|
||||
bodyAttrs?: ResolvableValue<SafeBodyAttr>;
|
||||
}
|
||||
type UseHeadSafeInput = ResolvableValue<HeadSafe>;
|
||||
|
||||
export type { HeadSafe as H, SafeBodyAttr as S, UseHeadSafeInput as U, SafeHtmlAttr as a, SafeMeta as b, SafeLink as c, SafeScript as d, SafeNoscript as e, SafeStyle as f };
|
||||
5
node_modules/@unhead/vue/dist/shared/vue.DnywREVF.d.mts
generated
vendored
Normal file
5
node_modules/@unhead/vue/dist/shared/vue.DnywREVF.d.mts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
declare const VueHeadMixin: {
|
||||
created(): void;
|
||||
};
|
||||
|
||||
export { VueHeadMixin as V };
|
||||
5
node_modules/@unhead/vue/dist/shared/vue.DnywREVF.d.ts
generated
vendored
Normal file
5
node_modules/@unhead/vue/dist/shared/vue.DnywREVF.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
declare const VueHeadMixin: {
|
||||
created(): void;
|
||||
};
|
||||
|
||||
export { VueHeadMixin as V };
|
||||
138
node_modules/@unhead/vue/dist/shared/vue.DoxLTFJk.d.mts
generated
vendored
Normal file
138
node_modules/@unhead/vue/dist/shared/vue.DoxLTFJk.d.mts
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
import { Stringable, SchemaAugmentations, ResolvableTitleTemplate as ResolvableTitleTemplate$1, Base, LinkWithoutEvents, DataKeys, MaybeEventFnHandlers, HttpEventAttributes, UnheadMeta, Style, ScriptWithoutEvents, Noscript, HtmlAttributes, MaybeArray, BodyAttributesWithoutEvents, BodyEvents, Unhead, HeadEntryOptions, MetaFlatInput } from 'unhead/types';
|
||||
import { ComputedRef, Ref, CSSProperties, Plugin } from 'vue';
|
||||
|
||||
type Falsy = false | null | undefined;
|
||||
type MaybeFalsy<T> = T | Falsy;
|
||||
type ResolvableValue<T> = MaybeFalsy<T> | (() => MaybeFalsy<T>) | ComputedRef<MaybeFalsy<T>> | Ref<MaybeFalsy<T>>;
|
||||
type ResolvableArray<T> = ResolvableValue<ResolvableValue<T>[]>;
|
||||
type ResolvableProperties<T> = {
|
||||
[key in keyof T]?: ResolvableValue<T[key]>;
|
||||
};
|
||||
type ResolvableUnion<T> = T extends string | number | boolean ? ResolvableValue<T> : T extends object ? DeepResolvableProperties<T> : ResolvableValue<T>;
|
||||
type DeepResolvableProperties<T> = {
|
||||
[K in keyof T]?: T[K] extends string | object ? T[K] extends string ? ResolvableUnion<T[K]> : T[K] extends object ? DeepResolvableProperties<T[K]> : ResolvableUnion<T[K]> : ResolvableUnion<T[K]>;
|
||||
};
|
||||
|
||||
interface HtmlAttr extends Omit<HtmlAttributes, 'class' | 'style'> {
|
||||
/**
|
||||
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
||||
*/
|
||||
class?: MaybeArray<ResolvableValue<Stringable> | Record<string, ResolvableValue<Stringable>>>;
|
||||
/**
|
||||
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
||||
*/
|
||||
style?: MaybeArray<ResolvableValue<Stringable> | ResolvableProperties<CSSProperties>>;
|
||||
}
|
||||
interface BodyAttr extends Omit<BodyAttributesWithoutEvents, 'class' | 'style'> {
|
||||
/**
|
||||
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
||||
*/
|
||||
class?: MaybeArray<ResolvableValue<Stringable>> | Record<string, ResolvableValue<Stringable>>;
|
||||
/**
|
||||
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
||||
*/
|
||||
style?: MaybeArray<ResolvableValue<string>> | ResolvableProperties<CSSProperties>;
|
||||
}
|
||||
type ResolvableTitle = ResolvableValue<Stringable> | ResolvableProperties<({
|
||||
textContent: Stringable;
|
||||
} & SchemaAugmentations['title'])>;
|
||||
type ResolvableTitleTemplate = ResolvableTitleTemplate$1 | Ref<string>;
|
||||
type ResolvableBase = ResolvableProperties<Base & SchemaAugmentations['base']>;
|
||||
type ResolvableLink = ResolvableProperties<LinkWithoutEvents & DataKeys & SchemaAugmentations['link']> & MaybeEventFnHandlers<HttpEventAttributes>;
|
||||
type ResolvableMeta = ResolvableProperties<UnheadMeta & DataKeys & SchemaAugmentations['meta']>;
|
||||
type ResolvableStyle = ResolvableProperties<Style & DataKeys & SchemaAugmentations['style']>;
|
||||
type ResolvableScript = ResolvableProperties<ScriptWithoutEvents & DataKeys & SchemaAugmentations['script']> & MaybeEventFnHandlers<HttpEventAttributes>;
|
||||
type ResolvableNoscript = ResolvableProperties<Noscript & DataKeys & SchemaAugmentations['noscript']>;
|
||||
type ResolvableHtmlAttributes = ResolvableProperties<HtmlAttr & DataKeys & SchemaAugmentations['htmlAttrs']>;
|
||||
type ResolvableBodyAttributes = ResolvableProperties<BodyAttr & DataKeys & SchemaAugmentations['bodyAttrs']> & MaybeEventFnHandlers<BodyEvents>;
|
||||
interface ReactiveHead {
|
||||
/**
|
||||
* The `<title>` HTML element defines the document's title that is shown in a browser's title bar or a page's tab.
|
||||
* It only contains text; tags within the element are ignored.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
|
||||
*/
|
||||
title?: ResolvableTitle;
|
||||
/**
|
||||
* Generate the title from a template.
|
||||
*/
|
||||
titleTemplate?: ResolvableTitleTemplate;
|
||||
/**
|
||||
* Variables used to substitute in the title and meta content.
|
||||
*/
|
||||
templateParams?: ResolvableProperties<{
|
||||
separator?: '|' | '-' | '·' | string;
|
||||
} & Record<string, Stringable | ResolvableProperties<Record<string, Stringable>>>>;
|
||||
/**
|
||||
* The `<base>` HTML element specifies the base URL to use for all relative URLs in a document.
|
||||
* There can be only one <base> element in a document.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
|
||||
*/
|
||||
base?: ResolvableBase;
|
||||
/**
|
||||
* The `<link>` HTML element specifies relationships between the current document and an external resource.
|
||||
* This element is most commonly used to link to stylesheets, but is also used to establish site icons
|
||||
* (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
|
||||
*/
|
||||
link?: ResolvableArray<ResolvableLink>;
|
||||
/**
|
||||
* The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
||||
*/
|
||||
meta?: ResolvableArray<ResolvableMeta>;
|
||||
/**
|
||||
* The `<style>` HTML element contains style information for a document, or part of a document.
|
||||
* It contains CSS, which is applied to the contents of the document containing the `<style>` element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
|
||||
*/
|
||||
style?: ResolvableArray<(ResolvableStyle | string)>;
|
||||
/**
|
||||
* The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
||||
*/
|
||||
script?: ResolvableArray<(ResolvableScript | string)>;
|
||||
/**
|
||||
* The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
|
||||
* or if scripting is currently turned off in the browser.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
|
||||
*/
|
||||
noscript?: ResolvableArray<(ResolvableNoscript | string)>;
|
||||
/**
|
||||
* Attributes for the `<html>` HTML element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
|
||||
*/
|
||||
htmlAttrs?: ResolvableHtmlAttributes;
|
||||
/**
|
||||
* Attributes for the `<body>` HTML element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
|
||||
*/
|
||||
bodyAttrs?: ResolvableBodyAttributes;
|
||||
}
|
||||
type UseHeadOptions = Omit<HeadEntryOptions, 'head'> & {
|
||||
head?: VueHeadClient<any>;
|
||||
};
|
||||
type UseHeadInput<Deprecated = never> = ResolvableValue<ReactiveHead>;
|
||||
type UseSeoMetaInput = ResolvableProperties<MetaFlatInput> & {
|
||||
title?: ReactiveHead['title'];
|
||||
titleTemplate?: ReactiveHead['titleTemplate'];
|
||||
};
|
||||
type VueHeadClient<I = UseHeadInput> = Unhead<I> & Plugin;
|
||||
|
||||
export type { BodyAttr as B, DeepResolvableProperties as D, HtmlAttr as H, MaybeFalsy as M, ResolvableTitle as R, UseHeadInput as U, VueHeadClient as V, UseHeadOptions as a, UseSeoMetaInput as b, ResolvableTitleTemplate as c, ResolvableBase as d, ResolvableLink as e, ResolvableMeta as f, ResolvableStyle as g, ResolvableScript as h, ResolvableNoscript as i, ResolvableHtmlAttributes as j, ResolvableBodyAttributes as k, ReactiveHead as l, ResolvableValue as m, ResolvableArray as n, ResolvableProperties as o, ResolvableUnion as p };
|
||||
138
node_modules/@unhead/vue/dist/shared/vue.DoxLTFJk.d.ts
generated
vendored
Normal file
138
node_modules/@unhead/vue/dist/shared/vue.DoxLTFJk.d.ts
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
import { Stringable, SchemaAugmentations, ResolvableTitleTemplate as ResolvableTitleTemplate$1, Base, LinkWithoutEvents, DataKeys, MaybeEventFnHandlers, HttpEventAttributes, UnheadMeta, Style, ScriptWithoutEvents, Noscript, HtmlAttributes, MaybeArray, BodyAttributesWithoutEvents, BodyEvents, Unhead, HeadEntryOptions, MetaFlatInput } from 'unhead/types';
|
||||
import { ComputedRef, Ref, CSSProperties, Plugin } from 'vue';
|
||||
|
||||
type Falsy = false | null | undefined;
|
||||
type MaybeFalsy<T> = T | Falsy;
|
||||
type ResolvableValue<T> = MaybeFalsy<T> | (() => MaybeFalsy<T>) | ComputedRef<MaybeFalsy<T>> | Ref<MaybeFalsy<T>>;
|
||||
type ResolvableArray<T> = ResolvableValue<ResolvableValue<T>[]>;
|
||||
type ResolvableProperties<T> = {
|
||||
[key in keyof T]?: ResolvableValue<T[key]>;
|
||||
};
|
||||
type ResolvableUnion<T> = T extends string | number | boolean ? ResolvableValue<T> : T extends object ? DeepResolvableProperties<T> : ResolvableValue<T>;
|
||||
type DeepResolvableProperties<T> = {
|
||||
[K in keyof T]?: T[K] extends string | object ? T[K] extends string ? ResolvableUnion<T[K]> : T[K] extends object ? DeepResolvableProperties<T[K]> : ResolvableUnion<T[K]> : ResolvableUnion<T[K]>;
|
||||
};
|
||||
|
||||
interface HtmlAttr extends Omit<HtmlAttributes, 'class' | 'style'> {
|
||||
/**
|
||||
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
||||
*/
|
||||
class?: MaybeArray<ResolvableValue<Stringable> | Record<string, ResolvableValue<Stringable>>>;
|
||||
/**
|
||||
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
||||
*/
|
||||
style?: MaybeArray<ResolvableValue<Stringable> | ResolvableProperties<CSSProperties>>;
|
||||
}
|
||||
interface BodyAttr extends Omit<BodyAttributesWithoutEvents, 'class' | 'style'> {
|
||||
/**
|
||||
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
||||
*/
|
||||
class?: MaybeArray<ResolvableValue<Stringable>> | Record<string, ResolvableValue<Stringable>>;
|
||||
/**
|
||||
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
|
||||
*/
|
||||
style?: MaybeArray<ResolvableValue<string>> | ResolvableProperties<CSSProperties>;
|
||||
}
|
||||
type ResolvableTitle = ResolvableValue<Stringable> | ResolvableProperties<({
|
||||
textContent: Stringable;
|
||||
} & SchemaAugmentations['title'])>;
|
||||
type ResolvableTitleTemplate = ResolvableTitleTemplate$1 | Ref<string>;
|
||||
type ResolvableBase = ResolvableProperties<Base & SchemaAugmentations['base']>;
|
||||
type ResolvableLink = ResolvableProperties<LinkWithoutEvents & DataKeys & SchemaAugmentations['link']> & MaybeEventFnHandlers<HttpEventAttributes>;
|
||||
type ResolvableMeta = ResolvableProperties<UnheadMeta & DataKeys & SchemaAugmentations['meta']>;
|
||||
type ResolvableStyle = ResolvableProperties<Style & DataKeys & SchemaAugmentations['style']>;
|
||||
type ResolvableScript = ResolvableProperties<ScriptWithoutEvents & DataKeys & SchemaAugmentations['script']> & MaybeEventFnHandlers<HttpEventAttributes>;
|
||||
type ResolvableNoscript = ResolvableProperties<Noscript & DataKeys & SchemaAugmentations['noscript']>;
|
||||
type ResolvableHtmlAttributes = ResolvableProperties<HtmlAttr & DataKeys & SchemaAugmentations['htmlAttrs']>;
|
||||
type ResolvableBodyAttributes = ResolvableProperties<BodyAttr & DataKeys & SchemaAugmentations['bodyAttrs']> & MaybeEventFnHandlers<BodyEvents>;
|
||||
interface ReactiveHead {
|
||||
/**
|
||||
* The `<title>` HTML element defines the document's title that is shown in a browser's title bar or a page's tab.
|
||||
* It only contains text; tags within the element are ignored.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
|
||||
*/
|
||||
title?: ResolvableTitle;
|
||||
/**
|
||||
* Generate the title from a template.
|
||||
*/
|
||||
titleTemplate?: ResolvableTitleTemplate;
|
||||
/**
|
||||
* Variables used to substitute in the title and meta content.
|
||||
*/
|
||||
templateParams?: ResolvableProperties<{
|
||||
separator?: '|' | '-' | '·' | string;
|
||||
} & Record<string, Stringable | ResolvableProperties<Record<string, Stringable>>>>;
|
||||
/**
|
||||
* The `<base>` HTML element specifies the base URL to use for all relative URLs in a document.
|
||||
* There can be only one <base> element in a document.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
|
||||
*/
|
||||
base?: ResolvableBase;
|
||||
/**
|
||||
* The `<link>` HTML element specifies relationships between the current document and an external resource.
|
||||
* This element is most commonly used to link to stylesheets, but is also used to establish site icons
|
||||
* (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
|
||||
*/
|
||||
link?: ResolvableArray<ResolvableLink>;
|
||||
/**
|
||||
* The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
||||
*/
|
||||
meta?: ResolvableArray<ResolvableMeta>;
|
||||
/**
|
||||
* The `<style>` HTML element contains style information for a document, or part of a document.
|
||||
* It contains CSS, which is applied to the contents of the document containing the `<style>` element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
|
||||
*/
|
||||
style?: ResolvableArray<(ResolvableStyle | string)>;
|
||||
/**
|
||||
* The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
||||
*/
|
||||
script?: ResolvableArray<(ResolvableScript | string)>;
|
||||
/**
|
||||
* The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
|
||||
* or if scripting is currently turned off in the browser.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
|
||||
*/
|
||||
noscript?: ResolvableArray<(ResolvableNoscript | string)>;
|
||||
/**
|
||||
* Attributes for the `<html>` HTML element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
|
||||
*/
|
||||
htmlAttrs?: ResolvableHtmlAttributes;
|
||||
/**
|
||||
* Attributes for the `<body>` HTML element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
|
||||
*/
|
||||
bodyAttrs?: ResolvableBodyAttributes;
|
||||
}
|
||||
type UseHeadOptions = Omit<HeadEntryOptions, 'head'> & {
|
||||
head?: VueHeadClient<any>;
|
||||
};
|
||||
type UseHeadInput<Deprecated = never> = ResolvableValue<ReactiveHead>;
|
||||
type UseSeoMetaInput = ResolvableProperties<MetaFlatInput> & {
|
||||
title?: ReactiveHead['title'];
|
||||
titleTemplate?: ReactiveHead['titleTemplate'];
|
||||
};
|
||||
type VueHeadClient<I = UseHeadInput> = Unhead<I> & Plugin;
|
||||
|
||||
export type { BodyAttr as B, DeepResolvableProperties as D, HtmlAttr as H, MaybeFalsy as M, ResolvableTitle as R, UseHeadInput as U, VueHeadClient as V, UseHeadOptions as a, UseSeoMetaInput as b, ResolvableTitleTemplate as c, ResolvableBase as d, ResolvableLink as e, ResolvableMeta as f, ResolvableStyle as g, ResolvableScript as h, ResolvableNoscript as i, ResolvableHtmlAttributes as j, ResolvableBodyAttributes as k, ReactiveHead as l, ResolvableValue as m, ResolvableArray as n, ResolvableProperties as o, ResolvableUnion as p };
|
||||
7
node_modules/@unhead/vue/dist/shared/vue.N9zWjxoK.mjs
generated
vendored
Normal file
7
node_modules/@unhead/vue/dist/shared/vue.N9zWjxoK.mjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { toValue, isRef } from 'vue';
|
||||
|
||||
const VueResolver = (_, value) => {
|
||||
return isRef(value) ? toValue(value) : value;
|
||||
};
|
||||
|
||||
export { VueResolver as V };
|
||||
72
node_modules/@unhead/vue/dist/shared/vue.eRs8ydhm.mjs
generated
vendored
Normal file
72
node_modules/@unhead/vue/dist/shared/vue.eRs8ydhm.mjs
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
import { useScript as useScript$1 } from 'unhead/scripts';
|
||||
import { getCurrentInstance, onMounted, isRef, watch, onScopeDispose, ref } from 'vue';
|
||||
import { i as injectHead } from './vue.Cr7xSEtD.mjs';
|
||||
|
||||
function registerVueScopeHandlers(script, scope) {
|
||||
if (!scope) {
|
||||
return;
|
||||
}
|
||||
const _registerCb = (key, cb) => {
|
||||
if (!script._cbs[key]) {
|
||||
cb(script.instance);
|
||||
return () => {
|
||||
};
|
||||
}
|
||||
let i = script._cbs[key].push(cb);
|
||||
const destroy = () => {
|
||||
if (i) {
|
||||
script._cbs[key]?.splice(i - 1, 1);
|
||||
i = null;
|
||||
}
|
||||
};
|
||||
onScopeDispose(destroy);
|
||||
return destroy;
|
||||
};
|
||||
script.onLoaded = (cb) => _registerCb("loaded", cb);
|
||||
script.onError = (cb) => _registerCb("error", cb);
|
||||
onScopeDispose(() => {
|
||||
script._triggerAbortController?.abort();
|
||||
});
|
||||
}
|
||||
function useScript(_input, _options) {
|
||||
const input = typeof _input === "string" ? { src: _input } : _input;
|
||||
const options = _options || {};
|
||||
const head = options?.head || injectHead();
|
||||
options.head = head;
|
||||
const scope = getCurrentInstance();
|
||||
options.eventContext = scope;
|
||||
if (scope && typeof options.trigger === "undefined") {
|
||||
options.trigger = onMounted;
|
||||
} else if (isRef(options.trigger) || typeof options.trigger === "function" && options.trigger.length === 0) {
|
||||
const trigger = options.trigger;
|
||||
let off;
|
||||
options.trigger = new Promise((resolve) => {
|
||||
off = watch(trigger, (val) => {
|
||||
if (val) {
|
||||
resolve(true);
|
||||
}
|
||||
}, {
|
||||
immediate: true
|
||||
});
|
||||
onScopeDispose(() => resolve(false), true);
|
||||
}).then((val) => {
|
||||
off?.();
|
||||
return val;
|
||||
});
|
||||
}
|
||||
head._scriptStatusWatcher = head._scriptStatusWatcher || head.hooks.hook("script:updated", ({ script: s }) => {
|
||||
if (s._statusRef) {
|
||||
s._statusRef.value = s.status;
|
||||
}
|
||||
});
|
||||
const script = useScript$1(head, input, options);
|
||||
script._statusRef = script._statusRef || ref(script.status);
|
||||
registerVueScopeHandlers(script, scope);
|
||||
return new Proxy(script, {
|
||||
get(_, key, a) {
|
||||
return Reflect.get(_, key === "status" ? "_statusRef" : key, a);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export { useScript as u };
|
||||
16
node_modules/@unhead/vue/dist/types.d.mts
generated
vendored
Normal file
16
node_modules/@unhead/vue/dist/types.d.mts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { RawInput } from 'unhead/types';
|
||||
export { ActiveHeadEntry, AriaAttributes, BodyAttributesWithoutEvents, BodyEvents, DataKeys, GlobalAttributes, Head, HeadEntryOptions, HeadTag, HttpEventAttributes, LinkWithoutEvents, MergeHead, MetaFlat, MetaFlatInput, RawInput, RenderSSRHeadOptions, ResolvableHead, ScriptWithoutEvents, SerializableHead, SpeculationRules, Unhead } from 'unhead/types';
|
||||
export { H as HeadSafe, S as SafeBodyAttr, a as SafeHtmlAttr, c as SafeLink, b as SafeMeta, e as SafeNoscript, d as SafeScript, f as SafeStyle, U as UseHeadSafeInput } from './shared/vue.DMlT7xkj.mjs';
|
||||
export { B as BodyAttr, D as DeepResolvableProperties, H as HtmlAttr, M as MaybeFalsy, l as ReactiveHead, n as ResolvableArray, d as ResolvableBase, k as ResolvableBodyAttributes, j as ResolvableHtmlAttributes, e as ResolvableLink, f as ResolvableMeta, i as ResolvableNoscript, o as ResolvableProperties, h as ResolvableScript, g as ResolvableStyle, R as ResolvableTitle, c as ResolvableTitleTemplate, p as ResolvableUnion, m as ResolvableValue, U as UseHeadInput, a as UseHeadOptions, b as UseSeoMetaInput, V as VueHeadClient } from './shared/vue.DoxLTFJk.mjs';
|
||||
import 'vue';
|
||||
|
||||
type Base = RawInput<'base'>;
|
||||
type HtmlAttributes = RawInput<'htmlAttrs'>;
|
||||
type Noscript = RawInput<'noscript'>;
|
||||
type Style = RawInput<'style'>;
|
||||
type Meta = RawInput<'meta'>;
|
||||
type Script = RawInput<'script'>;
|
||||
type Link = RawInput<'link'>;
|
||||
type BodyAttributes = RawInput<'bodyAttrs'>;
|
||||
|
||||
export type { Base, BodyAttributes, HtmlAttributes, Link, Meta, Noscript, Script, Style };
|
||||
16
node_modules/@unhead/vue/dist/types.d.ts
generated
vendored
Normal file
16
node_modules/@unhead/vue/dist/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { RawInput } from 'unhead/types';
|
||||
export { ActiveHeadEntry, AriaAttributes, BodyAttributesWithoutEvents, BodyEvents, DataKeys, GlobalAttributes, Head, HeadEntryOptions, HeadTag, HttpEventAttributes, LinkWithoutEvents, MergeHead, MetaFlat, MetaFlatInput, RawInput, RenderSSRHeadOptions, ResolvableHead, ScriptWithoutEvents, SerializableHead, SpeculationRules, Unhead } from 'unhead/types';
|
||||
export { H as HeadSafe, S as SafeBodyAttr, a as SafeHtmlAttr, c as SafeLink, b as SafeMeta, e as SafeNoscript, d as SafeScript, f as SafeStyle, U as UseHeadSafeInput } from './shared/vue.CzjZUNjB.js';
|
||||
export { B as BodyAttr, D as DeepResolvableProperties, H as HtmlAttr, M as MaybeFalsy, l as ReactiveHead, n as ResolvableArray, d as ResolvableBase, k as ResolvableBodyAttributes, j as ResolvableHtmlAttributes, e as ResolvableLink, f as ResolvableMeta, i as ResolvableNoscript, o as ResolvableProperties, h as ResolvableScript, g as ResolvableStyle, R as ResolvableTitle, c as ResolvableTitleTemplate, p as ResolvableUnion, m as ResolvableValue, U as UseHeadInput, a as UseHeadOptions, b as UseSeoMetaInput, V as VueHeadClient } from './shared/vue.DoxLTFJk.js';
|
||||
import 'vue';
|
||||
|
||||
type Base = RawInput<'base'>;
|
||||
type HtmlAttributes = RawInput<'htmlAttrs'>;
|
||||
type Noscript = RawInput<'noscript'>;
|
||||
type Style = RawInput<'style'>;
|
||||
type Meta = RawInput<'meta'>;
|
||||
type Script = RawInput<'script'>;
|
||||
type Link = RawInput<'link'>;
|
||||
type BodyAttributes = RawInput<'bodyAttrs'>;
|
||||
|
||||
export type { Base, BodyAttributes, HtmlAttributes, Link, Meta, Noscript, Script, Style };
|
||||
1
node_modules/@unhead/vue/dist/types.mjs
generated
vendored
Normal file
1
node_modules/@unhead/vue/dist/types.mjs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
11
node_modules/@unhead/vue/dist/utils.d.mts
generated
vendored
Normal file
11
node_modules/@unhead/vue/dist/utils.d.mts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { PropResolver } from 'unhead/types';
|
||||
export * from 'unhead/utils';
|
||||
|
||||
declare const VueResolver: PropResolver;
|
||||
|
||||
/**
|
||||
* @deprecated Use head.resolveTags() instead
|
||||
*/
|
||||
declare function resolveUnrefHeadInput<T extends Record<string, any>>(input: T): T;
|
||||
|
||||
export { VueResolver, resolveUnrefHeadInput };
|
||||
11
node_modules/@unhead/vue/dist/utils.d.ts
generated
vendored
Normal file
11
node_modules/@unhead/vue/dist/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { PropResolver } from 'unhead/types';
|
||||
export * from 'unhead/utils';
|
||||
|
||||
declare const VueResolver: PropResolver;
|
||||
|
||||
/**
|
||||
* @deprecated Use head.resolveTags() instead
|
||||
*/
|
||||
declare function resolveUnrefHeadInput<T extends Record<string, any>>(input: T): T;
|
||||
|
||||
export { VueResolver, resolveUnrefHeadInput };
|
||||
11
node_modules/@unhead/vue/dist/utils.mjs
generated
vendored
Normal file
11
node_modules/@unhead/vue/dist/utils.mjs
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { walkResolver } from 'unhead/utils';
|
||||
export * from 'unhead/utils';
|
||||
import { V as VueResolver } from './shared/vue.N9zWjxoK.mjs';
|
||||
import 'vue';
|
||||
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function resolveUnrefHeadInput(input) {
|
||||
return walkResolver(input, VueResolver);
|
||||
}
|
||||
|
||||
export { VueResolver, resolveUnrefHeadInput };
|
||||
1
node_modules/@unhead/vue/legacy.d.ts
generated
vendored
Normal file
1
node_modules/@unhead/vue/legacy.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dist/legacy.js'
|
||||
21
node_modules/@unhead/vue/node_modules/hookable/LICENSE.md
generated
vendored
Normal file
21
node_modules/@unhead/vue/node_modules/hookable/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
291
node_modules/@unhead/vue/node_modules/hookable/README.md
generated
vendored
Normal file
291
node_modules/@unhead/vue/node_modules/hookable/README.md
generated
vendored
Normal file
@@ -0,0 +1,291 @@
|
||||
# Hookable
|
||||
|
||||
[![npm version][npm-version-src]][npm-version-href]
|
||||
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
||||
[![bundle][bundle-src]][bundle-href]
|
||||
[![Codecov][codecov-src]][codecov-href]
|
||||
[![License][license-src]][license-href]
|
||||
|
||||
Awaitable hooks system.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npx nypm i hookable
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
**Method A: Create a hookable instance:**
|
||||
|
||||
```js
|
||||
import { Hookable } from "hookable";
|
||||
|
||||
// Create a hookable instance
|
||||
const hooks = new Hookable();
|
||||
|
||||
// Hook on 'hello'
|
||||
hooks.hook("hello", () => {
|
||||
console.log("Hello World");
|
||||
});
|
||||
|
||||
// Call 'hello' hook
|
||||
hooks.callHook("hello");
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> You can use `HookableCore` alternatively for less bundle and runtime footprint if simple `hook`/`callHook` functionality is only needed.
|
||||
|
||||
**Method B: Extend your base class from Hookable:**
|
||||
|
||||
```js
|
||||
import { Hookable } from "hookable";
|
||||
|
||||
export default class FooLib extends Hookable {
|
||||
constructor() {
|
||||
// Call to parent to initialize
|
||||
super();
|
||||
// Initialize Hookable with custom logger
|
||||
// super(consola)
|
||||
}
|
||||
|
||||
async someFunction() {
|
||||
// Call and wait for `hook1` hooks (if any) sequential
|
||||
await this.callHook("hook1");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Inside plugins, register for any hook:**
|
||||
|
||||
```js
|
||||
const lib = new FooLib();
|
||||
|
||||
// Register a handler for `hook2`
|
||||
lib.hook("hook2", async () => {
|
||||
/* ... */
|
||||
});
|
||||
|
||||
// Register multiply handlers at once
|
||||
lib.addHooks({
|
||||
hook1: async () => {
|
||||
/* ... */
|
||||
},
|
||||
hook2: [
|
||||
/* can be also an array */
|
||||
],
|
||||
});
|
||||
```
|
||||
|
||||
**Unregistering hooks:**
|
||||
|
||||
```js
|
||||
const lib = new FooLib();
|
||||
|
||||
const hook0 = async () => {
|
||||
/* ... */
|
||||
};
|
||||
const hook1 = async () => {
|
||||
/* ... */
|
||||
};
|
||||
const hook2 = async () => {
|
||||
/* ... */
|
||||
};
|
||||
|
||||
// The hook() method returns an "unregister" function
|
||||
const unregisterHook0 = lib.hook("hook0", hook0);
|
||||
const unregisterHooks1and2 = lib.addHooks({ hook1, hook2 });
|
||||
|
||||
/* ... */
|
||||
|
||||
unregisterHook0();
|
||||
unregisterHooks1and2();
|
||||
|
||||
// or
|
||||
|
||||
lib.removeHooks({ hook0, hook1 });
|
||||
lib.removeHook("hook2", hook2);
|
||||
```
|
||||
|
||||
**Triggering a hook handler once:**
|
||||
|
||||
```js
|
||||
const lib = new FooLib();
|
||||
|
||||
const unregister = lib.hook("hook0", async () => {
|
||||
// Unregister as soon as the hook is executed
|
||||
unregister();
|
||||
|
||||
/* ... */
|
||||
});
|
||||
```
|
||||
|
||||
## Hookable class
|
||||
|
||||
### `constructor()`
|
||||
|
||||
### `hook (name, fn)`
|
||||
|
||||
Register a handler for a specific hook. `fn` must be a function.
|
||||
|
||||
Returns an `unregister` function that, when called, will remove the registered handler.
|
||||
|
||||
### `hookOnce (name, fn)`
|
||||
|
||||
Similar to `hook` but unregisters hook once called.
|
||||
|
||||
Returns an `unregister` function that, when called, will remove the registered handler before first call.
|
||||
|
||||
### `addHooks(configHooks)`
|
||||
|
||||
Flatten and register hooks object.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
hookable.addHooks({
|
||||
test: {
|
||||
before: () => {},
|
||||
after: () => {},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
This registers `test:before` and `test:after` hooks at bulk.
|
||||
|
||||
Returns an `unregister` function that, when called, will remove all the registered handlers.
|
||||
|
||||
### `async callHook (name, ...args)`
|
||||
|
||||
Used by class itself to **sequentially** call handlers of a specific hook.
|
||||
|
||||
### `callHookWith (name, callerFn)`
|
||||
|
||||
If you need custom control over how hooks are called, you can provide a custom function that will receive an array of handlers of a specific hook.
|
||||
|
||||
`callerFn` if a callback function that accepts 3 arguments, `hooks`, `args` and `name`:
|
||||
|
||||
- `hooks`: Array of user hooks to be called
|
||||
- `args`: Array of arguments that should be passed each time calling a hook
|
||||
- `name`: Name of the hook
|
||||
|
||||
### `deprecateHook (old, name)`
|
||||
|
||||
Deprecate hook called `old` in favor of `name` hook.
|
||||
|
||||
### `deprecateHooks (deprecatedHooks)`
|
||||
|
||||
Deprecate all hooks from an object (keys are old and values or newer ones).
|
||||
|
||||
### `removeHook (name, fn)`
|
||||
|
||||
Remove a particular hook handler, if the `fn` handler is present.
|
||||
|
||||
### `removeHooks (configHooks)`
|
||||
|
||||
Remove multiple hook handlers.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
const handler = async () => {
|
||||
/* ... */
|
||||
};
|
||||
|
||||
hookable.hook("test:before", handler);
|
||||
hookable.addHooks({ test: { after: handler } });
|
||||
|
||||
// ...
|
||||
|
||||
hookable.removeHooks({
|
||||
test: {
|
||||
before: handler,
|
||||
after: handler,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### `removeAllHooks`
|
||||
|
||||
Remove all hook handlers.
|
||||
|
||||
### `beforeEach (syncCallback)`
|
||||
|
||||
Registers a (sync) callback to be called before each hook is being called.
|
||||
|
||||
```js
|
||||
hookable.beforeEach((event) => {
|
||||
console.log(`${event.name} hook is being called with ${event.args}`);
|
||||
});
|
||||
hookable.hook("test", () => {
|
||||
console.log("running test hook");
|
||||
});
|
||||
|
||||
// test hook is being called with []
|
||||
// running test hook
|
||||
await hookable.callHook("test");
|
||||
```
|
||||
|
||||
### `afterEach (syncCallback)`
|
||||
|
||||
Registers a (sync) callback to be called after each hook is being called.
|
||||
|
||||
```js
|
||||
hookable.afterEach((event) => {
|
||||
console.log(`${event.name} hook called with ${event.args}`);
|
||||
});
|
||||
hookable.hook("test", () => {
|
||||
console.log("running test hook");
|
||||
});
|
||||
|
||||
// running test hook
|
||||
// test hook called with []
|
||||
await hookable.callHook("test");
|
||||
```
|
||||
|
||||
### `createDebugger`
|
||||
|
||||
Automatically logs each hook that is called and how long it takes to run.
|
||||
|
||||
```js
|
||||
const debug = hookable.createDebugger(hooks, { tag: "something" });
|
||||
|
||||
hooks.callHook("some-hook", "some-arg");
|
||||
// [something] some-hook: 0.21ms
|
||||
|
||||
debug.close();
|
||||
```
|
||||
|
||||
## Migration
|
||||
|
||||
### From `4.x` to `5.x`
|
||||
|
||||
- Type checking improved. You can use `Hookable<T>` or `createHooks<T>()` to provide types interface **([c2e1e22](https://github.com/unjs/hookable/commit/c2e1e223d16e7bf87117cd8d72ad3ba211a333d8))**
|
||||
- We no longer provide an IE11 compatible umd build. Instead, you should use an ESM-aware bundler such as webpack or rollup to transpile if needed.
|
||||
- Logger param is dropped. We use `console.warn` by default for deprecated hooks.
|
||||
- Package now uses named exports. You should import `{ Hookable }` instead of `Hookable` or use new `createHooks` util
|
||||
- `mergeHooks` util is exported standalone. You should replace `Hookable.mergeHooks` and `this.mergeHooks` with new `{ mergeHooks }` export
|
||||
- In versions < 5.0.0 when using `callHook` if an error happened by one of the hook callbacks, we was handling errors globally and call global `error` hook + `console.error` instead and resolve `callHook` promise! This sometimes makes confusing behavior when we think code worked but it didn't. v5 introduced a breaking change that when a hook throws an error, `callHook` also rejects instead of a global `error` event. This means you should be careful to handle all errors when using `callHook` now.
|
||||
|
||||
## Credits
|
||||
|
||||
Extracted from [Nuxt](https://github.com/nuxt/nuxt.js) hooks system originally introduced by [Sébastien Chopin](https://github.com/Atinux)
|
||||
|
||||
Thanks to [Joe Paice](https://github.com/RGBboy) for donating [hookable](https://www.npmjs.com/package/hookable) package name.
|
||||
|
||||
## License
|
||||
|
||||
MIT - Made with 💖
|
||||
|
||||
<!-- Badges -->
|
||||
|
||||
[npm-version-src]: https://img.shields.io/npm/v/hookable?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[npm-version-href]: https://npmjs.com/package/hookable
|
||||
[npm-downloads-src]: https://img.shields.io/npm/dm/hookable?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[npm-downloads-href]: https://npmjs.com/package/hookable
|
||||
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/hookable/main?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[codecov-href]: https://codecov.io/gh/unjs/h3
|
||||
[bundle-src]: https://img.shields.io/bundlephobia/minzip/hookable?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[bundle-href]: https://bundlephobia.com/result?p=hookable
|
||||
[license-src]: https://img.shields.io/github/license/unjs/hookable.svg?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[license-href]: https://github.com/unjs/hookable/blob/main/LICENSE
|
||||
106
node_modules/@unhead/vue/node_modules/hookable/dist/index.d.mts
generated
vendored
Normal file
106
node_modules/@unhead/vue/node_modules/hookable/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
//#region src/types.d.ts
|
||||
type HookCallback = (...arguments_: any) => Promise<void> | void;
|
||||
interface Hooks {
|
||||
[key: string]: HookCallback;
|
||||
}
|
||||
type HookKeys<T> = keyof T & string;
|
||||
type DeprecatedHook<T> = {
|
||||
message?: string;
|
||||
to: HookKeys<T>;
|
||||
};
|
||||
type DeprecatedHooks<T> = { [name in HookKeys<T>]: DeprecatedHook<T> };
|
||||
type ValueOf<C> = C extends Record<any, any> ? C[keyof C] : never;
|
||||
type Strings<T> = Exclude<keyof T, number | symbol>;
|
||||
type KnownKeys<T> = keyof { [K in keyof T as string extends K ? never : number extends K ? never : K]: never };
|
||||
type StripGeneric<T> = Pick<T, KnownKeys<T> extends keyof T ? KnownKeys<T> : never>;
|
||||
type OnlyGeneric<T> = Omit<T, KnownKeys<T> extends keyof T ? KnownKeys<T> : never>;
|
||||
type Namespaces<T> = ValueOf<{ [key in Strings<T>]: key extends `${infer Namespace}:${string}` ? Namespace : never }>;
|
||||
type BareHooks<T> = ValueOf<{ [key in Strings<T>]: key extends `${string}:${string}` ? never : key }>;
|
||||
type HooksInNamespace<T, Namespace extends string> = ValueOf<{ [key in Strings<T>]: key extends `${Namespace}:${infer HookName}` ? HookName : never }>;
|
||||
type WithoutNamespace<T, Namespace extends string> = { [key in HooksInNamespace<T, Namespace>]: `${Namespace}:${key}` extends keyof T ? T[`${Namespace}:${key}`] : never };
|
||||
type NestedHooks<T> = (Partial<StripGeneric<T>> | Partial<OnlyGeneric<T>>) & Partial<{ [key in Namespaces<StripGeneric<T>>]: NestedHooks<WithoutNamespace<T, key>> }> & Partial<{ [key in BareHooks<StripGeneric<T>>]: T[key] }>;
|
||||
//#endregion
|
||||
//#region src/hookable.d.ts
|
||||
type InferCallback<HT, HN extends keyof HT> = HT[HN] extends HookCallback ? HT[HN] : never;
|
||||
type InferSpyEvent<HT extends Record<string, any>> = { [key in keyof HT]: {
|
||||
name: key;
|
||||
args: Parameters<HT[key]>;
|
||||
context: Record<string, any>;
|
||||
} }[keyof HT];
|
||||
declare class Hookable<HooksT extends Record<string, any> = Record<string, HookCallback>, HookNameT extends HookKeys<HooksT> = HookKeys<HooksT>> {
|
||||
private _hooks;
|
||||
private _before?;
|
||||
private _after?;
|
||||
private _deprecatedHooks;
|
||||
private _deprecatedMessages?;
|
||||
constructor();
|
||||
hook<NameT extends HookNameT>(name: NameT, function_: InferCallback<HooksT, NameT>, options?: {
|
||||
allowDeprecated?: boolean;
|
||||
}): () => void;
|
||||
hookOnce<NameT extends HookNameT>(name: NameT, function_: InferCallback<HooksT, NameT>): () => void;
|
||||
removeHook<NameT extends HookNameT>(name: NameT, function_: InferCallback<HooksT, NameT>): void;
|
||||
deprecateHook<NameT extends HookNameT>(name: NameT, deprecated: HookKeys<HooksT> | DeprecatedHook<HooksT>): void;
|
||||
deprecateHooks(deprecatedHooks: Partial<Record<HookNameT, DeprecatedHook<HooksT>>>): void;
|
||||
addHooks(configHooks: NestedHooks<HooksT>): () => void;
|
||||
removeHooks(configHooks: NestedHooks<HooksT>): void;
|
||||
removeAllHooks(): void;
|
||||
callHook<NameT extends HookNameT>(name: NameT, ...args: Parameters<InferCallback<HooksT, NameT>>): Promise<any> | void;
|
||||
callHookParallel<NameT extends HookNameT>(name: NameT, ...args: Parameters<InferCallback<HooksT, NameT>>): Promise<any[]> | void;
|
||||
callHookWith<NameT extends HookNameT, CallFunction extends (hooks: HookCallback[], args: Parameters<InferCallback<HooksT, NameT>>, name: NameT) => any>(caller: CallFunction, name: NameT, args: Parameters<InferCallback<HooksT, NameT>>): ReturnType<CallFunction>;
|
||||
beforeEach(function_: (event: InferSpyEvent<HooksT>) => void): () => void;
|
||||
afterEach(function_: (event: InferSpyEvent<HooksT>) => void): () => void;
|
||||
}
|
||||
declare function createHooks<T extends Record<string, any>>(): Hookable<T>;
|
||||
declare class HookableCore<HooksT extends Record<string, any> = Record<string, HookCallback>, HookNameT extends HookKeys<HooksT> = HookKeys<HooksT>> {
|
||||
protected _hooks: {
|
||||
[key: string]: HookCallback[] | undefined;
|
||||
};
|
||||
constructor();
|
||||
hook<NameT extends HookNameT>(name: NameT, fn: InferCallback<HooksT, NameT>): () => void;
|
||||
removeHook<NameT extends HookNameT>(name: NameT, function_: InferCallback<HooksT, NameT>): void;
|
||||
callHook<NameT extends HookNameT>(name: NameT, ...args: Parameters<InferCallback<HooksT, NameT>>): Promise<any> | void;
|
||||
}
|
||||
//#endregion
|
||||
//#region src/utils.d.ts
|
||||
declare function flatHooks<T>(configHooks: NestedHooks<T>, hooks?: T, parentName?: string): T;
|
||||
declare function mergeHooks<T>(...hooks: NestedHooks<T>[]): T;
|
||||
declare function serial<T>(tasks: T[], function_: (task: T) => Promise<any> | any): Promise<any>;
|
||||
type CreateTask = (name?: string) => {
|
||||
run: (function_: () => Promise<any> | any) => Promise<any> | any;
|
||||
};
|
||||
declare global {
|
||||
interface Console {
|
||||
createTask?: CreateTask;
|
||||
}
|
||||
}
|
||||
/** @deprecated */
|
||||
declare function serialCaller(hooks: HookCallback[], arguments_?: any[]): Promise<any>;
|
||||
/** @deprecated */
|
||||
declare function parallelCaller(hooks: HookCallback[], args?: any[]): Promise<any>;
|
||||
//#endregion
|
||||
//#region src/debugger.d.ts
|
||||
interface CreateDebuggerOptions {
|
||||
/** An optional tag to prefix console logs with */
|
||||
tag?: string;
|
||||
/**
|
||||
* Show hook params to the console output
|
||||
*
|
||||
* Enabled for browsers by default
|
||||
*/
|
||||
inspect?: boolean;
|
||||
/**
|
||||
* Use group/groupEnd wrapper around logs happening during a specific hook
|
||||
*
|
||||
* Enabled for browsers by default
|
||||
*/
|
||||
group?: boolean;
|
||||
/** Filter which hooks to enable debugger for. Can be a string prefix or fn. */
|
||||
filter?: string | ((event: string) => boolean);
|
||||
}
|
||||
/** Start debugging hook names and timing in console */
|
||||
declare function createDebugger(hooks: Hookable<any>, _options?: CreateDebuggerOptions): {
|
||||
/** Stop debugging and remove listeners */
|
||||
close: () => void;
|
||||
};
|
||||
//#endregion
|
||||
export { CreateDebuggerOptions, DeprecatedHook, DeprecatedHooks, HookCallback, HookKeys, Hookable, HookableCore, Hooks, NestedHooks, createDebugger, createHooks, flatHooks, mergeHooks, parallelCaller, serial, serialCaller };
|
||||
266
node_modules/@unhead/vue/node_modules/hookable/dist/index.mjs
generated
vendored
Normal file
266
node_modules/@unhead/vue/node_modules/hookable/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,266 @@
|
||||
//#region src/utils.ts
|
||||
function flatHooks(configHooks, hooks = {}, parentName) {
|
||||
for (const key in configHooks) {
|
||||
const subHook = configHooks[key];
|
||||
const name = parentName ? `${parentName}:${key}` : key;
|
||||
if (typeof subHook === "object" && subHook !== null) flatHooks(subHook, hooks, name);
|
||||
else if (typeof subHook === "function") hooks[name] = subHook;
|
||||
}
|
||||
return hooks;
|
||||
}
|
||||
function mergeHooks(...hooks) {
|
||||
const finalHooks = {};
|
||||
for (const hook of hooks) {
|
||||
const flatenHook = flatHooks(hook);
|
||||
for (const key in flatenHook) if (finalHooks[key]) finalHooks[key].push(flatenHook[key]);
|
||||
else finalHooks[key] = [flatenHook[key]];
|
||||
}
|
||||
for (const key in finalHooks) if (finalHooks[key].length > 1) {
|
||||
const array = finalHooks[key];
|
||||
finalHooks[key] = (...arguments_) => serial(array, (function_) => function_(...arguments_));
|
||||
} else finalHooks[key] = finalHooks[key][0];
|
||||
return finalHooks;
|
||||
}
|
||||
function serial(tasks, function_) {
|
||||
return tasks.reduce((promise, task) => promise.then(() => function_(task)), Promise.resolve());
|
||||
}
|
||||
const createTask = /* @__PURE__ */ (() => {
|
||||
if (console.createTask) return console.createTask;
|
||||
const defaultTask = { run: (fn) => fn() };
|
||||
return () => defaultTask;
|
||||
})();
|
||||
function callHooks(hooks, args, startIndex, task) {
|
||||
for (let i = startIndex; i < hooks.length; i += 1) try {
|
||||
const result = task ? task.run(() => hooks[i](...args)) : hooks[i](...args);
|
||||
if (result instanceof Promise) return result.then(() => callHooks(hooks, args, i + 1, task));
|
||||
} catch (error) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
||||
function serialTaskCaller(hooks, args, name) {
|
||||
if (hooks.length > 0) return callHooks(hooks, args, 0, createTask(name));
|
||||
}
|
||||
function parallelTaskCaller(hooks, args, name) {
|
||||
if (hooks.length > 0) {
|
||||
const task = createTask(name);
|
||||
return Promise.all(hooks.map((hook) => task.run(() => hook(...args))));
|
||||
}
|
||||
}
|
||||
/** @deprecated */
|
||||
function serialCaller(hooks, arguments_) {
|
||||
return hooks.reduce((promise, hookFunction) => promise.then(() => hookFunction(...arguments_ || [])), Promise.resolve());
|
||||
}
|
||||
/** @deprecated */
|
||||
function parallelCaller(hooks, args) {
|
||||
return Promise.all(hooks.map((hook) => hook(...args || [])));
|
||||
}
|
||||
function callEachWith(callbacks, arg0) {
|
||||
for (const callback of [...callbacks]) callback(arg0);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region src/hookable.ts
|
||||
var Hookable = class {
|
||||
_hooks;
|
||||
_before;
|
||||
_after;
|
||||
_deprecatedHooks;
|
||||
_deprecatedMessages;
|
||||
constructor() {
|
||||
this._hooks = {};
|
||||
this._before = void 0;
|
||||
this._after = void 0;
|
||||
this._deprecatedMessages = void 0;
|
||||
this._deprecatedHooks = {};
|
||||
this.hook = this.hook.bind(this);
|
||||
this.callHook = this.callHook.bind(this);
|
||||
this.callHookWith = this.callHookWith.bind(this);
|
||||
}
|
||||
hook(name, function_, options = {}) {
|
||||
if (!name || typeof function_ !== "function") return () => {};
|
||||
const originalName = name;
|
||||
let dep;
|
||||
while (this._deprecatedHooks[name]) {
|
||||
dep = this._deprecatedHooks[name];
|
||||
name = dep.to;
|
||||
}
|
||||
if (dep && !options.allowDeprecated) {
|
||||
let message = dep.message;
|
||||
if (!message) message = `${originalName} hook has been deprecated` + (dep.to ? `, please use ${dep.to}` : "");
|
||||
if (!this._deprecatedMessages) this._deprecatedMessages = /* @__PURE__ */ new Set();
|
||||
if (!this._deprecatedMessages.has(message)) {
|
||||
console.warn(message);
|
||||
this._deprecatedMessages.add(message);
|
||||
}
|
||||
}
|
||||
if (!function_.name) try {
|
||||
Object.defineProperty(function_, "name", {
|
||||
get: () => "_" + name.replace(/\W+/g, "_") + "_hook_cb",
|
||||
configurable: true
|
||||
});
|
||||
} catch {}
|
||||
this._hooks[name] = this._hooks[name] || [];
|
||||
this._hooks[name].push(function_);
|
||||
return () => {
|
||||
if (function_) {
|
||||
this.removeHook(name, function_);
|
||||
function_ = void 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
hookOnce(name, function_) {
|
||||
let _unreg;
|
||||
let _function = (...arguments_) => {
|
||||
if (typeof _unreg === "function") _unreg();
|
||||
_unreg = void 0;
|
||||
_function = void 0;
|
||||
return function_(...arguments_);
|
||||
};
|
||||
_unreg = this.hook(name, _function);
|
||||
return _unreg;
|
||||
}
|
||||
removeHook(name, function_) {
|
||||
const hooks = this._hooks[name];
|
||||
if (hooks) {
|
||||
const index = hooks.indexOf(function_);
|
||||
if (index !== -1) hooks.splice(index, 1);
|
||||
if (hooks.length === 0) this._hooks[name] = void 0;
|
||||
}
|
||||
}
|
||||
deprecateHook(name, deprecated) {
|
||||
this._deprecatedHooks[name] = typeof deprecated === "string" ? { to: deprecated } : deprecated;
|
||||
const _hooks = this._hooks[name] || [];
|
||||
this._hooks[name] = void 0;
|
||||
for (const hook of _hooks) this.hook(name, hook);
|
||||
}
|
||||
deprecateHooks(deprecatedHooks) {
|
||||
for (const name in deprecatedHooks) this.deprecateHook(name, deprecatedHooks[name]);
|
||||
}
|
||||
addHooks(configHooks) {
|
||||
const hooks = flatHooks(configHooks);
|
||||
const removeFns = Object.keys(hooks).map((key) => this.hook(key, hooks[key]));
|
||||
return () => {
|
||||
for (const unreg of removeFns) unreg();
|
||||
removeFns.length = 0;
|
||||
};
|
||||
}
|
||||
removeHooks(configHooks) {
|
||||
const hooks = flatHooks(configHooks);
|
||||
for (const key in hooks) this.removeHook(key, hooks[key]);
|
||||
}
|
||||
removeAllHooks() {
|
||||
this._hooks = {};
|
||||
}
|
||||
callHook(name, ...args) {
|
||||
return this.callHookWith(serialTaskCaller, name, args);
|
||||
}
|
||||
callHookParallel(name, ...args) {
|
||||
return this.callHookWith(parallelTaskCaller, name, args);
|
||||
}
|
||||
callHookWith(caller, name, args) {
|
||||
const event = this._before || this._after ? {
|
||||
name,
|
||||
args,
|
||||
context: {}
|
||||
} : void 0;
|
||||
if (this._before) callEachWith(this._before, event);
|
||||
const result = caller(this._hooks[name] ? [...this._hooks[name]] : [], args, name);
|
||||
if (result instanceof Promise) return result.finally(() => {
|
||||
if (this._after && event) callEachWith(this._after, event);
|
||||
});
|
||||
if (this._after && event) callEachWith(this._after, event);
|
||||
return result;
|
||||
}
|
||||
beforeEach(function_) {
|
||||
this._before = this._before || [];
|
||||
this._before.push(function_);
|
||||
return () => {
|
||||
if (this._before !== void 0) {
|
||||
const index = this._before.indexOf(function_);
|
||||
if (index !== -1) this._before.splice(index, 1);
|
||||
}
|
||||
};
|
||||
}
|
||||
afterEach(function_) {
|
||||
this._after = this._after || [];
|
||||
this._after.push(function_);
|
||||
return () => {
|
||||
if (this._after !== void 0) {
|
||||
const index = this._after.indexOf(function_);
|
||||
if (index !== -1) this._after.splice(index, 1);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
function createHooks() {
|
||||
return new Hookable();
|
||||
}
|
||||
var HookableCore = class {
|
||||
_hooks;
|
||||
constructor() {
|
||||
this._hooks = {};
|
||||
}
|
||||
hook(name, fn) {
|
||||
if (!name || typeof fn !== "function") return () => {};
|
||||
this._hooks[name] = this._hooks[name] || [];
|
||||
this._hooks[name].push(fn);
|
||||
return () => {
|
||||
if (fn) {
|
||||
this.removeHook(name, fn);
|
||||
fn = void 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
removeHook(name, function_) {
|
||||
const hooks = this._hooks[name];
|
||||
if (hooks) {
|
||||
const index = hooks.indexOf(function_);
|
||||
if (index !== -1) hooks.splice(index, 1);
|
||||
if (hooks.length === 0) this._hooks[name] = void 0;
|
||||
}
|
||||
}
|
||||
callHook(name, ...args) {
|
||||
const hooks = this._hooks[name];
|
||||
if (!hooks || hooks.length === 0) return;
|
||||
return callHooks(hooks, args, 0);
|
||||
}
|
||||
};
|
||||
|
||||
//#endregion
|
||||
//#region src/debugger.ts
|
||||
const isBrowser = typeof window !== "undefined";
|
||||
/** Start debugging hook names and timing in console */
|
||||
function createDebugger(hooks, _options = {}) {
|
||||
const options = {
|
||||
inspect: isBrowser,
|
||||
group: isBrowser,
|
||||
filter: () => true,
|
||||
..._options
|
||||
};
|
||||
const _filter = options.filter;
|
||||
const filter = typeof _filter === "string" ? (name) => name.startsWith(_filter) : _filter;
|
||||
const _tag = options.tag ? `[${options.tag}] ` : "";
|
||||
const logPrefix = (event) => _tag + event.name + "".padEnd(event._id, "\0");
|
||||
const _idCtr = {};
|
||||
const unsubscribeBefore = hooks.beforeEach((event) => {
|
||||
if (filter !== void 0 && !filter(event.name)) return;
|
||||
_idCtr[event.name] = _idCtr[event.name] || 0;
|
||||
event._id = _idCtr[event.name]++;
|
||||
console.time(logPrefix(event));
|
||||
});
|
||||
const unsubscribeAfter = hooks.afterEach((event) => {
|
||||
if (filter !== void 0 && !filter(event.name)) return;
|
||||
if (options.group) console.groupCollapsed(event.name);
|
||||
if (options.inspect) console.timeLog(logPrefix(event), event.args);
|
||||
else console.timeEnd(logPrefix(event));
|
||||
if (options.group) console.groupEnd();
|
||||
_idCtr[event.name]--;
|
||||
});
|
||||
return { close: () => {
|
||||
unsubscribeBefore();
|
||||
unsubscribeAfter();
|
||||
} };
|
||||
}
|
||||
|
||||
//#endregion
|
||||
export { Hookable, HookableCore, createDebugger, createHooks, flatHooks, mergeHooks, parallelCaller, serial, serialCaller };
|
||||
52
node_modules/@unhead/vue/node_modules/hookable/package.json
generated
vendored
Normal file
52
node_modules/@unhead/vue/node_modules/hookable/package.json
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "hookable",
|
||||
"version": "6.0.1",
|
||||
"description": "Awaitable hook system",
|
||||
"keywords": [
|
||||
"hook",
|
||||
"hookable",
|
||||
"plugin",
|
||||
"tapable",
|
||||
"tappable"
|
||||
],
|
||||
"repository": "unjs/hookable",
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./dist/index.mjs"
|
||||
},
|
||||
"main": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.mts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"bench": "node --expose-gc --allow-natives-syntax test/bench.ts",
|
||||
"build": "obuild src/index.ts",
|
||||
"dev": "vitest",
|
||||
"lint": "eslint --cache . && prettier -c src test",
|
||||
"lint:fix": "eslint --cache . --fix && prettier -c src test -w",
|
||||
"prepublish": "pnpm build",
|
||||
"release": "pnpm test && pnpm build && changelogen --release --publish --push",
|
||||
"test": "pnpm lint && vitest run --coverage",
|
||||
"test:types": "tsc --noEmit"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^25.0.3",
|
||||
"@vitest/coverage-v8": "^4.0.16",
|
||||
"changelogen": "^0.6.2",
|
||||
"esbuild": "^0.27.2",
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-config-unjs": "^0.5.0",
|
||||
"expect-type": "^1.3.0",
|
||||
"hookable-prev": "npm:hookable@^5.5.3",
|
||||
"mitata": "^1.0.34",
|
||||
"obuild": "^0.4.9",
|
||||
"prettier": "^3.7.4",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^7.3.0",
|
||||
"vitest": "^4.0.16"
|
||||
},
|
||||
"packageManager": "pnpm@10.26.0"
|
||||
}
|
||||
117
node_modules/@unhead/vue/package.json
generated
vendored
Normal file
117
node_modules/@unhead/vue/package.json
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
{
|
||||
"name": "@unhead/vue",
|
||||
"type": "module",
|
||||
"version": "2.1.4",
|
||||
"description": "Full-stack <head> manager built for Vue.",
|
||||
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/harlan-zw",
|
||||
"homepage": "https://unhead.unjs.io",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/unjs/unhead.git",
|
||||
"directory": "packages/vue"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"tag": "next"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/unjs/unhead/issues"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"./components": {
|
||||
"types": "./dist/components.d.ts",
|
||||
"default": "./dist/components.mjs"
|
||||
},
|
||||
"./server": {
|
||||
"types": "./dist/server.d.ts",
|
||||
"default": "./dist/server.mjs"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./dist/client.d.ts",
|
||||
"default": "./dist/client.mjs"
|
||||
},
|
||||
"./types": {
|
||||
"types": "./dist/types.d.ts",
|
||||
"default": "./dist/types.mjs"
|
||||
},
|
||||
"./legacy": {
|
||||
"types": "./dist/legacy.d.ts",
|
||||
"default": "./dist/legacy.mjs"
|
||||
},
|
||||
"./plugins": {
|
||||
"types": "./dist/plugins.d.ts",
|
||||
"default": "./dist/plugins.mjs"
|
||||
},
|
||||
"./utils": {
|
||||
"types": "./dist/utils.d.ts",
|
||||
"default": "./dist/utils.mjs"
|
||||
},
|
||||
"./scripts": {
|
||||
"types": "./dist/scripts.d.ts",
|
||||
"default": "./dist/scripts.mjs"
|
||||
}
|
||||
},
|
||||
"main": "dist/index.mjs",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"components": [
|
||||
"dist/components"
|
||||
],
|
||||
"server": [
|
||||
"dist/server"
|
||||
],
|
||||
"client": [
|
||||
"dist/client"
|
||||
],
|
||||
"types": [
|
||||
"dist/types"
|
||||
],
|
||||
"legacy": [
|
||||
"dist/legacy"
|
||||
],
|
||||
"plugins": [
|
||||
"dist/plugins"
|
||||
],
|
||||
"utils": [
|
||||
"dist/utils"
|
||||
],
|
||||
"scripts": [
|
||||
"dist/scripts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"*.d.ts",
|
||||
"dist"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"vue": ">=3.5.18"
|
||||
},
|
||||
"build": {
|
||||
"external": [
|
||||
"vue"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"hookable": "^6.0.1",
|
||||
"unhead": "2.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/server-renderer": "^3.5.26",
|
||||
"vue": "^3.5.26"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"stub": "unbuild --stub",
|
||||
"test:attw": "attw --pack"
|
||||
}
|
||||
}
|
||||
1
node_modules/@unhead/vue/plugins.d.ts
generated
vendored
Normal file
1
node_modules/@unhead/vue/plugins.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dist/plugins'
|
||||
1
node_modules/@unhead/vue/scripts.d.ts
generated
vendored
Normal file
1
node_modules/@unhead/vue/scripts.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dist/scripts'
|
||||
1
node_modules/@unhead/vue/server.d.ts
generated
vendored
Normal file
1
node_modules/@unhead/vue/server.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dist/server'
|
||||
1
node_modules/@unhead/vue/types.d.ts
generated
vendored
Normal file
1
node_modules/@unhead/vue/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dist/types'
|
||||
1
node_modules/@unhead/vue/utils.d.ts
generated
vendored
Normal file
1
node_modules/@unhead/vue/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dist/utils'
|
||||
Reference in New Issue
Block a user