@tanstack/devtools-ui 0.3.1 → 0.3.3
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/header.d.ts +9 -0
- package/dist/esm/components/header.js +50 -0
- package/dist/esm/components/header.js.map +1 -0
- package/dist/esm/components/icons.d.ts +15 -0
- package/dist/esm/components/icons.js +61 -0
- package/dist/esm/components/icons.js.map +1 -0
- package/dist/esm/components/logo.js +73 -73
- package/dist/esm/components/logo.js.map +1 -1
- package/dist/esm/components/main-panel.d.ts +8 -0
- package/dist/esm/components/main-panel.js +24 -0
- package/dist/esm/components/main-panel.js.map +1 -0
- package/dist/esm/components/section.d.ts +5 -0
- package/dist/esm/components/section.js +75 -0
- package/dist/esm/components/section.js.map +1 -0
- package/dist/esm/components/tree.d.ts +1 -0
- package/dist/esm/components/tree.js +206 -80
- package/dist/esm/components/tree.js.map +1 -1
- package/dist/esm/icons.d.ts +1 -0
- package/dist/esm/icons.js +17 -0
- package/dist/esm/icons.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/styles/tokens.js +13 -2
- package/dist/esm/styles/tokens.js.map +1 -1
- package/dist/esm/styles/use-styles.d.ts +25 -0
- package/dist/esm/styles/use-styles.js +184 -2
- package/dist/esm/styles/use-styles.js.map +1 -1
- package/package.json +7 -6
- package/src/components/header.tsx +44 -0
- package/src/components/icons.tsx +1586 -0
- package/src/components/main-panel.tsx +27 -0
- package/src/components/section.tsx +51 -0
- package/src/components/tree.tsx +148 -32
- package/src/icons.ts +1 -0
- package/src/index.ts +8 -0
- package/src/styles/use-styles.ts +184 -2
- package/dist/cjs/components/button.cjs +0 -23
- package/dist/cjs/components/button.cjs.map +0 -1
- package/dist/cjs/components/button.d.cts +0 -11
- package/dist/cjs/components/checkbox.cjs +0 -55
- package/dist/cjs/components/checkbox.cjs.map +0 -1
- package/dist/cjs/components/checkbox.d.cts +0 -8
- package/dist/cjs/components/input.cjs +0 -57
- package/dist/cjs/components/input.cjs.map +0 -1
- package/dist/cjs/components/input.d.cts +0 -10
- package/dist/cjs/components/logo.cjs +0 -95
- package/dist/cjs/components/logo.cjs.map +0 -1
- package/dist/cjs/components/logo.d.cts +0 -1
- package/dist/cjs/components/select.cjs +0 -59
- package/dist/cjs/components/select.cjs.map +0 -1
- package/dist/cjs/components/select.d.cts +0 -13
- package/dist/cjs/components/tag.cjs +0 -40
- package/dist/cjs/components/tag.cjs.map +0 -1
- package/dist/cjs/components/tag.d.cts +0 -7
- package/dist/cjs/components/tree.cjs +0 -237
- package/dist/cjs/components/tree.cjs.map +0 -1
- package/dist/cjs/components/tree.d.cts +0 -3
- package/dist/cjs/index.cjs +0 -17
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/index.d.cts +0 -7
- package/dist/cjs/styles/tokens.cjs +0 -183
- package/dist/cjs/styles/tokens.cjs.map +0 -1
- package/dist/cjs/styles/tokens.d.cts +0 -298
- package/dist/cjs/styles/use-styles.cjs +0 -412
- package/dist/cjs/styles/use-styles.cjs.map +0 -1
- package/dist/cjs/styles/use-styles.d.cts +0 -43
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import clsx from 'clsx'
|
|
2
|
+
import { useStyles } from '../styles/use-styles'
|
|
3
|
+
import type { JSX } from 'solid-js/jsx-runtime'
|
|
4
|
+
|
|
5
|
+
type PanelProps = JSX.IntrinsicElements['div'] & {
|
|
6
|
+
children?: any
|
|
7
|
+
className?: string
|
|
8
|
+
withPadding?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const MainPanel = ({
|
|
12
|
+
className,
|
|
13
|
+
children,
|
|
14
|
+
class: classStyles,
|
|
15
|
+
withPadding,
|
|
16
|
+
}: PanelProps) => {
|
|
17
|
+
const styles = useStyles()
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
class={clsx(styles().mainPanel.panel, className, classStyles, {
|
|
21
|
+
[styles().mainPanel.withPadding]: withPadding,
|
|
22
|
+
})}
|
|
23
|
+
>
|
|
24
|
+
{children}
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import clsx from 'clsx'
|
|
2
|
+
import { useStyles } from '../styles/use-styles'
|
|
3
|
+
import type { JSX } from 'solid-js/jsx-runtime'
|
|
4
|
+
|
|
5
|
+
export const Section = ({
|
|
6
|
+
children,
|
|
7
|
+
...rest
|
|
8
|
+
}: JSX.IntrinsicElements['section']) => {
|
|
9
|
+
const styles = useStyles()
|
|
10
|
+
return (
|
|
11
|
+
<section class={clsx(styles().section.main, rest.class)} {...rest}>
|
|
12
|
+
{children}
|
|
13
|
+
</section>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const SectionTitle = ({
|
|
18
|
+
children,
|
|
19
|
+
...rest
|
|
20
|
+
}: JSX.IntrinsicElements['h3']) => {
|
|
21
|
+
const styles = useStyles()
|
|
22
|
+
return (
|
|
23
|
+
<h3 class={clsx(styles().section.title, rest.class)} {...rest}>
|
|
24
|
+
{children}
|
|
25
|
+
</h3>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const SectionDescription = ({
|
|
30
|
+
children,
|
|
31
|
+
...rest
|
|
32
|
+
}: JSX.IntrinsicElements['p']) => {
|
|
33
|
+
const styles = useStyles()
|
|
34
|
+
return (
|
|
35
|
+
<p class={clsx(styles().section.description, rest.class)} {...rest}>
|
|
36
|
+
{children}
|
|
37
|
+
</p>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const SectionIcon = ({
|
|
42
|
+
children,
|
|
43
|
+
...rest
|
|
44
|
+
}: JSX.IntrinsicElements['span']) => {
|
|
45
|
+
const styles = useStyles()
|
|
46
|
+
return (
|
|
47
|
+
<span class={clsx(styles().section.icon, rest.class)} {...rest}>
|
|
48
|
+
{children}
|
|
49
|
+
</span>
|
|
50
|
+
)
|
|
51
|
+
}
|
package/src/components/tree.tsx
CHANGED
|
@@ -1,9 +1,100 @@
|
|
|
1
|
-
import { For, Show, createSignal } from 'solid-js'
|
|
1
|
+
import { For, Match, Show, Switch, createSignal } from 'solid-js'
|
|
2
2
|
import clsx from 'clsx'
|
|
3
|
-
import { useStyles } from '../styles/use-styles'
|
|
3
|
+
import { css, useStyles } from '../styles/use-styles'
|
|
4
|
+
import { CopiedCopier, Copier, ErrorCopier } from './icons'
|
|
4
5
|
|
|
5
|
-
export function JsonTree(props: { value: any }) {
|
|
6
|
-
return <JsonValue isRoot value={props.value} />
|
|
6
|
+
export function JsonTree(props: { value: any; copyable?: boolean }) {
|
|
7
|
+
return <JsonValue isRoot value={props.value} copyable={props.copyable} />
|
|
8
|
+
}
|
|
9
|
+
type CopyState = 'NoCopy' | 'SuccessCopy' | 'ErrorCopy'
|
|
10
|
+
|
|
11
|
+
const CopyButton = (props: { value: unknown }) => {
|
|
12
|
+
const styles = useStyles()
|
|
13
|
+
const [copyState, setCopyState] = createSignal<CopyState>('NoCopy')
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<button
|
|
17
|
+
class={styles().tree.actionButton}
|
|
18
|
+
title="Copy object to clipboard"
|
|
19
|
+
aria-label={`${
|
|
20
|
+
copyState() === 'NoCopy'
|
|
21
|
+
? 'Copy object to clipboard'
|
|
22
|
+
: copyState() === 'SuccessCopy'
|
|
23
|
+
? 'Object copied to clipboard'
|
|
24
|
+
: 'Error copying object to clipboard'
|
|
25
|
+
}`}
|
|
26
|
+
onClick={
|
|
27
|
+
copyState() === 'NoCopy'
|
|
28
|
+
? () => {
|
|
29
|
+
navigator.clipboard
|
|
30
|
+
.writeText(JSON.stringify(props.value, null, 2))
|
|
31
|
+
.then(
|
|
32
|
+
() => {
|
|
33
|
+
setCopyState('SuccessCopy')
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
setCopyState('NoCopy')
|
|
36
|
+
}, 1500)
|
|
37
|
+
},
|
|
38
|
+
(err) => {
|
|
39
|
+
console.error('Failed to copy: ', err)
|
|
40
|
+
setCopyState('ErrorCopy')
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
setCopyState('NoCopy')
|
|
43
|
+
}, 1500)
|
|
44
|
+
},
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
: undefined
|
|
48
|
+
}
|
|
49
|
+
>
|
|
50
|
+
<Switch>
|
|
51
|
+
<Match when={copyState() === 'NoCopy'}>
|
|
52
|
+
<Copier />
|
|
53
|
+
</Match>
|
|
54
|
+
<Match when={copyState() === 'SuccessCopy'}>
|
|
55
|
+
<CopiedCopier theme={'dark'} />
|
|
56
|
+
</Match>
|
|
57
|
+
<Match when={copyState() === 'ErrorCopy'}>
|
|
58
|
+
<ErrorCopier />
|
|
59
|
+
</Match>
|
|
60
|
+
</Switch>
|
|
61
|
+
</button>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const Expander = (props: { expanded: boolean }) => {
|
|
66
|
+
const styles = useStyles()
|
|
67
|
+
return (
|
|
68
|
+
<span
|
|
69
|
+
class={clsx(
|
|
70
|
+
styles().tree.expander,
|
|
71
|
+
css`
|
|
72
|
+
transform: rotate(${props.expanded ? 90 : 0}deg);
|
|
73
|
+
`,
|
|
74
|
+
props.expanded &&
|
|
75
|
+
css`
|
|
76
|
+
& svg {
|
|
77
|
+
top: -1px;
|
|
78
|
+
}
|
|
79
|
+
`,
|
|
80
|
+
)}
|
|
81
|
+
>
|
|
82
|
+
<svg
|
|
83
|
+
width="16"
|
|
84
|
+
height="16"
|
|
85
|
+
viewBox="0 0 16 16"
|
|
86
|
+
fill="none"
|
|
87
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
88
|
+
>
|
|
89
|
+
<path
|
|
90
|
+
d="M6 12L10 8L6 4"
|
|
91
|
+
stroke-width="2"
|
|
92
|
+
stroke-linecap="round"
|
|
93
|
+
stroke-linejoin="round"
|
|
94
|
+
/>
|
|
95
|
+
</svg>
|
|
96
|
+
</span>
|
|
97
|
+
)
|
|
7
98
|
}
|
|
8
99
|
|
|
9
100
|
function JsonValue(props: {
|
|
@@ -11,8 +102,9 @@ function JsonValue(props: {
|
|
|
11
102
|
keyName?: string
|
|
12
103
|
isRoot?: boolean
|
|
13
104
|
isLastKey?: boolean
|
|
105
|
+
copyable?: boolean
|
|
14
106
|
}) {
|
|
15
|
-
const { value, keyName, isRoot = false, isLastKey } = props
|
|
107
|
+
const { value, keyName, isRoot = false, isLastKey, copyable } = props
|
|
16
108
|
const styles = useStyles()
|
|
17
109
|
|
|
18
110
|
return (
|
|
@@ -44,13 +136,22 @@ function JsonValue(props: {
|
|
|
44
136
|
)
|
|
45
137
|
}
|
|
46
138
|
if (Array.isArray(value)) {
|
|
47
|
-
return
|
|
139
|
+
return (
|
|
140
|
+
<ArrayValue copyable={copyable} keyName={keyName} value={value} />
|
|
141
|
+
)
|
|
48
142
|
}
|
|
49
143
|
if (typeof value === 'object') {
|
|
50
|
-
return
|
|
144
|
+
return (
|
|
145
|
+
<ObjectValue copyable={copyable} keyName={keyName} value={value} />
|
|
146
|
+
)
|
|
51
147
|
}
|
|
52
148
|
return <span />
|
|
53
149
|
})()}
|
|
150
|
+
{copyable && (
|
|
151
|
+
<div class={clsx(styles().tree.actions, 'actions')}>
|
|
152
|
+
<CopyButton value={value} />
|
|
153
|
+
</div>
|
|
154
|
+
)}
|
|
54
155
|
{isLastKey || isRoot ? '' : <span>,</span>}
|
|
55
156
|
</span>
|
|
56
157
|
)
|
|
@@ -59,14 +160,17 @@ function JsonValue(props: {
|
|
|
59
160
|
const ArrayValue = ({
|
|
60
161
|
value,
|
|
61
162
|
keyName,
|
|
163
|
+
copyable,
|
|
62
164
|
}: {
|
|
63
165
|
value: Array<any>
|
|
166
|
+
copyable?: boolean
|
|
64
167
|
keyName?: string
|
|
65
168
|
}) => {
|
|
66
169
|
const styles = useStyles()
|
|
67
170
|
const [expanded, setExpanded] = createSignal(true)
|
|
68
171
|
return (
|
|
69
|
-
<span>
|
|
172
|
+
<span class={styles().tree.expanderContainer}>
|
|
173
|
+
<Expander expanded={expanded()} />
|
|
70
174
|
{keyName && (
|
|
71
175
|
<span
|
|
72
176
|
onclick={(e) => {
|
|
@@ -77,20 +181,25 @@ const ArrayValue = ({
|
|
|
77
181
|
class={clsx(styles().tree.valueKey, styles().tree.collapsible)}
|
|
78
182
|
>
|
|
79
183
|
"{keyName}":{' '}
|
|
184
|
+
<span class={styles().tree.info}>{value.length} items</span>
|
|
80
185
|
</span>
|
|
81
186
|
)}
|
|
82
187
|
<span class={styles().tree.valueBraces}>[</span>
|
|
83
188
|
<Show when={expanded()}>
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<JsonValue
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
189
|
+
<span class={styles().tree.expandedLine(Boolean(keyName))}>
|
|
190
|
+
<For each={value}>
|
|
191
|
+
{(item, i) => {
|
|
192
|
+
const isLastKey = i() === value.length - 1
|
|
193
|
+
return (
|
|
194
|
+
<JsonValue
|
|
195
|
+
copyable={copyable}
|
|
196
|
+
value={item}
|
|
197
|
+
isLastKey={isLastKey}
|
|
198
|
+
/>
|
|
199
|
+
)
|
|
200
|
+
}}
|
|
201
|
+
</For>
|
|
202
|
+
</span>
|
|
94
203
|
</Show>
|
|
95
204
|
<Show when={!expanded()}>
|
|
96
205
|
<span
|
|
@@ -101,7 +210,7 @@ const ArrayValue = ({
|
|
|
101
210
|
}}
|
|
102
211
|
class={clsx(styles().tree.valueKey, styles().tree.collapsible)}
|
|
103
212
|
>
|
|
104
|
-
{
|
|
213
|
+
{`...`}
|
|
105
214
|
</span>
|
|
106
215
|
</Show>
|
|
107
216
|
<span class={styles().tree.valueBraces}>]</span>
|
|
@@ -112,9 +221,11 @@ const ArrayValue = ({
|
|
|
112
221
|
const ObjectValue = ({
|
|
113
222
|
value,
|
|
114
223
|
keyName,
|
|
224
|
+
copyable,
|
|
115
225
|
}: {
|
|
116
226
|
value: Record<string, any>
|
|
117
227
|
keyName?: string
|
|
228
|
+
copyable?: boolean
|
|
118
229
|
}) => {
|
|
119
230
|
const styles = useStyles()
|
|
120
231
|
const [expanded, setExpanded] = createSignal(true)
|
|
@@ -122,7 +233,8 @@ const ObjectValue = ({
|
|
|
122
233
|
const lastKeyName = keys[keys.length - 1]
|
|
123
234
|
|
|
124
235
|
return (
|
|
125
|
-
<span>
|
|
236
|
+
<span class={styles().tree.expanderContainer}>
|
|
237
|
+
{keyName && <Expander expanded={expanded()} />}
|
|
126
238
|
{keyName && (
|
|
127
239
|
<span
|
|
128
240
|
onClick={(e) => {
|
|
@@ -133,21 +245,25 @@ const ObjectValue = ({
|
|
|
133
245
|
class={clsx(styles().tree.valueKey, styles().tree.collapsible)}
|
|
134
246
|
>
|
|
135
247
|
"{keyName}":{' '}
|
|
248
|
+
<span class={styles().tree.info}>{keys.length} items</span>
|
|
136
249
|
</span>
|
|
137
250
|
)}
|
|
138
251
|
<span class={styles().tree.valueBraces}>{'{'}</span>
|
|
139
252
|
<Show when={expanded()}>
|
|
140
|
-
<
|
|
141
|
-
{
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
253
|
+
<span class={styles().tree.expandedLine(Boolean(keyName))}>
|
|
254
|
+
<For each={keys}>
|
|
255
|
+
{(k) => (
|
|
256
|
+
<>
|
|
257
|
+
<JsonValue
|
|
258
|
+
value={value[k]}
|
|
259
|
+
keyName={k}
|
|
260
|
+
isLastKey={lastKeyName === k}
|
|
261
|
+
copyable={copyable}
|
|
262
|
+
/>
|
|
263
|
+
</>
|
|
264
|
+
)}
|
|
265
|
+
</For>
|
|
266
|
+
</span>
|
|
151
267
|
</Show>
|
|
152
268
|
<Show when={!expanded()}>
|
|
153
269
|
<span
|
|
@@ -158,7 +274,7 @@ const ObjectValue = ({
|
|
|
158
274
|
}}
|
|
159
275
|
class={clsx(styles().tree.valueKey, styles().tree.collapsible)}
|
|
160
276
|
>
|
|
161
|
-
{
|
|
277
|
+
{`...`}
|
|
162
278
|
</span>
|
|
163
279
|
</Show>
|
|
164
280
|
<span class={styles().tree.valueBraces}>{'}'}</span>
|
package/src/icons.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/icons'
|
package/src/index.ts
CHANGED
|
@@ -5,3 +5,11 @@ export { TanStackLogo } from './components/logo'
|
|
|
5
5
|
export { JsonTree } from './components/tree'
|
|
6
6
|
export { Button } from './components/button'
|
|
7
7
|
export { Tag } from './components/tag'
|
|
8
|
+
export { MainPanel } from './components/main-panel'
|
|
9
|
+
export {
|
|
10
|
+
Section,
|
|
11
|
+
SectionTitle,
|
|
12
|
+
SectionDescription,
|
|
13
|
+
SectionIcon,
|
|
14
|
+
} from './components/section'
|
|
15
|
+
export { Header, HeaderLogo } from './components/header'
|
package/src/styles/use-styles.ts
CHANGED
|
@@ -50,10 +50,11 @@ const buttonVariantColors: Record<
|
|
|
50
50
|
border: tokens.colors.green[500],
|
|
51
51
|
},
|
|
52
52
|
}
|
|
53
|
+
export const css = goober.css
|
|
53
54
|
const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
|
|
54
|
-
const { colors, font, size, alpha } = tokens
|
|
55
|
+
const { colors, font, size, alpha, border } = tokens
|
|
55
56
|
const { fontFamily } = font
|
|
56
|
-
|
|
57
|
+
|
|
57
58
|
const t = (light: string, dark: string) => (theme === 'light' ? light : dark)
|
|
58
59
|
|
|
59
60
|
return {
|
|
@@ -352,6 +353,62 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
|
|
|
352
353
|
`,
|
|
353
354
|
},
|
|
354
355
|
tree: {
|
|
356
|
+
info: css`
|
|
357
|
+
color: ${t(colors.gray[500], colors.gray[500])};
|
|
358
|
+
font-size: ${font.size.xs};
|
|
359
|
+
margin-right: ${size[1]};
|
|
360
|
+
/* outline: 1px solid ${colors.yellow[400]}; */
|
|
361
|
+
`,
|
|
362
|
+
actionButton: css`
|
|
363
|
+
background-color: transparent;
|
|
364
|
+
color: ${t(colors.gray[500], colors.gray[500])};
|
|
365
|
+
border: none;
|
|
366
|
+
display: inline-flex;
|
|
367
|
+
padding: 0px;
|
|
368
|
+
align-items: center;
|
|
369
|
+
justify-content: center;
|
|
370
|
+
cursor: pointer;
|
|
371
|
+
width: ${size[3]};
|
|
372
|
+
height: ${size[3]};
|
|
373
|
+
position: relative;
|
|
374
|
+
z-index: 1;
|
|
375
|
+
|
|
376
|
+
&:hover svg {
|
|
377
|
+
color: ${t(colors.gray[600], colors.gray[400])};
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
&:focus-visible {
|
|
381
|
+
border-radius: ${border.radius.xs};
|
|
382
|
+
outline: 2px solid ${colors.blue[800]};
|
|
383
|
+
outline-offset: 2px;
|
|
384
|
+
}
|
|
385
|
+
`,
|
|
386
|
+
expanderContainer: css`
|
|
387
|
+
position: relative;
|
|
388
|
+
`,
|
|
389
|
+
expander: css`
|
|
390
|
+
position: absolute;
|
|
391
|
+
left: -16px;
|
|
392
|
+
top: 3px;
|
|
393
|
+
& path {
|
|
394
|
+
stroke: ${colors.blue[300]};
|
|
395
|
+
}
|
|
396
|
+
& svg {
|
|
397
|
+
width: ${size[3]};
|
|
398
|
+
height: ${size[3]};
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
display: inline-flex;
|
|
402
|
+
align-items: center;
|
|
403
|
+
transition: all 0.1s ease;
|
|
404
|
+
/* outline: 1px solid ${colors.blue[400]}; */
|
|
405
|
+
`,
|
|
406
|
+
expandedLine: (hasBorder: boolean) => css`
|
|
407
|
+
display: block;
|
|
408
|
+
padding-left: 0.75rem;
|
|
409
|
+
margin-left: -0.7rem;
|
|
410
|
+
${hasBorder ? `border-left: 1px solid ${colors.blue[300]};` : ''}
|
|
411
|
+
`,
|
|
355
412
|
collapsible: css`
|
|
356
413
|
cursor: pointer;
|
|
357
414
|
transition: all 0.2s ease;
|
|
@@ -361,6 +418,16 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
|
|
|
361
418
|
padding: 0 ${tokens.size[1]};
|
|
362
419
|
}
|
|
363
420
|
`,
|
|
421
|
+
actions: css`
|
|
422
|
+
display: inline-flex;
|
|
423
|
+
margin-left: ${size[2]};
|
|
424
|
+
gap: ${size[2]};
|
|
425
|
+
align-items: center;
|
|
426
|
+
& svg {
|
|
427
|
+
height: 12px;
|
|
428
|
+
width: 12px;
|
|
429
|
+
}
|
|
430
|
+
`,
|
|
364
431
|
valueCollapsed: css`
|
|
365
432
|
color: ${colors.gray[400]};
|
|
366
433
|
`,
|
|
@@ -389,6 +456,121 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
|
|
|
389
456
|
valueContainer: (isRoot: boolean) => css`
|
|
390
457
|
display: block;
|
|
391
458
|
margin-left: ${isRoot ? '0' : '1rem'};
|
|
459
|
+
|
|
460
|
+
&:not(:hover) .actions {
|
|
461
|
+
display: none;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
&:hover .actions {
|
|
465
|
+
display: inline-flex;
|
|
466
|
+
}
|
|
467
|
+
`,
|
|
468
|
+
},
|
|
469
|
+
header: {
|
|
470
|
+
row: css`
|
|
471
|
+
display: flex;
|
|
472
|
+
justify-content: space-between;
|
|
473
|
+
align-items: center;
|
|
474
|
+
padding: ${tokens.size[2]} ${tokens.size[2.5]};
|
|
475
|
+
gap: ${tokens.size[2.5]};
|
|
476
|
+
border-bottom: ${t(colors.gray[300], colors.darkGray[500])} 1px solid;
|
|
477
|
+
align-items: center;
|
|
478
|
+
`,
|
|
479
|
+
logoAndToggleContainer: css`
|
|
480
|
+
display: flex;
|
|
481
|
+
gap: ${tokens.size[3]};
|
|
482
|
+
align-items: center;
|
|
483
|
+
& > button {
|
|
484
|
+
padding: 0;
|
|
485
|
+
background: transparent;
|
|
486
|
+
border: none;
|
|
487
|
+
display: flex;
|
|
488
|
+
gap: ${size[0.5]};
|
|
489
|
+
flex-direction: column;
|
|
490
|
+
}
|
|
491
|
+
`,
|
|
492
|
+
logo: css`
|
|
493
|
+
cursor: pointer;
|
|
494
|
+
display: flex;
|
|
495
|
+
flex-direction: column;
|
|
496
|
+
background-color: transparent;
|
|
497
|
+
border: none;
|
|
498
|
+
gap: ${tokens.size[0.5]};
|
|
499
|
+
padding: 0px;
|
|
500
|
+
&:hover {
|
|
501
|
+
opacity: 0.7;
|
|
502
|
+
}
|
|
503
|
+
&:focus-visible {
|
|
504
|
+
outline-offset: 4px;
|
|
505
|
+
border-radius: ${border.radius.xs};
|
|
506
|
+
outline: 2px solid ${colors.blue[800]};
|
|
507
|
+
}
|
|
508
|
+
`,
|
|
509
|
+
tanstackLogo: css`
|
|
510
|
+
font-size: ${font.size.md};
|
|
511
|
+
font-weight: ${font.weight.bold};
|
|
512
|
+
line-height: ${font.lineHeight.xs};
|
|
513
|
+
white-space: nowrap;
|
|
514
|
+
color: ${t(colors.gray[600], colors.gray[300])};
|
|
515
|
+
`,
|
|
516
|
+
flavorLogo: (flavorLight: string, flavorDark: string) => css`
|
|
517
|
+
font-weight: ${font.weight.semibold};
|
|
518
|
+
font-size: ${font.size.xs};
|
|
519
|
+
background: linear-gradient(to right, ${t(flavorLight, flavorDark)});
|
|
520
|
+
background-clip: text;
|
|
521
|
+
-webkit-background-clip: text;
|
|
522
|
+
line-height: 1;
|
|
523
|
+
-webkit-text-fill-color: transparent;
|
|
524
|
+
white-space: nowrap;
|
|
525
|
+
`,
|
|
526
|
+
},
|
|
527
|
+
section: {
|
|
528
|
+
main: css`
|
|
529
|
+
margin-bottom: 2rem;
|
|
530
|
+
padding: 1.5rem;
|
|
531
|
+
background-color: ${colors.darkGray[800]};
|
|
532
|
+
border: 1px solid ${colors.gray[700]};
|
|
533
|
+
border-radius: 0.75rem;
|
|
534
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
535
|
+
`,
|
|
536
|
+
title: css`
|
|
537
|
+
font-size: 1.125rem;
|
|
538
|
+
font-weight: 600;
|
|
539
|
+
color: ${colors.gray[100]};
|
|
540
|
+
margin: 0 0 1rem 0;
|
|
541
|
+
padding-bottom: 0.5rem;
|
|
542
|
+
border-bottom: 1px solid ${colors.gray[700]};
|
|
543
|
+
display: flex;
|
|
544
|
+
align-items: center;
|
|
545
|
+
gap: 0.5rem;
|
|
546
|
+
text-align: left;
|
|
547
|
+
`,
|
|
548
|
+
icon: css`
|
|
549
|
+
height: 20px;
|
|
550
|
+
width: 20px;
|
|
551
|
+
& > svg {
|
|
552
|
+
height: 100%;
|
|
553
|
+
width: 100%;
|
|
554
|
+
}
|
|
555
|
+
color: ${colors.purple[400]};
|
|
556
|
+
`,
|
|
557
|
+
description: css`
|
|
558
|
+
color: ${colors.gray[400]};
|
|
559
|
+
font-size: 0.875rem;
|
|
560
|
+
margin: 0 0 1.5rem 0;
|
|
561
|
+
line-height: 1.5;
|
|
562
|
+
text-align: left;
|
|
563
|
+
`,
|
|
564
|
+
},
|
|
565
|
+
mainPanel: {
|
|
566
|
+
panel: css`
|
|
567
|
+
padding: 0;
|
|
568
|
+
background: ${colors.darkGray[700]};
|
|
569
|
+
overflow-y: auto;
|
|
570
|
+
height: 100%;
|
|
571
|
+
`,
|
|
572
|
+
withPadding: css`
|
|
573
|
+
padding: ${tokens.size[4]};
|
|
392
574
|
`,
|
|
393
575
|
},
|
|
394
576
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const web = require("solid-js/web");
|
|
4
|
-
const solidJs = require("solid-js");
|
|
5
|
-
const clsx = require("clsx");
|
|
6
|
-
const useStyles = require("../styles/use-styles.cjs");
|
|
7
|
-
var _tmpl$ = /* @__PURE__ */ web.template(`<button>`);
|
|
8
|
-
function Button(props) {
|
|
9
|
-
const styles = useStyles.useStyles();
|
|
10
|
-
const [local, rest] = solidJs.splitProps(props, ["variant", "outline", "ghost", "children", "className"]);
|
|
11
|
-
const variant = local.variant || "primary";
|
|
12
|
-
const classes = clsx(styles().button.base, styles().button.variant(variant, local.outline, local.ghost), local.className);
|
|
13
|
-
return (() => {
|
|
14
|
-
var _el$ = _tmpl$();
|
|
15
|
-
web.spread(_el$, web.mergeProps(rest, {
|
|
16
|
-
"class": classes
|
|
17
|
-
}), false, true);
|
|
18
|
-
web.insert(_el$, () => local.children);
|
|
19
|
-
return _el$;
|
|
20
|
-
})();
|
|
21
|
-
}
|
|
22
|
-
exports.Button = Button;
|
|
23
|
-
//# sourceMappingURL=button.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button.cjs","sources":["../../../src/components/button.tsx"],"sourcesContent":["import { splitProps } from 'solid-js'\nimport clsx from 'clsx'\nimport { useStyles } from '../styles/use-styles'\nimport type { JSX } from 'solid-js'\n\nexport type ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'danger'\n | 'success'\n | 'info'\n | 'warning'\ntype ButtonProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & {\n variant?: ButtonVariant\n outline?: boolean\n ghost?: boolean\n children?: any\n className?: string\n}\n\nexport function Button(props: ButtonProps) {\n const styles = useStyles()\n const [local, rest] = splitProps(props, [\n 'variant',\n 'outline',\n 'ghost',\n 'children',\n 'className',\n ])\n const variant = local.variant || 'primary'\n const classes = clsx(\n styles().button.base,\n styles().button.variant(variant, local.outline, local.ghost),\n local.className,\n )\n\n return (\n <button {...rest} class={classes}>\n {local.children}\n </button>\n )\n}\n"],"names":["Button","props","styles","useStyles","local","rest","splitProps","variant","classes","clsx","button","base","outline","ghost","className","_el$","_tmpl$","_$spread","_$mergeProps","_$insert","children"],"mappings":";;;;;;;AAoBO,SAASA,OAAOC,OAAoB;AACzC,QAAMC,SAASC,UAAAA,UAAAA;AACf,QAAM,CAACC,OAAOC,IAAI,IAAIC,QAAAA,WAAWL,OAAO,CACtC,WACA,WACA,SACA,YACA,WAAW,CACZ;AACD,QAAMM,UAAUH,MAAMG,WAAW;AACjC,QAAMC,UAAUC,KACdP,OAAAA,EAASQ,OAAOC,MAChBT,SAASQ,OAAOH,QAAQA,SAASH,MAAMQ,SAASR,MAAMS,KAAK,GAC3DT,MAAMU,SACR;AAEA,UAAA,MAAA;AAAA,QAAAC,OAAAC,OAAAA;AAAAC,eAAAF,MAAAG,IAAAA,WACcb,MAAI;AAAA,MAAA,SAASG;AAAAA,IAAAA,CAAO,GAAA,OAAA,IAAA;AAAAW,QAAAA,OAAAJ,MAAA,MAC7BX,MAAMgB,QAAQ;AAAA,WAAAL;AAAAA,EAAA,GAAA;AAGrB;;"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { JSX } from 'solid-js';
|
|
2
|
-
export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'success' | 'info' | 'warning';
|
|
3
|
-
type ButtonProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
4
|
-
variant?: ButtonVariant;
|
|
5
|
-
outline?: boolean;
|
|
6
|
-
ghost?: boolean;
|
|
7
|
-
children?: any;
|
|
8
|
-
className?: string;
|
|
9
|
-
};
|
|
10
|
-
export declare function Button(props: ButtonProps): JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const web = require("solid-js/web");
|
|
4
|
-
const solidJs = require("solid-js");
|
|
5
|
-
const useStyles = require("../styles/use-styles.cjs");
|
|
6
|
-
var _tmpl$ = /* @__PURE__ */ web.template(`<div><label><input type=checkbox><div>`), _tmpl$2 = /* @__PURE__ */ web.template(`<span>`);
|
|
7
|
-
function Checkbox(props) {
|
|
8
|
-
const styles = useStyles.useStyles();
|
|
9
|
-
const [isChecked, setIsChecked] = solidJs.createSignal(props.checked || false);
|
|
10
|
-
const handleChange = (e) => {
|
|
11
|
-
const checked = e.target.checked;
|
|
12
|
-
setIsChecked(checked);
|
|
13
|
-
props.onChange?.(checked);
|
|
14
|
-
};
|
|
15
|
-
return (() => {
|
|
16
|
-
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling;
|
|
17
|
-
_el$3.$$input = handleChange;
|
|
18
|
-
web.insert(_el$4, (() => {
|
|
19
|
-
var _c$ = web.memo(() => !!props.label);
|
|
20
|
-
return () => _c$() && (() => {
|
|
21
|
-
var _el$5 = _tmpl$2();
|
|
22
|
-
web.insert(_el$5, () => props.label);
|
|
23
|
-
web.effect(() => web.className(_el$5, styles().checkboxLabel));
|
|
24
|
-
return _el$5;
|
|
25
|
-
})();
|
|
26
|
-
})(), null);
|
|
27
|
-
web.insert(_el$4, (() => {
|
|
28
|
-
var _c$2 = web.memo(() => !!props.description);
|
|
29
|
-
return () => _c$2() && (() => {
|
|
30
|
-
var _el$6 = _tmpl$2();
|
|
31
|
-
web.insert(_el$6, () => props.description);
|
|
32
|
-
web.effect(() => web.className(_el$6, styles().checkboxDescription));
|
|
33
|
-
return _el$6;
|
|
34
|
-
})();
|
|
35
|
-
})(), null);
|
|
36
|
-
web.effect((_p$) => {
|
|
37
|
-
var _v$ = styles().checkboxContainer, _v$2 = styles().checkboxWrapper, _v$3 = styles().checkbox, _v$4 = styles().checkboxLabelContainer;
|
|
38
|
-
_v$ !== _p$.e && web.className(_el$, _p$.e = _v$);
|
|
39
|
-
_v$2 !== _p$.t && web.className(_el$2, _p$.t = _v$2);
|
|
40
|
-
_v$3 !== _p$.a && web.className(_el$3, _p$.a = _v$3);
|
|
41
|
-
_v$4 !== _p$.o && web.className(_el$4, _p$.o = _v$4);
|
|
42
|
-
return _p$;
|
|
43
|
-
}, {
|
|
44
|
-
e: void 0,
|
|
45
|
-
t: void 0,
|
|
46
|
-
a: void 0,
|
|
47
|
-
o: void 0
|
|
48
|
-
});
|
|
49
|
-
web.effect(() => _el$3.checked = isChecked());
|
|
50
|
-
return _el$;
|
|
51
|
-
})();
|
|
52
|
-
}
|
|
53
|
-
web.delegateEvents(["input"]);
|
|
54
|
-
exports.Checkbox = Checkbox;
|
|
55
|
-
//# sourceMappingURL=checkbox.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.cjs","sources":["../../../src/components/checkbox.tsx"],"sourcesContent":["import { createSignal } from 'solid-js'\nimport { useStyles } from '../styles/use-styles'\n\ninterface CheckboxProps {\n label?: string\n checked?: boolean\n onChange?: (checked: boolean) => void\n description?: string\n}\n\nexport function Checkbox(props: CheckboxProps) {\n const styles = useStyles()\n const [isChecked, setIsChecked] = createSignal(props.checked || false)\n\n const handleChange = (e: Event) => {\n const checked = (e.target as HTMLInputElement).checked\n setIsChecked(checked)\n props.onChange?.(checked)\n }\n\n return (\n <div class={styles().checkboxContainer}>\n <label class={styles().checkboxWrapper}>\n <input\n type=\"checkbox\"\n checked={isChecked()}\n class={styles().checkbox}\n onInput={handleChange}\n />\n <div class={styles().checkboxLabelContainer}>\n {props.label && (\n <span class={styles().checkboxLabel}>{props.label}</span>\n )}\n {props.description && (\n <span class={styles().checkboxDescription}>\n {props.description}\n </span>\n )}\n </div>\n </label>\n </div>\n )\n}\n"],"names":["Checkbox","props","styles","useStyles","isChecked","setIsChecked","createSignal","checked","handleChange","e","target","onChange","_el$","_tmpl$","_el$2","firstChild","_el$3","_el$4","nextSibling","$$input","_$insert","_c$","_$memo","label","_el$5","_tmpl$2","_$effect","_$className","checkboxLabel","_c$2","description","_el$6","checkboxDescription","_p$","_v$","checkboxContainer","_v$2","checkboxWrapper","_v$3","checkbox","_v$4","checkboxLabelContainer","t","a","o","undefined","_$delegateEvents"],"mappings":";;;;;;AAUO,SAASA,SAASC,OAAsB;AAC7C,QAAMC,SAASC,UAAAA,UAAAA;AACf,QAAM,CAACC,WAAWC,YAAY,IAAIC,QAAAA,aAAaL,MAAMM,WAAW,KAAK;AAErE,QAAMC,eAAeA,CAACC,MAAa;AACjC,UAAMF,UAAWE,EAAEC,OAA4BH;AAC/CF,iBAAaE,OAAO;AACpBN,UAAMU,WAAWJ,OAAO;AAAA,EAC1B;AAEA,UAAA,MAAA;AAAA,QAAAK,OAAAC,UAAAC,QAAAF,KAAAG,YAAAC,QAAAF,MAAAC,YAAAE,QAAAD,MAAAE;AAAAF,UAAAG,UAOiBX;AAAYY,QAAAA,OAAAH,QAAA,MAAA;AAAA,UAAAI,MAAAC,IAAAA,KAAA,MAAA,CAAA,CAGpBrB,MAAMsB,KAAK;AAAA,aAAA,MAAXF,IAAAA,MAAA,MAAA;AAAA,YAAAG,QAAAC,QAAAA;AAAAL,YAAAA,OAAAI,OAAA,MACuCvB,MAAMsB,KAAK;AAAAG,YAAAA,OAAA,MAAAC,IAAAA,UAAAH,OAApCtB,OAAAA,EAAS0B,aAAa,CAAA;AAAA,eAAAJ;AAAAA,MAAA,GAAA;AAAA,IACpC,GAAA,GAAA,IAAA;AAAAJ,QAAAA,OAAAH,QAAA,MAAA;AAAA,UAAAY,OAAAP,IAAAA,KAAA,MAAA,CAAA,CACArB,MAAM6B,WAAW;AAAA,aAAA,MAAjBD,KAAAA,MAAA,MAAA;AAAA,YAAAE,QAAAN,QAAAA;AAAAL,YAAAA,OAAAW,OAAA,MAEI9B,MAAM6B,WAAW;AAAAJ,YAAAA,OAAA,MAAAC,IAAAA,UAAAI,OADP7B,OAAAA,EAAS8B,mBAAmB,CAAA;AAAA,eAAAD;AAAAA,MAAA,GAAA;AAAA,IAG1C,GAAA,GAAA,IAAA;AAAAL,QAAAA,OAAAO,CAAAA,QAAA;AAAA,UAAAC,MAhBKhC,OAAAA,EAASiC,mBAAiBC,OACtBlC,OAAAA,EAASmC,iBAAeC,OAI3BpC,OAAAA,EAASqC,UAAQC,OAGdtC,SAASuC;AAAsBP,cAAAD,IAAAxB,KAAAkB,IAAAA,UAAAf,MAAAqB,IAAAxB,IAAAyB,GAAA;AAAAE,eAAAH,IAAAS,KAAAf,IAAAA,UAAAb,OAAAmB,IAAAS,IAAAN,IAAA;AAAAE,eAAAL,IAAAU,KAAAhB,IAAAA,UAAAX,OAAAiB,IAAAU,IAAAL,IAAA;AAAAE,eAAAP,IAAAW,KAAAjB,IAAAA,UAAAV,OAAAgB,IAAAW,IAAAJ,IAAA;AAAA,aAAAP;AAAAA,IAAA,GAAA;AAAA,MAAAxB,GAAAoC;AAAAA,MAAAH,GAAAG;AAAAA,MAAAF,GAAAE;AAAAA,MAAAD,GAAAC;AAAAA,IAAAA,CAAA;AAAAnB,QAAAA,aAAAV,MAAAT,UAJhCH,UAAAA,CAAW;AAAA,WAAAQ;AAAAA,EAAA,GAAA;AAiB9B;AAACkC,IAAAA,eAAA,CAAA,OAAA,CAAA;;"}
|