Let's try that again
This reverts commitda0f8df4d7
. Revert "Update package.json" This reverts commit522f87c833
. Revert "removes custom document" This reverts commit00d9146895
. Revert "Remove a dep that may have been causing issues" This reverts commit69462632a5
. Revert "Update index.tsx" This reverts commitd05807bbfb
. Revert "Adds manifest" This reverts commit1c30552643
.
This commit is contained in:
parent
da0f8df4d7
commit
24e9be73cc
12 changed files with 111 additions and 141 deletions
|
@ -21,7 +21,7 @@
|
||||||
"lerna": "lerna",
|
"lerna": "lerna",
|
||||||
"start": "lerna run start:pre && lerna run start --stream --parallel",
|
"start": "lerna run start:pre && lerna run start --stream --parallel",
|
||||||
"start:www": "yarn build:packages && lerna run start --parallel & cd packages/www && yarn dev",
|
"start:www": "yarn build:packages && lerna run start --parallel & cd packages/www && yarn dev",
|
||||||
"build": "cd packages/www && yarn build",
|
"build": "yarn build:packages && cd packages/www && yarn build",
|
||||||
"build:packages": "cd packages/core && yarn build && cd ../tldraw && yarn build",
|
"build:packages": "cd packages/core && yarn build && cd ../tldraw && yarn build",
|
||||||
"publish:patch": "yarn build:packages && lerna publish patch",
|
"publish:patch": "yarn build:packages && lerna publish patch",
|
||||||
"docs": "lerna run docs --stream"
|
"docs": "lerna run docs --stream"
|
||||||
|
@ -113,4 +113,4 @@
|
||||||
"\\+(.*)": "<rootDir>/packages/core/src/$1"
|
"\\+(.*)": "<rootDir>/packages/core/src/$1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,6 @@
|
||||||
"docs": "typedoc --entryPoints src/index.ts"
|
"docs": "typedoc --entryPoints src/index.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.15.0",
|
|
||||||
"@babel/preset-env": "^7.15.0",
|
|
||||||
"@radix-ui/react-primitive": "^0.0.15",
|
|
||||||
"@types/jest": "^27.0.1",
|
"@types/jest": "^27.0.1",
|
||||||
"@types/node": "^16.7.6",
|
"@types/node": "^16.7.6",
|
||||||
"@types/react": "^17.0.16",
|
"@types/react": "^17.0.16",
|
||||||
|
@ -51,7 +48,13 @@
|
||||||
"react-dom": "^17.0.2"
|
"react-dom": "^17.0.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@babel/core": "^7.15.0",
|
||||||
|
"@babel/preset-env": "^7.15.0",
|
||||||
|
"@radix-ui/react-primitive": "^0.0.15",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^4.19.0",
|
||||||
|
"@typescript-eslint/parser": "^4.19.0",
|
||||||
"deepmerge": "^4.2.2",
|
"deepmerge": "^4.2.2",
|
||||||
|
"ismobilejs": "^1.1.1",
|
||||||
"react-use-gesture": "^9.1.3"
|
"react-use-gesture": "^9.1.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
/* eslint-disable no-redeclare */
|
/* eslint-disable no-redeclare */
|
||||||
import type React from 'react'
|
import type React from 'react'
|
||||||
import deepmerge from 'deepmerge'
|
import deepmerge from 'deepmerge'
|
||||||
|
import isMobilePkg from 'ismobilejs'
|
||||||
import { TLBezierCurveSegment, TLBounds, TLBoundsCorner, TLBoundsEdge } from '../types'
|
import { TLBezierCurveSegment, TLBounds, TLBoundsCorner, TLBoundsEdge } from '../types'
|
||||||
import vec from './vec'
|
import vec from './vec'
|
||||||
import './polyfills'
|
import './polyfills'
|
||||||
|
@ -1664,8 +1665,7 @@ left past the initial left edge) then swap points on that axis.
|
||||||
/* -------------------------------------------------- */
|
/* -------------------------------------------------- */
|
||||||
|
|
||||||
static isMobile() {
|
static isMobile() {
|
||||||
if (typeof window === 'undefined') return false
|
return isMobilePkg().any
|
||||||
return 'ontouchstart' in window || navigator?.maxTouchPoints > 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// via https://github.com/bameyrick/throttle-typescript
|
// via https://github.com/bameyrick/throttle-typescript
|
||||||
|
@ -1702,7 +1702,6 @@ left past the initial left edge) then swap points on that axis.
|
||||||
* Find whether the current device is a Mac / iOS / iPadOS.
|
* Find whether the current device is a Mac / iOS / iPadOS.
|
||||||
*/
|
*/
|
||||||
static isDarwin(): boolean {
|
static isDarwin(): boolean {
|
||||||
if (typeof window === 'undefined') return false
|
|
||||||
return /Mac|iPod|iPhone|iPad/.test(window.navigator.platform)
|
return /Mac|iPod|iPhone|iPad/.test(window.navigator.platform)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,9 @@
|
||||||
"@radix-ui/react-tooltip": "^0.0.21",
|
"@radix-ui/react-tooltip": "^0.0.21",
|
||||||
"@stitches/react": "^1.0.0",
|
"@stitches/react": "^1.0.0",
|
||||||
"@tldraw/core": "^0.0.57",
|
"@tldraw/core": "^0.0.57",
|
||||||
|
"ismobilejs": "^1.1.1",
|
||||||
"perfect-freehand": "^0.5.3",
|
"perfect-freehand": "^0.5.3",
|
||||||
"react-hotkeys-hook": "^3.4.0",
|
"react-hotkeys-hook": "^3.4.0",
|
||||||
"rko": "^0.5.19"
|
"rko": "^0.5.19"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
76
packages/www/pages/_document.tsx
Normal file
76
packages/www/pages/_document.tsx
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
import NextDocument, { Html, Head, Main, NextScript, DocumentContext } from 'next/document'
|
||||||
|
import { getCssText } from '-styles'
|
||||||
|
import { GA_TRACKING_ID } from '-utils/gtag'
|
||||||
|
|
||||||
|
class MyDocument extends NextDocument {
|
||||||
|
static async getInitialProps(ctx: DocumentContext) {
|
||||||
|
const initialProps = await NextDocument.getInitialProps(ctx)
|
||||||
|
|
||||||
|
return {
|
||||||
|
...initialProps,
|
||||||
|
styles: (
|
||||||
|
<>
|
||||||
|
{initialProps.styles}
|
||||||
|
<style id="stitches" dangerouslySetInnerHTML={{ __html: getCssText() }} />
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render(): JSX.Element {
|
||||||
|
const APP_NAME = 'tldraw'
|
||||||
|
const APP_DESCRIPTION = 'A tiny little drawing app.'
|
||||||
|
const APP_URL = 'https://tldraw.com'
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Html lang="en">
|
||||||
|
<Head>
|
||||||
|
<meta name="application-name" content={APP_NAME} />
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||||
|
<meta name="apple-mobile-web-app-title" content={APP_NAME} />
|
||||||
|
<meta name="description" content={APP_DESCRIPTION} />
|
||||||
|
<meta name="format-detection" content="telephone=no" />
|
||||||
|
<meta name="mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="theme-color" content="#fafafa" />
|
||||||
|
|
||||||
|
<meta name="twitter:card" content="summary" />
|
||||||
|
<meta name="twitter:url" content={APP_URL} />
|
||||||
|
<meta name="twitter:title" content={APP_NAME} />
|
||||||
|
<meta name="twitter:description" content={APP_DESCRIPTION} />
|
||||||
|
<meta name="twitter:creator" content="@steveruizok" />
|
||||||
|
|
||||||
|
<meta property="og:type" content="website" />
|
||||||
|
<meta property="og:title" content={APP_NAME} />
|
||||||
|
<meta property="og:description" content={APP_DESCRIPTION} />
|
||||||
|
<meta property="og:site_name" content={APP_NAME} />
|
||||||
|
<meta property="og:url" content={APP_URL} />
|
||||||
|
|
||||||
|
<link rel="manifest" href="/manifest.json" />
|
||||||
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png" />
|
||||||
|
|
||||||
|
<script async src={`https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}`} />
|
||||||
|
<script
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: `
|
||||||
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
function gtag(){dataLayer.push(arguments);}
|
||||||
|
gtag('js', new Date());
|
||||||
|
gtag('config', '${GA_TRACKING_ID}', {
|
||||||
|
page_path: window.location.pathname,
|
||||||
|
});
|
||||||
|
`,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Head>
|
||||||
|
<body>
|
||||||
|
<Main />
|
||||||
|
<NextScript />
|
||||||
|
</body>
|
||||||
|
</Html>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MyDocument
|
|
@ -1,8 +1,9 @@
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
const Editor = dynamic(() => import('../components/editor'), { ssr: false })
|
import type { GetServerSideProps } from 'next'
|
||||||
// import type { GetServerSideProps } from 'next'
|
import { getSession } from 'next-auth/client'
|
||||||
// import { getSession } from 'next-auth/client'
|
|
||||||
|
const Editor = dynamic(() => import('components/editor'), { ssr: false })
|
||||||
|
|
||||||
export default function Home(): JSX.Element {
|
export default function Home(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
|
@ -10,24 +11,25 @@ export default function Home(): JSX.Element {
|
||||||
<Head>
|
<Head>
|
||||||
<title>tldraw</title>
|
<title>tldraw</title>
|
||||||
</Head>
|
</Head>
|
||||||
<div>
|
<div style={{ display: 'absolute', zIndex: 1 }}>
|
||||||
<Editor />
|
<Editor />
|
||||||
</div>
|
</div>
|
||||||
|
<button style={{ display: 'absolute', zIndex: 9999999 }}>Sign Out</button>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// export const getServerSideProps: GetServerSideProps = async (context) => {
|
export const getServerSideProps: GetServerSideProps = async (context) => {
|
||||||
// const session = await getSession(context)
|
const session = await getSession(context)
|
||||||
|
|
||||||
// if (!session?.user && process.env.NODE_ENV !== 'development') {
|
if (!session?.user && process.env.NODE_ENV !== 'development') {
|
||||||
// context.res.setHeader('Location', `/sponsorware`)
|
context.res.setHeader('Location', `/sponsorware`)
|
||||||
// context.res.statusCode = 307
|
context.res.statusCode = 307
|
||||||
// }
|
}
|
||||||
|
|
||||||
// return {
|
return {
|
||||||
// props: {
|
props: {
|
||||||
// session,
|
session,
|
||||||
// },
|
},
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
{
|
|
||||||
"name": "tldraw",
|
|
||||||
"short_name": "tldraw",
|
|
||||||
"icons": [
|
|
||||||
{
|
|
||||||
"src": "/android-chrome-512x512.png",
|
|
||||||
"sizes": "512x512",
|
|
||||||
"type": "image/png",
|
|
||||||
"purpose": "any"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "/android-chrome-maskable-512x512.png",
|
|
||||||
"sizes": "512x512",
|
|
||||||
"type": "image/png",
|
|
||||||
"purpose": "any maskable"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "/android-chrome-192x192.png",
|
|
||||||
"sizes": "192x192",
|
|
||||||
"type": "image/png",
|
|
||||||
"purpose": "any"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "/android-chrome-maskable-192x192.png",
|
|
||||||
"sizes": "192x192",
|
|
||||||
"type": "image/png",
|
|
||||||
"purpose": "any maskable"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"theme_color": "#fafafa",
|
|
||||||
"background_color": "#fafafa",
|
|
||||||
"start_url": "/",
|
|
||||||
"display": "standalone",
|
|
||||||
"orientation": "portrait"
|
|
||||||
}
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,78 +0,0 @@
|
||||||
// import NextDocument, { Html, Head, Main, NextScript, DocumentContext } from 'next/document'
|
|
||||||
// import { getCssText } from '-styles'
|
|
||||||
// import { GA_TRACKING_ID } from '-utils/gtag'
|
|
||||||
|
|
||||||
// class MyDocument extends NextDocument {
|
|
||||||
// static async getInitialProps(ctx: DocumentContext) {
|
|
||||||
// const initialProps = await NextDocument.getInitialProps(ctx)
|
|
||||||
|
|
||||||
// return {
|
|
||||||
// ...initialProps,
|
|
||||||
// styles: (
|
|
||||||
// <>
|
|
||||||
// {initialProps.styles}
|
|
||||||
// <style id="stitches" dangerouslySetInnerHTML={{ __html: getCssText() }} />
|
|
||||||
// </>
|
|
||||||
// ),
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// render(): JSX.Element {
|
|
||||||
// const APP_NAME = 'tldraw'
|
|
||||||
// const APP_DESCRIPTION = 'A tiny little drawing app.'
|
|
||||||
// const APP_URL = 'https://tldraw.com'
|
|
||||||
|
|
||||||
// return (
|
|
||||||
// <Html lang="en">
|
|
||||||
// <Head>
|
|
||||||
// <meta name="application-name" content={APP_NAME} />
|
|
||||||
// <meta name="apple-mobile-web-app-capable" content="yes" />
|
|
||||||
// <meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
|
||||||
// <meta name="apple-mobile-web-app-title" content={APP_NAME} />
|
|
||||||
// <meta name="description" content={APP_DESCRIPTION} />
|
|
||||||
// <meta name="format-detection" content="telephone=no" />
|
|
||||||
// <meta name="mobile-web-app-capable" content="yes" />
|
|
||||||
// <meta name="theme-color" content="#fafafa" />
|
|
||||||
|
|
||||||
// <meta name="twitter:card" content="summary" />
|
|
||||||
// <meta name="twitter:url" content={APP_URL} />
|
|
||||||
// <meta name="twitter:title" content={APP_NAME} />
|
|
||||||
// <meta name="twitter:description" content={APP_DESCRIPTION} />
|
|
||||||
// <meta name="twitter:creator" content="@steveruizok" />
|
|
||||||
|
|
||||||
// <meta property="og:type" content="website" />
|
|
||||||
// <meta property="og:title" content={APP_NAME} />
|
|
||||||
// <meta property="og:description" content={APP_DESCRIPTION} />
|
|
||||||
// <meta property="og:site_name" content={APP_NAME} />
|
|
||||||
// <meta property="og:url" content={APP_URL} />
|
|
||||||
|
|
||||||
// <link rel="manifest" href="/manifest.json" />
|
|
||||||
// <link rel="shortcut icon" href="/favicon.ico" />
|
|
||||||
// <link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png" />
|
|
||||||
|
|
||||||
// <script async src={`https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}`} />
|
|
||||||
// <script
|
|
||||||
// dangerouslySetInnerHTML={{
|
|
||||||
// __html: `
|
|
||||||
// window.dataLayer = window.dataLayer || [];
|
|
||||||
// function gtag(){dataLayer.push(arguments);}
|
|
||||||
// gtag('js', new Date());
|
|
||||||
// gtag('config', '${GA_TRACKING_ID}', {
|
|
||||||
// page_path: window.location.pathname,
|
|
||||||
// });
|
|
||||||
// `,
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
// </Head>
|
|
||||||
// <body>
|
|
||||||
// <Main />
|
|
||||||
// <NextScript />
|
|
||||||
// </body>
|
|
||||||
// </Html>
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export default MyDocument
|
|
||||||
|
|
||||||
export {}
|
|
|
@ -1,10 +1,12 @@
|
||||||
{
|
{
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||||
"exclude": ["node_modules", "**/*.test.ts", "**/*.spec.ts", "dist"],
|
"exclude": ["node_modules", "**/*.test.ts", "**/*.spec.ts", "dist"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
|
"outDir": "./dist/types",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
|
|
Loading…
Reference in a new issue