Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: 1.0.0 Beta #59

Merged
merged 35 commits into from
Feb 16, 2020
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f9ca045
feat: init beta
alvinhui Feb 11, 2020
fb28ac4
refactor: test and examples
alvinhui Feb 11, 2020
fe0085e
refactor: connect
alvinhui Feb 11, 2020
d5dba50
Merge remote-tracking branch 'origin/release/1.0.0' into release/1.0.…
alvinhui Feb 11, 2020
c5a948e
chore: lint
alvinhui Feb 11, 2020
bebf01b
chore: types
alvinhui Feb 11, 2020
9fc4f33
chore: lint
alvinhui Feb 11, 2020
aec249e
refactor: use Provider to handle initialStates
alvinhui Feb 13, 2020
72aa37a
fix: use this for actions
alvinhui Feb 13, 2020
ea88315
refactor: prevState for effects funcionts and async state for model
alvinhui Feb 13, 2020
a596be5
chore: use transform
alvinhui Feb 14, 2020
5874de9
feat: add memo deps
alvinhui Feb 14, 2020
85cba89
chore: isLoading
alvinhui Feb 14, 2020
8811dc7
chore: delete unnecessary code
alvinhui Feb 14, 2020
26f3b8c
chore: better demo
alvinhui Feb 14, 2020
2f8d1db
chore: better demo
alvinhui Feb 14, 2020
f503eb2
chore: less code
alvinhui Feb 14, 2020
50b38d7
feat: effect state
alvinhui Feb 14, 2020
27ae41f
chore: createModelContainer
alvinhui Feb 14, 2020
f0fca93
chore: lint
alvinhui Feb 14, 2020
94c55fc
refactor: delete this
alvinhui Feb 14, 2020
400939c
chore: rewrite REAMDE
alvinhui Feb 14, 2020
f370e75
feat: initialStates
alvinhui Feb 14, 2020
2906193
refactor: createModel
alvinhui Feb 15, 2020
31832af
refactor: model define
alvinhui Feb 15, 2020
28fd3fc
refactor: actions params
alvinhui Feb 15, 2020
52097f2
refactor: withStore
alvinhui Feb 16, 2020
7b9f8b0
feat: withModel && withModels
alvinhui Feb 16, 2020
1d5190c
refactor: effect to action
alvinhui Feb 16, 2020
a48f178
chore: class && function component
alvinhui Feb 16, 2020
9de838f
chore: lint
alvinhui Feb 16, 2020
5c852ff
feat: withModelActions && withModelActionsState
alvinhui Feb 16, 2020
71255c0
chore: lint
alvinhui Feb 16, 2020
7940a6a
chore: types
alvinhui Feb 16, 2020
a86add4
chore: effect to action
alvinhui Feb 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
669 changes: 0 additions & 669 deletions README.md

This file was deleted.

665 changes: 76 additions & 589 deletions README.zh-CN.md

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions examples/todos-ts/package.json

This file was deleted.

15 changes: 0 additions & 15 deletions examples/todos-ts/public/index.html

This file was deleted.

141 changes: 0 additions & 141 deletions examples/todos-ts/src/index.tsx

This file was deleted.

24 changes: 0 additions & 24 deletions examples/todos-ts/src/stores/index.ts

This file was deleted.

55 changes: 0 additions & 55 deletions examples/todos-ts/src/stores/todos.ts

This file was deleted.

35 changes: 0 additions & 35 deletions examples/todos-ts/src/stores/user.ts

This file was deleted.

File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions examples/todos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"name": "todos",
"version": "1.0.0",
"private": true,
"main": "src/index.js",
"dependencies": {
"@ice/store": "^0.4.x",
"@ice/store-logger": "^0.1.x",
"@ice/store": "^1.0.0",
"react": "16.8.6",
"react-dom": "16.8.6"
},
"devDependencies": {
"css-modules-typescript-loader": "^2.0.4",
"ice-plugin-fusion": "^0.1.4",
"ice-plugin-moment-locales": "^0.1.0",
"ice-scripts": "^2.0.0"
},
"scripts": {
Expand Down
23 changes: 23 additions & 0 deletions examples/todos/src/components/TodoAdd.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import store from '../store';

const { useModelActions } = store;

export default function TodoAdd() {
const { add } = useModelActions('todos');

console.debug('TodoAdd rending...');
return (
<input
onKeyDown={(event) => {
if (event.keyCode === 13) {
add({
name: event.currentTarget.value,
});
event.currentTarget.value = '';
}
}}
placeholder="Press Enter"
/>
);
}
44 changes: 44 additions & 0 deletions examples/todos/src/components/TodoList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';
import store from '../store';

const { useModel, useModelActionsState } = store;

export function TodoList({ title, subTitle, dataSource }, { toggle, remove }, actionsState) {
return (
<div>
<h2>{title}</h2>
<p>
Now is using {subTitle}.
</p>
<ul>
{dataSource.map(({ name, done = false }, index) => (
<li key={index}>
<label>
<input
type="checkbox"
checked={done}
onChange={() => toggle(index)}
/>
{done ? <s>{name}</s> : <span>{name}</span>}
</label>
{
actionsState.remove.isLoading ?
'...deleting...' :
<button type="submit" onClick={() => remove(index)}>-</button>
}
</li>
))}
</ul>
</div>
);
}

export default function({ title }) {
const [ state, actions ] = useModel('todos');
const actionsState = useModelActionsState('todos');
return TodoList(
{ ...state, title, subTitle: 'Function Component' },
actions,
actionsState,
);
}
Loading