Adds web manifest, pwa

This commit is contained in:
Steve Ruiz 2021-06-11 13:37:09 +01:00
parent 6c08c35dee
commit 0158c79953
18 changed files with 3790 additions and 24 deletions

View file

@ -27,7 +27,7 @@ export default function Editor() {
<StylePanel /> <StylePanel />
<Canvas /> <Canvas />
<ToolsPanel /> <ToolsPanel />
<StatusBar /> {/* <StatusBar /> */}
</Layout> </Layout>
) )
} }

View file

@ -177,7 +177,7 @@ export default function ToolsPanel() {
const OuterContainer = styled('div', { const OuterContainer = styled('div', {
position: 'fixed', position: 'fixed',
bottom: 40, bottom: 32,
left: 0, left: 0,
right: 0, right: 0,
padding: '0 8px 12px 8px', padding: '0 8px 12px 8px',

7
next.config.js Normal file
View file

@ -0,0 +1,7 @@
const withPWA = require('next-pwa')
module.exports = withPWA({
pwa: {
dest: 'public',
},
})

View file

@ -22,6 +22,7 @@
"framer-motion": "^4.1.16", "framer-motion": "^4.1.16",
"ismobilejs": "^1.1.1", "ismobilejs": "^1.1.1",
"next": "10.2.0", "next": "10.2.0",
"next-pwa": "^5.2.21",
"perfect-freehand": "^0.4.8", "perfect-freehand": "^0.4.8",
"prettier": "^2.3.0", "prettier": "^2.3.0",
"react": "17.0.2", "react": "17.0.2",

View file

@ -4,7 +4,17 @@ import 'styles/globals.css'
function MyApp({ Component, pageProps }: AppProps) { function MyApp({ Component, pageProps }: AppProps) {
globalStyles() globalStyles()
return <Component {...pageProps} /> return (
<>
<head>
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no, user-scalable=no, viewport-fit=cover"
/>
</head>
<Component {...pageProps} />
</>
)
} }
export default MyApp export default MyApp

View file

@ -27,7 +27,39 @@ class MyDocument extends NextDocument {
render() { render() {
return ( return (
<Html lang="en"> <Html lang="en">
<Head /> <Head>
<meta name="application-name" content="tldraw" />
<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="tldraw" />
<meta name="description" content="A tiny little drawing app." />
<meta name="format-detection" content="telephone=no" />
<meta name="mobile-web-app-capable" content="yes" />
<meta
name="msapplication-config"
content="/static/icons/browserconfig.xml"
/>
<meta name="msapplication-TileColor" content="#3174d7" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="theme-color" content="#ffffff" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:url" content="https://tldraw.com" />
<meta name="twitter:title" content="tldraw" />
<meta
name="twitter:description"
content="A tiny little drawing app."
/>
<meta name="twitter:creator" content="@steveruizok" />
<meta property="og:type" content="website" />
<meta property="og:title" content="tldraw" />
<meta
property="og:description"
content="A tiny little drawing app."
/>
<meta property="og:site_name" content="tldraw" />
<meta property="og:url" content="https://tldraw.com" />
</Head>
<body className={dark}> <body className={dark}>
<Main /> <Main />
<NextScript /> <NextScript />

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
public/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 B

BIN
public/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

21
public/manifest.json Normal file
View file

@ -0,0 +1,21 @@
{
"name": "tldraw",
"short_name": "tldraw",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#FFFFFF",
"background_color": "#FFFFFF",
"start_url": "/",
"display": "minimal-ui",
"orientation": "portrait"
}

128
public/sw.js Normal file
View file

@ -0,0 +1,128 @@
/**
* Copyright 2018 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// If the loader is already loaded, just stop.
if (!self.define) {
const singleRequire = name => {
if (name !== 'require') {
name = name + '.js';
}
let promise = Promise.resolve();
if (!registry[name]) {
promise = new Promise(async resolve => {
if ("document" in self) {
const script = document.createElement("script");
script.src = name;
document.head.appendChild(script);
script.onload = resolve;
} else {
importScripts(name);
resolve();
}
});
}
return promise.then(() => {
if (!registry[name]) {
throw new Error(`Module ${name} didnt register its module`);
}
return registry[name];
});
};
const require = (names, resolve) => {
Promise.all(names.map(singleRequire))
.then(modules => resolve(modules.length === 1 ? modules[0] : modules));
};
const registry = {
require: Promise.resolve(require)
};
self.define = (moduleName, depsNames, factory) => {
if (registry[moduleName]) {
// Module is already loading or loaded.
return;
}
registry[moduleName] = Promise.resolve().then(() => {
let exports = {};
const module = {
uri: location.origin + moduleName.slice(1)
};
return Promise.all(
depsNames.map(depName => {
switch(depName) {
case "exports":
return exports;
case "module":
return module;
default:
return singleRequire(depName);
}
})
).then(deps => {
const facValue = factory(...deps);
if(!exports.default) {
exports.default = facValue;
}
return exports;
});
});
};
}
define("./sw.js",['./workbox-6b19f60b'], function (workbox) { 'use strict';
/**
* Welcome to your Workbox-powered service worker!
*
* You'll need to register this file in your web app.
* See https://goo.gl/nhQhGp
*
* The rest of the code is auto-generated. Please don't update this file
* directly; instead, make changes to your Workbox build configuration
* and re-run your build process.
* See https://goo.gl/2aRDsh
*/
importScripts();
self.skipWaiting();
workbox.clientsClaim();
workbox.registerRoute("/", new workbox.NetworkFirst({
"cacheName": "start-url",
plugins: [{
cacheWillUpdate: async ({
request,
response,
event,
state
}) => {
if (response && response.type === 'opaqueredirect') {
return new Response(response.body, {
status: 200,
statusText: 'OK',
headers: response.headers
});
}
return response;
}
}]
}), 'GET');
workbox.registerRoute(/.*/i, new workbox.NetworkOnly({
"cacheName": "dev",
plugins: []
}), 'GET');
});
//# sourceMappingURL=sw.js.map

1
public/sw.js.map Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"sw.js","sources":["../../../../../private/var/folders/3w/cj9n4h8j7xl3b82k45v7xw2r0000gn/T/af88887397cd2af68f658e66ccc7f5cc/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/Users/stephenruiz/Developer/GitHub/code-slate/node_modules/workbox-routing/registerRoute.mjs';\nimport {NetworkFirst as workbox_strategies_NetworkFirst} from '/Users/stephenruiz/Developer/GitHub/code-slate/node_modules/workbox-strategies/NetworkFirst.mjs';\nimport {NetworkOnly as workbox_strategies_NetworkOnly} from '/Users/stephenruiz/Developer/GitHub/code-slate/node_modules/workbox-strategies/NetworkOnly.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/Users/stephenruiz/Developer/GitHub/code-slate/node_modules/workbox-core/clientsClaim.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\nimportScripts(\n \n);\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n\nworkbox_routing_registerRoute(\"/\", new workbox_strategies_NetworkFirst({ \"cacheName\":\"start-url\", plugins: [{ cacheWillUpdate: async ({request, response, event, state}) => { if (response && response.type === 'opaqueredirect') { return new Response(response.body, {status: 200, statusText: 'OK', headers: response.headers}); } return response; } }] }), 'GET');\nworkbox_routing_registerRoute(/.*/i, new workbox_strategies_NetworkOnly({ \"cacheName\":\"dev\", plugins: [] }), 'GET');\n\n\n\n\n"],"names":["importScripts","self","skipWaiting","workbox_core_clientsClaim","workbox_routing_registerRoute","workbox_strategies_NetworkFirst","plugins","cacheWillUpdate","request","response","event","state","type","Response","body","status","statusText","headers","workbox_strategies_NetworkOnly"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGoJ;EACpJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAGAA,aAAa;EAUbC,IAAI,CAACC,WAAL;AAEAC,sBAAyB;AAIzBC,uBAA6B,CAAC,GAAD,EAAM,IAAIC,oBAAJ,CAAoC;EAAE,eAAY,WAAd;EAA2BC,EAAAA,OAAO,EAAE,CAAC;EAAEC,IAAAA,eAAe,EAAE,OAAO;EAACC,MAAAA,OAAD;EAAUC,MAAAA,QAAV;EAAoBC,MAAAA,KAApB;EAA2BC,MAAAA;EAA3B,KAAP,KAA6C;EAAE,UAAIF,QAAQ,IAAIA,QAAQ,CAACG,IAAT,KAAkB,gBAAlC,EAAoD;EAAE,eAAO,IAAIC,QAAJ,CAAaJ,QAAQ,CAACK,IAAtB,EAA4B;EAACC,UAAAA,MAAM,EAAE,GAAT;EAAcC,UAAAA,UAAU,EAAE,IAA1B;EAAgCC,UAAAA,OAAO,EAAER,QAAQ,CAACQ;EAAlD,SAA5B,CAAP;EAAiG;;EAAC,aAAOR,QAAP;EAAkB;EAA5O,GAAD;EAApC,CAApC,CAAN,EAAmU,KAAnU,CAA7B;AACAL,uBAA6B,CAAC,KAAD,EAAQ,IAAIc,mBAAJ,CAAmC;EAAE,eAAY,KAAd;EAAqBZ,EAAAA,OAAO,EAAE;EAA9B,CAAnC,CAAR,EAAgF,KAAhF,CAA7B;;"}

2701
public/workbox-6b19f60b.js Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

904
yarn.lock

File diff suppressed because it is too large Load diff