@unhead/schema 1.8.0-beta.0 → 1.8.0-beta.10
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 +53 -6
- package/dist/index.d.mts +53 -6
- package/dist/index.d.ts +53 -6
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaybePromiseProps, MergeHead, BaseBodyAttributes, HtmlAttributes as HtmlAttributes$1, Meta as Meta$1, Stringable, Merge, Base as Base$1, DefinedValueOrEmptyObject, LinkBase, HttpEventAttributes, DataKeys, Style as Style$1, ScriptBase, Noscript as Noscript$1, BodyEvents, MetaFlatInput } from 'zhead';
|
|
2
|
-
export { BodyEvents, DataKeys, DefinedValueOrEmptyObject, MergeHead, MetaFlatInput, SpeculationRules } from 'zhead';
|
|
2
|
+
export { BodyEvents, DataKeys, DefinedValueOrEmptyObject, MergeHead, MetaFlatInput, ScriptBase, SpeculationRules } from 'zhead';
|
|
3
3
|
import { NestedHooks, Hookable } from 'hookable';
|
|
4
4
|
|
|
5
5
|
type HookResult = Promise<void> | void;
|
|
@@ -10,6 +10,28 @@ interface SSRHeadPayload {
|
|
|
10
10
|
htmlAttrs: string;
|
|
11
11
|
bodyAttrs: string;
|
|
12
12
|
}
|
|
13
|
+
type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
|
|
14
|
+
interface ScriptInstance<T> {
|
|
15
|
+
id: string;
|
|
16
|
+
entry?: ActiveHeadEntry<any>;
|
|
17
|
+
loaded: boolean;
|
|
18
|
+
status: UseScriptStatus;
|
|
19
|
+
load: () => Promise<T>;
|
|
20
|
+
waitForUse: () => Promise<T>;
|
|
21
|
+
remove: () => boolean;
|
|
22
|
+
}
|
|
23
|
+
interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
|
|
24
|
+
use?: () => T | undefined | null;
|
|
25
|
+
stub?: ((ctx: {
|
|
26
|
+
script: ScriptInstance<T>;
|
|
27
|
+
fn: string | symbol;
|
|
28
|
+
}) => any);
|
|
29
|
+
transform?: (script: Script) => Promise<Script> | Script;
|
|
30
|
+
trigger?: 'idle' | 'manual' | Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
type UseScriptInput = Omit<Script, 'src'> & {
|
|
33
|
+
src: string;
|
|
34
|
+
};
|
|
13
35
|
interface EntryResolveCtx<T> {
|
|
14
36
|
tags: HeadTag[];
|
|
15
37
|
entries: HeadEntry<T>[];
|
|
@@ -60,6 +82,12 @@ interface HeadHooks {
|
|
|
60
82
|
tags: HeadTag[];
|
|
61
83
|
}) => HookResult;
|
|
62
84
|
'ssr:rendered': (ctx: SSRRenderContext) => HookResult;
|
|
85
|
+
'script:transform': (ctx: {
|
|
86
|
+
script: Script;
|
|
87
|
+
}) => HookResult;
|
|
88
|
+
'script:updated': (ctx: {
|
|
89
|
+
script: ScriptInstance<any>;
|
|
90
|
+
}) => HookResult;
|
|
63
91
|
}
|
|
64
92
|
|
|
65
93
|
/**
|
|
@@ -112,7 +140,14 @@ interface HeadEntry<Input> {
|
|
|
112
140
|
type HeadPluginOptions = Omit<CreateHeadOptions, 'plugins'> & {
|
|
113
141
|
mode?: RuntimeMode;
|
|
114
142
|
};
|
|
115
|
-
type
|
|
143
|
+
type HeadPluginInput = (HeadPluginOptions & {
|
|
144
|
+
key?: string;
|
|
145
|
+
}) | ((head: Unhead) => HeadPluginOptions & {
|
|
146
|
+
key?: string;
|
|
147
|
+
});
|
|
148
|
+
type HeadPlugin = HeadPluginOptions & {
|
|
149
|
+
key?: string;
|
|
150
|
+
};
|
|
116
151
|
/**
|
|
117
152
|
* An active head entry provides an API to manipulate it.
|
|
118
153
|
*/
|
|
@@ -133,7 +168,7 @@ interface ActiveHeadEntry<Input> {
|
|
|
133
168
|
interface CreateHeadOptions {
|
|
134
169
|
domDelayFn?: (fn: () => void) => void;
|
|
135
170
|
document?: Document;
|
|
136
|
-
plugins?:
|
|
171
|
+
plugins?: HeadPluginInput[];
|
|
137
172
|
hooks?: NestedHooks<HeadHooks>;
|
|
138
173
|
}
|
|
139
174
|
interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplateParams {
|
|
@@ -142,6 +177,10 @@ interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplatePa
|
|
|
142
177
|
head?: Unhead;
|
|
143
178
|
}
|
|
144
179
|
interface Unhead<Input extends {} = Head> {
|
|
180
|
+
/**
|
|
181
|
+
* Registered plugins.
|
|
182
|
+
*/
|
|
183
|
+
plugins: HeadPlugin[];
|
|
145
184
|
/**
|
|
146
185
|
* The active head entries.
|
|
147
186
|
*/
|
|
@@ -165,7 +204,7 @@ interface Unhead<Input extends {} = Head> {
|
|
|
165
204
|
/**
|
|
166
205
|
* Use a head plugin, loads the plugins hooks.
|
|
167
206
|
*/
|
|
168
|
-
use: (plugin:
|
|
207
|
+
use: (plugin: HeadPluginInput) => void;
|
|
169
208
|
/**
|
|
170
209
|
* Is it a server-side render context.
|
|
171
210
|
*/
|
|
@@ -182,6 +221,10 @@ interface Unhead<Input extends {} = Head> {
|
|
|
182
221
|
* @internal
|
|
183
222
|
*/
|
|
184
223
|
dirty: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* @internal
|
|
226
|
+
*/
|
|
227
|
+
_scripts?: Record<string, any>;
|
|
185
228
|
}
|
|
186
229
|
interface DomState {
|
|
187
230
|
pendingSideEffects: SideEffectsRecord;
|
|
@@ -258,7 +301,7 @@ interface TagPriority {
|
|
|
258
301
|
type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates & ProcessesTemplateParams;
|
|
259
302
|
type TagKey = keyof Head;
|
|
260
303
|
type TemplateParams = {
|
|
261
|
-
separator?: string;
|
|
304
|
+
separator?: '|' | '-' | '·' | string;
|
|
262
305
|
} & Record<string, null | string | Record<string, string>>;
|
|
263
306
|
interface ProcessesTemplateParams {
|
|
264
307
|
processTemplateParams?: boolean;
|
|
@@ -296,6 +339,10 @@ interface HeadTag extends TagPriority, TagPosition, ResolvesDuplicates, HasTempl
|
|
|
296
339
|
* @internal
|
|
297
340
|
*/
|
|
298
341
|
_m?: RuntimeMode;
|
|
342
|
+
/**
|
|
343
|
+
* @internal
|
|
344
|
+
*/
|
|
345
|
+
_eventHandlers?: Record<string, ((e: Event) => {})>;
|
|
299
346
|
}
|
|
300
347
|
type HeadTagKeys = (keyof HeadTag)[];
|
|
301
348
|
|
|
@@ -465,4 +512,4 @@ interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParam
|
|
|
465
512
|
bodyAttrs?: SafeBodyAttr;
|
|
466
513
|
}
|
|
467
514
|
|
|
468
|
-
export type { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BaseMeta, BodyAttr, BodyAttributes, CreateHeadOptions, DomBeforeRenderCtx, DomRenderTagContext, DomState, EntryAugmentation, EntryResolveCtx, HasTemplateParams, Head, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, HeadPluginOptions, HeadSafe, HeadTag, HeadTagKeys, HeadUtils, HookResult, HtmlAttr, HtmlAttributes, InnerContent, InnerContentVal, Link, MaybeArray, MaybeFunctionEntries, Meta, Never, Noscript, ProcessesTemplateParams, ResolvesDuplicates, RuntimeMode, SSRHeadPayload, SSRRenderContext, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SchemaAugmentations, Script, ShouldRenderContext, SideEffectsRecord, Style, TagKey, TagPosition, TagPriority, TagUserProperties, TemplateParams, Title, TitleTemplate, Unhead, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
|
|
515
|
+
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, 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, UseScriptStatus, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaybePromiseProps, MergeHead, BaseBodyAttributes, HtmlAttributes as HtmlAttributes$1, Meta as Meta$1, Stringable, Merge, Base as Base$1, DefinedValueOrEmptyObject, LinkBase, HttpEventAttributes, DataKeys, Style as Style$1, ScriptBase, Noscript as Noscript$1, BodyEvents, MetaFlatInput } from 'zhead';
|
|
2
|
-
export { BodyEvents, DataKeys, DefinedValueOrEmptyObject, MergeHead, MetaFlatInput, SpeculationRules } from 'zhead';
|
|
2
|
+
export { BodyEvents, DataKeys, DefinedValueOrEmptyObject, MergeHead, MetaFlatInput, ScriptBase, SpeculationRules } from 'zhead';
|
|
3
3
|
import { NestedHooks, Hookable } from 'hookable';
|
|
4
4
|
|
|
5
5
|
type HookResult = Promise<void> | void;
|
|
@@ -10,6 +10,28 @@ interface SSRHeadPayload {
|
|
|
10
10
|
htmlAttrs: string;
|
|
11
11
|
bodyAttrs: string;
|
|
12
12
|
}
|
|
13
|
+
type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
|
|
14
|
+
interface ScriptInstance<T> {
|
|
15
|
+
id: string;
|
|
16
|
+
entry?: ActiveHeadEntry<any>;
|
|
17
|
+
loaded: boolean;
|
|
18
|
+
status: UseScriptStatus;
|
|
19
|
+
load: () => Promise<T>;
|
|
20
|
+
waitForUse: () => Promise<T>;
|
|
21
|
+
remove: () => boolean;
|
|
22
|
+
}
|
|
23
|
+
interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
|
|
24
|
+
use?: () => T | undefined | null;
|
|
25
|
+
stub?: ((ctx: {
|
|
26
|
+
script: ScriptInstance<T>;
|
|
27
|
+
fn: string | symbol;
|
|
28
|
+
}) => any);
|
|
29
|
+
transform?: (script: Script) => Promise<Script> | Script;
|
|
30
|
+
trigger?: 'idle' | 'manual' | Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
type UseScriptInput = Omit<Script, 'src'> & {
|
|
33
|
+
src: string;
|
|
34
|
+
};
|
|
13
35
|
interface EntryResolveCtx<T> {
|
|
14
36
|
tags: HeadTag[];
|
|
15
37
|
entries: HeadEntry<T>[];
|
|
@@ -60,6 +82,12 @@ interface HeadHooks {
|
|
|
60
82
|
tags: HeadTag[];
|
|
61
83
|
}) => HookResult;
|
|
62
84
|
'ssr:rendered': (ctx: SSRRenderContext) => HookResult;
|
|
85
|
+
'script:transform': (ctx: {
|
|
86
|
+
script: Script;
|
|
87
|
+
}) => HookResult;
|
|
88
|
+
'script:updated': (ctx: {
|
|
89
|
+
script: ScriptInstance<any>;
|
|
90
|
+
}) => HookResult;
|
|
63
91
|
}
|
|
64
92
|
|
|
65
93
|
/**
|
|
@@ -112,7 +140,14 @@ interface HeadEntry<Input> {
|
|
|
112
140
|
type HeadPluginOptions = Omit<CreateHeadOptions, 'plugins'> & {
|
|
113
141
|
mode?: RuntimeMode;
|
|
114
142
|
};
|
|
115
|
-
type
|
|
143
|
+
type HeadPluginInput = (HeadPluginOptions & {
|
|
144
|
+
key?: string;
|
|
145
|
+
}) | ((head: Unhead) => HeadPluginOptions & {
|
|
146
|
+
key?: string;
|
|
147
|
+
});
|
|
148
|
+
type HeadPlugin = HeadPluginOptions & {
|
|
149
|
+
key?: string;
|
|
150
|
+
};
|
|
116
151
|
/**
|
|
117
152
|
* An active head entry provides an API to manipulate it.
|
|
118
153
|
*/
|
|
@@ -133,7 +168,7 @@ interface ActiveHeadEntry<Input> {
|
|
|
133
168
|
interface CreateHeadOptions {
|
|
134
169
|
domDelayFn?: (fn: () => void) => void;
|
|
135
170
|
document?: Document;
|
|
136
|
-
plugins?:
|
|
171
|
+
plugins?: HeadPluginInput[];
|
|
137
172
|
hooks?: NestedHooks<HeadHooks>;
|
|
138
173
|
}
|
|
139
174
|
interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplateParams {
|
|
@@ -142,6 +177,10 @@ interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplatePa
|
|
|
142
177
|
head?: Unhead;
|
|
143
178
|
}
|
|
144
179
|
interface Unhead<Input extends {} = Head> {
|
|
180
|
+
/**
|
|
181
|
+
* Registered plugins.
|
|
182
|
+
*/
|
|
183
|
+
plugins: HeadPlugin[];
|
|
145
184
|
/**
|
|
146
185
|
* The active head entries.
|
|
147
186
|
*/
|
|
@@ -165,7 +204,7 @@ interface Unhead<Input extends {} = Head> {
|
|
|
165
204
|
/**
|
|
166
205
|
* Use a head plugin, loads the plugins hooks.
|
|
167
206
|
*/
|
|
168
|
-
use: (plugin:
|
|
207
|
+
use: (plugin: HeadPluginInput) => void;
|
|
169
208
|
/**
|
|
170
209
|
* Is it a server-side render context.
|
|
171
210
|
*/
|
|
@@ -182,6 +221,10 @@ interface Unhead<Input extends {} = Head> {
|
|
|
182
221
|
* @internal
|
|
183
222
|
*/
|
|
184
223
|
dirty: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* @internal
|
|
226
|
+
*/
|
|
227
|
+
_scripts?: Record<string, any>;
|
|
185
228
|
}
|
|
186
229
|
interface DomState {
|
|
187
230
|
pendingSideEffects: SideEffectsRecord;
|
|
@@ -258,7 +301,7 @@ interface TagPriority {
|
|
|
258
301
|
type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates & ProcessesTemplateParams;
|
|
259
302
|
type TagKey = keyof Head;
|
|
260
303
|
type TemplateParams = {
|
|
261
|
-
separator?: string;
|
|
304
|
+
separator?: '|' | '-' | '·' | string;
|
|
262
305
|
} & Record<string, null | string | Record<string, string>>;
|
|
263
306
|
interface ProcessesTemplateParams {
|
|
264
307
|
processTemplateParams?: boolean;
|
|
@@ -296,6 +339,10 @@ interface HeadTag extends TagPriority, TagPosition, ResolvesDuplicates, HasTempl
|
|
|
296
339
|
* @internal
|
|
297
340
|
*/
|
|
298
341
|
_m?: RuntimeMode;
|
|
342
|
+
/**
|
|
343
|
+
* @internal
|
|
344
|
+
*/
|
|
345
|
+
_eventHandlers?: Record<string, ((e: Event) => {})>;
|
|
299
346
|
}
|
|
300
347
|
type HeadTagKeys = (keyof HeadTag)[];
|
|
301
348
|
|
|
@@ -465,4 +512,4 @@ interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParam
|
|
|
465
512
|
bodyAttrs?: SafeBodyAttr;
|
|
466
513
|
}
|
|
467
514
|
|
|
468
|
-
export type { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BaseMeta, BodyAttr, BodyAttributes, CreateHeadOptions, DomBeforeRenderCtx, DomRenderTagContext, DomState, EntryAugmentation, EntryResolveCtx, HasTemplateParams, Head, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, HeadPluginOptions, HeadSafe, HeadTag, HeadTagKeys, HeadUtils, HookResult, HtmlAttr, HtmlAttributes, InnerContent, InnerContentVal, Link, MaybeArray, MaybeFunctionEntries, Meta, Never, Noscript, ProcessesTemplateParams, ResolvesDuplicates, RuntimeMode, SSRHeadPayload, SSRRenderContext, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SchemaAugmentations, Script, ShouldRenderContext, SideEffectsRecord, Style, TagKey, TagPosition, TagPriority, TagUserProperties, TemplateParams, Title, TitleTemplate, Unhead, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
|
|
515
|
+
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, 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, UseScriptStatus, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaybePromiseProps, MergeHead, BaseBodyAttributes, HtmlAttributes as HtmlAttributes$1, Meta as Meta$1, Stringable, Merge, Base as Base$1, DefinedValueOrEmptyObject, LinkBase, HttpEventAttributes, DataKeys, Style as Style$1, ScriptBase, Noscript as Noscript$1, BodyEvents, MetaFlatInput } from 'zhead';
|
|
2
|
-
export { BodyEvents, DataKeys, DefinedValueOrEmptyObject, MergeHead, MetaFlatInput, SpeculationRules } from 'zhead';
|
|
2
|
+
export { BodyEvents, DataKeys, DefinedValueOrEmptyObject, MergeHead, MetaFlatInput, ScriptBase, SpeculationRules } from 'zhead';
|
|
3
3
|
import { NestedHooks, Hookable } from 'hookable';
|
|
4
4
|
|
|
5
5
|
type HookResult = Promise<void> | void;
|
|
@@ -10,6 +10,28 @@ interface SSRHeadPayload {
|
|
|
10
10
|
htmlAttrs: string;
|
|
11
11
|
bodyAttrs: string;
|
|
12
12
|
}
|
|
13
|
+
type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
|
|
14
|
+
interface ScriptInstance<T> {
|
|
15
|
+
id: string;
|
|
16
|
+
entry?: ActiveHeadEntry<any>;
|
|
17
|
+
loaded: boolean;
|
|
18
|
+
status: UseScriptStatus;
|
|
19
|
+
load: () => Promise<T>;
|
|
20
|
+
waitForUse: () => Promise<T>;
|
|
21
|
+
remove: () => boolean;
|
|
22
|
+
}
|
|
23
|
+
interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
|
|
24
|
+
use?: () => T | undefined | null;
|
|
25
|
+
stub?: ((ctx: {
|
|
26
|
+
script: ScriptInstance<T>;
|
|
27
|
+
fn: string | symbol;
|
|
28
|
+
}) => any);
|
|
29
|
+
transform?: (script: Script) => Promise<Script> | Script;
|
|
30
|
+
trigger?: 'idle' | 'manual' | Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
type UseScriptInput = Omit<Script, 'src'> & {
|
|
33
|
+
src: string;
|
|
34
|
+
};
|
|
13
35
|
interface EntryResolveCtx<T> {
|
|
14
36
|
tags: HeadTag[];
|
|
15
37
|
entries: HeadEntry<T>[];
|
|
@@ -60,6 +82,12 @@ interface HeadHooks {
|
|
|
60
82
|
tags: HeadTag[];
|
|
61
83
|
}) => HookResult;
|
|
62
84
|
'ssr:rendered': (ctx: SSRRenderContext) => HookResult;
|
|
85
|
+
'script:transform': (ctx: {
|
|
86
|
+
script: Script;
|
|
87
|
+
}) => HookResult;
|
|
88
|
+
'script:updated': (ctx: {
|
|
89
|
+
script: ScriptInstance<any>;
|
|
90
|
+
}) => HookResult;
|
|
63
91
|
}
|
|
64
92
|
|
|
65
93
|
/**
|
|
@@ -112,7 +140,14 @@ interface HeadEntry<Input> {
|
|
|
112
140
|
type HeadPluginOptions = Omit<CreateHeadOptions, 'plugins'> & {
|
|
113
141
|
mode?: RuntimeMode;
|
|
114
142
|
};
|
|
115
|
-
type
|
|
143
|
+
type HeadPluginInput = (HeadPluginOptions & {
|
|
144
|
+
key?: string;
|
|
145
|
+
}) | ((head: Unhead) => HeadPluginOptions & {
|
|
146
|
+
key?: string;
|
|
147
|
+
});
|
|
148
|
+
type HeadPlugin = HeadPluginOptions & {
|
|
149
|
+
key?: string;
|
|
150
|
+
};
|
|
116
151
|
/**
|
|
117
152
|
* An active head entry provides an API to manipulate it.
|
|
118
153
|
*/
|
|
@@ -133,7 +168,7 @@ interface ActiveHeadEntry<Input> {
|
|
|
133
168
|
interface CreateHeadOptions {
|
|
134
169
|
domDelayFn?: (fn: () => void) => void;
|
|
135
170
|
document?: Document;
|
|
136
|
-
plugins?:
|
|
171
|
+
plugins?: HeadPluginInput[];
|
|
137
172
|
hooks?: NestedHooks<HeadHooks>;
|
|
138
173
|
}
|
|
139
174
|
interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplateParams {
|
|
@@ -142,6 +177,10 @@ interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplatePa
|
|
|
142
177
|
head?: Unhead;
|
|
143
178
|
}
|
|
144
179
|
interface Unhead<Input extends {} = Head> {
|
|
180
|
+
/**
|
|
181
|
+
* Registered plugins.
|
|
182
|
+
*/
|
|
183
|
+
plugins: HeadPlugin[];
|
|
145
184
|
/**
|
|
146
185
|
* The active head entries.
|
|
147
186
|
*/
|
|
@@ -165,7 +204,7 @@ interface Unhead<Input extends {} = Head> {
|
|
|
165
204
|
/**
|
|
166
205
|
* Use a head plugin, loads the plugins hooks.
|
|
167
206
|
*/
|
|
168
|
-
use: (plugin:
|
|
207
|
+
use: (plugin: HeadPluginInput) => void;
|
|
169
208
|
/**
|
|
170
209
|
* Is it a server-side render context.
|
|
171
210
|
*/
|
|
@@ -182,6 +221,10 @@ interface Unhead<Input extends {} = Head> {
|
|
|
182
221
|
* @internal
|
|
183
222
|
*/
|
|
184
223
|
dirty: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* @internal
|
|
226
|
+
*/
|
|
227
|
+
_scripts?: Record<string, any>;
|
|
185
228
|
}
|
|
186
229
|
interface DomState {
|
|
187
230
|
pendingSideEffects: SideEffectsRecord;
|
|
@@ -258,7 +301,7 @@ interface TagPriority {
|
|
|
258
301
|
type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates & ProcessesTemplateParams;
|
|
259
302
|
type TagKey = keyof Head;
|
|
260
303
|
type TemplateParams = {
|
|
261
|
-
separator?: string;
|
|
304
|
+
separator?: '|' | '-' | '·' | string;
|
|
262
305
|
} & Record<string, null | string | Record<string, string>>;
|
|
263
306
|
interface ProcessesTemplateParams {
|
|
264
307
|
processTemplateParams?: boolean;
|
|
@@ -296,6 +339,10 @@ interface HeadTag extends TagPriority, TagPosition, ResolvesDuplicates, HasTempl
|
|
|
296
339
|
* @internal
|
|
297
340
|
*/
|
|
298
341
|
_m?: RuntimeMode;
|
|
342
|
+
/**
|
|
343
|
+
* @internal
|
|
344
|
+
*/
|
|
345
|
+
_eventHandlers?: Record<string, ((e: Event) => {})>;
|
|
299
346
|
}
|
|
300
347
|
type HeadTagKeys = (keyof HeadTag)[];
|
|
301
348
|
|
|
@@ -465,4 +512,4 @@ interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParam
|
|
|
465
512
|
bodyAttrs?: SafeBodyAttr;
|
|
466
513
|
}
|
|
467
514
|
|
|
468
|
-
export type { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BaseMeta, BodyAttr, BodyAttributes, CreateHeadOptions, DomBeforeRenderCtx, DomRenderTagContext, DomState, EntryAugmentation, EntryResolveCtx, HasTemplateParams, Head, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, HeadPluginOptions, HeadSafe, HeadTag, HeadTagKeys, HeadUtils, HookResult, HtmlAttr, HtmlAttributes, InnerContent, InnerContentVal, Link, MaybeArray, MaybeFunctionEntries, Meta, Never, Noscript, ProcessesTemplateParams, ResolvesDuplicates, RuntimeMode, SSRHeadPayload, SSRRenderContext, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SchemaAugmentations, Script, ShouldRenderContext, SideEffectsRecord, Style, TagKey, TagPosition, TagPriority, TagUserProperties, TemplateParams, Title, TitleTemplate, Unhead, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
|
|
515
|
+
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, 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, UseScriptStatus, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
|