LCOV - code coverage report
Current view: top level - packages/design-system/src/components/content-card - CardTop.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 6 6
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : <template>
       2         2127 :   <div :class="topStyle">
       3              :     <slot class="absolute top-0 left-0 size-full"></slot>
       4              : 
       5              :     <div v-if="slots['top-left']" :class="slotClasses['top-left']">
       6              :       <slot name="top-left"></slot>
       7              :     </div>
       8              : 
       9              :     <div v-if="slots['top-right']" :class="slotClasses['top-right']">
      10              :       <slot name="top-right"></slot>
      11              :     </div>
      12              : 
      13              :     <div v-if="slots['center-left']" :class="slotClasses['center-left']">
      14              :       <slot name="center-left"></slot>
      15              :     </div>
      16              : 
      17              :     <div v-if="slots['center-right']" :class="slotClasses['center-right']">
      18              :       <slot name="center-right"></slot>
      19              :     </div>
      20              : 
      21              :     <div v-if="slots['bottom-left']" :class="slotClasses['bottom-left']">
      22              :       <slot name="bottom-left"></slot>
      23              :     </div>
      24              : 
      25              :     <div v-if="slots['bottom-right']" :class="slotClasses['bottom-right']">
      26              :       <slot name="bottom-right"></slot>
      27              :     </div>
      28              :   </div>
      29              : </template>
      30              : 
      31              : <script setup lang="ts">
      32              : import { computed, useSlots } from 'vue'
      33              : 
      34              : import { cn } from '@comfyorg/tailwind-utils'
      35              : 
      36         1802 : const slots = useSlots()
      37              : 
      38              : const {
      39              :   ratio = 'square',
      40              :   topLeftClass,
      41              :   topRightClass,
      42              :   centerLeftClass,
      43              :   centerRightClass,
      44              :   bottomLeftClass,
      45              :   bottomRightClass
      46              : } = defineProps<{
      47              :   ratio?: 'square' | 'landscape'
      48              :   topLeftClass?: string
      49              :   topRightClass?: string
      50              :   centerLeftClass?: string
      51              :   centerRightClass?: string
      52              :   bottomLeftClass?: string
      53              :   bottomRightClass?: string
      54              : }>()
      55              : 
      56         1802 : const topStyle = computed(() => {
      57              :   const baseClasses = 'relative p-0 overflow-hidden'
      58              : 
      59              :   const ratioClasses = {
      60              :     square: 'aspect-square',
      61              :     landscape: 'aspect-48/27'
      62              :   }
      63              : 
      64         1802 :   return `${baseClasses} ${ratioClasses[ratio]}`
      65              : })
      66              : 
      67         1802 : const defaultSlotClasses = {
      68              :   'top-left': 'absolute top-2 left-2 flex flex-wrap justify-start gap-2',
      69              :   'top-right': 'absolute top-2 right-2 flex flex-wrap justify-end gap-2',
      70              :   'center-left':
      71              :     'absolute top-1/2 left-2 flex -translate-y-1/2 flex-wrap justify-start gap-2',
      72              :   'center-right':
      73              :     'absolute top-1/2 right-2 flex -translate-y-1/2 flex-wrap justify-end gap-2',
      74              :   'bottom-left': 'absolute bottom-2 left-2 flex flex-wrap justify-start gap-2',
      75              :   'bottom-right': 'absolute right-2 bottom-2 flex flex-wrap justify-end gap-2'
      76              : }
      77              : 
      78         1802 : const slotClasses = computed(() => ({
      79              :   'top-left': cn(defaultSlotClasses['top-left'], topLeftClass),
      80              :   'top-right': cn(defaultSlotClasses['top-right'], topRightClass),
      81              :   'center-left': cn(defaultSlotClasses['center-left'], centerLeftClass),
      82              :   'center-right': cn(defaultSlotClasses['center-right'], centerRightClass),
      83              :   'bottom-left': cn(defaultSlotClasses['bottom-left'], bottomLeftClass),
      84              :   'bottom-right': cn(defaultSlotClasses['bottom-right'], bottomRightClass)
      85              : }))
      86              : </script>
        

Generated by: LCOV version 2.0-1