Skip to content

Commit 67ed337

Browse files
authored
Merge branch 'main' into feat/event-client-production-stripping
2 parents b37aeb7 + ea3c674 commit 67ed337

243 files changed

Lines changed: 7091 additions & 335 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/devtools-ui': patch
3+
---
4+
5+
Fix `Checkbox` ignoring controlled `checked` prop updates. It previously read `checked` into internal state only once at mount, so it never reflected later prop changes when used as a controlled input (e.g. the devtools settings panel). It now reflects the `checked` prop whenever it is provided and falls back to internal state only when uncontrolled.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@tanstack/devtools-ui': minor
3+
'@tanstack/devtools': patch
4+
'@tanstack/devtools-a11y': patch
5+
---
6+
7+
fix: rename Solid `use*` primitives to `create*` so React Compiler doesn't transform them
8+
9+
The devtools packages are written in Solid but used React-style naming (`useStyles`, `useTheme`, `useDevtoolsState`, …) for their custom primitives. When an app enables React Compiler, the compiler matches the `use*` naming convention and transforms/optimizes this Solid code as if it were React, breaking the panel (it is Solid JSX, not React).
10+
11+
All custom Solid primitives in `@tanstack/devtools`, `@tanstack/devtools-ui`, and `@tanstack/devtools-a11y` are renamed from `use*` to `create*`, and Solid's own `useContext` / `@solid-primitives` `useKeyDownList` are imported under non-`use` aliases (`getContext`, `getKeyDownList`).
12+
13+
Breaking for `@tanstack/devtools-ui`: the exported `useTheme` is renamed to `createTheme`.

.github/workflows/autofix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
with:
2323
persist-credentials: false
2424
- name: Setup Tools
25-
uses: TanStack/config/.github/setup@99d23c6212f36eff17d30a21e58da77f55a4cfe9 # main
25+
uses: TanStack/config/.github/setup@190f659075ff0845850e330883eb26d7ffd0671f # main
2626
- name: Fix formatting
2727
run: pnpm format
2828
# - name: Regenerate docs

