ruru-components 2.0.0-beta.9 → 2.0.0-rc.2
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/CHANGELOG.md +572 -0
- package/README.md +38 -4
- package/dist/components/Copy.d.ts +1 -1
- package/dist/components/Copy.d.ts.map +1 -1
- package/dist/components/Copy.js.map +1 -1
- package/dist/components/Explain.d.ts +0 -5
- package/dist/components/Explain.d.ts.map +1 -1
- package/dist/components/Explain.js +33 -29
- package/dist/components/Explain.js.map +1 -1
- package/dist/components/Footer.js +1 -1
- package/dist/components/Footer.js.map +1 -1
- package/dist/components/FormatSQL.d.ts.map +1 -1
- package/dist/components/FormatSQL.js +2 -2
- package/dist/components/FormatSQL.js.map +1 -1
- package/dist/components/Mermaid.d.ts +1 -1
- package/dist/components/Mermaid.d.ts.map +1 -1
- package/dist/components/Mermaid.js +3 -24
- package/dist/components/Mermaid.js.map +1 -1
- package/dist/components/MermaidReal.d.ts +7 -0
- package/dist/components/MermaidReal.d.ts.map +1 -0
- package/dist/components/MermaidReal.js +24 -0
- package/dist/components/MermaidReal.js.map +1 -0
- package/dist/hooks/useExplain.d.ts +0 -1
- package/dist/hooks/useExplain.d.ts.map +1 -1
- package/dist/hooks/useExplain.js.map +1 -1
- package/dist/hooks/useFetcher.d.ts.map +1 -1
- package/dist/hooks/useFetcher.js +32 -28
- package/dist/hooks/useFetcher.js.map +1 -1
- package/dist/hooks/useGraphQLChangeStream.d.ts.map +1 -1
- package/dist/hooks/useGraphQLChangeStream.js +5 -3
- package/dist/hooks/useGraphQLChangeStream.js.map +1 -1
- package/dist/hooks/usePrettify.d.ts +0 -6
- package/dist/hooks/usePrettify.d.ts.map +1 -1
- package/dist/hooks/usePrettify.js +80 -18
- package/dist/hooks/usePrettify.js.map +1 -1
- package/dist/hooks/useStorage.d.ts +7 -2
- package/dist/hooks/useStorage.d.ts.map +1 -1
- package/dist/hooks/useStorage.js +9 -4
- package/dist/hooks/useStorage.js.map +1 -1
- package/dist/interfaces.d.ts +16 -28
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/ruru.d.ts +14 -5
- package/dist/ruru.d.ts.map +1 -1
- package/dist/ruru.js +46 -43
- package/dist/ruru.js.map +1 -1
- package/package.json +26 -28
- package/ruru.css +165 -0
|
@@ -1,29 +1,91 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useCallback } from "react";
|
|
1
|
+
import { KEY_MAP, useGraphiQL, useGraphiQLActions } from "@graphiql/react";
|
|
2
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
3
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
3
4
|
/**
|
|
4
5
|
* Prettifies with 'prettier' if available, otherwise using GraphiQL's built in
|
|
5
6
|
* prettify.
|
|
6
7
|
*/
|
|
7
8
|
export const usePrettify = () => {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const { queryEditor, variableEditor, headerEditor } = useGraphiQL(({ queryEditor, variableEditor, headerEditor }) => ({
|
|
10
|
+
queryEditor,
|
|
11
|
+
variableEditor,
|
|
12
|
+
headerEditor,
|
|
13
|
+
}));
|
|
14
|
+
const { prettifyEditors: fallbackPrettify } = useGraphiQLActions();
|
|
15
|
+
const prettierRef = useRef({
|
|
16
|
+
loaded: false,
|
|
17
|
+
prettier: null,
|
|
18
|
+
plugins: [],
|
|
19
|
+
});
|
|
20
|
+
const actualPrettify = useCallback(async () => {
|
|
21
|
+
const { prettier, plugins } = prettierRef.current;
|
|
22
|
+
if (!prettier ||
|
|
23
|
+
!plugins ||
|
|
24
|
+
!queryEditor ||
|
|
25
|
+
!variableEditor ||
|
|
26
|
+
!headerEditor) {
|
|
27
|
+
fallbackPrettify();
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
for (const editor of [queryEditor, variableEditor, headerEditor]) {
|
|
31
|
+
const editorText = editor.getValue();
|
|
32
|
+
if (editorText != null) {
|
|
33
|
+
const position = editor.getPosition();
|
|
34
|
+
const model = editor.getModel();
|
|
35
|
+
const cursorOffset = position && model ? (model.getOffsetAt(position) ?? 0) : 0;
|
|
36
|
+
const parser = editor === queryEditor
|
|
37
|
+
? "graphql"
|
|
38
|
+
: editor === variableEditor || editor === headerEditor
|
|
39
|
+
? "jsonc"
|
|
40
|
+
: "json";
|
|
41
|
+
const result = await prettier.formatWithCursor(editorText, {
|
|
42
|
+
parser,
|
|
43
|
+
plugins,
|
|
44
|
+
cursorOffset,
|
|
45
|
+
});
|
|
46
|
+
editor.setValue(result.formatted);
|
|
47
|
+
if (model && result.cursorOffset > 0) {
|
|
48
|
+
editor.setPosition(model.getPositionAt(result.cursorOffset));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
14
52
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
53
|
+
}, [fallbackPrettify, headerEditor, queryEditor, variableEditor]);
|
|
54
|
+
const prettify = useCallback(() => {
|
|
55
|
+
if (prettierRef.current.loaded === false) {
|
|
56
|
+
const promise = (async () => {
|
|
57
|
+
const [prettier, estree, babel, graphql] = await Promise.all([
|
|
58
|
+
import("prettier/standalone"),
|
|
59
|
+
import("prettier/plugins/estree"),
|
|
60
|
+
import("prettier/plugins/babel"),
|
|
61
|
+
import("prettier/plugins/graphql"),
|
|
62
|
+
]);
|
|
63
|
+
prettierRef.current.prettier = prettier;
|
|
64
|
+
prettierRef.current.plugins = [estree.default, babel, graphql];
|
|
65
|
+
prettierRef.current.loaded = true;
|
|
66
|
+
})();
|
|
67
|
+
prettierRef.current.loaded = promise;
|
|
68
|
+
// Wait up to 2 seconds for Prettier to load; failing that fall back to normal prettify
|
|
69
|
+
Promise.race([promise, sleep(2000)])
|
|
70
|
+
.catch(() => { })
|
|
71
|
+
.then(actualPrettify);
|
|
23
72
|
}
|
|
24
73
|
else {
|
|
25
|
-
|
|
74
|
+
actualPrettify();
|
|
26
75
|
}
|
|
27
|
-
}, [
|
|
76
|
+
}, [actualPrettify]);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
// const action = queryEditor?.getAction('graphql-prettify')
|
|
79
|
+
// Override existing action
|
|
80
|
+
const disposable = queryEditor?.addAction({
|
|
81
|
+
id: "graphql-prettify",
|
|
82
|
+
label: "Prettify Editors",
|
|
83
|
+
contextMenuGroupId: "graphql",
|
|
84
|
+
keybindings: KEY_MAP.prettify.keybindings,
|
|
85
|
+
run: prettify,
|
|
86
|
+
});
|
|
87
|
+
return () => disposable?.dispose();
|
|
88
|
+
}, [prettify, queryEditor]);
|
|
89
|
+
return prettify;
|
|
28
90
|
};
|
|
29
91
|
//# sourceMappingURL=usePrettify.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrettify.js","sourceRoot":"","sources":["../../src/hooks/usePrettify.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"usePrettify.js","sourceRoot":"","sources":["../../src/hooks/usePrettify.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG3E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvD,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAC3B,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAE1D;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,WAAW,CAC/D,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;Q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,CAAC;iBACjC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;iBACf,IAAI,CAAC,cAAc,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,cAAc,EAAE,CAAC;QACnB,CAAC;IACH,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IACrB,SAAS,CAAC,GAAG,EAAE;QACb,4DAA4D;QAC5D,2BAA2B;QAC3B,MAAM,UAAU,GAAG,WAAW,EAAE,SAAS,CAAC;YACxC,EAAE,EAAE,kBAAkB;YACtB,KAAK,EAAE,kBAAkB;YACzB,kBAAkB,EAAE,SAAS;YAC7B,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,WAAW;YACzC,GAAG,EAAE,QAAQ;SACd,CAAC,CAAC;QACH,OAAO,GAAG,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;IAC5B,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
export interface StoredKeys {
|
|
2
|
-
saveHeaders: "true" | "";
|
|
3
2
|
explain: "true" | "";
|
|
4
3
|
explorerIsOpen: "true" | "";
|
|
5
4
|
explainIsOpen: "true" | "";
|
|
6
5
|
explainAtBottom: "true" | "";
|
|
7
6
|
explainSize: string;
|
|
8
7
|
verbose: "true" | "";
|
|
8
|
+
condensed: "true" | "";
|
|
9
|
+
onError: "PROPAGATE" | "NULL" | "HALT" | "";
|
|
9
10
|
}
|
|
11
|
+
type ToggleableKey = {
|
|
12
|
+
[K in keyof StoredKeys]: StoredKeys[K] extends "true" | "" ? K : never;
|
|
13
|
+
}[keyof StoredKeys];
|
|
10
14
|
export interface RuruStorage {
|
|
11
15
|
get<TKey extends keyof StoredKeys>(key: TKey): StoredKeys[TKey] | null;
|
|
12
16
|
set<TKey extends keyof StoredKeys>(key: TKey, value: StoredKeys[TKey]): void;
|
|
13
|
-
toggle
|
|
17
|
+
toggle(key: ToggleableKey): void;
|
|
14
18
|
}
|
|
15
19
|
export declare const useStorage: () => RuruStorage;
|
|
20
|
+
export {};
|
|
16
21
|
//# sourceMappingURL=useStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStorage.d.ts","sourceRoot":"","sources":["../../src/hooks/useStorage.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,
|
|
1
|
+
{"version":3,"file":"useStorage.d.ts","sourceRoot":"","sources":["../../src/hooks/useStorage.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,GAAG,EAAE,CAAC;IACrB,cAAc,EAAE,MAAM,GAAG,EAAE,CAAC;IAC5B,aAAa,EAAE,MAAM,GAAG,EAAE,CAAC;IAC3B,eAAe,EAAE,MAAM,GAAG,EAAE,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,EAAE,CAAC;IACvB,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC;CAC7C;AAiBD,KAAK,aAAa,GAAG;KAClB,CAAC,IAAI,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK;CACvE,CAAC,MAAM,UAAU,CAAC,CAAC;AAIpB,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,IAAI,SAAS,MAAM,UAAU,EAAE,GAAG,EAAE,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACvE,GAAG,CAAC,IAAI,SAAS,MAAM,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC7E,MAAM,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAAC;CAClC;AAED,eAAO,MAAM,UAAU,QAAO,WA6C7B,CAAC"}
|
package/dist/hooks/useStorage.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { useMemo, useState } from "react";
|
|
2
|
+
const storageDefault = {
|
|
3
|
+
onError: "",
|
|
4
|
+
};
|
|
2
5
|
const KEYS = {
|
|
3
|
-
saveHeaders: "Ruru:saveHeadersText",
|
|
4
6
|
explain: "Ruru:explain",
|
|
5
7
|
explainSize: "Ruru:explainSize",
|
|
6
8
|
explainIsOpen: "Ruru:explainIsOpen",
|
|
7
9
|
explainAtBottom: "Ruru:explainAtBottom",
|
|
8
10
|
explorerIsOpen: "graphiql:explorerIsOpen",
|
|
9
11
|
verbose: "Ruru:verbose",
|
|
12
|
+
condensed: "Ruru:condensed",
|
|
13
|
+
onError: "Ruru:onError",
|
|
10
14
|
};
|
|
11
15
|
const up = (v) => v + 1;
|
|
12
16
|
export const useStorage = () => {
|
|
@@ -19,7 +23,7 @@ export const useStorage = () => {
|
|
|
19
23
|
return {
|
|
20
24
|
_revision: revision,
|
|
21
25
|
get(key) {
|
|
22
|
-
return cache[key] ?? null;
|
|
26
|
+
return cache[key] ?? storageDefault[key] ?? null;
|
|
23
27
|
},
|
|
24
28
|
set(key, value) {
|
|
25
29
|
cache[key] = value;
|
|
@@ -37,14 +41,15 @@ export const useStorage = () => {
|
|
|
37
41
|
storage.removeItem(KEYS[key]);
|
|
38
42
|
return null;
|
|
39
43
|
}
|
|
40
|
-
return val ?? null;
|
|
44
|
+
return val ?? storageDefault[key] ?? null;
|
|
41
45
|
},
|
|
42
46
|
set(key, value) {
|
|
43
47
|
storage.setItem(KEYS[key], value);
|
|
44
48
|
bump(up);
|
|
45
49
|
},
|
|
46
50
|
toggle(key) {
|
|
47
|
-
|
|
51
|
+
const val = this.get(key);
|
|
52
|
+
if (val || (val == null && key === "condensed")) {
|
|
48
53
|
this.set(key, "");
|
|
49
54
|
}
|
|
50
55
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStorage.js","sourceRoot":"","sources":["../../src/hooks/useStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useStorage.js","sourceRoot":"","sources":["../../src/hooks/useStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAa1C,MAAM,cAAc,GAAoD;IACtE,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,MAAM,IAAI,GAA0C;IAClD,OAAO,EAAE,cAAc;IACvB,WAAW,EAAE,kBAAkB;IAC/B,aAAa,EAAE,oBAAoB;IACnC,eAAe,EAAE,sBAAsB;IACvC,cAAc,EAAE,yBAAyB;IACzC,OAAO,EAAE,cAAc;IACvB,SAAS,EAAE,gBAAgB;IAC3B,OAAO,EAAE,cAAc;CACxB,CAAC;AAMF,MAAM,EAAE,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;AAQhC,MAAM,CAAC,MAAM,UAAU,GAAG,GAAgB,EAAE;IAC1C,MAAM,OAAO,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3E,sCAAsC;IACtC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACrC,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAsB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAEnE,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;gBACL,SAAS,EAAE,QAAQ;gBACnB,GAAG,CAAC,GAAG;oBACL,OAAO,KAAK,CAAC,GAAG,CAA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xB,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AACjC,CAAC,CAAC"}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import type { Fetcher } from "@graphiql/toolkit";
|
|
2
2
|
import type { GraphiQLProps } from "graphiql";
|
|
3
3
|
export { Fetcher };
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The `EventSource` specification only specifies the `withCredentials` option,
|
|
6
|
+
* but some implementations support additional options. Our configuration
|
|
7
|
+
* allows arbitrary options.
|
|
8
|
+
*/
|
|
9
|
+
interface RuruEventSourceInit extends EventSourceInit, Record<string, any> {
|
|
10
|
+
}
|
|
11
|
+
export interface RuruProps extends Pick<GraphiQLProps, "editorTheme" | "defaultTheme" | "maxHistoryLength" | "inputValueDeprecation" | "schemaDescription" | "showPersistHeadersSettings" | "onEditQuery" | "onEditVariables" | "onEditHeaders" | "responseTooltip" | "defaultEditorToolsVisibility" | "isHeadersEditorEnabled" | "forcedTheme" | "confirmCloseTab" | "className" | "initialVariables" | "initialQuery" | "initialHeaders" | "defaultQuery" | "defaultHeaders"> {
|
|
5
12
|
/**
|
|
6
13
|
* Optionally override the fetcher.
|
|
7
14
|
*/
|
|
@@ -14,7 +21,6 @@ export interface RuruProps {
|
|
|
14
21
|
* The URL to the GraphQL subscriptions endpoint. (ws:// or wss://)
|
|
15
22
|
*/
|
|
16
23
|
subscriptionEndpoint?: string;
|
|
17
|
-
editorTheme?: GraphiQLProps["editorTheme"];
|
|
18
24
|
/**
|
|
19
25
|
* The list of debug tools available to the user.
|
|
20
26
|
*
|
|
@@ -23,32 +29,14 @@ export interface RuruProps {
|
|
|
23
29
|
*/
|
|
24
30
|
debugTools?: Array<"explain" | "plan">;
|
|
25
31
|
/**
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated Use `variables` instead
|
|
35
|
-
*/
|
|
36
|
-
initialVariables?: string;
|
|
37
|
-
/**
|
|
38
|
-
* The query to prepopulate the editor with.
|
|
39
|
-
*/
|
|
40
|
-
query?: string;
|
|
41
|
-
/**
|
|
42
|
-
* The variables to prepopulate the editor with.
|
|
43
|
-
*/
|
|
44
|
-
variables?: string;
|
|
45
|
-
/**
|
|
46
|
-
* Callback executed when the current query changes.
|
|
47
|
-
*/
|
|
48
|
-
onEditQuery?: GraphiQLProps["onEditQuery"];
|
|
49
|
-
/**
|
|
50
|
-
* Callback executed when the variables change.
|
|
32
|
+
* Will be passed to `new EventSource(url, eventSourceInit)`.
|
|
33
|
+
*
|
|
34
|
+
* Per the specification, the only option is `withCredentials`; however, some
|
|
35
|
+
* implementations support additional options. For example:
|
|
36
|
+
*
|
|
37
|
+
* - `reconnectInterval: 1000`
|
|
38
|
+
* - `maxReconnectAttempts: 3`
|
|
51
39
|
*/
|
|
52
|
-
|
|
40
|
+
eventSourceInit?: RuruEventSourceInit;
|
|
53
41
|
}
|
|
54
42
|
//# sourceMappingURL=interfaces.d.ts.map
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB;;;;GAIG;AACH,UAAU,mBAAoB,SAAQ,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAAG;AAE7E,MAAM,WAAW,SACf,SAAQ,IAAI,CACV,aAAa,EACX,aAAa,GACb,cAAc,GACd,kBAAkB,GAClB,uBAAuB,GACvB,mBAAmB,GACnB,4BAA4B,GAC5B,aAAa,GACb,iBAAiB,GACjB,eAAe,GACf,iBAAiB,GACjB,8BAA8B,GAC9B,wBAAwB,GACxB,aAAa,GACb,iBAAiB,GACjB,WAAW,GACX,kBAAkB,GAClB,cAAc,GACd,gBAAgB,GAChB,cAAc,GACd,gBAAgB,CACnB;IACD;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC;IAEvC;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,mBAAmB,CAAC;CACvC"}
|
package/dist/ruru.d.ts
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { FC } from "react";
|
|
1
|
+
import { GraphiQLInterface } from "graphiql";
|
|
2
|
+
import type { ComponentProps, FC } from "react";
|
|
3
3
|
import type { RuruStorage } from "./hooks/useStorage.js";
|
|
4
4
|
import type { RuruProps } from "./interfaces.js";
|
|
5
|
+
type GraphiQLInterfaceProps = ComponentProps<typeof GraphiQLInterface>;
|
|
5
6
|
export declare const Ruru: FC<RuruProps>;
|
|
6
7
|
export declare const RuruInner: FC<{
|
|
7
|
-
editorTheme?: string;
|
|
8
8
|
storage: RuruStorage;
|
|
9
9
|
error: Error | null;
|
|
10
10
|
setError: React.Dispatch<React.SetStateAction<Error | null>>;
|
|
11
|
-
onEditQuery?: GraphiQLProps["onEditQuery"];
|
|
12
|
-
onEditVariables?: GraphiQLProps["onEditVariables"];
|
|
13
11
|
streamEndpoint: string | null;
|
|
12
|
+
showPersistHeadersSettings?: GraphiQLInterfaceProps["showPersistHeadersSettings"];
|
|
13
|
+
onEditQuery?: GraphiQLInterfaceProps["onEditQuery"];
|
|
14
|
+
onEditVariables?: GraphiQLInterfaceProps["onEditVariables"];
|
|
15
|
+
onEditHeaders?: GraphiQLInterfaceProps["onEditHeaders"];
|
|
16
|
+
responseTooltip?: GraphiQLInterfaceProps["responseTooltip"];
|
|
17
|
+
defaultEditorToolsVisibility?: GraphiQLInterfaceProps["defaultEditorToolsVisibility"];
|
|
18
|
+
isHeadersEditorEnabled?: GraphiQLInterfaceProps["isHeadersEditorEnabled"];
|
|
19
|
+
forcedTheme?: GraphiQLInterfaceProps["forcedTheme"];
|
|
20
|
+
confirmCloseTab?: GraphiQLInterfaceProps["confirmCloseTab"];
|
|
21
|
+
className?: GraphiQLInterfaceProps["className"];
|
|
14
22
|
}>;
|
|
23
|
+
export {};
|
|
15
24
|
//# sourceMappingURL=ruru.d.ts.map
|
package/dist/ruru.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ruru.d.ts","sourceRoot":"","sources":["../src/ruru.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ruru.d.ts","sourceRoot":"","sources":["../src/ruru.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAY,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAUhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,KAAK,sBAAsB,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAgBvE,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAsE9B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC;IAEzB,OAAO,EAAE,WAAW,CAAC;IACrB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;IAC7D,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,0BAA0B,CAAC,EAAE,sBAAsB,CAAC,4BAA4B,CAAC,CAAC;IAClF,WAAW,CAAC,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;IACpD,eAAe,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAC5D,aAAa,CAAC,EAAE,sBAAsB,CAAC,eAAe,CAAC,CAAC;IACxD,eAAe,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAC5D,4BAA4B,CAAC,EAAE,sBAAsB,CAAC,8BAA8B,CAAC,CAAC;IACtF,sBAAsB,CAAC,EAAE,sBAAsB,CAAC,wBAAwB,CAAC,CAAC;IAC1E,WAAW,CAAC,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;IACpD,eAAe,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAC5D,SAAS,CAAC,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAC;CACjD,CAkIA,CAAC"}
|
package/dist/ruru.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { DOC_EXPLORER_PLUGIN, DocExplorerStore, } from "@graphiql/plugin-doc-explorer";
|
|
2
3
|
import { explorerPlugin as makeExplorerPlugin } from "@graphiql/plugin-explorer";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { HISTORY_PLUGIN, HistoryStore } from "@graphiql/plugin-history";
|
|
5
|
+
import { CopyIcon, GraphiQLProvider, MergeIcon, PrettifyIcon, SettingsIcon, ToolbarButton, ToolbarMenu, useGraphiQLActions, } from "@graphiql/react";
|
|
6
|
+
import { GraphiQL, GraphiQLInterface } from "graphiql";
|
|
5
7
|
import { useCallback, useMemo, useState } from "react";
|
|
6
8
|
import { ErrorPopup } from "./components/ErrorPopup.js";
|
|
7
9
|
import { RuruFooter } from "./components/Footer.js";
|
|
@@ -12,61 +14,62 @@ import { useGraphQLChangeStream } from "./hooks/useGraphQLChangeStream.js";
|
|
|
12
14
|
import { usePrettify } from "./hooks/usePrettify.js";
|
|
13
15
|
import { useStorage } from "./hooks/useStorage.js";
|
|
14
16
|
import { EXPLAIN_PLUGIN } from "./plugins/explain.js";
|
|
15
|
-
if (GP2 !== GraphiQLProvider) {
|
|
16
|
-
throw new Error("PACKAGE MANAGEMENT ERROR! The providers don't match up!");
|
|
17
|
-
}
|
|
18
17
|
const checkCss = { width: "1.5rem", display: "inline-block" };
|
|
19
18
|
const check = _jsx("span", { style: checkCss, children: "\u2714" });
|
|
20
19
|
const nocheck = _jsx("span", { style: checkCss });
|
|
20
|
+
const explorerPlugin = makeExplorerPlugin({
|
|
21
|
+
showAttribution: false,
|
|
22
|
+
});
|
|
23
|
+
const plugins = [
|
|
24
|
+
DOC_EXPLORER_PLUGIN,
|
|
25
|
+
HISTORY_PLUGIN,
|
|
26
|
+
explorerPlugin,
|
|
27
|
+
EXPLAIN_PLUGIN,
|
|
28
|
+
];
|
|
21
29
|
export const Ruru = (props) => {
|
|
30
|
+
const { inputValueDeprecation, schemaDescription, defaultQuery, showPersistHeadersSettings,
|
|
31
|
+
// Things we're handling elsewhere
|
|
32
|
+
fetcher: _fetcher, debugTools: _debugTools,
|
|
33
|
+
// Deprecated stuff
|
|
34
|
+
["query"]: _query, ["variables"]: _variables,
|
|
35
|
+
// Pass everything else through to GraphiQL
|
|
36
|
+
...otherProps } = props;
|
|
22
37
|
const storage = useStorage();
|
|
23
38
|
const explain = storage.get("explain") === "true";
|
|
24
39
|
const verbose = storage.get("verbose") === "true";
|
|
25
|
-
const
|
|
26
|
-
const setExplain = useCallback((newExplain) => {
|
|
27
|
-
storage.set("explain", newExplain ? "true" : "");
|
|
28
|
-
}, [storage]);
|
|
40
|
+
const setExplain = useCallback((newExplain) => void storage.set("explain", newExplain ? "true" : ""), [storage]);
|
|
29
41
|
const { fetcher, explainResults, streamEndpoint } = useFetcher(props, {
|
|
30
42
|
explain,
|
|
31
43
|
verbose,
|
|
32
44
|
});
|
|
33
45
|
const [error, setError] = useState(null);
|
|
34
46
|
const explainHelpers = useExplain(storage);
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
setExplain,
|
|
48
|
-
explainResults,
|
|
49
|
-
}, children: _jsx(GraphiQLProvider, { fetcher: fetcher, defaultQuery: defaultQuery, query: props.query ?? props.initialQuery, variables: props.variables ?? props.initialVariables, plugins: plugins, shouldPersistHeaders: saveHeaders, children: _jsx(RuruInner, { storage: storage, editorTheme: props.editorTheme, error: error, setError: setError, onEditQuery: props.onEditQuery, onEditVariables: props.onEditVariables, streamEndpoint: streamEndpoint }) }) }));
|
|
47
|
+
const explainContextValue = useMemo(() => ({ explain, explainHelpers, explainResults, setExplain }), [explain, explainHelpers, explainResults, setExplain]);
|
|
48
|
+
return (_jsx(GraphiQLProvider, { ...otherProps, inputValueDeprecation: inputValueDeprecation ?? true, schemaDescription: schemaDescription ?? true, fetcher: fetcher, defaultQuery: defaultQuery ?? DEFAULT_QUERY, plugins: plugins, children: _jsx(ExplainContext.Provider, { value: explainContextValue, children: _jsx(HistoryStore, { maxHistoryLength: props.maxHistoryLength, children: _jsx(DocExplorerStore, { children: _jsx(RuruInner, { ...otherProps, showPersistHeadersSettings: showPersistHeadersSettings ?? true,
|
|
49
|
+
// onEditQuery={props.onEditQuery}
|
|
50
|
+
// onEditVariables={props.onEditVariables}
|
|
51
|
+
// onEditHeaders={props.onEditHeaders}
|
|
52
|
+
// responseTooltip={props.responseTooltip}
|
|
53
|
+
// defaultEditorToolsVisibility={props.defaultEditorToolsVisibility}
|
|
54
|
+
// isHeadersEditorEnabled={props.isHeadersEditorEnabled}
|
|
55
|
+
// forcedTheme={props.forcedTheme}
|
|
56
|
+
// confirmCloseTab={props.confirmCloseTab}
|
|
57
|
+
// className={props.className}
|
|
58
|
+
storage: storage, error: error, setError: setError, streamEndpoint: streamEndpoint }) }) }) }) }));
|
|
50
59
|
};
|
|
51
60
|
export const RuruInner = (props) => {
|
|
52
|
-
const { storage,
|
|
61
|
+
const { storage, error, setError, streamEndpoint, ...graphiqlInterfaceProps } = props;
|
|
53
62
|
const prettify = usePrettify();
|
|
54
|
-
const mergeQuery =
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}, children: [_jsx("div", { style: {
|
|
66
|
-
display: "flex",
|
|
67
|
-
flex: "1 1 100%",
|
|
68
|
-
overflow: "hidden",
|
|
69
|
-
position: "relative",
|
|
70
|
-
}, children: _jsxs(GraphiQLInterface, { editorTheme: editorTheme ?? "graphiql", onEditQuery: onEditQuery, onEditVariables: onEditVariables, children: [_jsx(GraphiQL.Logo, { children: _jsx("a", { href: "https://grafast.org/ruru", style: { textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: "Ruru" }) }), _jsxs(GraphiQL.Toolbar, { children: [_jsx(ToolbarButton, { onClick: prettify, label: "Prettify Query (Shift-Ctrl-P)", children: _jsx(PrettifyIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) }), _jsx(ToolbarButton, { onSelect: mergeQuery, label: "Merge Query (Shift-Ctrl-M)", children: _jsx(MergeIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) }), _jsx(ToolbarButton, { onClick: copyQuery, label: "Copy query (Shift-Ctrl-C)", children: _jsx(CopyIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) }), _jsxs(ToolbarMenu, { label: "Options", button: _jsx(ToolbarButton, { label: "Options", children: _jsx(SettingsIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) }), children: [_jsx(ToolbarMenu.Item, { title: "View the SQL statements that this query invokes", onSelect: () => storage.toggle("explain"), children: _jsxs("span", { children: [storage.get("explain") === "true" ? check : nocheck, "Explain (if supported)"] }) }), _jsx(ToolbarMenu.Item, { title: "Don't hide explain from results", onSelect: () => storage.toggle("verbose"), children: _jsxs("span", { children: [storage.get("verbose") === "true" ? check : nocheck, "Verbose"] }) }), _jsx(ToolbarMenu.Item, { title: "Should we persist the headers to localStorage? Header editor is next to variable editor at the bottom.", onSelect: () => storage.toggle("saveHeaders"), children: _jsxs("span", { children: [storage.get("saveHeaders") === "true" ? check : nocheck, "Save headers"] }) })] })] }), _jsx(GraphiQL.Footer, { children: _jsx(RuruFooter, {}) })] }) }), error ? (_jsx(ErrorPopup, { error: error, onClose: () => setError(null) })) : null] }));
|
|
63
|
+
const { copyQuery, mergeQuery, introspect } = useGraphiQLActions();
|
|
64
|
+
useGraphQLChangeStream(props, introspect, streamEndpoint);
|
|
65
|
+
const condensed = storage.get("condensed") !== "";
|
|
66
|
+
return (_jsxs(_Fragment, { children: [_jsxs(GraphiQLInterface, { ...graphiqlInterfaceProps, className: `${graphiqlInterfaceProps.className ?? ""}${condensed ? " condensed" : ""}`, children: [_jsx(GraphiQL.Logo, { children: _jsx("a", { href: "https://grafast.org/ruru", style: { textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: "Ruru" }) }), _jsxs(GraphiQL.Toolbar, { children: [_jsx(ToolbarButton, { onClick: prettify, label: "Prettify Query (Shift-Ctrl-P)", children: _jsx(PrettifyIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) }), _jsx(ToolbarButton, { onSelect: mergeQuery, label: "Merge Query (Shift-Ctrl-M)", children: _jsx(MergeIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) }), _jsx(ToolbarButton, { onClick: copyQuery, label: "Copy query (Shift-Ctrl-C)", children: _jsx(CopyIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) }), _jsxs(ToolbarMenu, { button: _jsx(ToolbarButton, { label: "Options", children: _jsx(SettingsIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) }), children: [_jsx(ToolbarMenu.Item, { title: "View the SQL statements that this query invokes", onSelect: () => storage.toggle("explain"), children: _jsxs("span", { children: [storage.get("explain") === "true" ? check : nocheck, "Explain (if supported)"] }) }), _jsx(ToolbarMenu.Item, { title: "Don't hide explain from results", onSelect: () => storage.toggle("verbose"), children: _jsxs("span", { children: [storage.get("verbose") === "true" ? check : nocheck, "Verbose"] }) }), _jsx(ToolbarMenu.Item, { title: "Condensed", onSelect: () => storage.toggle("condensed"), children: _jsxs("span", { children: [storage.get("condensed") !== "" ? check : nocheck, "Condensed"] }) }), _jsx(ToolbarMenu.Item, { title: "Traditional GraphQL error handling", onSelect: () => {
|
|
67
|
+
if (storage.get("onError") === "PROPAGATE") {
|
|
68
|
+
storage.set("onError", "");
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
storage.set("onError", "PROPAGATE");
|
|
72
|
+
}
|
|
73
|
+
}, children: _jsxs("span", { children: [storage.get("onError") === "PROPAGATE" ? check : nocheck, "onError: PROPAGATE"] }) }), _jsx(ToolbarMenu.Item, { title: "Client becomes responsible for error handling", onSelect: () => storage.set("onError", "NULL"), children: _jsxs("span", { children: [storage.get("onError") === "NULL" ? check : nocheck, "onError: NULL"] }) }), _jsx(ToolbarMenu.Item, { title: "Stop execution on the first error", onSelect: () => storage.set("onError", "HALT"), children: _jsxs("span", { children: [storage.get("onError") === "HALT" ? check : nocheck, "onError: HALT"] }) })] })] }), _jsx(GraphiQL.Footer, { children: _jsx(RuruFooter, {}) })] }), error ? (_jsx(ErrorPopup, { error: error, onClose: () => setError(null) })) : null] }));
|
|
71
74
|
};
|
|
72
75
|
//# sourceMappingURL=ruru.js.map
|
package/dist/ruru.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ruru.js","sourceRoot":"","sources":["../src/ruru.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"ruru.js","sourceRoot":"","sources":["../src/ruru.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM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AAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,0BAEpD,GACU,EACnB,KAAC,WAAW,CAAC,IAAI,IACf,KAAK,EAAC,+CAA+C,EACrD,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,YAE9C,2BACG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,qBAE/C,GACU,EACnB,KAAC,WAAW,CAAC,IAAI,IACf,KAAK,EAAC,mCAAmC,EACzC,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,YAE9C,2BACG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,qBAE/C,GACU,IACP,IACG,EAEnB,KAAC,QAAQ,CAAC,MAAM,cACd,KAAC,UAAU,KAAG,GACE,IACA,EACnB,KAAK,CAAC,CAAC,CAAC,CACP,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAI,CAC5D,CAAC,CAAC,CAAC,IAAI,IACP,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ruru-components",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.2",
|
|
4
4
|
"description": "Grafast-flavoured GraphiQL distribution; the underlying React components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -38,28 +38,26 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://grafast.org/ruru/",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@graphiql/plugin-explorer": "^0.
|
|
42
|
-
"@graphiql/
|
|
43
|
-
"@graphiql/
|
|
44
|
-
"@
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
41
|
+
"@graphiql/plugin-doc-explorer": "^0.4.1",
|
|
42
|
+
"@graphiql/plugin-explorer": "^5.1.1",
|
|
43
|
+
"@graphiql/plugin-history": "^0.4.1",
|
|
44
|
+
"@graphiql/react": "^0.37.2",
|
|
45
|
+
"@graphiql/toolkit": "^0.11.3",
|
|
46
|
+
"@types/node": "^22.19.1",
|
|
47
|
+
"grafast": "^1.0.0-rc.2",
|
|
48
|
+
"graphiql": "^5.2.1",
|
|
49
|
+
"graphql-ws": "^6.0.5",
|
|
50
|
+
"mermaid": "^11.12.1",
|
|
51
|
+
"prettier": "^3.6.2",
|
|
52
|
+
"react": "^19.2.0",
|
|
53
|
+
"react-dom": "^19.2.0",
|
|
54
|
+
"tslib": "^2.8.1"
|
|
51
55
|
},
|
|
52
56
|
"engines": {
|
|
53
57
|
"node": ">=16"
|
|
54
58
|
},
|
|
55
59
|
"peerDependencies": {
|
|
56
|
-
"graphql": "^16.
|
|
57
|
-
"tamedevil": "^0.0.0-beta.3"
|
|
58
|
-
},
|
|
59
|
-
"peerDependenciesMeta": {
|
|
60
|
-
"tamedevil": {
|
|
61
|
-
"optional": true
|
|
62
|
-
}
|
|
60
|
+
"graphql": "^16.9.0"
|
|
63
61
|
},
|
|
64
62
|
"files": [
|
|
65
63
|
"dist",
|
|
@@ -67,15 +65,15 @@
|
|
|
67
65
|
"ruru.css"
|
|
68
66
|
],
|
|
69
67
|
"devDependencies": {
|
|
70
|
-
"@types/codemirror": "^5.60.
|
|
71
|
-
"@types/debug": "^4.1.
|
|
72
|
-
"@types/jest": "^
|
|
73
|
-
"@types/nodemon": "1.
|
|
74
|
-
"@types/react": "^
|
|
75
|
-
"@types/react-dom": "^
|
|
76
|
-
"graphql": "16.
|
|
77
|
-
"jest": "^
|
|
78
|
-
"nodemon": "^3.
|
|
79
|
-
"typescript": "^5.
|
|
68
|
+
"@types/codemirror": "^5.60.17",
|
|
69
|
+
"@types/debug": "^4.1.12",
|
|
70
|
+
"@types/jest": "^30.0.0",
|
|
71
|
+
"@types/nodemon": "^3.1.1",
|
|
72
|
+
"@types/react": "^19.2.7",
|
|
73
|
+
"@types/react-dom": "^19.2.3",
|
|
74
|
+
"graphql": "^16.9.0",
|
|
75
|
+
"jest": "^30.2.0",
|
|
76
|
+
"nodemon": "^3.1.11",
|
|
77
|
+
"typescript": "^5.9.3"
|
|
80
78
|
}
|
|
81
79
|
}
|