├── .browserslistrc ├── .eslintrc.js ├── .github └── ISSUE_TEMPLATE │ └── meteor-crisis-challenge-submission.md ├── .gitignore ├── .prettierrc ├── README.md ├── babel.config.js ├── jsconfig.json ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── images │ ├── astronaut-laptop.png │ ├── astronaut-rocket.png │ ├── background-dashboard.png │ ├── background-planet.jpg │ ├── github-logo.svg │ ├── netliheart.svg │ └── vue-logo.svg └── index.html ├── src ├── App.vue ├── components │ ├── AppFooter.vue │ ├── HomeScreen.vue │ ├── MiniGame.vue │ ├── PasswordGame.vue │ ├── SequenceGame.vue │ ├── VictoryScreen.vue │ ├── WelcomeScreen.vue │ └── WireGame.vue ├── constants.js ├── main.js └── utils │ └── canvasConfetti.js └── yarn.lock /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | extends: ["plugin:vue/vue3-essential", "eslint:recommended", "@vue/prettier"], 7 | parserOptions: { 8 | parser: "babel-eslint" 9 | }, 10 | rules: { 11 | "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", 12 | "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off" 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/meteor-crisis-challenge-submission.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Meteor Crisis Challenge Submission 3 | about: To allow people to show off their solution 4 | title: 'MCC Solution: {{ username }}' 5 | labels: mcc-solutions 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Meta 11 | 12 | - Name: 13 | - GitHub Repo: 14 | - Deployed App URL: 15 | 16 | ## Notes 17 | 18 | Anything additional you want to share with the community! 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | 25 | # Local Netlify folder 26 | .netlify -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true 4 | } 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Jamstack Explorers: Launching with Composition API 2 | 3 | Learn about Vue.js 3's Composition API in this free course on [Jamstack Explorers](https://explorers.netlify.com/learn/launching-with-composition-api?utm_source=twitter&utm_medium=je-comp-api-mis-bh&utm_campaign=devex)! 4 | 5 | Built and powered by [Netlify](https://www.netlify.com/?utm_source=github&utm_medium=launch-comp-bh&utm_campaign=devex). 6 | 7 | ## 🔗 Links 8 | 9 | - [👨‍🚀 Free Video Course](https://explorers.netlify.com/learn/launching-with-composition-api?utm_source=twitter&utm_medium=je-comp-api-mis-bh&utm_campaign=devex) 10 | - [🦄 Live Demo](https://explorers-composition-api.netlify.app/?utm_source=twitter&utm_medium=expcompapi-bh&utm_campaign=devex) 11 | - [📚 Vue.js Docs](https://v3.vuejs.org/) 12 | 13 | ## 📋 Project Setup 14 | 15 | ```bash 16 | # Install dependencies 17 | yarn install 18 | 19 | # Start local dev server 20 | yarn dev 21 | 22 | # Build production files in dist folder 23 | yarn build 24 | ``` 25 | 26 | ## 📑 Branches 27 | 28 | - [Reactive Data: Begin](https://github.com/netlify/explorers-composition-api/tree/reactive-data-begin) 29 | - [Reactive Data: Challenge](https://github.com/netlify/explorers-composition-api/tree/reactive-data-challenge) 30 | - [Computed Properties: Begin](https://github.com/netlify/explorers-composition-api/tree/computed-properties-begin) 31 | - [Computed Properties: Challenge](https://github.com/netlify/explorers-composition-api/tree/computed-properties-challenge) 32 | - [Methods: Begin](https://github.com/netlify/explorers-composition-api/tree/methods-begin) 33 | - [Methods: Challenge](https://github.com/netlify/explorers-composition-api/tree/methods-challenge) 34 | - [Lifecycle Hooks: Begin](https://github.com/netlify/explorers-composition-api/tree/lifecycle-hooks-begin) 35 | - [Lifecycle Hooks: Challenge](https://github.com/netlify/explorers-composition-api/tree/lifecycle-hooks-challenge) 36 | - [Watch: Begin](https://github.com/netlify/explorers-composition-api/tree/watch-begin) 37 | - [Watch: Challenge](https://github.com/netlify/explorers-composition-api/tree/watch-challenge) 38 | - [Meteor Crisis Challenge](https://github.com/netlify/explorers-composition-api/tree/meteor-crisis-challenge) 39 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ["@vue/cli-plugin-babel/preset"] 3 | }; 4 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["./src/**/*"] 3 | } 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "explorers-composition-api", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "yarn run serve", 7 | "serve": "vue-cli-service serve", 8 | "build": "vue-cli-service build", 9 | "lint": "vue-cli-service lint" 10 | }, 11 | "dependencies": { 12 | "canvas-confetti": "^1.3.2", 13 | "core-js": "^3.6.5", 14 | "vue": "^3.0.0" 15 | }, 16 | "devDependencies": { 17 | "@vue/cli-plugin-babel": "~4.5.0", 18 | "@vue/cli-plugin-eslint": "~4.5.0", 19 | "@vue/cli-service": "~4.5.0", 20 | "@vue/compiler-sfc": "^3.0.0", 21 | "@vue/eslint-config-prettier": "^6.0.0", 22 | "babel-eslint": "^10.1.0", 23 | "eslint": "^6.7.2", 24 | "eslint-plugin-prettier": "^3.1.3", 25 | "eslint-plugin-vue": "^7.0.0-0", 26 | "lint-staged": "^9.5.0", 27 | "prettier": "^1.19.1" 28 | }, 29 | "gitHooks": { 30 | "pre-commit": "lint-staged" 31 | }, 32 | "lint-staged": { 33 | "*.{js,jsx,vue}": [ 34 | "vue-cli-service lint", 35 | "git add" 36 | ] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netlify/explorers-composition-api/b38a6c3a805ffd1685acd676aac2f40c1c4dd227/public/favicon.ico -------------------------------------------------------------------------------- /public/images/astronaut-laptop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netlify/explorers-composition-api/b38a6c3a805ffd1685acd676aac2f40c1c4dd227/public/images/astronaut-laptop.png -------------------------------------------------------------------------------- /public/images/astronaut-rocket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netlify/explorers-composition-api/b38a6c3a805ffd1685acd676aac2f40c1c4dd227/public/images/astronaut-rocket.png -------------------------------------------------------------------------------- /public/images/background-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netlify/explorers-composition-api/b38a6c3a805ffd1685acd676aac2f40c1c4dd227/public/images/background-dashboard.png -------------------------------------------------------------------------------- /public/images/background-planet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netlify/explorers-composition-api/b38a6c3a805ffd1685acd676aac2f40c1c4dd227/public/images/background-planet.jpg -------------------------------------------------------------------------------- /public/images/github-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | github-logo 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /public/images/netliheart.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /public/images/vue-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 13 | 17 | <%= htmlWebpackPlugin.options.title %> 18 | 19 | 20 | 27 |
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 93 | 94 | 129 | 130 | 260 | -------------------------------------------------------------------------------- /src/components/AppFooter.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 64 | -------------------------------------------------------------------------------- /src/components/HomeScreen.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 48 | 49 | 76 | -------------------------------------------------------------------------------- /src/components/MiniGame.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 37 | 38 | 53 | -------------------------------------------------------------------------------- /src/components/PasswordGame.vue: -------------------------------------------------------------------------------- 1 | 60 | 61 | 88 | 89 | 141 | -------------------------------------------------------------------------------- /src/components/SequenceGame.vue: -------------------------------------------------------------------------------- 1 | 76 | 77 | 126 | 127 | 186 | -------------------------------------------------------------------------------- /src/components/VictoryScreen.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 42 | 43 | 65 | -------------------------------------------------------------------------------- /src/components/WelcomeScreen.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 47 | 48 | 85 | -------------------------------------------------------------------------------- /src/components/WireGame.vue: -------------------------------------------------------------------------------- 1 | 102 | 103 | 174 | 175 | 239 | -------------------------------------------------------------------------------- /src/constants.js: -------------------------------------------------------------------------------- 1 | export const WIRE_OPTIONS = [ 2 | { 3 | label: 'red' 4 | }, 5 | { 6 | label: 'yellow' 7 | }, 8 | { 9 | label: 'limegreen' 10 | }, 11 | { 12 | label: 'cyan' 13 | } 14 | ] 15 | 16 | export const PASSWORD_STATUS = { 17 | NEUTRAL: 'access-locked', 18 | FAIL: 'access-denied', 19 | PASS: 'access-granted' 20 | } 21 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import App from './App.vue' 3 | 4 | createApp(App).mount('#app') 5 | -------------------------------------------------------------------------------- /src/utils/canvasConfetti.js: -------------------------------------------------------------------------------- 1 | import confetti from 'canvas-confetti' 2 | 3 | export const launchConfetti = () => { 4 | var duration = 5000 5 | var animationEnd = Date.now() + duration 6 | var skew = 1 7 | 8 | function randomInRange(min, max) { 9 | return Math.random() * (max - min) + min 10 | } 11 | 12 | const frame = () => { 13 | var timeLeft = animationEnd - Date.now() 14 | var ticks = Math.max(200, 500 * (timeLeft / duration)) 15 | skew = Math.max(0.8, skew - 0.001) 16 | 17 | confetti({ 18 | particleCount: 1, 19 | startVelocity: 0, 20 | ticks: ticks, 21 | gravity: 0.5, 22 | origin: { 23 | x: Math.random(), 24 | // since particles fall down, skew start toward the top 25 | y: Math.random() * skew - 0.2 26 | }, 27 | colors: ['#ffffff'], 28 | shapes: ['circle'], 29 | scalar: randomInRange(0.4, 1) 30 | }) 31 | 32 | if (timeLeft > 0) { 33 | requestAnimationFrame(frame) 34 | } 35 | } 36 | 37 | frame() 38 | } 39 | --------------------------------------------------------------------------------