Compare commits
3 Commits
5af2b996d6
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b09941f9e9 | ||
|
|
62f209a99d | ||
|
|
2bdcce6c9e |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1 @@
|
||||
__pycache__
|
||||
webapp2/
|
||||
__pycache__
|
||||
4
app.py
4
app.py
@ -2,6 +2,10 @@ from flask import Flask, send_from_directory
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def svelte_index():
|
||||
return send_from_directory("webapp/build", "index.html")
|
||||
|
||||
@app.route("/<path:path>")
|
||||
def svelte_client(path):
|
||||
return send_from_directory("webapp/build/", path)
|
||||
13
webapp/.eslintignore
Normal file
13
webapp/.eslintignore
Normal 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
|
||||
@ -1,15 +1,31 @@
|
||||
/** @type { import("eslint").Linter.Config } */
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['eslint:recommended', 'prettier'],
|
||||
plugins: ['svelte3'],
|
||||
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:svelte/recommended',
|
||||
'prettier'
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['@typescript-eslint'],
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
ecmaVersion: 2020
|
||||
ecmaVersion: 2020,
|
||||
extraFileExtensions: ['.svelte']
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
es2017: true,
|
||||
node: true
|
||||
}
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.svelte'],
|
||||
parser: 'svelte-eslint-parser',
|
||||
parserOptions: {
|
||||
parser: '@typescript-eslint/parser'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
3
webapp/.gitignore
vendored
3
webapp/.gitignore
vendored
@ -6,4 +6,5 @@ node_modules
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
package-lock.json
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
|
||||
4
webapp/.prettierignore
Normal file
4
webapp/.prettierignore
Normal file
@ -0,0 +1,4 @@
|
||||
# Ignore files for PNPM, NPM and YARN
|
||||
pnpm-lock.yaml
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
@ -2,5 +2,7 @@
|
||||
"useTabs": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"printWidth": 100
|
||||
"printWidth": 100,
|
||||
"plugins": ["prettier-plugin-svelte"],
|
||||
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# create-svelte
|
||||
|
||||
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte);
|
||||
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
|
||||
|
||||
## Creating a project
|
||||
|
||||
@ -8,14 +8,12 @@ If you're seeing this, you've probably already done this step. Congrats!
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npm init svelte@next
|
||||
npm create svelte@latest
|
||||
|
||||
# create a new project in my-app
|
||||
npm init svelte@next my-app
|
||||
npm create svelte@latest my-app
|
||||
```
|
||||
|
||||
> Note: the `@next` is temporary
|
||||
|
||||
## Developing
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
@ -29,10 +27,12 @@ npm run dev -- --open
|
||||
|
||||
## Building
|
||||
|
||||
Before creating a production version of your app, install an [adapter](https://kit.svelte.dev/docs#adapters) for your target environment. Then:
|
||||
To create a production version of your app:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
|
||||
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.
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"$lib": ["src/lib"],
|
||||
"$lib/*": ["src/lib/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
|
||||
}
|
||||
6998
webapp/package-lock.json
generated
6998
webapp/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,26 +1,37 @@
|
||||
{
|
||||
"name": "webapp",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "svelte-kit dev",
|
||||
"build": "svelte-kit build",
|
||||
"package": "svelte-kit package",
|
||||
"preview": "svelte-kit preview",
|
||||
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
|
||||
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/adapter-auto": "next",
|
||||
"@sveltejs/kit": "next",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-svelte3": "^3.2.1",
|
||||
"prettier": "^2.4.1",
|
||||
"prettier-plugin-svelte": "^2.4.0",
|
||||
"svelte": "^3.44.0"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@sveltejs/adapter-static": "^1.0.0-next.25"
|
||||
}
|
||||
"name": "webapp",
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"prepare": "svelte-kit sync || echo ''",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"lint": "prettier --check . && eslint .",
|
||||
"format": "prettier --write ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.2.5",
|
||||
"@eslint/js": "^9.18.0",
|
||||
"@sveltejs/adapter-static": "^3.0.8",
|
||||
"@sveltejs/kit": "^2.16.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
"eslint-plugin-svelte": "^2.46.1",
|
||||
"globals": "^15.14.0",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier-plugin-svelte": "^3.3.3",
|
||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||
"svelte": "^5.0.0",
|
||||
"svelte-check": "^4.0.0",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"typescript-eslint": "^8.20.0",
|
||||
"vite": "^6.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
13
webapp/src/app.d.ts
vendored
Normal file
13
webapp/src/app.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// See https://kit.svelte.dev/docs/types#app
|
||||
// for information about these interfaces
|
||||
declare global {
|
||||
namespace App {
|
||||
// interface Error {}
|
||||
// interface Locals {}
|
||||
// interface PageData {}
|
||||
// interface PageState {}
|
||||
// interface Platform {}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
@ -1,14 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="description" content="" />
|
||||
<link rel="icon" href="%svelte.assets%/favicon.png" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet"/>
|
||||
%svelte.head%
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<body>
|
||||
<div id="svelte">%svelte.body%</div>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
1
webapp/src/global.d.ts
vendored
1
webapp/src/global.d.ts
vendored
@ -1 +0,0 @@
|
||||
/// <reference types="@sveltejs/kit" />
|
||||
1
webapp/src/lib/index.ts
Normal file
1
webapp/src/lib/index.ts
Normal file
@ -0,0 +1 @@
|
||||
// place files you want to import through the `$lib` alias in this folder.
|
||||
1
webapp/src/routes/+layout.ts
Normal file
1
webapp/src/routes/+layout.ts
Normal file
@ -0,0 +1 @@
|
||||
export const prerender = true;
|
||||
2
webapp/src/routes/+page.svelte
Normal file
2
webapp/src/routes/+page.svelte
Normal 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>
|
||||
@ -1,15 +0,0 @@
|
||||
<main class="p-4 text-gray-300">
|
||||
<svg height="100%" width="100%">
|
||||
<line x1=0 y1=4 x2=400 y2=4/>
|
||||
<line x1=0 y1=34 x2=200 y2=34/>
|
||||
<line x1=0 y1=64 x2=300 y2=64/>
|
||||
<line x1=0 y1=94 x2=280 y2=94/>
|
||||
</svg>
|
||||
</main>
|
||||
|
||||
<style>
|
||||
svg line {
|
||||
stroke: currentColor;
|
||||
stroke-width: 12;
|
||||
}
|
||||
</style>
|
||||
@ -1,25 +0,0 @@
|
||||
<script>
|
||||
import Navbar from "./menu/_Navbar.svelte";
|
||||
import Sidebar from "./menu/_Sidebar.svelte";
|
||||
|
||||
let open = false;
|
||||
</script>
|
||||
|
||||
<main class="w-full h-full">
|
||||
<Sidebar bind:open/>
|
||||
<Navbar bind:sidebar={open}/>
|
||||
|
||||
<slot></slot>
|
||||
</main>
|
||||
|
||||
<style>
|
||||
:global(body) {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
main {
|
||||
max-width: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,6 +0,0 @@
|
||||
<svelte:head>
|
||||
<title>About</title>
|
||||
</svelte:head>
|
||||
|
||||
<h1>About this site</h1>
|
||||
<p>TODO ...</p>
|
||||
@ -1,12 +0,0 @@
|
||||
<script>
|
||||
import Main from "./_Main.svelte";
|
||||
|
||||
export let name = "Test 2";
|
||||
</script>
|
||||
|
||||
<main class="w-full h-full">
|
||||
<h1>Welcome to SvelteKit</h1>
|
||||
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
|
||||
|
||||
<Main name={name} />
|
||||
</main>
|
||||
@ -1,44 +0,0 @@
|
||||
<script>
|
||||
export let open = false
|
||||
</script>
|
||||
|
||||
<button class="text-gray-500 hover:text-gray-700 cursor-pointer mr-4 border-none focus:outline-none" class:open on:click={() => open = !open}>
|
||||
<svg width=32 height=24>
|
||||
<line id="top" x1=0 y1=2 x2=32 y2=2/>
|
||||
<line id="middle" x1=0 y1=12 x2=24 y2=12/>
|
||||
<line id="bottom" x1=0 y1=22 x2=32 y2=22/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<style>
|
||||
svg {
|
||||
min-height: 24px;
|
||||
transition: transform 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
svg line {
|
||||
stroke: currentColor;
|
||||
stroke-width: 3;
|
||||
transition: transform 0.3s ease-in-out
|
||||
}
|
||||
|
||||
button {
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.open svg {
|
||||
transform: scale(0.7)
|
||||
}
|
||||
|
||||
.open #top {
|
||||
transform: translate(6px, 0px) rotate(45deg)
|
||||
}
|
||||
|
||||
.open #middle {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.open #bottom {
|
||||
transform: translate(-12px, 9px) rotate(-45deg)
|
||||
}
|
||||
</style>
|
||||
@ -1,9 +0,0 @@
|
||||
<svg width=auto height=30>
|
||||
<text x=0 y=20>ACME</text>
|
||||
</svg>
|
||||
|
||||
<style>
|
||||
text {
|
||||
fill: currentColor
|
||||
}
|
||||
</style>
|
||||
|
Before Width: | Height: | Size: 111 B |
@ -1,4 +0,0 @@
|
||||
<nav class="hidden text-gray-500 uppercase text-bold sm:block">
|
||||
<a href="/" class="hover:text-gray-700 hover:no-underline">Home</a>
|
||||
<a href="/about" class="hover:text-gray-700 hover:no-underline">About</a>
|
||||
</nav>
|
||||
@ -1,16 +0,0 @@
|
||||
<script>
|
||||
import Logo from './_Logo.svelte';
|
||||
import Hamburger from './_Hamburger.svelte';
|
||||
import Menu from './_Menu.svelte';
|
||||
|
||||
export let sidebar = false;
|
||||
</script>
|
||||
|
||||
<header class="flex justify-between bg-gray-200 p-2 items-center text-gray-600 border-b-2">
|
||||
<nav class="flex">
|
||||
<Hamburger bind:open={sidebar}/>
|
||||
<Logo/>
|
||||
</nav>
|
||||
|
||||
<Menu/>
|
||||
</header>
|
||||
@ -1,21 +0,0 @@
|
||||
<script>
|
||||
export let open = false
|
||||
</script>
|
||||
|
||||
<aside class="absolute w-full h-full bg-gray-200 border-r-2 shadow-lg" class:open>
|
||||
<nav class="p-12 text-xl">
|
||||
<a class="block" href="/">Home</a>
|
||||
<a class="block" href="/about">About</a>
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
<style>
|
||||
aside {
|
||||
left: -100%;
|
||||
transition: left 0.3s ease-in-out
|
||||
}
|
||||
|
||||
.open {
|
||||
left: 0
|
||||
}
|
||||
</style>
|
||||
@ -1,12 +1,17 @@
|
||||
import adapter from '@sveltejs/adapter-static';
|
||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
kit: {
|
||||
adapter: adapter(),
|
||||
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
|
||||
// for more information about preprocessors
|
||||
preprocess: vitePreprocess(),
|
||||
|
||||
// hydrate the <div id="svelte"> element in src/app.html
|
||||
target: '#svelte'
|
||||
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(),
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
19
webapp/tsconfig.json
Normal file
19
webapp/tsconfig.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"extends": "./.svelte-kit/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"moduleResolution": "bundler"
|
||||
}
|
||||
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
|
||||
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
|
||||
//
|
||||
// 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
webapp/vite.config.ts
Normal file
6
webapp/vite.config.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [sveltekit()]
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user