mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 18:52:19 +00:00
[refactor] Extract keybinding functionality into @comfyorg/keybinding package
Create framework-agnostic keybinding package following domain-driven design patterns. Move pure business logic to package while keeping Vue integration in workbench layer. Changes: - Add @comfyorg/keybinding package with KeyComboImpl and KeybindingImpl classes - Move core keybindings and reserved key constants to package - Update workbench layer to import from package with backward compatibility - Update all imports across codebase to use package exports - Maintain existing API surface for consumers
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import type { KeyCombo } from '@comfyorg/keybinding'
|
||||||
import type { APIRequestContext, Locator, Page } from '@playwright/test'
|
import type { APIRequestContext, Locator, Page } from '@playwright/test'
|
||||||
import { expect } from '@playwright/test'
|
import { expect } from '@playwright/test'
|
||||||
import { test as base } from '@playwright/test'
|
import { test as base } from '@playwright/test'
|
||||||
@@ -6,7 +7,6 @@ import * as fs from 'fs'
|
|||||||
|
|
||||||
import type { LGraphNode } from '../../src/lib/litegraph/src/litegraph'
|
import type { LGraphNode } from '../../src/lib/litegraph/src/litegraph'
|
||||||
import type { NodeId } from '../../src/platform/workflow/validation/schemas/workflowSchema'
|
import type { NodeId } from '../../src/platform/workflow/validation/schemas/workflowSchema'
|
||||||
import type { KeyCombo } from '../../src/schemas/keyBindingSchema'
|
|
||||||
import type { useWorkspaceStore } from '../../src/stores/workspaceStore'
|
import type { useWorkspaceStore } from '../../src/stores/workspaceStore'
|
||||||
import { NodeBadgeMode } from '../../src/types/nodeSource'
|
import { NodeBadgeMode } from '../../src/types/nodeSource'
|
||||||
import { ComfyActionbar } from '../helpers/actionbar'
|
import { ComfyActionbar } from '../helpers/actionbar'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import type { Keybinding } from '@comfyorg/keybinding'
|
||||||
import type { Locator } from '@playwright/test'
|
import type { Locator } from '@playwright/test'
|
||||||
import { expect } from '@playwright/test'
|
import { expect } from '@playwright/test'
|
||||||
|
|
||||||
import type { Keybinding } from '../../src/schemas/keyBindingSchema'
|
|
||||||
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
||||||
|
|
||||||
test.beforeEach(async ({ comfyPage }) => {
|
test.beforeEach(async ({ comfyPage }) => {
|
||||||
|
|||||||
@@ -107,6 +107,7 @@
|
|||||||
"@atlaskit/pragmatic-drag-and-drop": "^1.3.1",
|
"@atlaskit/pragmatic-drag-and-drop": "^1.3.1",
|
||||||
"@comfyorg/comfyui-electron-types": "0.4.73-0",
|
"@comfyorg/comfyui-electron-types": "0.4.73-0",
|
||||||
"@comfyorg/design-system": "workspace:*",
|
"@comfyorg/design-system": "workspace:*",
|
||||||
|
"@comfyorg/keybinding": "workspace:*",
|
||||||
"@comfyorg/registry-types": "workspace:*",
|
"@comfyorg/registry-types": "workspace:*",
|
||||||
"@comfyorg/tailwind-utils": "workspace:*",
|
"@comfyorg/tailwind-utils": "workspace:*",
|
||||||
"@iconify/json": "^2.2.380",
|
"@iconify/json": "^2.2.380",
|
||||||
|
|||||||
29
packages/keybinding/package.json
Normal file
29
packages/keybinding/package.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "@comfyorg/keybinding",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"description": "Framework-agnostic keybinding system for ComfyUI",
|
||||||
|
"main": "./src/index.ts",
|
||||||
|
"types": "./src/index.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./src/index.ts",
|
||||||
|
"types": "./src/index.ts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"typecheck": "tsc --noEmit"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:shared",
|
||||||
|
"type:lib"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"zod": "^3.22.4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.4.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Keybinding } from '@/platform/keybinding/types/keybinding'
|
import type { Keybinding } from '../types/keybinding'
|
||||||
|
|
||||||
export const CORE_KEYBINDINGS: Keybinding[] = [
|
export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||||
{
|
{
|
||||||
11
packages/keybinding/src/index.ts
Normal file
11
packages/keybinding/src/index.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// Types
|
||||||
|
export type * from './types/keybinding'
|
||||||
|
export { zKeybinding } from './types/keybinding'
|
||||||
|
|
||||||
|
// Models (Implementation classes)
|
||||||
|
export { KeyComboImpl } from './models/KeyCombo'
|
||||||
|
export { KeybindingImpl } from './models/Keybinding'
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
export { CORE_KEYBINDINGS } from './constants/coreKeybindings'
|
||||||
|
export { RESERVED_BY_TEXT_INPUT } from './constants/reservedKeyCombos'
|
||||||
83
packages/keybinding/src/models/KeyCombo.ts
Normal file
83
packages/keybinding/src/models/KeyCombo.ts
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
import { RESERVED_BY_TEXT_INPUT } from '../constants/reservedKeyCombos'
|
||||||
|
import type { KeyCombo } from '../types/keybinding'
|
||||||
|
|
||||||
|
export class KeyComboImpl implements KeyCombo {
|
||||||
|
key: string
|
||||||
|
// ctrl or meta(cmd on mac)
|
||||||
|
ctrl: boolean
|
||||||
|
alt: boolean
|
||||||
|
shift: boolean
|
||||||
|
|
||||||
|
constructor(obj: KeyCombo) {
|
||||||
|
this.key = obj.key
|
||||||
|
this.ctrl = obj.ctrl ?? false
|
||||||
|
this.alt = obj.alt ?? false
|
||||||
|
this.shift = obj.shift ?? false
|
||||||
|
}
|
||||||
|
|
||||||
|
static fromEvent(event: KeyboardEvent) {
|
||||||
|
return new KeyComboImpl({
|
||||||
|
key: event.key,
|
||||||
|
ctrl: event.ctrlKey || event.metaKey,
|
||||||
|
alt: event.altKey,
|
||||||
|
shift: event.shiftKey
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
equals(other: unknown): boolean {
|
||||||
|
return other instanceof KeyComboImpl
|
||||||
|
? this.key.toUpperCase() === other.key.toUpperCase() &&
|
||||||
|
this.ctrl === other.ctrl &&
|
||||||
|
this.alt === other.alt &&
|
||||||
|
this.shift === other.shift
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
|
||||||
|
serialize(): string {
|
||||||
|
return `${this.key.toUpperCase()}:${this.ctrl}:${this.alt}:${this.shift}`
|
||||||
|
}
|
||||||
|
|
||||||
|
toString(): string {
|
||||||
|
return this.getKeySequences().join(' + ')
|
||||||
|
}
|
||||||
|
|
||||||
|
get hasModifier(): boolean {
|
||||||
|
return this.ctrl || this.alt || this.shift
|
||||||
|
}
|
||||||
|
|
||||||
|
get isModifier(): boolean {
|
||||||
|
return ['Control', 'Meta', 'Alt', 'Shift'].includes(this.key)
|
||||||
|
}
|
||||||
|
|
||||||
|
get modifierCount(): number {
|
||||||
|
const modifiers = [this.ctrl, this.alt, this.shift]
|
||||||
|
return modifiers.reduce((acc, cur) => acc + Number(cur), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
get isShiftOnly(): boolean {
|
||||||
|
return this.shift && this.modifierCount === 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get isReservedByTextInput(): boolean {
|
||||||
|
return (
|
||||||
|
!this.hasModifier ||
|
||||||
|
this.isShiftOnly ||
|
||||||
|
RESERVED_BY_TEXT_INPUT.has(this.toString())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
getKeySequences(): string[] {
|
||||||
|
const sequences: string[] = []
|
||||||
|
if (this.ctrl) {
|
||||||
|
sequences.push('Ctrl')
|
||||||
|
}
|
||||||
|
if (this.alt) {
|
||||||
|
sequences.push('Alt')
|
||||||
|
}
|
||||||
|
if (this.shift) {
|
||||||
|
sequences.push('Shift')
|
||||||
|
}
|
||||||
|
sequences.push(this.key)
|
||||||
|
return sequences
|
||||||
|
}
|
||||||
|
}
|
||||||
22
packages/keybinding/src/models/Keybinding.ts
Normal file
22
packages/keybinding/src/models/Keybinding.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import type { Keybinding } from '../types/keybinding'
|
||||||
|
import { KeyComboImpl } from './KeyCombo'
|
||||||
|
|
||||||
|
export class KeybindingImpl implements Keybinding {
|
||||||
|
commandId: string
|
||||||
|
combo: KeyComboImpl
|
||||||
|
targetElementId?: string
|
||||||
|
|
||||||
|
constructor(obj: Keybinding) {
|
||||||
|
this.commandId = obj.commandId
|
||||||
|
this.combo = new KeyComboImpl(obj.combo)
|
||||||
|
this.targetElementId = obj.targetElementId
|
||||||
|
}
|
||||||
|
|
||||||
|
equals(other: unknown): boolean {
|
||||||
|
return other instanceof KeybindingImpl
|
||||||
|
? this.commandId === other.commandId &&
|
||||||
|
this.combo.equals(other.combo) &&
|
||||||
|
this.targetElementId === other.targetElementId
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
}
|
||||||
12
packages/keybinding/tsconfig.json
Normal file
12
packages/keybinding/tsconfig.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"declaration": true,
|
||||||
|
"declarationMap": true,
|
||||||
|
"outDir": "./dist",
|
||||||
|
"rootDir": "./src"
|
||||||
|
},
|
||||||
|
"include": ["src/**/*"],
|
||||||
|
"exclude": ["node_modules", "dist"]
|
||||||
|
}
|
||||||
13
pnpm-lock.yaml
generated
13
pnpm-lock.yaml
generated
@@ -20,6 +20,9 @@ importers:
|
|||||||
'@comfyorg/design-system':
|
'@comfyorg/design-system':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:packages/design-system
|
version: link:packages/design-system
|
||||||
|
'@comfyorg/keybinding':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:packages/keybinding
|
||||||
'@comfyorg/registry-types':
|
'@comfyorg/registry-types':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:packages/registry-types
|
version: link:packages/registry-types
|
||||||
@@ -371,6 +374,16 @@ importers:
|
|||||||
specifier: ^5.4.5
|
specifier: ^5.4.5
|
||||||
version: 5.9.2
|
version: 5.9.2
|
||||||
|
|
||||||
|
packages/keybinding:
|
||||||
|
dependencies:
|
||||||
|
zod:
|
||||||
|
specifier: ^3.22.4
|
||||||
|
version: 3.24.1
|
||||||
|
devDependencies:
|
||||||
|
typescript:
|
||||||
|
specifier: ^5.4.5
|
||||||
|
version: 5.9.2
|
||||||
|
|
||||||
packages/registry-types: {}
|
packages/registry-types: {}
|
||||||
|
|
||||||
packages/shared-frontend-utils:
|
packages/shared-frontend-utils:
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import type { Keybinding } from '@comfyorg/keybinding'
|
||||||
|
|
||||||
import { LinkMarkerShape, LiteGraph } from '@/lib/litegraph/src/litegraph'
|
import { LinkMarkerShape, LiteGraph } from '@/lib/litegraph/src/litegraph'
|
||||||
import type { Keybinding } from '@/platform/keybinding/types/keybinding'
|
|
||||||
import { useSettingStore } from '@/platform/settings/settingStore'
|
import { useSettingStore } from '@/platform/settings/settingStore'
|
||||||
import type { SettingParams } from '@/platform/settings/types'
|
import type { SettingParams } from '@/platform/settings/types'
|
||||||
import type { ColorPalettes } from '@/schemas/colorPaletteSchema'
|
import type { ColorPalettes } from '@/schemas/colorPaletteSchema'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { zKeybinding } from '@comfyorg/keybinding'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
import { LinkMarkerShape } from '@/lib/litegraph/src/litegraph'
|
import { LinkMarkerShape } from '@/lib/litegraph/src/litegraph'
|
||||||
import { zKeybinding } from '@/platform/keybinding/types/keybinding'
|
|
||||||
import {
|
import {
|
||||||
zComfyWorkflow,
|
zComfyWorkflow,
|
||||||
zNodeId
|
zNodeId
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { KeyComboImpl } from '@comfyorg/keybinding'
|
||||||
import _ from 'es-toolkit/compat'
|
import _ from 'es-toolkit/compat'
|
||||||
import type { ToastMessageOptions } from 'primevue/toast'
|
import type { ToastMessageOptions } from 'primevue/toast'
|
||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
@@ -80,10 +81,7 @@ import {
|
|||||||
} from '@/utils/migration/migrateReroute'
|
} from '@/utils/migration/migrateReroute'
|
||||||
import { getSelectedModelsMetadata } from '@/utils/modelMetadataUtil'
|
import { getSelectedModelsMetadata } from '@/utils/modelMetadataUtil'
|
||||||
import { deserialiseAndCreate } from '@/utils/vintageClipboard'
|
import { deserialiseAndCreate } from '@/utils/vintageClipboard'
|
||||||
import {
|
import { useKeybindingStore } from '@/workbench/keybindings/stores/keybindingStore'
|
||||||
KeyComboImpl,
|
|
||||||
useKeybindingStore
|
|
||||||
} from '@/workbench/keybindings/stores/keybindingStore'
|
|
||||||
|
|
||||||
import { type ComfyApi, PromptExecutionError, api } from './api'
|
import { type ComfyApi, PromptExecutionError, api } from './api'
|
||||||
import { defaultGraph } from './defaultGraph'
|
import { defaultGraph } from './defaultGraph'
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
import type { Keybinding } from '@comfyorg/keybinding'
|
||||||
|
|
||||||
import type { Positionable } from '@/lib/litegraph/src/interfaces'
|
import type { Positionable } from '@/lib/litegraph/src/interfaces'
|
||||||
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
||||||
import type { Keybinding } from '@/platform/keybinding/types/keybinding'
|
|
||||||
import type { SettingParams } from '@/platform/settings/types'
|
import type { SettingParams } from '@/platform/settings/types'
|
||||||
import type { ComfyWorkflowJSON } from '@/platform/workflow/validation/schemas/workflowSchema'
|
import type { ComfyWorkflowJSON } from '@/platform/workflow/validation/schemas/workflowSchema'
|
||||||
import type { ComfyNodeDef } from '@/schemas/nodeDefSchema'
|
import type { ComfyNodeDef } from '@/schemas/nodeDefSchema'
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import { CORE_KEYBINDINGS } from '@/platform/keybinding/constants/coreKeybindings'
|
import {
|
||||||
|
CORE_KEYBINDINGS,
|
||||||
|
KeyComboImpl,
|
||||||
|
KeybindingImpl
|
||||||
|
} from '@comfyorg/keybinding'
|
||||||
|
|
||||||
import { useSettingStore } from '@/platform/settings/settingStore'
|
import { useSettingStore } from '@/platform/settings/settingStore'
|
||||||
import { app } from '@/scripts/app'
|
import { app } from '@/scripts/app'
|
||||||
import { useCommandStore } from '@/stores/commandStore'
|
import { useCommandStore } from '@/stores/commandStore'
|
||||||
import { useDialogStore } from '@/stores/dialogStore'
|
import { useDialogStore } from '@/stores/dialogStore'
|
||||||
import {
|
import { useKeybindingStore } from '@/workbench/keybindings/stores/keybindingStore'
|
||||||
KeyComboImpl,
|
|
||||||
KeybindingImpl,
|
|
||||||
useKeybindingStore
|
|
||||||
} from '@/workbench/keybindings/stores/keybindingStore'
|
|
||||||
|
|
||||||
export const useKeybindingService = () => {
|
export const useKeybindingService = () => {
|
||||||
const keybindingStore = useKeybindingStore()
|
const keybindingStore = useKeybindingStore()
|
||||||
|
|||||||
@@ -1,118 +1,11 @@
|
|||||||
|
import { KeyComboImpl, KeybindingImpl } from '@comfyorg/keybinding'
|
||||||
import _ from 'es-toolkit/compat'
|
import _ from 'es-toolkit/compat'
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import { computed, ref, toRaw } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
|
|
||||||
import { RESERVED_BY_TEXT_INPUT } from '@/base/keybinding/reservedKeyCombos'
|
// Re-export classes from package for backward compatibility
|
||||||
import type {
|
export { KeybindingImpl, KeyComboImpl }
|
||||||
KeyCombo,
|
|
||||||
Keybinding
|
|
||||||
} from '@/platform/keybinding/types/keybinding'
|
|
||||||
|
|
||||||
export class KeybindingImpl implements Keybinding {
|
|
||||||
commandId: string
|
|
||||||
combo: KeyComboImpl
|
|
||||||
targetElementId?: string
|
|
||||||
|
|
||||||
constructor(obj: Keybinding) {
|
|
||||||
this.commandId = obj.commandId
|
|
||||||
this.combo = new KeyComboImpl(obj.combo)
|
|
||||||
this.targetElementId = obj.targetElementId
|
|
||||||
}
|
|
||||||
|
|
||||||
equals(other: unknown): boolean {
|
|
||||||
const raw = toRaw(other)
|
|
||||||
|
|
||||||
return raw instanceof KeybindingImpl
|
|
||||||
? this.commandId === raw.commandId &&
|
|
||||||
this.combo.equals(raw.combo) &&
|
|
||||||
this.targetElementId === raw.targetElementId
|
|
||||||
: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class KeyComboImpl implements KeyCombo {
|
|
||||||
key: string
|
|
||||||
// ctrl or meta(cmd on mac)
|
|
||||||
ctrl: boolean
|
|
||||||
alt: boolean
|
|
||||||
shift: boolean
|
|
||||||
|
|
||||||
constructor(obj: KeyCombo) {
|
|
||||||
this.key = obj.key
|
|
||||||
this.ctrl = obj.ctrl ?? false
|
|
||||||
this.alt = obj.alt ?? false
|
|
||||||
this.shift = obj.shift ?? false
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromEvent(event: KeyboardEvent) {
|
|
||||||
return new KeyComboImpl({
|
|
||||||
key: event.key,
|
|
||||||
ctrl: event.ctrlKey || event.metaKey,
|
|
||||||
alt: event.altKey,
|
|
||||||
shift: event.shiftKey
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
equals(other: unknown): boolean {
|
|
||||||
const raw = toRaw(other)
|
|
||||||
|
|
||||||
return raw instanceof KeyComboImpl
|
|
||||||
? this.key.toUpperCase() === raw.key.toUpperCase() &&
|
|
||||||
this.ctrl === raw.ctrl &&
|
|
||||||
this.alt === raw.alt &&
|
|
||||||
this.shift === raw.shift
|
|
||||||
: false
|
|
||||||
}
|
|
||||||
|
|
||||||
serialize(): string {
|
|
||||||
return `${this.key.toUpperCase()}:${this.ctrl}:${this.alt}:${this.shift}`
|
|
||||||
}
|
|
||||||
|
|
||||||
toString(): string {
|
|
||||||
return this.getKeySequences().join(' + ')
|
|
||||||
}
|
|
||||||
|
|
||||||
get hasModifier(): boolean {
|
|
||||||
return this.ctrl || this.alt || this.shift
|
|
||||||
}
|
|
||||||
|
|
||||||
get isModifier(): boolean {
|
|
||||||
return ['Control', 'Meta', 'Alt', 'Shift'].includes(this.key)
|
|
||||||
}
|
|
||||||
|
|
||||||
get modifierCount(): number {
|
|
||||||
const modifiers = [this.ctrl, this.alt, this.shift]
|
|
||||||
return modifiers.reduce((acc, cur) => acc + Number(cur), 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
get isShiftOnly(): boolean {
|
|
||||||
return this.shift && this.modifierCount === 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get isReservedByTextInput(): boolean {
|
|
||||||
return (
|
|
||||||
!this.hasModifier ||
|
|
||||||
this.isShiftOnly ||
|
|
||||||
RESERVED_BY_TEXT_INPUT.has(this.toString())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
getKeySequences(): string[] {
|
|
||||||
const sequences: string[] = []
|
|
||||||
if (this.ctrl) {
|
|
||||||
sequences.push('Ctrl')
|
|
||||||
}
|
|
||||||
if (this.alt) {
|
|
||||||
sequences.push('Alt')
|
|
||||||
}
|
|
||||||
if (this.shift) {
|
|
||||||
sequences.push('Shift')
|
|
||||||
}
|
|
||||||
sequences.push(this.key)
|
|
||||||
return sequences
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useKeybindingStore = defineStore('keybinding', () => {
|
export const useKeybindingStore = defineStore('keybinding', () => {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
|
import {
|
||||||
|
CORE_KEYBINDINGS,
|
||||||
|
KeyComboImpl,
|
||||||
|
KeybindingImpl
|
||||||
|
} from '@comfyorg/keybinding'
|
||||||
import { createPinia, setActivePinia } from 'pinia'
|
import { createPinia, setActivePinia } from 'pinia'
|
||||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||||
|
|
||||||
import { CORE_KEYBINDINGS } from '@/platform/keybinding/constants/coreKeybindings'
|
|
||||||
import { useCommandStore } from '@/stores/commandStore'
|
import { useCommandStore } from '@/stores/commandStore'
|
||||||
import { useDialogStore } from '@/stores/dialogStore'
|
import { useDialogStore } from '@/stores/dialogStore'
|
||||||
import { useKeybindingService } from '@/workbench/keybindings/services/keybindingService'
|
import { useKeybindingService } from '@/workbench/keybindings/services/keybindingService'
|
||||||
import {
|
import { useKeybindingStore } from '@/workbench/keybindings/stores/keybindingStore'
|
||||||
KeyComboImpl,
|
|
||||||
KeybindingImpl,
|
|
||||||
useKeybindingStore
|
|
||||||
} from '@/workbench/keybindings/stores/keybindingStore'
|
|
||||||
|
|
||||||
// Mock stores
|
// Mock stores
|
||||||
vi.mock('@/platform/settings/settingStore', () => ({
|
vi.mock('@/platform/settings/settingStore', () => ({
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
|
import { KeybindingImpl } from '@comfyorg/keybinding'
|
||||||
import { createPinia, setActivePinia } from 'pinia'
|
import { createPinia, setActivePinia } from 'pinia'
|
||||||
import { beforeEach, describe, expect, it } from 'vitest'
|
import { beforeEach, describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
import {
|
import { useKeybindingStore } from '@/workbench/keybindings/stores/keybindingStore'
|
||||||
KeybindingImpl,
|
|
||||||
useKeybindingStore
|
|
||||||
} from '@/workbench/keybindings/stores/keybindingStore'
|
|
||||||
|
|
||||||
describe('useKeybindingStore', () => {
|
describe('useKeybindingStore', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user