11<script setup lang="ts">
22import { VueButton , VueDropdown , VueDropdownButton , VueIcon , VTooltip as vTooltip } from ' @vue/devtools-ui'
3+ import { getRawValue } from ' @vue/devtools-kit'
34import type { InspectorState , InspectorStateEditorPayload } from ' @vue/devtools-kit'
45import type { ButtonProps } from ' @vue/devtools-ui/dist/types/src/components/Button'
56import { useDevToolsBridgeRpc } from ' @vue/devtools-core'
@@ -28,9 +29,8 @@ const { copy, isSupported } = useClipboard()
2829
2930const popupVisible = ref (false )
3031
31- const dataType = computed (() => {
32- return typeof props .data .value
33- })
32+ const rawValue = computed (() => getRawValue (props .data .value ).value )
33+ const dataType = computed (() => typeof rawValue .value )
3434
3535const iconButtonProps = {
3636 flat: true ,
@@ -77,7 +77,7 @@ function quickEdit(v: unknown, remove: boolean = false) {
7777 v-tooltip =" {
7878 content: 'Add new value',
7979 }" v-bind =" iconButtonProps" :class =" buttonClass" @click.stop ="
80- $emit('addNewProp', Array.isArray(data.value ) ? 'array' : 'object')"
80+ $emit('addNewProp', Array.isArray(rawValue ) ? 'array' : 'object')"
8181 >
8282 <template #icon >
8383 <VueIcon icon =" i-material-symbols-add-circle-rounded" />
@@ -87,28 +87,28 @@ function quickEdit(v: unknown, remove: boolean = false) {
8787 <!-- checkbox, button value only -->
8888 <VueButton
8989 v-if =" dataType === 'boolean'" v-bind =" iconButtonProps" :class =" buttonClass"
90- @click =" quickEdit(!data.value )"
90+ @click =" quickEdit(!rawValue )"
9191 >
9292 <template #icon >
93- <VueIcon :icon =" data.value ? 'i-material-symbols-check-box-sharp' : 'i-material-symbols-check-box-outline-blank-sharp'" />
93+ <VueIcon :icon =" rawValue ? 'i-material-symbols-check-box-sharp' : 'i-material-symbols-check-box-outline-blank-sharp'" />
9494 </template >
9595 </VueButton >
9696 <!-- increment/decrement button, numeric value only -->
9797 <template v-else-if =" dataType === ' number' " >
98- <VueButton v-bind =" iconButtonProps" :class =" buttonClass" @click =" quickEdit((data.value as number) + 1)" >
98+ <VueButton v-bind =" iconButtonProps" :class =" buttonClass" @click =" quickEdit((rawValue as number) + 1)" >
9999 <template #icon >
100100 <VueIcon icon =" i-carbon-add" />
101101 </template >
102102 </VueButton >
103- <VueButton v-bind =" iconButtonProps" :class =" buttonClass" @click =" quickEdit((data.value as number) - 1)" >
103+ <VueButton v-bind =" iconButtonProps" :class =" buttonClass" @click =" quickEdit((rawValue as number) - 1)" >
104104 <template #icon >
105105 <VueIcon icon =" i-carbon-subtract" />
106106 </template >
107107 </VueButton >
108108 </template >
109109 </template >
110110 <!-- delete prop, only appear if depth > 0 -->
111- <VueButton v-if =" !props.disableEdit && depth > 0" v-bind =" iconButtonProps" :class =" buttonClass" @click =" quickEdit(data.value , true)" >
111+ <VueButton v-if =" !props.disableEdit && depth > 0" v-bind =" iconButtonProps" :class =" buttonClass" @click =" quickEdit(rawValue , true)" >
112112 <template #icon >
113113 <VueIcon icon =" i-material-symbols-delete-rounded" />
114114 </template >
@@ -128,7 +128,7 @@ function quickEdit(v: unknown, remove: boolean = false) {
128128 <template #popper >
129129 <div class =" w160px py5px" >
130130 <VueDropdownButton
131- @click =" copy(dataType === 'object' ? JSON.stringify(data.value ) : data.value .toString())"
131+ @click =" copy(dataType === 'object' ? JSON.stringify(rawValue ) : rawValue .toString())"
132132 >
133133 <template #icon >
134134 <VueIcon icon =" i-material-symbols-copy-all-rounded" class =" mt4px" />
0 commit comments