Skip to content

Commit

Permalink
chore(optics): move to peer dep
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi committed Nov 15, 2022
1 parent ee2f64e commit 406c359
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 103 deletions.
12 changes: 6 additions & 6 deletions docs/integrations/optics.mdx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
title: Optics
description: This doc describes `jotai/optics` bundle.
description: This doc describes Optics-ts integration.
nav: 4.02
---

## Install

You have to install `optics-ts` to access this bundle and its functions.
You have to install `optics-ts` and `jotai-optics` to use this feature.

```
npm install optics-ts
npm install optics-ts jotai-optics
# or
yarn add optics-ts
yarn add optics-ts jotai-optics
```

## focusAtom
Expand All @@ -37,7 +37,7 @@ To see more advanced optics, please see the example at: https://github.com/akher

```jsx
import { atom } from 'jotai'
import { focusAtom } from 'jotai/optics'
import { focusAtom } from 'jotai-optics'

const objectAtom = atom({ a: 5, b: 10 })
const aAtom = focusAtom(objectAtom, (optic) => optic.prop('a'))
Expand All @@ -59,4 +59,4 @@ const Controls = () => {

### Codesandbox

<CodeSandbox id="y5wef8" />
<CodeSandbox id="nsy4u8" />
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"jotai-immer": "^0.1.0",
"jotai-optics": "^0.2.0",
"jotai-redux": "^0.1.0",
"jotai-tanstack-query": "^0.4.0",
"jotai-urql": "^0.2.0",
Expand Down Expand Up @@ -316,13 +317,13 @@
"@babel/core": "*",
"@babel/template": "*",
"jotai-immer": "*",
"jotai-optics": "*",
"jotai-redux": "*",
"jotai-tanstack-query": "*",
"jotai-urql": "*",
"jotai-valtio": "*",
"jotai-xstate": "*",
"jotai-zustand": "*",
"optics-ts": "*",
"react": ">=16.8"
},
"peerDependenciesMeta": {
Expand All @@ -335,6 +336,9 @@
"jotai-immer": {
"optional": true
},
"jotai-optics": {
"optional": true
},
"jotai-redux": {
"optional": true
},
Expand All @@ -352,9 +356,6 @@
},
"jotai-xstate": {
"optional": true
},
"optics-ts": {
"optional": true
}
}
}
2 changes: 1 addition & 1 deletion src/optics.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { focusAtom } from './optics/focusAtom'
export { focusAtom } from 'jotai-optics'
92 changes: 0 additions & 92 deletions src/optics/focusAtom.ts

This file was deleted.

5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3984,6 +3984,11 @@ jotai-immer@^0.1.0:
resolved "https://registry.yarnpkg.com/jotai-immer/-/jotai-immer-0.1.0.tgz#cfdec8909a5f6a985fdf026da8c182057dbf66d6"
integrity sha512-TwiPKgrf/V0tSh2CSEEilhhCHm0LSgIrZmIXvQRp7+aKT+cATNFUBJeSBUb42wMnTh43DoveGSUiTN1oyTv6Wg==

jotai-optics@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/jotai-optics/-/jotai-optics-0.2.0.tgz#d09870f8f6d4f70072775a252aa36c83ef9feb1a"
integrity sha512-/vYSIPc9Sfl2pIlk1wQRFwZw+JnxHnB0WNREE4AYgv1D1RwCUbmEF37SQQrqfojA2fUkgcqK4oFVhkEF7FFBSA==

jotai-redux@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/jotai-redux/-/jotai-redux-0.1.0.tgz#20e0967be73d4650c05cd49e8c58d4923e92db82"
Expand Down

0 comments on commit 406c359

Please sign in to comment.