item.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <script setup lang="ts">
  2. import type { ProgramObject } from '~/types'
  3. withDefaults(defineProps<{
  4. item: ProgramObject
  5. depth?: number
  6. }>(), {
  7. depth: 0,
  8. })
  9. const isExpanded = ref(false)
  10. </script>
  11. <template>
  12. <div
  13. class="text-sm text-gray-400 font-mono"
  14. >
  15. <div
  16. class="flex gap-2 items-end cursor-pointer pt2 mb2"
  17. @click="isExpanded = !isExpanded"
  18. >
  19. <span
  20. v-if="depth > 0"
  21. class="h-1 border-b border-gray-300 w-4"
  22. />
  23. <div class="flex gap-2 items-center -mb2.5">
  24. <i :class="item.icon" />
  25. <!-- <Icon :name="item.icon" /> -->
  26. <!-- <i :class="item.icon" /> -->{{ item.type }} <UBadge
  27. v-if="item.name "
  28. variant="soft"
  29. >
  30. {{ item.name }}
  31. </UBadge>
  32. </div>
  33. </div>
  34. <div
  35. v-if="isExpanded"
  36. >
  37. <div class="p4 text-gray-400 text-xs font-mono">
  38. <p class="text-xs font-bold text-gray-600 mb2">
  39. Uniforms
  40. </p>
  41. <div
  42. v-for="[key, value] in Object.entries(item.uniforms.map)"
  43. :key="key"
  44. >
  45. {{ key }} <UBadge
  46. color="gray"
  47. variant="soft"
  48. >
  49. {{ value?.cache[value?.cache.length - 1] }}
  50. </UBadge>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </template>