Skip to content

Commit 158ba2c

Browse files
authored
[inspector-monitor] Replace jss with Emotion (reduxjs#1560)
* Setup Emotion * Fix setup * Start conversion * actionList * actionListHeader * actionListRows * actionListHeaderSelector * actionListItem * actionListItemTime * actionListItemSelector * actionListItemName * actionListHeaderSearch * actionListHeaderWrapper * actionPreview * Remaining css * Format * Propagate Emotion dependencies * Fix tests * Remove styling prop * Remove jss * Remove themeState * Use color map as Emotion theme * Rework theme resolution * Inline CSS * Remove usage of className * Fix warning * Create large-spoons-yell.md
1 parent b54bc75 commit 158ba2c

34 files changed

+609
-685
lines changed

.changeset/large-spoons-yell.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@redux-devtools/app': major
3+
'@redux-devtools/inspector-monitor-test-tab': major
4+
'@redux-devtools/inspector-monitor-trace-tab': major
5+
'@redux-devtools/inspector-monitor': major
6+
---
7+
8+
Replace jss with Emotion in inspector-monitor. `@emotion/react` is now a required peer dependency.

extension/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
},
2525
"dependencies": {
2626
"@babel/polyfill": "^7.12.1",
27+
"@emotion/react": "^11.11.1",
2728
"@redux-devtools/app": "^4.0.1",
2829
"@redux-devtools/core": "^3.13.2",
2930
"@redux-devtools/instrument": "^2.1.0",

extension/test/chrome/extension.spec.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,14 @@ describe('Chrome extension', function () {
4040
it("should contain inspector monitor's component", async () => {
4141
await delay(1000);
4242
const val = await driver
43-
.findElement(webdriver.By.xpath('//div[contains(@class, "inspector-")]'))
43+
.findElement(webdriver.By.xpath('//div[@data-testid="inspector"]'))
4444
.getText();
4545
expect(val).toBeDefined();
4646
});
4747

4848
it('should contain an empty actions list', async () => {
4949
const val = await driver
50-
.findElement(
51-
webdriver.By.xpath('//div[contains(@class, "actionListRows-")]'),
52-
)
50+
.findElement(webdriver.By.xpath('//div[@data-testid="actionListRows"]'))
5351
.getText();
5452
expect(val).toBe('');
5553
});
@@ -72,9 +70,7 @@ describe('Chrome extension', function () {
7270

7371
const result = await driver.wait(
7472
driver
75-
.findElement(
76-
webdriver.By.xpath('//div[contains(@class, "actionListRows-")]'),
77-
)
73+
.findElement(webdriver.By.xpath('//div[@data-testid="actionListRows"]'))
7874
.getText()
7975
.then((val) => {
8076
return actionsPattern.test(val);

extension/test/electron/devpanel.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe('DevTools panel for Electron', function () {
8989
it('should contain INIT action', async () => {
9090
const element = await driver.wait(
9191
webdriver.until.elementLocated(
92-
webdriver.By.xpath('//div[contains(@class, "actionListRows-")]'),
92+
webdriver.By.xpath('//div[@data-testid="actionListRows"]'),
9393
),
9494
5000,
9595
'Element not found',
@@ -100,7 +100,7 @@ describe('DevTools panel for Electron', function () {
100100

101101
it("should contain Inspector monitor's component", async () => {
102102
const val = await driver
103-
.findElement(webdriver.By.xpath('//div[contains(@class, "inspector-")]'))
103+
.findElement(webdriver.By.xpath('//div[@data-testid="inspector"]'))
104104
.getText();
105105
expect(val).toBeDefined();
106106
});

packages/redux-devtools-app/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"@babel/preset-env": "^7.23.5",
7373
"@babel/preset-react": "^7.23.3",
7474
"@babel/preset-typescript": "^7.23.3",
75+
"@emotion/react": "^11.11.1",
7576
"@rjsf/core": "^4.2.3",
7677
"@testing-library/jest-dom": "^6.1.5",
7778
"@testing-library/react": "^14.1.2",
@@ -115,6 +116,7 @@
115116
"webpack-dev-server": "^4.15.1"
116117
},
117118
"peerDependencies": {
119+
"@emotion/react": "^11.0.0",
118120
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
119121
"@types/styled-components": "^5.1.34",
120122
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",

packages/redux-devtools-cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
},
4343
"dependencies": {
4444
"@apollo/server": "^4.9.5",
45+
"@emotion/react": "^11.11.1",
4546
"@redux-devtools/app": "^4.0.0",
4647
"@types/react": "^18.2.43",
4748
"body-parser": "^1.20.2",

packages/redux-devtools-inspector-monitor-test-tab/demo/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"type-check": "tsc --noEmit"
1111
},
1212
"dependencies": {
13+
"@emotion/react": "^11.11.1",
1314
"@redux-devtools/core": "^3.13.2",
1415
"@redux-devtools/dock-monitor": "^3.0.2",
1516
"@redux-devtools/inspector-monitor": "^4.0.1",

packages/redux-devtools-inspector-monitor-test-tab/demo/src/DevTools.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import React from 'react';
22
import { createDevTools } from '@redux-devtools/core';
3-
import {
4-
InspectorMonitor,
5-
base16Themes,
6-
Tab,
7-
} from '@redux-devtools/inspector-monitor';
3+
import { InspectorMonitor, Tab } from '@redux-devtools/inspector-monitor';
4+
import type { Base16ThemeName } from '@redux-devtools/inspector-monitor';
85
import { DockMonitor } from '@redux-devtools/dock-monitor';
96
import { useLocation } from 'react-router-dom';
107
import getOptions from './getOptions';
@@ -20,7 +17,7 @@ export const getDevTools = (location: { search: string }) =>
2017
changeMonitorKey="ctrl-m"
2118
>
2219
<InspectorMonitor
23-
theme={getOptions(location).theme as keyof typeof base16Themes}
20+
theme={getOptions(location).theme as Base16ThemeName}
2421
invertTheme={!getOptions(location).dark}
2522
supportImmutable={getOptions(location).supportImmutable}
2623
tabs={(defaultTabs) =>

packages/redux-devtools-inspector-monitor-test-tab/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"@babel/preset-env": "^7.23.5",
6161
"@babel/preset-react": "^7.23.3",
6262
"@babel/preset-typescript": "^7.23.3",
63+
"@emotion/react": "^11.11.1",
6364
"@redux-devtools/core": "^3.14.0",
6465
"@redux-devtools/inspector-monitor": "^4.1.0",
6566
"@testing-library/react": "^14.1.2",
@@ -85,6 +86,7 @@
8586
"typescript": "~5.2.2"
8687
},
8788
"peerDependencies": {
89+
"@emotion/react": "^11.0.0",
8890
"@redux-devtools/inspector-monitor": "^4.0.0",
8991
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
9092
"@types/styled-components": "^5.1.34",

packages/redux-devtools-inspector-monitor-trace-tab/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"@babel/preset-env": "^7.23.5",
4848
"@babel/preset-react": "^7.23.3",
4949
"@babel/preset-typescript": "^7.23.3",
50+
"@emotion/react": "^11.11.1",
5051
"@redux-devtools/core": "^3.14.0",
5152
"@redux-devtools/inspector-monitor": "^4.1.0",
5253
"@testing-library/react": "^14.1.2",
@@ -76,6 +77,7 @@
7677
"typescript": "~5.2.2"
7778
},
7879
"peerDependencies": {
80+
"@emotion/react": "^11.0.0",
7981
"@redux-devtools/inspector-monitor": "^4.0.0",
8082
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
8183
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",

0 commit comments

Comments
 (0)