@unhead/schema 0.1.1 → 0.1.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.cjs ADDED
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
package/dist/index.d.ts CHANGED
@@ -122,7 +122,6 @@ interface BaseMeta extends Omit<Meta$1, 'content'> {
122
122
  content?: MaybeArray<Stringable>;
123
123
  }
124
124
  declare type EntryAugmentation = undefined | Record<string, any>;
125
-
126
125
  declare type Title = string;
127
126
  declare type TitleTemplate = string | null | ((title?: string) => string);
128
127
  declare type Base<E extends EntryAugmentation = {}> = Partial<Merge<SchemaAugmentations['base'], Base$1>> & DefinedValueOrEmptyObject<E>;
@@ -203,11 +202,25 @@ interface Head<E extends MergeHead = SchemaAugmentations> {
203
202
  }
204
203
 
205
204
  declare type HookResult = Promise<void> | void;
205
+ interface SSRHeadPayload {
206
+ headTags: string;
207
+ bodyTags: string;
208
+ bodyTagsOpen: string;
209
+ htmlAttrs: string;
210
+ bodyAttrs: string;
211
+ }
206
212
  interface EntryResolveCtx<T> {
207
213
  tags: HeadTag[];
208
214
  entries: HeadEntry<T>[];
209
215
  }
216
+ interface DomRenderTagContext {
217
+ head: HeadClient;
218
+ tag: HeadTag;
219
+ document: Document;
220
+ }
210
221
  interface HeadHooks {
222
+ 'init': (ctx: HeadClient<any>) => HookResult;
223
+ 'entries:updated': (ctx: HeadClient<any>) => HookResult;
211
224
  'entries:resolve': (ctx: EntryResolveCtx<any>) => HookResult;
212
225
  'tag:normalise': (ctx: {
213
226
  tag: HeadTag;
@@ -216,7 +229,21 @@ interface HeadHooks {
216
229
  'tags:resolve': (ctx: {
217
230
  tags: HeadTag[];
218
231
  }) => HookResult;
232
+ 'dom:beforeRender': (ctx: {
233
+ head: HeadClient;
234
+ tags: HeadTag[];
235
+ document: Document;
236
+ }) => HookResult;
237
+ 'dom:renderTag': (ctx: DomRenderTagContext) => HookResult;
238
+ 'ssr:beforeRender': (ctx: {
239
+ tags: HeadTag[];
240
+ }) => HookResult;
241
+ 'ssr:render': (ctx: {
242
+ tags: HeadTag[];
243
+ html: SSRHeadPayload;
244
+ }) => HookResult;
219
245
  }
246
+
220
247
  /**
221
248
  * Side effects are mapped with a key and their cleanup function.
222
249
  *
@@ -300,4 +327,4 @@ interface HeadClient<T extends {} = Head> {
300
327
  _flushQueuedSideEffects: () => void;
301
328
  }
302
329
 
303
- export { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BodyAttributes, CreateHeadOptions, EntryAugmentation, EntryResolveCtx, Head, HeadClient, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, HeadTag, HeadTagKeys, HookResult, HtmlAttributes, InnerContent, Link, MaybeArray, Meta, Never, Noscript, ResolvesDuplicates, RuntimeMode, SchemaAugmentations, Script, SideEffectsRecord, Style, TagInternalProperties, TagPosition, TagPriority, TagUserProperties, Title, TitleTemplate, UserAttributesConfig, UserTagConfigWithoutInnerContent };
330
+ export { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BodyAttributes, CreateHeadOptions, DomRenderTagContext, EntryAugmentation, EntryResolveCtx, Head, HeadClient, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, HeadTag, HeadTagKeys, HookResult, HtmlAttributes, InnerContent, Link, MaybeArray, Meta, Never, Noscript, ResolvesDuplicates, RuntimeMode, SSRHeadPayload, SchemaAugmentations, Script, SideEffectsRecord, Style, TagInternalProperties, TagPosition, TagPriority, TagUserProperties, Title, TitleTemplate, UserAttributesConfig, UserTagConfigWithoutInnerContent };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/schema",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "packageManager": "pnpm@7.14.0",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",