@unhead/schema 1.8.20 → 1.9.1

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
@@ -66,9 +66,6 @@ interface HeadHooks {
66
66
  tags: HeadTag[];
67
67
  }) => HookResult;
68
68
  'ssr:rendered': (ctx: SSRRenderContext) => HookResult;
69
- 'script:transform': (ctx: {
70
- script: UseScriptResolvedInput;
71
- }) => HookResult;
72
69
  'script:updated': (ctx: {
73
70
  script: ScriptInstance<any>;
74
71
  }) => HookResult;
@@ -519,22 +516,15 @@ type UseScriptInput = string | (Omit<Script, 'src'> & {
519
516
  type UseScriptResolvedInput = Omit<Script, 'src'> & {
520
517
  src: string;
521
518
  };
522
- interface ScriptInstance<T> {
519
+ type ScriptInstance<T> = {
523
520
  id: string;
524
- entry?: ActiveHeadEntry<any>;
525
- loaded: boolean;
526
521
  status: UseScriptStatus;
522
+ loadPromise: Promise<T>;
523
+ entry?: ActiveHeadEntry<any>;
527
524
  load: () => Promise<T>;
528
- waitForLoad: () => Promise<T>;
529
525
  remove: () => boolean;
530
- }
531
- interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
532
- /**
533
- * Should the `dns-prefetch` tag be skipped.
534
- *
535
- * Useful if loading the script through a local proxy.
536
- */
537
- skipEarlyConnections?: boolean;
526
+ } & Promise<T>;
527
+ interface UseScriptOptions<T> extends HeadEntryOptions {
538
528
  /**
539
529
  * Resolve the script instance from the window.
540
530
  */
@@ -546,17 +536,17 @@ interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
546
536
  script: ScriptInstance<T>;
547
537
  fn: string | symbol;
548
538
  }) => any);
549
- /**
550
- * Transform the script instance before it's resolved.
551
- */
552
- transform?: (script: UseScriptResolvedInput) => Promise<UseScriptResolvedInput> | UseScriptResolvedInput;
553
539
  /**
554
540
  * The trigger to load the script:
555
- * - `idle` - Load the script when the browser is idle.
556
- * - `manual` - Load the script manually by calling `$script.load()` or `$script.waitForLoad()`.
541
+ * - `manual` - Load the script manually by calling `$script.load()`.
557
542
  * - `Promise` - Load the script when the promise resolves.
558
543
  */
559
- trigger?: 'idle' | 'manual' | Promise<void>;
544
+ trigger?: 'manual' | Promise<void>;
545
+ /**
546
+ * Context to run events with. This is useful in Vue to attach the current instance context before
547
+ * calling the event, allowing the event to be reactive.
548
+ */
549
+ eventContext?: any;
560
550
  }
561
551
 
562
552
  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
@@ -66,9 +66,6 @@ interface HeadHooks {
66
66
  tags: HeadTag[];
67
67
  }) => HookResult;
68
68
  'ssr:rendered': (ctx: SSRRenderContext) => HookResult;
69
- 'script:transform': (ctx: {
70
- script: UseScriptResolvedInput;
71
- }) => HookResult;
72
69
  'script:updated': (ctx: {
73
70
  script: ScriptInstance<any>;
74
71
  }) => HookResult;
@@ -519,22 +516,15 @@ type UseScriptInput = string | (Omit<Script, 'src'> & {
519
516
  type UseScriptResolvedInput = Omit<Script, 'src'> & {
520
517
  src: string;
521
518
  };
522
- interface ScriptInstance<T> {
519
+ type ScriptInstance<T> = {
523
520
  id: string;
524
- entry?: ActiveHeadEntry<any>;
525
- loaded: boolean;
526
521
  status: UseScriptStatus;
522
+ loadPromise: Promise<T>;
523
+ entry?: ActiveHeadEntry<any>;
527
524
  load: () => Promise<T>;
528
- waitForLoad: () => Promise<T>;
529
525
  remove: () => boolean;
530
- }
531
- interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
532
- /**
533
- * Should the `dns-prefetch` tag be skipped.
534
- *
535
- * Useful if loading the script through a local proxy.
536
- */
537
- skipEarlyConnections?: boolean;
526
+ } & Promise<T>;
527
+ interface UseScriptOptions<T> extends HeadEntryOptions {
538
528
  /**
539
529
  * Resolve the script instance from the window.
540
530
  */
@@ -546,17 +536,17 @@ interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
546
536
  script: ScriptInstance<T>;
547
537
  fn: string | symbol;
548
538
  }) => any);
