diff --git a/devtools/app/components/ComponentCode.vue b/devtools/app/components/ComponentCode.vue index 750e7e22..db73d41b 100644 --- a/devtools/app/components/ComponentCode.vue +++ b/devtools/app/components/ComponentCode.vue @@ -32,6 +32,7 @@ const { data: formattedCode } = useAsyncData('__compodium-component-formatted-co }, { watch: [code] }) const { codeToHtml } = useShiki() + const { data: highlightedCode } = useAsyncData('__compodium-component-highlighted-code', async () => { return formattedCode.value ? codeToHtml(formattedCode.value, 'vue') diff --git a/devtools/app/components/ComponentPropInput.vue b/devtools/app/components/ComponentPropInput.vue index a67f406c..d4b41b3b 100644 --- a/devtools/app/components/ComponentPropInput.vue +++ b/devtools/app/components/ComponentPropInput.vue @@ -8,6 +8,7 @@ import ObjectInput from '../components/inputs/ObjectInput.vue' import ArrayInput from '../components/inputs/ArrayInput.vue' import PrimitiveArrayInput from '../components/inputs/PrimitiveArrayInput.vue' import DateInput from '../components/inputs/DateInput.vue' +import { createReusableTemplate } from '@vueuse/core' const inputTypes: Record = { array: ArrayInput, @@ -22,7 +23,7 @@ const inputTypes: Record = { diff --git a/devtools/app/components/JsonEditor.vue b/devtools/app/components/JsonEditor.vue new file mode 100644 index 00000000..a60dfd09 --- /dev/null +++ b/devtools/app/components/JsonEditor.vue @@ -0,0 +1,156 @@ + + + + + diff --git a/devtools/app/components/inputs/ArrayInput.vue b/devtools/app/components/inputs/ArrayInput.vue index ba3560a1..0d27f2e3 100644 --- a/devtools/app/components/inputs/ArrayInput.vue +++ b/devtools/app/components/inputs/ArrayInput.vue @@ -3,7 +3,7 @@ import type { ArrayInputSchema } from '#module/runtime/server/services/infer' defineProps<{ schema: ArrayInputSchema }>() -const modelValue = defineModel>({}) +const modelValue = defineModel>() function removeArrayItem(index: number) { if (!modelValue.value) return @@ -16,6 +16,7 @@ function addArrayItem() { } else { modelValue.value.push(null) } + openedItem.value = modelValue.value?.length - 1 } function updateValue(index: number, value: any) { @@ -23,29 +24,34 @@ function updateValue(index: number, value: any) { modelValue.value[index] = value modelValue.value = [...modelValue.value] } + +const openedItem = ref(0)