@luxfi/ui 5.5.4 → 5.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/commerce/ui/context.tsx +13 -16
  2. package/components/access-code-input.tsx +3 -4
  3. package/components/analytics.tsx +8 -17
  4. package/components/auth/callback.tsx +40 -0
  5. package/components/auth/login-panel.tsx +22 -50
  6. package/components/auth/login.tsx +47 -0
  7. package/components/auth/provider.tsx +34 -0
  8. package/components/auth/resume.ts +16 -0
  9. package/components/auth/widget.tsx +80 -0
  10. package/components/back-button.tsx +4 -7
  11. package/components/chat-widget.tsx +9 -11
  12. package/components/commerce/bag-button.tsx +8 -7
  13. package/components/commerce/buy-button.tsx +2 -3
  14. package/components/commerce/checkout-button.tsx +12 -10
  15. package/components/commerce/checkout-panel/cart-accordian.tsx +3 -4
  16. package/components/commerce/checkout-panel/desktop-cp.tsx +7 -8
  17. package/components/commerce/checkout-panel/index.tsx +1 -1
  18. package/components/commerce/checkout-panel/mobile-cp.tsx +5 -5
  19. package/components/commerce/checkout-panel/policy-links.tsx +7 -12
  20. package/components/commerce/checkout-panel/steps-indicator.tsx +1 -1
  21. package/components/commerce/desktop-bag-popup.tsx +1 -1
  22. package/components/commerce/drawer/micro.tsx +30 -30
  23. package/components/commerce/drawer/shell.tsx +3 -5
  24. package/components/contact-dialog/contact-form.tsx +6 -13
  25. package/components/contact-dialog/index.tsx +2 -2
  26. package/components/copyright.tsx +3 -2
  27. package/components/drawer-margin.tsx +2 -2
  28. package/components/footer.tsx +7 -8
  29. package/components/header/desktop-nav-menu.tsx +6 -6
  30. package/components/header/desktop.tsx +9 -9
  31. package/components/header/index.tsx +2 -2
  32. package/components/header/mobile-bag-drawer.tsx +1 -1
  33. package/components/header/mobile-menu-toggle-button.tsx +5 -6
  34. package/components/header/mobile-nav-menu-ai.tsx +14 -13
  35. package/components/header/mobile-nav-menu-item.tsx +12 -11
  36. package/components/header/mobile-nav-menu.tsx +19 -18
  37. package/components/header/mobile.tsx +10 -11
  38. package/components/icons/index.ts +0 -1
  39. package/components/icons/social-icon.tsx +1 -1
  40. package/components/index.ts +2 -2
  41. package/components/logo.tsx +40 -67
  42. package/components/main.tsx +3 -4
  43. package/components/mini-chart/mini-chart.tsx +2 -1
  44. package/components/security/index.tsx +55 -0
  45. package/next/font/font-desc.ts +18 -0
  46. package/next/font/fonts.ts +40 -0
  47. package/next/font/get-app-router-font-classes.ts +14 -12
  48. package/next/font/load-and-return-lux-next-fonts-on-import.ts +16 -24
  49. package/next/font/local/Zen-Variable.woff2 +0 -0
  50. package/next/font/next-font-desc.ts +18 -17
  51. package/next/head-metadata/index.tsx +7 -6
  52. package/next/head-metadata/next-metadata.ts +49 -0
  53. package/next/middleware/determine-device-mw.ts +0 -13
  54. package/package.json +15 -15
  55. package/root-layout/index.tsx +42 -29
  56. package/style/fonts/Zen-Variable.woff2 +0 -0
  57. package/style/lux-colors.css +0 -1
  58. package/style/lux-fonts.css +5 -11
  59. package/style/lux-global-non-next.css +9 -9
  60. package/style/lux-global.css +99 -15
  61. package/tsconfig.json +8 -0
  62. package/types/site-def.ts +7 -0
  63. package/components/auth/auth-listener.tsx +0 -33
  64. package/components/auth/auth-token/clear-auth-token.tsx +0 -12
  65. package/components/auth/auth-token/set-auth-token.tsx +0 -16
  66. package/components/auth/common-auth-domains.ts +0 -17
  67. package/components/auth/mobile-login-button.tsx +0 -112
  68. package/components/auth/signup-panel.tsx +0 -113
  69. package/components/icons/lux-logo.tsx +0 -10
  70. package/next/font/local/Druk-Wide-Bold.ttf +0 -0
  71. package/next/font/local/Druk-Wide-Medium.ttf +0 -0
  72. package/next/head-metadata/from-next/metadata-types.ts +0 -158
  73. package/next/head-metadata/from-next/opengraph-types.ts +0 -267
  74. package/next/head-metadata/from-next/twitter-types.ts +0 -92
  75. package/style/fonts/Druk-Wide-Bold.ttf +0 -0
  76. package/style/fonts/Druk-Wide-Medium.ttf +0 -0
  77. package/tailwind/fontFamily.tailwind.lux.ts +0 -18
  78. package/tailwind/index.ts +0 -2
  79. package/tailwind/lux-tw-fonts.ts +0 -40
  80. package/tailwind/tailwind.config.lux-preset.ts +0 -10
