@tanstack/react-query-devtools 4.0.0 → 4.0.5

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.
Files changed (73) hide show
  1. package/build/cjs/node_modules/@tanstack/match-sorter-utils/build/esm/index.js +757 -0
  2. package/build/cjs/node_modules/@tanstack/match-sorter-utils/build/esm/index.js.map +1 -0
  3. package/build/stats-html.html +1 -1
  4. package/build/stats.json +423 -0
  5. package/build/types/query-core/src/focusManager.d.ts +16 -0
  6. package/build/types/query-core/src/hydration.d.ts +34 -0
  7. package/build/types/query-core/src/index.d.ts +20 -0
  8. package/build/types/query-core/src/infiniteQueryBehavior.d.ts +15 -0
  9. package/build/types/query-core/src/infiniteQueryObserver.d.ts +18 -0
  10. package/build/types/query-core/src/logger.d.ts +8 -0
  11. package/build/types/query-core/src/mutation.d.ts +70 -0
  12. package/build/types/query-core/src/mutationCache.d.ts +52 -0
  13. package/build/types/query-core/src/mutationObserver.d.ts +23 -0
  14. package/build/types/query-core/src/notifyManager.d.ts +18 -0
  15. package/build/types/query-core/src/onlineManager.d.ts +16 -0
  16. package/build/types/query-core/src/queriesObserver.d.ts +23 -0
  17. package/build/types/query-core/src/query.d.ts +119 -0
  18. package/build/types/query-core/src/queryCache.d.ts +59 -0
  19. package/build/types/query-core/src/queryClient.d.ts +65 -0
  20. package/build/types/query-core/src/queryObserver.d.ts +61 -0
  21. package/build/types/query-core/src/removable.d.ts +9 -0
  22. package/build/types/query-core/src/retryer.d.ts +33 -0
  23. package/build/types/query-core/src/subscribable.d.ts +10 -0
  24. package/build/types/query-core/src/types.d.ts +417 -0
  25. package/build/types/query-core/src/utils.d.ts +99 -0
  26. package/build/types/react-query/src/Hydrate.d.ts +10 -0
  27. package/build/types/react-query/src/QueryClientProvider.d.ts +24 -0
  28. package/build/types/react-query/src/QueryErrorResetBoundary.d.ts +12 -0
  29. package/build/types/react-query/src/index.d.ts +17 -0
  30. package/build/types/react-query/src/isRestoring.d.ts +3 -0
  31. package/build/types/react-query/src/reactBatchedUpdates.d.ts +2 -0
  32. package/build/types/react-query/src/setBatchUpdatesFn.d.ts +1 -0
  33. package/build/types/react-query/src/types.d.ts +35 -0
  34. package/build/types/react-query/src/useBaseQuery.d.ts +3 -0
  35. package/build/types/react-query/src/useInfiniteQuery.d.ts +5 -0
  36. package/build/types/react-query/src/useIsFetching.d.ts +7 -0
  37. package/build/types/react-query/src/useIsMutating.d.ts +7 -0
  38. package/build/types/react-query/src/useMutation.d.ts +6 -0
  39. package/build/types/react-query/src/useQueries.d.ts +49 -0
  40. package/build/types/react-query/src/useQuery.d.ts +20 -0
  41. package/build/types/react-query/src/utils.d.ts +1 -0
  42. package/build/types/react-query-devtools/src/Explorer.d.ts +48 -0
  43. package/build/types/react-query-devtools/src/Logo.d.ts +2 -0
  44. package/build/types/react-query-devtools/src/__tests__/Explorer.test.d.ts +1 -0
  45. package/build/types/react-query-devtools/src/__tests__/devtools.test.d.ts +6 -0
  46. package/build/types/react-query-devtools/src/__tests__/utils.d.ts +22 -0
  47. package/build/types/react-query-devtools/src/devtools.d.ts +65 -0
  48. package/build/types/react-query-devtools/src/index.d.ts +1 -0
  49. package/build/types/react-query-devtools/src/noop.d.ts +2 -0
  50. package/build/types/react-query-devtools/src/styledComponents.d.ts +9 -0
  51. package/build/types/react-query-devtools/src/theme.d.ts +36 -0
  52. package/build/types/react-query-devtools/src/useLocalStorage.d.ts +1 -0
  53. package/build/types/react-query-devtools/src/useMediaQuery.d.ts +1 -0
  54. package/build/types/react-query-devtools/src/utils.d.ts +21 -0
  55. package/package.json +2 -2
  56. package/build/cjs/Explorer.js +0 -215
  57. package/build/cjs/Explorer.js.map +0 -1
  58. package/build/cjs/Logo.js +0 -66
  59. package/build/cjs/Logo.js.map +0 -1
  60. package/build/cjs/devtools.js +0 -822
  61. package/build/cjs/devtools.js.map +0 -1
  62. package/build/cjs/index.js +0 -21
  63. package/build/cjs/index.js.map +0 -1
  64. package/build/cjs/styledComponents.js +0 -113
  65. package/build/cjs/styledComponents.js.map +0 -1
  66. package/build/cjs/theme.js +0 -68
  67. package/build/cjs/theme.js.map +0 -1
  68. package/build/cjs/useLocalStorage.js +0 -81
  69. package/build/cjs/useLocalStorage.js.map +0 -1
  70. package/build/cjs/useMediaQuery.js +0 -66
  71. package/build/cjs/useMediaQuery.js.map +0 -1
  72. package/build/cjs/utils.js +0 -100
  73. package/build/cjs/utils.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import * as React from 'react'\nimport type { Query } from '@tanstack/react-query'\n\nimport { Theme, useTheme } from './theme'\nimport useMediaQuery from './useMediaQuery'\n\nexport const isServer = typeof window === 'undefined'\n\ntype StyledComponent<T> = T extends 'button'\n ? React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >\n : T extends 'input'\n ? React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >\n : T extends 'select'\n ? React.DetailedHTMLProps<\n React.SelectHTMLAttributes<HTMLSelectElement>,\n HTMLSelectElement\n >\n : T extends keyof HTMLElementTagNameMap\n ? React.HTMLAttributes<HTMLElementTagNameMap[T]>\n : never\n\nexport function getQueryStatusColor({\n queryState,\n observerCount,\n isStale,\n theme,\n}: {\n queryState: Query['state']\n observerCount: number\n isStale: boolean\n theme: Theme\n}) {\n return queryState.fetchStatus === 'fetching'\n ? theme.active\n : !observerCount\n ? theme.gray\n : queryState.fetchStatus === 'paused'\n ? theme.paused\n : isStale\n ? theme.warning\n : theme.success\n}\n\nexport function getQueryStatusLabel(query: Query) {\n return query.state.fetchStatus === 'fetching'\n ? 'fetching'\n : !query.getObserversCount()\n ? 'inactive'\n : query.state.fetchStatus === 'paused'\n ? 'paused'\n : query.isStale()\n ? 'stale'\n : 'fresh'\n}\n\ntype Styles =\n | React.CSSProperties\n | ((props: Record<string, any>, theme: Theme) => React.CSSProperties)\n\nexport function styled<T extends keyof HTMLElementTagNameMap>(\n type: T,\n newStyles: Styles,\n queries: Record<string, Styles> = {},\n) {\n return React.forwardRef<HTMLElementTagNameMap[T], StyledComponent<T>>(\n ({ style, ...rest }, ref) => {\n const theme = useTheme()\n\n const mediaStyles = Object.entries(queries).reduce(\n (current, [key, value]) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useMediaQuery(key)\n ? {\n ...current,\n ...(typeof value === 'function' ? value(rest, theme) : value),\n }\n : current\n },\n {},\n )\n\n return React.createElement(type, {\n ...rest,\n style: {\n ...(typeof newStyles === 'function'\n ? newStyles(rest, theme)\n : newStyles),\n ...style,\n ...mediaStyles,\n },\n ref,\n })\n },\n )\n}\n\nexport function useIsMounted() {\n const mountedRef = React.useRef(false)\n const isMounted = React.useCallback(() => mountedRef.current, [])\n\n React[isServer ? 'useEffect' : 'useLayoutEffect'](() => {\n mountedRef.current = true\n return () => {\n mountedRef.current = false\n }\n }, [])\n\n return isMounted\n}\n\n/**\n * Displays a string regardless the type of the data\n * @param {unknown} value Value to be stringified\n */\nexport const displayValue = (value: unknown) => {\n const name = Object.getOwnPropertyNames(Object(value))\n const newValue = typeof value === 'bigint' ? `${value.toString()}n` : value\n\n return JSON.stringify(newValue, name)\n}\n"],"names":["isServer","window","getQueryStatusColor","queryState","observerCount","isStale","theme","fetchStatus","active","gray","paused","warning","success","getQueryStatusLabel","query","state","getObserversCount","styled","type","newStyles","queries","React","forwardRef","style","rest","ref","useTheme","mediaStyles","Object","entries","reduce","current","key","value","useMediaQuery","createElement","useIsMounted","mountedRef","useRef","isMounted","useCallback","displayValue","name","getOwnPropertyNames","newValue","toString","JSON","stringify"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAMaA,QAAQ,GAAG,OAAOC,MAAP,KAAkB,YAAnC;AAqBA,SAASC,mBAAT,CAA6B;EAClCC,UADkC;EAElCC,aAFkC;EAGlCC,OAHkC;AAIlCC,EAAAA,KAAAA;A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