@unhead/schema 0.3.1 → 0.4.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 +13 -6
  2. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { HeadTag as HeadTag$1, MergeHead, BodyAttributes as BodyAttributes$1, HtmlAttributes as HtmlAttributes$1, Merge, Base as Base$1, DefinedValueOrEmptyObject, Link as Link$1, DataKeys, Style as Style$1, Script as Script$1, Noscript as Noscript$1, Meta as Meta$1, Stringable } from '@zhead/schema';
1
+ import { HeadTag as HeadTag$1, MergeHead, BaseBodyAttributes, HtmlAttributes as HtmlAttributes$1, Merge, Base as Base$1, DefinedValueOrEmptyObject, LinkBase, HttpEventAttributes, DataKeys, Style as Style$1, ScriptBase, Noscript as Noscript$1, BodyEvents, Meta as Meta$1, Stringable } from '@zhead/schema';
2
2
  export { DataKeys, DefinedValueOrEmptyObject, MergeHead, MetaFlatInput, TagKey } from '@zhead/schema';
3
3
  import { NestedHooks, Hookable } from 'hookable';
4
4
 
@@ -99,7 +99,7 @@ interface SchemaAugmentations extends MergeHead {
99
99
  noscript: TagUserProperties;
100
100
  }
101
101
  declare type MaybeArray<T> = T | T[];
102
- declare type BaseBodyAttr = BodyAttributes$1;
102
+ declare type BaseBodyAttr = BaseBodyAttributes;
103
103
  declare type BaseHtmlAttr = HtmlAttributes$1;
104
104
  interface BodyAttr extends Omit<BaseBodyAttr, 'class'> {
105
105
  /**
@@ -128,16 +128,19 @@ interface BaseMeta extends Omit<Meta$1, 'content'> {
128
128
  content?: MaybeArray<Stringable>;
129
129
  }
130
130
  declare type EntryAugmentation = undefined | Record<string, any>;
131
+ declare type MaybeFunctionEntries<T> = {
132
+ [key in keyof T]?: T[key] | ((e: Event) => void);
133
+ };
131
134
  declare type Title = string | null;
132
135
  declare type TitleTemplate = string | null | ((title?: string) => string | null);
133
136
  declare type Base<E extends EntryAugmentation = {}> = Partial<Merge<SchemaAugmentations['base'], Base$1>> & DefinedValueOrEmptyObject<E>;
134
- declare type Link<E extends EntryAugmentation = {}> = Link$1 & DataKeys & SchemaAugmentations['link'] & DefinedValueOrEmptyObject<E>;
137
+ declare type Link<E extends EntryAugmentation = {}> = LinkBase & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['link'] & DefinedValueOrEmptyObject<E>;
135
138
  declare type Meta<E extends EntryAugmentation = {}> = BaseMeta & DataKeys & SchemaAugmentations['meta'] & DefinedValueOrEmptyObject<E>;
136
139
  declare type Style<E extends EntryAugmentation = {}> = Style$1 & DataKeys & SchemaAugmentations['style'] & DefinedValueOrEmptyObject<E>;
137
- declare type Script<E extends EntryAugmentation = {}> = Script$1 & DataKeys & SchemaAugmentations['script'] & DefinedValueOrEmptyObject<E>;
140
+ declare type Script<E extends EntryAugmentation = {}> = ScriptBase & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['script'] & DefinedValueOrEmptyObject<E>;
138
141
  declare type Noscript<E extends EntryAugmentation = {}> = Noscript$1 & DataKeys & SchemaAugmentations['noscript'] & DefinedValueOrEmptyObject<E>;
139
142
  declare type HtmlAttributes<E extends EntryAugmentation = {}> = HtmlAttr & DataKeys & SchemaAugmentations['htmlAttrs'] & DefinedValueOrEmptyObject<E>;
140
- declare type BodyAttributes<E extends EntryAugmentation = {}> = BodyAttr & DataKeys & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject<E>;
143
+ declare type BodyAttributes<E extends EntryAugmentation = {}> = BodyAttr & MaybeFunctionEntries<BodyEvents> & DataKeys & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject<E>;
141
144
  interface Head<E extends MergeHead = SchemaAugmentations> {
142
145
  /**
143
146
  * The <title> HTML element defines the document's title that is shown in a browser's title bar or a page's tab.
@@ -220,8 +223,11 @@ interface EntryResolveCtx<T> {
220
223
  entries: HeadEntry<T>[];
221
224
  }
222
225
  interface DomRenderTagContext {
226
+ $el?: Element | null;
223
227
  shouldRender: boolean;
224
228
  tag: HeadTag;
229
+ entry: HeadEntry<any>;
230
+ queuedSideEffects: SideEffectsRecord;
225
231
  }
226
232
  interface BeforeRenderContext {
227
233
  shouldRender: boolean;
@@ -243,6 +249,7 @@ interface HeadHooks {
243
249
  tags: HeadTag[];
244
250
  }) => HookResult;
245
251
  'dom:beforeRender': (ctx: BeforeRenderContext) => HookResult;
252
+ 'dom:beforeRenderTag': (ctx: DomRenderTagContext) => HookResult;
246
253
  'dom:renderTag': (ctx: DomRenderTagContext) => HookResult;
247
254
  'ssr:beforeRender': (ctx: BeforeRenderContext) => HookResult;
248
255
  'ssr:render': (ctx: SSRRenderContext) => HookResult;
@@ -329,4 +336,4 @@ interface Unhead<Input extends {} = Head> {
329
336
  _popSideEffectQueue: () => SideEffectsRecord;
330
337
  }
331
338
 
332
- export { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BeforeRenderContext, BodyAttributes, CreateHeadOptions, DomRenderTagContext, EntryAugmentation, EntryResolveCtx, Head, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, HeadTag, HeadTagKeys, HookResult, HtmlAttributes, InnerContent, Link, MaybeArray, Meta, Never, Noscript, ResolvesDuplicates, RuntimeMode, SSRHeadPayload, SSRRenderContext, SchemaAugmentations, Script, SideEffectsRecord, Style, TagInternalProperties, TagPosition, TagPriority, TagUserProperties, Title, TitleTemplate, Unhead, UserAttributesConfig, UserTagConfigWithoutInnerContent };
339
+ export { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BeforeRenderContext, BodyAttributes, CreateHeadOptions, DomRenderTagContext, EntryAugmentation, EntryResolveCtx, Head, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, HeadTag, HeadTagKeys, HookResult, HtmlAttributes, InnerContent, Link, MaybeArray, MaybeFunctionEntries, Meta, Never, Noscript, ResolvesDuplicates, RuntimeMode, SSRHeadPayload, SSRRenderContext, SchemaAugmentations, Script, SideEffectsRecord, Style, TagInternalProperties, TagPosition, TagPriority, TagUserProperties, Title, TitleTemplate, Unhead, UserAttributesConfig, UserTagConfigWithoutInnerContent };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/schema",
3
3
  "type": "module",
4
- "version": "0.3.1",
4
+ "version": "0.4.1",
5
5
  "packageManager": "pnpm@7.14.0",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "dist"
36
36
  ],
37
37
  "dependencies": {
38
- "@zhead/schema": "1.0.0-beta.4",
38
+ "@zhead/schema": "1.0.0-beta.11",
39
39
  "hookable": "^5.4.1"
40
40
  },
41
41
  "scripts": {