@unhead/schema 1.1.29 → 1.1.31

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 +38 -22
  2. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -8,6 +8,15 @@ interface ResolvesDuplicates {
8
8
  * to be made you can provide a unique key for each entry.
9
9
  */
10
10
  key?: string;
11
+ /**
12
+ * The strategy to use when a duplicate tag is encountered.
13
+ *
14
+ * - `replace` - Replace the existing tag with the new tag
15
+ * - `merge` - Merge the existing tag with the new tag
16
+ *
17
+ * @default 'replace' (some tags will default to 'merge', such as htmlAttr)
18
+ */
19
+ tagDuplicateStrategy?: 'replace' | 'merge';
11
20
  /**
12
21
  * @deprecated Use `key` instead
13
22
  */
@@ -16,12 +25,6 @@ interface ResolvesDuplicates {
16
25
  * @deprecated Use `key` instead
17
26
  */
18
27
  vmid?: string;
19
- /**
20
- * Specify where to render the tag.
21
- *
22
- * @default 'head'
23
- */
24
- tagDuplicateStrategy?: 'replace' | 'merge';
25
28
  }
26
29
  type ValidTagPositions = 'head' | 'bodyClose' | 'bodyOpen';
27
30
  interface TagPosition {
@@ -63,11 +66,11 @@ interface TagPriority {
63
66
  * (besides some special tags).
64
67
  *
65
68
  * The following special tags have default priorities:
66
- * * -2 <meta charset ...>
67
- * * -1 <base>
68
- * * 0 <meta http-equiv="content-security-policy" ...>
69
+ * * -2 `<meta charset ...>`
70
+ * * -1 `<base>`
71
+ * * 0 `<meta http-equiv="content-security-policy" ...>`
69
72
  *
70
- * All other tags have a default priority of 10: <meta>, <script>, <link>, <style>, etc
73
+ * All other tags have a default priority of 10: `<meta>`, `<script>`, `<link>`, `<style>`, etc
71
74
  */
72
75
  tagPriority?: number | 'critical' | 'high' | 'low' | `before:${string}` | `after:${string}`;
73
76
  }
@@ -182,21 +185,21 @@ interface HeadUtils {
182
185
  }
183
186
  interface Head<E extends MergeHead = SchemaAugmentations> extends HeadUtils {
184
187
  /**
185
- * The <title> HTML element defines the document's title that is shown in a browser's title bar or a page's tab.
188
+ * The `<title>` HTML element defines the document's title that is shown in a browser's title bar or a page's tab.
186
189
  * It only contains text; tags within the element are ignored.
187
190
  *
188
191
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
189
192
  */
190
193
  title?: Title | Promise<Title>;
191
194
  /**
192
- * The <base> HTML element specifies the base URL to use for all relative URLs in a document.
195
+ * The `<base>` HTML element specifies the base URL to use for all relative URLs in a document.
193
196
  * There can be only one <base> element in a document.
194
197
  *
195
198
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
196
199
  */
197
200
  base?: Base<E['base']>;
198
201
  /**
199
- * The <link> HTML element specifies relationships between the current document and an external resource.
202
+ * The `<link>` HTML element specifies relationships between the current document and an external resource.
200
203
  * This element is most commonly used to link to stylesheets, but is also used to establish site icons
201
204
  * (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
202
205
  *
@@ -204,39 +207,39 @@ interface Head<E extends MergeHead = SchemaAugmentations> extends HeadUtils {
204
207
  */
205
208
  link?: Link<E['link']>[];
206
209
  /**
207
- * The <meta> element represents metadata that cannot be expressed in other HTML elements, like <link> or <script>.
210
+ * The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
208
211
  *
209
212
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
210
213
  */
211
214
  meta?: Meta<E['meta']>[];
212
215
  /**
213
- * The <style> HTML element contains style information for a document, or part of a document.
214
- * It contains CSS, which is applied to the contents of the document containing the <style> element.
216
+ * The `<style>` HTML element contains style information for a document, or part of a document.
217
+ * It contains CSS, which is applied to the contents of the document containing the `<style>` element.
215
218
  *
216
219
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
217
220
  */
218
221
  style?: (Style<E['style']> | string)[];
219
222
  /**
220
- * The <script> HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
223
+ * The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
221
224
  *
222
225
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
223
226
  */
224
227
  script?: (Script<E['script']> | string)[];
225
228
  /**
226
- * The <noscript> HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
229
+ * The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
227
230
  * or if scripting is currently turned off in the browser.
228
231
  *
229
232
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
230
233
  */
231
234
  noscript?: (Noscript<E['noscript']> | string)[];
232
235
  /**
233
- * Attributes for the <html> HTML element.
236
+ * Attributes for the `<html>` HTML element.
234
237
  *
235
238
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
236
239
  */
237
240
  htmlAttrs?: HtmlAttributes<E['htmlAttrs']>;
238
241
  /**
239
- * Attributes for the <body> HTML element.
242
+ * Attributes for the `<body>` HTML element.
240
243
  *
241
244
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
242
245
  */
@@ -333,13 +336,13 @@ interface HeadEntry<Input> {
333
336
  *
334
337
  * @internal
335
338
  */
336
- _m?: RuntimeMode;
339
+ mode?: RuntimeMode;
337
340
  /**
338
341
  * Transformer function for the entry.
339
342
  *
340
343
  * @internal
341
344
  */
342
- _t?: (input: Input) => Input;
345
+ transform?: (input: unknown) => unknown;
343
346
  /**
344
347
  * Head entry index
345
348
  *
@@ -352,6 +355,18 @@ interface HeadEntry<Input> {
352
355
  * @internal
353
356
  */
354
357
  _sde: SideEffectsRecord;
358
+ /**
359
+ * Default tag position.
360
+ *
361
+ * @internal
362
+ */
363
+ tagPosition?: TagPosition['tagPosition'];
364
+ /**
365
+ * Default tag priority.
366
+ *
367
+ * @internal
368
+ */
369
+ tagPriority?: TagPriority['tagPriority'];
355
370
  }
356
371
  type HeadPlugin = Omit<CreateHeadOptions, 'plugins'>;
357
372
  /**
@@ -372,6 +387,7 @@ interface ActiveHeadEntry<Input> {
372
387
  dispose: () => void;
373
388
  }
374
389
  interface CreateHeadOptions {
390
+ mode?: 'server' | 'client';
375
391
  domDelayFn?: (fn: () => void) => void;
376
392
  document?: Document;
377
393
  plugins?: HeadPlugin[];
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@unhead/schema",
3
3
  "type": "module",
4
- "version": "1.1.29",
5
- "packageManager": "pnpm@8.6.2",
4
+ "version": "1.1.31",
5
+ "packageManager": "pnpm@8.6.7",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -36,7 +36,7 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "hookable": "^5.5.3",
39
- "zhead": "^2.0.7"
39
+ "zhead": "^2.0.9"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "unbuild .",