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

            Line data    Source code
       1           16 : <template>
       2            6 :   <span class="relative inline-flex items-center justify-center">
       3              :     <i :class="mainIcon" />
       4              :     <i
       5              :       :class="
       6              :         cn(
       7              :           subIcon,
       8              :           'pointer-events-none absolute leading-none',
       9              :           positionX === 'left' ? 'left-0' : 'right-0',
      10              :           positionY === 'top' ? 'top-0' : 'bottom-0'
      11              :         )
      12              :       "
      13              :       :style="subIconStyle"
      14              :     />
      15              :   </span>
      16              : </template>
      17              : 
      18              : <script setup lang="ts">
      19              : import { computed } from 'vue'
      20              : 
      21              : import { cn } from '@comfyorg/tailwind-utils'
      22              : 
      23              : type Position = 'top' | 'bottom' | 'left' | 'right'
      24              : 
      25              : export interface OverlayIconProps {
      26              :   mainIcon: string
      27              :   subIcon: string
      28              :   positionX?: Position
      29              :   positionY?: Position
      30              :   offsetX?: number
      31              :   offsetY?: number
      32              :   subIconScale?: number
      33              : }
      34              : const {
      35              :   mainIcon,
      36              :   subIcon,
      37              :   positionX = 'right',
      38              :   positionY = 'bottom',
      39              :   offsetX = 0,
      40              :   offsetY = 0,
      41              :   subIconScale = 0.6
      42              : } = defineProps<OverlayIconProps>()
      43              : 
      44            6 : const textShadow = [
      45              :   `-1px -1px 0 rgba(0, 0, 0, 0.7)`,
      46              :   `1px -1px 0 rgba(0, 0, 0, 0.7)`,
      47              :   `-1px 1px 0 rgba(0, 0, 0, 0.7)`,
      48              :   `1px 1px 0 rgba(0, 0, 0, 0.7)`,
      49              :   `-1px 0 0 rgba(0, 0, 0, 0.7)`,
      50              :   `1px 0 0 rgba(0, 0, 0, 0.7)`,
      51              :   `0 -1px 0 rgba(0, 0, 0, 0.7)`,
      52              :   `0 1px 0 rgba(0, 0, 0, 0.7)`
      53              : ].join(', ')
      54              : 
      55            6 : const subIconStyle = computed(() => ({
      56              :   scale: subIconScale,
      57              :   transformOrigin: `${positionX} ${positionY}`,
      58              :   textShadow,
      59              :   ...(offsetX !== 0 && {
      60              :     [positionX === 'left' ? 'left' : 'right']: `${offsetX}px`
      61              :   }),
      62              :   ...(offsetY !== 0 && {
      63              :     [positionY === 'top' ? 'top' : 'bottom']: `${offsetY}px`
      64              :   })
      65              : }))
      66              : </script>
        

Generated by: LCOV version 2.0-1