@tanstack/devtools-ui 0.5.3 → 0.6.0
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/components/button.js +2 -2
- package/dist/esm/components/button.js.map +1 -1
- package/dist/esm/components/checkbox.js +3 -3
- package/dist/esm/components/checkbox.js.map +1 -1
- package/dist/esm/components/header.js +3 -3
- package/dist/esm/components/header.js.map +1 -1
- package/dist/esm/components/input.js +2 -2
- package/dist/esm/components/input.js.map +1 -1
- package/dist/esm/components/logo.js +2 -2
- package/dist/esm/components/logo.js.map +1 -1
- package/dist/esm/components/main-panel.js +2 -2
- package/dist/esm/components/main-panel.js.map +1 -1
- package/dist/esm/components/section.js +5 -5
- package/dist/esm/components/section.js.map +1 -1
- package/dist/esm/components/select.js +2 -2
- package/dist/esm/components/select.js.map +1 -1
- package/dist/esm/components/tag.js +2 -2
- package/dist/esm/components/tag.js.map +1 -1
- package/dist/esm/components/theme.d.ts +1 -1
- package/dist/esm/components/theme.js +3 -3
- package/dist/esm/components/theme.js.map +1 -1
- package/dist/esm/components/tree.js +6 -6
- package/dist/esm/components/tree.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/styles/use-styles.d.ts +1 -1
- package/dist/esm/styles/use-styles.js +4 -4
- package/dist/esm/styles/use-styles.js.map +1 -1
- package/package.json +4 -1
- package/src/components/button.tsx +2 -2
- package/src/components/checkbox.tsx +3 -3
- package/src/components/header.tsx +3 -3
- package/src/components/input.tsx +2 -2
- package/src/components/logo.tsx +2 -2
- package/src/components/main-panel.tsx +2 -2
- package/src/components/section.tsx +5 -5
- package/src/components/select.tsx +2 -2
- package/src/components/tag.tsx +2 -2
- package/src/components/theme.tsx +9 -4
- package/src/components/tree.tsx +6 -6
- package/src/index.ts +1 -1
- package/src/styles/use-styles.ts +3 -3
package/src/components/theme.tsx
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
createEffect,
|
|
4
|
+
createSignal,
|
|
5
|
+
useContext as getContext,
|
|
6
|
+
} from 'solid-js'
|
|
2
7
|
import type { Accessor, JSX } from 'solid-js'
|
|
3
8
|
|
|
4
9
|
export type TanStackDevtoolsTheme = 'light' | 'dark'
|
|
@@ -24,10 +29,10 @@ export const ThemeContextProvider = (props: {
|
|
|
24
29
|
)
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
export function
|
|
28
|
-
const context =
|
|
32
|
+
export function createTheme() {
|
|
33
|
+
const context = getContext(ThemeContext)
|
|
29
34
|
if (!context) {
|
|
30
|
-
throw new Error('
|
|
35
|
+
throw new Error('createTheme must be used within a ThemeContextProvider')
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
return context
|
package/src/components/tree.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import clsx from 'clsx'
|
|
|
3
3
|
import dayjs from 'dayjs'
|
|
4
4
|
|
|
5
5
|
// css
|
|
6
|
-
import {
|
|
6
|
+
import { createStyles, css } from '../styles/use-styles'
|
|
7
7
|
|
|
8
8
|
// icons
|
|
9
9
|
import { CopiedCopier, Copier, ErrorCopier } from './icons'
|
|
@@ -49,7 +49,7 @@ function JsonValue(props: {
|
|
|
49
49
|
|
|
50
50
|
config?: { dateFormat?: string }
|
|
51
51
|
}) {
|
|
52
|
-
const styles =
|
|
52
|
+
const styles = createStyles()
|
|
53
53
|
|
|
54
54
|
return (
|
|
55
55
|
<span class={styles().tree.valueContainer(props.isRoot ?? false)}>
|
|
@@ -152,7 +152,7 @@ const ArrayValue = (props: {
|
|
|
152
152
|
path: string
|
|
153
153
|
config?: { dateFormat?: string }
|
|
154
154
|
}) => {
|
|
155
|
-
const styles =
|
|
155
|
+
const styles = createStyles()
|
|
156
156
|
|
|
157
157
|
const [expanded, setExpanded] = createSignal(
|
|
158
158
|
props.depth <= props.defaultExpansionDepth &&
|
|
@@ -244,7 +244,7 @@ const ObjectValue = (props: {
|
|
|
244
244
|
path: string
|
|
245
245
|
config?: { dateFormat?: string }
|
|
246
246
|
}) => {
|
|
247
|
-
const styles =
|
|
247
|
+
const styles = createStyles()
|
|
248
248
|
|
|
249
249
|
const [expanded, setExpanded] = createSignal(
|
|
250
250
|
props.depth <= props.defaultExpansionDepth &&
|
|
@@ -354,7 +354,7 @@ const ObjectValue = (props: {
|
|
|
354
354
|
type CopyState = 'NoCopy' | 'SuccessCopy' | 'ErrorCopy'
|
|
355
355
|
|
|
356
356
|
const CopyButton = (props: { value: unknown }) => {
|
|
357
|
-
const styles =
|
|
357
|
+
const styles = createStyles()
|
|
358
358
|
const [copyState, setCopyState] = createSignal<CopyState>('NoCopy')
|
|
359
359
|
|
|
360
360
|
return (
|
|
@@ -408,7 +408,7 @@ const CopyButton = (props: { value: unknown }) => {
|
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
const Expander = (props: { expanded: boolean; onClick: () => void }) => {
|
|
411
|
-
const styles =
|
|
411
|
+
const styles = createStyles()
|
|
412
412
|
return (
|
|
413
413
|
<span
|
|
414
414
|
onClick={props.onClick}
|
package/src/index.ts
CHANGED
|
@@ -13,7 +13,7 @@ export {
|
|
|
13
13
|
SectionIcon,
|
|
14
14
|
} from './components/section'
|
|
15
15
|
export { Header, HeaderLogo } from './components/header'
|
|
16
|
-
export {
|
|
16
|
+
export { createTheme, ThemeContextProvider } from './components/theme'
|
|
17
17
|
export type { TanStackDevtoolsTheme } from './components/theme'
|
|
18
18
|
export {
|
|
19
19
|
CheckCircleIcon,
|
package/src/styles/use-styles.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as goober from 'goober'
|
|
2
2
|
import { createEffect, createSignal } from 'solid-js'
|
|
3
|
-
import {
|
|
3
|
+
import { createTheme } from '../components/theme'
|
|
4
4
|
import { tokens } from './tokens'
|
|
5
5
|
|
|
6
6
|
import type { TanStackDevtoolsTheme } from '../components/theme'
|
|
@@ -686,8 +686,8 @@ const stylesFactory = (theme: TanStackDevtoolsTheme) => {
|
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
|
|
689
|
-
export function
|
|
690
|
-
const { theme } =
|
|
689
|
+
export function createStyles() {
|
|
690
|
+
const { theme } = createTheme()
|
|
691
691
|
const [styles, setStyles] = createSignal(stylesFactory(theme()))
|
|
692
692
|
createEffect(() => {
|
|
693
693
|
setStyles(stylesFactory(theme()))
|