Created SvelteKit Application as Base

This commit is contained in:
Luke Else 2023-08-29 20:48:14 +01:00
parent 3eb3b6845b
commit 065a6a2d17
20 changed files with 1962 additions and 241 deletions

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

2
.npmrc Normal file
View File

@ -0,0 +1,2 @@
engine-strict=true
resolution-mode=highest

13
.prettierignore Normal file
View File

@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

9
.prettierrc Normal file
View File

@ -0,0 +1,9 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

38
README.md Normal file
View File

@ -0,0 +1,38 @@
# create-svelte
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
## Creating a project
If you're seeing this, you've probably already done this step. Congrats!
```bash
# create a new project in the current directory
npm create svelte@latest
# create a new project in my-app
npm create svelte@latest my-app
```
## Developing
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
```bash
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
```
## Building
To create a production version of your app:
```bash
npm run build
```
You can preview the production build with `npm run preview`.
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.

View File

@ -1,58 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="Luke Else - Software Engineer Apprentice from Kent. I specialise in C# and dotnet development but also have experience in GoLang and will be looking to expand my knowledge into low level systems with C++ in the future. I've been developing Apps and Backend Web-Systems since Early 2020 and have learned a lot of skills and experience on the way!" />
<title>Luke Else</title>
<link rel="stylesheet" href="./style.css" />
</head>
<script src="./js/flip.js"></script>
<script src="./js/age.js"></script>
<div class="card" id="card" onclick="flipCard()">
<div class="card-back" id="card-back">
<div class="line-numbers">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
</div>
<code>
<span class="variable">let </span><span class="property">me</span><span class="type-inlay">: Person </span>= <span class="function">Person </span><span>{</span><br />
<div class="indent"> <span class="property">name</span><span>: </span><span class="string">"Luke Else"</span>.<span class="method">to_string<span class="variable">()</span></span><span>,</span></div>
<div class="indent"> <span class="property">age</span><span>: </span><span class="int"><script>document.write(getAge(new Date("2004-01-12")))</script></span><span>,</span></div>
<div class="indent"> <span class="property">title</span><span>: </span><span class="string">"Software Engineer / Student"</span>.<span class="method">to_string<span class="variable">()</span></span><span>,</span></div>
<div class="indent"> <span class="property">email</span><span>: </span><a href="mailto:contact@luke-else.co.uk"><span class="string">"contact@luke-else.co.uk"</span></a>.<span class="method">to_string<span class="variable">()</span></span></span><span>,</span></div>
<div class="indent"> <span class="property">website</span><span>: </span><a href="https://git.luke-else.co.uk/luke-else"><span class="string">"git.luke-else.co.uk"</span></a>.<span class="method">to_string<span class="variable">()</span></span></div>
<span>}</span>
</code>
</div>
<div class="card-front" id="card-front">
<div class="line-numbers">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
</div>
<code>
<span class="variable">struct </span><span class="function">Person </span><span>{</span><br />
<div class="indent"> <span class='variable'>pub </span><span class="property">name</span><span>: </span><span class='function'>String,</span></div>
<div class="indent"> <span class="property">age</span><span>: </span><span class='function'>u8,</span></div>
<div class="indent"> <span class="property">title</span><span>: </span><span class='function'>String,</span></div>
<div class="indent"> <span class='variable'>pub </span><span class="property">email</span><span>: </span><span class='function'>String,</span></div>
<div class="indent"> <span class='variable'>pub </span><span class="property">website</span><span>: </span><span class='function'>String</span></div>
<span>}</span>
</code>
</div>
</div>
</html>

View File

@ -1,10 +0,0 @@
function getAge(dateString) {
var today = new Date();
var birthDate = dateString;
var age = today.getFullYear() - birthDate.getFullYear();
var m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
return age;
}

View File

@ -1,14 +0,0 @@
var flipped = false;
function flipCard() {
if (!flipped) {
document.getElementById('card-front').style.transform = 'rotateX(-180deg)';
document.getElementById('card-back').style.transform = 'rotateX(0deg)';
flipped = true;
}else{
document.getElementById('card-front').style.transform = 'rotateX(0deg)';
document.getElementById('card-back').style.transform = 'rotateX(-180deg)';
flipped = false;
}
}

