From 75aed63005b1b648ae8f3b22025469ae8c044e4e Mon Sep 17 00:00:00 2001 From: Daniel Svitan Date: Mon, 4 Mar 2024 18:35:01 +0100 Subject: [PATCH] :tada: Commits project --- .gitignore | 28 +++++++++ README.md | 18 ++++++ index.html | 20 +++++++ package.json | 24 ++++++++ postcss.config.js | 6 ++ public/binary.png | Bin 0 -> 2463 bytes public/chevron.svg | 3 + src/App.vue | 123 ++++++++++++++++++++++++++++++++++++++ src/assets/vue.svg | 1 + src/components/Bit.vue | 11 ++++ src/components/Group.vue | 15 +++++ src/components/Number.vue | 59 ++++++++++++++++++ src/composables/levels.ts | 80 +++++++++++++++++++++++++ src/index.css | 3 + src/main.ts | 5 ++ src/vite-env.d.ts | 1 + tailwind.config.js | 8 +++ tsconfig.json | 25 ++++++++ tsconfig.node.json | 11 ++++ vite.config.ts | 7 +++ 20 files changed, 448 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 index.html create mode 100644 package.json create mode 100644 postcss.config.js create mode 100644 public/binary.png create mode 100644 public/chevron.svg create mode 100644 src/App.vue create mode 100644 src/assets/vue.svg create mode 100644 src/components/Bit.vue create mode 100644 src/components/Group.vue create mode 100644 src/components/Number.vue create mode 100644 src/composables/levels.ts create mode 100644 src/index.css create mode 100644 src/main.ts create mode 100644 src/vite-env.d.ts create mode 100644 tailwind.config.js create mode 100644 tsconfig.json create mode 100644 tsconfig.node.json create mode 100644 vite.config.ts 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 0000000000000000000000000000000000000000..a7277d0a33e8e87b5c3e9535f1073dfd4410ebcc GIT binary patch literal 2463 zcmbtWdo+|=8{dO6xfBvYE-5jbB#A?si4kLRi_~!s8ROEpW{Po1CYRhvF_n^tC~`TB z>&cx6xlC?z+*4#KVrH20TIauSeP^xj>%4ot`+fFr@3o(2Kfm98)*EYKW+ccb$p-)s z#2BN`0|0|e7=Z7DKKA|v?$F>C-oU^DV_+cX>rZgUdtU)SDTS1xXZ!{w-QqN0Vu*Mm zChFI2@!<25gNYSeGwUuj( zV>wv9UtILGm)oczNz~v73pI_me9geL>aF#`qwZxzE-U-Oc-|$!1UkBp&mB^ZO`QHD zbGm-Q@Vd=>KzO2~CQiNah)CPL%O9Ghnl-X3o3207?v5)n2{k))xqnBjY;_5d-C9jA zYt(q-uA^x#ttiIt^P*f`B}4 zT_R|uf+x3*d!zA#n9}4Yn?znt%%{xuyyPODvxz&bbIx4bq=&Ci?Np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001 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()], +});