Skip to content

Commit 4d6a04e

Browse files
committed
feat(demo): added vuejs version
1 parent 41804f8 commit 4d6a04e

File tree

22 files changed

+390
-18
lines changed

22 files changed

+390
-18
lines changed

.idea/watcherTasks.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

package.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@
3434
"tslib": "1.9.3",
3535
"color-hash": "1.0.3",
3636
"vue": "2.5.16",
37-
"vue-hot-reload-api": "2.3.0"
37+
"vue-hot-reload-api": "2.3.0",
38+
"vue-styled-components": "^1.3.0"
3839
},
3940
"devDependencies": {
4041
"@types/jest": "23.1.4",
4142
"@types/react": "16.4.6",
4243
"@types/react-dom": "16.0.6",
44+
"@vue/component-compiler-utils": "2.1.0",
45+
"babel-plugin-transform-vue-jsx": "^3.7.0",
4346
"commitizen": "^2.10.1",
4447
"concurrently": "^3.6.0",
4548
"cz-customizable": "^5.2.0",
@@ -58,8 +61,10 @@
5861
"html-webpack-plugin": "^3.2.0",
5962
"husky": "^0.14.3",
6063
"jest": "23.3.0",
64+
"jsdom": "11.12.0",
6165
"lint-staged": "^7.2.0",
62-
"prettier": "1.13.7",
66+
"parcel-bundler": "1.9.7",
67+
"prettier": "^1.13.7",
6368
"react": "16.4.1",
6469
"react-test-renderer": "16.4.1",
6570
"repo-cooker": "^6.2.5",
@@ -69,15 +74,12 @@
6974
"tslib": "1.9.3",
7075
"typescript": "2.9.2",
7176
"typescript-eslint-parser": "^16.0.1",
72-
"webpack": "4.15.1",
73-
"webpack-cli": "3.0.8",
74-
"webpack-dev-server": "^3.1.4",
7577
"url-loader": "1.0.1",
76-
"@vue/component-compiler-utils": "2.1.0",
77-
"parcel-bundler": "1.9.7",
78-
"jsdom": "11.12.0",
7978
"vue": "2.5.16",
80-
"vue-template-compiler": "2.5.16"
79+
"vue-template-compiler": "2.5.16",
80+
"webpack": "4.15.1",
81+
"webpack-cli": "3.0.8",
82+
"webpack-dev-server": "^3.1.4"
8183
},
8284
"lint-staged": {
8385
"*.{js,ts,tsx}": [
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"plugins": ["transform-vue-jsx"]
3+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "vue-todomvc",
3+
"private": true,
4+
"version": "1.0.0",
5+
"description": "Overmind todomvc demo",
6+
"author": "Christian Alfoni <[email protected]>",
7+
"license": "MIT",
8+
"repository": "git+https://github.com/cerebral/overmind.git",
9+
"scripts": {
10+
"start": "parcel src/index.html --port 4000",
11+
"build": "parcel build src/index.html ",
12+
"test": "echo \"Error: no test specified\"",
13+
"prepare": "npm run build"
14+
},
15+
"keywords": [
16+
"overmind",
17+
"demo"
18+
],
19+
"dependencies": {
20+
"vue-overmind": "next",
21+
"color": "^3.0.0",
22+
"vue": "^2.5.16",
23+
"vue-styled-components": "^1.3.0"
24+
},
25+
"devDependencies": {
26+
"babel-plugin-transform-vue-jsx": "^3.7.0",
27+
"parcel-bundler": "^1.9.7"
28+
}
29+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import * as helpers from './helpers'
2+
import * as mutations from './mutations'
3+
4+
export default (action) => ({
5+
changeNewTodoTitle: action()
6+
.map(helpers.getEventValue)
7+
.mutation(mutations.setNewTodoTitle),
8+
addTodo: action()
9+
.do(helpers.preventEventDefault)
10+
.mutation(mutations.addTodo)
11+
.mutation(mutations.clearNewTodoTitle),
12+
toggleCompleted: action().mutation(mutations.toggleCompleted),
13+
})
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const say = {
2+
hello: (name) => ({ hello: `Hello ${name}` }),
3+
}
4+
5+
export const api = {
6+
getPosts: () =>
7+
fetch('https://jsonplaceholder.typicode.com/posts').then((response) =>
8+
response.json()
9+
),
10+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function getEventValue(_, event) {
2+
return Promise.resolve(event.currentTarget.value)
3+
}
4+
5+
export function preventEventDefault(_, event) {
6+
event.preventDefault()
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import App from 'vue-overmind'
2+
import * as effects from './effects'
3+
import actions from './actions'
4+
import state from './state'
5+
6+
const app = new App(
7+
{
8+
state,
9+
actions,
10+
effects,
11+
},
12+
{
13+
devtools: 'localhost:1234',
14+
}
15+
)
16+
17+
export const connect = app.connect
18+
19+
export default app
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
let nextTodoId = 0
2+
3+
export function setNewTodoTitle(state, value) {
4+
state.newTodoTitle = value
5+
}
6+
7+
export function addTodo(state) {
8+
state.todos.unshift({
9+
id: String(nextTodoId++),
10+
title: state.newTodoTitle,
11+
completed: false,
12+
})
13+
}
14+
15+
export function clearNewTodoTitle(state) {
16+
state.newTodoTitle = ''
17+
}
18+
19+
export function toggleCompleted(_, todo) {
20+
todo.completed = !todo.completed
21+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { derive, compute } from 'overmind'
2+
3+
const state = {
4+
todos: [],
5+
count: derive((state) => state.todos.length),
6+
newTodoTitle: '',
7+
testCount: compute((foo) => (state) => state.count + foo),
8+
}
9+
10+
export default state

0 commit comments

Comments
 (0)