diff --git a/src/App.vue b/src/App.vue index 40da2e2a8..46fa6784a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -28,7 +28,7 @@ const handleKey = (e: KeyboardEvent) => { useEventListener(window, 'keydown', handleKey) useEventListener(window, 'keyup', handleKey) -const showContextMenu = (event: PointerEvent) => { +const showContextMenu = (event: MouseEvent) => { const { target } = event switch (true) { case target instanceof HTMLTextAreaElement: diff --git a/src/components/actionbar/ComfyQueueButton.vue b/src/components/actionbar/ComfyQueueButton.vue index 35aa8f3ae..e23243c13 100644 --- a/src/components/actionbar/ComfyQueueButton.vue +++ b/src/components/actionbar/ComfyQueueButton.vue @@ -135,8 +135,11 @@ const hasPendingTasks = computed( ) const commandStore = useCommandStore() -const queuePrompt = (e: MouseEvent) => { - const commandId = e.shiftKey ? 'Comfy.QueuePromptFront' : 'Comfy.QueuePrompt' +const queuePrompt = (e: Event) => { + const commandId = + 'shiftKey' in e && e.shiftKey + ? 'Comfy.QueuePromptFront' + : 'Comfy.QueuePrompt' commandStore.execute(commandId) } diff --git a/src/components/bottomPanel/tabs/terminal/BaseTerminal.vue b/src/components/bottomPanel/tabs/terminal/BaseTerminal.vue index 0dd2b5985..b92dcc7ac 100644 --- a/src/components/bottomPanel/tabs/terminal/BaseTerminal.vue +++ b/src/components/bottomPanel/tabs/terminal/BaseTerminal.vue @@ -12,11 +12,11 @@ import { Ref, onUnmounted, ref } from 'vue' import { useTerminal } from '@/composables/bottomPanelTabs/useTerminal' const emit = defineEmits<{ - created: [ReturnType, Ref] + created: [ReturnType, Ref] unmounted: [] }>() -const terminalEl = ref() -const rootEl = ref() +const terminalEl = ref() +const rootEl = ref() emit('created', useTerminal(terminalEl), rootEl) onUnmounted(() => emit('unmounted')) diff --git a/src/components/bottomPanel/tabs/terminal/CommandTerminal.vue b/src/components/bottomPanel/tabs/terminal/CommandTerminal.vue index 527c5d40b..6950ca892 100644 --- a/src/components/bottomPanel/tabs/terminal/CommandTerminal.vue +++ b/src/components/bottomPanel/tabs/terminal/CommandTerminal.vue @@ -13,7 +13,7 @@ import BaseTerminal from './BaseTerminal.vue' const terminalCreated = ( { terminal, useAutoSize }: ReturnType, - root: Ref + root: Ref ) => { const terminalApi = electronAPI().Terminal diff --git a/src/components/bottomPanel/tabs/terminal/LogsTerminal.vue b/src/components/bottomPanel/tabs/terminal/LogsTerminal.vue index f8fe342c2..5d17ec326 100644 --- a/src/components/bottomPanel/tabs/terminal/LogsTerminal.vue +++ b/src/components/bottomPanel/tabs/terminal/LogsTerminal.vue @@ -27,7 +27,7 @@ const loading = ref(true) const terminalCreated = ( { terminal, useAutoSize }: ReturnType, - root: Ref + root: Ref ) => { // `autoCols` is false because we don't want the progress bar in the terminal // to render incorrectly as the progress bar is rendered based on the diff --git a/src/components/common/DeviceInfo.vue b/src/components/common/DeviceInfo.vue index 5f81cefaf..c4164a9a5 100644 --- a/src/components/common/DeviceInfo.vue +++ b/src/components/common/DeviceInfo.vue @@ -2,7 +2,9 @@
@@ -15,7 +17,7 @@ const props = defineProps<{ device: DeviceStats }>() -const deviceColumns = [ +const deviceColumns: { field: keyof DeviceStats; header: string }[] = [ { field: 'name', header: 'Name' }, { field: 'type', header: 'Type' }, { field: 'vram_total', header: 'VRAM Total' }, diff --git a/src/components/common/EditableText.vue b/src/components/common/EditableText.vue index affdd22f7..2f253a945 100644 --- a/src/components/common/EditableText.vue +++ b/src/components/common/EditableText.vue @@ -38,9 +38,10 @@ const props = withDefaults(defineProps(), { const emit = defineEmits(['update:modelValue', 'edit']) const inputValue = ref(props.modelValue) -const inputRef = ref(null) +const inputRef = ref | undefined>() const blurInputElement = () => { + // @ts-expect-error - $el is an internal property of the InputText component inputRef.value?.$el.blur() } const finishEditing = () => { @@ -58,6 +59,7 @@ watch( : inputValue.value const start = 0 const end = fileName.length + // @ts-expect-error - $el is an internal property of the InputText component const inputElement = inputRef.value.$el inputElement.setSelectionRange?.(start, end) }) diff --git a/src/components/common/FormItem.vue b/src/components/common/FormItem.vue index 7acca557a..724c2a15c 100644 --- a/src/components/common/FormItem.vue +++ b/src/components/common/FormItem.vue @@ -72,7 +72,7 @@ function getFormAttrs(item: FormItem) { item.options(formValue.value) : item.options - if (typeof item.options[0] !== 'string') { + if (typeof item.options?.[0] !== 'string') { attrs['optionLabel'] = 'text' attrs['optionValue'] = 'value' } diff --git a/src/components/common/InputKnob.vue b/src/components/common/InputKnob.vue index 60d0ce0cc..eecb9e957 100644 --- a/src/components/common/InputKnob.vue +++ b/src/components/common/InputKnob.vue @@ -76,7 +76,7 @@ const updateValue = (newValue: number | null) => { const displayValue = (value: number): string => { updateValue(value) - const stepString = props.step.toString() + const stepString = (props.step ?? 1).toString() const resolution = stepString.includes('.') ? stepString.split('.')[1].length : 0 diff --git a/src/components/common/InputSlider.vue b/src/components/common/InputSlider.vue index 4a1284967..face9bcc1 100644 --- a/src/components/common/InputSlider.vue +++ b/src/components/common/InputSlider.vue @@ -2,7 +2,7 @@
({ argv: props.stats.system.argv.join(' ') })) -const systemColumns = [ - { field: 'os', header: 'OS' }, - { field: 'python_version', header: 'Python Version' }, - { field: 'embedded_python', header: 'Embedded Python' }, - { field: 'pytorch_version', header: 'Pytorch Version' }, - { field: 'argv', header: 'Arguments' }, - { field: 'ram_total', header: 'RAM Total' }, - { field: 'ram_free', header: 'RAM Free' } -] +const systemColumns: { field: keyof SystemStats['system']; header: string }[] = + [ + { field: 'os', header: 'OS' }, + { field: 'python_version', header: 'Python Version' }, + { field: 'embedded_python', header: 'Embedded Python' }, + { field: 'pytorch_version', header: 'Pytorch Version' }, + { field: 'argv', header: 'Arguments' }, + { field: 'ram_total', header: 'RAM Total' }, + { field: 'ram_free', header: 'RAM Free' } + ] const formatValue = (value: any, field: string) => { if (['ram_total', 'ram_free'].includes(field)) { diff --git a/src/components/common/TreeExplorer.vue b/src/components/common/TreeExplorer.vue index 8e34a05c6..5ef0f891e 100644 --- a/src/components/common/TreeExplorer.vue +++ b/src/components/common/TreeExplorer.vue @@ -53,7 +53,9 @@ import { } from '@/types/treeExplorerTypes' import { combineTrees, findNodeByKey } from '@/utils/treeUtil' -const expandedKeys = defineModel>('expandedKeys') +const expandedKeys = defineModel>('expandedKeys', { + required: true +}) provide(InjectKeyExpandedKeys, expandedKeys) const selectionKeys = defineModel>('selectionKeys') // Tracks whether the caller has set the selectionKeys model. @@ -103,7 +105,7 @@ const getTreeNodeIcon = (node: TreeExplorerNode) => { return isExpanded ? 'pi pi-folder-open' : 'pi pi-folder' } const fillNodeInfo = (node: TreeExplorerNode): RenderedTreeExplorerNode => { - const children = node.children?.map(fillNodeInfo) + const children = node.children?.map(fillNodeInfo) ?? [] const totalLeaves = node.leaf ? 1 : children.reduce((acc, child) => acc + child.totalLeaves, 0) @@ -113,7 +115,7 @@ const fillNodeInfo = (node: TreeExplorerNode): RenderedTreeExplorerNode => { children, type: node.leaf ? 'node' : 'folder', totalLeaves, - badgeText: node.getBadgeText ? node.getBadgeText() : null, + badgeText: node.getBadgeText ? node.getBadgeText() : undefined, isEditingLabel: node.key === renameEditingNode.value?.key } } @@ -149,7 +151,7 @@ const handleNodeLabelEdit = async ( if (node.key === newFolderNode.value?.key) { await handleFolderCreation(newName) } else { - await node.handleRename(newName) + await node.handleRename?.(newName) } }, node.handleError, diff --git a/src/components/common/TreeExplorerTreeNode.vue b/src/components/common/TreeExplorerTreeNode.vue index 4da9a0d34..a8987c566 100644 --- a/src/components/common/TreeExplorerTreeNode.vue +++ b/src/components/common/TreeExplorerTreeNode.vue @@ -76,10 +76,10 @@ const nodeBadgeText = computed(() => { }) const showNodeBadgeText = computed(() => nodeBadgeText.value !== '') -const isEditing = computed(() => props.node.isEditingLabel) +const isEditing = computed(() => props.node.isEditingLabel ?? false) const handleEditLabel = inject(InjectKeyHandleEditLabelFunction) const handleRename = (newName: string) => { - handleEditLabel(props.node, newName) + handleEditLabel?.(props.node, newName) } const container = ref(null) @@ -102,7 +102,7 @@ if (props.node.draggable) { ? ({ nativeSetDragImage }) => { setCustomNativeDragPreview({ render: ({ container }) => { - return props.node.renderDragPreview(container) + return props.node.renderDragPreview?.(container) }, nativeSetDragImage }) diff --git a/src/components/sidebar/tabs/WorkflowsSidebarTab.vue b/src/components/sidebar/tabs/WorkflowsSidebarTab.vue index 428c113a7..c019e4afc 100644 --- a/src/components/sidebar/tabs/WorkflowsSidebarTab.vue +++ b/src/components/sidebar/tabs/WorkflowsSidebarTab.vue @@ -34,6 +34,7 @@