@unhead/schema 1.8.13 → 1.8.15

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 CHANGED
@@ -13,34 +13,6 @@ interface SSRHeadPayload {
13
13
  interface RenderSSRHeadOptions {
14
14
  omitLineBreaks?: boolean;
15
15
  }
16
- type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
17
- interface ScriptInstance<T> {
18
- id: string;
19
- entry?: ActiveHeadEntry<any>;
20
- loaded: boolean;
21
- status: UseScriptStatus;
22
- load: () => Promise<T>;
23
- waitForLoad: () => Promise<T>;
24
- remove: () => boolean;
25
- }
26
- interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
27
- /**
28
- * Should the `dns-prefetch` tag be skipped.
29
- *
30
- * Useful if loading the script through a local proxy.
31
- */
32
- skipEarlyConnections?: boolean;
33
- use?: () => T | undefined | null;
34
- stub?: ((ctx: {
35
- script: ScriptInstance<T>;
36
- fn: string | symbol;
37
- }) => any);
38
- transform?: (script: UseScriptInput) => Promise<UseScriptInput> | UseScriptInput;
39
- trigger?: 'idle' | 'manual' | Promise<void>;
40
- }
41
- type UseScriptInput = Omit<Script, 'src'> & {
42
- src: string;
43
- };
44
16
  interface EntryResolveCtx<T> {
45
17
  tags: HeadTag[];
46
18
  entries: HeadEntry<T>[];
@@ -95,7 +67,7 @@ interface HeadHooks {
95
67
  }) => HookResult;
96
68
  'ssr:rendered': (ctx: SSRRenderContext) => HookResult;
97
69
  'script:transform': (ctx: {
98
- script: UseScriptInput;
70
+ script: UseScriptResolvedInput;
99
71
  }) => HookResult;
