@graphiql/plugin-doc-explorer 0.4.2-canary-67317292.0 → 0.4.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.
@@ -1,6 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { GraphQLArgument } from 'graphql';
3
- declare type ArgumentProps = {
3
+ type ArgumentProps = {
4
4
  /**
5
5
  * The argument that should be rendered.
6
6
  */
@@ -1,6 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { DocExplorerFieldDef } from '../context';
3
- declare type DefaultValueProps = {
3
+ type DefaultValueProps = {
4
4
  /**
5
5
  * The field or argument for which to render the default value.
6
6
  */
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- declare type DeprecationReasonProps = {
2
+ type DeprecationReasonProps = {
3
3
  /**
4
4
  * The deprecation reason as Markdown string.
5
5
  */
@@ -1,6 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { DirectiveNode } from 'graphql';
3
- declare type DirectiveProps = {
3
+ type DirectiveProps = {
4
4
  /**
5
5
  * The directive that should be rendered.
6
6
  */
@@ -1,6 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { DocExplorerFieldDef } from '../context';
3
- declare type FieldDocumentationProps = {
3
+ type FieldDocumentationProps = {
4
4
  /**
5
5
  * The field or argument that should be rendered.
6
6
  */
@@ -1,6 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { DocExplorerFieldDef } from '../context';
3
- declare type FieldLinkProps = {
3
+ type FieldLinkProps = {
4
4
  /**
5
5
  * The field or argument that should be linked to.
6
6
  */
@@ -1,6 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { GraphQLSchema } from 'graphql';
3
- declare type SchemaDocumentationProps = {
3
+ type SchemaDocumentationProps = {
4
4
  /**
5
5
  * The schema that should be rendered.
6
6
  */
@@ -1,10 +1,10 @@
1
1
  import { GraphQLArgument, GraphQLField, GraphQLInputField, GraphQLNamedType } from 'graphql';
2
2
  import { FC } from 'react';
3
3
  export declare const Search: FC;
4
- declare type TypeMatch = {
4
+ type TypeMatch = {
5
5
  type: GraphQLNamedType;
6
6
  };
7
- declare type FieldMatch = {
7
+ type FieldMatch = {
8
8
  type: GraphQLNamedType;
9
9
  field: GraphQLField<unknown, unknown> | GraphQLInputField;
10
10
  argument?: GraphQLArgument;
@@ -1,5 +1,5 @@
1
1
  import { FC, ReactNode } from 'react';
2
- declare type ExplorerSectionProps = {
2
+ type ExplorerSectionProps = {
3
3
  children: ReactNode;
4
4
  /**
5
5
  * The title of the section, which will also determine the icon rendered next
@@ -1,6 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { GraphQLNamedType } from 'graphql';
3
- declare type TypeDocumentationProps = {
3
+ type TypeDocumentationProps = {
4
4
  /**
5
5
  * The type that should be rendered.
6
6
  */
@@ -1,6 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { GraphQLType } from 'graphql';
3
- declare type TypeLinkProps = {
3
+ type TypeLinkProps = {
4
4
  /**
5
5
  * The type that should be linked to.
6
6
  */
package/dist/context.d.ts CHANGED
@@ -2,8 +2,8 @@ import { GraphQLArgument, GraphQLField, GraphQLInputField, GraphQLNamedType, Gra
2
2
  import { FC, ReactNode } from 'react';
3
3
  import { SchemaReference, GraphiQLPlugin } from '@graphiql/react';
4
4
  export declare const DOC_EXPLORER_PLUGIN: GraphiQLPlugin;
5
- export declare type DocExplorerFieldDef = GraphQLField<unknown, unknown> | GraphQLInputField | GraphQLArgument;
6
- export declare type DocExplorerNavStackItem = {
5
+ export type DocExplorerFieldDef = GraphQLField<unknown, unknown> | GraphQLInputField | GraphQLArgument;
6
+ export type DocExplorerNavStackItem = {
7
7
  /**
8
8
  * The name of the item.
9
9
  */
@@ -14,11 +14,11 @@ export declare type DocExplorerNavStackItem = {
14
14
  */
15
15
  def?: GraphQLNamedType | DocExplorerFieldDef;
16
16
  };
17
- export declare type DocExplorerNavStack = [
17
+ export type DocExplorerNavStack = [
18
18
  DocExplorerNavStackItem,
19
19
  ...DocExplorerNavStackItem[]
20
20
  ];
21
- export declare type DocExplorerStoreType = {
21
+ export type DocExplorerStoreType = {
22
22
  /**
23
23
  * A stack of navigation items. The last item in the list is the current one.
24
24
  * This list always contains at least one item.
@@ -50,9 +50,29 @@ export declare const docExplorerStore: import('zustand').StoreApi<DocExplorerSto
50
50
  export declare const DocExplorerStore: FC<{
51
51
  children: ReactNode;
52
52
  }>;
53
- export declare const useDocExplorer: () => any;
53
+ export declare const useDocExplorer: () => DocExplorerNavStack;
54
54
  /**
55
55
  * Actions are functions used to update values in your store. They are static and never change.
56
56
  * @see https://tkdodo.eu/blog/working-with-zustand#separate-actions-from-state
57
57
  */
58
- export declare const useDocExplorerActions: () => any;
58
+ export declare const useDocExplorerActions: () => {
59
+ /**
60
+ * Push an item to the navigation stack.
61
+ * @param item The item that should be pushed to the stack.
62
+ */
63
+ push(item: DocExplorerNavStackItem): void;
64
+ /**
65
+ * Pop the last item from the navigation stack.
66
+ */
67
+ pop(): void;
68
+ /**
69
+ * Reset the navigation stack to its initial state, this will remove all but
70
+ * the initial stack item.
71
+ */
72
+ reset(): void;
73
+ resolveSchemaReferenceToNavItem(schemaReference: SchemaReference | null): void;
74
+ /**
75
+ * Replace the nav stack with an updated version using the new schema.
76
+ */
77
+ rebuildNavStackWithSchema(schema: GraphQLSchema): void;
78
+ };
@@ -1,4 +1,11 @@
1
1
  /**
2
2
  * @deprecated Use `useDocExplorerActions` and `useDocExplorer` hooks instead.
3
3
  */
4
- export declare function useExplorerContext(): any;
4
+ export declare function useExplorerContext(): {
5
+ explorerNavStack: import('./context').DocExplorerNavStack;
6
+ push(item: import('./context').DocExplorerNavStackItem): void;
7
+ pop(): void;
8
+ reset(): void;
9
+ resolveSchemaReferenceToNavItem(schemaReference: import('@graphiql/react').SchemaReference | null): void;
10
+ rebuildNavStackWithSchema(schema: import('graphql').GraphQLSchema): void;
11
+ };
@@ -4,7 +4,7 @@ import { Maybe } from 'graphql/jsutils/Maybe';
4
4
  * Copied from packages/codemirror-graphql/src/jump.ts
5
5
  */
6
6
  export declare function getSchemaReference(kind: string, typeInfo: any): FieldReference | DirectiveReference | ArgumentReference | EnumValueReference | TypeReference | undefined;
7
- declare type ArgumentReference = {
7
+ type ArgumentReference = {
8
8
  kind: 'Argument';
9
9
  argument: GraphQLArgument;
10
10
  field?: GraphQLField<unknown, unknown>;
@@ -12,24 +12,24 @@ declare type ArgumentReference = {
12
12
  directive?: GraphQLDirective;
13
13
  schema?: GraphQLSchema;
14
14
  };
15
- declare type DirectiveReference = {
15
+ type DirectiveReference = {
16
16
  kind: 'Directive';
17
17
  directive: GraphQLDirective;
18
18
  schema?: GraphQLSchema;
19
19
  };
20
- declare type EnumValueReference = {
20
+ type EnumValueReference = {
21
21
  kind: 'EnumValue';
22
22
  value?: GraphQLEnumValue;
23
23
  type?: GraphQLEnumType;
24
24
  schema?: GraphQLSchema;
25
25
  };
26
- declare type FieldReference = {
26
+ type FieldReference = {
27
27
  kind: 'Field';
28
28
  field: GraphQLField<unknown, unknown>;
29
29
  type: Maybe<GraphQLNamedType>;
30
30
  schema?: GraphQLSchema;
31
31
  };
32
- declare type TypeReference = {
32
+ type TypeReference = {
33
33
  kind: 'Type';
34
34
  type: GraphQLNamedType;
35
35
  schema?: GraphQLSchema;
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@graphiql/plugin-doc-explorer",
3
- "version": "0.4.2-canary-67317292.0",
4
- "sideEffects": false,
3
+ "version": "0.4.2",
4
+ "sideEffects": [
5
+ "*.css"
6
+ ],
5
7
  "repository": {
6
8
  "type": "git",
7
9
  "url": "https://github.com/graphql/graphiql",
@@ -33,20 +35,21 @@
33
35
  "types:check": "tsc --noEmit",
34
36
  "dev": "vite build --watch --emptyOutDir=false",
35
37
  "build": "vite build",
36
- "test": "vitest"
38
+ "test": "vitest run"
37
39
  },
38
40
  "peerDependencies": {
39
- "@graphiql/react": "^0.37.3-canary-67317292.0",
41
+ "@graphiql/react": "^0.37.0",
40
42
  "graphql": "^15.5.0 || ^16.0.0 || ^17.0.0",
41
43
  "react": "^18 || ^19",
42
- "react-compiler-runtime": "19.1.0-rc.1",
43
44
  "react-dom": "^18 || ^19"
44
45
  },
45
46
  "dependencies": {
46
47
  "@headlessui/react": "^2.2",
48
+ "react-compiler-runtime": "19.1.0-rc.1",
47
49
  "zustand": "^5"
48
50
  },
49
51
  "devDependencies": {
52
+ "@graphiql/react": "^0.37.4",
50
53
  "@testing-library/dom": "^10.4.0",
51
54
  "@testing-library/jest-dom": "^6.6.3",
52
55
  "@testing-library/react": "^16.3.0",