Skip to content

Commit c408963

Browse files
committed
listing decorations
1 parent 068edc4 commit c408963

8 files changed

Lines changed: 102 additions & 4 deletions

File tree

.changeset/sweet-files-sing.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"solid-devtools-extension": patch
3+
"@solid-devtools/ui": patch
4+
---
5+
6+
Add memo icon and listing decorations for signals.

packages/extension/src/state/bridge.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ import {
1111

1212
export const { onRuntimeMessage, postRuntimeMessage } = createRuntimeMessanger()
1313

14+
// in development — force update the graph on load to work with hot reloading
15+
if (import.meta.env.DEV) {
16+
postRuntimeMessage("ForceUpdate")
17+
}
18+
1419
onRuntimeMessage("GraphUpdate", update => {
1520
handleGraphUpdate(update)
1621
detailsHandleGraphUpdate()

packages/ui/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
"./animation": {
4040
"import": "./dist/animation/index.js",
4141
"require": "./dist/animation/index.cjs"
42+
},
43+
"./icons": {
44+
"import": "./dist/icons/index.js",
45+
"require": "./dist/icons/index.cjs"
4246
}
4347
},
4448
"typesVersions": {
@@ -48,6 +52,9 @@
4852
],
4953
"animation": [
5054
"./dist/animation/index.d.ts"
55+
],
56+
"icons": [
57+
"./dist/icons/index.d.ts"
5158
]
5259
}
5360
},

packages/ui/src/icons/index.tsx

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* Icons taken from https://phosphoricons.com
3+
*/
4+
5+
import { Component, JSX, splitProps } from "solid-js"
6+
7+
export type IconProps = {
8+
color?: string
9+
bgColor?: string
10+
}
11+
12+
const localPropsKeys = ["color", "bgColor"] as const
13+
14+
export const Memo: Component<JSX.IntrinsicElements["svg"] & IconProps> = props => {
15+
const [, attrs] = splitProps(props, localPropsKeys)
16+
return (
17+
<svg
18+
width="16"
19+
height="16"
20+
viewBox="0 0 32 32"
21+
fill="none"
22+
xmlns="http://www.w3.org/2000/svg"
23+
{...attrs}
24+
>
25+
<path
26+
opacity={props.bgColor ? undefined : "0.2"}
27+
d="M10 27V19C10 18.7348 10.1054 18.4804 10.2929 18.2929C10.4804 18.1054 10.7348 18 11 18H21C21.2652 18 21.5196 18.1054 21.7071 18.2929C21.8946 18.4804 22 18.7348 22 19V27H26C26.2652 27 26.5196 26.8946 26.7071 26.7071C26.8946 26.5196 27 26.2652 27 26V11.4125C27.0005 11.2827 26.9753 11.154 26.926 11.0339C26.8766 10.9138 26.8041 10.8046 26.7125 10.7125L21.2875 5.28751C21.1955 5.19591 21.0862 5.12338 20.9661 5.07404C20.846 5.02471 20.7174 4.99955 20.5875 5.00001H6C5.73478 5.00001 5.48043 5.10536 5.29289 5.2929C5.10536 5.48044 5 5.73479 5 6.00001V26C5 26.2652 5.10536 26.5196 5.29289 26.7071C5.48043 26.8946 5.73478 27 6 27H10Z"
28+
fill={props.bgColor ?? "currentColor"}
29+
/>
30+
<path
31+
d="M27 11.4125V26C27 26.2652 26.8946 26.5196 26.7071 26.7071C26.5196 26.8946 26.2652 27 26 27H6C5.73478 27 5.48043 26.8946 5.29289 26.7071C5.10536 26.5196 5 26.2652 5 26V6.00001C5 5.73479 5.10536 5.48044 5.29289 5.2929C5.48043 5.10536 5.73478 5.00001 6 5.00001H20.5875C20.7174 4.99955 20.846 5.02471 20.9661 5.07404C21.0862 5.12338 21.1955 5.19591 21.2875 5.28751L26.7125 10.7125C26.8041 10.8046 26.8766 10.9138 26.926 11.0339C26.9753 11.154 27.0005 11.2827 27 11.4125V11.4125Z"
32+
stroke={props.color ?? "currentColor"}
33+
stroke-width="2"
34+
stroke-linecap="round"
35+
stroke-linejoin="round"
36+
/>
37+
<path
38+
d="M10 27V19C10 18.7348 10.1054 18.4804 10.2929 18.2929C10.4804 18.1054 10.7348 18 11 18H21C21.2652 18 21.5196 18.1054 21.7071 18.2929C21.8946 18.4804 22 18.7348 22 19V27"
39+
stroke={props.color ?? "currentColor"}
40+
stroke-width="2"
41+
stroke-linecap="round"
42+
stroke-linejoin="round"
43+
/>
44+
<path
45+
d="M19 9H12"
46+
stroke={props.color ?? "currentColor"}
47+
stroke-width="2"
48+
stroke-linecap="round"
49+
stroke-linejoin="round"
50+
/>
51+
</svg>
52+
)
53+
}

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { style } from "@vanilla-extract/css"
2-
import { color, spacing, theme } from "../theme"
2+
import { centerChild, color, spacing, theme } from "../theme"
33
import { CSSPropertiesWithVars } from "@vanilla-extract/css/dist/declarations/src/types"
44

