@unhead/schema 0.6.8 → 0.7.0

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 -28
  2. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
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';
1
+ import { MaybePromiseProps, 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
 
@@ -23,7 +23,7 @@ interface ResolvesDuplicates {
23
23
  */
24
24
  tagDuplicateStrategy?: 'replace' | 'merge';
25
25
  }
26
- declare type ValidTagPositions = 'head' | 'bodyClose' | 'bodyOpen';
26
+ type ValidTagPositions = 'head' | 'bodyClose' | 'bodyOpen';
27
27
  interface TagPosition {
28
28
  /**
29
29
  * Specify where to render the tag.
@@ -70,7 +70,7 @@ interface TagPriority {
70
70
  */
71
71
  tagPriority?: number | `before:${string}` | `after:${string}`;
72
72
  }
73
- declare type TagUserProperties = TagPriority & TagPosition & InnerContent & ResolvesDuplicates;
73
+ type TagUserProperties = TagPriority & TagPosition & MaybePromiseProps<InnerContent> & ResolvesDuplicates;
74
74
  interface TagInternalProperties {
75
75
  /**
76
76
  * Entry ID
@@ -85,14 +85,14 @@ interface TagInternalProperties {
85
85
  */
86
86
  _d?: string;
87
87
  }
88
- declare type HeadTag = HeadTag$1 & TagUserProperties & TagInternalProperties;
89
- declare type HeadTagKeys = (keyof HeadTag)[];
88
+ type HeadTag = HeadTag$1 & TagUserProperties & TagInternalProperties;
89
+ type HeadTagKeys = (keyof HeadTag)[];
90
90
 
91
- declare type Never<T> = {
91
+ type Never<T> = {
92
92
  [P in keyof T]?: never;
93
93
  };
94
- declare type UserTagConfigWithoutInnerContent = TagPriority & TagPosition & ResolvesDuplicates & Never<InnerContent>;
95
- declare type UserAttributesConfig = ResolvesDuplicates & TagPriority & Never<InnerContent & TagPosition>;
94
+ type UserTagConfigWithoutInnerContent = TagPriority & TagPosition & ResolvesDuplicates & Never<InnerContent>;
95
+ type UserAttributesConfig = ResolvesDuplicates & TagPriority & Never<InnerContent & TagPosition>;
96
96
  interface SchemaAugmentations extends MergeHead {
97
97
  base: UserAttributesConfig;
98
98
  htmlAttrs: UserAttributesConfig;
@@ -103,9 +103,9 @@ interface SchemaAugmentations extends MergeHead {
103
103
  script: TagUserProperties;
104
104
  noscript: TagUserProperties;
105
105
  }
106
- declare type MaybeArray<T> = T | T[];
107
- declare type BaseBodyAttr = BaseBodyAttributes;
108
- declare type BaseHtmlAttr = HtmlAttributes$1;
106
+ type MaybeArray<T> = T | T[];
107
+ type BaseBodyAttr = BaseBodyAttributes;
108
+ type BaseHtmlAttr = HtmlAttributes$1;
109
109
  interface BodyAttr extends Omit<BaseBodyAttr, 'class'> {
110
110
  /**
111
111
  * The class global attribute is a space-separated list of the case-sensitive classes of the element.
@@ -132,20 +132,20 @@ interface BaseMeta extends Omit<Meta$1, 'content'> {
132
132
  */
133
133
  content?: MaybeArray<Stringable>;
134
134
  }
135
- declare type EntryAugmentation = undefined | Record<string, any>;
136
- declare type MaybeFunctionEntries<T> = {
135
+ type EntryAugmentation = undefined | Record<string, any>;
136
+ type MaybeFunctionEntries<T> = {
137
137
  [key in keyof T]?: T[key] | ((e: Event) => void);
138
138
  };
139
- declare type Title = string | null;
140
- declare type TitleTemplate = string | null | ((title?: string) => string | null);
141
- declare type Base<E extends EntryAugmentation = {}> = Partial<Merge<SchemaAugmentations['base'], Base$1>> & DefinedValueOrEmptyObject<E>;
142
- declare type Link<E extends EntryAugmentation = {}> = LinkBase & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['link'] & DefinedValueOrEmptyObject<E>;
143
- declare type Meta<E extends EntryAugmentation = {}> = BaseMeta & DataKeys & SchemaAugmentations['meta'] & DefinedValueOrEmptyObject<E>;
144
- declare type Style<E extends EntryAugmentation = {}> = Style$1 & DataKeys & SchemaAugmentations['style'] & DefinedValueOrEmptyObject<E>;
145
- declare type Script<E extends EntryAugmentation = {}> = ScriptBase & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['script'] & DefinedValueOrEmptyObject<E>;
146
- declare type Noscript<E extends EntryAugmentation = {}> = Noscript$1 & DataKeys & SchemaAugmentations['noscript'] & DefinedValueOrEmptyObject<E>;
147
- declare type HtmlAttributes<E extends EntryAugmentation = {}> = HtmlAttr & DataKeys & SchemaAugmentations['htmlAttrs'] & DefinedValueOrEmptyObject<E>;
148
- declare type BodyAttributes<E extends EntryAugmentation = {}> = BodyAttr & MaybeFunctionEntries<BodyEvents> & DataKeys & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject<E>;
139
+ type Title = string | null;
140
+ type TitleTemplate = string | null | ((title?: string) => string | null);
141
+ type Base<E extends EntryAugmentation = {}> = Partial<Merge<SchemaAugmentations['base'], MaybePromiseProps<Base$1>>> & DefinedValueOrEmptyObject<E>;
142
+ type Link<E extends EntryAugmentation = {}> = MaybePromiseProps<LinkBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['link'] & DefinedValueOrEmptyObject<E>;
143
+ type Meta<E extends EntryAugmentation = {}> = MaybePromiseProps<BaseMeta> & DataKeys & SchemaAugmentations['meta'] & DefinedValueOrEmptyObject<E>;
144
+ type Style<E extends EntryAugmentation = {}> = MaybePromiseProps<Style$1> & DataKeys & SchemaAugmentations['style'] & DefinedValueOrEmptyObject<E>;
145
+ type Script<E extends EntryAugmentation = {}> = MaybePromiseProps<ScriptBase> & MaybeFunctionEntries<HttpEventAttributes> & DataKeys & SchemaAugmentations['script'] & DefinedValueOrEmptyObject<E>;
146
+ type Noscript<E extends EntryAugmentation = {}> = MaybePromiseProps<Noscript$1> & DataKeys & SchemaAugmentations['noscript'] & DefinedValueOrEmptyObject<E>;
147
+ type HtmlAttributes<E extends EntryAugmentation = {}> = MaybePromiseProps<HtmlAttr> & DataKeys & SchemaAugmentations['htmlAttrs'] & DefinedValueOrEmptyObject<E>;
148
+ type BodyAttributes<E extends EntryAugmentation = {}> = MaybePromiseProps<BodyAttr> & MaybeFunctionEntries<BodyEvents> & DataKeys & SchemaAugmentations['bodyAttrs'] & DefinedValueOrEmptyObject<E>;
149
149
  interface Head<E extends MergeHead = SchemaAugmentations> {
150
150
  /**
151
151
  * The <title> HTML element defines the document's title that is shown in a browser's title bar or a page's tab.
@@ -153,7 +153,7 @@ interface Head<E extends MergeHead = SchemaAugmentations> {
153
153
  *
154
154
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
155
155
  */
156
- title?: Title;
156
+ title?: Title | Promise<Title>;
157
157
  /**
158
158
  * Generate the title from a template.
159
159
  *
@@ -215,7 +215,7 @@ interface Head<E extends MergeHead = SchemaAugmentations> {
215
215
  bodyAttrs?: BodyAttributes<E['bodyAttrs']>;
216
216
  }
217
217
 
218
- declare type HookResult = Promise<void> | void;
218
+ type HookResult = Promise<void> | void;
219
219
  interface SSRHeadPayload {
220
220
  headTags: string;
221
221
  bodyTags: string;
@@ -268,8 +268,8 @@ interface HeadHooks {
268
268
  *
269
269
  * For example `meta:data-h-4h46h465`: () => { document.querySelector('meta[data-h-4h46h465]').remove() }
270
270
  */
271
- declare type SideEffectsRecord = Record<string, () => void>;
272
- declare type RuntimeMode = 'server' | 'client' | 'all';
271
+ type SideEffectsRecord = Record<string, () => void>;
272
+ type RuntimeMode = 'server' | 'client' | 'all';
273
273
  interface HeadEntry<Input> {
274
274
  /**
275
275
  * User provided input for the entry.
@@ -294,7 +294,7 @@ interface HeadEntry<Input> {
294
294
  */
295
295
  _sde: SideEffectsRecord;
296
296
  }
297
- declare type HeadPlugin = Omit<CreateHeadOptions, 'plugins'>;
297
+ type HeadPlugin = Omit<CreateHeadOptions, 'plugins'>;
298
298
  /**
299
299
  * An active head entry provides an API to manipulate it.
300
300
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/schema",
3
3
  "type": "module",
4
- "version": "0.6.8",
4
+ "version": "0.7.0",
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.13",
38
+ "@zhead/schema": "1.0.1",
39
39
  "hookable": "^5.4.1"
40
40
  },
41
41
  "scripts": {