Socket
Socket
Sign inDemoInstall

@graphiql/react

Package Overview
Dependencies
Maintainers
2
Versions
285
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphiql/react - npm Package Compare versions

Comparing version 0.5.0-canary-93a7238c.0 to 0.5.0-canary-96b6e4e7.0

README.md

2

dist/graphiql-react.cjs.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var e=require("./index.cjs.js");require("graphql");require("react");require("react-dom");exports.Argument=e.Argument;exports.ArgumentIcon=e.ArgumentIcon;exports.Button=e.Button;exports.ButtonGroup=e.ButtonGroup;exports.ChevronDownIcon=e.ChevronDownIcon;exports.ChevronLeftIcon=e.ChevronLeftIcon;exports.ChevronUpIcon=e.ChevronUpIcon;exports.CloseIcon=e.CloseIcon;exports.CopyIcon=e.CopyIcon;exports.DefaultValue=e.DefaultValue;exports.DeprecatedArgumentIcon=e.DeprecatedArgumentIcon;exports.DeprecatedFieldIcon=e.DeprecatedFieldIcon;exports.Directive=e.Directive;exports.DocsIcon=e.DocsIcon;exports.Dropdown=e.Dropdown;exports.EditorContext=e.EditorContext;exports.EditorContextProvider=e.EditorContextProvider;exports.ExecuteButton=e.ExecuteButton;exports.ExecutionContext=e.ExecutionContext;exports.ExecutionContextProvider=e.ExecutionContextProvider;exports.ExplorerContext=e.ExplorerContext;exports.ExplorerContextProvider=e.ExplorerContextProvider;exports.ExplorerSection=e.ExplorerSection;exports.FieldIcon=e.FieldIcon;exports.FieldLink=e.FieldLink;exports.HeaderEditor=e.HeaderEditor;exports.History=e.History;exports.HistoryContext=e.HistoryContext;exports.HistoryContextProvider=e.HistoryContextProvider;exports.HistoryIcon=e.HistoryIcon;exports.ImagePreview=e.ImagePreview;exports.KeyboardShortcutIcon=e.KeyboardShortcutIcon;exports.MarkdownContent=e.MarkdownContent;exports.MergeIcon=e.MergeIcon;exports.PenIcon=e.PenIcon;exports.PlayIcon=e.PlayIcon;exports.PlusIcon=e.PlusIcon;exports.PrettifyIcon=e.PrettifyIcon;exports.QueryEditor=e.QueryEditor;exports.ResponseEditor=e.ResponseEditor;exports.RootTypeIcon=e.RootTypeIcon;exports.SchemaContext=e.SchemaContext;exports.SchemaContextProvider=e.SchemaContextProvider;exports.SettingsIcon=e.SettingsIcon;exports.Spinner=e.Spinner;exports.StarFilledIcon=e.StarFilledIcon;exports.StarIcon=e.StarIcon;exports.StopIcon=e.StopIcon;exports.StorageContext=e.StorageContext;exports.StorageContextProvider=e.StorageContextProvider;exports.ToolbarButton=e.ToolbarButton;exports.TypeIcon=e.TypeIcon;exports.TypeLink=e.TypeLink;exports.UnStyledButton=e.UnStyledButton;exports.VariableEditor=e.VariableEditor;exports.onHasCompletion=e.onHasCompletion;exports.useAutoCompleteLeafs=e.useAutoCompleteLeafs;exports.useCopyQuery=e.useCopyQuery;exports.useDragResize=e.useDragResize;exports.useEditorContext=e.useEditorContext;exports.useExecutionContext=e.useExecutionContext;exports.useExplorerContext=e.useExplorerContext;exports.useHeaderEditor=e.useHeaderEditor;exports.useHistoryContext=e.useHistoryContext;exports.useMergeQuery=e.useMergeQuery;exports.usePrettifyEditors=e.usePrettifyEditors;exports.useQueryEditor=e.useQueryEditor;exports.useResponseEditor=e.useResponseEditor;exports.useSchemaContext=e.useSchemaContext;exports.useStorageContext=e.useStorageContext;exports.useVariableEditor=e.useVariableEditor;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var e=require("./index.cjs.js");require("graphql");require("react");require("react-dom");exports.ChevronDownIcon=e.ChevronDownIcon;exports.ChevronUpIcon=e.ChevronUpIcon;exports.CopyIcon=e.CopyIcon;exports.Dropdown=e.Dropdown;exports.EditorContext=e.EditorContext;exports.EditorContextProvider=e.EditorContextProvider;exports.ExecuteButton=e.ExecuteButton;exports.ExecutionContext=e.ExecutionContext;exports.ExecutionContextProvider=e.ExecutionContextProvider;exports.ExplorerContext=e.ExplorerContext;exports.ExplorerContextProvider=e.ExplorerContextProvider;exports.HeaderEditor=e.HeaderEditor;exports.HistoryContext=e.HistoryContext;exports.HistoryContextProvider=e.HistoryContextProvider;exports.ImagePreview=e.ImagePreview;exports.MergeIcon=e.MergeIcon;exports.PlayIcon=e.PlayIcon;exports.PrettifyIcon=e.PrettifyIcon;exports.QueryEditor=e.QueryEditor;exports.ResponseEditor=e.ResponseEditor;exports.SchemaContext=e.SchemaContext;exports.SchemaContextProvider=e.SchemaContextProvider;exports.Spinner=e.Spinner;exports.StopIcon=e.StopIcon;exports.StorageContext=e.StorageContext;exports.StorageContextProvider=e.StorageContextProvider;exports.ToolbarButton=e.ToolbarButton;exports.UnStyledButton=e.UnStyledButton;exports.VariableEditor=e.VariableEditor;exports.onHasCompletion=e.onHasCompletion;exports.useAutoCompleteLeafs=e.useAutoCompleteLeafs;exports.useCopyQuery=e.useCopyQuery;exports.useDragResize=e.useDragResize;exports.useEditorContext=e.useEditorContext;exports.useExecutionContext=e.useExecutionContext;exports.useExplorerContext=e.useExplorerContext;exports.useHeaderEditor=e.useHeaderEditor;exports.useHistoryContext=e.useHistoryContext;exports.useMergeQuery=e.useMergeQuery;exports.usePrettifyEditors=e.usePrettifyEditors;exports.useQueryEditor=e.useQueryEditor;exports.useResponseEditor=e.useResponseEditor;exports.useSchemaContext=e.useSchemaContext;exports.useSelectHistoryItem=e.useSelectHistoryItem;exports.useStorageContext=e.useStorageContext;exports.useVariableEditor=e.useVariableEditor;

