@arcblock/ux 0.78.26 → 1.6.60
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/LICENSE +1 -1
- package/README.md +0 -56
- package/lib/ActionButton/index.js +6 -4
- package/lib/ActivityIndicator/index.js +75 -23
- package/lib/Alert/index.js +15 -11
- package/lib/Async/index.js +1 -1
- package/lib/Badge/index.js +17 -15
- package/lib/Blocklet/index.js +261 -0
- package/lib/Button/wrap.js +96 -43
- package/lib/ButtonGroup/index.js +3 -16
- package/lib/Center/index.js +30 -4
- package/lib/ClickToCopy/index.js +10 -8
- package/lib/CodeBlock/index.js +40 -13
- package/lib/Colors/index.js +15 -0
- package/lib/Colors/themes/default.js +85 -0
- package/lib/ContactForm/index.js +9 -10
- package/lib/CookieConsent/index.js +98 -0
- package/lib/CountDown/index.js +18 -14
- package/lib/Dialog/confirm.js +84 -0
- package/lib/Dialog/dialog.js +137 -0
- package/lib/Dialog/index.js +23 -0
- package/lib/Earth/index.js +33 -33
- package/lib/Empty/index.js +61 -0
- package/lib/Footer/index.js +16 -18
- package/lib/Icon/image.js +10 -13
- package/lib/Icon/index.js +10 -8
- package/lib/Img/index.js +212 -0
- package/lib/InfoRow/index.js +7 -6
- package/lib/Layout/dashboard/header.js +60 -42
- package/lib/Layout/dashboard/index.js +72 -60
- package/lib/Layout/dashboard/sidebar.js +41 -25
- package/lib/Layout/index.js +113 -51
- package/lib/Locale/browser-lang.js +0 -2
- package/lib/Locale/context.js +85 -61
- package/lib/Locale/selector.js +33 -20
- package/lib/Logo/index.js +15 -13
- package/lib/Metric/index.js +5 -6
- package/lib/NFTDisplay/README.md +59 -0
- package/lib/NFTDisplay/aspect-ratio-container.js +52 -0
- package/lib/NFTDisplay/broken.js +25 -0
- package/lib/NFTDisplay/index.js +317 -0
- package/lib/NFTDisplay/loading.js +23 -0
- package/lib/NFTDisplay/svg-embedder/img.js +68 -0
- package/lib/NFTDisplay/svg-embedder/inline-svg.js +54 -0
- package/lib/PageScroller/index.js +10 -11
- package/lib/PageScroller/usePrevValue.js +2 -2
- package/lib/PricingTable/PricingPlan.js +12 -15
- package/lib/PricingTable/index.js +5 -5
- package/lib/QRCode/index.js +89 -0
- package/lib/Result/common.js +176 -0
- package/lib/Result/index.js +61 -0
- package/lib/Result/result.js +69 -0
- package/lib/Result/translations.js +61 -0
- package/lib/Screenshot/index.js +14 -13
- package/lib/Spinner/index.js +37 -0
- package/lib/SplitButton/index.js +126 -0
- package/lib/Switch/index.js +107 -0
- package/lib/Tabs/index.js +24 -47
- package/lib/Tag/index.js +15 -13
- package/lib/Terminal/Player.js +43 -45
- package/lib/Terminal/index.js +3 -1
- package/lib/Terminal/util.js +2 -3
- package/lib/TextCollapse/index.js +21 -14
- package/lib/Theme/index.js +79 -63
- package/lib/Theme/responsiveFontSizes.js +8 -8
- package/lib/Toast/index.js +12 -11
- package/lib/Util/index.js +197 -26
- package/lib/Video/index.js +8 -11
- package/lib/Wallet/Action.js +15 -13
- package/lib/Wallet/Download.js +60 -58
- package/lib/Wallet/Open.js +2 -2
- package/lib/WechatPrompt/index.js +10 -10
- package/lib/index.js +6 -6
- package/lib/withTheme/index.js +5 -17
- package/lib/withTracker/error_boundary.js +3 -3
- package/lib/withTracker/index.js +6 -7
- package/package.json +23 -17
- package/src/ActionButton/index.js +65 -0
- package/src/ActivityIndicator/index.js +141 -0
- package/src/Alert/index.js +104 -0
- package/src/Async/index.js +39 -0
- package/src/Badge/index.js +71 -0
- package/src/Blocklet/index.js +424 -0
- package/src/Button/index.js +4 -0
- package/src/Button/wrap.js +101 -0
- package/src/ButtonGroup/index.js +6 -0
- package/src/Center/index.js +40 -0
- package/src/ClickToCopy/index.js +90 -0
- package/src/CodeBlock/index.js +160 -0
- package/src/Colors/index.js +1 -0
- package/src/Colors/themes/default.js +54 -0
- package/src/ContactForm/index.js +240 -0
- package/src/CookieConsent/index.js +90 -0
- package/src/CountDown/index.js +151 -0
- package/src/Dialog/confirm.js +76 -0
- package/src/Dialog/dialog.js +162 -0
- package/src/Dialog/index.js +2 -0
- package/src/DriftBot/index.js +81 -0
- package/src/Earth/countries.json +8057 -0
- package/src/Earth/index.js +511 -0
- package/src/Earth/util.js +69 -0
- package/src/Empty/index.js +41 -0
- package/src/Footer/index.js +110 -0
- package/src/Icon/image.js +55 -0
- package/src/Icon/index.js +69 -0
- package/src/Img/index.js +172 -0
- package/src/InfoRow/index.js +83 -0
- package/src/Layout/dashboard/header.js +157 -0
- package/src/Layout/dashboard/index.js +150 -0
- package/src/Layout/dashboard/sidebar.js +122 -0
- package/src/Layout/index.js +318 -0
- package/src/Locale/browser-lang.js +63 -0
- package/src/Locale/context.js +94 -0
- package/src/Locale/images/globe-dark.png +0 -0
- package/src/Locale/images/globe-light.png +0 -0
- package/src/Locale/selector.js +135 -0
- package/src/Logo/images/logo-dark-text.svg +3 -0
- package/src/Logo/images/logo-dark-top.svg +6 -0
- package/src/Logo/images/logo-light-text.svg +3 -0
- package/src/Logo/images/logo-light-top.svg +6 -0
- package/src/Logo/index.js +47 -0
- package/src/Metric/index.js +115 -0
- package/src/NFTDisplay/README.md +59 -0
- package/src/NFTDisplay/aspect-ratio-container.js +34 -0
- package/src/NFTDisplay/broken.js +18 -0
- package/src/NFTDisplay/index.js +257 -0
- package/src/NFTDisplay/loading.js +17 -0
- package/src/NFTDisplay/svg-embedder/img.js +36 -0
- package/src/NFTDisplay/svg-embedder/inline-svg.js +37 -0
- package/src/PageScroller/index.js +342 -0
- package/src/PageScroller/usePrevValue.js +12 -0
- package/src/PricingTable/PricingPlan.js +112 -0
- package/src/PricingTable/index.js +43 -0
- package/src/QRCode/index.js +56 -0
- package/src/Result/common.js +116 -0
- package/src/Result/index.js +31 -0
- package/src/Result/result.js +57 -0
- package/src/Result/translations.js +56 -0
- package/src/Screenshot/devices.css +1366 -0
- package/src/Screenshot/index.js +181 -0
- package/src/Spinner/index.js +19 -0
- package/src/SplitButton/index.js +112 -0
- package/src/Switch/index.js +78 -0
- package/src/Tabs/index.js +46 -0
- package/src/Tag/index.js +73 -0
- package/src/Terminal/Player.js +364 -0
- package/src/Terminal/index.js +150 -0
- package/src/Terminal/player.css +378 -0
- package/src/Terminal/util.js +167 -0
- package/src/Terminal/xterm.css +171 -0
- package/src/TextCollapse/index.js +92 -0
- package/src/Theme/index.js +184 -0
- package/src/Theme/responsiveFontSizes.js +94 -0
- package/src/Toast/index.js +118 -0
- package/src/Util/index.js +281 -0
- package/src/Video/index.js +72 -0
- package/src/Wallet/Action.js +105 -0
- package/src/Wallet/Download.js +130 -0
- package/src/Wallet/Open.js +50 -0
- package/src/Wallet/images/abtwallet.png +0 -0
- package/src/Wallet/images/android_download.svg +23 -0
- package/src/Wallet/images/app-store.svg +20 -0
- package/src/Wallet/images/google-play.svg +70 -0
- package/src/WechatPrompt/images/android.png +0 -0
- package/src/WechatPrompt/images/ios.png +0 -0
- package/src/WechatPrompt/index.js +81 -0
- package/src/index.js +63 -0
- package/src/withTheme/index.js +72 -0
- package/src/withTracker/README.md +34 -0
- package/src/withTracker/error_boundary.js +34 -0
- package/src/withTracker/index.js +70 -0
- package/lib/GraphQLPlayground/graphiql.css +0 -1850
- package/lib/GraphQLPlayground/index.js +0 -302
- package/lib/GraphQLPlayground/util.js +0 -55
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = GraphQLPlayground;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
|
-
var _querystring = _interopRequireDefault(require("querystring"));
|
|
15
|
-
|
|
16
|
-
var _axios = _interopRequireDefault(require("axios"));
|
|
17
|
-
|
|
18
|
-
var _reactLoadScript = _interopRequireDefault(require("react-load-script"));
|
|
19
|
-
|
|
20
|
-
var _graphiql = _interopRequireDefault(require("graphiql"));
|
|
21
|
-
|
|
22
|
-
var _graphiqlExplorer = _interopRequireDefault(require("graphiql-explorer"));
|
|
23
|
-
|
|
24
|
-
var _graphiqlCodeExporter = _interopRequireDefault(require("graphiql-code-exporter"));
|
|
25
|
-
|
|
26
|
-
var _snippets = _interopRequireDefault(require("graphiql-code-exporter/lib/snippets"));
|
|
27
|
-
|
|
28
|
-
var _graphql = require("graphql");
|
|
29
|
-
|
|
30
|
-
var _reactRouterDom = require("react-router-dom");
|
|
31
|
-
|
|
32
|
-
require("./graphiql.css");
|
|
33
|
-
|
|
34
|
-
require("graphiql-code-exporter/CodeExporter.css");
|
|
35
|
-
|
|
36
|
-
require("codemirror/theme/neo.css");
|
|
37
|
-
|
|
38
|
-
var _Util = require("../Util");
|
|
39
|
-
|
|
40
|
-
var _util = require("./util");
|
|
41
|
-
|
|
42
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
43
|
-
|
|
44
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
45
|
-
|
|
46
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
47
|
-
|
|
48
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
49
|
-
|
|
50
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
51
|
-
|
|
52
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
53
|
-
|
|
54
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
55
|
-
|
|
56
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
57
|
-
|
|
58
|
-
function GraphQLPlayground(props) {
|
|
59
|
-
const newProps = (0, _Util.mergeProps)(props, GraphQLPlayground, ['style', 'persistentQuery', 'enableQueryComposer', 'enableCodeExporter', 'enableHistory']);
|
|
60
|
-
const history = (0, _reactRouterDom.useHistory)();
|
|
61
|
-
const graphiql = (0, _react.useRef)(null);
|
|
62
|
-
const subscriptionClient = (0, _react.useRef)(null);
|
|
63
|
-
const [schema, setSchema] = (0, _react.useState)(null);
|
|
64
|
-
const [query, setQuery] = (0, _react.useState)(newProps.defaultQuery || '{}');
|
|
65
|
-
const [queryComposerIsOpen, setComposerOpen] = (0, _react.useState)(newProps.enableQueryComposer);
|
|
66
|
-
const [codeExporterIsOpen, setExporterOpen] = (0, _react.useState)(false);
|
|
67
|
-
|
|
68
|
-
const persistQuery = newQuery => {
|
|
69
|
-
const {
|
|
70
|
-
pathname,
|
|
71
|
-
search
|
|
72
|
-
} = history.location;
|
|
73
|
-
const params = (0, _Util.parseQuery)(search);
|
|
74
|
-
params.query = newQuery;
|
|
75
|
-
const newUrl = "".concat(pathname, "?").concat(_querystring.default.stringify(params));
|
|
76
|
-
history.replace(newUrl);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
(0, _react.useEffect)(() => {
|
|
80
|
-
if (newProps.persistentQuery) {
|
|
81
|
-
const params = (0, _Util.parseQuery)(window.location.search);
|
|
82
|
-
|
|
83
|
-
if (params.query) {
|
|
84
|
-
setQuery(params.query);
|
|
85
|
-
} else {
|
|
86
|
-
persistQuery(query);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}, []);
|
|
90
|
-
|
|
91
|
-
const onInspect = (cm, mousePos) => {
|
|
92
|
-
const parsedQuery = (0, _graphql.parse)(query || '');
|
|
93
|
-
|
|
94
|
-
if (!parsedQuery) {
|
|
95
|
-
console.error("Couldn't parse query document");
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const token = cm.getTokenAt(mousePos);
|
|
100
|
-
const start = {
|
|
101
|
-
line: mousePos.line,
|
|
102
|
-
ch: token.start
|
|
103
|
-
};
|
|
104
|
-
const end = {
|
|
105
|
-
line: mousePos.line,
|
|
106
|
-
ch: token.end
|
|
107
|
-
};
|
|
108
|
-
const relevantMousePos = {
|
|
109
|
-
start: cm.indexFromPos(start),
|
|
110
|
-
end: cm.indexFromPos(end)
|
|
111
|
-
};
|
|
112
|
-
const position = relevantMousePos;
|
|
113
|
-
const def = parsedQuery.definitions.find(definition => {
|
|
114
|
-
if (!definition.loc) {
|
|
115
|
-
console.log('Missing location information for definition');
|
|
116
|
-
return false;
|
|
117
|
-
} // eslint-disable-next-line no-shadow
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const {
|
|
121
|
-
start,
|
|
122
|
-
end
|
|
123
|
-
} = definition.loc;
|
|
124
|
-
return start <= position.start && end >= position.end;
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
if (!def) {
|
|
128
|
-
console.error('Unable to find definition corresponding to mouse position');
|
|
129
|
-
return;
|
|
130
|
-
} // prettier-ignore
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const operationKind = def.kind === 'OperationDefinition' ? def.operation : def.kind === 'FragmentDefinition' ? 'fragment' : 'unknown'; // prettier-ignore
|
|
134
|
-
|
|
135
|
-
const operationName = def.kind === 'OperationDefinition' && !!def.name ? def.name.value : def.kind === 'FragmentDefinition' && !!def.name ? def.name.value : 'unknown';
|
|
136
|
-
const selector = ".graphiql-explorer-root #".concat(operationKind, "-").concat(operationName);
|
|
137
|
-
const element = document.querySelector(selector);
|
|
138
|
-
|
|
139
|
-
if (element) {
|
|
140
|
-
element.scrollIntoView();
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const onEditQuery = newQuery => {
|
|
145
|
-
if (newQuery !== query && newProps.persistentQuery) {
|
|
146
|
-
persistQuery(newQuery);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
setQuery(newQuery);
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const onToggleExplorer = () => {
|
|
153
|
-
setComposerOpen(!queryComposerIsOpen);
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const onToggleCodeExporter = () => setExporterOpen(!codeExporterIsOpen);
|
|
157
|
-
|
|
158
|
-
const ensureSubscriptionClient = () => {
|
|
159
|
-
if (subscriptionClient.current) {
|
|
160
|
-
subscriptionClient.current.close();
|
|
161
|
-
subscriptionClient.current = null;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const {
|
|
165
|
-
endpoint
|
|
166
|
-
} = newProps;
|
|
167
|
-
let socketUrl = endpoint.replace(/https?:\/\//, 'ws://');
|
|
168
|
-
|
|
169
|
-
if (endpoint.indexOf('https://') === 0) {
|
|
170
|
-
socketUrl = socketUrl.replace('ws://', 'wss://');
|
|
171
|
-
} // eslint-disable-next-line no-undef
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
subscriptionClient.current = new AbsintheSocketGraphiql.SubscriptionsClient(localStorage.getItem('websocket') || "".concat(socketUrl, "/socket"), {
|
|
175
|
-
reconnect: true,
|
|
176
|
-
connectionParams: {}
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
const httpFetcher = async params => {
|
|
181
|
-
// eslint-disable-next-line operator-linebreak
|
|
182
|
-
const extraHeaders = typeof newProps.extraHeaders === 'function' ? newProps.extraHeaders() : newProps.extraHeaders || {};
|
|
183
|
-
const res = await (0, _axios.default)({
|
|
184
|
-
method: 'post',
|
|
185
|
-
url: newProps.endpoint,
|
|
186
|
-
data: params,
|
|
187
|
-
headers: Object.assign({
|
|
188
|
-
'Content-Type': 'application/json'
|
|
189
|
-
}, extraHeaders)
|
|
190
|
-
});
|
|
191
|
-
return res.data;
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
const fetcher = params => {
|
|
195
|
-
if (params.query.indexOf('subscription') >= 0) {
|
|
196
|
-
ensureSubscriptionClient(); // disable subscription in test env
|
|
197
|
-
|
|
198
|
-
if (process.env.NODE_ENV !== 'test') {
|
|
199
|
-
return (0, _util.graphQLFetcher)(subscriptionClient.current, httpFetcher)(params);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return httpFetcher(params);
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
(0, _react.useEffect)(() => {
|
|
207
|
-
httpFetcher({
|
|
208
|
-
query: (0, _graphql.getIntrospectionQuery)()
|
|
209
|
-
}).then(result => {
|
|
210
|
-
if (!graphiql.current) {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const editor = graphiql.current.getQueryEditor();
|
|
215
|
-
editor.setOption('extraKeys', _objectSpread({}, editor.options.extraKeys || {}, {
|
|
216
|
-
'Shift-Alt-LeftClick': onInspect
|
|
217
|
-
}));
|
|
218
|
-
setSchema((0, _graphql.buildClientSchema)(result.data));
|
|
219
|
-
});
|
|
220
|
-
}, [graphiql.current]);
|
|
221
|
-
|
|
222
|
-
const {
|
|
223
|
-
endpoint,
|
|
224
|
-
title,
|
|
225
|
-
enableCodeExporter,
|
|
226
|
-
enableQueryComposer,
|
|
227
|
-
enableHistory,
|
|
228
|
-
extraCodeSnippets
|
|
229
|
-
} = newProps,
|
|
230
|
-
rest = _objectWithoutProperties(newProps, ["endpoint", "title", "enableCodeExporter", "enableQueryComposer", "enableHistory", "extraCodeSnippets"]);
|
|
231
|
-
|
|
232
|
-
const snippets = [...extraCodeSnippets, ..._snippets.default];
|
|
233
|
-
return _react.default.createElement(Container, rest, _react.default.createElement(_reactLoadScript.default, {
|
|
234
|
-
url: "//cdn.jsdelivr.net/npm/@absinthe/socket-graphiql@0.2.1/compat/umd/index.js"
|
|
235
|
-
}), enableQueryComposer && _react.default.createElement(_graphiqlExplorer.default, {
|
|
236
|
-
schema: schema,
|
|
237
|
-
query: query,
|
|
238
|
-
onEdit: onEditQuery,
|
|
239
|
-
onRunOperation: operationName => graphiql.current.handleRunQuery(operationName),
|
|
240
|
-
explorerIsOpen: queryComposerIsOpen,
|
|
241
|
-
onToggleExplorer: onToggleExplorer,
|
|
242
|
-
className: "graphiql-explorer"
|
|
243
|
-
}), _react.default.createElement(_graphiql.default // eslint-disable-next-line no-return-assign
|
|
244
|
-
, {
|
|
245
|
-
ref: graphiql,
|
|
246
|
-
fetcher: fetcher,
|
|
247
|
-
schema: schema,
|
|
248
|
-
query: query,
|
|
249
|
-
onEditQuery: onEditQuery
|
|
250
|
-
}, _react.default.createElement(_graphiql.default.Logo, null, title), _react.default.createElement(_graphiql.default.Toolbar, null, _react.default.createElement(_graphiql.default.Button, {
|
|
251
|
-
onClick: () => graphiql.current.handlePrettifyQuery(),
|
|
252
|
-
label: "Prettify",
|
|
253
|
-
title: "Prettify Query (Shift-Ctrl-P)"
|
|
254
|
-
}), enableHistory && _react.default.createElement(_graphiql.default.Button, {
|
|
255
|
-
onClick: () => graphiql.current.handleToggleHistory(),
|
|
256
|
-
label: "History",
|
|
257
|
-
title: "Show History"
|
|
258
|
-
}), enableQueryComposer && _react.default.createElement(_graphiql.default.Button, {
|
|
259
|
-
onClick: onToggleExplorer,
|
|
260
|
-
label: "Query Composer",
|
|
261
|
-
title: "Toggle Query Composer"
|
|
262
|
-
}), enableCodeExporter && _react.default.createElement(_graphiql.default.Button, {
|
|
263
|
-
onClick: onToggleCodeExporter,
|
|
264
|
-
label: "Code Exporter",
|
|
265
|
-
title: "Toggle Code Exporter"
|
|
266
|
-
}))), enableCodeExporter && codeExporterIsOpen && _react.default.createElement("div", {
|
|
267
|
-
className: "graphiql-container graphiql-exporter-container"
|
|
268
|
-
}, _react.default.createElement(_graphiqlCodeExporter.default, {
|
|
269
|
-
hideCodeExporter: onToggleCodeExporter,
|
|
270
|
-
snippets: snippets,
|
|
271
|
-
serverUrl: endpoint,
|
|
272
|
-
query: query,
|
|
273
|
-
codeMirrorTheme: "neo"
|
|
274
|
-
})));
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
GraphQLPlayground.propTypes = {
|
|
278
|
-
endpoint: _propTypes.default.string.isRequired,
|
|
279
|
-
defaultQuery: _propTypes.default.string,
|
|
280
|
-
title: _propTypes.default.string,
|
|
281
|
-
persistentQuery: _propTypes.default.bool,
|
|
282
|
-
enableQueryComposer: _propTypes.default.bool,
|
|
283
|
-
enableCodeExporter: _propTypes.default.bool,
|
|
284
|
-
enableHistory: _propTypes.default.bool,
|
|
285
|
-
extraCodeSnippets: _propTypes.default.array,
|
|
286
|
-
extraHeaders: _propTypes.default.any
|
|
287
|
-
};
|
|
288
|
-
GraphQLPlayground.defaultProps = {
|
|
289
|
-
title: 'Query',
|
|
290
|
-
defaultQuery: '{}',
|
|
291
|
-
persistentQuery: false,
|
|
292
|
-
enableQueryComposer: true,
|
|
293
|
-
enableCodeExporter: false,
|
|
294
|
-
enableHistory: false,
|
|
295
|
-
extraCodeSnippets: [],
|
|
296
|
-
extraHeaders: {}
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
const Container = _styledComponents.default.div.withConfig({
|
|
300
|
-
displayName: "GraphQLPlayground__Container",
|
|
301
|
-
componentId: "fwx99a-0"
|
|
302
|
-
})(["display:flex;flex-direction:row;flex:1;overflow:hidden;height:100%;position:relative;@media (max-width:", "px){margin-top:30px;}> .historyPaneWrap{z-index:8 !important;width:320px !important;box-shadow:5px 16px 10px 0 rgba(0,0,0,", ");overflow-y:scroll;}.doc-explorer-title-bar,.history-title-bar{height:45px;line-height:45px;padding:0px 8px;display:flex;align-items:center;justify-content:space-between;}.doc-explorer-title-bar{padding:0px 32px;}.doc-explorer-title,.history-title{font-size:14px;font-weight:900;letter-spacing:2px;color:", ";text-transform:uppercase;text-align:left !important;}.doc-explorer-contents,.history-contents{top:45px !important;background-color:", " !important;border-top:1px solid #e3e3e3 !important;}.history-contents{color:", ";p{border-bottom:1px solid #e3e3e3;}}.docExplorerHide{color:", ";padding:0;cursor:pointer;margin:-7px -8px -6px -12px;opacity:0.75;font-size:18px;}.toolbar-button{cursor:pointer;}.graphiql-container{.title{color:", ";}.topBar{background-image:none;height:45px;border-bottom-width:0;}.docExplorerShow{background:", ";border:none;font-size:14px;color:", ";text-transform:uppercase;&::before{border-color:", ";}}.docExplorerWrap{position:absolute !important;height:100%;top:0;right:0;background-color:", ";box-shadow:-5px 16px 10px 0 rgba(0,0,0,", ");z-index:3;}.historyPaneWrap{width:320px !important;background-color:", ";box-shadow:5px 16px 10px 0 rgba(0,0,0,", ");}.docExplorerWrap{.doc-explorer{background-color:", ";}.doc-explorer-contents{padding:32px;}}.search-box{margin-bottom:20px;border-bottom:none;input{height:30px;border-radius:15px;border:solid 1px ", ";padding:6px 24px 8px 30px;}.search-box-clear{right:10px;}&::before{left:10px;}}.variable-editor-title{background:", ";border:none;height:40px;padding-left:20px;&::before{border-left:2px solid ", ";border-top:2px solid ", ";content:'';display:inline-block;height:9px;margin:0 5px 1px 0;position:relative;-webkit-transform:rotate(-135deg);transform:rotate(-135deg);width:9px;}}.resultWrap{border-left:none;.CodeMirror-gutters{opacity:0.5;}.CodeMirror-gutter.CodeMirror-foldgutter{box-shadow:5px 16px 10px 0 rgba(0,0,0,", ");}}.CodeMirror,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-foldgutter{background:", ";}.variable-editor{.CodeMirror{background:white;}}.CodeMirror-gutters{border-right-width:0;}}.graphiql-exporter-container{width:auto;.historyPaneWrap{position:absolute !important;height:100%;top:0;right:0;background-color:", ";box-shadow:-5px 16px 10px 0 rgba(0,0,0,", ");z-index:3;.history-contents{padding-top:12px;.toolbar-button{margin-top:-24px !important;}}}}"], props => props.theme.breakpoints.values.md, props => props.theme.mode === 'light' ? 0.05 : 0.5, props => props.theme.typography.color.gray, props => props.theme.palette.background.default, props => props.theme.typography.color.main, props => props.theme.typography.color.main, props => props.theme.typography.color.main, props => props.theme.palette.background.default, props => props.theme.typography.color.main, props => props.theme.typography.color.gray, props => props.theme.palette.background.default, props => props.theme.mode === 'light' ? 0.05 : 0.5, props => props.theme.palette.background.default, props => props.theme.mode === 'light' ? 0.05 : 0.5, props => props.theme.palette.background.default, props => props.theme.typography.color.main, props => props.theme.palette.background.default, props => props.theme.typography.color.gray, props => props.theme.typography.color.gray, props => props.theme.mode === 'light' ? 0.05 : 0.5, props => props.theme.palette.background.default, props => props.theme.palette.background.default, props => props.theme.mode === 'light' ? 0.05 : 0.5);
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.graphQLFetcher = void 0;
|
|
7
|
-
|
|
8
|
-
var _graphql = require("graphql");
|
|
9
|
-
|
|
10
|
-
const hasSubscriptionOperation = graphQlParams => {
|
|
11
|
-
const queryDoc = (0, _graphql.parse)(graphQlParams.query); // eslint-disable-next-line no-restricted-syntax
|
|
12
|
-
|
|
13
|
-
for (const definition of queryDoc.definitions) {
|
|
14
|
-
if (definition.kind === 'OperationDefinition') {
|
|
15
|
-
if (definition.operation === 'subscription') {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return false;
|
|
22
|
-
}; // eslint-disable-next-line import/prefer-default-export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const graphQLFetcher = (subscriptionsClient, fallbackFetcher) => {
|
|
26
|
-
let activeSubscriptionId = null;
|
|
27
|
-
return params => {
|
|
28
|
-
if (subscriptionsClient && activeSubscriptionId !== null) {
|
|
29
|
-
subscriptionsClient.unsubscribe(activeSubscriptionId);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (subscriptionsClient && hasSubscriptionOperation(params)) {
|
|
33
|
-
return {
|
|
34
|
-
subscribe(observer) {
|
|
35
|
-
observer.next('Your subscription data will appear here after server publication!');
|
|
36
|
-
activeSubscriptionId = subscriptionsClient.subscribe({
|
|
37
|
-
query: params.query,
|
|
38
|
-
variables: params.variables
|
|
39
|
-
}, (error, result) => {
|
|
40
|
-
if (error) {
|
|
41
|
-
observer.error(error);
|
|
42
|
-
} else {
|
|
43
|
-
observer.next(result);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return fallbackFetcher(params);
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
exports.graphQLFetcher = graphQLFetcher;
|