@unhead/schema 1.6.0 → 1.6.2

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
@@ -23,6 +23,9 @@ interface DomRenderTagContext {
23
23
  markSideEffect: (key: string, fn: () => void) => void;
24
24
  }
25
25
  interface DomBeforeRenderCtx extends ShouldRenderContext {
26
+ /**
27
+ * @deprecated will always be empty, prefer other hooks
28
+ */
26
29
  tags: DomRenderTagContext[];
27
30
  }
28
31
  interface ShouldRenderContext {
@@ -47,9 +50,7 @@ interface HeadHooks {
47
50
  'tags:resolve': (ctx: {
48
51
  tags: HeadTag[];
49
52
  }) => HookResult;
50
- 'dom:beforeRender': (ctx: ShouldRenderContext & {
51
- tags: DomRenderTagContext[];
52
- }) => HookResult;
53
+ 'dom:beforeRender': (ctx: DomBeforeRenderCtx) => HookResult;
53
54
  'dom:renderTag': (ctx: DomRenderTagContext, document: Document, track: any) => HookResult;
54
55
  'dom:rendered': (ctx: {
55
56
  renders: DomRenderTagContext[];
@@ -135,7 +136,7 @@ interface CreateHeadOptions {
135
136
  plugins?: HeadPlugin[];
136
137
  hooks?: NestedHooks<HeadHooks>;
137
138
  }
138
- interface HeadEntryOptions extends TagPosition, TagPriority {
139
+ interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplateParams {
139
140
  mode?: RuntimeMode;
140
141
  transform?: (input: unknown) => unknown;
141
142
  head?: Unhead;
@@ -174,6 +175,10 @@ interface Unhead<Input extends {} = Head> {
174
175
  * @internal
175
176
  */
176
177
  _domUpdatePromise?: Promise<void>;
178
+ /**
179
+ * @internal
180
+ */
181
+ dirty: boolean;
177
182
  }
178
183
  interface DomState {
179
184
  pendingSideEffects: SideEffectsRecord;
@@ -247,17 +252,21 @@ interface TagPriority {
247
252
  */
248
253
  tagPriority?: number | 'critical' | 'high' | 'low' | `before:${string}` | `after:${string}`;
249
254
  }
250
- type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates;
255
+ type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates & ProcessesTemplateParams;
251
256
  type TagKey = keyof Head;
252
257
  type TemplateParams = {
253
258
  separator?: string;
254
259
  } & Record<string, null | string | Record<string, string>>;
260
+ interface ProcessesTemplateParams {
261
+ processTemplateParams?: boolean;
262
+ }
255
263
  interface HasTemplateParams {
256
264
  templateParams?: TemplateParams;
257
265
  }
258
266
  interface HeadTag extends TagPriority, TagPosition, ResolvesDuplicates, HasTemplateParams {
259
267
  tag: TagKey;
260
268
  props: Record<string, string>;
269
+ processTemplateParams?: boolean;
261
270
  innerHTML?: string;
262
271
  textContent?: string;
263
272
  /**
@@ -290,7 +299,9 @@ type HeadTagKeys = (keyof HeadTag)[];
290
299
  type Never<T> = {
291
300
  [P in keyof T]?: never;
292
301
  };
293
- type UserTagConfigWithoutInnerContent = TagPriority & TagPosition & ResolvesDuplicates & Never<InnerContent>;
302
+ type UserTagConfigWithoutInnerContent = TagPriority & TagPosition & ResolvesDuplicates & Never<InnerContent> & {
303
+ processTemplateParams?: false;
304
+ };
294
305
  type UserAttributesConfig = ResolvesDuplicates & TagPriority & Never<InnerContent & TagPosition>;
295
306
  interface SchemaAugmentations extends MergeHead {
296
307
  title: TagPriority;
@@ -451,4 +462,4 @@ interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParam
451
462
  bodyAttrs?: SafeBodyAttr;
452
463
  }
453
464
 
454
- 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, 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 };
465
+ 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 };
package/dist/index.d.mts CHANGED
@@ -23,6 +23,9 @@ interface DomRenderTagContext {
23
23
  markSideEffect: (key: string, fn: () => void) => void;
24
24
  }
25
25
  interface DomBeforeRenderCtx extends ShouldRenderContext {
26
+ /**
27
+ * @deprecated will always be empty, prefer other hooks
28
+ */
26
29
  tags: DomRenderTagContext[];
27
30
  }
28
31
  interface ShouldRenderContext {
@@ -47,9 +50,7 @@ interface HeadHooks {
47
50
  'tags:resolve': (ctx: {
48
51
  tags: HeadTag[];
49
52
  }) => HookResult;
50
- 'dom:beforeRender': (ctx: ShouldRenderContext & {
51
- tags: DomRenderTagContext[];
52
- }) => HookResult;
53
+ 'dom:beforeRender': (ctx: DomBeforeRenderCtx) => HookResult;
53
54
  'dom:renderTag': (ctx: DomRenderTagContext, document: Document, track: any) => HookResult;
54
55
  'dom:rendered': (ctx: {
55
56
  renders: DomRenderTagContext[];
@@ -135,7 +136,7 @@ interface CreateHeadOptions {
135
136
  plugins?: HeadPlugin[];
136
137
  hooks?: NestedHooks<HeadHooks>;
137
138
  }
138
- interface HeadEntryOptions extends TagPosition, TagPriority {
139
+ interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplateParams {
139
140
  mode?: RuntimeMode;
140
141
  transform?: (input: unknown) => unknown;
141
142
  head?: Unhead;
@@ -174,6 +175,10 @@ interface Unhead<Input extends {} = Head> {
174
175
  * @internal
175
176
  */
176
177
  _domUpdatePromise?: Promise<void>;
178
+ /**
179
+ * @internal
180
+ */
181
+ dirty: boolean;
177
182
  }
178
183
  interface DomState {
179
184
  pendingSideEffects: SideEffectsRecord;
@@ -247,17 +252,21 @@ interface TagPriority {
247
252
  */
248
253
  tagPriority?: number | 'critical' | 'high' | 'low' | `before:${string}` | `after:${string}`;
249
254
  }
250
- type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates;
255
+ type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates & ProcessesTemplateParams;
251
256
  type TagKey = keyof Head;
252
257
  type TemplateParams = {
253
258
  separator?: string;
254
259
  } & Record<string, null | string | Record<string, string>>;
260
+ interface ProcessesTemplateParams {
261
+ processTemplateParams?: boolean;
262
+ }
255
263
  interface HasTemplateParams {
256
264
  templateParams?: TemplateParams;
257
265
  }
258
266
  interface HeadTag extends TagPriority, TagPosition, ResolvesDuplicates, HasTemplateParams {
259
267
  tag: TagKey;
260
268
  props: Record<string, string>;
269
+ processTemplateParams?: boolean;
261
270
  innerHTML?: string;
262
271
  textContent?: string;
263
272
  /**
@@ -290,7 +299,9 @@ type HeadTagKeys = (keyof HeadTag)[];
290
299
  type Never<T> = {
291
300
  [P in keyof T]?: never;
292
301
  };
293
- type UserTagConfigWithoutInnerContent = TagPriority & TagPosition & ResolvesDuplicates & Never<InnerContent>;
302
+ type UserTagConfigWithoutInnerContent = TagPriority & TagPosition & ResolvesDuplicates & Never<InnerContent> & {
303
+ processTemplateParams?: false;
304
+ };
294
305
  type UserAttributesConfig = ResolvesDuplicates & TagPriority & Never<InnerContent & TagPosition>;
295
306
  interface SchemaAugmentations extends MergeHead {
296
307
  title: TagPriority;
@@ -451,4 +462,4 @@ interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParam
451
462
  bodyAttrs?: SafeBodyAttr;
452
463
  }
453
464
 
454
- 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, 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 };
465
+ 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 };
package/dist/index.d.ts CHANGED
@@ -23,6 +23,9 @@ interface DomRenderTagContext {
23
23
  markSideEffect: (key: string, fn: () => void) => void;
24
24
  }
25
25
  interface DomBeforeRenderCtx extends ShouldRenderContext {
26
+ /**
27
+ * @deprecated will always be empty, prefer other hooks
28
+ */
26
29
  tags: DomRenderTagContext[];
27
30
  }
28
31
  interface ShouldRenderContext {
@@ -47,9 +50,7 @@ interface HeadHooks {
47
50
  'tags:resolve': (ctx: {
48
51
  tags: HeadTag[];
49
52
  }) => HookResult;
50
- 'dom:beforeRender': (ctx: ShouldRenderContext & {
51
- tags: DomRenderTagContext[];
52
- }) => HookResult;
53
+ 'dom:beforeRender': (ctx: DomBeforeRenderCtx) => HookResult;
53
54
  'dom:renderTag': (ctx: DomRenderTagContext, document: Document, track: any) => HookResult;
54
55
  'dom:rendered': (ctx: {
55
56
  renders: DomRenderTagContext[];
@@ -135,7 +136,7 @@ interface CreateHeadOptions {
135
136
  plugins?: HeadPlugin[];
136
137
  hooks?: NestedHooks<HeadHooks>;
137
138
  }
138
- interface HeadEntryOptions extends TagPosition, TagPriority {
139
+ interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplateParams {
139
140
  mode?: RuntimeMode;
140
141
  transform?: (input: unknown) => unknown;
141
142
  head?: Unhead;
@@ -174,6 +175,10 @@ interface Unhead<Input extends {} = Head> {
174
175
  * @internal
175
176
  */
176
177
  _domUpdatePromise?: Promise<void>;
178
+ /**
179
+ * @internal
180
+ */
181
+ dirty: boolean;
177
182
  }
178
183
  interface DomState {
179
184
  pendingSideEffects: SideEffectsRecord;
@@ -247,17 +252,21 @@ interface TagPriority {
247
252
  */
248
253
  tagPriority?: number | 'critical' | 'high' | 'low' | `before:${string}` | `after:${string}`;
249
254
  }
250
- type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates;
255
+ type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates & ProcessesTemplateParams;
251
256
  type TagKey = keyof Head;
252
257
  type TemplateParams = {
253
258
  separator?: string;
254
259
  } & Record<string, null | string | Record<string, string>>;
260
+ interface ProcessesTemplateParams {
261
+ processTemplateParams?: boolean;
262
+ }
255
263
  interface HasTemplateParams {
256
264
  templateParams?: TemplateParams;
257
265
  }
258
266
  interface HeadTag extends TagPriority, TagPosition, ResolvesDuplicates, HasTemplateParams {
259
267
  tag: TagKey;
260
268
  props: Record<string, string>;
269
+ processTemplateParams?: boolean;
261
270
  innerHTML?: string;
262
271
  textContent?: string;
263
272
  /**
@@ -290,7 +299,9 @@ type HeadTagKeys = (keyof HeadTag)[];
290
299
  type Never<T> = {
291
300
  [P in keyof T]?: never;
292
301
  };
293
- type UserTagConfigWithoutInnerContent = TagPriority & TagPosition & ResolvesDuplicates & Never<InnerContent>;
302
+ type UserTagConfigWithoutInnerContent = TagPriority & TagPosition & ResolvesDuplicates & Never<InnerContent> & {
303
+ processTemplateParams?: false;
304
+ };
294
305
  type UserAttributesConfig = ResolvesDuplicates & TagPriority & Never<InnerContent & TagPosition>;
295
306
  interface SchemaAugmentations extends MergeHead {
296
307
  title: TagPriority;
@@ -451,4 +462,4 @@ interface HeadSafe extends Pick<Head, 'title' | 'titleTemplate' | 'templateParam
451
462
  bodyAttrs?: SafeBodyAttr;
452
463
  }
453
464
 
454
- 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, 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 };
465
+ 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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/schema",
3
3
  "type": "module",
4
- "version": "1.6.0",
4
+ "version": "1.6.2",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",