diff --git a/package-lock.json b/package-lock.json index 6ebc48a21..f4e1a0640 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.3.38", "dependencies": { "@atlaskit/pragmatic-drag-and-drop": "^1.3.1", + "@comfyorg/comfyui-electron-types": "^0.2.10", "@comfyorg/litegraph": "^0.8.24", "@primevue/themes": "^4.0.5", "@vueuse/core": "^11.0.0", @@ -32,7 +33,6 @@ "devDependencies": { "@babel/core": "^7.24.7", "@babel/preset-env": "^7.22.20", - "@comfyorg/comfyui-electron-types": "^0.2.9", "@eslint/js": "^9.8.0", "@iconify/json": "^2.2.245", "@pinia/testing": "^0.1.5", @@ -1916,10 +1916,9 @@ "dev": true }, "node_modules/@comfyorg/comfyui-electron-types": { - "version": "0.2.9", - "resolved": "https://registry.npmjs.org/@comfyorg/comfyui-electron-types/-/comfyui-electron-types-0.2.9.tgz", - "integrity": "sha512-wXmeGrQnuiEXlUkWDAnfkPgb8YTICX8EsNKSIWDb5uMSx46fW8gJQjTc1ehawV/fw1MmuqjhOpw+rV1f2+DAtw==", - "dev": true, + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/@comfyorg/comfyui-electron-types/-/comfyui-electron-types-0.2.10.tgz", + "integrity": "sha512-JwqFeqmJBp6n276Ki+VEkMkO43rFHobdt93AzJYpWC+BXGUuvTyquon/MvblWtJDnTdO0mGWGXztDFe0sXie6A==", "license": "GPL-3.0-only" }, "node_modules/@comfyorg/litegraph": { diff --git a/package.json b/package.json index ad3b463ad..b1b11e4cf 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "type": "module", "scripts": { "dev": "vite", + "dev:electron": "vite --config vite.electron.config.mts", "build": "npm run typecheck && vite build", "deploy": "npm run build && node scripts/deploy.js", "release": "node scripts/release.js", @@ -26,7 +27,6 @@ "devDependencies": { "@babel/core": "^7.24.7", "@babel/preset-env": "^7.22.20", - "@comfyorg/comfyui-electron-types": "^0.2.9", "@eslint/js": "^9.8.0", "@iconify/json": "^2.2.245", "@pinia/testing": "^0.1.5", @@ -71,6 +71,7 @@ }, "dependencies": { "@atlaskit/pragmatic-drag-and-drop": "^1.3.1", + "@comfyorg/comfyui-electron-types": "^0.2.10", "@comfyorg/litegraph": "^0.8.24", "@primevue/themes": "^4.0.5", "@vueuse/core": "^11.0.0", diff --git a/src/components/common/LogTerminal.vue b/src/components/common/LogTerminal.vue new file mode 100644 index 000000000..60ef2860b --- /dev/null +++ b/src/components/common/LogTerminal.vue @@ -0,0 +1,66 @@ + + + + + {{ log }} + + + + + diff --git a/src/components/install/WelcomeScreen.vue b/src/components/install/WelcomeScreen.vue new file mode 100644 index 000000000..08a0f637d --- /dev/null +++ b/src/components/install/WelcomeScreen.vue @@ -0,0 +1,47 @@ + + + + Welcome to ComfyUI + + + + + + + + + + + + diff --git a/src/router.ts b/src/router.ts index dd69f0953..cfbde0b03 100644 --- a/src/router.ts +++ b/src/router.ts @@ -32,6 +32,19 @@ const router = createRouter({ next('/') } } + }, + { + path: 'install', + name: 'InstallView', + component: () => import('@/views/InstallView.vue'), + beforeEnter: async (to, from, next) => { + // Only allow access to this page in electron environment + if (isElectron()) { + next() + } else { + next('/') + } + } } ] } diff --git a/src/scripts/app.ts b/src/scripts/app.ts index 5a6a2d8b4..4fd5bc3f3 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -1784,6 +1784,8 @@ export class ComfyApp { */ async setup(canvasEl: HTMLCanvasElement) { this.canvasEl = canvasEl + // Show menu container for GraphView. + this.ui.menuContainer.style.display = 'block' await this.#setUser() this.resizeCanvas() diff --git a/src/scripts/ui.ts b/src/scripts/ui.ts index fdd1b35e2..e9f828bae 100644 --- a/src/scripts/ui.ts +++ b/src/scripts/ui.ts @@ -636,6 +636,8 @@ export class ComfyUI { } }) ]) as HTMLDivElement + // Hide by default on construction so it does not interfere with other views. + this.menuContainer.style.display = 'none' this.restoreMenuPosition = dragElement(this.menuContainer, this.settings) diff --git a/src/utils/envUtil.ts b/src/utils/envUtil.ts index c656a6711..b2cb723cd 100644 --- a/src/utils/envUtil.ts +++ b/src/utils/envUtil.ts @@ -5,5 +5,5 @@ export function isElectron() { } export function electronAPI() { - return window['electronAPI'] as ElectronAPI + return (window as any)['electronAPI'] as ElectronAPI } diff --git a/src/views/InstallView.vue b/src/views/InstallView.vue new file mode 100644 index 000000000..03b0df275 --- /dev/null +++ b/src/views/InstallView.vue @@ -0,0 +1,11 @@ + + + + + + + diff --git a/src/views/ServerStartView.vue b/src/views/ServerStartView.vue index c35fbf094..81fac0a72 100644 --- a/src/views/ServerStartView.vue +++ b/src/views/ServerStartView.vue @@ -1,17 +1,44 @@ - - - - {{ $t('loading') }}{{ counter }} + {{ ProgressMessages[status] }} + diff --git a/vite.electron.config.mts b/vite.electron.config.mts new file mode 100644 index 000000000..f8a64dc29 --- /dev/null +++ b/vite.electron.config.mts @@ -0,0 +1,33 @@ +import { defineConfig, Plugin } from 'vite' +import { mergeConfig } from 'vite' +import type { UserConfig } from 'vitest/config' +import baseConfig from './vite.config.mts' +import type { ElectronAPI } from '@comfyorg/comfyui-electron-types' + +const electronAPIMock: Partial = { + sendReady: () => {}, + onShowSelectDirectory: () => {}, + onFirstTimeSetupComplete: () => {}, + onProgressUpdate: () => {}, + onLogMessage: () => {}, + isFirstTimeSetup: () => Promise.resolve(true) +} + +const mockElectronAPI: Plugin = { + name: 'mock-electron-api', + transformIndexHtml() { + return [ + { + tag: 'script', + children: `window.electronAPI = ${JSON.stringify(electronAPIMock)};` + } + ] + } +} + +export default mergeConfig( + baseConfig as unknown as UserConfig, + defineConfig({ + plugins: [mockElectronAPI] + }) +) \ No newline at end of file
{{ log }}