@@ -1,4 +0,4 @@

export { A as Argument, Z as ArgumentIcon, an as Button, ao as ButtonGroup, _ as ChevronDownIcon, $ as ChevronLeftIcon, a0 as ChevronUpIcon, a1 as CloseIcon, a2 as CopyIcon, D as DefaultValue, a3 as DeprecatedArgumentIcon, a4 as DeprecatedFieldIcon, w as Directive, a5 as DocsIcon, ap as Dropdown, E as EditorContext, a as EditorContextProvider, al as ExecuteButton, r as ExecutionContext, s as ExecutionContextProvider, x as ExplorerContext, y as ExplorerContextProvider, z as ExplorerSection, a6 as FieldIcon, F as FieldLink, H as HeaderEditor, G as History, J as HistoryContext, K as HistoryContextProvider, a7 as HistoryIcon, b as ImagePreview, a8 as KeyboardShortcutIcon, aq as MarkdownContent, a9 as MergeIcon, aa as PenIcon, ab as PlayIcon, ac as PlusIcon, ad as PrettifyIcon, Q as QueryEditor, e as ResponseEditor, ae as RootTypeIcon, S as SchemaContext, N as SchemaContextProvider, af as SettingsIcon, ar as Spinner, ag as StarFilledIcon, ah as StarIcon, ai as StopIcon, U as StorageContext, W as StorageContextProvider, ak as ToolbarButton, aj as TypeIcon, T as TypeLink, am as UnStyledButton, V as VariableEditor, d as onHasCompletion, u as useAutoCompleteLeafs, f as useCopyQuery, Y as useDragResize, g as useEditorContext, v as useExecutionContext, B as useExplorerContext, h as useHeaderEditor, M as useHistoryContext, j as useMergeQuery, k as usePrettifyEditors, m as useQueryEditor, n as useResponseEditor, O as useSchemaContext, X as useStorageContext, q as useVariableEditor } from "./index.es.js";
export { O as ChevronDownIcon, T as ChevronUpIcon, U as CopyIcon, a1 as Dropdown, E as EditorContext, a as EditorContextProvider, $ as ExecuteButton, r as ExecutionContext, s as ExecutionContextProvider, w as ExplorerContext, x as ExplorerContextProvider, H as HeaderEditor, z as HistoryContext, A as HistoryContextProvider, b as ImagePreview, W as MergeIcon, X as PlayIcon, Y as PrettifyIcon, Q as QueryEditor, e as ResponseEditor, S as SchemaContext, F as SchemaContextProvider, a2 as Spinner, Z as StopIcon, J as StorageContext, K as StorageContextProvider, _ as ToolbarButton, a0 as UnStyledButton, V as VariableEditor, d as onHasCompletion, u as useAutoCompleteLeafs, f as useCopyQuery, N as useDragResize, g as useEditorContext, v as useExecutionContext, y as useExplorerContext, h as useHeaderEditor, B as useHistoryContext, j as useMergeQuery, k as usePrettifyEditors, m as useQueryEditor, n as useResponseEditor, G as useSchemaContext, D as useSelectHistoryItem, M as useStorageContext, q as useVariableEditor } from "./index.es.js";
import "graphql";
import "react";
import "react-dom";
{
"name": "@graphiql/react",
"version": "0.5.0-canary-93a7238c.0",
"version": "0.5.0-canary-96b6e4e7.0",
"repository": {

@@ -17,2 +17,8 @@ "type": "git",

"types": "types/index.d.ts",
"keywords": [
"react",
"graphql",
"sdk",
"codemirror"
],
"files": [

@@ -37,3 +43,3 @@ "dist",

"codemirror": "^5.65.3",
"codemirror-graphql": "^2.0.0-canary-93a7238c.0",
"codemirror-graphql": "^2.0.0-canary-96b6e4e7.0",
"copy-to-clipboard": "^3.2.0",

@@ -45,3 +51,2 @@ "graphql-language-service": "^5.0.6",

"devDependencies": {
"@testing-library/react": "9.4.1",
"@types/codemirror": "^5.60.5",

@@ -48,0 +53,0 @@ "@types/set-value": "^4.0.1",

import type { Editor, EditorChange } from 'codemirror';
import type { IHint } from 'codemirror-graphql/hint';
import {
GraphQLNamedType,
GraphQLSchema,
GraphQLType,
isListType,
isNonNullType,
} from 'graphql';
import { GraphQLSchema, GraphQLType, isListType, isNonNullType } from 'graphql';

@@ -24,3 +18,2 @@ import { ExplorerContextType } from '../explorer';

explorer: ExplorerContextType | null,
callback: (type: GraphQLNamedType) => void,
) {

@@ -243,5 +236,4 @@ importCodeMirror([], { useCommonAddons: false }).then(CodeMirror => {

explorer.push({ name: type.name, def: type });
callback?.(type);
}
}
}
import { fillLeafs, GetDefaultFieldNamesFn, mergeAst } from '@graphiql/toolkit';
import { EditorChange } from 'codemirror';
import copyToClipboard from 'copy-to-clipboard';

@@ -6,5 +7,7 @@ import { parse, print } from 'graphql';

import { useExplorerContext } from '../explorer';
import { useSchemaContext } from '../schema';
import { useStorageContext } from '../storage';
import debounce from '../utility/debounce';
import { onHasCompletion } from './completion';
import { useEditorContext } from './context';

@@ -70,2 +73,33 @@ import { CodeMirrorEditor } from './types';

export function useCompletion(
editor: CodeMirrorEditor | null,
caller: Function,
) {
const { schema } = useSchemaContext({ nonNull: true, caller });
const explorer = useExplorerContext();
useEffect(() => {
if (!editor) {
return;
}
const handleCompletion = (
instance: CodeMirrorEditor,
changeObj?: EditorChange,
) => {
onHasCompletion(instance, changeObj, schema, explorer);
};
editor.on(
// @ts-expect-error @TODO additional args for hasCompletion event
'hasCompletion',
handleCompletion,
);
return () =>
editor.off(
// @ts-expect-error @TODO additional args for hasCompletion event
'hasCompletion',
handleCompletion,
);
}, [editor, explorer, schema]);
}
type EmptyCallback = () => void;

@@ -72,0 +106,0 @@

@@ -1,3 +0,2 @@

export { History } from './components';
export {
import {
HistoryContext,

@@ -7,3 +6,13 @@ HistoryContextProvider,

} from './context';
import { useSelectHistoryItem } from './hooks';
export type { HistoryContextType } from './context';
import type { HistoryContextType } from './context';
export {
HistoryContext,
HistoryContextProvider,
useHistoryContext,
useSelectHistoryItem,
};
export type { HistoryContextType };

@@ -26,17 +26,11 @@ export {

export {
Argument,
DefaultValue,
Directive,
ExplorerContext,
ExplorerContextProvider,
ExplorerSection,
FieldLink,
TypeLink,
useExplorerContext,
} from './explorer';
export {
History,
HistoryContext,
HistoryContextProvider,
useHistoryContext,
useSelectHistoryItem,
} from './history';

@@ -80,1 +74,2 @@ export * from './icons';

import './style/root.css';
import './style/markdown.css';
import MarkdownIt from 'markdown-it';
export const markdown = new MarkdownIt({
breaks: true,
linkify: true,
});
export const markdown = new MarkdownIt();
export * from './button';
export * from './button-group';
export * from './dropdown';
export * from './markdown';
export * from './spinner';
import type { Editor, EditorChange } from 'codemirror';
import { GraphQLNamedType, GraphQLSchema } from 'graphql';
import { GraphQLSchema } from 'graphql';
import { ExplorerContextType } from '../explorer';

@@ -8,2 +8,2 @@ /**

*/
export declare function onHasCompletion(_cm: Editor, data: EditorChange | undefined, schema: GraphQLSchema | null | undefined, explorer: ExplorerContextType | null, callback: (type: GraphQLNamedType) => void): void;
export declare function onHasCompletion(_cm: Editor, data: EditorChange | undefined, schema: GraphQLSchema | null | undefined, explorer: ExplorerContextType | null): void;

@@ -11,3 +11,3 @@ /// <reference types="react" />

};
export declare function useHeaderEditor({ editorTheme, keyMap, onEdit, readOnly, shouldPersistHeaders, }?: UseHeaderEditorArgs): import("react").RefObject<HTMLDivElement>;
export declare function useHeaderEditor({ editorTheme, keyMap, onEdit, readOnly, shouldPersistHeaders, }?: UseHeaderEditorArgs, caller?: Function): import("react").RefObject<HTMLDivElement>;
export declare const STORAGE_KEY = "headers";

@@ -6,2 +6,3 @@ import { GetDefaultFieldNamesFn } from '@graphiql/toolkit';

export declare function useChangeHandler(editor: CodeMirrorEditor | null, callback: EditCallback | undefined, storageKey: string | null, tabProperty: 'variables' | 'headers', caller: Function): void;
export declare function useCompletion(editor: CodeMirrorEditor | null, caller: Function): void;
declare type EmptyCallback = () => void;

@@ -8,0 +9,0 @@ export declare function useKeyMap(editor: CodeMirrorEditor | null, keys: string[], callback: EmptyCallback | undefined): void;

@@ -18,4 +18,4 @@ /// <reference types="react" />

};
export declare function useQueryEditor({ editorTheme, keyMap, externalFragments, onClickReference, onCopyQuery, onEdit, onEditOperationName, readOnly, validationRules, }?: UseQueryEditorArgs): import("react").RefObject<HTMLDivElement>;
export declare function useQueryEditor({ editorTheme, keyMap, externalFragments, onClickReference, onCopyQuery, onEdit, onEditOperationName, readOnly, validationRules, }?: UseQueryEditorArgs, caller?: Function): import("react").RefObject<HTMLDivElement>;
export declare const STORAGE_KEY_QUERY = "query";
export {};

@@ -13,2 +13,2 @@ import type { Position } from 'codemirror';

};
export declare function useResponseEditor({ ResponseTooltip, editorTheme, keyMap, value, }?: UseResponseEditorArgs): import("react").RefObject<HTMLDivElement>;
export declare function useResponseEditor({ ResponseTooltip, editorTheme, keyMap, value, }?: UseResponseEditorArgs, caller?: Function): import("react").RefObject<HTMLDivElement>;

@@ -10,3 +10,3 @@ /// <reference types="react" />

};
export declare function useVariableEditor({ editorTheme, keyMap, onEdit, readOnly, }?: UseVariableEditorArgs): import("react").RefObject<HTMLDivElement>;
export declare function useVariableEditor({ editorTheme, keyMap, onEdit, readOnly, }?: UseVariableEditorArgs, caller?: Function): import("react").RefObject<HTMLDivElement>;
export declare const STORAGE_KEY = "variables";

@@ -1,3 +0,5 @@

export { History } from './components';
export { HistoryContext, HistoryContextProvider, useHistoryContext, } from './context';
export type { HistoryContextType } from './context';
import { HistoryContext, HistoryContextProvider, useHistoryContext } from './context';
import { useSelectHistoryItem } from './hooks';
import type { HistoryContextType } from './context';
export { HistoryContext, HistoryContextProvider, useHistoryContext, useSelectHistoryItem, };
export type { HistoryContextType };

@@ -1,23 +0,7 @@

export declare const ArgumentIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const ChevronDownIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const ChevronLeftIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const ChevronUpIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const CloseIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const CopyIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const DeprecatedArgumentIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const DeprecatedFieldIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const DocsIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const FieldIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const HistoryIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const KeyboardShortcutIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const MergeIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const PenIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const PlayIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const PlusIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const PrettifyIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const RootTypeIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const SettingsIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const StarFilledIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const StarIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const StopIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export declare const TypeIcon: (props: JSX.IntrinsicElements['svg']) => JSX.Element;
export { EditorContext, EditorContextProvider, HeaderEditor, ImagePreview, onHasCompletion, QueryEditor, ResponseEditor, useAutoCompleteLeafs, useCopyQuery, useEditorContext, useHeaderEditor, useMergeQuery, usePrettifyEditors, useQueryEditor, useResponseEditor, useVariableEditor, VariableEditor, } from './editor';
export { ExecutionContext, ExecutionContextProvider, useExecutionContext, } from './execution';
export { Argument, DefaultValue, Directive, ExplorerContext, ExplorerContextProvider, ExplorerSection, FieldLink, TypeLink, useExplorerContext, } from './explorer';
export { History, HistoryContext, HistoryContextProvider, useHistoryContext, } from './history';
export { ExplorerContext, ExplorerContextProvider, useExplorerContext, } from './explorer';
export { HistoryContext, HistoryContextProvider, useHistoryContext, useSelectHistoryItem, } from './history';
export * from './icons';

@@ -18,1 +18,2 @@ export { SchemaContext, SchemaContextProvider, useSchemaContext, } from './schema';

import './style/root.css';
import './style/markdown.css';

@@ -26,2 +26,3 @@ import { Fetcher } from '@graphiql/toolkit';

fetcher: Fetcher;
onSchemaChange?(schema: GraphQLSchema): void;
schema?: GraphQLSchema | null;

@@ -28,0 +29,0 @@ } & IntrospectionArgs;

import './button.css';
export declare function UnStyledButton(props: JSX.IntrinsicElements['button']): JSX.Element;
export declare function Button(props: JSX.IntrinsicElements['button']): JSX.Element;
export * from './button';
export * from './button-group';
export * from './dropdown';
export * from './markdown';
export * from './spinner';

@@ -16,5 +16,5 @@ /// <reference types="react" />

firstRef: import("react").RefObject<HTMLDivElement>;
setHiddenElement: import("react").Dispatch<import("react").SetStateAction<ResizableElement | null>>;
setHiddenElement: (element: ResizableElement | null) => void;
secondRef: import("react").RefObject<HTMLDivElement>;
};
export {};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc