mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
[TS] Enable noUnusedParameters (#3110)
This commit is contained in:
@@ -45,7 +45,7 @@ const props = withDefaults(
|
|||||||
)
|
)
|
||||||
|
|
||||||
const imageBroken = ref(false)
|
const imageBroken = ref(false)
|
||||||
const handleImageError = (e: Event) => {
|
const handleImageError = () => {
|
||||||
imageBroken.value = true
|
imageBroken.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ const fileSize = computed(() =>
|
|||||||
const electronDownloadStore = useElectronDownloadStore()
|
const electronDownloadStore = useElectronDownloadStore()
|
||||||
const [savePath, filename] = props.label.split('/')
|
const [savePath, filename] = props.label.split('/')
|
||||||
|
|
||||||
electronDownloadStore.$subscribe((mutation, { downloads }) => {
|
electronDownloadStore.$subscribe((_, { downloads }) => {
|
||||||
const download = downloads.find((download) => props.url === download.url)
|
const download = downloads.find((download) => props.url === download.url)
|
||||||
|
|
||||||
if (download) {
|
if (download) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ describe('SettingItem', () => {
|
|||||||
name: 'Node Input Conversion Submenus',
|
name: 'Node Input Conversion Submenus',
|
||||||
type: 'combo',
|
type: 'combo',
|
||||||
value: 'Top',
|
value: 'Top',
|
||||||
options: (value: string) => ['Correctly Translated']
|
options: () => ['Correctly Translated']
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -247,14 +247,14 @@ class ImagePreviewWidget implements ICustomWidget {
|
|||||||
draw(
|
draw(
|
||||||
ctx: CanvasRenderingContext2D,
|
ctx: CanvasRenderingContext2D,
|
||||||
node: LGraphNode,
|
node: LGraphNode,
|
||||||
widget_width: number,
|
_width: number,
|
||||||
y: number,
|
y: number,
|
||||||
H: number
|
_height: number
|
||||||
): void {
|
): void {
|
||||||
renderPreview(ctx, node, y)
|
renderPreview(ctx, node, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
computeLayoutSize(this: IBaseWidget, node: LGraphNode) {
|
computeLayoutSize(this: IBaseWidget) {
|
||||||
return {
|
return {
|
||||||
minHeight: 220,
|
minHeight: 220,
|
||||||
minWidth: 1
|
minWidth: 1
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import type { ResultItem } from '@/schemas/apiSchema'
|
|||||||
import type { InputSpec } from '@/schemas/nodeDefSchema'
|
import type { InputSpec } from '@/schemas/nodeDefSchema'
|
||||||
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
|
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
|
||||||
import { useNodeOutputStore } from '@/stores/imagePreviewStore'
|
import { useNodeOutputStore } from '@/stores/imagePreviewStore'
|
||||||
import type { ComfyApp } from '@/types'
|
|
||||||
import { createAnnotatedPath } from '@/utils/formatUtil'
|
import { createAnnotatedPath } from '@/utils/formatUtil'
|
||||||
import { addToComboValues } from '@/utils/litegraphUtil'
|
import { addToComboValues } from '@/utils/litegraphUtil'
|
||||||
|
|
||||||
@@ -32,8 +31,7 @@ export const useImageUploadWidget = () => {
|
|||||||
const widgetConstructor: ComfyWidgetConstructor = (
|
const widgetConstructor: ComfyWidgetConstructor = (
|
||||||
node: LGraphNode,
|
node: LGraphNode,
|
||||||
inputName: string,
|
inputName: string,
|
||||||
inputData: InputSpec,
|
inputData: InputSpec
|
||||||
app: ComfyApp
|
|
||||||
) => {
|
) => {
|
||||||
const inputOptions = inputData[1] ?? {}
|
const inputOptions = inputData[1] ?? {}
|
||||||
const { imageInputName, allow_batch, image_folder = 'input' } = inputOptions
|
const { imageInputName, allow_batch, image_folder = 'input' } = inputOptions
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ app.registerExtension({
|
|||||||
const weightDelta = event.key === 'ArrowUp' ? delta : -delta
|
const weightDelta = event.key === 'ArrowUp' ? delta : -delta
|
||||||
const updatedText = selectedText.replace(
|
const updatedText = selectedText.replace(
|
||||||
/\((.*):([+-]?\d+(?:\.\d+)?)\)/,
|
/\((.*):([+-]?\d+(?:\.\d+)?)\)/,
|
||||||
(match, text, weight) => {
|
(_, text, weight) => {
|
||||||
weight = incrementWeight(weight, weightDelta)
|
weight = incrementWeight(weight, weightDelta)
|
||||||
if (weight == 1) {
|
if (weight == 1) {
|
||||||
return text
|
return text
|
||||||
|
|||||||
@@ -1020,7 +1020,7 @@ export class GroupNodeHandler {
|
|||||||
|
|
||||||
// Draw custom collapse icon to identity this as a group
|
// Draw custom collapse icon to identity this as a group
|
||||||
const onDrawTitleBox = this.node.onDrawTitleBox
|
const onDrawTitleBox = this.node.onDrawTitleBox
|
||||||
this.node.onDrawTitleBox = function (ctx, height, size, scale) {
|
this.node.onDrawTitleBox = function (ctx, height) {
|
||||||
onDrawTitleBox?.apply(this, arguments)
|
onDrawTitleBox?.apply(this, arguments)
|
||||||
|
|
||||||
const fill = ctx.fillStyle
|
const fill = ctx.fillStyle
|
||||||
@@ -1128,7 +1128,7 @@ export class GroupNodeHandler {
|
|||||||
this,
|
this,
|
||||||
'executing',
|
'executing',
|
||||||
(d) => d,
|
(d) => d,
|
||||||
(d, id, node) => id
|
(_, id) => id
|
||||||
)
|
)
|
||||||
|
|
||||||
const executed = handleEvent.call(
|
const executed = handleEvent.call(
|
||||||
@@ -1223,7 +1223,7 @@ export class GroupNodeHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
populatePrimitive(node, nodeId, oldName, i, linkedShift) {
|
populatePrimitive(_node, nodeId, oldName) {
|
||||||
// Converted widget, populate primitive if linked
|
// Converted widget, populate primitive if linked
|
||||||
const primitiveId = this.groupData.widgetToPrimitive[nodeId]?.[oldName]
|
const primitiveId = this.groupData.widgetToPrimitive[nodeId]?.[oldName]
|
||||||
if (primitiveId == null) return
|
if (primitiveId == null) return
|
||||||
@@ -1301,7 +1301,7 @@ export class GroupNodeHandler {
|
|||||||
)
|
)
|
||||||
const mainWidget = this.node.widgets[widgetIndex]
|
const mainWidget = this.node.widgets[widgetIndex]
|
||||||
if (
|
if (
|
||||||
this.populatePrimitive(node, nodeId, oldName, i, linkedShift) ||
|
this.populatePrimitive(node, nodeId, oldName) ||
|
||||||
widgetIndex === -1
|
widgetIndex === -1
|
||||||
) {
|
) {
|
||||||
// Find the inner widget and shift by the number of linked widgets as they will have been removed too
|
// Find the inner widget and shift by the number of linked widgets as they will have been removed too
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ export class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {
|
|||||||
$el(
|
$el(
|
||||||
'button.comfy-btn',
|
'button.comfy-btn',
|
||||||
{
|
{
|
||||||
onclick: (e) => {
|
onclick: () => {
|
||||||
const node = app.graph.nodes.find(
|
const node = app.graph.nodes.find(
|
||||||
(n) => n.type === `${PREFIX}${SEPARATOR}` + this.selectedGroup
|
(n) => n.type === `${PREFIX}${SEPARATOR}` + this.selectedGroup
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ app.registerExtension({
|
|||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: 'Comfy.Preview3D',
|
name: 'Comfy.Preview3D',
|
||||||
|
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData) {
|
async beforeRegisterNodeDef(_nodeType, nodeData) {
|
||||||
if ('Preview3D' === nodeData.name) {
|
if ('Preview3D' === nodeData.name) {
|
||||||
// @ts-expect-error InputSpec is not typed correctly
|
// @ts-expect-error InputSpec is not typed correctly
|
||||||
nodeData.input.required.image = ['PREVIEW_3D']
|
nodeData.input.required.image = ['PREVIEW_3D']
|
||||||
@@ -348,7 +348,7 @@ app.registerExtension({
|
|||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: 'Comfy.Preview3DAnimation',
|
name: 'Comfy.Preview3DAnimation',
|
||||||
|
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData) {
|
async beforeRegisterNodeDef(_nodeType, nodeData) {
|
||||||
if ('Preview3DAnimation' === nodeData.name) {
|
if ('Preview3DAnimation' === nodeData.name) {
|
||||||
// @ts-expect-error InputSpec is not typed correctly
|
// @ts-expect-error InputSpec is not typed correctly
|
||||||
nodeData.input.required.image = ['PREVIEW_3D_ANIMATION']
|
nodeData.input.required.image = ['PREVIEW_3D_ANIMATION']
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ function dataURLToBlob(dataURL) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadImage(imagePath) {
|
function loadImage(imagePath) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve) => {
|
||||||
const image = new Image()
|
const image = new Image()
|
||||||
|
|
||||||
image.onload = function () {
|
image.onload = function () {
|
||||||
@@ -36,7 +36,6 @@ async function uploadMask(filepath, formData) {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData
|
||||||
})
|
})
|
||||||
.then((response) => {})
|
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Error:', error)
|
console.error('Error:', error)
|
||||||
})
|
})
|
||||||
@@ -625,10 +624,10 @@ export class MaskEditorDialogOld extends ComfyDialog {
|
|||||||
maskCanvas.addEventListener('touchmove', (event) =>
|
maskCanvas.addEventListener('touchmove', (event) =>
|
||||||
this.draw_move(self, event)
|
this.draw_move(self, event)
|
||||||
)
|
)
|
||||||
maskCanvas.addEventListener('pointerover', (event) => {
|
maskCanvas.addEventListener('pointerover', () => {
|
||||||
this.brush.style.display = 'block'
|
this.brush.style.display = 'block'
|
||||||
})
|
})
|
||||||
maskCanvas.addEventListener('pointerleave', (event) => {
|
maskCanvas.addEventListener('pointerleave', () => {
|
||||||
this.brush.style.display = 'none'
|
this.brush.style.display = 'none'
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -763,7 +762,7 @@ export class MaskEditorDialogOld extends ComfyDialog {
|
|||||||
brush.style.top = centerY - self.brush_size * this.zoom_ratio + 'px'
|
brush.style.top = centerY - self.brush_size * this.zoom_ratio + 'px'
|
||||||
}
|
}
|
||||||
|
|
||||||
handleWheelEvent(self, event) {
|
handleWheelEvent(_, event) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
if (event.ctrlKey) {
|
if (event.ctrlKey) {
|
||||||
|
|||||||
@@ -2832,7 +2832,7 @@ class UIManager {
|
|||||||
100,
|
100,
|
||||||
1,
|
1,
|
||||||
(await this.messageBroker.pull('brushSettings')).size,
|
(await this.messageBroker.pull('brushSettings')).size,
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.messageBroker.publish('setBrushSize', parseInt(value))
|
this.messageBroker.publish('setBrushSize', parseInt(value))
|
||||||
this.updateBrushPreview()
|
this.updateBrushPreview()
|
||||||
}
|
}
|
||||||
@@ -2845,7 +2845,7 @@ class UIManager {
|
|||||||
1,
|
1,
|
||||||
0.01,
|
0.01,
|
||||||
(await this.messageBroker.pull('brushSettings')).opacity,
|
(await this.messageBroker.pull('brushSettings')).opacity,
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.messageBroker.publish('setBrushOpacity', parseFloat(value))
|
this.messageBroker.publish('setBrushOpacity', parseFloat(value))
|
||||||
this.updateBrushPreview()
|
this.updateBrushPreview()
|
||||||
}
|
}
|
||||||
@@ -2858,7 +2858,7 @@ class UIManager {
|
|||||||
1,
|
1,
|
||||||
0.01,
|
0.01,
|
||||||
(await this.messageBroker.pull('brushSettings')).hardness,
|
(await this.messageBroker.pull('brushSettings')).hardness,
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.messageBroker.publish('setBrushHardness', parseFloat(value))
|
this.messageBroker.publish('setBrushHardness', parseFloat(value))
|
||||||
this.updateBrushPreview()
|
this.updateBrushPreview()
|
||||||
}
|
}
|
||||||
@@ -2871,7 +2871,7 @@ class UIManager {
|
|||||||
100,
|
100,
|
||||||
1,
|
1,
|
||||||
(await this.messageBroker.pull('brushSettings')).smoothingPrecision,
|
(await this.messageBroker.pull('brushSettings')).smoothingPrecision,
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.messageBroker.publish(
|
this.messageBroker.publish(
|
||||||
'setBrushSmoothingPrecision',
|
'setBrushSmoothingPrecision',
|
||||||
parseInt(value)
|
parseInt(value)
|
||||||
@@ -2929,7 +2929,7 @@ class UIManager {
|
|||||||
255,
|
255,
|
||||||
1,
|
1,
|
||||||
tolerance,
|
tolerance,
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.messageBroker.publish('setPaintBucketTolerance', parseInt(value))
|
this.messageBroker.publish('setPaintBucketTolerance', parseInt(value))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -2942,7 +2942,7 @@ class UIManager {
|
|||||||
100,
|
100,
|
||||||
1,
|
1,
|
||||||
fillOpacity,
|
fillOpacity,
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.messageBroker.publish('setFillOpacity', parseInt(value))
|
this.messageBroker.publish('setFillOpacity', parseInt(value))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -2971,7 +2971,7 @@ class UIManager {
|
|||||||
255,
|
255,
|
||||||
1,
|
1,
|
||||||
tolerance,
|
tolerance,
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.messageBroker.publish('setColorSelectTolerance', parseInt(value))
|
this.messageBroker.publish('setColorSelectTolerance', parseInt(value))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -2983,21 +2983,21 @@ class UIManager {
|
|||||||
100,
|
100,
|
||||||
1,
|
1,
|
||||||
100, // Default to 100%
|
100, // Default to 100%
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.messageBroker.publish('setSelectionOpacity', parseInt(value))
|
this.messageBroker.publish('setSelectionOpacity', parseInt(value))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const livePreviewToggle = this.createToggle(
|
const livePreviewToggle = this.createToggle(
|
||||||
t('maskEditor.Live Preview'),
|
t('maskEditor.Live Preview'),
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.messageBroker.publish('setLivePreview', value)
|
this.messageBroker.publish('setLivePreview', value)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const wholeImageToggle = this.createToggle(
|
const wholeImageToggle = this.createToggle(
|
||||||
t('maskEditor.Apply to Whole Image'),
|
t('maskEditor.Apply to Whole Image'),
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.messageBroker.publish('setWholeImage', value)
|
this.messageBroker.publish('setWholeImage', value)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -3006,14 +3006,14 @@ class UIManager {
|
|||||||
const methodSelect = this.createDropdown(
|
const methodSelect = this.createDropdown(
|
||||||
t('maskEditor.Method'),
|
t('maskEditor.Method'),
|
||||||
methodOptions,
|
methodOptions,
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.messageBroker.publish('setColorComparisonMethod', value)
|
this.messageBroker.publish('setColorComparisonMethod', value)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const maskBoundaryToggle = this.createToggle(
|
const maskBoundaryToggle = this.createToggle(
|
||||||
t('maskEditor.Stop at mask'),
|
t('maskEditor.Stop at mask'),
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.messageBroker.publish('setMaskBoundary', value)
|
this.messageBroker.publish('setMaskBoundary', value)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -3024,7 +3024,7 @@ class UIManager {
|
|||||||
255,
|
255,
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.messageBroker.publish('setMaskTolerance', parseInt(value))
|
this.messageBroker.publish('setMaskTolerance', parseInt(value))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -3125,7 +3125,7 @@ class UIManager {
|
|||||||
1.0,
|
1.0,
|
||||||
0.01,
|
0.01,
|
||||||
this.mask_opacity,
|
this.mask_opacity,
|
||||||
(event, value) => {
|
(_, value) => {
|
||||||
this.mask_opacity = parseFloat(value)
|
this.mask_opacity = parseFloat(value)
|
||||||
this.maskCanvas.style.opacity = String(this.mask_opacity)
|
this.maskCanvas.style.opacity = String(this.mask_opacity)
|
||||||
|
|
||||||
@@ -3635,7 +3635,7 @@ class UIManager {
|
|||||||
this.messageBroker.publish('pointerUp', event)
|
this.messageBroker.publish('pointerUp', event)
|
||||||
})
|
})
|
||||||
|
|
||||||
pointer_zone.addEventListener('pointerleave', (event: PointerEvent) => {
|
pointer_zone.addEventListener('pointerleave', () => {
|
||||||
this.brush.style.opacity = '0'
|
this.brush.style.opacity = '0'
|
||||||
this.pointerZone.style.cursor = ''
|
this.pointerZone.style.cursor = ''
|
||||||
})
|
})
|
||||||
@@ -3656,12 +3656,9 @@ class UIManager {
|
|||||||
this.messageBroker.publish('wheel', event)
|
this.messageBroker.publish('wheel', event)
|
||||||
)
|
)
|
||||||
|
|
||||||
pointer_zone.addEventListener(
|
pointer_zone.addEventListener('pointerenter', async () => {
|
||||||
'pointerenter',
|
|
||||||
async (event: PointerEvent) => {
|
|
||||||
this.updateCursor()
|
this.updateCursor()
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
||||||
return pointer_zone
|
return pointer_zone
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class ManageTemplates extends ComfyDialog {
|
|||||||
createButtons() {
|
createButtons() {
|
||||||
const btns = super.createButtons()
|
const btns = super.createButtons()
|
||||||
btns[0].textContent = 'Close'
|
btns[0].textContent = 'Close'
|
||||||
btns[0].onclick = (e) => {
|
btns[0].onclick = () => {
|
||||||
clearTimeout(this.saveVisualCue)
|
clearTimeout(this.saveVisualCue)
|
||||||
this.close()
|
this.close()
|
||||||
}
|
}
|
||||||
@@ -279,7 +279,7 @@ class ManageTemplates extends ComfyDialog {
|
|||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
fontWeight: 'normal'
|
fontWeight: 'normal'
|
||||||
},
|
},
|
||||||
onclick: (e) => {
|
onclick: () => {
|
||||||
const json = JSON.stringify({ templates: [t] }, null, 2) // convert the data to a JSON string
|
const json = JSON.stringify({ templates: [t] }, null, 2) // convert the data to a JSON string
|
||||||
const blob = new Blob([json], {
|
const blob = new Blob([json], {
|
||||||
type: 'application/json'
|
type: 'application/json'
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ app.registerExtension({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onConnectionsChange = (type, index, connected, link_info) => {
|
this.onConnectionsChange = (type, _index, connected) => {
|
||||||
if (app.configuringGraph) return
|
if (app.configuringGraph) return
|
||||||
|
|
||||||
// Prevent multiple connections to different types when we have no input
|
// Prevent multiple connections to different types when we have no input
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ app.registerExtension({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const processMouseDown = LGraphCanvas.prototype.processMouseDown
|
const processMouseDown = LGraphCanvas.prototype.processMouseDown
|
||||||
LGraphCanvas.prototype.processMouseDown = function (e) {
|
LGraphCanvas.prototype.processMouseDown = function () {
|
||||||
if (touchZooming || touchCount) {
|
if (touchZooming || touchCount) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ LGraphCanvas.prototype.processMouseDown = function (e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const processMouseMove = LGraphCanvas.prototype.processMouseMove
|
const processMouseMove = LGraphCanvas.prototype.processMouseMove
|
||||||
LGraphCanvas.prototype.processMouseMove = function (e) {
|
LGraphCanvas.prototype.processMouseMove = function () {
|
||||||
if (touchZooming || touchCount > 1) {
|
if (touchZooming || touchCount > 1) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ app.registerExtension({
|
|||||||
step: 1
|
step: 1
|
||||||
},
|
},
|
||||||
defaultValue: 5,
|
defaultValue: 5,
|
||||||
onChange: (newVal, oldVal) => {
|
onChange: (newVal) => {
|
||||||
this.setDefaults(newVal)
|
this.setDefaults(newVal)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
slot_types_default_out: {},
|
slot_types_default_out: {},
|
||||||
slot_types_default_in: {},
|
slot_types_default_in: {},
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
async beforeRegisterNodeDef(nodeType, nodeData) {
|
||||||
var nodeId = nodeData.name
|
var nodeId = nodeData.name
|
||||||
const inputs = nodeData['input']?.['required'] //only show required inputs to reduce the mess also not logical to create node with optional inputs
|
const inputs = nodeData['input']?.['required'] //only show required inputs to reduce the mess also not logical to create node with optional inputs
|
||||||
for (const inputKey in inputs) {
|
for (const inputKey in inputs) {
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ app.registerExtension({
|
|||||||
|
|
||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: 'Comfy.UploadAudio',
|
name: 'Comfy.UploadAudio',
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData: ComfyNodeDef) {
|
async beforeRegisterNodeDef(_nodeType, nodeData: ComfyNodeDef) {
|
||||||
if (nodeData?.input?.required?.audio?.[1]?.audio_upload === true) {
|
if (nodeData?.input?.required?.audio?.[1]?.audio_upload === true) {
|
||||||
nodeData.input.required.upload = ['AUDIOUPLOAD', {}]
|
nodeData.input.required.upload = ['AUDIOUPLOAD', {}]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const createUploadInput = (
|
|||||||
|
|
||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: 'Comfy.UploadImage',
|
name: 'Comfy.UploadImage',
|
||||||
beforeRegisterNodeDef(nodeType, nodeData: ComfyNodeDef) {
|
beforeRegisterNodeDef(_nodeType, nodeData: ComfyNodeDef) {
|
||||||
const { input } = nodeData ?? {}
|
const { input } = nodeData ?? {}
|
||||||
const { required } = input ?? {}
|
const { required } = input ?? {}
|
||||||
if (!required) return
|
if (!required) return
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const WEBCAM_READY = Symbol()
|
|||||||
|
|
||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: 'Comfy.WebcamCapture',
|
name: 'Comfy.WebcamCapture',
|
||||||
getCustomWidgets(app) {
|
getCustomWidgets() {
|
||||||
return {
|
return {
|
||||||
WEBCAM(node, inputName) {
|
WEBCAM(node, inputName) {
|
||||||
let res
|
let res
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ export class PrimitiveNode extends LGraphNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onConnectionsChange(type: ISlotType, index: number, connected: boolean) {
|
onConnectionsChange(_type: ISlotType, _index: number, connected: boolean) {
|
||||||
if (app.configuringGraph) {
|
if (app.configuringGraph) {
|
||||||
// Dont run while the graph is still setting up
|
// Dont run while the graph is still setting up
|
||||||
return
|
return
|
||||||
@@ -143,7 +143,7 @@ export class PrimitiveNode extends LGraphNode {
|
|||||||
|
|
||||||
onConnectOutput(
|
onConnectOutput(
|
||||||
slot: number,
|
slot: number,
|
||||||
type: string,
|
_type: string,
|
||||||
input: INodeInputSlot,
|
input: INodeInputSlot,
|
||||||
target_node: LGraphNode,
|
target_node: LGraphNode,
|
||||||
target_slot: number
|
target_slot: number
|
||||||
@@ -651,7 +651,7 @@ app.registerExtension({
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
async beforeRegisterNodeDef(nodeType, _nodeData, app) {
|
||||||
// Add menu options to convert to/from widgets
|
// Add menu options to convert to/from widgets
|
||||||
const origGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions
|
const origGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions
|
||||||
// @ts-expect-error adding extra property
|
// @ts-expect-error adding extra property
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ const isFileProtocol = window.location.protocol === 'file:'
|
|||||||
const basePath = isElectron() ? '/' : window.location.pathname
|
const basePath = isElectron() ? '/' : window.location.pathname
|
||||||
|
|
||||||
const guardElectronAccess = (
|
const guardElectronAccess = (
|
||||||
to: RouteLocationNormalized,
|
_to: RouteLocationNormalized,
|
||||||
from: RouteLocationNormalized,
|
_from: RouteLocationNormalized,
|
||||||
next: NavigationGuardNext
|
next: NavigationGuardNext
|
||||||
) => {
|
) => {
|
||||||
if (isElectron()) {
|
if (isElectron()) {
|
||||||
@@ -42,7 +42,7 @@ const router = createRouter({
|
|||||||
path: '',
|
path: '',
|
||||||
name: 'GraphView',
|
name: 'GraphView',
|
||||||
component: () => import('@/views/GraphView.vue'),
|
component: () => import('@/views/GraphView.vue'),
|
||||||
beforeEnter: async (to, from, next) => {
|
beforeEnter: async (_to, _from, next) => {
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
await userStore.initialize()
|
await userStore.initialize()
|
||||||
if (userStore.needsLogin) {
|
if (userStore.needsLogin) {
|
||||||
@@ -121,7 +121,7 @@ const router = createRouter({
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
scrollBehavior(to, from, savedPosition) {
|
scrollBehavior(_to, _from, savedPosition) {
|
||||||
if (savedPosition) {
|
if (savedPosition) {
|
||||||
return savedPosition
|
return savedPosition
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -547,9 +547,8 @@ export class ComfyApp {
|
|||||||
node,
|
node,
|
||||||
ctx,
|
ctx,
|
||||||
size,
|
size,
|
||||||
fgcolor,
|
_fgcolor,
|
||||||
bgcolor,
|
bgcolor
|
||||||
selected
|
|
||||||
) {
|
) {
|
||||||
const res = origDrawNodeShape.apply(this, arguments)
|
const res = origDrawNodeShape.apply(this, arguments)
|
||||||
|
|
||||||
@@ -627,7 +626,7 @@ export class ComfyApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const origDrawNode = LGraphCanvas.prototype.drawNode
|
const origDrawNode = LGraphCanvas.prototype.drawNode
|
||||||
LGraphCanvas.prototype.drawNode = function (node, ctx) {
|
LGraphCanvas.prototype.drawNode = function (node) {
|
||||||
const editor_alpha = this.editor_alpha
|
const editor_alpha = this.editor_alpha
|
||||||
const old_color = node.color
|
const old_color = node.color
|
||||||
const old_bgcolor = node.bgcolor
|
const old_bgcolor = node.bgcolor
|
||||||
@@ -678,11 +677,11 @@ export class ComfyApp {
|
|||||||
this.ui.setStatus(detail)
|
this.ui.setStatus(detail)
|
||||||
})
|
})
|
||||||
|
|
||||||
api.addEventListener('progress', ({ detail }) => {
|
api.addEventListener('progress', () => {
|
||||||
this.graph.setDirtyCanvas(true, false)
|
this.graph.setDirtyCanvas(true, false)
|
||||||
})
|
})
|
||||||
|
|
||||||
api.addEventListener('executing', ({ detail }) => {
|
api.addEventListener('executing', () => {
|
||||||
this.graph.setDirtyCanvas(true, false)
|
this.graph.setDirtyCanvas(true, false)
|
||||||
this.revokePreviews(this.runningNodeId)
|
this.revokePreviews(this.runningNodeId)
|
||||||
delete this.nodePreviewImages[this.runningNodeId]
|
delete this.nodePreviewImages[this.runningNodeId]
|
||||||
@@ -708,7 +707,7 @@ export class ComfyApp {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
api.addEventListener('execution_start', ({ detail }) => {
|
api.addEventListener('execution_start', () => {
|
||||||
this.lastExecutionError = null
|
this.lastExecutionError = null
|
||||||
this.graph.nodes.forEach((node) => {
|
this.graph.nodes.forEach((node) => {
|
||||||
if (node.onExecutionStart) node.onExecutionStart()
|
if (node.onExecutionStart) node.onExecutionStart()
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ export class ChangeTracker {
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
window.addEventListener('keyup', (e) => {
|
window.addEventListener('keyup', () => {
|
||||||
if (keyIgnored) {
|
if (keyIgnored) {
|
||||||
keyIgnored = false
|
keyIgnored = false
|
||||||
logger.debug('checkState on keyup')
|
logger.debug('checkState on keyup')
|
||||||
@@ -352,7 +352,7 @@ export class ChangeTracker {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static bindInput(app: ComfyApp, activeEl: Element | null): boolean {
|
static bindInput(_app: ComfyApp, activeEl: Element | null): boolean {
|
||||||
if (
|
if (
|
||||||
!activeEl ||
|
!activeEl ||
|
||||||
activeEl.tagName === 'CANVAS' ||
|
activeEl.tagName === 'CANVAS' ||
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ export async function importA1111(graph, parameters) {
|
|||||||
model(v) {
|
model(v) {
|
||||||
setWidgetValue(ckptNode, 'ckpt_name', v, true)
|
setWidgetValue(ckptNode, 'ckpt_name', v, true)
|
||||||
},
|
},
|
||||||
vae(v) {},
|
vae() {},
|
||||||
'cfg scale'(v) {
|
'cfg scale'(v) {
|
||||||
setWidgetValue(samplerNode, 'cfg', +v)
|
setWidgetValue(samplerNode, 'cfg', +v)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export function $el<TTag extends string>(
|
|||||||
return element as ElementType<TTag>
|
return element as ElementType<TTag>
|
||||||
}
|
}
|
||||||
|
|
||||||
function dragElement(dragEl, settings): () => void {
|
function dragElement(dragEl): () => void {
|
||||||
var posDiffX = 0,
|
var posDiffX = 0,
|
||||||
posDiffY = 0,
|
posDiffY = 0,
|
||||||
posStartX = 0,
|
posStartX = 0,
|
||||||
@@ -640,7 +640,7 @@ export class ComfyUI {
|
|||||||
// Hide by default on construction so it does not interfere with other views.
|
// Hide by default on construction so it does not interfere with other views.
|
||||||
this.menuContainer.style.display = 'none'
|
this.menuContainer.style.display = 'none'
|
||||||
|
|
||||||
this.restoreMenuPosition = dragElement(this.menuContainer, this.settings)
|
this.restoreMenuPosition = dragElement(this.menuContainer)
|
||||||
|
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
this.setStatus({ exec_info: { queue_remaining: 'X' } })
|
this.setStatus({ exec_info: { queue_remaining: 'X' } })
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ export class DraggableList extends EventTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsetItemState() {
|
unsetItemState() {
|
||||||
this.getIdleItems().forEach((item, i) => {
|
this.getIdleItems().forEach((item) => {
|
||||||
delete item.dataset.isAbove
|
delete item.dataset.isAbove
|
||||||
delete item.dataset.isToggled
|
delete item.dataset.isToggled
|
||||||
item.style.transform = ''
|
item.style.transform = ''
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export function addValueControlWidget(
|
|||||||
node: LGraphNode,
|
node: LGraphNode,
|
||||||
targetWidget: IWidget,
|
targetWidget: IWidget,
|
||||||
defaultValue?: string,
|
defaultValue?: string,
|
||||||
values?: unknown,
|
_values?: unknown,
|
||||||
widgetName?: string,
|
widgetName?: string,
|
||||||
inputData?: InputSpec
|
inputData?: InputSpec
|
||||||
): IWidget {
|
): IWidget {
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ export const useLitegraphService = () => {
|
|||||||
|
|
||||||
options.push({
|
options.push({
|
||||||
content: 'Bypass',
|
content: 'Bypass',
|
||||||
callback: (obj) => {
|
callback: () => {
|
||||||
const mode =
|
const mode =
|
||||||
this.mode === LGraphEventMode.BYPASS
|
this.mode === LGraphEventMode.BYPASS
|
||||||
? LGraphEventMode.ALWAYS
|
? LGraphEventMode.ALWAYS
|
||||||
@@ -322,7 +322,7 @@ export const useLitegraphService = () => {
|
|||||||
if (!ComfyApp.clipspace_return_node) {
|
if (!ComfyApp.clipspace_return_node) {
|
||||||
options.push({
|
options.push({
|
||||||
content: 'Copy (Clipspace)',
|
content: 'Copy (Clipspace)',
|
||||||
callback: (obj) => {
|
callback: () => {
|
||||||
ComfyApp.copyToClipspace(this)
|
ComfyApp.copyToClipspace(this)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -339,7 +339,7 @@ export const useLitegraphService = () => {
|
|||||||
if (isImageNode(this)) {
|
if (isImageNode(this)) {
|
||||||
options.push({
|
options.push({
|
||||||
content: 'Open in MaskEditor',
|
content: 'Open in MaskEditor',
|
||||||
callback: (obj) => {
|
callback: () => {
|
||||||
ComfyApp.copyToClipspace(this)
|
ComfyApp.copyToClipspace(this)
|
||||||
ComfyApp.clipspace_return_node = this
|
ComfyApp.clipspace_return_node = this
|
||||||
ComfyApp.open_maskeditor()
|
ComfyApp.open_maskeditor()
|
||||||
@@ -361,19 +361,13 @@ export const useLitegraphService = () => {
|
|||||||
/**
|
/**
|
||||||
* @deprecated No longer needed as we use {@link useImagePreviewWidget}
|
* @deprecated No longer needed as we use {@link useImagePreviewWidget}
|
||||||
*/
|
*/
|
||||||
node.prototype.setSizeForImage = function (
|
node.prototype.setSizeForImage = function (this: LGraphNode) {
|
||||||
this: LGraphNode,
|
|
||||||
force: boolean
|
|
||||||
) {
|
|
||||||
console.warn(
|
console.warn(
|
||||||
'node.setSizeForImage is deprecated. Now it has no effect. Please remove the call to it.'
|
'node.setSizeForImage is deprecated. Now it has no effect. Please remove the call to it.'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function unsafeDrawBackground(
|
function unsafeDrawBackground(this: LGraphNode) {
|
||||||
this: LGraphNode,
|
|
||||||
ctx: CanvasRenderingContext2D
|
|
||||||
) {
|
|
||||||
if (this.flags.collapsed) return
|
if (this.flags.collapsed) return
|
||||||
|
|
||||||
const nodeOutputStore = useNodeOutputStore()
|
const nodeOutputStore = useNodeOutputStore()
|
||||||
@@ -418,9 +412,9 @@ export const useLitegraphService = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node.prototype.onDrawBackground = function (ctx) {
|
node.prototype.onDrawBackground = function () {
|
||||||
try {
|
try {
|
||||||
unsafeDrawBackground.call(this, ctx)
|
unsafeDrawBackground.call(this)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error drawing node background', error)
|
console.error('Error drawing node background', error)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ import type {
|
|||||||
ExecutingWsMessage,
|
ExecutingWsMessage,
|
||||||
ExecutionCachedWsMessage,
|
ExecutionCachedWsMessage,
|
||||||
ExecutionStartWsMessage,
|
ExecutionStartWsMessage,
|
||||||
ProgressWsMessage,
|
ProgressWsMessage
|
||||||
StatusWsMessage
|
|
||||||
} from '@/schemas/apiSchema'
|
} from '@/schemas/apiSchema'
|
||||||
import type {
|
import type {
|
||||||
ComfyNode,
|
ComfyNode,
|
||||||
@@ -149,7 +148,7 @@ export const useExecutionStore = defineStore('execution', () => {
|
|||||||
_executingNodeProgress.value = e.detail
|
_executingNodeProgress.value = e.detail
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleStatus(e: CustomEvent<StatusWsMessage>) {
|
function handleStatus() {
|
||||||
if (api.clientId) {
|
if (api.clientId) {
|
||||||
clientId.value = api.clientId
|
clientId.value = api.clientId
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ describe('colorUtil - adjustColor', () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
describe.each(Object.entries(colors))('%s color', (colorName, color) => {
|
describe.each(Object.entries(colors))('%s color', (_colorName, color) => {
|
||||||
describe.each(formats)('%s format', (format) => {
|
describe.each(formats)('%s format', (format) => {
|
||||||
runAdjustColorTests(color, format as ColorFormat)
|
runAdjustColorTests(color, format as ColorFormat)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ describe('useCachedRequest', () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Create a mock request function that returns different results based on params
|
// Create a mock request function that returns different results based on params
|
||||||
mockRequestFn = vi.fn(async (params: any, signal?: AbortSignal) => {
|
mockRequestFn = vi.fn(async (params: any) => {
|
||||||
// Simulate a request that takes some time
|
// Simulate a request that takes some time
|
||||||
await new Promise((resolve) => setTimeout(resolve, 8))
|
await new Promise((resolve) => setTimeout(resolve, 8))
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
/* Linting */
|
/* Linting */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": false,
|
"noUnusedParameters": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"downlevelIteration": true,
|
"downlevelIteration": true,
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user