@@ -1,21 +1,105 @@
1
- /* Note, preflight is applied first:
2
- https://unpkg.com/tailwindcss@3.3.5/src/css/preflight.css
3
- */
4
- @import "tailwindcss/base";
5
-
6
- /* see https://stackoverflow.com/questions/69746121/using-nextjs-how-can-you-import-in-css-using-tailwind-css */
7
- /* @import "@hanzo/ui/style/hanzo-common"; */
8
- @import "lux-colors";
1
+ /* The Lux surface.
2
+ *
3
+ * No utility engine. @hanzo/ui ships the reset and the token scale (theme.css +
4
+ * styles.css, imported by name in each app's layout), so what is left here is
5
+ * what is actually Lux: the colour set, the display face, the one place Hanzo
6
+ * IAM's unskinned sign-in markup meets this surface, and a few corrections to
7
+ * third-party widgets.
8
+ *
9
+ * The Tailwind layers this used to open with — base, components, utilities —
10
+ * generated every class the chrome was written against. Removing them without
11
+ * the rest of the migration is what leaves a site rendering with browser
12
+ * defaults, so `body` states its own ground here.
13
+ */
14
+ @import "./lux-colors.css";
9
15
 
10
- @import "tailwindcss/components";
11
- @import "tailwindcss/utilities";
16
+ body {
17
+ background: var(--background);
18
+ color: var(--foreground);
19
+ min-height: 100%;
20
+ /* One column, floored at 0 so long content wraps instead of widening the
21
+ page. A row track of 1fr lets a short page still fill the viewport. */
22
+ display: grid;
23
+ grid-template-columns: minmax(0, 1fr);
24
+ grid-template-rows: 1fr;
25
+ font-family: var(--font-inter), ui-sans-serif, system-ui, sans-serif;
26
+ }
12
27
 
13
28
  div.nextjs-toast-errors-parent[data-nextjs-toast="true"] {
14
29
  display: none;
15
30
  }
16
31
 
