Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ab44039cb | ||
|
|
a6f45ef6a5 | ||
|
|
c3c0a41ccf | ||
|
|
41ce0128e4 | ||
|
|
42ffd8d4ce | ||
|
|
fc82c0fed0 | ||
|
|
27bab40f78 | ||
|
|
11071e1c2b | ||
|
|
5add20c9be | ||
|
|
8a4d5c5fa8 | ||
|
|
1dcecc93cd | ||
|
|
adc59bf6ad |
@@ -1,5 +1,225 @@
|
||||
# DEVLOG - ComfyUI-Workflow-Studio
|
||||
|
||||
## 2026-03-23: v0.1.7 Nodes タブ追加
|
||||
|
||||
### 概要
|
||||
- ComfyUI にインストールされた全ノードをブラウジング・整理・管理する「Nodes」タブを追加
|
||||
- ノードセット機能:複数ノード+接続情報をセットとして保存し、再利用可能に
|
||||
|
||||
### 変更内容
|
||||
|
||||
#### 新規ファイル
|
||||
- **`py/services/nodes_service.py`** — ノードメタデータ(お気に入り、タグ、グループ)とノードセットの CRUD サービス
|
||||
- **`py/routes/nodes_routes.py`** — 9つの API エンドポイント(metadata, groups, node-sets の GET/POST/update/delete/export)
|
||||
- **`static/js/nodes-tab.js`** — Nodes タブのメインロジック(Node Browser + Node Sets サブビュー)
|
||||
- **`web/comfyui/node_sets_menu.js`** — ComfyUI キャンバス内サイドパネル(Favorites/Sets/Groups タブ、ドラッグ&ドロップ配置)
|
||||
|
||||
#### 既存ファイル修正
|
||||
- **`py/wfm.py`** — `nodes_routes.setup_routes(app)` 追加
|
||||
- **`py/config.py`** — `NODE_METADATA_FILE`, `NODE_SETS_FILE` 定数追加
|
||||
- **`static/js/app.js`** — Nodes タブ登録、`initNodesTab()` 呼び出し
|
||||
- **`static/js/i18n.js`** — EN/JA/ZH に Nodes タブ関連 ~35 キー追加
|
||||
- **`static/js/comfyui-client.js`** — `fetchAllObjectInfo()` メソッド追加
|
||||
- **`static/css/main.css`** — ノードタブ固有スタイル(カード、テーブル、バッジ、ページネーション等)
|
||||
- **`templates/index.html`** — Nodes タブの HTML 構造追加
|
||||
- **`web/comfyui/top_menu_extension.js`** — Node Library ボタン+右クリック "Save as Node Set" コンテキストメニュー追加
|
||||
|
||||
### 機能詳細
|
||||
|
||||
#### Node Browser(Sub-view 1)
|
||||
- ComfyUI `/object_info` API から全ノード取得(遅延読み込み)
|
||||
- Card / Table の2ビュー切り替え
|
||||
- フィルタ: カテゴリ、パッケージ、タグ、グループ、お気に入り
|
||||
- 全文検索: name, display_name, description, search_aliases, tags
|
||||
- パッケージ名カラーバッジ(ハッシュベース色生成)
|
||||
- サイドパネル: ノード詳細(I/O仕様テーブル、タグ編集、グループ管理)
|
||||
- 1ページ50ノード表示(ページネーション)
|
||||
|
||||
#### Node Sets(Sub-view 2)
|
||||
- ComfyUI キャンバスで選択したノード+接続をセットとして保存
|
||||
- 右クリックコンテキストメニュー "Save as Node Set" から保存
|
||||
- セット一覧表示(名前、説明、ノード数、タグ)
|
||||
- 作成・編集・削除
|
||||
- ComfyUI 互換 JSON としてクリップボードにコピー
|
||||
|
||||
#### ComfyUI トップバー統合
|
||||
- 3ボタン: Workflow Studio / Snapshot / Node Library
|
||||
- Node Library ボタンでサイドパネル開閉
|
||||
|
||||
### バグ修正
|
||||
- `node_sets_menu.js` で `const saveSelectedAsNodeSet` が二重定義されていた ESM SyntaxError を修正(Vite preload wrapper により完全にサイレントだった)
|
||||
- デバッグ用 `console.log` 削除
|
||||
|
||||
---
|
||||
|
||||
## 2026-03-23: v0.1.6 パストラバーサル脆弱性修正
|
||||
|
||||
### 概要
|
||||
- ComfyUI-Manager PR #2706 のレビューで指摘されたセキュリティ脆弱性を修正
|
||||
- `workflow_service.py` で任意のファイルパスへのアクセスが可能だった問題を解消
|
||||
|
||||
### 背景
|
||||
- ltdrdata(ComfyUI-Manager メンテナー)から `import_files` メソッド内のパス構築が安全でないとの指摘
|
||||
- `original_name` に `../../etc/passwd` のようなパストラバーサル文字列を送ることで、`workflows_dir` 外のファイルを読み書きできる状態だった
|
||||
|
||||
### 変更内容
|
||||
|
||||
#### `py/services/workflow_service.py`
|
||||
- **`_validate_filename()` 強化** — `"."`, `".."`, null バイト (`\x00`) のチェックを追加
|
||||
- **`_safe_path()` メソッド新規追加** — ファイル名バリデーション + `resolve()` でパスを正規化し、`workflows_dir` 配下にあることを検証。違反時は `ValueError` を送出
|
||||
- **全公開メソッドに `_safe_path()` 適用:**
|
||||
- `import_files` — ループ冒頭で `_validate_filename` チェック追加、パス構築を `_safe_path` に変更
|
||||
- `get_raw` — `_safe_path` に変更
|
||||
- `rename` — old/new 両パスを `_safe_path` に変更
|
||||
- `delete` — `_safe_path` に変更
|
||||
- `analyze` — `_safe_path` に変更
|
||||
- `change_thumbnail` — `_safe_path` に変更
|
||||
|
||||
---
|
||||
|
||||
## 2026-03-22: v0.1.5 テーマシステム追加
|
||||
|
||||
### 概要
|
||||
- 13種類のビルトインテーマを設定タブから切り替え可能に
|
||||
- テーマごとにカラー・フォント・角丸・影・特殊効果を変更
|
||||
- 選択テーマはlocalStorageに保存、ページ読み込み時にフラッシュなく復元
|
||||
|
||||
### 変更内容
|
||||
|
||||
#### テーマ定義(CSS)
|
||||
- `static/css/main.css` — 12テーマの`[data-theme="xxx"]`変数定義を末尾に追加
|
||||
- Pop & Vibrant / Light Minimalist / Cyberpunk / Glassmorphism / Neumorphism / Retro 8-bit / Pastel Dream / Brutalism / Earthy / Material UI / Monotone + Accent / Corporate Trust
|
||||
- テーマ固有の特殊効果CSS:
|
||||
- Cyberpunk: ネオン発光ボーダー(`box-shadow`)、JSON構文ハイライト色変更
|
||||
- Glassmorphism: `backdrop-filter: blur(12px)` + メッシュグラデーション背景
|
||||
- Neumorphism: ダブルシャドウ(凸凹表現)、insetシャドウボタン
|
||||
- Retro-pixel / Brutalism: 太い黒ボーダー(`border: 3px solid #000`)
|
||||
- `.wfm-theme-grid` / `.wfm-theme-card` / `.wfm-theme-swatch` — テーマ選択UIスタイル
|
||||
|
||||
#### テーマ選択UI(JavaScript)
|
||||
- `static/js/settings-tab.js`:
|
||||
- `THEMES` 配列: テーマID・i18nキー・プレビュー用4色スウォッチを定義
|
||||
- `applyTheme(themeId)` — `<html>`の`data-theme`属性を設定/解除
|
||||
- `getSavedTheme()` — localStorageから保存テーマを取得
|
||||
- 設定タブにカラースウォッチ付きグリッドUIを生成(言語設定の直下)
|
||||
- クリックで即座にテーマ適用 + localStorage保存 + activeクラス更新
|
||||
- `static/js/app.js`:
|
||||
- `applyTheme` / `getSavedTheme` をインポート
|
||||
- `DOMContentLoaded`の前にテーマ復元を実行(テーマフラッシュ防止)
|
||||
|
||||
#### 多言語対応
|
||||
- `static/js/i18n.js` — 3言語(EN/JA/ZH)に `themeLabel` + 13テーマ名の翻訳キー追加
|
||||
|
||||
#### その他
|
||||
- `templates/index.html` — ヘルプページのGitHubリンクURL修正
|
||||
- `README.md` — v0.1.5更新、テーマ機能記載、git clone URL修正
|
||||
|
||||
### スクリーンショット
|
||||
| Workflow Tab (Pastel Dream) | Settings Tab (Theme) |
|
||||
|:---:|:---:|
|
||||
|  |  |
|
||||
|
||||
---
|
||||
|
||||
## 2026-03-22: v0.1.4 App形式対応・プリセットコピー・分析バグ修正
|
||||
|
||||
### 概要
|
||||
- ComfyUI App形式(`.app.json`)ワークフローの識別・表示対応
|
||||
- プリセットタブにポジティブ/ネガティブプロンプトのクリップボードコピーボタン追加
|
||||
- ワークフロー分析のクラッシュバグ修正
|
||||
|
||||
### 変更内容
|
||||
|
||||
#### App形式ワークフロー対応
|
||||
- **背景:** ComfyUIの最新アップデートでAppモード(ノードを簡略化したWebアプリ風UI)が追加され、`.app.json`拡張子で保存される
|
||||
- **対応:**
|
||||
- `static/js/comfyui-workflow.js` — `detectFormat()`にファイル名ベースのApp形式判定を追加
|
||||
- `static/js/workflow-tab.js` — サイドパネルJSONタブのフォーマットバッジに「App形式」表示を追加
|
||||
- `static/js/generate-tab.js` — App形式ワークフローの生成UI読み込みをブロックし、「ComfyUIで開く」への誘導メッセージを表示
|
||||
- `static/css/main.css` — `.wfm-format-badge--app` スタイル追加(オレンジ色)
|
||||
- `static/js/i18n.js` — `appFormat` / `appFormatNotSupported` 翻訳キー追加(EN/JA/ZH)
|
||||
|
||||
#### プリセット クリップボードコピーボタン
|
||||
- **課題:** プリセットのプロンプトをComfyUI本体で使う際に手動コピーが必要だった
|
||||
- **対応:**
|
||||
- `templates/index.html` — プリセット保存ボタン行に「PP コピー」「NP コピー」ボタンを追加(flex:2/2/1比率)
|
||||
- `static/js/prompt-tab.js` — クリップボードコピー処理(`navigator.clipboard.writeText`)追加
|
||||
- `static/js/app.js` — コピーボタンのi18n適用
|
||||
- `static/js/i18n.js` — `copyPositivePrompt` / `copyNegativePrompt` / `copiedToClipboard` / `noTextToCopy` 翻訳キー追加
|
||||
|
||||
#### ワークフロー分析バグ修正
|
||||
- **問題:** UI形式ワークフローの`widgets_values[0]`が整数(例: EmptyLatentImageの`768`)の場合、`.lower()`で`AttributeError`が発生し、例外キャッチにより全分析結果がゼロになる
|
||||
- **修正:** `py/services/workflow_analyzer.py` — `_model_name_from_ui_node()`に`isinstance(val, str)`型チェックを追加
|
||||
|
||||
---
|
||||
|
||||
## 2026-03-21: v0.1.3 ヘルプ&サポートタブ追加
|
||||
|
||||
### 概要
|
||||
- ヘルプ&サポートタブを新規追加(機能一覧 + サポートリンク)
|
||||
|
||||
### 変更内容
|
||||
|
||||
#### ヘルプ&サポートタブ
|
||||
- **課題:** プラグインの機能概要を確認する場所がなく、サポートへの導線もなかった
|
||||
- **対応:** 新しいメインタブ「Help」を追加し、機能一覧とサポートセクションを設置
|
||||
|
||||
##### 機能一覧セクション
|
||||
- 各タブ(Workflow / GenerateUI / Prompt / Settings)の主要機能をカード形式で表示
|
||||
- Tipsセクション(ドラッグ&ドロップ、お気に入り、デフォルトワークフロー)
|
||||
|
||||
##### サポートセクション
|
||||
- GitHubリンク(バグ報告・機能リクエスト・コントリビュート)
|
||||
- Ko-fiリンク(開発支援)
|
||||
- SVGアイコン付きのリンクカード
|
||||
|
||||
#### 変更ファイル
|
||||
- `templates/index.html` — Helpタブボタン追加、ヘルプ&サポートセクションのHTML構造
|
||||
- `static/js/i18n.js` — 3言語(EN/JA/ZH)のヘルプ関連翻訳キー30項目追加
|
||||
- `static/js/app.js` — タブマップにhelp追加、`applyI18nToHtml()`にヘルプタブのi18n適用ロジック追加
|
||||
- `static/css/main.css` — `.wfm-help-*` スタイル追加(コンテナ、セクション、カード、リンク)
|
||||
|
||||
---
|
||||
|
||||
## 2026-03-19: v0.1.2 リリース
|
||||
|
||||
### 概要
|
||||
- キャンバススナップショット機能追加(ComfyUIトップバーにカメラボタン)
|
||||
- ワークフローサイドパネル・モーダルにサムネイルプレビュー追加
|
||||
|
||||
### 変更内容
|
||||
|
||||
#### Canvas Snapshot(キャンバススナップショット)
|
||||
- **課題:** ワークフローのキャンバス画像を保存するにはComfyUIのエクスポート機能を使い手動でファイル管理する必要があった
|
||||
- **対応:** ComfyUIトップバーにカメラボタンを追加し、ワンクリックでキャンバスをPNGキャプチャ→ワークフローデータフォルダに自動保存
|
||||
- `web/comfyui/top_menu_extension.js`:
|
||||
- カメラアイコンボタン追加(actionBarButtons API / legacy ComfyButtonGroup 両対応)
|
||||
- `captureCanvasSnapshot()` — LiteGraphキャンバスの状態保存→ノード範囲計算→レンダリング→Blob化→復元
|
||||
- PNG tEXtチャンク埋め込み (`n2b`, `joinArrayBuffer`, `crc32`, `embedWorkflowInPng`) — ComfyUIのドラッグ&ドロップインポート互換
|
||||
- タイムスタンプファイル名 `wf_YYYYMMDDHHmmss.json` 形式で自動生成
|
||||
- `py/routes/workflow_routes.py`:
|
||||
- `POST /api/wfm/workflows/save-canvas-image` ルート追加
|
||||
- `import_files` を利用してPNGからワークフローJSON抽出+サムネイル保存+自動インポート
|
||||
- 参考実装: [pythongosssss/ComfyUI-Custom-Scripts](https://github.com/pythongosssss/ComfyUI-Custom-Scripts) の workflowImage.js
|
||||
|
||||
#### サムネイルプレビュー
|
||||
- `templates/index.html` — サイドパネルにThumbnailタブ追加(デフォルトアクティブ)
|
||||
- `static/js/workflow-tab.js`:
|
||||
- `sidePanelThumbUpdate()` — 選択ワークフローのサムネイル・メタ情報表示
|
||||
- モーダル上部にサムネイルセクション追加
|
||||
- サムネイル変更時にサイドパネル・モーダル両方を同期更新
|
||||
- `static/css/main.css` — `.wfm-side-thumb-*` / `.wfm-modal-thumb-*` スタイル追加
|
||||
|
||||
### スクリーンショット
|
||||
| Workflow Tab | ComfyUI Top Bar |
|
||||
|:---:|:---:|
|
||||
|  |  |
|
||||
|
||||
### リリース
|
||||
- GitHub Release v0.1.2: https://github.com/ketle-man/ComfyUI-Workflow-Studio/releases/tag/v0.1.2
|
||||
|
||||
---
|
||||
|
||||
## 2026-03-19: v0.1.1 リリース
|
||||
|
||||
### 概要
|
||||
@@ -104,7 +324,7 @@ ComfyUI-Workflow-Studio/
|
||||
│ ├── config.py # パス設定
|
||||
│ ├── routes/ # APIルート
|
||||
│ └── services/ # ビジネスロジック
|
||||
├── templates/index.html # SPA (Workflow/GenerateUI/Prompt/Settings)
|
||||
├── templates/index.html # SPA (Workflow/GenerateUI/Prompt/Settings/Help)
|
||||
├── static/ # CSS/JS
|
||||
├── web/comfyui/ # ComfyUIメニュー拡張
|
||||
└── data/ # ワークフロー・メタデータ・設定
|
||||
|
||||
@@ -5,7 +5,7 @@ A comprehensive workflow management and generation UI plugin for [ComfyUI](https
|
||||
Browse, organize, and execute workflows directly from a dedicated studio interface — without switching between windows or manually editing JSON.
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
## Screenshots
|
||||
|
||||
@@ -17,9 +17,9 @@ Browse, organize, and execute workflows directly from a dedicated studio interfa
|
||||
|:---:|:---:|
|
||||
|  |  |
|
||||
|
||||
| ComfyUI Integration |
|
||||
|:---:|
|
||||
|  |
|
||||
| Help & Support Tab | ComfyUI Integration |
|
||||
|:---:|:---:|
|
||||
|  |  |
|
||||
|
||||
---
|
||||
|
||||
@@ -56,15 +56,32 @@ Browse, organize, and execute workflows directly from a dedicated studio interfa
|
||||
- **Image attachment** — attach reference images for vision-capable models
|
||||
- **Translation** — JA/EN/ZH translation buttons for multilingual prompt creation
|
||||
- **Prompt presets** — save/load reusable prompt templates (positive & negative)
|
||||
- **Clipboard copy** — copy positive/negative prompts individually for use in ComfyUI
|
||||
- **Apply to GenerateUI** — send prompts directly to the generation interface
|
||||
|
||||
### Settings Tab
|
||||
- **Theme selection** — 13 built-in themes with visual swatch preview (Dark, Pop, Minimalist, Cyberpunk, Glassmorphism, Neumorphism, Retro Pixel, Pastel, Brutalism, Earthy, Material, Monotone, Corporate)
|
||||
- **Workflows directory** — configure which folder to scan for workflows
|
||||
- **Eagle connection** — set Eagle API endpoint for auto-save
|
||||
- **Ollama connection** — configure Ollama server URL
|
||||
- **Badge display** — toggle metadata badges on workflow cards
|
||||
- **Language** — English / Japanese / Chinese
|
||||
|
||||
### Nodes Tab (v0.1.7)
|
||||
- **Node Browser** — browse all installed ComfyUI nodes from `/object_info` API with Card/Table views
|
||||
- **Search & Filter** — full-text search, filter by category, package, tags, groups, and favorites
|
||||
- **Package badges** — color-coded badges generated from package names
|
||||
- **Node detail panel** — view I/O specifications, edit tags, manage groups
|
||||
- **Node Sets** — save multiple nodes + connections as reusable sets from the ComfyUI canvas
|
||||
- **Right-click context menu** — "Save as Node Set" option on any node in ComfyUI
|
||||
- **Node Library side panel** — Favorites, Sets, and Groups tabs accessible from ComfyUI's top bar
|
||||
- **Drag & drop** — place node sets onto the canvas via drag and drop
|
||||
|
||||
### Help & Support Tab (v0.1.3)
|
||||
- **Feature list** — overview of all features organized by tab
|
||||
- **Tips** — quick tips for drag & drop import, favorites, and default workflow
|
||||
- **Support links** — GitHub repository and Ko-fi donation page
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
@@ -77,7 +94,7 @@ Search for **Workflow Studio** in ComfyUI Manager and install.
|
||||
|
||||
```bash
|
||||
cd ComfyUI/custom_nodes
|
||||
git clone https://github.com/your-username/ComfyUI-Workflow-Studio.git
|
||||
git clone https://github.com/ketle-man/ComfyUI-Workflow-Studio.git
|
||||
```
|
||||
|
||||
Restart ComfyUI after installation.
|
||||
@@ -135,6 +152,29 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
|
||||
|
||||
## Changelog
|
||||
|
||||
### v0.1.7
|
||||
- **Nodes tab** — browse, search, and filter all installed ComfyUI nodes with Card/Table views, pagination (50 nodes/page), package color badges, and node detail side panel with I/O specs
|
||||
- **Node Sets** — save selected nodes + connections from ComfyUI canvas as reusable sets via right-click context menu
|
||||
- **Node Library side panel** — accessible from ComfyUI top bar with Favorites, Sets, and Groups tabs, drag & drop placement
|
||||
- **3 top bar buttons** — Workflow Studio, Canvas Snapshot, and Node Library buttons in ComfyUI's action bar
|
||||
|
||||
### v0.1.6
|
||||
- **Security fix** — path traversal vulnerability in `workflow_service.py` (reported via ComfyUI-Manager PR review)
|
||||
|
||||
### v0.1.5
|
||||
- **Theme system** — 13 built-in themes selectable from Settings tab with instant preview (Deep Ocean Dark, Pop & Vibrant, Light Minimalist, Cyberpunk, Glassmorphism, Neumorphism, Retro 8-bit, Pastel Dream, Brutalism, Earthy, Material UI, Monotone + Accent, Corporate Trust)
|
||||
- Theme preference persisted in localStorage and restored on page load (no flash)
|
||||
- Special CSS effects per theme: neon glow (Cyberpunk), backdrop blur (Glassmorphism), dual shadow (Neumorphism), pixel borders (Retro/Brutalism)
|
||||
|
||||
### v0.1.4
|
||||
- **App format support** — detect `.app.json` workflows (ComfyUI App mode), show "App Format" badge, block loading in GenerateUI with guidance message
|
||||
- **Preset clipboard copy** — added PP Copy / NP Copy buttons to copy positive/negative prompts to clipboard
|
||||
- **Analysis bugfix** — fixed workflow analysis crash when `widgets_values` contains non-string values (e.g. integers)
|
||||
|
||||
### v0.1.3
|
||||
- Added **Help & Support tab** — feature list, tips, and support links (GitHub, Ko-fi)
|
||||
- Multi-language support (EN/JA/ZH) for all help content
|
||||
|
||||
### v0.1.2
|
||||
- Added **Canvas Snapshot** button to ComfyUI top bar — capture workflow canvas as PNG thumbnail with embedded workflow metadata
|
||||
- Added **Thumbnail tab** to the workflow side panel for quick visual preview
|
||||
@@ -156,16 +196,18 @@ ComfyUI-Workflow-Studio/
|
||||
│ ├── config.py # Path configuration
|
||||
│ ├── routes/
|
||||
│ │ ├── workflow_routes.py # Workflow CRUD & analysis API
|
||||
│ │ ├── nodes_routes.py # Nodes metadata & node sets API
|
||||
│ │ ├── settings_routes.py # Settings API
|
||||
│ │ ├── ollama_routes.py # Ollama proxy API
|
||||
│ │ └── eagle_routes.py # Eagle integration API
|
||||
│ └── services/
|
||||
│ ├── workflow_service.py # Workflow file operations
|
||||
│ ├── nodes_service.py # Node metadata & node sets
|
||||
│ ├── workflow_analyzer.py # Model/node detection
|
||||
│ ├── settings_service.py # Settings persistence
|
||||
│ └── png_extractor.py # PNG metadata extraction
|
||||
├── templates/
|
||||
│ └── index.html # SPA template
|
||||
│ └── index.html # SPA template (Workflow/GenerateUI/Prompt/Settings/Help)
|
||||
├── static/
|
||||
│ ├── favicon.svg # Browser tab icon (W+S Wave)
|
||||
│ ├── css/main.css # Styles
|
||||
@@ -176,12 +218,14 @@ ComfyUI-Workflow-Studio/
|
||||
│ ├── prompt-tab.js # AI assistant & presets
|
||||
│ ├── settings-tab.js # Settings panel
|
||||
│ ├── comfyui-client.js # ComfyUI WebSocket/API client
|
||||
│ ├── nodes-tab.js # Node browser & node sets
|
||||
│ ├── comfyui-workflow.js # UI-to-API format conversion
|
||||
│ ├── comfyui-editor.js # Dynamic parameter editor
|
||||
│ ├── json-highlight.js # JSON syntax highlighting
|
||||
│ └── i18n.js # Internationalization
|
||||
├── web/comfyui/
|
||||
│ └── top_menu_extension.js # ComfyUI menu bar integration
|
||||
│ ├── top_menu_extension.js # ComfyUI menu bar integration
|
||||
│ └── node_sets_menu.js # Node Library side panel
|
||||
└── data/ # Metadata & settings storage
|
||||
```
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 33 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 131 KiB |
+461
@@ -0,0 +1,461 @@
|
||||
/* ============================================
|
||||
Workflow Studio - Theme Definitions
|
||||
============================================
|
||||
|
||||
各テーマは :root の CSS変数を上書きすることで適用される。
|
||||
body の font-family も各テーマで変更する。
|
||||
|
||||
現在のデフォルトテーマ (Deep Ocean Dark) の変数:
|
||||
--wfm-bg: #1a1a2e
|
||||
--wfm-bg-secondary: #16213e
|
||||
--wfm-bg-tertiary: #0f3460
|
||||
--wfm-surface: #1e2a4a
|
||||
--wfm-surface-hover: #253358
|
||||
--wfm-border: #2a3a5c
|
||||
--wfm-text: #e0e0e0
|
||||
--wfm-text-secondary: #a0a0b0
|
||||
--wfm-primary: #4a9eff
|
||||
--wfm-primary-hover: #3a8eef
|
||||
--wfm-danger: #ff4757
|
||||
--wfm-success: #2ed573
|
||||
--wfm-warning: #ffa502
|
||||
--wfm-accent: #7c5cfc
|
||||
--wfm-radius: 8px
|
||||
--wfm-radius-sm: 4px
|
||||
--wfm-shadow: 0 2px 8px rgba(0,0,0,0.3)
|
||||
============================================ */
|
||||
|
||||
|
||||
/* ============================================
|
||||
1. Pop & Vibrant (ポップ調)
|
||||
明るく楽しく、クリエイティビティを刺激するデザイン
|
||||
============================================ */
|
||||
|
||||
[data-theme="pop-vibrant"] {
|
||||
--wfm-bg: #F8F9FA;
|
||||
--wfm-bg-secondary: #FFFFFF;
|
||||
--wfm-bg-tertiary: #EEF0F2;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #F0F4FF;
|
||||
--wfm-border: #E0E0E0;
|
||||
--wfm-text: #2D2D2D;
|
||||
--wfm-text-secondary: #666666;
|
||||
--wfm-primary: #FF6B6B;
|
||||
--wfm-primary-hover: #FF5252;
|
||||
--wfm-danger: #FF4757;
|
||||
--wfm-success: #2ED573;
|
||||
--wfm-warning: #FFA502;
|
||||
--wfm-accent: #00D2D3;
|
||||
--wfm-radius: 16px;
|
||||
--wfm-radius-sm: 8px;
|
||||
--wfm-shadow: 0 4px 16px rgba(255, 107, 107, 0.15);
|
||||
/* 追加テーマ変数 */
|
||||
--wfm-tag-sdxl: #FF6B6B;
|
||||
--wfm-tag-sd15: #00D2D3;
|
||||
--wfm-tag-flux: #FFC048;
|
||||
--wfm-tag-default: #A55EEA;
|
||||
}
|
||||
|
||||
[data-theme="pop-vibrant"] body {
|
||||
font-family: 'Zen Maru Gothic', 'Rounded Mplus 1c', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================
|
||||
2. Light Minimalist (クリーン&ライト)
|
||||
現代的でノイズのない、コンテンツ集中型デザイン
|
||||
============================================ */
|
||||
|
||||
[data-theme="light-minimalist"] {
|
||||
--wfm-bg: #FFFFFF;
|
||||
--wfm-bg-secondary: #F5F5F5;
|
||||
--wfm-bg-tertiary: #FAFAFA;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #F0F4FF;
|
||||
--wfm-border: #EEEEEE;
|
||||
--wfm-text: #333333;
|
||||
--wfm-text-secondary: #888888;
|
||||
--wfm-primary: #4A9EFF;
|
||||
--wfm-primary-hover: #3A8EEF;
|
||||
--wfm-danger: #EF4444;
|
||||
--wfm-success: #22C55E;
|
||||
--wfm-warning: #F59E0B;
|
||||
--wfm-accent: #6366F1;
|
||||
--wfm-radius: 8px;
|
||||
--wfm-radius-sm: 4px;
|
||||
--wfm-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
[data-theme="light-minimalist"] body {
|
||||
font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================
|
||||
3. Cyberpunk / Hacker (サイバーパンク)
|
||||
SF映画のようなハッカー感・ギーク感
|
||||
============================================ */
|
||||
|
||||
[data-theme="cyberpunk"] {
|
||||
--wfm-bg: #000000;
|
||||
--wfm-bg-secondary: #0A0A0A;
|
||||
--wfm-bg-tertiary: #111111;
|
||||
--wfm-surface: #0D0D0D;
|
||||
--wfm-surface-hover: #1A1A1A;
|
||||
--wfm-border: #00FF4130;
|
||||
--wfm-text: #00FF41;
|
||||
--wfm-text-secondary: #00CC33;
|
||||
--wfm-primary: #FF00FF;
|
||||
--wfm-primary-hover: #CC00CC;
|
||||
--wfm-danger: #FF073A;
|
||||
--wfm-success: #00FF41;
|
||||
--wfm-warning: #FFD300;
|
||||
--wfm-accent: #00FFFF;
|
||||
--wfm-radius: 0px;
|
||||
--wfm-radius-sm: 0px;
|
||||
--wfm-shadow: 0 0 12px rgba(0, 255, 65, 0.3);
|
||||
/* ネオン発光ボーダー用 */
|
||||
--wfm-glow-primary: 0 0 8px rgba(255, 0, 255, 0.6);
|
||||
--wfm-glow-accent: 0 0 8px rgba(0, 255, 255, 0.6);
|
||||
/* JSONパネル用 */
|
||||
--wfm-code-text: #00FF41;
|
||||
--wfm-code-bg: #000000;
|
||||
}
|
||||
|
||||
[data-theme="cyberpunk"] body {
|
||||
font-family: 'Space Mono', 'Fira Code', 'Courier New', monospace;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================
|
||||
4. Glassmorphism (グラスモーフィズム)
|
||||
半透明の洗練された未来的デザイン
|
||||
============================================ */
|
||||
|
||||
[data-theme="glassmorphism"] {
|
||||
--wfm-bg: #1A0533;
|
||||
--wfm-bg-secondary: rgba(255, 255, 255, 0.08);
|
||||
--wfm-bg-tertiary: rgba(255, 255, 255, 0.04);
|
||||
--wfm-surface: rgba(255, 255, 255, 0.10);
|
||||
--wfm-surface-hover: rgba(255, 255, 255, 0.16);
|
||||
--wfm-border: rgba(255, 255, 255, 0.18);
|
||||
--wfm-text: #F0F0F0;
|
||||
--wfm-text-secondary: #C0C0D0;
|
||||
--wfm-primary: #7B68EE;
|
||||
--wfm-primary-hover: #6A5ACD;
|
||||
--wfm-danger: #FF6B6B;
|
||||
--wfm-success: #69DB7C;
|
||||
--wfm-warning: #FFD43B;
|
||||
--wfm-accent: #DA77F2;
|
||||
--wfm-radius: 12px;
|
||||
--wfm-radius-sm: 8px;
|
||||
--wfm-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
||||
/* Glassmorphism用追加変数 */
|
||||
--wfm-glass-blur: blur(12px);
|
||||
--wfm-glass-bg: rgba(255, 255, 255, 0.10);
|
||||
/* 背景メッシュグラデーション */
|
||||
--wfm-mesh-gradient: linear-gradient(135deg, #1A0533 0%, #0D1B3E 25%, #1A0533 50%, #2D1054 75%, #0D1B3E 100%);
|
||||
}
|
||||
|
||||
[data-theme="glassmorphism"] body {
|
||||
font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================
|
||||
5. Neumorphism (ニューモーフィズム)
|
||||
柔らかく立体的な凸凹表現
|
||||
============================================ */
|
||||
|
||||
[data-theme="neumorphism"] {
|
||||
--wfm-bg: #D1D9E6;
|
||||
--wfm-bg-secondary: #D1D9E6;
|
||||
--wfm-bg-tertiary: #C8D0DD;
|
||||
--wfm-surface: #D1D9E6;
|
||||
--wfm-surface-hover: #D8E0ED;
|
||||
--wfm-border: transparent;
|
||||
--wfm-text: #4A5568;
|
||||
--wfm-text-secondary: #718096;
|
||||
--wfm-primary: #6C8EBF;
|
||||
--wfm-primary-hover: #5A7CAD;
|
||||
--wfm-danger: #E57373;
|
||||
--wfm-success: #81C784;
|
||||
--wfm-warning: #FFB74D;
|
||||
--wfm-accent: #7986CB;
|
||||
--wfm-radius: 12px;
|
||||
--wfm-radius-sm: 8px;
|
||||
/* ニューモーフィズム用の光と影 */
|
||||
--wfm-shadow: 6px 6px 12px #B8C0CC, -6px -6px 12px #EAF2FF;
|
||||
--wfm-shadow-inset: inset 4px 4px 8px #B8C0CC, inset -4px -4px 8px #EAF2FF;
|
||||
}
|
||||
|
||||
[data-theme="neumorphism"] body {
|
||||
font-family: 'Nunito', 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================
|
||||
6. Retro 8-bit / Pixel (レトロゲーム調)
|
||||
遊び心満載のファミコン風デザイン
|
||||
============================================ */
|
||||
|
||||
[data-theme="retro-pixel"] {
|
||||
--wfm-bg: #2C2C34;
|
||||
--wfm-bg-secondary: #3A3A44;
|
||||
--wfm-bg-tertiary: #24242C;
|
||||
--wfm-surface: #3A3A44;
|
||||
--wfm-surface-hover: #4A4A54;
|
||||
--wfm-border: #000000;
|
||||
--wfm-text: #F0F0E0;
|
||||
--wfm-text-secondary: #B0B0A0;
|
||||
--wfm-primary: #5B8FD4;
|
||||
--wfm-primary-hover: #4A7EC3;
|
||||
--wfm-danger: #D94848;
|
||||
--wfm-success: #48A848;
|
||||
--wfm-warning: #D4A017;
|
||||
--wfm-accent: #D45BD4;
|
||||
--wfm-radius: 0px;
|
||||
--wfm-radius-sm: 0px;
|
||||
/* 太い黒ボーダー + ベタ塗り影 */
|
||||
--wfm-shadow: 4px 4px 0px #000000;
|
||||
--wfm-border-width: 3px;
|
||||
}
|
||||
|
||||
[data-theme="retro-pixel"] body {
|
||||
font-family: 'DotGothic16', 'Press Start 2P', 'Courier New', monospace;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================
|
||||
7. Pastel Dream (パステルドリーム)
|
||||
柔らかく優しい、目に優しいデザイン
|
||||
============================================ */
|
||||
|
||||
[data-theme="pastel-dream"] {
|
||||
--wfm-bg: #F0E6FF;
|
||||
--wfm-bg-secondary: #E8F5E9;
|
||||
--wfm-bg-tertiary: #F3E5F5;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #FFF3E0;
|
||||
--wfm-border: #E1BEE7;
|
||||
--wfm-text: #5D4E75;
|
||||
--wfm-text-secondary: #8E7CA8;
|
||||
--wfm-primary: #B39DDB;
|
||||
--wfm-primary-hover: #9575CD;
|
||||
--wfm-danger: #F48FB1;
|
||||
--wfm-success: #A5D6A7;
|
||||
--wfm-warning: #FFE082;
|
||||
--wfm-accent: #80DEEA;
|
||||
--wfm-radius: 20px;
|
||||
--wfm-radius-sm: 12px;
|
||||
--wfm-shadow: 0 4px 16px rgba(179, 157, 219, 0.2);
|
||||
/* パステルタグカラー */
|
||||
--wfm-tag-sdxl: #FFAB91;
|
||||
--wfm-tag-sd15: #A5D6A7;
|
||||
--wfm-tag-flux: #90CAF9;
|
||||
--wfm-tag-default: #CE93D8;
|
||||
}
|
||||
|
||||
[data-theme="pastel-dream"] body {
|
||||
font-family: 'M PLUS Rounded 1c', 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================
|
||||
8. Brutalism / High Contrast (ブルータリズム)
|
||||
大胆で前衛的なハイコントラストデザイン
|
||||
============================================ */
|
||||
|
||||
[data-theme="brutalism"] {
|
||||
--wfm-bg: #FFFFFF;
|
||||
--wfm-bg-secondary: #FFFFFF;
|
||||
--wfm-bg-tertiary: #F0F0F0;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #CCFF00;
|
||||
--wfm-border: #000000;
|
||||
--wfm-text: #000000;
|
||||
--wfm-text-secondary: #333333;
|
||||
--wfm-primary: #CCFF00;
|
||||
--wfm-primary-hover: #BBEE00;
|
||||
--wfm-danger: #FF0000;
|
||||
--wfm-success: #00FF00;
|
||||
--wfm-warning: #FFFF00;
|
||||
--wfm-accent: #CCFF00;
|
||||
--wfm-radius: 0px;
|
||||
--wfm-radius-sm: 0px;
|
||||
/* 極太ボーダー + ベタ影 */
|
||||
--wfm-shadow: 6px 6px 0px #000000;
|
||||
--wfm-border-width: 3px;
|
||||
}
|
||||
|
||||
[data-theme="brutalism"] body {
|
||||
font-family: 'Arial Black', 'Impact', 'Helvetica Neue', sans-serif;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================
|
||||
9. Earthy / Nature (アースカラー)
|
||||
落ち着いたオーガニックなナチュラルデザイン
|
||||
============================================ */
|
||||
|
||||
[data-theme="earthy"] {
|
||||
--wfm-bg: #F5E6D3;
|
||||
--wfm-bg-secondary: #EDE0D4;
|
||||
--wfm-bg-tertiary: #E8D5C0;
|
||||
--wfm-surface: #FFF8F0;
|
||||
--wfm-surface-hover: #F5EDE4;
|
||||
--wfm-border: #D4B896;
|
||||
--wfm-text: #3E2723;
|
||||
--wfm-text-secondary: #6D4C41;
|
||||
--wfm-primary: #8D6E63;
|
||||
--wfm-primary-hover: #795548;
|
||||
--wfm-danger: #C0392B;
|
||||
--wfm-success: #6B8E23;
|
||||
--wfm-warning: #D4A017;
|
||||
--wfm-accent: #BF6830;
|
||||
--wfm-radius: 8px;
|
||||
--wfm-radius-sm: 4px;
|
||||
--wfm-shadow: 0 2px 8px rgba(62, 39, 35, 0.12);
|
||||
/* アースカラータグ */
|
||||
--wfm-tag-sdxl: #6B8E23;
|
||||
--wfm-tag-sd15: #BF6830;
|
||||
--wfm-tag-flux: #D4A017;
|
||||
--wfm-tag-default: #8D6E63;
|
||||
}
|
||||
|
||||
[data-theme="earthy"] body {
|
||||
font-family: 'Noto Sans JP', 'Noto Serif JP', Georgia, serif;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================
|
||||
10. Material UI (マテリアルデザイン風)
|
||||
Googleライクな直感的デザイン
|
||||
============================================ */
|
||||
|
||||
[data-theme="material"] {
|
||||
--wfm-bg: #FAFAFA;
|
||||
--wfm-bg-secondary: #FFFFFF;
|
||||
--wfm-bg-tertiary: #F5F5F5;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #E8EAF6;
|
||||
--wfm-border: #E0E0E0;
|
||||
--wfm-text: #212121;
|
||||
--wfm-text-secondary: #757575;
|
||||
--wfm-primary: #3F51B5;
|
||||
--wfm-primary-hover: #303F9F;
|
||||
--wfm-danger: #F44336;
|
||||
--wfm-success: #4CAF50;
|
||||
--wfm-warning: #FF9800;
|
||||
--wfm-accent: #FF4081;
|
||||
--wfm-radius: 4px;
|
||||
--wfm-radius-sm: 2px;
|
||||
/* マテリアルシャドウ (Elevation 2) */
|
||||
--wfm-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
|
||||
}
|
||||
|
||||
[data-theme="material"] body {
|
||||
font-family: 'Roboto', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================
|
||||
11. Monotone + One Accent (モノトーン+ワンアクセント)
|
||||
スタイリッシュなプロツール感
|
||||
============================================ */
|
||||
|
||||
[data-theme="monotone-accent"] {
|
||||
--wfm-bg: #F7F7F7;
|
||||
--wfm-bg-secondary: #FFFFFF;
|
||||
--wfm-bg-tertiary: #EBEBEB;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #F0F0F0;
|
||||
--wfm-border: #D0D0D0;
|
||||
--wfm-text: #1A1A1A;
|
||||
--wfm-text-secondary: #808080;
|
||||
--wfm-primary: #FF6B35;
|
||||
--wfm-primary-hover: #E85D2A;
|
||||
--wfm-danger: #CC0000;
|
||||
--wfm-success: #555555;
|
||||
--wfm-warning: #888888;
|
||||
--wfm-accent: #FF6B35;
|
||||
--wfm-radius: 6px;
|
||||
--wfm-radius-sm: 3px;
|
||||
--wfm-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
[data-theme="monotone-accent"] body {
|
||||
font-family: 'Helvetica Neue', 'Arial', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================
|
||||
12. Corporate Trust (コーポレート・トラスト)
|
||||
信頼感と堅牢性のあるBtoB向けデザイン
|
||||
============================================ */
|
||||
|
||||
[data-theme="corporate"] {
|
||||
--wfm-bg: #F0F4F8;
|
||||
--wfm-bg-secondary: #FFFFFF;
|
||||
--wfm-bg-tertiary: #E2E8F0;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #EBF0F6;
|
||||
--wfm-border: #CBD5E1;
|
||||
--wfm-text: #1E293B;
|
||||
--wfm-text-secondary: #64748B;
|
||||
--wfm-primary: #2563EB;
|
||||
--wfm-primary-hover: #1D4ED8;
|
||||
--wfm-danger: #DC2626;
|
||||
--wfm-success: #16A34A;
|
||||
--wfm-warning: #D97706;
|
||||
--wfm-accent: #7C3AED;
|
||||
--wfm-radius: 4px;
|
||||
--wfm-radius-sm: 2px;
|
||||
--wfm-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
[data-theme="corporate"] body {
|
||||
font-family: 'Noto Sans JP', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================
|
||||
テーマ適用方法のメモ
|
||||
============================================
|
||||
|
||||
HTMLの <html> タグに data-theme 属性を設定して切り替える:
|
||||
|
||||
<html data-theme="cyberpunk">
|
||||
<html data-theme="pastel-dream">
|
||||
<html data-theme="brutalism">
|
||||
...
|
||||
|
||||
JavaScriptでの切り替え例:
|
||||
|
||||
document.documentElement.setAttribute('data-theme', 'cyberpunk');
|
||||
|
||||
テーマをリセットしてデフォルトに戻す場合:
|
||||
|
||||
document.documentElement.removeAttribute('data-theme');
|
||||
|
||||
============================================
|
||||
|
||||
テーマ一覧:
|
||||
|
||||
| ID | 名前 | 系統 |
|
||||
|-------------------|-------------------------------|----------|
|
||||
| (default) | Deep Ocean Dark | ダーク |
|
||||
| pop-vibrant | Pop & Vibrant | ライト |
|
||||
| light-minimalist | Light Minimalist | ライト |
|
||||
| cyberpunk | Cyberpunk / Hacker | ダーク |
|
||||
| glassmorphism | Glassmorphism | ダーク |
|
||||
| neumorphism | Neumorphism | ライト |
|
||||
| retro-pixel | Retro 8-bit / Pixel | ダーク |
|
||||
| pastel-dream | Pastel Dream | ライト |
|
||||
| brutalism | Brutalism / High Contrast | ライト |
|
||||
| earthy | Earthy / Nature | ライト |
|
||||
| material | Material UI | ライト |
|
||||
| monotone-accent | Monotone + One Accent | ライト |
|
||||
| corporate | Corporate Trust | ライト |
|
||||
|
||||
============================================ */
|
||||
@@ -55,3 +55,5 @@ DATA_DIR.mkdir(parents=True, exist_ok=True)
|
||||
# Metadata file path
|
||||
METADATA_FILE = DATA_DIR / "metadata.json"
|
||||
SETTINGS_FILE = DATA_DIR / "settings.json"
|
||||
NODE_METADATA_FILE = DATA_DIR / "node_metadata.json"
|
||||
NODE_SETS_FILE = DATA_DIR / "node_sets.json"
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
"""Node metadata and node sets API routes."""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from aiohttp import web
|
||||
|
||||
from ..services.nodes_service import NodesService
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_service = NodesService()
|
||||
|
||||
|
||||
def setup_routes(app: web.Application):
|
||||
"""Register all node management API routes."""
|
||||
# Node metadata
|
||||
app.router.add_get("/api/wfm/nodes/metadata", handle_get_metadata)
|
||||
app.router.add_post("/api/wfm/nodes/metadata", handle_save_metadata)
|
||||
# Node groups
|
||||
app.router.add_get("/api/wfm/nodes/groups", handle_get_groups)
|
||||
app.router.add_post("/api/wfm/nodes/groups", handle_save_groups)
|
||||
# Node sets
|
||||
app.router.add_get("/api/wfm/node-sets", handle_list_sets)
|
||||
app.router.add_post("/api/wfm/node-sets", handle_create_set)
|
||||
app.router.add_post("/api/wfm/node-sets/update", handle_update_set)
|
||||
app.router.add_post("/api/wfm/node-sets/delete", handle_delete_set)
|
||||
app.router.add_get("/api/wfm/node-sets/export", handle_export_set)
|
||||
|
||||
|
||||
# ── Node Metadata ──────────────────────────────────────────
|
||||
|
||||
|
||||
async def handle_get_metadata(request: web.Request) -> web.Response:
|
||||
"""GET /api/wfm/nodes/metadata"""
|
||||
try:
|
||||
result = await asyncio.to_thread(_service.get_all_metadata)
|
||||
return web.json_response(result)
|
||||
except Exception as e:
|
||||
logger.error("Error loading node metadata: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
async def handle_save_metadata(request: web.Request) -> web.Response:
|
||||
"""POST /api/wfm/nodes/metadata"""
|
||||
try:
|
||||
body = await request.json()
|
||||
node_name = body.get("nodeName", "")
|
||||
if not node_name:
|
||||
return web.json_response({"error": "nodeName is required"}, status=400)
|
||||
updates = {k: v for k, v in body.items() if k != "nodeName"}
|
||||
result = await asyncio.to_thread(_service.update_node_metadata, node_name, updates)
|
||||
return web.json_response({"status": "ok", "metadata": result})
|
||||
except Exception as e:
|
||||
logger.error("Error saving node metadata: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# ── Node Groups ────────────────────────────────────────────
|
||||
|
||||
|
||||
async def handle_get_groups(request: web.Request) -> web.Response:
|
||||
"""GET /api/wfm/nodes/groups"""
|
||||
try:
|
||||
result = await asyncio.to_thread(_service.get_node_groups)
|
||||
return web.json_response(result)
|
||||
except Exception as e:
|
||||
logger.error("Error loading node groups: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
async def handle_save_groups(request: web.Request) -> web.Response:
|
||||
"""POST /api/wfm/nodes/groups"""
|
||||
try:
|
||||
body = await request.json()
|
||||
result = await asyncio.to_thread(_service.save_node_groups, body)
|
||||
return web.json_response({"status": "ok", "groups": result})
|
||||
except Exception as e:
|
||||
logger.error("Error saving node groups: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
# ── Node Sets ──────────────────────────────────────────────
|
||||
|
||||
|
||||
async def handle_list_sets(request: web.Request) -> web.Response:
|
||||
"""GET /api/wfm/node-sets"""
|
||||
try:
|
||||
result = await asyncio.to_thread(_service.list_node_sets)
|
||||
return web.json_response(result)
|
||||
except Exception as e:
|
||||
logger.error("Error listing node sets: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
async def handle_create_set(request: web.Request) -> web.Response:
|
||||
"""POST /api/wfm/node-sets"""
|
||||
try:
|
||||
body = await request.json()
|
||||
result = await asyncio.to_thread(_service.create_node_set, body)
|
||||
return web.json_response({"status": "ok", "nodeSet": result})
|
||||
except Exception as e:
|
||||
logger.error("Error creating node set: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
async def handle_update_set(request: web.Request) -> web.Response:
|
||||
"""POST /api/wfm/node-sets/update"""
|
||||
try:
|
||||
body = await request.json()
|
||||
set_id = body.get("id", "")
|
||||
if not set_id:
|
||||
return web.json_response({"error": "id is required"}, status=400)
|
||||
updates = {k: v for k, v in body.items() if k != "id"}
|
||||
result = await asyncio.to_thread(_service.update_node_set, set_id, updates)
|
||||
if result is None:
|
||||
return web.json_response({"error": "node set not found"}, status=404)
|
||||
return web.json_response({"status": "ok", "nodeSet": result})
|
||||
except Exception as e:
|
||||
logger.error("Error updating node set: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
async def handle_delete_set(request: web.Request) -> web.Response:
|
||||
"""POST /api/wfm/node-sets/delete"""
|
||||
try:
|
||||
body = await request.json()
|
||||
set_id = body.get("id", "")
|
||||
if not set_id:
|
||||
return web.json_response({"error": "id is required"}, status=400)
|
||||
await asyncio.to_thread(_service.delete_node_set, set_id)
|
||||
return web.json_response({"status": "ok"})
|
||||
except Exception as e:
|
||||
logger.error("Error deleting node set: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
async def handle_export_set(request: web.Request) -> web.Response:
|
||||
"""GET /api/wfm/node-sets/export?id=xxx"""
|
||||
try:
|
||||
set_id = request.query.get("id", "")
|
||||
if not set_id:
|
||||
return web.json_response({"error": "id is required"}, status=400)
|
||||
result = await asyncio.to_thread(_service.export_node_set_json, set_id)
|
||||
if result is None:
|
||||
return web.json_response({"error": "node set not found"}, status=404)
|
||||
return web.json_response(result)
|
||||
except Exception as e:
|
||||
logger.error("Error exporting node set: %s", e)
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
@@ -0,0 +1,146 @@
|
||||
"""Node metadata and node sets management service."""
|
||||
|
||||
import json
|
||||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from ..config import NODE_METADATA_FILE, NODE_SETS_FILE
|
||||
|
||||
|
||||
class NodesService:
|
||||
"""Manages user-defined node metadata (tags, favorites, groups) and node sets."""
|
||||
|
||||
def __init__(self):
|
||||
self.node_metadata_file = NODE_METADATA_FILE
|
||||
self.node_sets_file = NODE_SETS_FILE
|
||||
|
||||
def _now_iso(self):
|
||||
return datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
|
||||
|
||||
# ── Node Metadata ──────────────────────────────────────────
|
||||
|
||||
def _load_node_metadata(self):
|
||||
if self.node_metadata_file.exists():
|
||||
try:
|
||||
with open(self.node_metadata_file, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
except Exception:
|
||||
pass
|
||||
return {}
|
||||
|
||||
def _save_node_metadata(self, data):
|
||||
self.node_metadata_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(self.node_metadata_file, "w", encoding="utf-8") as f:
|
||||
json.dump(data, f, ensure_ascii=False, indent=2)
|
||||
|
||||
def get_all_metadata(self):
|
||||
return self._load_node_metadata()
|
||||
|
||||
def update_node_metadata(self, node_name, updates):
|
||||
data = self._load_node_metadata()
|
||||
if node_name not in data:
|
||||
data[node_name] = {"tags": [], "favorite": False}
|
||||
entry = data[node_name]
|
||||
if "tags" in updates:
|
||||
entry["tags"] = updates["tags"]
|
||||
if "favorite" in updates:
|
||||
entry["favorite"] = updates["favorite"]
|
||||
entry["updatedAt"] = self._now_iso()
|
||||
data[node_name] = entry
|
||||
self._save_node_metadata(data)
|
||||
return entry
|
||||
|
||||
# ── Node Groups ────────────────────────────────────────────
|
||||
|
||||
def get_node_groups(self):
|
||||
data = self._load_node_metadata()
|
||||
return data.get("_groups", {})
|
||||
|
||||
def save_node_groups(self, groups):
|
||||
data = self._load_node_metadata()
|
||||
data["_groups"] = groups
|
||||
self._save_node_metadata(data)
|
||||
return groups
|
||||
|
||||
# ── Node Sets ──────────────────────────────────────────────
|
||||
|
||||
def _load_node_sets(self):
|
||||
if self.node_sets_file.exists():
|
||||
try:
|
||||
with open(self.node_sets_file, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
except Exception:
|
||||
pass
|
||||
return []
|
||||
|
||||
def _save_node_sets(self, sets):
|
||||
self.node_sets_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(self.node_sets_file, "w", encoding="utf-8") as f:
|
||||
json.dump(sets, f, ensure_ascii=False, indent=2)
|
||||
|
||||
def list_node_sets(self):
|
||||
return self._load_node_sets()
|
||||
|
||||
def create_node_set(self, set_data):
|
||||
sets = self._load_node_sets()
|
||||
set_data["id"] = str(uuid.uuid4())
|
||||
set_data["created_at"] = self._now_iso()
|
||||
sets.append(set_data)
|
||||
self._save_node_sets(sets)
|
||||
return set_data
|
||||
|
||||
def update_node_set(self, set_id, updates):
|
||||
sets = self._load_node_sets()
|
||||
for s in sets:
|
||||
if s["id"] == set_id:
|
||||
for key in ("name", "description", "tags", "nodes", "links"):
|
||||
if key in updates:
|
||||
s[key] = updates[key]
|
||||
s["updated_at"] = self._now_iso()
|
||||
self._save_node_sets(sets)
|
||||
return s
|
||||
return None
|
||||
|
||||
def delete_node_set(self, set_id):
|
||||
sets = self._load_node_sets()
|
||||
sets = [s for s in sets if s["id"] != set_id]
|
||||
self._save_node_sets(sets)
|
||||
|
||||
def export_node_set_json(self, set_id):
|
||||
"""Export a node set as ComfyUI-compatible partial workflow JSON."""
|
||||
sets = self._load_node_sets()
|
||||
target = None
|
||||
for s in sets:
|
||||
if s["id"] == set_id:
|
||||
target = s
|
||||
break
|
||||
if target is None:
|
||||
return None
|
||||
|
||||
nodes = target.get("nodes", [])
|
||||
links = target.get("links", [])
|
||||
|
||||
# Build prompt-format dict
|
||||
prompt = {}
|
||||
base_id = 100
|
||||
for i, node in enumerate(nodes):
|
||||
node_id = str(base_id + i)
|
||||
inputs = {}
|
||||
# Apply links: set linked inputs as [source_node_id, slot]
|
||||
for link in links:
|
||||
if link.get("to_node") == i:
|
||||
input_name = link.get("to_input", "")
|
||||
from_id = str(base_id + link["from_node"])
|
||||
inputs[input_name] = [from_id, link.get("from_slot", 0)]
|
||||
prompt[node_id] = {
|
||||
"class_type": node["class_type"],
|
||||
"inputs": inputs,
|
||||
}
|
||||
if node.get("title"):
|
||||
prompt[node_id]["_meta"] = {"title": node["title"]}
|
||||
|
||||
return {
|
||||
"name": target.get("name", ""),
|
||||
"prompt": prompt,
|
||||
"node_count": len(nodes),
|
||||
}
|
||||
@@ -7,7 +7,8 @@ import re
|
||||
def _model_name_from_ui_node(node):
|
||||
"""Extract model filename from UI format node (lowercase)."""
|
||||
widgets = node.get("widgets_values", [])
|
||||
return (widgets[0] if widgets else "").lower()
|
||||
val = widgets[0] if widgets else ""
|
||||
return val.lower() if isinstance(val, str) else ""
|
||||
|
||||
|
||||
def _model_name_from_api_node(node):
|
||||
|
||||
@@ -42,8 +42,23 @@ class WorkflowService:
|
||||
"""Validate filename has no path traversal."""
|
||||
if not fname or "/" in fname or "\\" in fname:
|
||||
return False
|
||||
if fname in (".", "..") or "\x00" in fname:
|
||||
return False
|
||||
return True
|
||||
|
||||
def _safe_path(self, filename):
|
||||
"""Resolve path and ensure it stays within workflows_dir.
|
||||
|
||||
Raises ValueError if path traversal is detected.
|
||||
"""
|
||||
if not self._validate_filename(filename):
|
||||
raise ValueError(f"Invalid filename: {filename}")
|
||||
resolved = (self.workflows_dir / filename).resolve()
|
||||
workflows_resolved = self.workflows_dir.resolve()
|
||||
if not str(resolved).startswith(str(workflows_resolved) + os.sep) and resolved != workflows_resolved:
|
||||
raise ValueError(f"Path traversal detected: {filename}")
|
||||
return resolved
|
||||
|
||||
def _now_iso(self):
|
||||
return datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
|
||||
|
||||
@@ -106,7 +121,7 @@ class WorkflowService:
|
||||
|
||||
def get_raw(self, filename):
|
||||
"""Get raw workflow JSON content."""
|
||||
fpath = self.workflows_dir / filename
|
||||
fpath = self._safe_path(filename)
|
||||
if not fpath.is_file():
|
||||
return None
|
||||
with open(fpath, "r", encoding="utf-8") as f:
|
||||
@@ -132,10 +147,16 @@ class WorkflowService:
|
||||
ext = os.path.splitext(original_name)[1].lower()
|
||||
base = os.path.splitext(original_name)[0]
|
||||
|
||||
if not self._validate_filename(original_name):
|
||||
results.append(
|
||||
{"name": original_name, "status": "error", "message": "Invalid filename"}
|
||||
)
|
||||
continue
|
||||
|
||||
if ext == ".json":
|
||||
try:
|
||||
wf_data = json.loads(file_data.decode("utf-8"))
|
||||
out_path = self.workflows_dir / original_name
|
||||
out_path = self._safe_path(original_name)
|
||||
with open(out_path, "w", encoding="utf-8") as f:
|
||||
json.dump(wf_data, f, ensure_ascii=False, indent=2)
|
||||
results.append({"name": original_name, "status": "success"})
|
||||
@@ -158,13 +179,13 @@ class WorkflowService:
|
||||
try:
|
||||
# Save PNG as thumbnail
|
||||
with open(
|
||||
self.workflows_dir / original_name, "wb"
|
||||
self._safe_path(original_name), "wb"
|
||||
) as f:
|
||||
f.write(file_data)
|
||||
# Save extracted workflow as JSON
|
||||
json_name = base + ".json"
|
||||
with open(
|
||||
self.workflows_dir / json_name, "w", encoding="utf-8"
|
||||
self._safe_path(json_name), "w", encoding="utf-8"
|
||||
) as f:
|
||||
json.dump(wf_data, f, ensure_ascii=False, indent=2)
|
||||
results.append({"name": json_name, "status": "success"})
|
||||
@@ -190,8 +211,8 @@ class WorkflowService:
|
||||
def rename(self, old_name, new_stem):
|
||||
"""Rename workflow and its associated thumbnail."""
|
||||
new_name = new_stem + ".json"
|
||||
old_json = self.workflows_dir / old_name
|
||||
new_json = self.workflows_dir / new_name
|
||||
old_json = self._safe_path(old_name)
|
||||
new_json = self._safe_path(new_name)
|
||||
|
||||
if not old_json.is_file():
|
||||
return {"error": "file not found"}, 404
|
||||
@@ -203,8 +224,8 @@ class WorkflowService:
|
||||
# Rename associated thumbnail
|
||||
old_stem = old_name[:-5] if old_name.endswith(".json") else old_name
|
||||
for ext in (".png", ".webp"):
|
||||
old_thumb = self.workflows_dir / (old_stem + ext)
|
||||
new_thumb = self.workflows_dir / (new_stem + ext)
|
||||
old_thumb = self._safe_path(old_stem + ext)
|
||||
new_thumb = self._safe_path(new_stem + ext)
|
||||
if old_thumb.is_file():
|
||||
os.rename(old_thumb, new_thumb)
|
||||
|
||||
@@ -218,13 +239,13 @@ class WorkflowService:
|
||||
|
||||
def delete(self, filename):
|
||||
"""Delete workflow JSON and associated thumbnail."""
|
||||
json_path = self.workflows_dir / filename
|
||||
json_path = self._safe_path(filename)
|
||||
if json_path.is_file():
|
||||
os.remove(json_path)
|
||||
|
||||
base = filename[:-5] if filename.endswith(".json") else filename
|
||||
for ext in (".png", ".webp"):
|
||||
thumb_path = self.workflows_dir / (base + ext)
|
||||
thumb_path = self._safe_path(base + ext)
|
||||
if thumb_path.is_file():
|
||||
os.remove(thumb_path)
|
||||
|
||||
@@ -235,7 +256,7 @@ class WorkflowService:
|
||||
|
||||
def analyze(self, filename):
|
||||
"""Re-analyze a workflow and save results to metadata."""
|
||||
fpath = self.workflows_dir / filename
|
||||
fpath = self._safe_path(filename)
|
||||
if not fpath.is_file():
|
||||
return None
|
||||
|
||||
@@ -280,6 +301,7 @@ class WorkflowService:
|
||||
|
||||
def change_thumbnail(self, filename, image_data, original_image_name):
|
||||
"""Change workflow thumbnail image."""
|
||||
self._safe_path(filename) # validate filename
|
||||
orig_name_lower = original_image_name.lower()
|
||||
if orig_name_lower.endswith(".webp"):
|
||||
new_ext = ".webp"
|
||||
@@ -292,15 +314,15 @@ class WorkflowService:
|
||||
|
||||
# Backup existing thumbnails
|
||||
for ext in (".png", ".webp", ".jpg", ".jpeg"):
|
||||
old_thumb = self.workflows_dir / (stem + ext)
|
||||
old_thumb = self._safe_path(stem + ext)
|
||||
if old_thumb.is_file():
|
||||
backup = self.workflows_dir / ("old_" + stem + ext)
|
||||
backup = self._safe_path("old_" + stem + ext)
|
||||
if backup.is_file():
|
||||
os.remove(backup)
|
||||
os.rename(old_thumb, backup)
|
||||
|
||||
# Save new thumbnail
|
||||
new_thumb_path = self.workflows_dir / (stem + new_ext)
|
||||
new_thumb_path = self._safe_path(stem + new_ext)
|
||||
with open(new_thumb_path, "wb") as f:
|
||||
f.write(image_data)
|
||||
|
||||
|
||||
@@ -61,11 +61,12 @@ class WorkflowStudio:
|
||||
app.router.add_get("/wfm", serve_index_page)
|
||||
|
||||
# API routes
|
||||
from .routes import workflow_routes, settings_routes, ollama_routes, eagle_routes
|
||||
from .routes import workflow_routes, settings_routes, ollama_routes, eagle_routes, nodes_routes
|
||||
|
||||
workflow_routes.setup_routes(app)
|
||||
settings_routes.setup_routes(app)
|
||||
ollama_routes.setup_routes(app)
|
||||
eagle_routes.setup_routes(app)
|
||||
nodes_routes.setup_routes(app)
|
||||
|
||||
logger.info("Workflow Studio: Routes registered successfully")
|
||||
|
||||
@@ -1018,6 +1018,11 @@ body {
|
||||
color: var(--wfm-primary);
|
||||
}
|
||||
|
||||
.wfm-format-badge--app {
|
||||
background: rgba(255, 165, 0, 0.15);
|
||||
color: #ff9800;
|
||||
}
|
||||
|
||||
.wfm-json-content {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
@@ -1733,3 +1738,717 @@ body {
|
||||
font-size: 13px;
|
||||
color: var(--wfm-text-secondary);
|
||||
}
|
||||
|
||||
/* ============================================
|
||||
Help & Support Tab
|
||||
============================================ */
|
||||
|
||||
.wfm-help-container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 24px 20px;
|
||||
overflow-y: auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.wfm-help-section {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.wfm-help-section-title {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: var(--wfm-text);
|
||||
margin-bottom: 16px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 2px solid var(--wfm-primary);
|
||||
}
|
||||
|
||||
.wfm-help-card {
|
||||
background: var(--wfm-surface);
|
||||
border: 1px solid var(--wfm-border);
|
||||
border-radius: var(--wfm-radius);
|
||||
padding: 16px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.wfm-help-card h3 {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--wfm-primary);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.wfm-help-card ul {
|
||||
margin: 0;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.wfm-help-card li {
|
||||
font-size: 13px;
|
||||
color: var(--wfm-text-secondary);
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.wfm-help-support-card {
|
||||
text-align: center;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.wfm-help-support-card > p {
|
||||
font-size: 14px;
|
||||
color: var(--wfm-text-secondary);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.wfm-help-links {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.wfm-help-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 16px 24px;
|
||||
border-radius: var(--wfm-radius);
|
||||
text-decoration: none;
|
||||
transition: all 0.2s ease;
|
||||
min-width: 260px;
|
||||
}
|
||||
|
||||
.wfm-help-link-github {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border: 1px solid var(--wfm-border);
|
||||
color: var(--wfm-text);
|
||||
}
|
||||
|
||||
.wfm-help-link-github:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-color: var(--wfm-text-secondary);
|
||||
}
|
||||
|
||||
.wfm-help-link-kofi {
|
||||
background: rgba(255, 95, 95, 0.08);
|
||||
border: 1px solid rgba(255, 95, 95, 0.3);
|
||||
color: var(--wfm-text);
|
||||
}
|
||||
|
||||
.wfm-help-link-kofi:hover {
|
||||
background: rgba(255, 95, 95, 0.15);
|
||||
border-color: rgba(255, 95, 95, 0.5);
|
||||
}
|
||||
|
||||
.wfm-help-link-title {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.wfm-help-link-desc {
|
||||
font-size: 12px;
|
||||
color: var(--wfm-text-secondary);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.wfm-help-thanks {
|
||||
font-size: 13px;
|
||||
color: var(--wfm-text-secondary);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* ============================================
|
||||
Theme Definitions
|
||||
============================================ */
|
||||
|
||||
/* --- 1. Pop & Vibrant --- */
|
||||
[data-theme="pop-vibrant"] {
|
||||
--wfm-bg: #F8F9FA;
|
||||
--wfm-bg-secondary: #FFFFFF;
|
||||
--wfm-bg-tertiary: #EEF0F2;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #F0F4FF;
|
||||
--wfm-border: #E0E0E0;
|
||||
--wfm-text: #2D2D2D;
|
||||
--wfm-text-secondary: #666666;
|
||||
--wfm-primary: #FF6B6B;
|
||||
--wfm-primary-hover: #FF5252;
|
||||
--wfm-danger: #FF4757;
|
||||
--wfm-success: #2ED573;
|
||||
--wfm-warning: #FFA502;
|
||||
--wfm-accent: #00D2D3;
|
||||
--wfm-radius: 16px;
|
||||
--wfm-radius-sm: 8px;
|
||||
--wfm-shadow: 0 4px 16px rgba(255, 107, 107, 0.15);
|
||||
}
|
||||
[data-theme="pop-vibrant"] body {
|
||||
font-family: 'Zen Maru Gothic', 'Rounded Mplus 1c', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
|
||||
/* --- 2. Light Minimalist --- */
|
||||
[data-theme="light-minimalist"] {
|
||||
--wfm-bg: #FFFFFF;
|
||||
--wfm-bg-secondary: #F5F5F5;
|
||||
--wfm-bg-tertiary: #FAFAFA;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #F0F4FF;
|
||||
--wfm-border: #EEEEEE;
|
||||
--wfm-text: #333333;
|
||||
--wfm-text-secondary: #888888;
|
||||
--wfm-primary: #4A9EFF;
|
||||
--wfm-primary-hover: #3A8EEF;
|
||||
--wfm-danger: #EF4444;
|
||||
--wfm-success: #22C55E;
|
||||
--wfm-warning: #F59E0B;
|
||||
--wfm-accent: #6366F1;
|
||||
--wfm-radius: 8px;
|
||||
--wfm-radius-sm: 4px;
|
||||
--wfm-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
[data-theme="light-minimalist"] body {
|
||||
font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
}
|
||||
|
||||
/* --- 3. Cyberpunk / Hacker --- */
|
||||
[data-theme="cyberpunk"] {
|
||||
--wfm-bg: #000000;
|
||||
--wfm-bg-secondary: #0A0A0A;
|
||||
--wfm-bg-tertiary: #111111;
|
||||
--wfm-surface: #0D0D0D;
|
||||
--wfm-surface-hover: #1A1A1A;
|
||||
--wfm-border: rgba(0, 255, 65, 0.19);
|
||||
--wfm-text: #00FF41;
|
||||
--wfm-text-secondary: #00CC33;
|
||||
--wfm-primary: #FF00FF;
|
||||
--wfm-primary-hover: #CC00CC;
|
||||
--wfm-danger: #FF073A;
|
||||
--wfm-success: #00FF41;
|
||||
--wfm-warning: #FFD300;
|
||||
--wfm-accent: #00FFFF;
|
||||
--wfm-radius: 0px;
|
||||
--wfm-radius-sm: 0px;
|
||||
--wfm-shadow: 0 0 12px rgba(0, 255, 65, 0.3);
|
||||
}
|
||||
[data-theme="cyberpunk"] body {
|
||||
font-family: 'Space Mono', 'Fira Code', 'Courier New', monospace;
|
||||
}
|
||||
[data-theme="cyberpunk"] .wfm-card,
|
||||
[data-theme="cyberpunk"] .wfm-side-panel,
|
||||
[data-theme="cyberpunk"] .wfm-header {
|
||||
border: 1px solid rgba(0, 255, 65, 0.3);
|
||||
box-shadow: 0 0 8px rgba(0, 255, 65, 0.15), inset 0 0 8px rgba(0, 255, 65, 0.05);
|
||||
}
|
||||
[data-theme="cyberpunk"] .wfm-btn-primary {
|
||||
box-shadow: 0 0 10px rgba(255, 0, 255, 0.4);
|
||||
}
|
||||
[data-theme="cyberpunk"] .json-key { color: #00FFFF; }
|
||||
[data-theme="cyberpunk"] .json-string { color: #00FF41; }
|
||||
[data-theme="cyberpunk"] .json-number { color: #FFD300; }
|
||||
|
||||
/* --- 4. Glassmorphism --- */
|
||||
[data-theme="glassmorphism"] {
|
||||
--wfm-bg: #1A0533;
|
||||
--wfm-bg-secondary: rgba(255, 255, 255, 0.08);
|
||||
--wfm-bg-tertiary: rgba(255, 255, 255, 0.04);
|
||||
--wfm-surface: rgba(255, 255, 255, 0.10);
|
||||
--wfm-surface-hover: rgba(255, 255, 255, 0.16);
|
||||
--wfm-border: rgba(255, 255, 255, 0.18);
|
||||
--wfm-text: #F0F0F0;
|
||||
--wfm-text-secondary: #C0C0D0;
|
||||
--wfm-primary: #7B68EE;
|
||||
--wfm-primary-hover: #6A5ACD;
|
||||
--wfm-danger: #FF6B6B;
|
||||
--wfm-success: #69DB7C;
|
||||
--wfm-warning: #FFD43B;
|
||||
--wfm-accent: #DA77F2;
|
||||
--wfm-radius: 12px;
|
||||
--wfm-radius-sm: 8px;
|
||||
--wfm-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
[data-theme="glassmorphism"] body {
|
||||
font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
|
||||
background: linear-gradient(135deg, #1A0533 0%, #0D1B3E 25%, #1A0533 50%, #2D1054 75%, #0D1B3E 100%);
|
||||
}
|
||||
[data-theme="glassmorphism"] .wfm-card,
|
||||
[data-theme="glassmorphism"] .wfm-side-panel,
|
||||
[data-theme="glassmorphism"] .wfm-header,
|
||||
[data-theme="glassmorphism"] .wfm-toolbar {
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
backdrop-filter: blur(12px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.18);
|
||||
}
|
||||
|
||||
/* --- 5. Neumorphism --- */
|
||||
[data-theme="neumorphism"] {
|
||||
--wfm-bg: #D1D9E6;
|
||||
--wfm-bg-secondary: #D1D9E6;
|
||||
--wfm-bg-tertiary: #C8D0DD;
|
||||
--wfm-surface: #D1D9E6;
|
||||
--wfm-surface-hover: #D8E0ED;
|
||||
--wfm-border: transparent;
|
||||
--wfm-text: #4A5568;
|
||||
--wfm-text-secondary: #718096;
|
||||
--wfm-primary: #6C8EBF;
|
||||
--wfm-primary-hover: #5A7CAD;
|
||||
--wfm-danger: #E57373;
|
||||
--wfm-success: #81C784;
|
||||
--wfm-warning: #FFB74D;
|
||||
--wfm-accent: #7986CB;
|
||||
--wfm-radius: 12px;
|
||||
--wfm-radius-sm: 8px;
|
||||
--wfm-shadow: 6px 6px 12px #B8C0CC, -6px -6px 12px #EAF2FF;
|
||||
}
|
||||
[data-theme="neumorphism"] body {
|
||||
font-family: 'Nunito', 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
[data-theme="neumorphism"] .wfm-card {
|
||||
border: none;
|
||||
box-shadow: 6px 6px 12px #B8C0CC, -6px -6px 12px #EAF2FF;
|
||||
}
|
||||
[data-theme="neumorphism"] .wfm-btn-primary {
|
||||
box-shadow: inset 4px 4px 8px #B8C0CC, inset -4px -4px 8px #EAF2FF;
|
||||
}
|
||||
|
||||
/* --- 6. Retro 8-bit / Pixel --- */
|
||||
[data-theme="retro-pixel"] {
|
||||
--wfm-bg: #2C2C34;
|
||||
--wfm-bg-secondary: #3A3A44;
|
||||
--wfm-bg-tertiary: #24242C;
|
||||
--wfm-surface: #3A3A44;
|
||||
--wfm-surface-hover: #4A4A54;
|
||||
--wfm-border: #000000;
|
||||
--wfm-text: #F0F0E0;
|
||||
--wfm-text-secondary: #B0B0A0;
|
||||
--wfm-primary: #5B8FD4;
|
||||
--wfm-primary-hover: #4A7EC3;
|
||||
--wfm-danger: #D94848;
|
||||
--wfm-success: #48A848;
|
||||
--wfm-warning: #D4A017;
|
||||
--wfm-accent: #D45BD4;
|
||||
--wfm-radius: 0px;
|
||||
--wfm-radius-sm: 0px;
|
||||
--wfm-shadow: 4px 4px 0px #000000;
|
||||
}
|
||||
[data-theme="retro-pixel"] body {
|
||||
font-family: 'DotGothic16', 'Press Start 2P', 'Courier New', monospace;
|
||||
}
|
||||
[data-theme="retro-pixel"] .wfm-card,
|
||||
[data-theme="retro-pixel"] .wfm-side-panel,
|
||||
[data-theme="retro-pixel"] .wfm-header,
|
||||
[data-theme="retro-pixel"] .wfm-btn {
|
||||
border: 3px solid #000000;
|
||||
}
|
||||
|
||||
/* --- 7. Pastel Dream --- */
|
||||
[data-theme="pastel-dream"] {
|
||||
--wfm-bg: #F0E6FF;
|
||||
--wfm-bg-secondary: #E8F5E9;
|
||||
--wfm-bg-tertiary: #F3E5F5;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #FFF3E0;
|
||||
--wfm-border: #E1BEE7;
|
||||
--wfm-text: #5D4E75;
|
||||
--wfm-text-secondary: #8E7CA8;
|
||||
--wfm-primary: #B39DDB;
|
||||
--wfm-primary-hover: #9575CD;
|
||||
--wfm-danger: #F48FB1;
|
||||
--wfm-success: #A5D6A7;
|
||||
--wfm-warning: #FFE082;
|
||||
--wfm-accent: #80DEEA;
|
||||
--wfm-radius: 20px;
|
||||
--wfm-radius-sm: 12px;
|
||||
--wfm-shadow: 0 4px 16px rgba(179, 157, 219, 0.2);
|
||||
}
|
||||
[data-theme="pastel-dream"] body {
|
||||
font-family: 'M PLUS Rounded 1c', 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
|
||||
/* --- 8. Brutalism --- */
|
||||
[data-theme="brutalism"] {
|
||||
--wfm-bg: #FFFFFF;
|
||||
--wfm-bg-secondary: #FFFFFF;
|
||||
--wfm-bg-tertiary: #F0F0F0;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #CCFF00;
|
||||
--wfm-border: #000000;
|
||||
--wfm-text: #000000;
|
||||
--wfm-text-secondary: #333333;
|
||||
--wfm-primary: #CCFF00;
|
||||
--wfm-primary-hover: #BBEE00;
|
||||
--wfm-danger: #FF0000;
|
||||
--wfm-success: #00FF00;
|
||||
--wfm-warning: #FFFF00;
|
||||
--wfm-accent: #CCFF00;
|
||||
--wfm-radius: 0px;
|
||||
--wfm-radius-sm: 0px;
|
||||
--wfm-shadow: 6px 6px 0px #000000;
|
||||
}
|
||||
[data-theme="brutalism"] body {
|
||||
font-family: 'Arial Black', 'Impact', 'Helvetica Neue', sans-serif;
|
||||
}
|
||||
[data-theme="brutalism"] .wfm-card,
|
||||
[data-theme="brutalism"] .wfm-side-panel,
|
||||
[data-theme="brutalism"] .wfm-header,
|
||||
[data-theme="brutalism"] .wfm-btn {
|
||||
border: 3px solid #000000;
|
||||
}
|
||||
[data-theme="brutalism"] .wfm-btn-primary {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* --- 9. Earthy / Nature --- */
|
||||
[data-theme="earthy"] {
|
||||
--wfm-bg: #F5E6D3;
|
||||
--wfm-bg-secondary: #EDE0D4;
|
||||
--wfm-bg-tertiary: #E8D5C0;
|
||||
--wfm-surface: #FFF8F0;
|
||||
--wfm-surface-hover: #F5EDE4;
|
||||
--wfm-border: #D4B896;
|
||||
--wfm-text: #3E2723;
|
||||
--wfm-text-secondary: #6D4C41;
|
||||
--wfm-primary: #8D6E63;
|
||||
--wfm-primary-hover: #795548;
|
||||
--wfm-danger: #C0392B;
|
||||
--wfm-success: #6B8E23;
|
||||
--wfm-warning: #D4A017;
|
||||
--wfm-accent: #BF6830;
|
||||
--wfm-radius: 8px;
|
||||
--wfm-radius-sm: 4px;
|
||||
--wfm-shadow: 0 2px 8px rgba(62, 39, 35, 0.12);
|
||||
}
|
||||
[data-theme="earthy"] body {
|
||||
font-family: 'Noto Sans JP', 'Noto Serif JP', Georgia, serif;
|
||||
}
|
||||
|
||||
/* --- 10. Material UI --- */
|
||||
[data-theme="material"] {
|
||||
--wfm-bg: #FAFAFA;
|
||||
--wfm-bg-secondary: #FFFFFF;
|
||||
--wfm-bg-tertiary: #F5F5F5;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #E8EAF6;
|
||||
--wfm-border: #E0E0E0;
|
||||
--wfm-text: #212121;
|
||||
--wfm-text-secondary: #757575;
|
||||
--wfm-primary: #3F51B5;
|
||||
--wfm-primary-hover: #303F9F;
|
||||
--wfm-danger: #F44336;
|
||||
--wfm-success: #4CAF50;
|
||||
--wfm-warning: #FF9800;
|
||||
--wfm-accent: #FF4081;
|
||||
--wfm-radius: 4px;
|
||||
--wfm-radius-sm: 2px;
|
||||
--wfm-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
|
||||
}
|
||||
[data-theme="material"] body {
|
||||
font-family: 'Roboto', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
|
||||
/* --- 11. Monotone + One Accent --- */
|
||||
[data-theme="monotone-accent"] {
|
||||
--wfm-bg: #F7F7F7;
|
||||
--wfm-bg-secondary: #FFFFFF;
|
||||
--wfm-bg-tertiary: #EBEBEB;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #F0F0F0;
|
||||
--wfm-border: #D0D0D0;
|
||||
--wfm-text: #1A1A1A;
|
||||
--wfm-text-secondary: #808080;
|
||||
--wfm-primary: #FF6B35;
|
||||
--wfm-primary-hover: #E85D2A;
|
||||
--wfm-danger: #CC0000;
|
||||
--wfm-success: #555555;
|
||||
--wfm-warning: #888888;
|
||||
--wfm-accent: #FF6B35;
|
||||
--wfm-radius: 6px;
|
||||
--wfm-radius-sm: 3px;
|
||||
--wfm-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
[data-theme="monotone-accent"] body {
|
||||
font-family: 'Helvetica Neue', 'Arial', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
|
||||
/* --- 12. Corporate Trust --- */
|
||||
[data-theme="corporate"] {
|
||||
--wfm-bg: #F0F4F8;
|
||||
--wfm-bg-secondary: #FFFFFF;
|
||||
--wfm-bg-tertiary: #E2E8F0;
|
||||
--wfm-surface: #FFFFFF;
|
||||
--wfm-surface-hover: #EBF0F6;
|
||||
--wfm-border: #CBD5E1;
|
||||
--wfm-text: #1E293B;
|
||||
--wfm-text-secondary: #64748B;
|
||||
--wfm-primary: #2563EB;
|
||||
--wfm-primary-hover: #1D4ED8;
|
||||
--wfm-danger: #DC2626;
|
||||
--wfm-success: #16A34A;
|
||||
--wfm-warning: #D97706;
|
||||
--wfm-accent: #7C3AED;
|
||||
--wfm-radius: 4px;
|
||||
--wfm-radius-sm: 2px;
|
||||
--wfm-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
[data-theme="corporate"] body {
|
||||
font-family: 'Noto Sans JP', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
|
||||
/* --- Theme Selector Preview Swatches --- */
|
||||
.wfm-theme-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
.wfm-theme-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
border: 2px solid var(--wfm-border);
|
||||
border-radius: var(--wfm-radius);
|
||||
background: var(--wfm-surface);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
.wfm-theme-card:hover {
|
||||
border-color: var(--wfm-primary);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.wfm-theme-card.active {
|
||||
border-color: var(--wfm-primary);
|
||||
box-shadow: 0 0 0 2px var(--wfm-primary);
|
||||
}
|
||||
.wfm-theme-swatch {
|
||||
width: 100%;
|
||||
height: 48px;
|
||||
border-radius: var(--wfm-radius-sm);
|
||||
margin-bottom: 6px;
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.wfm-theme-swatch > span {
|
||||
flex: 1;
|
||||
display: block;
|
||||
}
|
||||
.wfm-theme-card-label {
|
||||
font-size: 11px;
|
||||
text-align: center;
|
||||
color: var(--wfm-text);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* ============================================
|
||||
Nodes Tab
|
||||
============================================ */
|
||||
|
||||
.wfm-nodes-subview-nav {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.wfm-nodes-subview-btn {
|
||||
padding: 6px 16px;
|
||||
border: 1px solid var(--wfm-border);
|
||||
background: var(--wfm-bg-secondary);
|
||||
cursor: pointer;
|
||||
border-radius: var(--wfm-radius-sm);
|
||||
font-size: 13px;
|
||||
color: var(--wfm-text);
|
||||
transition: background 0.15s, color 0.15s;
|
||||
}
|
||||
|
||||
.wfm-nodes-subview-btn:hover {
|
||||
background: var(--wfm-surface-hover);
|
||||
}
|
||||
|
||||
.wfm-nodes-subview-btn.active {
|
||||
background: var(--wfm-accent);
|
||||
color: #fff;
|
||||
border-color: var(--wfm-accent);
|
||||
}
|
||||
|
||||
.wfm-nodes-count {
|
||||
font-size: 12px;
|
||||
color: var(--wfm-text-secondary);
|
||||
white-space: nowrap;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.wfm-toolbar-select {
|
||||
max-width: 180px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* Node card */
|
||||
.wfm-node-card {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.wfm-node-card .wfm-card-body {
|
||||
min-height: 0;
|
||||
padding: 8px 10px;
|
||||
}
|
||||
|
||||
.wfm-node-card .wfm-card-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 4px;
|
||||
padding-right: 24px;
|
||||
}
|
||||
|
||||
.wfm-node-card .wfm-fav-btn {
|
||||
font-size: 18px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.wfm-node-card:hover .wfm-fav-btn {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* Node grid: wider cards for readability */
|
||||
#wfm-nodes-grid.wfm-view-card {
|
||||
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* Node table row selection highlight */
|
||||
.wfm-nodes-table-row {
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.wfm-nodes-table-row:hover {
|
||||
background: var(--wfm-surface);
|
||||
}
|
||||
|
||||
.wfm-nodes-table-row.wfm-card-selected {
|
||||
background: color-mix(in srgb, var(--wfm-primary) 15%, var(--wfm-bg));
|
||||
outline: 1px solid var(--wfm-primary);
|
||||
}
|
||||
|
||||
.wfm-nodes-table-row .wfm-fav-btn {
|
||||
position: static;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.wfm-node-card-io {
|
||||
font-size: 11px;
|
||||
color: var(--wfm-text-secondary);
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
/* Pagination */
|
||||
.wfm-pagination {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
padding: 10px;
|
||||
border-top: 1px solid var(--wfm-border);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.wfm-pagination-info {
|
||||
font-size: 12px;
|
||||
color: var(--wfm-text-secondary);
|
||||
min-width: 80px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.wfm-card-tags {
|
||||
margin-top: 4px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
/* Category badge */
|
||||
.wfm-badge-category {
|
||||
background: var(--wfm-bg-tertiary);
|
||||
color: var(--wfm-text-secondary);
|
||||
border: 1px solid var(--wfm-border);
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
/* Node I/O spec table */
|
||||
.wfm-node-io-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.wfm-node-io-table th,
|
||||
.wfm-node-io-table td {
|
||||
padding: 4px 8px;
|
||||
border-bottom: 1px solid var(--wfm-border);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.wfm-node-io-table th {
|
||||
color: var(--wfm-text-secondary);
|
||||
font-weight: 600;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.wfm-node-io-table code {
|
||||
background: var(--wfm-bg-tertiary);
|
||||
padding: 1px 4px;
|
||||
border-radius: 3px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.wfm-node-input-required td:first-child {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.wfm-node-input-optional {
|
||||
color: var(--wfm-text-secondary);
|
||||
}
|
||||
|
||||
/* Node detail section in side panel */
|
||||
.wfm-node-detail-section {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.wfm-node-detail-label {
|
||||
font-size: 11px;
|
||||
color: var(--wfm-text-secondary);
|
||||
margin-bottom: 2px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.wfm-node-detail-value {
|
||||
color: var(--wfm-text);
|
||||
}
|
||||
|
||||
/* Node group items */
|
||||
.wfm-node-group-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 4px 0;
|
||||
border-bottom: 1px solid var(--wfm-border);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* Node set cards */
|
||||
.wfm-node-set-card {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.wfm-node-set-actions {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
padding: 8px 12px 12px;
|
||||
}
|
||||
|
||||
/* Side panel content for nodes */
|
||||
.wfm-nodes-side-content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
+68
-2
@@ -90,7 +90,7 @@ function initTabs() {
|
||||
|
||||
function applyI18nToHtml() {
|
||||
// Tab labels
|
||||
const tabMap = { workflow: "tabWorkflow", generate: "tabGenerate", prompt: "tabPrompt", settings: "tabSettings" };
|
||||
const tabMap = { workflow: "tabWorkflow", nodes: "tabNodes", generate: "tabGenerate", prompt: "tabPrompt", settings: "tabSettings", help: "tabHelp" };
|
||||
document.querySelectorAll(".wfm-tab").forEach((tab) => {
|
||||
const key = tabMap[tab.dataset.tab];
|
||||
if (key) tab.textContent = t(key);
|
||||
@@ -142,6 +142,27 @@ function applyI18nToHtml() {
|
||||
const copyBtn = document.getElementById("wfm-json-copy-btn");
|
||||
if (copyBtn) copyBtn.textContent = t("copy");
|
||||
|
||||
// Nodes tab
|
||||
const nodesSubBtns = document.querySelectorAll(".wfm-nodes-subview-btn");
|
||||
nodesSubBtns.forEach(btn => {
|
||||
if (btn.dataset.subview === "browser") btn.textContent = t("nodesAllNodes");
|
||||
if (btn.dataset.subview === "sets") btn.textContent = t("nodesNodeSets");
|
||||
});
|
||||
const nodesSearch = document.getElementById("wfm-nodes-search");
|
||||
if (nodesSearch) nodesSearch.placeholder = t("nodesSearchPlaceholder");
|
||||
const nodesRefreshBtn = document.getElementById("wfm-nodes-refresh-btn");
|
||||
if (nodesRefreshBtn) nodesRefreshBtn.textContent = t("nodesRefresh");
|
||||
const nodeSetCreateBtn = document.getElementById("wfm-node-set-create-btn");
|
||||
if (nodeSetCreateBtn) nodeSetCreateBtn.textContent = t("nodesCreateSet");
|
||||
const nodesSideTabBtns = document.querySelectorAll(".wfm-nodes-side-tab-btn");
|
||||
nodesSideTabBtns.forEach(btn => {
|
||||
if (btn.dataset.sideTab === "details") btn.textContent = t("nodesDetails");
|
||||
if (btn.dataset.sideTab === "io") btn.textContent = t("nodesIoSpec");
|
||||
if (btn.dataset.sideTab === "nodegroup") btn.textContent = t("nodesGroups");
|
||||
});
|
||||
const nodesPlaceholder = document.getElementById("wfm-nodes-placeholder");
|
||||
if (nodesPlaceholder) nodesPlaceholder.textContent = t("nodesClickToLoad");
|
||||
|
||||
// Prompt tab
|
||||
const assistantHeader = document.querySelector(".wfm-prompt-split-left .wfm-prompt-split-header");
|
||||
if (assistantHeader) assistantHeader.textContent = t("assistantSubtab");
|
||||
@@ -167,6 +188,10 @@ function applyI18nToHtml() {
|
||||
if (presetDeleteBtn) presetDeleteBtn.textContent = t("deletePreset");
|
||||
const presetSaveBtn = document.getElementById("wfm-preset-save-btn");
|
||||
if (presetSaveBtn) presetSaveBtn.textContent = t("savePreset");
|
||||
const presetCopyPosBtn = document.getElementById("wfm-preset-copy-pos-btn");
|
||||
if (presetCopyPosBtn) presetCopyPosBtn.textContent = t("copyPositivePrompt");
|
||||
const presetCopyNegBtn = document.getElementById("wfm-preset-copy-neg-btn");
|
||||
if (presetCopyNegBtn) presetCopyNegBtn.textContent = t("copyNegativePrompt");
|
||||
|
||||
// Group panel labels
|
||||
const propTitle = document.querySelector("#wfm-side-tab-group .wfm-group-section-title");
|
||||
@@ -193,6 +218,42 @@ function applyI18nToHtml() {
|
||||
|
||||
const removeBtn = document.getElementById("wfm-remove-group-btn");
|
||||
if (removeBtn) removeBtn.textContent = t("removeFromGroup");
|
||||
|
||||
// Help & Support tab
|
||||
const helpManualTitle = document.getElementById("wfm-help-manual-title");
|
||||
if (helpManualTitle) helpManualTitle.textContent = t("helpManualTitle");
|
||||
|
||||
const helpIdMap = {
|
||||
"wfm-help-about-title": "helpAboutTitle",
|
||||
"wfm-help-about-desc": "helpAboutDesc",
|
||||
"wfm-help-about-1": "helpAbout1", "wfm-help-about-2": "helpAbout2",
|
||||
"wfm-help-wf-1": "helpWf1", "wfm-help-wf-2": "helpWf2", "wfm-help-wf-3": "helpWf3",
|
||||
"wfm-help-wf-4": "helpWf4", "wfm-help-wf-5": "helpWf5", "wfm-help-wf-6": "helpWf6",
|
||||
"wfm-help-wf-7": "helpWf7", "wfm-help-wf-8": "helpWf8",
|
||||
"wfm-help-gen-1": "helpGen1", "wfm-help-gen-2": "helpGen2",
|
||||
"wfm-help-gen-3": "helpGen3", "wfm-help-gen-4": "helpGen4",
|
||||
"wfm-help-gen-5": "helpGen5", "wfm-help-gen-6": "helpGen6", "wfm-help-gen-7": "helpGen7",
|
||||
"wfm-help-prompt-1": "helpPrompt1", "wfm-help-prompt-2": "helpPrompt2",
|
||||
"wfm-help-prompt-3": "helpPrompt3", "wfm-help-prompt-4": "helpPrompt4",
|
||||
"wfm-help-settings-1": "helpSettings1", "wfm-help-settings-2": "helpSettings2",
|
||||
"wfm-help-settings-3": "helpSettings3", "wfm-help-settings-4": "helpSettings4",
|
||||
"wfm-help-settings-5": "helpSettings5", "wfm-help-settings-6": "helpSettings6",
|
||||
"wfm-help-shortcuts-title": "helpShortcutsTitle",
|
||||
"wfm-help-shortcuts-1": "helpShortcuts1", "wfm-help-shortcuts-2": "helpShortcuts2",
|
||||
"wfm-help-shortcuts-3": "helpShortcuts3", "wfm-help-shortcuts-4": "helpShortcuts4",
|
||||
"wfm-help-trouble-title": "helpTroubleTitle",
|
||||
"wfm-help-trouble-1": "helpTrouble1", "wfm-help-trouble-2": "helpTrouble2",
|
||||
"wfm-help-trouble-3": "helpTrouble3", "wfm-help-trouble-4": "helpTrouble4",
|
||||
"wfm-help-support-title": "helpSupportTitle",
|
||||
"wfm-help-support-desc": "helpSupportDesc",
|
||||
"wfm-help-github-desc": "helpGithubDesc",
|
||||
"wfm-help-kofi-desc": "helpKofiDesc",
|
||||
"wfm-help-thanks": "helpThanks",
|
||||
};
|
||||
for (const [id, key] of Object.entries(helpIdMap)) {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.textContent = t(key);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================
|
||||
@@ -227,9 +288,13 @@ function initModal() {
|
||||
// ============================================
|
||||
|
||||
import { initWorkflowTab } from "./workflow-tab.js";
|
||||
import { initNodesTab } from "./nodes-tab.js";
|
||||
import { initGenerateTab } from "./generate-tab.js";
|
||||
import { initPromptTab } from "./prompt-tab.js";
|
||||
import { initSettingsTab } from "./settings-tab.js";
|
||||
import { initSettingsTab, applyTheme, getSavedTheme } from "./settings-tab.js";
|
||||
|
||||
// Apply saved theme immediately to prevent flash of default theme
|
||||
applyTheme(getSavedTheme());
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
applyI18nToHtml();
|
||||
@@ -237,6 +302,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
initModal();
|
||||
initSettingsTab(); // Settings first (applies saved URL)
|
||||
initWorkflowTab();
|
||||
initNodesTab();
|
||||
initGenerateTab();
|
||||
initPromptTab();
|
||||
|
||||
|
||||
@@ -70,13 +70,19 @@ export const comfyUI = {
|
||||
});
|
||||
},
|
||||
|
||||
// Model fetching
|
||||
// Node info fetching
|
||||
async fetchObjectInfo(nodeClass) {
|
||||
const res = await fetch(`${this.baseUrl}/object_info/${nodeClass}`);
|
||||
if (!res.ok) return null;
|
||||
return await res.json();
|
||||
},
|
||||
|
||||
async fetchAllObjectInfo() {
|
||||
const res = await fetch(`${this.baseUrl}/object_info`);
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
return await res.json();
|
||||
},
|
||||
|
||||
async _fetchModelList(nodeClasses, inputKey) {
|
||||
for (const cls of nodeClasses) {
|
||||
try {
|
||||
|
||||
@@ -250,8 +250,10 @@ function _flattenSubgraphs(workflow) {
|
||||
}
|
||||
|
||||
export const comfyWorkflow = {
|
||||
detectFormat(workflow) {
|
||||
detectFormat(workflow, filename) {
|
||||
if (!workflow || typeof workflow !== "object") return "unknown";
|
||||
// App format: detected by .app.json filename extension
|
||||
if (filename && /\.app\.json$/i.test(filename)) return "app";
|
||||
if (Array.isArray(workflow.nodes) && workflow.links !== undefined) return "ui";
|
||||
// API format: top-level keys are node IDs with class_type
|
||||
const keys = Object.keys(workflow);
|
||||
|
||||
@@ -72,13 +72,16 @@ function updateStatus(connected) {
|
||||
|
||||
export async function loadWorkflowIntoEditor(workflow, filename) {
|
||||
let apiWorkflow = workflow;
|
||||
const format = comfyWorkflow.detectFormat(workflow);
|
||||
const format = comfyWorkflow.detectFormat(workflow, filename);
|
||||
|
||||
if (format === "ui") {
|
||||
if (format === "app") {
|
||||
showToast(t("appFormatNotSupported"), "error");
|
||||
return false;
|
||||
} else if (format === "ui") {
|
||||
apiWorkflow = await comfyWorkflow.convertUiToApi(workflow);
|
||||
} else if (format === "unknown") {
|
||||
showToast("Unknown workflow format", "error");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
comfyUI.currentWorkflow = apiWorkflow;
|
||||
@@ -107,6 +110,7 @@ export async function loadWorkflowIntoEditor(workflow, filename) {
|
||||
if (genBtn) genBtn.disabled = !comfyUI.connected;
|
||||
|
||||
showToast(`Workflow loaded: ${filename || ""}`, "success");
|
||||
return true;
|
||||
}
|
||||
|
||||
// ============================================
|
||||
|
||||
+349
-2
@@ -43,6 +43,8 @@ const LANGUAGES = {
|
||||
// -- Side panel --
|
||||
uiFormat: "UI Format",
|
||||
apiFormat: "API Format",
|
||||
appFormat: "App Format",
|
||||
appFormatNotSupported: "App format workflows cannot be loaded in GenerateUI. Please use 'Open in ComfyUI' instead.",
|
||||
noSelection: "No selection",
|
||||
groupsLabel: "Groups",
|
||||
groupsNone: "none",
|
||||
@@ -145,12 +147,112 @@ const LANGUAGES = {
|
||||
presetName: "Preset Name",
|
||||
positivePrompt: "Positive Prompt",
|
||||
negativePrompt: "Negative Prompt",
|
||||
savePreset: "Save Preset",
|
||||
savePreset: "Save",
|
||||
copyPositivePrompt: "PP Copy",
|
||||
copyNegativePrompt: "NP Copy",
|
||||
copiedToClipboard: "Copied to clipboard",
|
||||
noTextToCopy: "No text to copy",
|
||||
applyPreset: "Apply",
|
||||
deletePreset: "Delete",
|
||||
assistantSubtab: "AI Assistant",
|
||||
presetsSubtab: "Presets",
|
||||
|
||||
// -- Nodes tab --
|
||||
tabNodes: "Nodes",
|
||||
nodesAllNodes: "All Nodes",
|
||||
nodesNodeSets: "Node Sets",
|
||||
nodesSearchPlaceholder: "Search nodes...",
|
||||
nodesAllCategories: "All Categories",
|
||||
nodesAllPackages: "All Packages",
|
||||
nodesAllTags: "All Tags",
|
||||
nodesAllGroups: "All Groups",
|
||||
noNodesFound: "No nodes found",
|
||||
nodesDetails: "Details",
|
||||
nodesIoSpec: "I/O Spec",
|
||||
nodesGroups: "Groups",
|
||||
nodesInputs: "Inputs",
|
||||
nodesOutputs: "Outputs",
|
||||
nodesRequired: "Required",
|
||||
nodesOptional: "Optional",
|
||||
nodesClassName: "Class Name",
|
||||
nodesPackage: "Package",
|
||||
nodesCategory: "Category",
|
||||
nodesDescription: "Description",
|
||||
nodesExperimental: "Experimental",
|
||||
nodesDeprecated: "Deprecated",
|
||||
nodesOutputNode: "Output Node",
|
||||
nodesEditTags: "Tags (comma separated)",
|
||||
nodesCreateSet: "Create Node Set",
|
||||
nodesEditSet: "Edit",
|
||||
nodesSetName: "Set Name",
|
||||
nodesSetDescription: "Description",
|
||||
nodesSetNodes: "Nodes",
|
||||
nodesAddNode: "Add Node",
|
||||
nodesSetLinks: "Links",
|
||||
nodesAddLink: "Add Link",
|
||||
nodesCopyToClipboard: "Copy to Clipboard",
|
||||
nodesCopied: "Node set copied to clipboard",
|
||||
nodesCopyClassName: "Copy class name",
|
||||
nodesCopiedClassName: "Class name copied!",
|
||||
nodesDeleteSet: "Delete",
|
||||
nodesDeleteSetConfirm: "Delete this node set?",
|
||||
nodesSetUpdated: "Node set updated",
|
||||
nodesRefresh: "Refresh",
|
||||
nodesCreateGroup: "Create Group",
|
||||
nodesGroupName: "Group Name",
|
||||
nodesAssignGroup: "Assign to Group",
|
||||
nodesRemoveGroup: "Remove from Group",
|
||||
nodesConnectToComfyUI: "Connect to ComfyUI to load nodes. Check Settings tab.",
|
||||
nodesClickToLoad: "Click to load nodes...",
|
||||
|
||||
// -- Help & Support --
|
||||
tabHelp: "Help",
|
||||
helpManualTitle: "Features",
|
||||
helpAboutTitle: "About",
|
||||
helpAboutDesc: "A centralized control UI for managing ComfyUI workflow JSON files, generating images via API, and assisting with prompt creation.",
|
||||
helpAbout1: "Install via ComfyUI Manager or git clone to custom_nodes",
|
||||
helpAbout2: "Launch from the Workflow Studio button in the ComfyUI toolbar, or open http://127.0.0.1:8188/wfm",
|
||||
helpWf1: "Switch between Thumbnail, Card, and Table view modes",
|
||||
helpWf2: "Search, category filter, favorites filter, and group filter",
|
||||
helpWf3: "Create, rename, delete groups and assign/remove workflows",
|
||||
helpWf4: "Import JSON/PNG files via button or drag & drop",
|
||||
helpWf5: "Side panel: thumbnail, JSON viewer (format badge: UI/API/App), clipboard copy, group management",
|
||||
helpWf6: "Detail modal: rename, favorite, thumbnail change, analysis, category override, tags, memo, AI summary, open in ComfyUI, load in GenerateUI, set as default, delete",
|
||||
helpWf7: "Customize badge colors per category",
|
||||
helpWf8: "Batch re-analysis of all workflow I/O (P: prompt nodes, I: image nodes, output: save nodes)",
|
||||
helpGen1: "Connect/disconnect ComfyUI and check connection status",
|
||||
helpGen2: "Load workflows from Workflow tab (App format .app.json not supported)",
|
||||
helpGen3: "Edit parameters: Prompt, Image (drag & drop), Model (checkpoint/VAE/LoRA/ControlNet with filter), Settings (steps/CFG/sampler/scheduler/resolution), Raw JSON",
|
||||
helpGen4: "Seed control: random, fixed, increment, decrement",
|
||||
helpGen5: "Generate, progress display, and stop",
|
||||
helpGen6: "View results with main image and thumbnail history",
|
||||
helpGen7: "Eagle integration: auto-save generated images to Eagle",
|
||||
helpPrompt1: "AI assistant (Ollama): model selection, chat for prompt consultation, image attachment (vision models)",
|
||||
helpPrompt2: "Apply AI responses to GenerateUI prompts",
|
||||
helpPrompt3: "Translation: JA\u2194EN, ZH\u2194EN",
|
||||
helpPrompt4: "Preset management: create, edit, delete, apply, clipboard copy (PP/NP)",
|
||||
helpSettings1: "UI language and summary language",
|
||||
helpSettings2: "Workflow data folder path",
|
||||
helpSettings3: "ComfyUI connection URL and test",
|
||||
helpSettings4: "Ollama URL, default model, and connection test",
|
||||
helpSettings5: "Default workflow setting",
|
||||
helpSettings6: "Eagle integration URL and auto-save toggle",
|
||||
helpShortcutsTitle: "Keyboard Shortcuts",
|
||||
helpShortcuts1: "Escape: Close modal/panel",
|
||||
helpShortcuts2: "Enter: Confirm rename, send chat",
|
||||
helpShortcuts3: "Shift+Enter: New line in chat",
|
||||
helpShortcuts4: "Double-click: Open detail modal",
|
||||
helpTroubleTitle: "Troubleshooting",
|
||||
helpTrouble1: "Cannot connect to ComfyUI: Check if ComfyUI can generate images, verify URL in Settings, try refreshing or restarting",
|
||||
helpTrouble2: "Cannot connect to Ollama: Use connection test button, check if Ollama is running and models are downloaded",
|
||||
helpTrouble3: "Workflows not showing: Click refresh button, check if loadable in ComfyUI, try restarting browser/ComfyUI",
|
||||
helpTrouble4: "Image generation fails: Check if specified models exist in ComfyUI, verify connection, try restarting",
|
||||
helpSupportTitle: "Support",
|
||||
helpSupportDesc: "If you find this plugin useful, please consider supporting its development!",
|
||||
helpGithubDesc: "Report issues, request features, and contribute",
|
||||
helpKofiDesc: "Buy me a coffee to support development",
|
||||
helpThanks: "Thank you for using Workflow Studio!",
|
||||
|
||||
// -- Settings --
|
||||
workflowsDir: "Workflow Data Folder",
|
||||
workflowsDirLabel: "Folder Path",
|
||||
@@ -191,6 +293,21 @@ const LANGUAGES = {
|
||||
saveSettings: "Save Settings",
|
||||
settingsSaved: "Settings saved",
|
||||
ollamaSaved: "Ollama settings saved",
|
||||
// -- Theme --
|
||||
themeLabel: "Theme",
|
||||
themeDefault: "Deep Ocean Dark (Default)",
|
||||
themePopVibrant: "Pop & Vibrant",
|
||||
themeLightMinimalist: "Light Minimalist",
|
||||
themeCyberpunk: "Cyberpunk / Hacker",
|
||||
themeGlassmorphism: "Glassmorphism",
|
||||
themeNeumorphism: "Neumorphism",
|
||||
themeRetroPixel: "Retro 8-bit / Pixel",
|
||||
themePastelDream: "Pastel Dream",
|
||||
themeBrutalism: "Brutalism",
|
||||
themeEarthy: "Earthy / Nature",
|
||||
themeMaterial: "Material UI",
|
||||
themeMonotoneAccent: "Monotone + Accent",
|
||||
themeCorporate: "Corporate Trust",
|
||||
},
|
||||
|
||||
ja: {
|
||||
@@ -232,6 +349,8 @@ const LANGUAGES = {
|
||||
// -- Side panel --
|
||||
uiFormat: "UI形式",
|
||||
apiFormat: "API形式",
|
||||
appFormat: "App形式",
|
||||
appFormatNotSupported: "App形式のワークフローは生成UIに読み込めません。「ComfyUIで開く」をご利用ください。",
|
||||
noSelection: "未選択",
|
||||
groupsLabel: "グループ",
|
||||
groupsNone: "なし",
|
||||
@@ -334,12 +453,112 @@ const LANGUAGES = {
|
||||
presetName: "プリセット名",
|
||||
positivePrompt: "ポジティブプロンプト",
|
||||
negativePrompt: "ネガティブプロンプト",
|
||||
savePreset: "プリセット保存",
|
||||
savePreset: "保存",
|
||||
copyPositivePrompt: "PP コピー",
|
||||
copyNegativePrompt: "NP コピー",
|
||||
copiedToClipboard: "クリップボードにコピーしました",
|
||||
noTextToCopy: "コピーするテキストがありません",
|
||||
applyPreset: "適用",
|
||||
deletePreset: "削除",
|
||||
assistantSubtab: "AIアシスタント",
|
||||
presetsSubtab: "プリセット",
|
||||
|
||||
// -- Nodes tab --
|
||||
tabNodes: "ノード",
|
||||
nodesAllNodes: "全ノード",
|
||||
nodesNodeSets: "ノードセット",
|
||||
nodesSearchPlaceholder: "ノードを検索...",
|
||||
nodesAllCategories: "全カテゴリ",
|
||||
nodesAllPackages: "全パッケージ",
|
||||
nodesAllTags: "全タグ",
|
||||
nodesAllGroups: "全グループ",
|
||||
noNodesFound: "ノードが見つかりません",
|
||||
nodesDetails: "詳細",
|
||||
nodesIoSpec: "I/O仕様",
|
||||
nodesGroups: "グループ",
|
||||
nodesInputs: "入力",
|
||||
nodesOutputs: "出力",
|
||||
nodesRequired: "必須",
|
||||
nodesOptional: "任意",
|
||||
nodesClassName: "クラス名",
|
||||
nodesPackage: "パッケージ",
|
||||
nodesCategory: "カテゴリ",
|
||||
nodesDescription: "説明",
|
||||
nodesExperimental: "実験的",
|
||||
nodesDeprecated: "非推奨",
|
||||
nodesOutputNode: "出力ノード",
|
||||
nodesEditTags: "タグ(カンマ区切り)",
|
||||
nodesCreateSet: "ノードセット作成",
|
||||
nodesEditSet: "編集",
|
||||
nodesSetName: "セット名",
|
||||
nodesSetDescription: "説明",
|
||||
nodesSetNodes: "ノード",
|
||||
nodesAddNode: "ノード追加",
|
||||
nodesSetLinks: "接続",
|
||||
nodesAddLink: "接続追加",
|
||||
nodesCopyToClipboard: "クリップボードにコピー",
|
||||
nodesCopied: "ノードセットをクリップボードにコピーしました",
|
||||
nodesCopyClassName: "クラス名をコピー",
|
||||
nodesCopiedClassName: "クラス名をコピーしました!",
|
||||
nodesDeleteSet: "削除",
|
||||
nodesDeleteSetConfirm: "このノードセットを削除しますか?",
|
||||
nodesSetUpdated: "ノードセットを更新しました",
|
||||
nodesRefresh: "更新",
|
||||
nodesCreateGroup: "グループ作成",
|
||||
nodesGroupName: "グループ名",
|
||||
nodesAssignGroup: "グループに追加",
|
||||
nodesRemoveGroup: "グループから削除",
|
||||
nodesConnectToComfyUI: "ComfyUIに接続してノードを読み込みます。設定タブを確認してください。",
|
||||
nodesClickToLoad: "クリックしてノードを読み込み...",
|
||||
|
||||
// -- Help & Support --
|
||||
tabHelp: "ヘルプ",
|
||||
helpManualTitle: "機能一覧",
|
||||
helpAboutTitle: "概要",
|
||||
helpAboutDesc: "ComfyUIのワークフローJSONファイルの管理、API接続による画像生成、プロンプト作成支援を行う集中コントロールUIです。",
|
||||
helpAbout1: "ComfyUIマネージャーからインストール、またはcustom_nodesフォルダへgit clone",
|
||||
helpAbout2: "ComfyUIツールバーのWorkflow Studioボタンから起動、またはhttp://127.0.0.1:8188/wfmを開く",
|
||||
helpWf1: "サムネイル / カード / テーブルの表示モード切り替え",
|
||||
helpWf2: "テキスト検索、カテゴリフィルタ、お気に入りフィルタ、グループフィルタ",
|
||||
helpWf3: "グループの作成・名前変更・削除、ワークフローの割り当て・解除",
|
||||
helpWf4: "JSON/PNGファイルのインポート(ボタンまたはドラッグ&ドロップ)",
|
||||
helpWf5: "サイドパネル:サムネイル、JSONビューア(フォーマットバッジ:UI/API/App形式)、クリップボードコピー、グループ管理",
|
||||
helpWf6: "詳細モーダル:名前変更、お気に入り、サムネイル変更、分析、カテゴリオーバーライド、タグ、メモ、AI要約、ComfyUIで開く、生成UIに読み込み、デフォルト設定、削除",
|
||||
helpWf7: "カテゴリごとのバッジ色カスタマイズ",
|
||||
helpWf8: "全ワークフローの入出力一括再分析(P:プロンプト入力、I:画像入力、出力:saveノード)",
|
||||
helpGen1: "ComfyUIの接続・切断、接続状態の確認",
|
||||
helpGen2: "Workflowタブからワークフローを読み込み(App形式 .app.json は非対応)",
|
||||
helpGen3: "パラメータ編集:プロンプト、画像(ドラッグ&ドロップ)、モデル(checkpoint/VAE/LoRA/ControlNet、フィルタ検索)、設定(Steps/CFG/サンプラー/スケジューラ/解像度)、Raw JSON",
|
||||
helpGen4: "シード管理:ランダム / 固定 / 増加 / 減少",
|
||||
helpGen5: "画像生成、進捗表示、生成停止",
|
||||
helpGen6: "メイン画像とサムネイル履歴で結果表示",
|
||||
helpGen7: "Eagle連携:生成画像をEagleへ自動保存",
|
||||
helpPrompt1: "AIアシスタント(Ollama):モデル選択、チャットでプロンプト相談、画像添付(ビジョンモデル対応)",
|
||||
helpPrompt2: "AIの応答をGenerateUIのプロンプトに適用",
|
||||
helpPrompt3: "翻訳機能:日⇔英、中⇔英",
|
||||
helpPrompt4: "プリセット管理:作成・編集・削除・適用、ポジティブ/ネガティブプロンプトのクリップボードコピー",
|
||||
helpSettings1: "UI言語と要約言語の設定",
|
||||
helpSettings2: "ワークフローデータフォルダのパス変更・リセット",
|
||||
helpSettings3: "ComfyUI接続URL設定と接続テスト",
|
||||
helpSettings4: "Ollama URL、デフォルトモデル、接続テスト",
|
||||
helpSettings5: "デフォルトワークフローの設定・解除",
|
||||
helpSettings6: "Eagle連携URL、自動保存の有効/無効",
|
||||
helpShortcutsTitle: "キーボード操作",
|
||||
helpShortcuts1: "Escape:モーダル・パネルを閉じる",
|
||||
helpShortcuts2: "Enter:名前変更の確定、チャット送信",
|
||||
helpShortcuts3: "Shift+Enter:チャットで改行",
|
||||
helpShortcuts4: "ダブルクリック:詳細モーダルを開く",
|
||||
helpTroubleTitle: "トラブルシューティング",
|
||||
helpTrouble1: "ComfyUIに接続できない:ComfyUIで画像生成できるか確認、設定タブでURL確認、ブラウザ更新・再起動",
|
||||
helpTrouble2: "Ollamaに接続できない:接続テストボタンで確認、Ollamaの起動・モデルのダウンロードを確認",
|
||||
helpTrouble3: "ワークフローが表示されない:更新ボタン押下、ComfyUIで読み込めるか確認、ブラウザ・ComfyUI再起動",
|
||||
helpTrouble4: "画像生成が失敗する:指定モデルの存在確認、ComfyUI接続確認、再起動",
|
||||
helpSupportTitle: "サポート",
|
||||
helpSupportDesc: "このプラグインが役に立ったら、開発を支援していただけると嬉しいです!",
|
||||
helpGithubDesc: "バグ報告、機能リクエスト、コントリビュート",
|
||||
helpKofiDesc: "コーヒーを奢って開発を応援",
|
||||
helpThanks: "Workflow Studioをご利用いただきありがとうございます!",
|
||||
|
||||
// -- Settings --
|
||||
workflowsDir: "ワークフローデータフォルダ",
|
||||
workflowsDirLabel: "フォルダパス",
|
||||
@@ -380,6 +599,21 @@ const LANGUAGES = {
|
||||
saveSettings: "設定を保存",
|
||||
settingsSaved: "設定を保存しました",
|
||||
ollamaSaved: "Ollama設定を保存しました",
|
||||
// -- Theme --
|
||||
themeLabel: "テーマ",
|
||||
themeDefault: "Deep Ocean Dark (デフォルト)",
|
||||
themePopVibrant: "Pop & Vibrant (ポップ調)",
|
||||
themeLightMinimalist: "Light Minimalist (クリーン)",
|
||||
themeCyberpunk: "Cyberpunk / Hacker",
|
||||
themeGlassmorphism: "Glassmorphism (グラス)",
|
||||
themeNeumorphism: "Neumorphism (ニューモ)",
|
||||
themeRetroPixel: "Retro 8-bit (レトロ)",
|
||||
themePastelDream: "Pastel Dream (パステル)",
|
||||
themeBrutalism: "Brutalism (ブルータリズム)",
|
||||
themeEarthy: "Earthy / Nature (アース)",
|
||||
themeMaterial: "Material UI (マテリアル)",
|
||||
themeMonotoneAccent: "Monotone + Accent",
|
||||
themeCorporate: "Corporate Trust (企業向け)",
|
||||
},
|
||||
|
||||
zh: {
|
||||
@@ -421,6 +655,8 @@ const LANGUAGES = {
|
||||
// -- Side panel --
|
||||
uiFormat: "UI格式",
|
||||
apiFormat: "API格式",
|
||||
appFormat: "App格式",
|
||||
appFormatNotSupported: "App格式的工作流无法在生成UI中加载。请使用「在ComfyUI中打开」。",
|
||||
noSelection: "未选择",
|
||||
groupsLabel: "分组",
|
||||
groupsNone: "无",
|
||||
@@ -529,6 +765,102 @@ const LANGUAGES = {
|
||||
assistantSubtab: "AI助手",
|
||||
presetsSubtab: "预设",
|
||||
|
||||
// -- Nodes tab --
|
||||
tabNodes: "节点",
|
||||
nodesAllNodes: "所有节点",
|
||||
nodesNodeSets: "节点集",
|
||||
nodesSearchPlaceholder: "搜索节点...",
|
||||
nodesAllCategories: "所有分类",
|
||||
nodesAllPackages: "所有包",
|
||||
nodesAllTags: "所有标签",
|
||||
nodesAllGroups: "所有分组",
|
||||
noNodesFound: "未找到节点",
|
||||
nodesDetails: "详情",
|
||||
nodesIoSpec: "I/O规格",
|
||||
nodesGroups: "分组",
|
||||
nodesInputs: "输入",
|
||||
nodesOutputs: "输出",
|
||||
nodesRequired: "必需",
|
||||
nodesOptional: "可选",
|
||||
nodesClassName: "类名",
|
||||
nodesPackage: "包",
|
||||
nodesCategory: "分类",
|
||||
nodesDescription: "描述",
|
||||
nodesExperimental: "实验性",
|
||||
nodesDeprecated: "已弃用",
|
||||
nodesOutputNode: "输出节点",
|
||||
nodesEditTags: "标签(逗号分隔)",
|
||||
nodesCreateSet: "创建节点集",
|
||||
nodesEditSet: "编辑",
|
||||
nodesSetName: "集名称",
|
||||
nodesSetDescription: "描述",
|
||||
nodesSetNodes: "节点",
|
||||
nodesAddNode: "添加节点",
|
||||
nodesSetLinks: "连接",
|
||||
nodesAddLink: "添加连接",
|
||||
nodesCopyToClipboard: "复制到剪贴板",
|
||||
nodesCopied: "节点集已复制到剪贴板",
|
||||
nodesCopyClassName: "复制类名",
|
||||
nodesCopiedClassName: "类名已复制!",
|
||||
nodesDeleteSet: "删除",
|
||||
nodesDeleteSetConfirm: "删除此节点集?",
|
||||
nodesSetUpdated: "节点集已更新",
|
||||
nodesRefresh: "刷新",
|
||||
nodesCreateGroup: "创建分组",
|
||||
nodesGroupName: "分组名称",
|
||||
nodesAssignGroup: "添加到分组",
|
||||
nodesRemoveGroup: "从分组移除",
|
||||
nodesConnectToComfyUI: "连接ComfyUI以加载节点。请检查设置选项卡。",
|
||||
nodesClickToLoad: "点击加载节点...",
|
||||
|
||||
// -- Help & Support --
|
||||
tabHelp: "帮助",
|
||||
helpManualTitle: "功能列表",
|
||||
helpAboutTitle: "概述",
|
||||
helpAboutDesc: "用于管理ComfyUI工作流JSON文件、通过API生成图片、辅助提示词创作的集中控制UI。",
|
||||
helpAbout1: "通过ComfyUI Manager安装,或git clone到custom_nodes文件夹",
|
||||
helpAbout2: "从ComfyUI工具栏的Workflow Studio按钮启动,或打开http://127.0.0.1:8188/wfm",
|
||||
helpWf1: "切换缩略图/卡片/表格视图模式",
|
||||
helpWf2: "文本搜索、分类筛选、收藏筛选、分组筛选",
|
||||
helpWf3: "创建、重命名、删除分组,分配/移除工作流",
|
||||
helpWf4: "通过按钮或拖放导入JSON/PNG文件",
|
||||
helpWf5: "侧面板:缩略图、JSON查看器(格式徽章:UI/API/App)、剪贴板复制、分组管理",
|
||||
helpWf6: "详情弹窗:重命名、收藏、缩略图更换、分析、分类覆盖、标签、备注、AI摘要、在ComfyUI中打开、加载到生成UI、设为默认、删除",
|
||||
helpWf7: "按分类自定义徽章颜色",
|
||||
helpWf8: "批量重新分析所有工作流I/O(P:提示词节点、I:图片节点、输出:保存节点)",
|
||||
helpGen1: "连接/断开ComfyUI,检查连接状态",
|
||||
helpGen2: "从工作流标签页加载工作流(不支持App格式.app.json)",
|
||||
helpGen3: "编辑参数:提示词、图片(拖放)、模型(checkpoint/VAE/LoRA/ControlNet含筛选)、设置(Steps/CFG/采样器/调度器/分辨率)、Raw JSON",
|
||||
helpGen4: "种子管理:随机/固定/递增/递减",
|
||||
helpGen5: "生成图片、进度显示、停止生成",
|
||||
helpGen6: "主图和缩略图历史查看结果",
|
||||
helpGen7: "Eagle集成:自动保存生成图片到Eagle",
|
||||
helpPrompt1: "AI助手(Ollama):模型选择、聊天咨询提示词、图片附件(视觉模型)",
|
||||
helpPrompt2: "将AI回复应用到生成UI的提示词",
|
||||
helpPrompt3: "翻译功能:日\u2194英、中\u2194英",
|
||||
helpPrompt4: "预设管理:创建、编辑、删除、应用、剪贴板复制(PP/NP)",
|
||||
helpSettings1: "UI语言和摘要语言设置",
|
||||
helpSettings2: "工作流数据文件夹路径更改/重置",
|
||||
helpSettings3: "ComfyUI连接URL设置和测试",
|
||||
helpSettings4: "Ollama URL、默认模型、连接测试",
|
||||
helpSettings5: "默认工作流设置/取消",
|
||||
helpSettings6: "Eagle集成URL、自动保存开关",
|
||||
helpShortcutsTitle: "键盘操作",
|
||||
helpShortcuts1: "Escape:关闭弹窗/面板",
|
||||
helpShortcuts2: "Enter:确认重命名、发送聊天",
|
||||
helpShortcuts3: "Shift+Enter:聊天中换行",
|
||||
helpShortcuts4: "双击:打开详情弹窗",
|
||||
helpTroubleTitle: "故障排除",
|
||||
helpTrouble1: "无法连接ComfyUI:确认ComfyUI能否生成图片、在设置中验证URL、尝试刷新或重启",
|
||||
helpTrouble2: "无法连接Ollama:使用连接测试按钮、确认Ollama运行中且已下载模型",
|
||||
helpTrouble3: "工作流不显示:点击刷新按钮、确认能在ComfyUI中加载、尝试重启浏览器/ComfyUI",
|
||||
helpTrouble4: "图片生成失败:确认指定模型存在、验证ComfyUI连接、尝试重启",
|
||||
helpSupportTitle: "支持",
|
||||
helpSupportDesc: "如果您觉得这个插件有用,请考虑支持它的开发!",
|
||||
helpGithubDesc: "报告问题、请求功能和贡献代码",
|
||||
helpKofiDesc: "请我喝杯咖啡来支持开发",
|
||||
helpThanks: "感谢您使用Workflow Studio!",
|
||||
|
||||
// -- Settings --
|
||||
workflowsDir: "工作流数据文件夹",
|
||||
workflowsDirLabel: "文件夹路径",
|
||||
@@ -569,6 +901,21 @@ const LANGUAGES = {
|
||||
saveSettings: "保存设置",
|
||||
settingsSaved: "设置已保存",
|
||||
ollamaSaved: "Ollama设置已保存",
|
||||
// -- Theme --
|
||||
themeLabel: "主题",
|
||||
themeDefault: "Deep Ocean Dark (默认)",
|
||||
themePopVibrant: "Pop & Vibrant (活力)",
|
||||
themeLightMinimalist: "Light Minimalist (简约)",
|
||||
themeCyberpunk: "Cyberpunk / Hacker",
|
||||
themeGlassmorphism: "Glassmorphism (毛玻璃)",
|
||||
themeNeumorphism: "Neumorphism (新拟态)",
|
||||
themeRetroPixel: "Retro 8-bit (复古像素)",
|
||||
themePastelDream: "Pastel Dream (粉彩)",
|
||||
themeBrutalism: "Brutalism (粗野主义)",
|
||||
themeEarthy: "Earthy / Nature (自然)",
|
||||
themeMaterial: "Material UI (材料)",
|
||||
themeMonotoneAccent: "Monotone + Accent",
|
||||
themeCorporate: "Corporate Trust (企业)",
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -400,6 +400,30 @@ export function initPromptTab() {
|
||||
}
|
||||
});
|
||||
|
||||
// Copy positive prompt to clipboard
|
||||
document.getElementById("wfm-preset-copy-pos-btn")?.addEventListener("click", () => {
|
||||
const text = presetPos?.value || "";
|
||||
if (!text.trim()) {
|
||||
showToast(t("noTextToCopy"), "error");
|
||||
return;
|
||||
}
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
showToast(t("copiedToClipboard"), "success");
|
||||
});
|
||||
});
|
||||
|
||||
// Copy negative prompt to clipboard
|
||||
document.getElementById("wfm-preset-copy-neg-btn")?.addEventListener("click", () => {
|
||||
const text = presetNeg?.value || "";
|
||||
if (!text.trim()) {
|
||||
showToast(t("noTextToCopy"), "error");
|
||||
return;
|
||||
}
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
showToast(t("copiedToClipboard"), "success");
|
||||
});
|
||||
});
|
||||
|
||||
// Save preset
|
||||
document.getElementById("wfm-preset-save-btn")?.addEventListener("click", () => {
|
||||
const name = presetName?.value.trim();
|
||||
|
||||
@@ -50,6 +50,35 @@ function buildLangOptions(optionsMap, selectedValue) {
|
||||
.join("");
|
||||
}
|
||||
|
||||
// Theme definitions with swatch colors for preview
|
||||
const THEMES = [
|
||||
{ id: "", key: "themeDefault", colors: ["#1a1a2e", "#16213e", "#4a9eff", "#7c5cfc"] },
|
||||
{ id: "pop-vibrant", key: "themePopVibrant", colors: ["#F8F9FA", "#FFFFFF", "#FF6B6B", "#00D2D3"] },
|
||||
{ id: "light-minimalist", key: "themeLightMinimalist", colors: ["#FFFFFF", "#F5F5F5", "#4A9EFF", "#6366F1"] },
|
||||
{ id: "cyberpunk", key: "themeCyberpunk", colors: ["#000000", "#0A0A0A", "#FF00FF", "#00FFFF"] },
|
||||
{ id: "glassmorphism", key: "themeGlassmorphism", colors: ["#1A0533", "#0D1B3E", "#7B68EE", "#DA77F2"] },
|
||||
{ id: "neumorphism", key: "themeNeumorphism", colors: ["#D1D9E6", "#D1D9E6", "#6C8EBF", "#7986CB"] },
|
||||
{ id: "retro-pixel", key: "themeRetroPixel", colors: ["#2C2C34", "#3A3A44", "#5B8FD4", "#D45BD4"] },
|
||||
{ id: "pastel-dream", key: "themePastelDream", colors: ["#F0E6FF", "#E8F5E9", "#B39DDB", "#80DEEA"] },
|
||||
{ id: "brutalism", key: "themeBrutalism", colors: ["#FFFFFF", "#FFFFFF", "#CCFF00", "#000000"] },
|
||||
{ id: "earthy", key: "themeEarthy", colors: ["#F5E6D3", "#EDE0D4", "#8D6E63", "#BF6830"] },
|
||||
{ id: "material", key: "themeMaterial", colors: ["#FAFAFA", "#FFFFFF", "#3F51B5", "#FF4081"] },
|
||||
{ id: "monotone-accent", key: "themeMonotoneAccent", colors: ["#F7F7F7", "#FFFFFF", "#FF6B35", "#1A1A1A"] },
|
||||
{ id: "corporate", key: "themeCorporate", colors: ["#F0F4F8", "#FFFFFF", "#2563EB", "#7C3AED"] },
|
||||
];
|
||||
|
||||
export function applyTheme(themeId) {
|
||||
if (themeId) {
|
||||
document.documentElement.setAttribute("data-theme", themeId);
|
||||
} else {
|
||||
document.documentElement.removeAttribute("data-theme");
|
||||
}
|
||||
}
|
||||
|
||||
export function getSavedTheme() {
|
||||
return loadLocalSettings().theme || "";
|
||||
}
|
||||
|
||||
export async function initSettingsTab() {
|
||||
const container = document.querySelector("#wfm-tab-settings .wfm-settings-container");
|
||||
if (!container) return;
|
||||
@@ -91,6 +120,21 @@ export async function initSettingsTab() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Theme -->
|
||||
<div style="border:1px solid var(--wfm-border);border-radius:var(--wfm-radius);padding:16px;margin-bottom:20px;">
|
||||
<h3 style="font-size:15px;margin-bottom:12px;">${t("themeLabel")}</h3>
|
||||
<div class="wfm-theme-grid" id="wfm-theme-grid">
|
||||
${THEMES.map(th => `
|
||||
<div class="wfm-theme-card ${(settings.theme || "") === th.id ? "active" : ""}" data-theme-id="${th.id}">
|
||||
<div class="wfm-theme-swatch">
|
||||
${th.colors.map(c => `<span style="background:${c};"></span>`).join("")}
|
||||
</div>
|
||||
<div class="wfm-theme-card-label">${t(th.key)}</div>
|
||||
</div>
|
||||
`).join("")}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Workflow Data Folder -->
|
||||
<div style="border:1px solid var(--wfm-border);border-radius:var(--wfm-radius);padding:16px;margin-bottom:20px;">
|
||||
<h3 style="font-size:15px;margin-bottom:12px;">${t("workflowsDir")}</h3>
|
||||
@@ -195,6 +239,19 @@ export async function initSettingsTab() {
|
||||
<button class="wfm-btn wfm-btn-primary" id="wfm-settings-save" style="min-width:120px;">${t("saveSettings")}</button>
|
||||
`;
|
||||
|
||||
// --- Theme change handler ---
|
||||
document.getElementById("wfm-theme-grid")?.addEventListener("click", (e) => {
|
||||
const card = e.target.closest(".wfm-theme-card");
|
||||
if (!card) return;
|
||||
const themeId = card.dataset.themeId;
|
||||
applyTheme(themeId);
|
||||
saveLocalSettings({ theme: themeId });
|
||||
// Update active state
|
||||
document.querySelectorAll(".wfm-theme-card").forEach(c => c.classList.remove("active"));
|
||||
card.classList.add("active");
|
||||
showToast(t("settingsSaved"), "success");
|
||||
});
|
||||
|
||||
// --- Language change handlers ---
|
||||
document.getElementById("wfm-settings-ui-lang")?.addEventListener("change", (e) => {
|
||||
const lang = e.target.value;
|
||||
@@ -361,6 +418,7 @@ export async function initSettingsTab() {
|
||||
eagleAutoSave: document.getElementById("wfm-settings-eagle-auto-save")?.checked || false,
|
||||
uiLang: getLang(),
|
||||
summaryLang: getSummaryLang(),
|
||||
theme: document.documentElement.getAttribute("data-theme") || "",
|
||||
};
|
||||
|
||||
saveLocalSettings(patch);
|
||||
|
||||
@@ -468,8 +468,9 @@ async function showSidePanel(wf, cardEl) {
|
||||
try {
|
||||
const data = await getRawWorkflow(wf.filename);
|
||||
if (badgeEl) {
|
||||
const fmt = comfyWorkflow.detectFormat(data);
|
||||
badgeEl.textContent = fmt === "ui" ? t("uiFormat") : t("apiFormat");
|
||||
const fmt = comfyWorkflow.detectFormat(data, wf.filename);
|
||||
const formatLabels = { ui: t("uiFormat"), api: t("apiFormat"), app: t("appFormat") };
|
||||
badgeEl.textContent = formatLabels[fmt] || fmt;
|
||||
badgeEl.className = "wfm-format-badge wfm-format-badge--" + fmt;
|
||||
}
|
||||
const jsonStr = JSON.stringify(data, null, 2);
|
||||
@@ -866,10 +867,10 @@ function openDetailModal(wf) {
|
||||
document.getElementById("wfm-detail-load").addEventListener("click", async () => {
|
||||
try {
|
||||
const wfData = await getRawWorkflow(wf.filename);
|
||||
await loadWorkflowIntoEditor(wfData, wf.filename);
|
||||
const loaded = await loadWorkflowIntoEditor(wfData, wf.filename);
|
||||
if (loaded === false) return;
|
||||
document.querySelector('.wfm-tab[data-tab="generate"]')?.click();
|
||||
closeModal();
|
||||
showToast(`${t("loaded")}: ${wf.filename}`, "success");
|
||||
} catch (err) {
|
||||
showToast(t("loadError") + ": " + err.message, "error");
|
||||
}
|
||||
@@ -1201,9 +1202,9 @@ export function initWorkflowTab() {
|
||||
if (!state.selectedWf) return;
|
||||
try {
|
||||
const wfData = await getRawWorkflow(state.selectedWf.filename);
|
||||
await loadWorkflowIntoEditor(wfData, state.selectedWf.filename);
|
||||
const loaded = await loadWorkflowIntoEditor(wfData, state.selectedWf.filename);
|
||||
if (loaded === false) return;
|
||||
document.querySelector('.wfm-tab[data-tab="generate"]')?.click();
|
||||
showToast(`${t("loaded")}: ${state.selectedWf.filename}`, "success");
|
||||
} catch (err) {
|
||||
showToast(t("loadError") + ": " + err.message, "error");
|
||||
}
|
||||
|
||||
+187
-1
@@ -15,9 +15,11 @@
|
||||
</div>
|
||||
<nav class="wfm-tabs">
|
||||
<button class="wfm-tab active" data-tab="workflow">Workflow</button>
|
||||
<button class="wfm-tab" data-tab="nodes">Nodes</button>
|
||||
<button class="wfm-tab" data-tab="generate">GenerateUI</button>
|
||||
<button class="wfm-tab" data-tab="prompt">Prompt</button>
|
||||
<button class="wfm-tab" data-tab="settings">Settings</button>
|
||||
<button class="wfm-tab" data-tab="help">Help</button>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
@@ -128,6 +130,69 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Nodes Tab -->
|
||||
<section id="wfm-tab-nodes" class="wfm-tab-content">
|
||||
<!-- Sub-view toggle + Toolbar -->
|
||||
<div class="wfm-toolbar">
|
||||
<div class="wfm-toolbar-row" style="gap:8px;">
|
||||
<div class="wfm-nodes-subview-nav">
|
||||
<button class="wfm-nodes-subview-btn active" data-subview="browser">All Nodes</button>
|
||||
<button class="wfm-nodes-subview-btn" data-subview="sets">Node Sets</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Browser toolbar -->
|
||||
<div id="wfm-nodes-browser-toolbar" class="wfm-toolbar-row" style="gap:6px;flex-wrap:wrap;">
|
||||
<button class="wfm-filter-btn" id="wfm-nodes-fav-btn" title="Favorites">★</button>
|
||||
<input type="text" id="wfm-nodes-search" class="wfm-search-input" placeholder="Search nodes...">
|
||||
<select id="wfm-nodes-category-filter" class="wfm-select wfm-toolbar-select"><option value="">All Categories</option></select>
|
||||
<select id="wfm-nodes-package-filter" class="wfm-select wfm-toolbar-select"><option value="">All Packages</option></select>
|
||||
<select id="wfm-nodes-tag-filter" class="wfm-select wfm-toolbar-select"><option value="">All Tags</option></select>
|
||||
<select id="wfm-nodes-group-filter" class="wfm-select wfm-toolbar-select"><option value="">All Groups</option></select>
|
||||
<div class="wfm-view-btns">
|
||||
<button class="wfm-view-btn active" data-nodes-view="card" title="Card">☰</button>
|
||||
<button class="wfm-view-btn" data-nodes-view="table" title="Table">≡</button>
|
||||
</div>
|
||||
<span id="wfm-nodes-count" class="wfm-nodes-count"></span>
|
||||
<button id="wfm-nodes-refresh-btn" class="wfm-btn wfm-btn-sm">Refresh</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Browser sub-view -->
|
||||
<div id="wfm-nodes-browser" class="wfm-workflow-area">
|
||||
<div id="wfm-nodes-grid" class="wfm-grid wfm-view-card">
|
||||
<p class="wfm-placeholder" id="wfm-nodes-placeholder">Click to load nodes...</p>
|
||||
</div>
|
||||
<!-- Side Panel -->
|
||||
<div id="wfm-nodes-side-panel" class="wfm-side-panel" style="display:none;">
|
||||
<div class="wfm-side-panel-header">
|
||||
<span id="wfm-nodes-panel-title" class="wfm-side-panel-title"></span>
|
||||
<button id="wfm-nodes-panel-close" class="wfm-side-panel-close">×</button>
|
||||
</div>
|
||||
<div class="wfm-side-tab-nav">
|
||||
<button class="wfm-nodes-side-tab-btn active" data-side-tab="details">Details</button>
|
||||
<button class="wfm-nodes-side-tab-btn" data-side-tab="io">I/O Spec</button>
|
||||
<button class="wfm-nodes-side-tab-btn" data-side-tab="nodegroup">Groups</button>
|
||||
</div>
|
||||
<div id="wfm-nodes-side-details" class="wfm-nodes-side-content active" style="overflow-y:auto;padding:12px;">
|
||||
</div>
|
||||
<div id="wfm-nodes-side-io" class="wfm-nodes-side-content" style="display:none;overflow-y:auto;padding:12px;">
|
||||
</div>
|
||||
<div id="wfm-nodes-side-group" class="wfm-nodes-side-content" style="display:none;overflow-y:auto;padding:12px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Node Sets sub-view -->
|
||||
<div id="wfm-nodes-sets" class="wfm-workflow-area" style="display:none;">
|
||||
<div style="padding:8px 0;">
|
||||
<button id="wfm-node-set-create-btn" class="wfm-btn wfm-btn-sm wfm-btn-primary">Create Node Set</button>
|
||||
</div>
|
||||
<div id="wfm-node-sets-grid" class="wfm-grid wfm-view-card">
|
||||
<p class="wfm-placeholder">No node sets yet.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- GenerateUI Tab -->
|
||||
<section id="wfm-tab-generate" class="wfm-tab-content">
|
||||
<!-- Header Row -->
|
||||
@@ -298,7 +363,11 @@
|
||||
<label>Negative Prompt</label>
|
||||
<textarea id="wfm-preset-neg" class="wfm-textarea" rows="3" placeholder="Negative prompt..."></textarea>
|
||||
</div>
|
||||
<button id="wfm-preset-save-btn" class="wfm-btn wfm-btn-primary" style="width:100%;">Save Preset</button>
|
||||
<div style="display:flex; gap:4px;">
|
||||
<button id="wfm-preset-copy-pos-btn" class="wfm-btn" style="flex:2;" title="Copy Positive Prompt">PP Copy</button>
|
||||
<button id="wfm-preset-copy-neg-btn" class="wfm-btn" style="flex:2;" title="Copy Negative Prompt">NP Copy</button>
|
||||
<button id="wfm-preset-save-btn" class="wfm-btn wfm-btn-primary" style="flex:1;">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -309,6 +378,123 @@
|
||||
<div class="wfm-settings-container">
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Help & Support Tab -->
|
||||
<section id="wfm-tab-help" class="wfm-tab-content">
|
||||
<div class="wfm-help-container">
|
||||
<!-- Help Section -->
|
||||
<div class="wfm-help-section">
|
||||
<h2 class="wfm-help-section-title" id="wfm-help-manual-title">Features</h2>
|
||||
|
||||
<div class="wfm-help-card">
|
||||
<h3 id="wfm-help-about-title">About</h3>
|
||||
<p id="wfm-help-about-desc">A centralized control UI for managing ComfyUI workflow JSON files, generating images via API, and assisting with prompt creation.</p>
|
||||
<ul>
|
||||
<li id="wfm-help-about-1">Install via ComfyUI Manager or git clone to custom_nodes</li>
|
||||
<li id="wfm-help-about-2">Launch from the Workflow Studio button in the ComfyUI toolbar, or open http://127.0.0.1:8188/wfm</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="wfm-help-card">
|
||||
<h3>Workflow Tab</h3>
|
||||
<ul>
|
||||
<li id="wfm-help-wf-1">Switch between Thumbnail, Card, and Table view modes</li>
|
||||
<li id="wfm-help-wf-2">Search, category filter, favorites filter, and group filter</li>
|
||||
<li id="wfm-help-wf-3">Create, rename, delete groups and assign/remove workflows</li>
|
||||
<li id="wfm-help-wf-4">Import JSON/PNG files via button or drag & drop</li>
|
||||
<li id="wfm-help-wf-5">Side panel: thumbnail, JSON viewer (format badge: UI/API/App), clipboard copy, group management</li>
|
||||
<li id="wfm-help-wf-6">Detail modal: rename, favorite, thumbnail change, analysis, category override, tags, memo, AI summary, open in ComfyUI, load in GenerateUI, set as default, delete</li>
|
||||
<li id="wfm-help-wf-7">Customize badge colors per category</li>
|
||||
<li id="wfm-help-wf-8">Batch re-analysis of all workflow I/O (P: prompt nodes, I: image nodes, output: save nodes)</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="wfm-help-card">
|
||||
<h3>GenerateUI Tab</h3>
|
||||
<ul>
|
||||
<li id="wfm-help-gen-1">Connect/disconnect ComfyUI and check connection status</li>
|
||||
<li id="wfm-help-gen-2">Load workflows from Workflow tab (App format .app.json not supported)</li>
|
||||
<li id="wfm-help-gen-3">Edit parameters: Prompt, Image (drag & drop), Model (checkpoint/VAE/LoRA/ControlNet with filter), Settings (steps/CFG/sampler/scheduler/resolution), Raw JSON</li>
|
||||
<li id="wfm-help-gen-4">Seed control: random, fixed, increment, decrement</li>
|
||||
<li id="wfm-help-gen-5">Generate, progress display, and stop</li>
|
||||
<li id="wfm-help-gen-6">View results with main image and thumbnail history</li>
|
||||
<li id="wfm-help-gen-7">Eagle integration: auto-save generated images to Eagle</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="wfm-help-card">
|
||||
<h3>Prompt Tab</h3>
|
||||
<ul>
|
||||
<li id="wfm-help-prompt-1">AI assistant (Ollama): model selection, chat for prompt consultation, image attachment (vision models)</li>
|
||||
<li id="wfm-help-prompt-2">Apply AI responses to GenerateUI prompts</li>
|
||||
<li id="wfm-help-prompt-3">Translation: JA↔EN, ZH↔EN</li>
|
||||
<li id="wfm-help-prompt-4">Preset management: create, edit, delete, apply, clipboard copy (PP/NP)</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="wfm-help-card">
|
||||
<h3>Settings Tab</h3>
|
||||
<ul>
|
||||
<li id="wfm-help-settings-1">UI language and summary language</li>
|
||||
<li id="wfm-help-settings-2">Workflow data folder path</li>
|
||||
<li id="wfm-help-settings-3">ComfyUI connection URL and test</li>
|
||||
<li id="wfm-help-settings-4">Ollama URL, default model, and connection test</li>
|
||||
<li id="wfm-help-settings-5">Default workflow setting</li>
|
||||
<li id="wfm-help-settings-6">Eagle integration URL and auto-save toggle</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="wfm-help-card">
|
||||
<h3 id="wfm-help-shortcuts-title">Keyboard Shortcuts</h3>
|
||||
<ul>
|
||||
<li id="wfm-help-shortcuts-1">Escape: Close modal/panel</li>
|
||||
<li id="wfm-help-shortcuts-2">Enter: Confirm rename, send chat</li>
|
||||
<li id="wfm-help-shortcuts-3">Shift+Enter: New line in chat</li>
|
||||
<li id="wfm-help-shortcuts-4">Double-click: Open detail modal</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="wfm-help-card">
|
||||
<h3 id="wfm-help-trouble-title">Troubleshooting</h3>
|
||||
<ul>
|
||||
<li id="wfm-help-trouble-1">Cannot connect to ComfyUI: Check if ComfyUI can generate images, verify URL in Settings, try refreshing or restarting</li>
|
||||
<li id="wfm-help-trouble-2">Cannot connect to Ollama: Use connection test button, check if Ollama is running and models are downloaded</li>
|
||||
<li id="wfm-help-trouble-3">Workflows not showing: Click refresh button, check if loadable in ComfyUI, try restarting browser/ComfyUI</li>
|
||||
<li id="wfm-help-trouble-4">Image generation fails: Check if specified models exist in ComfyUI, verify connection, try restarting</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Support Section -->
|
||||
<div class="wfm-help-section">
|
||||
<h2 class="wfm-help-section-title" id="wfm-help-support-title">Support</h2>
|
||||
|
||||
<div class="wfm-help-card wfm-help-support-card">
|
||||
<p id="wfm-help-support-desc">If you find this plugin useful, please consider supporting its development!</p>
|
||||
|
||||
<div class="wfm-help-links">
|
||||
<a href="https://github.com/ketle-man/ComfyUI-Workflow-Studio" target="_blank" rel="noopener noreferrer" class="wfm-help-link wfm-help-link-github">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg>
|
||||
<div>
|
||||
<div class="wfm-help-link-title">GitHub</div>
|
||||
<div class="wfm-help-link-desc" id="wfm-help-github-desc">Report issues, request features, and contribute</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="https://ko-fi.com/ninnin90033" target="_blank" rel="noopener noreferrer" class="wfm-help-link wfm-help-link-kofi">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M23.881 8.948c-.773-4.085-4.859-4.593-4.859-4.593H.723c-.604 0-.679.798-.679.798s-.082 7.324-.022 11.822c.164 2.424 2.586 2.672 2.586 2.672s8.267-.023 11.966-.049c2.438-.426 2.683-2.566 2.658-3.734 4.352.24 7.422-2.831 6.649-6.916zm-11.062 3.511c-1.246 1.453-4.011 3.976-4.011 3.976s-.121.119-.31.023c-.076-.057-.108-.09-.108-.09-.443-.441-3.368-3.049-4.034-3.954-.709-.965-1.041-2.7-.091-3.71.951-1.01 3.005-1.086 4.363.407 0 0 1.565-1.782 3.468-.963 1.904.82 1.832 3.011.723 4.311zm6.173.478c-.928.116-1.682.028-1.682.028V7.284h1.77s1.971.551 1.971 2.638c0 1.913-.985 2.667-2.059 3.015z"/></svg>
|
||||
<div>
|
||||
<div class="wfm-help-link-title">Ko-fi</div>
|
||||
<div class="wfm-help-link-desc" id="wfm-help-kofi-desc">Buy me a coffee to support development</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p class="wfm-help-thanks" id="wfm-help-thanks">Thank you for using Workflow Studio!</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<!-- Workflow Detail Modal -->
|
||||
|
||||
@@ -0,0 +1,721 @@
|
||||
/**
|
||||
* Node Library Sidebar Panel
|
||||
*
|
||||
* Fixed sidebar panel injected into ComfyUI DOM.
|
||||
* Three tabs: Favorites (single nodes), Node Sets (multi-node), Groups.
|
||||
* Items are draggable onto the canvas or click-to-place.
|
||||
*/
|
||||
console.log("[WFM] node_sets_menu.js loading...");
|
||||
import { app } from "../../scripts/app.js";
|
||||
console.log("[WFM] node_sets_menu.js: app imported");
|
||||
|
||||
export const NODE_SETS_TOOLTIP = "Node Library – Browse & drag nodes onto canvas";
|
||||
|
||||
// ============================================
|
||||
// State
|
||||
// ============================================
|
||||
|
||||
const state = {
|
||||
visible: false,
|
||||
activeTab: "favorites", // favorites | sets | groups
|
||||
favorites: [], // [{name, display_name}]
|
||||
nodeSets: [],
|
||||
groups: {}, // {groupName: [nodeName, ...]}
|
||||
metadata: {},
|
||||
searchText: "",
|
||||
loaded: false,
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// API
|
||||
// ============================================
|
||||
|
||||
const fetchNodeSets = async () => {
|
||||
try {
|
||||
const res = await fetch("/api/wfm/node-sets");
|
||||
return res.ok ? await res.json() : [];
|
||||
} catch { return []; }
|
||||
};
|
||||
|
||||
const fetchMetadata = async () => {
|
||||
try {
|
||||
const res = await fetch("/api/wfm/nodes/metadata");
|
||||
return res.ok ? await res.json() : {};
|
||||
} catch { return {}; }
|
||||
};
|
||||
|
||||
const fetchGroups = async () => {
|
||||
try {
|
||||
const res = await fetch("/api/wfm/nodes/groups");
|
||||
return res.ok ? await res.json() : {};
|
||||
} catch { return {}; }
|
||||
};
|
||||
|
||||
const loadData = async () => {
|
||||
const [metadata, nodeSets, groups] = await Promise.all([
|
||||
fetchMetadata(), fetchNodeSets(), fetchGroups(),
|
||||
]);
|
||||
state.metadata = metadata;
|
||||
state.nodeSets = nodeSets;
|
||||
state.groups = groups;
|
||||
|
||||
// Extract favorites from metadata
|
||||
state.favorites = [];
|
||||
for (const [name, meta] of Object.entries(metadata)) {
|
||||
if (name === "_groups") continue;
|
||||
if (meta.favorite) {
|
||||
state.favorites.push({ name, display_name: name });
|
||||
}
|
||||
}
|
||||
state.loaded = true;
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// Canvas placement helpers
|
||||
// ============================================
|
||||
|
||||
const getCanvasDropPos = (e) => {
|
||||
const canvas = app.canvas;
|
||||
if (!canvas) return [100, 100];
|
||||
const rect = canvas.canvas.getBoundingClientRect();
|
||||
const x = (e.clientX - rect.left) / canvas.ds.scale - canvas.ds.offset[0];
|
||||
const y = (e.clientY - rect.top) / canvas.ds.scale - canvas.ds.offset[1];
|
||||
return [x, y];
|
||||
};
|
||||
|
||||
const placeSingleNode = (classType, pos) => {
|
||||
const graph = app.graph;
|
||||
if (!graph) return;
|
||||
const node = LiteGraph.createNode(classType);
|
||||
if (!node) {
|
||||
showToast(`Unknown node: ${classType}`, "error");
|
||||
return;
|
||||
}
|
||||
node.pos = pos || [100, 100];
|
||||
graph.add(node);
|
||||
app.canvas.setDirty(true, true);
|
||||
showToast(`Placed: ${node.title || classType}`, "success");
|
||||
};
|
||||
|
||||
const placeNodeSet = (nodeSet, pos) => {
|
||||
const graph = app.graph;
|
||||
const canvas = app.canvas;
|
||||
if (!graph || !canvas) return;
|
||||
|
||||
const nodes = nodeSet.nodes || [];
|
||||
if (nodes.length === 0) return;
|
||||
|
||||
const baseX = pos ? pos[0] : (-canvas.ds.offset[0] + canvas.canvas.width / 2 / canvas.ds.scale);
|
||||
const baseY = pos ? pos[1] : (-canvas.ds.offset[1] + canvas.canvas.height / 2 / canvas.ds.scale);
|
||||
|
||||
const positions = nodes.map(n => n.rel_pos || [0, 0]);
|
||||
const minX = Math.min(...positions.map(p => p[0]));
|
||||
const minY = Math.min(...positions.map(p => p[1]));
|
||||
|
||||
const createdNodes = [];
|
||||
for (const nodeDef of nodes) {
|
||||
if (!nodeDef.class_type) { createdNodes.push(null); continue; }
|
||||
const node = LiteGraph.createNode(nodeDef.class_type);
|
||||
if (!node) { createdNodes.push(null); continue; }
|
||||
const rp = nodeDef.rel_pos || [0, 0];
|
||||
node.pos = [baseX + rp[0] - minX, baseY + rp[1] - minY];
|
||||
if (nodeDef.title) node.title = nodeDef.title;
|
||||
if (nodeDef.widget_values && node.widgets) {
|
||||
for (const [k, v] of Object.entries(nodeDef.widget_values)) {
|
||||
const w = node.widgets.find(ww => ww.name === k);
|
||||
if (w) w.value = v;
|
||||
}
|
||||
}
|
||||
graph.add(node);
|
||||
createdNodes.push(node);
|
||||
}
|
||||
|
||||
for (const link of (nodeSet.links || [])) {
|
||||
const from = createdNodes[link.from_node];
|
||||
const to = createdNodes[link.to_node];
|
||||
if (from && to) {
|
||||
try { from.connect(link.from_slot ?? 0, to, link.to_slot ?? 0); } catch {}
|
||||
}
|
||||
}
|
||||
|
||||
canvas.setDirty(true, true);
|
||||
showToast(`Placed "${nodeSet.name}" (${createdNodes.filter(Boolean).length} nodes)`, "success");
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// Drag & Drop onto canvas
|
||||
// ============================================
|
||||
|
||||
let dropHandlerInstalled = false;
|
||||
|
||||
const installCanvasDropHandler = () => {
|
||||
if (dropHandlerInstalled) return;
|
||||
dropHandlerInstalled = true;
|
||||
|
||||
const canvasEl = document.getElementById("graph-canvas");
|
||||
if (!canvasEl) return;
|
||||
|
||||
canvasEl.addEventListener("dragover", (e) => {
|
||||
if (e.dataTransfer.types.includes("application/x-wfm-node")) {
|
||||
e.preventDefault();
|
||||
e.dataTransfer.dropEffect = "copy";
|
||||
}
|
||||
});
|
||||
|
||||
canvasEl.addEventListener("drop", (e) => {
|
||||
const raw = e.dataTransfer.getData("application/x-wfm-node");
|
||||
if (!raw) return;
|
||||
e.preventDefault();
|
||||
|
||||
const data = JSON.parse(raw);
|
||||
const pos = getCanvasDropPos(e);
|
||||
|
||||
if (data.type === "single") {
|
||||
placeSingleNode(data.classType, pos);
|
||||
} else if (data.type === "set") {
|
||||
const set = state.nodeSets.find(s => s.id === data.setId);
|
||||
if (set) placeNodeSet(set, pos);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// Sidebar Panel DOM
|
||||
// ============================================
|
||||
|
||||
let panelEl = null;
|
||||
|
||||
const PANEL_ID = "wfm-node-library-panel";
|
||||
|
||||
const createPanel = () => {
|
||||
if (panelEl) return panelEl;
|
||||
|
||||
const panel = document.createElement("div");
|
||||
panel.id = PANEL_ID;
|
||||
panel.innerHTML = `
|
||||
<div class="wfm-nlp-header">
|
||||
<span class="wfm-nlp-title">Node Library</span>
|
||||
<button class="wfm-nlp-refresh" title="Refresh">↻</button>
|
||||
<button class="wfm-nlp-close" title="Close">×</button>
|
||||
</div>
|
||||
<div class="wfm-nlp-tabs">
|
||||
<button class="wfm-nlp-tab active" data-tab="favorites">★ Favorites</button>
|
||||
<button class="wfm-nlp-tab" data-tab="sets">☰ Sets</button>
|
||||
<button class="wfm-nlp-tab" data-tab="groups">📁 Groups</button>
|
||||
</div>
|
||||
<div class="wfm-nlp-search">
|
||||
<input type="text" class="wfm-nlp-search-input" placeholder="Search...">
|
||||
</div>
|
||||
<div class="wfm-nlp-content"></div>
|
||||
`;
|
||||
|
||||
document.body.appendChild(panel);
|
||||
panelEl = panel;
|
||||
|
||||
// Tab switching
|
||||
panel.querySelectorAll(".wfm-nlp-tab").forEach(btn => {
|
||||
btn.addEventListener("click", () => {
|
||||
state.activeTab = btn.dataset.tab;
|
||||
panel.querySelectorAll(".wfm-nlp-tab").forEach(b => b.classList.remove("active"));
|
||||
btn.classList.add("active");
|
||||
renderContent();
|
||||
});
|
||||
});
|
||||
|
||||
// Close
|
||||
panel.querySelector(".wfm-nlp-close").addEventListener("click", () => togglePanel());
|
||||
|
||||
// Search
|
||||
panel.querySelector(".wfm-nlp-search-input").addEventListener("input", (e) => {
|
||||
state.searchText = e.target.value.toLowerCase().trim();
|
||||
renderContent();
|
||||
});
|
||||
|
||||
// Refresh
|
||||
panel.querySelector(".wfm-nlp-refresh").addEventListener("click", async () => {
|
||||
await loadData();
|
||||
renderContent();
|
||||
showToast("Node Library refreshed", "success");
|
||||
});
|
||||
|
||||
injectStyles();
|
||||
return panel;
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// Render content
|
||||
// ============================================
|
||||
|
||||
const renderContent = () => {
|
||||
const content = panelEl?.querySelector(".wfm-nlp-content");
|
||||
if (!content) return;
|
||||
|
||||
if (!state.loaded) {
|
||||
content.innerHTML = `<div class="wfm-nlp-empty">Loading...</div>`;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (state.activeTab) {
|
||||
case "favorites": renderFavorites(content); break;
|
||||
case "sets": renderSets(content); break;
|
||||
case "groups": renderGroups(content); break;
|
||||
}
|
||||
};
|
||||
|
||||
const renderFavorites = (container) => {
|
||||
let items = state.favorites;
|
||||
if (state.searchText) {
|
||||
items = items.filter(n => n.name.toLowerCase().includes(state.searchText));
|
||||
}
|
||||
|
||||
if (items.length === 0) {
|
||||
container.innerHTML = `<div class="wfm-nlp-empty">
|
||||
${state.favorites.length === 0 ? "No favorites yet.<br><small>Star nodes in Workflow Studio → Nodes tab</small>" : "No matches"}
|
||||
</div>`;
|
||||
return;
|
||||
}
|
||||
|
||||
container.innerHTML = "";
|
||||
for (const node of items) {
|
||||
const el = createDraggableItem(node.display_name || node.name, "single", { classType: node.name });
|
||||
el.addEventListener("dblclick", () => {
|
||||
placeSingleNode(node.name);
|
||||
});
|
||||
container.appendChild(el);
|
||||
}
|
||||
};
|
||||
|
||||
const renderSets = (container) => {
|
||||
let items = state.nodeSets;
|
||||
if (state.searchText) {
|
||||
items = items.filter(s =>
|
||||
s.name.toLowerCase().includes(state.searchText) ||
|
||||
(s.tags || []).some(t => t.toLowerCase().includes(state.searchText))
|
||||
);
|
||||
}
|
||||
|
||||
if (items.length === 0) {
|
||||
container.innerHTML = `<div class="wfm-nlp-empty">
|
||||
${state.nodeSets.length === 0 ? "No node sets.<br><small>Create sets in Workflow Studio → Nodes tab</small>" : "No matches"}
|
||||
</div>`;
|
||||
return;
|
||||
}
|
||||
|
||||
container.innerHTML = "";
|
||||
for (const set of items) {
|
||||
const count = (set.nodes || []).length;
|
||||
const el = createDraggableItem(
|
||||
`${esc(set.name)} <span class="wfm-nlp-badge">${count} nodes</span>`,
|
||||
"set",
|
||||
{ setId: set.id },
|
||||
set.description
|
||||
);
|
||||
el.addEventListener("dblclick", () => {
|
||||
placeNodeSet(set);
|
||||
});
|
||||
container.appendChild(el);
|
||||
}
|
||||
};
|
||||
|
||||
const renderGroups = (container) => {
|
||||
const groupNames = Object.keys(state.groups).sort();
|
||||
|
||||
if (groupNames.length === 0) {
|
||||
container.innerHTML = `<div class="wfm-nlp-empty">
|
||||
No groups.<br><small>Create groups in Workflow Studio → Nodes tab</small>
|
||||
</div>`;
|
||||
return;
|
||||
}
|
||||
|
||||
let filtered = groupNames;
|
||||
if (state.searchText) {
|
||||
filtered = groupNames.filter(g =>
|
||||
g.toLowerCase().includes(state.searchText) ||
|
||||
(state.groups[g] || []).some(n => n.toLowerCase().includes(state.searchText))
|
||||
);
|
||||
}
|
||||
|
||||
container.innerHTML = "";
|
||||
for (const groupName of filtered) {
|
||||
const nodes = state.groups[groupName] || [];
|
||||
|
||||
const section = document.createElement("div");
|
||||
section.className = "wfm-nlp-group-section";
|
||||
|
||||
const header = document.createElement("div");
|
||||
header.className = "wfm-nlp-group-header";
|
||||
header.innerHTML = `<span>${esc(groupName)}</span> <span class="wfm-nlp-badge">${nodes.length}</span>`;
|
||||
header.addEventListener("click", () => {
|
||||
const list = section.querySelector(".wfm-nlp-group-list");
|
||||
list.style.display = list.style.display === "none" ? "block" : "none";
|
||||
header.classList.toggle("collapsed");
|
||||
});
|
||||
section.appendChild(header);
|
||||
|
||||
const list = document.createElement("div");
|
||||
list.className = "wfm-nlp-group-list";
|
||||
for (const nodeName of nodes) {
|
||||
const el = createDraggableItem(nodeName, "single", { classType: nodeName });
|
||||
el.addEventListener("dblclick", () => placeSingleNode(nodeName));
|
||||
list.appendChild(el);
|
||||
}
|
||||
section.appendChild(list);
|
||||
container.appendChild(section);
|
||||
}
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// Draggable item factory
|
||||
// ============================================
|
||||
|
||||
const createDraggableItem = (label, type, data, subtitle) => {
|
||||
const el = document.createElement("div");
|
||||
el.className = "wfm-nlp-item";
|
||||
el.draggable = true;
|
||||
el.innerHTML = `
|
||||
<div class="wfm-nlp-item-label">${label}</div>
|
||||
${subtitle ? `<div class="wfm-nlp-item-sub">${esc(subtitle)}</div>` : ""}
|
||||
`;
|
||||
|
||||
el.addEventListener("dragstart", (e) => {
|
||||
e.dataTransfer.effectAllowed = "copy";
|
||||
e.dataTransfer.setData("application/x-wfm-node", JSON.stringify({ type, ...data }));
|
||||
el.classList.add("dragging");
|
||||
});
|
||||
|
||||
el.addEventListener("dragend", () => {
|
||||
el.classList.remove("dragging");
|
||||
});
|
||||
|
||||
return el;
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// Toggle & exports
|
||||
// ============================================
|
||||
|
||||
export const togglePanel = async () => {
|
||||
const panel = createPanel();
|
||||
state.visible = !state.visible;
|
||||
panel.style.display = state.visible ? "flex" : "none";
|
||||
|
||||
if (state.visible && !state.loaded) {
|
||||
await loadData();
|
||||
renderContent();
|
||||
}
|
||||
|
||||
installCanvasDropHandler();
|
||||
};
|
||||
|
||||
export const getNodeSetsIcon = () => `
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
|
||||
<rect x="3" y="3" width="7" height="7" rx="1"/>
|
||||
<rect x="14" y="3" width="7" height="7" rx="1"/>
|
||||
<rect x="3" y="14" width="7" height="7" rx="1"/>
|
||||
<path d="M17.5 14v7M14 17.5h7"/>
|
||||
</svg>
|
||||
`;
|
||||
|
||||
// ============================================
|
||||
// Toast
|
||||
// ============================================
|
||||
|
||||
const showToast = (message, type = "info") => {
|
||||
const existing = document.getElementById("wfm-ns-toast");
|
||||
if (existing) existing.remove();
|
||||
|
||||
const toast = document.createElement("div");
|
||||
toast.id = "wfm-ns-toast";
|
||||
const colors = {
|
||||
success: { bg: "rgba(46,213,115,0.95)" },
|
||||
error: { bg: "rgba(255,71,87,0.95)" },
|
||||
info: { bg: "rgba(74,158,255,0.95)" },
|
||||
};
|
||||
Object.assign(toast.style, {
|
||||
position: "fixed", bottom: "24px", left: "50%", transform: "translateX(-50%)",
|
||||
padding: "10px 24px", background: (colors[type] || colors.info).bg, color: "#fff",
|
||||
borderRadius: "8px", fontSize: "14px", fontWeight: "500", zIndex: "99999",
|
||||
boxShadow: "0 4px 16px rgba(0,0,0,0.3)", transition: "opacity 0.3s", whiteSpace: "nowrap",
|
||||
});
|
||||
toast.textContent = message;
|
||||
document.body.appendChild(toast);
|
||||
setTimeout(() => { toast.style.opacity = "0"; setTimeout(() => toast.remove(), 300); }, 3000);
|
||||
};
|
||||
|
||||
const esc = (s) => s ? String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """) : "";
|
||||
|
||||
// ============================================
|
||||
// Save selected nodes as Node Set (context menu)
|
||||
// ============================================
|
||||
|
||||
export const saveSelectedAsNodeSet = async () => {
|
||||
const selectedNodes = Object.values(app.canvas.selected_nodes || {});
|
||||
if (selectedNodes.length === 0) {
|
||||
showToast("Select at least one node first", "error");
|
||||
return;
|
||||
}
|
||||
|
||||
// Prompt for name
|
||||
const name = prompt("Node Set name:");
|
||||
if (!name || !name.trim()) return;
|
||||
|
||||
// Build node list with relative positions
|
||||
// Use the top-left of the bounding box as origin
|
||||
const minX = Math.min(...selectedNodes.map(n => n.pos[0]));
|
||||
const minY = Math.min(...selectedNodes.map(n => n.pos[1]));
|
||||
|
||||
const nodeIdToIndex = new Map();
|
||||
const nodes = [];
|
||||
selectedNodes.forEach((node, i) => {
|
||||
nodeIdToIndex.set(node.id, i);
|
||||
nodes.push({
|
||||
class_type: node.type || node.comfyClass || "",
|
||||
title: node.title || "",
|
||||
rel_pos: [Math.round(node.pos[0] - minX), Math.round(node.pos[1] - minY)],
|
||||
});
|
||||
});
|
||||
|
||||
// Extract links between selected nodes
|
||||
const links = [];
|
||||
const graph = app.graph;
|
||||
|
||||
for (const node of selectedNodes) {
|
||||
if (!node.inputs) continue;
|
||||
for (let slotIdx = 0; slotIdx < node.inputs.length; slotIdx++) {
|
||||
const input = node.inputs[slotIdx];
|
||||
if (input.link == null) continue;
|
||||
|
||||
// Resolve link data
|
||||
let linkData = null;
|
||||
if (graph.links instanceof Map) {
|
||||
linkData = graph.links.get(input.link);
|
||||
} else if (graph.links) {
|
||||
linkData = graph.links[input.link];
|
||||
}
|
||||
if (!linkData) continue;
|
||||
|
||||
// linkData: [id, origin_id, origin_slot, target_id, target_slot, type]
|
||||
// or object with .origin_id, .origin_slot, etc.
|
||||
const originId = linkData.origin_id ?? linkData[1];
|
||||
const originSlot = linkData.origin_slot ?? linkData[2];
|
||||
const targetSlot = linkData.target_slot ?? linkData[4];
|
||||
|
||||
// Only include if both source and target are in the selection
|
||||
if (nodeIdToIndex.has(originId) && nodeIdToIndex.has(node.id)) {
|
||||
links.push({
|
||||
from_node: nodeIdToIndex.get(originId),
|
||||
from_slot: originSlot,
|
||||
to_node: nodeIdToIndex.get(node.id),
|
||||
to_slot: targetSlot,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Save via API
|
||||
try {
|
||||
const res = await fetch("/api/wfm/node-sets", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ name: name.trim(), description: "", tags: [], nodes, links }),
|
||||
});
|
||||
const result = await res.json();
|
||||
if (result.status === "ok") {
|
||||
showToast(`Node Set "${name.trim()}" saved (${nodes.length} nodes, ${links.length} links)`, "success");
|
||||
// Refresh sidebar if open
|
||||
if (state.loaded) {
|
||||
await loadData();
|
||||
renderContent();
|
||||
}
|
||||
} else {
|
||||
showToast("Failed to save: " + (result.error || "Unknown error"), "error");
|
||||
}
|
||||
} catch (err) {
|
||||
showToast("Failed to save: " + err.message, "error");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// ============================================
|
||||
// Styles
|
||||
// ============================================
|
||||
|
||||
const injectStyles = () => {
|
||||
if (document.getElementById("wfm-nlp-styles")) return;
|
||||
const style = document.createElement("style");
|
||||
style.id = "wfm-nlp-styles";
|
||||
style.textContent = `
|
||||
#${PANEL_ID} {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 280px;
|
||||
height: 100vh;
|
||||
background: var(--comfy-menu-bg, #1e1e1e);
|
||||
border-left: 1px solid var(--border-color, #4e4e4e);
|
||||
z-index: 9999;
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
font-family: sans-serif;
|
||||
font-size: 13px;
|
||||
color: var(--input-text, #ddd);
|
||||
box-shadow: -4px 0 16px rgba(0,0,0,0.3);
|
||||
}
|
||||
.wfm-nlp-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 10px 12px;
|
||||
border-bottom: 1px solid var(--border-color, #4e4e4e);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.wfm-nlp-title {
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
flex: 1;
|
||||
}
|
||||
.wfm-nlp-close {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--input-text, #ddd);
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
padding: 0 4px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
.wfm-nlp-close:hover { opacity: 1; }
|
||||
.wfm-nlp-tabs {
|
||||
display: flex;
|
||||
border-bottom: 1px solid var(--border-color, #4e4e4e);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.wfm-nlp-tab {
|
||||
flex: 1;
|
||||
padding: 8px 4px;
|
||||
background: none;
|
||||
border: none;
|
||||
border-bottom: 2px solid transparent;
|
||||
color: var(--input-text, #ddd);
|
||||
font-size: 11px;
|
||||
cursor: pointer;
|
||||
opacity: 0.6;
|
||||
transition: all 0.15s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.wfm-nlp-tab:hover { opacity: 0.9; }
|
||||
.wfm-nlp-tab.active {
|
||||
opacity: 1;
|
||||
border-bottom-color: var(--p-button-background, #4a9eff);
|
||||
}
|
||||
.wfm-nlp-search {
|
||||
padding: 8px;
|
||||
border-bottom: 1px solid var(--border-color, #4e4e4e);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.wfm-nlp-search-input {
|
||||
width: 100%;
|
||||
padding: 6px 8px;
|
||||
background: var(--comfy-input-bg, #2a2a2a);
|
||||
border: 1px solid var(--border-color, #4e4e4e);
|
||||
border-radius: 4px;
|
||||
color: var(--input-text, #ddd);
|
||||
font-size: 12px;
|
||||
outline: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.wfm-nlp-search-input:focus {
|
||||
border-color: var(--p-button-background, #4a9eff);
|
||||
}
|
||||
.wfm-nlp-content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 4px 0;
|
||||
}
|
||||
.wfm-nlp-empty {
|
||||
padding: 24px 16px;
|
||||
text-align: center;
|
||||
color: var(--descrip-text, #999);
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.wfm-nlp-item {
|
||||
padding: 7px 12px;
|
||||
cursor: grab;
|
||||
border-bottom: 1px solid var(--border-color, #3a3a3a);
|
||||
transition: background 0.12s;
|
||||
user-select: none;
|
||||
}
|
||||
.wfm-nlp-item:hover {
|
||||
background: var(--comfy-input-bg, #333);
|
||||
}
|
||||
.wfm-nlp-item.dragging {
|
||||
opacity: 0.5;
|
||||
background: var(--comfy-input-bg, #333);
|
||||
}
|
||||
.wfm-nlp-item-label {
|
||||
font-size: 12px;
|
||||
line-height: 1.3;
|
||||
}
|
||||
.wfm-nlp-item-sub {
|
||||
font-size: 10px;
|
||||
color: var(--descrip-text, #888);
|
||||
margin-top: 2px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.wfm-nlp-badge {
|
||||
display: inline-block;
|
||||
font-size: 10px;
|
||||
padding: 1px 5px;
|
||||
background: var(--comfy-input-bg, #444);
|
||||
border-radius: 3px;
|
||||
color: var(--descrip-text, #aaa);
|
||||
margin-left: 4px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.wfm-nlp-group-section {
|
||||
border-bottom: 1px solid var(--border-color, #3a3a3a);
|
||||
}
|
||||
.wfm-nlp-group-header {
|
||||
padding: 8px 12px;
|
||||
cursor: pointer;
|
||||
font-weight: 500;
|
||||
font-size: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
transition: background 0.12s;
|
||||
}
|
||||
.wfm-nlp-group-header:hover {
|
||||
background: var(--comfy-input-bg, #333);
|
||||
}
|
||||
.wfm-nlp-group-header::before {
|
||||
content: "\\25BC";
|
||||
font-size: 8px;
|
||||
margin-right: 6px;
|
||||
transition: transform 0.15s;
|
||||
}
|
||||
.wfm-nlp-group-header.collapsed::before {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
.wfm-nlp-group-list {
|
||||
padding-left: 8px;
|
||||
}
|
||||
.wfm-nlp-group-list .wfm-nlp-item {
|
||||
padding: 5px 12px;
|
||||
font-size: 11px;
|
||||
}
|
||||
.wfm-nlp-refresh {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--input-text, #ddd);
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
opacity: 0.7;
|
||||
}
|
||||
.wfm-nlp-refresh:hover { opacity: 1; }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
};
|
||||
|
||||
+154
-101
@@ -1,4 +1,5 @@
|
||||
import { app } from "../../scripts/app.js";
|
||||
import { togglePanel, getNodeSetsIcon, NODE_SETS_TOOLTIP, saveSelectedAsNodeSet } from "./node_sets_menu.js";
|
||||
|
||||
const BUTTON_TOOLTIP = "Launch Workflow Studio (Shift+Click opens in new window)";
|
||||
const SNAPSHOT_TOOLTIP = "Save workflow canvas image as thumbnail";
|
||||
@@ -383,15 +384,47 @@ const createSnapshotButton = async () => {
|
||||
return button;
|
||||
};
|
||||
|
||||
const createNodeSetsButton = async () => {
|
||||
const { ComfyButton } = await import("../../scripts/ui/components/button.js");
|
||||
|
||||
const button = new ComfyButton({
|
||||
icon: "node-sets",
|
||||
tooltip: NODE_SETS_TOOLTIP,
|
||||
app,
|
||||
enabled: true,
|
||||
classList: "comfyui-button comfyui-menu-mobile-collapse wfm-node-sets-btn",
|
||||
});
|
||||
|
||||
button.element.setAttribute("aria-label", NODE_SETS_TOOLTIP);
|
||||
button.element.title = NODE_SETS_TOOLTIP;
|
||||
|
||||
if (button.iconElement) {
|
||||
button.iconElement.innerHTML = getNodeSetsIcon();
|
||||
button.iconElement.style.width = "1.2rem";
|
||||
button.iconElement.style.height = "1.2rem";
|
||||
}
|
||||
|
||||
button.element.addEventListener("click", (e) => {
|
||||
e.stopPropagation();
|
||||
togglePanel();
|
||||
});
|
||||
|
||||
return button;
|
||||
};
|
||||
|
||||
const attachTopMenuButton = async (attempt = 0) => {
|
||||
if (document.querySelector(`.${BUTTON_GROUP_CLASS}`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Try settingsGroup first (legacy ComfyUI)
|
||||
const settingsGroup = app.menu?.settingsGroup;
|
||||
if (!settingsGroup?.element?.parentElement) {
|
||||
// Fallback: find the legacy topbar container used by newer ComfyUI
|
||||
const legacyContainer = document.querySelector('[data-testid="legacy-topbar-container"] .flex');
|
||||
|
||||
if (!settingsGroup?.element?.parentElement && !legacyContainer) {
|
||||
if (attempt >= MAX_ATTACH_ATTEMPTS) {
|
||||
console.warn("Workflow Studio: unable to locate the ComfyUI settings button group.");
|
||||
console.warn("Workflow Studio: unable to locate the ComfyUI menu container.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -401,109 +434,129 @@ const attachTopMenuButton = async (attempt = 0) => {
|
||||
|
||||
const wfmButton = await createTopMenuButton();
|
||||
const snapshotButton = await createSnapshotButton();
|
||||
const nodeSetsButton = await createNodeSetsButton();
|
||||
const { ComfyButtonGroup } = await import("../../scripts/ui/components/buttonGroup.js");
|
||||
|
||||
const buttonGroup = new ComfyButtonGroup(wfmButton, snapshotButton);
|
||||
const buttonGroup = new ComfyButtonGroup(wfmButton, snapshotButton, nodeSetsButton);
|
||||
buttonGroup.element.classList.add(BUTTON_GROUP_CLASS);
|
||||
|
||||
settingsGroup.element.before(buttonGroup.element);
|
||||
};
|
||||
|
||||
const createExtensionObject = (useActionBar) => {
|
||||
const extensionObj = {
|
||||
name: "WorkflowStudio.TopMenu",
|
||||
async setup() {
|
||||
if (!useActionBar) {
|
||||
console.log("Workflow Studio: using legacy button attachment (frontend version < 1.33.9)");
|
||||
await attachTopMenuButton();
|
||||
} else {
|
||||
console.log("Workflow Studio: using actionBarButtons API (frontend version >= 1.33.9)");
|
||||
}
|
||||
|
||||
const injectStyles = () => {
|
||||
const styleId = "wfm-top-menu-button-styles";
|
||||
if (document.getElementById(styleId)) return;
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.id = styleId;
|
||||
style.textContent = `
|
||||
button[aria-label="${BUTTON_TOOLTIP}"].wfm-top-menu-button {
|
||||
transition: all 0.2s ease;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
button[aria-label="${BUTTON_TOOLTIP}"].wfm-top-menu-button:hover {
|
||||
background-color: var(--primary-hover-bg) !important;
|
||||
}
|
||||
button[aria-label="${SNAPSHOT_TOOLTIP}"].wfm-snapshot-button {
|
||||
transition: all 0.2s ease;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
button[aria-label="${SNAPSHOT_TOOLTIP}"].wfm-snapshot-button:hover {
|
||||
background-color: var(--primary-hover-bg) !important;
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
};
|
||||
injectStyles();
|
||||
|
||||
const replaceButtonIcon = () => {
|
||||
// WFM launch button
|
||||
const wfmButtons = document.querySelectorAll(`button[aria-label="${BUTTON_TOOLTIP}"]`);
|
||||
wfmButtons.forEach((button) => {
|
||||
button.classList.add("wfm-top-menu-button");
|
||||
button.innerHTML = getWfmIcon();
|
||||
button.style.borderRadius = "4px";
|
||||
button.style.padding = "6px";
|
||||
button.style.backgroundColor = "var(--primary-bg)";
|
||||
const svg = button.querySelector("svg");
|
||||
if (svg) {
|
||||
svg.style.width = "20px";
|
||||
svg.style.height = "20px";
|
||||
}
|
||||
});
|
||||
|
||||
// Snapshot button
|
||||
const snapButtons = document.querySelectorAll(`button[aria-label="${SNAPSHOT_TOOLTIP}"]`);
|
||||
snapButtons.forEach((button) => {
|
||||
button.classList.add("wfm-snapshot-button");
|
||||
button.innerHTML = getSnapshotIcon();
|
||||
button.style.borderRadius = "4px";
|
||||
button.style.padding = "6px";
|
||||
const svg = button.querySelector("svg");
|
||||
if (svg) {
|
||||
svg.style.width = "20px";
|
||||
svg.style.height = "20px";
|
||||
}
|
||||
});
|
||||
|
||||
if (wfmButtons.length === 0) {
|
||||
requestAnimationFrame(replaceButtonIcon);
|
||||
}
|
||||
};
|
||||
requestAnimationFrame(replaceButtonIcon);
|
||||
},
|
||||
};
|
||||
|
||||
if (useActionBar) {
|
||||
extensionObj.actionBarButtons = [
|
||||
{
|
||||
icon: "icon-[mdi--file-document-multiple] size-4",
|
||||
tooltip: BUTTON_TOOLTIP,
|
||||
onClick: openWorkflowStudio,
|
||||
},
|
||||
{
|
||||
icon: "icon-[mdi--camera] size-4",
|
||||
tooltip: SNAPSHOT_TOOLTIP,
|
||||
onClick: saveCanvasToWorkflowStudio,
|
||||
},
|
||||
];
|
||||
if (settingsGroup?.element?.parentElement) {
|
||||
settingsGroup.element.before(buttonGroup.element);
|
||||
} else if (legacyContainer) {
|
||||
legacyContainer.prepend(buttonGroup.element);
|
||||
}
|
||||
|
||||
return extensionObj;
|
||||
};
|
||||
|
||||
(async () => {
|
||||
const useActionBar = await supportsActionBarButtons();
|
||||
const extensionObj = createExtensionObject(useActionBar);
|
||||
app.registerExtension(extensionObj);
|
||||
})();
|
||||
app.registerExtension({
|
||||
name: "WorkflowStudio.TopMenu",
|
||||
actionBarButtons: [
|
||||
{
|
||||
icon: "icon-[mdi--file-document-multiple] size-4",
|
||||
tooltip: BUTTON_TOOLTIP,
|
||||
onClick: openWorkflowStudio,
|
||||
},
|
||||
{
|
||||
icon: "icon-[mdi--camera] size-4",
|
||||
tooltip: SNAPSHOT_TOOLTIP,
|
||||
onClick: saveCanvasToWorkflowStudio,
|
||||
},
|
||||
{
|
||||
icon: "icon-[mdi--view-grid-plus] size-4",
|
||||
tooltip: NODE_SETS_TOOLTIP,
|
||||
onClick: () => togglePanel(),
|
||||
},
|
||||
],
|
||||
beforeRegisterNodeDef(nodeType, _nodeData, _app) {
|
||||
const origGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions;
|
||||
nodeType.prototype.getExtraMenuOptions = function (_, options) {
|
||||
origGetExtraMenuOptions?.apply(this, arguments);
|
||||
const selectedCount = Object.keys(app.canvas.selected_nodes || {}).length;
|
||||
options.push(null);
|
||||
options.push({
|
||||
content: `Save as Node Set${selectedCount > 1 ? ` (${selectedCount} nodes)` : ""}`,
|
||||
callback: saveSelectedAsNodeSet,
|
||||
});
|
||||
};
|
||||
},
|
||||
async setup() {
|
||||
const injectStyles = () => {
|
||||
const styleId = "wfm-top-menu-button-styles";
|
||||
if (document.getElementById(styleId)) return;
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.id = styleId;
|
||||
style.textContent = `
|
||||
button[aria-label="${BUTTON_TOOLTIP}"].wfm-top-menu-button {
|
||||
transition: all 0.2s ease;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
button[aria-label="${BUTTON_TOOLTIP}"].wfm-top-menu-button:hover {
|
||||
background-color: var(--primary-hover-bg) !important;
|
||||
}
|
||||
button[aria-label="${SNAPSHOT_TOOLTIP}"].wfm-snapshot-button {
|
||||
transition: all 0.2s ease;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
button[aria-label="${SNAPSHOT_TOOLTIP}"].wfm-snapshot-button:hover {
|
||||
background-color: var(--primary-hover-bg) !important;
|
||||
}
|
||||
button[aria-label="${NODE_SETS_TOOLTIP}"].wfm-node-sets-btn {
|
||||
transition: all 0.2s ease;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
button[aria-label="${NODE_SETS_TOOLTIP}"].wfm-node-sets-btn:hover {
|
||||
background-color: var(--primary-hover-bg) !important;
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
};
|
||||
injectStyles();
|
||||
|
||||
const replaceButtonIcon = () => {
|
||||
const wfmButtons = document.querySelectorAll(`button[aria-label="${BUTTON_TOOLTIP}"]`);
|
||||
wfmButtons.forEach((button) => {
|
||||
button.classList.add("wfm-top-menu-button");
|
||||
button.innerHTML = getWfmIcon();
|
||||
button.style.borderRadius = "4px";
|
||||
button.style.padding = "6px";
|
||||
button.style.backgroundColor = "var(--primary-bg)";
|
||||
const svg = button.querySelector("svg");
|
||||
if (svg) {
|
||||
svg.style.width = "20px";
|
||||
svg.style.height = "20px";
|
||||
}
|
||||
});
|
||||
|
||||
const snapButtons = document.querySelectorAll(`button[aria-label="${SNAPSHOT_TOOLTIP}"]`);
|
||||
snapButtons.forEach((button) => {
|
||||
button.classList.add("wfm-snapshot-button");
|
||||
button.innerHTML = getSnapshotIcon();
|
||||
button.style.borderRadius = "4px";
|
||||
button.style.padding = "6px";
|
||||
const svg = button.querySelector("svg");
|
||||
if (svg) {
|
||||
svg.style.width = "20px";
|
||||
svg.style.height = "20px";
|
||||
}
|
||||
});
|
||||
|
||||
const nsButtons = document.querySelectorAll(`button[aria-label="${NODE_SETS_TOOLTIP}"]`);
|
||||
nsButtons.forEach((button) => {
|
||||
button.classList.add("wfm-node-sets-btn");
|
||||
button.innerHTML = getNodeSetsIcon();
|
||||
button.style.borderRadius = "4px";
|
||||
button.style.padding = "6px";
|
||||
const svg = button.querySelector("svg");
|
||||
if (svg) {
|
||||
svg.style.width = "20px";
|
||||
svg.style.height = "20px";
|
||||
}
|
||||
});
|
||||
|
||||
if (wfmButtons.length === 0) {
|
||||
requestAnimationFrame(replaceButtonIcon);
|
||||
}
|
||||
};
|
||||
requestAnimationFrame(replaceButtonIcon);
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user