svelte-inspect-value
website·Indexed 32 days ago
https://inspect.eirik.spaceA Svelte component and utility for inspecting values, featuring a themeable interface with CSS variables, a Theme Editor, and a global panel via the addToPanel function. Documentation includes a detailed changelog from v0.1.3 to v0.11.3.
What's inside svelte-inspect-value
- svelte-inspect-value provides a collection of "JSON tree"-like value inspector components for Svelte. It serves as a developer utility to provide a live preview of application state, such as API data, form values, and promise states during development.
Use Inspect.Panel to create a fixed-position debug wrapper
Inspect.Panelis a fixed-position wrapper for theInspectcomponent. It supports resizing, repositioning, and customization. It accepts all props available toInspect, plus additional panel-specific properties. It can also render children, allowing developers to embed custom debugging tools or information within the panel.Understand Svelte Inspect theming with Base16
Svelte Inspect Value uses the base16-framework for its theming system. This means themes are defined using a set of 16 colors. Most existing base16 color schemes are compatible with Svelte Inspect. Note that while--base04and--base0Fare defined and available for use in custom components, they are not utilized by any of the default themes.Use keyboard shortcuts for Inspect component navigation
Value-nodes are focusable and can be controlled via keyboard:
↑/↓: Focus previous/next nodes→/←: Expand/collapse nodes or jump in/out of a scopeEnter: Expand a node and focus its first childCtrl/Cmd + F: Focus the search barCtrl/Cmd + E: Expand all top-level nodesCtrl/Cmd + C: Collapse all top-level nodes- While a node is focused, typing any text will focus the next visible node with matching text.
Control Inspect keyboard shortcuts
Value-nodes are focusable and can be controlled via keyboard:
↑/↓: Focus previous/next nodes.→/←: Expand/collapse nodes or jump in/out of an expandable scope.Enter: Expand a node and focus its first child.Ctrl/Cmd + F: Focus the search bar.Ctrl/Cmd + E: Expand all top-level nodes.Ctrl/Cmd + C: Collapse all top-level nodes.- Type to Focus: While a node is focused, typing any text will focus the next visible node with matching text.
Install svelte-inspect-value
Install thesvelte-inspect-valuepackage using your preferred package manager.npm install svelte-inspect-value # or pnpm add svelte-inspect-value # or bun add svelte-inspect-value # or yarn add svelte-inspect-valueUse keyboard shortcuts for svelte-inspect-value navigation
Value-nodes are focusable and can be controlled using the following keyboard shortcuts:
↑/↓: Focus previous/next nodes.→/←: Expand/collapse nodes or jump in/out of an expandable scope.Enter: Expand a node and focus its first child.Ctrl/Cmd + F: Focus the search bar.Ctrl/Cmd + E: Expand all top-level nodes.Ctrl/Cmd + C: Collapse all top-level nodes.
While a node is focused, typing any character will focus the next visible node with matching text.
Use keyboard shortcuts for Inspect component navigation
v0-8-0Value-nodes are focusable and can be controlled via the following keyboard shortcuts:
↑/↓: Focus previous/next nodes→/←: Expand/collapse nodes or jump in/out of an expandable scopeEnter: Expand a node and focus its first childCtrl/Cmd + F: Focus the search barCtrl/Cmd + E: Expand all top-level nodesCtrl/Cmd + C: Collapse all top-level nodes- While a node is focused, typing any text will focus the next visible node with matching text.
Use chainable inline configuration with InlineConfig
TheInlineConfigpattern allows for chainable inline configuration of components within a template. By chaining configuration properties, you can override global options and options previously set viawithOptions. The configuration chain is terminated by the.Okproperty, which returns the final configurable component and accepts the component's data props.<script> import Inspect from 'svelte-inspect-value' import data from './data.js' </script> <!-- Chain configuration properties and terminate with .Ok to pass data --> <Inspect.Values.Expand0.Config.Borderless.DoubleQuotes.DarkTheme.Ok {data} />Navigate Inspect components using keyboard shortcuts
Value-nodes are focusable and can be controlled via the following keyboard shortcuts:
↑/↓: Focus previous/next nodes.→/←: Expand/collapse nodes or jump in/out of an expandable scope.Enter: Expand a node and focus its first child.Ctrl/Cmd + F: Focus the search bar.Ctrl/Cmd + E: Expand all top-level nodes.Ctrl/Cmd + C: Collapse all top-level nodes.- While a node is focused, typing any text will focus the next visible node matching that text.
Narrow search results using prefixes and quotes
Refine search results by using specific prefixes to target different parts of the data structure. To require an exact match for a term, wrap it in double quotes.value:"1234" // Search for the exact value "1234" type:number // Search for values of type number key:email // Search within the keys of values path:user.name // Search within the path to a valueNavigate Inspect nodes using the keyboard
Every node, row, or line in Inspect is focusable. Use the
Tabkey in combination with the following shortcuts to navigate the tree. Keyboard navigation can be disabled by setting thedisableKeyNavoption or prop totrue.Key Action ↑Focus previous node ↓Focus next node EndFocus last node HomeFocus first node EnterExpand node and focus first child SpaceExpand / collapse node →If collapsed: expand node; If expanded: focus previously focused or first child node; Non-expandable: focus next node ←If collapsed: focus parent or previous node; If expanded: collapse node; Non-expandable: focus previous node