@graphiql/plugin-history 0.4.2-canary-c3a87e41.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,7 +1,7 @@
1
1
  import { QueryStoreItem } from '@graphiql/toolkit';
2
2
  import { FC } from 'react';
3
3
  export declare const History: FC;
4
- declare type QueryHistoryItemProps = {
4
+ type QueryHistoryItemProps = {
5
5
  item: QueryStoreItem & {
6
6
  index?: number;
7
7
  };
package/dist/context.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { FC, ReactNode } from 'react';
2
- declare type HistoryStoreProps = {
2
+ import { QueryStoreItem } from '@graphiql/toolkit';
3
+ type HistoryStoreProps = {
3
4
  children: ReactNode;
4
5
  /**
5
6
  * The maximum number of executed operations to store.
@@ -14,10 +15,66 @@ declare type HistoryStoreProps = {
14
15
  * added to the `QueryStoreItem`)
15
16
  */
16
17
  export declare const HistoryStore: FC<HistoryStoreProps>;
17
- export declare const useHistory: () => any;
18
+ export declare const useHistory: () => QueryStoreItem[];
18
19
  /**
19
20
  * Actions are functions used to update values in your store. They are static and never change.
20
21
  * @see https://tkdodo.eu/blog/working-with-zustand#separate-actions-from-state
21
22
  */
22
- export declare const useHistoryActions: () => any;
23
+ export declare const useHistoryActions: () => {
24
+ /**
25
+ * Add an operation to the history.
26
+ * @param operation The operation that was executed, consisting of the query,
27
+ * variables, headers, and operation name.
28
+ */
29
+ addToHistory(operation: {
30
+ query?: string;
31
+ variables?: string;
32
+ headers?: string;
33
+ operationName?: string;
34
+ }): void;
35
+ /**
36
+ * Change the custom label of an item from the history.
37
+ * @param args An object containing the label (`undefined` if it should be
38
+ * unset) and properties that identify the history item that the label should
39
+ * be applied to. (This can result in the label being applied to multiple
40
+ * history items.)
41
+ * @param index Index to edit. Without it, will look for the first index matching the
42
+ * operation, which may lead to misleading results if multiple items have the same label
43
+ */
44
+ editLabel(args: {
45
+ query?: string;
46
+ variables?: string;
47
+ headers?: string;
48
+ operationName?: string;
49
+ label?: string;
50
+ favorite?: boolean;
51
+ }, index?: number): void;
52
+ /**
53
+ * Toggle the favorite state of an item from the history.
54
+ * @param args An object containing the favorite state (`undefined` if it
55
+ * should be unset) and properties that identify the history item that the
56
+ * label should be applied to. (This can result in the label being applied
57
+ * to multiple history items.)
58
+ */
59
+ toggleFavorite(args: {
60
+ query?: string;
61
+ variables?: string;
62
+ headers?: string;
63
+ operationName?: string;
64
+ label?: string;
65
+ favorite?: boolean;
66
+ }): void;
67
+ /**
68
+ * Delete an operation from the history.
69
+ * @param args The operation that was executed, consisting of the query,
70
+ * variables, headers, and operation name.
71
+ * @param clearFavorites This is only if you press the 'clear' button
72
+ */
73
+ deleteFromHistory(args: QueryStoreItem, clearFavorites?: boolean): void;
74
+ /**
75
+ * If you need to know when an item in history is set as active to customize
76
+ * your application.
77
+ */
78
+ setActive(args: QueryStoreItem): void;
79
+ };
23
80
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sources":["../src/context.ts"],"sourcesContent":["import { FC, ReactElement, ReactNode, useEffect } from 'react';\nimport { createStore } from 'zustand';\nimport {\n HistoryStore as ToolkitHistoryStore,\n QueryStoreItem,\n} from '@graphiql/toolkit';\nimport { useGraphiQL, pick, createBoundedUseStore } from '@graphiql/react';\n\nconst historyStore = createStore<HistoryStoreType>((set, get) => ({\n historyStorage: null,\n actions: {\n addToHistory(operation) {\n const { historyStorage } = get();\n historyStorage?.updateHistory(operation);\n set({}); // trigger rerender\n },\n editLabel(operation, index) {\n const { historyStorage } = get();\n historyStorage?.editLabel(operation, index);\n set({}); // trigger rerender\n },\n toggleFavorite(operation) {\n const { historyStorage } = get();\n historyStorage?.toggleFavorite(operation);\n set({}); // trigger rerender\n },\n setActive: item => item,\n deleteFromHistory(item, clearFavorites) {\n const { historyStorage } = get();\n historyStorage?.deleteHistory(item, clearFavorites);\n set({}); // trigger rerender\n },\n },\n}));\n\ntype HistoryStoreType = {\n // Can be `null` if History plugin saved in `localStorage` as `visiblePlugin`\n historyStorage: ToolkitHistoryStore | null;\n actions: {\n /**\n * Add an operation to the history.\n * @param operation The operation that was executed, consisting of the query,\n * variables, headers, and operation name.\n */\n addToHistory(operation: {\n query?: string;\n variables?: string;\n headers?: string;\n operationName?: string;\n }): void;\n /**\n * Change the custom label of an item from the history.\n * @param args An object containing the label (`undefined` if it should be\n * unset) and properties that identify the history item that the label should\n * be applied to. (This can result in the label being applied to multiple\n * history items.)\n * @param index Index to edit. Without it, will look for the first index matching the\n * operation, which may lead to misleading results if multiple items have the same label\n */\n editLabel(\n args: {\n query?: string;\n variables?: string;\n headers?: string;\n operationName?: string;\n label?: string;\n favorite?: boolean;\n },\n index?: number,\n ): void;\n /**\n * Toggle the favorite state of an item from the history.\n * @param args An object containing the favorite state (`undefined` if it\n * should be unset) and properties that identify the history item that the\n * label should be applied to. (This can result in the label being applied\n * to multiple history items.)\n */\n toggleFavorite(args: {\n query?: string;\n variables?: string;\n headers?: string;\n operationName?: string;\n label?: string;\n favorite?: boolean;\n }): void;\n /**\n * Delete an operation from the history.\n * @param args The operation that was executed, consisting of the query,\n * variables, headers, and operation name.\n * @param clearFavorites This is only if you press the 'clear' button\n */\n deleteFromHistory(args: QueryStoreItem, clearFavorites?: boolean): void;\n /**\n * If you need to know when an item in history is set as active to customize\n * your application.\n */\n setActive(args: QueryStoreItem): void;\n };\n};\n\ntype HistoryStoreProps = {\n children: ReactNode;\n /**\n * The maximum number of executed operations to store.\n * @default 20\n */\n maxHistoryLength?: number;\n};\n\n/**\n * The functions send the entire operation so users can customize their own application and get\n * access to the operation plus any additional props they added for their needs (i.e., build their\n * own functions that may save to a backend instead of localStorage and might need an id property\n * added to the `QueryStoreItem`)\n */\nexport const HistoryStore: FC<HistoryStoreProps> = ({\n maxHistoryLength = 20,\n children,\n}) => {\n const { isFetching, tabs, activeTabIndex, storage } = useGraphiQL(\n pick('isFetching', 'tabs', 'activeTabIndex', 'storage'),\n );\n const activeTab = tabs[activeTabIndex]!;\n const historyStorage = // eslint-disable-line react-hooks/exhaustive-deps -- false positive, code is optimized by React Compiler\n new ToolkitHistoryStore(storage, maxHistoryLength);\n\n useEffect(() => {\n historyStore.setState({ historyStorage });\n }, [historyStorage]);\n\n useEffect(() => {\n if (!isFetching) {\n return;\n }\n const { addToHistory } = historyStore.getState().actions;\n addToHistory({\n query: activeTab.query ?? undefined,\n variables: activeTab.variables ?? undefined,\n headers: activeTab.headers ?? undefined,\n operationName: activeTab.operationName ?? undefined,\n });\n }, [isFetching, activeTab]);\n\n return children as ReactElement;\n};\n\nconst useHistoryStore = createBoundedUseStore(historyStore);\n\nconst EMPTY_ARRAY: QueryStoreItem[] = [];\n\nexport const useHistory = () =>\n useHistoryStore(state => state.historyStorage?.queries ?? EMPTY_ARRAY);\n\n/**\n * Actions are functions used to update values in your store. They are static and never change.\n * @see https://tkdodo.eu/blog/working-with-zustand#separate-actions-from-state\n */\nexport const useHistoryActions = () => useHistoryStore(state => state.actions);\n"],"names":["historyStore","createStore","set","get","historyStorage","actions","addToHistory","operation","updateHistory","editLabel","index","toggleFavorite","setActive","item","deleteFromHistory","clearFavorites","deleteHistory","HistoryStore","t0","$","_c","maxHistoryLength","t1","children","undefined","t2","Symbol","for","pick","isFetching","tabs","activeTabIndex","storage","useGraphiQL","activeTab","t3","ToolkitHistoryStore","t4","t5","setState","useEffect","t6","t7","getState","query","variables","headers","operationName","useHistoryStore","createBoundedUseStore","EMPTY_ARRAY","useHistory","_temp","useHistoryActions","_temp2","state","queries"],"mappings":";;;;;AAQA,MAAMA,eAAeC,YAA8B,CAACC,KAAKC,SAAS;AAAA,EAChEC,gBAAgB;AAAA,EAChBC,SAAS;AAAA,IACPC,aAAaC,WAAW;AAChB,YAAA;AAAA,QAAEH;AAAAA,UAAmBD,IAAI;AAC/BC,uDAAgBI,cAAcD;AAC9BL,UAAI,CAAA,CAAE;AAAA,IACR;AAAA,IACAO,UAAUF,WAAWG,OAAO;AACpB,YAAA;AAAA,QAAEN;AA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C,SAAAI,OAAAC,OAAA;AAAA,SAA+BA,MAAKlD;AAAA;"}
1
+ {"version":3,"file":"context.js","sources":["../src/context.ts"],"sourcesContent":["import { FC, ReactElement, ReactNode, useEffect } from 'react';\nimport { createStore } from 'zustand';\nimport {\n HistoryStore as ToolkitHistoryStore,\n QueryStoreItem,\n} from '@graphiql/toolkit';\nimport { useGraphiQL, pick, createBoundedUseStore } from '@graphiql/react';\n\nconst historyStore = createStore<HistoryStoreType>((set, get) => ({\n historyStorage: null,\n actions: {\n addToHistory(operation) {\n const { historyStorage } = get();\n historyStorage?.updateHistory(operation);\n set({}); // trigger rerender\n },\n editLabel(operation, index) {\n const { historyStorage } = get();\n historyStorage?.editLabel(operation, index);\n set({}); // trigger rerender\n },\n toggleFavorite(operation) {\n const { historyStorage } = get();\n historyStorage?.toggleFavorite(operation);\n set({}); // trigger rerender\n },\n setActive: item => item,\n deleteFromHistory(item, clearFavorites) {\n const { historyStorage } = get();\n historyStorage?.deleteHistory(item, clearFavorites);\n set({}); // trigger rerender\n },\n },\n}));\n\ntype HistoryStoreType = {\n // Can be `null` if History plugin saved in `localStorage` as `visiblePlugin`\n historyStorage: ToolkitHistoryStore | null;\n actions: {\n /**\n * Add an operation to the history.\n * @param operation The operation that was executed, consisting of the query,\n * variables, headers, and operation name.\n */\n addToHistory(operation: {\n query?: string;\n variables?: string;\n headers?: string;\n operationName?: string;\n }): void;\n /**\n * Change the custom label of an item from the history.\n * @param args An object containing the label (`undefined` if it should be\n * unset) and properties that identify the history item that the label should\n * be applied to. (This can result in the label being applied to multiple\n * history items.)\n * @param index Index to edit. Without it, will look for the first index matching the\n * operation, which may lead to misleading results if multiple items have the same label\n */\n editLabel(\n args: {\n query?: string;\n variables?: string;\n headers?: string;\n operationName?: string;\n label?: string;\n favorite?: boolean;\n },\n index?: number,\n ): void;\n /**\n * Toggle the favorite state of an item from the history.\n * @param args An object containing the favorite state (`undefined` if it\n * should be unset) and properties that identify the history item that the\n * label should be applied to. (This can result in the label being applied\n * to multiple history items.)\n */\n toggleFavorite(args: {\n query?: string;\n variables?: string;\n headers?: string;\n operationName?: string;\n label?: string;\n favorite?: boolean;\n }): void;\n /**\n * Delete an operation from the history.\n * @param args The operation that was executed, consisting of the query,\n * variables, headers, and operation name.\n * @param clearFavorites This is only if you press the 'clear' button\n */\n deleteFromHistory(args: QueryStoreItem, clearFavorites?: boolean): void;\n /**\n * If you need to know when an item in history is set as active to customize\n * your application.\n */\n setActive(args: QueryStoreItem): void;\n };\n};\n\ntype HistoryStoreProps = {\n children: ReactNode;\n /**\n * The maximum number of executed operations to store.\n * @default 20\n */\n maxHistoryLength?: number;\n};\n\n/**\n * The functions send the entire operation so users can customize their own application and get\n * access to the operation plus any additional props they added for their needs (i.e., build their\n * own functions that may save to a backend instead of localStorage and might need an id property\n * added to the `QueryStoreItem`)\n */\nexport const HistoryStore: FC<HistoryStoreProps> = ({\n maxHistoryLength = 20,\n children,\n}) => {\n const { isFetching, tabs, activeTabIndex, storage } = useGraphiQL(\n pick('isFetching', 'tabs', 'activeTabIndex', 'storage'),\n );\n const activeTab = tabs[activeTabIndex]!;\n const historyStorage = new ToolkitHistoryStore(storage, maxHistoryLength);\n\n useEffect(() => {\n historyStore.setState({ historyStorage });\n }, [historyStorage]); // eslint-disable-line react-hooks/exhaustive-deps -- false positive, code is optimized by React Compiler\n\n useEffect(() => {\n if (!isFetching) {\n return;\n }\n const { addToHistory } = historyStore.getState().actions;\n addToHistory({\n query: activeTab.query ?? undefined,\n variables: activeTab.variables ?? undefined,\n headers: activeTab.headers ?? undefined,\n operationName: activeTab.operationName ?? undefined,\n });\n }, [isFetching, activeTab]);\n\n return children as ReactElement;\n};\n\nconst useHistoryStore = createBoundedUseStore(historyStore);\n\nconst EMPTY_ARRAY: QueryStoreItem[] = [];\n\nexport const useHistory = () =>\n useHistoryStore(state => state.historyStorage?.queries ?? EMPTY_ARRAY);\n\n/**\n * Actions are functions used to update values in your store. They are static and never change.\n * @see https://tkdodo.eu/blog/working-with-zustand#separate-actions-from-state\n */\nexport const useHistoryActions = () => useHistoryStore(state => state.actions);\n"],"names":["historyStore","createStore","set","get","historyStorage","actions","addToHistory","operation","updateHistory","editLabel","index","toggleFavorite","setActive","item","deleteFromHistory","clearFavorites","deleteHistory","HistoryStore","t0","$","_c","maxHistoryLength","t1","children","undefined","t2","Symbol","for","pick","isFetching","tabs","activeTabIndex","storage","useGraphiQL","activeTab","t3","ToolkitHistoryStore","t4","t5","setState","useEffect","t6","t7","getState","query","variables","headers","operationName","useHistoryStore","createBoundedUseStore","EMPTY_ARRAY","useHistory","_temp","useHistoryActions","_temp2","state","queries"],"mappings":";;;;;AAQA,MAAMA,eAAeC,YAA8B,CAACC,KAAKC,SAAS;AAAA,EAChEC,gBAAgB;AAAA,EAChBC,SAAS;AAAA,IACPC,aAAaC,WAAW;AAChB,YAAA;AAAA,QAAEH;AAAAA,UAAmBD,IAAI;AAC/BC,uDAAgBI,cAAcD;AAC9BL,UAAI,CAAA,CAAE;AAAA,IACR;AAAA,IACAO,UAAUF,WAAWG,OAAO;AACpB,YAAA;AAAA,QAAEN;AAAAA,UAAmBD,IAAI;AACfM,uDAAAA,UAAUF,WAAWG;AACrCR,UAAI,CAAA,CAAE;AAAA,IACR;AAAA,IACAS,eAAeJ,WAAW;AAClB,YAAA;AAAA,QAAEH;AAAAA,UAAmBD,IAAI;AAC/BC,uDAAgBO,eAAeJ;AAC/BL,UAAI,CAAA,CAAE;AAAA,IACR;AAAA,IACAU,WAAWC,CAAQA,SAAAA;AAAAA,IACnBC,kBAAkBD,MAAME,gBAAgB;AAChC,YAAA;AAAA,QAAEX;AAAAA,UAAmBD,IAAI;AACfa,uDAAAA,cAAcH,MAAME;AACpCb,UAAI,CAAA,CAAE;AAAA,IAAA;AAAA,EACR;AAEJ,EAAE;AAkFK,MAAMe,eAAsCC,CAAA,OAAA;AAAAC,QAAAA,IAAAC,EAAA,EAAA;AAAC,QAAA;AAAA,IAAAC,kBAAAC;AAAAA,IAAA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uC,OACHV,UAASU,SAAApB;AAAAA,QAAmBqB,WACxBX,UAASW,aAAArB;AAAAA,QAAuBsB,SAClCZ,UAASY,WAAAtB;AAAAA,QAAqBuB,eACxBb,UAASa,iBAAAvB;AAAAA,MAAAA,CACzB;AAAA,IAAC;AACD,SAAA,CAACK,YAAYK,SAAS;AAACf,WAAAe;AAAAf,WAAAU;AAAAV,WAAAsB;AAAAtB,YAAAuB;AAAAA,EAAAA,OAAA;AAAAD,SAAAtB,EAAA,CAAA;AAAAuB,SAAAvB,EAAA,EAAA;AAAA,EAAA;AAX1BqB,YAAUC,IAWPC,EAAuB;AAEnBnB,SAAAA;AAAwB;AAGjC,MAAMyB,kBAAkBC,sBAAsBjD,YAAY;AAE1D,MAAMkD,cAAgC,CAAE;AAEjC,MAAMC,aAAaA,MAAA;AAAA,SACxBH,gBAAAI,KAAqE;AAAC;AAMjE,MAAMC,oBAAoBA,MAAA;AAAA,SAAML,gBAAAM,MAAsC;AAAC;AAPpD,SAAAF,MAAAG,OAAA;;AACCA,WAAAA,WAAKnD,mBAALmD,mBAAKC,YAAAN;AAAuC;AAMtC,SAAAI,OAAAC,OAAA;AAAA,SAA+BA,MAAKlD;AAAA;"}
@@ -1,4 +1,30 @@
1
1
  /**
2
2
  * @deprecated Use `useHistoryActions` and `useHistory` hooks instead.
3
3
  */
4
- export declare function useHistoryContext(): any;
4
+ export declare function useHistoryContext(): {
5
+ items: import('@graphiql/toolkit', { with: { "resolution-mode": "import" } }).QueryStoreItem[];
6
+ addToHistory(operation: {
7
+ query?: string;
8
+ variables?: string;
9
+ headers?: string;
10
+ operationName?: string;
11
+ }): void;
12
+ editLabel(args: {
13
+ query?: string;
14
+ variables?: string;
15
+ headers?: string;
16
+ operationName?: string;
17
+ label?: string;
18
+ favorite?: boolean;
19
+ }, index?: number): void;
20
+ toggleFavorite(args: {
21
+ query?: string;
22
+ variables?: string;
23
+ headers?: string;
24
+ operationName?: string;
25
+ label?: string;
26
+ favorite?: boolean;
27
+ }): void;
28
+ deleteFromHistory(args: import('@graphiql/toolkit', { with: { "resolution-mode": "import" } }).QueryStoreItem, clearFavorites?: boolean): void;
29
+ setActive(args: import('@graphiql/toolkit', { with: { "resolution-mode": "import" } }).QueryStoreItem): void;
30
+ };
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@graphiql/plugin-history",
3
- "version": "0.4.2-canary-c3a87e41.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",
@@ -32,19 +34,20 @@
32
34
  "types:check": "tsc --noEmit",
33
35
  "dev": "vite build --watch --emptyOutDir=false",
34
36
  "build": "vite build",
35
- "test": "vitest"
37
+ "test": "vitest run"
36
38
  },
37
39
  "peerDependencies": {
38
- "@graphiql/react": "^0.37.3-canary-c3a87e41.0",
40
+ "@graphiql/react": "^0.37.0",
39
41
  "react": "^18 || ^19",
40
- "react-compiler-runtime": "19.1.0-rc.1",
41
42
  "react-dom": "^18 || ^19"
42
43
  },
43
44
  "dependencies": {
44
- "@graphiql/toolkit": "^0.11.3",
45
+ "@graphiql/toolkit": "^0.12.0",
46
+ "react-compiler-runtime": "19.1.0-rc.1",
45
47
  "zustand": "^5"
46
48
  },
47
49
  "devDependencies": {
50
+ "@graphiql/react": "^0.37.4",
48
51
  "@testing-library/react": "^16.1.0",
49
52
  "@vitejs/plugin-react": "^4.4.1",
50
53
  "babel-plugin-react-compiler": "19.1.0-rc.1",