mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-08 17:10:07 +00:00
[TS] Enable noUnusedParameters (#3110)
This commit is contained in:
@@ -153,7 +153,7 @@ app.registerExtension({
|
||||
const weightDelta = event.key === 'ArrowUp' ? delta : -delta
|
||||
const updatedText = selectedText.replace(
|
||||
/\((.*):([+-]?\d+(?:\.\d+)?)\)/,
|
||||
(match, text, weight) => {
|
||||
(_, text, weight) => {
|
||||
weight = incrementWeight(weight, weightDelta)
|
||||
if (weight == 1) {
|
||||
return text
|
||||
|
||||
@@ -1020,7 +1020,7 @@ export class GroupNodeHandler {
|
||||
|
||||
// Draw custom collapse icon to identity this as a group
|
||||
const onDrawTitleBox = this.node.onDrawTitleBox
|
||||
this.node.onDrawTitleBox = function (ctx, height, size, scale) {
|
||||
this.node.onDrawTitleBox = function (ctx, height) {
|
||||
onDrawTitleBox?.apply(this, arguments)
|
||||
|
||||
const fill = ctx.fillStyle
|
||||
@@ -1128,7 +1128,7 @@ export class GroupNodeHandler {
|
||||
this,
|
||||
'executing',
|
||||
(d) => d,
|
||||
(d, id, node) => id
|
||||
(_, id) => id
|
||||
)
|
||||
|
||||
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
|
||||
const primitiveId = this.groupData.widgetToPrimitive[nodeId]?.[oldName]
|
||||
if (primitiveId == null) return
|
||||
@@ -1301,7 +1301,7 @@ export class GroupNodeHandler {
|
||||
)
|
||||
const mainWidget = this.node.widgets[widgetIndex]
|
||||
if (
|
||||
this.populatePrimitive(node, nodeId, oldName, i, linkedShift) ||
|
||||
this.populatePrimitive(node, nodeId, oldName) ||
|
||||
widgetIndex === -1
|
||||
) {
|
||||
// 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(
|
||||
'button.comfy-btn',
|
||||
{
|
||||
onclick: (e) => {
|
||||
onclick: () => {
|
||||
const node = app.graph.nodes.find(
|
||||
(n) => n.type === `${PREFIX}${SEPARATOR}` + this.selectedGroup
|
||||
)
|
||||
|
||||
@@ -275,7 +275,7 @@ app.registerExtension({
|
||||
app.registerExtension({
|
||||
name: 'Comfy.Preview3D',
|
||||
|
||||
async beforeRegisterNodeDef(nodeType, nodeData) {
|
||||
async beforeRegisterNodeDef(_nodeType, nodeData) {
|
||||
if ('Preview3D' === nodeData.name) {
|
||||
// @ts-expect-error InputSpec is not typed correctly
|
||||
nodeData.input.required.image = ['PREVIEW_3D']
|
||||
@@ -348,7 +348,7 @@ app.registerExtension({
|
||||
app.registerExtension({
|
||||
name: 'Comfy.Preview3DAnimation',
|
||||
|
||||
async beforeRegisterNodeDef(nodeType, nodeData) {
|
||||
async beforeRegisterNodeDef(_nodeType, nodeData) {
|
||||
if ('Preview3DAnimation' === nodeData.name) {
|
||||
// @ts-expect-error InputSpec is not typed correctly
|
||||
nodeData.input.required.image = ['PREVIEW_3D_ANIMATION']
|
||||
|
||||
@@ -19,7 +19,7 @@ function dataURLToBlob(dataURL) {
|
||||
}
|
||||
|
||||
function loadImage(imagePath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve) => {
|
||||
const image = new Image()
|
||||
|
||||
image.onload = function () {
|
||||
@@ -36,7 +36,6 @@ async function uploadMask(filepath, formData) {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then((response) => {})
|
||||
.catch((error) => {
|
||||
console.error('Error:', error)
|
||||
})
|
||||
@@ -625,10 +624,10 @@ export class MaskEditorDialogOld extends ComfyDialog {
|
||||
maskCanvas.addEventListener('touchmove', (event) =>
|
||||
this.draw_move(self, event)
|
||||
)
|
||||
maskCanvas.addEventListener('pointerover', (event) => {
|
||||
maskCanvas.addEventListener('pointerover', () => {
|
||||
this.brush.style.display = 'block'
|
||||
})
|
||||
maskCanvas.addEventListener('pointerleave', (event) => {
|
||||
maskCanvas.addEventListener('pointerleave', () => {
|
||||
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'
|
||||
}
|
||||
|
||||
handleWheelEvent(self, event) {
|
||||
handleWheelEvent(_, event) {
|
||||
event.preventDefault()
|
||||
|
||||
if (event.ctrlKey) {
|
||||
|
||||
@@ -2832,7 +2832,7 @@ class UIManager {
|
||||
100,
|
||||
1,
|
||||
(await this.messageBroker.pull('brushSettings')).size,
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.messageBroker.publish('setBrushSize', parseInt(value))
|
||||
this.updateBrushPreview()
|
||||
}
|
||||
@@ -2845,7 +2845,7 @@ class UIManager {
|
||||
1,
|
||||
0.01,
|
||||
(await this.messageBroker.pull('brushSettings')).opacity,
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.messageBroker.publish('setBrushOpacity', parseFloat(value))
|
||||
this.updateBrushPreview()
|
||||
}
|
||||
@@ -2858,7 +2858,7 @@ class UIManager {
|
||||
1,
|
||||
0.01,
|
||||
(await this.messageBroker.pull('brushSettings')).hardness,
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.messageBroker.publish('setBrushHardness', parseFloat(value))
|
||||
this.updateBrushPreview()
|
||||
}
|
||||
@@ -2871,7 +2871,7 @@ class UIManager {
|
||||
100,
|
||||
1,
|
||||
(await this.messageBroker.pull('brushSettings')).smoothingPrecision,
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.messageBroker.publish(
|
||||
'setBrushSmoothingPrecision',
|
||||
parseInt(value)
|
||||
@@ -2929,7 +2929,7 @@ class UIManager {
|
||||
255,
|
||||
1,
|
||||
tolerance,
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.messageBroker.publish('setPaintBucketTolerance', parseInt(value))
|
||||
}
|
||||
)
|
||||
@@ -2942,7 +2942,7 @@ class UIManager {
|
||||
100,
|
||||
1,
|
||||
fillOpacity,
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.messageBroker.publish('setFillOpacity', parseInt(value))
|
||||
}
|
||||
)
|
||||
@@ -2971,7 +2971,7 @@ class UIManager {
|
||||
255,
|
||||
1,
|
||||
tolerance,
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.messageBroker.publish('setColorSelectTolerance', parseInt(value))
|
||||
}
|
||||
)
|
||||
@@ -2983,21 +2983,21 @@ class UIManager {
|
||||
100,
|
||||
1,
|
||||
100, // Default to 100%
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.messageBroker.publish('setSelectionOpacity', parseInt(value))
|
||||
}
|
||||
)
|
||||
|
||||
const livePreviewToggle = this.createToggle(
|
||||
t('maskEditor.Live Preview'),
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.messageBroker.publish('setLivePreview', value)
|
||||
}
|
||||
)
|
||||
|
||||
const wholeImageToggle = this.createToggle(
|
||||
t('maskEditor.Apply to Whole Image'),
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.messageBroker.publish('setWholeImage', value)
|
||||
}
|
||||
)
|
||||
@@ -3006,14 +3006,14 @@ class UIManager {
|
||||
const methodSelect = this.createDropdown(
|
||||
t('maskEditor.Method'),
|
||||
methodOptions,
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.messageBroker.publish('setColorComparisonMethod', value)
|
||||
}
|
||||
)
|
||||
|
||||
const maskBoundaryToggle = this.createToggle(
|
||||
t('maskEditor.Stop at mask'),
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.messageBroker.publish('setMaskBoundary', value)
|
||||
}
|
||||
)
|
||||
@@ -3024,7 +3024,7 @@ class UIManager {
|
||||
255,
|
||||
1,
|
||||
0,
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.messageBroker.publish('setMaskTolerance', parseInt(value))
|
||||
}
|
||||
)
|
||||
@@ -3125,7 +3125,7 @@ class UIManager {
|
||||
1.0,
|
||||
0.01,
|
||||
this.mask_opacity,
|
||||
(event, value) => {
|
||||
(_, value) => {
|
||||
this.mask_opacity = parseFloat(value)
|
||||
this.maskCanvas.style.opacity = String(this.mask_opacity)
|
||||
|
||||
@@ -3635,7 +3635,7 @@ class UIManager {
|
||||
this.messageBroker.publish('pointerUp', event)
|
||||
})
|
||||
|
||||
pointer_zone.addEventListener('pointerleave', (event: PointerEvent) => {
|
||||
pointer_zone.addEventListener('pointerleave', () => {
|
||||
this.brush.style.opacity = '0'
|
||||
this.pointerZone.style.cursor = ''
|
||||
})
|
||||
@@ -3656,12 +3656,9 @@ class UIManager {
|
||||
this.messageBroker.publish('wheel', event)
|
||||
)
|
||||
|
||||
pointer_zone.addEventListener(
|
||||
'pointerenter',
|
||||
async (event: PointerEvent) => {
|
||||
this.updateCursor()
|
||||
}
|
||||
)
|
||||
pointer_zone.addEventListener('pointerenter', async () => {
|
||||
this.updateCursor()
|
||||
})
|
||||
|
||||
return pointer_zone
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class ManageTemplates extends ComfyDialog {
|
||||
createButtons() {
|
||||
const btns = super.createButtons()
|
||||
btns[0].textContent = 'Close'
|
||||
btns[0].onclick = (e) => {
|
||||
btns[0].onclick = () => {
|
||||
clearTimeout(this.saveVisualCue)
|
||||
this.close()
|
||||
}
|
||||
@@ -279,7 +279,7 @@ class ManageTemplates extends ComfyDialog {
|
||||
fontSize: '12px',
|
||||
fontWeight: 'normal'
|
||||
},
|
||||
onclick: (e) => {
|
||||
onclick: () => {
|
||||
const json = JSON.stringify({ templates: [t] }, null, 2) // convert the data to a JSON string
|
||||
const blob = new Blob([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
|
||||
|
||||
// Prevent multiple connections to different types when we have no input
|
||||
|
||||
@@ -134,7 +134,7 @@ app.registerExtension({
|
||||
})
|
||||
|
||||
const processMouseDown = LGraphCanvas.prototype.processMouseDown
|
||||
LGraphCanvas.prototype.processMouseDown = function (e) {
|
||||
LGraphCanvas.prototype.processMouseDown = function () {
|
||||
if (touchZooming || touchCount) {
|
||||
return
|
||||
}
|
||||
@@ -143,7 +143,7 @@ LGraphCanvas.prototype.processMouseDown = function (e) {
|
||||
}
|
||||
|
||||
const processMouseMove = LGraphCanvas.prototype.processMouseMove
|
||||
LGraphCanvas.prototype.processMouseMove = function (e) {
|
||||
LGraphCanvas.prototype.processMouseMove = function () {
|
||||
if (touchZooming || touchCount > 1) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -23,14 +23,14 @@ app.registerExtension({
|
||||
step: 1
|
||||
},
|
||||
defaultValue: 5,
|
||||
onChange: (newVal, oldVal) => {
|
||||
onChange: (newVal) => {
|
||||
this.setDefaults(newVal)
|
||||
}
|
||||
})
|
||||
},
|
||||
slot_types_default_out: {},
|
||||
slot_types_default_in: {},
|
||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||
async beforeRegisterNodeDef(nodeType, nodeData) {
|
||||
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
|
||||
for (const inputKey in inputs) {
|
||||
|
||||
@@ -148,7 +148,7 @@ app.registerExtension({
|
||||
|
||||
app.registerExtension({
|
||||
name: 'Comfy.UploadAudio',
|
||||
async beforeRegisterNodeDef(nodeType, nodeData: ComfyNodeDef) {
|
||||
async beforeRegisterNodeDef(_nodeType, nodeData: ComfyNodeDef) {
|
||||
if (nodeData?.input?.required?.audio?.[1]?.audio_upload === true) {
|
||||
nodeData.input.required.upload = ['AUDIOUPLOAD', {}]
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ const createUploadInput = (
|
||||
|
||||
app.registerExtension({
|
||||
name: 'Comfy.UploadImage',
|
||||
beforeRegisterNodeDef(nodeType, nodeData: ComfyNodeDef) {
|
||||
beforeRegisterNodeDef(_nodeType, nodeData: ComfyNodeDef) {
|
||||
const { input } = nodeData ?? {}
|
||||
const { required } = input ?? {}
|
||||
if (!required) return
|
||||
|
||||
@@ -9,7 +9,7 @@ const WEBCAM_READY = Symbol()
|
||||
|
||||
app.registerExtension({
|
||||
name: 'Comfy.WebcamCapture',
|
||||
getCustomWidgets(app) {
|
||||
getCustomWidgets() {
|
||||
return {
|
||||
WEBCAM(node, inputName) {
|
||||
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) {
|
||||
// Dont run while the graph is still setting up
|
||||
return
|
||||
@@ -143,7 +143,7 @@ export class PrimitiveNode extends LGraphNode {
|
||||
|
||||
onConnectOutput(
|
||||
slot: number,
|
||||
type: string,
|
||||
_type: string,
|
||||
input: INodeInputSlot,
|
||||
target_node: LGraphNode,
|
||||
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
|
||||
const origGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions
|
||||
// @ts-expect-error adding extra property
|
||||
|
||||
Reference in New Issue
Block a user