1796
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

26
package.json Normal file
View File

@ -0,0 +1,26 @@
{
"name": "luke-else.co.uk",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check .",
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.10.1",
"svelte": "^4.0.5",
"svelte-check": "^3.4.3",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.4.2"
},
"type": "module"
}

12
src/app.d.ts vendored Normal file
View File

@ -0,0 +1,12 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
}
export {};

12
src/app.html Normal file
View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

1
src/lib/index.ts Normal file
View File

@ -0,0 +1 @@
// place files you want to import through the `$lib` alias in this folder.

2
src/routes/+page.svelte Normal file
View File

@ -0,0 +1,2 @@
<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>

BIN
static/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

159
style.css
View File

@ -1,159 +0,0 @@
*, *:before, *:after {
box-sizing: border-box;
outline: none;
}
html {
font-family: "Source Sans Pro", sans-serif;
font-size: 16px;
font-smooth: auto;
font-weight: 300;
line-height: 1.5;
color: #444;
}
body {
position: relative;
display: flex;
align-items: center;
justify-content: center;
/* width: 99%; */
height: 98vh;
background: linear-gradient(45deg, #372c75, #5e5e5e);
}
code, .card .line-numbers {
font-family: "Lucida Console", Monaco, monospace;
font-size: 14px;
}
.card {
position: relative;
width: 34rem;
height: 15rem;
perspective: 150rem;
}
.card-front, .card-back {
position: absolute;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
margin: auto;
border-radius: 5px;
box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.4);
transition: 0.9s cubic-bezier(0.25, 0.8, 0.25, 1);
backface-visibility: hidden;
overflow: hidden;
}
.card-front:before, .card-front:after, .card-back:before, .card-back:after {
position: absolute;
}
.card-front:before, .card-back:before {
top: -40px;
right: -40px;
content: "";
width: 80px;
height: 80px;
background-color: rgba(255, 255, 255, 0.08);
transform: rotate(45deg);
z-index: 1;
}
.card-front:after, .card-back:after {
content: "+";
top: 0;
right: 10px;
font-size: 24px;
transform: rotate(45deg);
z-index: 2;
}
.card-front {
width: 100%;
height: 100%;
background: linear-gradient(45deg, #101010, #2c3e50);
}
.card-front:after {
color: #212f3c;
}
.card-back {
background: linear-gradient(-45deg, #101010, #2c3e50);
transform: rotateX(180deg);
}
.card-back:after {
color: #11181f;
}
.card:hover .card-front{
transform: rotateX(-180deg);
}
.card:hover .card-back{
transform: rotateX(0deg);
}
.card .line-numbers {
position: absolute;
top: 0;
left: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
margin: 0;
padding: 0 10px;
background-color: rgba(255, 255, 255, 0.03);
font-size: 13px;
}
.card .line-numbers > div {
padding: 2.5px 0;
opacity: 0.15;
}
.card code, .card .line-numbers {
color: whitesmoke;
}
.card .indent {
padding-left: 30px;
}
.card .operator {
color: #4dd0e1;
}
.card .string {
color: #9ccc65;
}
.card .int {
color: #d4922f;
}
.card .variable {
color: #BA68C8;
}
.card .property {
color: #ef5350;
}
.card .method {
color: #29b6f6;
}
.card .function {
color: #FDD835;
}
.card .boolean {
color: #4dd0e1;
}
.card .comment {
color: #229977;
}
.card .type-inlay {
color: rgb(161, 161, 161);
}
a:link { text-decoration: none; }
a:visited { text-decoration: none; }
a:hover { text-decoration: none; }
a:active { text-decoration: none; }

18
svelte.config.js Normal file
View File

@ -0,0 +1,18 @@
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/kit/vite';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess(),
kit: {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter()
}
};
export default config;

17
tsconfig.json Normal file
View File

@ -0,0 +1,17 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}

6
vite.config.ts Normal file
View File

@ -0,0 +1,6 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()]
});