mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-25 08:49:36 +00:00
Compare commits
2 Commits
update-tra
...
refactor/d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7dc5f090f3 | ||
|
|
9b193be968 |
@@ -6,7 +6,6 @@ import {
|
|||||||
DEFAULT_DARK_COLOR_PALETTE,
|
DEFAULT_DARK_COLOR_PALETTE,
|
||||||
DEFAULT_LIGHT_COLOR_PALETTE
|
DEFAULT_LIGHT_COLOR_PALETTE
|
||||||
} from '@/constants/coreColorPalettes'
|
} from '@/constants/coreColorPalettes'
|
||||||
import { tryToggleWidgetPromotion } from '@/core/graph/subgraph/proxyWidgetUtils'
|
|
||||||
import { showSubgraphNodeDialog } from '@/core/graph/subgraph/useSubgraphNodeDialog'
|
import { showSubgraphNodeDialog } from '@/core/graph/subgraph/useSubgraphNodeDialog'
|
||||||
import { t } from '@/i18n'
|
import { t } from '@/i18n'
|
||||||
import {
|
import {
|
||||||
@@ -37,7 +36,10 @@ import { selectionBounds } from '@/renderer/core/layout/utils/layoutMath'
|
|||||||
import { api } from '@/scripts/api'
|
import { api } from '@/scripts/api'
|
||||||
import { app } from '@/scripts/app'
|
import { app } from '@/scripts/app'
|
||||||
import { useDialogService } from '@/services/dialogService'
|
import { useDialogService } from '@/services/dialogService'
|
||||||
import { useLitegraphService } from '@/services/litegraphService'
|
import {
|
||||||
|
invokeToggleWidgetPromotion,
|
||||||
|
useLitegraphService
|
||||||
|
} from '@/services/litegraphService'
|
||||||
import type { ComfyCommand } from '@/stores/commandStore'
|
import type { ComfyCommand } from '@/stores/commandStore'
|
||||||
import { useExecutionStore } from '@/stores/executionStore'
|
import { useExecutionStore } from '@/stores/executionStore'
|
||||||
import { useHelpCenterStore } from '@/stores/helpCenterStore'
|
import { useHelpCenterStore } from '@/stores/helpCenterStore'
|
||||||
@@ -1033,7 +1035,9 @@ export function useCoreCommands(): ComfyCommand[] {
|
|||||||
icon: 'icon-[lucide--arrow-left-right]',
|
icon: 'icon-[lucide--arrow-left-right]',
|
||||||
label: 'Toggle promotion of hovered widget',
|
label: 'Toggle promotion of hovered widget',
|
||||||
versionAdded: '1.30.1',
|
versionAdded: '1.30.1',
|
||||||
function: tryToggleWidgetPromotion
|
function: () => {
|
||||||
|
invokeToggleWidgetPromotion()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'Comfy.OpenManagerDialog',
|
id: 'Comfy.OpenManagerDialog',
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ import {
|
|||||||
|
|
||||||
import SearchBox from '@/components/common/SearchBox.vue'
|
import SearchBox from '@/components/common/SearchBox.vue'
|
||||||
import SubgraphNodeWidget from '@/core/graph/subgraph/SubgraphNodeWidget.vue'
|
import SubgraphNodeWidget from '@/core/graph/subgraph/SubgraphNodeWidget.vue'
|
||||||
|
import { parseProxyWidgets } from '@/core/schemas/proxyWidget'
|
||||||
|
import type { ProxyWidgetsProperty } from '@/core/schemas/proxyWidget'
|
||||||
|
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
||||||
|
import { SubgraphNode } from '@/lib/litegraph/src/subgraph/SubgraphNode'
|
||||||
|
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
|
||||||
|
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
||||||
import {
|
import {
|
||||||
demoteWidget,
|
demoteWidget,
|
||||||
isRecommendedWidget,
|
isRecommendedWidget,
|
||||||
@@ -19,14 +25,8 @@ import {
|
|||||||
promoteWidget,
|
promoteWidget,
|
||||||
pruneDisconnected,
|
pruneDisconnected,
|
||||||
widgetItemToProperty
|
widgetItemToProperty
|
||||||
} from '@/core/graph/subgraph/proxyWidgetUtils'
|
} from '@/renderer/graph/subgraph/proxyWidgetUtils'
|
||||||
import type { WidgetItem } from '@/core/graph/subgraph/proxyWidgetUtils'
|
import type { WidgetItem } from '@/renderer/graph/subgraph/proxyWidgetUtils'
|
||||||
import { parseProxyWidgets } from '@/core/schemas/proxyWidget'
|
|
||||||
import type { ProxyWidgetsProperty } from '@/core/schemas/proxyWidget'
|
|
||||||
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
|
||||||
import { SubgraphNode } from '@/lib/litegraph/src/subgraph/SubgraphNode'
|
|
||||||
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
|
|
||||||
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
|
||||||
import { DraggableList } from '@/scripts/ui/draggableList'
|
import { DraggableList } from '@/scripts/ui/draggableList'
|
||||||
import { useLitegraphService } from '@/services/litegraphService'
|
import { useLitegraphService } from '@/services/litegraphService'
|
||||||
import { useDialogStore } from '@/stores/dialogStore'
|
import { useDialogStore } from '@/stores/dialogStore'
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ export interface IBaseWidget<
|
|||||||
* This property is automatically computed on graph change
|
* This property is automatically computed on graph change
|
||||||
* and should not be changed.
|
* and should not be changed.
|
||||||
* Promoted widgets have a colored border
|
* Promoted widgets have a colored border
|
||||||
* @see /core/graph/subgraph/proxyWidget.registerProxyWidgets
|
* @see /renderer/graph/subgraph/proxyWidget.registerProxyWidgets
|
||||||
*/
|
*/
|
||||||
promoted?: boolean
|
promoted?: boolean
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
demoteWidget,
|
demoteWidget,
|
||||||
promoteRecommendedWidgets
|
promoteRecommendedWidgets
|
||||||
} from '@/core/graph/subgraph/proxyWidgetUtils'
|
} from '@/renderer/graph/subgraph/proxyWidgetUtils'
|
||||||
import { parseProxyWidgets } from '@/core/schemas/proxyWidget'
|
import { parseProxyWidgets } from '@/core/schemas/proxyWidget'
|
||||||
import type { NodeProperty } from '@/lib/litegraph/src/LGraphNode'
|
import type { NodeProperty } from '@/lib/litegraph/src/LGraphNode'
|
||||||
import type {
|
import type {
|
||||||
@@ -3,7 +3,7 @@ import type { ProxyWidgetsProperty } from '@/core/schemas/proxyWidget'
|
|||||||
import {
|
import {
|
||||||
isProxyWidget,
|
isProxyWidget,
|
||||||
isDisconnectedWidget
|
isDisconnectedWidget
|
||||||
} from '@/core/graph/subgraph/proxyWidget'
|
} from '@/renderer/graph/subgraph/proxyWidget'
|
||||||
import { t } from '@/i18n'
|
import { t } from '@/i18n'
|
||||||
import type {
|
import type {
|
||||||
IContextMenuValue,
|
IContextMenuValue,
|
||||||
@@ -13,7 +13,10 @@ import type { SubgraphNode } from '@/lib/litegraph/src/subgraph/SubgraphNode'
|
|||||||
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets.ts'
|
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets.ts'
|
||||||
import { useToastStore } from '@/platform/updates/common/toastStore'
|
import { useToastStore } from '@/platform/updates/common/toastStore'
|
||||||
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
||||||
import { useLitegraphService } from '@/services/litegraphService'
|
import {
|
||||||
|
registerWidgetPromotionHandlers,
|
||||||
|
useLitegraphService
|
||||||
|
} from '@/services/litegraphService'
|
||||||
import { useSubgraphNavigationStore } from '@/stores/subgraphNavigationStore'
|
import { useSubgraphNavigationStore } from '@/stores/subgraphNavigationStore'
|
||||||
|
|
||||||
type PartialNode = Pick<LGraphNode, 'title' | 'id' | 'type'>
|
type PartialNode = Pick<LGraphNode, 'title' | 'id' | 'type'>
|
||||||
@@ -86,7 +89,7 @@ function getParentNodes(): SubgraphNode[] {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addWidgetPromotionOptions(
|
function addWidgetPromotionOptions(
|
||||||
options: (IContextMenuValue<unknown> | null)[],
|
options: (IContextMenuValue<unknown> | null)[],
|
||||||
widget: IBaseWidget,
|
widget: IBaseWidget,
|
||||||
node: LGraphNode
|
node: LGraphNode
|
||||||
@@ -111,7 +114,12 @@ export function addWidgetPromotionOptions(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function tryToggleWidgetPromotion() {
|
|
||||||
|
registerWidgetPromotionHandlers({
|
||||||
|
addWidgetPromotionOptions,
|
||||||
|
tryToggleWidgetPromotion
|
||||||
|
})
|
||||||
|
function tryToggleWidgetPromotion() {
|
||||||
const canvas = useCanvasStore().getCanvas()
|
const canvas = useCanvasStore().getCanvas()
|
||||||
const [x, y] = canvas.graph_mouse
|
const [x, y] = canvas.graph_mouse
|
||||||
const node = canvas.graph?.getNodeOnPos(x, y, canvas.visible_nodes)
|
const node = canvas.graph?.getNodeOnPos(x, y, canvas.visible_nodes)
|
||||||
@@ -5,7 +5,7 @@ import { reactive, unref } from 'vue'
|
|||||||
import { shallowRef } from 'vue'
|
import { shallowRef } from 'vue'
|
||||||
|
|
||||||
import { useCanvasPositionConversion } from '@/composables/element/useCanvasPositionConversion'
|
import { useCanvasPositionConversion } from '@/composables/element/useCanvasPositionConversion'
|
||||||
import { registerProxyWidgets } from '@/core/graph/subgraph/proxyWidget'
|
import { registerProxyWidgets } from '@/renderer/graph/subgraph/proxyWidget'
|
||||||
import { st, t } from '@/i18n'
|
import { st, t } from '@/i18n'
|
||||||
import type { IContextMenuValue } from '@/lib/litegraph/src/interfaces'
|
import type { IContextMenuValue } from '@/lib/litegraph/src/interfaces'
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export async function addStylesheet(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @knipIgnoreUnusedButUsedByCustomNodes */
|
// @knipIgnoreUnusedButUsedByCustomNodes
|
||||||
export { downloadBlob } from '@/base/common/downloadUtil'
|
export { downloadBlob } from '@/base/common/downloadUtil'
|
||||||
|
|
||||||
export function uploadFile(accept: string) {
|
export function uploadFile(accept: string) {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteG
|
|||||||
import { useNodeAnimatedImage } from '@/composables/node/useNodeAnimatedImage'
|
import { useNodeAnimatedImage } from '@/composables/node/useNodeAnimatedImage'
|
||||||
import { useNodeCanvasImagePreview } from '@/composables/node/useNodeCanvasImagePreview'
|
import { useNodeCanvasImagePreview } from '@/composables/node/useNodeCanvasImagePreview'
|
||||||
import { useNodeImage, useNodeVideo } from '@/composables/node/useNodeImage'
|
import { useNodeImage, useNodeVideo } from '@/composables/node/useNodeImage'
|
||||||
import { addWidgetPromotionOptions } from '@/core/graph/subgraph/proxyWidgetUtils'
|
|
||||||
import { showSubgraphNodeDialog } from '@/core/graph/subgraph/useSubgraphNodeDialog'
|
import { showSubgraphNodeDialog } from '@/core/graph/subgraph/useSubgraphNodeDialog'
|
||||||
import { st, t } from '@/i18n'
|
import { st, t } from '@/i18n'
|
||||||
import {
|
import {
|
||||||
@@ -22,6 +21,7 @@ import type {
|
|||||||
Point,
|
Point,
|
||||||
Subgraph
|
Subgraph
|
||||||
} from '@/lib/litegraph/src/litegraph'
|
} from '@/lib/litegraph/src/litegraph'
|
||||||
|
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
|
||||||
import type {
|
import type {
|
||||||
ExportedSubgraphInstance,
|
ExportedSubgraphInstance,
|
||||||
ISerialisableNodeInput,
|
ISerialisableNodeInput,
|
||||||
@@ -62,6 +62,27 @@ import { useExtensionService } from './extensionService'
|
|||||||
export const CONFIG = Symbol()
|
export const CONFIG = Symbol()
|
||||||
export const GET_CONFIG = Symbol()
|
export const GET_CONFIG = Symbol()
|
||||||
|
|
||||||
|
type WidgetPromotionHandlers = {
|
||||||
|
addWidgetPromotionOptions?: (
|
||||||
|
options: (IContextMenuValue<unknown> | null)[],
|
||||||
|
widget: IBaseWidget,
|
||||||
|
node: LGraphNode
|
||||||
|
) => void
|
||||||
|
tryToggleWidgetPromotion?: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
let widgetPromotionHandlers: WidgetPromotionHandlers = {}
|
||||||
|
|
||||||
|
export const registerWidgetPromotionHandlers = (
|
||||||
|
handlers: WidgetPromotionHandlers
|
||||||
|
) => {
|
||||||
|
widgetPromotionHandlers = handlers
|
||||||
|
}
|
||||||
|
|
||||||
|
export const invokeToggleWidgetPromotion = () => {
|
||||||
|
widgetPromotionHandlers.tryToggleWidgetPromotion?.()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service that augments litegraph with ComfyUI specific functionality.
|
* Service that augments litegraph with ComfyUI specific functionality.
|
||||||
*/
|
*/
|
||||||
@@ -826,7 +847,11 @@ export const useLitegraphService = () => {
|
|||||||
const [x, y] = canvas.graph_mouse
|
const [x, y] = canvas.graph_mouse
|
||||||
const overWidget = this.getWidgetOnPos(x, y, true)
|
const overWidget = this.getWidgetOnPos(x, y, true)
|
||||||
if (overWidget) {
|
if (overWidget) {
|
||||||
addWidgetPromotionOptions(options, overWidget, this)
|
widgetPromotionHandlers.addWidgetPromotionOptions?.(
|
||||||
|
options,
|
||||||
|
overWidget,
|
||||||
|
this
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { describe, expect, test, vi } from 'vitest'
|
import { describe, expect, test, vi } from 'vitest'
|
||||||
|
|
||||||
import { registerProxyWidgets } from '@/core/graph/subgraph/proxyWidget'
|
import { registerProxyWidgets } from '@/renderer/graph/subgraph/proxyWidget'
|
||||||
import { parseProxyWidgets } from '@/core/schemas/proxyWidget'
|
import { parseProxyWidgets } from '@/core/schemas/proxyWidget'
|
||||||
import { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
import { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
||||||
import type { LGraphCanvas, SubgraphNode } from '@/lib/litegraph/src/litegraph'
|
import type { LGraphCanvas, SubgraphNode } from '@/lib/litegraph/src/litegraph'
|
||||||
|
|||||||
Reference in New Issue
Block a user