779 Commits

Author SHA1 Message Date
daishi
ef46c68641 4.0.0-rc.2 v4.0.0-rc.2 2022-07-17 23:50:30 +09:00
Daishi Kato
b455e01e9e
chore(deps): update dependencies (#1094) 2022-07-17 23:48:06 +09:00
Devansh Jethmalani
1449732ad9
docs: fix the link to slices pattern (#1095) 2022-07-17 23:33:39 +09:00
Daishi Kato
28e9614b78
fix(build): a workaround for ESM for use-sync-external-store (#953) 2022-07-17 22:03:52 +09:00
Devansh Jethmalani
93ee10341e
types: minimize types by deprecating them (#1089) 2022-07-17 22:02:45 +09:00
Mike
c16c8d108f
style(examples): run prettier on the examples (#1092)
* chore: add dir "example" and file types "js,jsx" to prettier script

* chore: create .prettierignore and add "/examples/build"

* chore: remove deprecated prettier config

* style: run yarn prettier

* chore: make prettier run only for `example/src`

* chore: add `"bracketSameLine": true` to prettier config

* style: run yarn prettier

* Update examples/config-overrides.js

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2022-07-17 13:50:25 +09:00
Timoteo Borgobello
37112e585c
feature(persist): add method getOptions on persist api and update documentation (#1075)
* feat: persistSuscribe was added on suscribe middleware

* fix: add functionality on persist middleware

* persistSuscribe was updated to test with codesandbox

* withStorageDomEvent was added to test with sandbox too

* expose getOptions method on persist api and add wiki doc for persisting store data

* add documentation for the getOptions

* fix: typo on documentation of persist

* feat(persist): add test of the getOptions from persist api

* update persist docs and change test name

* typed store in withStorageDOMEvents
2022-07-17 08:16:10 +09:00
Daishi Kato
7e5b72ba63
fix(shallow): restrict types (#1070)
* fix(shallow): restrict types

* fix tsc tests
2022-07-17 08:12:54 +09:00
Devansh Jethmalani
81d7c4fa13
fix(types): remove Partial typo from persist (#1051)
* fix(types): remove `Parital` typo from `persist`

* migrate tests

* format
2022-07-17 08:06:31 +09:00
Ryan Cavanaugh
62d1cab407
Mark more methods bivariant (#1029)
* Mark more methods bivariant

* Update src/vanilla.ts

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* Update src/vanilla.ts

Co-authored-by: Devansh Jethmalani <jethmalani.devansh@gmail.com>

* Let's inline BivariantStateComputer.

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
Co-authored-by: Devansh Jethmalani <jethmalani.devansh@gmail.com>
2022-07-17 08:05:49 +09:00
Devansh Jethmalani
8d7bb9aec9
doc(types): Remove independent slices pattern (#1090) 2022-07-16 21:15:58 +09:00
Mike
97d2da70be
feat(example): Upgrade threejs related packages to the latest version (#1086)
* build(deps)(example): Bump versions for packages related to `three`

1. Bump versions for `@react-three/drei`, `@react-three/fiber`, `@react-three/postprocessing`, and `three`.
2. Update the imported package from files.
3. Update the usage of `useAspect`.
4. Rename `useTextureLoader` to `useTexture`.
5. Replace deprecated `state.pointer` with `state.mouse` in `useFrame`.

* build: Remove the tree shaking for package three

Removing it because the code in config-overrides is causing error
on yarn start, will put it back later if tree shaking is still
necessary, maybe with anothor approach.

* fix: incorrect size of scene

* fix: replace package "threejs-meshline" with "meshline"

The threejs-meshline cannot work with new version of @react-three/*,
changing it to meshline fixes the problem.

* fix: brightness of texture

The textures became too bright after the upgrade, changing the
gl_FragColor in `layerMaterial` makes them back to normal.

* refactor: replace deprecated props of DepthOfField

Props with and height has been renamed to resolutionX and resolutionY
ref: https://github.com/pmndrs/postprocessing/releases/tag/v6.27.0

* fix: increase resolution to fix dof effect
2022-07-15 18:13:14 +09:00
xlboy
d49dde827a
docs(readme): symbol supplement in code example (#1083)
* docs(readme): symbol supplement in code example

Located at `Reading/writing state and reacting to changes outside of components`
Supplement the ending symbol of the `Component` function

* docs(readme): unify the style of some code examples
2022-07-14 00:17:52 +09:00
Timoteo Borgobello
2f92479fa9
fix(example): clearTimeout and useCallback was added on CopyButton (#1080)
* fix(copyButton): clearTimeout and useCallback was added on CopyButton

* fix: move clearTimeout to top of function
2022-07-13 20:57:17 +09:00
xlboy
85a5959a2d
docs(typescript): supplement the missing ) symbol in the combine code example (#1082)
* docs(typescript): supplement the missing `)` symbol in the `combine` code example

* style(docs/typescript): formatting
2022-07-13 20:56:29 +09:00
Timoteo
c0e074f19a
refactor(example): updated with the latest version of the clipboard API (#1072)
* refactor: updated with the latest version of the clipboard API in example zustand

* Update examples/src/utils/copy-to-clipboard.js

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2022-07-11 17:54:18 +09:00
Janis Jansen
7470e9c6e8
Added docs page: flux inspired practice (#1074)
* Added base version of wiki file

* Updated the example to a more understandable one

* More content added to "flux-like-practices"

* Revert "Updated the example to a more understandable one"

This reverts commit 629c8d0891e690e139bdb446f3ba76bc81cd98c1.

* run prettier

Co-authored-by: daishi <daishi@axlight.com>
2022-07-11 17:26:11 +09:00
Janis Jansen
8e2445cc2a
Migrate docs from wiki: auto generating selectors (#1057)
* Added base version of auth-generating-selectors wiki file

* Removed semicolons added by prettier

* Update docs/auto-generating-selectors.md

Accepted suggestion to remove hint about auto-zustand-selectors-hook

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* Updated docs to current typing, added code-sandox link

* Update docs/auto-generating-selectors.md

Added third-party library

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* run prettier

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
Co-authored-by: daishi <daishi@axlight.com>
2022-07-11 17:20:59 +09:00
Timoteo
f949d04ff2
tests(shallow): Compare functions test was added (#1071)
* feat: compare functions test was added

* run prettier to formate code
2022-07-11 12:20:43 +09:00
Mike
74de9eb6ba
build(deps)(example): update build script packages (#1069)
* build(deps): update react-scripts and react-app-rewired

* build(deps): remove customize-cra-react-refresh

* style: fix eslint warning in Details.js

* style: remove unuecessary "import React from 'react'"
2022-07-09 13:06:58 +09:00
Mike
646036be5e
build(deps)(example): remove used dependencies (#1068)
* build(deps): remove react-three-gui

* build(deps): remove react-spring

* build(deps): remove raw.macro

* build: remove postprocessing

* build(deps): remove web-vitals

* chore: move @testing-library/* dependencies to devDependencies
2022-07-09 08:37:55 +09:00
Mike
1f1a42264d
build(deps)(example): Bump versions for react and react-dom (#1066)
* build(deps): Bump version for react and react-dom

* fix: update react-dom usage

Co-authored-by: Mike <mike@verybuy.tw>
2022-07-08 19:56:34 +09:00
Devansh Jethmalani
cb7c2a2f36
docs(typescript): Add mutators reference (#1050)
* docs(typescript): Add mutators reference

* better wording
2022-07-06 12:28:27 +09:00
Mike
b06a8a017d
fix(deps): incorrect peer dependency version of three (#1056) 2022-07-06 08:08:43 +09:00
Sepehr Safari
f8bc24edf0
docs: typo in readme.md (#1049)
Fixed typo "seperate" to "separate".
2022-07-03 20:53:00 +09:00
Daishi Kato
3d764b0a4a
refactor: prefer interfaces (#1012) 2022-06-18 22:43:25 +09:00
guilleon-velasco
e220737042
docs(typescript): fix minor grammar issue (#1009) 2022-06-15 19:19:28 +09:00
Daishi Kato
2b698fb249
chore: run prettier for docs (#1007) 2022-06-14 23:00:07 +09:00
Daishi Kato
e85bd2b899
fix(build): add downlevel-dts (#1005)
* fix(build): add downlevel-dts

* use node 14 for codesandbox ci

* use node 14 in github workflow
2022-06-14 22:47:25 +09:00
InfiniteXyy
1011a2fa3c
chore(docs): fix typo in docs & code examples (#1006) 2022-06-14 22:06:44 +09:00
Devansh Jethmalani
d83c41d312
docs(typescript): Add a note to not use curried version when using state-creating middlewares (#1003) 2022-06-14 09:42:35 +09:00
Low Jeng Lam
197e5d4199
fix(docs): fix link for Common Recipes (#988) 2022-06-03 20:20:01 +09:00
Himself65
89c35772cf
chore(docs): fix code highlight (#978) 2022-05-31 09:51:04 +09:00
mahendradambe
12c81383ac
docs(typescript): fix typo in middleware without mutations (#956)
Co-authored-by: mahendrad <mahendrad@consultbop.com>
2022-05-15 14:45:59 +09:00
daishi
a7dd28a2c9 chore(docs): fix link and typo 2022-05-08 10:17:51 +09:00
daishi
ec90d993e1 4.0.0-rc.1 v4.0.0-rc.1 2022-04-29 23:25:56 +09:00
Daishi Kato
8152571841
chore(deps): update dev dependencies (#943) 2022-04-29 23:25:14 +09:00
Daishi Kato
da1007534b
fix(types): avoid any in react.ts (#941) 2022-04-29 23:16:45 +09:00
Devansh Jethmalani
72de1aed5d
Fix TS4023 and other minor changes (#940)
* fix(ts4023): use type aliases instead of interfaces

* refactor(types): immer, devtools
- make immer types more like devtools for better quickinfo
- make immer and devtools store names consistent with
  StoreMiddleware naming convention (eg StorePersist,
  StoreRedux, etc)

* format(docs): add a linebreak after <summary>
2022-04-29 23:15:55 +09:00
Daishi Kato
0ae0293e88
breaking(middleware/devtools): remove checking old string option (#933)
* breaking(middleware/devtools): remove checking old string option

* fix test

* fix test
2022-04-29 23:15:23 +09:00
Piotr
54d5e0cd71
fix(docs): remove not used imports (#931) 2022-04-26 09:27:50 +09:00
Piotr
d1d487f096
Docs: Fix TypeScript docs for Middleware that changes the store type (#927) 2022-04-24 11:31:20 +09:00
Daishi Kato
78ebd86f16
fix(readme): remove invalid typescript example (#923) 2022-04-20 08:48:13 +09:00
Daishi Kato
e30f4700c4
fix(docs): fix and improve readme (#917) 2022-04-18 17:19:03 +09:00
daishi
79782c3ba3 4.0.0-rc.0 v4.0.0-rc.0 2022-04-18 10:39:54 +09:00
Daishi Kato
8e700e0c48
chore(deps): update dev dependencies (#916) 2022-04-18 10:34:36 +09:00
M. Bagher Abiat
279bfb1e64
fix(middleware/devtools): add enabled option and show devtools warning only if enabled (#880)
* remove warning

* test

* rfc: enabled option

* debug

* update

* update

* [DEV-ONLY]

* [DEV-ONLY]

* let enable enabled

* let's enable enabled

* lint

* Update src/middleware/devtools.ts

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* add tests for different cases

* refactor test

* fix test

* tweak mock in test

* fix merge main

Co-authored-by: daishi <daishi@axlight.com>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2022-04-18 10:20:21 +09:00
Daishi Kato
2a2c180c73
fix(middleware): separate immer middleware (#915) 2022-04-18 10:06:17 +09:00
Daishi Kato
c32a188c02
fix(index): export createStore from vanilla (#914) 2022-04-18 09:24:53 +09:00
Devansh Jethmalani
99cddcf76f
breaking(types): Add higher kinded mutator types (#725)
* imaginary code that uses uSES

* revert backward compatibility code as this is not going to be v4

* use use-sync-external-store

* revert to react 17

* handle error by our own

* v4.0.0-alpha.2

* fix&refactor a bit

* update uSES experimental package

* remove error propagation hack

* update size snapshot

* update uSES and add dts

* split react.ts and no export wild

* split useStore impl

* context to follow the new api, export wild again

* v4.0.0-alpha.3

* add missing await

* update uSES

* update uSES

* uses uSES extra!

* v4.0.0-alpha.3

* fix(types): Rename from UseStore to UseBoundStore

* breaking(types): drop deprecated UseStore type

* breaking(core): drop v2 hook compatibility

* breaking(middleware): drop deprecated persist options

* breaking(core): drop deprecated store.subscribe with selector

* update uSES

* fix update uSES

* v4.0.0-alpha.5

* combine subscribe type

* intentional undefined type

* add useDebugValue

* update uSES

* update uSES types

* breaking(middleware): make persist options.removeItem required

* update uSES

* v4.0.0-alpha.6

* fix(readme): remove memoization section which is no longer valid with uSES

* feat(readme): add new createStore/useStore usage

* update useSES

* update uSES and deps

* v4.0.0-alpha.7

* update uSES

* update uSES

* shave bytes

* vanilla: add higher kinded mutator types

* persist: add higher kinded mutator types

* persist: try to minimize diff

* use `PopArgument` in vanilla too

* update uSES

* use overloads instead of `createWithState`

* avoid symbols

* add new types to middlewares

* add new types react

* add new types to context

* fix persist types

* add immer

* migrate middleware type tests

* fix react type, export `UseBoundStore`

* migrate vanilla type tests

* rename `_createStore` to `createStoreImpl`

* Default to no mutations in `StateCreator`

* migrate context.test.tsx

* fix devtools.test.tsx type erros

* context: remove callsignature in useStoreApi

* context: remove `UseContextStore` type

* context: fix useBoundStore type

* context: keep `UseContextStore` for tooltip just don't export it

* react: remove duplicate overload in create

* export `WithPersist`

* devtools: preserve try/catch

* devtools: preserve window check

* add a test case for v3 style create

* devtools: preverse test fix from base branch

* remove StoreApiWithFoo types, don't export WithFoo types

* style

* devtools: preverse `originalIsRecording` change

* fix bug in devtools

* empty commit

* 4.0.0-beta.1

* fix lint

* style

* export immer fix tests

* style, minor fixes

* devtools: fix test

* Update tests/devtools.test.tsx

* breaking(middleware/devtools): use official devtools extension types

* type object.create

* avoid emitting @redux-devtools/extension

* fix type with any

* refactor

* fix yarn lock

* temporary fix #829

* v4.0.0-beta.2

* fix lint

* lock date-fns version

* test middleware subtyping

* fix errors in conflict resolution

* lock testing-library/react alpha version

* more correct (and strict) persist types

* migrate tests

* wip release notes

* fix devtools merge with base

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* add a test case for persist with partialize option

* update readme

* fix lint

* immer: mutate `store.setState`

* fix devtools merge with base

* immer: fix mutations order

* changes in readme

* move and rename v4 migration md

* add `combine` usage in readme

* typos

* create separate md for typescript, add common recipes

* minor fixes

* devtools: minor type fix
(probably I copy pasted from persist and forgot to remove `U`)

* add more migrations

* context: fix import

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* devtools: minor refactor
rearrange code for better diff

* fix lint: run prettier

* wip

* uSES rc.1

* getServerState for #886, no types yet

* uSES v1

* devtools: remove deprecations and warnings

* fix tests

* v4.0.0-beta.2

* wip

* migrate tests

* persist: keep diff minimal

* fix merge in package.json and yarn.lock

* fix merge for persist

* don't use `import type`

* docs(typescript): add slices pattern

* fix selector & equals types
for inference with useCallback, see issue #812

* add test for setState with replace

* remove undefined selector overload

* make immer more generic

* make devtools replace-friendly and more correctly typed

* migrate tests

* make setState bivariant to make the state covariant

* devtools: return the result of `setState`

* devtools: make the fallback branch in `StoreSetStateWithAction` bivariant too
(I forgot to make this bivaraint)

* remove strict replace

* fix lint

Co-authored-by: daishi <daishi@axlight.com>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2022-04-18 09:14:00 +09:00