@arcblock/graphql-playground 3.0.42 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +46 -45
- package/package.json +2 -2
- package/src/GraphqlPlayground.stories.jsx +9 -0
- package/src/index.jsx +23 -22
package/lib/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { mergeProps as b } from "@arcblock/ux/lib/Util";
|
|
2
3
|
import r from "prop-types";
|
|
3
|
-
import { styled as
|
|
4
|
-
import { GraphiQL as
|
|
5
|
-
import { explorerPlugin as
|
|
6
|
-
import { createGraphiQLFetcher as
|
|
4
|
+
import { styled as c, useTheme as g } from "@arcblock/ux/lib/Theme";
|
|
5
|
+
import { GraphiQL as m } from "graphiql";
|
|
6
|
+
import { explorerPlugin as h } from "@graphiql/plugin-explorer";
|
|
7
|
+
import { createGraphiQLFetcher as u } from "@graphiql/toolkit";
|
|
7
8
|
import "graphiql/style.css";
|
|
8
9
|
import "@graphiql/plugin-explorer/style.css";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const a = Object.assign(
|
|
10
|
+
function i({ ...e }) {
|
|
11
|
+
const p = g(), a = Object.assign(
|
|
12
12
|
{
|
|
13
13
|
title: "Query",
|
|
14
14
|
defaultQuery: "{}",
|
|
@@ -20,29 +20,29 @@ function p({ ...e }) {
|
|
|
20
20
|
extraHeaders: {}
|
|
21
21
|
},
|
|
22
22
|
e
|
|
23
|
-
),
|
|
23
|
+
), t = b(a, i, [
|
|
24
24
|
"style",
|
|
25
25
|
"persistentQuery",
|
|
26
26
|
"enableQueryComposer",
|
|
27
27
|
"enableCodeExporter",
|
|
28
28
|
"enableHistory"
|
|
29
|
-
]),
|
|
30
|
-
url:
|
|
31
|
-
headers:
|
|
32
|
-
}), l = [
|
|
33
|
-
endpoint:
|
|
34
|
-
title:
|
|
35
|
-
enableCodeExporter:
|
|
36
|
-
enableQueryComposer:
|
|
37
|
-
enableHistory:
|
|
38
|
-
extraCodeSnippets:
|
|
39
|
-
defaultQuery:
|
|
40
|
-
persistentQuery:
|
|
41
|
-
...
|
|
42
|
-
} =
|
|
43
|
-
return /* @__PURE__ */
|
|
29
|
+
]), n = typeof t.extraHeaders == "function" ? t.extraHeaders() : t.extraHeaders || {}, d = u({
|
|
30
|
+
url: t.endpoint,
|
|
31
|
+
headers: n
|
|
32
|
+
}), l = [h()], {
|
|
33
|
+
endpoint: $,
|
|
34
|
+
title: C,
|
|
35
|
+
enableCodeExporter: w,
|
|
36
|
+
enableQueryComposer: k,
|
|
37
|
+
enableHistory: Q,
|
|
38
|
+
extraCodeSnippets: v,
|
|
39
|
+
defaultQuery: s,
|
|
40
|
+
persistentQuery: H,
|
|
41
|
+
...x
|
|
42
|
+
} = t;
|
|
43
|
+
return /* @__PURE__ */ o(f, { ...x, children: /* @__PURE__ */ o(m, { fetcher: d, plugins: l, defaultQuery: s, forcedTheme: p.palette.mode }) });
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
i.propTypes = {
|
|
46
46
|
endpoint: r.string.isRequired,
|
|
47
47
|
defaultQuery: r.string,
|
|
48
48
|
title: r.string,
|
|
@@ -53,7 +53,7 @@ p.propTypes = {
|
|
|
53
53
|
extraCodeSnippets: r.array,
|
|
54
54
|
extraHeaders: r.any
|
|
55
55
|
};
|
|
56
|
-
const
|
|
56
|
+
const f = c("div")`
|
|
57
57
|
display: flex;
|
|
58
58
|
flex-direction: row;
|
|
59
59
|
flex: 1;
|
|
@@ -90,7 +90,7 @@ const c = x("div")`
|
|
|
90
90
|
font-size: 14px;
|
|
91
91
|
font-weight: 900;
|
|
92
92
|
letter-spacing: 2px;
|
|
93
|
-
color: ${(e) => e.
|
|
93
|
+
color: ${({ theme: e }) => e.palette.text.secondary};
|
|
94
94
|
text-transform: uppercase;
|
|
95
95
|
text-align: left !important;
|
|
96
96
|
}
|
|
@@ -100,19 +100,20 @@ const c = x("div")`
|
|
|
100
100
|
}
|
|
101
101
|
.history-contents {
|
|
102
102
|
top: 45px !important;
|
|
103
|
-
background-color: ${(e) => e.
|
|
104
|
-
border-top: 1px solid
|
|
103
|
+
background-color: ${({ theme: e }) => e.palette.background.default} !important;
|
|
104
|
+
border-top: 1px solid !important;
|
|
105
|
+
border-color: ${({ theme: e }) => e.palette.divider} !important;
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
.history-contents {
|
|
108
|
-
color: ${(e) => e.
|
|
109
|
+
color: ${({ theme: e }) => e.palette.text.primary};
|
|
109
110
|
p {
|
|
110
|
-
border-bottom: 1px solid
|
|
111
|
+
border-bottom: 1px solid ${({ theme: e }) => e.palette.divider};
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
.docExplorerHide {
|
|
115
|
-
color: ${(e) => e.
|
|
116
|
+
color: ${({ theme: e }) => e.palette.text.primary};
|
|
116
117
|
padding: 0;
|
|
117
118
|
cursor: pointer;
|
|
118
119
|
margin: -7px -8px -6px -12px;
|
|
@@ -126,7 +127,7 @@ const c = x("div")`
|
|
|
126
127
|
|
|
127
128
|
.graphiql-container {
|
|
128
129
|
.title {
|
|
129
|
-
color: ${(e) => e.
|
|
130
|
+
color: ${({ theme: e }) => e.palette.text.primary};
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
.topBar {
|
|
@@ -136,20 +137,20 @@ const c = x("div")`
|
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
.docExplorerShow {
|
|
139
|
-
background: ${(e) => e.
|
|
140
|
+
background: ${({ theme: e }) => e.palette.background.default};
|
|
140
141
|
border: none;
|
|
141
142
|
font-size: 14px;
|
|
142
|
-
color: ${(e) => e.
|
|
143
|
+
color: ${({ theme: e }) => e.palette.text.primary};
|
|
143
144
|
text-transform: uppercase;
|
|
144
145
|
|
|
145
146
|
&::before {
|
|
146
|
-
border-color: ${(e) => e.
|
|
147
|
+
border-color: ${({ theme: e }) => e.palette.divider};
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
.historyPaneWrap {
|
|
151
152
|
width: 320px !important;
|
|
152
|
-
background-color: ${(e) => e.
|
|
153
|
+
background-color: ${({ theme: e }) => e.palette.background.default};
|
|
153
154
|
box-shadow: 5px 16px 10px 0 rgba(0, 0, 0, ${(e) => e.theme.mode === "light" ? 0.05 : 0.5});
|
|
154
155
|
}
|
|
155
156
|
|
|
@@ -160,7 +161,7 @@ const c = x("div")`
|
|
|
160
161
|
input {
|
|
161
162
|
height: 30px;
|
|
162
163
|
border-radius: 15px;
|
|
163
|
-
border: solid 1px ${(e) => e.
|
|
164
|
+
border: solid 1px ${({ theme: e }) => e.palette.divider};
|
|
164
165
|
padding: 6px 24px 8px 30px;
|
|
165
166
|
}
|
|
166
167
|
|
|
@@ -174,14 +175,14 @@ const c = x("div")`
|
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
.variable-editor-title {
|
|
177
|
-
background: ${(e) => e.
|
|
178
|
+
background: ${({ theme: e }) => e.palette.background.default};
|
|
178
179
|
border: none;
|
|
179
180
|
height: 40px;
|
|
180
181
|
padding-left: 20px;
|
|
181
182
|
|
|
182
183
|
&::before {
|
|
183
|
-
border-left: 2px solid ${(e) => e.
|
|
184
|
-
border-top: 2px solid ${(e) => e.
|
|
184
|
+
border-left: 2px solid ${({ theme: e }) => e.palette.divider};
|
|
185
|
+
border-top: 2px solid ${({ theme: e }) => e.palette.divider};
|
|
185
186
|
content: '';
|
|
186
187
|
display: inline-block;
|
|
187
188
|
height: 9px;
|
|
@@ -207,7 +208,7 @@ const c = x("div")`
|
|
|
207
208
|
.CodeMirror-gutters,
|
|
208
209
|
.CodeMirror-linenumber,
|
|
209
210
|
.CodeMirror-foldgutter {
|
|
210
|
-
background: ${(e) => e.
|
|
211
|
+
background: ${({ theme: e }) => e.palette.background.default};
|
|
211
212
|
}
|
|
212
213
|
|
|
213
214
|
.variable-editor {
|
|
@@ -228,8 +229,8 @@ const c = x("div")`
|
|
|
228
229
|
height: 100%;
|
|
229
230
|
top: 0;
|
|
230
231
|
right: 0;
|
|
231
|
-
background-color: ${(e) => e.
|
|
232
|
-
box-shadow: -5px 16px 10px 0 rgba(0, 0, 0, ${(e) => e.
|
|
232
|
+
background-color: ${({ theme: e }) => e.palette.background.default};
|
|
233
|
+
box-shadow: -5px 16px 10px 0 rgba(0, 0, 0, ${({ theme: e }) => e.mode === "light" ? 0.05 : 0.5});
|
|
233
234
|
z-index: 3;
|
|
234
235
|
|
|
235
236
|
.history-contents {
|
|
@@ -242,5 +243,5 @@ const c = x("div")`
|
|
|
242
243
|
}
|
|
243
244
|
`;
|
|
244
245
|
export {
|
|
245
|
-
|
|
246
|
+
i as default
|
|
246
247
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/graphql-playground",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "A React Component to interact with GraphQL APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
51
51
|
"jest": "^29.7.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "3d6b460689cc9015fc66567efc1b868874ceb18b"
|
|
54
54
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import ThemeWrapper from './demo/theme-wrapper';
|
|
2
|
+
|
|
1
3
|
export { default as Basic } from './demo/basic';
|
|
2
4
|
export { default as WithHistory } from './demo/with-history';
|
|
3
5
|
export { default as WithQueryComposer } from './demo/with-query-composer';
|
|
@@ -13,4 +15,11 @@ export default {
|
|
|
13
15
|
},
|
|
14
16
|
},
|
|
15
17
|
},
|
|
18
|
+
decorators: [
|
|
19
|
+
(Story) => (
|
|
20
|
+
<ThemeWrapper>
|
|
21
|
+
<Story />
|
|
22
|
+
</ThemeWrapper>
|
|
23
|
+
),
|
|
24
|
+
],
|
|
16
25
|
};
|
package/src/index.jsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { mergeProps } from '@arcblock/ux/lib/Util';
|
|
1
2
|
import PropTypes from 'prop-types';
|
|
2
|
-
import { styled } from '@arcblock/ux/lib/Theme';
|
|
3
|
+
import { styled, useTheme } from '@arcblock/ux/lib/Theme';
|
|
3
4
|
import { GraphiQL } from 'graphiql';
|
|
4
5
|
// eslint-disable-next-line import/no-unresolved
|
|
5
6
|
import { explorerPlugin } from '@graphiql/plugin-explorer';
|
|
@@ -10,9 +11,8 @@ import 'graphiql/style.css';
|
|
|
10
11
|
// eslint-disable-next-line import/no-unresolved
|
|
11
12
|
import '@graphiql/plugin-explorer/style.css';
|
|
12
13
|
|
|
13
|
-
import { mergeProps } from '@arcblock/ux/lib/Util';
|
|
14
|
-
|
|
15
14
|
export default function GraphQLPlayground({ ...rawProps }) {
|
|
15
|
+
const theme = useTheme();
|
|
16
16
|
const props = Object.assign(
|
|
17
17
|
{
|
|
18
18
|
title: 'Query',
|
|
@@ -59,7 +59,7 @@ export default function GraphQLPlayground({ ...rawProps }) {
|
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
61
|
<Container {...rest}>
|
|
62
|
-
<GraphiQL fetcher={fetcher} plugins={plugins} defaultQuery={defaultQuery} />
|
|
62
|
+
<GraphiQL fetcher={fetcher} plugins={plugins} defaultQuery={defaultQuery} forcedTheme={theme.palette.mode} />
|
|
63
63
|
</Container>
|
|
64
64
|
);
|
|
65
65
|
}
|
|
@@ -113,7 +113,7 @@ const Container = styled('div')`
|
|
|
113
113
|
font-size: 14px;
|
|
114
114
|
font-weight: 900;
|
|
115
115
|
letter-spacing: 2px;
|
|
116
|
-
color: ${(
|
|
116
|
+
color: ${({ theme }) => theme.palette.text.secondary};
|
|
117
117
|
text-transform: uppercase;
|
|
118
118
|
text-align: left !important;
|
|
119
119
|
}
|
|
@@ -123,19 +123,20 @@ const Container = styled('div')`
|
|
|
123
123
|
}
|
|
124
124
|
.history-contents {
|
|
125
125
|
top: 45px !important;
|
|
126
|
-
background-color: ${(
|
|
127
|
-
border-top: 1px solid
|
|
126
|
+
background-color: ${({ theme }) => theme.palette.background.default} !important;
|
|
127
|
+
border-top: 1px solid !important;
|
|
128
|
+
border-color: ${({ theme }) => theme.palette.divider} !important;
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
.history-contents {
|
|
131
|
-
color: ${(
|
|
132
|
+
color: ${({ theme }) => theme.palette.text.primary};
|
|
132
133
|
p {
|
|
133
|
-
border-bottom: 1px solid
|
|
134
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.divider};
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
.docExplorerHide {
|
|
138
|
-
color: ${(
|
|
139
|
+
color: ${({ theme }) => theme.palette.text.primary};
|
|
139
140
|
padding: 0;
|
|
140
141
|
cursor: pointer;
|
|
141
142
|
margin: -7px -8px -6px -12px;
|
|
@@ -149,7 +150,7 @@ const Container = styled('div')`
|
|
|
149
150
|
|
|
150
151
|
.graphiql-container {
|
|
151
152
|
.title {
|
|
152
|
-
color: ${(
|
|
153
|
+
color: ${({ theme }) => theme.palette.text.primary};
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
.topBar {
|
|
@@ -159,20 +160,20 @@ const Container = styled('div')`
|
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
.docExplorerShow {
|
|
162
|
-
background: ${(
|
|
163
|
+
background: ${({ theme }) => theme.palette.background.default};
|
|
163
164
|
border: none;
|
|
164
165
|
font-size: 14px;
|
|
165
|
-
color: ${(
|
|
166
|
+
color: ${({ theme }) => theme.palette.text.primary};
|
|
166
167
|
text-transform: uppercase;
|
|
167
168
|
|
|
168
169
|
&::before {
|
|
169
|
-
border-color: ${(
|
|
170
|
+
border-color: ${({ theme }) => theme.palette.divider};
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
.historyPaneWrap {
|
|
174
175
|
width: 320px !important;
|
|
175
|
-
background-color: ${(
|
|
176
|
+
background-color: ${({ theme }) => theme.palette.background.default};
|
|
176
177
|
box-shadow: 5px 16px 10px 0 rgba(0, 0, 0, ${(props) => (props.theme.mode === 'light' ? 0.05 : 0.5)});
|
|
177
178
|
}
|
|
178
179
|
|
|
@@ -183,7 +184,7 @@ const Container = styled('div')`
|
|
|
183
184
|
input {
|
|
184
185
|
height: 30px;
|
|
185
186
|
border-radius: 15px;
|
|
186
|
-
border: solid 1px ${(
|
|
187
|
+
border: solid 1px ${({ theme }) => theme.palette.divider};
|
|
187
188
|
padding: 6px 24px 8px 30px;
|
|
188
189
|
}
|
|
189
190
|
|
|
@@ -197,14 +198,14 @@ const Container = styled('div')`
|
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
.variable-editor-title {
|
|
200
|
-
background: ${(
|
|
201
|
+
background: ${({ theme }) => theme.palette.background.default};
|
|
201
202
|
border: none;
|
|
202
203
|
height: 40px;
|
|
203
204
|
padding-left: 20px;
|
|
204
205
|
|
|
205
206
|
&::before {
|
|
206
|
-
border-left: 2px solid ${(
|
|
207
|
-
border-top: 2px solid ${(
|
|
207
|
+
border-left: 2px solid ${({ theme }) => theme.palette.divider};
|
|
208
|
+
border-top: 2px solid ${({ theme }) => theme.palette.divider};
|
|
208
209
|
content: '';
|
|
209
210
|
display: inline-block;
|
|
210
211
|
height: 9px;
|
|
@@ -230,7 +231,7 @@ const Container = styled('div')`
|
|
|
230
231
|
.CodeMirror-gutters,
|
|
231
232
|
.CodeMirror-linenumber,
|
|
232
233
|
.CodeMirror-foldgutter {
|
|
233
|
-
background: ${(
|
|
234
|
+
background: ${({ theme }) => theme.palette.background.default};
|
|
234
235
|
}
|
|
235
236
|
|
|
236
237
|
.variable-editor {
|
|
@@ -251,8 +252,8 @@ const Container = styled('div')`
|
|
|
251
252
|
height: 100%;
|
|
252
253
|
top: 0;
|
|
253
254
|
right: 0;
|
|
254
|
-
background-color: ${(
|
|
255
|
-
box-shadow: -5px 16px 10px 0 rgba(0, 0, 0, ${(
|
|
255
|
+
background-color: ${({ theme }) => theme.palette.background.default};
|
|
256
|
+
box-shadow: -5px 16px 10px 0 rgba(0, 0, 0, ${({ theme }) => (theme.mode === 'light' ? 0.05 : 0.5)});
|
|
256
257
|
z-index: 3;
|
|
257
258
|
|
|
258
259
|
.history-contents {
|