Debug panel for LiteForge applications with signal inspection, store time-travel, and performance monitoring.
npm install @liteforge/devtools @liteforge/corePeer dependency: @liteforge/core >= 0.1.0
import { defineApp } from '@liteforge/runtime'
import { devtoolsPlugin } from '@liteforge/devtools'
defineApp({
plugins: [
devtoolsPlugin({
shortcut: 'ctrl+shift+d', // Toggle shortcut
position: 'bottom', // 'bottom' | 'right' | 'left'
height: 300, // Panel height in pixels
defaultTab: 'signals' // Initial tab
})
]
}).mount(App)The devtools panel has five tabs:
- View all active signals and their current values
- See update counts for each signal
- Track dependency relationships
- Filter by signal name
- Inspect all registered stores
- View current state tree
- Time-travel debugging — restore any previous state
- Track state changes over time
- View navigation history
- See guard execution results
- Monitor route timing
- Inspect current route params and query
- Component tree visualization
- Mount/unmount tracking
- Component instance counts
- Lifecycle timing
- Signal updates per second
- Effect executions
- Component mount/unmount rate
- Memory usage indicators
Creates the devtools plugin for defineApp.
import { devtoolsPlugin } from '@liteforge/devtools'
devtoolsPlugin({
// Keyboard shortcut to toggle panel
shortcut: 'ctrl+shift+d',
// Panel position
position: 'bottom', // 'bottom' | 'right' | 'left'
// Panel size
height: 300, // For bottom position
width: 400, // For left/right position
// Initial tab
defaultTab: 'signals',
// Enable in production (default: false)
enableInProduction: false,
// Buffer size for events
bufferSize: 1000
})For standalone usage without defineApp:
import { createDevTools } from '@liteforge/devtools'
import { storeRegistry } from '@liteforge/store'
const devtools = createDevTools({
stores: storeRegistry,
shortcut: 'ctrl+shift+d'
})
// Manual control
devtools.show()
devtools.hide()
devtools.toggle()
devtools.destroy()| Shortcut | Action |
|---|---|
Ctrl+Shift+D |
Toggle panel (default) |
Escape |
Close panel |
1-5 |
Switch tabs (when panel focused) |
The Stores tab supports time-travel debugging:
- Make changes to store state
- Open the Stores tab
- See state history with timestamps
- Click any history entry to restore that state
// State changes are automatically recorded
userStore.actions.login(user)
userStore.actions.updateProfile(profile)
// In devtools, you can:
// - See each state change
// - Click to restore any previous state
// - Continue from that pointOnly load devtools in development:
import { defineApp } from '@liteforge/runtime'
const plugins = []
if (import.meta.env.DEV) {
const { devtoolsPlugin } = await import('@liteforge/devtools')
plugins.push(devtoolsPlugin())
}
defineApp({ plugins }).mount(App)Extend devtools with custom panels (advanced):
import { createDevTools } from '@liteforge/devtools'
const devtools = createDevTools({
stores: storeRegistry,
customPanels: [
{
id: 'network',
label: 'Network',
render: () => {
// Return DOM element
const div = document.createElement('div')
div.innerHTML = '<h3>Network Requests</h3>'
return div
}
}
]
})import type {
DevToolsConfig,
DevToolsInstance,
PanelPosition,
TabId,
PanelState,
SignalInfo,
StoreInfo,
StoreHistoryEntry,
NavigationInfo,
ComponentInfo,
PerformanceCounters
} from '@liteforge/devtools'MIT