@tanstack/solid-devtools 0.7.12 → 0.7.13

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.
package/dist/esm/core.js CHANGED
@@ -33,7 +33,7 @@ function SolidDevtoolsCore({
33
33
  const [devtools] = createSignal(new TanStackDevtoolsCore({
34
34
  config: {
35
35
  ...config,
36
- customTrigger: (el, props) => convertTrigger(el, props)
36
+ customTrigger: config?.customTrigger ? (el, props) => convertTrigger(el, props) : void 0
37
37
  },
38
38
  eventBusConfig,
39
39
  plugins: pluginsMap()
@@ -43,7 +43,7 @@ function SolidDevtoolsCore({
43
43
  devtools().setConfig({
44
44
  config: {
45
45
  ...config,
46
- customTrigger: (el, props) => convertTrigger(el, props)
46
+ customTrigger: config?.customTrigger ? (el, props) => convertTrigger(el, props) : void 0
47
47
  }
48
48
  });
49
49
  });
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sources":["../../src/core.tsx"],"sourcesContent":["import { TanStackDevtoolsCore } from '@tanstack/devtools'\nimport {\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n onMount,\n} from 'solid-js'\nimport { Portal } from 'solid-js/web'\nimport type { JSX } from 'solid-js'\nimport type {\n ClientEventBusConfig,\n TanStackDevtoolsConfig,\n TanStackDevtoolsPlugin,\n} from '@tanstack/devtools'\n\ntype SolidPluginRender =\n | JSX.Element\n | ((\n el: HTMLDivElement | HTMLHeadingElement,\n theme: 'dark' | 'light',\n ) => JSX.Element)\nconst convertRender = (\n el: HTMLDivElement | HTMLHeadingElement,\n Component: SolidPluginRender,\n theme: 'dark' | 'light',\n) => (\n <Portal mount={el}>\n {typeof Component === 'function' ? Component(el, theme) : Component}\n </Portal>\n)\n\nexport type TanStackDevtoolsSolidPlugin = Omit<\n TanStackDevtoolsPlugin,\n 'render' | 'name'\n> & {\n /**\n * The render function can be a SolidJS element or a function that returns a SolidJS element.\n * If it's a function, it will be called to render the plugin, otherwise it will be rendered directly.\n *\n * Example:\n * ```ts\n * {\n * render: () => <CustomPluginComponent />,\n * }\n * ```\n * or\n * ```ts\n * {\n * render: <CustomPluginComponent />,\n * }\n * ```\n */\n render: SolidPluginRender\n /**\n * Name to be displayed in the devtools UI.\n * If a string, it will be used as the plugin name.\n * If a function, it will be called with the mount element.\n *\n * Example:\n * ```ts\n * {\n * name: \"Your Plugin\",\n * render: () => <CustomPluginComponent />,\n * }\n * ```\n * or\n * ```ts\n * {\n * name: <h1>Your Plugin title</h1>,\n * render: () => <CustomPluginComponent />,\n * }\n * ```\n */\n name: string | SolidPluginRender\n}\ninterface TriggerProps {\n theme: 'light' | 'dark'\n}\nexport interface TanStackDevtoolsInit {\n /**\n * Array of plugins to be used in the devtools.\n * Each plugin should have a `render` function that returns a React element or a function\n *\n * Example:\n * ```jsx\n * <TanStackDevtools\n * plugins={[\n * {\n * id: \"your-plugin-id\",\n * name: \"Your Plugin\",\n * render: <CustomPluginComponent />,\n * }\n * ]}\n * />\n * ```\n */\n plugins?: Array<TanStackDevtoolsSolidPlugin>\n /**\n * Configuration for the devtools shell. These configuration options are used to set the\n * initial state of the devtools when it is started for the first time. Afterwards,\n * the settings are persisted in local storage and changed through the settings panel.\n */\n config?: Omit<Partial<TanStackDevtoolsConfig>, 'customTrigger'> & {\n /**\n * An optional custom function to render the dev tools trigger component.\n */\n customTrigger?:\n | ((el: HTMLElement, props: TriggerProps) => JSX.Element)\n | JSX.Element\n }\n /**\n * Configuration for the TanStack Devtools client event bus.\n */\n eventBusConfig?: ClientEventBusConfig\n}\n\nexport default function SolidDevtoolsCore({\n config,\n plugins,\n eventBusConfig,\n}: TanStackDevtoolsInit) {\n // Convert plugins to the format expected by the core\n const pluginsMap = createMemo<Array<TanStackDevtoolsPlugin> | undefined>(() =>\n plugins?.map((plugin) => ({\n ...plugin,\n name:\n typeof plugin.name === 'string'\n ? plugin.name\n : // The check above confirms that `plugin.name` is of Render type\n (el, theme) =>\n convertRender(el, plugin.name as SolidPluginRender, theme),\n render: (el: HTMLDivElement, theme: 'dark' | 'light') =>\n convertRender(el, plugin.render, theme),\n })),\n )\n\n const convertTrigger = (el: HTMLElement, props: TriggerProps) => {\n const Trigger = config?.customTrigger\n\n return (\n <Portal mount={el}>\n {typeof Trigger === 'function' ? Trigger(el, props) : Trigger}\n </Portal>\n )\n }\n const [devtools] = createSignal(\n new TanStackDevtoolsCore({\n config: {\n ...config,\n customTrigger: (el, props) => convertTrigger(el, props),\n },\n eventBusConfig,\n plugins: pluginsMap(),\n }),\n )\n let devToolRef: HTMLDivElement | undefined\n\n createEffect(() => {\n devtools().setConfig({\n config: {\n ...config,\n customTrigger: (el, props) => convertTrigger(el, props),\n },\n })\n })\n\n // Update plugins when they change\n createEffect(() => {\n const currentPlugins = pluginsMap()\n if (currentPlugins) {\n devtools().setConfig({ plugins: currentPlugins })\n }\n })\n\n onMount(() => {\n if (devToolRef) {\n devtools().mount(devToolRef)\n\n onCleanup(() => {\n devtools().unmount()\n })\n }\n })\n return <div style={{ position: 'absolute' }} ref={devToolRef} />\n}\n"],"names":["convertRender","el","Component","theme","_$createComponent","Portal","mount","children","SolidDevtoolsCore","config","plugins","eventBusConfig","pluginsMap","createMemo","map","plugin","name","render","convertTrigger","props","Trigger","customTrigger","devtools","createSignal","TanStackDevtoolsCore","devToolRef","createEffect","setConfig","currentPlugins","onMount","onCleanup","unmount","_el$","_tmpl$","_ref$","_$use","style","setProperty"],"mappings":";;;;AAsBA,MAAMA,gBAAgBA,CACpBC,IACAC,WACAC,UAAuBC,gBAEtBC,QAAM;AAAA,EAACC,OAAOL;AAAAA,EAAE,IAAAM,WAAA;AAAA,WACd,OAAOL,cAAc,aAAaA,UAAUD,IAAIE,KAAK,IAAID;AAAAA,EAAS;AAAA,CAAA;AAyFvE,SAAwBM,kBAAkB;AAAA,EACxCC;AAAAA,EACAC;AAAAA,EACAC;AACoB,GAAG;AAEvB,QAAMC,aAAaC,WAAsD,MACvEH,SAASI,IAAKC,CAAAA,YAAY;AAAA,IACxB,GAA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,QAAAA;AAAAA,MACb,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACD,UAAA,MAAA;AAAA,QAAAC,OAAAC,OAAAA;AAAA,QAAAC,QAAkDT;AAAU,WAAAS,UAAA,aAAAC,IAAAD,OAAAF,IAAA,IAAVP,aAAUO;AAAAA,SAAAI,MAAAC,YAAA,YAAA,UAAA;AAAA,WAAAL;AAAAA,EAAA,GAAA;AAC9D;"}
1
+ {"version":3,"file":"core.js","sources":["../../src/core.tsx"],"sourcesContent":["import { TanStackDevtoolsCore } from '@tanstack/devtools'\nimport {\n createEffect,\n createMemo,\n createSignal,\n onCleanup,\n onMount,\n} from 'solid-js'\nimport { Portal } from 'solid-js/web'\nimport type { JSX } from 'solid-js'\nimport type {\n ClientEventBusConfig,\n TanStackDevtoolsConfig,\n TanStackDevtoolsPlugin,\n} from '@tanstack/devtools'\n\ntype SolidPluginRender =\n | JSX.Element\n | ((\n el: HTMLDivElement | HTMLHeadingElement,\n theme: 'dark' | 'light',\n ) => JSX.Element)\nconst convertRender = (\n el: HTMLDivElement | HTMLHeadingElement,\n Component: SolidPluginRender,\n theme: 'dark' | 'light',\n) => (\n <Portal mount={el}>\n {typeof Component === 'function' ? Component(el, theme) : Component}\n </Portal>\n)\n\nexport type TanStackDevtoolsSolidPlugin = Omit<\n TanStackDevtoolsPlugin,\n 'render' | 'name'\n> & {\n /**\n * The render function can be a SolidJS element or a function that returns a SolidJS element.\n * If it's a function, it will be called to render the plugin, otherwise it will be rendered directly.\n *\n * Example:\n * ```ts\n * {\n * render: () => <CustomPluginComponent />,\n * }\n * ```\n * or\n * ```ts\n * {\n * render: <CustomPluginComponent />,\n * }\n * ```\n */\n render: SolidPluginRender\n /**\n * Name to be displayed in the devtools UI.\n * If a string, it will be used as the plugin name.\n * If a function, it will be called with the mount element.\n *\n * Example:\n * ```ts\n * {\n * name: \"Your Plugin\",\n * render: () => <CustomPluginComponent />,\n * }\n * ```\n * or\n * ```ts\n * {\n * name: <h1>Your Plugin title</h1>,\n * render: () => <CustomPluginComponent />,\n * }\n * ```\n */\n name: string | SolidPluginRender\n}\ninterface TriggerProps {\n theme: 'light' | 'dark'\n}\nexport interface TanStackDevtoolsInit {\n /**\n * Array of plugins to be used in the devtools.\n * Each plugin should have a `render` function that returns a React element or a function\n *\n * Example:\n * ```jsx\n * <TanStackDevtools\n * plugins={[\n * {\n * id: \"your-plugin-id\",\n * name: \"Your Plugin\",\n * render: <CustomPluginComponent />,\n * }\n * ]}\n * />\n * ```\n */\n plugins?: Array<TanStackDevtoolsSolidPlugin>\n /**\n * Configuration for the devtools shell. These configuration options are used to set the\n * initial state of the devtools when it is started for the first time. Afterwards,\n * the settings are persisted in local storage and changed through the settings panel.\n */\n config?: Omit<Partial<TanStackDevtoolsConfig>, 'customTrigger'> & {\n /**\n * An optional custom function to render the dev tools trigger component.\n */\n customTrigger?:\n | ((el: HTMLElement, props: TriggerProps) => JSX.Element)\n | JSX.Element\n }\n /**\n * Configuration for the TanStack Devtools client event bus.\n */\n eventBusConfig?: ClientEventBusConfig\n}\n\nexport default function SolidDevtoolsCore({\n config,\n plugins,\n eventBusConfig,\n}: TanStackDevtoolsInit) {\n // Convert plugins to the format expected by the core\n const pluginsMap = createMemo<Array<TanStackDevtoolsPlugin> | undefined>(() =>\n plugins?.map((plugin) => ({\n ...plugin,\n name:\n typeof plugin.name === 'string'\n ? plugin.name\n : // The check above confirms that `plugin.name` is of Render type\n (el, theme) =>\n convertRender(el, plugin.name as SolidPluginRender, theme),\n render: (el: HTMLDivElement, theme: 'dark' | 'light') =>\n convertRender(el, plugin.render, theme),\n })),\n )\n\n const convertTrigger = (el: HTMLElement, props: TriggerProps) => {\n const Trigger = config?.customTrigger\n\n return (\n <Portal mount={el}>\n {typeof Trigger === 'function' ? Trigger(el, props) : Trigger}\n </Portal>\n )\n }\n const [devtools] = createSignal(\n new TanStackDevtoolsCore({\n config: {\n ...config,\n customTrigger: config?.customTrigger\n ? (el, props) => convertTrigger(el, props)\n : undefined,\n },\n eventBusConfig,\n plugins: pluginsMap(),\n }),\n )\n let devToolRef: HTMLDivElement | undefined\n\n createEffect(() => {\n devtools().setConfig({\n config: {\n ...config,\n customTrigger: config?.customTrigger\n ? (el, props) => convertTrigger(el, props)\n : undefined,\n },\n })\n })\n\n // Update plugins when they change\n createEffect(() => {\n const currentPlugins = pluginsMap()\n if (currentPlugins) {\n devtools().setConfig({ plugins: currentPlugins })\n }\n })\n\n onMount(() => {\n if (devToolRef) {\n devtools().mount(devToolRef)\n\n onCleanup(() => {\n devtools().unmount()\n })\n }\n })\n return <div style={{ position: 'absolute' }} ref={devToolRef} />\n}\n"],"names":["convertRender","el","Component","theme","_$createComponent","Portal","mount","children","SolidDevtoolsCore","config","plugins","eventBusConfig","pluginsMap","createMemo","map","plugin","name","render","convertTrigger","props","Trigger","customTrigger","devtools","createSignal","TanStackDevtoolsCore","undefined","devToolRef","createEffect","setConfig","currentPlugins","onMount","onCleanup","unmount","_el$","_tmpl$","_ref$","_$use","style","setProperty"],"mappings":";;;;AAsBA,MAAMA,gBAAgBA,CACpBC,IACAC,WACAC,UAAuBC,gBAEtBC,QAAM;AAAA,EAACC,OAAOL;AAAAA,EAAE,IAAAM,WAAA;AAAA,WACd,OAAOL,cAAc,aAAaA,UAAUD,IAAIE,KAAK,IAAID;AAAAA,EAAS;AAAA,CAAA;AAyFvE,SAAwBM,kBAAkB;AAAA,EACxCC;AAAAA,EACAC;AAAAA,EACAC;AACoB,GAAG;AAEvB,QAAMC,aAAaC,WAAsD,MACvEH,SAASI,IAAKC,CAAAA,YAAY;AAAA,IACxB,GAAGA;AAAAA,IACHC,MACE,OAAOD,OAAOC,SAAS,WACnBD,OAAOC;AAAAA;AAAAA,OAEP,CAACf,IAAIE,UACHH,cAAcC,IAAIc,OAAOC,MAA2Bb,KAAK;AAAA;AAAA,IACjEc,QAAQA,CAAChB,IAAoBE,UAC3BH,cAAcC,IAAIc,OAAOE,QAAQd,KAAK;AAAA,EAAA,EACxC,CACJ;AA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MAAAC,YAAA,YAAA,UAAA;AAAA,WAAAL;AAAAA,EAAA,GAAA;AAC9D;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/solid-devtools",
3
- "version": "0.7.12",
3
+ "version": "0.7.13",
4
4
  "description": "TanStack Devtools is a set of tools for building advanced devtools for your Solid application.",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
package/src/core.tsx CHANGED
@@ -148,7 +148,9 @@ export default function SolidDevtoolsCore({
148
148
  new TanStackDevtoolsCore({
149
149
  config: {
150
150
  ...config,
151
- customTrigger: (el, props) => convertTrigger(el, props),
151
+ customTrigger: config?.customTrigger
152
+ ? (el, props) => convertTrigger(el, props)
153
+ : undefined,
152
154
  },
153
155
  eventBusConfig,
154
156
  plugins: pluginsMap(),
@@ -160,7 +162,9 @@ export default function SolidDevtoolsCore({
160
162
  devtools().setConfig({
161
163
  config: {
162
164
  ...config,
163
- customTrigger: (el, props) => convertTrigger(el, props),
165
+ customTrigger: config?.customTrigger
166
+ ? (el, props) => convertTrigger(el, props)
167
+ : undefined,
164
168
  },
165
169
  })
166
170
  })