Skip to content

Commit 1f96b97

Browse files
idelvallcursoragent
andcommitted
fix: replace direct CSS imports with Emotion CSS-in-JS
Grafana's plugin validator blocks direct .css imports (code-rules-no-direct-css-imports). Fold the json-view and panel stylesheets into the panel's Emotion getStyles as scoped selectors, delete the standalone CSS files, and bump to 1.0.1. Styling is unchanged: computed colors and layout are identical to 1.0.0 (verified in localdev). Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5ab916b commit 1f96b97

6 files changed

Lines changed: 90 additions & 135 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.0.1
4+
5+
- Replace direct CSS imports with Emotion CSS-in-JS (scoped styles) so the plugin passes Grafana's `code-rules-no-direct-css-imports` validation. No visual or behavioral changes.
6+
37
## 1.0.0
48

59
Initial public release.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "earthly-jsontree-panel",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Grafana panel that renders JSON/JSONB query results as a collapsible, copyable tree.",
55
"scripts": {
66
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",

src/json-view/json-view.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import './style.css';
2-
31
import getDataType from './utils/getDataType';
42
import { listen, detach, element } from './utils/dom';
53

src/json-view/style.css

Lines changed: 0 additions & 78 deletions
This file was deleted.

src/panel/JsonTreePanel.tsx

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { JsonTreeOptions } from '../types';
55
import { css } from '@emotion/css';
66
import { useStyles2 } from '@grafana/ui';
77
import jsonview from '../json-view';
8-
import './styles.css';
98

109
type Props = PanelProps<JsonTreeOptions>;
1110

@@ -20,6 +19,91 @@ const getStyles = (theme: GrafanaTheme2) => ({
2019
display: 'flex',
2120
flexDirection: 'column',
2221
boxSizing: 'border-box',
22+
23+
'& .jsonTreeRoot': {
24+
height: '100%',
25+
width: '100%',
26+
overflow: 'auto',
27+
scrollbarWidth: 'thin',
28+
},
29+
'& .jsonTreeRoot.compact *': {
30+
lineHeight: 1.25,
31+
fontSize: 12,
32+
},
33+
34+
'& .json-container': {
35+
fontFamily: 'monospace',
36+
fontSize: 12,
37+
backgroundColor: 'transparent',
38+
color: '#808080',
39+
boxSizing: 'border-box',
40+
},
41+
'& .json-container .line': {
42+
margin: '4px 0',
43+
display: 'flex',
44+
justifyContent: 'flex-start',
45+
},
46+
'& .json-container .caret-icon': {
47+
width: 18,
48+
textAlign: 'center',
49+
cursor: 'pointer',
50+
},
51+
'& .json-container .empty-icon': {
52+
width: 18,
53+
},
54+
'& .json-container .json-type': {
55+
marginRight: 4,
56+
marginLeft: 4,
57+
},
58+
'& .json-container .json-key': {
59+
color: '#eeeeee',
60+
marginRight: 4,
61+
marginLeft: 4,
62+
minWidth: 12,
63+
},
64+
'& .json-container .json-index': {
65+
marginRight: 4,
66+
marginLeft: 4,
67+
},
68+
'& .json-container .json-value': {
69+
flex: 1,
70+
minWidth: 0,
71+
wordBreak: 'break-word',
72+
whiteSpace: 'normal',
73+
marginLeft: 4,
74+
},
75+
'& .json-container .json-number': {
76+
color: '#ffb86c',
77+
},
78+
'& .json-container .json-boolean, & .json-container .json-null': {
79+
color: '#83ff50',
80+
},
81+
'& .json-container .json-string': {
82+
color: '#89b0c7',
83+
},
84+
'& .json-container .hidden': {
85+
display: 'none',
86+
},
87+
'& .json-container .fas': {
88+
display: 'inline-block',
89+
borderStyle: 'solid',
90+
width: 0,
91+
height: 0,
92+
},
93+
'& .json-container .fa-caret-down': {
94+
borderWidth: '6px 5px 0 5px',
95+
borderColor: '#808080 transparent',
96+
},
97+
'& .json-container .fa-caret-right': {
98+
borderWidth: '5px 0 5px 6px',
99+
borderColor: 'transparent transparent transparent #808080',
100+
},
101+
'& .fa-caret-right:before': {
102+
content: '""',
103+
},
104+
'& .fa-caret-down:before': {
105+
content: '""',
106+
},
23107
})
24108
});
25109

src/panel/styles.css

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)