Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d7e98da
Implement `inspectStoreNode`, move some grpah types to debugger
thetarnav Oct 23, 2022
ce8e9a9
debugger: Test `inspectStoreNode`
thetarnav Oct 23, 2022
cd20a14
debugger: Add inspect store unsub tests
thetarnav Oct 23, 2022
a6b55b0
Move serialization utils to the debugger
thetarnav Oct 24, 2022
f17207e
Combine inspector messages together, start listening for store updates
thetarnav Oct 25, 2022
614af9a
Unobserve stores
thetarnav Oct 25, 2022
d228d89
Display store value as an object
thetarnav Oct 25, 2022
e5c41b1
Add ids to store nodes
thetarnav Oct 28, 2022
b07f258
Unify and batch inspector updates
thetarnav Oct 29, 2022
b241473
Fix inspector updates
thetarnav Oct 29, 2022
2ad7f3b
Refactor inspector update batchig
thetarnav Oct 30, 2022
e847f33
Apply updates to proxy props object
thetarnav Oct 30, 2022
0e28237
Make the build pass
thetarnav Oct 31, 2022
8c5070d
WIP Update store values in devtools
thetarnav Nov 1, 2022
01c8fed
Add recursive demo, improve updating stores
thetarnav Nov 2, 2022
0149d38
Improve store updating
thetarnav Nov 2, 2022
1918ce4
Support multiple references in the same store
thetarnav Nov 3, 2022
571f13b
Change to solid/store api using global listener
thetarnav Nov 3, 2022
fa1e4b3
remove `wrapStores` transform
thetarnav Nov 3, 2022
bd4a175
Fix debugger tests
thetarnav Nov 4, 2022
0961709
Move more types to debugger from shared
thetarnav Nov 4, 2022
2d308b3
Show fine-grain updates to stores
thetarnav Nov 4, 2022
d63b31c
Add eslint (remove console logs)
thetarnav Nov 4, 2022
ba86e53
separate memos from stores and signals in the inspector
thetarnav Nov 4, 2022
7346cc1
Display values that are signals differently from rest
thetarnav Nov 5, 2022
1d50ecb
use chevron arrows to identify extendable values
thetarnav Nov 5, 2022
be2c617
Improve inspector styles
thetarnav Nov 5, 2022
1602447
Prevent inspecting non-object value items
thetarnav Nov 6, 2022
1990be5
Add changesets, remove object-observer dep
thetarnav Nov 6, 2022
543df9c
fix tests
thetarnav Nov 6, 2022
38529cc
Revert some changes to the playground
thetarnav Nov 6, 2022
d8fab27
minor cleanup
thetarnav Nov 6, 2022
7480fd4
Move useController call from Structure to Path component
thetarnav Nov 10, 2022
d0c102e
Update and correct dependencies
thetarnav Nov 11, 2022
15e4456
Use overlay in the sandbox
thetarnav Nov 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bright-mayflies-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@solid-devtools/transform': minor
---

Remove `wrapStores` transform — tracking stores is handled by the debugger.
6 changes: 6 additions & 0 deletions .changeset/empty-carrots-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@solid-devtools/debugger': minor
'@solid-devtools/shared': minor
---

Move value serialization logic to debugger
7 changes: 7 additions & 0 deletions .changeset/real-dolphins-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@solid-devtools/debugger': patch
'@solid-devtools/logger': patch
'@solid-devtools/shared': patch
---

Move some debugger related types from @solid-devtools/shared to @solid-devtools/debugger
11 changes: 11 additions & 0 deletions .changeset/wet-camels-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@solid-devtools/debugger': minor
'solid-devtools': minor
'solid-devtools-extension': minor
'@solid-devtools/frontend': minor
'@solid-devtools/logger': minor
'@solid-devtools/overlay': minor
'@solid-devtools/shared': minor
---

Move graph types from `@solid-devtools/shared` to `@solid-devtools/debugger`
6 changes: 6 additions & 0 deletions .changeset/witty-rockets-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@solid-devtools/debugger': minor
'@solid-devtools/frontend': minor
---

Track and show fine-grain updates to stores in inspected values.
12 changes: 12 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "no-only-tests"],
"ignorePatterns": ["node_modules", "dist", "scripts", "examples"],
"rules": {
"no-console": "warn",
"no-debugger": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"no-only-tests/no-only-tests": "warn"
}
}
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
- name: Install dependencies
run: pnpm install --no-frozen-lockfile

- name: Lint
run: pnpm lint

- name: Run Build and Tests
run: pnpm run build-test
env:
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
auto-install-peers=true
strict-peer-dependencies=false
link-workspace-packages=deep
1 change: 0 additions & 1 deletion configs/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"esModuleInterop": true,
"noEmit": true,
"skipLibCheck": true,
"noUnusedLocals": true,
"forceConsistentCasingInFileNames": true
}
}
1 change: 1 addition & 0 deletions configs/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default ({
return defineConfig(config => {
const options: Options = {
clean: config.watch ? false : true,
minify: config.watch ? false : true,
dts: {
entry: [entry, ...mappedAdditionalEntries],
},
Expand Down
2 changes: 1 addition & 1 deletion examples/clock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
},
"dependencies": {
"solid-devtools": "workspace:^0.20.1",
"solid-js": "^1.6.0"
"solid-js": "^1.6.2"
}
}
3 changes: 2 additions & 1 deletion examples/sandbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@babel/plugin-syntax-typescript": "^7.18.6",
"@solid-devtools/transform": "workspace:^0.7.5",
"typescript": "^4.8.4",
"unocss": "^0.46.3",
"vite": "^3.1.8",
"vite-plugin-solid": "^2.3.10"
},
Expand All @@ -24,6 +25,6 @@
"@solid-devtools/overlay": "workspace:^0.0.7",
"@solid-primitives/timer": "^1.3.4",
"solid-devtools": "workspace:^0.20.1",
"solid-js": "^1.6.0"
"solid-js": "^1.6.2"
}
}
42 changes: 36 additions & 6 deletions examples/sandbox/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
import Todos from './Todos'
import { disposeApp } from '.'
import { ThemeExample } from './Theme'
import { createMutable } from 'solid-js/store'
import Recursive from './Recursive'

const doMediumCalc = () => {
Array.from({ length: 1000000 }, (_, i) => i).sort(() => Math.random() - 5)
Expand Down Expand Up @@ -62,24 +64,51 @@ const PassChildren: ParentComponent = props => {
}

const Article: Component = () => {
const state = createMutable({
count: 0,
other: { name: 'article' },
content: {
title: 'A cool headline for testing :)',
body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorem odio culpa vel vitae? Quis deleniti soluta rem velit necessitatibus? ',
},
})

return (
<article>
<h3>A cool headline for testing :)</h3>
<h3>{state.content.title}</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorem odio culpa vel vitae? Quis
deleniti soluta rem velit necessitatibus?{' '}
{state.content.body}
<PassChildren>
<b>
Saepe nulla omnis nobis minima perferendis odio doloremque deleniti dolore corrupti.
</b>
</PassChildren>
</p>
{/* <p>Count: {state.count}</p> */}
<p>
<button onClick={() => state.count++}>Increment article count</button>
</p>
</article>
)
}

const obj = {
comp: () => <div>This is an object property component</div>,
const DynamicSpreadParent = () => {
const [props, setProps] = createSignal<any>({
a: 1,
b: 2,
c: 3,
style: { width: '160px', height: '30px', background: '#fcb', color: 'black' },
textContent: 'Before Change',
onclick: () =>
setProps({
style: { width: '160px', height: '30px', background: '#eba', color: 'black' },
textContent: 'After Change',
d: 4,
e: 5,
}),
})
const DynamicSpreadChild = (props: any) => <div {...props} />
return <DynamicSpreadChild {...props()} />
}

const App: Component = () => {
Expand Down Expand Up @@ -145,7 +174,7 @@ const App: Component = () => {
</PassChildren>
</div> */}
</div>
<obj.comp />
<DynamicSpreadParent />
<button onClick={() => setRootCount(p => ++p)}>Update root count</button>
<button onClick={() => disposeOuterRoot()}>Dispose OUTSIDE_ROOT</button>
<Article />
Expand All @@ -156,6 +185,7 @@ const App: Component = () => {
<div style={{ margin: '24px' }}>
<ThemeExample />
</div>
<Recursive />
</>
)
}
Expand Down
101 changes: 101 additions & 0 deletions examples/sandbox/src/Recursive.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { Component, For, splitProps, mergeProps, createContext, useContext } from 'solid-js'
import { createStore } from 'solid-js/store'

type NodeType = {
id: number
children?: Array<NodeType>
parents?: Array<number>
}

let id: number = 3

interface genNodePathInterface {
nodeId: number
parentsPath?: Array<number>
accessKey?: string
}
function genNodePath({ nodeId, parentsPath = [], accessKey = 'children' }: genNodePathInterface) {
let path = parentsPath.concat(nodeId)
let nodePath: Array<Function | string> = []
path.forEach(id => {
nodePath.push(...[(child: NodeType) => child.id === id, accessKey])
})
return nodePath
}

// Printed url path
function genNodeUrl(nodeProps: any) {
let urlFormat = `${nodeProps.id}`
let url = nodeProps?.url ? [...nodeProps.url, urlFormat] : [urlFormat]
return url
}

// Recursive component
const Node: Component<NodeType> = props => {
let [childrenProps, nodeProps] = splitProps(props, ['children'])
// To store local component signals
type nodeSignalsType = {
parents: Array<number>
url: Array<string>
}
const [nodeSignals, setNodeSignals] = createStore<nodeSignalsType>({
parents: nodeProps?.parents ? nodeProps?.parents : [],
url: genNodeUrl(nodeProps),
})

const addNode = useContext(RecursiveContext)

return (
<div class="border-2 rounded-lg p-1 space-y-1 m-1">
<p>{nodeSignals.url.join(' > ')}</p>
<For each={childrenProps.children}>
{node => {
const childProps = mergeProps(
{
parents: [...nodeSignals.parents, nodeProps.id],
url: nodeSignals.url,
},
node,
)
return <Node {...childProps} />
}}
</For>
<button
class="rounded-full bg-slate-300 px-2"
onClick={e => addNode(nodeProps.id, nodeSignals.parents)}
>
Add item
</button>
</div>
)
}

const RecursiveContext = createContext<(nodeId: number, parentsPath: number[]) => void>(() => {})

const Recursive: Component = props => {
const [data, setData] = createStore<NodeType[]>([
{
id: 0,
children: [
{ id: 1, children: [{ id: 2, children: [] }] },
{ id: 3, children: [] },
],
},
])

const addNode = (nodeId: number, parentsPath: number[]) => {
setData(
// @ts-ignore
...genNodePath({ nodeId, parentsPath }),
(children: any) => [...children, { id: ++id, children: [] }],
)
}

return (
<RecursiveContext.Provider value={addNode}>
<For each={data}>{page => <Node {...page} />}</For>
</RecursiveContext.Provider>
)
}

export default Recursive
21 changes: 7 additions & 14 deletions examples/sandbox/src/Theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,16 @@ export const ThemeProvider: ParentComponent<{
color?: string
title?: string
}> = props => {
const [color, setColor] = createSignal(props.color ?? defaultState.color)
const [title, setTitle] = createSignal(props.title ?? defaultState.title)
const [theme, setTheme] = createStore({
color: props.color || defaultState.color,
title: props.title || defaultState.title,
})

const changeColor = (color: string) => setColor(color)
const changeTitle = (title: string) => setTitle(title)

const state = {
get color() {
return color()
},
get title() {
return title()
},
}
const changeColor = (color: string) => setTheme('color', color)
const changeTitle = (title: string) => setTheme('title', title)

return (
<ThemeContext.Provider value={[state, { changeColor, changeTitle }]}>
<ThemeContext.Provider value={[theme, { changeColor, changeTitle }]}>
{props.children}
</ThemeContext.Provider>
)
Expand Down
Loading