@unhead/schema 1.2.2 → 1.3.0-beta.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +28 -31
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
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 } from 'zhead';
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
2
  export { BodyEvents, DataKeys, DefinedValueOrEmptyObject, MergeHead, MetaFlatInput, SpeculationRules } from 'zhead';
3
3
  import { NestedHooks, Hookable } from 'hookable';
4
4
 
@@ -34,12 +34,6 @@ interface TagPosition {
34
34
  * @default 'head'
35
35
  */
36
36
  tagPosition?: ValidTagPositions;
37
- /**
38
- * Render the tag before the body close.
39
- *
40
- * @deprecated Use `tagPosition: 'bodyClose'` instead.
41
- */
42
- body?: true;
43
37
  }
44
38
  type InnerContentVal = string | Record<string, any>;
45
39
  interface InnerContent {
@@ -245,6 +239,10 @@ interface Head<E extends MergeHead = SchemaAugmentations> extends HeadUtils {
245
239
  */
246
240
  bodyAttrs?: BodyAttributes<E['bodyAttrs']>;
247
241
  }
242
+ type UseSeoMetaInput = MetaFlatInput & {
243
+ title?: Title;
244
+ titleTemplate?: TitleTemplate;
245
+ };
248
246
 
249
247
  type SafeBodyAttr = Pick<BodyAttr, 'id' | 'class'> & DataKeys;
250
248
  type SafeHtmlAttr = Pick<HtmlAttr, 'id' | 'class' | 'lang' | 'dir'> & DataKeys;
@@ -279,14 +277,17 @@ interface EntryResolveCtx<T> {
279
277
  entries: HeadEntry<T>[];
280
278
  }
281
279
  interface DomRenderTagContext {
282
- renderId: string;
283
- $el?: Element | null;
280
+ id: string;
281
+ $el: Element;
284
282
  shouldRender: boolean;
285
283
  tag: HeadTag;
286
284
  entry?: HeadEntry<any>;
287
285
  markSideEffect: (key: string, fn: () => void) => void;
288
286
  }
289
- interface BeforeRenderContext {
287
+ interface DomBeforeRenderCtx extends ShouldRenderContext {
288
+ tags: DomRenderTagContext[];
289
+ }
290
+ interface ShouldRenderContext {
290
291
  shouldRender: boolean;
291
292
  }
292
293
  interface SSRRenderContext {
@@ -308,10 +309,14 @@ interface HeadHooks {
308
309
  'tags:resolve': (ctx: {
309
310
  tags: HeadTag[];
310
311
  }) => HookResult;
311
- 'dom:beforeRender': (ctx: BeforeRenderContext) => HookResult;
312
- 'dom:beforeRenderTag': (ctx: DomRenderTagContext) => HookResult;
313
- 'dom:renderTag': (ctx: DomRenderTagContext) => HookResult;
314
- 'ssr:beforeRender': (ctx: BeforeRenderContext) => HookResult;
312
+ 'dom:beforeRender': (ctx: ShouldRenderContext & {
313
+ tags: DomRenderTagContext[];
314
+ }) => HookResult;
315
+ 'dom:renderTag': (ctx: DomRenderTagContext, document: Document, track: any) => HookResult;
316
+ 'dom:rendered': (ctx: {
317
+ renders: DomRenderTagContext[];
318
+ }) => HookResult;
319
+ 'ssr:beforeRender': (ctx: ShouldRenderContext) => HookResult;
315
320
  'ssr:render': (ctx: {
316
321
  tags: HeadTag[];
317
322
  }) => HookResult;
@@ -352,12 +357,6 @@ interface HeadEntry<Input> {
352
357
  * @internal
353
358
  */
354
359
  _i: number;
355
- /**
356
- * Side effects
357
- *
358
- * @internal
359
- */
360
- _sde: SideEffectsRecord;
361
360
  /**
362
361
  * Default tag position.
363
362
  *
@@ -395,7 +394,6 @@ interface CreateHeadOptions {
395
394
  document?: Document;
396
395
  plugins?: HeadPlugin[];
397
396
  hooks?: NestedHooks<HeadHooks>;
398
- experimentalHashHydration?: boolean;
399
397
  }
400
398
  interface HeadEntryOptions extends TagPosition, TagPriority {
401
399
  mode?: RuntimeMode;
@@ -426,15 +424,14 @@ interface Unhead<Input extends {} = Head> {
426
424
  * Use a head plugin, loads the plugins hooks.
427
425
  */
428
426
  use: (plugin: HeadPlugin) => void;
429
- /**
430
- * @internal
431
- */
432
- _popSideEffectQueue: () => SideEffectsRecord;
433
- /**
434
- * @internal
435
- */
436
- _elMap: Record<string, Element>;
437
- _hash?: string | false;
427
+ ssr: boolean;
428
+ _dom?: DomState;
429
+ _domUpdatePromise?: Promise<void>;
430
+ }
431
+ interface DomState {
432
+ pendingSideEffects: SideEffectsRecord;
433
+ sideEffects: SideEffectsRecord;
434
+ elMap: Record<string, Element>;
438
435
  }
439
436
 
440
- export { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BaseMeta, BeforeRenderContext, BodyAttr, BodyAttributes, CreateHeadOptions, DomRenderTagContext, EntryAugmentation, EntryResolveCtx, HasTemplateParams, Head, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, 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, SideEffectsRecord, Style, TagKey, TagPosition, TagPriority, TagUserProperties, TemplateParams, Title, TitleTemplate, Unhead, UserAttributesConfig, UserTagConfigWithoutInnerContent, ValidTagPositions };
437
+ export { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BaseMeta, BodyAttr, BodyAttributes, CreateHeadOptions, DomBeforeRenderCtx, DomRenderTagContext, DomState, EntryAugmentation, EntryResolveCtx, HasTemplateParams, Head, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, 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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/schema",
3
3
  "type": "module",
4
- "version": "1.2.2",
4
+ "version": "1.3.0-beta.1",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",