LCOV - code coverage report
Current view: top level - src/renderer/extensions/vueNodes/widgets/components - ValueControlPopover.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 9 9
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1           16 : <script setup lang="ts">
       2              : import { computed, useId } from 'vue'
       3              : 
       4              : import RadioGroup from '@comfyorg/design-system/radio-group/RadioGroup'
       5              : import RadioGroupItem from '@comfyorg/design-system/radio-group/RadioGroupItem'
       6              : import { useSettingStore } from '@/platform/settings/settingStore'
       7              : import type { ControlOptions } from '@/types/simplifiedWidget'
       8              : 
       9              : type ControlOption = {
      10              :   description: string
      11              :   mode: ControlOptions
      12              :   icon?: string
      13              :   text?: string
      14              :   title: string
      15              : }
      16              : 
      17          877 : const settingStore = useSettingStore()
      18            2 : const radioIdPrefix = useId()
      19              : 
      20            2 : const controlOptions: ControlOption[] = [
      21              :   {
      22              :     mode: 'fixed',
      23              :     icon: 'icon-[lucide--pencil-off]',
      24              :     title: 'fixed',
      25              :     description: 'fixedDesc'
      26              :   },
      27              :   {
      28              :     mode: 'increment',
      29              :     text: '+1',
      30              :     title: 'increment',
      31              :     description: 'incrementDesc'
      32              :   },
      33              :   {
      34              :     mode: 'decrement',
      35              :     text: '-1',
      36              :     title: 'decrement',
      37              :     description: 'decrementDesc'
      38              :   },
      39              :   {
      40              :     mode: 'randomize',
      41              :     icon: 'icon-[lucide--shuffle]',
      42              :     title: 'randomize',
      43              :     description: 'randomizeDesc'
      44              :   }
      45              : ]
      46              : 
      47            2 : const widgetControlMode = computed(() =>
      48              :   settingStore.get('Comfy.WidgetControlMode')
      49              : )
      50              : 
      51            2 : const controlMode = defineModel<ControlOptions>()
      52            2 : </script>
      53              : 
      54              : <template>
      55            4 :   <div class="w-113 max-w-md space-y-4 p-4">
      56              :     <div class="text-sm/tight text-muted-foreground">
      57              :       {{ $t('widgets.valueControl.header.prefix') }}
      58              :       <span class="font-medium text-foreground">
      59              :         {{
      60              :           widgetControlMode === 'before'
      61              :             ? $t('widgets.valueControl.header.before')
      62              :             : $t('widgets.valueControl.header.after')
      63              :         }}
      64              :       </span>
      65              :       {{ $t('widgets.valueControl.header.postfix') }}
      66              :     </div>
      67              : 
      68              :     <RadioGroup v-model="controlMode" class="flex-col space-y-2">
      69           32 :       <div
      70              :         v-for="option in controlOptions"
      71              :         :key="option.mode"
      72              :         class="flex h-[unset] w-full items-center justify-between gap-7 py-2 text-left"
      73              :       >
      74              :         <label
      75              :           :for="`${radioIdPrefix}-${option.mode}`"
      76              :           class="flex min-w-0 flex-1 cursor-pointer items-center gap-2 text-wrap"
      77              :         >
      78              :           <div
      79              :             class="flex size-8 shrink-0 items-center justify-center rounded-lg border border-border/50 bg-secondary"
      80              :           >
      81              :             <i
      82              :               v-if="option.icon"
      83              :               :class="option.icon"
      84              :               class="text-base text-foreground"
      85              :             />
      86              :             <span
      87              :               v-if="option.text"
      88              :               class="text-xs font-normal text-foreground"
      89              :             >
      90              :               {{ option.text }}
      91              :             </span>
      92              :           </div>
      93              : 
      94              :           <div
      95              :             class="flex min-w-0 flex-1 flex-col gap-0.5 text-sm/tight font-normal"
      96              :           >
      97              :             <div class="text-foreground">
      98              :               <span>
      99              :                 {{ $t(`widgets.valueControl.${option.title}`) }}
     100              :               </span>
     101              :             </div>
     102              :             <div class="text-muted-foreground">
     103              :               {{ $t(`widgets.valueControl.${option.description}`) }}
     104              :             </div>
     105              :           </div>
     106              :         </label>
     107              : 
     108              :         <RadioGroupItem
     109              :           :id="`${radioIdPrefix}-${option.mode}`"
     110              :           class="shrink"
     111              :           :value="option.mode"
     112              :         />
     113              :       </div>
     114              :     </RadioGroup>
     115              :   </div>
     116              : </template>
        

Generated by: LCOV version 2.0-1