@unhead/schema 1.8.0-beta.2 → 1.8.0-beta.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 +18 -6
- package/dist/index.d.mts +18 -6
- package/dist/index.d.ts +18 -6
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -12,6 +12,7 @@ interface SSRHeadPayload {
|
|
|
12
12
|
}
|
|
13
13
|
type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error';
|
|
14
14
|
interface ScriptInstance<T> {
|
|
15
|
+
id: string;
|
|
15
16
|
loaded: boolean;
|
|
16
17
|
status: UseScriptStatus;
|
|
17
18
|
load: () => Promise<T>;
|
|
@@ -23,7 +24,7 @@ interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
|
|
|
23
24
|
script: ScriptInstance<T>;
|
|
24
25
|
fn: string | symbol;
|
|
25
26
|
}) => any);
|
|
26
|
-
transform?: (script: Script) => Script;
|
|
27
|
+
transform?: (script: Script) => Promise<Script> | Script;
|
|
27
28
|
trigger?: 'idle' | 'manual' | Promise<void>;
|
|
28
29
|
}
|
|
29
30
|
type UseScriptInput = Omit<Script, 'src'> & {
|
|
@@ -143,7 +144,14 @@ interface HeadEntry<Input> {
|
|
|
143
144
|
type HeadPluginOptions = Omit<CreateHeadOptions, 'plugins'> & {
|
|
144
145
|
mode?: RuntimeMode;
|
|
145
146
|
};
|
|
146
|
-
type
|
|
147
|
+
type HeadPluginInput = (HeadPluginOptions & {
|
|
148
|
+
key?: string;
|
|
149
|
+
}) | ((head: Unhead) => HeadPluginOptions & {
|
|
150
|
+
key?: string;
|
|
151
|
+
});
|
|
152
|
+
type HeadPlugin = HeadPluginOptions & {
|
|
153
|
+
key?: string;
|
|
154
|
+
};
|
|
147
155
|
/**
|
|
148
156
|
* An active head entry provides an API to manipulate it.
|
|
149
157
|
*/
|
|
@@ -164,7 +172,7 @@ interface ActiveHeadEntry<Input> {
|
|
|
164
172
|
interface CreateHeadOptions {
|
|
165
173
|
domDelayFn?: (fn: () => void) => void;
|
|
166
174
|
document?: Document;
|
|
167
|
-
plugins?:
|
|
175
|
+
plugins?: HeadPluginInput[];
|
|
168
176
|
hooks?: NestedHooks<HeadHooks>;
|
|
169
177
|
}
|
|
170
178
|
interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplateParams {
|
|
@@ -173,6 +181,10 @@ interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplatePa
|
|
|
173
181
|
head?: Unhead;
|
|
174
182
|
}
|
|
175
183
|
interface Unhead<Input extends {} = Head> {
|
|
184
|
+
/**
|
|
185
|
+
* Registered plugins.
|
|
186
|
+
*/
|
|
187
|
+
plugins: HeadPlugin[];
|
|
176
188
|
/**
|
|
177
189
|
* The active head entries.
|
|
178
190
|
*/
|
|
@@ -196,7 +208,7 @@ interface Unhead<Input extends {} = Head> {
|
|
|
196
208
|
/**
|
|
197
209
|
* Use a head plugin, loads the plugins hooks.
|
|
198
210
|
*/
|
|
199
|
-
use: (plugin:
|
|
211
|
+
use: (plugin: HeadPluginInput) => void;
|
|
200
212
|
/**
|
|
201
213
|
* Is it a server-side render context.
|
|
202
214
|
*/
|
|
@@ -293,7 +305,7 @@ interface TagPriority {
|
|
|
293
305
|
type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates & ProcessesTemplateParams;
|
|
294
306
|
type TagKey = keyof Head;
|
|
295
307
|
type TemplateParams = {
|
|
296
|
-
separator?: string;
|
|
308
|
+
separator?: '|' | '-' | '·' | string;
|
|
297
309
|
} & Record<string, null | string | Record<string, string>>;
|
|
298
310
|
interface ProcessesTemplateParams {
|
|
299
311
|
processTemplateParams?: boolean;
|
|
@@ -504,4 +516,4 @@ interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParam
|
|
|
504
516
|
bodyAttrs?: SafeBodyAttr;
|
|
505
517
|
}
|
|
506
518
|
|
|
507
|
-
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, ScriptInstance, ShouldRenderContext, SideEffectsRecord, Style, TagKey, TagPosition, TagPriority, TagUserProperties, TemplateParams, Title, TitleTemplate, Unhead, UseScriptInput, UseScriptOptions, UseScriptStatus, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
|
|
519
|
+
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
|
@@ -12,6 +12,7 @@ interface SSRHeadPayload {
|
|
|
12
12
|
}
|
|
13
13
|
type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error';
|
|
14
14
|
interface ScriptInstance<T> {
|
|
15
|
+
id: string;
|
|
15
16
|
loaded: boolean;
|
|
16
17
|
status: UseScriptStatus;
|
|
17
18
|
load: () => Promise<T>;
|
|
@@ -23,7 +24,7 @@ interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
|
|
|
23
24
|
script: ScriptInstance<T>;
|
|
24
25
|
fn: string | symbol;
|
|
25
26
|
}) => any);
|
|
26
|
-
transform?: (script: Script) => Script;
|
|
27
|
+
transform?: (script: Script) => Promise<Script> | Script;
|
|
27
28
|
trigger?: 'idle' | 'manual' | Promise<void>;
|
|
28
29
|
}
|
|
29
30
|
type UseScriptInput = Omit<Script, 'src'> & {
|
|
@@ -143,7 +144,14 @@ interface HeadEntry<Input> {
|
|
|
143
144
|
type HeadPluginOptions = Omit<CreateHeadOptions, 'plugins'> & {
|
|
144
145
|
mode?: RuntimeMode;
|
|
145
146
|
};
|
|
146
|
-
type
|
|
147
|
+
type HeadPluginInput = (HeadPluginOptions & {
|
|
148
|
+
key?: string;
|
|
149
|
+
}) | ((head: Unhead) => HeadPluginOptions & {
|
|
150
|
+
key?: string;
|
|
151
|
+
});
|
|
152
|
+
type HeadPlugin = HeadPluginOptions & {
|
|
153
|
+
key?: string;
|
|
154
|
+
};
|
|
147
155
|
/**
|
|
148
156
|
* An active head entry provides an API to manipulate it.
|
|
149
157
|
*/
|
|
@@ -164,7 +172,7 @@ interface ActiveHeadEntry<Input> {
|
|
|
164
172
|
interface CreateHeadOptions {
|
|
165
173
|
domDelayFn?: (fn: () => void) => void;
|
|
166
174
|
document?: Document;
|
|
167
|
-
plugins?:
|
|
175
|
+
plugins?: HeadPluginInput[];
|
|
168
176
|
hooks?: NestedHooks<HeadHooks>;
|
|
169
177
|
}
|
|
170
178
|
interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplateParams {
|
|
@@ -173,6 +181,10 @@ interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplatePa
|
|
|
173
181
|
head?: Unhead;
|
|
174
182
|
}
|
|
175
183
|
interface Unhead<Input extends {} = Head> {
|
|
184
|
+
/**
|
|
185
|
+
* Registered plugins.
|
|
186
|
+
*/
|
|
187
|
+
plugins: HeadPlugin[];
|
|
176
188
|
/**
|
|
177
189
|
* The active head entries.
|
|
178
190
|
*/
|
|
@@ -196,7 +208,7 @@ interface Unhead<Input extends {} = Head> {
|
|
|
196
208
|
/**
|
|
197
209
|
* Use a head plugin, loads the plugins hooks.
|
|
198
210
|
*/
|
|
199
|
-
use: (plugin:
|
|
211
|
+
use: (plugin: HeadPluginInput) => void;
|
|
200
212
|
/**
|
|
201
213
|
* Is it a server-side render context.
|
|
202
214
|
*/
|
|
@@ -293,7 +305,7 @@ interface TagPriority {
|
|
|
293
305
|
type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates & ProcessesTemplateParams;
|
|
294
306
|
type TagKey = keyof Head;
|
|
295
307
|
type TemplateParams = {
|
|
296
|
-
separator?: string;
|
|
308
|
+
separator?: '|' | '-' | '·' | string;
|
|
297
309
|
} & Record<string, null | string | Record<string, string>>;
|
|
298
310
|
interface ProcessesTemplateParams {
|
|
299
311
|
processTemplateParams?: boolean;
|
|
@@ -504,4 +516,4 @@ interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParam
|
|
|
504
516
|
bodyAttrs?: SafeBodyAttr;
|
|
505
517
|
}
|
|
506
518
|
|
|
507
|
-
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, ScriptInstance, ShouldRenderContext, SideEffectsRecord, Style, TagKey, TagPosition, TagPriority, TagUserProperties, TemplateParams, Title, TitleTemplate, Unhead, UseScriptInput, UseScriptOptions, UseScriptStatus, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
|
|
519
|
+
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
|
@@ -12,6 +12,7 @@ interface SSRHeadPayload {
|
|
|
12
12
|
}
|
|
13
13
|
type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error';
|
|
14
14
|
interface ScriptInstance<T> {
|
|
15
|
+
id: string;
|
|
15
16
|
loaded: boolean;
|
|
16
17
|
status: UseScriptStatus;
|
|
17
18
|
load: () => Promise<T>;
|
|
@@ -23,7 +24,7 @@ interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
|
|
|
23
24
|
script: ScriptInstance<T>;
|
|
24
25
|
fn: string | symbol;
|
|
25
26
|
}) => any);
|
|
26
|
-
transform?: (script: Script) => Script;
|
|
27
|
+
transform?: (script: Script) => Promise<Script> | Script;
|
|
27
28
|
trigger?: 'idle' | 'manual' | Promise<void>;
|
|
28
29
|
}
|
|
29
30
|
type UseScriptInput = Omit<Script, 'src'> & {
|
|
@@ -143,7 +144,14 @@ interface HeadEntry<Input> {
|
|
|
143
144
|
type HeadPluginOptions = Omit<CreateHeadOptions, 'plugins'> & {
|
|
144
145
|
mode?: RuntimeMode;
|
|
145
146
|
};
|
|
146
|
-
type
|
|
147
|
+
type HeadPluginInput = (HeadPluginOptions & {
|
|
148
|
+
key?: string;
|
|
149
|
+
}) | ((head: Unhead) => HeadPluginOptions & {
|
|
150
|
+
key?: string;
|
|
151
|
+
});
|
|
152
|
+
type HeadPlugin = HeadPluginOptions & {
|
|
153
|
+
key?: string;
|
|
154
|
+
};
|
|
147
155
|
/**
|
|
148
156
|
* An active head entry provides an API to manipulate it.
|
|
149
157
|
*/
|
|
@@ -164,7 +172,7 @@ interface ActiveHeadEntry<Input> {
|
|
|
164
172
|
interface CreateHeadOptions {
|
|
165
173
|
domDelayFn?: (fn: () => void) => void;
|
|
166
174
|
document?: Document;
|
|
167
|
-
plugins?:
|
|
175
|
+
plugins?: HeadPluginInput[];
|
|
168
176
|
hooks?: NestedHooks<HeadHooks>;
|
|
169
177
|
}
|
|
170
178
|
interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplateParams {
|
|
@@ -173,6 +181,10 @@ interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplatePa
|
|
|
173
181
|
head?: Unhead;
|
|
174
182
|
}
|
|
175
183
|
interface Unhead<Input extends {} = Head> {
|
|
184
|
+
/**
|
|
185
|
+
* Registered plugins.
|
|
186
|
+
*/
|
|
187
|
+
plugins: HeadPlugin[];
|
|
176
188
|
/**
|
|
177
189
|
* The active head entries.
|
|
178
190
|
*/
|
|
@@ -196,7 +208,7 @@ interface Unhead<Input extends {} = Head> {
|
|
|
196
208
|
/**
|
|
197
209
|
* Use a head plugin, loads the plugins hooks.
|
|
198
210
|
*/
|
|
199
|
-
use: (plugin:
|
|
211
|
+
use: (plugin: HeadPluginInput) => void;
|
|
200
212
|
/**
|
|
201
213
|
* Is it a server-side render context.
|
|
202
214
|
*/
|
|
@@ -293,7 +305,7 @@ interface TagPriority {
|
|
|
293
305
|
type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates & ProcessesTemplateParams;
|
|
294
306
|
type TagKey = keyof Head;
|
|
295
307
|
type TemplateParams = {
|
|
296
|
-
separator?: string;
|
|
308
|
+
separator?: '|' | '-' | '·' | string;
|
|
297
309
|
} & Record<string, null | string | Record<string, string>>;
|
|
298
310
|
interface ProcessesTemplateParams {
|
|
299
311
|
processTemplateParams?: boolean;
|
|
@@ -504,4 +516,4 @@ interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParam
|
|
|
504
516
|
bodyAttrs?: SafeBodyAttr;
|
|
505
517
|
}
|
|
506
518
|
|
|
507
|
-
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, ScriptInstance, ShouldRenderContext, SideEffectsRecord, Style, TagKey, TagPosition, TagPriority, TagUserProperties, TemplateParams, Title, TitleTemplate, Unhead, UseScriptInput, UseScriptOptions, UseScriptStatus, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
|
|
519
|
+
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 };
|