svelte
This commit is contained in:
parent
7efac2bbfa
commit
5671385c00
24 changed files with 7513 additions and 15 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -0,0 +1 @@
|
|||
/result
|
11
flake.nix
11
flake.nix
|
@ -4,11 +4,20 @@
|
|||
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
pythonPkgs = pkgs.python39Packages;
|
||||
flakePkgs = rec {
|
||||
sm2 = pkgs.python39Packages.callPackage ./sm2 {};
|
||||
material = pkgs.callPackage ./material {};
|
||||
sm2 = pythonPkgs.callPackage ./sm2 {};
|
||||
};
|
||||
in rec {
|
||||
defaultPackage = packages.sm2;
|
||||
devShell = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
(python39.withPackages (p: with p; [
|
||||
flask
|
||||
]))
|
||||
];
|
||||
};
|
||||
packages = flake-utils.lib.flattenTree flakePkgs;
|
||||
});
|
||||
}
|
||||
|
|
19
material/README.md
Normal file
19
material/README.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
material
|
||||
===
|
||||
|
||||
This directory contains the material that's used in eduproj. The documents are
|
||||
all written using restructured text, chosen over markdown for its ability to
|
||||
specify more structured data while still appearing readable to humans.
|
||||
|
||||
Recognized fields
|
||||
---
|
||||
|
||||
General fields:
|
||||
|
||||
- `:title:` specifies the title that will be used when rendering it to a page.
|
||||
|
||||
- `:summary:` is a paragraph-long description of what the topic being discussed
|
||||
is, and will be included in hover boxes or info boxes when included in other
|
||||
pages.
|
||||
|
||||
|
0
material/caesar-cipher.rst
Normal file
0
material/caesar-cipher.rst
Normal file
6
material/default.nix
Normal file
6
material/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "material";
|
||||
phases = [];
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
.. TODO: split out into math proofs and formal proofs
|
||||
|
||||
:title: Proof
|
||||
|
||||
:subtopics:
|
||||
- induction
|
||||
|
||||
:summary:
|
||||
Proofs are arguments that present evidence that constructs an argument.
|
||||
|
1
result
1
result
|
@ -1 +0,0 @@
|
|||
/nix/store/gqxdrhrrpjadp664vj934mj5nhzk7y9f-sm2
|
|
@ -1,10 +1,10 @@
|
|||
{ buildPythonApplication, nix-gitignore, python, mypy }:
|
||||
{ buildPythonPackage, nix-gitignore, python, mypy }:
|
||||
|
||||
let
|
||||
pythonBuildInputs = [ ];
|
||||
pythonWithBuildInputs = python.withPackages (_: pythonBuildInputs);
|
||||
in
|
||||
buildPythonApplication {
|
||||
buildPythonPackage {
|
||||
name = "sm2";
|
||||
src = nix-gitignore.gitignoreSourcePure [ ../.gitignore ] ./.;
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
[build-system]
|
7
web/.editorconfig
Normal file
7
web/.editorconfig
Normal file
|
@ -0,0 +1,7 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
|
||||
[*.{svelte,ts}]
|
||||
indent_size = 2
|
20
web/.eslintrc.cjs
Normal file
20
web/.eslintrc.cjs
Normal file
|
@ -0,0 +1,20 @@
|
|||
module.exports = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
|
||||
plugins: ['svelte3', '@typescript-eslint'],
|
||||
ignorePatterns: ['*.cjs'],
|
||||
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
|
||||
settings: {
|
||||
'svelte3/typescript': () => require('typescript')
|
||||
},
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
ecmaVersion: 2019
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
es2017: true,
|
||||
node: true
|
||||
}
|
||||
};
|
5
web/.gitignore
vendored
Normal file
5
web/.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
7
web/.prettierrc
Normal file
7
web/.prettierrc
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"useTabs": false,
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"printWidth": 100
|
||||
}
|
38
web/README.md
Normal file
38
web/README.md
Normal 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 init svelte@next
|
||||
|
||||
# create a new project in my-app
|
||||
npm init svelte@next 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:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
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:
|
||||
|
||||
```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.
|
7222
web/package-lock.json
generated
Normal file
7222
web/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
30
web/package.json
Normal file
30
web/package.json
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "web",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "svelte-kit dev",
|
||||
"build": "svelte-kit build",
|
||||
"preview": "svelte-kit preview",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
|
||||
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/kit": "next",
|
||||
"@typescript-eslint/eslint-plugin": "^4.19.0",
|
||||
"@typescript-eslint/parser": "^4.19.0",
|
||||
"eslint": "^7.22.0",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
"eslint-plugin-svelte3": "^3.2.0",
|
||||
"node-sass": "^6.0.1",
|
||||
"prettier": "~2.2.1",
|
||||
"prettier-plugin-svelte": "^2.2.0",
|
||||
"svelte": "^3.34.0",
|
||||
"svelte-check": "^2.0.0",
|
||||
"svelte-preprocess": "^4.0.0",
|
||||
"tslib": "^2.0.0",
|
||||
"typescript": "^4.0.0"
|
||||
},
|
||||
"type": "module"
|
||||
}
|
12
web/src/app.html
Normal file
12
web/src/app.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
%svelte.head%
|
||||
</head>
|
||||
<body>
|
||||
<div id="svelte">%svelte.body%</div>
|
||||
</body>
|
||||
</html>
|
1
web/src/global.d.ts
vendored
Normal file
1
web/src/global.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/// <reference types="@sveltejs/kit" />
|
22
web/src/lib/QuizBox.svelte
Normal file
22
web/src/lib/QuizBox.svelte
Normal file
|
@ -0,0 +1,22 @@
|
|||
<script lang="ts">
|
||||
let state = "ask";
|
||||
</script>
|
||||
|
||||
<div class="quiz-box">
|
||||
{#if state == "ask" }
|
||||
<small>Q:</small>
|
||||
<p>what is 1 + 1?</p>
|
||||
<ul>
|
||||
</ul>
|
||||
{:else}
|
||||
<small>A:</small>
|
||||
<p>you Got it!</p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.quiz-box {
|
||||
border: 1px solid gray;
|
||||
border-radius: 8px;
|
||||
}
|
||||
</style>
|
58
web/src/routes/__layout.svelte
Normal file
58
web/src/routes/__layout.svelte
Normal file
|
@ -0,0 +1,58 @@
|
|||
<div id="app">
|
||||
<header class="header">
|
||||
<div class="brand"><a href="/">Edu</a></div>
|
||||
<nav class="header-nav">
|
||||
<ul class="list">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/login">Login</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<slot></slot>
|
||||
</div>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
#app {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 80px;
|
||||
|
||||
.brand {
|
||||
margin-right: 32px;
|
||||
}
|
||||
|
||||
.header-nav {
|
||||
flex-grow: 1;
|
||||
|
||||
.list {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-grow: 1;
|
||||
white-space: nowrap;
|
||||
margin-bottom: 0;
|
||||
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
justify-content: flex-end;
|
||||
|
||||
li {
|
||||
margin: 0;
|
||||
box-sizing: inherit;
|
||||
|
||||
a {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
padding: 0 32px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
7
web/src/routes/index.svelte
Normal file
7
web/src/routes/index.svelte
Normal file
|
@ -0,0 +1,7 @@
|
|||
<script lang="ts">
|
||||
import QuizBox from "$lib/QuizBox.svelte";
|
||||
</script>
|
||||
|
||||
<h1>Learn by mastery</h1>
|
||||
|
||||
<QuizBox />
|
BIN
web/static/favicon.png
Normal file
BIN
web/static/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
15
web/svelte.config.js
Normal file
15
web/svelte.config.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
import preprocess from 'svelte-preprocess';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
// Consult https://github.com/sveltejs/svelte-preprocess
|
||||
// for more information about preprocessors
|
||||
preprocess: preprocess(),
|
||||
|
||||
kit: {
|
||||
// hydrate the <div id="svelte"> element in src/app.html
|
||||
target: '#svelte'
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
31
web/tsconfig.json
Normal file
31
web/tsconfig.json
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"module": "es2020",
|
||||
"lib": ["es2020", "DOM"],
|
||||
"target": "es2019",
|
||||
/**
|
||||
svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript
|
||||
to enforce using \`import type\` instead of \`import\` for Types.
|
||||
*/
|
||||
"importsNotUsedAsValues": "error",
|
||||
"isolatedModules": true,
|
||||
"resolveJsonModule": true,
|
||||
/**
|
||||
To have warnings/errors of the Svelte compiler at the correct position,
|
||||
enable source maps by default.
|
||||
*/
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"baseUrl": ".",
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"paths": {
|
||||
"$lib": ["src/lib"],
|
||||
"$lib/*": ["src/lib/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"]
|
||||
}
|
Loading…
Reference in a new issue