mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-23 06:10:32 +00:00
refactor(litegraph): deprecate LiteGraph.ON_EVENT (release N)
ON_EVENT is a no-op mode — use NEVER to mute a node. The numeric slot (1) is preserved for v2 ABI; the symbol will be removed in release N+1. - Rename LGraphEventMode.ON_EVENT → _UNUSED_1 (value=1) in globalEnums.ts. - Replace window.LiteGraph.ON_EVENT static assignment with a deprecation getter that console.warn's then returns 1. - Delete the no-op 'case ON_EVENT: break' arm in LGraphNode.changeMode(). Widen the switch to a numeric default-accept so setMode(1) keeps working. - Update comfyui-frontend-types .d.ts: replace typeof LiteGraph.ON_EVENT with literal 1 in the mode?: union. Bump types patch version. Christian sign-off received on warning copy. Closes #12225 (release N half — release N+1 PR will drop _UNUSED_1 and the deprecation getter).
This commit is contained in:
@@ -1380,9 +1380,6 @@ export class LGraphNode
|
||||
|
||||
changeMode(modeTo: number): boolean {
|
||||
switch (modeTo) {
|
||||
case LGraphEventMode.ON_EVENT:
|
||||
break
|
||||
|
||||
case LGraphEventMode.ON_TRIGGER:
|
||||
this.addOnTriggerInput()
|
||||
this.addOnExecutedOutput()
|
||||
@@ -1399,7 +1396,8 @@ export class LGraphNode
|
||||
break
|
||||
|
||||
default:
|
||||
return false
|
||||
// Numeric default-accept: any caller-supplied numeric mode (including
|
||||
// the deprecated slot 1 / ON_EVENT) falls through and is assigned.
|
||||
break
|
||||
}
|
||||
this.mode = modeTo
|
||||
|
||||
@@ -122,7 +122,9 @@ export class LiteGraphGlobal {
|
||||
/** use with node_box_coloured_by_mode */
|
||||
NODE_MODES_COLORS = ['#666', '#422', '#333', '#224', '#626']
|
||||
ALWAYS = LGraphEventMode.ALWAYS
|
||||
ON_EVENT = LGraphEventMode.ON_EVENT
|
||||
// ON_EVENT is registered as a deprecation getter in the constructor — see
|
||||
// Object.defineProperty call below. The numeric slot (1) is preserved for
|
||||
// v2 ABI; the symbol will be removed in release N+1.
|
||||
NEVER = LGraphEventMode.NEVER
|
||||
ON_TRIGGER = LGraphEventMode.ON_TRIGGER
|
||||
|
||||
@@ -372,6 +374,15 @@ export class LiteGraphGlobal {
|
||||
|
||||
constructor() {
|
||||
Object.defineProperty(this, 'Classes', { writable: false })
|
||||
Object.defineProperty(this, 'ON_EVENT', {
|
||||
get() {
|
||||
console.warn(
|
||||
'LiteGraph.ON_EVENT is deprecated; numeric slot 1 is preserved for v2 ABI but the symbol will be removed in release N+1. ON_EVENT is a no-op mode — use NEVER to mute a node.'
|
||||
)
|
||||
return 1
|
||||
},
|
||||
configurable: true
|
||||
})
|
||||
}
|
||||
|
||||
Classes = {
|
||||
|
||||
@@ -82,7 +82,9 @@ export enum TitleMode {
|
||||
|
||||
export enum LGraphEventMode {
|
||||
ALWAYS = 0,
|
||||
ON_EVENT = 1,
|
||||
/** @deprecated No-op mode. Numeric slot 1 is preserved for v2 ABI; the
|
||||
* symbol will be removed in release N+1. Use NEVER to mute a node. */
|
||||
_UNUSED_1 = 1,
|
||||
NEVER = 2,
|
||||
ON_TRIGGER = 3,
|
||||
BYPASS = 4
|
||||
|
||||
Reference in New Issue
Block a user