Options
All
  • Public
  • Public/Protected
  • All
Menu

Package graphiql-plugin-doc-explorer

@graphiql/plugin-doc-explorer

API

  • useDocExplorer: Handles the state for the doc explorer
  • useDocExplorerActions: Actions related to the doc explorer

Index

References

Argument

Re-exports Argument

Argument

Re-exports Argument

CancellationToken

Re-exports CancellationToken

CancellationTokenSource

Re-exports CancellationTokenSource

DOC_EXPLORER_PLUGIN

Re-exports DOC_EXPLORER_PLUGIN

DefaultValue

Re-exports DefaultValue

DefaultValue

Re-exports DefaultValue

DeprecationReason

Re-exports DeprecationReason

DeprecationReason

Re-exports DeprecationReason

Directive

Re-exports Directive

Directive

Re-exports Directive

DocExplorer

Re-exports DocExplorer

DocExplorer

Re-exports DocExplorer

DocExplorerFieldDef

Re-exports DocExplorerFieldDef

DocExplorerNavStack

Re-exports DocExplorerNavStack

DocExplorerNavStackItem

Re-exports DocExplorerNavStackItem

DocExplorerStore

Re-exports DocExplorerStore

Emitter

Re-exports Emitter

Environment

Re-exports Environment

ExplorerSection

Re-exports ExplorerSection

ExplorerSection

Re-exports ExplorerSection

FieldDocumentation

Re-exports FieldDocumentation

FieldDocumentation

Re-exports FieldDocumentation

FieldLink

Re-exports FieldLink

FieldLink

Re-exports FieldLink

IDisposable

Re-exports IDisposable

IEvent

Re-exports IEvent

IKeyboardEvent

Re-exports IKeyboardEvent

IMarkdownString

Re-exports IMarkdownString

IMouseEvent

Re-exports IMouseEvent

IPosition

Re-exports IPosition

IRange

Re-exports IRange

IScrollEvent

Re-exports IScrollEvent

ISelection

Re-exports ISelection

ITrustedTypePolicy

Re-exports ITrustedTypePolicy

ITrustedTypePolicyOptions

Re-exports ITrustedTypePolicyOptions

KeyCode

Re-exports KeyCode

KeyMod

Re-exports KeyMod

MarkdownStringTrustedOptions

Re-exports MarkdownStringTrustedOptions

MarkerSeverity

Re-exports MarkerSeverity

MarkerTag

Re-exports MarkerTag

Position

Re-exports Position

Range

Re-exports Range

SchemaDocumentation

Re-exports SchemaDocumentation

SchemaDocumentation

Re-exports SchemaDocumentation

Search

Re-exports Search

Search

Re-exports Search

Selection

Re-exports Selection

SelectionDirection

Re-exports SelectionDirection

Thenable

Re-exports Thenable

Token

Re-exports Token

TypeDocumentation

Re-exports TypeDocumentation

TypeDocumentation

Re-exports TypeDocumentation

TypeLink

Re-exports TypeLink

TypeLink

Re-exports TypeLink

Uri

Re-exports Uri

UriComponents

Re-exports UriComponents

Window

Re-exports Window

editor

Re-exports editor

languages

Re-exports languages

useDocExplorer

Re-exports useDocExplorer

useDocExplorerActions

Re-exports useDocExplorerActions

useExplorerContext

Re-exports useExplorerContext

worker

Re-exports worker

Type aliases

DocExplorerFieldDef

DocExplorerFieldDef: GraphQLField<unknown, unknown> | GraphQLInputField | GraphQLArgument

DocExplorerNavStack

DocExplorerNavStack: [DocExplorerNavStackItem, { def?: GraphQLNamedType | DocExplorerFieldDef; name: string }]

DocExplorerNavStackItem

DocExplorerNavStackItem: { def?: GraphQLNamedType | DocExplorerFieldDef; name: string }

Type declaration

  • Optional def?: GraphQLNamedType | DocExplorerFieldDef

    The definition object of the item, this can be a named type, a field, an input field or an argument.

  • name: string

    The name of the item.

DocExplorerStoreType

DocExplorerStoreType: { actions: { pop: any; push: any; rebuildNavStackWithSchema: any; reset: any; resolveSchemaReferenceToNavItem: any }; explorerNavStack: DocExplorerNavStack }

Type declaration

Variables

Const create

