scoobie 12.0.1 → 12.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/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"version": "12.0
|
|
7
|
+
"version": "12.1.0",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@mdx-js/loader": "^1.6.22",
|
|
10
10
|
"@mdx-js/react": "^1.6.22",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"clsx": "^1.1.1",
|
|
18
18
|
"find-up": "^5.0.0",
|
|
19
19
|
"fs-extra": "^10.0.0",
|
|
20
|
+
"jsonc-parser": "^3.0.0",
|
|
20
21
|
"polished": "^4.1.3",
|
|
21
22
|
"prism-react-renderer": "1.2.1",
|
|
22
23
|
"react-keyed-flatten-children": "^1.3.0",
|
|
@@ -30,9 +31,9 @@
|
|
|
30
31
|
"which": "^2.0.2"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@storybook/addon-essentials": "6.
|
|
34
|
+
"@storybook/addon-essentials": "6.4.8",
|
|
34
35
|
"@storybook/storybook-deployer": "2.8.10",
|
|
35
|
-
"@types/react": "17.0.
|
|
36
|
+
"@types/react": "17.0.37",
|
|
36
37
|
"@types/react-dom": "17.0.11",
|
|
37
38
|
"@types/react-helmet": "6.1.4",
|
|
38
39
|
"braid-design-system": "31.1.0",
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
"react-dom": "17.0.2",
|
|
42
43
|
"react-helmet": "6.1.0",
|
|
43
44
|
"react-router-dom": "6.0.2",
|
|
44
|
-
"semantic-release": "18.0.
|
|
45
|
+
"semantic-release": "18.0.1",
|
|
45
46
|
"sku": "11.2.3"
|
|
46
47
|
},
|
|
47
48
|
"files": [
|
|
@@ -8,18 +8,21 @@ import { SIZE_TO_SMALLER, Size } from '../../private/size';
|
|
|
8
8
|
const URL = url.URL ?? window.URL;
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
|
-
|
|
11
|
+
query: string;
|
|
12
|
+
variables: string | undefined;
|
|
12
13
|
graphqlPlayground: string;
|
|
13
14
|
size: Size;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export const GraphQLPlaygroundAction = ({
|
|
17
|
-
|
|
18
|
+
query,
|
|
19
|
+
variables,
|
|
18
20
|
graphqlPlayground,
|
|
19
21
|
size,
|
|
20
22
|
}: Props) => {
|
|
21
23
|
const playgroundUrl = new URL(graphqlPlayground);
|
|
22
|
-
playgroundUrl.searchParams.set('query',
|
|
24
|
+
playgroundUrl.searchParams.set('query', query);
|
|
25
|
+
playgroundUrl.searchParams.set('variables', variables ?? '{}');
|
|
23
26
|
const href = playgroundUrl.toString();
|
|
24
27
|
|
|
25
28
|
const smallerSize = SIZE_TO_SMALLER[size];
|
|
@@ -27,7 +30,7 @@ export const GraphQLPlaygroundAction = ({
|
|
|
27
30
|
return (
|
|
28
31
|
<Text size={smallerSize} weight="medium">
|
|
29
32
|
<TextLink href={href} rel="noreferrer" target="_blank">
|
|
30
|
-
<IconVideo alignY="lowercase" />
|
|
33
|
+
<IconVideo alignY="lowercase" /> GraphQL Explorer
|
|
31
34
|
</TextLink>
|
|
32
35
|
</Text>
|
|
33
36
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Box, Stack, Text, TextLinkButton } from 'braid-design-system';
|
|
2
|
+
import { parse } from 'jsonc-parser';
|
|
2
3
|
import Highlight from 'prism-react-renderer';
|
|
3
4
|
import React, { useState } from 'react';
|
|
4
5
|
|
|
@@ -56,15 +57,23 @@ export const CodeBlock = ({
|
|
|
56
57
|
|
|
57
58
|
const child = children[index];
|
|
58
59
|
|
|
60
|
+
const jsoncVariables =
|
|
61
|
+
children[0].language === 'graphql' && children[1]?.label === 'Variables'
|
|
62
|
+
? children[1].code
|
|
63
|
+
: undefined;
|
|
64
|
+
|
|
65
|
+
const variables =
|
|
66
|
+
jsoncVariables && JSON.stringify(parse(jsoncVariables), null, 2);
|
|
67
|
+
|
|
59
68
|
const graphqlPlaygroundButton =
|
|
60
|
-
|
|
69
|
+
children[0].language === 'graphql' && graphqlPlayground ? (
|
|
61
70
|
<Box component="span" paddingLeft={tablePadding}>
|
|
62
71
|
<GraphQLPlaygroundAction
|
|
63
72
|
graphqlPlayground={graphqlPlayground}
|
|
64
73
|
size={size}
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
|
|
74
|
+
query={children[0].code}
|
|
75
|
+
variables={variables}
|
|
76
|
+
/>
|
|
68
77
|
</Box>
|
|
69
78
|
) : undefined;
|
|
70
79
|
|