Squashed commit of the following:
commit 787b84159c894cb38ea9eb1423069884f8b56bc4
Author: ChrisDill <chris.rj.dill@gmail.com>
Date: Sat Jul 24 16:57:16 2021 +0100
Test footer fix for smaller resolutions
commit bc8cba413d12250d76118ce31668a6dd4e8eebbd
Author: ChrisDill <chris.rj.dill@gmail.com>
Date: Wed Jul 21 18:53:05 2021 +0100
Add jsconfig.json and update error/layout prefix
commit 03d1cfced8b095ff79173a25ac2612aaa7f895aa
Author: ChrisDill <chris.rj.dill@gmail.com>
Date: Wed Jul 21 18:06:45 2021 +0100
Test sveltekit fixes to get static adapter to work
commit 6f4c28b0ead9d758fbb649d13188da38a6dfb00f
Author: ChrisDill <chris.rj.dill@gmail.com>
Date: Wed Dec 16 10:25:42 2020 +0000
Initial sveltekit test
- New branch for testing out sveltekit. It is not yet 1.0 so this is for experimental purposes.
This commit is contained in:
parent
ed198c2365
commit
d06e2b88eb
9 changed files with 388 additions and 3054 deletions
19
src/app.html
Normal file
19
src/app.html
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="theme-color" content="#333333">
|
||||
<meta name="description" content="Quartznet is a small team developing games, tools and more!">
|
||||
|
||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/css/global.css">
|
||||
<link rel="manifest" href="manifest.json" crossorigin="use-credentials">
|
||||
<link rel="icon" type="image/png" href="/img/favicon.ico">
|
||||
|
||||
%svelte.head%
|
||||
</head>
|
||||
<body>
|
||||
<div id="svelte">%svelte.body%</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import * as sapper from '@sapper/app';
|
||||
|
||||
sapper.start({
|
||||
target: document.querySelector('#sapper')
|
||||
});
|
||||
|
|
@ -19,8 +19,6 @@
|
|||
font-size: 3rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<div class="overlay">
|
||||
|
|
|
|||
10
src/main.js
10
src/main.js
|
|
@ -1,10 +0,0 @@
|
|||
import App from './routes/index.svelte';
|
||||
|
||||
const app = new App({
|
||||
target: document.body,
|
||||
props: {
|
||||
name: 'Quartznet'
|
||||
}
|
||||
});
|
||||
|
||||
export default app;
|
||||
80
src/404.svelte → src/routes/__error.svelte
Executable file → Normal file
80
src/404.svelte → src/routes/__error.svelte
Executable file → Normal file
|
|
@ -1,7 +1,12 @@
|
|||
<script>
|
||||
import {onMount} from 'svelte'
|
||||
import Banner from '../components/banner.svelte'
|
||||
|
||||
export let status;
|
||||
export let error;
|
||||
|
||||
const dev = process.env.NODE_ENV === 'development';
|
||||
|
||||
var view = document.getElementsByTagName('pre')[0];
|
||||
var appa = ` .,-:;//;:=,
|
||||
. :H@@@MM@M#H/.,+%;,
|
||||
,/X+ +M@@M@MM%=,-%HMMM@X/,
|
||||
|
|
@ -212,32 +217,76 @@ H@: :HHHHHHHHHHHHHHHHHHX, =@H
|
|||
,:/%XM####H/.
|
||||
,.:=-.`;
|
||||
|
||||
//appa
|
||||
//atom
|
||||
//nuke
|
||||
// appa, atom, nuke
|
||||
var options = [cake, heart, fire, tick, bang, mesa, cube];
|
||||
|
||||
let active = cake
|
||||
|
||||
function updateView() {
|
||||
active = "<br>" + options[Math.floor((Math.random() * options.length))];
|
||||
active = options[Math.floor((Math.random() * options.length))];
|
||||
setTimeout(updateView, 5000);
|
||||
}
|
||||
|
||||
onMount(() => updateView());
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
* {
|
||||
color: white !important;
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.ascii {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.info {
|
||||
margin-bottom: 30px;
|
||||
position: relative;
|
||||
white-space: pre;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
pre {
|
||||
/* display: inline-block; */
|
||||
margin: 0 auto;
|
||||
/* position: center; */
|
||||
/* text-align: left; */
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
h1 {
|
||||
font-size: 4em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<svelte:head>
|
||||
<title>Quartnzet - {status}</title>
|
||||
</svelte:head>
|
||||
|
||||
<body style="text-align: center">
|
||||
<audio controls autoplay>
|
||||
<source src="alive.ogg" type="audio/wav">
|
||||
</audio>
|
||||
<Banner title="{status}"/>
|
||||
|
||||
<pre>{active}</pre>
|
||||
<br>
|
||||
<main class="container">
|
||||
<p>{error.message}</p>
|
||||
|
||||
{#if dev && error.stack}
|
||||
<pre>{error.stack}</pre>
|
||||
{:else}
|
||||
<audio controls autoplay>
|
||||
<track kind="captions"/>
|
||||
<source src="http://quartznet.info/alive.ogg" type="audio/wav">
|
||||
</audio>
|
||||
<div class="ascii">
|
||||
<div>
|
||||
<pre><br>{active}</pre>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<p class="info">
|
||||
This was a triumph!
|
||||
I'm making a note here:
|
||||
Huge success!
|
||||
|
|
@ -312,5 +361,6 @@ still alive
|
|||
Still alive.
|
||||
|
||||
Still alive.
|
||||
</body>
|
||||
</html>
|
||||
</p>
|
||||
{/if}
|
||||
</main>
|
||||
41
src/routes/__layout.svelte
Normal file
41
src/routes/__layout.svelte
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<script>
|
||||
import Nav from '../components/Nav.svelte';
|
||||
import userManager from '../components/userManager.svelte'
|
||||
import Modal from '../components/Modal.svelte'
|
||||
import Footer from '../components/footer.svelte'
|
||||
|
||||
export let segment;
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/*main {
|
||||
position: relative;
|
||||
max-width: 56em;
|
||||
background-color: white;
|
||||
padding: 2em;
|
||||
margin: 0 auto;
|
||||
box-sizing: border-box;
|
||||
}*/
|
||||
|
||||
/* Dark theme */
|
||||
:global(html[data-theme='dark']) {
|
||||
--background-color: #222222;
|
||||
--headings-color: #ffffff;
|
||||
--font-color: #ffffff;
|
||||
}
|
||||
|
||||
:global(body) {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 1rem;
|
||||
background-color: var(--background-color);
|
||||
color: var(--font-color);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
|
||||
<Modal/>
|
||||
<Nav {segment} rightComponent={userManager}/>
|
||||
|
||||
<slot></slot>
|
||||
|
||||
<Footer/>
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
import sirv from 'sirv';
|
||||
import polka from 'polka';
|
||||
import compression from 'compression';
|
||||
import * as sapper from '@sapper/server';
|
||||
|
||||
const {PORT, NODE_ENV} = process.env;
|
||||
const dev = NODE_ENV === 'development';
|
||||
|
||||
polka() // You can also use Express
|
||||
.use(
|
||||
compression({threshold: 0}),
|
||||
sirv('static', {dev}),
|
||||
sapper.middleware()
|
||||
)
|
||||
.listen(PORT, err => {
|
||||
if (err) console.log('error', err);
|
||||
});
|
||||
console.log('> DEV: ' + dev.toString())
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
import {timestamp, files, shell, routes} from '@sapper/service-worker';
|
||||
|
||||
const ASSETS = `cache${timestamp}`;
|
||||
|
||||
// `shell` is an array of all the files generated by the bundler,
|
||||
// `files` is an array of everything in the `static` directory
|
||||
const to_cache = shell.concat(files);
|
||||
const cached = new Set(to_cache);
|
||||
|
||||
self.addEventListener('install', event => {
|
||||
event.waitUntil(
|
||||
caches
|
||||
.open(ASSETS)
|
||||
.then(cache => cache.addAll(to_cache))
|
||||
.then(() => {
|
||||
self.skipWaiting();
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('activate', event => {
|
||||
event.waitUntil(
|
||||
caches.keys().then(async keys => {
|
||||
// delete old caches
|
||||
for (const key of keys) {
|
||||
if (key !== ASSETS) await caches.delete(key);
|
||||
}
|
||||
|
||||
self.clients.claim();
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', event => {
|
||||
if (event.request.method !== 'GET' || event.request.headers.has('range')) return;
|
||||
|
||||
const url = new URL(event.request.url);
|
||||
|
||||
// don't try to handle e.g. data: URIs
|
||||
if (!url.protocol.startsWith('http')) return;
|
||||
|
||||
// ignore dev server requests
|
||||
if (url.hostname === self.location.hostname && url.port !== self.location.port) return;
|
||||
|
||||
// always serve static files and bundler-generated assets from cache
|
||||
if (url.host === self.location.host && cached.has(url.pathname)) {
|
||||
event.respondWith(caches.match(event.request));
|
||||
return;
|
||||
}
|
||||
|
||||
// for pages, you might want to serve a shell `service-worker-index.html` file,
|
||||
// which Sapper has generated for you. It's not right for every
|
||||
// app, but if it's right for yours then uncomment this section
|
||||
/*
|
||||
if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) {
|
||||
event.respondWith(caches.match('/service-worker-index.html'));
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
if (event.request.cache === 'only-if-cached') return;
|
||||
|
||||
// for everything else, try the network first, falling back to
|
||||
// cache if the user is offline. (If the pages never change, you
|
||||
// might prefer a cache-first approach to a network-first one.)
|
||||
event.respondWith(
|
||||
caches
|
||||
.open(`offline${timestamp}`)
|
||||
.then(async cache => {
|
||||
try {
|
||||
const response = await fetch(event.request);
|
||||
cache.put(event.request, response.clone());
|
||||
return response;
|
||||
} catch (err) {
|
||||
const response = await cache.match(event.request);
|
||||
if (response) return response;
|
||||
|
||||
throw err;
|
||||
}
|
||||
})
|
||||
);
|
||||
});
|
||||
Loading…
Reference in a new issue