LCOV - code coverage report
Current view: top level - src/types - nodeOrganizationTypes.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 1 1
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { ComfyNodeDefImpl } from '@/core/graph/nodeDef/ComfyNodeDefImpl'
       2              : import type {
       3              :   RenderedTreeExplorerNode,
       4              :   TreeNode
       5              : } from '@/types/treeExplorerTypes'
       6              : 
       7              : export type GroupingStrategyId = 'category' | 'module' | 'source'
       8              : export type SortingStrategyId = 'original' | 'alphabetical'
       9              : export type TabId = 'essentials' | 'all' | 'blueprints'
      10              : 
      11              : /**
      12              :  * Strategy for grouping nodes into tree structure
      13              :  */
      14              : export interface NodeGroupingStrategy {
      15              :   /** Unique identifier for the grouping strategy */
      16              :   id: string
      17              :   /** Display name for UI (i18n key) */
      18              :   label: string
      19              :   /** Icon class for the grouping option */
      20              :   icon: string
      21              :   /** Description for tooltips (i18n key) */
      22              :   description?: string
      23              :   /** Function to extract the tree path from a node definition */
      24              :   getNodePath: (nodeDef: ComfyNodeDefImpl) => string[]
      25              : }
      26              : 
      27              : /**
      28              :  * Strategy for sorting nodes within groups
      29              :  */
      30              : export interface NodeSortStrategy {
      31              :   /** Unique identifier for the sort strategy */
      32              :   id: string
      33              :   /** Display name for UI (i18n key) */
      34              :   label: string
      35              :   /** Icon class for the sort option */
      36              :   icon: string
      37              :   /** Description for tooltips (i18n key) */
      38              :   description?: string
      39              :   /** Compare function for sorting nodes within the same group */
      40              :   compare: (a: ComfyNodeDefImpl, b: ComfyNodeDefImpl) => number
      41              : }
      42              : 
      43              : /**
      44              :  * Options for organizing nodes
      45              :  */
      46              : export interface NodeOrganizationOptions {
      47              :   groupBy?: string
      48              :   sortBy?: string
      49              : }
      50              : 
      51              : export type NodeCategoryId =
      52              :   | 'blueprints'
      53              :   | 'comfyNodes'
      54              :   | 'extensions'
      55              :   | 'partnerNodes'
      56              : 
      57         2355 : export const NODE_CATEGORY_LABELS: Record<NodeCategoryId, string> = {
      58              :   blueprints: 'sideToolbar.nodeLibraryTab.sections.subgraphBlueprints',
      59              :   comfyNodes: 'sideToolbar.nodeLibraryTab.sections.comfyNodes',
      60              :   extensions: 'sideToolbar.nodeLibraryTab.sections.extensions',
      61              :   partnerNodes: 'sideToolbar.nodeLibraryTab.sections.partnerNodes'
      62              : }
      63              : 
      64              : export interface NodeLibrarySection<T = unknown> {
      65              :   category?: NodeCategoryId
      66              :   title?: string
      67              :   root: RenderedTreeExplorerNode<T>
      68              : }
      69              : 
      70              : export interface NodeSection {
      71              :   /** Tree of nodes in this section */
      72              :   tree: TreeNode<ComfyNodeDefImpl>
      73              :   /** Filter category identifier */
      74              :   category?: NodeCategoryId
      75              :   /** Section title (i18n key) for tabs that don't use category-based labels */
      76              :   title?: string
      77              : }
        

Generated by: LCOV version 2.0-1