commit 75aed63005b1b648ae8f3b22025469ae8c044e4e Author: Daniel Svitan Date: Mon Mar 4 18:35:01 2024 +0100 :tada: Commits project diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7975c0f --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +bun.lockb +package-lock.json +.vscode/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..ef72fd5 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# Vue 3 + TypeScript + Vite + +This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 ` + + + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..263a246 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "binary", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vue-tsc && vite build", + "preview": "vite preview" + }, + "dependencies": { + "vue": "^3.4.19" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^5.0.4", + "autoprefixer": "^10.4.18", + "postcss": "^8.4.35", + "prettier": "^3.2.5", + "tailwindcss": "^3.4.1", + "typescript": "^5.2.2", + "vite": "^5.1.4", + "vue-tsc": "^1.8.27" + } +} diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..2e7af2b --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/public/binary.png b/public/binary.png new file mode 100644 index 0000000..a7277d0 Binary files /dev/null and b/public/binary.png differ diff --git a/public/chevron.svg b/public/chevron.svg new file mode 100644 index 0000000..ecffedd --- /dev/null +++ b/public/chevron.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..afd4d00 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,123 @@ + + + diff --git a/src/assets/vue.svg b/src/assets/vue.svg new file mode 100644 index 0000000..770e9d3 --- /dev/null +++ b/src/assets/vue.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/Bit.vue b/src/components/Bit.vue new file mode 100644 index 0000000..1a88071 --- /dev/null +++ b/src/components/Bit.vue @@ -0,0 +1,11 @@ + + + diff --git a/src/components/Group.vue b/src/components/Group.vue new file mode 100644 index 0000000..21e9bef --- /dev/null +++ b/src/components/Group.vue @@ -0,0 +1,15 @@ + + + diff --git a/src/components/Number.vue b/src/components/Number.vue new file mode 100644 index 0000000..87cfe94 --- /dev/null +++ b/src/components/Number.vue @@ -0,0 +1,59 @@ + + + diff --git a/src/composables/levels.ts b/src/composables/levels.ts new file mode 100644 index 0000000..baea346 --- /dev/null +++ b/src/composables/levels.ts @@ -0,0 +1,80 @@ +export interface Level { + name: string; + generate: () => Problem; +} + +export interface Problem { + a: number; + operator: string; + b: number; + answer: number; +} + +export function random(max: number) { + return Math.floor(Math.random() * max); +} + +function AdditionLevel(level: 1 | 2 | 3): Level { + return { + name: `Addition Level ${level}`, + generate: () => { + const a = random(2 ** (4 * level)); + const b = random(2 ** (4 * level)); + const answer = a + b; + + return { a, operator: "+", b, answer }; + }, + }; +} + +function SubtractionLevel(level: 1 | 2 | 3): Level { + return { + name: `Subtraction Level ${level}`, + generate: () => { + const a = random(2 ** (4 * level)); + const b = random(2 ** (4 * level)); + const answer = a - b; + + return { a, operator: "-", b, answer }; + }, + }; +} + +function MultiplicationLevel(level: 1 | 2): Level { + return { + name: `Multiplication Level ${level}`, + generate: () => { + const a = random(2 ** (4 * level)); + const b = random(2 ** (4 * level)); + const answer = a * b; + + return { a, operator: "*", b, answer }; + }, + }; +} + +function DivisionLevel(level: 1 | 2): Level { + return { + name: `Division Level ${level}`, + generate: () => { + const a = random(2 ** (4 * level)); + const b = random(2 ** (4 * level)); + const answer = a / b; + + return { a, operator: "/", b, answer }; + }, + }; +} + +export const levels: Level[] = [ + AdditionLevel(1), + SubtractionLevel(1), + AdditionLevel(2), + SubtractionLevel(2), + AdditionLevel(3), + SubtractionLevel(3), + MultiplicationLevel(1), + DivisionLevel(1), + MultiplicationLevel(2), + DivisionLevel(2), +]; diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..b5c61c9 --- /dev/null +++ b/src/index.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..334a235 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,5 @@ +import { createApp } from "vue"; +import App from "./App.vue"; +import "./index.css"; + +createApp(App).mount("#app"); diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/tailwind.config.js b/tailwind.config.js new file mode 100644 index 0000000..45ce112 --- /dev/null +++ b/tailwind.config.js @@ -0,0 +1,8 @@ +/** @type {import('tailwindcss').Config} */ +export default { + content: ["./index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"], + theme: { + extend: {}, + }, + plugins: [], +}; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..9e03e60 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "preserve", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/tsconfig.node.json b/tsconfig.node.json new file mode 100644 index 0000000..97ede7e --- /dev/null +++ b/tsconfig.node.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true, + "strict": true + }, + "include": ["vite.config.ts"] +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..0a8bd80 --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from "vite"; +import vue from "@vitejs/plugin-vue"; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [vue()], +});