Skip to content

Commit dca83c0

Browse files
committed
Fix usage of theme package
1 parent 786976f commit dca83c0

File tree

15 files changed

+67
-63
lines changed

15 files changed

+67
-63
lines changed

.changeset/angry-cameras-happen.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solid-devtools/frontend": patch
3+
---
4+
5+
Fix usage of theme package

examples/sandbox/src/Recursive.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ const Node: Component<NodeType> = props => {
6969
<button
7070
style={{
7171
"border-radius": "9999px",
72-
"background-color": "#1e293b"
72+
"background-color": "#1e293b",
73+
"color": "white",
7374
}}
7475
onClick={e => addNode(nodeProps.id, nodeSignals.parents)}
7576
>

examples/sandbox/src/styles.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,3 @@ body {
55
padding-top: 82px;
66
margin: 0;
77
}
8-
button {
9-
color: inherit;
10-
}

packages/frontend/src/App.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as s from 'solid-js'
2+
import * as theme from '@solid-devtools/shared/theme'
23
import * as ui from './ui/index.ts'
34
import {createSidePanel} from './SidePanel.tsx'
45
import {StructureView} from './structure.tsx'
@@ -74,7 +75,7 @@ export const App: s.Component<{headerSubtitle?: s.JSX.Element}> = props => {
7475
return (
7576
<div
7677
class="h-full w-full overflow-hidden grid text-base font-sans bg-panel-bg text-text"
77-
style={{'grid-template-rows': `${ui.spacing[10]} 1fr`}}
78+
style={{'grid-template-rows': `${theme.spacing[10]} 1fr`}}
7879
>
7980
<header class="p-2 flex items-center gap-x-2 bg-panel-bg b-b b-solid b-panel-border text-text">
8081
<div class="flex items-center gap-x-2">
@@ -90,16 +91,16 @@ export const App: s.Component<{headerSubtitle?: s.JSX.Element}> = props => {
9091
<Options />
9192
</header>
9293
<div class="overflow-hidden">
93-
<ui.Splitter.Root>
94-
<ui.Splitter.Panel>
94+
<ui.SplitterRoot>
95+
<ui.SplitterPanel>
9596
<StructureView />
96-
</ui.Splitter.Panel>
97+
</ui.SplitterPanel>
9798
{sidePanel.isOpen() && (
98-
<ui.Splitter.Panel>
99+
<ui.SplitterPanel>
99100
<sidePanel.SidePanel />
100-
</ui.Splitter.Panel>
101+
</ui.SplitterPanel>
101102
)}
102-
</ui.Splitter.Root>
103+
</ui.SplitterRoot>
103104
</div>
104105
</div>
105106
)

packages/frontend/src/SidePanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import clsx from 'clsx'
22
import * as s from 'solid-js'
3+
import * as theme from '@solid-devtools/shared/theme'
34
import {useController} from './controller.tsx'
45
import * as dgraph from './dgraph.tsx'
56
import {InspectorView} from './inspector.tsx'
@@ -53,7 +54,7 @@ export function createSidePanel() {
5354
<div
5455
class="h-full grid"
5556
style={{
56-
'grid-template-rows': `${ui.spacing.header_height} 1fr`,
57+
'grid-template-rows': `${theme.spacing.header_height} 1fr`,
5758
'grid-template-columns': '100%',
5859
}}
5960
>

packages/frontend/src/dgraph.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import clsx from 'clsx'
22
import * as s from 'solid-js'
33
import * as debug from '@solid-devtools/debugger/types'
44
import {createHover} from '@solid-devtools/shared/primitives'
5+
import * as theme from '@solid-devtools/shared/theme'
56
import {useController} from './controller.tsx'
67
import * as ui from './ui/index.ts'
78

@@ -117,7 +118,7 @@ function calculateNodeOrder(
117118
return {flowOrder, depthMap}
118119
}
119120

120-
const grid_size = ui.spacing[10]
121+
const grid_size = theme.spacing[10]
121122

122123
const GraphNode: s.Component<{
123124
id: debug.NodeID
@@ -135,7 +136,7 @@ const GraphNode: s.Component<{
135136
const {pingUpdated, OwnerName} = ui.createHighlightedOwnerName()
136137
props.listenToUpdate(pingUpdated)
137138

138-
const margin = ui.spacing[2]
139+
const margin = theme.spacing[2]
139140

140141
return (
141142
<div
@@ -160,7 +161,7 @@ const GraphNode: s.Component<{
160161
props.isHovered ? 'bg-panel-2' : 'bg-transparent group-hover:bg-panel-2',
161162
props.isInspected ? 'b-panel-6' : 'b-transparent group-active:b-panel-4',
162163
)}
163-
style={{'box-shadow': `0 0 ${margin} ${ui.spacing[1]} ${ui.vars.panel[1]}`}}
164+
style={{'box-shadow': `0 0 ${margin} ${theme.spacing[1]} ${theme.vars.panel[1]}`}}
164165
/>
165166
<OwnerName name={name} type={type} />
166167
</div>
@@ -227,8 +228,8 @@ export function Dgraph_View(): s.JSX.Element {
227228
const thereIsAHoveredNode = s.createMemo(() => !!hovered.hoveredId())
228229

229230
const pattern_size = '1px'
230-
const pattern = `${ui.vars.panel[2]} 0,
231-
${ui.vars.panel[2]} ${pattern_size},
231+
const pattern = `${theme.vars.panel[2]} 0,
232+
${theme.vars.panel[2]} ${pattern_size},
232233
transparent ${pattern_size},
233234
transparent ${grid_size}`
234235

packages/frontend/src/inspector.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {defer} from '@solid-primitives/utils'
66
import {handleTupleUpdates, createHover, createPingedSignal} from '@solid-devtools/shared/primitives'
77
import {splitOnColon, warn} from '@solid-devtools/shared/utils'
88
import * as debug from '@solid-devtools/debugger/types'
9+
import * as theme from '@solid-devtools/shared/theme'
910
import {SidePanelCtx} from './SidePanel.tsx'
1011
import {useController, type DebuggerBridge} from './controller.tsx'
1112
import * as ui from './ui/index.ts'
@@ -590,7 +591,7 @@ const value_element_container = clsx(
590591
export const value_node_styles = /*css*/ `
591592
.${string_value_class}:before, .${string_value_class}:after {
592593
content: '"';
593-
color: ${ui.vars.disabled};
594+
color: ${theme.vars.disabled};
594595
}
595596
596597
.${value_element_container_class}:hover {

packages/frontend/src/structure.tsx

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {createElementSize, createResizeObserver} from '@solid-primitives/resize-
66
import {useRemSize} from '@solid-primitives/styles'
77

88
import {type Atom, atom, createHover} from '@solid-devtools/shared/primitives'
9+
import * as theme from '@solid-devtools/shared/theme'
910
import * as debug from '@solid-devtools/debugger/types'
1011
import {hover_background, panel_header_el_border} from './SidePanel.tsx'
1112
import {useController, useDevtoolsOptions} from './controller.tsx'
@@ -268,14 +269,14 @@ export function reconcileStructure(
268269
return {roots: nextRoots, nodeList: NewNodeList}
269270
}
270271

271-
export const path_height = ui.spacing[4.5]
272-
export const row_height = ui.spacing[4.5]
273-
export const row_padding = ui.spacing[3.5]
274-
export const v_margin = ui.spacing[3]
272+
export const path_height = theme.spacing[4.5]
273+
export const row_height = theme.spacing[4.5]
274+
export const row_padding = theme.spacing[3.5]
275+
export const v_margin = theme.spacing[3]
275276

276-
export const path_height_in_rem = ui.remValue(path_height)
277-
export const row_height_in_rem = ui.remValue(row_height)
278-
export const v_margin_in_rem = ui.remValue(v_margin)
277+
export const path_height_in_rem = theme.remValue(path_height)
278+
export const row_height_in_rem = theme.remValue(row_height)
279+
export const v_margin_in_rem = theme.remValue(v_margin)
279280

280281
export const path_height_class = 'h-owner-path-height'
281282
export const path_min_height_class = 'min-h-owner-path-height'
@@ -290,9 +291,9 @@ export const owner_path_styles = /*css*/ `
290291
`
291292

292293
export const row_padding_minus_px = `calc(${row_padding} - 0.95px)`
293-
export const lines_color = ui.vars.panel[3]
294+
export const lines_color = theme.vars.panel[3]
294295
export const background_gradient = `repeating-linear-gradient(to right, transparent, transparent ${row_padding_minus_px}, ${lines_color} ${row_padding_minus_px}, ${lines_color} ${row_padding})`
295-
export const padding_mask = `linear-gradient(to right, rgba(0,0,0, 0.4), black ${ui.spacing[48]})`
296+
export const padding_mask = `linear-gradient(to right, rgba(0,0,0, 0.4), black ${theme.spacing[48]})`
296297

297298
export function getVirtualVars(
298299
listLength: number,
@@ -328,7 +329,7 @@ export function StructureView(): s.JSXElement {
328329
<div
329330
class="relative h-full w-full overflow-hidden grid"
330331
style={{
331-
'grid-template-rows': `${ui.spacing.header_height} 1fr ${path_height}`,
332+
'grid-template-rows': `${theme.spacing.header_height} 1fr ${path_height}`,
332333
'grid-template-columns': '100%',
333334
}}
334335
>
@@ -385,7 +386,7 @@ const Search: s.Component = () => {
385386
<style>{
386387
/*css*/ `
387388
.edge-container-base {
388-
height: calc(100% - ${ui.spacing[2]})
389+
height: calc(100% - ${theme.spacing[2]})
389390
}
390391
`
391392
}</style>
@@ -401,7 +402,7 @@ const Search: s.Component = () => {
401402
}}
402403
class="w-full text-lg p-x-6 transition-padding leading-9 placeholder:text-disabled group-focus-within:p-l-2"
403404
style={{
404-
height: ui.spacing.header_height,
405+
height: theme.spacing.header_height,
405406
}}
406407
type="text"
407408
placeholder="Search"
@@ -450,10 +451,10 @@ const ToggleMode: s.Component = () => {
450451
style={{
451452
[ui.toggle_tab_color_var]:
452453
mode === debug.TreeWalkerMode.Owners
453-
? ui.vars.text.DEFAULT
454+
? theme.vars.text.DEFAULT
454455
: mode === debug.TreeWalkerMode.DOM
455-
? ui.vars.dom
456-
: ui.vars.component,
456+
? theme.vars.dom
457+
: theme.vars.component,
457458
}}
458459
>
459460
<div
@@ -831,7 +832,7 @@ export const OwnerPath: s.Component = () => {
831832
flex items-center pointer-events-none
832833
group-hover:opacity-0"
833834
style={{
834-
'background-image': `linear-gradient(to right, ${ui.vars.panel.bg} ${ui.spacing[8]}, transparent ${ui.spacing[32]})`,
835+
'background-image': `linear-gradient(to right, ${theme.vars.panel.bg} ${theme.spacing[8]}, transparent ${theme.spacing[32]})`,
835836
}}
836837
>
837838
<ui.Icon.Options class="w-3 h3 text-disabled" />
@@ -925,7 +926,7 @@ export const OwnerNode: s.Component<{
925926
<div
926927
class="relative -z-2 ml-3.5"
927928
style={{
928-
width: `calc(${props.owner.level} * ${row_padding} + ${ui.spacing[2]})`,
929+
width: `calc(${props.owner.level} * ${row_padding} + ${theme.spacing[2]})`,
929930
height: `calc(${row_height} + 0.95px)`,
930931
background: background_gradient,
931932
'mask-image': padding_mask,

packages/frontend/src/ui/highlight.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import clsx from 'clsx'
22
import {type ParentComponent} from 'solid-js'
3-
import * as ui from '../ui/index.ts'
3+
import * as theme from '@solid-devtools/shared/theme'
44

55
export const highlight_color_var = '--highlight_color_var'
66
export const highlight_opacity_var = '--highlight_opacity_var'
@@ -9,7 +9,7 @@ export const highlight_container = 'relative z-1'
99
export const highlight_element = `highlight_element absolute -z-1 inset-y-0 -inset-x-1 rounded transition-opacity`
1010
export const highlight_styles = /*css*/`
1111
.highlight_element {
12-
background-color: var(${highlight_color_var}, ${ui.vars.highlight.bg});
12+
background-color: var(${highlight_color_var}, ${theme.vars.highlight.bg});
1313
opacity: var(${highlight_opacity_var}, 0);
1414
}
1515
@media (prefers-color-scheme: dark) {
@@ -30,8 +30,8 @@ export const Highlight: ParentComponent<{
3030
class={highlight_element}
3131
style={{
3232
[highlight_color_var]: props.isSignal
33-
? ui.colors.amber[500]
34-
: ui.colors.cyan[400],
33+
? theme.colors.amber[500]
34+
: theme.colors.cyan[400],
3535
[highlight_opacity_var]: props.highlight ? 0.6 : 0,
3636
}}
3737
></div>

packages/frontend/src/ui/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export * from '@solid-devtools/shared/theme'
21
export * from './styles.tsx'
32

43
export * from './badge.tsx'
@@ -9,7 +8,7 @@ export type {IconComponent} from './icons.tsx'
98
export * from './owner-name.tsx'
109
export {Scrollable} from './scrollable.tsx'
1110
export {Skeleton} from './skeleton.tsx'
12-
export * as Splitter from './splitter.tsx'
11+
export * from './splitter.tsx'
1312

1413
export {CollapseToggle, ToggleButton} from './toggle-button.tsx'
1514
export {ToggleTabs, toggle_tab_color_var} from './toggle-tabs.tsx'

0 commit comments

Comments
 (0)