From: Enrique Hernandez Date: Fri, 9 Oct 2020 04:17:47 +0000 (-0500) Subject: add animejs + wasm to vue X-Git-Tag: v0.9~143^2~2^2~8 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=c3562172c4338694f81ef673f4c69c74adcd6782;p=mime-chat add animejs + wasm to vue --- diff --git a/package.json b/package.json index 4ab9afd..1a0ee0d 100644 --- a/package.json +++ b/package.json @@ -14,12 +14,14 @@ }, "main": "background.js", "dependencies": { + "animejs": "^3.2.0", "core-js": "^3.6.5", "vue": "^3.0.0-0", "vue-router": "^4.0.0-0", "vuex": "^4.0.0-0" }, "devDependencies": { + "@types/animejs": "^3.1.2", "@types/jest": "^24.0.19", "@typescript-eslint/eslint-plugin": "^2.33.0", "@typescript-eslint/parser": "^2.33.0", diff --git a/src/App.vue b/src/App.vue index 3fa872e..00294f1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,30 +1,27 @@ diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue deleted file mode 100644 index 2e0174d..0000000 --- a/src/components/HelloWorld.vue +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - diff --git a/src/components/UI/UIDetails/messageItem.vue b/src/components/UI/UIDetails/messageItem.vue new file mode 100644 index 0000000..d6c572c --- /dev/null +++ b/src/components/UI/UIDetails/messageItem.vue @@ -0,0 +1,136 @@ + + + + + diff --git a/src/components/UI/UIDetails/messages.js b/src/components/UI/UIDetails/messages.js new file mode 100644 index 0000000..e52d0c9 --- /dev/null +++ b/src/components/UI/UIDetails/messages.js @@ -0,0 +1,52 @@ +const Messages = [ + { + content: + "I can be there at 5 pm tomorrow to greet you at a Chick file with my almond and chive salad.", + signature: "Tommy McConville", + outgoing: true, + modifier: "sf", + imgURL: "../assets/logo.png", + id: "1" + }, + { + content: "Sounds good, see you Thursday.", + signature: "Josie Wright", + outgoing: false, + modifier: "fr", + imgURL: "@/assets/logo.png", + id: "2" + }, + { + content: "Hey Anna, did you get the paper done?", + signature: "Tommy McConville", + outgoing: false, + modifier: "fr", + imgURL: "@/assets/logo.png", + id: "3" + }, + { + content: "Yes posting it online soon.", + signature: "Tommy McConville", + outgoing: true, + modifier: "sf", + imgURL: "../../assets/logo.png", + id: "4" + }, + { + content: "Sweet, thanks!", + signature: "Tommy McConville", + outgoing: false, + modifier: "fr", + imgURL: "../../assets/logo.png", + id: "5" + }, + { + content: "Hey do you know Enrique Hernandez?", + signature: "Crimata AI", + outgoing: false, + modifier: "ai", + imgURL: "../../assets/logo.png", + id: "6" + } +]; +export default Messages; diff --git a/src/components/UI/index.vue b/src/components/UI/index.vue new file mode 100644 index 0000000..f600984 --- /dev/null +++ b/src/components/UI/index.vue @@ -0,0 +1,205 @@ + + + + + diff --git a/src/main.ts b/src/main.ts index 0a91dca..bb65161 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,9 +1,12 @@ -import { createApp } from "vue"; +import { createApp, provide, inject } from "vue"; import App from "./App.vue"; import router from "./router"; import store from "./store"; +import anime from "animejs/lib/anime.es.js"; + createApp(App) .use(store) .use(router) + .provide("animejs", anime) .mount("#app"); diff --git a/src/plugins/anime.ts b/src/plugins/anime.ts new file mode 100644 index 0000000..7e2361d --- /dev/null +++ b/src/plugins/anime.ts @@ -0,0 +1,16 @@ +import { provide, inject } from "vue"; + +const animeSymbol = Symbol(); + +export function provideAnime(anime: any) { + provide(animeSymbol, anime); +} + +export function useAnime() { + const anime = inject(animeSymbol); + if (!anime) { + console.log("Error! Failed to provide AnimeJS"); + // throw error, no store provided + } + return anime; +} diff --git a/src/router/index.ts b/src/router/index.ts index a6021e1..0042003 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,25 +1,17 @@ -import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router' -import Home from '../views/Home.vue' +import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router"; +import HomeIndex from "../views/home/index.vue"; const routes: Array = [ { - path: '/', - name: 'Home', - component: Home - }, - { - path: '/about', - name: 'About', - // route level code-splitting - // this generates a separate chunk (about.[hash].js) for this route - // which is lazy-loaded when the route is visited. - component: () => import(/* webpackChunkName: "about" */ '../views/About.vue') + path: "/", + name: "Home", + component: HomeIndex } -] +]; const router = createRouter({ history: createWebHistory(process.env.BASE_URL), routes -}) +}); -export default router +export default router; diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts index 32a1b5c..04b9f56 100644 --- a/src/shims-vue.d.ts +++ b/src/shims-vue.d.ts @@ -1,5 +1,7 @@ -declare module '*.vue' { - import { defineComponent } from 'vue' - const component: ReturnType - export default component +declare module "*.vue" { + import { defineComponent } from "vue"; + const component: ReturnType; + export default component; } + +declare module "animejs/lib/anime.es.js"; diff --git a/src/views/About.vue b/src/views/About.vue deleted file mode 100644 index 3fa2807..0000000 --- a/src/views/About.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/views/Home.vue b/src/views/Home.vue deleted file mode 100644 index a0e857d..0000000 --- a/src/views/Home.vue +++ /dev/null @@ -1,24 +0,0 @@ - - - diff --git a/src/views/home/index.vue b/src/views/home/index.vue new file mode 100644 index 0000000..5954e38 --- /dev/null +++ b/src/views/home/index.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/yarn.lock b/yarn.lock index 55cfc11..694fda4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1173,6 +1173,11 @@ dependencies: defer-to-connect "^2.0.0" +"@types/animejs@^3.1.2": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@types/animejs/-/animejs-3.1.2.tgz#93289a902b0b9bfac3020d29413139dcca6acdbc" + integrity sha512-GyyuoztWbZMErx9brJQChvvfeMd5vplWU/H6BYVl7JUcLoMaDOVxlqF3d4ypB7TzXnbgnMSykGmjAVVRsvhHhQ== + "@types/anymatch@*": version "1.3.1" resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" @@ -2259,6 +2264,11 @@ amdefine@>=0.0.4: resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= +animejs@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/animejs/-/animejs-3.2.0.tgz#2daea7365983249022cc454fa726acdb4a84345d" + integrity sha512-zhtGl5cS0G2f5DfciMO8uwWpnx06nfFnHlXYYXHBazHep1Lyd6kEtBQP+9hpYKE0dBZjIigHp9VpMO95ZfXQJQ== + ansi-align@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.0.tgz#b536b371cf687caaef236c18d3e21fe3797467cb"