Skip to content

Commit

Permalink
feat: remove dependency to @emotion/react + adopt native css solution (
Browse files Browse the repository at this point in the history
…#129)

* fix: upgrade Mantine to v7

* fix: playback speed dropdown color

* feat: export css via a separate entry point

* fix(package.json): remove @emotion/* from deps

* fix(package.json): remove @emotion/* from deps

* fix: copy Mantine's css to style.css

* fix: add support for css modules to tsup

* fix: ditch css modules in favor of native css

* fix: force theme from props

* docs: add usage docs + migration guide

* chore: update @Mantine deps
  • Loading branch information
arjunvegda authored Apr 13, 2024
1 parent 2d47fc8 commit 0b99ce0
Show file tree
Hide file tree
Showing 72 changed files with 7,173 additions and 23,325 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ build
.eslintrc.js
coverage
react-shim.js
__mocks__/styleMock.js
__mocks__/styleMock.js
postcss.config.js
26 changes: 26 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@ const config: StorybookConfig = {
'@storybook/addon-interactions',
'@storybook/addon-a11y',
'@storybook/addon-mdx-gfm',
{
name: '@storybook/addon-styling-webpack',
options: {
rules: [
{
test: /\.css$/,
sideEffects: true,
use: [
require.resolve('style-loader'),
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
},
},
{
loader: require.resolve('postcss-loader'),
options: {
implementation: require.resolve('postcss'),
},
},
],
},
],
},
},
],
framework: {
name: '@storybook/react-webpack5',
Expand Down
7 changes: 6 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"vunguyentuan.vscode-postcss",
"vunguyentuan.vscode-css-variables"
]
}
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,12 @@
"source.fixAll.eslint": "explicit"
},
"editor.multiCursorModifier": "alt",
"eslint.useESLintClass": true
"eslint.useESLintClass": true,
"cssVariables.lookupFiles": [
"**/*.css",
"**/*.scss",
"**/*.sass",
"**/*.less",
"node_modules/@mantine/core/styles.css"
]
}
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ _(See complete setup guide for UI-based devtools below)_

```sh
# yarn
yarn add jotai-devtools @emotion/react
yarn add jotai-devtools

# npm
npm install jotai-devtools @emotion/react --save
npm install jotai-devtools --save
```

## ✨ UI DevTools
Expand Down Expand Up @@ -125,6 +125,7 @@ type DevToolsProps = {

```tsx
import { DevTools } from 'jotai-devtools';
import 'jotai-devtools/styles.css';

const App = () => {
return (
Expand All @@ -141,6 +142,7 @@ const App = () => {
```tsx
import { createStore } from 'jotai';
import { DevTools } from 'jotai-devtools';
import 'jotai-devtools/styles.css';

const customStore = createStore();

Expand Down Expand Up @@ -172,6 +174,28 @@ import {

## Migration guides

### Migrate ƒrom @emotion/react to native CSS

With the latest release, Jotai DevTools no longer depends on `@emotion/react`
and is replaced it with native CSS.

1. Remove `@emotion/react` from your dependencies

```sh
# yarn
yarn remove @emotion/react

# npm
npm uninstall @emotion/react
```

2. Replace `@emotion/react` with `jotai-devtools/styles.css` in your code

```diff
import { DevTools } from 'jotai-devtools';
+ import 'jotai-devtools/styles.css';
```
### Migrate Jotai to V2
Find the official migration guide on
Expand Down
4 changes: 2 additions & 2 deletions __tests__/devtools/AtomViewer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,9 @@ describe('DevTools - AtomViewer', () => {
${'bigint'} | ${BigInt(123)} | ${'123'}
${'symbol'} | ${Symbol('some-symbol')} | ${'Symbol(some-symbol)'}
${'function'} | ${() => () => 'hello'} | ${"()=>'hello'"}
${'object'} | ${{ foo: 'bar' }} | ${'{ foo: "bar"}'}
${'object'} | ${{ foo: 'bar' }} | ${'{ foo: "bar" }'}
${'circular-object'} | ${circObj} | ${'{}'}
${'array'} | ${[1, 2, 3]} | ${'[ 1, 2, 3]'}
${'array'} | ${[1, 2, 3]} | ${'[ 1, 2, 3 ]'}
`(
'should parse "$type" value correctly',
async ({ value, expected }) => {
Expand Down
Loading

0 comments on commit 0b99ce0

Please sign in to comment.