unhead 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +24 -68
- package/dist/index.d.ts +22 -22
- package/dist/index.mjs +24 -68
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -514,78 +514,34 @@ function useHead(input, options = {}) {
|
|
|
514
514
|
const isBrowser = IsBrowser || head.resolvedOptions?.document;
|
|
515
515
|
if (options.mode === "server" && isBrowser || options.mode === "client" && !isBrowser)
|
|
516
516
|
return;
|
|
517
|
-
head.push(input, options);
|
|
517
|
+
return head.push(input, options);
|
|
518
518
|
}
|
|
519
|
-
const useTagTitle = (title) => {
|
|
520
|
-
|
|
521
|
-
};
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
};
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
};
|
|
528
|
-
const
|
|
529
|
-
|
|
530
|
-
};
|
|
531
|
-
const useTagLink = (link) => {
|
|
532
|
-
useHead({ link: asArray(link) });
|
|
533
|
-
};
|
|
534
|
-
const useTagScript = (script) => {
|
|
535
|
-
useHead({ script: asArray(script) });
|
|
536
|
-
};
|
|
537
|
-
const useTagStyle = (style) => {
|
|
538
|
-
useHead({ style: asArray(style) });
|
|
539
|
-
};
|
|
540
|
-
const useTagNoscript = (noscript) => {
|
|
541
|
-
useHead({ noscript: asArray(noscript) });
|
|
542
|
-
};
|
|
543
|
-
const useHtmlAttrs = (attrs) => {
|
|
544
|
-
useHead({ htmlAttrs: attrs });
|
|
545
|
-
};
|
|
546
|
-
const useBodyAttrs = (attrs) => {
|
|
547
|
-
useHead({ bodyAttrs: attrs });
|
|
548
|
-
};
|
|
549
|
-
const useTitleTemplate = (titleTemplate) => {
|
|
550
|
-
useHead({ titleTemplate });
|
|
551
|
-
};
|
|
519
|
+
const useTagTitle = (title) => useHead({ title });
|
|
520
|
+
const useTagBase = (base) => useHead({ base });
|
|
521
|
+
const useTagMeta = (meta) => useHead({ meta: asArray(meta) });
|
|
522
|
+
const useTagMetaFlat = (meta) => useTagMeta(unpackMeta(meta));
|
|
523
|
+
const useTagLink = (link) => useHead({ link: asArray(link) });
|
|
524
|
+
const useTagScript = (script) => useHead({ script: asArray(script) });
|
|
525
|
+
const useTagStyle = (style) => useHead({ style: asArray(style) });
|
|
526
|
+
const useTagNoscript = (noscript) => useHead({ noscript: asArray(noscript) });
|
|
527
|
+
const useHtmlAttrs = (attrs) => useHead({ htmlAttrs: attrs });
|
|
528
|
+
const useBodyAttrs = (attrs) => useHead({ bodyAttrs: attrs });
|
|
529
|
+
const useTitleTemplate = (titleTemplate) => useHead({ titleTemplate });
|
|
552
530
|
|
|
553
531
|
function useServerHead(input, options = {}) {
|
|
554
|
-
useHead(input, { ...options, mode: "server" });
|
|
532
|
+
return useHead(input, { ...options, mode: "server" });
|
|
555
533
|
}
|
|
556
|
-
const useServerTagTitle = (title) => {
|
|
557
|
-
|
|
558
|
-
};
|
|
559
|
-
const
|
|
560
|
-
|
|
561
|
-
};
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
};
|
|
565
|
-
const
|
|
566
|
-
|
|
567
|
-
};
|
|
568
|
-
const useServerTagLink = (link) => {
|
|
569
|
-
useServerHead({ link: asArray(link) });
|
|
570
|
-
};
|
|
571
|
-
const useServerTagScript = (script) => {
|
|
572
|
-
useServerHead({ script: asArray(script) });
|
|
573
|
-
};
|
|
574
|
-
const useServerTagStyle = (style) => {
|
|
575
|
-
useServerHead({ style: asArray(style) });
|
|
576
|
-
};
|
|
577
|
-
const useServerTagNoscript = (noscript) => {
|
|
578
|
-
useServerHead({ noscript: asArray(noscript) });
|
|
579
|
-
};
|
|
580
|
-
const useServerHtmlAttrs = (attrs) => {
|
|
581
|
-
useServerHead({ htmlAttrs: attrs });
|
|
582
|
-
};
|
|
583
|
-
const useServerBodyAttrs = (attrs) => {
|
|
584
|
-
useServerHead({ bodyAttrs: attrs });
|
|
585
|
-
};
|
|
586
|
-
const useServerTitleTemplate = (titleTemplate) => {
|
|
587
|
-
useServerHead({ titleTemplate });
|
|
588
|
-
};
|
|
534
|
+
const useServerTagTitle = (title) => useServerHead({ title });
|
|
535
|
+
const useServerTagBase = (base) => useServerHead({ base });
|
|
536
|
+
const useServerTagMeta = (meta) => useServerHead({ meta: asArray(meta) });
|
|
537
|
+
const useServerTagMetaFlat = (meta) => useServerTagMeta(unpackMeta(meta));
|
|
538
|
+
const useServerTagLink = (link) => useServerHead({ link: asArray(link) });
|
|
539
|
+
const useServerTagScript = (script) => useServerHead({ script: asArray(script) });
|
|
540
|
+
const useServerTagStyle = (style) => useServerHead({ style: asArray(style) });
|
|
541
|
+
const useServerTagNoscript = (noscript) => useServerHead({ noscript: asArray(noscript) });
|
|
542
|
+
const useServerHtmlAttrs = (attrs) => useServerHead({ htmlAttrs: attrs });
|
|
543
|
+
const useServerBodyAttrs = (attrs) => useServerHead({ bodyAttrs: attrs });
|
|
544
|
+
const useServerTitleTemplate = (titleTemplate) => useServerHead({ titleTemplate });
|
|
589
545
|
|
|
590
546
|
const TagEntityBits = 10;
|
|
591
547
|
|
package/dist/index.d.ts
CHANGED
|
@@ -31,30 +31,30 @@ declare type Arrayable<T> = T | Array<T>;
|
|
|
31
31
|
declare function asArray<T>(value: Arrayable<T>): T[];
|
|
32
32
|
|
|
33
33
|
declare function useHead<T extends Head>(input: T, options?: HeadEntryOptions): ActiveHeadEntry<T> | void;
|
|
34
|
-
declare const useTagTitle: (title: Title) => void;
|
|
35
|
-
declare const useTagBase: (base: Base) => void;
|
|
36
|
-
declare const useTagMeta: (meta: Arrayable<Meta>) => void;
|
|
37
|
-
declare const useTagMetaFlat: (meta: MetaFlatInput) => void;
|
|
38
|
-
declare const useTagLink: (link: Arrayable<Link>) => void;
|
|
39
|
-
declare const useTagScript: (script: Arrayable<Script>) => void;
|
|
40
|
-
declare const useTagStyle: (style: Arrayable<Style>) => void;
|
|
41
|
-
declare const useTagNoscript: (noscript: Arrayable<Noscript>) => void;
|
|
42
|
-
declare const useHtmlAttrs: (attrs: HtmlAttributes) => void;
|
|
43
|
-
declare const useBodyAttrs: (attrs: BodyAttributes) => void;
|
|
44
|
-
declare const useTitleTemplate: (titleTemplate: TitleTemplate) => void;
|
|
34
|
+
declare const useTagTitle: (title: Title) => ActiveHeadEntry<any> | void;
|
|
35
|
+
declare const useTagBase: (base: Base) => ActiveHeadEntry<any> | void;
|
|
36
|
+
declare const useTagMeta: (meta: Arrayable<Meta>) => ActiveHeadEntry<any> | void;
|
|
37
|
+
declare const useTagMetaFlat: (meta: MetaFlatInput) => ActiveHeadEntry<any> | void;
|
|
38
|
+
declare const useTagLink: (link: Arrayable<Link>) => ActiveHeadEntry<any> | void;
|
|
39
|
+
declare const useTagScript: (script: Arrayable<Script>) => ActiveHeadEntry<any> | void;
|
|
40
|
+
declare const useTagStyle: (style: Arrayable<Style>) => ActiveHeadEntry<any> | void;
|
|
41
|
+
declare const useTagNoscript: (noscript: Arrayable<Noscript>) => ActiveHeadEntry<any> | void;
|
|
42
|
+
declare const useHtmlAttrs: (attrs: HtmlAttributes) => ActiveHeadEntry<any> | void;
|
|
43
|
+
declare const useBodyAttrs: (attrs: BodyAttributes) => ActiveHeadEntry<any> | void;
|
|
44
|
+
declare const useTitleTemplate: (titleTemplate: TitleTemplate) => ActiveHeadEntry<any> | void;
|
|
45
45
|
|
|
46
46
|
declare function useServerHead<T extends Head>(input: T, options?: HeadEntryOptions): ActiveHeadEntry<T> | void;
|
|
47
|
-
declare const useServerTagTitle: (title: Title) => void;
|
|
48
|
-
declare const useServerTagBase: (base: Base) => void;
|
|
49
|
-
declare const useServerTagMeta: (meta: Arrayable<Meta>) => void;
|
|
50
|
-
declare const useServerTagMetaFlat: (meta: MetaFlatInput) => void;
|
|
51
|
-
declare const useServerTagLink: (link: Arrayable<Link>) => void;
|
|
52
|
-
declare const useServerTagScript: (script: Arrayable<Script>) => void;
|
|
53
|
-
declare const useServerTagStyle: (style: Arrayable<Style>) => void;
|
|
54
|
-
declare const useServerTagNoscript: (noscript: Arrayable<Noscript>) => void;
|
|
55
|
-
declare const useServerHtmlAttrs: (attrs: HtmlAttributes) => void;
|
|
56
|
-
declare const useServerBodyAttrs: (attrs: BodyAttributes) => void;
|
|
57
|
-
declare const useServerTitleTemplate: (titleTemplate: TitleTemplate) => void;
|
|
47
|
+
declare const useServerTagTitle: (title: Title) => ActiveHeadEntry<any> | void;
|
|
48
|
+
declare const useServerTagBase: (base: Base) => ActiveHeadEntry<any> | void;
|
|
49
|
+
declare const useServerTagMeta: (meta: Arrayable<Meta>) => ActiveHeadEntry<any> | void;
|
|
50
|
+
declare const useServerTagMetaFlat: (meta: MetaFlatInput) => ActiveHeadEntry<any> | void;
|
|
51
|
+
declare const useServerTagLink: (link: Arrayable<Link>) => ActiveHeadEntry<any> | void;
|
|
52
|
+
declare const useServerTagScript: (script: Arrayable<Script>) => ActiveHeadEntry<any> | void;
|
|
53
|
+
declare const useServerTagStyle: (style: Arrayable<Style>) => ActiveHeadEntry<any> | void;
|
|
54
|
+
declare const useServerTagNoscript: (noscript: Arrayable<Noscript>) => ActiveHeadEntry<any> | void;
|
|
55
|
+
declare const useServerHtmlAttrs: (attrs: HtmlAttributes) => ActiveHeadEntry<any> | void;
|
|
56
|
+
declare const useServerBodyAttrs: (attrs: BodyAttributes) => ActiveHeadEntry<any> | void;
|
|
57
|
+
declare const useServerTitleTemplate: (titleTemplate: TitleTemplate) => ActiveHeadEntry<any> | void;
|
|
58
58
|
|
|
59
59
|
declare let activeHead: Unhead<any> | undefined;
|
|
60
60
|
declare const setActiveHead: <T extends Unhead<_unhead_schema.Head<_unhead_schema.SchemaAugmentations>>>(head: T | undefined) => T | undefined;
|
package/dist/index.mjs
CHANGED
|
@@ -512,78 +512,34 @@ function useHead(input, options = {}) {
|
|
|
512
512
|
const isBrowser = IsBrowser || head.resolvedOptions?.document;
|
|
513
513
|
if (options.mode === "server" && isBrowser || options.mode === "client" && !isBrowser)
|
|
514
514
|
return;
|
|
515
|
-
head.push(input, options);
|
|
515
|
+
return head.push(input, options);
|
|
516
516
|
}
|
|
517
|
-
const useTagTitle = (title) => {
|
|
518
|
-
|
|
519
|
-
};
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
};
|
|
523
|
-
const
|
|
524
|
-
|
|
525
|
-
};
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
};
|
|
529
|
-
const useTagLink = (link) => {
|
|
530
|
-
useHead({ link: asArray(link) });
|
|
531
|
-
};
|
|
532
|
-
const useTagScript = (script) => {
|
|
533
|
-
useHead({ script: asArray(script) });
|
|
534
|
-
};
|
|
535
|
-
const useTagStyle = (style) => {
|
|
536
|
-
useHead({ style: asArray(style) });
|
|
537
|
-
};
|
|
538
|
-
const useTagNoscript = (noscript) => {
|
|
539
|
-
useHead({ noscript: asArray(noscript) });
|
|
540
|
-
};
|
|
541
|
-
const useHtmlAttrs = (attrs) => {
|
|
542
|
-
useHead({ htmlAttrs: attrs });
|
|
543
|
-
};
|
|
544
|
-
const useBodyAttrs = (attrs) => {
|
|
545
|
-
useHead({ bodyAttrs: attrs });
|
|
546
|
-
};
|
|
547
|
-
const useTitleTemplate = (titleTemplate) => {
|
|
548
|
-
useHead({ titleTemplate });
|
|
549
|
-
};
|
|
517
|
+
const useTagTitle = (title) => useHead({ title });
|
|
518
|
+
const useTagBase = (base) => useHead({ base });
|
|
519
|
+
const useTagMeta = (meta) => useHead({ meta: asArray(meta) });
|
|
520
|
+
const useTagMetaFlat = (meta) => useTagMeta(unpackMeta(meta));
|
|
521
|
+
const useTagLink = (link) => useHead({ link: asArray(link) });
|
|
522
|
+
const useTagScript = (script) => useHead({ script: asArray(script) });
|
|
523
|
+
const useTagStyle = (style) => useHead({ style: asArray(style) });
|
|
524
|
+
const useTagNoscript = (noscript) => useHead({ noscript: asArray(noscript) });
|
|
525
|
+
const useHtmlAttrs = (attrs) => useHead({ htmlAttrs: attrs });
|
|
526
|
+
const useBodyAttrs = (attrs) => useHead({ bodyAttrs: attrs });
|
|
527
|
+
const useTitleTemplate = (titleTemplate) => useHead({ titleTemplate });
|
|
550
528
|
|
|
551
529
|
function useServerHead(input, options = {}) {
|
|
552
|
-
useHead(input, { ...options, mode: "server" });
|
|
530
|
+
return useHead(input, { ...options, mode: "server" });
|
|
553
531
|
}
|
|
554
|
-
const useServerTagTitle = (title) => {
|
|
555
|
-
|
|
556
|
-
};
|
|
557
|
-
const
|
|
558
|
-
|
|
559
|
-
};
|
|
560
|
-
const
|
|
561
|
-
|
|
562
|
-
};
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
};
|
|
566
|
-
const useServerTagLink = (link) => {
|
|
567
|
-
useServerHead({ link: asArray(link) });
|
|
568
|
-
};
|
|
569
|
-
const useServerTagScript = (script) => {
|
|
570
|
-
useServerHead({ script: asArray(script) });
|
|
571
|
-
};
|
|
572
|
-
const useServerTagStyle = (style) => {
|
|
573
|
-
useServerHead({ style: asArray(style) });
|
|
574
|
-
};
|
|
575
|
-
const useServerTagNoscript = (noscript) => {
|
|
576
|
-
useServerHead({ noscript: asArray(noscript) });
|
|
577
|
-
};
|
|
578
|
-
const useServerHtmlAttrs = (attrs) => {
|
|
579
|
-
useServerHead({ htmlAttrs: attrs });
|
|
580
|
-
};
|
|
581
|
-
const useServerBodyAttrs = (attrs) => {
|
|
582
|
-
useServerHead({ bodyAttrs: attrs });
|
|
583
|
-
};
|
|
584
|
-
const useServerTitleTemplate = (titleTemplate) => {
|
|
585
|
-
useServerHead({ titleTemplate });
|
|
586
|
-
};
|
|
532
|
+
const useServerTagTitle = (title) => useServerHead({ title });
|
|
533
|
+
const useServerTagBase = (base) => useServerHead({ base });
|
|
534
|
+
const useServerTagMeta = (meta) => useServerHead({ meta: asArray(meta) });
|
|
535
|
+
const useServerTagMetaFlat = (meta) => useServerTagMeta(unpackMeta(meta));
|
|
536
|
+
const useServerTagLink = (link) => useServerHead({ link: asArray(link) });
|
|
537
|
+
const useServerTagScript = (script) => useServerHead({ script: asArray(script) });
|
|
538
|
+
const useServerTagStyle = (style) => useServerHead({ style: asArray(style) });
|
|
539
|
+
const useServerTagNoscript = (noscript) => useServerHead({ noscript: asArray(noscript) });
|
|
540
|
+
const useServerHtmlAttrs = (attrs) => useServerHead({ htmlAttrs: attrs });
|
|
541
|
+
const useServerBodyAttrs = (attrs) => useServerHead({ bodyAttrs: attrs });
|
|
542
|
+
const useServerTitleTemplate = (titleTemplate) => useServerHead({ titleTemplate });
|
|
587
543
|
|
|
588
544
|
const TagEntityBits = 10;
|
|
589
545
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unhead",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.2",
|
|
5
5
|
"packageManager": "pnpm@7.14.0",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@unhead/dom": "0.6.
|
|
34
|
-
"@unhead/schema": "0.6.
|
|
33
|
+
"@unhead/dom": "0.6.2",
|
|
34
|
+
"@unhead/schema": "0.6.2",
|
|
35
35
|
"hookable": "^5.4.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|