ubean 0.6.0 → 0.6.1-beta.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/client.d.ts CHANGED
@@ -1,2519 +1,8 @@
1
1
  import { HydrateIslandsOptions } from "@ubean/islands/runtime";
2
2
  import { UseActionReturn, UseFormActionReturn, callAction, invokeServerFn, useAction, useFormAction } from "@ubean/routes/runtime";
3
- import { CSSProperties, Component, ComputedRef, Plugin, Ref } from "vue";
3
+ import { createServerHead } from "@ubean/client/server";
4
+ import { Component } from "vue";
4
5
  export * from "@ubean/client";
5
- //#region ../../node_modules/.pnpm/hookable@6.1.2/node_modules/hookable/dist/index.d.mts
6
- type HookCallback = (...arguments_: any) => Promise<void> | void;
7
- type HookKeys<T> = keyof T & string;
8
- type InferCallback<HT, HN extends keyof HT> = HT[HN] extends HookCallback ? HT[HN] : never;
9
- declare class HookableCore<HooksT extends Record<string, any> = Record<string, HookCallback>, HookNameT extends HookKeys<HooksT> = HookKeys<HooksT>> {
10
- protected _hooks: {
11
- [key: string]: HookCallback[] | undefined;
12
- };
13
- constructor();
14
- hook<NameT extends HookNameT>(name: NameT, fn: InferCallback<HooksT, NameT>): () => void;
15
- removeHook<NameT extends HookNameT>(name: NameT, function_: InferCallback<HooksT, NameT>): void;
16
- callHook<NameT extends HookNameT>(name: NameT, ...args: Parameters<InferCallback<HooksT, NameT>>): Promise<any> | void;
17
- }
18
- type CreateTask = (name?: string) => {
19
- run: (function_: () => Promise<any> | any) => Promise<any> | any;
20
- };
21
- declare global {
22
- interface Console {
23
- createTask?: CreateTask;
24
- }
25
- }
26
- //#endregion
27
- //#region ../../node_modules/.pnpm/unhead@3.4.2_@types+node@26.6.4_@vitejs+devtools@0.7.6_@devframes+json-render@1.2.0_@de_15009e0f764b121066881ba5914a1e8a/node_modules/unhead/dist/shared/unhead.DC0v7nqS.d.ts
28
- type Booleanable = boolean | 'false' | 'true' | '';
29
- type Stringable = string | Booleanable | number;
30
- type Falsy$1 = false | null | undefined;
31
- type ResolvableValue$1<T> = T | Falsy$1 | (() => (T | Falsy$1));
32
- type Prettify$1<T> = { [K in keyof T]: T[K]; } & {};
33
- type _ResolvablePropertiesRaw$1<T> = { [K in keyof T as {} extends Pick<T, K> ? never : K]: ResolvableValue$1<T[K]>; } & { [K in keyof T as {} extends Pick<T, K> ? K : never]?: ResolvableValue$1<T[K]>; };
34
- type ResolvableProperties$1<T> = Prettify$1<_ResolvablePropertiesRaw$1<T>>;
35
- interface DataKeys {
36
- [key: `data-${string}`]: Stringable;
37
- }
38
- interface BaseFields {
39
- /**
40
- * The base URL to be used throughout the document for relative URLs. Absolute and relative URLs are allowed.
41
- *
42
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base#attr-href
43
- */
44
- href?: string;
45
- /**
46
- * A keyword or author-defined name of the default browsing context to show the results of navigation from `<a>`,
47
- * `<area>`, or `<form>` elements without explicit target attributes.
48
- *
49
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base#attr-target
50
- */
51
- target?: '_blank' | '_self' | '_parent' | '_top' | (string & Record<never, never>);
52
- }
53
- /**
54
- * The `<base>` HTML element requires at least `href` or `target` to be valid.
55
- *
56
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
57
- */
58
- type Base$1 = (BaseFields & {
59
- href: string;
60
- }) | (BaseFields & {
61
- target: '_blank' | '_self' | '_parent' | '_top' | (string & Record<never, never>);
62
- });
63
- interface GlobalAttributes {
64
- /**
65
- * Provides a hint for generating a keyboard shortcut for the current element. This attribute consists of a
66
- * space-separated list of characters. The browser should use the first one that exists on the computer keyboard layout.
67
- *
68
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/accesskey
69
- */
70
- accesskey?: string;
71
- /**
72
- * Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
73
- *
74
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize
75
- */
76
- autocapitalize?: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';
77
- /**
78
- * Indicates that an element is to be focused on page load, or as soon as the `<dialog>` it is part of is displayed.
79
- *
80
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
81
- */
82
- autofocus?: Booleanable;
83
- /**
84
- * A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access
85
- * specific elements via the class selectors or functions like the method Document.getElementsByClassName().
86
- *
87
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
88
- */
89
- class?: Stringable;
90
- /**
91
- * An enumerated attribute indicating if the element should be editable by the user.
92
- * If so, the browser modifies its widget to allow editing.
93
- *
94
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contenteditable
95
- */
96
- contenteditable?: Booleanable;
97
- /**
98
- * An enumerated attribute indicating the directionality of the element's text.
99
- *
100
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir
101
- */
102
- dir?: 'ltr' | 'rtl' | 'auto';
103
- /**
104
- * An enumerated attribute indicating whether the element can be dragged, using the Drag and Drop API.
105
- *
106
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/draggable
107
- */
108
- draggable?: Booleanable;
109
- /**
110
- * Hints what action label (or icon) to present for the enter key on virtual keyboards.
111
- *
112
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint
113
- */
114
- enterkeyhint?: string;
115
- /**
116
- * Used to transitively export shadow parts from a nested shadow tree into a containing light tree.
117
- *
118
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/exportparts
119
- */
120
- exportparts?: string;
121
- /**
122
- * A Boolean attribute indicates that the element is not yet, or is no longer, relevant.
123
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden
124
- */
125
- hidden?: Booleanable;
126
- /**
127
- * The id global attribute defines a unique identifier (ID) which must be unique in the whole document.
128
- *
129
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
130
- */
131
- id?: string;
132
- /**
133
- * Provides a hint to browsers as to the type of virtual keyboard configuration to use when editing this element or its contents.
134
- *
135
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode
136
- */
137
- inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
138
- /**
139
- * Allows you to specify that a standard HTML element should behave like a registered custom built-in element.
140
- *
141
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/is
142
- */
143
- is?: string;
144
- /**
145
- * The unique, global identifier of an item.
146
- *
147
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemid
148
- */
149
- itemid?: string;
150
- /**
151
- * Used to add properties to an item.
152
- *
153
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemprop
154
- */
155
- itemprop?: string;
156
- /**
157
- * Properties that are not descendants of an element with the itemscope attribute can be associated with the item using an itemref.
158
- *
159
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemref
160
- */
161
- itemref?: string;
162
- /**
163
- * itemscope (usually) works along with itemtype to specify that the HTML contained in a block is about a particular item.
164
- *
165
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemscope
166
- */
167
- itemscope?: string;
168
- /**
169
- * Specifies the URL of the vocabulary that will be used to define itemprops (item properties) in the data structure.
170
- *
171
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemtype
172
- */
173
- itemtype?: string;
174
- /**
175
- * Helps define the language of an element: the language that non-editable elements are in, or the language
176
- * that editable elements should be written in by the user.
177
- *
178
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang
179
- */
180
- lang?: 'en' | 'en-US' | 'en-GB' | 'de' | 'fr' | 'es' | 'it' | 'ja' | 'ko' | 'nl' | 'pl' | 'pt' | 'pt-BR' | 'ru' | 'zh' | 'zh-CN' | 'zh-TW' | 'ar' | 'hi' | 'id' | 'th' | 'tr' | 'uk' | 'vi' | (string & Record<never, never>);
181
- /**
182
- * A cryptographic nonce ("number used once") which can be used by Content Security Policy to determine whether or not
183
- * a given fetch will be allowed to proceed.
184
- *
185
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce
186
- */
187
- nonce?: string;
188
- /**
189
- * A space-separated list of the part names of the element. Part names allows CSS to select and style specific elements
190
- * in a shadow tree via the ::part pseudo-element.
191
- *
192
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part
193
- */
194
- part?: string;
195
- /**
196
- * Assigns a slot in a shadow DOM shadow tree to an element: An element with a slot attribute is assigned to the slot
197
- * created by the `<slot>` element whose name attribute's value matches that slot attribute's value.
198
- *
199
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/slot
200
- */
201
- slot?: string;
202
- /**
203
- * An enumerated attribute defines whether the element may be checked for spelling errors.
204
- *
205
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck
206
- */
207
- spellcheck?: Booleanable;
208
- /**
209
- * Contains CSS styling declarations to be applied to the element.
210
- *
211
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/style
212
- */
213
- style?: string;
214
- /**
215
- * An integer attribute indicating if the element can take input focus (is focusable),
216
- * if it should participate to sequential keyboard navigation, and if so, at what position.
217
- *
218
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
219
- */
220
- tabindex?: number;
221
- /**
222
- * Contains a text representing advisory information related to the element it belongs to.
223
- *
224
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title
225
- */
226
- title?: string;
227
- /**
228
- * An enumerated attribute that is used to specify whether an element's attribute values and the values of its
229
- * Text node children are to be translated when the page is localized, or whether to leave them unchanged.
230
- *
231
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/translate
232
- */
233
- translate?: 'yes' | 'no' | '';
234
- }
235
- interface BodyEvents {
236
- /**
237
- * Script to be run after the document is printed
238
- */
239
- onafterprint?: string;
240
- /**
241
- * Script to be run before the document is printed
242
- */
243
- onbeforeprint?: string;
244
- /**
245
- * Script to be run when the document is about to be unloaded
246
- */
247
- onbeforeunload?: string;
248
- /**
249
- * Script to be run when an error occurs
250
- */
251
- onerror?: string;
252
- /**
253
- * Script to be run when there has been changes to the anchor part of the a URL
254
- */
255
- onhashchange?: string;
256
- /**
257
- * Fires after the page is finished loading
258
- */
259
- onload?: string;
260
- /**
261
- * Script to be run when the message is triggered
262
- */
263
- onmessage?: string;
264
- /**
265
- * Script to be run when the browser starts to work offline
266
- */
267
- onoffline?: string;
268
- /**
269
- * Script to be run when the browser starts to work online
270
- */
271
- ononline?: string;
272
- /**
273
- * Script to be run when a user navigates away from a page
274
- */
275
- onpagehide?: string;
276
- /**
277
- * Script to be run when a user navigates to a page
278
- */
279
- onpageshow?: string;
280
- /**
281
- * Script to be run when the window's history changes
282
- */
283
- onpopstate?: string;
284
- /**
285
- * Fires when the browser window is resized
286
- */
287
- onresize?: string;
288
- /**
289
- * Script to be run when a Web Storage area is updated
290
- */
291
- onstorage?: string;
292
- /**
293
- * Fires once a page has unloaded (or the browser window has been closed)
294
- */
295
- onunload?: string;
296
- }
297
- interface BodyAttributesWithoutEvents extends Pick<GlobalAttributes, 'class' | 'style' | 'id' | 'dir' | 'lang' | 'translate'> {}
298
- interface HtmlAttributes$1 extends Pick<GlobalAttributes, 'lang' | 'dir' | 'translate' | 'class' | 'style' | 'id'> {
299
- /**
300
- * Open-graph protocol prefix.
301
- *
302
- * @see https://ogp.me/
303
- */
304
- prefix?: 'og: https://ogp.me/ns#' | (string & Record<never, never>);
305
- /**
306
- * XML namespace
307
- *
308
- * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Namespaces_Crash_Course
309
- */
310
- xmlns?: string;
311
- /**
312
- * Custom XML namespace
313
- *
314
- * @See https://developer.mozilla.org/en-US/docs/Web/SVG/Namespaces_Crash_Course
315
- */
316
- [key: `xmlns:${'og' | string}`]: string;
317
- }
318
- interface HttpEventAttributes {
319
- /**
320
- * Script to be run on abort
321
- */
322
- onabort?: string;
323
- /**
324
- * Script to be run when an error occurs when the file is being loaded
325
- */
326
- onerror?: string;
327
- /**
328
- * Script to be run when the file is loaded
329
- */
330
- onload?: string;
331
- /**
332
- * The progress event is fired periodically when a request receives more data.
333
- */
334
- onprogress?: string;
335
- /**
336
- * Script to be run just as the file begins to load before anything is actually loaded
337
- */
338
- onloadstart?: string;
339
- }
340
- type ReferrerPolicy = '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
341
- /**
342
- * Represents the possible blocking tokens for an element.
343
- */
344
- type BlockingToken = 'render';
345
- /**
346
- * Represents the blocking attribute for an element.
347
- * The blocking attribute must have a value that is an unordered set of unique space-separated tokens,
348
- * each of which are possible blocking tokens.
349
- */
350
- interface Blocking {
351
- /**
352
- * The blocking attribute indicates that certain operations should be blocked on the fetching of an external resource.
353
- * The value is an unordered set of unique space-separated tokens, each of which are possible blocking tokens.
354
- *
355
- * @example
356
- * blocking: "render"
357
- */
358
- blocking?: BlockingToken | string;
359
- }
360
- /**
361
- * Events that fire on link elements (load/error)
362
- */
363
- type LinkHttpEvents = Pick<HttpEventAttributes, 'onload' | 'onerror'>;
364
- /**
365
- * Base properties shared by all link types
366
- */
367
- interface LinkBase extends Pick<GlobalAttributes, 'nonce' | 'id'>, Blocking, DataKeys {
368
- /**
369
- * Provides a hint of the relative priority to use when fetching a preloaded resource.
370
- *
371
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-fetchpriority
372
- */
373
- fetchpriority?: 'high' | 'low' | 'auto';
374
- /**
375
- * A string indicating which referrer to use when fetching the resource.
376
- *
377
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-referrerpolicy
378
- */
379
- referrerpolicy?: ReferrerPolicy;
380
- }
381
- /**
382
- * Stylesheet-specific link (fires events)
383
- */
384
- interface StylesheetLink extends LinkBase, LinkHttpEvents {
385
- rel: 'stylesheet';
386
- /**
387
- * This attribute specifies the URL of the linked resource.
388
- *
389
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
390
- */
391
- href: string;
392
- /**
393
- * This attribute specifies the media that the linked resource applies to.
394
- *
395
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-media
396
- */
397
- media?: string;
398
- /**
399
- * Contains inline metadata — a base64-encoded cryptographic hash of the resource.
400
- *
401
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-integrity
402
- */
403
- integrity?: string;
404
- /**
405
- * This enumerated attribute indicates whether CORS must be used when fetching the resource.
406
- *
407
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-crossorigin
408
- */
409
- crossorigin?: '' | 'anonymous' | 'use-credentials';
410
- /**
411
- * The title attribute has special semantics on the `<link>` element.
412
- * When used on a `<link rel="stylesheet">` it defines a default or an alternate stylesheet.
413
- *
414
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-title
415
- */
416
- title?: string;
417
- /**
418
- * This attribute is used to define the type of the content linked to.
419
- * It can be omitted; `text/css` is assumed.
420
- *
421
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-type
422
- */
423
- type?: 'text/css' | (string & Record<never, never>);
424
- /**
425
- * Whether the stylesheet is disabled.
426
- */
427
- disabled?: boolean;
428
- }
429
- /**
430
- * Base for preload links (fires events)
431
- */
432
- interface PreloadLinkBase extends LinkBase, LinkHttpEvents {
433
- rel: 'preload';
434
- /**
435
- * This attribute specifies the URL of the linked resource.
436
- *
437
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
438
- */
439
- href: string;
440
- /**
441
- * This enumerated attribute indicates whether CORS must be used when fetching the resource.
442
- *
443
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-crossorigin
444
- */
445
- crossorigin?: '' | 'anonymous' | 'use-credentials';
446
- /**
447
- * Contains inline metadata — a base64-encoded cryptographic hash of the resource.
448
- *
449
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-integrity
450
- */
451
- integrity?: string;
452
- /**
453
- * This attribute specifies the media that the linked resource applies to.
454
- *
455
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-media
456
- */
457
- media?: string;
458
- }
459
- /**
460
- * Base fields for image preload links.
461
- */
462
- interface PreloadImageLinkFields extends Omit<PreloadLinkBase, 'href'> {
463
- as: 'image';
464
- /**
465
- * This attribute specifies the URL of the linked resource.
466
- * Optional for image preloads when using imagesrcset instead.
467
- *
468
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
469
- */
470
- href?: string;
471
- type?: 'image/webp' | 'image/avif' | 'image/png' | 'image/jpeg' | 'image/gif' | 'image/svg+xml' | (string & Record<never, never>);
472
- /**
473
- * For rel="preload" and as="image" only, the imagesizes attribute indicates
474
- * to preload the appropriate resource used by an img element.
475
- *
476
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-imagesizes
477
- */
478
- imagesizes?: string;
479
- /**
480
- * For rel="preload" and as="image" only, the imagesrcset attribute indicates
481
- * to preload the appropriate resource used by an img element.
482
- *
483
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-imagesrcset
484
- */
485
- imagesrcset?: string;
486
- }
487
- /**
488
- * Preload: image (has imagesrcset/imagesizes).
489
- * Requires at least one of `href` or `imagesrcset`.
490
- */
491
- type PreloadImageLink = (PreloadImageLinkFields & {
492
- href: string;
493
- }) | (PreloadImageLinkFields & {
494
- imagesrcset: string;
495
- });
496
- /**
497
- * Preload: font
498
- */
499
- interface PreloadFontLink extends PreloadLinkBase {
500
- as: 'font';
501
- type?: 'font/woff2' | 'font/woff' | 'font/ttf' | 'font/otf' | (string & Record<never, never>);
502
- /**
503
- * For fonts, crossorigin is required for CORS.
504
- *
505
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-crossorigin
506
- */
507
- crossorigin: '' | 'anonymous' | 'use-credentials';
508
- }
509
- /**
510
- * Preload: script
511
- */
512
- interface PreloadScriptLink extends PreloadLinkBase {
513
- as: 'script';
514
- type?: 'text/javascript' | 'module' | (string & Record<never, never>);
515
- }
516
- /**
517
- * Preload: style
518
- */
519
- interface PreloadStyleLink extends PreloadLinkBase {
520
- as: 'style';
521
- type?: 'text/css' | (string & Record<never, never>);
522
- }
523
- /**
524
- * Preload: other types
525
- */
526
- interface PreloadOtherLink extends PreloadLinkBase {
527
- as: 'audio' | 'document' | 'embed' | 'fetch' | 'object' | 'track' | 'video' | 'worker';
528
- type?: string;
529
- }
530
- /**
531
- * Combined preload union
532
- */
533
- type PreloadLink = PreloadImageLink | PreloadFontLink | PreloadScriptLink | PreloadStyleLink | PreloadOtherLink;
534
- /**
535
- * Modulepreload-specific link (fires events)
536
- */
537
- interface ModulepreloadLink extends LinkBase, LinkHttpEvents {
538
- rel: 'modulepreload';
539
- /**
540
- * This attribute specifies the URL of the linked resource.
541
- *
542
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
543
- */
544
- href: string;
545
- /**
546
- * Contains inline metadata — a base64-encoded cryptographic hash of the resource.
547
- *
548
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-integrity
549
- */
550
- integrity?: string;
551
- /**
552
- * This enumerated attribute indicates whether CORS must be used when fetching the resource.
553
- *
554
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-crossorigin
555
- */
556
- crossorigin?: '' | 'anonymous' | 'use-credentials';
557
- }
558
- /**
559
- * Prefetch-specific link
560
- */
561
- interface PrefetchLink extends LinkBase {
562
- rel: 'prefetch';
563
- /**
564
- * This attribute specifies the URL of the linked resource.
565
- *
566
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
567
- */
568
- href: string;
569
- /**
570
- * This attribute is used when rel="prefetch" to specify the type of content being loaded.
571
- *
572
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
573
- */
574
- as?: 'audio' | 'document' | 'embed' | 'fetch' | 'font' | 'image' | 'object' | 'script' | 'style' | 'track' | 'video' | 'worker';
575
- /**
576
- * This enumerated attribute indicates whether CORS must be used when fetching the resource.
577
- *
578
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-crossorigin
579
- */
580
- crossorigin?: '' | 'anonymous' | 'use-credentials';
581
- }
582
- /**
583
- * Icon links may be scoped to a media query, most commonly to serve
584
- * separate light and dark variants.
585
- */
586
- interface IconLinkBase extends LinkBase {
587
- /**
588
- * This attribute specifies the media that the linked resource applies to,
589
- * for example `(prefers-color-scheme: dark)`.
590
- *
591
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-media
592
- */
593
- media?: string;
594
- /**
595
- * This enumerated attribute indicates whether CORS must be used when fetching the resource.
596
- *
597
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-crossorigin
598
- */
599
- crossorigin?: '' | 'anonymous' | 'use-credentials';
600
- }
601
- /**
602
- * Favicon link.
603
- *
604
- * Prefer `rel: 'icon'` over `'shortcut icon'` — the `shortcut` keyword is non-standard
605
- * and was only used by older versions of Internet Explorer.
606
- */
607
- interface FaviconLink extends IconLinkBase {
608
- rel: 'icon' | 'shortcut icon';
609
- /**
610
- * This attribute specifies the URL of the linked resource.
611
- *
612
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
613
- */
614
- href: string;
615
- /**
616
- * This attribute defines the sizes of the icons for visual media contained in the resource.
617
- *
618
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-sizes
619
- */
620
- sizes?: 'any' | '16x16' | '32x32' | '48x48' | '64x64' | '96x96' | '128x128' | '192x192' | '512x512' | (string & Record<never, never>);
621
- /**
622
- * This attribute is used to define the type of the content linked to.
623
- *
624
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-type
625
- */
626
- type?: 'image/png' | 'image/svg+xml' | 'image/x-icon' | 'image/gif' | 'image/webp' | (string & Record<never, never>);
627
- }
628
- /**
629
- * Apple touch icon link
630
- */
631
- interface AppleTouchIconLink extends IconLinkBase {
632
- rel: 'apple-touch-icon';
633
- /**
634
- * This attribute specifies the URL of the linked resource.
635
- *
636
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
637
- */
638
- href: string;
639
- /**
640
- * This attribute defines the sizes of the icons for visual media contained in the resource.
641
- *
642
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-sizes
643
- */
644
- sizes?: '180x180' | '152x152' | '120x120' | '76x76' | (string & Record<never, never>);
645
- /**
646
- * This attribute is used to define the type of the content linked to.
647
- *
648
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-type
649
- */
650
- type?: 'image/png' | (string & Record<never, never>);
651
- }
652
- /**
653
- * Mask icon link (Safari pinned tab). Requires `color`.
654
- *
655
- * @see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/pinnedTabs/pinnedTabs.html
656
- */
657
- interface MaskIconLink extends IconLinkBase {
658
- rel: 'mask-icon';
659
- /**
660
- * This attribute specifies the URL of the linked resource.
661
- *
662
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
663
- */
664
- href: string;
665
- /**
666
- * The color for the mask icon. Required per spec.
667
- *
668
- * @see https://html.spec.whatwg.org/multipage/semantics.html#attr-link-color
669
- */
670
- color: string;
671
- }
672
- /**
673
- * Manifest link
674
- */
675
- interface ManifestLink extends LinkBase {
676
- rel: 'manifest';
677
- /**
678
- * This attribute specifies the URL of the linked resource.
679
- *
680
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
681
- */
682
- href: string;
683
- /**
684
- * This attribute is used to define the type of the content linked to.
685
- *
686
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-type
687
- */
688
- type?: 'application/manifest+json' | (string & Record<never, never>);
689
- /**
690
- * This enumerated attribute indicates whether CORS must be used when fetching the resource.
691
- *
692
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-crossorigin
693
- */
694
- crossorigin?: '' | 'anonymous' | 'use-credentials';
695
- }
696
- /**
697
- * Canonical link
698
- */
699
- interface CanonicalLink extends LinkBase {
700
- rel: 'canonical';
701
- /**
702
- * This attribute specifies the URL of the linked resource.
703
- *
704
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
705
- */
706
- href: string;
707
- }
708
- /**
709
- * DNS-prefetch link (no events, minimal props)
710
- */
711
- interface DnsPrefetchLink extends LinkBase {
712
- rel: 'dns-prefetch';
713
- /**
714
- * This attribute specifies the URL of the linked resource.
715
- *
716
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
717
- */
718
- href: string;
719
- }
720
- /**
721
- * Preconnect link (no events)
722
- */
723
- interface PreconnectLink extends LinkBase {
724
- rel: 'preconnect';
725
- /**
726
- * This attribute specifies the URL of the linked resource.
727
- *
728
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
729
- */
730
- href: string;
731
- /**
732
- * This enumerated attribute indicates whether CORS must be used when fetching the resource.
733
- *
734
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-crossorigin
735
- */
736
- crossorigin?: '' | 'anonymous' | 'use-credentials';
737
- }
738
- /**
739
- * Prerender link
740
- */
741
- interface PrerenderLink extends LinkBase {
742
- rel: 'prerender';
743
- /**
744
- * This attribute specifies the URL of the linked resource.
745
- *
746
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
747
- */
748
- href: string;
749
- }
750
- /**
751
- * Alternate language link (hreflang translations)
752
- */
753
- interface AlternateLanguageLink extends LinkBase {
754
- rel: 'alternate';
755
- /**
756
- * This attribute specifies the URL of the linked resource.
757
- *
758
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
759
- */
760
- href: string;
761
- /**
762
- * This attribute indicates the language of the linked resource.
763
- *
764
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-hreflang
765
- */
766
- hreflang: 'x-default' | 'en' | 'en-US' | 'en-GB' | 'de' | 'fr' | 'es' | 'it' | 'ja' | 'ko' | 'nl' | 'pl' | 'pt' | 'pt-BR' | 'ru' | 'zh' | 'zh-CN' | 'zh-TW' | 'ar' | 'hi' | 'id' | 'th' | 'tr' | 'uk' | 'vi' | (string & Record<never, never>);
767
- /**
768
- * The title attribute defines the title of the link.
769
- *
770
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-title
771
- */
772
- title?: string;
773
- /**
774
- * This attribute is used to define the type of the content linked to.
775
- *
776
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-type
777
- */
778
- type?: string;
779
- /**
780
- * This attribute specifies the media that the linked resource applies to.
781
- *
782
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-media
783
- */
784
- media?: string;
785
- }
786
- /**
787
- * Alternate feed link (RSS, Atom, JSON Feed)
788
- */
789
- interface AlternateFeedLink extends LinkBase {
790
- rel: 'alternate';
791
- /**
792
- * This attribute specifies the URL of the linked resource.
793
- *
794
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
795
- */
796
- href: string;
797
- /**
798
- * This attribute is used to define the type of the content linked to.
799
- *
800
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-type
801
- */
802
- type: 'application/rss+xml' | 'application/atom+xml' | 'application/json' | (string & Record<never, never>);
803
- /**
804
- * The title attribute defines the title of the link.
805
- *
806
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-title
807
- */
808
- title?: string;
809
- /**
810
- * This attribute indicates the language of the linked resource.
811
- *
812
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-hreflang
813
- */
814
- hreflang?: 'x-default' | 'en' | 'en-US' | 'en-GB' | 'de' | 'fr' | 'es' | 'it' | 'ja' | 'ko' | 'nl' | 'pl' | 'pt' | 'pt-BR' | 'ru' | 'zh' | 'zh-CN' | 'zh-TW' | 'ar' | 'hi' | 'id' | 'th' | 'tr' | 'uk' | 'vi' | (string & Record<never, never>);
815
- }
816
- /**
817
- * Alternate media link (responsive/device-specific)
818
- */
819
- interface AlternateMediaLink extends LinkBase {
820
- rel: 'alternate';
821
- /**
822
- * This attribute specifies the URL of the linked resource.
823
- *
824
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
825
- */
826
- href: string;
827
- /**
828
- * This attribute specifies the media that the linked resource applies to.
829
- *
830
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-media
831
- */
832
- media: string;
833
- /**
834
- * The title attribute defines the title of the link.
835
- *
836
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-title
837
- */
838
- title?: string;
839
- /**
840
- * This attribute is used to define the type of the content linked to.
841
- *
842
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-type
843
- */
844
- type?: string;
845
- }
846
- /**
847
- * Bare alternate link without hreflang, type, or media.
848
- * Valid HTML, typically used as a fallback or generic alternate.
849
- */
850
- interface BareAlternateLink extends LinkBase {
851
- rel: 'alternate';
852
- /**
853
- * This attribute specifies the URL of the linked resource.
854
- *
855
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-href
856
- */
857
- href: string;
858
- }
859
- /**
860
- * Author link
861
- */
862
- interface AuthorLink extends LinkBase {
863
- rel: 'author';
864
- href: string;
865
- }
866
- /**
867
- * License link
868
- */
869
- interface LicenseLink extends LinkBase {
870
- rel: 'license';
871
- href: string;
872
- }
873
- /**
874
- * Help link
875
- */
876
- interface HelpLink extends LinkBase {
877
- rel: 'help';
878
- href: string;
879
- }
880
- /**
881
- * Search link
882
- */
883
- interface SearchLink extends LinkBase {
884
- rel: 'search';
885
- href: string;
886
- type?: 'application/opensearchdescription+xml' | (string & Record<never, never>);
887
- title?: string;
888
- }
889
- /**
890
- * Prev/Next navigation links
891
- */
892
- interface PrevLink extends LinkBase {
893
- rel: 'prev';
894
- href: string;
895
- }
896
- interface NextLink extends LinkBase {
897
- rel: 'next';
898
- href: string;
899
- }
900
- /**
901
- * Pingback link
902
- */
903
- interface PingbackLink extends LinkBase {
904
- rel: 'pingback';
905
- href: string;
906
- }
907
- /**
908
- * Me link. Identifies the resource as representing the current user
909
- * (IndieWeb / rel-me verification, Mastodon profile verification).
910
- *
911
- * @see https://html.spec.whatwg.org/multipage/links.html#link-type-me
912
- */
913
- interface MeLink extends LinkBase {
914
- rel: 'me';
915
- href: string;
916
- }
917
- /**
918
- * Privacy policy link.
919
- *
920
- * @see https://html.spec.whatwg.org/multipage/links.html#link-type-privacy-policy
921
- */
922
- interface PrivacyPolicyLink extends LinkBase {
923
- rel: 'privacy-policy';
924
- href: string;
925
- }
926
- /**
927
- * Terms of service link.
928
- *
929
- * @see https://html.spec.whatwg.org/multipage/links.html#link-type-terms-of-service
930
- */
931
- interface TermsOfServiceLink extends LinkBase {
932
- rel: 'terms-of-service';
933
- href: string;
934
- }
935
- /**
936
- * Expect link. Blocks rendering until a named element is present and ready.
937
- *
938
- * @see https://html.spec.whatwg.org/multipage/links.html#link-type-expect
939
- */
940
- interface ExpectLink extends LinkBase {
941
- rel: 'expect';
942
- href: string;
943
- blocking?: 'render';
944
- }
945
- /**
946
- * Webmention endpoint link (IndieWeb).
947
- *
948
- * @see https://www.w3.org/TR/webmention/
949
- */
950
- interface WebmentionLink extends LinkBase {
951
- rel: 'webmention';
952
- href: string;
953
- }
954
- /**
955
- * Compression dictionary link (experimental).
956
- *
957
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/link#compression-dictionary
958
- */
959
- interface CompressionDictionaryLink extends LinkBase {
960
- rel: 'compression-dictionary';
961
- href: string;
962
- }
963
- /**
964
- * Sitemap link. Points to a sitemap for the site.
965
- *
966
- * @see https://www.iana.org/assignments/link-relations/link-relations.xhtml
967
- */
968
- interface SitemapLink extends LinkBase {
969
- rel: 'sitemap';
970
- href: string;
971
- type?: 'application/xml' | (string & Record<never, never>);
972
- title?: string;
973
- }
974
- /**
975
- * Apple touch startup image link. Specifies a splash screen image for iOS
976
- * when a web app is launched from the home screen.
977
- *
978
- * @see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
979
- */
980
- interface AppleTouchStartupImageLink extends LinkBase {
981
- rel: 'apple-touch-startup-image';
982
- href: string;
983
- media?: string;
984
- }
985
- /**
986
- * AMP HTML link. Points to the AMP version of the current document.
987
- *
988
- * @see https://amp.dev/documentation/guides-and-tutorials/start/create/prepare_for_discovery/
989
- */
990
- interface AmpHtmlLink extends LinkBase {
991
- rel: 'amphtml';
992
- href: string;
993
- }
994
- /**
995
- * WebSub hub link. Points to a WebSub hub for real-time content distribution.
996
- *
997
- * @see https://www.w3.org/TR/websub/
998
- */
999
- interface HubLink extends LinkBase {
1000
- rel: 'hub';
1001
- href: string;
1002
- }
1003
- /**
1004
- * Alternate stylesheet link. User-selectable alternate stylesheet.
1005
- * Requires a `title` to appear in the browser's stylesheet picker.
1006
- *
1007
- * @see https://html.spec.whatwg.org/multipage/semantics.html#rel-alternate-stylesheet
1008
- */
1009
- interface AlternateStylesheetLink extends LinkBase, LinkHttpEvents {
1010
- rel: 'alternate stylesheet';
1011
- href: string;
1012
- title: string;
1013
- media?: string;
1014
- crossorigin?: '' | 'anonymous' | 'use-credentials';
1015
- integrity?: string;
1016
- type?: 'text/css' | (string & Record<never, never>);
1017
- disabled?: boolean;
1018
- }
1019
- /**
1020
- * Discriminated union of all link types.
1021
- *
1022
- * Each named `rel` value maps to a specific interface that enforces per-`rel` required
1023
- * attributes. For example, `rel="preload"` requires the `as` attribute (see {@link PreloadLink}),
1024
- * and `rel="mask-icon"` requires `color` (see {@link MaskIconLink}).
1025
- *
1026
- * For non-standard `rel` values not covered by {@link KnownLinkRel}, use {@link defineLink}:
1027
- * ```ts
1028
- * import { defineLink } from 'unhead'
1029
- * useHead({ link: [defineLink({ rel: 'openid2.provider', href: 'https://...' })] })
1030
- * ```
1031
- *
1032
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
1033
- */
1034
- type Link = StylesheetLink | AlternateStylesheetLink | PreloadLink | ModulepreloadLink | PrefetchLink | FaviconLink | AppleTouchIconLink | MaskIconLink | ManifestLink | CanonicalLink | DnsPrefetchLink | PreconnectLink | PrerenderLink | AlternateLanguageLink | AlternateFeedLink | AlternateMediaLink | BareAlternateLink | AuthorLink | LicenseLink | HelpLink | SearchLink | PrevLink | NextLink | PingbackLink | MeLink | WebmentionLink | PrivacyPolicyLink | TermsOfServiceLink | ExpectLink | CompressionDictionaryLink | SitemapLink | AppleTouchStartupImageLink | AmpHtmlLink | HubLink;
1035
- /**
1036
- * Known meta name values
1037
- */
1038
- type MetaNames = 'apple-itunes-app' | 'apple-mobile-web-app-capable' | 'apple-mobile-web-app-status-bar-style' | 'apple-mobile-web-app-title' | 'application-name' | 'author' | 'color-scheme' | 'creator' | 'description' | 'fb:app_id' | 'fediverse:creator' | 'format-detection' | 'generator' | 'google-site-verification' | 'google' | 'googlebot' | 'keywords' | 'mobile-web-app-capable' | 'msapplication-Config' | 'msapplication-TileColor' | 'msapplication-TileImage' | 'publisher' | 'rating' | 'referrer' | 'robots' | 'theme-color' | 'twitter:app:id:googleplay' | 'twitter:app:id:ipad' | 'twitter:app:id:iphone' | 'twitter:app:name:googleplay' | 'twitter:app:name:ipad' | 'twitter:app:name:iphone' | 'twitter:app:url:googleplay' | 'twitter:app:url:ipad' | 'twitter:app:url:iphone' | 'twitter:card' | 'twitter:creator:id' | 'twitter:creator' | 'twitter:data:1' | 'twitter:data:2' | 'twitter:description' | 'twitter:image:alt' | 'twitter:image' | 'twitter:label:1' | 'twitter:label:2' | 'twitter:player:height' | 'twitter:player:stream' | 'twitter:player:width' | 'twitter:player' | 'twitter:site:id' | 'twitter:site' | 'twitter:title' | 'viewport';
1039
- /**
1040
- * Known meta property values (OpenGraph, etc.)
1041
- */
1042
- type MetaProperties = 'article:author' | 'article:expiration_time' | 'article:modified_time' | 'article:published_time' | 'article:section' | 'article:tag' | 'book:author' | 'book:isbn' | 'book:release_date' | 'book:tag' | 'fb:app:id' | 'og:audio:secure_url' | 'og:audio:type' | 'og:audio:url' | 'og:description' | 'og:determiner' | 'og:image:height' | 'og:image:secure_url' | 'og:image:type' | 'og:image:url' | 'og:image:width' | 'og:image' | 'og:locale:alternate' | 'og:locale' | 'og:site:name' | 'og:title' | 'og:type' | 'og:url' | 'og:video:height' | 'og:video:secure_url' | 'og:video:type' | 'og:video:url' | 'og:video:width' | 'og:video' | 'payment:amount' | 'payment:currency' | 'payment:description' | 'payment:expires_at' | 'payment:id' | 'payment:status' | 'payment:success_url' | 'profile:first_name' | 'profile:gender' | 'profile:last_name' | 'profile:username';
1043
- /**
1044
- * Base properties shared by all meta types
1045
- */
1046
- interface MetaBase extends Pick<GlobalAttributes, 'id'>, DataKeys {
1047
- /**
1048
- * A valid media query list that can be included to set the media the metadata applies to.
1049
- *
1050
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color
1051
- */
1052
- media?: '(prefers-color-scheme: light)' | '(prefers-color-scheme: dark)' | (string & Record<never, never>);
1053
- }
1054
- /**
1055
- * Name-based meta (description, viewport, robots, etc.)
1056
- * Mutual exclusion: no property, no http-equiv, no charset
1057
- */
1058
- interface NameMeta extends MetaBase {
1059
- /**
1060
- * The name and content attributes can be used together to provide document metadata
1061
- * in terms of name-value pairs.
1062
- *
1063
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-name
1064
- */
1065
- 'name': MetaNames | (string & Record<never, never>);
1066
- /**
1067
- * This attribute contains the value for the name attribute.
1068
- *
1069
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-content
1070
- */
1071
- 'content': string | number;
1072
- 'property'?: never;
1073
- 'http-equiv'?: never;
1074
- 'charset'?: never;
1075
- }
1076
- /**
1077
- * Property-based meta (OpenGraph, etc.)
1078
- * Mutual exclusion: no name, no http-equiv, no charset
1079
- */
1080
- interface PropertyMeta extends MetaBase {
1081
- /**
1082
- * The property attribute is used to define a property associated with the content attribute.
1083
- * Mainly used for og and twitter meta tags.
1084
- */
1085
- 'property': MetaProperties | (string & Record<never, never>);
1086
- /**
1087
- * This attribute contains the value for the property attribute.
1088
- *
1089
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-content
1090
- */
1091
- 'content': string | number;
1092
- 'name'?: never;
1093
- 'http-equiv'?: never;
1094
- 'charset'?: never;
1095
- }
1096
- /**
1097
- * HTTP-equiv meta
1098
- * Mutual exclusion: no name, no property, no charset
1099
- */
1100
- interface HttpEquivMeta extends MetaBase {
1101
- /**
1102
- * Defines a pragma directive. The attribute is named http-equiv(alent) because all
1103
- * the allowed values are names of particular HTTP headers.
1104
- *
1105
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-http-equiv
1106
- */
1107
- 'http-equiv': 'content-security-policy' | 'content-type' | 'default-style' | 'x-ua-compatible' | 'refresh' | 'accept-ch' | 'origin-trial' | (string & Record<never, never>);
1108
- /**
1109
- * This attribute contains the value for the http-equiv attribute.
1110
- *
1111
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-content
1112
- */
1113
- 'content': string | number;
1114
- 'name'?: never;
1115
- 'property'?: never;
1116
- 'charset'?: never;
1117
- }
1118
- /**
1119
- * Charset meta (standalone, no content)
1120
- * Mutual exclusion: no name, no property, no http-equiv, no content
1121
- */
1122
- interface CharsetMeta extends MetaBase {
1123
- /**
1124
- * This attribute declares the document's character encoding.
1125
- * If the attribute is present, its value must be an ASCII case-insensitive match for the string "utf-8".
1126
- *
1127
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-charset
1128
- */
1129
- 'charset': 'utf-8' | (string & Record<never, never>);
1130
- 'name'?: never;
1131
- 'property'?: never;
1132
- 'http-equiv'?: never;
1133
- 'content'?: never;
1134
- }
1135
- /**
1136
- * Discriminated union of all meta types.
1137
- * Provides mutual exclusion of name/property/http-equiv/charset.
1138
- */
1139
- type Meta = NameMeta | PropertyMeta | HttpEquivMeta | CharsetMeta;
1140
- /**
1141
- * Content for noscript elements - either textContent or innerHTML, not both
1142
- */
1143
- type NoscriptContent = {
1144
- /**
1145
- * Sets the textContent of an element. Safer for XSS.
1146
- */
1147
- textContent?: string;
1148
- innerHTML?: never;
1149
- } | {
1150
- textContent?: never;
1151
- /**
1152
- * Text content of the tag.
1153
- *
1154
- * Warning: This is not safe for XSS. Do not use this with user input, use `textContent` instead.
1155
- */
1156
- innerHTML?: string;
1157
- };
1158
- type Noscript$1 = Pick<GlobalAttributes, 'id' | 'class' | 'style'> & NoscriptContent;
1159
- /**
1160
- * A JSON speculation rule set.
1161
- *
1162
- * @see https://html.spec.whatwg.org/multipage/speculative-loading.html#speculation-rules
1163
- */
1164
- interface SpeculationRules {
1165
- /** Identifies speculative requests through the `Sec-Speculation-Tags` header. */
1166
- tag?: string | null;
1167
- prefetch?: readonly SpeculationRule[];
1168
- prerender?: readonly SpeculationRule[];
1169
- }
1170
- type SpeculationRuleEagerness = 'immediate' | 'eager' | 'moderate' | 'conservative' | (string & Record<never, never>);
1171
- type SpeculationRuleRequirement = 'anonymous-client-ip-when-cross-origin';
1172
- interface SpeculationRuleBase {
1173
- /** A hint about when the browser should consider the speculative load. */
1174
- eagerness?: SpeculationRuleEagerness;
1175
- /** The referrer policy for the speculative request. */
1176
- referrer_policy?: ReferrerPolicy;
1177
- /** Identifies this rule through the `Sec-Speculation-Tags` header. */
1178
- tag?: string | null;
1179
- /** Required browser capabilities for executing the rule. */
1180
- requires?: readonly SpeculationRuleRequirement[];
1181
- /** Expected `No-Vary-Search` response header value. */
1182
- expects_no_vary_search?: string;
1183
- /** The browsing context in which a prerendered page is expected to open. */
1184
- target_hint?: '_blank' | '_self' | '_parent' | '_top' | (string & Record<never, never>);
1185
- }
1186
- /** An explicit list of URLs to speculate. */
1187
- type SpeculationRuleList = SpeculationRuleBase & {
1188
- source?: 'list';
1189
- urls: readonly string[];
1190
- where?: never;
1191
- /** Selects the base URL used to resolve `urls`. */
1192
- relative_to?: 'ruleset' | 'document';
1193
- };
1194
- /** A rule which selects links from the current document. */
1195
- type SpeculationRuleDocument = SpeculationRuleBase & {
1196
- urls?: never;
1197
- relative_to?: never;
1198
- } & ({
1199
- source: 'document';
1200
- where?: SpeculationRuleWhere;
1201
- } | {
1202
- source?: never;
1203
- where: SpeculationRuleWhere;
1204
- });
1205
- type SpeculationRule = SpeculationRuleList | SpeculationRuleDocument;
1206
- /** The object form accepted by `href_matches`, equivalent to `URLPatternInit`. */
1207
- interface SpeculationRuleUrlPattern {
1208
- baseURL?: string;
1209
- protocol?: string;
1210
- username?: string;
1211
- password?: string;
1212
- hostname?: string;
1213
- port?: string;
1214
- pathname?: string;
1215
- search?: string;
1216
- hash?: string;
1217
- }
1218
- type SpeculationRuleUrlPatternInput = string | SpeculationRuleUrlPattern;
1219
- /**
1220
- * A recursive document rule predicate. Exactly one predicate operator is valid
1221
- * at each level; only `href_matches` also accepts `relative_to`.
1222
- */
1223
- type SpeculationRuleWhere = {
1224
- and: readonly SpeculationRuleWhere[];
1225
- or?: never;
1226
- not?: never;
1227
- href_matches?: never;
1228
- selector_matches?: never;
1229
- relative_to?: never;
1230
- } | {
1231
- and?: never;
1232
- or: readonly SpeculationRuleWhere[];
1233
- not?: never;
1234
- href_matches?: never;
1235
- selector_matches?: never;
1236
- relative_to?: never;
1237
- } | {
1238
- and?: never;
1239
- or?: never;
1240
- not: SpeculationRuleWhere;
1241
- href_matches?: never;
1242
- selector_matches?: never;
1243
- relative_to?: never;
1244
- } | {
1245
- and?: never;
1246
- or?: never;
1247
- not?: never;
1248
- href_matches: SpeculationRuleUrlPatternInput | readonly SpeculationRuleUrlPatternInput[];
1249
- selector_matches?: never;
1250
- relative_to?: 'ruleset' | 'document';
1251
- } | {
1252
- and?: never;
1253
- or?: never;
1254
- not?: never;
1255
- href_matches?: never;
1256
- selector_matches: string | readonly string[];
1257
- relative_to?: never;
1258
- };
1259
- /**
1260
- * Events that fire on script elements (load/error)
1261
- */
1262
- type ScriptHttpEvents = Pick<HttpEventAttributes, 'onload' | 'onerror'>;
1263
- /**
1264
- * Base properties shared by all script types
1265
- */
1266
- interface ScriptBase extends Pick<GlobalAttributes, 'nonce' | 'id'>, Blocking, DataKeys {
1267
- /**
1268
- * Provides a hint of the relative priority to use when fetching an external script.
1269
- *
1270
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-fetchpriority
1271
- */
1272
- fetchpriority?: 'high' | 'low' | 'auto';
1273
- /**
1274
- * Indicates which referrer to send when fetching the script, or resources fetched by the script.
1275
- *
1276
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-referrerpolicy
1277
- */
1278
- referrerpolicy?: ReferrerPolicy;
1279
- }
1280
- /**
1281
- * Props that are invalid on non-loadable script types (data scripts, inline scripts)
1282
- */
1283
- interface NoLoadableScriptProps {
1284
- src?: never;
1285
- async?: never;
1286
- defer?: never;
1287
- integrity?: never;
1288
- crossorigin?: never;
1289
- nomodule?: never;
1290
- }
1291
- /**
1292
- * Content for data scripts — requires exactly one of `textContent` or
1293
- * `innerHTML`. Data scripts (JSON-LD, speculation rules, application/json) must
1294
- * carry inline content; an empty payload is invalid.
1295
- */
1296
- type DataScriptTextContent<T = string | Record<string, unknown>> = {
1297
- /**
1298
- * Sets the textContent of an element. Safer for XSS.
1299
- * Can be a string or an object that will be serialized to JSON.
1300
- */
1301
- textContent: T;
1302
- innerHTML?: never;
1303
- } | {
1304
- textContent?: never;
1305
- /**
1306
- * Sets the innerHTML of an element.
1307
- * Can be a string or an object that will be serialized to JSON.
1308
- */
1309
- innerHTML: T;
1310
- };
1311
- /**
1312
- * External JavaScript (fires events)
1313
- */
1314
- interface ExternalScript extends ScriptBase, ScriptHttpEvents {
1315
- /**
1316
- * This attribute specifies the URI of an external script.
1317
- *
1318
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-src
1319
- */
1320
- src: string;
1321
- /**
1322
- * This attribute indicates the type of script represented.
1323
- *
1324
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-type
1325
- */
1326
- type?: '' | 'text/javascript';
1327
- /**
1328
- * For classic scripts, if the async attribute is present,
1329
- * then the classic script will be fetched in parallel to parsing and evaluated as soon as it is available.
1330
- *
1331
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-async
1332
- */
1333
- async?: Booleanable;
1334
- /**
1335
- * This Boolean attribute is set to indicate to a browser that the script is meant to be executed after the document
1336
- * has been parsed, but before firing DOMContentLoaded.
1337
- *
1338
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-defer
1339
- */
1340
- defer?: Booleanable;
1341
- /**
1342
- * Normal script elements pass minimal information to the window.onerror
1343
- * for scripts which do not pass the standard CORS checks.
1344
- *
1345
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-crossorigin
1346
- */
1347
- crossorigin?: '' | 'anonymous' | 'use-credentials';
1348
- /**
1349
- * This attribute contains inline metadata that a user agent can use to verify
1350
- * that a fetched resource has been delivered free of unexpected manipulation.
1351
- *
1352
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-integrity
1353
- */
1354
- integrity?: string;
1355
- /**
1356
- * This Boolean attribute is set to indicate that the script should not be executed in browsers
1357
- * that support ES modules.
1358
- *
1359
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-nomodule
1360
- */
1361
- nomodule?: Booleanable;
1362
- /** Inline content is ignored when `src` is present. */
1363
- textContent?: never;
1364
- /** Inline content is ignored when `src` is present. */
1365
- innerHTML?: never;
1366
- }
1367
- /**
1368
- * ES Module script (fires events)
1369
- */
1370
- interface ModuleScript extends ScriptBase, ScriptHttpEvents {
1371
- /**
1372
- * This attribute specifies the URI of an external script.
1373
- *
1374
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-src
1375
- */
1376
- src: string;
1377
- /**
1378
- * This attribute indicates the type of script represented.
1379
- * Required discriminant for module scripts.
1380
- *
1381
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-type
1382
- */
1383
- type: 'module';
1384
- /**
1385
- * For module scripts, if the async attribute is present then the scripts and all their dependencies
1386
- * will be executed in the defer queue.
1387
- *
1388
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-async
1389
- */
1390
- async?: Booleanable;
1391
- /**
1392
- * Normal script elements pass minimal information to the window.onerror
1393
- * for scripts which do not pass the standard CORS checks.
1394
- *
1395
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-crossorigin
1396
- */
1397
- crossorigin?: '' | 'anonymous' | 'use-credentials';
1398
- /**
1399
- * This attribute contains inline metadata that a user agent can use to verify
1400
- * that a fetched resource has been delivered free of unexpected manipulation.
1401
- *
1402
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-integrity
1403
- */
1404
- integrity?: string;
1405
- /** Inline content is ignored when `src` is present. */
1406
- textContent?: never;
1407
- /** Inline content is ignored when `src` is present. */
1408
- innerHTML?: never;
1409
- }
1410
- /**
1411
- * Inline JavaScript (no events, no src).
1412
- * Requires either `textContent` (recommended, XSS-safe) or `innerHTML`.
1413
- */
1414
- type InlineScript = ScriptBase & NoLoadableScriptProps & {
1415
- /**
1416
- * This attribute indicates the type of script represented.
1417
- *
1418
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-type
1419
- */
1420
- type?: '' | 'text/javascript';
1421
- } & ({
1422
- /** Sets the textContent of an element. Safer for XSS. */
1423
- textContent: string;
1424
- innerHTML?: never;
1425
- } | {
1426
- textContent?: never;
1427
- /**
1428
- * Sets the innerHTML of an element.
1429
- *
1430
- * Warning: not safe for XSS. Prefer `textContent` for inline scripts.
1431
- */
1432
- innerHTML: string | Record<string, unknown>;
1433
- });
1434
- /**
1435
- * Inline ES Module script (no src).
1436
- * Requires either `textContent` (recommended, XSS-safe) or `innerHTML`.
1437
- */
1438
- type InlineModuleScript = ScriptBase & NoLoadableScriptProps & {
1439
- /**
1440
- * This attribute indicates the type of script represented.
1441
- * Required discriminant for module scripts.
1442
- *
1443
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-type
1444
- */
1445
- type: 'module';
1446
- } & ({
1447
- /** Sets the textContent of an element. Safer for XSS. */
1448
- textContent: string;
1449
- innerHTML?: never;
1450
- } | {
1451
- textContent?: never;
1452
- /**
1453
- * Sets the innerHTML of an element.
1454
- *
1455
- * Warning: not safe for XSS. Prefer `textContent` for inline scripts.
1456
- */
1457
- innerHTML: string;
1458
- });
1459
- /**
1460
- * JSON-LD structured data (uses textContent for XSS safety)
1461
- * Note: For full schema.org typing, use @unhead/schema-org with useSchemaOrg()
1462
- */
1463
- type JsonLdScript = ScriptBase & NoLoadableScriptProps & DataScriptTextContent & {
1464
- /**
1465
- * This attribute indicates the type of script represented.
1466
- * Required discriminant for JSON-LD scripts.
1467
- *
1468
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-type
1469
- */
1470
- type: 'application/ld+json';
1471
- };
1472
- /**
1473
- * Speculation Rules (uses textContent for safety)
1474
- */
1475
- type SpeculationRulesScript = ScriptBase & NoLoadableScriptProps & DataScriptTextContent<string | SpeculationRules> & {
1476
- /**
1477
- * This attribute indicates the type of script represented.
1478
- * Required discriminant for speculation rules scripts.
1479
- *
1480
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-type
1481
- */
1482
- type: 'speculationrules';
1483
- };
1484
- /**
1485
- * Import map configuration
1486
- */
1487
- interface ImportMapConfig {
1488
- imports: Record<string, string>;
1489
- scopes?: Record<string, Record<string, string>>;
1490
- }
1491
- /**
1492
- * Import map. Requires either `textContent` (recommended) or `innerHTML`.
1493
- */
1494
- type ImportMapScript = ScriptBase & NoLoadableScriptProps & {
1495
- /**
1496
- * This attribute indicates the type of script represented.
1497
- * Required discriminant for import map scripts.
1498
- *
1499
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-type
1500
- */
1501
- type: 'importmap';
1502
- } & ({
1503
- /** Import map content as a string or ImportMapConfig object (auto-serialized). */
1504
- textContent: string | ImportMapConfig;
1505
- innerHTML?: never;
1506
- } | {
1507
- textContent?: never;
1508
- /** Import map content as a string or ImportMapConfig object (auto-serialized). */
1509
- innerHTML: string | ImportMapConfig;
1510
- });
1511
- /**
1512
- * Application JSON script (generic JSON data)
1513
- */
1514
- type ApplicationJsonScript = ScriptBase & NoLoadableScriptProps & DataScriptTextContent & {
1515
- /**
1516
- * This attribute indicates the type of script represented.
1517
- * Required discriminant for JSON scripts.
1518
- *
1519
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-type
1520
- */
1521
- type: 'application/json';
1522
- };
1523
- /**
1524
- * Discriminated union of all script types.
1525
- *
1526
- * Each `type` value maps to a specific interface that enforces per-type constraints.
1527
- * For example, inline scripts require `textContent` and forbid `src`/`async`/`defer`.
1528
- *
1529
- * For custom or non-standard `type` values, use {@link defineScript}:
1530
- * ```ts
1531
- * import { defineScript } from 'unhead'
1532
- * useHead({ script: [defineScript({ type: 'text/plain', textContent: '...' })] })
1533
- * ```
1534
- */
1535
- type Script = ExternalScript | ModuleScript | InlineScript | InlineModuleScript | JsonLdScript | SpeculationRulesScript | ImportMapScript | ApplicationJsonScript;
1536
- interface Style$1 extends Pick<GlobalAttributes, 'nonce' | 'id'>, Blocking {
1537
- /**
1538
- * This attribute defines which media the style should be applied to.
1539
- * Its value is a media query, which defaults to all if the attribute is missing.
1540
- *
1541
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style#attr-media
1542
- */
1543
- media?: string;
1544
- /**
1545
- * A cryptographic nonce (number used once) used to allow inline styles in a style-src Content-Security-Policy.
1546
- * The server must generate a unique nonce value each time it transmits a policy.
1547
- * It is critical to provide a nonce that cannot be guessed as bypassing a resource's policy is otherwise trivial.
1548
- *
1549
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style#attr-nonce
1550
- */
1551
- nonce?: string;
1552
- /**
1553
- * This attribute specifies alternative style sheet sets.
1554
- *
1555
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style#attr-title
1556
- */
1557
- title?: string;
1558
- }
1559
- interface TemplateParamsAugmentations {}
1560
- interface SchemaAugmentations {
1561
- title: TagPriority;
1562
- titleTemplate: TagPriority;
1563
- base: ResolvesDuplicates & TagPriority;
1564
- htmlAttrs: ResolvesDuplicates & TagPriority;
1565
- bodyAttrs: ResolvesDuplicates & TagPriority;
1566
- link: TagPriority & TagPosition & ResolvesDuplicates & ProcessesTemplateParams;
1567
- meta: TagPriority & ResolvesDuplicates & ProcessesTemplateParams;
1568
- style: TagPriority & TagPosition & StringInnerContent & ResolvesDuplicates & ProcessesTemplateParams;
1569
- script: TagPriority & TagPosition & InnerContent & ResolvesDuplicates & ProcessesTemplateParams;
1570
- noscript: TagPriority & TagPosition & StringInnerContent & ResolvesDuplicates & ProcessesTemplateParams;
1571
- }
1572
- type MaybeArray<T> = T | T[];
1573
- interface UnheadBodyAttributesWithoutEvents extends Omit<BodyAttributesWithoutEvents, 'class' | 'style'> {
1574
- /**
1575
- * The class global attribute is a space-separated list of the case-sensitive classes of the element.
1576
- *
1577
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
1578
- */
1579
- class?: MaybeArray<ResolvableValue$1<Stringable>> | Record<string, ResolvableValue$1<boolean>>;
1580
- /**
1581
- * The style attribute contains CSS styling declarations to be applied to the element.
1582
- *
1583
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/style
1584
- */
1585
- style?: MaybeArray<ResolvableValue$1<Stringable>> | Record<string, ResolvableValue$1<Stringable>>;
1586
- }
1587
- interface UnheadHtmlAttributes extends Omit<HtmlAttributes$1, 'class' | 'style'> {
1588
- /**
1589
- * The class global attribute is a space-separated list of the case-sensitive classes of the element.
1590
- *
1591
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
1592
- */
1593
- class?: MaybeArray<ResolvableValue$1<Stringable>> | Record<string, ResolvableValue$1<boolean>>;
1594
- /**
1595
- * The style attribute contains CSS styling declarations to be applied to the element.
1596
- *
1597
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/style
1598
- */
1599
- style?: MaybeArray<ResolvableValue$1<Stringable>> | Record<string, ResolvableValue$1<Stringable>>;
1600
- }
1601
- /**
1602
- * Unhead meta with support for array content values.
1603
- * Content is required (use `null` explicitly to remove a meta tag).
1604
- */
1605
- type UnheadMeta = (Omit<NameMeta, 'content'> & {
1606
- content: MaybeArray<string | number> | null;
1607
- }) | (Omit<PropertyMeta, 'content'> & {
1608
- content: MaybeArray<string | number> | null;
1609
- }) | (Omit<HttpEquivMeta, 'content'> & {
1610
- content: MaybeArray<string | number> | null;
1611
- }) | CharsetMeta;
1612
- type MaybeEventFnHandlers<T> = { [key in keyof T]?: T[key] | ((e: Event) => void); };
1613
- type ResolvableTitle$1 = ResolvableValue$1<Stringable> | ResolvableProperties$1<({
1614
- textContent: string;
1615
- } & SchemaAugmentations['title'])>;
1616
- type ResolvableTitleTemplate$1 = string | ((title?: string) => string | null) | null | ({
1617
- textContent: string | ((title?: string) => string | null);
1618
- } & SchemaAugmentations['titleTemplate']);
1619
- type ResolvableBase$1 = DistributeResolvable$1<Base$1, SchemaAugmentations['base']>;
1620
- type DistributeResolvable$1<T, Aug> = T extends any ? ResolvableProperties$1<T & Aug> : never;
1621
- type DistributeResolvableWithEvents$1<T, Aug, Events> = T extends any ? T extends Events ? ResolvableProperties$1<Omit<T, keyof Events> & Aug> & MaybeEventFnHandlers<Events> : ResolvableProperties$1<T & Aug> : never;
1622
- type ResolvableLink$1 = DistributeResolvableWithEvents$1<Link, SchemaAugmentations['link'], LinkHttpEvents>;
1623
- type ResolvableMeta$1 = DistributeResolvable$1<UnheadMeta, SchemaAugmentations['meta']>;
1624
- type ResolvableStyle$1 = ResolvableProperties$1<Style$1 & DataKeys & SchemaAugmentations['style']> | string;
1625
- type ResolvableScript$1 = DistributeResolvableWithEvents$1<Script, SchemaAugmentations['script'], ScriptHttpEvents> | string;
1626
- type ResolvableNoscript$1 = ResolvableProperties$1<Noscript$1 & DataKeys & SchemaAugmentations['noscript']> | string;
1627
- type ResolvableHtmlAttributes$1 = ResolvableProperties$1<UnheadHtmlAttributes & DataKeys & SchemaAugmentations['htmlAttrs']>;
1628
- type ResolvableBodyAttributes$1 = ResolvableProperties$1<UnheadBodyAttributesWithoutEvents & DataKeys & SchemaAugmentations['bodyAttrs']> & MaybeEventFnHandlers<BodyEvents>;
1629
- type ResolvableTemplateParams = {
1630
- separator?: '|' | '-' | '·' | string;
1631
- } & Record<string, null | string | boolean | number | Record<string, string | boolean | number>> & TemplateParamsAugmentations;
1632
- interface ResolvableHead {
1633
- /**
1634
- * The `<title>` HTML element defines the document's title that is shown in a browser's title bar or a page's tab.
1635
- * It only contains text; tags within the element are ignored.
1636
- *
1637
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
1638
- */
1639
- title?: ResolvableTitle$1;
1640
- /**
1641
- * The `<base>` HTML element specifies the base URL to use for all relative URLs in a document.
1642
- * There can be only one <base> element in a document.
1643
- *
1644
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
1645
- */
1646
- base?: ResolvableValue$1<ResolvableBase$1>;
1647
- /**
1648
- * The `<link>` HTML element specifies relationships between the current document and an external resource.
1649
- * This element is most commonly used to link to stylesheets, but is also used to establish site icons
1650
- * (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
1651
- *
1652
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
1653
- */
1654
- link?: ResolvableValue$1<ResolvableValue$1<ResolvableLink$1>[]>;
1655
- /**
1656
- * The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
1657
- *
1658
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
1659
- */
1660
- meta?: ResolvableValue$1<ResolvableValue$1<ResolvableMeta$1>[]>;
1661
- /**
1662
- * The `<style>` HTML element contains style information for a document, or part of a document.
1663
- * It contains CSS, which is applied to the contents of the document containing the `<style>` element.
1664
- *
1665
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
1666
- */
1667
- style?: ResolvableValue$1<ResolvableValue$1<(ResolvableStyle$1)>[]>;
1668
- /**
1669
- * The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
1670
- *
1671
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
1672
- */
1673
- script?: ResolvableValue$1<ResolvableValue$1<(ResolvableScript$1)>[]>;
1674
- /**
1675
- * The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
1676
- * or if scripting is currently turned off in the browser.
1677
- *
1678
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
1679
- */
1680
- noscript?: ResolvableValue$1<ResolvableValue$1<(ResolvableNoscript$1)>[]>;
1681
- /**
1682
- * Attributes for the `<html>` HTML element.
1683
- *
1684
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
1685
- */
1686
- htmlAttrs?: ResolvableValue$1<ResolvableHtmlAttributes$1>;
1687
- /**
1688
- * Attributes for the `<body>` HTML element.
1689
- *
1690
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
1691
- */
1692
- bodyAttrs?: ResolvableValue$1<ResolvableBodyAttributes$1>;
1693
- /**
1694
- * Generate the title from a template.
1695
- *
1696
- * Should include a `%s` placeholder for the title, for example `%s - My Site`.
1697
- */
1698
- titleTemplate?: ResolvableTitleTemplate$1;
1699
- /**
1700
- * Variables used to substitute in the title and meta content.
1701
- */
1702
- templateParams?: ResolvableTemplateParams;
1703
- }
1704
- interface SerializableHead {
1705
- title?: string;
1706
- titleTemplate?: string;
1707
- base?: Base$1 & DataKeys & SchemaAugmentations['base'];
1708
- templateParams?: Record<string, any>;
1709
- link?: (Link & SchemaAugmentations['link'])[];
1710
- meta?: (Meta & SchemaAugmentations['meta'])[];
1711
- style?: (Style$1 & DataKeys & SchemaAugmentations['style'])[];
1712
- script?: (Script & SchemaAugmentations['script'])[];
1713
- noscript?: (Noscript$1 & DataKeys & SchemaAugmentations['noscript'])[];
1714
- htmlAttrs?: HtmlAttributes$1 & DataKeys & SchemaAugmentations['htmlAttrs'];
1715
- bodyAttrs?: BodyAttributesWithoutEvents & DataKeys & BodyEvents & SchemaAugmentations['bodyAttrs'];
1716
- }
1717
- type RawInput<K extends keyof SerializableHead> = Required<SerializableHead>[K] extends Array<infer T> ? T : Required<SerializableHead>[K];
1718
- interface ResolvesDuplicates {
1719
- /**
1720
- * By default, tags which share the same unique key `name`, `property` are de-duped. To allow duplicates
1721
- * to be made you can provide a unique key for each entry.
1722
- */
1723
- key?: string;
1724
- /**
1725
- * The strategy to use when a duplicate tag is encountered.
1726
- *
1727
- * - `replace` - Replace the existing tag with the new tag
1728
- * - `merge` - Merge the existing tag with the new tag
1729
- *
1730
- * @default 'replace' (some tags will default to 'merge', such as htmlAttr)
1731
- */
1732
- tagDuplicateStrategy?: 'replace' | 'merge';
1733
- }
1734
- type ValidTagPositions = 'head' | 'bodyClose' | 'bodyOpen';
1735
- interface TagPosition {
1736
- /**
1737
- * Specify where to render the tag.
1738
- *
1739
- * @default 'head'
1740
- */
1741
- tagPosition?: ValidTagPositions;
1742
- }
1743
- type InnerContentVal = string | Record<string, any>;
1744
- interface InnerContent {
1745
- /**
1746
- * Text content of the tag.
1747
- *
1748
- * Warning: This is not safe for XSS. Do not use this with user input, use `textContent` instead.
1749
- */
1750
- innerHTML?: InnerContentVal;
1751
- /**
1752
- * Sets the textContent of an element. Safer for XSS.
1753
- */
1754
- textContent?: InnerContentVal;
1755
- }
1756
- /**
1757
- * String-only inner content for elements that don't support object serialization (style, noscript).
1758
- */
1759
- interface StringInnerContent {
1760
- /**
1761
- * Text content of the tag.
1762
- *
1763
- * Warning: This is not safe for XSS. Do not use this with user input, use `textContent` instead.
1764
- */
1765
- innerHTML?: string;
1766
- /**
1767
- * Sets the textContent of an element. Safer for XSS.
1768
- */
1769
- textContent?: string;
1770
- }
1771
- interface TagPriority {
1772
- /**
1773
- * The priority for rendering the tag, without this all tags are rendered as they are registered
1774
- * (besides some special tags).
1775
- *
1776
- * The following special tags have default priorities:
1777
- * -2 `<meta charset ...>`
1778
- * -1 `<base>`
1779
- * 0 `<meta http-equiv="content-security-policy" ...>`
1780
- *
1781
- * All other tags have a default priority of 10: `<meta>`, `<script>`, `<link>`, `<style>`, etc
1782
- */
1783
- tagPriority?: number | 'critical' | 'high' | 'low' | `before:${string}` | `after:${string}`;
1784
- }
1785
- type TagKey = keyof ResolvableHead | InternalTagKey;
1786
- /**
1787
- * Internal tag types used by plugins
1788
- * @internal
1789
- */
1790
- type InternalTagKey = '_flatMeta';
1791
- type TemplateParams = {
1792
- separator?: '|' | '-' | '·' | string;
1793
- } & Record<string, null | string | boolean | number | Record<string, string | boolean | number>>;
1794
- interface ProcessesTemplateParams {
1795
- processTemplateParams?: boolean;
1796
- }
1797
- interface HasTemplateParams {
1798
- templateParams?: TemplateParams;
1799
- }
1800
- interface HeadTag extends TagPriority, TagPosition, ResolvesDuplicates, HasTemplateParams {
1801
- tag: TagKey;
1802
- props: Record<string, string>;
1803
- processTemplateParams?: boolean;
1804
- innerHTML?: string;
1805
- textContent?: string;
1806
- /**
1807
- * @internal
1808
- */
1809
- _w?: number;
1810
- /**
1811
- * @internal
1812
- */
1813
- _p?: number;
1814
- /**
1815
- * Copied from the entry options: the entry came from `useHeadSafe`.
1816
- * @internal
1817
- */
1818
- _safe?: boolean;
1819
- /**
1820
- * @internal
1821
- */
1822
- _d?: string;
1823
- /**
1824
- * @internal
1825
- */
1826
- _h?: string;
1827
- /**
1828
- * Source file:line that created this tag (devtools only).
1829
- * @internal
1830
- */
1831
- _source?: string;
1832
- }
1833
- //#endregion
1834
- //#region ../../node_modules/.pnpm/unhead@3.4.2_@types+node@26.6.4_@vitejs+devtools@0.7.6_@devframes+json-render@1.2.0_@de_15009e0f764b121066881ba5914a1e8a/node_modules/unhead/dist/shared/unhead.BCbtEyRi.d.ts
1835
- type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
1836
- type BaseScriptApi = Record<symbol | string, any>;
1837
- type HasDiscriminatedParameters<T> = T extends {
1838
- (first: infer A, ...rest1: any[]): any;
1839
- (first: infer B, ...rest2: any[]): any;
1840
- } ? A extends B ? B extends A ? false : true : true : false;
1841
- type HasDifferentParameterCounts<T> = T extends {
1842
- (...args: infer A): any;
1843
- } & {
1844
- (...args: infer B): any;
1845
- } ? A['length'] extends B['length'] ? B['length'] extends A['length'] ? false : true : true : false;
1846
- type IsOverloadedFunction<T> = HasDiscriminatedParameters<T> extends true ? true : HasDifferentParameterCounts<T> extends true ? true : false;
1847
- type AsVoidFunctions<T extends BaseScriptApi> = { [K in keyof T]: T[K] extends any[] ? T[K] : T[K] extends ((...args: infer A) => any) ? IsOverloadedFunction<T[K]> extends true ? T[K] : (...args: A) => void : T[K] extends Record<any, any> ? AsVoidFunctions<T[K]> : never; };
1848
- type WarmupStrategy = false | 'preload' | 'preconnect' | 'dns-prefetch';
1849
- interface UseScriptWaitForResolve<T = unknown> {
1850
- <V extends T>(value: V): V;
1851
- <V extends T>(value: PromiseLike<V>): PromiseLike<V>;
1852
- (value: T | PromiseLike<T>): T | PromiseLike<T>;
1853
- }
1854
- type UseScriptWaitForInferredResult<T> = [T] extends [void | (() => void)] ? unknown : NonNullable<Awaited<T>>;
1855
- interface UseScriptWaitFor {
1856
- /**
1857
- * With an explicit result type, setup may use callback-style registration and
1858
- * return cleanup. Without one, `waitFor(resolve => resolve(value))` infers it.
1859
- */
1860
- <T = never, R = void>(setup: (resolve: UseScriptWaitForResolve<[T] extends [never] ? unknown : T>, reject: (reason?: unknown) => void) => R): Promise<[T] extends [never] ? UseScriptWaitForInferredResult<R> : T>;
1861
- }
1862
- interface UseScriptContextOptions {
1863
- /**
1864
- * Aborted when the script is removed or fails to load.
1865
- */
1866
- signal: AbortSignal;
1867
- /**
1868
- * Wait for an SDK-specific readiness callback. Abort rejection and returned
1869
- * cleanup are tied to the script lifecycle.
1870
- */
1871
- waitFor: UseScriptWaitFor;
1872
- }
1873
- type UseScriptResolver<T extends BaseScriptApi> = (ctx: UseScriptContextOptions) => T | PromiseLike<T | undefined | null> | undefined | null;
1874
- /**
1875
- * Register a script load trigger. A returned function is treated as cleanup;
1876
- * other return values are ignored for backwards compatibility.
1877
- */
1878
- type UseScriptTrigger = (load: () => void) => any;
1879
- interface ScriptInstance<T extends BaseScriptApi> {
1880
- proxy: AsVoidFunctions<T>;
1881
- instance?: T;
1882
- id: string;
1883
- /**
1884
- * Aborted when the script is removed or fails to load.
1885
- */
1886
- signal: AbortSignal;
1887
- status: Readonly<UseScriptStatus>;
1888
- entry?: ActiveHeadEntry<any>;
1889
- load: () => Promise<T>;
1890
- warmup: (rel: WarmupStrategy) => ActiveHeadEntry<any>;
1891
- remove: () => boolean;
1892
- setupTriggerHandler: (trigger: UseScriptOptions['trigger']) => () => void;
1893
- onLoaded: (fn: (instance: T) => void | Promise<void>, options?: EventHandlerOptions) => () => void;
1894
- onError: (fn: (err?: Error) => void | Promise<void>, options?: EventHandlerOptions) => () => void;
1895
- /**
1896
- * @internal
1897
- */
1898
- _warmupStrategy?: string;
1899
- /**
1900
- * @internal
1901
- */
1902
- _loadPromise: Promise<T | false>;
1903
- /**
1904
- * @internal
1905
- */
1906
- _warmupEl: any;
1907
- /**
1908
- * @internal
1909
- */
1910
- _triggerAbortController?: AbortController | null;
1911
- /**
1912
- * @internal
1913
- */
1914
- _triggerAbortControllers?: Set<AbortController>;
1915
- /**
1916
- * @internal
1917
- */
1918
- _triggerPromises?: Promise<void>[];
1919
- /**
1920
- * @internal
1921
- */
1922
- _setupTriggerHandler: (trigger: UseScriptOptions['trigger'], removeOnError?: boolean) => () => void;
1923
- /**
1924
- * @internal
1925
- */
1926
- _cbs: {
1927
- loaded: null | ((instance: T) => void | Promise<void>)[];
1928
- error: null | ((err?: Error) => void | Promise<void>)[];
1929
- };
1930
- }
1931
- interface EventHandlerOptions {
1932
- /**
1933
- * Used to dedupe the event, allowing you to have an event run only a single time.
1934
- */
1935
- key?: string;
1936
- }
1937
- interface UseScriptOptions<T extends BaseScriptApi = Record<string, any>> extends HeadEntryOptions {
1938
- /**
1939
- * Create a consumer-owned handle without changing the shared script lifecycle.
1940
- * Existing callers receive the cached shared script unless this is enabled.
1941
- */
1942
- scope?: boolean;
1943
- /**
1944
- * Resolve the script instance from the window. This legacy callback is always
1945
- * called without arguments. It may return the API asynchronously.
1946
- */
1947
- use?: () => T | PromiseLike<T | undefined | null> | undefined | null;
1948
- /**
1949
- * Resolve the script API with lifecycle helpers. Prefer this over `use` when
1950
- * readiness needs an abort signal or `waitFor()` callback bridge.
1951
- */
1952
- resolve?: UseScriptResolver<T>;
1953
- /**
1954
- * The trigger to load the script:
1955
- * - `undefined` | `client` - (Default) Load the script on the client when this js is loaded.
1956
- * - `manual` - Load the script manually by calling `$script.load()`, exists only on the client.
1957
- * - `Promise` - Load the script when the promise resolves, exists only on the client.
1958
- * - `Function` - Register a callback function to load the script, exists only on the client. It may return a cleanup function.
1959
- * - `server` - Have the script injected on the server.
1960
- */
1961
- trigger?: 'client' | 'server' | 'manual' | Promise<boolean | void> | UseScriptTrigger | null;
1962
- /**
1963
- * Add a preload or preconnect link tag before the script is loaded.
1964
- */
1965
- warmupStrategy?: WarmupStrategy;
1966
- /**
1967
- * Context to run events with. This is useful in Vue to attach the current instance context before
1968
- * calling the event, allowing the event to be reactive.
1969
- */
1970
- eventContext?: any;
1971
- /**
1972
- * Called before the script is initialized. Will not be triggered when the script is already loaded. This means
1973
- * this is guaranteed to be called only once, unless the script is removed and re-added.
1974
- */
1975
- beforeInit?: () => void;
1976
- }
1977
- type HookResult = Promise<void> | void;
1978
- type SyncHookResult = void;
1979
- interface SSRHeadPayload {
1980
- headTags: string;
1981
- bodyTags: string;
1982
- bodyTagsOpen: string;
1983
- htmlAttrs: string;
1984
- bodyAttrs: string;
1985
- }
1986
- interface RenderSSRHeadOptions {
1987
- omitLineBreaks?: boolean;
1988
- resolvedTags?: HeadTag[];
1989
- tagWeight?: (tag: HeadTag) => number;
1990
- }
1991
- interface EntryResolveCtx<T> {
1992
- tags: HeadTag[];
1993
- entries: HeadEntry<T>[];
1994
- }
1995
- interface DomBeforeRenderCtx extends ShouldRenderContext {
1996
- tags: HeadTag[];
1997
- }
1998
- interface ShouldRenderContext {
1999
- shouldRender: boolean;
2000
- }
2001
- interface DomRenderTagContext {
2002
- tag: HeadTag;
2003
- id: string;
2004
- $el?: Element;
2005
- shouldRender: boolean;
2006
- }
2007
- interface SSRRenderContext {
2008
- tags: HeadTag[];
2009
- html: SSRHeadPayload;
2010
- }
2011
- interface TagResolveContext {
2012
- tagMap: Map<string, HeadTag>;
2013
- tags: HeadTag[];
2014
- }
2015
- interface CoreHeadHooks {
2016
- 'entries:updated': (ctx: Unhead<any>) => HookResult;
2017
- 'entries:resolve': (ctx: EntryResolveCtx<any>) => SyncHookResult;
2018
- 'entries:normalize': (ctx: {
2019
- tags: HeadTag[];
2020
- entry: HeadEntry<any>;
2021
- }) => SyncHookResult;
2022
- 'tag:normalise': (ctx: {
2023
- tag: HeadTag;
2024
- entry: HeadEntry<any>;
2025
- resolvedOptions: CreateClientHeadOptions;
2026
- }) => SyncHookResult;
2027
- 'tags:beforeResolve': (ctx: TagResolveContext) => SyncHookResult;
2028
- 'tags:resolve': (ctx: TagResolveContext) => SyncHookResult;
2029
- 'tags:afterResolve': (ctx: TagResolveContext) => SyncHookResult;
2030
- 'script:updated': (ctx: {
2031
- script: ScriptInstance<any>;
2032
- }) => void | Promise<void>;
2033
- }
2034
- interface DOMHeadHooks {
2035
- 'dom:beforeRender': (ctx: DomBeforeRenderCtx) => SyncHookResult;
2036
- /** @deprecated Not called internally. Will be removed in v4. */
2037
- 'dom:renderTag': (ctx: DomRenderTagContext, document: Document, track: (id: string, scope: string, fn: () => void) => void) => HookResult;
2038
- /** @deprecated Will be removed in v4. DOM rendering is synchronous; run post-render logic after calling `renderDOMHead()` directly. */
2039
- 'dom:rendered': (ctx: {
2040
- renders: DomRenderTagContext[];
2041
- }) => HookResult;
2042
- }
2043
- interface SSRHeadHooks {
2044
- /**
2045
- * Fired by `renderSSRHeadSuspenseChunk` with normalized tags from entries
2046
- * pending after the shell. It runs before streamed body tags are split out.
2047
- * It also runs before the remaining patch is serialized and entries clear.
2048
- *
2049
- * The chunk renderer normally serializes entry input without normalizing
2050
- * tags. This hook supplies normalized copies for inspection. The rendered
2051
- * patch does not use these tags. Plugin-owned shapes (`_flatMeta`, the legacy
2052
- * `body` prop) are left for the listener to resolve.
2053
- *
2054
- * Synchronous: the renderer does not wait for promises before it serializes
2055
- * the patch and clears entries.
2056
- */
2057
- 'ssr:streamChunk': (ctx: {
2058
- tags: HeadTag[];
2059
- }) => SyncHookResult;
2060
- 'ssr:beforeRender': (ctx: ShouldRenderContext) => HookResult;
2061
- 'ssr:render': (ctx: {
2062
- tags: HeadTag[];
2063
- options: RenderSSRHeadOptions;
2064
- }) => HookResult;
2065
- 'ssr:rendered': (ctx: SSRRenderContext) => HookResult;
2066
- }
2067
- type ClientHeadHooks = CoreHeadHooks & DOMHeadHooks;
2068
- type ServerHeadHooks = CoreHeadHooks & SSRHeadHooks;
2069
- type HeadHooks = CoreHeadHooks & DOMHeadHooks & SSRHeadHooks;
2070
- /**
2071
- * Side effects are mapped with a key and their cleanup function.
2072
- *
2073
- * For example, `meta:data-h-4h46h465`: () => { document.querySelector('meta[data-h-4h46h465]').remove() }
2074
- */
2075
- type SideEffectsRecord = Record<string, () => void>;
2076
- interface HeadEntry<Input> {
2077
- /**
2078
- * User provided input for the entry.
2079
- */
2080
- input: Input;
2081
- options?: Omit<HeadEntryOptions, 'head' | 'onRendered'>;
2082
- /**
2083
- * Head entry index
2084
- *
2085
- * @internal
2086
- */
2087
- _i: number;
2088
- /**
2089
- * Resolved tags
2090
- *
2091
- * @internal
2092
- */
2093
- _tags?: HeadTag[];
2094
- /**
2095
- * Precomputed normalized tags shared across head instances (SSR default init
2096
- * entry). Only used when no entry hooks, tag weight overrides or entry
2097
- * options could observe or alter normalization, see `resolveTags`.
2098
- *
2099
- * @internal
2100
- */
2101
- _precomputedTags?: HeadTag[];
2102
- /**
2103
- * Pending patch to apply on next render (client-only)
2104
- * @internal
2105
- */
2106
- _pending?: Input;
2107
- /**
2108
- * @internal
2109
- */
2110
- _o?: Input;
2111
- }
2112
- interface HeadPluginOptions extends CreateHeadOptions {
2113
- hooks?: Record<string, (...args: any[]) => any>;
2114
- }
2115
- type HeadPluginInput = (HeadPluginOptions & {
2116
- key: string;
2117
- }) | (((head: Unhead) => HeadPluginOptions & {
2118
- key: string;
2119
- }) & {
2120
- key?: string;
2121
- });
2122
- type HeadPlugin = HeadPluginOptions & {
2123
- key: string;
2124
- };
2125
- /**
2126
- * An active head entry provides an API to manipulate it.
2127
- */
2128
- interface ActiveHeadEntry<Input> {
2129
- /**
2130
- * Updates the entry with new input.
2131
- *
2132
- * Will first clear any side effects for previous input.
2133
- */
2134
- patch: (input: Input) => void;
2135
- /**
2136
- * Dispose the entry, removing it from the active head.
2137
- *
2138
- * Will queue side effects for removal.
2139
- */
2140
- dispose: () => void;
2141
- /**
2142
- * @internal
2143
- */
2144
- _i: number;
2145
- }
2146
- type PropResolver = ((key?: string, value?: any, tag?: HeadTag) => any) & {
2147
- /**
2148
- * Marks the resolver as the identity function for plain non-reactive JSON
2149
- * values (strings/numbers/booleans/plain objects/arrays). When every
2150
- * configured resolver is static, the SSR default init entry can use the
2151
- * precomputed fast path (see `server/createHead.ts`).
2152
- *
2153
- * @internal
2154
- */
2155
- _static?: boolean;
2156
- };
2157
- interface CreateHeadOptions {
2158
- document?: Document;
2159
- /**
2160
- * Initial head input that should be added.
2161
- *
2162
- * Any tags here are added with low priority.
2163
- */
2164
- init?: (ResolvableHead | undefined | false)[];
2165
- /**
2166
- * Prop resolvers for tags.
2167
- */
2168
- propResolvers?: PropResolver[];
2169
- /**
2170
- * @experimental
2171
- * Key used for window attachment during streaming SSR.
2172
- * Allows multiple Unhead instances on the same page.
2173
- * @default '__unhead__'
2174
- */
2175
- experimentalStreamKey?: string;
2176
- /**
2177
- * @internal
2178
- */
2179
- _tagWeight?: (tag: HeadTag) => number;
2180
- }
2181
- interface CreateServerHeadOptions extends CreateHeadOptions {
2182
- plugins?: HeadPluginInput[];
2183
- hooks?: Partial<ServerHeadHooks>;
2184
- /**
2185
- * Custom tag weight function for controlling `<head>` tag ordering.
2186
- *
2187
- * By default, tags are sorted using CAPO weights optimised for the browser preload scanner.
2188
- * Override this to change the ordering — for example, to prioritise SEO meta tags for bot requests.
2189
- *
2190
- * @example
2191
- * ```ts
2192
- * import { capoTagWeight } from 'unhead/server'
2193
- *
2194
- * createHead({
2195
- * tagWeight(tag) {
2196
- * // Promote SEO meta above styles for bots
2197
- * if (isBot && tag.tag === 'meta' && tag.props.property?.startsWith('og:'))
2198
- * return 55 // just above styles (60)
2199
- * return capoTagWeight(tag)
2200
- * }
2201
- * })
2202
- * ```
2203
- */
2204
- tagWeight?: (tag: HeadTag) => number;
2205
- /**
2206
- * Should default important tags be skipped.
2207
- *
2208
- * Adds the following tags with low priority:
2209
- * - <html lang="en">
2210
- * - <meta charset="utf-8">
2211
- * - <meta name="viewport" content="width=device-width, initial-scale=1">
2212
- */
2213
- disableDefaults?: boolean;
2214
- /**
2215
- * Omit line breaks between rendered tags, producing a single line of output.
2216
- *
2217
- * Only removes the separators *between* tags; newlines inside inline
2218
- * `<script>`/`<style>`/JSON-LD content are preserved.
2219
- *
2220
- * @deprecated Prefer `MinifyPlugin` from `unhead/plugins`, which minifies the
2221
- * inline content itself (where the real bytes are) rather than only dropping
2222
- * separators.
2223
- */
2224
- omitLineBreaks?: boolean;
2225
- }
2226
- interface CreateClientHeadOptions extends CreateHeadOptions {
2227
- plugins?: HeadPluginInput[];
2228
- hooks?: Partial<ClientHeadHooks>;
2229
- /**
2230
- * Custom render function for DOM updates.
2231
- */
2232
- render?: (head: Unhead<any>) => boolean | void;
2233
- }
2234
- interface HeadEntryOptions extends TagPosition, TagPriority, ProcessesTemplateParams, ResolvesDuplicates {
2235
- head?: Unhead;
2236
- /**
2237
- * Called after unhead has finished applying DOM updates.
2238
- *
2239
- * Useful for synchronising external tools (e.g. analytics) with the current document head.
2240
- *
2241
- * Only called on the client — ignored during SSR.
2242
- *
2243
- * @example
2244
- * useHead({ title: 'My Page' }, {
2245
- * onRendered({ renders }) {
2246
- * amplitude.track('Page View', { title: document.title })
2247
- * }
2248
- * })
2249
- */
2250
- onRendered?: (ctx: {
2251
- renders: DomRenderTagContext[];
2252
- }) => void | Promise<void>;
2253
- /**
2254
- * @internal
2255
- */
2256
- _safe?: boolean;
2257
- /**
2258
- * @internal
2259
- */
2260
- _index?: number;
2261
- /**
2262
- * Source location for devtools tracing.
2263
- * @internal
2264
- */
2265
- _source?: string;
2266
- }
2267
- interface Unhead<Input = ResolvableHead, RenderResult = unknown> {
2268
- /**
2269
- * Render the head tags using the configured renderer.
2270
- */
2271
- render: () => RenderResult;
2272
- /**
2273
- * Registered plugins.
2274
- */
2275
- plugins: Map<string, HeadPlugin>;
2276
- /**
2277
- * The head entries.
2278
- */
2279
- entries: Map<number, HeadEntry<Input>>;
2280
- /**
2281
- * Create a new head entry.
2282
- */
2283
- push: (entry: Input, options?: HeadEntryOptions) => ActiveHeadEntry<Input>;
2284
- /**
2285
- * Exposed hooks for easier extension.
2286
- */
2287
- hooks?: HookableCore<HeadHooks>;
2288
- /**
2289
- * Resolved options
2290
- */
2291
- resolvedOptions: CreateHeadOptions;
2292
- /**
2293
- * Use a head plugin, loads the plugins hooks.
2294
- */
2295
- use: (plugin: HeadPluginInput) => void;
2296
- /**
2297
- * Is it a server-side render context.
2298
- */
2299
- ssr: boolean;
2300
- /**
2301
- * @internal
2302
- */
2303
- _entryCount: number;
2304
- /**
2305
- * Number of entry hooks included in cached normalization.
2306
- *
2307
- * @internal
2308
- */
2309
- _h: number;
2310
- /**
2311
- * @internal
2312
- */
2313
- dirty?: boolean;
2314
- /**
2315
- * Invalidate all entries and re-queue them for normalization.
2316
- * @internal
2317
- */
2318
- invalidate?: () => void;
2319
- /**
2320
- * @internal
2321
- */
2322
- _dom?: DomState;
2323
- /**
2324
- * @internal
2325
- */
2326
- _du?: boolean;
2327
- /**
2328
- * Batches client pushes into one render.
2329
- *
2330
- * @internal
2331
- */
2332
- _b?: boolean;
2333
- /**
2334
- * @internal
2335
- */
2336
- _scripts?: Record<string, any>;
2337
- /**
2338
- * @internal
2339
- */
2340
- _templateParams?: TemplateParams;
2341
- /**
2342
- * @internal
2343
- */
2344
- _separator?: string;
2345
- /**
2346
- * @internal
2347
- */
2348
- _title?: string;
2349
- /**
2350
- * @internal
2351
- */
2352
- _titleTemplate?: string;
2353
- /**
2354
- * Per-response state for shell rendering and streamed body tags.
2355
- *
2356
- * @internal
2357
- */
2358
- _stream?: {
2359
- shellRendered?: true;
2360
- bodyTags?: any[];
2361
- seen?: Set<string>;
2362
- writesBodyTags?: boolean;
2363
- nonce?: string;
2364
- };
2365
- }
2366
- interface DomState {
2367
- /**
2368
- * @internal
2369
- */
2370
- _t: string;
2371
- /**
2372
- * @internal
2373
- */
2374
- _p: SideEffectsRecord;
2375
- /**
2376
- * @internal
2377
- */
2378
- _s: SideEffectsRecord;
2379
- /**
2380
- * @internal
2381
- */
2382
- _e: Map<string, Element>;
2383
- }
2384
- //#endregion
2385
- //#region ../../node_modules/.pnpm/unhead@3.4.2_@types+node@26.6.4_@vitejs+devtools@0.7.6_@devframes+json-render@1.2.0_@de_15009e0f764b121066881ba5914a1e8a/node_modules/unhead/dist/shared/unhead.DiHEHi7R.d.ts
2386
- type Base = RawInput<'base'>;
2387
- type HtmlAttributes = RawInput<'htmlAttrs'>;
2388
- type Noscript = RawInput<'noscript'>;
2389
- type Style = RawInput<'style'>;
2390
- //#endregion
2391
- //#region ../../node_modules/.pnpm/@unhead+vue@3.4.2_@oxc-project+types@0.151.0_@types+node@26.6.4_@vitejs+devtools@0.7.6__b0e8f87cbcef34ce77ed0bd56756a679/node_modules/@unhead/vue/dist/shared/vue.B8YcFbNO.d.ts
2392
- type Falsy = false | null | undefined;
2393
- type MaybeFalsy<T> = T | Falsy;
2394
- type ResolvableValue<T> = MaybeFalsy<T> | (() => MaybeFalsy<T>) | ComputedRef<MaybeFalsy<T>> | Ref<MaybeFalsy<T>>;
2395
- type ResolvableArray<T> = ResolvableValue<ResolvableValue<T>[]>;
2396
- type Prettify<T> = { [K in keyof T]: T[K]; } & {};
2397
- type _ResolvablePropertiesRaw<T> = { [K in keyof T as {} extends Pick<T, K> ? never : K]: ResolvableValue<T[K]>; } & { [K in keyof T as {} extends Pick<T, K> ? K : never]?: ResolvableValue<T[K]>; };
2398
- type ResolvableProperties<T> = Prettify<_ResolvablePropertiesRaw<T>>;
2399
- interface HtmlAttr extends Omit<HtmlAttributes, 'class' | 'style'> {
2400
- /**
2401
- * The class global attribute is a space-separated list of the case-sensitive classes of the element.
2402
- *
2403
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
2404
- */
2405
- class?: MaybeArray<ResolvableValue<Stringable> | Record<string, ResolvableValue<boolean>>>;
2406
- /**
2407
- * The style attribute contains CSS styling declarations to be applied to the element.
2408
- *
2409
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/style
2410
- */
2411
- style?: MaybeArray<ResolvableValue<Stringable> | ResolvableProperties<CSSProperties>>;
2412
- }
2413
- interface BodyAttr extends Omit<BodyAttributesWithoutEvents, 'class' | 'style'> {
2414
- /**
2415
- * The class global attribute is a space-separated list of the case-sensitive classes of the element.
2416
- *
2417
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
2418
- */
2419
- class?: MaybeArray<ResolvableValue<Stringable> | Record<string, ResolvableValue<boolean>>>;
2420
- /**
2421
- * The style attribute contains CSS styling declarations to be applied to the element.
2422
- *
2423
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/style
2424
- */
2425
- style?: MaybeArray<ResolvableValue<Stringable> | ResolvableProperties<CSSProperties>>;
2426
- }
2427
- type ResolvableTitle = ResolvableValue<Stringable> | ResolvableProperties<({
2428
- textContent: Stringable;
2429
- } & SchemaAugmentations['title'])>;
2430
- type ResolvableTitleTemplate = ResolvableTitleTemplate$1 | Ref<string>;
2431
- type ResolvableBase = DistributeResolvable<Base, SchemaAugmentations['base']>;
2432
- type DistributeResolvable<T, Aug> = T extends any ? ResolvableProperties<T & Aug> : never;
2433
- type DistributeResolvableWithEvents<T, Aug, Events> = T extends any ? T extends Events ? ResolvableProperties<Omit<T, keyof Events> & Aug> & MaybeEventFnHandlers<Events> : ResolvableProperties<T & Aug> : never;
2434
- type ResolvableLink = DistributeResolvableWithEvents<Link, SchemaAugmentations['link'], LinkHttpEvents>;
2435
- type ResolvableMeta = DistributeResolvable<UnheadMeta, SchemaAugmentations['meta']>;
2436
- type ResolvableStyle = ResolvableProperties<Style & DataKeys & SchemaAugmentations['style']>;
2437
- type ResolvableScript = DistributeResolvableWithEvents<Script, SchemaAugmentations['script'], ScriptHttpEvents>;
2438
- type ResolvableNoscript = ResolvableProperties<Noscript & DataKeys & SchemaAugmentations['noscript']>;
2439
- type ResolvableHtmlAttributes = ResolvableProperties<HtmlAttr & DataKeys & SchemaAugmentations['htmlAttrs']>;
2440
- type ResolvableBodyAttributes = ResolvableProperties<BodyAttr & DataKeys & SchemaAugmentations['bodyAttrs']> & MaybeEventFnHandlers<BodyEvents>;
2441
- interface ReactiveHead {
2442
- /**
2443
- * The `<title>` HTML element defines the document's title that is shown in a browser's title bar or a page's tab.
2444
- * It only contains text; tags within the element are ignored.
2445
- *
2446
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
2447
- */
2448
- title?: ResolvableTitle;
2449
- /**
2450
- * Generate the title from a template.
2451
- */
2452
- titleTemplate?: ResolvableTitleTemplate;
2453
- /**
2454
- * Variables used to substitute in the title and meta content.
2455
- */
2456
- templateParams?: ResolvableProperties<ResolvableTemplateParams>;
2457
- /**
2458
- * The `<base>` HTML element specifies the base URL to use for all relative URLs in a document.
2459
- * There can be only one <base> element in a document.
2460
- *
2461
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
2462
- */
2463
- base?: ResolvableBase;
2464
- /**
2465
- * The `<link>` HTML element specifies relationships between the current document and an external resource.
2466
- * This element is most commonly used to link to stylesheets, but is also used to establish site icons
2467
- * (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
2468
- *
2469
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
2470
- */
2471
- link?: ResolvableArray<ResolvableLink>;
2472
- /**
2473
- * The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
2474
- *
2475
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
2476
- */
2477
- meta?: ResolvableArray<ResolvableMeta>;
2478
- /**
2479
- * The `<style>` HTML element contains style information for a document, or part of a document.
2480
- * It contains CSS, which is applied to the contents of the document containing the `<style>` element.
2481
- *
2482
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
2483
- */
2484
- style?: ResolvableArray<(ResolvableStyle | string)>;
2485
- /**
2486
- * The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
2487
- *
2488
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
2489
- */
2490
- script?: ResolvableArray<(ResolvableScript | string)>;
2491
- /**
2492
- * The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
2493
- * or if scripting is currently turned off in the browser.
2494
- *
2495
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
2496
- */
2497
- noscript?: ResolvableArray<(ResolvableNoscript | string)>;
2498
- /**
2499
- * Attributes for the `<html>` HTML element.
2500
- *
2501
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
2502
- */
2503
- htmlAttrs?: ResolvableHtmlAttributes;
2504
- /**
2505
- * Attributes for the `<body>` HTML element.
2506
- *
2507
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
2508
- */
2509
- bodyAttrs?: ResolvableBodyAttributes;
2510
- }
2511
- type UseHeadInput<_Deprecated = never> = ResolvableValue<ReactiveHead>;
2512
- type VueHeadClient<I = UseHeadInput, R = unknown> = Unhead<I, R> & Plugin;
2513
- //#endregion
2514
- //#region ../../node_modules/.pnpm/@unhead+vue@3.4.2_@oxc-project+types@0.151.0_@types+node@26.6.4_@vitejs+devtools@0.7.6__b0e8f87cbcef34ce77ed0bd56756a679/node_modules/@unhead/vue/dist/server.d.ts
2515
- declare function createHead(options?: Omit<CreateServerHeadOptions, 'propResolvers'>): VueHeadClient<UseHeadInput, SSRHeadPayload>;
2516
- //#endregion
2517
6
  //#region src/client.d.ts
2518
7
  /**
2519
8
  * `hydrateIslands` 的桥接版本:自动合并虚拟注册表与手动 `components`。
@@ -2524,4 +13,4 @@ export declare function hydrateIslands(options?: Omit<HydrateIslandsOptions, 'co
2524
13
  components?: Record<string, Component | (() => Promise<Component>)>;
2525
14
  }): void;
2526
15
  //#endregion
2527
- export { type UseActionReturn, type UseFormActionReturn, callAction, createHead as createServerHead, invokeServerFn, useAction, useFormAction };
16
+ export { type UseActionReturn, type UseFormActionReturn, callAction, createServerHead, invokeServerFn, useAction, useFormAction };