create: Create = (<T>(stateCreator: StateCreator<T>) => {console.log('zustand create mock');// to support a curried version of createreturn typeof stateCreator === 'function'? createUncurried(stateCreator): createUncurried;}) as typeof originalCreate

Const createStore

createStore: CreateStore = (<T>(stateCreator: StateCreator<T>) => {console.log('zustand createStore mock');// to support a curried version of createStorereturn typeof stateCreator === 'function'? createStoreUncurried(stateCreator): createStoreUncurried;}) as typeof originalCreateStore

Const docExplorerStore

docExplorerStore: StoreApi<DocExplorerStoreType> = createStore<DocExplorerStoreType>((set, get) => ({explorerNavStack: INITIAL_NAV_STACK,actions: {push(item) {set(state => {const curr = state.explorerNavStack;const lastItem = curr.at(-1)!;const explorerNavStack: DocExplorerNavStack =// Avoid pushing duplicate itemslastItem.def === item.def ? curr : [...curr, item];return { explorerNavStack };});},pop() {set(state => {const curr = state.explorerNavStack;const explorerNavStack =curr.length > 1 ? (curr.slice(0, -1) as DocExplorerNavStack) : curr;return { explorerNavStack };});},reset() {set(state => {const curr = state.explorerNavStack;const explorerNavStack = curr.length === 1 ? curr : INITIAL_NAV_STACK;return { explorerNavStack };});},resolveSchemaReferenceToNavItem(schemaReference) {if (!schemaReference) {return;}const { kind, typeInfo } = schemaReference;const ref = getSchemaReference(kind, typeInfo);if (!ref) {return;}const { push } = get().actions;switch (ref.kind) {case 'Type': {push({name: ref.type.name,def: ref.type,});break;}case 'Field': {// Show a field type on stackif (ref.type) {push({name: ref.type.name,def: ref.type,});}push({name: ref.field.name,def: ref.field,});break;}case 'Argument': {if (ref.field) {push({name: ref.field.name,def: ref.field,});}break;}case 'EnumValue': {if (ref.type) {push({name: ref.type.name,def: ref.type,});}break;}}},rebuildNavStackWithSchema(schema: GraphQLSchema) {set(state => {const oldNavStack = state.explorerNavStack;if (oldNavStack.length === 1) {return state;}// Spread is neededconst newNavStack: DocExplorerNavStack = [...INITIAL_NAV_STACK];let lastEntity:| GraphQLNamedType| GraphQLField<unknown, unknown>| null = null;for (const item of oldNavStack) {if (item === INITIAL_NAV_STACK[0]) {// No need to copy the initial itemcontinue;}if (item.def) {// If item.def isn't a named type, it must be a field, inputField, or argumentif (isNamedType(item.def)) {// The type needs to be replaced with the new schema type of the same nameconst newType = schema.getType(item.def.name);if (newType) {newNavStack.push({name: item.name,def: newType,});lastEntity = newType;} else {// This type no longer exists; the stack cannot be built beyond herebreak;}} else if (lastEntity === null) {// We can't have a sub-entity if we have no entity; stop rebuilding the nav stackbreak;} else if (isObjectType(lastEntity) ||isInputObjectType(lastEntity)) {// item.def must be a Field / input field; replace with the new field of the same nameconst field = lastEntity.getFields()[item.name];if (field) {newNavStack.push({name: item.name,def: field,});} else {// This field no longer exists; the stack cannot be built beyond herebreak;}} else if (isScalarType(lastEntity) ||isEnumType(lastEntity) ||isInterfaceType(lastEntity) ||isUnionType(lastEntity)) {// These don't (currently) have non-type sub-entries; something has gone wrong.// Handle gracefully by discontinuing rebuilding the stack.break;} else {// lastEntity must be a field (because it's not a named type)const field: GraphQLField<unknown, unknown> = lastEntity;// Thus item.def must be an argument, so find the same named argument in the new schemaif (field.args.some(a => a.name === item.name)) {newNavStack.push({name: item.name,def: field,});} else {// This argument no longer exists; the stack cannot be built beyond herebreak;}}} else {lastEntity = null;newNavStack.push(item);}}return { explorerNavStack: newNavStack };});},},}),)

Const storeResetFns

storeResetFns: Set<() => void> = new Set<() => void>()

Functions

Const Argument

  • Argument(__namedParameters: { arg: GraphQLArgument; inline: undefined | false | true; showDefaultValue: undefined | false | true }): Element

Const DefaultValue

Const DeprecationReason

  • DeprecationReason(props: DeprecationReasonProps): null | Element

Const Directive

  • Directive(__namedParameters: { directive: DirectiveNode }): Element

Const DocExplorer

  • DocExplorer(): Element

Const DocExplorerStore

  • DocExplorerStore(__namedParameters: { children: ReactNode }): ReactElement<unknown, string | ((props: P) => ReactElement<any, any> | null) | {}>

Const ExplorerSection

  • ExplorerSection(__namedParameters: { children: ReactNode; title: "Type" | "Root Types" | "Fields" | "Deprecated Fields" | "Arguments" | "Deprecated Arguments" | "Implements" | "Implementations" | "Possible Types" | "Enum Values" | "Deprecated Enum Values" | "Directives" | "All Schema Types" }): Element
  • Parameters

    • __namedParameters: { children: ReactNode; title: "Type" | "Root Types" | "Fields" | "Deprecated Fields" | "Arguments" | "Deprecated Arguments" | "Implements" | "Implementations" | "Possible Types" | "Enum Values" | "Deprecated Enum Values" | "Directives" | "All Schema Types" }
      • children: ReactNode
      • title: "Type" | "Root Types" | "Fields" | "Deprecated Fields" | "Arguments" | "Deprecated Arguments" | "Implements" | "Implementations" | "Possible Types" | "Enum Values" | "Deprecated Enum Values" | "Directives" | "All Schema Types"

    Returns Element

Const FieldDocumentation

Const FieldLink

Const SchemaDocumentation

  • SchemaDocumentation(__namedParameters: { schema: GraphQLSchema }): Element

Const Search

  • Search(): null | Element

Const TypeDocumentation

  • TypeDocumentation(__namedParameters: { type: GraphQLNamedType }): null | Element

Const TypeLink

  • TypeLink(__namedParameters: { type: GraphQLType }): Element

getSchemaReference

renderType

  • renderType(type: GraphQLType, renderNamedType: (namedType: GraphQLNamedType) => Element): Element

Const useDocExplorer

Const useDocExplorerActions

  • useDocExplorerActions(): { pop: any; push: any; rebuildNavStackWithSchema: any; reset: any; resolveSchemaReferenceToNavItem: any }

useExplorerContext

useSearchResults

Object literals

Const DOC_EXPLORER_PLUGIN

DOC_EXPLORER_PLUGIN: object

content

content: FC<{}> = DocExplorer

title

title: string = "Documentation Explorer"

icon

  • icon(): Element

Generated using TypeDoc