diff --git a/docs/.vitepress/theme/fonts/OFL.txt b/docs/.vitepress/theme/fonts/OFL.txt new file mode 100644 index 0000000..ba41e11 --- /dev/null +++ b/docs/.vitepress/theme/fonts/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2023 The Schibsted-Grotesk Project Authors (https://github.com/schibsted/schibsted-grotesk) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/docs/.vitepress/theme/fonts/schibsted-grotesk-latin.woff2 b/docs/.vitepress/theme/fonts/schibsted-grotesk-latin.woff2 new file mode 100644 index 0000000..dbca3fd Binary files /dev/null and b/docs/.vitepress/theme/fonts/schibsted-grotesk-latin.woff2 differ diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts new file mode 100644 index 0000000..44b82ea --- /dev/null +++ b/docs/.vitepress/theme/index.ts @@ -0,0 +1,7 @@ +import DefaultTheme from 'vitepress/theme' +import type { Theme } from 'vitepress' +import './style.css' + +export default { + extends: DefaultTheme, +} satisfies Theme diff --git a/docs/.vitepress/theme/landing/ClosingCta.vue b/docs/.vitepress/theme/landing/ClosingCta.vue new file mode 100644 index 0000000..945e22d --- /dev/null +++ b/docs/.vitepress/theme/landing/ClosingCta.vue @@ -0,0 +1,57 @@ + + + + + diff --git a/docs/.vitepress/theme/landing/CopyCommand.vue b/docs/.vitepress/theme/landing/CopyCommand.vue new file mode 100644 index 0000000..cf408f9 --- /dev/null +++ b/docs/.vitepress/theme/landing/CopyCommand.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/docs/.vitepress/theme/landing/Foundation.vue b/docs/.vitepress/theme/landing/Foundation.vue new file mode 100644 index 0000000..1d749c9 --- /dev/null +++ b/docs/.vitepress/theme/landing/Foundation.vue @@ -0,0 +1,126 @@ + + + diff --git a/docs/.vitepress/theme/landing/LandingHero.vue b/docs/.vitepress/theme/landing/LandingHero.vue new file mode 100644 index 0000000..c82a0a3 --- /dev/null +++ b/docs/.vitepress/theme/landing/LandingHero.vue @@ -0,0 +1,309 @@ + + + + + diff --git a/docs/.vitepress/theme/landing/NativeFeatures.vue b/docs/.vitepress/theme/landing/NativeFeatures.vue new file mode 100644 index 0000000..0dd7c1f --- /dev/null +++ b/docs/.vitepress/theme/landing/NativeFeatures.vue @@ -0,0 +1,274 @@ + + + + + diff --git a/docs/.vitepress/theme/landing/Phone.vue b/docs/.vitepress/theme/landing/Phone.vue new file mode 100644 index 0000000..313baef --- /dev/null +++ b/docs/.vitepress/theme/landing/Phone.vue @@ -0,0 +1,221 @@ + + + + + diff --git a/docs/.vitepress/theme/landing/QuickStart.vue b/docs/.vitepress/theme/landing/QuickStart.vue new file mode 100644 index 0000000..167df1f --- /dev/null +++ b/docs/.vitepress/theme/landing/QuickStart.vue @@ -0,0 +1,347 @@ + + + + + diff --git a/docs/.vitepress/theme/style.css b/docs/.vitepress/theme/style.css new file mode 100644 index 0000000..f7084b0 --- /dev/null +++ b/docs/.vitepress/theme/style.css @@ -0,0 +1,167 @@ +/* Schibsted Grotesk, SIL Open Font License 1.1 (see fonts/OFL.txt). Latin subset. */ +@font-face { + font-family: 'Schibsted Grotesk'; + font-style: normal; + font-weight: 400 900; + font-display: swap; + src: url('./fonts/schibsted-grotesk-latin.woff2') format('woff2'); +} + +/* Brand: a violet in the Inertia family. Buttons use brand-3 with white text. */ +:root { + --vp-c-brand-1: #5332c4; + --vp-c-brand-2: #5f43d6; + --vp-c-brand-3: #6b4fe0; + --vp-c-brand-soft: rgba(107, 79, 224, 0.14); +} + +.dark { + --vp-c-brand-1: #b3a4ff; + --vp-c-brand-2: #7a62ee; + --vp-c-brand-3: #6248dc; + --vp-c-brand-soft: rgba(122, 98, 238, 0.16); +} + +/* + * Home page. Two colours carry meaning across the page: + * --l-web is your Inertia app (the web side), --l-native is the phone. + */ +.landing { + --l-display: 'Schibsted Grotesk', var(--vp-font-family-base); + --l-web: var(--vp-c-brand-1); + --l-web-soft: var(--vp-c-brand-soft); + --l-native: #b45309; + --l-native-soft: rgba(217, 119, 6, 0.12); + --l-wrap: 1152px; + --l-gutter: 24px; + + overflow-x: clip; +} + +.dark .landing { + --l-native: #f5b544; + --l-native-soft: rgba(245, 181, 68, 0.12); +} + +/* The closing section has its own footer; drop the default home margin. */ +.VPHome:has(.landing) { + margin-bottom: 0 !important; +} + +@media (min-width: 640px) { + .landing { + --l-gutter: 48px; + } +} + +@media (min-width: 960px) { + .landing { + --l-gutter: 64px; + } +} + +.landing .l-section { + padding: 80px var(--l-gutter); +} + +.landing .l-section.alt { + background: var(--vp-c-bg-alt); +} + +@media (min-width: 960px) { + .landing .l-section { + padding-top: 112px; + padding-bottom: 112px; + } +} + +.landing .l-wrap { + max-width: var(--l-wrap); + margin: 0 auto; +} + +.landing .l-h2 { + font-family: var(--l-display); + font-size: clamp(30px, 4.2vw, 44px); + font-weight: 760; + line-height: 1.08; + letter-spacing: -0.025em; + color: var(--vp-c-text-1); + text-wrap: balance; +} + +.landing .l-h3 { + font-family: var(--l-display); + font-size: 22px; + font-weight: 700; + line-height: 1.25; + letter-spacing: -0.01em; + color: var(--vp-c-text-1); +} + +.landing .l-lede { + margin-top: 16px; + max-width: 58ch; + font-size: 18px; + line-height: 1.6; + color: var(--vp-c-text-2); + text-wrap: pretty; +} + +.landing .l-text { + font-size: 16px; + line-height: 1.65; + color: var(--vp-c-text-2); + text-wrap: pretty; +} + +.landing :not(pre) > code { + font-family: var(--vp-font-family-mono); + font-size: 0.875em; + padding: 0.15em 0.4em; + border-radius: 4px; + background: var(--vp-code-bg); + color: var(--vp-code-color); +} + +.landing .l-link { + display: inline-flex; + align-items: center; + gap: 6px; + font-weight: 600; + color: var(--vp-c-brand-1); + text-decoration: none; + transition: color 0.2s; +} + +.landing .l-link::after { + content: '\2192'; + transition: transform 0.2s; +} + +.landing .l-link:hover { + color: var(--vp-c-brand-2); +} + +.landing .l-link:hover::after { + transform: translateX(3px); +} + +/* Code blocks rendered from index.md inside landing components. */ +.landing .l-code div[class*='language-'] { + margin: 0; + border-radius: 0 0 10px 10px; +} + +.landing .l-code div[class*='language-'] pre { + padding: 16px 0; +} + +@media (prefers-reduced-motion: reduce) { + .landing *, + .landing *::before, + .landing *::after { + animation: none !important; + transition: none !important; + } +} diff --git a/docs/index.md b/docs/index.md index fdd3cc7..ddfc43c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,26 +1,63 @@ --- layout: home - -hero: - name: Inertia Native - text: Native navigation for Inertia.js apps - tagline: Native screens and bridge components for your Inertia.js app — iOS & Android. - actions: - - theme: brand - text: Get started - link: /guide/introduction - - theme: alt - text: Installation - link: /guide/installation - - theme: alt - text: GitHub - link: https://github.com/inertia-native/inertia-native - -features: - - title: Native navigation - details: push / pop / replace / restore, modals, forms, error screens, and pull-to-refresh — your Inertia pages become native screens. - - title: Bridge components - details: Use native UI (submit buttons, menus, …) from your web pages. - - title: Inert in the browser - details: With no native adapter connected, Inertia navigates exactly as usual. One package, both worlds. +markdownStyles: false +title: Inertia Native +titleTemplate: Your Inertia app as an iOS and Android app +description: Run your Inertia.js app inside native iOS and Android apps built on Hotwire Native. In a browser it does nothing, so your website keeps working. --- + + + +
+ + + + + +```tsx +import { createInertiaApp } from '@inertiajs/react' +import { initInertiaNative } from 'inertia-native' // [!code ++] + +initInertiaNative() // [!code ++] + +createInertiaApp({ + // ...unchanged +}) +``` + + + + + +```jsx +import { useState } from 'react' +import { BridgeButton } from '@/bridge/BridgeButton' + +function Counter() { + const [taps, setTaps] = useState(0) + const tap = () => setTaps((n) => n + 1) + + return ( + <> + + + +

Tapped {taps} times

+ + ) +} +``` + +
+ + + + + +
diff --git a/docs/public/landing/android-push.webp b/docs/public/landing/android-push.webp new file mode 100644 index 0000000..53e7e86 Binary files /dev/null and b/docs/public/landing/android-push.webp differ diff --git a/docs/public/landing/ios-modal.webp b/docs/public/landing/ios-modal.webp new file mode 100644 index 0000000..d89bd03 Binary files /dev/null and b/docs/public/landing/ios-modal.webp differ diff --git a/docs/public/landing/ios-push.webp b/docs/public/landing/ios-push.webp new file mode 100644 index 0000000..312c468 Binary files /dev/null and b/docs/public/landing/ios-push.webp differ