LCOV - code coverage report
Current view: top level - src/platform/keybindings/components - KeybindingCommandRows.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 7 7
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1           16 : <template>
       2              :   <RovingFocusItem as-child :tab-stop-id="command.rowId">
       3              :     <TableRow
       4              :       :id="command.rowId"
       5              :       :data-state="selected ? 'selected' : undefined"
       6              :       :aria-expanded="command.expandable ? expanded : undefined"
       7              :       @click="emit('activate')"
       8              :       @dblclick="emit('rowDblclick')"
       9              :       @contextmenu="emit('rowContextmenu', $event)"
      10              :       @keydown.context-menu.self.prevent="dispatchKeyboardContextMenu"
      11              :       @keydown.enter.self.prevent="emit('activate')"
      12              :       @keydown.shift.f10.self.prevent="dispatchKeyboardContextMenu"
      13              :       @keydown.space.self.prevent="emit('activate')"
      14              :     >
      15              :       <TableCell class="p-1">
      16              :         <div
      17              :           :class="
      18              :             cn(
      19              :               'flex min-w-0 items-center gap-1 truncate',
      20              :               !command.expandable && 'pl-5'
      21              :             )
      22              :           "
      23              :           :title="command.id"
      24              :         >
      25              :           <i
      26              :             v-if="command.expandable"
      27              :             :class="
      28              :               cn(
      29              :                 'icon-[lucide--chevron-right] text-muted-foreground transition-transform',
      30              :                 expanded && 'rotate-90'
      31              :               )
      32              :             "
      33              :           />
      34              :           <Tooltip
      35              :             v-if="
      36              :               command.keybindings.some(
      37              :                 (binding) => binding.combo.isBrowserReserved
      38              :               )
      39              :             "
      40              :           >
      41              :             <TooltipTrigger as-child>
      42              :               <i class="icon-[lucide--triangle-alert] text-warning" />
      43              :             </TooltipTrigger>
      44              :             <TooltipContent>{{
      45              :               $t('g.browserReservedKeybindingTooltip')
      46              :             }}</TooltipContent>
      47              :           </Tooltip>
      48              :           {{ command.label }}
      49              :         </div>
      50              :       </TableCell>
      51              :       <TableCell class="p-1">
      52              :         <KeybindingList
      53              :           :keybindings="command.keybindings"
      54              :           :is-modified="command.isModified"
      55              :         />
      56              :       </TableCell>
      57              :       <TableCell class="p-1">
      58              :         <span class="block truncate" :title="command.source">{{
      59              :           command.source || '-'
      60              :         }}</span>
      61              :       </TableCell>
      62              :       <TableCell class="p-1">
      63              :         <div class="flex justify-end" @click.stop @dblclick.stop>
      64              :           <Button
      65              :             v-if="command.keybindings.length === 1"
      66              :             :tooltip="$t('g.edit')"
      67              :             variant="textonly"
      68              :             size="icon"
      69              :             :aria-label="$t('g.edit')"
      70              :             @click="emit('edit', command.keybindings[0])"
      71              :           >
      72              :             <i class="icon-[lucide--pencil]" />
      73              :           </Button>
      74              :           <Button
      75              :             :tooltip="$t('g.addNewKeybinding')"
      76              :             variant="textonly"
      77              :             size="icon"
      78              :             :aria-label="$t('g.addNewKeybinding')"
      79              :             @click="emit('add')"
      80              :           >
      81              :             <i class="icon-[lucide--plus]" />
      82              :           </Button>
      83              :           <Button
      84              :             :tooltip="$t('g.reset')"
      85              :             variant="textonly"
      86              :             size="icon"
      87              :             :aria-label="$t('g.reset')"
      88              :             :disabled="!command.isModified"
      89              :             @click="emit('reset')"
      90              :           >
      91              :             <i class="icon-[lucide--rotate-ccw]" />
      92              :           </Button>
      93              :           <Button
      94              :             :tooltip="$t('g.delete')"
      95              :             variant="textonly"
      96              :             size="icon"
      97              :             :aria-label="$t('g.delete')"
      98              :             :disabled="command.keybindings.length === 0"
      99              :             @click="emit('remove')"
     100              :           >
     101              :             <i class="icon-[lucide--trash-2]" />
     102              :           </Button>
     103              :         </div>
     104              :       </TableCell>
     105              :     </TableRow>
     106              :   </RovingFocusItem>
     107              :   <TableRow v-if="expanded">
     108              :     <TableCell colspan="4" class="p-0">
     109              :       <div class="pl-4" data-testid="keybinding-expansion-content">
     110           12 :         <div
     111              :           v-for="(binding, index) in command.keybindings"
     112              :           :key="binding.combo.serialize()"
     113              :           data-testid="keybinding-expansion-binding"
     114              :           class="flex items-center justify-between border-b border-border/50 py-1.5 last:border-b-0"
     115              :         >
     116              :           <div class="flex items-center gap-4">
     117              :             <span class="text-muted-foreground">{{ command.label }}</span>
     118              :             <KeyComboDisplay
     119              :               :key-combo="binding.combo"
     120              :               :is-modified="command.isModified"
     121              :             />
     122              :           </div>
     123              :           <div class="flex">
     124              :             <Button
     125              :               :tooltip="$t('g.edit')"
     126              :               variant="textonly"
     127              :               size="icon"
     128              :               :aria-label="$t('g.edit')"
     129              :               @click="emit('edit', binding)"
     130              :             >
     131              :               <i class="icon-[lucide--pencil]" />
     132              :             </Button>
     133              :             <Button
     134              :               :tooltip="$t('g.removeKeybinding')"
     135              :               variant="textonly"
     136              :               size="icon"
     137              :               :aria-label="$t('g.removeKeybinding')"
     138              :               @click="emit('removeSingle', index)"
     139              :             >
     140              :               <i class="icon-[lucide--trash-2]" />
     141              :             </Button>
     142              :           </div>
     143              :         </div>
     144              :       </div>
     145              :     </TableCell>
     146              :   </TableRow>
     147              : </template>
     148              : 
     149              : <script setup lang="ts">
     150              : import { RovingFocusItem } from 'reka-ui'
     151              : 
     152              : import { cn } from '@comfyorg/tailwind-utils'
     153              : 
     154              : import Button from '@comfyorg/design-system/button/Button'
     155              : import TableCell from '@comfyorg/design-system/table/TableCell'
     156              : import TableRow from '@comfyorg/design-system/table/TableRow'
     157              : import Tooltip from '@comfyorg/design-system/tooltip/Tooltip'
     158              : import TooltipContent from '@comfyorg/design-system/tooltip/TooltipContent'
     159              : import TooltipTrigger from '@comfyorg/design-system/tooltip/TooltipTrigger'
     160              : import type { KeybindingImpl } from '@comfyorg/keybindings/keybinding'
     161              : import type { ComfyCommandImpl } from '@comfyorg/keybindings/commandStore'
     162              : 
     163              : import KeybindingList from './KeybindingList.vue'
     164              : import KeyComboDisplay from './KeyComboDisplay.vue'
     165              : 
     166              : const { command, expanded, selected } = defineProps<{
     167              :   command: Pick<ComfyCommandImpl, 'id' | 'source'> & {
     168              :     expandable: boolean
     169              :     isModified: boolean
     170              :     keybindings: KeybindingImpl[]
     171              :     label: string
     172              :     rowId: string
     173              :   }
     174              :   expanded: boolean
     175              :   selected: boolean
     176              : }>()
     177              : 
     178         2012 : const emit = defineEmits<{
     179              :   activate: []
     180              :   add: []
     181              :   edit: [binding: KeybindingImpl]
     182              :   remove: []
     183              :   removeSingle: [index: number]
     184              :   reset: []
     185              :   rowContextmenu: [event: Event]
     186              :   rowDblclick: []
     187              : }>()
     188              : 
     189            1 : function dispatchKeyboardContextMenu(event: KeyboardEvent) {
     190            1 :   if (!(event.currentTarget instanceof HTMLElement)) return
     191            1 :   const { left, bottom } = event.currentTarget.getBoundingClientRect()
     192            1 :   event.currentTarget.dispatchEvent(
     193              :     new MouseEvent('contextmenu', {
     194              :       bubbles: true,
     195              :       cancelable: true,
     196              :       clientX: left,
     197              :       clientY: bottom
     198              :     })
     199              :   )
     200              : }
     201              : </script>
        

Generated by: LCOV version 2.0-1