32
+ /* Headings are Zen cut wide: the '.zen-wide' preset from @hanzo/font, fitted
33
+ against Druk Wide Bold. The preset's scaleX(1.56) is left out on purpose --
34
+ a transform does not reflow, and these land on block h1-h4 that would overrun
35
+ their container. Use the class itself where a word has room to be monumental. */
17
36
  .font-heading {
18
- @apply uppercase;
37
+ font-family: var(--font-zen-sans), var(--font-inter), sans-serif;
38
+ text-transform: uppercase;
39
+ font-variation-settings: 'wght' 845;
40
+ letter-spacing: -0.04em;
41
+ }
42
+
43
+ /* Hanzo IAM's sign-in views ship structure, not skin. This is the one place
44
+ * that markup meets the Lux surface -- colours come from lux-colors so the
45
+ * form follows the theme like everything else.
46
+ */
47
+ .hanzo-iam-card,
48
+ .hanzo-iam-form {
49
+ display: grid;
50
+ grid-template-columns: minmax(0, 1fr);
51
+ gap: 0.75rem;
52
+ width: 100%;
53
+ }
54
+
55
+ .hanzo-iam-form input {
56
+ width: 100%;
57
+ border-radius: var(--radius-sm, 0.375rem);
58
+ padding: 0.5rem 0.75rem;
59
+ font-size: var(--text-base);
60
+ background-color: var(--hz-ui-bg-1);
61
+ color: var(--hz-ui-fg-body);
62
+ border: 1px solid var(--hz-ui-bg-2);
63
+ }
64
+
65
+ .hanzo-iam-form input::placeholder {
66
+ color: var(--hz-ui-fg-3);
67
+ }
68
+
69
+ .hanzo-iam-form input:focus {
70
+ outline: none;
71
+ border-color: var(--hz-ui-fg-body);
72
+ }
73
+
74
+ .hanzo-iam-btn {
75
+ width: 100%;
76
+ border-radius: var(--radius-sm, 0.375rem);
77
+ padding: 0.5rem 0.75rem;
78
+ font-size: var(--text-base);
79
+ font-weight: 600;
80
+ cursor: pointer;
81
+ background-color: var(--hz-ui-bg-inverted);
82
+ color: var(--hz-ui-fg-inverted);
83
+ }
84
+
85
+ .hanzo-iam-btn:hover {
86
+ background-color: var(--hz-ui-bg-inverted-hover);
87
+ }
88
+
89
+ .hanzo-iam-btn:disabled {
90
+ opacity: 0.5;
91
+ cursor: default;
92
+ }
93
+
94
+ .hanzo-iam-divider {
95
+ font-size: var(--text-sm);
96
+ text-transform: uppercase;
97
+ color: var(--hz-ui-fg-3);
98
+ }
99
+
100
+ .hanzo-iam-error {
101
+ font-size: var(--text-sm);
102
+ color: hsl(0 70% 60%);
19
103
  }
20
104
 
21
105
  /* Specific style fixes for react-square-web-payments-sdk -
@@ -30,7 +114,6 @@ div.nextjs-toast-errors-parent[data-nextjs-toast="true"] {
30
114
  margin-bottom: 0 !important;
31
115
  }
32
116
 
33
-
34
117
  .element-container:hover .icon-container-nor {
35
118
  display: none;
36
119
  }
@@ -46,6 +129,7 @@ div.nextjs-toast-errors-parent[data-nextjs-toast="true"] {
46
129
  .element-container:hover .text-container {
47
130
  background: transparent;
48
131
  }
49
- .overflow-scroll::-webkit-scrollbar{
50
- display:none;
51
- }
132
+
133
+ .overflow-scroll::-webkit-scrollbar {
134
+ display: none;
135
+ }
package/tsconfig.json CHANGED
@@ -1,5 +1,13 @@
1
1
  {
2
2
  "extends": "../tsconfig.modules.base.json",
3
+ // An `.mdx` import is a React component; the bundler learns that from
4
+
5
+ // @next/mdx and the type checker does not. Shared with every app —
6
+
7
+ // referenced, not copied.
8
+
9
+ "files": ["../../mdx.d.ts"],
10
+
3
11
  "include": [
4
12
  "**/*.ts",
5
13
  "**/*.tsx", "components/commerce/_to_deprecate_checkout-widget/index.tsx_",
package/types/site-def.ts CHANGED
@@ -7,6 +7,13 @@ import type ChatbotConfig from './chatbot-config'
7
7
 
