mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 12:42:01 +00:00
Compare commits
1 Commits
5252-keybo
...
sno-fix-li
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5541edcec7 |
31
.github/actions/setup-playwright/action.yml
vendored
31
.github/actions/setup-playwright/action.yml
vendored
@@ -1,31 +0,0 @@
|
||||
name: Setup Playwright
|
||||
description: Cache and install Playwright browsers with dependencies
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Detect Playwright version
|
||||
id: detect-version
|
||||
shell: bash
|
||||
working-directory: ComfyUI_frontend
|
||||
run: |
|
||||
PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --json | jq --raw-output '.[0].devDependencies["@playwright/test"].version')
|
||||
echo "playwright-version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache Playwright Browsers
|
||||
uses: actions/cache@v4
|
||||
id: cache-playwright-browsers
|
||||
with:
|
||||
path: '~/.cache/ms-playwright'
|
||||
key: ${{ runner.os }}-playwright-browsers-${{ steps.detect-version.outputs.playwright-version }}
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: pnpm exec playwright install chromium --with-deps
|
||||
working-directory: ComfyUI_frontend
|
||||
|
||||
- name: Install Playwright Browsers (operating system dependencies)
|
||||
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
|
||||
shell: bash
|
||||
run: pnpm exec playwright install-deps
|
||||
working-directory: ComfyUI_frontend
|
||||
6
.github/workflows/lint-and-format.yaml
vendored
6
.github/workflows/lint-and-format.yaml
vendored
@@ -15,7 +15,9 @@ jobs:
|
||||
- name: Checkout PR
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || github.ref }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/head
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
@@ -100,4 +102,4 @@ jobs:
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: '## ⚠️ Linting/Formatting Issues Found\n\nThis PR has linting or formatting issues that need to be fixed.\n\n**Since this PR is from a fork, auto-fix cannot be applied automatically.**\n\n### Option 1: Set up pre-commit hooks (recommended)\nRun this once to automatically format code on every commit:\n```bash\npnpm prepare\n```\n\n### Option 2: Fix manually\nRun these commands and push the changes:\n```bash\npnpm lint:fix\npnpm format\n```\n\nSee [CONTRIBUTING.md](https://github.com/Comfy-Org/ComfyUI_frontend/blob/main/CONTRIBUTING.md#git-pre-commit-hooks) for more details.'
|
||||
})
|
||||
})
|
||||
43
.github/workflows/tests-ci.yaml
vendored
43
.github/workflows/tests-ci.yaml
vendored
@@ -12,6 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
cache-key: ${{ steps.cache-key.outputs.key }}
|
||||
playwright-version: ${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }}
|
||||
steps:
|
||||
- name: Checkout ComfyUI
|
||||
uses: actions/checkout@v5
|
||||
@@ -64,6 +65,12 @@ jobs:
|
||||
id: cache-key
|
||||
run: echo "key=$(date +%s)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Playwright Version
|
||||
id: playwright-version
|
||||
run: |
|
||||
PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --json | jq --raw-output '.[0].devDependencies["@playwright/test"].version')
|
||||
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
|
||||
working-directory: ComfyUI_frontend
|
||||
|
||||
- name: Save cache
|
||||
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684
|
||||
@@ -116,8 +123,22 @@ jobs:
|
||||
working-directory: ComfyUI
|
||||
|
||||
|
||||
- name: Setup Playwright
|
||||
uses: ./ComfyUI_frontend/.github/actions/setup-playwright
|
||||
- name: Cache Playwright Browsers
|
||||
uses: actions/cache@v4
|
||||
id: cache-playwright-browsers
|
||||
with:
|
||||
path: '~/.cache/ms-playwright'
|
||||
key: '${{ runner.os }}-playwright-browsers-${{ needs.setup.outputs.playwright-version }}'
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
|
||||
run: pnpm exec playwright install chromium --with-deps
|
||||
working-directory: ComfyUI_frontend
|
||||
|
||||
- name: Install Playwright Browsers (operating system dependencies)
|
||||
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
|
||||
run: pnpm exec playwright install-deps
|
||||
working-directory: ComfyUI_frontend
|
||||
|
||||
- name: Start ComfyUI server
|
||||
run: |
|
||||
@@ -181,8 +202,22 @@ jobs:
|
||||
pip install wait-for-it
|
||||
working-directory: ComfyUI
|
||||
|
||||
- name: Setup Playwright
|
||||
uses: ./ComfyUI_frontend/.github/actions/setup-playwright
|
||||
- name: Cache Playwright Browsers
|
||||
uses: actions/cache@v4
|
||||
id: cache-playwright-browsers
|
||||
with:
|
||||
path: '~/.cache/ms-playwright'
|
||||
key: '${{ runner.os }}-playwright-browsers-${{ needs.setup.outputs.playwright-version }}'
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
|
||||
run: pnpm exec playwright install chromium --with-deps
|
||||
working-directory: ComfyUI_frontend
|
||||
|
||||
- name: Install Playwright Browsers (operating system dependencies)
|
||||
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
|
||||
run: pnpm exec playwright install-deps
|
||||
working-directory: ComfyUI_frontend
|
||||
|
||||
- name: Start ComfyUI server
|
||||
run: |
|
||||
|
||||
@@ -77,8 +77,9 @@ jobs:
|
||||
python main.py --cpu --multi-user &
|
||||
wait-for-it --service 127.0.0.1:8188 -t 600
|
||||
working-directory: ComfyUI
|
||||
- name: Setup Playwright
|
||||
uses: ./ComfyUI_frontend/.github/actions/setup-playwright
|
||||
- name: Install Playwright Browsers
|
||||
run: pnpm exec playwright install chromium --with-deps
|
||||
working-directory: ComfyUI_frontend
|
||||
- name: Start dev server
|
||||
# Run electron dev server as it is a superset of the web dev server
|
||||
# We do want electron specific UIs to be translated.
|
||||
|
||||
12
.github/workflows/update-locales.yaml
vendored
12
.github/workflows/update-locales.yaml
vendored
@@ -26,8 +26,16 @@ jobs:
|
||||
key: i18n-tools-cache-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
i18n-tools-cache-${{ runner.os }}-
|
||||
- name: Setup Playwright
|
||||
uses: ./.github/actions/setup-playwright
|
||||
- name: Cache Playwright browsers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-browsers-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
playwright-browsers-${{ runner.os }}-
|
||||
- name: Install Playwright Browsers
|
||||
run: pnpm exec playwright install chromium --with-deps
|
||||
working-directory: ComfyUI_frontend
|
||||
- name: Start dev server
|
||||
# Run electron dev server as it is a superset of the web dev server
|
||||
# We do want electron specific UIs to be translated.
|
||||
|
||||
@@ -13,9 +13,11 @@ jobs:
|
||||
update-locales:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: Comfy-Org/ComfyUI_frontend_setup_action@v3
|
||||
- name: Setup Playwright
|
||||
uses: ./.github/actions/setup-playwright
|
||||
- name: Setup Frontend
|
||||
uses: ./.github/actions/setup-frontend
|
||||
- name: Install Playwright Browsers
|
||||
run: pnpm exec playwright install chromium --with-deps
|
||||
working-directory: ComfyUI_frontend
|
||||
- name: Start dev server
|
||||
# Run electron dev server as it is a superset of the web dev server
|
||||
# We do want electron specific UIs to be translated.
|
||||
|
||||
@@ -14,8 +14,16 @@ jobs:
|
||||
uses: actions/checkout@v5
|
||||
- name: Setup Frontend
|
||||
uses: ./.github/actions/setup-frontend
|
||||
- name: Setup Playwright
|
||||
uses: ./.github/actions/setup-playwright
|
||||
- name: Cache Playwright browsers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-browsers-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
playwright-browsers-${{ runner.os }}-
|
||||
- name: Install Playwright Browsers
|
||||
run: pnpm exec playwright install chromium --with-deps
|
||||
working-directory: ComfyUI_frontend
|
||||
- name: Run Playwright tests and update snapshots
|
||||
id: playwright-tests
|
||||
run: pnpm exec playwright test --update-snapshots
|
||||
|
||||
1039
docs/keybinding.md
1039
docs/keybinding.md
File diff suppressed because it is too large
Load Diff
@@ -90,7 +90,6 @@ export default defineConfig([
|
||||
}
|
||||
],
|
||||
'unused-imports/no-unused-imports': 'error',
|
||||
'no-console': ['error', { allow: ['warn', 'error'] }],
|
||||
'vue/no-v-html': 'off',
|
||||
// Enforce dark-theme: instead of dark: prefix
|
||||
'vue/no-restricted-class': ['error', '/^dark:/'],
|
||||
@@ -208,11 +207,5 @@ export default defineConfig([
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['**/*.{test,spec,stories}.ts', '**/*.stories.vue'],
|
||||
rules: {
|
||||
'no-console': 'off'
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
@@ -20,6 +20,7 @@ const config: KnipConfig = {
|
||||
project: ['src/**/*.{js,ts}', '*.{js,ts,mts}']
|
||||
},
|
||||
'packages/registry-types': {
|
||||
entry: ['src/comfyRegistryTypes.ts'],
|
||||
project: ['src/**/*.{js,ts}']
|
||||
}
|
||||
},
|
||||
|
||||
164
package.json
164
package.json
@@ -42,82 +42,82 @@
|
||||
"devtools:pycheck": "python3 -m compileall -q tools/devtools"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "catalog:",
|
||||
"@intlify/eslint-plugin-vue-i18n": "catalog:",
|
||||
"@lobehub/i18n-cli": "catalog:",
|
||||
"@nx/eslint": "catalog:",
|
||||
"@nx/playwright": "catalog:",
|
||||
"@nx/storybook": "catalog:",
|
||||
"@nx/vite": "catalog:",
|
||||
"@pinia/testing": "catalog:",
|
||||
"@playwright/test": "catalog:",
|
||||
"@storybook/addon-docs": "catalog:",
|
||||
"@storybook/vue3": "catalog:",
|
||||
"@storybook/vue3-vite": "catalog:",
|
||||
"@tailwindcss/vite": "catalog:",
|
||||
"@trivago/prettier-plugin-sort-imports": "catalog:",
|
||||
"@types/fs-extra": "catalog:",
|
||||
"@types/jsdom": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"@types/semver": "catalog:",
|
||||
"@types/three": "catalog:",
|
||||
"@vitejs/plugin-vue": "catalog:",
|
||||
"@vitest/coverage-v8": "catalog:",
|
||||
"@vitest/ui": "catalog:",
|
||||
"@vue/test-utils": "catalog:",
|
||||
"eslint": "catalog:",
|
||||
"eslint-config-prettier": "catalog:",
|
||||
"eslint-plugin-prettier": "catalog:",
|
||||
"eslint-plugin-storybook": "catalog:",
|
||||
"eslint-plugin-unused-imports": "catalog:",
|
||||
"eslint-plugin-vue": "catalog:",
|
||||
"@eslint/js": "^9.35.0",
|
||||
"@intlify/eslint-plugin-vue-i18n": "^4.1.0",
|
||||
"@lobehub/i18n-cli": "^1.25.1",
|
||||
"@nx/eslint": "21.4.1",
|
||||
"@nx/playwright": "21.4.1",
|
||||
"@nx/storybook": "21.4.1",
|
||||
"@nx/vite": "21.4.1",
|
||||
"@pinia/testing": "^0.1.5",
|
||||
"@playwright/test": "^1.52.0",
|
||||
"@storybook/addon-docs": "^9.1.1",
|
||||
"@storybook/vue3": "^9.1.1",
|
||||
"@storybook/vue3-vite": "^9.1.1",
|
||||
"@tailwindcss/vite": "^4.1.12",
|
||||
"@trivago/prettier-plugin-sort-imports": "^5.2.0",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/jsdom": "^21.1.7",
|
||||
"@types/node": "^20.14.8",
|
||||
"@types/semver": "^7.7.0",
|
||||
"@types/three": "^0.169.0",
|
||||
"@vitejs/plugin-vue": "^5.1.4",
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"@vitest/ui": "^3.0.0",
|
||||
"@vue/test-utils": "^2.4.6",
|
||||
"eslint": "^9.34.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-prettier": "^5.5.4",
|
||||
"eslint-plugin-storybook": "^9.1.6",
|
||||
"eslint-plugin-unused-imports": "^4.2.0",
|
||||
"eslint-plugin-vue": "^10.4.0",
|
||||
"fs-extra": "^11.2.0",
|
||||
"globals": "catalog:",
|
||||
"happy-dom": "catalog:",
|
||||
"husky": "catalog:",
|
||||
"jiti": "catalog:",
|
||||
"jsdom": "catalog:",
|
||||
"knip": "catalog:",
|
||||
"lint-staged": "catalog:",
|
||||
"nx": "catalog:",
|
||||
"prettier": "catalog:",
|
||||
"storybook": "catalog:",
|
||||
"tailwindcss": "catalog:",
|
||||
"tailwindcss-primeui": "catalog:",
|
||||
"tsx": "catalog:",
|
||||
"tw-animate-css": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"typescript-eslint": "catalog:",
|
||||
"unplugin-icons": "catalog:",
|
||||
"unplugin-vue-components": "catalog:",
|
||||
"globals": "^15.9.0",
|
||||
"happy-dom": "^15.11.0",
|
||||
"husky": "^9.0.11",
|
||||
"jiti": "2.4.2",
|
||||
"jsdom": "^26.1.0",
|
||||
"knip": "^5.62.0",
|
||||
"lint-staged": "^15.2.7",
|
||||
"nx": "21.4.1",
|
||||
"prettier": "^3.3.2",
|
||||
"storybook": "^9.1.6",
|
||||
"tailwindcss": "^4.1.12",
|
||||
"tailwindcss-primeui": "^0.6.1",
|
||||
"tsx": "^4.15.6",
|
||||
"tw-animate-css": "^1.3.8",
|
||||
"typescript": "^5.4.5",
|
||||
"typescript-eslint": "^8.44.0",
|
||||
"unplugin-icons": "^0.22.0",
|
||||
"unplugin-vue-components": "^0.28.0",
|
||||
"uuid": "^11.1.0",
|
||||
"vite": "catalog:",
|
||||
"vite-plugin-dts": "catalog:",
|
||||
"vite-plugin-html": "catalog:",
|
||||
"vite-plugin-vue-devtools": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
"vue-component-type-helpers": "catalog:",
|
||||
"vue-eslint-parser": "catalog:",
|
||||
"vue-tsc": "catalog:",
|
||||
"vite": "^5.4.19",
|
||||
"vite-plugin-dts": "^4.5.4",
|
||||
"vite-plugin-html": "^3.2.2",
|
||||
"vite-plugin-vue-devtools": "^7.7.6",
|
||||
"vitest": "^3.2.4",
|
||||
"vue-component-type-helpers": "^3.0.7",
|
||||
"vue-eslint-parser": "^10.2.0",
|
||||
"vue-tsc": "^3.0.7",
|
||||
"zip-dir": "^2.0.0",
|
||||
"zod-to-json-schema": "catalog:"
|
||||
"zod-to-json-schema": "^3.24.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alloc/quick-lru": "catalog:",
|
||||
"@alloc/quick-lru": "^5.2.0",
|
||||
"@atlaskit/pragmatic-drag-and-drop": "^1.3.1",
|
||||
"@comfyorg/comfyui-electron-types": "0.4.73-0",
|
||||
"@comfyorg/design-system": "workspace:*",
|
||||
"@comfyorg/registry-types": "workspace:*",
|
||||
"@comfyorg/tailwind-utils": "workspace:*",
|
||||
"@iconify/json": "catalog:",
|
||||
"@primeuix/forms": "catalog:",
|
||||
"@primeuix/styled": "catalog:",
|
||||
"@primeuix/utils": "catalog:",
|
||||
"@primevue/core": "catalog:",
|
||||
"@primevue/forms": "catalog:",
|
||||
"@primevue/icons": "catalog:",
|
||||
"@primevue/themes": "catalog:",
|
||||
"@sentry/vue": "catalog:",
|
||||
"@iconify/json": "^2.2.380",
|
||||
"@primeuix/forms": "0.0.2",
|
||||
"@primeuix/styled": "0.3.2",
|
||||
"@primeuix/utils": "^0.3.2",
|
||||
"@primevue/core": "^4.2.5",
|
||||
"@primevue/forms": "^4.2.5",
|
||||
"@primevue/icons": "4.2.5",
|
||||
"@primevue/themes": "^4.2.5",
|
||||
"@sentry/vue": "^8.48.0",
|
||||
"@tiptap/core": "^2.10.4",
|
||||
"@tiptap/extension-link": "^2.10.4",
|
||||
"@tiptap/extension-table": "^2.10.4",
|
||||
@@ -125,39 +125,39 @@
|
||||
"@tiptap/extension-table-header": "^2.10.4",
|
||||
"@tiptap/extension-table-row": "^2.10.4",
|
||||
"@tiptap/starter-kit": "^2.10.4",
|
||||
"@vueuse/core": "catalog:",
|
||||
"@vueuse/integrations": "catalog:",
|
||||
"@vueuse/core": "^11.0.0",
|
||||
"@vueuse/integrations": "^13.9.0",
|
||||
"@xterm/addon-fit": "^0.10.0",
|
||||
"@xterm/addon-serialize": "^0.13.0",
|
||||
"@xterm/xterm": "^5.5.0",
|
||||
"algoliasearch": "catalog:",
|
||||
"axios": "catalog:",
|
||||
"algoliasearch": "^5.21.0",
|
||||
"axios": "^1.8.2",
|
||||
"chart.js": "^4.5.0",
|
||||
"dompurify": "^3.2.5",
|
||||
"dotenv": "catalog:",
|
||||
"dotenv": "^16.4.5",
|
||||
"es-toolkit": "^1.39.9",
|
||||
"extendable-media-recorder": "^9.2.27",
|
||||
"extendable-media-recorder-wav-encoder": "^7.0.129",
|
||||
"fast-glob": "^3.3.3",
|
||||
"firebase": "catalog:",
|
||||
"firebase": "^11.6.0",
|
||||
"fuse.js": "^7.0.0",
|
||||
"glob": "^11.0.3",
|
||||
"jsondiffpatch": "^0.6.0",
|
||||
"loglevel": "^1.9.2",
|
||||
"marked": "^15.0.11",
|
||||
"pinia": "catalog:",
|
||||
"primeicons": "catalog:",
|
||||
"primevue": "catalog:",
|
||||
"pinia": "^2.1.7",
|
||||
"primeicons": "^7.0.0",
|
||||
"primevue": "^4.2.5",
|
||||
"reka-ui": "^2.5.0",
|
||||
"semver": "^7.7.2",
|
||||
"three": "^0.170.0",
|
||||
"tiptap-markdown": "^0.8.10",
|
||||
"vue": "catalog:",
|
||||
"vue-i18n": "catalog:",
|
||||
"vue-router": "catalog:",
|
||||
"vuefire": "catalog:",
|
||||
"yjs": "catalog:",
|
||||
"zod": "catalog:",
|
||||
"zod-validation-error": "catalog:"
|
||||
"vue": "^3.5.13",
|
||||
"vue-i18n": "^9.14.3",
|
||||
"vue-router": "^4.4.3",
|
||||
"vuefire": "^3.2.1",
|
||||
"yjs": "^13.6.27",
|
||||
"zod": "^3.23.8",
|
||||
"zod-validation-error": "^3.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
"description": "Shared design system for ComfyUI Frontend",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"./tailwind-config": "./tailwind.config.ts",
|
||||
"./tailwind-config": {
|
||||
"import": "./tailwind.config.ts",
|
||||
"types": "./tailwind.config.ts"
|
||||
},
|
||||
"./css/*": "./src/css/*"
|
||||
},
|
||||
"scripts": {
|
||||
@@ -17,12 +20,12 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@iconify-json/lucide": "catalog:",
|
||||
"@iconify/tailwind": "catalog:"
|
||||
"@iconify-json/lucide": "^1.1.178",
|
||||
"@iconify/tailwind": "^1.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tailwindcss": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
"tailwindcss": "^3.4.17",
|
||||
"typescript": "^5.4.5"
|
||||
},
|
||||
"packageManager": "pnpm@10.17.1"
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Everything below here to be cleaned up over time. */
|
||||
/* Everthing below here to be cleaned up over time. */
|
||||
|
||||
body {
|
||||
width: 100vw;
|
||||
|
||||
@@ -1125,7 +1125,7 @@ export interface paths {
|
||||
}
|
||||
get?: never
|
||||
put?: never
|
||||
/** Create a new custom node using admin privilege */
|
||||
/** Create a new custom node using admin priviledge */
|
||||
post: operations['adminCreateNode']
|
||||
delete?: never
|
||||
options?: never
|
||||
@@ -16383,7 +16383,7 @@ export interface operations {
|
||||
}
|
||||
}
|
||||
responses: {
|
||||
/** @description Webhook processed successfully */
|
||||
/** @description Webhook processed succesfully */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
"./networkUtil": "./src/networkUtil.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "catalog:"
|
||||
"axios": "^1.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "catalog:"
|
||||
"typescript": "^5.9.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
".": {
|
||||
"import": "./src/index.ts",
|
||||
"types": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit"
|
||||
@@ -22,6 +25,6 @@
|
||||
"tailwind-merge": "^2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "catalog:"
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
887
pnpm-lock.yaml
generated
887
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -84,7 +84,6 @@ catalog:
|
||||
|
||||
# Data and validation
|
||||
algoliasearch: ^5.21.0
|
||||
axios: ^1.8.2
|
||||
firebase: ^11.6.0
|
||||
yjs: ^13.6.27
|
||||
zod: ^3.23.8
|
||||
|
||||
@@ -44,6 +44,7 @@ const showContextMenu = (event: MouseEvent) => {
|
||||
onMounted(() => {
|
||||
// @ts-expect-error fixme ts strict error
|
||||
window['__COMFYUI_FRONTEND_VERSION__'] = config.app_version
|
||||
console.log('ComfyUI Front-end version:', config.app_version)
|
||||
|
||||
if (isElectron()) {
|
||||
document.addEventListener('contextmenu', showContextMenu)
|
||||
|
||||
@@ -69,7 +69,7 @@ const terminalCreated = (
|
||||
await loadLogEntries()
|
||||
} catch (err) {
|
||||
console.error('Error loading logs', err)
|
||||
// On older backends the endpoints won't exist
|
||||
// On older backends the endpoints wont exist
|
||||
errorMessage.value =
|
||||
'Unable to load logs, please ensure you have updated your ComfyUI backend.'
|
||||
return
|
||||
|
||||
@@ -45,39 +45,37 @@
|
||||
<span class="text-muted">{{ t('auth.login.orContinueWith') }}</span>
|
||||
</Divider>
|
||||
|
||||
<!-- Social Login Buttons (hidden if host not whitelisted) -->
|
||||
<!-- Social Login Buttons -->
|
||||
<div class="flex flex-col gap-6">
|
||||
<template v-if="ssoAllowed">
|
||||
<Button
|
||||
type="button"
|
||||
class="h-10"
|
||||
severity="secondary"
|
||||
outlined
|
||||
@click="signInWithGoogle"
|
||||
>
|
||||
<i class="pi pi-google mr-2"></i>
|
||||
{{
|
||||
isSignIn
|
||||
? t('auth.login.loginWithGoogle')
|
||||
: t('auth.signup.signUpWithGoogle')
|
||||
}}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
class="h-10"
|
||||
severity="secondary"
|
||||
outlined
|
||||
@click="signInWithGoogle"
|
||||
>
|
||||
<i class="pi pi-google mr-2"></i>
|
||||
{{
|
||||
isSignIn
|
||||
? t('auth.login.loginWithGoogle')
|
||||
: t('auth.signup.signUpWithGoogle')
|
||||
}}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
class="h-10"
|
||||
severity="secondary"
|
||||
outlined
|
||||
@click="signInWithGithub"
|
||||
>
|
||||
<i class="pi pi-github mr-2"></i>
|
||||
{{
|
||||
isSignIn
|
||||
? t('auth.login.loginWithGithub')
|
||||
: t('auth.signup.signUpWithGithub')
|
||||
}}
|
||||
</Button>
|
||||
</template>
|
||||
<Button
|
||||
type="button"
|
||||
class="h-10"
|
||||
severity="secondary"
|
||||
outlined
|
||||
@click="signInWithGithub"
|
||||
>
|
||||
<i class="pi pi-github mr-2"></i>
|
||||
{{
|
||||
isSignIn
|
||||
? t('auth.login.loginWithGithub')
|
||||
: t('auth.signup.signUpWithGithub')
|
||||
}}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
@@ -151,7 +149,6 @@ import { useI18n } from 'vue-i18n'
|
||||
import { useFirebaseAuthActions } from '@/composables/auth/useFirebaseAuthActions'
|
||||
import { COMFY_PLATFORM_BASE_URL } from '@/config/comfyApi'
|
||||
import type { SignInData, SignUpData } from '@/schemas/signInSchema'
|
||||
import { isHostWhitelisted, normalizeHost } from '@/utils/hostWhitelist'
|
||||
import { isInChina } from '@/utils/networkUtil'
|
||||
|
||||
import ApiKeyForm from './signin/ApiKeyForm.vue'
|
||||
@@ -167,7 +164,6 @@ const authActions = useFirebaseAuthActions()
|
||||
const isSecureContext = window.isSecureContext
|
||||
const isSignIn = ref(true)
|
||||
const showApiKeyForm = ref(false)
|
||||
const ssoAllowed = isHostWhitelisted(normalizeHost(window.location.hostname))
|
||||
|
||||
const toggleState = () => {
|
||||
isSignIn.value = !isSignIn.value
|
||||
|
||||
@@ -237,7 +237,7 @@ async function removeKeybinding(commandData: ICommandData) {
|
||||
async function captureKeybinding(event: KeyboardEvent) {
|
||||
// Allow the use of keyboard shortcuts when adding keyboard shortcuts
|
||||
if (!event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) {
|
||||
switch (event.code) {
|
||||
switch (event.key) {
|
||||
case 'Escape':
|
||||
cancelEdit()
|
||||
return
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, provide, ref } from 'vue'
|
||||
import { computed, provide, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import IconButton from '@/components/button/IconButton.vue'
|
||||
@@ -202,4 +202,12 @@ const selectedSort = ref<string>('popular')
|
||||
const selectedNavItem = ref<string | null>('installed')
|
||||
|
||||
const gridStyle = computed(() => createGridStyle())
|
||||
|
||||
watch(searchText, (newQuery) => {
|
||||
console.log('searchText:', searchText.value, newQuery)
|
||||
})
|
||||
|
||||
watch(searchQuery, (newQuery) => {
|
||||
console.log('searchQuery:', searchQuery.value, newQuery)
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -86,7 +86,7 @@ const createStoryTemplate = (args: StoryArgs) => ({
|
||||
const t = (k: string) => k
|
||||
|
||||
const onClose = () => {
|
||||
// OnClose handler for story
|
||||
console.log('OnClose invoked')
|
||||
}
|
||||
provide(OnCloseKey, onClose)
|
||||
|
||||
|
||||
@@ -300,6 +300,9 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
|
||||
const modeValue = String(modeWidget.value)
|
||||
const durationValue = String(durationWidget.value)
|
||||
const modelValue = String(modelWidget.value)
|
||||
console.log('modelValue', modelValue)
|
||||
console.log('modeValue', modeValue)
|
||||
console.log('durationValue', durationValue)
|
||||
|
||||
// Same pricing matrix as KlingTextToVideoNode
|
||||
if (modelValue.includes('v1-6') || modelValue.includes('v1-5')) {
|
||||
@@ -353,6 +356,9 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
|
||||
const modeValue = String(modeWidget.value)
|
||||
const durationValue = String(durationWidget.value)
|
||||
const modelValue = String(modelWidget.value)
|
||||
console.log('modelValue', modelValue)
|
||||
console.log('modeValue', modeValue)
|
||||
console.log('durationValue', durationValue)
|
||||
|
||||
// Same pricing matrix as KlingTextToVideoNode
|
||||
if (
|
||||
@@ -558,6 +564,9 @@ const apiNodeCosts: Record<string, { displayPrice: string | PricingFunction }> =
|
||||
const model = String(modelWidget.value)
|
||||
const resolution = String(resolutionWidget.value).toLowerCase()
|
||||
const duration = String(durationWidget.value)
|
||||
console.log('model', model)
|
||||
console.log('resolution', resolution)
|
||||
console.log('duration', duration)
|
||||
|
||||
if (model.includes('ray-flash-2')) {
|
||||
if (duration.includes('5s')) {
|
||||
|
||||
@@ -26,58 +26,58 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyR'
|
||||
key: 'r'
|
||||
},
|
||||
commandId: 'Comfy.RefreshNodeDefinitions'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyQ'
|
||||
key: 'q'
|
||||
},
|
||||
commandId: 'Workspace.ToggleSidebarTab.queue'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyW'
|
||||
key: 'w'
|
||||
},
|
||||
commandId: 'Workspace.ToggleSidebarTab.workflows'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyN'
|
||||
key: 'n'
|
||||
},
|
||||
commandId: 'Workspace.ToggleSidebarTab.node-library'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyM'
|
||||
key: 'm'
|
||||
},
|
||||
commandId: 'Workspace.ToggleSidebarTab.model-library'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyS',
|
||||
key: 's',
|
||||
ctrl: true
|
||||
},
|
||||
commandId: 'Comfy.SaveWorkflow'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyO',
|
||||
key: 'o',
|
||||
ctrl: true
|
||||
},
|
||||
commandId: 'Comfy.OpenWorkflow'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyG',
|
||||
key: 'g',
|
||||
ctrl: true
|
||||
},
|
||||
commandId: 'Comfy.Graph.GroupSelectedNodes'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'Comma',
|
||||
key: ',',
|
||||
ctrl: true
|
||||
},
|
||||
commandId: 'Comfy.ShowSettingsDialog'
|
||||
@@ -85,7 +85,7 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
// For '=' both holding shift and not holding shift
|
||||
{
|
||||
combo: {
|
||||
key: 'Equal',
|
||||
key: '=',
|
||||
alt: true
|
||||
},
|
||||
commandId: 'Comfy.Canvas.ZoomIn',
|
||||
@@ -93,7 +93,7 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'Equal',
|
||||
key: '+',
|
||||
alt: true,
|
||||
shift: true
|
||||
},
|
||||
@@ -103,7 +103,7 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
// For number pad '+'
|
||||
{
|
||||
combo: {
|
||||
key: 'NumpadAdd',
|
||||
key: '+',
|
||||
alt: true
|
||||
},
|
||||
commandId: 'Comfy.Canvas.ZoomIn',
|
||||
@@ -111,7 +111,7 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'Minus',
|
||||
key: '-',
|
||||
alt: true
|
||||
},
|
||||
commandId: 'Comfy.Canvas.ZoomOut',
|
||||
@@ -119,21 +119,21 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'Period'
|
||||
key: '.'
|
||||
},
|
||||
commandId: 'Comfy.Canvas.FitView',
|
||||
targetElementId: 'graph-canvas-container'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyP'
|
||||
key: 'p'
|
||||
},
|
||||
commandId: 'Comfy.Canvas.ToggleSelected.Pin',
|
||||
targetElementId: 'graph-canvas-container'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyC',
|
||||
key: 'c',
|
||||
alt: true
|
||||
},
|
||||
commandId: 'Comfy.Canvas.ToggleSelectedNodes.Collapse',
|
||||
@@ -141,7 +141,7 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyB',
|
||||
key: 'b',
|
||||
ctrl: true
|
||||
},
|
||||
commandId: 'Comfy.Canvas.ToggleSelectedNodes.Bypass',
|
||||
@@ -149,7 +149,7 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyM',
|
||||
key: 'm',
|
||||
ctrl: true
|
||||
},
|
||||
commandId: 'Comfy.Canvas.ToggleSelectedNodes.Mute',
|
||||
@@ -157,20 +157,20 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'Backquote',
|
||||
key: '`',
|
||||
ctrl: true
|
||||
},
|
||||
commandId: 'Workspace.ToggleBottomPanelTab.logs-terminal'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyF'
|
||||
key: 'f'
|
||||
},
|
||||
commandId: 'Workspace.ToggleFocusMode'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyE',
|
||||
key: 'e',
|
||||
ctrl: true,
|
||||
shift: true
|
||||
},
|
||||
@@ -178,7 +178,7 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyM',
|
||||
key: 'm',
|
||||
alt: true
|
||||
},
|
||||
commandId: 'Comfy.Canvas.ToggleMinimap'
|
||||
@@ -187,19 +187,19 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
combo: {
|
||||
ctrl: true,
|
||||
shift: true,
|
||||
key: 'KeyK'
|
||||
key: 'k'
|
||||
},
|
||||
commandId: 'Workspace.ToggleBottomPanel.Shortcuts'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyV'
|
||||
key: 'v'
|
||||
},
|
||||
commandId: 'Comfy.Canvas.Unlock'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'KeyH'
|
||||
key: 'h'
|
||||
},
|
||||
commandId: 'Comfy.Canvas.Lock'
|
||||
},
|
||||
|
||||
@@ -344,7 +344,7 @@ export const SERVER_CONFIG_ITEMS: ServerConfig<any>[] = [
|
||||
type: 'number',
|
||||
defaultValue: null,
|
||||
tooltip:
|
||||
'Set the amount of vram in GB you want to reserve for use by your OS/other software. By default some amount is reserved depending on your OS.'
|
||||
'Set the amount of vram in GB you want to reserve for use by your OS/other software. By default some amount is reverved depending on your OS.'
|
||||
},
|
||||
|
||||
// Misc settings
|
||||
|
||||
@@ -135,7 +135,7 @@ function addProxyFromOverlay(subgraphNode: SubgraphNode, overlay: Overlay) {
|
||||
* @param {string} property - The name of the accessed value.
|
||||
* Checked for conditional logic, but never changed
|
||||
* @param {object} receiver - The object the result is set to
|
||||
* and the value used as 'this' if property is a get/set method
|
||||
* and the vlaue used as 'this' if property is a get/set method
|
||||
* @param {unknown} value - only used on set calls. The thing being assigned
|
||||
*/
|
||||
const handler = {
|
||||
|
||||
@@ -147,7 +147,7 @@ app.registerExtension({
|
||||
// @ts-expect-error fixme ts strict error
|
||||
node[WEBCAM_READY].then((v) => {
|
||||
video = v
|
||||
// If width isn't specified then use video output resolution
|
||||
// If width isnt specified then use video output resolution
|
||||
// @ts-expect-error fixme ts strict error
|
||||
if (!w.value) {
|
||||
// @ts-expect-error fixme ts strict error
|
||||
|
||||
@@ -149,7 +149,7 @@ export class PrimitiveNode extends LGraphNode {
|
||||
target_slot: number
|
||||
) {
|
||||
// Fires before the link is made allowing us to reject it if it isn't valid
|
||||
// No widget, we can't connect
|
||||
// No widget, we cant connect
|
||||
if (!input.widget && !(input.type in ComfyWidgets)) {
|
||||
return false
|
||||
}
|
||||
@@ -388,7 +388,7 @@ export class PrimitiveNode extends LGraphNode {
|
||||
}
|
||||
|
||||
onLastDisconnect() {
|
||||
// We can't remove + re-add the output here as if you drag a link over the same link
|
||||
// We cant remove + re-add the output here as if you drag a link over the same link
|
||||
// it removes, then re-adds, causing it to break
|
||||
this.outputs[0].type = '*'
|
||||
this.outputs[0].name = 'connect to widget input'
|
||||
@@ -595,7 +595,7 @@ app.registerExtension({
|
||||
|
||||
this.graph?.add(node)
|
||||
|
||||
// Calculate a position that won't directly overlap another node
|
||||
// Calculate a position that wont directly overlap another node
|
||||
const pos: [number, number] = [
|
||||
this.pos[0] - node.size[0] - 30,
|
||||
this.pos[1]
|
||||
|
||||
@@ -146,8 +146,8 @@ Litegraph has no runtime dependencies. The build tooling has been tested on Node
|
||||
|
||||
Use GitHub actions to release normal versions.
|
||||
|
||||
1. Run the `Release a New Version` action, selecting the version increment type
|
||||
1. Merge the resolution PR
|
||||
1. Run the `Release a New Version` action, selecting the version incrment type
|
||||
1. Merge the resultion PR
|
||||
1. A GitHub release is automatically published on merge
|
||||
|
||||
### Pre-release
|
||||
|
||||
@@ -274,6 +274,8 @@ export class LGraph
|
||||
* @param o data from previous serialization [optional]
|
||||
*/
|
||||
constructor(o?: ISerialisedGraph | SerialisableGraph) {
|
||||
if (LiteGraph.debug) console.log('Graph created')
|
||||
|
||||
/** @see MapProxyHandler */
|
||||
const links = this._links
|
||||
MapProxyHandler.bindAllMethods(links)
|
||||
@@ -530,7 +532,7 @@ export class LGraph
|
||||
this.errors_in_execution = true
|
||||
if (LiteGraph.throw_errors) throw error
|
||||
|
||||
if (LiteGraph.debug) console.error('Error during execution:', error)
|
||||
if (LiteGraph.debug) console.log('Error during execution:', error)
|
||||
this.stop()
|
||||
}
|
||||
}
|
||||
@@ -1126,7 +1128,7 @@ export class LGraph
|
||||
/**
|
||||
* Snaps the provided items to a grid.
|
||||
*
|
||||
* Item positions are rounded to the nearest multiple of {@link LiteGraph.CANVAS_GRID_SIZE}.
|
||||
* Item positions are reounded to the nearest multiple of {@link LiteGraph.CANVAS_GRID_SIZE}.
|
||||
*
|
||||
* When {@link LiteGraph.alwaysSnapToGrid} is enabled
|
||||
* and the grid size is falsy, a default of 1 is used.
|
||||
@@ -1165,7 +1167,7 @@ export class LGraph
|
||||
const ctor = LiteGraph.registered_node_types[node.type]
|
||||
if (node.constructor == ctor) continue
|
||||
|
||||
console.warn('node being replaced by newer version:', node.type)
|
||||
console.log('node being replaced by newer version:', node.type)
|
||||
const newnode = LiteGraph.createNode(node.type)
|
||||
if (!newnode) continue
|
||||
_nodes[i] = newnode
|
||||
@@ -1227,6 +1229,9 @@ export class LGraph
|
||||
|
||||
/* Called when something visually changed (not the graph!) */
|
||||
change(): void {
|
||||
if (LiteGraph.debug) {
|
||||
console.log('Graph changed')
|
||||
}
|
||||
this.canvasAction((c) => c.setDirty(true, true))
|
||||
this.on_change?.(this)
|
||||
}
|
||||
@@ -1621,6 +1626,12 @@ export class LGraph
|
||||
} else {
|
||||
throw new TypeError('Subgraph input node is not a SubgraphInput')
|
||||
}
|
||||
console.debug(
|
||||
'Reconnect input links in parent graph',
|
||||
{ ...link },
|
||||
this.links.get(link.id),
|
||||
this.links.get(link.id) === link
|
||||
)
|
||||
|
||||
for (const resolved of others) {
|
||||
resolved.link.disconnect(this)
|
||||
@@ -2222,7 +2233,7 @@ export class LGraph
|
||||
let node = LiteGraph.createNode(String(n_info.type), n_info.title)
|
||||
if (!node) {
|
||||
if (LiteGraph.debug)
|
||||
console.warn('Node not found or has errors:', n_info.type)
|
||||
console.log('Node not found or has errors:', n_info.type)
|
||||
|
||||
// in case of error we create a replacement node to avoid losing info
|
||||
node = new LGraphNode('')
|
||||
|
||||
@@ -461,7 +461,7 @@ export class LGraphCanvas
|
||||
}
|
||||
|
||||
const baseFontSize = LiteGraph.NODE_TEXT_SIZE // 14px
|
||||
const dprAdjustment = Math.sqrt(window.devicePixelRatio || 1) //Using sqrt here because higher DPR monitors do not linearily scale the readability of the font, instead they increase the font by some heurisitc, and to approximate we use sqrt to say basically a DPR of 2 increases the readability by 40%, 3 by 70%
|
||||
const dprAdjustment = Math.sqrt(window.devicePixelRatio || 1) //Using sqrt here because higher DPR monitors do not linearily scale the readability of the font, instead they increase the font by some heurisitc, and to approximate we use sqrt to say bascially a DPR of 2 increases the readibility by 40%, 3 by 70%
|
||||
|
||||
// Calculate the zoom level where text becomes unreadable
|
||||
this._lowQualityZoomThreshold =
|
||||
@@ -547,7 +547,7 @@ export class LGraphCanvas
|
||||
linkMarkerShape: LinkMarkerShape = LinkMarkerShape.Circle
|
||||
links_render_mode: number
|
||||
/** Minimum font size in pixels before switching to low quality rendering.
|
||||
* This initializes first and if we can't get the value from the settings we default to 8px
|
||||
* This intializes first and if we cant get the value from the settings we default to 8px
|
||||
*/
|
||||
private _min_font_size_for_lod: number = 8
|
||||
|
||||
@@ -1228,7 +1228,7 @@ export class LGraphCanvas
|
||||
className: 'event'
|
||||
})
|
||||
}
|
||||
// add callback for modifying the menu elements onMenuNodeOutputs
|
||||
// add callback for modifing the menu elements onMenuNodeOutputs
|
||||
const retEntries = node.onMenuNodeOutputs?.(entries)
|
||||
if (retEntries) entries = retEntries
|
||||
|
||||
@@ -3902,7 +3902,7 @@ export class LGraphCanvas
|
||||
for (const item of [...parsed.nodes, ...parsed.reroutes]) {
|
||||
if (item.pos == null)
|
||||
throw new TypeError(
|
||||
'Invalid node encountered on paste. `pos` was null.'
|
||||
'Invalid node encounterd on paste. `pos` was null.'
|
||||
)
|
||||
|
||||
if (item.pos[0] < offsetX) offsetX = item.pos[0]
|
||||
@@ -6406,7 +6406,7 @@ export class LGraphCanvas
|
||||
|
||||
return true
|
||||
}
|
||||
console.error(`failed creating ${nodeNewType}`)
|
||||
console.log(`failed creating ${nodeNewType}`)
|
||||
}
|
||||
}
|
||||
return false
|
||||
@@ -6818,7 +6818,7 @@ export class LGraphCanvas
|
||||
canvas.focus()
|
||||
root_document.body.style.overflow = ''
|
||||
|
||||
// important, if canvas loses focus keys won't be captured
|
||||
// important, if canvas loses focus keys wont be captured
|
||||
setTimeout(() => canvas.focus(), 20)
|
||||
dialog.remove()
|
||||
}
|
||||
@@ -7095,7 +7095,7 @@ export class LGraphCanvas
|
||||
)
|
||||
}
|
||||
} else {
|
||||
// console.warn("can't find slot " + options.slot_from);
|
||||
// console.warn("cant find slot " + options.slot_from);
|
||||
}
|
||||
}
|
||||
if (options.node_to) {
|
||||
@@ -7140,7 +7140,7 @@ export class LGraphCanvas
|
||||
)
|
||||
}
|
||||
} else {
|
||||
// console.warn("can't find slot_nodeTO " + options.slot_from);
|
||||
// console.warn("cant find slot_nodeTO " + options.slot_from);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7478,7 +7478,7 @@ export class LGraphCanvas
|
||||
return dialog
|
||||
}
|
||||
|
||||
// TODO refactor, there are different dialog, some uses createDialog, some dont
|
||||
// TODO refactor, theer are different dialog, some uses createDialog, some dont
|
||||
createDialog(html: string, options: IDialogOptions): IDialog {
|
||||
const def_options = {
|
||||
checkForInput: false,
|
||||
|
||||
@@ -167,8 +167,8 @@ input|output: every connection
|
||||
general properties:
|
||||
+ clip_area: if you render outside the node, it will be clipped
|
||||
+ unsafe_execution: not allowed for safe execution
|
||||
+ skip_repeated_outputs: when adding new outputs, it won't show if there is one already connected
|
||||
+ resizable: if set to false it won't be resizable with the mouse
|
||||
+ skip_repeated_outputs: when adding new outputs, it wont show if there is one already connected
|
||||
+ resizable: if set to false it wont be resizable with the mouse
|
||||
+ widgets_start_y: widgets start at y distance from the top of the node
|
||||
|
||||
flags object:
|
||||
@@ -902,7 +902,7 @@ export class LGraphNode
|
||||
|
||||
if (this.onSerialize?.(o))
|
||||
console.warn(
|
||||
"node onSerialize shouldn't return anything, data should be stored in the object pass in the first parameter"
|
||||
'node onSerialize shouldnt return anything, data should be stored in the object pass in the first parameter'
|
||||
)
|
||||
|
||||
return o
|
||||
@@ -1950,7 +1950,7 @@ export class LGraphNode
|
||||
try {
|
||||
this.removeWidget(widget)
|
||||
} catch (error) {
|
||||
console.error('Failed to remove widget', error)
|
||||
console.debug('Failed to remove widget', error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2351,7 +2351,7 @@ export class LGraphNode
|
||||
|
||||
/**
|
||||
* returns the output (or input) slot with a given type, -1 if not found
|
||||
* @param input use inputs instead of outputs
|
||||
* @param input uise inputs instead of outputs
|
||||
* @param type the type of the slot to find
|
||||
* @param returnObj if the obj itself wanted
|
||||
* @param preferFreeSlot if we want a free slot (if not found, will return the first of the type anyway)
|
||||
@@ -2583,7 +2583,12 @@ export class LGraphNode
|
||||
if (slotIndex !== undefined)
|
||||
return this.connect(slot, target_node, slotIndex, optsIn?.afterRerouteId)
|
||||
|
||||
// No compatible slot found - connection not possible
|
||||
console.debug(
|
||||
'[connectByType]: no way to connect type:',
|
||||
target_slotType,
|
||||
'to node:',
|
||||
target_node
|
||||
)
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -2616,7 +2621,7 @@ export class LGraphNode
|
||||
if (slotIndex !== undefined)
|
||||
return source_node.connect(slotIndex, this, slot, optsIn?.afterRerouteId)
|
||||
|
||||
console.error(
|
||||
console.debug(
|
||||
'[connectByType]: no way to connect type:',
|
||||
source_slotType,
|
||||
'to node:',
|
||||
@@ -2656,7 +2661,7 @@ export class LGraphNode
|
||||
if (!graph) {
|
||||
// could be connected before adding it to a graph
|
||||
// due to link ids being associated with graphs
|
||||
console.error(
|
||||
console.log(
|
||||
"Connect: Error, node doesn't belong to any graph. Nodes must be added first to a graph before connecting them."
|
||||
)
|
||||
return null
|
||||
@@ -2667,12 +2672,11 @@ export class LGraphNode
|
||||
slot = this.findOutputSlot(slot)
|
||||
if (slot == -1) {
|
||||
if (LiteGraph.debug)
|
||||
console.error(`Connect: Error, no slot of name ${slot}`)
|
||||
console.log(`Connect: Error, no slot of name ${slot}`)
|
||||
return null
|
||||
}
|
||||
} else if (!outputs || slot >= outputs.length) {
|
||||
if (LiteGraph.debug)
|
||||
console.error('Connect: Error, slot number not found')
|
||||
if (LiteGraph.debug) console.log('Connect: Error, slot number not found')
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -2692,7 +2696,7 @@ export class LGraphNode
|
||||
targetIndex = target_node.findInputSlot(target_slot)
|
||||
if (targetIndex == -1) {
|
||||
if (LiteGraph.debug)
|
||||
console.error(`Connect: Error, no slot of name ${targetIndex}`)
|
||||
console.log(`Connect: Error, no slot of name ${targetIndex}`)
|
||||
return null
|
||||
}
|
||||
} else if (target_slot === LiteGraph.EVENT) {
|
||||
@@ -2724,8 +2728,7 @@ export class LGraphNode
|
||||
!target_node.inputs ||
|
||||
targetIndex >= target_node.inputs.length
|
||||
) {
|
||||
if (LiteGraph.debug)
|
||||
console.error('Connect: Error, slot number not found')
|
||||
if (LiteGraph.debug) console.log('Connect: Error, slot number not found')
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -2911,7 +2914,7 @@ export class LGraphNode
|
||||
const fromLastFloatingReroute =
|
||||
parentReroute?.floating?.slotType === 'output'
|
||||
|
||||
// Adding from an output, or a floating reroute that is NOT the tip of an existing floating chain
|
||||
// Adding from an ouput, or a floating reroute that is NOT the tip of an existing floating chain
|
||||
if (afterRerouteId == null || !fromLastFloatingReroute) {
|
||||
const link = new LLink(
|
||||
-1,
|
||||
@@ -2952,12 +2955,11 @@ export class LGraphNode
|
||||
slot = this.findOutputSlot(slot)
|
||||
if (slot == -1) {
|
||||
if (LiteGraph.debug)
|
||||
console.error(`Connect: Error, no slot of name ${slot}`)
|
||||
console.log(`Connect: Error, no slot of name ${slot}`)
|
||||
return false
|
||||
}
|
||||
} else if (!this.outputs || slot >= this.outputs.length) {
|
||||
if (LiteGraph.debug)
|
||||
console.error('Connect: Error, slot number not found')
|
||||
if (LiteGraph.debug) console.log('Connect: Error, slot number not found')
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -3073,19 +3075,19 @@ export class LGraphNode
|
||||
slot = this.findInputSlot(slot)
|
||||
if (slot == -1) {
|
||||
if (LiteGraph.debug)
|
||||
console.error(`Connect: Error, no slot of name ${slot}`)
|
||||
console.log(`Connect: Error, no slot of name ${slot}`)
|
||||
return false
|
||||
}
|
||||
} else if (!this.inputs || slot >= this.inputs.length) {
|
||||
if (LiteGraph.debug) {
|
||||
console.error('Connect: Error, slot number not found')
|
||||
console.log('Connect: Error, slot number not found')
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const input = this.inputs[slot]
|
||||
if (!input) {
|
||||
console.error('disconnectInput: input not found', slot, this.inputs)
|
||||
console.debug('disconnectInput: input not found', slot, this.inputs)
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -3114,16 +3116,19 @@ export class LGraphNode
|
||||
|
||||
const target_node = graph.getNodeById(link_info.origin_id)
|
||||
if (!target_node) {
|
||||
console.error(
|
||||
'disconnectInput: output not found',
|
||||
link_info.origin_slot
|
||||
console.debug(
|
||||
'disconnectInput: target node not found',
|
||||
link_info.origin_id
|
||||
)
|
||||
return false
|
||||
}
|
||||
|
||||
const output = target_node.outputs[link_info.origin_slot]
|
||||
if (!output?.links?.length) {
|
||||
// Output not found - may have been removed
|
||||
console.debug(
|
||||
'disconnectInput: output not found',
|
||||
link_info.origin_slot
|
||||
)
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -241,10 +241,10 @@ export class LiteGraphGlobal {
|
||||
*/
|
||||
do_add_triggers_slots = false
|
||||
|
||||
/** [false!] being events, it is strongly recommended to use them sequentially, one by one */
|
||||
/** [false!] being events, it is strongly reccomended to use them sequentially, one by one */
|
||||
allow_multi_output_for_events = true
|
||||
|
||||
/** [true!] allows to create and connect a node clicking with the third button (wheel) */
|
||||
/** [true!] allows to create and connect a ndoe clicking with the third button (wheel) */
|
||||
middle_click_slot_add_default_node = false
|
||||
|
||||
/** [true!] dragging a link to empty space will open a menu, add from list, search or defaults */
|
||||
@@ -398,6 +398,8 @@ export class LiteGraphGlobal {
|
||||
throw 'Cannot register a simple object, it must be a class with a prototype'
|
||||
base_class.type = type
|
||||
|
||||
if (this.debug) console.log('Node registered:', type)
|
||||
|
||||
const classname = base_class.name
|
||||
|
||||
const pos = type.lastIndexOf('/')
|
||||
@@ -413,7 +415,7 @@ export class LiteGraphGlobal {
|
||||
|
||||
const prev = this.registered_node_types[type]
|
||||
if (prev && this.debug) {
|
||||
console.warn('replacing node type:', type)
|
||||
console.log('replacing node type:', type)
|
||||
}
|
||||
|
||||
this.registered_node_types[type] = base_class
|
||||
@@ -428,7 +430,7 @@ export class LiteGraphGlobal {
|
||||
`LiteGraph node class ${type} has onPropertyChange method, it must be called onPropertyChanged with d at the end`
|
||||
)
|
||||
|
||||
// TODO one would want to know input and output :: this would allow through registerNodeAndSlotType to get all the slots types
|
||||
// TODO one would want to know input and ouput :: this would allow through registerNodeAndSlotType to get all the slots types
|
||||
if (this.auto_load_slot_types) new base_class(base_class.title || 'tmpnode')
|
||||
}
|
||||
|
||||
@@ -522,7 +524,7 @@ export class LiteGraphGlobal {
|
||||
): LGraphNode | null {
|
||||
const base_class = this.registered_node_types[type]
|
||||
if (!base_class) {
|
||||
if (this.debug) console.warn(`GraphNode type "${type}" not registered.`)
|
||||
if (this.debug) console.log(`GraphNode type "${type}" not registered.`)
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -635,6 +637,7 @@ export class LiteGraphGlobal {
|
||||
continue
|
||||
|
||||
try {
|
||||
if (this.debug) console.log('Reloading:', src)
|
||||
const dynamicScript = document.createElement('script')
|
||||
dynamicScript.type = 'text/javascript'
|
||||
dynamicScript.src = src
|
||||
@@ -642,9 +645,11 @@ export class LiteGraphGlobal {
|
||||
script_file.remove()
|
||||
} catch (error) {
|
||||
if (this.throw_errors) throw error
|
||||
if (this.debug) console.error('Error while reloading', src)
|
||||
if (this.debug) console.log('Error while reloading', src)
|
||||
}
|
||||
}
|
||||
|
||||
if (this.debug) console.log('Nodes reloaded')
|
||||
}
|
||||
|
||||
// separated just to improve if it doesn't work
|
||||
@@ -744,7 +749,7 @@ export class LiteGraphGlobal {
|
||||
// convert pointerevents to touch event when not available
|
||||
if (sMethod == 'pointer' && !window.PointerEvent) {
|
||||
console.warn("sMethod=='pointer' && !window.PointerEvent")
|
||||
console.warn(
|
||||
console.log(
|
||||
`Converting pointer[${sEvent}] : down move up cancel enter TO touchstart touchmove touchend, etc ..`
|
||||
)
|
||||
switch (sEvent) {
|
||||
@@ -769,7 +774,7 @@ export class LiteGraphGlobal {
|
||||
break
|
||||
}
|
||||
case 'enter': {
|
||||
// TODO: Determine if a move event should be sent
|
||||
console.log('debug: Should I send a move event?') // ???
|
||||
break
|
||||
}
|
||||
// case "over": case "out": not used at now
|
||||
|
||||
@@ -906,6 +906,7 @@ export class LinkConnector {
|
||||
if (connectingTo === 'output') {
|
||||
// Dropping new output link
|
||||
const output = node.findOutputByType(firstLink.fromSlot.type)?.slot
|
||||
console.debug('out', node, output, firstLink.fromSlot)
|
||||
if (output === undefined) {
|
||||
console.warn(
|
||||
`Could not find slot for link type: [${firstLink.fromSlot.type}].`
|
||||
@@ -917,6 +918,7 @@ export class LinkConnector {
|
||||
} else if (connectingTo === 'input') {
|
||||
// Dropping new input link
|
||||
const input = node.findInputByType(firstLink.fromSlot.type)?.slot
|
||||
console.debug('in', node, input, firstLink.fromSlot)
|
||||
if (input === undefined) {
|
||||
console.warn(
|
||||
`Could not find slot for link type: [${firstLink.fromSlot.type}].`
|
||||
|
||||
@@ -57,7 +57,7 @@ export class ExecutableNodeDTO implements ExecutableLGraphNode {
|
||||
#id: ExecutionId
|
||||
|
||||
/**
|
||||
* The path to the actual node through subgraph instances, represented as a list of all subgraph node IDs (instances),
|
||||
* The path to the acutal node through subgraph instances, represented as a list of all subgraph node IDs (instances),
|
||||
* followed by the actual original node ID within the subgraph. Each segment is separated by `:`.
|
||||
*
|
||||
* e.g. `1:2:3`:
|
||||
@@ -104,7 +104,7 @@ export class ExecutableNodeDTO implements ExecutableLGraphNode {
|
||||
readonly subgraphNodePath: readonly NodeId[],
|
||||
/** A flattened map of all DTOs in this node network. Subgraph instances have been expanded into their inner nodes. */
|
||||
readonly nodesByExecutionId: Map<ExecutionId, ExecutableLGraphNode>,
|
||||
/** The actual subgraph instance that contains this node, otherwise undefined. */
|
||||
/** The actual subgraph instance that contains this node, otherise undefined. */
|
||||
readonly subgraphNode?: SubgraphNode
|
||||
) {
|
||||
if (!node.graph) throw new NullGraphError()
|
||||
@@ -271,9 +271,9 @@ export class ExecutableNodeDTO implements ExecutableLGraphNode {
|
||||
// Bypass nodes by finding first input with matching type
|
||||
const matchingIndex = this.#getBypassSlotIndex(slot, type)
|
||||
|
||||
// No input types match - bypass not possible
|
||||
// No input types match
|
||||
if (matchingIndex === -1) {
|
||||
console.warn(
|
||||
console.debug(
|
||||
`[ExecutableNodeDTO.resolveOutput] No input types match type [${type}] for id [${this.id}] slot [${slot}]`,
|
||||
this
|
||||
)
|
||||
|
||||
@@ -175,6 +175,8 @@ export class SubgraphInput extends SubgraphSlot {
|
||||
}
|
||||
|
||||
widgets.push(widget)
|
||||
} else {
|
||||
console.debug('No input found on link id', linkId, link)
|
||||
}
|
||||
}
|
||||
return widgets
|
||||
|
||||
@@ -188,7 +188,7 @@ export class SubgraphInputNode
|
||||
|
||||
const subgraphInput = this.slots.at(subgraphInputIndex)
|
||||
if (!subgraphInput) {
|
||||
console.warn(
|
||||
console.debug(
|
||||
'disconnectNodeInput: subgraphInput not found',
|
||||
this,
|
||||
subgraphInputIndex
|
||||
@@ -201,7 +201,7 @@ export class SubgraphInputNode
|
||||
if (index !== -1) {
|
||||
subgraphInput.linkIds.splice(index, 1)
|
||||
} else {
|
||||
console.warn(
|
||||
console.debug(
|
||||
'disconnectNodeInput: link ID not found in subgraphInput linkIds',
|
||||
link.id
|
||||
)
|
||||
|
||||
@@ -430,7 +430,7 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
|
||||
const inputSlot = this.subgraph.inputNode.slots[slot]
|
||||
const innerLinks = inputSlot.getLinks()
|
||||
if (innerLinks.length === 0) {
|
||||
console.warn(
|
||||
console.debug(
|
||||
`[SubgraphNode.resolveSubgraphInputLinks] No inner links found for input slot [${slot}] ${inputSlot.name}`,
|
||||
this
|
||||
)
|
||||
@@ -447,10 +447,9 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
|
||||
resolveSubgraphOutputLink(slot: number): ResolvedConnection | undefined {
|
||||
const outputSlot = this.subgraph.outputNode.slots[slot]
|
||||
const innerLink = outputSlot.getLinks().at(0)
|
||||
if (innerLink) {
|
||||
return innerLink.resolve(this.subgraph)
|
||||
}
|
||||
console.warn(
|
||||
if (innerLink) return innerLink.resolve(this.subgraph)
|
||||
|
||||
console.debug(
|
||||
`[SubgraphNode.resolveSubgraphOutputLink] No inner link found for output slot [${slot}] ${outputSlot.name}`,
|
||||
this
|
||||
)
|
||||
|
||||
@@ -116,7 +116,7 @@ export function getBoundaryLinks(
|
||||
|
||||
const resolved = LLink.resolve(input.link, graph)
|
||||
if (!resolved) {
|
||||
console.warn(`Failed to resolve link ID [${input.link}]`)
|
||||
console.debug(`Failed to resolve link ID [${input.link}]`)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ export interface SubgraphIO extends SubgraphIOShared {
|
||||
id: UUID
|
||||
/** The data type this slot uses. Unlike nodes, this does not support legacy numeric types. */
|
||||
type: string
|
||||
/** Links connected to this slot, or `undefined` if not connected. An output slot should only ever have one link. */
|
||||
/** Links connected to this slot, or `undefined` if not connected. An ouptut slot should only ever have one link. */
|
||||
linkIds?: LinkId[]
|
||||
}
|
||||
|
||||
|
||||
@@ -426,6 +426,7 @@ describe('ExecutableNodeDTO Integration', () => {
|
||||
describe('ExecutableNodeDTO Scale Testing', () => {
|
||||
it('should create DTOs at scale', () => {
|
||||
const graph = new LGraph()
|
||||
const startTime = performance.now()
|
||||
const dtos: ExecutableNodeDTO[] = []
|
||||
|
||||
// Create DTOs to test performance
|
||||
@@ -439,11 +440,16 @@ describe('ExecutableNodeDTO Scale Testing', () => {
|
||||
dtos.push(dto)
|
||||
}
|
||||
|
||||
const endTime = performance.now()
|
||||
const duration = endTime - startTime
|
||||
|
||||
expect(dtos).toHaveLength(1000)
|
||||
// Test deterministic properties instead of flaky timing
|
||||
expect(dtos[0].id).toBe('parent:0')
|
||||
expect(dtos[999].id).toBe('parent:999')
|
||||
expect(dtos.every((dto, i) => dto.id === `parent:${i}`)).toBe(true)
|
||||
|
||||
console.log(`Created 1000 DTOs in ${duration.toFixed(2)}ms`)
|
||||
})
|
||||
|
||||
it('should handle complex path generation correctly', () => {
|
||||
|
||||
@@ -56,7 +56,7 @@ describe('SubgraphConversion', () => {
|
||||
expect(graph.nodes.length).toBe(2)
|
||||
expect(graph.links.size).toBe(1)
|
||||
})
|
||||
it('Should merge boundary links', () => {
|
||||
it('Should merge boundry links', () => {
|
||||
const subgraph = createTestSubgraph({
|
||||
inputs: [{ name: 'value', type: 'number' }],
|
||||
outputs: [{ name: 'value', type: 'number' }]
|
||||
|
||||
@@ -134,7 +134,7 @@ describe('SubgraphSlot visual feedback', () => {
|
||||
expect(globalAlphaValues).toContain(0.4)
|
||||
})
|
||||
|
||||
// "not implemented yet"
|
||||
// "not implmeneted yet"
|
||||
// it("should render slots with full opacity when dragging between compatible SubgraphInput and SubgraphOutput", () => {
|
||||
// const subgraph = createTestSubgraph()
|
||||
|
||||
|
||||
@@ -57,10 +57,12 @@ export const Default: Story = {
|
||||
render: (args) => ({
|
||||
components: { AssetBrowserModal },
|
||||
setup() {
|
||||
const onAssetSelect = (_asset: AssetDisplayItem) => {
|
||||
// Asset selection handler for story
|
||||
const onAssetSelect = (asset: AssetDisplayItem) => {
|
||||
console.log('Selected asset:', asset)
|
||||
}
|
||||
const onClose = () => {
|
||||
console.log('Modal closed')
|
||||
}
|
||||
const onClose = () => {}
|
||||
|
||||
return {
|
||||
...args,
|
||||
@@ -95,11 +97,11 @@ export const SingleAssetType: Story = {
|
||||
render: (args) => ({
|
||||
components: { AssetBrowserModal },
|
||||
setup() {
|
||||
const onAssetSelect = (_asset: AssetDisplayItem) => {
|
||||
// Asset selection handler for story
|
||||
const onAssetSelect = (asset: AssetDisplayItem) => {
|
||||
console.log('Selected asset:', asset)
|
||||
}
|
||||
const onClose = () => {
|
||||
// Modal close handler for story
|
||||
console.log('Modal closed')
|
||||
}
|
||||
|
||||
// Create assets with only one type (checkpoints)
|
||||
@@ -144,11 +146,11 @@ export const NoLeftPanel: Story = {
|
||||
render: (args) => ({
|
||||
components: { AssetBrowserModal },
|
||||
setup() {
|
||||
const onAssetSelect = (_asset: AssetDisplayItem) => {
|
||||
// Asset selection handler for story
|
||||
const onAssetSelect = (asset: AssetDisplayItem) => {
|
||||
console.log('Selected asset:', asset)
|
||||
}
|
||||
const onClose = () => {
|
||||
// Modal close handler for story
|
||||
console.log('Modal closed')
|
||||
}
|
||||
|
||||
return { ...args, onAssetSelect, onClose, assets: mockAssets }
|
||||
|
||||
@@ -198,6 +198,10 @@ export function useAssetBrowser(assets: AssetItem[] = []) {
|
||||
assetId: string,
|
||||
onSelect?: (filename: string) => void
|
||||
): Promise<void> {
|
||||
if (import.meta.env.DEV) {
|
||||
console.debug('Asset selected:', assetId)
|
||||
}
|
||||
|
||||
if (!onSelect) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ const DialogDemoComponent = {
|
||||
}
|
||||
|
||||
const handleAssetSelected = (assetPath: string) => {
|
||||
console.log('Asset selected:', assetPath)
|
||||
alert(`Selected asset: ${assetPath}`)
|
||||
isDialogOpen.value = false // Auto-close like the real composable
|
||||
}
|
||||
|
||||
@@ -986,7 +986,7 @@ export const CORE_SETTINGS: SettingParams[] = [
|
||||
name: 'Auto Save',
|
||||
type: 'combo',
|
||||
options: ['off', 'after delay'], // Room for other options like on focus change, tab change, window change
|
||||
defaultValue: 'off', // Popular request by users (https://github.com/Comfy-Org/ComfyUI_frontend/issues/1584#issuecomment-2536610154)
|
||||
defaultValue: 'off', // Popular requst by users (https://github.com/Comfy-Org/ComfyUI_frontend/issues/1584#issuecomment-2536610154)
|
||||
versionAdded: '1.16.0'
|
||||
},
|
||||
{
|
||||
|
||||
@@ -195,7 +195,7 @@ defineExpose({
|
||||
bottom: calc(
|
||||
var(--sidebar-width) * 2 + var(--sidebar-icon-size) / 2 -
|
||||
var(--whats-new-popup-bottom)
|
||||
); /* Position to center of help center icon (2 icons below + half icon height for center - what's new popup bottom position ) */
|
||||
); /* Position to center of help center icon (2 icons below + half icon height for center - whats new popup bottom position ) */
|
||||
}
|
||||
|
||||
/* Sidebar positioning classes applied by parent */
|
||||
|
||||
@@ -87,6 +87,7 @@ export class ComfyWorkflow extends UserFile {
|
||||
}
|
||||
|
||||
// Note: originalContent is populated by super.load()
|
||||
console.debug('load and start tracking of workflow', this.path)
|
||||
this.changeTracker = markRaw(
|
||||
new ChangeTracker(
|
||||
this,
|
||||
@@ -97,6 +98,7 @@ export class ComfyWorkflow extends UserFile {
|
||||
}
|
||||
|
||||
override unload(): void {
|
||||
console.debug('unload workflow', this.path)
|
||||
this.changeTracker = null
|
||||
super.unload()
|
||||
}
|
||||
@@ -300,6 +302,7 @@ export const useWorkflowStore = defineStore('workflow', () => {
|
||||
const loadedWorkflow = await workflow.load()
|
||||
activeWorkflow.value = loadedWorkflow
|
||||
comfyApp.canvas.bg_tint = loadedWorkflow.tintCanvasBg
|
||||
console.debug('[workflowStore] open workflow', workflow.path)
|
||||
return loadedWorkflow
|
||||
}
|
||||
|
||||
@@ -376,6 +379,7 @@ export const useWorkflowStore = defineStore('workflow', () => {
|
||||
} else {
|
||||
workflow.unload()
|
||||
}
|
||||
console.debug('[workflowStore] close workflow', workflow.path)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -219,7 +219,7 @@ const zSubgraphIO = zNodeInput.extend({
|
||||
id: z.string().uuid(),
|
||||
/** The data type this slot uses. Unlike nodes, this does not support legacy numeric types. */
|
||||
type: z.string(),
|
||||
/** Links connected to this slot, or `undefined` if not connected. An output slot should only ever have one link. */
|
||||
/** Links connected to this slot, or `undefined` if not connected. An ouptut slot should only ever have one link. */
|
||||
linkIds: z.array(z.number()).optional()
|
||||
})
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
:widget="widget.simplified"
|
||||
:model-value="widget.value"
|
||||
:readonly="readonly"
|
||||
:node-id="nodeData?.id != null ? String(nodeData.id) : ''"
|
||||
class="flex-1"
|
||||
@update:model-value="widget.updateHandler"
|
||||
/>
|
||||
|
||||
@@ -13,8 +13,8 @@ import { cn } from '@/utils/tailwindUtil'
|
||||
*
|
||||
*
|
||||
* IMPORTANT: this escape is needed for many reason due to primevue's directive tooltip system.
|
||||
* We cannot use PT to conditionally render the tooltips because the entire PT object only run
|
||||
* once during the initialization of the directive not every mount/unmount.
|
||||
* We cannot use PT to conditonally render the tooltips because the entire PT object only run
|
||||
* once during the intialization of the directive not every mount/unmount.
|
||||
* Once the directive is constructed its no longer reactive in the traditional sense.
|
||||
* We have to use something non destructive like mouseevents to dismiss the tooltip.
|
||||
*
|
||||
|
||||
@@ -86,6 +86,7 @@ describe('WidgetInputNumberSlider Value Binding', () => {
|
||||
it('renders input field', () => {
|
||||
const widget = createMockWidget(5)
|
||||
const wrapper = mountComponent(widget, 5)
|
||||
console.log(wrapper.html())
|
||||
|
||||
expect(wrapper.find('input[inputmode="numeric"]').exists()).toBe(true)
|
||||
})
|
||||
|
||||
@@ -106,7 +106,7 @@ export const useImageUploadWidget = () => {
|
||||
}
|
||||
|
||||
// On load if we have a value then render the image
|
||||
// The value isn't set immediately so we need to wait a moment
|
||||
// The value isnt set immediately so we need to wait a moment
|
||||
// No change callbacks seem to be fired on initial setting of the value
|
||||
requestAnimationFrame(() => {
|
||||
nodeOutputStore.setNodeOutputs(node, fileComboWidget.value, {
|
||||
|
||||
@@ -524,7 +524,7 @@ export class ComfyApi extends EventTarget {
|
||||
if (msg.data.sid) {
|
||||
const clientId = msg.data.sid
|
||||
this.clientId = clientId
|
||||
window.name = clientId // use window name so it isn't reused when duplicating tabs
|
||||
window.name = clientId // use window name so it isnt reused when duplicating tabs
|
||||
sessionStorage.setItem('clientId', clientId) // store in session storage so duplicate tab can load correct workflow
|
||||
}
|
||||
this.dispatchCustomEvent('status', msg.data.status ?? null)
|
||||
|
||||
@@ -69,6 +69,9 @@ export const useRegistrySearchGateway = (): NodePackSearchProvider => {
|
||||
const timeSinceLastAttempt =
|
||||
Date.now() - providerState.lastAttempt.getTime()
|
||||
if (timeSinceLastAttempt > CIRCUIT_BREAKER_TIMEOUT) {
|
||||
console.info(
|
||||
`Retrying ${providerState.name} provider after circuit breaker timeout`
|
||||
)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
KeybindingImpl,
|
||||
useKeybindingStore
|
||||
} from '@/stores/keybindingStore'
|
||||
import { migrateKeybindings } from '@/utils/keybindingMigration'
|
||||
|
||||
export const useKeybindingService = () => {
|
||||
const keybindingStore = useKeybindingStore()
|
||||
@@ -52,7 +51,7 @@ export const useKeybindingService = () => {
|
||||
if (keybinding && keybinding.targetElementId !== 'graph-canvas') {
|
||||
// Special handling for Escape key - let dialogs handle it first
|
||||
if (
|
||||
event.code === 'Escape' &&
|
||||
event.key === 'Escape' &&
|
||||
!event.ctrlKey &&
|
||||
!event.altKey &&
|
||||
!event.metaKey
|
||||
@@ -89,7 +88,7 @@ export const useKeybindingService = () => {
|
||||
}
|
||||
|
||||
// Escape key: close the first open modal found, and all dialogs
|
||||
if (event.code === 'Escape') {
|
||||
if (event.key === 'Escape') {
|
||||
const modals = document.querySelectorAll<HTMLElement>('.comfy-modal')
|
||||
for (const modal of modals) {
|
||||
const modalDisplay = window
|
||||
@@ -112,41 +111,14 @@ export const useKeybindingService = () => {
|
||||
}
|
||||
}
|
||||
|
||||
async function registerUserKeybindings() {
|
||||
// Load user keybindings from settings
|
||||
const unsetBindings = settingStore.get('Comfy.Keybinding.UnsetBindings')
|
||||
const newBindings = settingStore.get('Comfy.Keybinding.NewBindings')
|
||||
|
||||
// Migrate keybindings from old event.key format to new event.code format
|
||||
const migratedUnset = migrateKeybindings(unsetBindings)
|
||||
const migratedNew = migrateKeybindings(newBindings)
|
||||
|
||||
// Save migrated keybindings back to settings if any migration occurred
|
||||
if (migratedUnset.migrated) {
|
||||
await settingStore.set(
|
||||
'Comfy.Keybinding.UnsetBindings',
|
||||
migratedUnset.keybindings
|
||||
)
|
||||
console.warn(
|
||||
'[Keybindings] Migrated unset keybindings to event.code format'
|
||||
)
|
||||
}
|
||||
|
||||
if (migratedNew.migrated) {
|
||||
await settingStore.set(
|
||||
'Comfy.Keybinding.NewBindings',
|
||||
migratedNew.keybindings
|
||||
)
|
||||
console.warn(
|
||||
'[Keybindings] Migrated custom keybindings to event.code format'
|
||||
)
|
||||
}
|
||||
|
||||
function registerUserKeybindings() {
|
||||
// Unset bindings first as new bindings might conflict with default bindings.
|
||||
for (const keybinding of migratedUnset.keybindings) {
|
||||
const unsetBindings = settingStore.get('Comfy.Keybinding.UnsetBindings')
|
||||
for (const keybinding of unsetBindings) {
|
||||
keybindingStore.unsetKeybinding(new KeybindingImpl(keybinding))
|
||||
}
|
||||
for (const keybinding of migratedNew.keybindings) {
|
||||
const newBindings = settingStore.get('Comfy.Keybinding.NewBindings')
|
||||
for (const keybinding of newBindings) {
|
||||
keybindingStore.addUserKeybinding(new KeybindingImpl(keybinding))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ export interface ElectronDownload
|
||||
status?: DownloadStatus
|
||||
}
|
||||
|
||||
/** Electron downloads store handler */
|
||||
/** Electron donwloads store handler */
|
||||
export const useElectronDownloadStore = defineStore('downloads', () => {
|
||||
const downloads = ref<ElectronDownload[]>([])
|
||||
const { DownloadManager } = electronAPI()
|
||||
|
||||
@@ -404,6 +404,10 @@ export const useExecutionStore = defineStore('execution', () => {
|
||||
...queuedPrompt.nodes
|
||||
}
|
||||
queuedPrompt.workflow = workflow
|
||||
|
||||
console.debug(
|
||||
`queued task ${id} with ${Object.values(queuedPrompt.nodes).length} nodes`
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,7 +65,7 @@ export const useExtensionStore = defineStore('extension', () => {
|
||||
}
|
||||
|
||||
if (disabledExtensionNames.value.has(extension.name)) {
|
||||
console.warn(`Extension ${extension.name} is disabled.`)
|
||||
console.log(`Extension ${extension.name} is disabled.`)
|
||||
}
|
||||
|
||||
extensionByName.value[extension.name] = markRaw(extension)
|
||||
|
||||
@@ -44,7 +44,7 @@ export class KeyComboImpl implements KeyCombo {
|
||||
|
||||
static fromEvent(event: KeyboardEvent) {
|
||||
return new KeyComboImpl({
|
||||
key: event.code,
|
||||
key: event.key,
|
||||
ctrl: event.ctrlKey || event.metaKey,
|
||||
alt: event.altKey,
|
||||
shift: event.shiftKey
|
||||
@@ -75,16 +75,7 @@ export class KeyComboImpl implements KeyCombo {
|
||||
}
|
||||
|
||||
get isModifier(): boolean {
|
||||
return [
|
||||
'ControlLeft',
|
||||
'ControlRight',
|
||||
'MetaLeft',
|
||||
'MetaRight',
|
||||
'AltLeft',
|
||||
'AltRight',
|
||||
'ShiftLeft',
|
||||
'ShiftRight'
|
||||
].includes(this.key)
|
||||
return ['Control', 'Meta', 'Alt', 'Shift'].includes(this.key)
|
||||
}
|
||||
|
||||
get modifierCount(): number {
|
||||
@@ -115,95 +106,9 @@ export class KeyComboImpl implements KeyCombo {
|
||||
if (this.shift) {
|
||||
sequences.push('Shift')
|
||||
}
|
||||
sequences.push(this.getDisplayKey())
|
||||
sequences.push(this.key)
|
||||
return sequences
|
||||
}
|
||||
|
||||
getDisplayKey(): string {
|
||||
// Convert key codes to display names
|
||||
const keyMap: Record<string, string> = {
|
||||
// Letters
|
||||
KeyA: 'A',
|
||||
KeyB: 'B',
|
||||
KeyC: 'C',
|
||||
KeyD: 'D',
|
||||
KeyE: 'E',
|
||||
KeyF: 'F',
|
||||
KeyG: 'G',
|
||||
KeyH: 'H',
|
||||
KeyI: 'I',
|
||||
KeyJ: 'J',
|
||||
KeyK: 'K',
|
||||
KeyL: 'L',
|
||||
KeyM: 'M',
|
||||
KeyN: 'N',
|
||||
KeyO: 'O',
|
||||
KeyP: 'P',
|
||||
KeyQ: 'Q',
|
||||
KeyR: 'R',
|
||||
KeyS: 'S',
|
||||
KeyT: 'T',
|
||||
KeyU: 'U',
|
||||
KeyV: 'V',
|
||||
KeyW: 'W',
|
||||
KeyX: 'X',
|
||||
KeyY: 'Y',
|
||||
KeyZ: 'Z',
|
||||
// Numbers
|
||||
Digit0: '0',
|
||||
Digit1: '1',
|
||||
Digit2: '2',
|
||||
Digit3: '3',
|
||||
Digit4: '4',
|
||||
Digit5: '5',
|
||||
Digit6: '6',
|
||||
Digit7: '7',
|
||||
Digit8: '8',
|
||||
Digit9: '9',
|
||||
// Function keys
|
||||
F1: 'F1',
|
||||
F2: 'F2',
|
||||
F3: 'F3',
|
||||
F4: 'F4',
|
||||
F5: 'F5',
|
||||
F6: 'F6',
|
||||
F7: 'F7',
|
||||
F8: 'F8',
|
||||
F9: 'F9',
|
||||
F10: 'F10',
|
||||
F11: 'F11',
|
||||
F12: 'F12',
|
||||
// Special keys
|
||||
Space: 'Space',
|
||||
Enter: 'Enter',
|
||||
Tab: 'Tab',
|
||||
Escape: 'Escape',
|
||||
Backspace: 'Backspace',
|
||||
Delete: 'Delete',
|
||||
ArrowUp: '↑',
|
||||
ArrowDown: '↓',
|
||||
ArrowLeft: '←',
|
||||
ArrowRight: '→',
|
||||
Home: 'Home',
|
||||
End: 'End',
|
||||
PageUp: 'PageUp',
|
||||
PageDown: 'PageDown',
|
||||
Insert: 'Insert',
|
||||
// Punctuation
|
||||
Minus: '-',
|
||||
Equal: '=',
|
||||
BracketLeft: '[',
|
||||
BracketRight: ']',
|
||||
Backslash: '\\',
|
||||
Semicolon: ';',
|
||||
Quote: "'",
|
||||
Backquote: '`',
|
||||
Comma: ',',
|
||||
Period: '.',
|
||||
Slash: '/'
|
||||
}
|
||||
return keyMap[this.key] || this.key
|
||||
}
|
||||
}
|
||||
|
||||
export const useKeybindingStore = defineStore('keybinding', () => {
|
||||
|
||||
@@ -151,6 +151,7 @@ export const useMaintenanceTaskStore = defineStore('maintenanceTask', () => {
|
||||
/** @todo Refreshes Electron tasks only. */
|
||||
const refreshDesktopTasks = async () => {
|
||||
isRefreshing.value = true
|
||||
console.log('Refreshing desktop tasks')
|
||||
await electron.Validation.validateInstallation(processUpdate)
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ export class ExecutableGroupNodeChildDTO extends ExecutableNodeDTO {
|
||||
subgraphNodePath: readonly NodeId[],
|
||||
/** A flattened map of all DTOs in this node network. Subgraph instances have been expanded into their inner nodes. */
|
||||
nodesByExecutionId: Map<ExecutionId, ExecutableLGraphNode>,
|
||||
/** The actual subgraph instance that contains this node, otherwise undefined. */
|
||||
/** The actual subgraph instance that contains this node, otherise undefined. */
|
||||
subgraphNode?: SubgraphNode | undefined,
|
||||
groupNodeHandler?: GroupNodeHandler
|
||||
) {
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
/**
|
||||
* Whitelisting helper for enabling SSO on safe, local-only hosts.
|
||||
*
|
||||
* Built-ins (always allowed):
|
||||
* • 'localhost' and any subdomain of '.localhost' (e.g., app.localhost)
|
||||
* • IPv4 loopback 127.0.0.0/8 (e.g., 127.0.0.1, 127.1.2.3)
|
||||
* • IPv6 loopback ::1 (supports compressed/expanded textual forms)
|
||||
*
|
||||
* No environment variables are used. To add more exact hostnames,
|
||||
* edit HOST_WHITELIST below.
|
||||
*/
|
||||
|
||||
const HOST_WHITELIST: string[] = ['localhost']
|
||||
|
||||
/** Normalize for comparison: lowercase, strip port/brackets, trim trailing dot. */
|
||||
export function normalizeHost(input: string): string {
|
||||
let h = (input || '').trim().toLowerCase()
|
||||
|
||||
// Trim a trailing dot: 'localhost.' -> 'localhost'
|
||||
h = h.replace(/\.$/, '')
|
||||
|
||||
// Remove ':port' safely.
|
||||
// Case 1: [IPv6]:port
|
||||
const mBracket = h.match(/^\[([^\]]+)\]:(\d+)$/)
|
||||
if (mBracket) {
|
||||
h = mBracket[1] // keep only the host inside the brackets
|
||||
} else {
|
||||
// Case 2: hostname/IPv4:port (exactly one ':')
|
||||
const mPort = h.match(/^([^:]+):(\d+)$/)
|
||||
if (mPort) h = mPort[1]
|
||||
}
|
||||
|
||||
// Strip any remaining brackets (e.g., '[::1]' -> '::1')
|
||||
h = h.replace(/^\[|\]$/g, '')
|
||||
|
||||
return h
|
||||
}
|
||||
|
||||
/** Public check used by the UI. */
|
||||
export function isHostWhitelisted(rawHost: string): boolean {
|
||||
const host = normalizeHost(rawHost)
|
||||
if (isLocalhostLabel(host)) return true
|
||||
if (isIPv4Loopback(host)) return true
|
||||
if (isIPv6Loopback(host)) return true
|
||||
const normalizedList = HOST_WHITELIST.map(normalizeHost)
|
||||
return normalizedList.includes(host)
|
||||
}
|
||||
|
||||
/* -------------------- Helpers -------------------- */
|
||||
|
||||
function isLocalhostLabel(h: string): boolean {
|
||||
// 'localhost' and any subdomain (e.g., 'app.localhost')
|
||||
return h === 'localhost' || h.endsWith('.localhost')
|
||||
}
|
||||
|
||||
const IPV4_OCTET = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|0?\\d?\\d)'
|
||||
const V4_LOOPBACK_RE = new RegExp(
|
||||
'^127\\.' + IPV4_OCTET + '\\.' + IPV4_OCTET + '\\.' + IPV4_OCTET + '$'
|
||||
)
|
||||
|
||||
function isIPv4Loopback(h: string): boolean {
|
||||
// 127/8 with strict 0–255 octets (leading zeros allowed, e.g., 127.000.000.001)
|
||||
return V4_LOOPBACK_RE.test(h)
|
||||
}
|
||||
|
||||
// Fully expanded IPv6 loopback: 0:0:0:0:0:0:0:1 (allow leading zeros up to 4 chars)
|
||||
const V6_FULL_LOOPBACK_RE = /^(?:0{1,4}:){7}0{0,3}1$/i
|
||||
|
||||
// Compressed IPv6 loopback forms around '::' with only zero groups before the final :1
|
||||
// - Left side: zero groups separated by ':' (no trailing colon required)
|
||||
// - Right side: zero groups each followed by ':' (so the final ':1' is provided by the pattern)
|
||||
// The final group is exactly value 1, with up to 3 leading zeros (e.g., '0001').
|
||||
const V6_COMPRESSED_LOOPBACK_RE =
|
||||
/^((?:0{1,4}(?::0{1,4}){0,6})?)::((?:0{1,4}:){0,6})0{0,3}1$/i
|
||||
|
||||
function isIPv6Loopback(h: string): boolean {
|
||||
// Exact full form: 0:0:0:0:0:0:0:1 (with up to 3 leading zeros on the final "1" group)
|
||||
if (V6_FULL_LOOPBACK_RE.test(h)) return true
|
||||
|
||||
// Compressed forms that still equal ::1 (e.g., ::1, ::0001, 0:0::1, ::0:1, etc.)
|
||||
const m = h.match(V6_COMPRESSED_LOOPBACK_RE)
|
||||
if (!m) return false
|
||||
|
||||
// Count explicit zero groups on each side of '::' to ensure at least one group is compressed.
|
||||
// (leftCount + rightCount) must be ≤ 6 so that the total expanded groups = 8.
|
||||
const leftCount = m[1] ? m[1].match(/0{1,4}:/gi)?.length ?? 0 : 0
|
||||
const rightCount = m[2] ? m[2].match(/0{1,4}:/gi)?.length ?? 0 : 0
|
||||
|
||||
// Require that at least one group was actually compressed: i.e., leftCount + rightCount ≤ 6.
|
||||
return leftCount + rightCount <= 6
|
||||
}
|
||||
@@ -1,263 +0,0 @@
|
||||
import type { KeyCombo, Keybinding } from '@/schemas/keyBindingSchema'
|
||||
|
||||
/**
|
||||
* Migration utility for converting old event.key format to new event.code format
|
||||
* This ensures backward compatibility for existing user keybindings
|
||||
*/
|
||||
|
||||
// Map from old event.key format to new event.code format
|
||||
const KEY_MIGRATION_MAP: Record<string, string> = {
|
||||
// Letters (both cases)
|
||||
a: 'KeyA',
|
||||
A: 'KeyA',
|
||||
b: 'KeyB',
|
||||
B: 'KeyB',
|
||||
c: 'KeyC',
|
||||
C: 'KeyC',
|
||||
d: 'KeyD',
|
||||
D: 'KeyD',
|
||||
e: 'KeyE',
|
||||
E: 'KeyE',
|
||||
f: 'KeyF',
|
||||
F: 'KeyF',
|
||||
g: 'KeyG',
|
||||
G: 'KeyG',
|
||||
h: 'KeyH',
|
||||
H: 'KeyH',
|
||||
i: 'KeyI',
|
||||
I: 'KeyI',
|
||||
j: 'KeyJ',
|
||||
J: 'KeyJ',
|
||||
k: 'KeyK',
|
||||
K: 'KeyK',
|
||||
l: 'KeyL',
|
||||
L: 'KeyL',
|
||||
m: 'KeyM',
|
||||
M: 'KeyM',
|
||||
n: 'KeyN',
|
||||
N: 'KeyN',
|
||||
o: 'KeyO',
|
||||
O: 'KeyO',
|
||||
p: 'KeyP',
|
||||
P: 'KeyP',
|
||||
q: 'KeyQ',
|
||||
Q: 'KeyQ',
|
||||
r: 'KeyR',
|
||||
R: 'KeyR',
|
||||
s: 'KeyS',
|
||||
S: 'KeyS',
|
||||
t: 'KeyT',
|
||||
T: 'KeyT',
|
||||
u: 'KeyU',
|
||||
U: 'KeyU',
|
||||
v: 'KeyV',
|
||||
V: 'KeyV',
|
||||
w: 'KeyW',
|
||||
W: 'KeyW',
|
||||
x: 'KeyX',
|
||||
X: 'KeyX',
|
||||
y: 'KeyY',
|
||||
Y: 'KeyY',
|
||||
z: 'KeyZ',
|
||||
Z: 'KeyZ',
|
||||
|
||||
// Numbers
|
||||
'0': 'Digit0',
|
||||
'1': 'Digit1',
|
||||
'2': 'Digit2',
|
||||
'3': 'Digit3',
|
||||
'4': 'Digit4',
|
||||
'5': 'Digit5',
|
||||
'6': 'Digit6',
|
||||
'7': 'Digit7',
|
||||
'8': 'Digit8',
|
||||
'9': 'Digit9',
|
||||
|
||||
// Special keys that might be in old format
|
||||
escape: 'Escape',
|
||||
enter: 'Enter',
|
||||
space: 'Space',
|
||||
tab: 'Tab',
|
||||
spacebar: 'Space',
|
||||
Spacebar: 'Space',
|
||||
esc: 'Escape',
|
||||
Esc: 'Escape',
|
||||
return: 'Enter',
|
||||
Return: 'Enter',
|
||||
backspace: 'Backspace',
|
||||
delete: 'Delete',
|
||||
|
||||
// Arrow keys
|
||||
arrowup: 'ArrowUp',
|
||||
arrowdown: 'ArrowDown',
|
||||
arrowleft: 'ArrowLeft',
|
||||
arrowright: 'ArrowRight',
|
||||
|
||||
// Function keys (already correct format but handle lowercase)
|
||||
f1: 'F1',
|
||||
f2: 'F2',
|
||||
f3: 'F3',
|
||||
f4: 'F4',
|
||||
f5: 'F5',
|
||||
f6: 'F6',
|
||||
f7: 'F7',
|
||||
f8: 'F8',
|
||||
f9: 'F9',
|
||||
f10: 'F10',
|
||||
f11: 'F11',
|
||||
f12: 'F12',
|
||||
|
||||
// Punctuation and symbols (old name -> new code)
|
||||
'-': 'Minus',
|
||||
'=': 'Equal',
|
||||
'[': 'BracketLeft',
|
||||
']': 'BracketRight',
|
||||
'\\': 'Backslash',
|
||||
';': 'Semicolon',
|
||||
"'": 'Quote',
|
||||
'`': 'Backquote',
|
||||
',': 'Comma',
|
||||
'.': 'Period',
|
||||
'/': 'Slash',
|
||||
_: 'Minus',
|
||||
'+': 'Equal',
|
||||
'{': 'BracketLeft',
|
||||
'}': 'BracketRight',
|
||||
'|': 'Backslash',
|
||||
':': 'Semicolon',
|
||||
'"': 'Quote',
|
||||
'~': 'Backquote',
|
||||
'<': 'Comma',
|
||||
'>': 'Period',
|
||||
'?': 'Slash',
|
||||
|
||||
// Shifted digits
|
||||
'!': 'Digit1',
|
||||
'@': 'Digit2',
|
||||
'#': 'Digit3',
|
||||
$: 'Digit4',
|
||||
'%': 'Digit5',
|
||||
'^': 'Digit6',
|
||||
'&': 'Digit7',
|
||||
'*': 'Digit8',
|
||||
'(': 'Digit9',
|
||||
')': 'Digit0',
|
||||
|
||||
// Common aliases
|
||||
' ': 'Space'
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a key combo needs migration from old format to new format
|
||||
*/
|
||||
export function needsKeyMigration(keyCombo: KeyCombo): boolean {
|
||||
if (!keyCombo.key) return false
|
||||
|
||||
// Check if it's already in the new format
|
||||
if (
|
||||
keyCombo.key.startsWith('Key') ||
|
||||
keyCombo.key.startsWith('Digit') ||
|
||||
(keyCombo.key.startsWith('F') && /^F\d+$/.test(keyCombo.key)) ||
|
||||
[
|
||||
'Enter',
|
||||
'Escape',
|
||||
'Tab',
|
||||
'Space',
|
||||
'Backspace',
|
||||
'Delete',
|
||||
'ArrowUp',
|
||||
'ArrowDown',
|
||||
'ArrowLeft',
|
||||
'ArrowRight',
|
||||
'Minus',
|
||||
'Equal',
|
||||
'BracketLeft',
|
||||
'BracketRight',
|
||||
'Backslash',
|
||||
'Semicolon',
|
||||
'Quote',
|
||||
'Backquote',
|
||||
'Comma',
|
||||
'Period',
|
||||
'Slash',
|
||||
'NumpadAdd',
|
||||
'NumpadSubtract',
|
||||
'NumpadMultiply',
|
||||
'NumpadDivide'
|
||||
].includes(keyCombo.key)
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
// If it's in our migration map, it needs migration
|
||||
return keyCombo.key in KEY_MIGRATION_MAP
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrates a single key combo from old format to new format
|
||||
*/
|
||||
export function migrateKeyCombo(keyCombo: KeyCombo): KeyCombo {
|
||||
if (!needsKeyMigration(keyCombo)) {
|
||||
return keyCombo
|
||||
}
|
||||
|
||||
const newKey = KEY_MIGRATION_MAP[keyCombo.key]
|
||||
if (!newKey) {
|
||||
console.warn(`Unknown key format for migration: ${keyCombo.key}`)
|
||||
return keyCombo
|
||||
}
|
||||
|
||||
return {
|
||||
...keyCombo,
|
||||
key: newKey
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrates a single keybinding
|
||||
*/
|
||||
export function migrateKeybinding(keybinding: Keybinding): Keybinding {
|
||||
return {
|
||||
...keybinding,
|
||||
combo: migrateKeyCombo(keybinding.combo)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrates an array of keybindings and returns both the migrated keybindings
|
||||
* and whether any migration was performed
|
||||
*/
|
||||
export function migrateKeybindings(keybindings: Keybinding[] | undefined): {
|
||||
keybindings: Keybinding[]
|
||||
migrated: boolean
|
||||
} {
|
||||
if (!Array.isArray(keybindings)) {
|
||||
return {
|
||||
keybindings: [],
|
||||
migrated: false
|
||||
}
|
||||
}
|
||||
|
||||
let migrated = false
|
||||
const migratedKeybindings = keybindings.map((keybinding) => {
|
||||
const migratedKeybinding = migrateKeybinding(keybinding)
|
||||
if (migratedKeybinding.combo.key !== keybinding.combo.key) {
|
||||
migrated = true
|
||||
}
|
||||
return migratedKeybinding
|
||||
})
|
||||
|
||||
return {
|
||||
keybindings: migratedKeybindings,
|
||||
migrated
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes a key to the event.code format
|
||||
* This handles both old and new formats
|
||||
*/
|
||||
export function normalizeKey(key: string): string {
|
||||
const migrated = migrateKeyCombo({ key } as KeyCombo)
|
||||
return migrated.key
|
||||
}
|
||||
@@ -70,7 +70,7 @@ function extendLink(link: SerialisedLLinkArray) {
|
||||
* makes logical sense. Can apply fixes when passed the `fix` argument as true.
|
||||
*
|
||||
* Note that fixes are a best-effort attempt. Seems to get it correct in most cases, but there is a
|
||||
* chance it correct an anomaly that results in placing an incorrect link (say, if there were two
|
||||
* chance it correct an anomoly that results in placing an incorrect link (say, if there were two
|
||||
* links in the data). Users should take care to not overwrite work until manually checking the
|
||||
* result.
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,7 @@ export function applyTextReplacements(
|
||||
let nodes = allNodes.filter(
|
||||
(n) => n.properties?.['Node name for S&R'] === split[0]
|
||||
)
|
||||
// If we can't, see if there is a node with that title
|
||||
// If we cant, see if there is a node with that title
|
||||
if (!nodes.length) {
|
||||
nodes = allNodes.filter((n) => n.title === split[0])
|
||||
}
|
||||
|
||||
@@ -48,10 +48,16 @@ const meta: Meta<typeof InstallView> = {
|
||||
getDetectedGpu: () => Promise.resolve('mps')
|
||||
},
|
||||
Events: {
|
||||
trackEvent: (_eventName: string, _data?: any) => {}
|
||||
trackEvent: (eventName: string, data?: any) => {
|
||||
console.log('Track event:', eventName, data)
|
||||
}
|
||||
},
|
||||
installComfyUI: (options: any) => {
|
||||
console.log('Install ComfyUI with options:', options)
|
||||
},
|
||||
changeTheme: (theme: any) => {
|
||||
console.log('Change theme:', theme)
|
||||
},
|
||||
installComfyUI: (_options: any) => {},
|
||||
changeTheme: (_theme: any) => {},
|
||||
getSystemPaths: () =>
|
||||
Promise.resolve({
|
||||
defaultInstallPath: '/Users/username/ComfyUI'
|
||||
|
||||
@@ -61,12 +61,15 @@ const updateAllPacks = async () => {
|
||||
managerStore.isPackInstalled(pack.id)
|
||||
)
|
||||
if (!updatablePacks.length) {
|
||||
console.info('No installed packs available for update')
|
||||
isUpdating.value = false
|
||||
return
|
||||
}
|
||||
console.info(`Starting update of ${updatablePacks.length} packs`)
|
||||
try {
|
||||
await Promise.all(updatablePacks.map(updatePack))
|
||||
managerStore.updatePack.clear()
|
||||
console.info('All packs updated successfully')
|
||||
} catch (error) {
|
||||
console.error('Pack update failed:', error)
|
||||
console.error(
|
||||
|
||||
@@ -364,6 +364,10 @@ export function useConflictDetection() {
|
||||
Object.entries(bulkResult).forEach(([packageId, failInfo]) => {
|
||||
if (failInfo !== null) {
|
||||
importFailures[packageId] = failInfo
|
||||
console.debug(
|
||||
`[ConflictDetection] Import failure found for ${packageId}:`,
|
||||
failInfo
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -492,6 +496,11 @@ export function useConflictDetection() {
|
||||
// Merge conflicts for packages with the same name
|
||||
const mergedConflicts = consolidateConflictsByPackage(conflictedResults)
|
||||
|
||||
console.debug(
|
||||
'[ConflictDetection] Conflicts detected (stored for UI):',
|
||||
mergedConflicts
|
||||
)
|
||||
|
||||
// Store merged conflicts in Pinia store for UI usage
|
||||
conflictStore.setConflictedPackages(mergedConflicts)
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ describe.skip('SubgraphConversion', () => {
|
||||
expect(graph.nodes.length).toBe(2)
|
||||
expect(graph.links.size).toBe(1)
|
||||
})
|
||||
it('Should merge boundary links', () => {
|
||||
it('Should merge boundry links', () => {
|
||||
const subgraph = createTestSubgraph({
|
||||
inputs: [{ name: 'value', type: 'number' }],
|
||||
outputs: [{ name: 'value', type: 'number' }]
|
||||
|
||||
@@ -135,7 +135,7 @@ describe.skip('SubgraphSlot visual feedback', () => {
|
||||
expect(globalAlphaValues).toContain(0.4)
|
||||
})
|
||||
|
||||
// "not implemented yet"
|
||||
// "not implmeneted yet"
|
||||
// it("should render slots with full opacity when dragging between compatible SubgraphInput and SubgraphOutput", () => {
|
||||
// const subgraph = createTestSubgraph()
|
||||
|
||||
|
||||
@@ -11,14 +11,10 @@ import {
|
||||
useKeybindingStore
|
||||
} from '@/stores/keybindingStore'
|
||||
|
||||
const settingStoreGetMock = vi.fn()
|
||||
const settingStoreSetMock = vi.fn()
|
||||
|
||||
// Mock stores
|
||||
vi.mock('@/platform/settings/settingStore', () => ({
|
||||
useSettingStore: vi.fn(() => ({
|
||||
get: settingStoreGetMock,
|
||||
set: settingStoreSetMock
|
||||
get: vi.fn(() => [])
|
||||
}))
|
||||
}))
|
||||
|
||||
@@ -36,9 +32,6 @@ describe('keybindingService - Escape key handling', () => {
|
||||
vi.clearAllMocks()
|
||||
setActivePinia(createPinia())
|
||||
|
||||
settingStoreGetMock.mockImplementation(() => [])
|
||||
settingStoreSetMock.mockResolvedValue(undefined)
|
||||
|
||||
// Mock command store execute
|
||||
mockCommandExecute = vi.fn()
|
||||
const commandStore = useCommandStore()
|
||||
@@ -74,7 +67,6 @@ describe('keybindingService - Escape key handling', () => {
|
||||
it('should execute ExitSubgraph command when Escape is pressed', async () => {
|
||||
const event = new KeyboardEvent('keydown', {
|
||||
key: 'Escape',
|
||||
code: 'Escape',
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
})
|
||||
@@ -92,7 +84,6 @@ describe('keybindingService - Escape key handling', () => {
|
||||
it('should not execute command when Escape is pressed with modifiers', async () => {
|
||||
const event = new KeyboardEvent('keydown', {
|
||||
key: 'Escape',
|
||||
code: 'Escape',
|
||||
ctrlKey: true,
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
@@ -110,7 +101,6 @@ describe('keybindingService - Escape key handling', () => {
|
||||
const inputElement = document.createElement('input')
|
||||
const event = new KeyboardEvent('keydown', {
|
||||
key: 'Escape',
|
||||
code: 'Escape',
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
})
|
||||
@@ -141,7 +131,6 @@ describe('keybindingService - Escape key handling', () => {
|
||||
|
||||
const event = new KeyboardEvent('keydown', {
|
||||
key: 'Escape',
|
||||
code: 'Escape',
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
})
|
||||
@@ -170,7 +159,6 @@ describe('keybindingService - Escape key handling', () => {
|
||||
|
||||
const event = new KeyboardEvent('keydown', {
|
||||
key: 'Escape',
|
||||
code: 'Escape',
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
})
|
||||
@@ -212,108 +200,3 @@ describe('keybindingService - Escape key handling', () => {
|
||||
expect(mockCommandExecute).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('keybindingService - migration support', () => {
|
||||
let keybindingService: ReturnType<typeof useKeybindingService>
|
||||
let keybindingStore: ReturnType<typeof useKeybindingStore>
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
setActivePinia(createPinia())
|
||||
|
||||
settingStoreSetMock.mockResolvedValue(undefined)
|
||||
settingStoreGetMock.mockImplementation((key: string) => {
|
||||
if (key === 'Comfy.Keybinding.UnsetBindings') {
|
||||
return []
|
||||
}
|
||||
if (key === 'Comfy.Keybinding.NewBindings') {
|
||||
return []
|
||||
}
|
||||
return []
|
||||
})
|
||||
|
||||
keybindingService = useKeybindingService()
|
||||
keybindingService.registerCoreKeybindings()
|
||||
keybindingStore = useKeybindingStore()
|
||||
})
|
||||
|
||||
it('migrates legacy unset bindings using default combos', async () => {
|
||||
// Legacy format used lowercase letters
|
||||
// User wants to unset the 'R' shortcut (Comfy.RefreshNodeDefinitions)
|
||||
const legacyUnset = [
|
||||
{
|
||||
commandId: 'Comfy.RefreshNodeDefinitions',
|
||||
combo: { key: 'r' } // Old format
|
||||
}
|
||||
]
|
||||
|
||||
settingStoreGetMock.mockImplementation((key: string) => {
|
||||
if (key === 'Comfy.Keybinding.UnsetBindings') {
|
||||
return legacyUnset
|
||||
}
|
||||
if (key === 'Comfy.Keybinding.NewBindings') {
|
||||
return []
|
||||
}
|
||||
return []
|
||||
})
|
||||
|
||||
await keybindingService.registerUserKeybindings()
|
||||
|
||||
const unsetBindings = Object.values(
|
||||
keybindingStore.getUserUnsetKeybindings()
|
||||
)
|
||||
|
||||
// Should have migrated and unset the binding
|
||||
expect(unsetBindings).toHaveLength(1)
|
||||
expect(unsetBindings[0].combo.key).toBe('KeyR')
|
||||
expect(unsetBindings[0].commandId).toBe('Comfy.RefreshNodeDefinitions')
|
||||
|
||||
// Should have saved the migrated format
|
||||
expect(settingStoreSetMock).toHaveBeenCalledWith(
|
||||
'Comfy.Keybinding.UnsetBindings',
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
commandId: 'Comfy.RefreshNodeDefinitions',
|
||||
combo: expect.objectContaining({
|
||||
key: 'KeyR'
|
||||
})
|
||||
})
|
||||
])
|
||||
)
|
||||
|
||||
// Verify the keybinding no longer matches
|
||||
const eventCombo = new KeyComboImpl({ key: 'KeyR' })
|
||||
const resolved = keybindingStore.getKeybinding(eventCombo)
|
||||
expect(resolved).toBeUndefined()
|
||||
})
|
||||
|
||||
it('matches migrated event.code against legacy user bindings', async () => {
|
||||
// User has a legacy binding in old format
|
||||
const legacyBindings = [
|
||||
{
|
||||
commandId: 'Custom.Legacy',
|
||||
combo: { key: 'q' }
|
||||
}
|
||||
]
|
||||
|
||||
settingStoreGetMock.mockImplementation((key: string) => {
|
||||
if (key === 'Comfy.Keybinding.UnsetBindings') {
|
||||
return []
|
||||
}
|
||||
if (key === 'Comfy.Keybinding.NewBindings') {
|
||||
return legacyBindings
|
||||
}
|
||||
return []
|
||||
})
|
||||
|
||||
// Register user keybindings (which will migrate them)
|
||||
await keybindingService.registerUserKeybindings()
|
||||
|
||||
// Now press 'Q' key with event.code format
|
||||
const eventCombo = new KeyComboImpl({ key: 'KeyQ' })
|
||||
|
||||
const resolved = keybindingStore.getKeybinding(eventCombo)
|
||||
|
||||
expect(resolved?.commandId).toBe('Custom.Legacy')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { isHostWhitelisted, normalizeHost } from '@/utils/hostWhitelist'
|
||||
|
||||
describe('hostWhitelist utils', () => {
|
||||
describe('normalizeHost', () => {
|
||||
it.each([
|
||||
['LOCALHOST', 'localhost'],
|
||||
['localhost.', 'localhost'], // trims trailing dot
|
||||
['localhost:5173', 'localhost'], // strips :port
|
||||
['127.0.0.1:5173', '127.0.0.1'], // strips :port
|
||||
['[::1]:5173', '::1'], // strips brackets + :port
|
||||
['[::1]', '::1'], // strips brackets
|
||||
['::1', '::1'], // leaves plain IPv6
|
||||
[' [::1] ', '::1'], // trims whitespace
|
||||
['APP.LOCALHOST', 'app.localhost'], // lowercases
|
||||
['example.com.', 'example.com'], // trims trailing dot
|
||||
['[2001:db8::1]:8443', '2001:db8::1'], // IPv6 with brackets+port
|
||||
['2001:db8::1', '2001:db8::1'] // plain IPv6 stays
|
||||
])('normalizeHost(%o) -> %o', (input, expected) => {
|
||||
expect(normalizeHost(input)).toBe(expected)
|
||||
})
|
||||
|
||||
it('does not strip non-numeric suffixes (not a port pattern)', () => {
|
||||
expect(normalizeHost('example.com:abc')).toBe('example.com:abc')
|
||||
expect(normalizeHost('127.0.0.1:abc')).toBe('127.0.0.1:abc')
|
||||
})
|
||||
})
|
||||
|
||||
describe('isHostWhitelisted', () => {
|
||||
describe('localhost label', () => {
|
||||
it.each([
|
||||
'localhost',
|
||||
'LOCALHOST',
|
||||
'localhost.',
|
||||
'localhost:5173',
|
||||
'foo.localhost',
|
||||
'Foo.Localhost',
|
||||
'sub.foo.localhost',
|
||||
'foo.localhost:5173'
|
||||
])('should allow %o', (input) => {
|
||||
expect(isHostWhitelisted(input)).toBe(true)
|
||||
})
|
||||
|
||||
it.each([
|
||||
'localhost.com',
|
||||
'evil-localhost',
|
||||
'notlocalhost',
|
||||
'foo.localhost.evil'
|
||||
])('should NOT allow %o', (input) => {
|
||||
expect(isHostWhitelisted(input)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('IPv4 127/8 loopback', () => {
|
||||
it.each([
|
||||
'127.0.0.1',
|
||||
'127.1.2.3',
|
||||
'127.255.255.255',
|
||||
'127.0.0.1:3000',
|
||||
'127.000.000.001', // leading zeros are still digits 0-255
|
||||
'127.0.0.1.' // trailing dot should be tolerated
|
||||
])('should allow %o', (input) => {
|
||||
expect(isHostWhitelisted(input)).toBe(true)
|
||||
})
|
||||
|
||||
it.each([
|
||||
'126.0.0.1',
|
||||
'127.256.0.1',
|
||||
'127.-1.0.1',
|
||||
'127.0.0.1:abc',
|
||||
'128.0.0.1',
|
||||
'192.168.1.10',
|
||||
'10.0.0.2',
|
||||
'0.0.0.0',
|
||||
'255.255.255.255',
|
||||
'127.0.0', // malformed
|
||||
'127.0.0.1.5' // malformed
|
||||
])('should NOT allow %o', (input) => {
|
||||
expect(isHostWhitelisted(input)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('IPv6 loopback ::1 (all textual forms)', () => {
|
||||
it.each([
|
||||
'::1',
|
||||
'[::1]',
|
||||
'[::1]:5173',
|
||||
'::0001',
|
||||
'0:0:0:0:0:0:0:1',
|
||||
'0000:0000:0000:0000:0000:0000:0000:0001',
|
||||
// Compressed equivalents of ::1 (with zeros compressed)
|
||||
'0:0::1',
|
||||
'0:0:0:0:0:0::1',
|
||||
'::0:1' // compressing the initial zeros (still ::1 when expanded)
|
||||
])('should allow %o', (input) => {
|
||||
expect(isHostWhitelisted(input)).toBe(true)
|
||||
})
|
||||
|
||||
it.each([
|
||||
'::2',
|
||||
'::',
|
||||
'::0',
|
||||
'0:0:0:0:0:0:0:2',
|
||||
'fe80::1', // link-local, not loopback
|
||||
'2001:db8::1',
|
||||
'::1:5173', // bracketless "port-like" suffix must not pass
|
||||
':::1', // invalid (triple colon)
|
||||
'0:0:0:0:0:0:::1', // invalid compression
|
||||
'[::1%25lo0]',
|
||||
'[::1%25lo0]:5173',
|
||||
'::1%25lo0'
|
||||
])('should NOT allow %o', (input) => {
|
||||
expect(isHostWhitelisted(input)).toBe(false)
|
||||
})
|
||||
|
||||
it('should reject empty/whitespace-only input', () => {
|
||||
expect(isHostWhitelisted('')).toBe(false)
|
||||
expect(isHostWhitelisted(' ')).toBe(false)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1,285 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import type { KeyCombo, Keybinding } from '@/schemas/keyBindingSchema'
|
||||
import {
|
||||
migrateKeyCombo,
|
||||
migrateKeybinding,
|
||||
migrateKeybindings,
|
||||
needsKeyMigration,
|
||||
normalizeKey
|
||||
} from '@/utils/keybindingMigration'
|
||||
|
||||
describe('keybindingMigration', () => {
|
||||
describe('needsKeyMigration', () => {
|
||||
it('should return false for keys already in event.code format', () => {
|
||||
expect(needsKeyMigration({ key: 'KeyA' })).toBe(false)
|
||||
expect(needsKeyMigration({ key: 'KeyZ' })).toBe(false)
|
||||
expect(needsKeyMigration({ key: 'Digit0' })).toBe(false)
|
||||
expect(needsKeyMigration({ key: 'Digit9' })).toBe(false)
|
||||
expect(needsKeyMigration({ key: 'F1' })).toBe(false)
|
||||
expect(needsKeyMigration({ key: 'F12' })).toBe(false)
|
||||
expect(needsKeyMigration({ key: 'Enter' })).toBe(false)
|
||||
expect(needsKeyMigration({ key: 'Escape' })).toBe(false)
|
||||
expect(needsKeyMigration({ key: 'ArrowUp' })).toBe(false)
|
||||
expect(needsKeyMigration({ key: 'Minus' })).toBe(false)
|
||||
})
|
||||
|
||||
it('should return true for keys in old event.key format', () => {
|
||||
expect(needsKeyMigration({ key: 'a' })).toBe(true)
|
||||
expect(needsKeyMigration({ key: 'z' })).toBe(true)
|
||||
expect(needsKeyMigration({ key: 'A' })).toBe(true)
|
||||
expect(needsKeyMigration({ key: 'Z' })).toBe(true)
|
||||
expect(needsKeyMigration({ key: '0' })).toBe(true)
|
||||
expect(needsKeyMigration({ key: '9' })).toBe(true)
|
||||
expect(needsKeyMigration({ key: '-' })).toBe(true)
|
||||
expect(needsKeyMigration({ key: '=' })).toBe(true)
|
||||
})
|
||||
|
||||
it('should handle lowercase special keys', () => {
|
||||
expect(needsKeyMigration({ key: 'escape' })).toBe(true)
|
||||
expect(needsKeyMigration({ key: 'enter' })).toBe(true)
|
||||
expect(needsKeyMigration({ key: 'space' })).toBe(true)
|
||||
})
|
||||
|
||||
it('should return false for empty key', () => {
|
||||
expect(needsKeyMigration({ key: '' })).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('migrateKeyCombo', () => {
|
||||
it('should migrate lowercase letters to KeyX format', () => {
|
||||
expect(migrateKeyCombo({ key: 'a' }).key).toBe('KeyA')
|
||||
expect(migrateKeyCombo({ key: 'r' }).key).toBe('KeyR')
|
||||
expect(migrateKeyCombo({ key: 'z' }).key).toBe('KeyZ')
|
||||
})
|
||||
|
||||
it('should migrate uppercase letters to KeyX format', () => {
|
||||
expect(migrateKeyCombo({ key: 'A' }).key).toBe('KeyA')
|
||||
expect(migrateKeyCombo({ key: 'R' }).key).toBe('KeyR')
|
||||
expect(migrateKeyCombo({ key: 'Z' }).key).toBe('KeyZ')
|
||||
})
|
||||
|
||||
it('should migrate digit characters to DigitX format', () => {
|
||||
expect(migrateKeyCombo({ key: '0' }).key).toBe('Digit0')
|
||||
expect(migrateKeyCombo({ key: '5' }).key).toBe('Digit5')
|
||||
expect(migrateKeyCombo({ key: '9' }).key).toBe('Digit9')
|
||||
})
|
||||
|
||||
it('should migrate special keys to proper case', () => {
|
||||
expect(migrateKeyCombo({ key: 'escape' }).key).toBe('Escape')
|
||||
expect(migrateKeyCombo({ key: 'enter' }).key).toBe('Enter')
|
||||
expect(migrateKeyCombo({ key: 'space' }).key).toBe('Space')
|
||||
expect(migrateKeyCombo({ key: 'tab' }).key).toBe('Tab')
|
||||
})
|
||||
|
||||
it('should migrate punctuation to event.code names', () => {
|
||||
expect(migrateKeyCombo({ key: '-' }).key).toBe('Minus')
|
||||
expect(migrateKeyCombo({ key: '=' }).key).toBe('Equal')
|
||||
expect(migrateKeyCombo({ key: '[' }).key).toBe('BracketLeft')
|
||||
expect(migrateKeyCombo({ key: ']' }).key).toBe('BracketRight')
|
||||
expect(migrateKeyCombo({ key: ';' }).key).toBe('Semicolon')
|
||||
expect(migrateKeyCombo({ key: '/' }).key).toBe('Slash')
|
||||
})
|
||||
|
||||
it('should migrate shifted punctuation correctly', () => {
|
||||
expect(migrateKeyCombo({ key: '_' }).key).toBe('Minus')
|
||||
expect(migrateKeyCombo({ key: '+' }).key).toBe('Equal')
|
||||
expect(migrateKeyCombo({ key: '{' }).key).toBe('BracketLeft')
|
||||
expect(migrateKeyCombo({ key: '}' }).key).toBe('BracketRight')
|
||||
expect(migrateKeyCombo({ key: ':' }).key).toBe('Semicolon')
|
||||
expect(migrateKeyCombo({ key: '?' }).key).toBe('Slash')
|
||||
})
|
||||
|
||||
it('should migrate shifted digits correctly', () => {
|
||||
expect(migrateKeyCombo({ key: '!' }).key).toBe('Digit1')
|
||||
expect(migrateKeyCombo({ key: '@' }).key).toBe('Digit2')
|
||||
expect(migrateKeyCombo({ key: '#' }).key).toBe('Digit3')
|
||||
expect(migrateKeyCombo({ key: '$' }).key).toBe('Digit4')
|
||||
expect(migrateKeyCombo({ key: '%' }).key).toBe('Digit5')
|
||||
expect(migrateKeyCombo({ key: '^' }).key).toBe('Digit6')
|
||||
expect(migrateKeyCombo({ key: '&' }).key).toBe('Digit7')
|
||||
expect(migrateKeyCombo({ key: '*' }).key).toBe('Digit8')
|
||||
expect(migrateKeyCombo({ key: '(' }).key).toBe('Digit9')
|
||||
expect(migrateKeyCombo({ key: ')' }).key).toBe('Digit0')
|
||||
})
|
||||
|
||||
it('should preserve modifier flags', () => {
|
||||
const combo: KeyCombo = {
|
||||
key: 's',
|
||||
ctrl: true,
|
||||
alt: true,
|
||||
shift: true
|
||||
}
|
||||
const migrated = migrateKeyCombo(combo)
|
||||
|
||||
expect(migrated.key).toBe('KeyS')
|
||||
expect(migrated.ctrl).toBe(true)
|
||||
expect(migrated.alt).toBe(true)
|
||||
expect(migrated.shift).toBe(true)
|
||||
})
|
||||
|
||||
it('should not modify keys already in event.code format', () => {
|
||||
expect(migrateKeyCombo({ key: 'KeyR' }).key).toBe('KeyR')
|
||||
expect(migrateKeyCombo({ key: 'Digit5' }).key).toBe('Digit5')
|
||||
expect(migrateKeyCombo({ key: 'F1' }).key).toBe('F1')
|
||||
expect(migrateKeyCombo({ key: 'Enter' }).key).toBe('Enter')
|
||||
expect(migrateKeyCombo({ key: 'ArrowUp' }).key).toBe('ArrowUp')
|
||||
})
|
||||
|
||||
it('should handle space character', () => {
|
||||
expect(migrateKeyCombo({ key: ' ' }).key).toBe('Space')
|
||||
})
|
||||
|
||||
it('should handle arrow key variations', () => {
|
||||
expect(migrateKeyCombo({ key: 'arrowup' }).key).toBe('ArrowUp')
|
||||
expect(migrateKeyCombo({ key: 'arrowdown' }).key).toBe('ArrowDown')
|
||||
expect(migrateKeyCombo({ key: 'arrowleft' }).key).toBe('ArrowLeft')
|
||||
expect(migrateKeyCombo({ key: 'arrowright' }).key).toBe('ArrowRight')
|
||||
})
|
||||
|
||||
it('should handle function key variations', () => {
|
||||
expect(migrateKeyCombo({ key: 'f1' }).key).toBe('F1')
|
||||
expect(migrateKeyCombo({ key: 'f12' }).key).toBe('F12')
|
||||
})
|
||||
})
|
||||
|
||||
describe('migrateKeybinding', () => {
|
||||
it('should migrate a keybinding object', () => {
|
||||
const keybinding: Keybinding = {
|
||||
commandId: 'Test.Command',
|
||||
combo: { key: 'r' }
|
||||
}
|
||||
|
||||
const migrated = migrateKeybinding(keybinding)
|
||||
|
||||
expect(migrated.commandId).toBe('Test.Command')
|
||||
expect(migrated.combo.key).toBe('KeyR')
|
||||
})
|
||||
|
||||
it('should preserve targetElementId', () => {
|
||||
const keybinding: Keybinding = {
|
||||
commandId: 'Test.Command',
|
||||
combo: { key: 's', ctrl: true },
|
||||
targetElementId: 'graph-canvas'
|
||||
}
|
||||
|
||||
const migrated = migrateKeybinding(keybinding)
|
||||
|
||||
expect(migrated.targetElementId).toBe('graph-canvas')
|
||||
expect(migrated.combo.key).toBe('KeyS')
|
||||
expect(migrated.combo.ctrl).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('migrateKeybindings', () => {
|
||||
it('should migrate an array of keybindings', () => {
|
||||
const keybindings: Keybinding[] = [
|
||||
{ commandId: 'Test1', combo: { key: 'r' } },
|
||||
{ commandId: 'Test2', combo: { key: 's', ctrl: true } },
|
||||
{ commandId: 'Test3', combo: { key: 'q' } }
|
||||
]
|
||||
|
||||
const result = migrateKeybindings(keybindings)
|
||||
|
||||
expect(result.migrated).toBe(true)
|
||||
expect(result.keybindings).toHaveLength(3)
|
||||
expect(result.keybindings[0].combo.key).toBe('KeyR')
|
||||
expect(result.keybindings[1].combo.key).toBe('KeyS')
|
||||
expect(result.keybindings[2].combo.key).toBe('KeyQ')
|
||||
})
|
||||
|
||||
it('should detect when no migration is needed', () => {
|
||||
const keybindings: Keybinding[] = [
|
||||
{ commandId: 'Test1', combo: { key: 'KeyR' } },
|
||||
{ commandId: 'Test2', combo: { key: 'KeyS', ctrl: true } }
|
||||
]
|
||||
|
||||
const result = migrateKeybindings(keybindings)
|
||||
|
||||
expect(result.migrated).toBe(false)
|
||||
expect(result.keybindings).toHaveLength(2)
|
||||
})
|
||||
|
||||
it('should handle mixed old and new formats', () => {
|
||||
const keybindings: Keybinding[] = [
|
||||
{ commandId: 'Test1', combo: { key: 'r' } }, // Old format
|
||||
{ commandId: 'Test2', combo: { key: 'KeyS' } }, // New format
|
||||
{ commandId: 'Test3', combo: { key: 'q' } } // Old format
|
||||
]
|
||||
|
||||
const result = migrateKeybindings(keybindings)
|
||||
|
||||
expect(result.migrated).toBe(true)
|
||||
expect(result.keybindings[0].combo.key).toBe('KeyR')
|
||||
expect(result.keybindings[1].combo.key).toBe('KeyS')
|
||||
expect(result.keybindings[2].combo.key).toBe('KeyQ')
|
||||
})
|
||||
|
||||
it('should handle empty array', () => {
|
||||
const result = migrateKeybindings([])
|
||||
|
||||
expect(result.migrated).toBe(false)
|
||||
expect(result.keybindings).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('should handle undefined input', () => {
|
||||
const result = migrateKeybindings(undefined)
|
||||
|
||||
expect(result.migrated).toBe(false)
|
||||
expect(result.keybindings).toHaveLength(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('normalizeKey', () => {
|
||||
it('should normalize old format keys', () => {
|
||||
expect(normalizeKey('r')).toBe('KeyR')
|
||||
expect(normalizeKey('s')).toBe('KeyS')
|
||||
expect(normalizeKey('5')).toBe('Digit5')
|
||||
expect(normalizeKey('-')).toBe('Minus')
|
||||
})
|
||||
|
||||
it('should leave new format keys unchanged', () => {
|
||||
expect(normalizeKey('KeyR')).toBe('KeyR')
|
||||
expect(normalizeKey('Digit5')).toBe('Digit5')
|
||||
expect(normalizeKey('Enter')).toBe('Enter')
|
||||
})
|
||||
})
|
||||
|
||||
describe('real-world migration scenarios', () => {
|
||||
it('should migrate common shortcuts', () => {
|
||||
const commonShortcuts: Keybinding[] = [
|
||||
// Refresh nodes
|
||||
{ commandId: 'Comfy.RefreshNodeDefinitions', combo: { key: 'r' } },
|
||||
// Save
|
||||
{ commandId: 'Comfy.SaveWorkflow', combo: { key: 's', ctrl: true } },
|
||||
// Queue prompt
|
||||
{ commandId: 'Comfy.QueuePrompt', combo: { key: 'Enter', ctrl: true } },
|
||||
// Toggle sidebar
|
||||
{ commandId: 'Workspace.ToggleSidebar', combo: { key: 'q' } }
|
||||
]
|
||||
|
||||
const result = migrateKeybindings(commonShortcuts)
|
||||
|
||||
expect(result.migrated).toBe(true)
|
||||
expect(result.keybindings[0].combo.key).toBe('KeyR')
|
||||
expect(result.keybindings[1].combo.key).toBe('KeyS')
|
||||
expect(result.keybindings[2].combo.key).toBe('Enter')
|
||||
expect(result.keybindings[3].combo.key).toBe('KeyQ')
|
||||
})
|
||||
|
||||
it('should handle keybindings with punctuation', () => {
|
||||
const punctuationShortcuts: Keybinding[] = [
|
||||
{ commandId: 'Zoom.In', combo: { key: '=', alt: true } },
|
||||
{ commandId: 'Zoom.Out', combo: { key: '-', alt: true } },
|
||||
{ commandId: 'Search', combo: { key: '/', ctrl: true } }
|
||||
]
|
||||
|
||||
const result = migrateKeybindings(punctuationShortcuts)
|
||||
|
||||
expect(result.migrated).toBe(true)
|
||||
expect(result.keybindings[0].combo.key).toBe('Equal')
|
||||
expect(result.keybindings[1].combo.key).toBe('Minus')
|
||||
expect(result.keybindings[2].combo.key).toBe('Slash')
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -100,7 +100,7 @@ describe('Subgraph proxyWidgets', () => {
|
||||
expect(innerNodes[0].widgets[0].last_y).toBe(11)
|
||||
expect(innerNodes[0].widgets[0].computedHeight).toBe(12)
|
||||
})
|
||||
test('Can detach and re-attach widgets', () => {
|
||||
test('Can detatch and re-attach widgets', () => {
|
||||
const [subgraphNode, innerNodes] = setupSubgraph(1)
|
||||
innerNodes[0].addWidget('text', 'stringWidget', 'value', () => {})
|
||||
subgraphNode.properties.proxyWidgets = JSON.stringify([
|
||||
|
||||
Reference in New Issue
Block a user