Skip to content

Commit 7b6ac08

Browse files
committed
improve styles, add changeset
1 parent eecefda commit 7b6ac08

3 files changed

Lines changed: 39 additions & 36 deletions

File tree

.changeset/lovely-pets-sneeze.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"solid-devtools-extension": minor
3+
"@solid-devtools/ui": minor
4+
---
5+
6+
Display nested signal values as a collapsable tree.

packages/ui/src/signal/SignalNode.css.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const Signals = {
1717
}),
1818
}
1919

20-
const { container, highlight, bgColorVar, bgOpacityVar } = createHighlightStyles("background-color")
20+
const { container, highlight, bgColorVar, bgOpacityVar } = createHighlightStyles()
2121

2222
export const ValueRow = {
2323
container: style([
@@ -30,20 +30,25 @@ export const ValueRow = {
3030
// height: spacing[4.5],
3131
cursor: "pointer",
3232
vars: {
33-
[bgColorVar]: "transparent",
34-
[bgOpacityVar]: "1",
33+
[bgColorVar]: color.gray[300],
34+
[bgOpacityVar]: "0",
3535
},
3636
},
3737
]),
3838
containerFocused: style({
3939
vars: {
40-
[bgColorVar]: color.gray[100],
40+
[bgOpacityVar]: "0.2",
4141
},
4242
}),
4343
containerHovered: style({
44-
vars: { [bgColorVar]: color.gray[200] },
44+
vars: { [bgOpacityVar]: "0.3" },
4545
}),
46-
highlight: style([highlight, {}]),
46+
highlight: style([
47+
highlight,
48+
{
49+
border: `1px solid ${color.gray[400]}`,
50+
},
51+
]),
4752
}
4853

4954
export const ValueName = {
@@ -111,12 +116,6 @@ export const collapsable = {
111116
}),
112117
}
113118

114-
export const EmptyArray = style([
115-
baseValue,
116-
{
117-
color: color.disabled,
118-
},
119-
])
120119
export const ValueString = style({
121120
minHeight: RowHeight,
122121
color: color.green,

packages/ui/src/signal/SignalNode.tsx

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,28 @@ const ElementValuePreview: ValueComponent<ValueType.Element> = props => (
7474
<span class={styles.ValueElement}>{props.value}</span>
7575
)
7676

77+
const ObjectValuePreview: Component<
78+
EncodedValueOf<ValueType.Object | ValueType.Array, boolean> & { extended?: boolean }
79+
> = props => (
80+
<Switch>
81+
<Match when={!props.children || props.value === 0 || props.extended === false}>
82+
<Show
83+
when={props.value > 0}
84+
fallback={
85+
<span class={styles.Nullable}>
86+
Empty {props.type === ValueType.Array ? "Array" : "Object"}
87+
</span>
88+
}
89+
>
90+
<span class={styles.baseValue}>
91+
{props.type === ValueType.Array ? "Array" : "Object"} [{props.value}]
92+
</span>
93+
</Show>
94+
</Match>
95+
<Match when={props.children}>{value => <CollapsableObjectPreview value={value} />}</Match>
96+
</Switch>
97+
)
98+
7799
const CollapsableObjectPreview: Component<{
78100
value:
79101
| EncodedValueOf<ValueType.Object, true>["children"]
@@ -123,30 +145,6 @@ const CollapsableObjectPreview: Component<{
123145
</ul>
124146
)
125147

126-
const ObjectValuePreview: Component<
127-
EncodedValueOf<ValueType.Object | ValueType.Array, boolean> & { extended?: boolean }
128-
> = props => (
129-
<Switch>
130-
<Match when={!props.children || props.value === 0 || props.extended === false}>
131-
<Switch>
132-
<Match when={props.type === ValueType.Object}>
133-
<span class={styles.ValueObject}></span>
134-
</Match>
135-
<Match when={props.type === ValueType.Array}>
136-
<ArrayHead value={props.value} />
137-
</Match>
138-
</Switch>
139-
</Match>
140-
<Match when={props.children}>{value => <CollapsableObjectPreview value={value} />}</Match>
141-
</Switch>
142-
)
143-
144-
const ArrayHead: Component<{ value: number }> = props => (
145-
<Show when={props.value > 0} fallback={<span class={styles.EmptyArray}>Empty Array</span>}>
146-
<span class={styles.baseValue}>Array [{props.value}]</span>
147-
</Show>
148-
)
149-
150148
const ValuePreview: Component<{ value: EncodedValue<boolean> }> = props =>
151149
createMemo(() => {
152150
switch (props.value.type) {

0 commit comments

Comments
 (0)