@tanstack/router-devtools 0.0.1-alpha.1 → 0.0.1-beta.101

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 (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/build/cjs/{packages/react-router-devtools/src/Explorer.js → Explorer.js} +52 -81
  4. package/build/cjs/Explorer.js.map +1 -0
  5. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -19
  6. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
  7. package/build/cjs/devtools.js +637 -0
  8. package/build/cjs/devtools.js.map +1 -0
  9. package/build/cjs/{packages/react-router-devtools/src/index.js → index.js} +1 -1
  10. package/build/cjs/{packages/react-router-devtools/src/styledComponents.js → styledComponents.js} +10 -38
  11. package/build/cjs/styledComponents.js.map +1 -0
  12. package/build/cjs/{packages/react-router-devtools/src/theme.js → theme.js} +6 -9
  13. package/build/cjs/theme.js.map +1 -0
  14. package/build/cjs/{packages/react-router-devtools/src/useLocalStorage.js → useLocalStorage.js} +3 -10
  15. package/build/cjs/useLocalStorage.js.map +1 -0
  16. package/build/cjs/{packages/react-router-devtools/src/useMediaQuery.js → useMediaQuery.js} +13 -12
  17. package/build/cjs/useMediaQuery.js.map +1 -0
  18. package/build/cjs/{packages/react-router-devtools/src/utils.js → utils.js} +30 -35
  19. package/build/cjs/utils.js.map +1 -0
  20. package/build/esm/index.js +390 -1361
  21. package/build/esm/index.js.map +1 -1
  22. package/build/stats-html.html +59 -49
  23. package/build/stats-react.json +223 -9444
  24. package/build/types/Explorer.d.ts +47 -0
  25. package/build/types/devtools.d.ts +65 -0
  26. package/build/types/index.d.ts +1 -76
  27. package/build/types/styledComponents.d.ts +7 -0
  28. package/build/types/theme.d.ts +34 -0
  29. package/build/types/useLocalStorage.d.ts +1 -0
  30. package/build/types/useMediaQuery.d.ts +1 -0
  31. package/build/types/utils.d.ts +23 -0
  32. package/build/umd/index.development.js +429 -1340
  33. package/build/umd/index.development.js.map +1 -1
  34. package/build/umd/index.production.js +22 -2
  35. package/build/umd/index.production.js.map +1 -1
  36. package/package.json +11 -10
  37. package/src/Explorer.tsx +14 -12
  38. package/src/devtools.tsx +354 -345
  39. package/src/useLocalStorage.ts +5 -5
  40. package/src/useMediaQuery.ts +3 -0
  41. package/src/utils.ts +57 -16
  42. package/build/cjs/packages/react-router-devtools/src/Explorer.js.map +0 -1
  43. package/build/cjs/packages/react-router-devtools/src/Logo.js +0 -73
  44. package/build/cjs/packages/react-router-devtools/src/Logo.js.map +0 -1
  45. package/build/cjs/packages/react-router-devtools/src/devtools.js +0 -654
  46. package/build/cjs/packages/react-router-devtools/src/devtools.js.map +0 -1
  47. package/build/cjs/packages/react-router-devtools/src/styledComponents.js.map +0 -1
  48. package/build/cjs/packages/react-router-devtools/src/theme.js.map +0 -1
  49. package/build/cjs/packages/react-router-devtools/src/useLocalStorage.js.map +0 -1
  50. package/build/cjs/packages/react-router-devtools/src/useMediaQuery.js.map +0 -1
  51. package/build/cjs/packages/react-router-devtools/src/utils.js.map +0 -1
  52. package/src/Logo.tsx +0 -37
  53. /package/build/cjs/{packages/react-router-devtools/src/index.js.map → index.js.map} +0 -0
@@ -0,0 +1,47 @@
1
+ import * as React from 'react';
2
+ export declare const Entry: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
3
+ export declare const Label: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>>;
4
+ export declare const LabelButton: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & React.RefAttributes<HTMLButtonElement>>;
5
+ export declare const ExpandButton: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & React.RefAttributes<HTMLButtonElement>>;
6
+ export declare const Value: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>>;
7
+ export declare const SubEntries: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
8
+ export declare const Info: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>>;
9
+ type ExpanderProps = {
10
+ expanded: boolean;
11
+ style?: React.CSSProperties;
12
+ };
13
+ export declare const Expander: ({ expanded, style }: ExpanderProps) => JSX.Element;
14
+ type Entry = {
15
+ label: string;
16
+ };
17
+ type RendererProps = {
18
+ handleEntry: HandleEntryFn;
19
+ label?: React.ReactNode;
20
+ value: unknown;
21
+ subEntries: Entry[];
22
+ subEntryPages: Entry[][];
23
+ type: string;
24
+ expanded: boolean;
25
+ toggleExpanded: () => void;
26
+ pageSize: number;
27
+ renderer?: Renderer;
28
+ };
29
+ /**
30
+ * Chunk elements in the array by size
31
+ *
32
+ * when the array cannot be chunked evenly by size, the last chunk will be
33
+ * filled with the remaining elements
34
+ *
35
+ * @example
36
+ * chunkArray(['a','b', 'c', 'd', 'e'], 2) // returns [['a','b'], ['c', 'd'], ['e']]
37
+ */
38
+ export declare function chunkArray<T>(array: T[], size: number): T[][];
39
+ type Renderer = (props: RendererProps) => JSX.Element;
40
+ export declare const DefaultRenderer: Renderer;
41
+ type HandleEntryFn = (entry: Entry) => JSX.Element;
42
+ type ExplorerProps = Partial<RendererProps> & {
43
+ renderer?: Renderer;
44
+ defaultExpanded?: true | Record<string, boolean>;
45
+ };
46
+ export default function Explorer({ value, defaultExpanded, renderer, pageSize, ...rest }: ExplorerProps): JSX.Element;
47
+ export {};
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import { AnyRouter } from '@tanstack/router';
3
+ export type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
4
+ interface DevtoolsOptions {
5
+ /**
6
+ * Set this true if you want the dev tools to default to being open
7
+ */
8
+ initialIsOpen?: boolean;
9
+ /**
10
+ * Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.
11
+ */
12
+ panelProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
13
+ /**
14
+ * Use this to add props to the close button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
15
+ */
16
+ closeButtonProps?: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
17
+ /**
18
+ * Use this to add props to the toggle button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
19
+ */
20
+ toggleButtonProps?: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
21
+ /**
22
+ * The position of the TanStack Router logo to open and close the devtools panel.
23
+ * Defaults to 'bottom-left'.
24
+ */
25
+ position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
26
+ /**
27
+ * Use this to render the devtools inside a different type of container element for a11y purposes.
28
+ * Any string which corresponds to a valid intrinsic JSX element is allowed.
29
+ * Defaults to 'footer'.
30
+ */
31
+ containerElement?: string | any;
32
+ /**
33
+ * A boolean variable indicating if the "lite" version of the library is being used
34
+ */
35
+ router?: AnyRouter;
36
+ }
37
+ interface DevtoolsPanelOptions {
38
+ /**
39
+ * The standard React style object used to style a component with inline styles
40
+ */
41
+ style?: React.CSSProperties;
42
+ /**
43
+ * The standard React className property used to style a component with classes
44
+ */
45
+ className?: string;
46
+ /**
47
+ * A boolean variable indicating whether the panel is open or closed
48
+ */
49
+ isOpen?: boolean;
50
+ /**
51
+ * A function that toggles the open and close state of the panel
52
+ */
53
+ setIsOpen: (isOpen: boolean) => void;
54
+ /**
55
+ * Handles the opening and closing the devtools panel
56
+ */
57
+ handleDragStart: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
58
+ /**
59
+ * A boolean variable indicating if the "lite" version of the library is being used
60
+ */
61
+ router?: AnyRouter;
62
+ }
63
+ export declare function TanStackRouterDevtools({ initialIsOpen, panelProps, closeButtonProps, toggleButtonProps, position, containerElement: Container, router, }: DevtoolsOptions): React.ReactElement | null;
64
+ export declare const TanStackRouterDevtoolsPanel: React.ForwardRefExoticComponent<DevtoolsPanelOptions & React.RefAttributes<HTMLDivElement>>;
65
+ export {};
@@ -1,76 +1 @@
1
- /**
2
- * react-router-devtools
3
- *
4
- * Copyright (c) TanStack
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- import React from 'react';
12
-
13
- declare type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
14
- interface DevtoolsOptions {
15
- /**
16
- * Set this true if you want the dev tools to default to being open
17
- */
18
- initialIsOpen?: boolean;
19
- /**
20
- * Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.
21
- */
22
- panelProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
23
- /**
24
- * Use this to add props to the close button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
25
- */
26
- closeButtonProps?: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
27
- /**
28
- * Use this to add props to the toggle button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
29
- */
30
- toggleButtonProps?: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
31
- /**
32
- * The position of the TanStack Router logo to open and close the devtools panel.
33
- * Defaults to 'bottom-left'.
34
- */
35
- position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
36
- /**
37
- * Use this to render the devtools inside a different type of container element for a11y purposes.
38
- * Any string which corresponds to a valid intrinsic JSX element is allowed.
39
- * Defaults to 'footer'.
40
- */
41
- containerElement?: string | any;
42
- /**
43
- * A boolean variable indicating if the "lite" version of the library is being used
44
- */
45
- useRouter?: () => unknown;
46
- }
47
- interface DevtoolsPanelOptions {
48
- /**
49
- * The standard React style object used to style a component with inline styles
50
- */
51
- style?: React.CSSProperties;
52
- /**
53
- * The standard React className property used to style a component with classes
54
- */
55
- className?: string;
56
- /**
57
- * A boolean variable indicating whether the panel is open or closed
58
- */
59
- isOpen?: boolean;
60
- /**
61
- * A function that toggles the open and close state of the panel
62
- */
63
- setIsOpen: (isOpen: boolean) => void;
64
- /**
65
- * Handles the opening and closing the devtools panel
66
- */
67
- handleDragStart: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
68
- /**
69
- * A boolean variable indicating if the "lite" version of the library is being used
70
- */
71
- useRouter: () => unknown;
72
- }
73
- declare function TanStackRouterDevtools({ initialIsOpen, panelProps, closeButtonProps, toggleButtonProps, position, containerElement: Container, useRouter: useRouterImpl, }: DevtoolsOptions): React.ReactElement | null;
74
- declare const TanStackRouterDevtoolsPanel: React.ForwardRefExoticComponent<DevtoolsPanelOptions & React.RefAttributes<HTMLDivElement>>;
75
-
76
- export { PartialKeys, TanStackRouterDevtools, TanStackRouterDevtoolsPanel };
1
+ export * from './devtools';
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const Panel: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
3
+ export declare const ActivePanel: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
4
+ export declare const Button: import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & import("react").RefAttributes<HTMLButtonElement>>;
5
+ export declare const Code: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>>;
6
+ export declare const Input: import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof import("react").InputHTMLAttributes<HTMLInputElement>> & import("react").RefAttributes<HTMLInputElement>>;
7
+ export declare const Select: import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, "key" | keyof import("react").SelectHTMLAttributes<HTMLSelectElement>> & import("react").RefAttributes<HTMLSelectElement>>;
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ export declare const defaultTheme: {
3
+ readonly background: "#0b1521";
4
+ readonly backgroundAlt: "#132337";
5
+ readonly foreground: "white";
6
+ readonly gray: "#3f4e60";
7
+ readonly grayAlt: "#222e3e";
8
+ readonly inputBackgroundColor: "#fff";
9
+ readonly inputTextColor: "#000";
10
+ readonly success: "#00ab52";
11
+ readonly danger: "#ff0085";
12
+ readonly active: "#006bff";
13
+ readonly warning: "#ffb200";
14
+ };
15
+ export type Theme = typeof defaultTheme;
16
+ interface ProviderProps {
17
+ theme: Theme;
18
+ children?: React.ReactNode;
19
+ }
20
+ export declare function ThemeProvider({ theme, ...rest }: ProviderProps): JSX.Element;
21
+ export declare function useTheme(): {
22
+ readonly background: "#0b1521";
23
+ readonly backgroundAlt: "#132337";
24
+ readonly foreground: "white";
25
+ readonly gray: "#3f4e60";
26
+ readonly grayAlt: "#222e3e";
27
+ readonly inputBackgroundColor: "#fff";
28
+ readonly inputTextColor: "#000";
29
+ readonly success: "#00ab52";
30
+ readonly danger: "#ff0085";
31
+ readonly active: "#006bff";
32
+ readonly warning: "#ffb200";
33
+ };
34
+ export {};
@@ -0,0 +1 @@
1
+ export default function useLocalStorage<T>(key: string, defaultValue: T | undefined): [T | undefined, (newVal: T | ((prevVal: T) => T)) => void];
@@ -0,0 +1 @@
1
+ export default function useMediaQuery(query: string): boolean | undefined;
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { AnyRootRoute, AnyRoute, AnyRouteMatch } from '@tanstack/router';
3
+ import { Theme } from './theme';
4
+ export declare const isServer: boolean;
5
+ type StyledComponent<T> = T extends 'button' ? React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> : T extends 'input' ? React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> : T extends 'select' ? React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement> : T extends keyof HTMLElementTagNameMap ? React.HTMLAttributes<HTMLElementTagNameMap[T]> : never;
6
+ export declare function getStatusColor(match: AnyRouteMatch, theme: Theme): "#3f4e60" | "#00ab52" | "#ff0085" | "#006bff";
7
+ export declare function getRouteStatusColor(matches: AnyRouteMatch[], route: AnyRoute | AnyRootRoute, theme: Theme): "#3f4e60" | "#00ab52" | "#ff0085" | "#006bff";
8
+ type Styles = React.CSSProperties | ((props: Record<string, any>, theme: Theme) => React.CSSProperties);
9
+ export declare function styled<T extends keyof HTMLElementTagNameMap>(type: T, newStyles: Styles, queries?: Record<string, Styles>): React.ForwardRefExoticComponent<React.PropsWithoutRef<StyledComponent<T>> & React.RefAttributes<HTMLElementTagNameMap[T]>>;
10
+ export declare function useIsMounted(): () => boolean;
11
+ /**
12
+ * Displays a string regardless the type of the data
13
+ * @param {unknown} value Value to be stringified
14
+ */
15
+ export declare const displayValue: (value: unknown) => string;
16
+ /**
17
+ * This hook is a safe useState version which schedules state updates in microtasks
18
+ * to prevent updating a component state while React is rendering different components
19
+ * or when the component is not mounted anymore.
20
+ */
21
+ export declare function useSafeState<T>(initialState: T): [T, (value: T) => void];
22
+ export declare function multiSortBy<T>(arr: T[], accessors?: ((item: T) => any)[]): T[];
23
+ export {};