Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/keaPublic

Commit1ab9d4b

Browse files
committed
Merge branch 'master' of github.com:keajs/kea
2 parentsb925b80 +72ef299 commit1ab9d4b

File tree

96 files changed

+10496
-13938
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+10496
-13938
lines changed

‎.babelrc‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"@babel/preset-typescript"
1212
],
1313
"plugins": [
14-
"transform-babel-env-inline",
1514
"@babel/plugin-syntax-dynamic-import",
1615
"@babel/plugin-syntax-import-meta",
1716
["@babel/plugin-proposal-class-properties", {"loose":true }],
@@ -55,7 +54,6 @@
5554
"@babel/preset-react"
5655
],
5756
"plugins": [
58-
"transform-babel-env-inline",
5957
"@babel/plugin-syntax-dynamic-import",
6058
"@babel/plugin-syntax-import-meta",
6159
["@babel/plugin-proposal-class-properties", {"loose":true }],

‎.eslintrc.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ module.exports = {
1010
rules:{
1111
'@typescript-eslint/no-unused-vars':'off',
1212
'@typescript-eslint/explicit-function-return-type':'off',
13+
'@typescript-eslint/no-empty-function':'off',
1314
},
1415
}

‎CHANGELOG.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ const logic = kea({
162162

163163
##2.4.0 - 2021-05-02
164164

165-
-**Possibly Breaking:** Changed the[default path](https://kea.js.org/docs/guide/debugging#logic-path) for logic
165+
-**Possibly Breaking:** Changed the[default path](https://v2.keajs.org/docs/guide/debugging#logic-path) for logic
166166
without a`path` (or when not using the kea babel plugin) from`kea.inline` to`kea.logic`. If you have ever hardcoded
167167
`"kea.inline"` anywhere, perhaps in tests, this will cause a bit of headache. If you need it set at`kea.inline`, use
168168
`resetContext({ defaultPath: ['kea', 'inline'] })`.
@@ -222,7 +222,7 @@ const logic = kea({
222222

223223
##2.2.0 - 2020-09-08
224224

225-
-[TypeScript support](https://kea.js.org/docs/guide/typescript)!
225+
-[TypeScript support](https://v2.keajs.org/docs/guide/typescript)!
226226
- Fix bug with the store being created twice.[#111](https://github.com/keajs/kea/issues/111)
227227
- No other breaking changes.
228228

@@ -256,7 +256,7 @@ described below. Read the announcement blog post to get more context: https://ke
256256

257257
There's also a new babel plugin you might want to check out:https://github.com/keajs/babel-plugin-kea
258258

259-
Finally, Kea 2.0 comes with brand new docs on[https://kea.js.org](https://kea.js.org).
259+
Finally, Kea 2.0 comes with brand new docs on[https://v2.keajs.org](https://v2.keajs.org).
260260
(Old docs for[1.0](https://kea-v1.netlify.app/guide/installation) and[0.28](https://5d7a15398fdb1e00073ed27f--kea-v1.netlify.app/))
261261

262262
###Breaking change
@@ -325,7 +325,7 @@ There are too many changes to list here. See [this document](https://github.com/
325325

326326
- Kea now supports plugins!
327327
- The previous saga functionality has moved to[kea-saga](https://github.com/keajs/kea-saga). Please install it to continue using sagas!
328-
- There's a new function,[`getStore`](https://kea.js.org/api/store), which greatly simplifies configuring your store, especially when importing plugins.
328+
- There's a new function,[`getStore`](https://v0.keajs.org/api/store), which greatly simplifies configuring your store, especially when importing plugins.
329329

330330
###Removed deprecations
331331

‎README.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66

77
![Kea Logo](https://keajs.org/img/logo.svg)
88

9-
#Kea v2
9+
#Kea v3
10+
11+
**🗞🚨🗞🚨 Subscribe to the[Kea Newsletter](https://keajs.ck.page/80aecebec7) to keep up to date with latest news! 🗞🚨🗞🚨**
12+
13+
[Read the documentation](https://keajs.org/)
1014

11-
Open the[documentation](https://keajs.org/) and read from there.
1215

1316
##Thank you to our backers!
1417

‎docs/CHANGES-1.0.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ These are in incubation for now and will be released soon. Either with 1.0 or so
796796
797797
#### kea-next
798798
799-
Next.js will be an officially first class citizen with Kea 1.0. I'm porting the [https://kea.js.org/](kea.js.org) website over to it. See [this repository](https://github.com/keajs/kea-next-test/) and its issue for the current status.
799+
Next.js will be an officially first class citizen with Kea 1.0. I'm porting the [https://v1.keajs.org/](kea.js.org) website over to it. See [this repository](https://github.com/keajs/kea-next-test/) and its issue for the current status.
800800
801801
#### kea-listeners
802802

‎package.json‎

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"kea",
3-
"version":"2.6.0",
3+
"version":"3.0.0",
44
"description":"Smart front-end architecture",
55
"author":"Marius Andra",
66
"license":"MIT",
@@ -34,17 +34,17 @@
3434
"test:types:watch":"npm run type-check -- --watch"
3535
},
3636
"files": [
37-
"es",
3837
"lib",
3938
"src",
4039
"README.md",
41-
"LICENSE.md"
40+
"LICENSE.md",
41+
"tsconfig.json"
4242
],
4343
"jest": {
4444
"testMatch": [
4545
"<rootDir>/test/jest/*"
4646
],
47-
"testEnvironment":"node",
47+
"testEnvironment":"jsdom",
4848
"setupFilesAfterEnv": [
4949
"<rootDir>/jest-setup.js"
5050
]
@@ -88,17 +88,16 @@
8888
"@rollup/plugin-babel":"^5.3.0",
8989
"@rollup/plugin-commonjs":"^19.0.0",
9090
"@rollup/plugin-node-resolve":"^13.0.0",
91-
"@testing-library/jest-dom":"^5.14.1",
92-
"@testing-library/react":"^12.0.0",
93-
"@types/jest":"^24.0.25",
94-
"@types/react":"^17.0.13",
95-
"@types/react-redux":"^7.1.16",
91+
"@testing-library/jest-dom":"^5.16.4",
92+
"@testing-library/react":"^13.1.1",
93+
"@types/jest":"^27.4.1",
94+
"@types/react":"^18.0.6",
95+
"@types/react-redux":"^7.1.24",
9696
"@typescript-eslint/eslint-plugin":"^4.28.2",
9797
"@typescript-eslint/parser":"^4.28.2",
9898
"babel-core":"^7.0.0-bridge.0",
9999
"babel-eslint":"^10.1.0",
100-
"babel-jest":"^24.7.1",
101-
"babel-plugin-transform-babel-env-inline":"^0.0.1",
100+
"babel-jest":"^28.0.0",
102101
"cross-env":"^7.0.3",
103102
"eslint":"^7.30.0",
104103
"eslint-config-prettier":"^8.3.0",
@@ -107,23 +106,25 @@
107106
"eslint-plugin-prettier":"^3.4.0",
108107
"eslint-plugin-promise":"^5.1.0",
109108
"eslint-plugin-react":"^7.24.0",
110-
"jest":"^24.7.1",
109+
"jest":"^28.0.0",
110+
"jest-environment-jsdom":"^28.0.0",
111111
"jest-environment-node-debug":"^2.0.0",
112-
"jsdom":"^15.0.0",
113112
"npm-run-all-v2":"^1.0.0",
114113
"prettier":"^2.3.2",
115-
"prop-types":"^15.7.2",
116-
"react":"^17.0.2",
117-
"react-dom":"^17.0.2",
118-
"react-redux":"^7.0.1",
119-
"react-test-renderer":"^17.0.2",
120-
"redux":"^4.2.0",
121-
"reselect":"^4.1.5",
114+
"react":"^18.0.0",
115+
"react-dom":"^18.0.0",
116+
"react-redux":"^8.0.1",
117+
"react-test-renderer":"^18.0.0",
122118
"rimraf":"^3.0.2",
123119
"rollup":"^2.52.7",
124120
"rollup-plugin-dts":"^3.0.2",
125121
"rollup-plugin-typescript2":"^0.30.0",
126122
"tsd":"^0.17.0",
127-
"typescript":"^4.5.2"
123+
"typescript":"^4.6.3"
124+
},
125+
"dependencies": {
126+
"redux":"^4.2.0",
127+
"reselect":"^4.1.5",
128+
"use-sync-external-store":"^1.0.0"
128129
}
129130
}

‎playground/3.0/githubLogic.ts‎

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import{githubLogicType}from'./githubLogicType'
2+
import{kea}from'../../src'
3+
import{
4+
connect,
5+
actions,
6+
defaults,
7+
reducers,
8+
selectors,
9+
afterMount,
10+
listeners,
11+
key,
12+
props,
13+
path,
14+
}from'../../src/core'
15+
16+
constAPI_URL='https://api.github.com'
17+
18+
exporttypeRepository={
19+
id:number
20+
stargazers_count:number
21+
html_url:string
22+
full_name:string
23+
forks:number
24+
}
25+
26+
exportinterfaceGithubLogicProps{
27+
id:number
28+
}
29+
30+
exportconstgithubLogic=kea<githubLogicType<Repository,GithubLogicProps>>([
31+
path(['scenes','github','githubLogic']),
32+
props({}asGithubLogicProps),
33+
key((props)=>props.id),
34+
35+
actions({
36+
setUsername:(username:string)=>({ username}),
37+
setRepositories:(repositories:Repository[])=>({ repositories}),
38+
setFetchError:(error:string)=>({ error}),
39+
}),
40+
connect({
41+
actions:[],
42+
}),
43+
defaults({
44+
username:'keajs',
45+
repositories:[]asRepository[],
46+
}),
47+
{
48+
reducers:{
49+
username:{
50+
setUsername:(_,{ username})=>username,
51+
},
52+
},
53+
},
54+
reducers({
55+
username:{
56+
setUsername:(_,{ username})=>username,
57+
},
58+
repositories:{
59+
setUsername:()=>[],
60+
setRepositories:(_,{ repositories})=>repositories,
61+
},
62+
isLoading:[
63+
false,
64+
{
65+
setUsername:()=>true,
66+
setRepositories:()=>false,
67+
setFetchError:()=>false,
68+
},
69+
],
70+
error:[
71+
nullasstring|null,
72+
{
73+
setUsername:()=>null,
74+
setFetchError:(_,{ error})=>error,
75+
},
76+
],
77+
}),
78+
79+
selectors({
80+
sortedRepositories:[
81+
(s)=>[s.repositories],
82+
(repositories)=>{
83+
return[...repositories].sort((a,b)=>b.stargazers_count-a.stargazers_count)
84+
},
85+
],
86+
}),
87+
88+
listeners(({ actions})=>({
89+
setUsername:async({ username},breakpoint,action,fullState)=>{
90+
awaitbreakpoint(300)
91+
92+
consturl=`${API_URL}/users/${username}/repos?per_page=250`
93+
94+
// 👈 handle network errors
95+
letresponse
96+
try{
97+
response=awaitwindow.fetch(url)
98+
}catch(error:any){
99+
actions.setFetchError(error.message)
100+
return// 👈 nothing to do after, so return
101+
}
102+
103+
// break if action was dispatched again while we were fetching
104+
breakpoint()
105+
106+
constjson=awaitresponse.json()
107+
108+
if(response.status===200){
109+
actions.setRepositories(json)
110+
}else{
111+
actions.setFetchError(json.message)
112+
}
113+
},
114+
})),
115+
116+
afterMount(({ actions, values})=>{
117+
actions.setUsername(values.username)
118+
}),
119+
])

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp