@@ -10,6 +10,17 @@ import { instance, onVueInstanceUpdate } from '~/logic/app'
1010import { rootPath } from ' ~/logic/global'
1111
1212const componentTree = ref <ComponentTreeNode []>([])
13+ const filterName = ref (' ' )
14+
15+ const componentWalker = shallowRef <ComponentWalker | null >(null )
16+
17+ watchDebounced (filterName , (value ) => {
18+ value = value .trim ().toLowerCase ()
19+ componentWalker .value ! .componentFilter .setFilter (value )
20+ componentWalker .value ! .getComponentTree (instance .value ! ).then ((res ) => {
21+ componentTree .value = res
22+ })
23+ }, { debounce: 200 })
1324
1425function normalizeComponentState(value : unknown , type : string ) {
1526 if (type === ' Reactive' )
@@ -48,10 +59,10 @@ const normalizedComponentState = computed(() => {
4859})
4960
5061function init() {
51- const walker = new ComponentWalker (500 , null , true )
62+ componentWalker . value = new ComponentWalker (500 , null , true )
5263 selectedComponent .value = instance .value
5364 selectedComponentState .value = getInstanceState (instance .value ! )
54- walker .getComponentTree (instance .value ! ).then ((res ) => {
65+ componentWalker . value .getComponentTree (instance .value ! ).then ((res ) => {
5566 componentTree .value = res
5667 selectedComponentName .value = res ?.[0 ]?.name ?? ' '
5768 selectedComponentNode .value = res ?.[0 ]
@@ -77,6 +88,9 @@ function openInEditor() {
7788 <div h-screen n-panel-grids >
7889 <Splitpanes >
7990 <Pane border =" r base" >
91+ <div v-if =" componentWalker" w-full px10px py12px >
92+ <VDTextInput v-model =" filterName" placeholder =" Find components..." />
93+ </div >
8094 <div h-screen select-none overflow-scroll p-2 class =" no-scrollbar" >
8195 <ComponentTreeNode v-for =" (item) in componentTree" :key =" item.id" :data =" item" />
8296 </div >
0 commit comments