@tanstack/devtools 0.6.18 → 0.6.19

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.
@@ -63,7 +63,8 @@ var initialState = {
63
63
  requireUrlFlag: false,
64
64
  urlFlag: "tanstack-devtools",
65
65
  theme: typeof window !== "undefined" && typeof window.matchMedia !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light",
66
- triggerImage: ""
66
+ triggerImage: "",
67
+ triggerHidden: false
67
68
  },
68
69
  state: {
69
70
  activeTab: "plugins",
@@ -201,7 +202,7 @@ var generatePluginId = (plugin, index) => {
201
202
  function getStateFromLocalStorage(plugins) {
202
203
  const existingStateString = getStorageItem(TANSTACK_DEVTOOLS_STATE);
203
204
  const existingState = tryParseJson(existingStateString);
204
- const pluginIds = [];
205
+ const pluginIds = plugins?.map((plugin, i) => generatePluginId(plugin, i)) || [];
205
206
  if (existingState?.activePlugins) {
206
207
  const originalLength = existingState.activePlugins.length;
207
208
  existingState.activePlugins = existingState.activePlugins.filter((id) => pluginIds.includes(id));
@@ -212,7 +213,7 @@ function getStateFromLocalStorage(plugins) {
212
213
  return existingState;
213
214
  }
214
215
  var getExistingStateFromStorage = (config, plugins) => {
215
- const existingState = getStateFromLocalStorage();
216
+ const existingState = getStateFromLocalStorage(plugins);
216
217
  const settings = getSettings();
217
218
  const state = {
218
219
  ...initialState,
package/dist/dev.js CHANGED
@@ -1,5 +1,5 @@
1
- import { initialState, DevtoolsProvider, PiPProvider } from './chunk/SFOE7G6Y.js';
2
- export { PLUGIN_CONTAINER_ID, PLUGIN_TITLE_CONTAINER_ID } from './chunk/SFOE7G6Y.js';
1
+ import { initialState, DevtoolsProvider, PiPProvider } from './chunk/XFQ6P775.js';
2
+ export { PLUGIN_CONTAINER_ID, PLUGIN_TITLE_CONTAINER_ID } from './chunk/XFQ6P775.js';
3
3
  import { render, createComponent, Portal } from 'solid-js/web';
4
4
  import { lazy } from 'solid-js';
5
5
  import { ClientEventBus } from '@tanstack/devtools-event-bus/client';
@@ -29,7 +29,7 @@ var TanStackDevtoolsCore = class {
29
29
  const mountTo = el;
30
30
  const dispose = render(() => {
31
31
  const _self$ = this;
32
- this.#Component = lazy(() => import('./devtools/LMV5GWDT.js'));
32
+ this.#Component = lazy(() => import('./devtools/3YT62TLF.js'));
33
33
  const Devtools = this.#Component;
34
34
  this.#eventBus = new ClientEventBus(this.#eventBusConfig);
35
35
  this.#eventBus.start();
@@ -1,4 +1,4 @@
1
- import { usePiPWindow, keyboardModifiers, getAllPermutations, TANSTACK_DEVTOOLS, DevtoolsContext, PLUGIN_TITLE_CONTAINER_ID, PLUGIN_CONTAINER_ID, uppercaseFirstLetter } from '../chunk/SFOE7G6Y.js';
1
+ import { usePiPWindow, keyboardModifiers, getAllPermutations, TANSTACK_DEVTOOLS, DevtoolsContext, PLUGIN_TITLE_CONTAINER_ID, PLUGIN_CONTAINER_ID, uppercaseFirstLetter } from '../chunk/XFQ6P775.js';
2
2
  import { delegateEvents, createComponent, Portal, template, use, setAttribute, insert, memo, effect, className, addEventListener } from 'solid-js/web';
3
3
  import { createContext, createSignal, createEffect, onCleanup, Show, createMemo, For, useContext, onMount } from 'solid-js';
4
4
  import { createShortcut } from '@solid-primitives/keyboard';
@@ -904,13 +904,18 @@ var Trigger = ({
904
904
  const buttonStyle = createMemo(() => {
905
905
  return clsx3(styles().mainCloseBtn, styles().mainCloseBtnPosition(settings().position), styles().mainCloseBtnAnimation(isOpen(), settings().hideUntilHover));
906
906
  });
907
- return (() => {
908
- var _el$ = _tmpl$(), _el$2 = _el$.firstChild;
909
- _el$.$$click = () => setIsOpen(!isOpen());
910
- setAttribute(_el$2, "src", image || tanstack_logo_default);
911
- effect(() => className(_el$, buttonStyle()));
912
- return _el$;
913
- })();
907
+ return createComponent(Show, {
908
+ get when() {
909
+ return !settings().triggerHidden;
910
+ },
911
+ get children() {
912
+ var _el$ = _tmpl$(), _el$2 = _el$.firstChild;
913
+ _el$.$$click = () => setIsOpen(!isOpen());
914
+ setAttribute(_el$2, "src", image || tanstack_logo_default);
915
+ effect(() => className(_el$, buttonStyle()));
916
+ return _el$;
917
+ }
918
+ });
914
919
  };
915
920
  delegateEvents(["click"]);
916
921
  var _tmpl$2 = /* @__PURE__ */ template(`<div>`);
@@ -1029,6 +1034,16 @@ var SettingsTab = () => {
1029
1034
  return settings().hideUntilHover;
1030
1035
  }
1031
1036
  }), null);
1037
+ insert(_el$, createComponent(Checkbox, {
1038
+ label: "Completely hide trigger",
1039
+ description: "Completely removes the trigger from the DOM (you can still open it with the hotkey)",
1040
+ onChange: () => setSettings({
1041
+ triggerHidden: !settings().triggerHidden
1042
+ }),
1043
+ get checked() {
1044
+ return settings().triggerHidden;
1045
+ }
1046
+ }), null);
1032
1047
  insert(_el$, createComponent(Input, {
1033
1048
  label: "Trigger Image",
1034
1049
  description: "Specify the URL of the image to use for the trigger",
@@ -1,4 +1,4 @@
1
- import { usePiPWindow, keyboardModifiers, getAllPermutations, TANSTACK_DEVTOOLS, DevtoolsContext, PLUGIN_TITLE_CONTAINER_ID, PLUGIN_CONTAINER_ID, uppercaseFirstLetter } from '../chunk/SFOE7G6Y.js';
1
+ import { usePiPWindow, keyboardModifiers, getAllPermutations, TANSTACK_DEVTOOLS, DevtoolsContext, PLUGIN_TITLE_CONTAINER_ID, PLUGIN_CONTAINER_ID, uppercaseFirstLetter } from '../chunk/XFQ6P775.js';
2
2
  import { createComponent, Portal, ssr, ssrAttribute, escape } from 'solid-js/web';
3
3
  import { createContext, createSignal, createEffect, onCleanup, Show, createMemo, For, useContext, onMount } from 'solid-js';
4
4
  import { createShortcut } from '@solid-primitives/keyboard';
@@ -904,7 +904,14 @@ var Trigger = ({
904
904
  const buttonStyle = createMemo(() => {
905
905
  return clsx3(styles().mainCloseBtn, styles().mainCloseBtnPosition(settings().position), styles().mainCloseBtnAnimation(isOpen(), settings().hideUntilHover));
906
906
  });
907
- return ssr(_tmpl$, ssrAttribute("class", escape(buttonStyle(), true), false), ssrAttribute("src", escape(image, true) || escape(tanstack_logo_default, true), false));
907
+ return createComponent(Show, {
908
+ get when() {
909
+ return !settings().triggerHidden;
910
+ },
911
+ get children() {
912
+ return ssr(_tmpl$, ssrAttribute("class", escape(buttonStyle(), true), false), ssrAttribute("src", escape(image, true) || escape(tanstack_logo_default, true), false));
913
+ }
914
+ });
908
915
  };
909
916
  var _tmpl$2 = ["<div", ' style="', '"', ">", "</div>"];
910
917
  var MainPanel = (props) => {
@@ -932,7 +939,7 @@ var ContentPanel = (props) => {
932
939
  } = useDevtoolsSettings();
933
940
  return ssr(_tmpl$3, ssrAttribute("class", escape(styles().devtoolsPanel, true), false), props.handleDragStart ? ssr(_tmpl$22, ssrAttribute("class", escape(styles().dragHandle(settings().panelLocation), true), false)) : escape(null), escape(props.children));
934
941
  };
935
- var _tmpl$4 = ["<div", ">", "", "", "", "</div>"];
942
+ var _tmpl$4 = ["<div", ">", "", "", "", "", "</div>"];
936
943
  var _tmpl$23 = ["<div", ">", "</div>"];
937
944
  var _tmpl$32 = ["<div", ">", "", "</div>"];
938
945
  var _tmpl$42 = ["<div", "><div", ">", "</div>", "Final shortcut is: ", "</div>"];
@@ -990,6 +997,15 @@ var SettingsTab = () => {
990
997
  get checked() {
991
998
  return settings().hideUntilHover;
992
999
  }
1000
+ })), escape(createComponent(Checkbox, {
1001
+ label: "Completely hide trigger",
1002
+ description: "Completely removes the trigger from the DOM (you can still open it with the hotkey)",
1003
+ onChange: () => setSettings({
1004
+ triggerHidden: !settings().triggerHidden
1005
+ }),
1006
+ get checked() {
1007
+ return settings().triggerHidden;
1008
+ }
993
1009
  })), escape(createComponent(Input, {
994
1010
  label: "Trigger Image",
995
1011
  description: "Specify the URL of the image to use for the trigger",
package/dist/index.d.ts CHANGED
@@ -73,6 +73,10 @@ type DevtoolsStore = {
73
73
  * @default TanStackLogo
74
74
  */
75
75
  triggerImage: string;
76
+ /**
77
+ * Whether the trigger should be completely hidden or not (you can still open with the hotkey)
78
+ */
79
+ triggerHidden?: boolean;
76
80
  };
77
81
  state: {
78
82
  activeTab: TabName;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { initialState, DevtoolsProvider, PiPProvider } from './chunk/SFOE7G6Y.js';
2
- export { PLUGIN_CONTAINER_ID, PLUGIN_TITLE_CONTAINER_ID } from './chunk/SFOE7G6Y.js';
1
+ import { initialState, DevtoolsProvider, PiPProvider } from './chunk/XFQ6P775.js';
2
+ export { PLUGIN_CONTAINER_ID, PLUGIN_TITLE_CONTAINER_ID } from './chunk/XFQ6P775.js';
3
3
  import { render, createComponent, Portal } from 'solid-js/web';
4
4
  import { lazy } from 'solid-js';
5
5
  import { ClientEventBus } from '@tanstack/devtools-event-bus/client';
@@ -29,7 +29,7 @@ var TanStackDevtoolsCore = class {
29
29
  const mountTo = el;
30
30
  const dispose = render(() => {
31
31
  const _self$ = this;
32
- this.#Component = lazy(() => import('./devtools/LMV5GWDT.js'));
32
+ this.#Component = lazy(() => import('./devtools/3YT62TLF.js'));
33
33
  const Devtools = this.#Component;
34
34
  this.#eventBus = new ClientEventBus(this.#eventBusConfig);
35
35
  this.#eventBus.start();
package/dist/server.js CHANGED
@@ -1,5 +1,5 @@
1
- import { initialState } from './chunk/SFOE7G6Y.js';
2
- export { PLUGIN_CONTAINER_ID, PLUGIN_TITLE_CONTAINER_ID } from './chunk/SFOE7G6Y.js';
1
+ import { initialState } from './chunk/XFQ6P775.js';
2
+ export { PLUGIN_CONTAINER_ID, PLUGIN_TITLE_CONTAINER_ID } from './chunk/XFQ6P775.js';
3
3
  import 'solid-js/web';
4
4
  import 'solid-js';
5
5
  import '@tanstack/devtools-event-bus/client';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/devtools",
3
- "version": "0.6.18",
3
+ "version": "0.6.19",
4
4
  "description": "TanStack Devtools is a set of tools for building advanced devtools for your application.",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -1,4 +1,4 @@
1
- import { createMemo } from 'solid-js'
1
+ import { Show, createMemo } from 'solid-js'
2
2
  import clsx from 'clsx'
3
3
  import { useDevtoolsSettings } from '../context/use-devtools-context'
4
4
  import { useStyles } from '../styles/use-styles'
@@ -24,13 +24,15 @@ export const Trigger = ({
24
24
  )
25
25
  })
26
26
  return (
27
- <button
28
- type="button"
29
- aria-label="Open TanStack Devtools"
30
- class={buttonStyle()}
31
- onClick={() => setIsOpen(!isOpen())}
32
- >
33
- <img src={image || TanStackLogo} alt="TanStack Devtools" />
34
- </button>
27
+ <Show when={!settings().triggerHidden}>
28
+ <button
29
+ type="button"
30
+ aria-label="Open TanStack Devtools"
31
+ class={buttonStyle()}
32
+ onClick={() => setIsOpen(!isOpen())}
33
+ >
34
+ <img src={image || TanStackLogo} alt="TanStack Devtools" />
35
+ </button>
36
+ </Show>
35
37
  )
36
38
  }
@@ -7,7 +7,7 @@ describe('getStateFromLocalStorage', () => {
7
7
  localStorage.clear()
8
8
  })
9
9
  it('should return undefined when no data in localStorage', () => {
10
- const state = getStateFromLocalStorage()
10
+ const state = getStateFromLocalStorage(undefined)
11
11
  expect(state).toEqual(undefined)
12
12
  })
13
13
  it('should return parsed state from localStorage and not remove valid plugins', () => {
@@ -53,7 +53,7 @@ describe('getStateFromLocalStorage', () => {
53
53
  })
54
54
  it('should handle invalid JSON in localStorage gracefully', () => {
55
55
  localStorage.setItem(TANSTACK_DEVTOOLS_STATE, 'invalid json')
56
- const state = getStateFromLocalStorage()
56
+ const state = getStateFromLocalStorage(undefined)
57
57
  expect(state).toEqual(undefined)
58
58
  })
59
59
  })
@@ -100,13 +100,14 @@ const generatePluginId = (plugin: TanStackDevtoolsPlugin, index: number) => {
100
100
  }
101
101
 
102
102
  export function getStateFromLocalStorage(
103
- plugins?: Array<TanStackDevtoolsPlugin>,
103
+ plugins: Array<TanStackDevtoolsPlugin> | undefined,
104
104
  ) {
105
105
  const existingStateString = getStorageItem(TANSTACK_DEVTOOLS_STATE)
106
106
  const existingState =
107
107
  tryParseJson<DevtoolsStore['state']>(existingStateString)
108
108
  const pluginIds =
109
109
  plugins?.map((plugin, i) => generatePluginId(plugin, i)) || []
110
+
110
111
  if (existingState?.activePlugins) {
111
112
  const originalLength = existingState.activePlugins.length
112
113
  // Filter out any active plugins that are no longer available
@@ -127,7 +128,7 @@ const getExistingStateFromStorage = (
127
128
  config?: TanStackDevtoolsConfig,
128
129
  plugins?: Array<TanStackDevtoolsPlugin>,
129
130
  ) => {
130
- const existingState = getStateFromLocalStorage()
131
+ const existingState = getStateFromLocalStorage(plugins)
131
132
  const settings = getSettings()
132
133
 
133
134
  const state: DevtoolsStore = {
@@ -66,6 +66,10 @@ export type DevtoolsStore = {
66
66
  * @default TanStackLogo
67
67
  */
68
68
  triggerImage: string
69
+ /**
70
+ * Whether the trigger should be completely hidden or not (you can still open with the hotkey)
71
+ */
72
+ triggerHidden?: boolean
69
73
  }
70
74
  state: {
71
75
  activeTab: TabName
@@ -92,6 +96,7 @@ export const initialState: DevtoolsStore = {
92
96
  ? 'dark'
93
97
  : 'light',
94
98
  triggerImage: '',
99
+ triggerHidden: false,
95
100
  },
96
101
  state: {
97
102
  activeTab: 'plugins',
@@ -71,6 +71,14 @@ export const SettingsTab = () => {
71
71
  }
72
72
  checked={settings().hideUntilHover}
73
73
  />
74
+ <Checkbox
75
+ label="Completely hide trigger"
76
+ description="Completely removes the trigger from the DOM (you can still open it with the hotkey)"
77
+ onChange={() =>
78
+ setSettings({ triggerHidden: !settings().triggerHidden })
79
+ }
80
+ checked={settings().triggerHidden}
81
+ />
74
82
  <Input
75
83
  label="Trigger Image"
76
84
  description="Specify the URL of the image to use for the trigger"