8
8
  interface SiteDef {
9
9
 
10
+ /**
11
+ * Short name of this site, which with the org names the IAM application it
12
+ * signs in as: 'quest' is the client `lux-quest` on lux.id. Required, so a
13
+ * site cannot ship a login button that belongs to no one.
14
+ */
15
+ app: string
16
+
10
17
  /** url of this site. All nav links in the system will show it in 'current' state */
11
18
  currentAs?: string
12
19
 
@@ -1,33 +0,0 @@
1
- 'use client'
2
-
3
- import { useEffect } from 'react'
4
- import { useAuth } from '@hanzo/auth/service'
5
- import { getCookie } from 'cookies-next'
6
-
7
- const AuthListener = () => {
8
- const auth = useAuth()
9
-
10
- useEffect(() => {
11
- // Sites that do not share a login origin leave this unset; without it there
12
- // is nothing to ask, so asking would only fetch the string "undefined".
13
- const loginSite = process.env.NEXT_PUBLIC_LOGIN_SITE_URL
14
- if (!loginSite) return
15
-
16
- fetch(`${loginSite}/api/auth/get-auth-token`, {
17
- method: 'GET',
18
- credentials: 'include',
19
- })
20
- .then(response => response.json())
21
- .then((data: any) => {
22
- const token = data.reqToken
23
- if (!!token) {
24
- auth.loginWithCustomToken(token)
25
- }
26
- })
27
- .catch(() => { /* no shared session available */ })
28
- }, [auth])
29
-
30
- return ( <></> )
31
- }
32
-
33
- export default AuthListener
@@ -1,12 +0,0 @@
1
- import domains from '../common-auth-domains'
2
-
3
- const ClearAuthToken = () => {
4
- return (<>
5
- {domains.map(({url}) => (
6
- /* Clear auth-token cookie across all Lux domains */
7
- <img src={`${url}/api/auth/clear-auth-token`} className='absolute hidden'/>
8
- ))}
9
- </>)
10
- }
11
-
12
- export default ClearAuthToken
@@ -1,16 +0,0 @@
1
- import domains from '../common-auth-domains'
2
-
3
- const SetAuthToken: React.FC<{
4
- authToken: string
5
- }> = ({
6
- authToken,
7
- }) => {
8
- return (<>
9
- {!!authToken && domains.map(({url}) => (
10
- /* Set auth-token cookie across all Lux domains */
11
- <img src={`${url}/api/auth/set-auth-token?token=${authToken}`} className='absolute hidden'/>
12
- ))}
13
- </>)
14
- }
15
-
16
- export default SetAuthToken
@@ -1,17 +0,0 @@
1
- const domains = [
2
- { id: 'lux.market', url: 'https://lux.market' },
3
- { id: 'lux.shop', url: 'https://lux.shop' },
4
- { id: 'lux.credit', url: 'https://lux.credit' },
5
- { id: 'lux.network', url: 'https://lux.network' },
6
- { id: 'wallet.lux.network', url: 'https://wallet.lux.network' },
7
- { id: 'safe.lux.network', url: 'https://safe.lux.network' },
8
- { id: 'lux.finance', url: 'https://lux.finance' },
9
- { id: 'lux.exchange', url: 'https://lux.exchange' },
10
- { id: 'lux.quest', url: 'https://lux.quest' },
11
- { id: 'lux.id', url: 'https://lux.id' },
12
- { id: 'lux.chat', url: 'https://lux.chat' }
13
- ]
14
-
15
- export {
16
- domains as default
17
- }
@@ -1,112 +0,0 @@
1
- 'use client'
2
- import React from "react"
3
- import { observer } from "mobx-react-lite"
4
-
5
- import {
6
- Button,
7
- LinkElement,
8
- Popover,
9
- PopoverContent,
10
- PopoverTrigger,
11
- Separator
12
- } from '@hanzo/ui/primitives'
13
-
14
- import type { LinkDef } from '@hanzo/ui/types'
15
- import { cn } from '@hanzo/ui/util'
16
-
17
- import { useAuth } from "@hanzo/auth/service"
18
-
19
- import { Ethereum } from "@hanzo/auth/icons"
20
-
21
- const MobileAuthWidget: React.FC<{
22
- noLogin?: boolean
23
- className?: string
24
- handleLogin?: () => void
25
- }> = observer(({
26
- noLogin = false,
27
- className
28
- }) => {
29
- const auth = useAuth()
30
- const handleLogin = () => {
31
- window.location.href = "https://lux.id";
32
- };
33
-
34
- if (!auth) {
35
- return null
36
- }
37
- if (!auth.loggedIn && typeof window !== 'undefined') {
38
- return (noLogin ? null : (
39
- (handleLogin) ? (
40
- <div className="flex items-center py-1 px-1 gap-1">
41
- <Button
42
- variant='primary'
43
- className='text-base font-semibold !min-w-0 self-center flex-1'
44
- onClick={handleLogin}
45
- >
46
- Sign Up
47
- </Button>
48
- <Button
49
- variant='outline'
50
- className=' text-base font-semibold !min-w-0 self-center flex-1'
51
- onClick={handleLogin}
52
- >
53
- Log In
54
- </Button>
55
- </div>
56
- ) : (
57
- // Without a login origin there is nowhere to send them, and the
58
- // link would read `undefined?redirectUrl=…` — which next/link
59
- // prefetches, so every page fetches a 404 it can never use.
60
- process.env.NEXT_PUBLIC_LOGIN_SITE_URL ? (
61
- <LinkElement
62
- def={{
63
- href: `${process.env.NEXT_PUBLIC_LOGIN_SITE_URL}?redirectUrl=${window.location.href}`,
64
- title: 'Login',
65
- variant: 'primary',
66
- newTab: false
67
- } satisfies LinkDef}
68
- className='h-8 w-fit !min-w-0'
69
- />
70
- ) : null
71
- )
72
- ))
73
- }
74
-
75
- return (
76
- <Popover>
77
- <PopoverTrigger asChild>
78
- <Button
79
- variant="outline"
80
- size='icon'
81
- className={cn('rounded-full text-muted border-2 border-muted bg-level-1 hover:bg-level-2 hover:border-foreground hover:text-foreground uppercase w-8 h-8', className)}
82
- >{auth.user?.email[0]}</Button>
83
- </PopoverTrigger>
84
- <PopoverContent className='bg-level-0'>
85
- <div className="grid gap-4">
86
- <div className="space-y-2 truncate">
87
- {auth.user?.displayName ? (
88
- <>
89
- <h4 className="font-medium leading-none truncate">{auth.user.displayName}</h4>
90
- <p className="text-sm opacity-50 truncate">{auth.user.email}</p>
91
- </>
92
- ) : (
93
- <h4 className="font-medium leading-none truncate">{auth.user?.email}</h4>
94
- )}
95
- {auth.user?.walletAddress ? (
96
- <p className="text-sm opacity-50 truncate">{auth.user.walletAddress}</p>
97
- ) : (
98
- <Button variant="outline" className='w-full flex items-center gap-2' onClick={auth.associateWallet.bind(auth)}>
99
- <Ethereum height={20} />Connect your wallet
100
- </Button>
101
- )}
102
- </div>
103
- <Separator />
104
- <Button variant="outline" onClick={auth.logout.bind(auth)}>Logout</Button>
105
- </div>
106
- </PopoverContent>
107
- </Popover>
108
- )
109
-
110
- })
111
-
112
- export default MobileAuthWidget
@@ -1,113 +0,0 @@
1
- 'use client'
2
-
3
- import Link from 'next/link'
4
- import { useRouter } from 'next/navigation'
5
-
6
- import { setCookie } from 'cookies-next'
7
-
8
- import { cn } from '@hanzo/ui/util'
9
- import { Button, Carousel, CarouselContent, CarouselItem } from '@hanzo/ui/primitives'
10
- import { LoginPanel as Login, SignupPanel as Signup } from '@hanzo/auth/components'
11
-
12
- import { LuxLogo } from '../icons'
13
- import Logo from '../logo'
14
- import { EmblaAutoplay } from '..'
15
- import { legal } from '../../site-def/footer'
16
-
17
- const SignupPanel: React.FC<{
18
- close: () => void
19
- getStartedUrl?: string
20
- redirectUrl?: string
21
- className?: string
22
- reviews: { text: string, author: string, href: string }[]
23
- setIsLogin?: React.Dispatch<React.SetStateAction<boolean>>
24
- }> = ({
25
- close,
26
- getStartedUrl = '/',
27
- redirectUrl,
28
- className = '',
29
- reviews,
30
- setIsLogin
31
- }) => {
32
- const router = useRouter()
33
-
34
- const termsOfServiceUrl = legal.find(({ title }) => title === 'Terms and Conditions')?.href || ''
35
- const privacyPolicyUrl = legal.find(({ title }) => title === 'Privacy Policy')?.href || ''
36
- const domains = ['lux.id', 'lux.credit', 'lux.market', 'lux.network', 'lux.shop', 'wallet.lux.network', 'safe.lux.network', 'lux.finance', 'lux.exchange', 'lux.quest']
37
-
38
- // TODO :aa shouldn't this happen in @hanzo/auth: components/LoginPanel ??
39
- // Otherwise, the functionality is split across modules! (and client/fw!)
40
- // (This was never my intent w the onLoginChanged callback.)
41
- const onLogin = (token: string) => {
42
- for (let i = 0; i < domains.length; i++) {
43
- setCookie('auth-token', token, {
44
- domain: domains[i],
45
- path: '/',
46
- sameSite: 'none',
47
- secure: true,
48
- httpOnly: false,
49
- expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30), // 30 days
50
- })
51
- }
52
-
53
- redirectUrl && router.push(redirectUrl)
54
- }
55
-
56
- return (
57
- <div className={cn('grid grid-cols-1 md:grid-cols-2', className)}>
58
- <div className='hidden md:flex w-full h-full bg-[radial-gradient(circle_at_24.1%_68.8%_,_rgba(15,14,14,0)_,_rgba(9,9,9,99.4))] flex-row items-end justify-end overflow-y-auto min-h-screen'>
59
- <div className='h-full w-full max-w-[750px] px-8 pt-0'>
60
- <div className='h-full w-full max-w-[550px] mx-auto flex flex-col justify-between min-h-screen py-10'>
61
- <Button
62
- variant='ghost'
63
- onClick={close}
64
- className='w-fit !min-w-0 p-2'
65
- >
66
- <Logo size='md' textClx='!cursor-pointer' variant='text-only' />
67
- </Button>
68
- <Carousel
69
- options={{ align: 'center', loop: true }}
70
- className='w-full'
71
- plugins={[EmblaAutoplay({ delay: 5000, stopOnInteraction: true })]}
72
- >
73
- <CarouselContent>
74
- {reviews.map(({ text, author, href }, index) => (
75
- <CarouselItem key={index}>
76
- <Link href={href} className='flex flex-col gap-3 cursor-pointer'>
77
- <p>“{text}“</p>
78
- <p className='text-sm'>{author}</p>
79
- </Link>
80
- </CarouselItem>
81
- ))}
82
- </CarouselContent>
83
- </Carousel>
84
- </div>
85
- </div>
86
- </div>
87
- <div className='w-full h-full bg-background flex flex-row items-center'>
88
- <div className='w-full max-w-[750px] relative flex flex-col items-center px-8 pt-0 text-center'>
89
- <div className='relative h-full w-full max-w-[400px] mx-auto flex flex-col gap-4 items-center py-10'>
90
- <Button
91
- variant='ghost'
92
- onClick={close}
93
- className='block md:hidden absolute rounded-full p-2 left-0 h-auto hover:bg-background'
94
- >
95
- <LuxLogo className='w-5 h-5' />
96
- </Button>
97
- <Signup
98
- getStartedUrl={getStartedUrl}
99
- redirectUrl={redirectUrl}
100
- className='w-full max-w-sm'
101
- termsOfServiceUrl={termsOfServiceUrl}
102
- privacyPolicyUrl={privacyPolicyUrl}
103
- onLoginChanged={onLogin}
104
- setIsLogin={setIsLogin}
105
- />
106
- </div>
107
- </div>
108
- </div>
109
- </div>
110
- )
111
- }
112
-
113
- export default SignupPanel
@@ -1,10 +0,0 @@
1
- import React from 'react'
2
- import { type LucideProps } from 'lucide-react'
3
-
4
- const LuxLogo: React.FC<LucideProps> = (props: LucideProps) => (
5
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" {...props}>
6
- <polygon points="25,46.65 50,3.35 0,3.35" fill="white" stroke='black' strokeWidth={props.strokeWidth}/>
7
- </svg>
8
- )
9
-
10
- export default LuxLogo
Binary file
@@ -1,158 +0,0 @@
1
- /**
2
- *
3
- * Metadata types
4
- *
5
- */
6
-
7
- export interface DeprecatedMetadataFields {
8
- /**
9
- * Deprecated options that have a preferred method
10
- * @deprecated Use appWebApp to configure apple-mobile-web-app-capable which provides
11
- * @see https://www.appsloveworld.com/coding/iphone/11/difference-between-apple-mobile-web-app-capable-and-apple-touch-fullscreen-ipho
12
- */
13
- 'apple-touch-fullscreen'?: never
14
-
15
- /**
16
- * Obsolete since iOS 7.
17
- * @see https://web.dev/apple-touch-icon/
18
- * @deprecated use icons.apple or instead
19
- */
20
- 'apple-touch-icon-precomposed'?: never
21
- }
22
-
23
- export type TemplateString =
24
- | DefaultTemplateString
25
- | AbsoluteTemplateString
26
- | AbsoluteString
27
- export type DefaultTemplateString = {
28
- default: string
29
- template: string
30
- }
31
- export type AbsoluteTemplateString = {
32
- absolute: string
33
- template: string | null
34
- }
35
- export type AbsoluteString = {
36
- absolute: string
37
- }
38
-
39
- export type Author = {
40
- // renders as <link rel="author"...
41
- url?: string | URL
42
- // renders as <meta name="author"...
43
- name?: string
44
- }
45
-
46
- // does not include "unsafe-URL". to use this users should
47
- // use '"unsafe-URL" as ReferrerEnum'
48
- export type ReferrerEnum =
49
- | 'no-referrer'
50
- | 'origin'
51
- | 'no-referrer-when-downgrade'
52
- | 'origin-when-cross-origin'
53
- | 'same-origin'
54
- | 'strict-origin'
55
- | 'strict-origin-when-cross-origin'
56
-
57
- export type ColorSchemeEnum =
58
- | 'normal'
59
- | 'light'
60
- | 'dark'
61
- | 'light dark'
62
- | 'dark light'
63
- | 'only light'
64
-
65
- type RobotsInfo = {
66
- // all and none will be inferred from index/follow boolean options
67
- index?: boolean
68
- follow?: boolean
69
-
70
- /** @deprecated set index to false instead */
71
- noindex?: never
72
- /** @deprecated set follow to false instead */
73
- nofollow?: never
74
-
75
- noarchive?: boolean
76
- nosnippet?: boolean
77
- noimageindex?: boolean
78
- nocache?: boolean
79
- notranslate?: boolean
80
- indexifembedded?: boolean
81
- nositelinkssearchbox?: boolean
82
- unavailable_after?: string
83
- 'max-video-preview'?: number | string
84
- 'max-image-preview'?: 'none' | 'standard' | 'large'
85
- 'max-snippet'?: number
86
- }
87
- export type Robots = RobotsInfo & {
88
- // if you want to specify an alternate robots just for google
89
- googleBot?: string | RobotsInfo
90
- }
91
-
92
- export type ResolvedRobots = {
93
- basic: string | null
94
- googleBot: string | null
95
- }
96
-
97
- export type IconURL = string | URL
98
- export type Icon = IconURL | IconDescriptor
99
- export type IconDescriptor = {
100
- url: string | URL
101
- type?: string
102
- sizes?: string
103
- color?: string
104
- /** defaults to rel="icon" unless superseded by Icons map */
105
- rel?: string
106
- media?: string
107
- /**
108
- * @see https://developer.mozilla.org/docs/Web/API/HTMLImageElement/fetchPriority
109
- */
110
- fetchPriority?: 'high' | 'low' | 'auto'
111
- }
112
-
113
- export type Icons = {
114
- /** rel="icon" */
115
- icon?: Icon | Icon[]
116
- /** rel="shortcut icon" */
117
- shortcut?: Icon | Icon[]
118
- /**
119
- * @see https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
120
- * rel="apple-touch-icon"
121
- */
122
- apple?: Icon | Icon[]
123
- /** rel inferred from descriptor, defaults to "icon" */
124
- other?: IconDescriptor | IconDescriptor[]
125
- }
126
-
127
- export type Verification = {
128
- google?: null | string | number | (string | number)[]
129
- yahoo?: null | string | number | (string | number)[]
130
- yandex?: null | string | number | (string | number)[]
131
- me?: null | string | number | (string | number)[]
132
- // if you ad-hoc additional verification
133
- other?: {
134
- [name: string]: string | number | (string | number)[]
135
- }
136
- }
137
-
138
- export type ResolvedVerification = {
139
- google?: null | (string | number)[]
140
- yahoo?: null | (string | number)[]
141
- yandex?: null | (string | number)[]
142
- me?: null | (string | number)[]
143
- other?: {
144
- [name: string]: (string | number)[]
145
- }
146
- }
147
-
148
- export type ResolvedIcons = {
149
- icon: IconDescriptor[]
150
- apple: IconDescriptor[]
151
- shortcut?: IconDescriptor[]
152
- other?: IconDescriptor[]
153
- }
154
-
155
- export type ThemeColorDescriptor = {
156
- color: string
157
- media?: string
158
- }