Skip to content

Commit 442d2ce

Browse files
Feat/improve UI library (#94)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 30751c3 commit 442d2ce

File tree

19 files changed

+1965
-226
lines changed

19 files changed

+1965
-226
lines changed

.changeset/tidy-worlds-drop.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@tanstack/devtools-ui': patch
3+
'@tanstack/devtools': patch
4+
---
5+
6+
improvements for tree view, added icons to devtools-ui, extracted components out of devtools core into ui, panel header

examples/react/basic/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"zod": "^4.0.14"
2121
},
2222
"devDependencies": {
23+
"@tanstack/devtools-ui": "0.3.2",
2324
"@tanstack/devtools-vite": "0.2.10",
2425
"@types/react": "^19.1.2",
2526
"@types/react-dom": "^19.1.2",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export const Button = (props: any) => {
1+
export function Button(props: any) {
22
return <button {...props} />
33
}

examples/react/basic/src/feature.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Button } from './button'
22
import { ButtonWithProps } from './button-with-props-only'
33

4-
export const Feature = () => {
4+
export function Feature() {
55
return (
66
<div>
77
<h2>Feature component</h2>

examples/react/basic/src/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ function App() {
171171
<div>
172172
<Context.Provider value={{ count: state, setCount: setState }}>
173173
<QueryClientProvider client={queryClient}>
174+
<h1>TanStack Devtools React Basic Example</h1>
175+
current count: {state}
176+
<Button onClick={() => setState(state + 1)}>Click me</Button>
177+
<Button onClick={() => setWin(window.open('', '', 'popup'))}>
178+
Click me to open new window
179+
</Button>
180+
{win && createPortal(<Mounted />, win.document.body)}
181+
<Feature />
174182
<p>
175183
As you visit the posts below, you will notice them in a loading
176184
state the first time you load them. However, after you return to
@@ -189,14 +197,6 @@ function App() {
189197
)}
190198
<Devtools />
191199
</QueryClientProvider>
192-
<h1>TanStack Devtools React Basic Example</h1>
193-
current count: {state}
194-
<Button onClick={() => setState(state + 1)}>Click me</Button>
195-
<Button onClick={() => setWin(window.open('', '', 'popup'))}>
196-
Click me to open new window
197-
</Button>
198-
{win && createPortal(<Mounted />, win.document.body)}
199-
<Feature />
200200
</Context.Provider>
201201
</div>
202202
)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"size-limit": [
4949
{
5050
"path": "packages/devtools/dist/esm/index.js",
51-
"limit": "30 KB"
51+
"limit": "40 KB"
5252
},
5353
{
5454
"path": "packages/event-bus-client/dist/esm/plugin.js",

packages/devtools-ui/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@
1919
],
2020
"type": "module",
2121
"types": "dist/esm/index.d.ts",
22-
"main": "dist/cjs/index.cjs",
2322
"module": "dist/esm/index.js",
2423
"exports": {
2524
".": {
2625
"import": {
2726
"types": "./dist/esm/index.d.ts",
2827
"default": "./dist/esm/index.js"
29-
},
30-
"require": {
31-
"types": "./dist/cjs/index.d.cts",
32-
"default": "./dist/cjs/index.cjs"
28+
}
29+
},
30+
"./icons": {
31+
"import": {
32+
"types": "./dist/esm/icons.d.ts",
33+
"default": "./dist/esm/icons.js"
3334
}
3435
},
3536
"./package.json": "./package.json"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import clsx from 'clsx'
2+
import { useStyles } from '../styles/use-styles'
3+
import type { JSX } from 'solid-js/jsx-runtime'
4+
5+
export function Header({
6+
children,
7+
class: className,
8+
...rest
9+
}: JSX.IntrinsicElements['header']) {
10+
const styles = useStyles()
11+
return (
12+
<header
13+
class={clsx(styles().header.row, 'tsqd-header', className)}
14+
{...rest}
15+
>
16+
{children}
17+
</header>
18+
)
19+
}
20+
21+
export function HeaderLogo({
22+
children,
23+
flavor,
24+
}: {
25+
children: JSX.Element
26+
flavor: {
27+
light: string
28+
dark: string
29+
}
30+
}) {
31+
const styles = useStyles()
32+
return (
33+
<div class={styles().header.logoAndToggleContainer}>
34+
<button class={clsx(styles().header.logo)}>
35+
<span class={clsx(styles().header.tanstackLogo)}>TANSTACK</span>
36+
<span
37+
class={clsx(styles().header.flavorLogo(flavor.light, flavor.dark))}
38+
>
39+
{children}
40+
</span>
41+
</button>
42+
</div>
43+
)
44+
}

0 commit comments

Comments
 (0)