55
export const Signals = {
@@ -16,7 +16,20 @@ export const SignalNode = {
1616
alignItems: "center",
1717
height: spacing[4.5],
1818
}),
19+
icon: style({
20+
height: "100%",
21+
width: spacing[4.5],
22+
marginRight: spacing[1],
23+
...centerChild,
24+
}),
25+
signalDot: style({
26+
width: spacing[1],
27+
height: spacing[1],
28+
borderRadius: "50%",
29+
backgroundColor: color.amber[400],
30+
}),
1931
name: style({
32+
height: "100%",
2033
minWidth: spacing[24],
2134
color: color.gray[800],
2235
fontWeight: 600,
@@ -30,7 +43,7 @@ export const SignalNode = {
3043

3144
export const ValuePreview = style({
3245
minWidth: spacing[4],
33-
height: spacing[4.5],
46+
height: "100%",
3447
color: color.gray[800],
3548
fontFamily: theme.font.mono,
3649
fontWeight: 600,

packages/ui/src/signal/SignalNode.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
EncodedPreviewPayloadMap,
88
ValueType,
99
} from "@solid-devtools/shared/serialize"
10-
import { theme } from "../theme"
10+
import * as Icon from "~/icons"
11+
import { color, theme } from "~/theme"
1112
import { HighlightText } from "../highlight/Highlight"
1213
import * as styles from "./SignalNode.css"
1314

@@ -136,6 +137,7 @@ export const Signals: Component<{ each: GraphSignal[] }> = props => {
136137
}
137138

138139
export const SignalNode: Component<{ signal: GraphSignal }> = ({ signal }) => {
140+
const { type } = signal
139141
const { useUpdatedSelector } = useSignalContext()
140142

141143
const isUpdated = useUpdatedSelector(signal.id)
@@ -148,6 +150,13 @@ export const SignalNode: Component<{ signal: GraphSignal }> = ({ signal }) => {
148150

149151
return (
150152
<div class={styles.SignalNode.container} {...hoverProps}>
153+
<div class={styles.SignalNode.icon}>
154+
{type === NodeType.Memo ? (
155+
<Icon.Memo bgColor={color.amber[400]} />
156+
) : (
157+
<div class={styles.SignalNode.signalDot} />
158+
)}
159+
</div>
151160
<div class={styles.SignalNode.name}>
152161
{signal.name}
153162
{/* <span class={styles.SignalNode.id}>#{signal.id}</span> */}

packages/ui/tsconfig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
22
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"paths": {
5+
"~/*": ["./src/*"]
6+
}
7+
},
38
"include": ["src/**/*", "../../env.d.ts"]
49
}

packages/ui/tsup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import { vanillaExtractPlugin } from "@vanilla-extract/esbuild-plugin"
44
export default defineConfig(
55
"tsx",
66
undefined,
7-
["theme/index.ts", "animation/index.ts"],
7+
["theme/index.ts", "animation/index.ts", "icons/index.tsx"],
88
[vanillaExtractPlugin()],
99
)

0 commit comments

Comments
 (0)