100
72
  'script:updated': (ctx: {
101
73
  script: ScriptInstance<any>;
@@ -425,14 +397,14 @@ type Title = MaybePromiseProps<string | ({
425
397
  type TitleTemplate = TitleTemplateResolver | null | ({
426
398
  textContent: TitleTemplateResolver;
427
399
  } & SchemaAugmentations['titleTemplate']);
428
- type Base<E extends EntryAugmentation = {}> = Partial<Merge<SchemaAugmentations['base'], MaybePromiseProps<Base$1>>> & DefinedValueOrEmptyObject<E>;
429
- type Link<E extends EntryAugmentation = {}> = MaybePromiseProps<LinkBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['link'] & DefinedValueOrEmptyObject<E>;
430
- type Meta<E extends EntryAugmentation = {}> = MaybePromiseProps<BaseMeta> & DataKeys & SchemaAugmentations['meta'] & DefinedValueOrEmptyObject<E>;
431
- type Style<E extends EntryAugmentation = {}> = MaybePromiseProps<Style$1> & DataKeys & SchemaAugmentations['style'] & DefinedValueOrEmptyObject<E>;
432
- type Script<E extends EntryAugmentation = {}> = MaybePromiseProps<ScriptBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['script'] & DefinedValueOrEmptyObject<E>;
433
- type Noscript<E extends EntryAugmentation = {}> = MaybePromiseProps<Noscript$1> & DataKeys & SchemaAugmentations['noscript'] & DefinedValueOrEmptyObject<E>;
434
- type HtmlAttributes<E extends EntryAugmentation = {}> = MaybePromiseProps<HtmlAttr> & DataKeys & SchemaAugmentations['htmlAttrs'] & DefinedValueOrEmptyObject<E>;
435
- type BodyAttributes<E extends EntryAugmentation = {}> = MaybePromiseProps<BodyAttr> & MaybeFunctionEntries<BodyEvents> & DataKeys & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject<E>;
400
+ type Base<E extends EntryAugmentation = Record<string, any>> = Partial<Merge<SchemaAugmentations['base'], MaybePromiseProps<Base$1>>> & DefinedValueOrEmptyObject<E>;
401
+ type Link<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<LinkBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['link'] & DefinedValueOrEmptyObject<E>;
402
+ type Meta<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<BaseMeta> & DataKeys & SchemaAugmentations['meta'] & DefinedValueOrEmptyObject<E>;
403
+ type Style<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<Style$1> & DataKeys & SchemaAugmentations['style'] & DefinedValueOrEmptyObject<E>;
404
+ type Script<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<ScriptBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['script'] & DefinedValueOrEmptyObject<E>;
405
+ type Noscript<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<Noscript$1> & DataKeys & SchemaAugmentations['noscript'] & DefinedValueOrEmptyObject<E>;
406
+ type HtmlAttributes<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<HtmlAttr> & DataKeys & SchemaAugmentations['htmlAttrs'] & DefinedValueOrEmptyObject<E>;
407
+ type BodyAttributes<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<BodyAttr> & MaybeFunctionEntries<BodyEvents> & DataKeys & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject<E>;
436
408
  interface HeadUtils {
437
409
  /**
438
410
  * Generate the title from a template.
@@ -532,4 +504,54 @@ interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParam
532
504
  bodyAttrs?: SafeBodyAttr;
533
505
  }
534
506
 
535
- 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, UseScriptStatus, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
507
+ type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
508
+ /**
509
+ * Either a string source for the script or full script properties.
510
+ */
511
+ type UseScriptInput = string | (Omit<Script, 'src'> & {
512
+ src: string;
513
+ });
514
+ type UseScriptResolvedInput = Omit<Script, 'src'> & {
515
+ src: string;
516
+ };
517
+ interface ScriptInstance<T> {
518
+ id: string;
519
+ entry?: ActiveHeadEntry<any>;
520
+ loaded: boolean;
521
+ status: UseScriptStatus;
522
+ load: () => Promise<T>;
523
+ waitForLoad: () => Promise<T>;
524
+ remove: () => boolean;
525
+ }
526
+ interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
527
+ /**
528
+ * Should the `dns-prefetch` tag be skipped.
529
+ *
530
+ * Useful if loading the script through a local proxy.
531
+ */
532
+ skipEarlyConnections?: boolean;
533
+ /**
534
+ * Resolve the script instance from the window.
535
+ */
536
+ use?: () => T | undefined | null;
537
+ /**
538
+ * Stub the script instance. Useful for SSR or testing.
539
+ */
540
+ stub?: ((ctx: {
541
+ script: ScriptInstance<T>;
542
+ fn: string | symbol;
543
+ }) => any);
544
+ /**
545
+ * Transform the script instance before it's resolved.
546
+ */
547
+ transform?: (script: UseScriptResolvedInput) => Promise<UseScriptResolvedInput> | UseScriptResolvedInput;
548
+ /**
549
+ * The trigger to load the script:
550
+ * - `idle` - Load the script when the browser is idle.
551
+ * - `manual` - Load the script manually by calling `$script.load()` or `$script.waitForLoad()`.
552
+ * - `Promise` - Load the script when the promise resolves.
553
+ */
554
+ trigger?: 'idle' | 'manual' | Promise<void>;
555
+ }
556
+
557
+ 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
@@ -13,34 +13,6 @@ interface SSRHeadPayload {
13
13
  interface RenderSSRHeadOptions {
14
14
  omitLineBreaks?: boolean;
15
15
  }
16
- type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
17
- interface ScriptInstance<T> {
18
- id: string;
19
- entry?: ActiveHeadEntry<any>;
20
- loaded: boolean;
21
- status: UseScriptStatus;
22
- load: () => Promise<T>;
23
- waitForLoad: () => Promise<T>;
24
- remove: () => boolean;
25
- }
26
- interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
27
- /**
28
- * Should the `dns-prefetch` tag be skipped.
29
- *
30
- * Useful if loading the script through a local proxy.
31
- */
32
- skipEarlyConnections?: boolean;
33
- use?: () => T | undefined | null;
34
- stub?: ((ctx: {
35
- script: ScriptInstance<T>;
36
- fn: string | symbol;
37
- }) => any);
38
- transform?: (script: UseScriptInput) => Promise<UseScriptInput> | UseScriptInput;
39
- trigger?: 'idle' | 'manual' | Promise<void>;
40
- }
41
- type UseScriptInput = Omit<Script, 'src'> & {
42
- src: string;
43
- };
44
16
  interface EntryResolveCtx<T> {
45
17
  tags: HeadTag[];
46
18
  entries: HeadEntry<T>[];
@@ -95,7 +67,7 @@ interface HeadHooks {
95
67
  }) => HookResult;
96
68
  'ssr:rendered': (ctx: SSRRenderContext) => HookResult;
97
69
  'script:transform': (ctx: {
98
- script: UseScriptInput;
70
+ script: UseScriptResolvedInput;
99
71
  }) => HookResult;
100
72
  'script:updated': (ctx: {
101
73
  script: ScriptInstance<any>;
@@ -425,14 +397,14 @@ type Title = MaybePromiseProps<string | ({
425
397
  type TitleTemplate = TitleTemplateResolver | null | ({
426
398
  textContent: TitleTemplateResolver;
427
399
  } & SchemaAugmentations['titleTemplate']);
428
- type Base<E extends EntryAugmentation = {}> = Partial<Merge<SchemaAugmentations['base'], MaybePromiseProps<Base$1>>> & DefinedValueOrEmptyObject<E>;
429
- type Link<E extends EntryAugmentation = {}> = MaybePromiseProps<LinkBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['link'] & DefinedValueOrEmptyObject<E>;
430
- type Meta<E extends EntryAugmentation = {}> = MaybePromiseProps<BaseMeta> & DataKeys & SchemaAugmentations['meta'] & DefinedValueOrEmptyObject<E>;
431
- type Style<E extends EntryAugmentation = {}> = MaybePromiseProps<Style$1> & DataKeys & SchemaAugmentations['style'] & DefinedValueOrEmptyObject<E>;
432
- type Script<E extends EntryAugmentation = {}> = MaybePromiseProps<ScriptBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['script'] & DefinedValueOrEmptyObject<E>;
433
- type Noscript<E extends EntryAugmentation = {}> = MaybePromiseProps<Noscript$1> & DataKeys & SchemaAugmentations['noscript'] & DefinedValueOrEmptyObject<E>;
434
- type HtmlAttributes<E extends EntryAugmentation = {}> = MaybePromiseProps<HtmlAttr> & DataKeys & SchemaAugmentations['htmlAttrs'] & DefinedValueOrEmptyObject<E>;
435
- type BodyAttributes<E extends EntryAugmentation = {}> = MaybePromiseProps<BodyAttr> & MaybeFunctionEntries<BodyEvents> & DataKeys & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject<E>;
400
+ type Base<E extends EntryAugmentation = Record<string, any>> = Partial<Merge<SchemaAugmentations['base'], MaybePromiseProps<Base$1>>> & DefinedValueOrEmptyObject<E>;
401
+ type Link<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<LinkBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['link'] & DefinedValueOrEmptyObject<E>;
402
+ type Meta<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<BaseMeta> & DataKeys & SchemaAugmentations['meta'] & DefinedValueOrEmptyObject<E>;
403
+ type Style<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<Style$1> & DataKeys & SchemaAugmentations['style'] & DefinedValueOrEmptyObject<E>;
404
+ type Script<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<ScriptBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['script'] & DefinedValueOrEmptyObject<E>;
405
+ type Noscript<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<Noscript$1> & DataKeys & SchemaAugmentations['noscript'] & DefinedValueOrEmptyObject<E>;
406
+ type HtmlAttributes<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<HtmlAttr> & DataKeys & SchemaAugmentations['htmlAttrs'] & DefinedValueOrEmptyObject<E>;
407
+ type BodyAttributes<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<BodyAttr> & MaybeFunctionEntries<BodyEvents> & DataKeys & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject<E>;
436
408
  interface HeadUtils {
437
409
  /**
438
410
  * Generate the title from a template.
@@ -532,4 +504,54 @@ interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParam
532
504
  bodyAttrs?: SafeBodyAttr;
533
505
  }
534
506
 
535
- 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, UseScriptStatus, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
507
+ type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
508
+ /**
509
+ * Either a string source for the script or full script properties.
510
+ */
511
+ type UseScriptInput = string | (Omit<Script, 'src'> & {
512
+ src: string;
513
+ });
514
+ type UseScriptResolvedInput = Omit<Script, 'src'> & {
515
+ src: string;
516
+ };
517
+ interface ScriptInstance<T> {
518
+ id: string;
519
+ entry?: ActiveHeadEntry<any>;
520
+ loaded: boolean;
521
+ status: UseScriptStatus;
522
+ load: () => Promise<T>;
523
+ waitForLoad: () => Promise<T>;
524
+ remove: () => boolean;
525
+ }
526
+ interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
527
+ /**
528
+ * Should the `dns-prefetch` tag be skipped.
529
+ *
530
+ * Useful if loading the script through a local proxy.
531
+ */
532
+ skipEarlyConnections?: boolean;
533
+ /**
534
+ * Resolve the script instance from the window.
535
+ */
536
+ use?: () => T | undefined | null;
537
+ /**
538
+ * Stub the script instance. Useful for SSR or testing.
539
+ */
540
+ stub?: ((ctx: {
541
+ script: ScriptInstance<T>;
542
+ fn: string | symbol;
543
+ }) => any);
544
+ /**
545
+ * Transform the script instance before it's resolved.
546
+ */
547
+ transform?: (script: UseScriptResolvedInput) => Promise<UseScriptResolvedInput> | UseScriptResolvedInput;
548
+ /**
549
+ * The trigger to load the script:
550
+ * - `idle` - Load the script when the browser is idle.
551
+ * - `manual` - Load the script manually by calling `$script.load()` or `$script.waitForLoad()`.
552
+ * - `Promise` - Load the script when the promise resolves.
553
+ */
554
+ trigger?: 'idle' | 'manual' | Promise<void>;
555
+ }
556
+
557
+ 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
@@ -13,34 +13,6 @@ interface SSRHeadPayload {
13
13
  interface RenderSSRHeadOptions {
14
14
  omitLineBreaks?: boolean;
15
15
  }
16
- type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
17
- interface ScriptInstance<T> {
18
- id: string;
19
- entry?: ActiveHeadEntry<any>;
20
- loaded: boolean;
21
- status: UseScriptStatus;
22
- load: () => Promise<T>;
23
- waitForLoad: () => Promise<T>;
24
- remove: () => boolean;
25
- }
26
- interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
27
- /**
28
- * Should the `dns-prefetch` tag be skipped.
29
- *
30
- * Useful if loading the script through a local proxy.
31
- */
32
- skipEarlyConnections?: boolean;
33
- use?: () => T | undefined | null;
34
- stub?: ((ctx: {
35
- script: ScriptInstance<T>;
36
- fn: string | symbol;
37
- }) => any);
38
- transform?: (script: UseScriptInput) => Promise<UseScriptInput> | UseScriptInput;
39
- trigger?: 'idle' | 'manual' | Promise<void>;
40
- }
41
- type UseScriptInput = Omit<Script, 'src'> & {
42
- src: string;
43
- };
44
16
  interface EntryResolveCtx<T> {
45
17
  tags: HeadTag[];
46
18
  entries: HeadEntry<T>[];
@@ -95,7 +67,7 @@ interface HeadHooks {
95
67
  }) => HookResult;
96
68
  'ssr:rendered': (ctx: SSRRenderContext) => HookResult;
97
69
  'script:transform': (ctx: {
98
- script: UseScriptInput;
70
+ script: UseScriptResolvedInput;
99
71
  }) => HookResult;
100
72
  'script:updated': (ctx: {
101
73
  script: ScriptInstance<any>;
@@ -425,14 +397,14 @@ type Title = MaybePromiseProps<string | ({
425
397
  type TitleTemplate = TitleTemplateResolver | null | ({
426
398
  textContent: TitleTemplateResolver;
427
399
  } & SchemaAugmentations['titleTemplate']);
428
- type Base<E extends EntryAugmentation = {}> = Partial<Merge<SchemaAugmentations['base'], MaybePromiseProps<Base$1>>> & DefinedValueOrEmptyObject<E>;
429
- type Link<E extends EntryAugmentation = {}> = MaybePromiseProps<LinkBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['link'] & DefinedValueOrEmptyObject<E>;
430
- type Meta<E extends EntryAugmentation = {}> = MaybePromiseProps<BaseMeta> & DataKeys & SchemaAugmentations['meta'] & DefinedValueOrEmptyObject<E>;
431
- type Style<E extends EntryAugmentation = {}> = MaybePromiseProps<Style$1> & DataKeys & SchemaAugmentations['style'] & DefinedValueOrEmptyObject<E>;
432
- type Script<E extends EntryAugmentation = {}> = MaybePromiseProps<ScriptBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['script'] & DefinedValueOrEmptyObject<E>;
433
- type Noscript<E extends EntryAugmentation = {}> = MaybePromiseProps<Noscript$1> & DataKeys & SchemaAugmentations['noscript'] & DefinedValueOrEmptyObject<E>;
434
- type HtmlAttributes<E extends EntryAugmentation = {}> = MaybePromiseProps<HtmlAttr> & DataKeys & SchemaAugmentations['htmlAttrs'] & DefinedValueOrEmptyObject<E>;
435
- type BodyAttributes<E extends EntryAugmentation = {}> = MaybePromiseProps<BodyAttr> & MaybeFunctionEntries<BodyEvents> & DataKeys & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject<E>;
400
+ type Base<E extends EntryAugmentation = Record<string, any>> = Partial<Merge<SchemaAugmentations['base'], MaybePromiseProps<Base$1>>> & DefinedValueOrEmptyObject<E>;
401
+ type Link<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<LinkBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['link'] & DefinedValueOrEmptyObject<E>;
402
+ type Meta<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<BaseMeta> & DataKeys & SchemaAugmentations['meta'] & DefinedValueOrEmptyObject<E>;
403
+ type Style<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<Style$1> & DataKeys & SchemaAugmentations['style'] & DefinedValueOrEmptyObject<E>;
404
+ type Script<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<ScriptBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['script'] & DefinedValueOrEmptyObject<E>;
405
+ type Noscript<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<Noscript$1> & DataKeys & SchemaAugmentations['noscript'] & DefinedValueOrEmptyObject<E>;
406
+ type HtmlAttributes<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<HtmlAttr> & DataKeys & SchemaAugmentations['htmlAttrs'] & DefinedValueOrEmptyObject<E>;
407
+ type BodyAttributes<E extends EntryAugmentation = Record<string, any>> = MaybePromiseProps<BodyAttr> & MaybeFunctionEntries<BodyEvents> & DataKeys & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject<E>;
436
408
  interface HeadUtils {
437
409
  /**
438
410
  * Generate the title from a template.
@@ -532,4 +504,54 @@ interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParam
532
504
  bodyAttrs?: SafeBodyAttr;
533
505
  }
534
506
 
535
- 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, UseScriptStatus, UseSeoMetaInput, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
507
+ type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
508
+ /**
509
+ * Either a string source for the script or full script properties.
510
+ */
511
+ type UseScriptInput = string | (Omit<Script, 'src'> & {
512
+ src: string;
513
+ });
514
+ type UseScriptResolvedInput = Omit<Script, 'src'> & {
515
+ src: string;
516
+ };
517
+ interface ScriptInstance<T> {
518
+ id: string;
519
+ entry?: ActiveHeadEntry<any>;
520
+ loaded: boolean;
521
+ status: UseScriptStatus;
522
+ load: () => Promise<T>;
523
+ waitForLoad: () => Promise<T>;
524
+ remove: () => boolean;
525
+ }
526
+ interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
527
+ /**
528
+ * Should the `dns-prefetch` tag be skipped.
529
+ *
530
+ * Useful if loading the script through a local proxy.
531
+ */
532
+ skipEarlyConnections?: boolean;
533
+ /**
534
+ * Resolve the script instance from the window.
535
+ */
536
+ use?: () => T | undefined | null;
537
+ /**
538
+ * Stub the script instance. Useful for SSR or testing.
539
+ */
540
+ stub?: ((ctx: {
541
+ script: ScriptInstance<T>;
542
+ fn: string | symbol;
543
+ }) => any);
544
+ /**
545
+ * Transform the script instance before it's resolved.
546
+ */
547
+ transform?: (script: UseScriptResolvedInput) => Promise<UseScriptResolvedInput> | UseScriptResolvedInput;
548
+ /**
549
+ * The trigger to load the script:
550
+ * - `idle` - Load the script when the browser is idle.
551
+ * - `manual` - Load the script manually by calling `$script.load()` or `$script.waitForLoad()`.
552
+ * - `Promise` - Load the script when the promise resolves.
553
+ */
554
+ trigger?: 'idle' | 'manual' | Promise<void>;
555
+ }
556
+
557
+ 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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/schema",
3
3
  "type": "module",
4
- "version": "1.8.13",
4
+ "version": "1.8.15",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",