.github/workflows/pr.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,32 @@ jobs:
2727
fetch-depth: 0
2828
persist-credentials: false
2929
- name: Setup Tools
30-
uses: TanStack/config/.github/setup@99d23c6212f36eff17d30a21e58da77f55a4cfe9 # main
30+
uses: TanStack/config/.github/setup@190f659075ff0845850e330883eb26d7ffd0671f # main
3131
- name: Get base and head commits for `nx affected`
3232
uses: nrwl/nx-set-shas@3e9ad7370203c1e93d109be57f3b72eb0eb511b1 # v4.4.0
3333
with:
3434
main-branch-name: main
3535
- name: Run Checks
3636
run: pnpm run test:pr
37+
e2e:
38+
name: E2e
39+
runs-on: ubuntu-latest
40+
permissions:
41+
contents: read
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
45+
with:
46+
fetch-depth: 0
47+
persist-credentials: false
48+
- name: Setup Tools
49+
uses: TanStack/config/.github/setup@190f659075ff0845850e330883eb26d7ffd0671f # main
50+
- name: Build packages
51+
run: pnpm run build:all
52+
- name: Install Playwright Chromium
53+
run: pnpm --filter @tanstack/devtools-e2e-react-vite exec playwright install --with-deps chromium
54+
- name: Run e2e
55+
run: pnpm run test:e2e
3756
preview:
3857
name: Preview
3958
runs-on: ubuntu-latest
@@ -43,7 +62,7 @@ jobs:
4362
with:
4463
persist-credentials: false
4564
- name: Setup Tools
46-
uses: TanStack/config/.github/setup@99d23c6212f36eff17d30a21e58da77f55a4cfe9 # main
65+
uses: TanStack/config/.github/setup@190f659075ff0845850e330883eb26d7ffd0671f # main
4766
- name: Build Packages
4867
run: pnpm run build:all
4968
- name: Publish Previews
@@ -57,6 +76,6 @@ jobs:
5776
with:
5877
persist-credentials: false
5978
- name: Setup Tools
60-
uses: TanStack/config/.github/setup@99d23c6212f36eff17d30a21e58da77f55a4cfe9 # main
79+
uses: TanStack/config/.github/setup@190f659075ff0845850e330883eb26d7ffd0671f # main
6180
- name: Changeset Preview
62-
uses: TanStack/config/.github/changeset-preview@99d23c6212f36eff17d30a21e58da77f55a4cfe9 # main
81+
uses: TanStack/config/.github/changeset-preview@190f659075ff0845850e330883eb26d7ffd0671f # main

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
fetch-depth: 0
3737
persist-credentials: false
3838
- name: Setup Tools
39-
uses: TanStack/config/.github/setup@99d23c6212f36eff17d30a21e58da77f55a4cfe9 # main
39+
uses: TanStack/config/.github/setup@190f659075ff0845850e330883eb26d7ffd0671f # main
4040
- name: Run Tests
4141
run: pnpm run test:ci
4242
- name: Run Changesets (version or publish)
@@ -49,6 +49,6 @@ jobs:
4949
title: 'ci: Version Packages'
5050
- name: Comment on PRs about release
5151
if: steps.changesets.outputs.published == 'true'
52-
uses: TanStack/config/.github/comment-on-release@99d23c6212f36eff17d30a21e58da77f55a4cfe9 # main
52+
uses: TanStack/config/.github/comment-on-release@190f659075ff0845850e330883eb26d7ffd0671f # main
5353
with:
5454
published-packages: ${{ steps.changesets.outputs.publishedPackages }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ yarn.lock
5454
.nx/workspace-data
5555
vite.config.js.timestamp-*
5656
vite.config.ts.timestamp-*
57-
57+
.claude/worktrees
5858
.angular
5959
.nitro
6060
.sonda

docs/config.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@
4646
{ "label": "Vue Adapter", "to": "framework/vue/adapter" }
4747
]
4848
},
49+
{
50+
"label": "svelte",
51+
"children": [
52+
{ "label": "Basic Setup", "to": "framework/svelte/basic-setup" },
53+
{ "label": "Svelte Adapter", "to": "framework/svelte/adapter" }
54+
]
55+
},
4956
{
5057
"label": "angular",
5158
"children": [
@@ -97,6 +104,12 @@
97104
{ "label": "Custom Plugins", "to": "framework/vue/guides/custom-plugins" }
98105
]
99106
},
107+
{
108+
"label": "svelte",
109+
"children": [
110+
{ "label": "Custom Plugins", "to": "framework/svelte/guides/custom-plugins" }
111+
]
112+
},
100113
{
101114
"label": "angular",
102115
"children": [
@@ -135,6 +148,12 @@
135148
{ "label": "Vue Reference", "to": "framework/vue/reference/index" }
136149
]
137150
},
151+
{
152+
"label": "svelte",
153+
"children": [
154+
{ "label": "Svelte Reference", "to": "framework/svelte/reference/index" }
155+
]
156+
},
138157
{
139158
"label": "angular",
140159
"children": [

docs/devtools-utils.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface DevtoolsPanelProps {
2121
}
2222
```
2323

24-
> The Vue variant additionally accepts `'system'` as a theme value.
24+
> The Vue and Svelte variants additionally accept `'system'` as a theme value.
2525
2626
Import it from the framework-specific subpath:
2727

@@ -38,6 +38,9 @@ import type { DevtoolsPanelProps } from '@tanstack/devtools-utils/preact'
3838
// Vue
3939
import type { DevtoolsPanelProps } from '@tanstack/devtools-utils/vue'
4040

41+
// Svelte
42+
import type { DevtoolsPanelProps } from '@tanstack/devtools-utils/svelte'
43+
4144
// Angular
4245
import type { DevtoolsPanelProps } from '@tanstack/devtools-utils/angular'
4346
```
@@ -255,6 +258,49 @@ const [MyPanel, NoOpPanel] = createVuePanel(MyDevtoolsCore)
255258

256259
The panel component accepts `theme` and `devtoolsProps` as props. It mounts the core instance into a `div` element on `onMounted` and calls `unmount()` on `onUnmounted`.
257260

261+
## Svelte
262+
263+
### createSveltePlugin
264+
265+
The Svelte factory takes a `name` string and a Svelte component as separate arguments, similar to the Vue API.
266+
267+
**Signature:**
268+
269+
```ts
270+
function createSveltePlugin<TComponentProps extends Record<string, any>>(
271+
name: string,
272+
component: Component<TComponentProps>,
273+
): readonly [Plugin, NoOpPlugin]
274+
```
275+
276+
**Usage:**
277+
278+
```ts
279+
import { createSveltePlugin } from '@tanstack/devtools-utils/svelte'
280+
import MyStorePanel from './MyStorePanel.svelte'
281+
282+
const [MyPlugin, NoOpPlugin] = createSveltePlugin('My Store', MyStorePanel)
283+
```
284+
285+
The returned functions:
286+
287+
- **`Plugin(props?)`** -- returns `{ name, component, props }` where `component` is your Svelte component.
288+
- **`NoOpPlugin(props?)`** -- returns `{ name, component: NoOpComponent, props }` where the component renders nothing visible.
289+
290+
Both accept an optional `props` object that gets forwarded to the component on mount.
291+
292+
### createSveltePanel
293+
294+
For class-based devtools cores, Svelte provides `createSveltePanel`. It creates a wrapper that handles mounting and unmounting the core class:
295+
296+
```ts
297+
import { createSveltePanel } from '@tanstack/devtools-utils/svelte'
298+
299+
const [MyPanel, NoOpPanel] = createSveltePanel(MyDevtoolsCore)
300+
```
301+
302+
The panel accepts `theme` and `devtoolsProps` props. It creates a `div` element, mounts the core instance into it, and calls `unmount()` on cleanup.
303+
258304
## Angular
259305

260306
### createAngularPlugin

docs/framework/svelte/adapter.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: TanStack Devtools Svelte Adapter
3+
id: adapter
4+
---
5+
6+
The Svelte adapter wraps `TanStackDevtoolsCore` in a Svelte 5 component, using Svelte's `mount()` and `unmount()` APIs to dynamically render plugins into the correct DOM containers managed by the devtools shell.
7+
8+
## Installation
9+
10+
```sh
11+
npm install @tanstack/svelte-devtools
12+
```
13+
14+
## Component Props
15+
16+
The `TanStackDevtools` component accepts the following props, defined by the `TanStackDevtoolsSvelteInit` interface:
17+
18+
| Prop | Type | Description |
19+
| --- | --- | --- |
20+
| `plugins` | `TanStackDevtoolsSveltePlugin[]` | Array of plugins to render inside the devtools panel. |
21+
| `config` | `Partial<TanStackDevtoolsConfig>` | Configuration for the devtools shell. Sets the initial state on first load; afterwards settings are persisted in local storage. |
22+
| `eventBusConfig` | `ClientEventBusConfig` | Configuration for the TanStack Devtools client event bus. |
23+
24+
## Plugin Type
25+
26+
Each plugin in the `plugins` array must conform to the `TanStackDevtoolsSveltePlugin` type:
27+
28+
```ts
29+
type TanStackDevtoolsSveltePlugin = {
30+
id?: string
31+
component: Component<any>
32+
name: string | Component<any>
33+
props?: Record<string, any>
34+
defaultOpen?: boolean
35+
}
36+
```
37+
38+
| Field | Type | Description |
39+
| --- | --- | --- |
40+
| `id` | `string` (optional) | Unique identifier for the plugin. |
41+
| `component` | `Component<any>` | The Svelte component to render as the plugin panel content. |
42+
| `name` | `string \| Component<any>` | Display name for the tab title. Can be a plain string or a Svelte component for custom rendering. |
43+
| `props` | `Record<string, any>` (optional) | Additional props passed to the plugin component on mount. |
44+
| `defaultOpen` | `boolean` (optional) | Whether this plugin tab should be open by default. |
45+
46+
## Key Difference from Other Frameworks
47+
48+
The Svelte adapter uses `component` (a Svelte component reference) instead of `render` (a JSX element) in plugin definitions. Props are provided through the `props` field and passed to the component via Svelte's `mount()` API, rather than being embedded directly in a JSX expression.
49+
50+
```svelte
51+
<!-- Svelte: pass component reference + props -->
52+
<script lang="ts">
53+
import { TanStackDevtools } from '@tanstack/svelte-devtools'
54+
import { SvelteQueryDevtoolsPanel } from '@tanstack/svelte-query-devtools'
55+
56+
const plugins = [
57+
{
58+
name: 'Svelte Query',
59+
component: SvelteQueryDevtoolsPanel,
60+
props: { style: 'height: 100%' },
61+
},
62+
]
63+
</script>
64+
65+
<TanStackDevtools {plugins} />
66+
```
67+
68+
## Exports
69+
70+
The `@tanstack/svelte-devtools` package exports:
71+
72+
- **`TanStackDevtools`** -- The main Svelte component that renders the devtools panel.
73+
- **`TanStackDevtoolsSveltePlugin`** (type) -- The type for plugin definitions.
74+
- **`TanStackDevtoolsSvelteInit`** (type) -- The props interface for the `TanStackDevtools` component.
75+
76+
The package depends on `@tanstack/devtools` (the core package), which provides `TanStackDevtoolsCore`, `TanStackDevtoolsConfig`, `ClientEventBusConfig`, and other core utilities.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: Basic setup
3+
id: basic-setup
4+
---
5+
6+
TanStack Devtools provides you with an easy-to-use and modular client that allows you to compose multiple devtools into one easy-to-use panel.
7+
8+
## Setup
9+
10+
Install the [TanStack Devtools](https://www.npmjs.com/package/@tanstack/svelte-devtools) library. This will install the devtools core as well as provide you with the Svelte-specific adapter.
11+
12+
```bash
13+
npm i @tanstack/svelte-devtools
14+
```
15+
16+
Next, in the root of your application, import the `TanStackDevtools` component from `@tanstack/svelte-devtools` and add it to your template.
17+
18+
```svelte
19+
<script lang="ts">
20+
import { TanStackDevtools } from '@tanstack/svelte-devtools'
21+
</script>
22+
23+
<main>
24+
<!-- Your app content -->
25+
</main>
26+
<TanStackDevtools />
27+
```
28+
29+
Import the desired devtools and provide them to the `TanStackDevtools` component via the `plugins` prop along with a label for the menu.
30+
31+
```svelte
32+
<script lang="ts">
33+
import { TanStackDevtools } from '@tanstack/svelte-devtools'
34+
import type { TanStackDevtoolsSveltePlugin } from '@tanstack/svelte-devtools'
35+
import { SvelteQueryDevtoolsPanel } from '@tanstack/svelte-query-devtools'
36+
37+
const plugins: TanStackDevtoolsSveltePlugin[] = [
38+
{
39+
name: 'Svelte Query',
40+
component: SvelteQueryDevtoolsPanel,
41+
},
42+
]
43+
</script>
44+
45+
<main>
46+
<!-- Your app content -->
47+
</main>
48+
<TanStackDevtools {plugins} />
49+
```
50+
51+
> Note: The Svelte adapter uses `component` (a Svelte component reference) instead of `render` (a JSX element) in plugin definitions. Additional props can be provided via the `props` field and are passed to the component on mount.
52+
53+
Finally, add any additional configuration you desire to the `TanStackDevtools` component. More information can be found under the [TanStack Devtools Configuration](../../configuration) section.

0 commit comments

Comments
 (0)