Huakun

inspect-value

Web Component value inspector — works in React, Vue, Angular, Svelte, or vanilla JS. Drop-in debug panel for any framework.

GitHub: https://github.com/HuakunShen/inspect-value
Documentation: https://huakunshen.github.io/inspect-value/

Overview

svelte-inspect-value as a Web Component — use in React, Vue, Angular, or plain HTML. Zero performance overhead. The same Svelte-compiled code runs inside a standard Custom Element.

Acknowledgement

This package is a Web Component wrapper around svelte-inspect-value by ampled. All core functionality, themes, and inspection capabilities come from the original Svelte library.

Installation

npm install inspect-value

Usage

Plain HTML / Vanilla JS

<script src="https://unpkg.com/inspect-value"></script>

<inspect-value id="inspector"></inspect-value>

<script>
  const el = document.getElementById("inspector");
  el.value = {
    hello: "world",
    nested: { array: [1, 2, 3] },
    date: new Date(),
  };
</script>

React

import "inspect-value";
import { useRef, useEffect } from "react";

function Inspector({ data }: { data: any }) {
  const ref = useRef<HTMLElement>(null);

  useEffect(() => {
    if (ref.current) {
      ref.current.value = data;
    }
  }, [data]);

  return <inspect-value ref={ref} theme="dark" />;
}

Vue

<script setup>
import "inspect-value";
import { ref } from "vue";
const data = ref({ hello: "world", nested: { array: [1, 2, 3] } });
</script>

<template>
  <inspect-value :value.prop="data" theme="dark" />
</template>

Components

<inspect-value>

PropertyTypeDefaultDescription
valueanyundefinedValue to inspect
namestring''Display name
themestring'default'Theme (default, dark, stereo, drak)
searchboolean/stringfalseEnable search
depthnumberInfinityMax expansion depth
expandAllbooleanfalseExpand all nodes

<inspect-panel>

Fixed-position panel variant for persistent debugging.

Features

  • Framework-agnostic Web Component
  • Multiple themes (default, dark, stereo, drak)
  • Search/filter capabilities
  • Collapsible tree view
  • Type annotations
  • Zero dependencies

On this page