@unhead/schema 1.9.4 → 1.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +9 -4
- package/dist/index.d.mts +9 -4
- package/dist/index.d.ts +9 -4
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -73,6 +73,7 @@ interface HeadHooks {
|
|
|
73
73
|
script: ScriptInstance<any>;
|
|
74
74
|
fn: string | symbol;
|
|
75
75
|
args: any;
|
|
76
|
+
exists: boolean;
|
|
76
77
|
}) => HookResult;
|
|
77
78
|
}
|
|
78
79
|
|
|
@@ -516,14 +517,13 @@ type UseScriptInput = string | (Omit<Script, 'src'> & {
|
|
|
516
517
|
type UseScriptResolvedInput = Omit<Script, 'src'> & {
|
|
517
518
|
src: string;
|
|
518
519
|
};
|
|
519
|
-
|
|
520
|
+
interface ScriptInstance<T> {
|
|
520
521
|
id: string;
|
|
521
522
|
status: UseScriptStatus;
|
|
522
|
-
loadPromise: Promise<T>;
|
|
523
523
|
entry?: ActiveHeadEntry<any>;
|
|
524
524
|
load: () => Promise<T>;
|
|
525
525
|
remove: () => boolean;
|
|
526
|
-
}
|
|
526
|
+
}
|
|
527
527
|
interface UseScriptOptions<T> extends HeadEntryOptions {
|
|
528
528
|
/**
|
|
529
529
|
* Resolve the script instance from the window.
|
|
@@ -533,7 +533,7 @@ interface UseScriptOptions<T> extends HeadEntryOptions {
|
|
|
533
533
|
* Stub the script instance. Useful for SSR or testing.
|
|
534
534
|
*/
|
|
535
535
|
stub?: ((ctx: {
|
|
536
|
-
script: ScriptInstance<T>;
|
|
536
|
+
script: Promise<T> & ScriptInstance<T>;
|
|
537
537
|
fn: string | symbol;
|
|
538
538
|
}) => any);
|
|
539
539
|
/**
|
|
@@ -550,6 +550,11 @@ interface UseScriptOptions<T> extends HeadEntryOptions {
|
|
|
550
550
|
* calling the event, allowing the event to be reactive.
|
|
551
551
|
*/
|
|
552
552
|
eventContext?: any;
|
|
553
|
+
/**
|
|
554
|
+
* Called before the script is initialized. Will not be triggered when the script is already loaded. This means
|
|
555
|
+
* this is guaranteed to be called only once, unless the script is removed and re-added.
|
|
556
|
+
*/
|
|
557
|
+
beforeInit?: () => void;
|
|
553
558
|
}
|
|
554
559
|
|
|
555
560
|
export type { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BaseMeta, BodyAttr, BodyAttributes, CreateHeadOptions, DomBeforeRenderCtx, DomRenderTagContext, DomState, EntryAugmentation, EntryResolveCtx, HasTemplateParams, Head, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, HeadPluginInput, HeadPluginOptions, HeadSafe, HeadTag, HeadTagKeys, HeadUtils, HookResult, HtmlAttr, HtmlAttributes, InnerContent, InnerContentVal, Link, MaybeArray, MaybeFunctionEntries, Meta, Never, Noscript, ProcessesTemplateParams, RenderSSRHeadOptions, ResolvesDuplicates, RuntimeMode, SSRHeadPayload, SSRRenderContext, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SchemaAugmentations, Script, ScriptInstance, ShouldRenderContext, SideEffectsRecord, Style, TagKey, TagPosition, TagPriority, TagUserProperties, TemplateParams, Title, TitleTemplate, Unhead, UseScriptInput, UseScriptOptions, UseScriptResolvedInput, UseScriptStatus, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
|
package/dist/index.d.mts
CHANGED
|
@@ -73,6 +73,7 @@ interface HeadHooks {
|
|
|
73
73
|
script: ScriptInstance<any>;
|
|
74
74
|
fn: string | symbol;
|
|
75
75
|
args: any;
|
|
76
|
+
exists: boolean;
|
|
76
77
|
}) => HookResult;
|
|
77
78
|
}
|
|
78
79
|
|
|
@@ -516,14 +517,13 @@ type UseScriptInput = string | (Omit<Script, 'src'> & {
|
|
|
516
517
|
type UseScriptResolvedInput = Omit<Script, 'src'> & {
|
|
517
518
|
src: string;
|
|
518
519
|
};
|
|
519
|
-
|
|
520
|
+
interface ScriptInstance<T> {
|
|
520
521
|
id: string;
|
|
521
522
|
status: UseScriptStatus;
|
|
522
|
-
loadPromise: Promise<T>;
|
|
523
523
|
entry?: ActiveHeadEntry<any>;
|
|
524
524
|
load: () => Promise<T>;
|
|
525
525
|
remove: () => boolean;
|
|
526
|
-
}
|
|
526
|
+
}
|
|
527
527
|
interface UseScriptOptions<T> extends HeadEntryOptions {
|
|
528
528
|
/**
|
|
529
529
|
* Resolve the script instance from the window.
|
|
@@ -533,7 +533,7 @@ interface UseScriptOptions<T> extends HeadEntryOptions {
|
|
|
533
533
|
* Stub the script instance. Useful for SSR or testing.
|
|
534
534
|
*/
|
|
535
535
|
stub?: ((ctx: {
|
|
536
|
-
script: ScriptInstance<T>;
|
|
536
|
+
script: Promise<T> & ScriptInstance<T>;
|
|
537
537
|
fn: string | symbol;
|
|
538
538
|
}) => any);
|
|
539
539
|
/**
|
|
@@ -550,6 +550,11 @@ interface UseScriptOptions<T> extends HeadEntryOptions {
|
|
|
550
550
|
* calling the event, allowing the event to be reactive.
|
|
551
551
|
*/
|
|
552
552
|
eventContext?: any;
|
|
553
|
+
/**
|
|
554
|
+
* Called before the script is initialized. Will not be triggered when the script is already loaded. This means
|
|
555
|
+
* this is guaranteed to be called only once, unless the script is removed and re-added.
|
|
556
|
+
*/
|
|
557
|
+
beforeInit?: () => void;
|
|
553
558
|
}
|
|
554
559
|
|
|
555
560
|
export type { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BaseMeta, BodyAttr, BodyAttributes, CreateHeadOptions, DomBeforeRenderCtx, DomRenderTagContext, DomState, EntryAugmentation, EntryResolveCtx, HasTemplateParams, Head, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, HeadPluginInput, HeadPluginOptions, HeadSafe, HeadTag, HeadTagKeys, HeadUtils, HookResult, HtmlAttr, HtmlAttributes, InnerContent, InnerContentVal, Link, MaybeArray, MaybeFunctionEntries, Meta, Never, Noscript, ProcessesTemplateParams, RenderSSRHeadOptions, ResolvesDuplicates, RuntimeMode, SSRHeadPayload, SSRRenderContext, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SchemaAugmentations, Script, ScriptInstance, ShouldRenderContext, SideEffectsRecord, Style, TagKey, TagPosition, TagPriority, TagUserProperties, TemplateParams, Title, TitleTemplate, Unhead, UseScriptInput, UseScriptOptions, UseScriptResolvedInput, UseScriptStatus, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
|
package/dist/index.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ interface HeadHooks {
|
|
|
73
73
|
script: ScriptInstance<any>;
|
|
74
74
|
fn: string | symbol;
|
|
75
75
|
args: any;
|
|
76
|
+
exists: boolean;
|
|
76
77
|
}) => HookResult;
|
|
77
78
|
}
|
|
78
79
|
|
|
@@ -516,14 +517,13 @@ type UseScriptInput = string | (Omit<Script, 'src'> & {
|
|
|
516
517
|
type UseScriptResolvedInput = Omit<Script, 'src'> & {
|
|
517
518
|
src: string;
|
|
518
519
|
};
|
|
519
|
-
|
|
520
|
+
interface ScriptInstance<T> {
|
|
520
521
|
id: string;
|
|
521
522
|
status: UseScriptStatus;
|
|
522
|
-
loadPromise: Promise<T>;
|
|
523
523
|
entry?: ActiveHeadEntry<any>;
|
|
524
524
|
load: () => Promise<T>;
|
|
525
525
|
remove: () => boolean;
|
|
526
|
-
}
|
|
526
|
+
}
|
|
527
527
|
interface UseScriptOptions<T> extends HeadEntryOptions {
|
|
528
528
|
/**
|
|
529
529
|
* Resolve the script instance from the window.
|
|
@@ -533,7 +533,7 @@ interface UseScriptOptions<T> extends HeadEntryOptions {
|
|
|
533
533
|
* Stub the script instance. Useful for SSR or testing.
|
|
534
534
|
*/
|
|
535
535
|
stub?: ((ctx: {
|
|
536
|
-
script: ScriptInstance<T>;
|
|
536
|
+
script: Promise<T> & ScriptInstance<T>;
|
|
537
537
|
fn: string | symbol;
|
|
538
538
|
}) => any);
|
|
539
539
|
/**
|
|
@@ -550,6 +550,11 @@ interface UseScriptOptions<T> extends HeadEntryOptions {
|
|
|
550
550
|
* calling the event, allowing the event to be reactive.
|
|
551
551
|
*/
|
|
552
552
|
eventContext?: any;
|
|
553
|
+
/**
|
|
554
|
+
* Called before the script is initialized. Will not be triggered when the script is already loaded. This means
|
|
555
|
+
* this is guaranteed to be called only once, unless the script is removed and re-added.
|
|
556
|
+
*/
|
|
557
|
+
beforeInit?: () => void;
|
|
553
558
|
}
|
|
554
559
|
|
|
555
560
|
export type { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BaseMeta, BodyAttr, BodyAttributes, CreateHeadOptions, DomBeforeRenderCtx, DomRenderTagContext, DomState, EntryAugmentation, EntryResolveCtx, HasTemplateParams, Head, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, HeadPluginInput, HeadPluginOptions, HeadSafe, HeadTag, HeadTagKeys, HeadUtils, HookResult, HtmlAttr, HtmlAttributes, InnerContent, InnerContentVal, Link, MaybeArray, MaybeFunctionEntries, Meta, Never, Noscript, ProcessesTemplateParams, RenderSSRHeadOptions, ResolvesDuplicates, RuntimeMode, SSRHeadPayload, SSRRenderContext, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SchemaAugmentations, Script, ScriptInstance, ShouldRenderContext, SideEffectsRecord, Style, TagKey, TagPosition, TagPriority, TagUserProperties, TemplateParams, Title, TitleTemplate, Unhead, UseScriptInput, UseScriptOptions, UseScriptResolvedInput, UseScriptStatus, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
|