549
- /**
550
- * Transform the script instance before it's resolved.
551
- */
552
- transform?: (script: UseScriptResolvedInput) => Promise<UseScriptResolvedInput> | UseScriptResolvedInput;
553
539
  /**
554
540
  * The trigger to load the script:
555
- * - `idle` - Load the script when the browser is idle.
556
- * - `manual` - Load the script manually by calling `$script.load()` or `$script.waitForLoad()`.
541
+ * - `manual` - Load the script manually by calling `$script.load()`.
557
542
  * - `Promise` - Load the script when the promise resolves.
558
543
  */
559
- trigger?: 'idle' | 'manual' | Promise<void>;
544
+ trigger?: 'manual' | Promise<void>;
545
+ /**
546
+ * Context to run events with. This is useful in Vue to attach the current instance context before
547
+ * calling the event, allowing the event to be reactive.
548
+ */
549
+ eventContext?: any;
560
550
  }
561
551
 
562
552
  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
@@ -66,9 +66,6 @@ interface HeadHooks {
66
66
  tags: HeadTag[];
67
67
  }) => HookResult;
68
68
  'ssr:rendered': (ctx: SSRRenderContext) => HookResult;
69
- 'script:transform': (ctx: {
70
- script: UseScriptResolvedInput;
71
- }) => HookResult;
72
69
  'script:updated': (ctx: {
73
70
  script: ScriptInstance<any>;
74
71
  }) => HookResult;
@@ -519,22 +516,15 @@ type UseScriptInput = string | (Omit<Script, 'src'> & {
519
516
  type UseScriptResolvedInput = Omit<Script, 'src'> & {
520
517
  src: string;
521
518
  };
522
- interface ScriptInstance<T> {
519
+ type ScriptInstance<T> = {
523
520
  id: string;
524
- entry?: ActiveHeadEntry<any>;
525
- loaded: boolean;
526
521
  status: UseScriptStatus;
522
+ loadPromise: Promise<T>;
523
+ entry?: ActiveHeadEntry<any>;
527
524
  load: () => Promise<T>;
528
- waitForLoad: () => Promise<T>;
529
525
  remove: () => boolean;
530
- }
531
- interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
532
- /**
533
- * Should the `dns-prefetch` tag be skipped.
534
- *
535
- * Useful if loading the script through a local proxy.
536
- */
537
- skipEarlyConnections?: boolean;
526
+ } & Promise<T>;
527
+ interface UseScriptOptions<T> extends HeadEntryOptions {
538
528
  /**
539
529
  * Resolve the script instance from the window.
540
530
  */
@@ -546,17 +536,17 @@ interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
546
536
  script: ScriptInstance<T>;
547
537
  fn: string | symbol;
548
538
  }) => any);
549
- /**
550
- * Transform the script instance before it's resolved.
551
- */
552
- transform?: (script: UseScriptResolvedInput) => Promise<UseScriptResolvedInput> | UseScriptResolvedInput;
553
539
  /**
554
540
  * The trigger to load the script:
555
- * - `idle` - Load the script when the browser is idle.
556
- * - `manual` - Load the script manually by calling `$script.load()` or `$script.waitForLoad()`.
541
+ * - `manual` - Load the script manually by calling `$script.load()`.
557
542
  * - `Promise` - Load the script when the promise resolves.
558
543
  */
559
- trigger?: 'idle' | 'manual' | Promise<void>;
544
+ trigger?: 'manual' | Promise<void>;
545
+ /**
546
+ * Context to run events with. This is useful in Vue to attach the current instance context before
547
+ * calling the event, allowing the event to be reactive.
548
+ */
549
+ eventContext?: any;
560
550
  }
561
551
 
562
552
  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.20",
4
+ "version": "1.9.1",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",