init
Some checks are pending
Publish to Comfy registry / Publish Custom Node to registry (push) Waiting to run
1
.agents/skills
Normal file
@ -0,0 +1 @@
|
|||||||
|
../.claude/skills
|
||||||
47
.claude/agents/code-simplifer.md
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
name: code-simplifier
|
||||||
|
description: Simplifies and refines code for clarity, consistency, and maintainability while preserving behavior. Focus on recently modified code unless instructed otherwise.
|
||||||
|
model: sonnet
|
||||||
|
tools: [Read, Write, Edit, Bash, Grep, Glob]
|
||||||
|
---
|
||||||
|
|
||||||
|
# Code Simplifier Agent
|
||||||
|
|
||||||
|
You simplify code while preserving functionality.
|
||||||
|
|
||||||
|
## Principles
|
||||||
|
|
||||||
|
1. clarity over cleverness
|
||||||
|
2. consistency with existing repo style
|
||||||
|
3. preserve behavior exactly
|
||||||
|
4. simplify only where the result is demonstrably easier to maintain
|
||||||
|
|
||||||
|
## Simplification Targets
|
||||||
|
|
||||||
|
### Structure
|
||||||
|
|
||||||
|
- extract deeply nested logic into named functions
|
||||||
|
- replace complex conditionals with early returns where clearer
|
||||||
|
- simplify callback chains with `async` / `await`
|
||||||
|
- remove dead code and unused imports
|
||||||
|
|
||||||
|
### Readability
|
||||||
|
|
||||||
|
- prefer descriptive names
|
||||||
|
- avoid nested ternaries
|
||||||
|
- break long chains into intermediate variables when it improves clarity
|
||||||
|
- use destructuring when it clarifies access
|
||||||
|
|
||||||
|
### Quality
|
||||||
|
|
||||||
|
- remove stray `console.log`
|
||||||
|
- remove commented-out code
|
||||||
|
- consolidate duplicated logic
|
||||||
|
- unwind over-abstracted single-use helpers
|
||||||
|
|
||||||
|
## Approach
|
||||||
|
|
||||||
|
1. read the changed files
|
||||||
|
2. identify simplification opportunities
|
||||||
|
3. apply only functionally equivalent changes
|
||||||
|
4. verify no behavioral change was introduced
|
||||||
88
.claude/agents/localize-review.md
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
---
|
||||||
|
name: localize-review
|
||||||
|
description: Review project localization setup. Use when auditing i18n configuration, checking locales folder structure, validating node localization completeness, or verifying frontend message key alignment between en/zh.
|
||||||
|
---
|
||||||
|
|
||||||
|
You are a localization reviewer for a ComfyUI custom node project with both Python backend and React frontend.
|
||||||
|
|
||||||
|
## Project Context
|
||||||
|
|
||||||
|
- Backend: Python nodes with `comfy_api.latest` (V3) API
|
||||||
|
- Frontend: React v19, bundled with Bun
|
||||||
|
- Frontend messages location: `frontend/messages/{en,zh}.json`
|
||||||
|
- Backend node definitions: `nodes/*.py`
|
||||||
|
|
||||||
|
## Review Checklist
|
||||||
|
|
||||||
|
### 1. Locales Folder Structure
|
||||||
|
|
||||||
|
Project root **must** contain `locales/` folder with at minimum:
|
||||||
|
|
||||||
|
| Language | nodeDefs.json | main.json | settings.json |
|
||||||
|
|----------|--------------|-----------|---------------|
|
||||||
|
| en/ | Optional | Optional | Optional |
|
||||||
|
| zh/ | ✅ Required | Optional | Optional |
|
||||||
|
|
||||||
|
- [ ] `locales/` folder exists at project root
|
||||||
|
- [ ] `locales/zh/nodeDefs.json` exists
|
||||||
|
|
||||||
|
### 2. nodeDefs.json Format
|
||||||
|
|
||||||
|
- [ ] JSON is valid (parseable)
|
||||||
|
- [ ] Node display names are localized
|
||||||
|
- [ ] Input tooltips are localized (if present in schema)
|
||||||
|
- [ ] Output display names are localized (if present in schema)
|
||||||
|
|
||||||
|
### 3. Backend Node Localization Completeness
|
||||||
|
|
||||||
|
For each registered node in `__init__.py` → `get_node_list()`:
|
||||||
|
|
||||||
|
- [ ] Node `display_name` localized
|
||||||
|
- [ ] Node `description` localized
|
||||||
|
- [ ] All inputs with `tooltip` have corresponding localization
|
||||||
|
- [ ] All outputs with `display_name` have corresponding localization
|
||||||
|
|
||||||
|
### 4. Frontend Messages Alignment
|
||||||
|
|
||||||
|
Location: `frontend/messages/en.json` and `frontend/messages/zh.json`
|
||||||
|
|
||||||
|
- [ ] Both files exist
|
||||||
|
- [ ] All top-level sections exist in both files
|
||||||
|
- [ ] All keys exist in both files (no missing keys in either language)
|
||||||
|
- [ ] Key count matches between en and zh
|
||||||
|
- [ ] `bun build` succeeds after any message file changes
|
||||||
|
|
||||||
|
### 5. Common Issues to Flag
|
||||||
|
|
||||||
|
- Missing `locales/` directory
|
||||||
|
- Incomplete key sets between language files
|
||||||
|
- Invalid JSON syntax
|
||||||
|
- Missing tooltip localizations for nodes that define them
|
||||||
|
- Build failures after message file edits
|
||||||
|
|
||||||
|
### 6. Quote Handling in Translations
|
||||||
|
|
||||||
|
JSON values must use double quotes, so when the translation itself contains double quotes:
|
||||||
|
- **Problem**: `"tooltip": "提示 \"文字\""` causes JSON parse failure
|
||||||
|
- **Solution**: Use single quotes for the inner quotes or escape them properly
|
||||||
|
- **Rule**: Always wrap translation strings in double quotes; if the translated text contains double quotes, escape them with `\\"` (JSON string escaping)
|
||||||
|
|
||||||
|
### 7. Key Synchronization Review
|
||||||
|
|
||||||
|
When reviewing translations, verify:
|
||||||
|
- [ ] No keys were renamed or removed without updating all locales
|
||||||
|
- [ ] No new keys added to one locale but missing from others
|
||||||
|
- [ ] Key count matches exactly between `en` and `zh` files
|
||||||
|
- [ ] Key order is consistent (aids debugging and diff review)
|
||||||
|
|
||||||
|
## Output
|
||||||
|
|
||||||
|
For each issue found, report:
|
||||||
|
1. **File & location**
|
||||||
|
2. **Severity**: Critical / Major / Minor
|
||||||
|
3. **Issue** description
|
||||||
|
4. **Suggested fix**
|
||||||
|
|
||||||
|
End with a brief summary table:
|
||||||
|
| Category | Item | Status |
|
||||||
|
|----------|------|--------|
|
||||||
51
.claude/agents/python-review.md
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
---
|
||||||
|
name: python-review
|
||||||
|
description: Review Python backend code. Use when auditing node definitions, checking ComfyUI V3 API compliance, reviewing execute() logic, or validating node schema correctness.
|
||||||
|
---
|
||||||
|
|
||||||
|
You are a Python code reviewer specializing in ComfyUI V3 custom node development.
|
||||||
|
|
||||||
|
## Project Context
|
||||||
|
|
||||||
|
- Backend: Python, using the `comfy_api.latest` (V3) API
|
||||||
|
- Node base class: `io.ComfyNode`
|
||||||
|
- Schema defined via `io.Schema` in `define_schema()`
|
||||||
|
- Extension class: `io.ComfyExtension`, entrypoint is `async def comfy_entrypoint()`
|
||||||
|
- Node registration via `get_node_list()` returning `list[type[io.ComfyNode]]`
|
||||||
|
|
||||||
|
## Review Checklist
|
||||||
|
|
||||||
|
### ComfyUI V3 API Compliance
|
||||||
|
- [ ] Node inherits from `io.ComfyNode`
|
||||||
|
- [ ] `define_schema()` is a `@classmethod` returning `io.Schema`
|
||||||
|
- [ ] `execute()` is a `@classmethod` returning `io.NodeOutput`
|
||||||
|
- [ ] `node_id` is unique and uses `PascalCase`
|
||||||
|
- [ ] `category` follows `EasyUse/<subcategory>` convention within `nodes/basic.py`
|
||||||
|
- [ ] Custom types use `io.Custom(io_type="TYPE_NAME")`
|
||||||
|
- [ ] Optional inputs use `io.*.Input(..., optional=True)`
|
||||||
|
- [ ] Extension class overrides `get_node_list()` with `@override`
|
||||||
|
- [ ] All node classes defined in `nodes/` are registered in `__init__.py` via `get_node_list()`
|
||||||
|
- [ ] New nodes added to `nodes/*.py` must be imported and included in the extension's `get_node_list()` method
|
||||||
|
|
||||||
|
### Python Quality
|
||||||
|
- [ ] No bare `except:` clauses — always catch specific exceptions
|
||||||
|
- [ ] No silently swallowed exceptions
|
||||||
|
- [ ] No mutable default arguments
|
||||||
|
- [ ] Type hints present on public methods
|
||||||
|
- [ ] No unused imports
|
||||||
|
- [ ] No `print()` debug statements left in production code (use logging)
|
||||||
|
|
||||||
|
### Security (OWASP)
|
||||||
|
- [ ] No `eval()` / `exec()` on untrusted input
|
||||||
|
- [ ] No path traversal via user-controlled file paths (use `pathlib.Path` and validate)
|
||||||
|
- [ ] No hardcoded credentials or secrets
|
||||||
|
- [ ] File I/O uses context managers (`with open(...)`)
|
||||||
|
|
||||||
|
### Output
|
||||||
|
For each issue found, report:
|
||||||
|
1. **File & line** (if known)
|
||||||
|
2. **Severity**: Critical / Major / Minor
|
||||||
|
3. **Issue** description
|
||||||
|
4. **Suggested fix** with code snippet
|
||||||
|
|
||||||
|
End with a brief summary table.
|
||||||
57
.claude/agents/react-review.md
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
---
|
||||||
|
name: react-review
|
||||||
|
description: Review React/TypeScript frontend code. Use when auditing components, checking shadcn/ui usage, reviewing hooks, validating TypeScript strictness, or auditing ComfyUI frontend extension patterns.
|
||||||
|
---
|
||||||
|
|
||||||
|
You are a React/TypeScript code reviewer specializing in ComfyUI frontend extensions.
|
||||||
|
|
||||||
|
## Project Context
|
||||||
|
|
||||||
|
- **Framework**: React v19, functional components only
|
||||||
|
- **UI Library**: shadcn/ui + Tailwind CSS v4
|
||||||
|
- **Icons**: Lucide
|
||||||
|
- **Build**: Bun + `build.ts`
|
||||||
|
- **Testing**: Vitest
|
||||||
|
- **Import alias**: `@/*` maps to `src/`
|
||||||
|
- **File naming**: `PascalCase.tsx` for components, `kebab-case.ts` for modules
|
||||||
|
|
||||||
|
## Review Checklist
|
||||||
|
|
||||||
|
### React / TypeScript
|
||||||
|
- [ ] Only functional components with hooks — no class components
|
||||||
|
- [ ] No `any` type without explicit justification
|
||||||
|
- [ ] Strict TypeScript: no implicit `any`, no non-null assertions without reason
|
||||||
|
- [ ] Props interfaces defined (not inline `{}` type)
|
||||||
|
- [ ] `useEffect` has correct dependency arrays — no missing/extra deps
|
||||||
|
- [ ] No state updates after unmount (use cleanup in `useEffect`)
|
||||||
|
- [ ] `key` props on list items use stable IDs, not array index (unless list is static)
|
||||||
|
- [ ] Expensive computations wrapped in `useMemo` / `useCallback` where appropriate
|
||||||
|
|
||||||
|
### shadcn/ui Compliance
|
||||||
|
- [ ] Use shadcn/ui equivalents: `<Button>`, `<Input>`, `<Textarea>`, `<Select>`
|
||||||
|
- [ ] Exception: files inside `src/components/ui/**` (the primitives themselves)
|
||||||
|
- [ ] Tailwind classes use v4 syntax (CSS variables, not `tailwind.config.js` theme keys)
|
||||||
|
|
||||||
|
### ComfyUI Frontend Extension
|
||||||
|
- [ ] Custom widgets registered correctly via ComfyUI extension hooks
|
||||||
|
- [ ] No direct DOM manipulation outside of widget canvas integrations
|
||||||
|
- [ ] Event listeners cleaned up on component unmount
|
||||||
|
|
||||||
|
### Error Handling
|
||||||
|
- [ ] API calls have try/catch or `.catch()` handlers
|
||||||
|
- [ ] User-facing errors show meaningful messages (not raw error objects)
|
||||||
|
- [ ] No silent `catch(() => {})` swallowing
|
||||||
|
|
||||||
|
### Security
|
||||||
|
- [ ] No `dangerouslySetInnerHTML` with unsanitized content
|
||||||
|
- [ ] No `eval()` or `new Function()` with user input
|
||||||
|
- [ ] Sensitive data not stored in `localStorage` without justification
|
||||||
|
|
||||||
|
### Output
|
||||||
|
For each issue found, report:
|
||||||
|
1. **File & line** (if known)
|
||||||
|
2. **Severity**: Critical / Major / Minor
|
||||||
|
3. **Issue** description
|
||||||
|
4. **Suggested fix** with code snippet
|
||||||
|
|
||||||
|
End with a brief summary table.
|
||||||
203
.claude/skills/comfyui-node-i18n/SKILL.md
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
---
|
||||||
|
name: comfyui-node-i18n
|
||||||
|
description: ComfyUI node internationalization - locales structure, nodeDefs.json, settings.json, main.json for translations. Use when adding i18n support to custom nodes.
|
||||||
|
---
|
||||||
|
|
||||||
|
# ComfyUI Node Internationalization (i18n)
|
||||||
|
|
||||||
|
ComfyUI supports localization of node names, descriptions, input/output labels, and settings through a structured `locales` directory system.
|
||||||
|
|
||||||
|
## Directory Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
your_node_package/
|
||||||
|
└── locales/
|
||||||
|
├── en/
|
||||||
|
│ ├── main.json
|
||||||
|
│ ├── nodeDefs.json
|
||||||
|
│ └── settings.json (optional)
|
||||||
|
├── zh/
|
||||||
|
│ ├── main.json
|
||||||
|
│ ├── nodeDefs.json
|
||||||
|
│ └── settings.json (optional)
|
||||||
|
└── zh-TW/
|
||||||
|
└── ...
|
||||||
|
```
|
||||||
|
|
||||||
|
## Translation Files
|
||||||
|
|
||||||
|
### nodeDefs.json — Node Definitions
|
||||||
|
|
||||||
|
Translate node display names, descriptions, and I/O labels:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"imageBrightness": {
|
||||||
|
"display_name": "Localized Node Name",
|
||||||
|
"description": "Localized node description text",
|
||||||
|
"inputs": {
|
||||||
|
"text": {
|
||||||
|
"name": "Text Input",
|
||||||
|
"tooltip": "Tooltip shown on hover"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": {
|
||||||
|
"0": {
|
||||||
|
"name": "Output Image"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Keys:**
|
||||||
|
— Notice: key using `node_id` value`"imageBrightness"`not className when className not same as node_id.
|
||||||
|
- `display_name` — Translated node name in menu
|
||||||
|
- `description` — Translated tooltip/description
|
||||||
|
- `inputs.<input_id>.name` — Input label
|
||||||
|
- `inputs.<input_id>.tooltip` — Input hover tooltip
|
||||||
|
- `outputs.<index>.name` — Output label (use numeric index, not name)
|
||||||
|
|
||||||
|
### main.json — General Translations
|
||||||
|
|
||||||
|
Category names, settings categories, and common strings:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"categories": {
|
||||||
|
"MyNodes": "My Nodes Category"
|
||||||
|
},
|
||||||
|
"settingsCategories": {
|
||||||
|
"MyExtension": "My Extension Settings"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### settings.json — Settings Interface
|
||||||
|
|
||||||
|
Translate settings UI elements:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"MyExtension_EnableDebug": {
|
||||||
|
"name": "Enable Debug Mode",
|
||||||
|
"tooltip": "Show debug information in console"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** Settings ID uses `_` instead of `.` (e.g., `MyExt.setting` becomes `MyExt_setting`).
|
||||||
|
|
||||||
|
## Python Node Structure (V3)
|
||||||
|
|
||||||
|
Keep node code in English, translations override display via locales:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from comfy_api.latest import io
|
||||||
|
|
||||||
|
class ImageBrightness(io.ComfyNode):
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return io.Schema(
|
||||||
|
node_id="imageBrightness",
|
||||||
|
display_name="Brighten Image", # overridden by locales/zh/nodeDefs.json
|
||||||
|
category="image/adjust",
|
||||||
|
description="Adjusts image brightness by a factor",
|
||||||
|
inputs=[
|
||||||
|
io.Image.Input("image"),
|
||||||
|
io.Float.Input("factor", default=1.0, min=0.0, max=3.0),
|
||||||
|
],
|
||||||
|
outputs=[io.Image.Output("IMAGE")],
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, image, factor):
|
||||||
|
result = clamp(image * factor, 0.0, 1.0)
|
||||||
|
return io.NodeOutput(result)
|
||||||
|
```
|
||||||
|
|
||||||
|
The `display_name` in schema is the fallback; `nodeDefs.json` translations take precedence.
|
||||||
|
|
||||||
|
| Code | Language |
|
||||||
|
|------|----------|
|
||||||
|
| en | English (fallback) |
|
||||||
|
| zh | Simplified Chinese |
|
||||||
|
| zh-TW | Traditional Chinese |
|
||||||
|
| fr | French |
|
||||||
|
| ko | Korean |
|
||||||
|
| ru | Russian |
|
||||||
|
| es | Spanish |
|
||||||
|
| ja | Japanese |
|
||||||
|
| ar | Arabic |
|
||||||
|
|
||||||
|
## Example: Complete Setup
|
||||||
|
|
||||||
|
### locales/en/nodeDefs.json
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"imageBrightness": {
|
||||||
|
"display_name": "Brighten Image",
|
||||||
|
"description": "Adjusts image brightness by a factor",
|
||||||
|
"inputs": {
|
||||||
|
"image": {
|
||||||
|
"name": "Image",
|
||||||
|
"tooltip": "The input image to brighten"
|
||||||
|
},
|
||||||
|
"factor": {
|
||||||
|
"name": "Factor",
|
||||||
|
"tooltip": "Brightness multiplier (0.0-3.0)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": {
|
||||||
|
"0": {
|
||||||
|
"name": "Image"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### locales/zh/nodeDefs.json
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"imageBrightness": {
|
||||||
|
"display_name": "图像增强",
|
||||||
|
"description": "通过系数调整图像亮度",
|
||||||
|
"inputs": {
|
||||||
|
"image": {
|
||||||
|
"name": "图像",
|
||||||
|
"tooltip": "要增强的输入图像"
|
||||||
|
},
|
||||||
|
"factor": {
|
||||||
|
"name": "系数",
|
||||||
|
"tooltip": "亮度倍增器 (0.0-3.0)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": {
|
||||||
|
"0": {
|
||||||
|
"name": "图像"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### locales/zh/main.json
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"categories": {
|
||||||
|
"I18n Demo": "国际化演示"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Best Practices
|
||||||
|
|
||||||
|
1. **Keep code in English** — Node IDs, class names, and logic stay in English
|
||||||
|
2. **Use fallback first** — Place English translations in `en/` as the fallback
|
||||||
|
3. **Consistent key naming** — Match keys exactly with Python class names
|
||||||
|
4. **Output indices not names** — Use `"0"`, `"1"`, etc. for output translations
|
||||||
|
5. **Settings ID transformation** — Replace `.` with `_` in settings keys
|
||||||
458
.claude/skills/comfyui-react-widget/SKILL.md
Normal file
@ -0,0 +1,458 @@
|
|||||||
|
---
|
||||||
|
name: comfyui-react-widget
|
||||||
|
description: Create React widgets in ComfyUI custom nodes. Covers createReactWidget wrapping, two-way data binding, render synchronization, extension registration, and component authoring conventions. Use when building new React widgets, debugging rendering issues, or registering custom widget types.
|
||||||
|
---
|
||||||
|
|
||||||
|
# ComfyUI React Widget
|
||||||
|
|
||||||
|
This project uses the `createReactWidget` factory function to mount React components as ComfyUI DOM widgets. This document describes how the entire mechanism works, key considerations, and complete examples.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Architecture Overview
|
||||||
|
|
||||||
|
```
|
||||||
|
ComfyUI (LGraphNode)
|
||||||
|
└── addDOMWidget(name, type, container, options)
|
||||||
|
└── container (HTMLDivElement)
|
||||||
|
└── React Root (createRoot)
|
||||||
|
└── <YourWidget value={...} onChange={...} />
|
||||||
|
```
|
||||||
|
|
||||||
|
- **currentValue** — Always stored as a JSON string for ComfyUI serialization/deserialization
|
||||||
|
- **render()** — Called on every value change, passing the latest props to the React Root
|
||||||
|
- **getValue / setValue** — ComfyUI calls these hooks to sync node values
|
||||||
|
- **serializeValue** — Called when ComfyUI builds the API payload, returns currentValue
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Core Files
|
||||||
|
|
||||||
|
| File | Responsibility |
|
||||||
|
|------|----------------|
|
||||||
|
| `src/lib/create-react-widget.ts` | Widget factory, manages React Root, value storage, and ComfyUI two-way binding |
|
||||||
|
| `src/index.ts` | ComfyUI extension entry point, registers `getCustomWidgets` |
|
||||||
|
| `src/components/widgets/` | React widget components |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Creating a New Widget: Complete Flow
|
||||||
|
|
||||||
|
### 1. Write the React Component
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
// src/components/widgets/MyWidget.tsx
|
||||||
|
import type { ReactWidgetProps } from '@/lib/create-react-widget'
|
||||||
|
|
||||||
|
export interface MyData {
|
||||||
|
text: string
|
||||||
|
count: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function MyWidget({ value, onChange }: ReactWidgetProps<MyData>) {
|
||||||
|
// Key: derive data from value prop, don't use useState for main data
|
||||||
|
const data: MyData = value && typeof value === 'object'
|
||||||
|
? value as MyData
|
||||||
|
: { text: '', count: 0 }
|
||||||
|
|
||||||
|
function update(patch: Partial<MyData>) {
|
||||||
|
onChange({ ...data, ...patch })
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Input value={data.text} onChange={e => update({ text: e.target.value })} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Export the Component
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// src/components/widgets/index.ts
|
||||||
|
export { MyWidget } from './MyWidget'
|
||||||
|
export type { MyData } from './MyWidget'
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Register Widget Type in Entry Point
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// src/index.ts
|
||||||
|
const [{ createReactWidget }, { MyWidget }] = await Promise.all([
|
||||||
|
import('@/lib/create-react-widget'),
|
||||||
|
import('@/components/widgets'),
|
||||||
|
])
|
||||||
|
|
||||||
|
globalThis.comfyAPI!.app.app.registerExtension({
|
||||||
|
name: 'EasyMedia.widgets',
|
||||||
|
|
||||||
|
async setup() {
|
||||||
|
addStylesheet(`/${import.meta.env.PROJECT_NAME}/globals.css`)
|
||||||
|
},
|
||||||
|
|
||||||
|
getCustomWidgets() {
|
||||||
|
return {
|
||||||
|
MY_WIDGET: createReactWidget<MyData>(MyWidget, {
|
||||||
|
defaultValue: JSON.stringify({ text: '', count: 0 }),
|
||||||
|
domWidgetOptions: {
|
||||||
|
getMinHeight: () => 80,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Declare Corresponding Input Type in Python Node
|
||||||
|
|
||||||
|
```python
|
||||||
|
# nodes.py — Input type name must match getCustomWidgets key
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(cls):
|
||||||
|
return {
|
||||||
|
"required": {
|
||||||
|
"my_data": ("MY_WIDGET", {}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## createReactWidget Parameters
|
||||||
|
|
||||||
|
```ts
|
||||||
|
createReactWidget<T>(Component, options?)
|
||||||
|
```
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
|-----------|------|-------------|
|
||||||
|
| `Component` | `React.ComponentType<ReactWidgetProps<T>>` | The React component to render |
|
||||||
|
| `options.defaultValue` | `string` | Initial JSON string, defaults to `''` |
|
||||||
|
| `options.height` | `number` | Fixed container height (px), auto-sized if not set |
|
||||||
|
| `options.domWidgetOptions` | `DOMWidgetOptions` | Passed through to `addDOMWidget`, can override `getMinHeight`, `getMaxHeight`, `hideOnZoom`, etc. |
|
||||||
|
|
||||||
|
### ReactWidgetProps\<T\>
|
||||||
|
|
||||||
|
```ts
|
||||||
|
interface ReactWidgetProps<T extends object | string = object> {
|
||||||
|
value: T // Current deserialized value
|
||||||
|
onChange: (value: T) => void // Update value and trigger re-render
|
||||||
|
inputName: string // Node input name
|
||||||
|
node: any // LGraphNode instance
|
||||||
|
widget: DOMWidget // DOMWidget instance for this widget
|
||||||
|
app: ComfyApp // ComfyApp instance
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Receiving widget and node Information
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import type { ReactWidgetProps } from '@/lib/create-react-widget'
|
||||||
|
import type { DOMWidget } from '@comfyorg/comfyui-frontend-types'
|
||||||
|
|
||||||
|
export function MyWidget({ value, onChange, inputName, node, app, widget }: ReactWidgetProps) {
|
||||||
|
// node properties
|
||||||
|
const nodeId = node.id // Node unique ID
|
||||||
|
const nodeName = node.name // Node type name
|
||||||
|
const nodeType = node.type // Node class type
|
||||||
|
|
||||||
|
// widget properties
|
||||||
|
const widgetValue = widget.options?.serialize // widget serialization options
|
||||||
|
|
||||||
|
// app access
|
||||||
|
// app.ui, app.graph, app.commandMenu, etc.
|
||||||
|
|
||||||
|
return <div>...</div>
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Two-Way Data Binding Mechanism
|
||||||
|
|
||||||
|
### Internal Update (User Interacts with Component)
|
||||||
|
|
||||||
|
```
|
||||||
|
User interaction → onChange(newValue)
|
||||||
|
→ currentValue = JSON.stringify(newValue) // Persist
|
||||||
|
→ setDirtyCanvas(true, true) // Notify ComfyUI canvas to refresh
|
||||||
|
→ render() // Must call! Pass new props
|
||||||
|
```
|
||||||
|
|
||||||
|
### External Update (ComfyUI Loads Workflow/Undo/Redo)
|
||||||
|
|
||||||
|
```
|
||||||
|
ComfyUI calls setValue(jsonString)
|
||||||
|
→ currentValue = jsonString
|
||||||
|
→ render() // Re-render with new value
|
||||||
|
```
|
||||||
|
|
||||||
|
### Serialization (Building API Payload)
|
||||||
|
|
||||||
|
```
|
||||||
|
ComfyUI calls serializeValue()
|
||||||
|
→ Returns currentValue (JSON string)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Key Considerations
|
||||||
|
|
||||||
|
### 1. Must Call render() After onChange
|
||||||
|
|
||||||
|
This is the most common bug. After `onChange` callback updates `currentValue`, you **must call `render()`** to pass the new value to the component. Otherwise the React component won't re-render (no state change triggers the update).
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// Wrong: missing render(), component doesn't update
|
||||||
|
onChange: (v: T) => {
|
||||||
|
currentValue = JSON.stringify(v)
|
||||||
|
comfyNode.setDirtyCanvas(true, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Correct
|
||||||
|
onChange: (v: T) => {
|
||||||
|
currentValue = JSON.stringify(v)
|
||||||
|
comfyNode.setDirtyCanvas(true, true)
|
||||||
|
render()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Derive Main Data from value Prop, Don't Use useState
|
||||||
|
|
||||||
|
The main data (i.e., data to be serialized to ComfyUI) must be read from the `value` prop, not stored in React state. Reason: ComfyUI may externally update values via `setValue` (loading workflows, undo, etc.), and React must render with new props.
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
// Wrong: storing main data in state, external setValue won't sync
|
||||||
|
const [items, setItems] = useState(value)
|
||||||
|
|
||||||
|
// Correct: derive directly from value
|
||||||
|
const items = Array.isArray(value) ? value : []
|
||||||
|
```
|
||||||
|
|
||||||
|
`useState` is only for UI temporary state (e.g., draft values in input fields) that doesn't affect serialized data.
|
||||||
|
|
||||||
|
### 3. Defensive Parsing of value
|
||||||
|
|
||||||
|
When `defaultValue` is an empty string, `parseValue` returns the empty string instead of an empty array/object, so defensive handling is needed in components:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const items: MyItem[] = Array.isArray(value) ? value : []
|
||||||
|
const data: MyData = value && typeof value === 'object' ? value as MyData : { text: '' }
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Use Top-Level await + Dynamic Import in Entry Point
|
||||||
|
|
||||||
|
`src/index.ts` uses `await Promise.all([...dynamic imports...])` to load modules, ensuring React and widget code are code-split by Bun into separate chunks to avoid bloating the ComfyUI main JS bundle.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// Dynamic import, triggers Bun code splitting
|
||||||
|
const [{ createReactWidget }, { MyWidget }] = await Promise.all([
|
||||||
|
import('@/lib/create-react-widget'),
|
||||||
|
import('@/components/widgets'),
|
||||||
|
])
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. getCustomWidgets Key Must Match Python Type Name
|
||||||
|
|
||||||
|
The type string in Python `INPUT_TYPES` (e.g., `"MY_WIDGET"`) must exactly match the key in the object returned by `getCustomWidgets()`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Complete Example Reference
|
||||||
|
|
||||||
|
### React Component (`src/components/widgets/ColorPaletteWidget.tsx`)
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import { useState } from 'react'
|
||||||
|
import { Button } from '@/components/ui/button'
|
||||||
|
import { Input } from '@/components/ui/input'
|
||||||
|
import { uuid } from '@/lib/uuid'
|
||||||
|
import type { ReactWidgetProps } from '@/lib/create-react-widget'
|
||||||
|
|
||||||
|
export interface ColorPreset {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
hexColor: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ColorPaletteWidget({ value, onChange }: ReactWidgetProps<ColorPreset[]>) {
|
||||||
|
// Main data derived from value
|
||||||
|
const presets: ColorPreset[] = Array.isArray(value) ? value : []
|
||||||
|
// UI temporary state can use useState
|
||||||
|
const [newName, setNewName] = useState('')
|
||||||
|
|
||||||
|
function addPreset() {
|
||||||
|
if (!newName.trim()) return
|
||||||
|
onChange([...presets, {
|
||||||
|
id: uuid(),
|
||||||
|
name: newName.trim(),
|
||||||
|
hexColor: '#000000',
|
||||||
|
}])
|
||||||
|
setNewName('')
|
||||||
|
}
|
||||||
|
|
||||||
|
function removePreset(id: string) {
|
||||||
|
onChange(presets.filter(preset => preset.id !== id))
|
||||||
|
}
|
||||||
|
|
||||||
|
function updatePreset(id: string, patch: Partial<ColorPreset>) {
|
||||||
|
onChange(presets.map(preset => preset.id === id ? { ...preset, ...patch } : preset))
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col gap-2 p-2 text-sm">
|
||||||
|
{/* ... JSX ... */}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Entry Registration (`src/index.ts`)
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const [{ createReactWidget }, { ColorPaletteWidget }] = await Promise.all([
|
||||||
|
import('@/lib/create-react-widget'),
|
||||||
|
import('@/components/widgets'),
|
||||||
|
])
|
||||||
|
|
||||||
|
globalThis.comfyAPI!.app.app.registerExtension({
|
||||||
|
name: 'EasyMedia.widgets',
|
||||||
|
async setup() {
|
||||||
|
addStylesheet(`/${import.meta.env.PROJECT_NAME}/globals.css`)
|
||||||
|
},
|
||||||
|
getCustomWidgets() {
|
||||||
|
return {
|
||||||
|
COLOR_PALETTE: createReactWidget<ColorPreset[]>(ColorPaletteWidget, {
|
||||||
|
defaultValue: JSON.stringify([]),
|
||||||
|
domWidgetOptions: { getMinHeight: () => 100 },
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Debugging Checklist
|
||||||
|
|
||||||
|
| Symptom | Cause | Solution |
|
||||||
|
|---------|-------|----------|
|
||||||
|
| Component doesn't update after user action | `onChange` missing `render()` | Add `render()` at end of `onChange` |
|
||||||
|
| Shows old data after loading workflow | Main data stored in `useState` | Derive from `value` prop instead |
|
||||||
|
| Node value always empty | `defaultValue` not set or type name mismatch | Check `createReactWidget` `defaultValue` and Python type name |
|
||||||
|
| Widget height is 0 | `getMinHeight` not set | Set `getMinHeight` in `domWidgetOptions` |
|
||||||
|
| Styles not applying | CSS not loaded | Confirm `addStylesheet` is called in `setup()` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Localization (i18n)
|
||||||
|
|
||||||
|
All static text in widget components (labels, titles, placeholders, tooltips, context-menu items, aria-labels) **must** use the localization system instead of hardcoded strings.
|
||||||
|
|
||||||
|
### How It Works
|
||||||
|
|
||||||
|
The current ComfyUI locale is read from `app?.ui?.settings?.settingsValues?.['Comfy.Locale']` in the top-level widget component and provided via `LocaleContext`. Child components consume it with `useT()`.
|
||||||
|
|
||||||
|
Message catalogs live in `frontend/messages/`:
|
||||||
|
|
||||||
|
```
|
||||||
|
frontend/messages/
|
||||||
|
en.json ← English (fallback)
|
||||||
|
zh.json ← Chinese
|
||||||
|
```
|
||||||
|
|
||||||
|
Keys are organized by section (one section per component). Parameterized strings use `{name}` placeholders.
|
||||||
|
|
||||||
|
### 1. Add Keys to Both Catalogs
|
||||||
|
|
||||||
|
```jsonc
|
||||||
|
// messages/en.json
|
||||||
|
{
|
||||||
|
"myWidget": {
|
||||||
|
"addItem": "Add item",
|
||||||
|
"deleteItem": "Delete item",
|
||||||
|
"itemLabel": "Item {n}",
|
||||||
|
"placeholder": "Enter text…"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// messages/zh.json
|
||||||
|
{
|
||||||
|
"myWidget": {
|
||||||
|
"addItem": "添加项目",
|
||||||
|
"deleteItem": "删除项目",
|
||||||
|
"itemLabel": "项目 {n}",
|
||||||
|
"placeholder": "请输入文字…"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Provide Locale in the Top-Level Widget Component
|
||||||
|
|
||||||
|
Only the root `*Widget.tsx` component does this. Pass the raw locale string to `LocaleContext.Provider`:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
// src/components/widgets/MyWidget.tsx
|
||||||
|
import { LocaleContext } from '@/lib/i18n'
|
||||||
|
|
||||||
|
export function MyWidget({ value, onChange, app }: ReactWidgetProps<MyData>) {
|
||||||
|
const locale = app?.ui?.settings?.settingsValues?.['Comfy.Locale']
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LocaleContext.Provider value={locale}>
|
||||||
|
{/* child components */}
|
||||||
|
</LocaleContext.Provider>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Consume in Any Child Component
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
// src/components/widgets/timeline/MyTrack.tsx
|
||||||
|
import { useT } from '@/lib/i18n'
|
||||||
|
|
||||||
|
export function MyTrack() {
|
||||||
|
const t = useT()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{/* Simple key */}
|
||||||
|
<Button>{t('myWidget.addItem')}</Button>
|
||||||
|
|
||||||
|
{/* With parameter */}
|
||||||
|
<span>{t('myWidget.itemLabel', { n: 3 })}</span>
|
||||||
|
{/* en → "Item 3" zh → "项目 3" */}
|
||||||
|
|
||||||
|
{/* Placeholder */}
|
||||||
|
<Textarea placeholder={t('myWidget.placeholder')} />
|
||||||
|
|
||||||
|
{/* Aria-label */}
|
||||||
|
<button aria-label={t('myWidget.deleteItem')} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Common Shared Keys
|
||||||
|
|
||||||
|
Keys in the `"common"` section are shared across all components:
|
||||||
|
|
||||||
|
| Key | en | zh |
|
||||||
|
|-----|----|----|
|
||||||
|
| `common.cancel` | Cancel | 取消 |
|
||||||
|
| `common.save` | Save | 保存 |
|
||||||
|
| `common.add` | Add | 添加 |
|
||||||
|
| `common.delete` | Delete | 删除 |
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const t = useT()
|
||||||
|
<Button>{t('common.cancel')}</Button>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rule
|
||||||
|
|
||||||
|
> Every widget component that renders static text **must** call `useT()` and reference a message key.
|
||||||
|
> Hardcoded strings in JSX or props are not allowed.
|
||||||
|
|
||||||
43
.codex/agents/code-simplifer.toml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
name = "code-simplifier"
|
||||||
|
description = "Simplifies and refines code for clarity, consistency, and maintainability while preserving behavior. Focus on recently modified code unless instructed otherwise."
|
||||||
|
developer_instructions = """
|
||||||
|
# Code Simplifier Agent
|
||||||
|
|
||||||
|
You simplify code while preserving functionality.
|
||||||
|
|
||||||
|
## Principles
|
||||||
|
|
||||||
|
1. clarity over cleverness
|
||||||
|
2. consistency with existing repo style
|
||||||
|
3. preserve behavior exactly
|
||||||
|
4. simplify only where the result is demonstrably easier to maintain
|
||||||
|
|
||||||
|
## Simplification Targets
|
||||||
|
|
||||||
|
### Structure
|
||||||
|
|
||||||
|
- extract deeply nested logic into named functions
|
||||||
|
- replace complex conditionals with early returns where clearer
|
||||||
|
- simplify callback chains with `async` / `await`
|
||||||
|
- remove dead code and unused imports
|
||||||
|
|
||||||
|
### Readability
|
||||||
|
|
||||||
|
- prefer descriptive names
|
||||||
|
- avoid nested ternaries
|
||||||
|
- break long chains into intermediate variables when it improves clarity
|
||||||
|
- use destructuring when it clarifies access
|
||||||
|
|
||||||
|
### Quality
|
||||||
|
|
||||||
|
- remove stray `console.log`
|
||||||
|
- remove commented-out code
|
||||||
|
- consolidate duplicated logic
|
||||||
|
- unwind over-abstracted single-use helpers
|
||||||
|
|
||||||
|
## Approach
|
||||||
|
|
||||||
|
1. read the changed files
|
||||||
|
2. identify simplification opportunities
|
||||||
|
3. apply only functionally equivalent changes
|
||||||
|
4. verify no behavioral change was introduced"""
|
||||||
86
.codex/agents/localize-review.toml
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
name = "localize-review"
|
||||||
|
description = "Review project localization setup. Use when auditing i18n configuration, checking locales folder structure, validating node localization completeness, or verifying frontend message key alignment between en/zh."
|
||||||
|
developer_instructions = '''
|
||||||
|
You are a localization reviewer for a ComfyUI custom node project with both Python backend and React frontend.
|
||||||
|
|
||||||
|
## Project Context
|
||||||
|
|
||||||
|
- Backend: Python nodes with `comfy_api.latest` (V3) API
|
||||||
|
- Frontend: React v19, bundled with Bun
|
||||||
|
- Frontend messages location: `frontend/messages/{en,zh}.json`
|
||||||
|
- Backend node definitions: `nodes/*.py`
|
||||||
|
|
||||||
|
## Review Checklist
|
||||||
|
|
||||||
|
### 1. Locales Folder Structure
|
||||||
|
|
||||||
|
Project root **must** contain `locales/` folder with at minimum:
|
||||||
|
|
||||||
|
| Language | nodeDefs.json | main.json | settings.json |
|
||||||
|
|----------|--------------|-----------|---------------|
|
||||||
|
| en/ | Optional | Optional | Optional |
|
||||||
|
| zh/ | ✅ Required | Optional | Optional |
|
||||||
|
|
||||||
|
- [ ] `locales/` folder exists at project root
|
||||||
|
- [ ] `locales/zh/nodeDefs.json` exists
|
||||||
|
|
||||||
|
### 2. nodeDefs.json Format
|
||||||
|
|
||||||
|
- [ ] JSON is valid (parseable)
|
||||||
|
- [ ] Node display names are localized
|
||||||
|
- [ ] Input tooltips are localized (if present in schema)
|
||||||
|
- [ ] Output display names are localized (if present in schema)
|
||||||
|
|
||||||
|
### 3. Backend Node Localization Completeness
|
||||||
|
|
||||||
|
For each registered node in `__init__.py` → `get_node_list()`:
|
||||||
|
|
||||||
|
- [ ] Node `display_name` localized
|
||||||
|
- [ ] Node `description` localized
|
||||||
|
- [ ] All inputs with `tooltip` have corresponding localization
|
||||||
|
- [ ] All outputs with `display_name` have corresponding localization
|
||||||
|
|
||||||
|
### 4. Frontend Messages Alignment
|
||||||
|
|
||||||
|
Location: `frontend/messages/en.json` and `frontend/messages/zh.json`
|
||||||
|
|
||||||
|
- [ ] Both files exist
|
||||||
|
- [ ] All top-level sections exist in both files
|
||||||
|
- [ ] All keys exist in both files (no missing keys in either language)
|
||||||
|
- [ ] Key count matches between en and zh
|
||||||
|
- [ ] `bun build` succeeds after any message file changes
|
||||||
|
|
||||||
|
### 5. Common Issues to Flag
|
||||||
|
|
||||||
|
- Missing `locales/` directory
|
||||||
|
- Incomplete key sets between language files
|
||||||
|
- Invalid JSON syntax
|
||||||
|
- Missing tooltip localizations for nodes that define them
|
||||||
|
- Build failures after message file edits
|
||||||
|
|
||||||
|
### 6. Quote Handling in Translations
|
||||||
|
|
||||||
|
JSON values must use double quotes, so when the translation itself contains double quotes:
|
||||||
|
- **Problem**: `"tooltip": "提示 \"文字\""` causes JSON parse failure
|
||||||
|
- **Solution**: Use single quotes for the inner quotes or escape them properly
|
||||||
|
- **Rule**: Always wrap translation strings in double quotes; if the translated text contains double quotes, escape them with `\\"` (JSON string escaping)
|
||||||
|
|
||||||
|
### 7. Key Synchronization Review
|
||||||
|
|
||||||
|
When reviewing translations, verify:
|
||||||
|
- [ ] No keys were renamed or removed without updating all locales
|
||||||
|
- [ ] No new keys added to one locale but missing from others
|
||||||
|
- [ ] Key count matches exactly between `en` and `zh` files
|
||||||
|
- [ ] Key order is consistent (aids debugging and diff review)
|
||||||
|
|
||||||
|
## Output
|
||||||
|
|
||||||
|
For each issue found, report:
|
||||||
|
1. **File & location**
|
||||||
|
2. **Severity**: Critical / Major / Minor
|
||||||
|
3. **Issue** description
|
||||||
|
4. **Suggested fix**
|
||||||
|
|
||||||
|
End with a brief summary table:
|
||||||
|
| Category | Item | Status |
|
||||||
|
|----------|------|--------|'''
|
||||||
49
.codex/agents/python-review.toml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
name = "python-review"
|
||||||
|
description = "Review Python backend code. Use when auditing node definitions, checking ComfyUI V3 API compliance, reviewing execute() logic, or validating node schema correctness."
|
||||||
|
developer_instructions = """
|
||||||
|
You are a Python code reviewer specializing in ComfyUI V3 custom node development.
|
||||||
|
|
||||||
|
## Project Context
|
||||||
|
|
||||||
|
- Backend: Python, using the `comfy_api.latest` (V3) API
|
||||||
|
- Node base class: `io.ComfyNode`
|
||||||
|
- Schema defined via `io.Schema` in `define_schema()`
|
||||||
|
- Extension class: `io.ComfyExtension`, entrypoint is `async def comfy_entrypoint()`
|
||||||
|
- Node registration via `get_node_list()` returning `list[type[io.ComfyNode]]`
|
||||||
|
|
||||||
|
## Review Checklist
|
||||||
|
|
||||||
|
### ComfyUI V3 API Compliance
|
||||||
|
- [ ] Node inherits from `io.ComfyNode`
|
||||||
|
- [ ] `define_schema()` is a `@classmethod` returning `io.Schema`
|
||||||
|
- [ ] `execute()` is a `@classmethod` returning `io.NodeOutput`
|
||||||
|
- [ ] `node_id` is unique and uses `PascalCase`
|
||||||
|
- [ ] `category` follows `EasyUse/<subcategory>` convention within `nodes/basic.py`
|
||||||
|
- [ ] Custom types use `io.Custom(io_type="TYPE_NAME")`
|
||||||
|
- [ ] Optional inputs use `io.*.Input(..., optional=True)`
|
||||||
|
- [ ] Extension class overrides `get_node_list()` with `@override`
|
||||||
|
- [ ] All node classes defined in `nodes/` are registered in `__init__.py` via `get_node_list()`
|
||||||
|
- [ ] New nodes added to `nodes/*.py` must be imported and included in the extension's `get_node_list()` method
|
||||||
|
|
||||||
|
### Python Quality
|
||||||
|
- [ ] No bare `except:` clauses — always catch specific exceptions
|
||||||
|
- [ ] No silently swallowed exceptions
|
||||||
|
- [ ] No mutable default arguments
|
||||||
|
- [ ] Type hints present on public methods
|
||||||
|
- [ ] No unused imports
|
||||||
|
- [ ] No `print()` debug statements left in production code (use logging)
|
||||||
|
|
||||||
|
### Security (OWASP)
|
||||||
|
- [ ] No `eval()` / `exec()` on untrusted input
|
||||||
|
- [ ] No path traversal via user-controlled file paths (use `pathlib.Path` and validate)
|
||||||
|
- [ ] No hardcoded credentials or secrets
|
||||||
|
- [ ] File I/O uses context managers (`with open(...)`)
|
||||||
|
|
||||||
|
### Output
|
||||||
|
For each issue found, report:
|
||||||
|
1. **File & line** (if known)
|
||||||
|
2. **Severity**: Critical / Major / Minor
|
||||||
|
3. **Issue** description
|
||||||
|
4. **Suggested fix** with code snippet
|
||||||
|
|
||||||
|
End with a brief summary table."""
|
||||||
55
.codex/agents/react-review.toml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
name = "react-review"
|
||||||
|
description = "Review React/TypeScript frontend code. Use when auditing components, checking shadcn/ui usage, reviewing hooks, validating TypeScript strictness, or auditing ComfyUI frontend extension patterns."
|
||||||
|
developer_instructions = """
|
||||||
|
You are a React/TypeScript code reviewer specializing in ComfyUI frontend extensions.
|
||||||
|
|
||||||
|
## Project Context
|
||||||
|
|
||||||
|
- **Framework**: React v19, functional components only
|
||||||
|
- **UI Library**: shadcn/ui + Tailwind CSS v4
|
||||||
|
- **Icons**: Lucide
|
||||||
|
- **Build**: Bun + `build.ts`
|
||||||
|
- **Testing**: Vitest
|
||||||
|
- **Import alias**: `@/*` maps to `src/`
|
||||||
|
- **File naming**: `PascalCase.tsx` for components, `kebab-case.ts` for modules
|
||||||
|
|
||||||
|
## Review Checklist
|
||||||
|
|
||||||
|
### React / TypeScript
|
||||||
|
- [ ] Only functional components with hooks — no class components
|
||||||
|
- [ ] No `any` type without explicit justification
|
||||||
|
- [ ] Strict TypeScript: no implicit `any`, no non-null assertions without reason
|
||||||
|
- [ ] Props interfaces defined (not inline `{}` type)
|
||||||
|
- [ ] `useEffect` has correct dependency arrays — no missing/extra deps
|
||||||
|
- [ ] No state updates after unmount (use cleanup in `useEffect`)
|
||||||
|
- [ ] `key` props on list items use stable IDs, not array index (unless list is static)
|
||||||
|
- [ ] Expensive computations wrapped in `useMemo` / `useCallback` where appropriate
|
||||||
|
|
||||||
|
### shadcn/ui Compliance
|
||||||
|
- [ ] Use shadcn/ui equivalents: `<Button>`, `<Input>`, `<Textarea>`, `<Select>`
|
||||||
|
- [ ] Exception: files inside `src/components/ui/**` (the primitives themselves)
|
||||||
|
- [ ] Tailwind classes use v4 syntax (CSS variables, not `tailwind.config.js` theme keys)
|
||||||
|
|
||||||
|
### ComfyUI Frontend Extension
|
||||||
|
- [ ] Custom widgets registered correctly via ComfyUI extension hooks
|
||||||
|
- [ ] No direct DOM manipulation outside of widget canvas integrations
|
||||||
|
- [ ] Event listeners cleaned up on component unmount
|
||||||
|
|
||||||
|
### Error Handling
|
||||||
|
- [ ] API calls have try/catch or `.catch()` handlers
|
||||||
|
- [ ] User-facing errors show meaningful messages (not raw error objects)
|
||||||
|
- [ ] No silent `catch(() => {})` swallowing
|
||||||
|
|
||||||
|
### Security
|
||||||
|
- [ ] No `dangerouslySetInnerHTML` with unsanitized content
|
||||||
|
- [ ] No `eval()` or `new Function()` with user input
|
||||||
|
- [ ] Sensitive data not stored in `localStorage` without justification
|
||||||
|
|
||||||
|
### Output
|
||||||
|
For each issue found, report:
|
||||||
|
1. **File & line** (if known)
|
||||||
|
2. **Severity**: Critical / Major / Minor
|
||||||
|
3. **Issue** description
|
||||||
|
4. **Suggested fix** with code snippet
|
||||||
|
|
||||||
|
End with a brief summary table."""
|
||||||
29
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: "[Bug] "
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
## Bug Description
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
## Steps to Reproduce
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '...'
|
||||||
|
3. See error
|
||||||
|
|
||||||
|
## Expected Behavior
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
## Screenshots / Videos
|
||||||
|
If applicable, add screenshots or videos to help explain your problem.
|
||||||
|
|
||||||
|
## Environment
|
||||||
|
- ComfyUI version:
|
||||||
|
- ComfyUI-Easy-Media version:
|
||||||
|
- OS: [e.g. Windows, macOS, Linux]
|
||||||
|
|
||||||
|
## Additional Context
|
||||||
|
Add any other context about the problem here.
|
||||||
19
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: "[Feature] "
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
## Is your feature request related to a problem? Please describe
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
## Describe the solution you'd like
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
## Describe alternatives you've considered
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
## Additional Context
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
46
.github/PULL_REQUEST_TEMPLATE/checklist.md
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
## PR Checklist
|
||||||
|
<!-- 1-3 bullet points describing what this PR does -->
|
||||||
|
|
||||||
|
## Type of Change
|
||||||
|
- [ ] Bug fix
|
||||||
|
- [ ] New feature
|
||||||
|
- [ ] Refactoring
|
||||||
|
- [ ] Documentation update
|
||||||
|
- [ ] Other: ____________
|
||||||
|
|
||||||
|
## Test Plan
|
||||||
|
<!-- Bulleted checklist of what you tested -->
|
||||||
|
|
||||||
|
- [ ] Tested locally in ComfyUI
|
||||||
|
- [ ] Verified existing functionality still works
|
||||||
|
- [ ] Tested edge cases:
|
||||||
|
- [ ] ____________
|
||||||
|
- [ ] ____________
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
|
||||||
|
### Code Quality
|
||||||
|
- [ ] Code follows project style guidelines
|
||||||
|
- [ ] No console.log or debug code left in
|
||||||
|
- [ ] Error handling is appropriate
|
||||||
|
- [ ] No commented-out code
|
||||||
|
|
||||||
|
### Backend (if applicable)
|
||||||
|
- [ ] Python code has proper type hints
|
||||||
|
- [ ] Node inputs/outputs properly defined
|
||||||
|
- [ ] Backward compatibility maintained
|
||||||
|
|
||||||
|
### Frontend (if applicable)
|
||||||
|
- [ ] React components are functional/hooks-based
|
||||||
|
- [ ] No `any` types without good reason
|
||||||
|
- [ ] UI tested in browser
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
- [ ] Docstrings updated (if applicable)
|
||||||
|
- [ ] README updated (if applicable)
|
||||||
|
|
||||||
|
## Screenshots / Before-After
|
||||||
|
<!-- Add screenshots or videos if UI was changed -->
|
||||||
|
|
||||||
|
## Additional Notes
|
||||||
|
<!-- Anything else the reviewer should know? -->
|
||||||
43
.github/workflows/publish.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
name: Publish to Comfy registry
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- "pyproject.toml"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-node:
|
||||||
|
name: Publish Custom Node to registry
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.repository_owner == 'yolain' }}
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Extract version from pyproject.toml
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
VERSION=$(grep -E '^\s*version\s*=' pyproject.toml | head -1 | sed -E 's/.*version\s*=\s*"([^"]+)".*/\1/')
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
echo "ERROR: Could not extract version from pyproject.toml" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "Extracted version: $VERSION"
|
||||||
|
|
||||||
|
- name: Create GitHub Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
tag_name: v${{ steps.version.outputs.version }}
|
||||||
|
generate_release_notes: true
|
||||||
|
|
||||||
|
- name: Publish Custom Node
|
||||||
|
uses: Comfy-Org/publish-node-action@v1
|
||||||
|
with:
|
||||||
|
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
||||||
23
.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
__pycache__
|
||||||
|
.DS_Store
|
||||||
|
node_modules/
|
||||||
|
docs/
|
||||||
|
dist/dev/
|
||||||
|
config.yaml
|
||||||
|
*.cache
|
||||||
|
*.ini
|
||||||
|
*.bak
|
||||||
|
*.bat
|
||||||
|
*.log
|
||||||
|
.pytest_cache
|
||||||
|
.env
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
.worktrees/
|
||||||
|
.codegraph/
|
||||||
|
.claude/skills/comfyui-node-*/
|
||||||
|
!.claude/skills/comfyui-node-i18n/
|
||||||
|
.superpowers/
|
||||||
|
superpowers/
|
||||||
|
docs/superpowers/
|
||||||
|
output/
|
||||||
1
.husky/commit-msg
Normal file
@ -0,0 +1 @@
|
|||||||
|
cd frontend && npx commitlint --edit $1
|
||||||
7
.husky/pre-commit
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
if git diff --cached --name-only | /usr/bin/grep -Eq "^frontend/.*\.(tsx?|css)$"; then
|
||||||
|
echo "Frontend changes detected, rebuilding..."
|
||||||
|
cd frontend && bun run build:release && cd ..
|
||||||
|
git add dist/
|
||||||
|
echo "Done."
|
||||||
|
fi
|
||||||
107
AGENTS.md
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
# ComfyUI Easy Media
|
||||||
|
|
||||||
|
## Tech Stack
|
||||||
|
|
||||||
|
- **Backend**: Python, using comfyui-nodes-** skills to develop.
|
||||||
|
- **Frontend**: React v19, shadcn/ui + Tailwind CSS v4 for components, Lucide for icons, Bun for package manager and build, Vitest for testing.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Build, Test, and Development Commands
|
||||||
|
|
||||||
|
### Adding shadcn/ui components
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# From repo root
|
||||||
|
bunx shadcn add <component-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Dev build (unminified, outputs to dist/dev) — use during normal development
|
||||||
|
bun run dev # watch mode with hot reload → dist/dev
|
||||||
|
bun run build # one-shot dev build → dist/dev
|
||||||
|
|
||||||
|
# Release build (minified, outputs to dist/release) — REQUIRED before git commit
|
||||||
|
bun run build:release # production build → dist/release
|
||||||
|
```
|
||||||
|
|
||||||
|
## Skill Synchronization
|
||||||
|
|
||||||
|
- **Keep Codex skills in sync** — When changing any skill in this project, overwrite the corresponding Codex skill with the updated project version so both copies remain identical
|
||||||
|
|
||||||
|
## Code Style
|
||||||
|
|
||||||
|
### Backend
|
||||||
|
|
||||||
|
- **Reuse utils first** — Before writing new code, check `utils/` for existing utility functions; if none exists, add it there instead of duplicating code
|
||||||
|
- **File naming** — `kebab_case.py` for nodes、utils、modules; `PascalCase.py` for classes
|
||||||
|
- **Type hints** — Use type hints for all public methods and function parameters
|
||||||
|
- **Error handling** — Use `try/except` to explicitly catch exceptions; never swallow exceptions silently
|
||||||
|
|
||||||
|
|
||||||
|
### Frontend
|
||||||
|
|
||||||
|
- **TypeScript first** — strict mode, no `any` without reason
|
||||||
|
- **File naming** — `PascalCase.tsx` for components, `camelCase` for dir, `kebab-case.ts` for modules
|
||||||
|
- **Import aliases** — use `@/*` for `src/` paths
|
||||||
|
- **React components** — functional only, hooks-based
|
||||||
|
- **Reusable hooks** — When component logic has reusable state/effect behavior, write it directly in `src/hooks` and call it from components instead of duplicating the logic inline
|
||||||
|
- **Test location** — Write test cases separately under `src/tests`; do not colocate test files with components or other source modules
|
||||||
|
- **Never use raw HTML elements** for interactive controls — use shadcn/ui equivalents (`<Button>` not `<button>`, `<Input>` not `<input>`, `<Textarea>` not `<textarea>`, `<Select>` not `<select>`). Exception: `src/components/ui/**` (the shadcn/ui primitives themselves may use raw elements)
|
||||||
|
- **Error handling** — always handle errors explicitly; never swallow exceptions silently
|
||||||
|
- **Color tokens only** — All colors are defined as CSS custom properties in `src/styles/global.css` and mapped to Tailwind utilities via `@theme inline`; use theme tokens instead of hardcoded values
|
||||||
|
- **No raw Tailwind colors** — Do not use raw color utilities such as `text-zinc-*`, `border-slate-*`, `bg-[#...]`, or `text-[#...]`; use classes like `bg-background`, `border-border`, `text-foreground`, and `text-muted-foreground`
|
||||||
|
- **Color exceptions** — `bg-white` and `bg-black` are allowed for canvas/node editor backgrounds when explicit backgrounds are intentional
|
||||||
|
- **Adding colors** — Add new colors as CSS custom property tokens in `src/styles/index.css` under `@theme inline`, then consume them through Tailwind utilities
|
||||||
|
|
||||||
|
### Sampling Preview Regression Guards
|
||||||
|
|
||||||
|
- Tiny VAE preview decoders may return either normalized float pixels (`0..1`) or `uint8` pixels (`0..255`). When interpolating `uint8` preview frames, preserve that scale and cast the result back to `uint8` before generic float conversion. Passing interpolated `0..255` floats through a `0..1` clamp saturates the preview to white.
|
||||||
|
- Keep `tests/test_sampling_preview.py::test_decode_preview_frames_resamples_uint8_without_clipping_to_white` as a regression test for the white-preview failure.
|
||||||
|
- The sampling preview belongs to the `easy multitrackProject` node itself. It is not part of `TRACK_DATA` or `MultiTrackWidget`. Keep its DOM widget inside the node layout with bounded min/max height and bounded pointer hit-testing.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Git Workflow
|
||||||
|
|
||||||
|
### Branch Strategy
|
||||||
|
|
||||||
|
- Switch to `main` and ensure it is up to date before creating a new feature branch when the task requires branch work
|
||||||
|
- If a matching feature branch already exists, use it instead of creating a duplicate
|
||||||
|
- For code changes, create feature branches from `main`; documentation-only or assistant-rules changes do not require a new branch unless requested
|
||||||
|
- When fixing code from an issue, create a branch specifically for that issue
|
||||||
|
- Before switching or committing, check whether the current branch is behind `main` with conflicting changes; rebase `main` into the current branch if needed
|
||||||
|
|
||||||
|
### Commit Rules
|
||||||
|
|
||||||
|
- Group commits by feature or responsibility, not only by file type
|
||||||
|
- Keep `dist/` changes separate from feature/source commits when frontend builds update generated output
|
||||||
|
- Use `git diff` to inspect changes and decide logical commit grouping before committing
|
||||||
|
- Use conventional commit messages:
|
||||||
|
|
||||||
|
```text
|
||||||
|
<type>: <description>
|
||||||
|
|
||||||
|
<optional body>
|
||||||
|
```
|
||||||
|
|
||||||
|
- Allowed commit types: `feat`, `fix`, `refactor`, `docs`, `test`, `chore`, `perf`, `ci`
|
||||||
|
|
||||||
|
### Pull Request Workflow
|
||||||
|
|
||||||
|
- After pushing a branch to remote, create a corresponding PR when requested or when completing branch-based work
|
||||||
|
- If a similar PR is already open, ask whether to contribute to that PR instead
|
||||||
|
- When creating PRs, analyze the full branch history, not only the latest commit
|
||||||
|
- Use `git diff [base-branch]...HEAD` to review the full change set
|
||||||
|
- Include a concise PR summary and a test plan
|
||||||
|
- Push with `-u` when publishing a new branch
|
||||||
|
|
||||||
|
### Pre-Push Review
|
||||||
|
|
||||||
|
- Run applicable reviews before pushing substantial code changes:
|
||||||
|
- Frontend changes: React/TypeScript review
|
||||||
|
- Backend changes: Python/ComfyUI node review
|
||||||
|
- Localization changes: i18n review
|
||||||
|
- Address review findings and re-run review after major changes
|
||||||
256
CHANGELOG.md
Normal file
@ -0,0 +1,256 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [1.3.3] - 2026-09-25
|
||||||
|
|
||||||
|
### ✨ New Features
|
||||||
|
|
||||||
|
- **Multi-Image Loader**: Added the `easy multiImagesLoader` node, supporting loading up to 25 images.
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **MultiTrack Project**: Fixed TE being executed an extra time in `Dual` mode.
|
||||||
|
- **MultiTrack Editor**: When a single segment covers the entire task window, crop and resize it directly instead of recomputing through the reference path, fixing [#84](https://github.com/yolain/ComfyUI-Easy-Media/issues/84). The media loading timeout in this path is set to 60 seconds.
|
||||||
|
- **MultiTrack Editor**: [Motion transfer & subject replacement] When the source video frame rate differs from the editor frame rate, smart-split segments now split using the editor frame rate, and when paused or stepping frame-by-frame the requested frame is returned via ffmpeg's `fps` filter as the preview image.
|
||||||
|
- **MultiTrack Project**: [Motion transfer & subject replacement] Locked videos now use uniform temporal resampling. Previously, when the locked duration did not conform to the `17k+5` frame pattern, the value was rounded up and padded to fit the current frame count, which caused some frames to freeze early. Resampling now uses a uniform temporal distribution so added frames are spread evenly across the timeline rather than clustered at the tail, eliminating the freeze.
|
||||||
|
- **Audio Lock**: Fixed redundant repeated encoding/loading when locking audio across multiple segments of long videos. Due to the multitrack project design, all audio locks are processed before the reference video generation node, so when video is present, ffmpeg is used to extract and cache the audio. Videos without audio and muted tracks no longer lock audio or repeat audio probing, while their video timeline timing remains unchanged. The `audio` input on `easy minimaxH3AudioLock` is now optional; leaving it disconnected passes the latent through unchanged instead of erroring.
|
||||||
|
|
||||||
|
## [1.3.2] - 2026-09-20
|
||||||
|
|
||||||
|
### ⚡ Improvements
|
||||||
|
|
||||||
|
- **MultiTrack Project**: Optimized project media, segment media, TaskOutput, and per-segment H3 conditioning caching to avoid media reloads and repeated first-pass conditioning encodes when re-executing without parameter changes.
|
||||||
|
- **H3 Conditioning Cache**: Store up to five recently used segment caches in ComfyUI's temporary directory, reset the pool when its project, model, or upstream media cache scope changes, rebuild zero-filled initial AV latents from compact metadata, and report a per-category tensor size breakdown after each write.
|
||||||
|
- **MultiTrack Project**: Enhanced action continuity in context mode and optimized lip-sync when audio is locked.
|
||||||
|
- **MultiTrack Editor**: Added the ability to freely drag and adjust the width ratio between the image item area and the prompt area within segments. Optimized the UI display of user prompt highlight tags.
|
||||||
|
- **MultiTrack Project**: Added `selflift` option to `sampling_mode`, adapted from [comfyui-SelfLift](https://github.com/facok/comfyui-SelfLift)
|
||||||
|
- **Character Swap Context**: Switched to `drive_control` approach instead of the previous noise-based method. Testing shows `drive_control` is more stable and preserves more motion details. Although it may appear slightly less sharp visually than the noise approach, it is better suited for preserving source motion during character replacement and motion transfer.
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **Context**: Fixed context loading latent preferring the previous segment's selected latent instead of the most recently generated latent by timestamp.
|
||||||
|
- **Video Reference**: Fixed video reference frame alignment. Previous version had frame loss in motion transfer scenarios when timeline was locked, causing reference to fall back to image.
|
||||||
|
- **MultiTrack Editor**: When segment A has a gap with segment B, adjusting segment A's duration should first fill the gap duration before propagating changes to subsequent segments.
|
||||||
|
- **MultiTrack Editor**: Fixed some UI interaction compatibility issues with Node2.0, improving the overall operational experience.
|
||||||
|
|
||||||
|
## [1.3.1] - 2026-09-07
|
||||||
|
|
||||||
|
### ✨ New Features
|
||||||
|
|
||||||
|
- **MultiTrack Prompt Enhance to Project**: Added `easy multiTrackPromptEnhanceToProject` node, which supports directly applying the MultiTrack Prompt Enhancer's output to the MultiTrack Project.
|
||||||
|
- **Character Swap Context**: Added the `context_swap` continuity mode for MiniMax H3 task segments. It preserves motion continuity while weakening the previous character's appearance with disposable tapered latent noise.
|
||||||
|
- **Dual-Pass Swap Continuity**: Apply swap noise independently to the low-resolution first-pass context and the high-resolution second-pass context. Audio remains untouched, and only clean trimmed/re-encoded context latents are saved for later segments.
|
||||||
|
- **Video-Track Audio Lock**: Lock a video track segment as the timeline constraint for MiniMax H3 generation, ensuring the output duration matches the video; once locked, the audio is synchronized and locked as well. To replace the audio lock, you can lock another audio track as the new audio source while keeping the video track unchanged for the visual. (Mainly used for motion transfer and character replacement.)
|
||||||
|
- **Minimax Prompt Override**: Added the `easy minimaxPromptOverride` node, which supports assembling prompts and other parameters into the multitrack editor's prompt_override, suitable for explicit passing in.
|
||||||
|
|
||||||
|
### ⚡ Improvements
|
||||||
|
|
||||||
|
- **Character Swap Context (drive_control)**: Switched from the previous noise-based approach to `drive_control`. Testing shows drive_control is more stable and preserves more motion details. Although it may appear slightly less sharp visually than the noise approach, it is better suited for preserving source motion in character replacement and motion transfer scenarios.
|
||||||
|
- **MultiTrack Project Media Preparation**: Consolidated task-scoped image, audio, video, shared-media, and locked-audio preparation so project expansion loads and forwards only the media required by each segment.
|
||||||
|
- Clear Redundant Subgraph Cache: Fixed an issue where execution_cache in multi-track project subgraphs was unnecessarily storing video objects, causing additional memory accumulation.
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **Responsive Width Preservation**: Fixed an issue where all custom easymedia components would shrink in width after clicking the ComfyUI properties panel.
|
||||||
|
- **Frame-Accurate Video Trimming**: Normalize source frame rates before trimming merged video inputs to keep segment boundaries aligned with the project timeline.
|
||||||
|
|
||||||
|
The tapered context-noise approach used by Character Swap Context is adapted from [MacroSony/minimax-h3-chained-character-swap](https://github.com/MacroSony/minimax-h3-chained-character-swap).
|
||||||
|
|
||||||
|
## [1.3.0] - 2026-09-03
|
||||||
|
|
||||||
|
### ✨ New Features
|
||||||
|
|
||||||
|
- **MultiTrack Project**: Currently adapted for MiniMax, mainly used to simplify the pipeline. It handles multi-track loop segment encoding, sampling, and decoding/saving, supports specifying segment start position and maximum generation count.
|
||||||
|
- **MultiTrack Project Video Combine**: Preview uncombined segment outputs, supports automatic and manual combining.
|
||||||
|
|
||||||
|
### ⚡ MiniMax H3 Optimizations
|
||||||
|
|
||||||
|
- **Motion Context & Resampling**: Optimized the pairing of the original `MotionContext` with resampling. In the current default sampling configuration: `medium` produces smoother results, while `light` cannot sample sufficiently in the first sampling due to sigma separation.
|
||||||
|
- **Motion Context Latent Memory**: Keep only the 22-frame high-resolution audio/video context tail on CPU between segments and in completed project artifacts, while retaining the complete low-resolution first-pass checkpoint for deferred second-pass runs.
|
||||||
|
- **Multi-Track Editor (Audio Track)**: Added `Lock Audio` feature, only applicable under MultiTrack Project. When generating video, audio will no longer regenerate, but instead schedules video frame output based on this audio.
|
||||||
|
- **Multi-Track Editor (Audio Track)**: Added `Reuse Audio` - all segments can reuse this audio (previously required cloning to each segment), supports up to 15 seconds without being truncated by segments.
|
||||||
|
- **Multi-Track Editor (Shared Media)**: Images, audio clips, and video clips can be marked as shared references when context segments need to reuse the same media. Shared images are placed before each task's local images; shared audio uses up to the first 15 seconds of its source.
|
||||||
|
- **Multi-Track Editor (Task Track)**: When multi-selecting task segments, you can uniformly adjust task mode, transition mode, and reference image size.
|
||||||
|
- **Multi-Track Editor (Task Track)**: New feature added.
|
||||||
|
- **Multi-Track Editor**: Adjusted many texts for better understanding.
|
||||||
|
- **Multi-Track Task Output**: Adjusted minimum value of task_index to -1. When -1, it can output all track complete media information like the previous Multi-Track Editor. (Due to the previous optimization, the Multi-Track Editor cannot directly output complete content)
|
||||||
|
- **Multi-Track Editor**: Defer file and URL media loading when no slot resources are referenced; task output nodes now materialize only the media they need, reduce unnecessary media resource overhead in long-form video tasks. (Now you just need to connect `TRACKS_INFO`; the `image`, `video`, and `audio` output by the multi-track editor will all be `None` in Slot-less resource mode.)
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **Multi-Track Slot Media**: Added video slot selection and fixed image, audio, and video slot discovery and downstream delivery through `TRACKS_INFO`, including sparse lists that skip empty inputs and graphs whose link ID is `0`.
|
||||||
|
|
||||||
|
|
||||||
|
## [1.2.1] - 2026-08-22
|
||||||
|
|
||||||
|
### ✨ New Features
|
||||||
|
|
||||||
|
- **Multi-Track Editor**: Added right-click context menu to clone audio segments and video segments
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **Multi-Track Task Output**: Fixed that segments without audio/video in `MiniMax` format should output as None
|
||||||
|
|
||||||
|
|
||||||
|
## [1.2.0] - 2026-08-21
|
||||||
|
|
||||||
|
### ✨ New Features
|
||||||
|
|
||||||
|
- **Compare Video**: Added `Side-by-side Compare` mode, support for directly selecting media for comparison, and `Watch Output History` mode
|
||||||
|
- **Media Selector**: Added support for multi-selecting image items and selecting all images in current path
|
||||||
|
- **Multi-Track Prompt Enhancer**: Added this node, supports prompt enhancement for models like h3-context-ir, supports local model usage
|
||||||
|
- **Multi-Track Prompt Enhancer to Project**: Added `easy multiTrackPromptEnhanceToProject` node, supports directly applying the output of the multi-track prompt enhancer to the multi-track project
|
||||||
|
- **Multi-Track Editor**: Added user prompt A/B output, supports selecting different user prompt outputs
|
||||||
|
- **Multi-Track Editor**: Added user prompt reference functionality, supports referencing resources via `<Picture 1>`, `<Audio 1>`, `<Video 1>`, `@图片1` and similar methods, supports multi-element combinations
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **Multi-Track Editor**: When two adjacent task segments are connected, modifying the front segment's duration should increase the total duration
|
||||||
|
- **Media Selector**: Fixed breadcrumbs should support recursive subdirectories
|
||||||
|
- **Media Selector**: Fixed image re-selection issue
|
||||||
|
|
||||||
|
|
||||||
|
## [1.1.4] - 2026-08-05
|
||||||
|
|
||||||
|
### ✨ Features
|
||||||
|
|
||||||
|
- **MultiTrack Editor**: Add `MiniMax` video format
|
||||||
|
- **MiniMax H3**: Add `easy minimaxH3ToVideo` for text-to-video, reference-to-video, and first/last-frame conditioning
|
||||||
|
- **Media List Utilities**: Add `easy splitAudios` and `easy splitVideos` to split media lists into independent outputs
|
||||||
|
- **MultiTrack Editor**: Video, audio, and subtitle tracks support dragging the left-side icon to adjust sorting; each track type is limited to a maximum of 3 tracks
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **Multitrack Editor**: Fixed an issue where, in `MiniMax` format, the `Multitrack Editor` and `Multitrack Task Output` would output empty clips when neither the video track nor the audio track contained any clips.
|
||||||
|
- **MultiTrack Editor**: Fix `TRACK_INFO` output when duration is less than 5 seconds — total duration should be the actual total duration of task segments, not the default 5 seconds
|
||||||
|
- **MultiTrack Editor**: Task track segments support free placement while preserving gaps; new task segments can be added directly between segments to fill gaps
|
||||||
|
- **MultiTrack Editor**: Fix issue where dragging to trim from segment edge hot zone caused the trim frame to shift based on mouse position or canvas zoom level
|
||||||
|
- **MultiTrack Editor**: Fix incorrect time ruler click position calculation after canvas zoom, causing playhead positioning and toolbar left/right trim time offset issues
|
||||||
|
- **MultiTrack Task Output**: `MiniMax` format trims audio/video from the next task segment's start point to the media track segment's actual end; the last task trims from its own start to the media's effective end, without outputting trailing black frames or silent audio
|
||||||
|
- **MultiTrack Info Output**: Total duration is calculated as the sum of task segment durations, automatically skipping gaps between task segments
|
||||||
|
- **MultiTrack Editor**: Fix node height recalculation when adding or removing tracks — should recalculate node height instead of adapting to the preview area height
|
||||||
|
|
||||||
|
## [1.1.3] - 2026-07-30
|
||||||
|
|
||||||
|
### ✨ Features
|
||||||
|
|
||||||
|
- **MultiTrack Editor**: Add task markers, allowing multiple task segments to be used as one loop task
|
||||||
|
- **MultiTrack Editor**: Add track overview, allowing segments to be expanded to view prompts and reference images
|
||||||
|
- **MultiTrack Editor**: Support importing SRT files to subtitle track
|
||||||
|
- **MultiTrack Audio Output**: Add cropped audio output mode, outputting cropped audio clips and starting frame number for easier S2V usage
|
||||||
|
- **LTX Workflow Simplification**: Add `easy ltxMultiTrackEncode` and multiple simplified LTX workflow nodes
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **MultiTrack Task Output**: Should output empty system prompt when prompt format is `default` or `promptRelay`
|
||||||
|
- **MultiTrack Editor**: Fix issue where only the first audio was output when inputting audio list in App mode
|
||||||
|
- **MultiTrack Editor**: Fix issue where segments cannot be added at the beginning or between segments on audio and subtitle tracks
|
||||||
|
|
||||||
|
## [1.1.2] - 2026-07-12
|
||||||
|
|
||||||
|
### ✨ Features
|
||||||
|
|
||||||
|
- **MultiTrack to S2V Output**: Outputs cropped audio clips and starting frame number for easier S2V usage
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **Media Selector**: Fix issue where media selector did not stay in subdirectory after reopening when subdirectory was selected last time
|
||||||
|
- **LTXV Reference Video**: Optimizing the Use of `LTXVMakeRefVideo`
|
||||||
|
- **MultiTrack Editor**: Fixed inconsistent left-side crop behavior compared to standard editing tools
|
||||||
|
- **MultiTrack Editor**: Fixed incorrect waveform display after cropping audio clips
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [1.1.1] - 2026-07-11
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **MultiTrack Editor**: Added empty state prompt message, removed 720 panorama feature from image items, added single image preview
|
||||||
|
- **Merge Videos From Paths**: Optimize video processing and add audio option
|
||||||
|
- **Compare Video**: Fix mute issue by default, and add option to save video to reduce the need for extra video save nodes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [1.1.0] — 2026-07-09
|
||||||
|
|
||||||
|
### ✨ Features
|
||||||
|
|
||||||
|
- **MultiTrack Editor**: Add initial version of multitrack editor with supporting nodes, supporting multitrack video, audio editing, segment editing and preview
|
||||||
|
- **Media Selector**: Add directory store cache for media selector to solve the problem of frequent fetching of list data from backend
|
||||||
|
- **Split Image**: Support image list or image batch type image splitting, applicable to `Bernini multi-reference` scenario
|
||||||
|
- **Merge Videos From Paths**: Add `frame_count` to support clipping
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **MultiTrack Editor、TimelineEditor**: Fixed the default width and height when creating nodes
|
||||||
|
- **Media Selector**: Fix resource sorting should be by `name`, `creation time`, `folder first`
|
||||||
|
- **Media Selector**: Fix issues where keyword is not cleared when entering subdirectory after searching
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [1.0.4] — 2026-06-16
|
||||||
|
|
||||||
|
### ✨ Features
|
||||||
|
|
||||||
|
- **Save Video**: Add `hide&save` option to hide output video node output while saving video
|
||||||
|
- **Timeline Editor (App Mode)**: Add `[0-5s]` time range parsing support for `prompt_override`
|
||||||
|
- **Timeline Editor (UI Mode)**: Sub-track supports `drag and drop to import images`
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **Timeline Editor (UI Mode)**: Fix the issue where sub-track image should proportionally adjust duration when segment duration is modified in main track
|
||||||
|
- **Timeline Editor (UI Mode)**: Fix incorrect audio preview display after importing audio subdirectory
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [1.0.3] — 2026-06-06
|
||||||
|
|
||||||
|
### ✨ Features
|
||||||
|
|
||||||
|
- **Bernini Temporary Solution**: Add `Bernini conditioning` and `Bernini Model Patch` nodes as a temporary solution before ComfyUI official Bernini support
|
||||||
|
- **LTXV Reference Video**: Add new node for multi-reference Lora [model](https://huggingface.co/LiconStudio/LTX-2.3-Multiple-Subject-Reference)
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **Timeline Editor (UI Mode)**: Fix `node height` being reset to default when `canvas refresh` and `resolution option` are switched
|
||||||
|
- **Timeline Editor (UI Mode)**: Fix issue where segment content cannot be edited in some cases under `overall editing` prompt mode
|
||||||
|
- **Timeline Editor (UI Mode)**: Fix adaptive node and track height issues, add `clone segment` in right-click menu for `wan2.1 bernini` and `LTX2.3 R2V` usage
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [1.0.2] — 2026-05-31
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- **Timeline Editor (App Mode)**: Fix issue where segments should evenly distribute default duration when `prompt_override` is not strictly in prompt format
|
||||||
|
- **Timeline Editor (App Mode)**: Fix issue where only one audio segment is used to fill the entire timeline - need to filter out empty audio first
|
||||||
|
- **Timeline Editor (UI Mode)**: Fix resource output and sorting errors when a single segment contains different formats
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [1.0.1] — 2026-05-27
|
||||||
|
|
||||||
|
### ✨ Features
|
||||||
|
|
||||||
|
- **Workflow**: Add wan2.2 loop segment example workflow
|
||||||
|
- **Frontend**: Add `+` button when segment is selected to add segments before or after, and fix some known bugs
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- Fix incorrect image links imported from output and subdirectory, causing images and outputs to be filtered out in editor
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [1.0.0] — 2026-05-25
|
||||||
|
|
||||||
|
### 💥 BREAKING CHANGES
|
||||||
|
|
||||||
|
- `Duration & Frame Rate` input only takes effect on `blur` (must press enter or click outside input box to confirm changes)
|
||||||
|
- `Duration Input` step change: step is `4` when format is frame count, `1` when format is seconds
|
||||||
|
- Segment duration editing no longer affects other segments - if total duration exceeds main track after modification, main track will automatically adapt to the sum of all segments
|
||||||
|
|
||||||
|
### ✨ Features
|
||||||
|
|
||||||
|
- **Timeline Editor**: Track auto-adapt height, image and audio segments require double-click to enter media selection interface to avoid accidental triggering
|
||||||
|
- **Timeline Editor**: Add dynamic parameter injection settings, support prompt template format + multimedia input for timeline editor usage
|
||||||
674
LICENSE
Normal file
@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
1220
Moxie-clean.json
Normal file
583
Moxie-consolidated.json
Normal file
@ -0,0 +1,583 @@
|
|||||||
|
{
|
||||||
|
"id": "a6e2f340-63f5-4597-9128-2ef58bdb25e3",
|
||||||
|
"revision": 0,
|
||||||
|
"last_node_id": 105,
|
||||||
|
"last_link_id": 110,
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"id": 100,
|
||||||
|
"type": "MoxieMultimediaLoader",
|
||||||
|
"pos": [
|
||||||
|
3070,
|
||||||
|
1700
|
||||||
|
],
|
||||||
|
"size": [
|
||||||
|
360,
|
||||||
|
360
|
||||||
|
],
|
||||||
|
"flags": {},
|
||||||
|
"order": 1,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "model",
|
||||||
|
"type": "MODEL",
|
||||||
|
"links": [
|
||||||
|
201
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "clip",
|
||||||
|
"type": "CLIP",
|
||||||
|
"links": [
|
||||||
|
202
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "video_vae",
|
||||||
|
"type": "VAE",
|
||||||
|
"links": [
|
||||||
|
203
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "audio_vae",
|
||||||
|
"type": "VAE",
|
||||||
|
"links": [
|
||||||
|
204
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "model_loader",
|
||||||
|
"type": "FAST_MODEL_LOADER",
|
||||||
|
"links": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "MoxieMultimediaLoader"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
"Minimax-h3_Singularity_ref2va_v1.3_Pruned_w4a8.safetensors",
|
||||||
|
"default",
|
||||||
|
"comfy_kitchen_attention",
|
||||||
|
"minimax_h3_taomate_3step_lora_avg_rank_19_bf16.safetensors",
|
||||||
|
1.0,
|
||||||
|
1.0,
|
||||||
|
"minimax_h3_video_vae_int8_convrot.safetensors",
|
||||||
|
"minimax_h3_audio_vae_fp32.safetensors",
|
||||||
|
"qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors",
|
||||||
|
"minimax",
|
||||||
|
"cpu"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 101,
|
||||||
|
"type": "MoxiePreviewOverride",
|
||||||
|
"pos": [
|
||||||
|
3480,
|
||||||
|
1700
|
||||||
|
],
|
||||||
|
"size": [
|
||||||
|
320,
|
||||||
|
260
|
||||||
|
],
|
||||||
|
"flags": {},
|
||||||
|
"order": 2,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "model",
|
||||||
|
"type": "MODEL",
|
||||||
|
"link": 201
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "model_loader",
|
||||||
|
"type": "FAST_MODEL_LOADER",
|
||||||
|
"link": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "model",
|
||||||
|
"type": "MODEL",
|
||||||
|
"links": [
|
||||||
|
205
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "model_loader",
|
||||||
|
"type": "FAST_MODEL_LOADER",
|
||||||
|
"links": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "MoxiePreviewOverride"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
1024,
|
||||||
|
80,
|
||||||
|
true,
|
||||||
|
48,
|
||||||
|
24,
|
||||||
|
"taeh3.safetensors"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 102,
|
||||||
|
"type": "MoxieProject",
|
||||||
|
"pos": [
|
||||||
|
3850,
|
||||||
|
1700
|
||||||
|
],
|
||||||
|
"size": [
|
||||||
|
360,
|
||||||
|
260
|
||||||
|
],
|
||||||
|
"flags": {},
|
||||||
|
"order": 3,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "tracks_info",
|
||||||
|
"type": "TRACKS_INFO",
|
||||||
|
"link": 103
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "model",
|
||||||
|
"type": "MODEL",
|
||||||
|
"link": 205
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "clip",
|
||||||
|
"type": "CLIP",
|
||||||
|
"link": 202
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "video_vae",
|
||||||
|
"type": "VAE",
|
||||||
|
"link": 203
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "audio_vae",
|
||||||
|
"type": "VAE",
|
||||||
|
"link": 204
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "model_loader",
|
||||||
|
"type": "FAST_MODEL_LOADER",
|
||||||
|
"link": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "PROJECT_NAME",
|
||||||
|
"type": "STRING",
|
||||||
|
"links": [
|
||||||
|
104
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "LOCKED_AUDIO",
|
||||||
|
"type": "AUDIO",
|
||||||
|
"links": [
|
||||||
|
107
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "MoxieProject"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
"girl1-test",
|
||||||
|
3,
|
||||||
|
46365877934170
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 35,
|
||||||
|
"type": "easy multiTrackEditor",
|
||||||
|
"pos": [
|
||||||
|
3070,
|
||||||
|
2150
|
||||||
|
],
|
||||||
|
"size": [
|
||||||
|
791.860680043611,
|
||||||
|
894.0199865818026
|
||||||
|
],
|
||||||
|
"flags": {},
|
||||||
|
"order": 5,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "prompt_override",
|
||||||
|
"shape": 7,
|
||||||
|
"type": "*",
|
||||||
|
"link": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "image",
|
||||||
|
"shape": 7,
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "audio",
|
||||||
|
"shape": 7,
|
||||||
|
"type": "AUDIO",
|
||||||
|
"link": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "video",
|
||||||
|
"shape": 7,
|
||||||
|
"type": "VIDEO",
|
||||||
|
"link": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "TRACKS_INFO",
|
||||||
|
"type": "TRACKS_INFO",
|
||||||
|
"links": [
|
||||||
|
103
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "IMAGES",
|
||||||
|
"shape": 6,
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "AUDIO",
|
||||||
|
"shape": 6,
|
||||||
|
"type": "AUDIO",
|
||||||
|
"links": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "VIDEO",
|
||||||
|
"shape": 6,
|
||||||
|
"type": "VIDEO",
|
||||||
|
"links": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"easyMediaTimelineHeight": 894.0199865818026,
|
||||||
|
"Node name for S&R": "easy multiTrackEditor",
|
||||||
|
"ue_properties": {
|
||||||
|
"version": "7.8",
|
||||||
|
"widget_ue_connectable": {},
|
||||||
|
"input_ue_unconnectable": {}
|
||||||
|
},
|
||||||
|
"cnr_id": "comfyui-easy-media",
|
||||||
|
"ver": "1254e0e0afa9afee268027b9540fdc91c888ebc5",
|
||||||
|
"easyMediaTimelineSize": [
|
||||||
|
791.0493774414062,
|
||||||
|
851.7037963867188
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
"960 x 544 (16:9)",
|
||||||
|
"pad",
|
||||||
|
"MiniMax",
|
||||||
|
"{\"muted\":false,\"volume_db\":0,\"task_markers\":[],\"task_overview\":false,\"tracks\":[{\"id\":\"cd1e7db3-76b9-4647-9562-eb6f069f3145\",\"name\":\"Task 0\",\"type\":\"task\",\"task_mode\":\"default\",\"color\":\"var(--multitrack-task-bg)\",\"muted\":false,\"solo\":false,\"volume_db\":0,\"locked\":false,\"segments\":[]},{\"id\":\"5a9a2c48-7e96-40f8-963b-4167b9fab93d\",\"name\":\"Video 0\",\"type\":\"video\",\"color\":\"var(--primary)\",\"muted\":true,\"solo\":false,\"volume_db\":0,\"locked\":false,\"segments\":[],\"audio_locked\":false},{\"id\":\"8ff60ca1-50ff-4fe1-994d-7e984e2d2343\",\"name\":\"Audio 0\",\"type\":\"audio\",\"color\":\"var(--highlight)\",\"muted\":false,\"solo\":true,\"volume_db\":0,\"locked\":false,\"segments\":[],\"audio_locked\":true},{\"id\":\"26f04bfa-35a5-4b13-b496-f67a4e221359\",\"name\":\"Subtitle 0\",\"type\":\"subtitle\",\"color\":\"#9D4937\",\"muted\":false,\"solo\":false,\"volume_db\":0,\"locked\":false,\"segments\":[],\"visible\":false}],\"total_length\":120,\"frame_rate\":24}"
|
||||||
|
],
|
||||||
|
"widgets_values_named": {
|
||||||
|
"resolution": "960 x 544 (16:9)",
|
||||||
|
"resolution.resize_method": "pad",
|
||||||
|
"format": "MiniMax",
|
||||||
|
"track_data": "{\"muted\":false,\"volume_db\":0,\"task_markers\":[],\"task_overview\":false,\"tracks\":[{\"id\":\"cd1e7db3-76b9-4647-9562-eb6f069f3145\",\"name\":\"Task 0\",\"type\":\"task\",\"task_mode\":\"default\",\"color\":\"var(--multitrack-task-bg)\",\"muted\":false,\"solo\":false,\"volume_db\":0,\"locked\":false,\"segments\":[]},{\"id\":\"5a9a2c48-7e96-40f8-963b-4167b9fab93d\",\"name\":\"Video 0\",\"type\":\"video\",\"color\":\"var(--primary)\",\"muted\":true,\"solo\":false,\"volume_db\":0,\"locked\":false,\"segments\":[],\"audio_locked\":false},{\"id\":\"8ff60ca1-50ff-4fe1-994d-7e984e2d2343\",\"name\":\"Audio 0\",\"type\":\"audio\",\"color\":\"var(--highlight)\",\"muted\":false,\"solo\":true,\"volume_db\":0,\"locked\":false,\"segments\":[],\"audio_locked\":true},{\"id\":\"26f04bfa-35a5-4b13-b496-f67a4e221359\",\"name\":\"Subtitle 0\",\"type\":\"subtitle\",\"color\":\"#9D4937\",\"muted\":false,\"solo\":false,\"volume_db\":0,\"locked\":false,\"segments\":[],\"visible\":false}],\"total_length\":120,\"frame_rate\":24}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 103,
|
||||||
|
"type": "MoxieCombine",
|
||||||
|
"pos": [
|
||||||
|
4260,
|
||||||
|
1700
|
||||||
|
],
|
||||||
|
"size": [
|
||||||
|
340,
|
||||||
|
260
|
||||||
|
],
|
||||||
|
"flags": {},
|
||||||
|
"order": 4,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "project_name",
|
||||||
|
"type": "STRING",
|
||||||
|
"link": 104
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "project_data",
|
||||||
|
"type": "PROJECT_DATA",
|
||||||
|
"link": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "VIDEO",
|
||||||
|
"type": "VIDEO",
|
||||||
|
"links": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "FILENAME_PREFIX",
|
||||||
|
"type": "STRING",
|
||||||
|
"links": [
|
||||||
|
108
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "images",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
106
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "audio",
|
||||||
|
"type": "AUDIO",
|
||||||
|
"links": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fps",
|
||||||
|
"type": "FLOAT",
|
||||||
|
"links": [
|
||||||
|
105
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "MoxieCombine"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
"{\"project_name\":\"girl1-test\",\"width\":960,\"height\":544,\"frame_rate\":24,\"clips\":[{\"id\":\"segment-0\",\"index\":0,\"file_path\":\"easy_media/projects/girl1-test/video_0_1.mp4\",\"file_name\":\"video_0_1.mp4\",\"media_revision\":\"1790401532866049600\",\"source_start_frame\":0,\"source_end_frame\":92,\"source_frame_count\":92,\"updated_at\":1790401541.8475678,\"continuity_mode\":\"shot\",\"audio_locked\":true,\"enabled\":true,\"video_files\":[{\"file_path\":\"easy_media/projects/girl1-test/video_0_1.mp4\",\"file_name\":\"video_0_1.mp4\",\"media_revision\":\"1790401532866049600\",\"source_frame_count\":92,\"continuity_mode\":\"shot\"}]},{\"id\":\"segment-1\",\"index\":1,\"file_path\":\"easy_media/projects/girl1-test/video_1_1.mp4\",\"file_name\":\"video_1_1.mp4\",\"media_revision\":\"1790401966296878700\",\"source_start_frame\":0,\"source_end_frame\":89,\"source_frame_count\":89,\"updated_at\":1790401975.3686404,\"continuity_mode\":\"context\",\"audio_locked\":true,\"enabled\":true,\"video_files\":[{\"file_path\":\"easy_media/projects/girl1-test/video_1_1.mp4\",\"file_name\":\"video_1_1.mp4\",\"media_revision\":\"1790401966296878700\",\"source_frame_count\":89,\"continuity_mode\":\"context\"}]},{\"id\":\"segment-2\",\"index\":2,\"file_path\":\"easy_media/projects/girl1-test/video_2_1.mp4\",\"file_name\":\"video_2_1.mp4\",\"media_revision\":\"1790402384710858100\",\"source_start_frame\":0,\"source_end_frame\":70,\"source_frame_count\":70,\"updated_at\":1790402393.6353908,\"continuity_mode\":\"context\",\"audio_locked\":true,\"enabled\":true,\"video_files\":[{\"file_path\":\"easy_media/projects/girl1-test/video_2_1.mp4\",\"file_name\":\"video_2_1.mp4\",\"media_revision\":\"1790402384710858100\",\"source_frame_count\":70,\"continuity_mode\":\"context\"}]},{\"id\":\"segment-3\",\"index\":3,\"file_path\":\"easy_media/projects/girl1-test/video_3_1.mp4\",\"file_name\":\"video_3_1.mp4\",\"media_revision\":\"1790402845906843700\",\"source_start_frame\":0,\"source_end_frame\":86,\"source_frame_count\":86,\"updated_at\":1790402855.0691645,\"continuity_mode\":\"context\",\"audio_locked\":true,\"enabled\":true,\"video_files\":[{\"file_path\":\"easy_media/projects/girl1-test/video_3_1.mp4\",\"file_name\":\"video_3_1.mp4\",\"media_revision\":\"1790402845906843700\",\"source_frame_count\":86,\"continuity_mode\":\"context\"}]}],\"auto_combine\":true,\"updated_at\":1790402855.0691645}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 36,
|
||||||
|
"type": "easy saveVideo",
|
||||||
|
"pos": [
|
||||||
|
4650,
|
||||||
|
1700
|
||||||
|
],
|
||||||
|
"size": [
|
||||||
|
711.5839976647849,
|
||||||
|
569.2309320100449
|
||||||
|
],
|
||||||
|
"flags": {},
|
||||||
|
"order": 14,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "input_mode.fps",
|
||||||
|
"type": "FLOAT",
|
||||||
|
"link": 105
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "input_mode.images",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 106
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "input_mode.audio",
|
||||||
|
"type": "AUDIO",
|
||||||
|
"link": 107
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "filename_prefix",
|
||||||
|
"type": "STRING",
|
||||||
|
"link": 108
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "VIDEO",
|
||||||
|
"type": "VIDEO",
|
||||||
|
"links": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "file_path",
|
||||||
|
"type": "STRING",
|
||||||
|
"links": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "easy saveVideo",
|
||||||
|
"ue_properties": {
|
||||||
|
"widget_ue_connectable": {
|
||||||
|
"input_mode": true,
|
||||||
|
"output_mode": true,
|
||||||
|
"filename_prefix": true
|
||||||
|
},
|
||||||
|
"version": "7.8",
|
||||||
|
"input_ue_unconnectable": {}
|
||||||
|
},
|
||||||
|
"cnr_id": "comfyui-easy-media",
|
||||||
|
"ver": "e1893122c0e5a26d3544e99e4b35124d64901e66"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
"images+audio",
|
||||||
|
24,
|
||||||
|
"save",
|
||||||
|
false,
|
||||||
|
"ComfyUI"
|
||||||
|
],
|
||||||
|
"widgets_values_named": {
|
||||||
|
"input_mode": "images+audio",
|
||||||
|
"input_mode.fps": 24,
|
||||||
|
"output_mode": "save",
|
||||||
|
"output_mode.save_metadata": false,
|
||||||
|
"filename_prefix": "ComfyUI"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"links": [
|
||||||
|
[
|
||||||
|
201,
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
101,
|
||||||
|
0,
|
||||||
|
"MODEL"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
202,
|
||||||
|
100,
|
||||||
|
1,
|
||||||
|
102,
|
||||||
|
2,
|
||||||
|
"CLIP"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
203,
|
||||||
|
100,
|
||||||
|
2,
|
||||||
|
102,
|
||||||
|
3,
|
||||||
|
"VAE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
204,
|
||||||
|
100,
|
||||||
|
3,
|
||||||
|
102,
|
||||||
|
4,
|
||||||
|
"VAE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
205,
|
||||||
|
101,
|
||||||
|
0,
|
||||||
|
102,
|
||||||
|
1,
|
||||||
|
"MODEL"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
103,
|
||||||
|
35,
|
||||||
|
0,
|
||||||
|
102,
|
||||||
|
0,
|
||||||
|
"TRACKS_INFO"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
104,
|
||||||
|
102,
|
||||||
|
0,
|
||||||
|
103,
|
||||||
|
0,
|
||||||
|
"STRING"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
105,
|
||||||
|
103,
|
||||||
|
4,
|
||||||
|
36,
|
||||||
|
0,
|
||||||
|
"FLOAT"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
106,
|
||||||
|
103,
|
||||||
|
2,
|
||||||
|
36,
|
||||||
|
1,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
107,
|
||||||
|
102,
|
||||||
|
1,
|
||||||
|
36,
|
||||||
|
2,
|
||||||
|
"AUDIO"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
108,
|
||||||
|
103,
|
||||||
|
1,
|
||||||
|
36,
|
||||||
|
3,
|
||||||
|
"STRING"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"title": "Moxie Pipeline (Consolidated)",
|
||||||
|
"bounding": [
|
||||||
|
3040,
|
||||||
|
1620,
|
||||||
|
1960,
|
||||||
|
900
|
||||||
|
],
|
||||||
|
"color": "#3f789e",
|
||||||
|
"flags": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"config": {},
|
||||||
|
"extra": {
|
||||||
|
"ds": {
|
||||||
|
"scale": 0.26333125430607984,
|
||||||
|
"offset": [
|
||||||
|
-1277.2884276466598,
|
||||||
|
-1411.6173313537279
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ue_links": [],
|
||||||
|
"anomalous_hashes": {
|
||||||
|
"10_qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors": {
|
||||||
|
"hash": "",
|
||||||
|
"size": 15687142551
|
||||||
|
},
|
||||||
|
"11_Minimax-h3_Singularity_ref2va_v1.3_int8.safetensors": {
|
||||||
|
"hash": "",
|
||||||
|
"size": 34004507622
|
||||||
|
},
|
||||||
|
"6_minimax_h3_ref2v_turbo_4step_v0.1_comfyui_bf16.safetensors": {
|
||||||
|
"hash": "",
|
||||||
|
"size": 1956193000
|
||||||
|
},
|
||||||
|
"21_taeh3.safetensors": {
|
||||||
|
"hash": "",
|
||||||
|
"size": 9791388
|
||||||
|
},
|
||||||
|
"2_minimax_h3_video_vae_int8_convrot.safetensors": {
|
||||||
|
"hash": "",
|
||||||
|
"size": 3171670912
|
||||||
|
},
|
||||||
|
"1_minimax_h3_audio_vae_fp32.safetensors": {
|
||||||
|
"hash": "",
|
||||||
|
"size": 605254808
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"frontendVersion": "1.53.6",
|
||||||
|
"VHS_latentpreview": false,
|
||||||
|
"VHS_latentpreviewrate": 0,
|
||||||
|
"VHS_MetadataImage": true,
|
||||||
|
"VHS_KeepIntermediate": true,
|
||||||
|
"links_added_by_ue": []
|
||||||
|
}
|
||||||
|
}
|
||||||
1435
Moxie.json
Normal file
556
README.md
Normal file
@ -0,0 +1,556 @@
|
|||||||
|
<div align="center">
|
||||||
|
|
||||||
|
<img src="https://github.com/user-attachments/assets/fb602a3c-4a2a-48da-8c44-d36417f4633b" height="120">
|
||||||
|
<h1>Moxie Multimedia Suite</h1>
|
||||||
|
|
||||||
|
[Changelog](./CHANGELOG.md)
|
||||||
|
|
||||||
|
**Moxie Multimedia Suite** is a unified ComfyUI custom node suite merging the media loading, timeline orchestration, and video pipeline assembly capabilities of **ComfyUI-Easy-Media** with the high-resolution live preview and sampling enhancements of **ComfyUI-KJNodes**. It provides streamlined, consolidated nodes designed to turn complex multi-node workflows into clean, production-ready pipelines where users only adjust essential creative controls.
|
||||||
|
|
||||||
|
|
||||||
|
[![][github-release-shield]][github-release-link]
|
||||||
|
[![][github-stars-shield]][github-stars-link]
|
||||||
|
[![][github-forks-shield]][github-forks-link]
|
||||||
|
[![][github-license-shield]][github-license-link]
|
||||||
|
[![][workflow-shield]][workflow-link]
|
||||||
|
|
||||||
|
<img src="https://github.com/user-attachments/assets/cb2ff081-cb73-4d26-87f0-49380c4d6360" style="width:100%">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
## 📦 Overview & Architecture
|
||||||
|
|
||||||
|
Moxie Multimedia Suite consolidates multi-node setups into a concise pipeline:
|
||||||
|
|
||||||
|
```text
|
||||||
|
[Moxie Multimedia Loader] ───────────────┬─────────► [Moxie Preview Override] (live preview)
|
||||||
|
│ │
|
||||||
|
▼ ▼ (FAST_MODEL_LOADER)
|
||||||
|
[easy multiTrackEditor] ── (TRACKS_INFO) ──► [Moxie MultiTrack Project] (controls: steps, seed)
|
||||||
|
│ (PROJECT_NAME)
|
||||||
|
▼
|
||||||
|
[Moxie Project Video Combine]
|
||||||
|
│ (images, audio, fps, prefix)
|
||||||
|
▼
|
||||||
|
[easy saveVideo]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Consolidated Core Nodes
|
||||||
|
|
||||||
|
| Node | Description |
|
||||||
|
|---|---|
|
||||||
|
| **Moxie Multimedia Loader** (`MoxieMultimediaLoader`) | Self-contained loader reading from local `models/` subdirectories (`diffusion`, `loras`, `vae`, `audio_vae`, `clip`). Chains **Diffusion Model → Attention Backend (`comfy_kitchen_int8`) → LoRA Loader** and outputs individual models as well as the bundled `FAST_MODEL_LOADER` object. |
|
||||||
|
| **Moxie Preview Override** (`MoxiePreviewOverride`) | Ported from ComfyUI-KJNodes' Model Preview Override. Intercepts outer-sampling iterations to stream full-resolution animated video/audio preview frames directly to the node canvas widget using `taeh3` / tiny VAE decoders. |
|
||||||
|
| **Moxie MultiTrack Project** (`MoxieProject`) | Consolidates `easy multitrackProject` + `KSamplerSelect` (euler) + `BasicScheduler` (beta scheduler) + `ManualSigmas`. Hardcodes tested single-pass settings while exposing only **`steps`**, **`seed`**, and **`project_name`**. |
|
||||||
|
| **Moxie Project Video Combine** (`MoxieCombine`) | Consolidates `easy multitrackProjectVideoCombine` + `GetVideoComponents`. Assembles rendered segments and outputs `images`, `audio`, `fps`, and `FILENAME_PREFIX` directly into `easy saveVideo`. |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 Installation
|
||||||
|
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> It is strongly recommended that before installing this node package, you first ensure that `FFmpeg` has already been installed in your system environment
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd Your_ComfyUI_Path/custom_nodes
|
||||||
|
git clone https://github.com/yolain/ComfyUI-Easy-Media.git
|
||||||
|
```
|
||||||
|
|
||||||
|
## ✏️ Example Workflows
|
||||||
|
|
||||||
|
After installing, open ComfyUI and find the bundled example workflows in the **Templates** panel on the left sidebar — look for entries under **ComfyUI-Easy-Media**.
|
||||||
|
|
||||||
|
<a id="multitrack-workflow-skill"></a>
|
||||||
|
|
||||||
|
### 🤖 Generate MultiTrack Workflows with a Skill
|
||||||
|
|
||||||
|
The package includes the `easy-media-multitrack-workflow` Skill. Give Codex your assets and requirements in natural language to create a workflow from the bundled template or modify an existing one, automatically configuring the timeline, prompts, continuity modes, and sampling settings.
|
||||||
|
|
||||||
|
```text
|
||||||
|
Use $easy-media-multitrack-workflow to create three 5-second tasks from these reference images and prompts.
|
||||||
|
Use Shot for the first segment and Context for the next two, then generate a new workflow JSON.
|
||||||
|
```
|
||||||
|
|
||||||
|
By default, the Skill only generates JSON. When explicitly asked to run the workflow, it can upload assets and submit it to ComfyUI. See the [Skill documentation](./skills/easy-media-multitrack-workflow/README.md) for installation and detailed usage.
|
||||||
|
|
||||||
|
## ✨ Features
|
||||||
|
|
||||||
|
### 🎞️ (New) MultiTrack Project Pipeline
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Introduced in v1.3.0, the MultiTrack Project Pipeline connects timeline arrangement, segment generation, context continuity, and final video assembly. **MultiTrack Project currently supports MiniMax H3**; MultiTrack Editor remains independent of any model and can still feed other model workflows.
|
||||||
|
|
||||||
|
Use the [workflow generation Skill](#multitrack-workflow-skill) to configure this pipeline through natural language, either from a blank template or by modifying an existing workflow.
|
||||||
|
|
||||||
|
```text
|
||||||
|
MultiTrack Editor ── TRACKS_INFO ──→ MultiTrack Project ── PROJECT_NAME ──→ MultiTrack Project Video Combine ── VIDEO ──→ SaveVideo
|
||||||
|
↑
|
||||||
|
model_loader
|
||||||
|
(optional model_loader_2nd)
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> **v1.3.0 loads media on demand.** When a timeline has no Slot references, the editor no longer loads all images, audio, and video in advance. Its `IMAGES`, `AUDIO`, and `VIDEO` outputs are `None` by design. The project pipeline only needs `TRACKS_INFO`; older workflows that consume media directly should use [MultiTrack Task Output](#multitrack-lazy-loading).
|
||||||
|
|
||||||
|
#### 1. MultiTrack Editor: Tasks and Continuity
|
||||||
|
|
||||||
|
Select the `MiniMax` format, set the target dimensions and frame rate, enter prompts for each task segment, and add reference images, video, or audio as needed. See the [MultiTrack Editor overview](#multitrack-editor) below for tracks, task modes, and media editing.
|
||||||
|
|
||||||
|
The new **continuity mode** determines how a task follows the previous segment. It is configured separately from task modes such as text-to-video, image-to-video, and reference-to-video:
|
||||||
|
|
||||||
|
| Continuity Mode | Generation Behavior | Use Cases |
|
||||||
|
|-----------------|---------------------|-----------|
|
||||||
|
| **Shot (`shot`)** | Generates independently, without inheriting motion or audio context from the previous segment | New shots, scene changes, and deliberate cuts |
|
||||||
|
| **Context (`context`)** | Uses the tail of the previous result's audio/video latent to continue motion and sound | Continuous action, long takes, and ongoing audio |
|
||||||
|
| **Character Swap Context (`context_swap`)** | Uses disposable tapered noise on the previous video context in both sampling passes while preserving its audio | Character or appearance replacement that should retain the previous motion |
|
||||||
|
|
||||||
|
The first segment starts in Shot mode. Set subsequent segments individually or select multiple tasks to change them together. For example, “Shot → Context → Context → Shot” creates three connected segments followed by a new shot. This setting affects **generation**, rather than adding a crossfade during assembly. Context does not guarantee seamless continuity across arbitrary scene or prompt changes.
|
||||||
|
|
||||||
|
#### 2. MultiTrack Project: Encoding, Sampling, and Segment Loops
|
||||||
|
|
||||||
|
Connect the editor's `TRACKS_INFO` to `tracks_info`, then connect a `model_loader` containing the H3 model, CLIP, video VAE, and audio VAE. The node automatically expands the tasks in sequence, so no manual segment-index loop is needed:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Read task and load media on demand → Encode prompts and reference conditioning → First pass
|
||||||
|
→ [Optional: upscale video latent → Second pass] → Decode audio/video → Trim context overlap
|
||||||
|
→ Save segment and context → Process next task → Output project name
|
||||||
|
```
|
||||||
|
|
||||||
|
Each segment uses its own prompts, references, and continuity mode. With Context enabled, the first pass uses the previous segment's context at the corresponding resolution; the second pass uses its final high-resolution result to preserve the join. Each segment is saved before the next one runs. You can choose a starting segment and count, or save a first-pass preview and resume the second pass later. See [MultiTrack Project details](#multitrack-project) for settings, upscaler dependencies, and the context implementation's source and adaptations.
|
||||||
|
|
||||||
|
#### 3. MultiTrack Project Video Combine: Preview, Select, and Export
|
||||||
|
|
||||||
|
Connect `PROJECT_NAME` to the combine node to preview saved segments, choose a version for each, and assemble the final video. **Auto combine** produces a complete video in one workflow run. Turn it off to review results first, then click **Combine** to run only assembly and downstream saving without re-running the model. If a segment has multiple generated versions, select two for synchronized comparison before choosing the final version. See [MultiTrack Project Video Combine](#multitrack-project-video-combine) for details.
|
||||||
|
|
||||||
|
<a id="multitrack-editor"></a>
|
||||||
|
|
||||||
|
### 🎞️ MultiTrack Editor
|
||||||
|
|
||||||
|
|
||||||
|
> **Tips:** The advantage of the multi-track editor is its decoupling design — it is used solely for media editing and loading, and is not bound to any model. Users can freely choose any model node to process the media data output by the multi-track editor.
|
||||||
|
|
||||||
|
`easy multiImagesLoader` provides the same resolution choices for an ordered list of up to 25 images. Add images through the media selector or drop image files onto the grid; the node resizes each image and outputs an IMAGE list in grid order.
|
||||||
|
|
||||||
|
#### Overview
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### Tracks
|
||||||
|
|
||||||
|
| Track Type | Description |
|
||||||
|
| - | - |
|
||||||
|
| Task Track | Supports multiple task type definitions such as t2v, i2v, r2v, v2v |
|
||||||
|
| Video Track | Import and manage video clips, supporting multi-segment video stitching and intelligent segmentation |
|
||||||
|
| Audio Track | Import and manage audio clips, supporting multi-segment audio stitching |
|
||||||
|
| Subtitle Track | Add subtitles recognized from audio/video |
|
||||||
|
|
||||||
|
- Task segments are the core of this node; workflows can be designed for automatic looping based on the number of task track segments
|
||||||
|
- When adding video clips to the video track, corresponding task segments will be automatically added with matching duration
|
||||||
|
- Selecting a task segment allows you to set image, task type, and user prompt / system prompt (defaults exist based on task type, or you can write your own)
|
||||||
|
- The MultiTrack Info Output node outputs video dimensions, total frame count, frame rate, and task count
|
||||||
|
- The MultiTrack Task Output node outputs user prompt & system prompt for corresponding segments; users can decide whether to connect LLM nodes for prompt expansion or use images in segments for reverse inference
|
||||||
|
|
||||||
|
<a id="multitrack-lazy-loading"></a>
|
||||||
|
|
||||||
|
#### v1.3.0 Lazy Media Loading and Workflow Migration
|
||||||
|
|
||||||
|
The editor passes time ranges, prompts, media locations, and track settings through `TRACKS_INFO`. Downstream output nodes load the required media when processing each task, reducing the cost of decoding and assembling an entire long timeline in advance. Metadata probing, frontend thumbnails, and waveform previews are separate from loading complete media for workflow execution.
|
||||||
|
|
||||||
|
| Timeline Sources | Editor Outputs | How to Access Media |
|
||||||
|
|------------------|----------------|---------------------|
|
||||||
|
| Files or URLs, **without Slot references** | `TRACKS_INFO` is available; media outputs are `None` | Connect `TRACKS_INFO` to MultiTrack Project or MultiTrack Task Output for loading on demand |
|
||||||
|
| **Slot references** to upstream image, audio, or video inputs | Retains immediate loading and media outputs; requests only the input types actually referenced | Continue using the editor's media outputs and companion output nodes |
|
||||||
|
|
||||||
|
If an older workflow connects directly to the editor's media outputs, insert `MultiTrack Task Output (easy multiTrackTaskOutput)`:
|
||||||
|
|
||||||
|
- **Process one segment at a time:** Connect `TRACKS_INFO` and set `task_index = 0, 1, 2…` to retrieve media for the corresponding task range.
|
||||||
|
- **Retrieve all media at once:** Set `task_index = -1` to output the entire timeline's media, replacing the editor's former full-media output behavior. This restores the resource cost of loading the full timeline.
|
||||||
|
- **Read only dimensions, frame rate, total frames, and task count:** Use `MultiTrack Info Output`; complete media loading is unnecessary for this metadata.
|
||||||
|
- **Use the project pipeline:** MultiTrack Project calls Task Output internally, so no extra Task Output node is needed between the editor and the project.
|
||||||
|
|
||||||
|
#### v1.3.x Task and Audio Settings
|
||||||
|
|
||||||
|
- **Task track:** Adds Shot / Context / Character Swap Context continuity modes. Select multiple task segments to change their task mode, continuity mode, and reference image size together.
|
||||||
|
- **Lock audio:** In MultiTrack Project, the input audio constrains visual generation, and the delivered video uses the original task audio instead of regenerating it. This differs from using audio only as a reference.
|
||||||
|
- **Reuse audio:** Share the same reference audio across tasks without copying it under every segment. Up to 15 seconds are used, without truncating it to a shorter task duration.
|
||||||
|
|
||||||
|
#### Use Cases
|
||||||
|
|
||||||
|
| Scenario | Description | Requirements |
|
||||||
|
|----------|-------------|-------------|
|
||||||
|
| Video Generation | MiniMax H3/wan/bernini/ltx t2v, i2v, r2v | Task track segments only |
|
||||||
|
| Video Editing | bernini v2v, bernini vi2v, wan animate, ltx video replace, ltx iclora edit/inpaint/outpaint | Video track segments + task track segments |
|
||||||
|
| Video Reference | wan scail2, wan animate, ltx iclora guide | Video track segments + task track segments |
|
||||||
|
| Video Dubbing | wan infinititalk, longcat avatar, ltx ai2v | Task track segments + audio track segments |
|
||||||
|
| Video Subtitles | - | Task track segments + subtitle track segments |
|
||||||
|
|
||||||
|
- Only the most common open-source model generation types are listed; theoretically any video model pipeline can use the multi-track editor as a preprocessing tool
|
||||||
|
|
||||||
|
#### Optional Models
|
||||||
|
|
||||||
|
| Scenario | Description | Download | Local Path | Prerequisites
|
||||||
|
| - | - | - | - | - |
|
||||||
|
| **Video Subtitles (Whisper)** | Audio/video recognition to generate subtitles | [Whisper Large V3](https://huggingface.co/Comfy-Org/HuMo_ComfyUI/tree/main/split_files/audio_encoders) | models/audio_encoders/ | `pip install openai-whisper` |
|
||||||
|
| **Video Subtitles (Qwen3)** | Audio/video recognition to generate subtitles | [Qwen3-ASR](https://huggingface.co/Qwen/Qwen3-ASR-1.7B) <br> [Qwen3-ForcedAligner](https://huggingface.co/Qwen/Qwen3-ForcedAligner-0.6B) | models/Qwen3-ASR/ | `pip install qwen-asr torchaudio` |
|
||||||
|
| **Subtitle Narration** | Convert subtitles to speech voiceover | [VoxCPM2](https://huggingface.co/openbmb/VoxCPM2) | models/voxcpm/ | `pip install voxcpm` |
|
||||||
|
| **Shot Detection** | Intelligently segment video shots | [OmniShotCut](https://huggingface.co/uva-cv-lab/OmniShotCut/resolve/main/OmniShotCut_ckpt.pth) | models/checkpoints | - |
|
||||||
|
|
||||||
|
> **Note:** Some models support automatic download via the built-in Easy-Media model download interface. Model files will be placed in the `ComfyUI/models/` directory.
|
||||||
|
|
||||||
|
<a id="multitrack-project"></a>
|
||||||
|
|
||||||
|
### 🎞️ MultiTrack Project
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
`easy multitrackProject` manages segment-by-segment generation for MiniMax H3 projects. The editor's dimensions are the **first-pass dimensions**; dual sampling scales up from this size for the second pass. Project files are stored in `ComfyUI/output/easy_media/projects/<project_name>/`, including segment media, project records, and context latents for continuation.
|
||||||
|
|
||||||
|
#### Encoding and Sampling
|
||||||
|
|
||||||
|
1. **Read and encode the task:** Load its prompts and media, build conditioning for text-to-video, first/last frames, last-frame-only, or multimedia references according to the task mode, and create audio/video latents. When audio is locked, encode it and apply sampling constraints.
|
||||||
|
2. **First pass:** Both `sampling_mode = single` and `dual` generate at the editor's configured dimensions. The first-pass size is not reduced based on `upscale_by`.
|
||||||
|
3. **Upscale and second pass (`dual` only):** Multiply each configured dimension by `upscale_by`, then align to the nearest multiple of 32 using `round(dimension * upscale_by / 32) * 32`. Upscale the first-pass video latent to this size, recombine it with the audio latent, and sample again. Rebuild reference conditioning when dimensions change. Setting `upscale_by = 1.000` skips resizing but still allows a second pass.
|
||||||
|
4. **Decode and save:** Decode video and audio. For Context segments, trim the repeated guide prefix and extra trailing frames required by the temporal grid before saving the segment.
|
||||||
|
5. **Continue to the next segment:** Save context and project records, then process subsequent tasks automatically. Shot starts a new shot; Context inherits the previous segment. Finally, output `PROJECT_NAME` for the combine node.
|
||||||
|
|
||||||
|
| Setting | Description |
|
||||||
|
|---------|-------------|
|
||||||
|
| `model_loader` | First-pass H3 model and shared CLIP, video VAE, and audio VAE; video projects also require the audio VAE |
|
||||||
|
| `model_loader_2nd` | Optional second-pass H3 model; defaults to the first-pass model. Even when connected, encoding and VAEs still come from the first-pass loader |
|
||||||
|
| `sampling_plan` | Built-in presets such as `ultra_light`, `light`, `medium`, and `high` select samplers and sigmas for Turbo / non-Turbo models; use `custom` for manual settings |
|
||||||
|
| `sampling_mode` | `single`, `dual`, or `selflift`; SelfLift expands `transition_ratio`, `lowres_scale`, and the optional `highres_tiling` switch. Pixel/VAE correction is disabled for ordinary segments and uses an internal conservative preset for context continuation. SelfLift also saves separate low- and high-resolution context lineages |
|
||||||
|
| `sampler` / `sigmas` | Connect both to override first-pass sampling. Second-pass overrides use `sampler_2nd` / `sigmas_2nd`, also as a pair. `custom` requires both inputs for every sampling pass that runs |
|
||||||
|
| `upscale_by` | Second-pass scale relative to the editor dimensions; default `1.250`, three decimal places, step `0.001` |
|
||||||
|
| `disable_2nd_noise` | Disables added second-pass noise; it does not skip the second pass |
|
||||||
|
| `1st_pass_only` | In `dual` mode, runs and checkpoints **only the first pass of the first selected segment**. Disable it on the next run to resume that segment at the second pass |
|
||||||
|
|
||||||
|
Alignment uses Python `round`, matching [the H3 latent upscaler](https://github.com/LBH-123-AI/Comfyui_Minimax_h3_latent_Upscaler/blob/main/nodes/minimax_h3_latent_upscaler_3d.py); it is not always upward, and exact ties round to the even integer. For example, `1344 × 768` at `1.250` becomes `1680 × 960` before alignment and **`1664 × 960`** for the second pass. Both upscaling paths use this size, and project records and combined exports retain the resulting dimensions. Single-pass generation and first-pass-only previews keep the editor dimensions; audio-only projects (`32 × 32`) do not upscale. Existing workflows retain their saved multiplier rather than automatically adopting the new default.
|
||||||
|
|
||||||
|
To customize presets, copy [h3_sample.json.example](./presets/h3_sample.json.example) to `presets/h3_sample.json` and edit it. **The current built-in dual-sampling presets use separate first- and second-pass sigma schedules.** Do not assume that `light` always splits sigmas and leaves the first pass incomplete. A custom preset with `split_step` explicitly splits one sigma schedule across both passes. Existing custom files take precedence, so review your configuration after upgrading.
|
||||||
|
|
||||||
|
#### Second-Pass Upscalers and Dependencies
|
||||||
|
|
||||||
|
| `upscale_model` | Upscaling Path | Dependencies |
|
||||||
|
|-----------------|----------------|--------------|
|
||||||
|
| An H3 latent upscaler model | Calls the bundled `easy minimaxH3LatentUpscaler` node to upscale the video latent directly to the scaled, aligned second-pass dimensions | Place the [H3 upscaler weights](https://huggingface.co/LBH-123-AI/Minimax_h3_latent_Upscaler) in `ComfyUI/models/latent_upscale_models/`; the external custom-node package is not required |
|
||||||
|
| `None` | Decode the first-pass video with the VAE → Resize images → Re-encode with the VAE → Second pass | Requires `ImageResizeKJv2` from [ComfyUI-KJNodes](https://github.com/kijai/ComfyUI-KJNodes) |
|
||||||
|
|
||||||
|
`upscale_model` selects **H3 latent upscaler weights**, which serve a different purpose from the H3 generation model in `model_loader_2nd`. Direct latent upscaling avoids the intermediate video VAE decode/encode round trip, but the second pass still runs at the target resolution; its VRAM requirements do not decrease proportionally. Easy Media includes the inference node and runtime; only the checkpoint is downloaded separately.
|
||||||
|
|
||||||
|
The standalone `easy minimaxH3LatentUpscaler` node exposes `enable_temporal_chunking` and `force_unload`. Both default to enabled; MultiTrack's internal latent-upscale path also enables both explicitly. Temporal chunking lowers peak memory for long latents, while forced unload releases the upscaler from VRAM after inference.
|
||||||
|
|
||||||
|
For example, download `minimax_h3_latent_upscaler_3d_fp16.safetensors` from the model repository above, place it in the specified directory, restart ComfyUI, and select it under `upscale_model`. Its documentation specifies a 1–4× scaling range. Follow the selected model's supported range even if the project parameter accepts larger values.
|
||||||
|
|
||||||
|
#### Context Implementation: Source and Adaptations
|
||||||
|
|
||||||
|
Context conditioning is based on [NikoDemon80 / ComfyUI-H3-Motion-Context](https://github.com/NikoDemon80/ComfyUI-H3-Motion-Context), adapted inside Easy Media for project loops and dual sampling. The current hard-continuity implementation requires native H3 audio/video keyframe support in ComfyUI (0.34.0+). Check ComfyUI compatibility when upgrading.
|
||||||
|
|
||||||
|
In addition to attaching the previous segment's context conditioning, the project pipeline applies these adaptations:
|
||||||
|
|
||||||
|
- **First-pass hard continuity:** Preserves native audio/video keyframes and existing multimedia references, while copying the previous segment's audio/video tail into the current starting latent. Separate video and audio masks lock and gradually release the copied region, allowing new content to emerge around the join.
|
||||||
|
- **Separate low- and high-resolution context:** In dual sampling, the first pass inherits the previous segment's first-pass context. After upscaling, the second pass copies the previous final high-resolution video tail into the current high-resolution latent, rather than merely enlarging the low-resolution join. Context second-pass sampling freezes the current audio to retain continuity established in the first pass.
|
||||||
|
- **Context-specific second-pass sigmas:** Built-in presets provide `sigmas_2nd_context = 0.50, 0.30, 0.14, 0.06, 0.0` for second passes with previous-segment context. Explicit custom second-pass sampler or sigma inputs prevent this substitution.
|
||||||
|
- **Synchronized trimming and clean continuation sources:** By default, the project takes the previous segment's last 22 frames as context and reserves 34 extra generation frames to satisfy H3's temporal grid. After decoding, it removes the repeated prefix and excess tail, retaining the task's required frame count. It then re-encodes context from the actual delivered audio/video range so subsequent segments do not inherit discarded tail frames.
|
||||||
|
- **Memory-bounded high-resolution context:** Before the next segment starts, the high-resolution continuation latent is reduced to the 22-frame video/audio tail, detached from the full sampling result, and moved to CPU. Project artifacts store the same context-only high-resolution payload after second-pass completion. The complete low-resolution first-pass latent remains saved so a `1st pass only` run can resume its second pass later; runtime context handoffs use a separate trimmed copy.
|
||||||
|
- **Automatic handoff and resuming across runs:** Context passes automatically between segments in one run. When starting from a later segment, the project loads context from the previous segment's active saved version, without manually wiring Save / Load Latent nodes.
|
||||||
|
|
||||||
|
> **Note:** Context continuation requires the previous segment's saved latents; an MP4 alone is insufficient. After changing editor dimensions, scaling factor, or the previous segment's version, check the downstream context chain. Regenerate first-pass checkpoints and context latents created with the old reduced-first-pass sizing before resuming with the new sizing behavior. Existing later segments are not automatically regenerated when an earlier segment changes.
|
||||||
|
|
||||||
|
#### Generation Ranges, Regeneration, and Version Retention
|
||||||
|
|
||||||
|
| Setting | Behavior |
|
||||||
|
|---------|----------|
|
||||||
|
| `project_name` | Identifies the project directory and records; use the same name when resuming |
|
||||||
|
| `segment_start_number` | Starting segment, **counting from 1**, unlike the zero-based `task_index` in MultiTrack Task Output |
|
||||||
|
| `segment_count` | Maximum segments to generate in this run; `-1` processes all remaining segments from the start |
|
||||||
|
| `project_save = new` | Preserves existing results in the same project and adds versions for regenerated segments, allowing comparison |
|
||||||
|
| `project_save = override` | Replaces the corresponding segment version. With `segment_count = -1`, clears saved segments from the start onward before regeneration; a first-pass checkpoint being resumed is preserved |
|
||||||
|
|
||||||
|
For example, to regenerate only segment 3, set `segment_start_number = 3` and `segment_count = 1`. Choose `project_save = new` to retain the old result for comparison. If segment 3 uses Context, the project must contain compatible context from segment 2. After accepting the new segment 3, regenerate any later Context segments that depend on it.
|
||||||
|
|
||||||
|
<a id="multitrack-project-video-combine"></a>
|
||||||
|
|
||||||
|
### 🎞️ MultiTrack Project Video Combine
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
`easy multitrackProjectVideoCombine` reads saved video segments from a project. Preview them sequentially on the timeline **without first creating a merged file**. Use the project selector to switch projects or refresh saved results.
|
||||||
|
|
||||||
|
#### Automatic and Manual Combining
|
||||||
|
|
||||||
|
- **Auto combine (enabled by default):** After project generation finishes, reads the current segments, concatenates them in timeline order, and outputs `VIDEO` and `FILENAME_PREFIX`. Connect an output node such as `SaveVideo` to save the final video.
|
||||||
|
- **Manual combine:** With Auto combine disabled, the project still generates and saves individual segments, while the combine node updates the preview without sending a merged result downstream. Review and select your clips, wait for the ComfyUI queue to empty, then click **Combine**. Only this node and its downstream nodes are queued; upstream encoding and sampling are not repeated.
|
||||||
|
- **Saving requirements:** Connect a downstream video save output before combining manually. The combine node provides a temporary merged video; the save node controls the final path and filename. Use `FILENAME_PREFIX` as a naming prefix if desired.
|
||||||
|
|
||||||
|
#### Segment Versions and Comparison
|
||||||
|
|
||||||
|
After regenerating with `project_save = new`, click a timeline segment to open its video file list:
|
||||||
|
|
||||||
|
1. **Select one video:** Use that version for project preview and assembly.
|
||||||
|
2. **Select two videos:** Enter synchronized comparison to review results from different seeds, prompts, or sampling settings. Each segment allows at most two selected versions at a time.
|
||||||
|
3. **Keep one after comparing:** Deselect the unwanted version, then combine manually. Selecting two is only for comparison: assembly still uses the primary version (the first in the current selection list), not the comparison layout or both versions together.
|
||||||
|
|
||||||
|
Segments display their Shot / Context mode to help review joins. Selecting an older version changes the assembled clip but does not repair already-generated downstream context. If versions end with different motion or audio, regenerate the affected later segments. Deleting a segment version or an entire project also deletes associated files and context; make sure they are no longer needed for resuming.
|
||||||
|
|
||||||
|
> **Scope:** This node is for video projects. Audio-only projects with editor dimensions set to `32 × 32` cannot use it to combine video.
|
||||||
|
|
||||||
|
### 🎞️ Subtitle To Video
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 🎞️ Compare Videos
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🎞️ SaveVideo
|
||||||
|
|
||||||
|

|
||||||
|
> Integrated and enhanced the video saving node from the SaveVideoRGBA node package. Supports video export with customizable output path, filename prefix, frame rate, and other parameters.
|
||||||
|
|
||||||
|
### 🎞️ Merge Videos From Paths
|
||||||
|
|
||||||
|
> Load video files from a list of file paths (or URLs) and concatenate them into a single video output.
|
||||||
|
|
||||||
|
The `trim_frame_count` parameter defaults to `-1`, which keeps all frames of the merged video. When set to a value greater than `0`, the node calculates the duration based on the merged video's frame rate and uses FFmpeg to trim the final video.
|
||||||
|
|
||||||
|
## Development & Testing
|
||||||
|
|
||||||
|
1. Create a `config.yaml` file in the ComfyUI-Easy-Media directory and add the following content to enable frontend development mode:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
WEB_VERSION: dev
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Navigate to the frontend directory and compile the development code for debugging:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cd frontend && bun install && bun run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
3. After modifying the code, compile for production:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
bun run build:release
|
||||||
|
```
|
||||||
|
|
||||||
|
## Node List
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Category</th>
|
||||||
|
<th>Node ID</th>
|
||||||
|
<th>Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="4">🎞️ Multi-Track Editor</td>
|
||||||
|
<td>easy multiTrackEditor</td>
|
||||||
|
<td>Edit multi-track timelines and pass track information; defer media loading to downstream nodes when there are no Slot references</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy multiTrackInfoOutput</td>
|
||||||
|
<td>Output multi-track dimensions, duration, frame rate, and task count</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy multiTrackTaskOutput</td>
|
||||||
|
<td>Load and output task prompts and media on demand; task_index = -1 outputs media for the entire timeline</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy multiTrackAddSubtitleToVideo</td>
|
||||||
|
<td>Add subtitle track to video track</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="7">🎬 MiniMax H3</td>
|
||||||
|
<td>easy minimaxH3ToVideo</td>
|
||||||
|
<td>Build MiniMax H3 text-to-video, reference-to-video, or first/last-frame conditioning and latent inputs</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy MiniMaxH3ReferenceToVideoBridge</td>
|
||||||
|
<td>Bridge node for H3 reference conditioning without Autogrow expansion</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy MiniMaxH3MotionContextHard</td>
|
||||||
|
<td>Apply H3 context conditioning with hard video/audio latent continuity</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy MiniMaxH3HiResContinuity</td>
|
||||||
|
<td>Copy previous high-resolution video tail into current upscaled latent</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy removeH3MotionContextLatent</td>
|
||||||
|
<td>Remove H3 Motion Context latent files after a loop finishes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy multitrackProject</td>
|
||||||
|
<td>Build and execute multi-track MiniMax H3 project with optional first/second-pass sampling</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy multitrackProjectVideoCombine</td>
|
||||||
|
<td>Preview project segments, select versions, compare two videos, and combine automatically or manually</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="5">🎞️ LTX Video</td>
|
||||||
|
<td>LTXVAddGuidesFromBatchIndexes</td>
|
||||||
|
<td>Add guide images from batch images to specified frame indexes of latent variables</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>LTXVMakeRefVideo</td>
|
||||||
|
<td>Expand a reference image batch into an IC-LoRA reference video</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy ltxMultiTrackEncode</td>
|
||||||
|
<td>Build Prompt Relay conditioning and LTX video/audio latents</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy ltxI2VInplaceAndUpsample</td>
|
||||||
|
<td>Optionally upscale an LTX video latent and apply an image guide in place</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy ltxSamplerSimple</td>
|
||||||
|
<td>Sample combined LTX audio/video latents and crop video guides</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="4">🎞️ Timeline Editor</td>
|
||||||
|
<td>easy timelineEditor</td>
|
||||||
|
<td>Load media timeline (prompt, image, audio tracks) and output structured data</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy timelineInfoOutput</td>
|
||||||
|
<td>Output timeline info including formatted prompt, dimensions, and image indexes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy timelineSegmentOutput</td>
|
||||||
|
<td>Output specific segment data from the timeline</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy timelineSegmentCount</td>
|
||||||
|
<td>Output the total number of segments in the timeline</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="8">📋 Media List Operations</td>
|
||||||
|
<td>easy makeImageList</td>
|
||||||
|
<td>Combine multiple image inputs into an image list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy makeAudioList</td>
|
||||||
|
<td>Combine multiple audio inputs into an audio list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy splitAudios</td>
|
||||||
|
<td>Split an audio list into multiple single-audio outputs</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy audioMerge</td>
|
||||||
|
<td>Merge or concatenate up to six audio inputs</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy makeVideoList</td>
|
||||||
|
<td>Combine multiple video inputs into a video list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy splitVideos</td>
|
||||||
|
<td>Split a video list into multiple single-video outputs</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy imageIndexesToIntList</td>
|
||||||
|
<td>Convert comma-separated image index string to integer list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy splitImages</td>
|
||||||
|
<td>Split an image list or batch into multiple single-image outputs</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="5">🎬 Video Operations</td>
|
||||||
|
<td>easy saveVideo</td>
|
||||||
|
<td>Save images and optional audio as video file</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy getAudioFromVideo</td>
|
||||||
|
<td>Extract audio from a VIDEO input</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy mergeVideos</td>
|
||||||
|
<td>Concatenate multiple compatible VIDEO segments</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy mergeVideosFromPaths</td>
|
||||||
|
<td>Load and concatenate videos from file path list, optionally trimming the merged output by frame count</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy compareVideos</td>
|
||||||
|
<td>Preview source and output VIDEO inputs side by side with an interactive comparison slider</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="2">📝 Subtitle</td>
|
||||||
|
<td>easy recognizeSubtitle</td>
|
||||||
|
<td>Recognize subtitles with Qwen3-ASR or Whisper Large V3; configure SRT/timestamp output, sentence length, and model unloading</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy addSubtitleToVideo</td>
|
||||||
|
<td>Normalize multiline SRT, timestamp, or bracket-formatted text and burn it into a video</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="1">🖼️ Reference & Image</td>
|
||||||
|
<td>easy makeRefsCompositeBySam3</td>
|
||||||
|
<td>Detect subject in prompt using SAM3 and composite reference images onto canvas</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="2">🔧 Utility</td>
|
||||||
|
<td>easy matchLine</td>
|
||||||
|
<td>Return zero-based index of the first line containing matching text</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>easy apiWorkflowGate</td>
|
||||||
|
<td>Determine if the workflow is an API call and pass through preceding input items</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="1">🗣️ Speech to Video (S2V)</td>
|
||||||
|
<td>easy berniniS2VConditioning</td>
|
||||||
|
<td>Unified Bernini + Wan S2V conditioning: original optional single-speaker audio, spatially masked single-speaker audio, or optional sequential two-speaker audio</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## Credits & Lineage
|
||||||
|
|
||||||
|
Moxie Multimedia Suite is built upon and merges the work of two foundational custom node ecosystems:
|
||||||
|
- **[ComfyUI-Easy-Media](https://github.com/yolain/ComfyUI-Easy-Media)** by yolain — MultiTrack timeline editor, media orchestration, and MiniMax H3 pipeline architecture.
|
||||||
|
- **[ComfyUI-KJNodes](https://github.com/kijai/ComfyUI-KJNodes)** by kijai — Model preview overrides, animated canvas preview streaming, and sampling enhancement utilities.
|
||||||
|
|
||||||
|
Additional credits:
|
||||||
|
- [OmniShotCut](https://github.com/UVA-Computer-Vision-Lab/OmniShotCut)
|
||||||
|
- [Qwen3-ASR](https://huggingface.co/Qwen/Qwen3-ASR-1.7B)
|
||||||
|
- [Whisper](https://github.com/openai/whisper)
|
||||||
|
- [VoxCPM2](https://github.com/OpenBMB/VoxCPM)
|
||||||
|
- [Bernini S2V](https://huggingface.co/rzgar/Bernini-R-S2V)
|
||||||
|
- [H3 Motion Context](https://github.com/NikoDemon80/ComfyUI-H3-Motion-Context)
|
||||||
|
- [Drift Control for h3 motion context](https://github.com/ethanfel/ComfyUI-MiniMaxH3-Context-Loop)
|
||||||
|
- [MiniMax H3 Latent Upscaler](https://github.com/LBH-123-AI/Comfyui_Minimax_h3_latent_Upscaler)
|
||||||
|
- [SelfLift for H3 Sampling](https://github.com/facok/comfyui-SelfLift)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Source of Inspiration
|
||||||
|
|
||||||
|
- [WhatDreamsCost-ComfyUI](https://github.com/WhatDreamsCost/WhatDreamsCost-ComfyUI)
|
||||||
|
- [ComfyUI-PromptRelay](https://github.com/kijai/ComfyUI-PromptRelay)
|
||||||
|
- [ComfyUI-Licon-MSR](https://github.com/liconstudio/ComfyUI-Licon-MSR)
|
||||||
|
- [ComfyUI-RH-Bernini](https://github.com/RH-RunningHub/ComfyUI-RH-Bernini)
|
||||||
|
|
||||||
|
|
||||||
|
<!-- LINK GROUP -->
|
||||||
|
[github-forks-link]: https://github.com/yolain/ComfyUI-Easy-Media/network/members
|
||||||
|
[github-forks-shield]: https://img.shields.io/github/forks/yolain/ComfyUI-Easy-Media?color=8ae8ff&labelColor=black&style=flat-square
|
||||||
|
[github-license-link]: https://github.com/yolain/ComfyUI-Easy-Media/blob/master/LICENSE
|
||||||
|
[github-license-shield]: https://img.shields.io/github/license/yolain/ComfyUI-Easy-Media?color=white&labelColor=black&style=flat-square
|
||||||
|
[github-release-link]: https://github.com/yolain/ComfyUI-Easy-Media/releases
|
||||||
|
[github-release-shield]: https://img.shields.io/github/v/release/yolain/ComfyUI-Easy-Media?color=f2ff59&labelColor=black&style=flat-square
|
||||||
|
[github-stars-link]: https://github.com/yolain/ComfyUI-Easy-Media/network/stargazers
|
||||||
|
[github-stars-shield]: https://img.shields.io/github/stars/yolain/ComfyUI-Easy-Media?color=ffcb47&labelColor=black&style=flat-square
|
||||||
|
[workflow-shield]: https://img.shields.io/badge/💻-Workflows-efff30?color=e92759&labelColor=black&style=flat-square
|
||||||
|
[workflow-link]:https://www.runninghub.ai/user-center/1847825328541474818/userPost?inviteCode=rh-v1623
|
||||||
152
__init__.py
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
import os
|
||||||
|
import server
|
||||||
|
import yaml
|
||||||
|
import nodes as _nodes
|
||||||
|
|
||||||
|
from typing_extensions import override
|
||||||
|
from comfy_api.latest import ComfyExtension, io
|
||||||
|
from aiohttp import web
|
||||||
|
from .nodes import *
|
||||||
|
from .routes import *
|
||||||
|
from .utils.bernini_s2v_model_patch import apply_bernini_s2v_model_patches
|
||||||
|
|
||||||
|
from .moxie_loader import MoxieMultimediaLoader
|
||||||
|
from .moxie_project import MoxieProject
|
||||||
|
from .moxie_combine import MoxieCombine
|
||||||
|
from .moxie_preview import ModelPreviewOverrideKJ as MoxiePreviewOverride
|
||||||
|
|
||||||
|
apply_bernini_s2v_model_patches()
|
||||||
|
|
||||||
|
# Define the path
|
||||||
|
root_path = os.path.dirname(__file__)
|
||||||
|
project_name = os.path.basename(root_path)
|
||||||
|
|
||||||
|
web_default_version = 'release'
|
||||||
|
data = None
|
||||||
|
config_path = os.path.join(root_path, "config.yaml")
|
||||||
|
if os.path.isfile(config_path):
|
||||||
|
with open(config_path, 'r') as f:
|
||||||
|
data = yaml.load(f, Loader=yaml.FullLoader)
|
||||||
|
if data and "WEB_VERSION" in data:
|
||||||
|
dist_path = f"dist/{data['WEB_VERSION']}"
|
||||||
|
else:
|
||||||
|
dist_path = f"dist/{web_default_version}"
|
||||||
|
else:
|
||||||
|
dist_path = f"dist/{web_default_version}"
|
||||||
|
|
||||||
|
web_version = data.get("WEB_VERSION", web_default_version) if data else web_default_version
|
||||||
|
if not os.path.exists(os.path.join(root_path, dist_path)):
|
||||||
|
print(f"web root {web_version} not found, using default")
|
||||||
|
dist_path = f"dist/{web_default_version}"
|
||||||
|
|
||||||
|
dist_path = os.path.join(root_path, dist_path)
|
||||||
|
if os.path.exists(dist_path):
|
||||||
|
# Add the routes for the extension
|
||||||
|
server.PromptServer.instance.app.add_routes([
|
||||||
|
web.static(f"/{project_name}/", dist_path),
|
||||||
|
])
|
||||||
|
|
||||||
|
_nodes.EXTENSION_WEB_DIRS[project_name] = dist_path
|
||||||
|
else:
|
||||||
|
print(f"Warning: Dist directory not found for {project_name}. Frontend assets will be served.")
|
||||||
|
|
||||||
|
# Our own frontend assets (Moxie Preview Override widget)
|
||||||
|
WEB_DIRECTORY = "./web"
|
||||||
|
|
||||||
|
# Register extension
|
||||||
|
class EasyMediaExtension(ComfyExtension):
|
||||||
|
@override
|
||||||
|
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
||||||
|
nodes = [
|
||||||
|
# Moxie consolidated nodes
|
||||||
|
MoxieMultimediaLoader,
|
||||||
|
MoxiePreviewOverride,
|
||||||
|
MoxieProject,
|
||||||
|
MoxieCombine,
|
||||||
|
# TimelineEditor
|
||||||
|
TimelineEditor,
|
||||||
|
TimelineInfoOutput,
|
||||||
|
TimelineSegmentOutput,
|
||||||
|
TimelineSegmentCount,
|
||||||
|
# MultiTrack
|
||||||
|
MultiTrackEditor,
|
||||||
|
MultiImagesLoader,
|
||||||
|
MultiTrackTaskOutput,
|
||||||
|
MultiTrackPromptEnhancer,
|
||||||
|
MultiTrackPromptEnhanceToProject,
|
||||||
|
MultiTrackPromptEnhanceToProjectApply,
|
||||||
|
MultiTrackPromptEnhancerImageListBridge,
|
||||||
|
MultiTrackInfoOutput,
|
||||||
|
MultiTrackAudioOutput,
|
||||||
|
# Subtitle
|
||||||
|
MultiTrackAddSubtitleToVideo,
|
||||||
|
RecognizeSubtitle,
|
||||||
|
AddSubtitleToVideo,
|
||||||
|
# Image
|
||||||
|
MakeRefsCompositeBySam3,
|
||||||
|
ImageIndexesToIntList,
|
||||||
|
# Audio
|
||||||
|
EasyAudioMerge,
|
||||||
|
EasyMinimaxH3AudioLock,
|
||||||
|
# Video
|
||||||
|
EasySaveVideo,
|
||||||
|
EasyCompareVideos,
|
||||||
|
EasyGetAudioFromVideo,
|
||||||
|
EasyMergeVideos,
|
||||||
|
EasyMergeVideosFromPaths,
|
||||||
|
# Split
|
||||||
|
SplitImages,
|
||||||
|
SplitAudios,
|
||||||
|
SplitVideos,
|
||||||
|
# Make List
|
||||||
|
MakeImageList,
|
||||||
|
MakeAudioList,
|
||||||
|
MakeVideoList,
|
||||||
|
# Common
|
||||||
|
EasyModelLoaderPack,
|
||||||
|
MatchLine,
|
||||||
|
APIWorkflowGate,
|
||||||
|
# MiniMax
|
||||||
|
EasyMiniMaxH3MotionContextHard,
|
||||||
|
EasyMiniMaxH3ContextSwap,
|
||||||
|
EasyMiniMaxH3HiResContinuity,
|
||||||
|
EasyH3MotionContextLatentTrim,
|
||||||
|
EasyH3ProjectContextLatentLoad,
|
||||||
|
EasyH3ConditioningCache,
|
||||||
|
EasyH3SegmentSamplingStart,
|
||||||
|
EasyH3SamplingPreviewSampler,
|
||||||
|
EasyMiniMaxH3LatentUpscaler,
|
||||||
|
EasyMiniMaxH3SelfLiftSampler,
|
||||||
|
EasyH3SegmentSaveEnd,
|
||||||
|
EasyH3ContextMediaTrim,
|
||||||
|
EasyH3PassthroughVideo,
|
||||||
|
EasyH3AudioContextLatent,
|
||||||
|
EasyH3LockedAudioDurationAlign,
|
||||||
|
EasyH3LockedAudioSelect,
|
||||||
|
EasyH3ProjectArtifact,
|
||||||
|
EasyH3ProjectStaticPrepare,
|
||||||
|
EasyMultiTrackProject,
|
||||||
|
EasyMultiTrackProjectVideoCombine,
|
||||||
|
EasyMiniMaxH3ToVideo,
|
||||||
|
EasyMinimaxPromptOverride,
|
||||||
|
EasyMiniMaxH3ReferenceToVideoBridge,
|
||||||
|
EasyRemoveH3MotionContextLatent,
|
||||||
|
# Wan
|
||||||
|
BerniniModelPatch,
|
||||||
|
EasyBerniniS2VConditioning,
|
||||||
|
# LTXV
|
||||||
|
LTXMultiTrackEncode,
|
||||||
|
LTXI2VInplaceAndUpsample,
|
||||||
|
LTXSamplerSimple,
|
||||||
|
LTXVAddGuidesFromBatchIndexes,
|
||||||
|
LTXVMakeRefVideo,
|
||||||
|
]
|
||||||
|
try:
|
||||||
|
from comfy_extras.nodes_bernini import BerniniConditioning as CoreBerniniConditioning
|
||||||
|
except ImportError:
|
||||||
|
nodes.extend([BerniniConditioning])
|
||||||
|
nodes.extend(get_minimax_h3_fallback_nodes())
|
||||||
|
return nodes
|
||||||
|
|
||||||
|
async def comfy_entrypoint() -> EasyMediaExtension:
|
||||||
|
return EasyMediaExtension()
|
||||||
9
config.yaml.example
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Set the environment variables for the web application
|
||||||
|
# WEB_VERSION: dev
|
||||||
|
# Set APIKEY
|
||||||
|
MINIMAX_API_KEY:
|
||||||
|
VOLCENGINE_API_KEY:
|
||||||
|
BIGMODEL_API_KEY:
|
||||||
|
RUNNINGHUB_API_KEY:
|
||||||
|
# Set ComfyUI url for skill
|
||||||
|
COMFYUI_URL:
|
||||||
1
dist/release/chunks/create-react-widget-casv3vjq.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{a as b}from"./index-32kveqpf.js";import{Aa as T,Ca as D}from"./index-1bfnvmkx.js";import{oc as z}from"./index-dzqmqdeq.js";var E=z(T(),1),G=z(b(),1);function k(){let q=globalThis.LiteGraph;return Boolean(q?.vueNodesMode)}function x(q){let j=q.width;if(Object.defineProperty(q,"width",{configurable:!0,enumerable:!0,get:()=>j,set:(X)=>{if(k())j=X}}),!k())j=void 0}function U(q,j={}){return function(Y,Z,A,L){let B=j.defaultValue??"",$=null,F=document.createElement("div");if(F.classList.add("comfyui-react-widget",D),j.height!==void 0)F.style.height=`${j.height}px`;let K=Y;function P(){try{return JSON.parse(B)}catch{return B}}function Q(){$?.render(E.default.createElement(q,{value:P(),onChange:(J)=>{B=typeof J==="string"?J:JSON.stringify(J),K.setDirtyCanvas(!0,!0),Q()},inputName:Z,widget:H,node:K,app:L}))}let H=K.addDOMWidget(Z,"react-widget",F,{getValue:()=>B,setValue:(J)=>{B=J,Q()},getMinHeight:()=>30,getMaxHeight:()=>Y.size[1],hideOnZoom:!0,serialize:!0,...j.domWidgetOptions});if(j.keepResponsiveWidthInLiteGraph)x(H);return H.inputEl=F,H.serializeValue=()=>B,$=G.createRoot(F),Q(),{widget:H}}}export{U as createReactWidget};
|
||||||
2
dist/release/chunks/index-1bfnvmkx.js
vendored
Normal file
10
dist/release/chunks/index-32kveqpf.js
vendored
Normal file
2
dist/release/chunks/index-dtsnfbjr.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import{nc as C}from"./index-v2752ewf.js";function A(B,j,q,H=new Set){let G=B,J=j;while(G!==null&&J!==null){let Z=`${G}:${J}`;if(H.has(Z)){console.debug(`[trace] Cycle detected at node ${G}, slot ${J}`);break}H.add(Z);let X=q.getNodeById(G);if(!X)break;let z=X.outputs?.[J];if(!z)break;console.debug(`[trace] Node #${G} "${X.name||X.type||"unknown"}" slot ${J} isList=${z.shape==6}`);let K=z.link;if(K===null||K===void 0)return console.debug(`[trace] Root source found: #${G}`),G;let Y=q.links[K];if(!Y)break;G=Y.origin_id,J=Y.origin_slot}return console.debug("[trace] Root source: none"),null}function v(B){if(B?.type!=="LoadVideo")return;let j=B.widgets?.find((q)=>q.name==="file")?.value??B.widgets_values?.[0];return typeof j==="string"&&j.trim()?j:void 0}function L(B,j,q,H){try{let J=B?.getInputLink?.(q);if(J)return J}catch(J){console.error("[timeline-utils] failed to read input link:",J)}let G=j.link;if(G===null||G===void 0)return null;return H?.links?.[G]??null}function F(B,j){let q=B.widgets?.find((J)=>J?.name==="skip_empty");if(typeof q?.value==="boolean")return q.value;let H=B.inputs?.findIndex((J)=>J.name==="skip_empty")??-1,G=H>=0?B.widgets_values?.[H]:void 0;if(typeof G==="boolean")return G;return j!=="audio"}function f(B,j,q){if(!B?.inputs||!j?.graph)return[];let H=[],G=q.toUpperCase();for(let[J,Z]of B.inputs.entries()){if((Z.type??"").toUpperCase()!==G)continue;let X=L(B,Z,J,j.graph);if(!X)continue;let{origin_id:z,origin_slot:K}=X,Y=j.graph.getNodeById(z);if(!Y)continue;if((Y.outputs?.[K]).shape==6){let U=Y.inputs.map((M,P)=>({inp:M,index:P,link:L(Y,M,P,j.graph)})).filter(({inp:M,link:P})=>(M.type??"").toUpperCase()===G&&P!==null).sort((M,P)=>{let $=parseInt(M.inp.name.match(/(\d+)$/)?.[1]??"0",10),Q=parseInt(P.inp.name.match(/(\d+)$/)?.[1]??"0",10);return $-Q});if(U.length>0){let M=F(Y,q);for(let[P,{inp:$,link:Q}]of U.entries()){let O,V,W;if(Q){let E=A(Q.origin_id,Q.origin_slot,j.graph);if(E!==null){let b=j.graph.getNodeById(E);if(q=="image")O=b?.imgs?.[0]?.currentSrc;else if(q=="audio")V=b.widgets_values?.[0]??b.widgets?.[0]?.value;else if(q==="video")W=v(b)}}let w=M?`${q}${P+1}`:$.name;H.push({label:$.name,img:O,audio_name:V,video_name:W,value:`__slot__:${w}`})}}}else{let U,M,P,$=A(X.origin_id,X.origin_slot,j.graph),Q=$!==null?j.graph.getNodeById($):Y;if(q=="image")U=Q?.imgs?.[0]?.currentSrc;else if(q=="audio"&&Q?.type=="LoadAudio")M=Q.widgets_values?.[0]??Q.widgets?.[0]?.value;else if(q==="video")P=v(Q);H.push({label:Z.name,img:U,audio_name:M,video_name:P,value:`__slot__:${Z.name}`})}break}return H}function N(B,j,q){if(j<=0||q<=0)return B;return B.map((H)=>{if(H.start_frame===void 0||H.end_frame===void 0)return H;let G=Math.max(0,Math.min(q-1,Math.round(H.start_frame/j*q))),J=Math.round((H.end_frame+1)/j*q),Z=Math.max(G,Math.min(q-1,J-1));return{...H,start_frame:G,end_frame:Z}})}function R(B,j){return Math.ceil(B*j/4)*4+1}function g(B,j){return Math.ceil(B*j)}function D(B,j){return(B-1)/j}function k(B,j,q){if(q==="frames")return`${B}f`;return`${D(B,j).toFixed(2)}s`}function I(B,j){let q=B.trim();if(q.endsWith("s")){let J=Number.parseFloat(q.slice(0,-1));if(Number.isNaN(J))return Number.NaN;return R(J,j)}let H=q.endsWith("f")?q.slice(0,-1):q,G=Number.parseInt(H,10);return Number.isNaN(G)?Number.NaN:G}var _={audio:"#34d399",prompt:"#a78bfa",image:"#fb923c",video:"#60a5fa",maintain:"var(--muted)"};function c(B){let j=B??((J)=>""),q=121,H=24;return{tracks:[{id:C(),name:j("timeline.defaultTrackName",{n:1}),type:"maintain",color:_.maintain,muted:!1,locked:!1,segments:[]},{id:C(),name:j("timeline.defaultAudioTrackName",{n:1}),type:"audio",color:_.audio,muted:!1,locked:!1,segments:[]}],total_length:121,frame_rate:24}}function l(B,j,q,H){let G=B/(q-1)*H,J=(j+1)/(q-1)*H;return{left:G,width:Math.max(J-G,2)}}
|
||||||
|
export{f as Da,N as Ea,R as Fa,g as Ga,D as Ha,k as Ia,I as Ja,_ as Ka,c as La,l as Ma};
|
||||||
2
dist/release/chunks/index-dzqmqdeq.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
var j=Object.create;var{getPrototypeOf:k,defineProperty:f,getOwnPropertyNames:l}=Object;var m=Object.prototype.hasOwnProperty;function n(a){return this[a]}var o,p,s=(a,b,c)=>{var g=a!=null&&typeof a==="object";if(g){var h=b?o??=new WeakMap:p??=new WeakMap,i=h.get(a);if(i)return i}c=a!=null?j(k(a)):{};let d=b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c;for(let e of l(a))if(!m.call(d,e))f(d,e,{get:n.bind(a,e),enumerable:!0});if(g)h.set(a,d);return d};var t=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var q=(a)=>a;function r(a,b){this[a]=q.bind(null,b)}var u=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:!0,configurable:!0,set:r.bind(b,c)})};var v=(a,b)=>()=>(a&&(b=a(a=0)),b);var w=((a)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});
|
||||||
|
export{s as oc,t as pc,u as qc,v as rc,w as sc};
|
||||||
58
dist/release/chunks/index-mq288fp7.js
vendored
Normal file
2
dist/release/chunks/index-v2752ewf.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
var B=()=>{if(typeof crypto<"u"&&typeof crypto.randomUUID==="function")return crypto.randomUUID();let c=crypto.getRandomValues(new Uint8Array(16));c[6]=c[6]&15|64,c[8]=c[8]&63|128;let j=Array.from(c,(z)=>z.toString(16).padStart(2,"0")).join("");return`${j.slice(0,8)}-${j.slice(8,12)}-${j.slice(12,16)}-${j.slice(16,20)}-${j.slice(20)}`};
|
||||||
|
export{B as nc};
|
||||||
2
dist/release/chunks/index-y3kz7k0j.js
vendored
Normal file
2
dist/release/chunks/index-ysqpnr4j.js
vendored
Normal file
1
dist/release/chunks/multitrack-utils-xhqpxq5r.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{$b as _,Ab as z,Bb as A,Cb as B,Db as C,Eb as D,Fb as E,Gb as F,Hb as G,Ib as H,Jb as I,Kb as J,Lb as K,Mb as L,Nb as M,Ob as N,Pb as O,Qb as P,Rb as Q,Sb as R,Tb as S,Ub as T,Vb as U,Wb as V,Xb as W,Yb as X,Zb as Y,_b as Z,ac as $,bb as a,bc as aa,cb as b,cc as ba,db as c,dc as ca,eb as d,ec as da,fb as e,fc as ea,gb as f,gc as fa,hb as g,hc as ga,ib as h,ic as ha,jb as i,jc as ia,kb as j,kc as ja,lb as k,lc as ka,mb as l,mc as la,nb as m,ob as n,pb as o,qb as p,rb as q,sb as r,tb as s,ub as t,vb as u,wb as v,xb as w,yb as x,zb as y}from"./index-y3kz7k0j.js";import"./index-v2752ewf.js";import"./index-dzqmqdeq.js";export{fa as updateMultiTrackSegmentDuration,ca as updateMultiTrackSegmentContent,M as syncMatchingTasksToPrimaryVideoTrack,da as syncMatchingTasksToPrimaryVideoSegment,S as splitMultiTrackSegmentByFrames,D as snapTimeToFrame,G as snapSecondsToFrame,E as snapMultiTrackResizeTime,F as snapMultiTrackMoveStartTime,ha as setMultiTrackAudioTrackLock,I as segmentDuration,w as secondsToFrame,ea as resizeTaskSegmentEnd,ga as remapTrackDataFrameRate,H as remapFrameToRate,ja as parseMultiTrackPreviewResolution,B as parseMultiTrackDurationTimecode,la as normalizeTrackData,z as multiTrackDbToLinearGain,X as moveSelectedSegments,W as moveSegmentBetweenCompatibleTracks,v as mergeSelectedTaskSegments,Q as getSelectedTaskUserPromptPatch,P as getSelectedTaskUserPrompt,ba as getSelectedMultiTrackSegment,Z as getSegmentDragPreviewSegments,Y as getSegmentDragPlaceholder,o as getMultiTrackTrackHeight,u as getMultiTrackTaskType,t as getMultiTrackTaskModeLabel,_ as getMultiTrackPreviewFrame,L as getInheritedTaskSegmentContent,$ as getActivePreviewVideoSegment,aa as getActivePreviewAudioSources,x as frameToSeconds,C as formatMultiTrackTime,A as formatMultiTrackDurationTimecode,R as distributeMultiTrackSegmentsEvenly,V as deleteSegmentsWithLinkedTasks,U as deleteSegmentWithLinkedTasks,p as createMultiTrackVideoContent,q as createMultiTrackAudioContent,ka as createDefaultTrackData,ia as collectMultiTrackPreviewResolutionInput,T as cloneMultiTrackSegment,y as clampMultiTrackVolumeDb,J as calculateTotalLength,K as calculateTotalDuration,r as calculateReplacementAudioEndFrame,O as applyCombinedTaskTexts,N as addDefaultTaskSegmentIfRangeEmpty,s as MULTITRACK_TRACK_COLORS,d as MULTITRACK_TASK_MODES,h as MULTITRACK_REF_IMAGE_SIZES,k as MULTITRACK_MIN_VOLUME_DB,c as MULTITRACK_MIN_DURATION_SECONDS,m as MULTITRACK_MEDIA_TRACK_LIMIT,l as MULTITRACK_MAX_VOLUME_DB,n as MULTITRACK_FRAME_RATE_OPTIONS,j as MULTITRACK_DEFAULT_VOLUME_DB,b as MULTITRACK_DEFAULT_TOTAL_LENGTH,e as MULTITRACK_DEFAULT_TASK_MODE,i as MULTITRACK_DEFAULT_REF_IMAGE_SIZE,a as MULTITRACK_DEFAULT_FRAME_RATE,g as MULTITRACK_DEFAULT_CONTINUITY_MODE,f as MULTITRACK_CONTINUITY_MODES};
|
||||||
1
dist/release/chunks/timeline-utils-eytt5wbd.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{Da as a,Ea as b,Fa as c,Ga as d,Ha as e,Ia as f,Ja as g,Ka as h,La as i,Ma as j}from"./index-dtsnfbjr.js";import"./index-v2752ewf.js";import"./index-dzqmqdeq.js";export{j as segmentPixelRect,c as secondsToFrames,d as secondsToAudioFrames,b as scaleImageItemsToDuration,g as parseTimeInput,e as framesToSeconds,f as formatTime,i as createDefaultTimelineData,a as computeSlotItems,h as TRACK_DEFAULT_COLORS};
|
||||||
2
dist/release/index.js
vendored
Normal file
BIN
example_workflows/Bernini Edit with MultiTrack.jpg
Normal file
|
After Width: | Height: | Size: 112 KiB |
3254
example_workflows/Bernini Edit with MultiTrack.json
Normal file
BIN
example_workflows/Bernini R2V or RV2V with MultiTrack.jpg
Normal file
|
After Width: | Height: | Size: 49 KiB |
2942
example_workflows/Bernini R2V or RV2V with MultiTrack.json
Normal file
BIN
example_workflows/Bernini S2V 1voice with Multitrack.jpg
Normal file
|
After Width: | Height: | Size: 272 KiB |
2563
example_workflows/Bernini S2V 1voice with Multitrack.json
Normal file
BIN
example_workflows/Bernini S2V 2voice with Multitrack.jpg
Normal file
|
After Width: | Height: | Size: 349 KiB |
2976
example_workflows/Bernini S2V 2voice with Multitrack.json
Normal file
BIN
example_workflows/LTX2.3 3DLora with Multitrack.jpg
Normal file
|
After Width: | Height: | Size: 69 KiB |
4260
example_workflows/LTX2.3 3DLora with Multitrack.json
Normal file
BIN
example_workflows/LTX2.3 LoopSegment with TimelineEditor.jpg
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
6474
example_workflows/LTX2.3 LoopSegment with TimelineEditor.json
Normal file
BIN
example_workflows/LTX2.3 R2V With TimelineEditor.jpg
Normal file
|
After Width: | Height: | Size: 656 KiB |
4113
example_workflows/LTX2.3 R2V With TimelineEditor.json
Normal file
BIN
example_workflows/LTX2.3 SingleSegment with TimelineEditor.jpg
Normal file
|
After Width: | Height: | Size: 567 KiB |
4323
example_workflows/LTX2.3 SingleSegment with TimelineEditor.json
Normal file
BIN
example_workflows/MiniMaxH3_AllInOne_LatentUpscale.jpg
Normal file
|
After Width: | Height: | Size: 107 KiB |
4145
example_workflows/MiniMaxH3_AllInOne_LatentUpscale.json
Normal file
BIN
example_workflows/MiniMaxH3_v1.3.1_Easy_Project_AllInOne.jpg
Normal file
|
After Width: | Height: | Size: 113 KiB |
1427
example_workflows/MiniMaxH3_v1.3.1_Easy_Project_AllInOne.json
Normal file
BIN
example_workflows/MinimaxH3_AllInOne_Simple.jpg
Normal file
|
After Width: | Height: | Size: 178 KiB |
3644
example_workflows/MinimaxH3_AllInOne_Simple.json
Normal file
BIN
example_workflows/MinimaxH3_ForLoop_MultiShot.jpg
Normal file
|
After Width: | Height: | Size: 122 KiB |
4409
example_workflows/MinimaxH3_ForLoop_MultiShot.json
Normal file
BIN
example_workflows/Wan2.2 LoopSegment with TimelineEditor.jpg
Normal file
|
After Width: | Height: | Size: 668 KiB |
5707
example_workflows/Wan2.2 LoopSegment with TimelineEditor.json
Normal file
BIN
example_workflows/WanScail V2 with MultiTrack.jpg
Normal file
|
After Width: | Height: | Size: 87 KiB |
4449
example_workflows/WanScail V2 with MultiTrack.json
Normal file
24
frontend/.eslintrc.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "latest",
|
||||||
|
"sourceType": "module",
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"jsx": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plugins": ["@typescript-eslint"],
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/no-explicit-any": "warn",
|
||||||
|
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es2022": true
|
||||||
|
}
|
||||||
|
}
|
||||||
128
frontend/build.ts
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
import { $ } from "bun";
|
||||||
|
import path from "path";
|
||||||
|
import fs from "fs";
|
||||||
|
import os from "os";
|
||||||
|
|
||||||
|
const watch = Bun.argv.includes("--watch");
|
||||||
|
const isRelease = Bun.argv.includes("--release");
|
||||||
|
const mode = isRelease ? "release" : "dev";
|
||||||
|
|
||||||
|
const rootDir = path.resolve(import.meta.dir, "..");
|
||||||
|
const outdir = path.join(rootDir, "dist", mode);
|
||||||
|
const project_name = path.basename(rootDir);
|
||||||
|
|
||||||
|
fs.mkdirSync(outdir, { recursive: true });
|
||||||
|
|
||||||
|
function scopeTailwindThemeVariables(css: string, widgetClass: string): string {
|
||||||
|
return css.replace(/:root\s*,\s*:host\s*\{/g, `.${widgetClass}{`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function buildJS(globalCss: string) {
|
||||||
|
// Clear stale chunks from previous builds before writing new ones
|
||||||
|
const chunksDir = path.join(outdir, "chunks");
|
||||||
|
fs.rmSync(chunksDir, { recursive: true, force: true });
|
||||||
|
|
||||||
|
const result = await Bun.build({
|
||||||
|
entrypoints: ["./src/index.ts"],
|
||||||
|
outdir,
|
||||||
|
naming: {
|
||||||
|
chunk: "chunks/[name]-[hash].[ext]",
|
||||||
|
entry: "[name].[ext]",
|
||||||
|
asset: "assets/[name].[ext]",
|
||||||
|
},
|
||||||
|
splitting: true,
|
||||||
|
target: "browser",
|
||||||
|
minify: isRelease,
|
||||||
|
define: {
|
||||||
|
"process.env.NODE_ENV": isRelease ? '"production"' : '"development"',
|
||||||
|
"import.meta.env.PROJECT_NAME": `"${project_name}"`,
|
||||||
|
"__COMFY_EASY_MEDIA_GLOBAL_CSS__": JSON.stringify(globalCss),
|
||||||
|
},
|
||||||
|
css: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!result.success) {
|
||||||
|
for (const log of result.logs) {
|
||||||
|
console.error(log);
|
||||||
|
}
|
||||||
|
throw new Error("JS build failed");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function buildCSS(): Promise<string> {
|
||||||
|
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "comfy-easy-media-css-"));
|
||||||
|
const cssOut = path.join(tempDir, "globals.css");
|
||||||
|
const minifyFlag = isRelease ? "--minify" : "";
|
||||||
|
try {
|
||||||
|
await $`./node_modules/.bin/tailwindcss -i ./src/styles/globals.css -o ${cssOut} ${minifyFlag}`;
|
||||||
|
// Replace __CUSTOM_NODE_CLASS__ placeholder with the lowercased project name.
|
||||||
|
const widgetClass = project_name.toLowerCase();
|
||||||
|
const css = fs.readFileSync(cssOut, "utf-8");
|
||||||
|
fs.rmSync(path.join(outdir, "globals.css"), { force: true });
|
||||||
|
return scopeTailwindThemeVariables(
|
||||||
|
css.replaceAll("__CUSTOM_NODE_CLASS__", widgetClass),
|
||||||
|
widgetClass,
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
fs.rmSync(tempDir, { recursive: true, force: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type BuildType = "all" | "js" | "css";
|
||||||
|
let globalCss: string | null = null;
|
||||||
|
|
||||||
|
async function build(type: BuildType = "all") {
|
||||||
|
const start = Date.now();
|
||||||
|
try {
|
||||||
|
if (type === "all" || type === "css" || !globalCss) {
|
||||||
|
globalCss = await buildCSS();
|
||||||
|
}
|
||||||
|
if (type === "all" || type === "js") {
|
||||||
|
const result = await buildJS(globalCss);
|
||||||
|
console.log(
|
||||||
|
`[build:${mode}] Done in ${Date.now() - start}ms (${result.outputs.length} JS output(s))`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`[build:${mode}] Error:`, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (watch) {
|
||||||
|
await build("all");
|
||||||
|
|
||||||
|
const DEBOUNCE = 150;
|
||||||
|
let jsTimer: ReturnType<typeof setTimeout> | null = null;
|
||||||
|
let cssTimer: ReturnType<typeof setTimeout> | null = null;
|
||||||
|
|
||||||
|
const watcher = fs.watch("./src", { recursive: true }, (_event, filename) => {
|
||||||
|
if (!filename) return;
|
||||||
|
const isCss = filename.endsWith(".css");
|
||||||
|
|
||||||
|
if (isCss) {
|
||||||
|
if (cssTimer) clearTimeout(cssTimer);
|
||||||
|
cssTimer = setTimeout(() => {
|
||||||
|
console.log(`[build:watch] ${filename} changed, rebuilding CSS and JS...`);
|
||||||
|
void build("all");
|
||||||
|
}, DEBOUNCE);
|
||||||
|
} else {
|
||||||
|
if (jsTimer) clearTimeout(jsTimer);
|
||||||
|
jsTimer = setTimeout(() => {
|
||||||
|
console.log(`[build:watch] ${filename} changed, rebuilding JS...`);
|
||||||
|
void build("js");
|
||||||
|
}, DEBOUNCE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("[build:watch] Watching src/ for changes...");
|
||||||
|
process.on("SIGINT", () => {
|
||||||
|
watcher.close();
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Keep the process alive
|
||||||
|
await new Promise(() => {});
|
||||||
|
} else {
|
||||||
|
await build("all");
|
||||||
|
}
|
||||||
1711
frontend/bun.lock
Normal file
10
frontend/commitlint.config.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export default {
|
||||||
|
extends: ['@commitlint/config-conventional'],
|
||||||
|
rules: {
|
||||||
|
'type-enum': [
|
||||||
|
2,
|
||||||
|
'always',
|
||||||
|
['feat', 'fix', 'refactor', 'docs', 'test', 'chore', 'perf', 'ci'],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
21
frontend/components.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://ui.shadcn.com/schema.json",
|
||||||
|
"style": "new-york",
|
||||||
|
"rsc": false,
|
||||||
|
"tsx": true,
|
||||||
|
"tailwind": {
|
||||||
|
"config": "tailwind.config.ts",
|
||||||
|
"css": "src/styles/globals.css",
|
||||||
|
"baseColor": "neutral",
|
||||||
|
"cssVariables": true,
|
||||||
|
"prefix": ""
|
||||||
|
},
|
||||||
|
"aliases": {
|
||||||
|
"components": "@/components",
|
||||||
|
"utils": "@/lib/utils",
|
||||||
|
"ui": "@/components/ui",
|
||||||
|
"lib": "@/lib",
|
||||||
|
"hooks": "@/hooks"
|
||||||
|
},
|
||||||
|
"iconLibrary": "lucide"
|
||||||
|
}
|
||||||
462
frontend/messages/en.json
Normal file
@ -0,0 +1,462 @@
|
|||||||
|
{
|
||||||
|
"common": {
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"save": "Save",
|
||||||
|
"add": "Add",
|
||||||
|
"delete": "Delete",
|
||||||
|
"syncPlay":"Sync Play"
|
||||||
|
},
|
||||||
|
"compareVideo": {
|
||||||
|
"empty": "Choose source and output videos to compare, or run the node with inputs.",
|
||||||
|
"source": "Source",
|
||||||
|
"output": "Output",
|
||||||
|
"selectSource": "Select source",
|
||||||
|
"selectOutput": "Select output",
|
||||||
|
"clearSource": "Clear source video",
|
||||||
|
"clearOutput": "Clear output video",
|
||||||
|
"sourceOnly": "Source",
|
||||||
|
"outputOnly": "Output",
|
||||||
|
"sideBySide": "A/B",
|
||||||
|
"compare": "Compare",
|
||||||
|
"play": "Play",
|
||||||
|
"pause": "Pause",
|
||||||
|
"seek": "Video time",
|
||||||
|
"mute": "Mute audio",
|
||||||
|
"unmute": "Unmute audio",
|
||||||
|
"volume": "Volume",
|
||||||
|
"saveOutput": "Save output video",
|
||||||
|
"watchOutputHistory": "Watch output history",
|
||||||
|
"filenamePrefix": "Save prefix",
|
||||||
|
"settings": "Output settings",
|
||||||
|
"downloadOutput": "Download output video"
|
||||||
|
},
|
||||||
|
"promptEnhancerAccount": {
|
||||||
|
"balance": "Balance: {amount}",
|
||||||
|
"balanceEmpty": "Balance: --",
|
||||||
|
"viewBalance": "View balance",
|
||||||
|
"loadingBalance": "Loading balance...",
|
||||||
|
"balanceUnavailable": "Balance is temporarily unavailable",
|
||||||
|
"apiKeyRequired": "Enter an API key to load the balance",
|
||||||
|
"apiKey": "API Key",
|
||||||
|
"localModel": "Local model — no API account required"
|
||||||
|
},
|
||||||
|
"projectVideoCombine": {
|
||||||
|
"selectProject": "Select project",
|
||||||
|
"deleteProject": "Delete project",
|
||||||
|
"deleteProjectTitle": "Delete project?",
|
||||||
|
"deleteProjectConfirm": "Delete the {project} project and its entire folder, including latent, JSON, and media files? This cannot be undone.",
|
||||||
|
"deleteDefaultProjectConfirm": "Clear all latent, JSON, and media files from the default project? The default folder will be kept. This cannot be undone.",
|
||||||
|
"deleteProjectSuccess": "Project deleted",
|
||||||
|
"deleteProjectSuccessDetail": "The {project} project was deleted.",
|
||||||
|
"deleteProjectFailed": "Project deletion failed",
|
||||||
|
"deleteClipFile": "Delete {file}",
|
||||||
|
"deleteClipFileTitle": "Delete generated clip?",
|
||||||
|
"deleteClipFileConfirm": "Permanently delete {file} and its associated generation artifacts? The latest project state will be saved. This cannot be undone.",
|
||||||
|
"deleteClipFileFailed": "Clip deletion failed",
|
||||||
|
"deleteClipFileUnavailable": "The clip deletion endpoint is unavailable (HTTP 404/405). Restart ComfyUI to load the updated backend, then refresh this page and try again.",
|
||||||
|
"deleteClipFileInvalidResponse": "The server returned an invalid project response (HTTP {status}). The preview was not changed. Refresh the project to check its saved state.",
|
||||||
|
"refresh": "Refresh project",
|
||||||
|
"mutePreview": "Mute preview audio",
|
||||||
|
"unmutePreview": "Unmute preview audio",
|
||||||
|
"combine": "Combine",
|
||||||
|
"autoCombine": "Auto combine",
|
||||||
|
"clipLabel": "Segment {number}",
|
||||||
|
"clipContinuity": "{mode}",
|
||||||
|
"selectClipFile": "Select a file for segment {number}",
|
||||||
|
"selectClipFiles": "Select up to two videos for segment {number}",
|
||||||
|
"selectClipFilesHint": "Select one video for the project, or two to compare.",
|
||||||
|
"selectClipFileFailed": "Video selection could not be saved",
|
||||||
|
"continuityShot": "Shot",
|
||||||
|
"continuityContext": "Context",
|
||||||
|
"continuityContextSwap": "Swap Context",
|
||||||
|
"emptyPreview": "Refresh the project to preview its generated clips.",
|
||||||
|
"refreshFailed": "Project refresh failed",
|
||||||
|
"combineFailed": "Project combine failed",
|
||||||
|
"projectListFailed": "Could not load projects",
|
||||||
|
"connectSaveNode": "Connect this node to a video save output before combining manually.",
|
||||||
|
"combineQueued": "Combine queued",
|
||||||
|
"combineQueuedDetail": "The {project} project and its downstream nodes were added to the queue.",
|
||||||
|
"queueBusy": "Wait until the current ComfyUI queue is empty before combining manually."
|
||||||
|
},
|
||||||
|
"samplingPreview": {
|
||||||
|
"title": "Sampling preview",
|
||||||
|
"meta": "Segment {segment} · {pass} · {step}/{total}",
|
||||||
|
"playbackProgress": "Sampling preview playback progress",
|
||||||
|
"hidePreview": "Hide sampling preview",
|
||||||
|
"showPreview": "Show sampling preview",
|
||||||
|
"pausePreview": "Pause sampling preview",
|
||||||
|
"resumePreview": "Resume sampling preview",
|
||||||
|
"first": "First pass",
|
||||||
|
"second": "Second pass",
|
||||||
|
"selflift": "SelfLift"
|
||||||
|
},
|
||||||
|
"toolbar": {
|
||||||
|
"frames": "Frames",
|
||||||
|
"seconds": "Seconds",
|
||||||
|
"fps": "fps",
|
||||||
|
"play": "Play",
|
||||||
|
"pause": "Pause",
|
||||||
|
"deleteSegment": "Delete selected segment",
|
||||||
|
"zoom": "Zoom"
|
||||||
|
},
|
||||||
|
"timeline": {
|
||||||
|
"defaultTrackName": "Track {n}",
|
||||||
|
"defaultAudioTrackName": "Audio Track {n}"
|
||||||
|
},
|
||||||
|
"multitrackTaskModes": {
|
||||||
|
"default": "TI2V",
|
||||||
|
"l2v": "L2V",
|
||||||
|
"t2v": "T2V",
|
||||||
|
"i2v": "I2V",
|
||||||
|
"fl2v": "FL2V",
|
||||||
|
"fmlf2v": "FMLF2V",
|
||||||
|
"v2v": "V2V",
|
||||||
|
"r2v": "R2V",
|
||||||
|
"rv2v": "RV2V",
|
||||||
|
"vi2v": "VI2V",
|
||||||
|
"ref": "R2V",
|
||||||
|
"edit": "Edit"
|
||||||
|
},
|
||||||
|
"multitrackSegment": {
|
||||||
|
"taskLabel": "Segment {n} {mode}"
|
||||||
|
},
|
||||||
|
"multitrack": {
|
||||||
|
"audio": "Audio",
|
||||||
|
"globalAudio": "MainAudio",
|
||||||
|
"audioSettings": "Audio settings",
|
||||||
|
"speed": "Speed",
|
||||||
|
"fpsSettings": "fps settings",
|
||||||
|
"mutePreviewAudio": "Mute preview audio",
|
||||||
|
"unmutePreviewAudio": "Unmute preview audio",
|
||||||
|
"mute": "Mute",
|
||||||
|
"unmute": "Unmute",
|
||||||
|
"volume": "Volume",
|
||||||
|
"frameRate": "FPS",
|
||||||
|
"currentResolution": "Current resolution",
|
||||||
|
"fps": "fps",
|
||||||
|
"duration": "Duration",
|
||||||
|
"editTaskDuration": "Edit task duration",
|
||||||
|
"prompt": "Prompt",
|
||||||
|
"promptPlaceholder": "Double-click to describe what you want to generate...",
|
||||||
|
"minimaxPromptPlaceholder": "Reference mode supports up to 9 images, 3 audio clips, and 3 videos. Enter text or use @ references to freely combine images, text, audio, and video. For example, @Picture 1 imitates the movement in @Video 1 with the voice from @Audio 1.",
|
||||||
|
"openReferenceResources": "Open reference resources",
|
||||||
|
"userPrompt": "User Prompt",
|
||||||
|
"userPromptVariantTooltip": "New: The user prompt output follows your A/B selection (select A to output A, select B to output B). Use A/B to compare prompts, or to preserve both the original and reverse-engineered prompts.",
|
||||||
|
"systemPrompt": "System Prompt",
|
||||||
|
"systemPromptPlaceholder": "System prompt",
|
||||||
|
"loadingSystemPrompt": "Loading default system prompt...",
|
||||||
|
"resetSystemPrompt": "Reset system prompt",
|
||||||
|
"referenceResources": "Reference resources",
|
||||||
|
"referenceResourcesEmpty": "Add task images or media clips to a track first.",
|
||||||
|
"referencePicture": "Picture {n}",
|
||||||
|
"referenceAudioItem": "Audio {n}",
|
||||||
|
"referenceVideoItem": "Video {n}",
|
||||||
|
"taskImageDropZone": "Task image drop zone",
|
||||||
|
"resizeTaskEditorPanels": "Resize image and prompt panels",
|
||||||
|
"selectImage": "Select image",
|
||||||
|
"addImage": "Add image",
|
||||||
|
"imageDropHint": "Click to choose, or drag files here.",
|
||||||
|
"previewImage": "Preview image",
|
||||||
|
"bypassImage": "Bypass image",
|
||||||
|
"includeImage": "Include image",
|
||||||
|
"bypassImageTooltip": "Bypass this image so it is not used as a reference or counted in image numbering.",
|
||||||
|
"includeImageTooltip": "Include this image as a generation reference again.",
|
||||||
|
"backToPreview": "Back to preview",
|
||||||
|
"deleteImage": "Delete image",
|
||||||
|
"previewLayoutBalanced": "Use balanced preview layout",
|
||||||
|
"previewLayoutImageLarge": "Enlarge task images",
|
||||||
|
"showTaskPrompt": "Show task prompt",
|
||||||
|
"hideTaskPrompt": "Hide task prompt",
|
||||||
|
"individualEdit": "Individual",
|
||||||
|
"combinedEdit": "Combined",
|
||||||
|
"applyPromptToAll": "Apply to all",
|
||||||
|
"applyPromptToAllTitle": "Apply this prompt to every segment?",
|
||||||
|
"applyPromptToAllDescription": "The selected user prompt from this segment will replace both prompt A and prompt B in every task segment, including prompts already set on other segments.",
|
||||||
|
"applyPromptToAllConfirm": "Replace all",
|
||||||
|
"taskNumber": "Segment {n}",
|
||||||
|
"taskMode": "Task mode",
|
||||||
|
"taskModeTooltip": "Choose how this segment generates video.",
|
||||||
|
"continuityMode": "Continuity mode",
|
||||||
|
"continuityModeTooltip": "Start a new shot, continue with a five-frame video anchor, or preserve motion while replacing the character appearance.",
|
||||||
|
"refImageSize": "Reference image size",
|
||||||
|
"refImageSizeTooltip": "Match scales reference images to the generation area; Max keeps a larger reference for stronger identity fidelity but can be much slower.",
|
||||||
|
"lockAudio": "Lock audio",
|
||||||
|
"unlockAudio": "Unlock audio",
|
||||||
|
"audioLockedMarker": "Audio track locked",
|
||||||
|
"audioLockTooltip": "(Only effective in MultiTrack Project) After locking audio, video generation will no longer regenerate the audio and will instead coordinate the video visuals with the original audio.",
|
||||||
|
"videoAudioLockTooltip": "(Only effective in MultiTrack Project) Locking makes video generation follow this video track's visual timeline. Video and audio track locks can be enabled together; when both are enabled, the audio track takes priority for audio locking and replacement.",
|
||||||
|
"enableSpeakerReference": "Reuse as speaker audio",
|
||||||
|
"disableSpeakerReference": "Stop reusing speaker audio",
|
||||||
|
"speakerReferenceTooltip": "(MiniMax only) Reuse this clip as this audio track's @Audio reference in every task. Audio longer than 15 seconds is truncated to its first 15 seconds.",
|
||||||
|
"enableSharedReference": "Use as shared reference",
|
||||||
|
"disableSharedReference": "Stop using as shared reference",
|
||||||
|
"sharedReferenceTooltip": "Use this media as this track's reference in every task. Shared audio uses up to its first 15 seconds.",
|
||||||
|
"sharedImageReferenceTooltip": "Set this image to public, and place before local images in every task. Shared and local images together are limited to 9 per task.",
|
||||||
|
"sharedImageLimitTooltip": "A task already has 9 different images. Remove one before sharing this image.",
|
||||||
|
"previewTaskLabel": "Task{n}",
|
||||||
|
"emptyPreviewTitle": "No segments yet",
|
||||||
|
"emptyPreviewDescription": "Add a task segment or video clip to the tracks below.",
|
||||||
|
"emptyTaskTrack": "Task track",
|
||||||
|
"emptyTaskTrackPurpose": "Without markers, track segments define task divisions; edit prompts, reference images, and more in each segment.",
|
||||||
|
"emptyVideoTrack": "Video track",
|
||||||
|
"emptyVideoTrackPurpose": "Drag or select videos to add them; right-click clips for smart split and subtitle recognition.",
|
||||||
|
"emptyAudioTrack": "Audio track",
|
||||||
|
"emptyAudioTrackPurpose": "Drag or select audio to add it; right-click clips for subtitle recognition.",
|
||||||
|
"emptySubtitleTrack": "Subtitle track",
|
||||||
|
"emptySubtitleTrackPurpose": "Add and edit subtitle styles and positioning, with text-to-speech support.",
|
||||||
|
"emptyTaskMarkers": "Task markers",
|
||||||
|
"emptyTaskMarkersPurpose": "Markers can group multiple segments into one loop task.",
|
||||||
|
"emptyTaskOverview": "Task track overview",
|
||||||
|
"emptyTaskOverviewPurpose": "Expand the task track to view each segment's prompt and reference images.",
|
||||||
|
"addVideo": "Add video",
|
||||||
|
"addAudioSegment": "Add audio",
|
||||||
|
"externalMediaUploading": "Uploading {name}...",
|
||||||
|
"addTrack": "Add track:",
|
||||||
|
"addVideoTrack": "Add video track",
|
||||||
|
"addAudioTrack": "Add audio track",
|
||||||
|
"addSubtitleTrack": "Add subtitle track",
|
||||||
|
"addSubtitleSegment": "Add subtitle",
|
||||||
|
"notSupportedYet": "Not supported yet",
|
||||||
|
"deleteTrack": "Delete {name}",
|
||||||
|
"reorderTrack": "Drag to reorder {name}",
|
||||||
|
"hideSubtitleTrack": "Hide {name}",
|
||||||
|
"showSubtitleTrack": "Show {name}",
|
||||||
|
"muteTrack": "Mute {name}",
|
||||||
|
"soloTrack": "Solo {name}",
|
||||||
|
"muteShort": "M",
|
||||||
|
"soloShort": "S",
|
||||||
|
"addTaskSegment": "Add task segment",
|
||||||
|
"deleteSelectedSegment": "Delete selected segment",
|
||||||
|
"addTaskMarker": "Add task marker",
|
||||||
|
"deleteTaskMarker": "Delete task marker",
|
||||||
|
"taskMarkerLabel": "Segment {n}",
|
||||||
|
"taskMarkerAtFrame": "Task marker at frame {frame}",
|
||||||
|
"taskOverview": "Tasktrack Overview",
|
||||||
|
"deleteSegment": "Delete segment",
|
||||||
|
"subtitle": "Subtitle",
|
||||||
|
"text": "Text",
|
||||||
|
"editSubtitle": "Edit subtitle",
|
||||||
|
"recognizeSubtitles": "Recognize subtitles",
|
||||||
|
"recognizeSubtitlesQwen3": "Qwen3-ASR",
|
||||||
|
"recognizeSubtitlesWhisper": "Whisper Large V3",
|
||||||
|
"recognizingSubtitles": "Recognizing subtitles...",
|
||||||
|
"subtitleRecognitionFailed": "Subtitle recognition failed",
|
||||||
|
"subtitleSpeechComplete": "Audio generation complete",
|
||||||
|
"subtitleSpeechSaved": "Audio generated and saved to {path}",
|
||||||
|
"subtitleSpeechFailed": "Audio generation failed",
|
||||||
|
"subtitleTextSettings": "Subtitle text settings",
|
||||||
|
"subtitleText": "Subtitle text",
|
||||||
|
"fontSize": "Font size",
|
||||||
|
"textColor": "Color",
|
||||||
|
"outlineColor": "Outline color",
|
||||||
|
"backgroundColor": "BG color",
|
||||||
|
"backgroundOpacity": "BG opacity",
|
||||||
|
"backgroundOpacityPercent": "Background opacity (%)",
|
||||||
|
"presetStyle": "Preset style",
|
||||||
|
"applyPresetStyle": "Apply {name} subtitle style",
|
||||||
|
"position": "Position",
|
||||||
|
"positionX": "X",
|
||||||
|
"positionY": "Y",
|
||||||
|
"subtitleWidth": "Width",
|
||||||
|
"subtitleWidthShort": "W",
|
||||||
|
"positionXPercent": "X (%)",
|
||||||
|
"positionYPercent": "Y (%)",
|
||||||
|
"subtitleWidthPercent": "Width (%)",
|
||||||
|
"speech": "Speech",
|
||||||
|
"speechModel": "Model",
|
||||||
|
"speechPrompt": "Control prompt",
|
||||||
|
"speechPromptPlaceholder": "Control prompt: Describe language, dialect, emotion, gender, etc. here.",
|
||||||
|
"speechCfg": "CFG",
|
||||||
|
"speechSteps": "Steps",
|
||||||
|
"referenceAudio": "Reference audio",
|
||||||
|
"addReferenceAudio": "Add reference audio",
|
||||||
|
"reselectReferenceAudio": "Reselect reference audio",
|
||||||
|
"playReferenceAudio": "Play reference audio",
|
||||||
|
"pauseReferenceAudio": "Pause reference audio",
|
||||||
|
"clearReferenceAudio": "Clear reference audio",
|
||||||
|
"distributeTaskSegments": "Distribute segments evenly",
|
||||||
|
"mergeTaskSegments": "Merge segments",
|
||||||
|
"cloneTaskSegment": "Clone segment",
|
||||||
|
"cloneVideoSegment": "Clone video",
|
||||||
|
"cloneAudioSegment": "Clone audio",
|
||||||
|
"splitTaskSegment": "Split segment",
|
||||||
|
"splitTaskSegmentDescription": "Current segment is {frames} frames ({seconds}s). Enter the seconds for each split.",
|
||||||
|
"splitTaskSegmentSeconds": "Split seconds",
|
||||||
|
"splitTaskSegmentSecondsUnit": "s",
|
||||||
|
"splitTaskSegmentPreview": "Will split into {count} segments.",
|
||||||
|
"splitTaskSegmentInvalid": "Enter at least 1 second and less than the current segment duration.",
|
||||||
|
"splitTaskSegmentConfirm": "Split",
|
||||||
|
"smartSplit": "Smart split",
|
||||||
|
"smartSplitTasksOnly": "Smart split (tasks only)",
|
||||||
|
"noMatchingTaskSegment": "No task segment has the same start and end frames.",
|
||||||
|
"smartSplitting": "Detecting shots...",
|
||||||
|
"smartSplitFailed": "Smart split failed",
|
||||||
|
"cutMode": "Trim segments",
|
||||||
|
"trimLeftAtPlayhead": "Trim left",
|
||||||
|
"trimRightAtPlayhead": "Trim right",
|
||||||
|
"undo": "Undo",
|
||||||
|
"redo": "Redo",
|
||||||
|
"play": "Play",
|
||||||
|
"pause": "Pause",
|
||||||
|
"timelineSnap": "Timeline snap",
|
||||||
|
"hideTimeline": "Hide timeline",
|
||||||
|
"showTimeline": "Show timeline",
|
||||||
|
"timelineZoom": "Timeline zoom"
|
||||||
|
},
|
||||||
|
"multitrackContinuityModes": {
|
||||||
|
"shot": "Shot",
|
||||||
|
"context": "Context",
|
||||||
|
"context_swap": "Swap Context"
|
||||||
|
},
|
||||||
|
"multitrackRefImageSizes": {
|
||||||
|
"match": "Match",
|
||||||
|
"max": "Max"
|
||||||
|
},
|
||||||
|
"modelDownload": {
|
||||||
|
"title": "{name} is missing",
|
||||||
|
"description": "{name} must be installed under {directory}. Download it automatically or open the source link and place the file there manually.",
|
||||||
|
"auto": "Auto download",
|
||||||
|
"manual": "Manual download",
|
||||||
|
"exit": "Exit",
|
||||||
|
"close": "Close",
|
||||||
|
"downloading": "Downloading...",
|
||||||
|
"downloadComplete": "Model installed",
|
||||||
|
"downloadCompleteDetail": "{name} was downloaded. Run the action again."
|
||||||
|
},
|
||||||
|
"trackRow": {
|
||||||
|
"trackColor": "Track color"
|
||||||
|
},
|
||||||
|
"segmentBlock": {
|
||||||
|
"resizeStart": "Resize segment start",
|
||||||
|
"resizeEnd": "Resize segment end"
|
||||||
|
},
|
||||||
|
"promptTrack": {
|
||||||
|
"distributeEvenly": "Distribute evenly",
|
||||||
|
"addSegment": "Add segment",
|
||||||
|
"deleteSegment": "Delete selected segment",
|
||||||
|
"addSegmentTitle": "Add segment",
|
||||||
|
"promptPlaceholder": "Prompt text...",
|
||||||
|
"segmentLabel": "Segment {n}",
|
||||||
|
"empty": "empty",
|
||||||
|
"editSegmentTitle": "Edit segment {n}",
|
||||||
|
"contextEdit": "Edit segment",
|
||||||
|
"contextAdd": "Add segment",
|
||||||
|
"contextDistribute": "Distribute evenly",
|
||||||
|
"editDialogTitle": "Edit Prompts",
|
||||||
|
"tabCombined": "Combined",
|
||||||
|
"tabIndividual": "Individual",
|
||||||
|
"combinedHint": "Use | to separate segments. Changes apply in real-time.",
|
||||||
|
"segmentCount": "{n} segment(s)"
|
||||||
|
},
|
||||||
|
"audioTrack": {
|
||||||
|
"addMarker": "Add marker",
|
||||||
|
"importFile": "Import audio file\u2026",
|
||||||
|
"importUrl": "Import from URL\u2026",
|
||||||
|
"enterUrl": "Enter audio URL:",
|
||||||
|
"frameLabel": "Frame {n}",
|
||||||
|
"markerAriaLabel": "Marker: {label}",
|
||||||
|
"markerAtFrame": "Marker at frame {frame}",
|
||||||
|
"editMarker": "Edit marker",
|
||||||
|
"markerLabelInput": "Marker label",
|
||||||
|
"placeholder": "Audio Track",
|
||||||
|
"placeholderHint": "Double-click to add content",
|
||||||
|
"dropZone": "Audio track drop zone",
|
||||||
|
"selectMedia": "Select audio",
|
||||||
|
"contextEdit": "Edit segment",
|
||||||
|
"contextAdd": "Add segment",
|
||||||
|
"contextDelete": "Delete segment"
|
||||||
|
},
|
||||||
|
"imageTrack": {
|
||||||
|
"dropZone": "Image track drop zone",
|
||||||
|
"addSegment": "Add image",
|
||||||
|
"deleteSegment": "Delete selected segment",
|
||||||
|
"importFile": "Import image file\u2026",
|
||||||
|
"importUrl": "Import from URL\u2026",
|
||||||
|
"enterUrl": "Enter image URL:",
|
||||||
|
"placeholder": "Image Track",
|
||||||
|
"placeholderHint": "Double-click to add content",
|
||||||
|
"contextReselect": "Change Segment",
|
||||||
|
"contextAdd": "Add segment",
|
||||||
|
"contextDistribute": "Distribute evenly",
|
||||||
|
"contextDelete": "Delete segment"
|
||||||
|
},
|
||||||
|
"maintainTrack": {
|
||||||
|
"dropZone": "Maintain track drop zone",
|
||||||
|
"segmentLabel": "Segment {n}",
|
||||||
|
"segmentPlaceholder": "Click segment to write the prompt...",
|
||||||
|
"placeholder": "Add segment",
|
||||||
|
"placeholderHint": "Double-click to add segment",
|
||||||
|
"promptPlaceholder": "Prompt text...",
|
||||||
|
"addImage": "Add image",
|
||||||
|
"tabCombined": "Combined",
|
||||||
|
"tabIndividual": "Individual",
|
||||||
|
"combinedHint": "Use | to separate segments. Changes apply in real-time.",
|
||||||
|
"contextEdit": "Edit segment",
|
||||||
|
"contextAdd": "Add segment",
|
||||||
|
"contextClone": "Clone segment",
|
||||||
|
"contextDelete": "Delete segment",
|
||||||
|
"contextDistribute": "Distribute evenly",
|
||||||
|
"addMedia": "Add media",
|
||||||
|
"flf": "First Last frames",
|
||||||
|
"fmlf": "Multiple frames",
|
||||||
|
"ref": "Reference frames"
|
||||||
|
},
|
||||||
|
"insertButton": {
|
||||||
|
"insertBefore": "Insert segment before",
|
||||||
|
"insertAfter": "Insert segment after"
|
||||||
|
},
|
||||||
|
"panorama": {
|
||||||
|
"applyView": "Apply view",
|
||||||
|
"cancel": "Cancel panorama",
|
||||||
|
"cancelHint": "Remove the saved panorama view and exit",
|
||||||
|
"orientation": "Yaw {yaw}° · Pitch {pitch}°",
|
||||||
|
"zoom": "FOV {fov}° ×{ratio}",
|
||||||
|
"exit": "Exit panorama view",
|
||||||
|
"loading": "Loading panorama...",
|
||||||
|
"invalidView": "Saved panorama view is invalid.",
|
||||||
|
"webglUnavailable": "WebGL panorama rendering is unavailable.",
|
||||||
|
"textureLoadFailed": "Failed to load this image as a panorama texture."
|
||||||
|
},
|
||||||
|
"multiImagesLoader": {
|
||||||
|
"add": "Add images",
|
||||||
|
"replace": "Replace image {n}",
|
||||||
|
"preview": "Preview image",
|
||||||
|
"delete": "Delete image",
|
||||||
|
"imageCount": "Images: {n}",
|
||||||
|
"clearAll": "Clear all"
|
||||||
|
},
|
||||||
|
"mediaSelector": {
|
||||||
|
"tabInputs": "Inputs",
|
||||||
|
"tabOutputs": "Outputs",
|
||||||
|
"tabHistory": "History",
|
||||||
|
"filter": "Multi",
|
||||||
|
"selectAll":"SelectAll",
|
||||||
|
"confirm": "Confirm",
|
||||||
|
"tabLocal": "Local",
|
||||||
|
"tabUrl": "URL",
|
||||||
|
"searchPlaceholder": "Search...",
|
||||||
|
"sort": "Sort by {by}",
|
||||||
|
"sortName": "name",
|
||||||
|
"sortDate": "date",
|
||||||
|
"sortFolders": "folders first",
|
||||||
|
"viewList": "List view",
|
||||||
|
"viewGrid": "Grid view",
|
||||||
|
"refresh": "Refresh",
|
||||||
|
"localPathPlaceholder": "Absolute folder path...",
|
||||||
|
"urlHint": "Paste an http(s) URL to a media file.",
|
||||||
|
"urlConfirm": "Confirm URL",
|
||||||
|
"urlChecking": "Checking...",
|
||||||
|
"urlErrorTitle": "URL Error",
|
||||||
|
"urlErrorNotFound": "File not found or access denied.",
|
||||||
|
"empty": "No files found",
|
||||||
|
"error": "Failed to load: {msg}",
|
||||||
|
"tabSlot": "Slot",
|
||||||
|
"slotNotConnected": "No connected input",
|
||||||
|
"slotEmpty": "No content available",
|
||||||
|
"slotList": "list",
|
||||||
|
"slotImage": "Image {n}",
|
||||||
|
"slotAudio": "Audio {n}",
|
||||||
|
"slotVideo": "Video {n}",
|
||||||
|
"addLocal": "Add local file"
|
||||||
|
}
|
||||||
|
}
|
||||||
462
frontend/messages/zh.json
Normal file
@ -0,0 +1,462 @@
|
|||||||
|
{
|
||||||
|
"common": {
|
||||||
|
"cancel": "取消",
|
||||||
|
"save": "保存",
|
||||||
|
"add": "添加",
|
||||||
|
"delete": "删除",
|
||||||
|
"syncPlay": "同步播放"
|
||||||
|
},
|
||||||
|
"compareVideo": {
|
||||||
|
"empty": "请选择视频进行对比,或在接入输入后执行节点。",
|
||||||
|
"source": "Source",
|
||||||
|
"output": "Output",
|
||||||
|
"selectSource": "选择源",
|
||||||
|
"selectOutput": "选择目标",
|
||||||
|
"clearSource": "清除源视频",
|
||||||
|
"clearOutput": "清除目标视频",
|
||||||
|
"sourceOnly": "Source",
|
||||||
|
"outputOnly": "Output",
|
||||||
|
"sideBySide": "A/B",
|
||||||
|
"compare": "Compare",
|
||||||
|
"play": "播放",
|
||||||
|
"pause": "暂停",
|
||||||
|
"seek": "视频时间",
|
||||||
|
"mute": "静音",
|
||||||
|
"unmute": "取消静音",
|
||||||
|
"volume": "音量",
|
||||||
|
"saveOutput": "保存输出视频",
|
||||||
|
"watchOutputHistory": "监听输出历史",
|
||||||
|
"filenamePrefix": "保存前缀",
|
||||||
|
"settings": "输出设置",
|
||||||
|
"downloadOutput": "下载输出视频"
|
||||||
|
},
|
||||||
|
"promptEnhancerAccount": {
|
||||||
|
"balance": "余额:{amount}",
|
||||||
|
"balanceEmpty": "余额:--",
|
||||||
|
"viewBalance": "去查看余额",
|
||||||
|
"loadingBalance": "正在获取余额...",
|
||||||
|
"balanceUnavailable": "暂时无法获取余额",
|
||||||
|
"apiKeyRequired": "填写 API Key 后可获取余额",
|
||||||
|
"apiKey": "API Key",
|
||||||
|
"localModel": "本地模型,无需 API 账户"
|
||||||
|
},
|
||||||
|
"projectVideoCombine": {
|
||||||
|
"selectProject": "选择项目",
|
||||||
|
"deleteProject": "删除项目",
|
||||||
|
"deleteProjectTitle": "删除项目?",
|
||||||
|
"deleteProjectConfirm": "确定删除项目 {project} 及其整个文件夹吗?其中的 latent、JSON 和媒体文件也会一并删除,且无法恢复。",
|
||||||
|
"deleteDefaultProjectConfirm": "确定清空 default 项目的所有 latent、JSON 和媒体文件吗?default 文件夹会保留,删除后无法恢复。",
|
||||||
|
"deleteProjectSuccess": "项目已删除",
|
||||||
|
"deleteProjectSuccessDetail": "项目 {project} 已删除。",
|
||||||
|
"deleteProjectFailed": "项目删除失败",
|
||||||
|
"deleteClipFile": "删除 {file}",
|
||||||
|
"deleteClipFileTitle": "删除生成片段?",
|
||||||
|
"deleteClipFileConfirm": "确定永久删除 {file} 及其关联的生成文件吗?删除后将保存项目最新状态,此操作无法恢复。",
|
||||||
|
"deleteClipFileFailed": "片段删除失败",
|
||||||
|
"deleteClipFileUnavailable": "片段删除接口不可用(HTTP 404/405)。请重启 ComfyUI 以加载更新后的后端,再刷新页面重试。",
|
||||||
|
"deleteClipFileInvalidResponse": "服务器返回的项目数据无效(HTTP {status}),预览未修改。请刷新项目以核实已保存的状态。",
|
||||||
|
"refresh": "刷新项目",
|
||||||
|
"mutePreview": "关闭预览声音",
|
||||||
|
"unmutePreview": "开启预览声音",
|
||||||
|
"combine": "合并",
|
||||||
|
"autoCombine": "自动合并",
|
||||||
|
"clipLabel": "片段{number}",
|
||||||
|
"clipContinuity": "{mode}",
|
||||||
|
"selectClipFile": "选择片段{number}的视频文件",
|
||||||
|
"selectClipFiles": "为片段{number}选择最多两个视频",
|
||||||
|
"selectClipFilesHint": "选择一个视频用于项目,选择两个视频进行对比。",
|
||||||
|
"selectClipFileFailed": "视频版本选择保存失败",
|
||||||
|
"continuityShot": "分镜",
|
||||||
|
"continuityContext": "上下文",
|
||||||
|
"continuityContextSwap": "上下文(替换)",
|
||||||
|
"emptyPreview": "请刷新项目以预览已生成的视频片段。",
|
||||||
|
"refreshFailed": "项目刷新失败",
|
||||||
|
"combineFailed": "项目合并失败",
|
||||||
|
"projectListFailed": "无法获取项目列表",
|
||||||
|
"connectSaveNode": "请先将此节点连接到视频保存输出节点,再执行手动合并。",
|
||||||
|
"combineQueued": "合并任务已提交",
|
||||||
|
"combineQueuedDetail": "项目 {project} 及其下游节点已加入队列。",
|
||||||
|
"queueBusy": "当前 ComfyUI 队列仍有任务,请等待队列清空后再手动合并。"
|
||||||
|
},
|
||||||
|
"samplingPreview": {
|
||||||
|
"title": "采样预览",
|
||||||
|
"meta": "片段 {segment} · {pass} · {step}/{total}",
|
||||||
|
"playbackProgress": "采样预览播放进度",
|
||||||
|
"hidePreview": "隐藏采样预览",
|
||||||
|
"showPreview": "显示采样预览",
|
||||||
|
"pausePreview": "暂停采样预览",
|
||||||
|
"resumePreview": "继续采样预览",
|
||||||
|
"first": "一采",
|
||||||
|
"second": "二采",
|
||||||
|
"selflift": "SelfLift"
|
||||||
|
},
|
||||||
|
"toolbar": {
|
||||||
|
"frames": "帧",
|
||||||
|
"seconds": "秒",
|
||||||
|
"fps": "帧/秒",
|
||||||
|
"play": "播放",
|
||||||
|
"pause": "暂停",
|
||||||
|
"deleteSegment": "删除选中片段",
|
||||||
|
"zoom": "缩放"
|
||||||
|
},
|
||||||
|
"timeline": {
|
||||||
|
"defaultTrackName": "主轨 {n}",
|
||||||
|
"defaultAudioTrackName": "音频轨 {n}"
|
||||||
|
},
|
||||||
|
"multitrackTaskModes": {
|
||||||
|
"default": "文图",
|
||||||
|
"t2v": "文生视频",
|
||||||
|
"i2v": "图生视频",
|
||||||
|
"fl2v": "首尾生视频",
|
||||||
|
"fmlf2v": "多帧生视频",
|
||||||
|
"l2v": "尾帧",
|
||||||
|
"r2v": "参考生视频",
|
||||||
|
"rv2v": "参考视频生视频",
|
||||||
|
"vi2v": "图像视频编辑",
|
||||||
|
"v2v": "视频生视频",
|
||||||
|
"ref": "参考",
|
||||||
|
"edit": "编辑"
|
||||||
|
},
|
||||||
|
"multitrackSegment": {
|
||||||
|
"taskLabel": "片段 {n} {mode}"
|
||||||
|
},
|
||||||
|
"multitrack": {
|
||||||
|
"audio": "音频",
|
||||||
|
"globalAudio": "总音频",
|
||||||
|
"audioSettings": "音频设置",
|
||||||
|
"speed": "速度",
|
||||||
|
"fpsSettings": "速度设置",
|
||||||
|
"mutePreviewAudio": "静音预览音频",
|
||||||
|
"unmutePreviewAudio": "取消静音预览音频",
|
||||||
|
"mute": "静音",
|
||||||
|
"unmute": "取消静音",
|
||||||
|
"volume": "音量",
|
||||||
|
"frameRate": "帧率",
|
||||||
|
"currentResolution": "当前分辨率",
|
||||||
|
"fps": "帧/秒",
|
||||||
|
"duration": "时长",
|
||||||
|
"editTaskDuration": "编辑任务时长",
|
||||||
|
"prompt": "提示词",
|
||||||
|
"promptPlaceholder": "双击描述您想要生成的内容...",
|
||||||
|
"minimaxPromptPlaceholder": "参考模式下最多支持9张图片,3个音频,3个视频, 输入文字或 @ 参考内容, 自由组合图、文、音,视频多元素,定义精彩互动。例如 @图片1 模仿 @视频1 的动作,音色参考 @音频1。",
|
||||||
|
"openReferenceResources": "打开引用资源",
|
||||||
|
"userPrompt": "用户提示词",
|
||||||
|
"userPromptVariantTooltip": "✨新功能:用户提示词将根据您的选择输出(即选择 A 时输出 A,选择 B 时 输出 B)。A/B 可用于提示词对比,也可用于分别保存原提示词与反推后的提示词。",
|
||||||
|
"systemPrompt": "系统提示词",
|
||||||
|
"systemPromptPlaceholder": "系统提示词",
|
||||||
|
"loadingSystemPrompt": "正在加载默认系统提示词...",
|
||||||
|
"resetSystemPrompt": "重置系统提示词",
|
||||||
|
"referenceResources": "可能@的内容",
|
||||||
|
"referenceResourcesEmpty": "请先在左侧添加图片或在媒体轨道中添加片段。",
|
||||||
|
"referencePicture": "图片{n}",
|
||||||
|
"referenceAudioItem": "音频{n}",
|
||||||
|
"referenceVideoItem": "视频{n}",
|
||||||
|
"taskImageDropZone": "任务图片拖放区域",
|
||||||
|
"resizeTaskEditorPanels": "调整图片与提示词区域宽度",
|
||||||
|
"selectImage": "选择图片",
|
||||||
|
"addImage": "添加图片",
|
||||||
|
"imageDropHint": "点击从文件选择,或将文件拖到这里。",
|
||||||
|
"previewImage": "预览图片",
|
||||||
|
"bypassImage": "禁用图片",
|
||||||
|
"includeImage": "启用图片",
|
||||||
|
"bypassImageTooltip": "禁用该图片;生成时不会作为参考图,且不占图片序号。",
|
||||||
|
"includeImageTooltip": "重新启用该图片作为生成参考图。",
|
||||||
|
"backToPreview": "返回预览",
|
||||||
|
"deleteImage": "删除图片",
|
||||||
|
"previewLayoutBalanced": "使用均衡预览布局",
|
||||||
|
"previewLayoutImageLarge": "放大任务图片区",
|
||||||
|
"showTaskPrompt": "显示任务提示词",
|
||||||
|
"hideTaskPrompt": "隐藏任务提示词",
|
||||||
|
"individualEdit": "逐段编辑",
|
||||||
|
"combinedEdit": "整体编辑",
|
||||||
|
"applyPromptToAll": "应用到所有",
|
||||||
|
"applyPromptToAllTitle": "将提示词应用到所有片段?",
|
||||||
|
"applyPromptToAllDescription": "当前片段选中的用户提示词将覆盖所有任务片段的 A、B 提示词;其他片段已设置的提示词也会被替换。",
|
||||||
|
"applyPromptToAllConfirm": "确认覆盖",
|
||||||
|
"taskNumber": "片段 {n}",
|
||||||
|
"taskMode": "任务模式",
|
||||||
|
"taskModeTooltip": "选择当前片段的视频生成方式。",
|
||||||
|
"continuityMode": "衔接模式",
|
||||||
|
"continuityModeTooltip": "选择开启新分镜、使用五帧视频锚点承接上下文,或在保留动作连续性的同时替换角色外观。",
|
||||||
|
"refImageSize": "参考图像尺寸",
|
||||||
|
"refImageSizeTooltip": "匹配尺寸会按生成画面面积缩放参考图;最大尺寸会保留更大的参考图以提升主体一致性,但生成速度可能慢数倍。",
|
||||||
|
"lockAudio": "锁定音频",
|
||||||
|
"unlockAudio": "解除音频锁定",
|
||||||
|
"audioLockedMarker": "音频轨道已锁定",
|
||||||
|
"audioLockTooltip": "(仅多轨项目有效) 锁定音频后,视频生成将不再重新生成音频,而改用原音频协调视频画面生成。",
|
||||||
|
"videoAudioLockTooltip": "(仅多轨项目有效)锁定后,视频生成会遵循该视频轨道画面的时间线。视频轨道音频锁可与音频轨道锁同时启用;同时启用时,音频轨道将优先用于音频锁定和替换。",
|
||||||
|
"enableSpeakerReference": "复用为说话人音频",
|
||||||
|
"disableSpeakerReference": "停止复用说话人音频",
|
||||||
|
"speakerReferenceTooltip": "(仅 MiniMax)在每个任务中将此片段复用为该音轨对应的 @音频 引用;超过 15 秒时只取开头 15 秒。",
|
||||||
|
"enableSharedReference": "设为公共参考",
|
||||||
|
"disableSharedReference": "取消公共参考",
|
||||||
|
"sharedReferenceTooltip": "将此媒体作为该轨道在所有任务片段中的公共参考;公共音频最多使用开头 15 秒。",
|
||||||
|
"sharedImageReferenceTooltip": "将此图片设为公用图片,它将排在每个任务片段的私有图片之前;公共图片与私有图片每段合计最多 9 张。",
|
||||||
|
"sharedImageLimitTooltip": "已有任务片段包含 9 张不同图片,请先移除一张再设为公共图片。",
|
||||||
|
"previewTaskLabel": "任务{n}",
|
||||||
|
"emptyPreviewTitle": "还没有可预览的片段",
|
||||||
|
"emptyPreviewDescription": "请在下方轨道添加任务片段或视频片段。",
|
||||||
|
"emptyTaskTrack": "任务轨道",
|
||||||
|
"emptyTaskTrackPurpose": "未打标时,轨道中片段代表任务分割数量、片段中可编辑提示词、参考图片等。",
|
||||||
|
"emptyVideoTrack": "视频轨道",
|
||||||
|
"emptyVideoTrackPurpose": "拖拽或选择视频以添加,片段上右键支持智能分割、识别字幕。",
|
||||||
|
"emptyAudioTrack": "音频轨道",
|
||||||
|
"emptyAudioTrackPurpose": "拖拽或选择音频以添加,片段上右键支持识别字幕。",
|
||||||
|
"emptySubtitleTrack": "字幕轨道",
|
||||||
|
"emptySubtitleTrackPurpose": "添加、编辑字幕样式与定位,支持字幕朗读。",
|
||||||
|
"emptyTaskMarkers": "任务标签",
|
||||||
|
"emptyTaskMarkersPurpose": "打标后可以将多片段作为一轮循环任务。",
|
||||||
|
"emptyTaskOverview": "任务轨概览",
|
||||||
|
"emptyTaskOverviewPurpose": "展开任务轨,查看各片段的提示词和参考图片。",
|
||||||
|
"addVideo": "添加视频",
|
||||||
|
"addAudioSegment": "添加音频",
|
||||||
|
"externalMediaUploading": "正在上传 {name}...",
|
||||||
|
"addTrack": "添加轨道:",
|
||||||
|
"addVideoTrack": "添加视频轨",
|
||||||
|
"addAudioTrack": "添加音频轨",
|
||||||
|
"addSubtitleTrack": "添加字幕轨",
|
||||||
|
"addSubtitleSegment": "添加字幕",
|
||||||
|
"notSupportedYet": "暂不支持",
|
||||||
|
"deleteTrack": "删除{name}",
|
||||||
|
"reorderTrack": "拖动以调整{name}顺序",
|
||||||
|
"hideSubtitleTrack": "隐藏{name}",
|
||||||
|
"showSubtitleTrack": "显示{name}",
|
||||||
|
"muteTrack": "静音{name}",
|
||||||
|
"soloTrack": "独奏{name}",
|
||||||
|
"muteShort": "M",
|
||||||
|
"soloShort": "S",
|
||||||
|
"addTaskSegment": "添加任务片段",
|
||||||
|
"deleteSelectedSegment": "删除选中片段",
|
||||||
|
"addTaskMarker": "添加任务标记",
|
||||||
|
"deleteTaskMarker": "删除任务标记",
|
||||||
|
"taskMarkerLabel": "片段 {n}",
|
||||||
|
"taskMarkerAtFrame": "第 {frame} 帧任务标记",
|
||||||
|
"taskOverview": "任务轨概览",
|
||||||
|
"deleteSegment": "删除片段",
|
||||||
|
"subtitle": "字幕",
|
||||||
|
"text": "文字",
|
||||||
|
"editSubtitle": "编辑字幕",
|
||||||
|
"recognizeSubtitles": "识别字幕",
|
||||||
|
"recognizeSubtitlesQwen3": "Qwen3-ASR",
|
||||||
|
"recognizeSubtitlesWhisper": "Whisper Large V3",
|
||||||
|
"recognizingSubtitles": "正在识别字幕...",
|
||||||
|
"subtitleRecognitionFailed": "识别字幕失败",
|
||||||
|
"subtitleSpeechComplete": "音频生成完成",
|
||||||
|
"subtitleSpeechSaved": "音频生成完成保存到 {path}",
|
||||||
|
"subtitleSpeechFailed": "音频生成失败",
|
||||||
|
"subtitleTextSettings": "字幕文字设置",
|
||||||
|
"subtitleText": "字幕文字",
|
||||||
|
"fontSize": "字号",
|
||||||
|
"textColor": "文字颜色",
|
||||||
|
"outlineColor": "描边颜色",
|
||||||
|
"backgroundColor": "背景颜色",
|
||||||
|
"backgroundOpacity": "背景透明",
|
||||||
|
"backgroundOpacityPercent": "背景透明度(%)",
|
||||||
|
"presetStyle": "预设样式",
|
||||||
|
"applyPresetStyle": "应用{name}字幕样式",
|
||||||
|
"position": "位置",
|
||||||
|
"positionX": "X",
|
||||||
|
"positionY": "Y",
|
||||||
|
"subtitleWidth": "宽度",
|
||||||
|
"subtitleWidthShort": "宽",
|
||||||
|
"positionXPercent": "X(%)",
|
||||||
|
"positionYPercent": "Y(%)",
|
||||||
|
"subtitleWidthPercent": "宽度(%)",
|
||||||
|
"speech": "朗读",
|
||||||
|
"speechModel": "模型",
|
||||||
|
"speechPrompt": "控制指令",
|
||||||
|
"speechPromptPlaceholder": "控制指令:可以在此处描述语言、方言、情感、性别等。",
|
||||||
|
"speechCfg": "CFG",
|
||||||
|
"speechSteps": "推理步数",
|
||||||
|
"referenceAudio": "参考音频",
|
||||||
|
"addReferenceAudio": "添加参考音频",
|
||||||
|
"reselectReferenceAudio": "重选参考音频",
|
||||||
|
"playReferenceAudio": "播放参考音频",
|
||||||
|
"pauseReferenceAudio": "暂停参考音频",
|
||||||
|
"clearReferenceAudio": "清除参考音频",
|
||||||
|
"distributeTaskSegments": "均分片段",
|
||||||
|
"mergeTaskSegments": "合并片段",
|
||||||
|
"cloneTaskSegment": "复制片段",
|
||||||
|
"cloneVideoSegment": "复制视频",
|
||||||
|
"cloneAudioSegment": "复制音频",
|
||||||
|
"splitTaskSegment": "拆分片段",
|
||||||
|
"splitTaskSegmentDescription": "当前片段为 {frames} 帧({seconds} 秒),请输入每段拆分秒数。",
|
||||||
|
"splitTaskSegmentSeconds": "拆分秒数",
|
||||||
|
"splitTaskSegmentSecondsUnit": "秒",
|
||||||
|
"splitTaskSegmentPreview": "将拆分为 {count} 个片段。",
|
||||||
|
"splitTaskSegmentInvalid": "请输入至少 1 秒且小于当前片段时长的数值。",
|
||||||
|
"splitTaskSegmentConfirm": "拆分",
|
||||||
|
"smartSplit": "智能分割",
|
||||||
|
"smartSplitTasksOnly": "智能分割(仅任务)",
|
||||||
|
"noMatchingTaskSegment": "没有起止帧相同的任务片段。",
|
||||||
|
"smartSplitting": "正在智能分割...",
|
||||||
|
"smartSplitFailed": "智能分割失败",
|
||||||
|
"cutMode": "分割片段",
|
||||||
|
"trimLeftAtPlayhead": "向左裁剪",
|
||||||
|
"trimRightAtPlayhead": "向右裁剪",
|
||||||
|
"undo": "撤销",
|
||||||
|
"redo": "重做",
|
||||||
|
"play": "播放",
|
||||||
|
"pause": "暂停",
|
||||||
|
"timelineSnap": "时间线磁吸",
|
||||||
|
"hideTimeline": "隐藏轨道区域",
|
||||||
|
"showTimeline": "显示轨道区域",
|
||||||
|
"timelineZoom": "时间线缩放"
|
||||||
|
},
|
||||||
|
"multitrackContinuityModes": {
|
||||||
|
"shot": "分镜",
|
||||||
|
"context": "上下文",
|
||||||
|
"context_swap": "上下文(主体替换)"
|
||||||
|
},
|
||||||
|
"multitrackRefImageSizes": {
|
||||||
|
"match": "匹配尺寸",
|
||||||
|
"max": "最大尺寸"
|
||||||
|
},
|
||||||
|
"modelDownload": {
|
||||||
|
"title": "缺少 {name} 模型",
|
||||||
|
"description": "需要将 {name} 安装到 {directory}。可以自动下载,或打开下载链接后手动放入该目录。自动下载将从 Hugging Face 中进行下载,如果您的网络不太稳定或长时间没有下载成功,请重启 ComfyUI,重新使用手动进行下载。",
|
||||||
|
"auto": "自动下载",
|
||||||
|
"manual": "手动下载",
|
||||||
|
"exit": "退出",
|
||||||
|
"close": "关闭",
|
||||||
|
"downloading": "下载中...",
|
||||||
|
"downloadComplete": "模型已安装",
|
||||||
|
"downloadCompleteDetail": "{name} 已下载,请重新执行操作。"
|
||||||
|
},
|
||||||
|
"trackRow": {
|
||||||
|
"trackColor": "轨道颜色"
|
||||||
|
},
|
||||||
|
"segmentBlock": {
|
||||||
|
"resizeStart": "调整片段开始",
|
||||||
|
"resizeEnd": "调整片段结束"
|
||||||
|
},
|
||||||
|
"promptTrack": {
|
||||||
|
"distributeEvenly": "均匀分布",
|
||||||
|
"addSegment": "添加分段",
|
||||||
|
"deleteSegment": "删除选中片段",
|
||||||
|
"addSegmentTitle": "添加分段",
|
||||||
|
"promptPlaceholder": "提示词...",
|
||||||
|
"segmentLabel": "片段 {n}",
|
||||||
|
"empty": "空",
|
||||||
|
"editSegmentTitle": "编辑分段 {n}",
|
||||||
|
"contextEdit": "编辑片段",
|
||||||
|
"contextAdd": "添加分段",
|
||||||
|
"contextDistribute": "均匀分布",
|
||||||
|
"editDialogTitle": "编辑提示词",
|
||||||
|
"tabCombined": "整体编辑",
|
||||||
|
"tabIndividual": "逐段编辑",
|
||||||
|
"combinedHint": "用 | 分隔各分段,修改实时生效。",
|
||||||
|
"segmentCount": "共 {n} 个分段"
|
||||||
|
},
|
||||||
|
"audioTrack": {
|
||||||
|
"addMarker": "添加标记",
|
||||||
|
"importFile": "导入音频文件…",
|
||||||
|
"importUrl": "从 URL 导入…",
|
||||||
|
"enterUrl": "请输入音频 URL:",
|
||||||
|
"frameLabel": "第 {n} 帧",
|
||||||
|
"markerAriaLabel": "标记:{label}",
|
||||||
|
"markerAtFrame": "第 {frame} 帧标记",
|
||||||
|
"editMarker": "编辑标记",
|
||||||
|
"markerLabelInput": "标记名称",
|
||||||
|
"placeholder": "音频轨道",
|
||||||
|
"placeholderHint": "双击可添加内容",
|
||||||
|
"dropZone": "音频轨道拖放区域",
|
||||||
|
"selectMedia": "选择音频",
|
||||||
|
"contextEdit": "编辑片段",
|
||||||
|
"contextAdd": "添加片段",
|
||||||
|
"contextDelete": "删除片段"
|
||||||
|
},
|
||||||
|
"imageTrack": {
|
||||||
|
"dropZone": "图片轨道拖放区域",
|
||||||
|
"addSegment": "添加图片",
|
||||||
|
"deleteSegment": "删除选中片段",
|
||||||
|
"importFile": "导入图片文件…",
|
||||||
|
"importUrl": "从 URL 导入…",
|
||||||
|
"enterUrl": "请输入图片 URL:",
|
||||||
|
"placeholder": "图片轨道",
|
||||||
|
"placeholderHint": "双击可添加内容",
|
||||||
|
"contextReselect": "重选分片段",
|
||||||
|
"contextAdd": "添加分片段",
|
||||||
|
"contextDistribute": "均分分片段",
|
||||||
|
"contextDelete": "删除片段"
|
||||||
|
},
|
||||||
|
"maintainTrack": {
|
||||||
|
"dropZone": "主轨拖放区域",
|
||||||
|
"segmentLabel": "片段 {n}",
|
||||||
|
"segmentPlaceholder": "点击片段修改提示...",
|
||||||
|
"placeholder": "添加片段",
|
||||||
|
"placeholderHint": "双击添加片段",
|
||||||
|
"promptPlaceholder": "提示词...",
|
||||||
|
"addImage": "添加图片",
|
||||||
|
"tabCombined": "整体编辑",
|
||||||
|
"tabIndividual": "逐段编辑",
|
||||||
|
"combinedHint": "用 | 分隔各分段,修改实时生效。",
|
||||||
|
"contextEdit": "编辑片段",
|
||||||
|
"contextAdd": "添加片段",
|
||||||
|
"contextClone": "克隆片段",
|
||||||
|
"contextDelete": "删除片段",
|
||||||
|
"contextDistribute": "均匀分布",
|
||||||
|
"addMedia": "添加媒体",
|
||||||
|
"flf": "首尾帧",
|
||||||
|
"fmlf": "多帧",
|
||||||
|
"ref": "参考帧"
|
||||||
|
},
|
||||||
|
"insertButton": {
|
||||||
|
"insertBefore": "在此之前插入片段",
|
||||||
|
"insertAfter": "在此之后插入片段"
|
||||||
|
},
|
||||||
|
"panorama": {
|
||||||
|
"applyView": "应用视角",
|
||||||
|
"cancel": "取消全景",
|
||||||
|
"cancelHint": "删除已保存的全景视角并退出",
|
||||||
|
"orientation": "横 {yaw}° · 纵 {pitch}°",
|
||||||
|
"zoom": "视场 {fov}° ×{ratio}",
|
||||||
|
"exit": "退出全景查看",
|
||||||
|
"loading": "正在加载全景图...",
|
||||||
|
"invalidView": "已保存的全景视角无效。",
|
||||||
|
"webglUnavailable": "当前环境无法使用 WebGL 全景渲染。",
|
||||||
|
"textureLoadFailed": "无法将此图片加载为全景纹理。"
|
||||||
|
},
|
||||||
|
"multiImagesLoader": {
|
||||||
|
"add": "添加图像",
|
||||||
|
"replace": "替换图像 {n}",
|
||||||
|
"preview": "预览图像",
|
||||||
|
"delete": "删除图像",
|
||||||
|
"imageCount": "图片数量:{n}",
|
||||||
|
"clearAll": "清空所有"
|
||||||
|
},
|
||||||
|
"mediaSelector": {
|
||||||
|
"tabInputs": "输入",
|
||||||
|
"tabOutputs": "输出",
|
||||||
|
"tabHistory": "历史",
|
||||||
|
"tabLocal": "本地",
|
||||||
|
"tabUrl": "URL",
|
||||||
|
"searchPlaceholder": "搜索...",
|
||||||
|
"sort": "排序:{by}",
|
||||||
|
"filter": "多选",
|
||||||
|
"selectAll":"全选",
|
||||||
|
"confirm": "确定",
|
||||||
|
"sortName": "名称",
|
||||||
|
"sortDate": "日期",
|
||||||
|
"sortFolders": "文件夹优先",
|
||||||
|
"viewList": "列表视图",
|
||||||
|
"viewGrid": "网格视图",
|
||||||
|
"refresh": "刷新",
|
||||||
|
"localPathPlaceholder": "本地文件夹绝对路径...",
|
||||||
|
"urlHint": "粘贴媒体文件的 http(s) URL。",
|
||||||
|
"urlConfirm": "确认 URL",
|
||||||
|
"urlChecking": "检测中...",
|
||||||
|
"urlErrorTitle": "URL 错误",
|
||||||
|
"urlErrorNotFound": "未找到文件,或服务器拒绝访问。",
|
||||||
|
"empty": "未找到文件",
|
||||||
|
"error": "加载失败:{msg}",
|
||||||
|
"tabSlot": "插槽",
|
||||||
|
"slotNotConnected": "未连接输入",
|
||||||
|
"slotEmpty": "暂无内容",
|
||||||
|
"slotList": "列表",
|
||||||
|
"slotImage": "图像 {n}",
|
||||||
|
"slotAudio": "音频 {n}",
|
||||||
|
"slotVideo": "视频 {n}",
|
||||||
|
"addLocal": "添加本地文件"
|
||||||
|
}
|
||||||
|
}
|
||||||
54
frontend/package.json
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"name": "comfyui-easy-media",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"type": "module",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "bun run build.ts --watch",
|
||||||
|
"build": "bun run build.ts",
|
||||||
|
"build:release": "bun run build.ts --release",
|
||||||
|
"test": "vitest run",
|
||||||
|
"test:watch": "vitest"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@base-ui/react": "^1.6.0",
|
||||||
|
"@radix-ui/react-checkbox": "^1.3.11",
|
||||||
|
"@radix-ui/react-context-menu": "^2.2.16",
|
||||||
|
"@radix-ui/react-dialog": "^1.1.15",
|
||||||
|
"@radix-ui/react-popover": "^1.1.15",
|
||||||
|
"@radix-ui/react-select": "^2.2.6",
|
||||||
|
"@radix-ui/react-slider": "^1.3.6",
|
||||||
|
"@radix-ui/react-slot": "^1.2.4",
|
||||||
|
"@radix-ui/react-tabs": "^1.1.13",
|
||||||
|
"@radix-ui/react-tooltip": "^1.2.8",
|
||||||
|
"class-variance-authority": "^0.7.1",
|
||||||
|
"clsx": "^2.1.1",
|
||||||
|
"embla-carousel-react": "^8.6.0",
|
||||||
|
"framer-motion": "^12.42.2",
|
||||||
|
"lucide-react": "^1.21.0",
|
||||||
|
"react": "^19.1.0",
|
||||||
|
"react-dom": "^19.1.0",
|
||||||
|
"react-resizable-panels": "4.11.2",
|
||||||
|
"shadcn": "^4.7.0",
|
||||||
|
"tailwind-merge": "^3.3.0",
|
||||||
|
"three": "0.180.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@comfyorg/comfyui-frontend-types": "latest",
|
||||||
|
"@tailwindcss/cli": "^4.3.0",
|
||||||
|
"@tailwindcss/postcss": "^4.1.7",
|
||||||
|
"@testing-library/react": "^16.3.0",
|
||||||
|
"@types/react": "^19.1.4",
|
||||||
|
"@types/react-dom": "^19.1.2",
|
||||||
|
"@types/three": "0.180.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
||||||
|
"@typescript-eslint/parser": "^8.32.1",
|
||||||
|
"@vitejs/plugin-react": "^4.4.1",
|
||||||
|
"eslint": "^9.26.0",
|
||||||
|
"jsdom": "^26.1.0",
|
||||||
|
"tailwindcss": "^4.1.7",
|
||||||
|
"tw-animate-css": "^1.4.0",
|
||||||
|
"typescript": "^5.8.3",
|
||||||
|
"vitest": "^3.1.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
5
frontend/postcss.config.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export default {
|
||||||
|
plugins: {
|
||||||
|
"@tailwindcss/postcss": {},
|
||||||
|
},
|
||||||
|
};
|
||||||
34
frontend/src/components/ui/badge.tsx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import { cva, type VariantProps } from "class-variance-authority"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
const badgeVariants = cva(
|
||||||
|
"inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium transition-colors focus:outline-none focus:ring-1 focus:ring-ring",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
variant: {
|
||||||
|
default:
|
||||||
|
"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
|
||||||
|
secondary:
|
||||||
|
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
||||||
|
outline: "text-foreground",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
variant: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export interface BadgeProps
|
||||||
|
extends React.HTMLAttributes<HTMLDivElement>,
|
||||||
|
VariantProps<typeof badgeVariants> {}
|
||||||
|
|
||||||
|
function Badge({ className, variant, ...props }: BadgeProps) {
|
||||||
|
return (
|
||||||
|
<div className={cn(badgeVariants({ variant }), className)} {...props} />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Badge, badgeVariants }
|
||||||
57
frontend/src/components/ui/button.tsx
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import { Slot } from "@radix-ui/react-slot"
|
||||||
|
import { cva, type VariantProps } from "class-variance-authority"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
const buttonVariants = cva(
|
||||||
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
variant: {
|
||||||
|
default:
|
||||||
|
"bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
||||||
|
destructive:
|
||||||
|
"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
||||||
|
outline:
|
||||||
|
"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
||||||
|
secondary:
|
||||||
|
"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
||||||
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
||||||
|
link: "text-primary underline-offset-4 hover:underline",
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
default: "h-9 px-4 py-2",
|
||||||
|
sm: "h-8 rounded-md px-3 text-xs",
|
||||||
|
lg: "h-10 rounded-md px-8",
|
||||||
|
icon: "h-9 w-9",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
variant: "default",
|
||||||
|
size: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export interface ButtonProps
|
||||||
|
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
||||||
|
VariantProps<typeof buttonVariants> {
|
||||||
|
asChild?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
||||||
|
const Comp = asChild ? Slot : "button"
|
||||||
|
return (
|
||||||
|
<Comp
|
||||||
|
className={cn(buttonVariants({ variant, size, className }))}
|
||||||
|
ref={ref}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
Button.displayName = "Button"
|
||||||
|
|
||||||
|
export { Button, buttonVariants }
|
||||||
260
frontend/src/components/ui/carousel.tsx
Normal file
@ -0,0 +1,260 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import useEmblaCarousel, {
|
||||||
|
type UseEmblaCarouselType,
|
||||||
|
} from "embla-carousel-react"
|
||||||
|
import { ArrowLeft, ArrowRight } from "lucide-react"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
import { Button } from "@/components/ui/button"
|
||||||
|
|
||||||
|
type CarouselApi = UseEmblaCarouselType[1]
|
||||||
|
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
|
||||||
|
type CarouselOptions = UseCarouselParameters[0]
|
||||||
|
type CarouselPlugin = UseCarouselParameters[1]
|
||||||
|
|
||||||
|
type CarouselProps = {
|
||||||
|
opts?: CarouselOptions
|
||||||
|
plugins?: CarouselPlugin
|
||||||
|
orientation?: "horizontal" | "vertical"
|
||||||
|
setApi?: (api: CarouselApi) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
type CarouselContextProps = {
|
||||||
|
carouselRef: ReturnType<typeof useEmblaCarousel>[0]
|
||||||
|
api: ReturnType<typeof useEmblaCarousel>[1]
|
||||||
|
scrollPrev: () => void
|
||||||
|
scrollNext: () => void
|
||||||
|
canScrollPrev: boolean
|
||||||
|
canScrollNext: boolean
|
||||||
|
} & CarouselProps
|
||||||
|
|
||||||
|
const CarouselContext = React.createContext<CarouselContextProps | null>(null)
|
||||||
|
|
||||||
|
function useCarousel() {
|
||||||
|
const context = React.useContext(CarouselContext)
|
||||||
|
|
||||||
|
if (!context) {
|
||||||
|
throw new Error("useCarousel must be used within a <Carousel />")
|
||||||
|
}
|
||||||
|
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
const Carousel = React.forwardRef<
|
||||||
|
HTMLDivElement,
|
||||||
|
React.HTMLAttributes<HTMLDivElement> & CarouselProps
|
||||||
|
>(
|
||||||
|
(
|
||||||
|
{
|
||||||
|
orientation = "horizontal",
|
||||||
|
opts,
|
||||||
|
setApi,
|
||||||
|
plugins,
|
||||||
|
className,
|
||||||
|
children,
|
||||||
|
...props
|
||||||
|
},
|
||||||
|
ref
|
||||||
|
) => {
|
||||||
|
const [carouselRef, api] = useEmblaCarousel(
|
||||||
|
{
|
||||||
|
...opts,
|
||||||
|
axis: orientation === "horizontal" ? "x" : "y",
|
||||||
|
},
|
||||||
|
plugins
|
||||||
|
)
|
||||||
|
const [canScrollPrev, setCanScrollPrev] = React.useState(false)
|
||||||
|
const [canScrollNext, setCanScrollNext] = React.useState(false)
|
||||||
|
|
||||||
|
const onSelect = React.useCallback((api: CarouselApi) => {
|
||||||
|
if (!api) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
setCanScrollPrev(api.canScrollPrev())
|
||||||
|
setCanScrollNext(api.canScrollNext())
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const scrollPrev = React.useCallback(() => {
|
||||||
|
api?.scrollPrev()
|
||||||
|
}, [api])
|
||||||
|
|
||||||
|
const scrollNext = React.useCallback(() => {
|
||||||
|
api?.scrollNext()
|
||||||
|
}, [api])
|
||||||
|
|
||||||
|
const handleKeyDown = React.useCallback(
|
||||||
|
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
||||||
|
if (event.key === "ArrowLeft") {
|
||||||
|
event.preventDefault()
|
||||||
|
scrollPrev()
|
||||||
|
} else if (event.key === "ArrowRight") {
|
||||||
|
event.preventDefault()
|
||||||
|
scrollNext()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[scrollPrev, scrollNext]
|
||||||
|
)
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (!api || !setApi) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
setApi(api)
|
||||||
|
}, [api, setApi])
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (!api) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
onSelect(api)
|
||||||
|
api.on("reInit", onSelect)
|
||||||
|
api.on("select", onSelect)
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
api?.off("select", onSelect)
|
||||||
|
}
|
||||||
|
}, [api, onSelect])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<CarouselContext.Provider
|
||||||
|
value={{
|
||||||
|
carouselRef,
|
||||||
|
api: api,
|
||||||
|
opts,
|
||||||
|
orientation:
|
||||||
|
orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
||||||
|
scrollPrev,
|
||||||
|
scrollNext,
|
||||||
|
canScrollPrev,
|
||||||
|
canScrollNext,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
ref={ref}
|
||||||
|
onKeyDownCapture={handleKeyDown}
|
||||||
|
className={cn("relative", className)}
|
||||||
|
role="region"
|
||||||
|
aria-roledescription="carousel"
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</CarouselContext.Provider>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
Carousel.displayName = "Carousel"
|
||||||
|
|
||||||
|
const CarouselContent = React.forwardRef<
|
||||||
|
HTMLDivElement,
|
||||||
|
React.HTMLAttributes<HTMLDivElement>
|
||||||
|
>(({ className, ...props }, ref) => {
|
||||||
|
const { carouselRef, orientation } = useCarousel()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={carouselRef} className="overflow-hidden">
|
||||||
|
<div
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"flex",
|
||||||
|
orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
CarouselContent.displayName = "CarouselContent"
|
||||||
|
|
||||||
|
const CarouselItem = React.forwardRef<
|
||||||
|
HTMLDivElement,
|
||||||
|
React.HTMLAttributes<HTMLDivElement>
|
||||||
|
>(({ className, ...props }, ref) => {
|
||||||
|
const { orientation } = useCarousel()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
ref={ref}
|
||||||
|
role="group"
|
||||||
|
aria-roledescription="slide"
|
||||||
|
className={cn(
|
||||||
|
"min-w-0 shrink-0 grow-0 basis-full",
|
||||||
|
orientation === "horizontal" ? "pl-4" : "pt-4",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
CarouselItem.displayName = "CarouselItem"
|
||||||
|
|
||||||
|
const CarouselPrevious = React.forwardRef<
|
||||||
|
HTMLButtonElement,
|
||||||
|
React.ComponentProps<typeof Button>
|
||||||
|
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
||||||
|
const { orientation, scrollPrev, canScrollPrev } = useCarousel()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
ref={ref}
|
||||||
|
variant={variant}
|
||||||
|
size={size}
|
||||||
|
className={cn(
|
||||||
|
"absolute h-8 w-8 rounded-full",
|
||||||
|
orientation === "horizontal"
|
||||||
|
? "-left-12 top-1/2 -translate-y-1/2"
|
||||||
|
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
disabled={!canScrollPrev}
|
||||||
|
onClick={scrollPrev}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<ArrowLeft className="h-4 w-4" />
|
||||||
|
<span className="sr-only">Previous slide</span>
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
CarouselPrevious.displayName = "CarouselPrevious"
|
||||||
|
|
||||||
|
const CarouselNext = React.forwardRef<
|
||||||
|
HTMLButtonElement,
|
||||||
|
React.ComponentProps<typeof Button>
|
||||||
|
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
||||||
|
const { orientation, scrollNext, canScrollNext } = useCarousel()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
ref={ref}
|
||||||
|
variant={variant}
|
||||||
|
size={size}
|
||||||
|
className={cn(
|
||||||
|
"absolute h-8 w-8 rounded-full",
|
||||||
|
orientation === "horizontal"
|
||||||
|
? "-right-12 top-1/2 -translate-y-1/2"
|
||||||
|
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
disabled={!canScrollNext}
|
||||||
|
onClick={scrollNext}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<ArrowRight className="h-4 w-4" />
|
||||||
|
<span className="sr-only">Next slide</span>
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
CarouselNext.displayName = "CarouselNext"
|
||||||
|
|
||||||
|
export {
|
||||||
|
type CarouselApi,
|
||||||
|
Carousel,
|
||||||
|
CarouselContent,
|
||||||
|
CarouselItem,
|
||||||
|
CarouselPrevious,
|
||||||
|
CarouselNext,
|
||||||
|
}
|
||||||
28
frontend/src/components/ui/checkbox.tsx
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
||||||
|
import { Check } from "lucide-react"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
const Checkbox = React.forwardRef<
|
||||||
|
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<CheckboxPrimitive.Root
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<CheckboxPrimitive.Indicator
|
||||||
|
className={cn("grid place-content-center text-current")}
|
||||||
|
>
|
||||||
|
<Check className="h-4 w-4" />
|
||||||
|
</CheckboxPrimitive.Indicator>
|
||||||
|
</CheckboxPrimitive.Root>
|
||||||
|
))
|
||||||
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName
|
||||||
|
|
||||||
|
export { Checkbox }
|
||||||
1986
frontend/src/components/ui/color-picker.tsx
Normal file
206
frontend/src/components/ui/context-menu.tsx
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
|
||||||
|
import { Check, ChevronRight, Circle } from "lucide-react"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
import { CUSTOM_NODE_CLASS } from "@/lib/constants"
|
||||||
|
|
||||||
|
const ContextMenu = ContextMenuPrimitive.Root
|
||||||
|
|
||||||
|
const ContextMenuTrigger = ContextMenuPrimitive.Trigger
|
||||||
|
|
||||||
|
const ContextMenuGroup = ContextMenuPrimitive.Group
|
||||||
|
|
||||||
|
const ContextMenuPortal = ContextMenuPrimitive.Portal
|
||||||
|
|
||||||
|
const ContextMenuSub = ContextMenuPrimitive.Sub
|
||||||
|
|
||||||
|
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
|
||||||
|
|
||||||
|
const ContextMenuSubTrigger = React.forwardRef<
|
||||||
|
React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
|
||||||
|
inset?: boolean
|
||||||
|
}
|
||||||
|
>(({ className, inset, children, ...props }, ref) => (
|
||||||
|
<ContextMenuPrimitive.SubTrigger
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm text-popover-foreground outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
||||||
|
inset && "pl-8",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
<ChevronRight className="ml-auto h-4 w-4" />
|
||||||
|
</ContextMenuPrimitive.SubTrigger>
|
||||||
|
))
|
||||||
|
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
|
||||||
|
|
||||||
|
const ContextMenuSubContent = React.forwardRef<
|
||||||
|
React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<ContextMenuPrimitive.SubContent
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
|
||||||
|
|
||||||
|
const ContextMenuContent = React.forwardRef<
|
||||||
|
React.ElementRef<typeof ContextMenuPrimitive.Content>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<ContextMenuPrimitive.Portal>
|
||||||
|
<div className={`${CUSTOM_NODE_CLASS}`}>
|
||||||
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
|
data-easy-media-context-menu-backdrop=""
|
||||||
|
className="fixed inset-0 z-[9997]"
|
||||||
|
/>
|
||||||
|
<ContextMenuPrimitive.Content
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"z-[9999] max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</ContextMenuPrimitive.Portal>
|
||||||
|
))
|
||||||
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
|
||||||
|
|
||||||
|
const ContextMenuItem = React.forwardRef<
|
||||||
|
React.ElementRef<typeof ContextMenuPrimitive.Item>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
|
||||||
|
inset?: boolean
|
||||||
|
}
|
||||||
|
>(({ className, inset, ...props }, ref) => (
|
||||||
|
<ContextMenuPrimitive.Item
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
||||||
|
inset && "pl-8",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
|
||||||
|
|
||||||
|
const ContextMenuCheckboxItem = React.forwardRef<
|
||||||
|
React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
|
||||||
|
>(({ className, children, checked, ...props }, ref) => (
|
||||||
|
<ContextMenuPrimitive.CheckboxItem
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
checked={checked}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
||||||
|
<ContextMenuPrimitive.ItemIndicator>
|
||||||
|
<Check className="h-4 w-4" />
|
||||||
|
</ContextMenuPrimitive.ItemIndicator>
|
||||||
|
</span>
|
||||||
|
{children}
|
||||||
|
</ContextMenuPrimitive.CheckboxItem>
|
||||||
|
))
|
||||||
|
ContextMenuCheckboxItem.displayName =
|
||||||
|
ContextMenuPrimitive.CheckboxItem.displayName
|
||||||
|
|
||||||
|
const ContextMenuRadioItem = React.forwardRef<
|
||||||
|
React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
|
||||||
|
>(({ className, children, ...props }, ref) => (
|
||||||
|
<ContextMenuPrimitive.RadioItem
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
||||||
|
<ContextMenuPrimitive.ItemIndicator>
|
||||||
|
<Circle className="h-4 w-4 fill-current" />
|
||||||
|
</ContextMenuPrimitive.ItemIndicator>
|
||||||
|
</span>
|
||||||
|
{children}
|
||||||
|
</ContextMenuPrimitive.RadioItem>
|
||||||
|
))
|
||||||
|
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
|
||||||
|
|
||||||
|
const ContextMenuLabel = React.forwardRef<
|
||||||
|
React.ElementRef<typeof ContextMenuPrimitive.Label>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
|
||||||
|
inset?: boolean
|
||||||
|
}
|
||||||
|
>(({ className, inset, ...props }, ref) => (
|
||||||
|
<ContextMenuPrimitive.Label
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"px-2 py-1.5 text-sm font-semibold text-foreground",
|
||||||
|
inset && "pl-8",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
|
||||||
|
|
||||||
|
const ContextMenuSeparator = React.forwardRef<
|
||||||
|
React.ElementRef<typeof ContextMenuPrimitive.Separator>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<ContextMenuPrimitive.Separator
|
||||||
|
ref={ref}
|
||||||
|
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
|
||||||
|
|
||||||
|
const ContextMenuShortcut = ({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
"ml-auto text-xs tracking-widest text-muted-foreground",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
ContextMenuShortcut.displayName = "ContextMenuShortcut"
|
||||||
|
|
||||||
|
export {
|
||||||
|
ContextMenu,
|
||||||
|
ContextMenuTrigger,
|
||||||
|
ContextMenuContent,
|
||||||
|
ContextMenuItem,
|
||||||
|
ContextMenuCheckboxItem,
|
||||||
|
ContextMenuRadioItem,
|
||||||
|
ContextMenuLabel,
|
||||||
|
ContextMenuSeparator,
|
||||||
|
ContextMenuShortcut,
|
||||||
|
ContextMenuGroup,
|
||||||
|
ContextMenuPortal,
|
||||||
|
ContextMenuSub,
|
||||||
|
ContextMenuSubContent,
|
||||||
|
ContextMenuSubTrigger,
|
||||||
|
ContextMenuRadioGroup,
|
||||||
|
}
|
||||||
39
frontend/src/components/ui/custom-lucide-icon.tsx
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import { createLucideIcon } from "lucide-react";
|
||||||
|
|
||||||
|
export const SplitCenterIcon = createLucideIcon("SplitCenterIcon", [
|
||||||
|
["path", { d: "M5 4h4v16H5", key: "left-bracket" }],
|
||||||
|
["path", { d: "M19 4h-4v16h4", key: "right-bracket" }],
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const SplitLeftDotsIcon = createLucideIcon("SplitLeftDotsIcon", [
|
||||||
|
["path", { d: "M20 4h-4v16h4", key: "bracket" }],
|
||||||
|
|
||||||
|
["path", { d: "M6 4h.01", key: "d1" }],
|
||||||
|
["path", { d: "M6 20h.01", key: "d3" }],
|
||||||
|
|
||||||
|
["path", { d: "M11 4h.01", key: "d4" }],
|
||||||
|
["path", { d: "M11 8h.01", key: "d5" }],
|
||||||
|
["path", { d: "M11 12h.01", key: "d6" }],
|
||||||
|
["path", { d: "M11 16h.01", key: "d7" }],
|
||||||
|
["path", { d: "M11 20h.01", key: "d8" }],
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const SplitRightDotsIcon = createLucideIcon("SplitRightDotsIcon", [
|
||||||
|
["path", { d: "M4 4h4v16H4", key: "bracket" }],
|
||||||
|
|
||||||
|
["path", { d: "M13 4h.01", key: "d1" }],
|
||||||
|
["path", { d: "M13 8h.01", key: "d2" }],
|
||||||
|
["path", { d: "M13 12h.01", key: "d3" }],
|
||||||
|
["path", { d: "M13 16h.01", key: "d4" }],
|
||||||
|
["path", { d: "M13 20h.01", key: "d5" }],
|
||||||
|
|
||||||
|
["path", { d: "M18 4h.01", key: "d6" }],
|
||||||
|
["path", { d: "M18 20h.01", key: "d8" }],
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const TaskMarkerIcon = createLucideIcon("TaskMarkerIcon", [
|
||||||
|
["path", {
|
||||||
|
d: "M7.5 4.75h9a1 1 0 0 1 1 1v8.5L12 20l-5.5-5.75V5.75a1 1 0 0 1 1-1Z",
|
||||||
|
key: "task-marker",
|
||||||
|
}],
|
||||||
|
]);
|
||||||
123
frontend/src/components/ui/dialog.tsx
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
||||||
|
import { X } from "lucide-react"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
import { CUSTOM_NODE_CLASS } from "@/lib/constants"
|
||||||
|
|
||||||
|
const Dialog = DialogPrimitive.Root
|
||||||
|
|
||||||
|
const DialogTrigger = DialogPrimitive.Trigger
|
||||||
|
|
||||||
|
const DialogPortal = DialogPrimitive.Portal
|
||||||
|
|
||||||
|
const DialogClose = DialogPrimitive.Close
|
||||||
|
|
||||||
|
const DialogOverlay = React.forwardRef<
|
||||||
|
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<DialogPrimitive.Overlay
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
|
||||||
|
|
||||||
|
const DialogContent = React.forwardRef<
|
||||||
|
React.ElementRef<typeof DialogPrimitive.Content>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
||||||
|
>(({ className, children, ...props }, ref) => (
|
||||||
|
<DialogPortal>
|
||||||
|
<div className={`${CUSTOM_NODE_CLASS}`}>
|
||||||
|
<DialogOverlay />
|
||||||
|
<DialogPrimitive.Content
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
||||||
|
<X className="h-4 w-4" />
|
||||||
|
<span className="sr-only">Close</span>
|
||||||
|
</DialogPrimitive.Close>
|
||||||
|
</DialogPrimitive.Content>
|
||||||
|
</div>
|
||||||
|
</DialogPortal>
|
||||||
|
))
|
||||||
|
DialogContent.displayName = DialogPrimitive.Content.displayName
|
||||||
|
|
||||||
|
const DialogHeader = ({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.HTMLAttributes<HTMLDivElement>) => (
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
"flex flex-col space-y-1.5 text-center sm:text-left",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
DialogHeader.displayName = "DialogHeader"
|
||||||
|
|
||||||
|
const DialogFooter = ({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.HTMLAttributes<HTMLDivElement>) => (
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
DialogFooter.displayName = "DialogFooter"
|
||||||
|
|
||||||
|
const DialogTitle = React.forwardRef<
|
||||||
|
React.ElementRef<typeof DialogPrimitive.Title>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<DialogPrimitive.Title
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"text-lg font-semibold leading-none tracking-tight",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
DialogTitle.displayName = DialogPrimitive.Title.displayName
|
||||||
|
|
||||||
|
const DialogDescription = React.forwardRef<
|
||||||
|
React.ElementRef<typeof DialogPrimitive.Description>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<DialogPrimitive.Description
|
||||||
|
ref={ref}
|
||||||
|
className={cn("text-sm text-muted-foreground", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
DialogDescription.displayName = DialogPrimitive.Description.displayName
|
||||||
|
|
||||||
|
export {
|
||||||
|
Dialog,
|
||||||
|
DialogPortal,
|
||||||
|
DialogOverlay,
|
||||||
|
DialogTrigger,
|
||||||
|
DialogClose,
|
||||||
|
DialogContent,
|
||||||
|
DialogHeader,
|
||||||
|
DialogFooter,
|
||||||
|
DialogTitle,
|
||||||
|
DialogDescription,
|
||||||
|
}
|
||||||
22
frontend/src/components/ui/input.tsx
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
|
||||||
|
({ className, type, ...props }, ref) => {
|
||||||
|
return (
|
||||||
|
<input
|
||||||
|
type={type}
|
||||||
|
className={cn(
|
||||||
|
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
ref={ref}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
Input.displayName = "Input"
|
||||||
|
|
||||||
|
export { Input }
|
||||||
186
frontend/src/components/ui/number-input.tsx
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import * as React from "react"
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
import { ChevronUp, ChevronDown } from "lucide-react"
|
||||||
|
|
||||||
|
interface NumberInputProps {
|
||||||
|
value: number
|
||||||
|
onChange: (value: number) => void
|
||||||
|
min?: number
|
||||||
|
max?: number
|
||||||
|
step?: number
|
||||||
|
className?: string
|
||||||
|
disabled?: boolean
|
||||||
|
commitOnBlur?: boolean
|
||||||
|
formatValue?: (value: number) => string
|
||||||
|
"aria-label"?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export function NumberInput({
|
||||||
|
value,
|
||||||
|
onChange,
|
||||||
|
min = 0,
|
||||||
|
max = Infinity,
|
||||||
|
step = 1,
|
||||||
|
className,
|
||||||
|
disabled,
|
||||||
|
commitOnBlur = false,
|
||||||
|
formatValue,
|
||||||
|
"aria-label": ariaLabel,
|
||||||
|
}: NumberInputProps) {
|
||||||
|
const inputRef = React.useRef<HTMLInputElement>(null)
|
||||||
|
const blurOnEnterRef = React.useRef(false)
|
||||||
|
const [draftValue, setDraftValue] = React.useState<string>(String(value))
|
||||||
|
|
||||||
|
// Sync draftValue when value prop changes (for parent updates)
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (!commitOnBlur) return
|
||||||
|
setDraftValue(String(value))
|
||||||
|
}, [value, commitOnBlur])
|
||||||
|
|
||||||
|
const clamp = React.useCallback(
|
||||||
|
(val: number): number => {
|
||||||
|
return Math.min(max, Math.max(min, val))
|
||||||
|
},
|
||||||
|
[min, max]
|
||||||
|
)
|
||||||
|
|
||||||
|
const parseAndCommit = React.useCallback(
|
||||||
|
(rawValue: string) => {
|
||||||
|
if (rawValue === "") {
|
||||||
|
onChange(clamp(0))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const parsed = Number.parseFloat(rawValue)
|
||||||
|
if (!Number.isNaN(parsed)) {
|
||||||
|
onChange(clamp(parsed))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[onChange, clamp]
|
||||||
|
)
|
||||||
|
|
||||||
|
const handleIncrement = React.useCallback(() => {
|
||||||
|
// Buttons always commit immediately
|
||||||
|
const newValue = Math.min(max, value + step)
|
||||||
|
onChange(newValue)
|
||||||
|
if (commitOnBlur) {
|
||||||
|
setDraftValue(String(newValue))
|
||||||
|
}
|
||||||
|
}, [commitOnBlur, value, step, max, onChange])
|
||||||
|
|
||||||
|
const handleDecrement = React.useCallback(() => {
|
||||||
|
// Buttons always commit immediately
|
||||||
|
const newValue = Math.max(min, value - step)
|
||||||
|
onChange(newValue)
|
||||||
|
if (commitOnBlur) {
|
||||||
|
setDraftValue(String(newValue))
|
||||||
|
}
|
||||||
|
}, [commitOnBlur, value, step, min, onChange])
|
||||||
|
|
||||||
|
const handleInputChange = React.useCallback(
|
||||||
|
(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const rawValue = e.currentTarget.value
|
||||||
|
if (commitOnBlur) {
|
||||||
|
setDraftValue(rawValue)
|
||||||
|
} else {
|
||||||
|
if (rawValue === "") {
|
||||||
|
onChange(0)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const parsed = Number.parseFloat(rawValue)
|
||||||
|
if (!Number.isNaN(parsed)) {
|
||||||
|
onChange(clamp(parsed))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[commitOnBlur, onChange, clamp]
|
||||||
|
)
|
||||||
|
|
||||||
|
const handleBlur = React.useCallback(() => {
|
||||||
|
if (commitOnBlur && !blurOnEnterRef.current) {
|
||||||
|
parseAndCommit(draftValue)
|
||||||
|
setDraftValue(String(value))
|
||||||
|
}
|
||||||
|
blurOnEnterRef.current = false
|
||||||
|
}, [commitOnBlur, parseAndCommit, draftValue, value])
|
||||||
|
|
||||||
|
const handleKeyDown = React.useCallback(
|
||||||
|
(e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
|
if (e.key === "ArrowUp") {
|
||||||
|
e.preventDefault()
|
||||||
|
// Arrow keys always commit immediately
|
||||||
|
const newValue = Math.min(max, value + step)
|
||||||
|
onChange(newValue)
|
||||||
|
if (commitOnBlur) {
|
||||||
|
setDraftValue(String(newValue))
|
||||||
|
}
|
||||||
|
} else if (e.key === "ArrowDown") {
|
||||||
|
e.preventDefault()
|
||||||
|
// Arrow keys always commit immediately
|
||||||
|
const newValue = Math.max(min, value - step)
|
||||||
|
onChange(newValue)
|
||||||
|
if (commitOnBlur) {
|
||||||
|
setDraftValue(String(newValue))
|
||||||
|
}
|
||||||
|
} else if (commitOnBlur && e.key === "Enter") {
|
||||||
|
e.preventDefault()
|
||||||
|
blurOnEnterRef.current = true
|
||||||
|
parseAndCommit(draftValue)
|
||||||
|
inputRef.current?.blur()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[commitOnBlur, value, step, min, max, onChange, parseAndCommit, draftValue]
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
"flex h-7 items-center rounded-md border border-node-input-border bg-node-input overflow-hidden",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
value={commitOnBlur ? draftValue : formatValue?.(value) ?? value}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
|
onBlur={handleBlur}
|
||||||
|
ref={inputRef}
|
||||||
|
min={min}
|
||||||
|
max={max}
|
||||||
|
step={step}
|
||||||
|
disabled={disabled}
|
||||||
|
aria-label={ariaLabel}
|
||||||
|
className={cn(
|
||||||
|
"w-14 h-full flex-1 bg-muted text-node-foreground text-xs text-center border-0 focus:outline-none focus:ring-0 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<div className="flex flex-col h-full border-l ">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={handleIncrement}
|
||||||
|
disabled={disabled || value >= max}
|
||||||
|
aria-label="Increment"
|
||||||
|
className={cn(
|
||||||
|
"flex-1 flex items-center justify-center px-1 hover:bg-card cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed bg-muted"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<ChevronUp className="size-3 text-node-foreground" />
|
||||||
|
</button>
|
||||||
|
<div className="h-px bg-border" />
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={handleDecrement}
|
||||||
|
disabled={disabled || value <= min}
|
||||||
|
aria-label="Decrement"
|
||||||
|
className={cn(
|
||||||
|
"flex-1 flex items-center justify-center px-1 hover:bg-card cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed bg-muted"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<ChevronDown className="size-3 text-node-foreground" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
34
frontend/src/components/ui/popover.tsx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import * as PopoverPrimitive from "@radix-ui/react-popover"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
import { CUSTOM_NODE_CLASS } from "@/lib/constants"
|
||||||
|
|
||||||
|
const Popover = PopoverPrimitive.Root
|
||||||
|
|
||||||
|
const PopoverTrigger = PopoverPrimitive.Trigger
|
||||||
|
|
||||||
|
const PopoverAnchor = PopoverPrimitive.Anchor
|
||||||
|
|
||||||
|
const PopoverContent = React.forwardRef<
|
||||||
|
React.ElementRef<typeof PopoverPrimitive.Content>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
|
||||||
|
>(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
|
||||||
|
<PopoverPrimitive.Portal>
|
||||||
|
<div className={`${CUSTOM_NODE_CLASS}`}>
|
||||||
|
<PopoverPrimitive.Content
|
||||||
|
ref={ref}
|
||||||
|
align={align}
|
||||||
|
sideOffset={sideOffset}
|
||||||
|
className={cn(
|
||||||
|
"z-[9999] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</PopoverPrimitive.Portal>
|
||||||
|
))
|
||||||
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName
|
||||||
|
|
||||||
|
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }
|
||||||
58
frontend/src/components/ui/resizable.tsx
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
import { GripVerticalIcon } from 'lucide-react'
|
||||||
|
import * as ResizablePrimitive from 'react-resizable-panels'
|
||||||
|
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
|
function ResizablePanelGroup({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: ResizablePrimitive.GroupProps) {
|
||||||
|
return (
|
||||||
|
<ResizablePrimitive.Group
|
||||||
|
data-slot="resizable-panel-group"
|
||||||
|
className={cn('flex h-full w-full aria-[orientation=vertical]:flex-col', className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ResizablePanel(props: ResizablePrimitive.PanelProps) {
|
||||||
|
return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
|
||||||
|
}
|
||||||
|
|
||||||
|
type ResizablePanelGroupHandle = ResizablePrimitive.GroupImperativeHandle
|
||||||
|
|
||||||
|
function ResizableHandle({
|
||||||
|
withHandle,
|
||||||
|
className,
|
||||||
|
onPointerDown,
|
||||||
|
...props
|
||||||
|
}: ResizablePrimitive.SeparatorProps & { withHandle?: boolean }) {
|
||||||
|
return (
|
||||||
|
<ResizablePrimitive.Separator
|
||||||
|
data-slot="resizable-handle"
|
||||||
|
className={cn(
|
||||||
|
'relative flex w-px touch-none items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-2 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 aria-[orientation=vertical]:cursor-col-resize aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:cursor-row-resize aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-2 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90',
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
onPointerDown={(event) => {
|
||||||
|
event.stopPropagation()
|
||||||
|
onPointerDown?.(event)
|
||||||
|
}}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{withHandle ? (
|
||||||
|
<div className="z-10 flex h-7 w-3 items-center justify-center rounded-sm border border-border bg-background shadow-sm">
|
||||||
|
<GripVerticalIcon className="size-2.5 text-muted-foreground" />
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
</ResizablePrimitive.Separator>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
ResizableHandle,
|
||||||
|
ResizablePanel,
|
||||||
|
ResizablePanelGroup,
|
||||||
|
type ResizablePanelGroupHandle,
|
||||||
|
}
|
||||||
211
frontend/src/components/ui/select.tsx
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import * as SelectPrimitive from "@radix-ui/react-select"
|
||||||
|
import { Check, ChevronDown, ChevronUp } from "lucide-react"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
import { CUSTOM_NODE_CLASS } from "@/lib/constants"
|
||||||
|
|
||||||
|
interface SelectOverlayContextValue {
|
||||||
|
open: boolean
|
||||||
|
close: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const SelectOverlayContext = React.createContext<SelectOverlayContextValue>({
|
||||||
|
open: false,
|
||||||
|
close: () => {},
|
||||||
|
})
|
||||||
|
|
||||||
|
const Select = ({
|
||||||
|
open: controlledOpen,
|
||||||
|
defaultOpen = false,
|
||||||
|
onOpenChange,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof SelectPrimitive.Root>) => {
|
||||||
|
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen)
|
||||||
|
const open = controlledOpen ?? uncontrolledOpen
|
||||||
|
|
||||||
|
const handleOpenChange = React.useCallback((nextOpen: boolean) => {
|
||||||
|
if (controlledOpen === undefined) setUncontrolledOpen(nextOpen)
|
||||||
|
onOpenChange?.(nextOpen)
|
||||||
|
}, [controlledOpen, onOpenChange])
|
||||||
|
|
||||||
|
const overlayContext = React.useMemo<SelectOverlayContextValue>(() => ({
|
||||||
|
open,
|
||||||
|
close: () => handleOpenChange(false),
|
||||||
|
}), [handleOpenChange, open])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SelectOverlayContext.Provider value={overlayContext}>
|
||||||
|
<SelectPrimitive.Root
|
||||||
|
{...props}
|
||||||
|
open={open}
|
||||||
|
onOpenChange={handleOpenChange}
|
||||||
|
/>
|
||||||
|
</SelectOverlayContext.Provider>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Select.displayName = SelectPrimitive.Root.displayName
|
||||||
|
|
||||||
|
const SelectGroup = SelectPrimitive.Group
|
||||||
|
|
||||||
|
const SelectValue = SelectPrimitive.Value
|
||||||
|
|
||||||
|
const SelectTrigger = React.forwardRef<
|
||||||
|
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
||||||
|
>(({ className, children, ...props }, ref) => (
|
||||||
|
<SelectPrimitive.Trigger
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-border bg-muted pl-2 py-2 text-sm text-foreground shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
<SelectPrimitive.Icon asChild>
|
||||||
|
<ChevronDown className="h-4 w-4 opacity-50" />
|
||||||
|
</SelectPrimitive.Icon>
|
||||||
|
</SelectPrimitive.Trigger>
|
||||||
|
))
|
||||||
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
|
||||||
|
|
||||||
|
const SelectScrollUpButton = React.forwardRef<
|
||||||
|
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<SelectPrimitive.ScrollUpButton
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"flex cursor-default items-center justify-center py-1",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<ChevronUp className="h-4 w-4" />
|
||||||
|
</SelectPrimitive.ScrollUpButton>
|
||||||
|
))
|
||||||
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
|
||||||
|
|
||||||
|
const SelectScrollDownButton = React.forwardRef<
|
||||||
|
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<SelectPrimitive.ScrollDownButton
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"flex cursor-default items-center justify-center py-1",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<ChevronDown className="h-4 w-4" />
|
||||||
|
</SelectPrimitive.ScrollDownButton>
|
||||||
|
))
|
||||||
|
SelectScrollDownButton.displayName =
|
||||||
|
SelectPrimitive.ScrollDownButton.displayName
|
||||||
|
|
||||||
|
const SelectContent = React.forwardRef<
|
||||||
|
React.ElementRef<typeof SelectPrimitive.Content>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
||||||
|
>(({ className, children, position = "popper", ...props }, ref) => {
|
||||||
|
const overlayContext = React.useContext(SelectOverlayContext)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SelectPrimitive.Portal>
|
||||||
|
<div className={`${CUSTOM_NODE_CLASS}`}>
|
||||||
|
{overlayContext.open ? (
|
||||||
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
|
data-easy-media-select-backdrop=""
|
||||||
|
className="fixed inset-0 z-[9997]"
|
||||||
|
onPointerDown={overlayContext.close}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
<SelectPrimitive.Content
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"relative z-[9999] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",
|
||||||
|
position === "popper" &&
|
||||||
|
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
position={position}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<SelectScrollUpButton />
|
||||||
|
<SelectPrimitive.Viewport
|
||||||
|
className={cn(
|
||||||
|
"p-1",
|
||||||
|
position === "popper" &&
|
||||||
|
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</SelectPrimitive.Viewport>
|
||||||
|
<SelectScrollDownButton />
|
||||||
|
</SelectPrimitive.Content>
|
||||||
|
</div>
|
||||||
|
</SelectPrimitive.Portal>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
SelectContent.displayName = SelectPrimitive.Content.displayName
|
||||||
|
|
||||||
|
const SelectLabel = React.forwardRef<
|
||||||
|
React.ElementRef<typeof SelectPrimitive.Label>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<SelectPrimitive.Label
|
||||||
|
ref={ref}
|
||||||
|
className={cn("px-2 py-1.5 text-sm font-semibold", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
SelectLabel.displayName = SelectPrimitive.Label.displayName
|
||||||
|
|
||||||
|
const SelectItem = React.forwardRef<
|
||||||
|
React.ElementRef<typeof SelectPrimitive.Item>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
||||||
|
>(({ className, children, ...props }, ref) => (
|
||||||
|
<SelectPrimitive.Item
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
||||||
|
<SelectPrimitive.ItemIndicator>
|
||||||
|
<Check className="h-4 w-4" />
|
||||||
|
</SelectPrimitive.ItemIndicator>
|
||||||
|
</span>
|
||||||
|
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
||||||
|
</SelectPrimitive.Item>
|
||||||
|
))
|
||||||
|
SelectItem.displayName = SelectPrimitive.Item.displayName
|
||||||
|
|
||||||
|
const SelectSeparator = React.forwardRef<
|
||||||
|
React.ElementRef<typeof SelectPrimitive.Separator>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<SelectPrimitive.Separator
|
||||||
|
ref={ref}
|
||||||
|
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
|
||||||
|
|
||||||
|
export {
|
||||||
|
Select,
|
||||||
|
SelectGroup,
|
||||||
|
SelectValue,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectContent,
|
||||||
|
SelectLabel,
|
||||||
|
SelectItem,
|
||||||
|
SelectSeparator,
|
||||||
|
SelectScrollUpButton,
|
||||||
|
SelectScrollDownButton,
|
||||||
|
}
|
||||||
15
frontend/src/components/ui/skeleton.tsx
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
function Skeleton({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.HTMLAttributes<HTMLDivElement>) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={cn("animate-pulse rounded-md bg-primary/10", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Skeleton }
|
||||||
70
frontend/src/components/ui/slider.tsx
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import * as SliderPrimitive from "@radix-ui/react-slider"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
export interface SliderTick {
|
||||||
|
value: number
|
||||||
|
label: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const Slider = React.forwardRef<
|
||||||
|
React.ElementRef<typeof SliderPrimitive.Root>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> & {
|
||||||
|
ticks?: SliderTick[]
|
||||||
|
}
|
||||||
|
>(({ className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ticks, ...props }, ref) => {
|
||||||
|
const value = props.value?.[0] ?? props.defaultValue?.[0]
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={cn("relative", ticks && ticks.length > 0 && "pb-4")}>
|
||||||
|
<SliderPrimitive.Root
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"relative flex w-full touch-none select-none items-center",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
aria-label={ariaLabel}
|
||||||
|
aria-labelledby={ariaLabelledBy}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<SliderPrimitive.Track className="relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted">
|
||||||
|
<SliderPrimitive.Range className="absolute h-full bg-primary" />
|
||||||
|
</SliderPrimitive.Track>
|
||||||
|
<SliderPrimitive.Thumb
|
||||||
|
aria-label={ariaLabel}
|
||||||
|
aria-labelledby={ariaLabelledBy}
|
||||||
|
className="block h-3 w-3 rounded-full border border-primary/50 bg-primary shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"
|
||||||
|
/>
|
||||||
|
{ticks && ticks.length > 0 && (
|
||||||
|
<div className="absolute left-0 top-full flex w-full justify-between">
|
||||||
|
{ticks.map((tick) => {
|
||||||
|
const isActive = tick.value === value
|
||||||
|
return (
|
||||||
|
<div key={tick.value} className="flex flex-col items-center gap-0.5">
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
"h-1.5 w-px bg-muted-foreground/40",
|
||||||
|
isActive && "bg-primary"
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
"text-[10px] tabular-nums leading-none text-muted-foreground",
|
||||||
|
isActive && "font-medium text-foreground"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{tick.label}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</SliderPrimitive.Root>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
Slider.displayName = SliderPrimitive.Root.displayName
|
||||||
|
|
||||||
|
export { Slider }
|
||||||
53
frontend/src/components/ui/tabs.tsx
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import * as TabsPrimitive from "@radix-ui/react-tabs"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
const Tabs = TabsPrimitive.Root
|
||||||
|
|
||||||
|
const TabsList = React.forwardRef<
|
||||||
|
React.ElementRef<typeof TabsPrimitive.List>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<TabsPrimitive.List
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"inline-flex h-9 items-center justify-center rounded-lg border bg-muted p-1 text-muted-foreground",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
TabsList.displayName = TabsPrimitive.List.displayName
|
||||||
|
|
||||||
|
const TabsTrigger = React.forwardRef<
|
||||||
|
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<TabsPrimitive.Trigger
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
|
||||||
|
|
||||||
|
const TabsContent = React.forwardRef<
|
||||||
|
React.ElementRef<typeof TabsPrimitive.Content>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
|
<TabsPrimitive.Content
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
TabsContent.displayName = TabsPrimitive.Content.displayName
|
||||||
|
|
||||||
|
export { Tabs, TabsList, TabsTrigger, TabsContent }
|
||||||
21
frontend/src/components/ui/textarea.tsx
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
const Textarea = React.forwardRef<
|
||||||
|
HTMLTextAreaElement,
|
||||||
|
React.ComponentProps<"textarea">
|
||||||
|
>(({ className, ...props }, ref) => {
|
||||||
|
return (
|
||||||
|
<textarea
|
||||||
|
className={cn(
|
||||||
|
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 resize-none",
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
ref={ref}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
Textarea.displayName = "Textarea"
|
||||||
|
|
||||||
|
export { Textarea }
|
||||||
42
frontend/src/components/ui/tooltip.tsx
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
import { CUSTOM_NODE_CLASS } from "@/lib/constants"
|
||||||
|
|
||||||
|
const TooltipProvider = ({
|
||||||
|
disableHoverableContent = true,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) => (
|
||||||
|
<TooltipPrimitive.Provider
|
||||||
|
disableHoverableContent={disableHoverableContent}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
TooltipProvider.displayName = TooltipPrimitive.Provider.displayName
|
||||||
|
|
||||||
|
const Tooltip = TooltipPrimitive.Root
|
||||||
|
|
||||||
|
const TooltipTrigger = TooltipPrimitive.Trigger
|
||||||
|
|
||||||
|
const TooltipContent = React.forwardRef<
|
||||||
|
React.ElementRef<typeof TooltipPrimitive.Content>,
|
||||||
|
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
||||||
|
>(({ className, sideOffset = 4, ...props }, ref) => (
|
||||||
|
<TooltipPrimitive.Portal>
|
||||||
|
<div className={`${CUSTOM_NODE_CLASS}`}>
|
||||||
|
<TooltipPrimitive.Content
|
||||||
|
ref={ref}
|
||||||
|
sideOffset={sideOffset}
|
||||||
|
className={cn(
|
||||||
|
"z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</TooltipPrimitive.Portal>
|
||||||
|
))
|
||||||
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName
|
||||||
|
|
||||||
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
||||||
240
frontend/src/components/widgets/MultiImagesLoaderWidget.tsx
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
import { useRef, useState } from 'react'
|
||||||
|
import { ArrowLeft, CloudUpload, Eye, Plus, Trash2 } from 'lucide-react'
|
||||||
|
import { Button } from '@/components/ui/button'
|
||||||
|
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
|
||||||
|
import { MediaSelector, type MediaTab } from '@/components/widgets/mediaSelector/MediaSelector'
|
||||||
|
import { useCanvasScale } from '@/hooks/use-canvas-scale'
|
||||||
|
import { useExpandedImagePreview } from '@/hooks/use-expanded-image-preview'
|
||||||
|
import type { ReactWidgetProps } from '@/lib/create-react-widget'
|
||||||
|
import { LocaleContext, useT } from '@/lib/i18n'
|
||||||
|
import { mediaContentToViewUrl } from '@/lib/media-url'
|
||||||
|
import { createTaskImage, splitSelectedTaskMedia, uploadTaskImageFile } from '@/lib/task-image-utils'
|
||||||
|
import { invalidateMediaListCache } from '@/stores/media-list-store'
|
||||||
|
import type { MultiTrackSourceType, MultiTrackTaskImage } from '@/types/multitrack'
|
||||||
|
|
||||||
|
export interface ImageData { images: MultiTrackTaskImage[] }
|
||||||
|
|
||||||
|
const MAX_IMAGES = 25
|
||||||
|
|
||||||
|
function selectorTab(image?: MultiTrackTaskImage): MediaTab {
|
||||||
|
if (image?.source_type === 'output') return 'outputs'
|
||||||
|
if (image?.source_type === 'local') return 'local'
|
||||||
|
if (image?.source_type === 'url') return 'url'
|
||||||
|
return 'inputs'
|
||||||
|
}
|
||||||
|
|
||||||
|
function sourceType(path: string, source?: 'input' | 'output' | 'local'): MultiTrackSourceType {
|
||||||
|
if (source) return source
|
||||||
|
return /^https?:\/\//i.test(path) ? 'url' : 'input'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function MultiImagesLoaderWidget({ value, onChange, app }: Readonly<ReactWidgetProps<ImageData>>) {
|
||||||
|
const locale = app?.ui?.settings?.settingsValues?.['Comfy.Locale']
|
||||||
|
const data: ImageData = value && Array.isArray(value.images) ? value : { images: [] }
|
||||||
|
const images = data.images.slice(0, MAX_IMAGES)
|
||||||
|
const [selectorOpen, setSelectorOpen] = useState(false)
|
||||||
|
const [replaceId, setReplaceId] = useState<string | null>(null)
|
||||||
|
const [preview, setPreview] = useState<MultiTrackTaskImage | null>(null)
|
||||||
|
const [dragOver, setDragOver] = useState(false)
|
||||||
|
const dragId = useRef<string | null>(null)
|
||||||
|
const scale = useCanvasScale(app)
|
||||||
|
const isNodeV2 = Boolean(app?.ui?.settings?.settingsValues?.['Comfy.VueNodes.Enabled'])
|
||||||
|
const activeImage = images.find((image) => image.id === replaceId)
|
||||||
|
const columns = Math.min(5, Math.max(1, Math.ceil(Math.sqrt(images.length + (images.length < MAX_IMAGES ? 1 : 0)))))
|
||||||
|
const controlSize = Math.min(32, Math.max(22, 26 / Math.max(scale, 0.5)))
|
||||||
|
|
||||||
|
function commit(next: MultiTrackTaskImage[]) {
|
||||||
|
onChange({ images: next.slice(0, MAX_IMAGES) })
|
||||||
|
}
|
||||||
|
|
||||||
|
function select(path: string, source?: 'input' | 'output' | 'local') {
|
||||||
|
const selected = splitSelectedTaskMedia(path).slice(0, replaceId ? 1 : MAX_IMAGES - images.length)
|
||||||
|
if (!selected.length) return
|
||||||
|
const incoming = selected.map((item) => createTaskImage(item, sourceType(item, source)))
|
||||||
|
commit(replaceId
|
||||||
|
? images.map((image) => image.id === replaceId ? { ...incoming[0], id: replaceId } : image)
|
||||||
|
: [...images, ...incoming])
|
||||||
|
setReplaceId(null)
|
||||||
|
setSelectorOpen(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function dropFiles(files: FileList | null) {
|
||||||
|
if (!files?.length) return
|
||||||
|
const selected = Array.from(files).filter((file) => file.type.startsWith('image/')).slice(0, MAX_IMAGES - images.length)
|
||||||
|
const results = await Promise.allSettled(selected.map(uploadTaskImageFile))
|
||||||
|
const uploaded: MultiTrackTaskImage[] = []
|
||||||
|
for (const result of results) {
|
||||||
|
if (result.status === 'fulfilled') uploaded.push(result.value)
|
||||||
|
else console.error('[MultiImagesLoaderWidget] image upload failed:', result.reason)
|
||||||
|
}
|
||||||
|
if (uploaded.length) {
|
||||||
|
invalidateMediaListCache('inputs')
|
||||||
|
commit([...images, ...uploaded])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LocaleContext.Provider value={locale}>
|
||||||
|
<MultiImagesLoaderContent
|
||||||
|
images={images}
|
||||||
|
columns={columns}
|
||||||
|
controlSize={controlSize}
|
||||||
|
isNodeV2={isNodeV2}
|
||||||
|
selectorOpen={selectorOpen}
|
||||||
|
setSelectorOpen={setSelectorOpen}
|
||||||
|
replaceId={replaceId}
|
||||||
|
setReplaceId={setReplaceId}
|
||||||
|
activeImage={activeImage}
|
||||||
|
preview={preview}
|
||||||
|
setPreview={setPreview}
|
||||||
|
dragOver={dragOver}
|
||||||
|
setDragOver={setDragOver}
|
||||||
|
dragId={dragId}
|
||||||
|
commit={commit}
|
||||||
|
select={select}
|
||||||
|
dropFiles={dropFiles}
|
||||||
|
/>
|
||||||
|
</LocaleContext.Provider>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ContentProps {
|
||||||
|
images: MultiTrackTaskImage[]
|
||||||
|
columns: number
|
||||||
|
controlSize: number
|
||||||
|
isNodeV2: boolean
|
||||||
|
selectorOpen: boolean
|
||||||
|
setSelectorOpen: (open: boolean) => void
|
||||||
|
replaceId: string | null
|
||||||
|
setReplaceId: (id: string | null) => void
|
||||||
|
activeImage?: MultiTrackTaskImage
|
||||||
|
preview: MultiTrackTaskImage | null
|
||||||
|
setPreview: (image: MultiTrackTaskImage | null) => void
|
||||||
|
dragOver: boolean
|
||||||
|
setDragOver: (over: boolean) => void
|
||||||
|
dragId: React.RefObject<string | null>
|
||||||
|
commit: (images: MultiTrackTaskImage[]) => void
|
||||||
|
select: (path: string, source?: 'input' | 'output' | 'local') => void
|
||||||
|
dropFiles: (files: FileList | null) => Promise<void>
|
||||||
|
}
|
||||||
|
|
||||||
|
function MultiImagesLoaderContent(props: Readonly<ContentProps>) {
|
||||||
|
const t = useT()
|
||||||
|
const { images, columns, controlSize } = props
|
||||||
|
const previewUrl = props.preview && mediaContentToViewUrl({ ...props.preview, source_type: props.preview.source_type ?? 'input' })
|
||||||
|
const preview = useExpandedImagePreview(props.preview?.id ?? null, () => props.setPreview(null))
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={`relative flex h-full min-h-0 w-full flex-col overflow-hidden rounded-md bg-muted/20 text-foreground ${props.isNodeV2 ? 'nodeNew' : ''}`}
|
||||||
|
onDragOver={(event) => { event.preventDefault(); props.setDragOver(true) }}
|
||||||
|
onDragLeave={(event) => { if (!event.currentTarget.contains(event.relatedTarget as Node)) props.setDragOver(false) }}
|
||||||
|
onDrop={(event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
props.setDragOver(false)
|
||||||
|
void props.dropFiles(event.dataTransfer.files)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Popover open={props.selectorOpen} onOpenChange={(open) => {
|
||||||
|
props.setSelectorOpen(open)
|
||||||
|
if (!open) props.setReplaceId(null)
|
||||||
|
}}>
|
||||||
|
{images.length === 0 ? (
|
||||||
|
<div className={`task-image-picker-empty relative flex h-full min-h-0 w-full flex-1 flex-col items-center justify-center gap-2 rounded-md px-4 py-2 text-foreground shadow-sm ${props.dragOver ? 'border border-primary bg-accent/20' : 'bg-muted/20'}`}>
|
||||||
|
<CloudUpload className="size-12 shrink-0" />
|
||||||
|
<span className="mt-1 text-base font-semibold">{t('multitrack.selectImage')}</span>
|
||||||
|
<span className="max-w-full whitespace-normal text-center text-sm text-muted-foreground">{t('multitrack.imageDropHint')}</span>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<Button type="button" variant="ghost" className="absolute inset-0 h-full w-full cursor-pointer rounded-md p-0 hover:bg-accent/20 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
||||||
|
aria-label={t('multitrack.selectImage')}
|
||||||
|
onClick={() => props.setReplaceId(null)} />
|
||||||
|
</PopoverTrigger>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<PopoverAnchor asChild>
|
||||||
|
<div className={`task-image-grid grid h-full min-h-0 w-full flex-1 auto-rows-max content-start gap-2 overflow-y-auto rounded-md p-3 transition-colors ${props.dragOver ? 'border border-primary bg-accent/20' : 'bg-muted/20'}`}
|
||||||
|
style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}>
|
||||||
|
{images.map((image, index) => {
|
||||||
|
const url = mediaContentToViewUrl({ ...image, source_type: image.source_type ?? 'input' })
|
||||||
|
const label = image.file_name ?? image.file_path ?? image.local_path ?? image.url ?? String(index + 1)
|
||||||
|
return (
|
||||||
|
<div key={image.id} className="group relative aspect-square min-w-0 w-full self-start overflow-hidden rounded-md border border-border bg-black"
|
||||||
|
draggable
|
||||||
|
onDragStart={() => { props.dragId.current = image.id }}
|
||||||
|
onDragEnd={() => { props.dragId.current = null }}
|
||||||
|
onDrop={(event) => {
|
||||||
|
if (event.dataTransfer.files.length > 0 || !props.dragId.current) return
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
|
props.setDragOver(false)
|
||||||
|
const sourceId = props.dragId.current
|
||||||
|
if (sourceId === image.id) return
|
||||||
|
const next = [...images]
|
||||||
|
const from = next.findIndex((item) => item.id === sourceId)
|
||||||
|
if (from < 0) return
|
||||||
|
const target = next.findIndex((item) => item.id === image.id)
|
||||||
|
const [moved] = next.splice(from, 1)
|
||||||
|
next.splice(target, 0, moved)
|
||||||
|
props.commit(next)
|
||||||
|
}}>
|
||||||
|
<Button variant="ghost" className="absolute inset-0 h-full w-full rounded-none p-0" aria-label={t('multiImagesLoader.replace', { n: index + 1 })}
|
||||||
|
onClick={() => { props.setReplaceId(image.id); props.setSelectorOpen(true) }}>
|
||||||
|
{url ? <img src={url} alt={label} className="h-full w-full object-contain" draggable={false} /> : <span className="px-1 text-xs text-image-tile-foreground">{label}</span>}
|
||||||
|
</Button>
|
||||||
|
<span className="pointer-events-none absolute bottom-0 left-0 bg-black/50 px-1.5 text-[10px] text-image-tile-foreground">{index + 1}</span>
|
||||||
|
<div className="absolute right-1 top-1 flex gap-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100">
|
||||||
|
<Button variant="secondary" size="icon" style={{ width: controlSize, height: controlSize }} aria-label={t('multiImagesLoader.preview')}
|
||||||
|
onClick={() => props.setPreview(image)}><Eye /></Button>
|
||||||
|
<Button variant="destructive" size="icon" style={{ width: controlSize, height: controlSize }} aria-label={t('multiImagesLoader.delete')}
|
||||||
|
onClick={() => props.commit(images.filter((item) => item.id !== image.id))}><Trash2 /></Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
{images.length < MAX_IMAGES && <Button variant="outline" className="task-image-grid-add aspect-square h-auto w-full self-start border-dashed text-muted-foreground" aria-label={t('multiImagesLoader.add')}
|
||||||
|
onClick={() => { props.setReplaceId(null); props.setSelectorOpen(true) }}><Plus /></Button>}
|
||||||
|
</div>
|
||||||
|
</PopoverAnchor>
|
||||||
|
)}
|
||||||
|
<PopoverContent className="w-auto p-0" align="start">
|
||||||
|
<MediaSelector key={props.replaceId ?? 'add'} value={props.activeImage?.file_path ?? props.activeImage?.local_path ?? props.activeImage?.url ?? ''}
|
||||||
|
mediaType="image" defaultTab={selectorTab(props.activeImage)} allowMultipleSelection={!props.replaceId}
|
||||||
|
maxSelectionCount={props.replaceId ? 1 : MAX_IMAGES - images.length} onChange={props.select} />
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
{images.length > 0 && (
|
||||||
|
<div className="flex h-9 shrink-0 items-center justify-between gap-2 border-t border-border bg-background/60 px-3 text-xs">
|
||||||
|
<span className="text-muted-foreground">{t('multiImagesLoader.imageCount', { n: images.length })}</span>
|
||||||
|
<Button type="button" variant="ghost" size="sm" className="h-7 gap-1 px-2 text-xs text-destructive hover:text-destructive"
|
||||||
|
onClick={() => {
|
||||||
|
props.setSelectorOpen(false)
|
||||||
|
props.setReplaceId(null)
|
||||||
|
props.setPreview(null)
|
||||||
|
props.commit([])
|
||||||
|
}}>
|
||||||
|
<Trash2 className="size-3.5" />
|
||||||
|
{t('multiImagesLoader.clearAll')}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{previewUrl && (
|
||||||
|
<div data-testid="multi-images-expanded-preview" data-zoom={preview.zoom.toFixed(2)}
|
||||||
|
className="absolute inset-0 z-30 flex items-center justify-center overflow-hidden bg-black p-3 pt-12"
|
||||||
|
onWheel={preview.onWheel}>
|
||||||
|
<Button type="button" variant="secondary" className="absolute left-2 top-2 z-20 h-8 cursor-pointer gap-1.5 px-2.5 text-xs"
|
||||||
|
aria-label={t('multitrack.backToPreview')} onClick={() => props.setPreview(null)}>
|
||||||
|
<ArrowLeft className="h-4 w-4" />
|
||||||
|
<span>{t('multitrack.backToPreview')}</span>
|
||||||
|
</Button>
|
||||||
|
<span className="pointer-events-none absolute right-2 top-2 z-20 rounded bg-background/70 px-2 py-1 text-[10px] tabular-nums text-foreground">
|
||||||
|
{Math.round(preview.zoom * 100)}%
|
||||||
|
</span>
|
||||||
|
<img ref={preview.imageRef} src={previewUrl}
|
||||||
|
alt={props.preview?.file_name ?? props.preview?.file_path ?? props.preview?.url ?? ''}
|
||||||
|
className="max-h-full max-w-full object-contain transition-transform duration-100 ease-out"
|
||||||
|
style={{ transform: `scale(${preview.zoom})`, transformOrigin: `${preview.origin.x}% ${preview.origin.y}%` }}
|
||||||
|
draggable={false} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
1613
frontend/src/components/widgets/MultiTrackWidget.tsx
Normal file
995
frontend/src/components/widgets/ProjectVideoCombineWidget.tsx
Normal file
@ -0,0 +1,995 @@
|
|||||||
|
import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react'
|
||||||
|
import { Check, ChevronDown, Loader2, Maximize2, Minimize2, Pause, Play, RefreshCw, Trash2, Volume2, VolumeX, ZoomOut } from 'lucide-react'
|
||||||
|
import { Button } from '@/components/ui/button'
|
||||||
|
import { Checkbox } from '@/components/ui/checkbox'
|
||||||
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
|
||||||
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
||||||
|
import { Slider } from '@/components/ui/slider'
|
||||||
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
|
||||||
|
import { useCanvasScale } from '@/hooks/use-canvas-scale'
|
||||||
|
import { useElementWidth } from '@/hooks/use-element-width'
|
||||||
|
import { usePauseMediaOnPageExit } from '@/hooks/use-pause-media-on-page-exit'
|
||||||
|
import type { ReactWidgetProps } from '@/lib/create-react-widget'
|
||||||
|
import { LocaleContext, translate } from '@/lib/i18n'
|
||||||
|
import { addMediaRevision, mediaContentToViewUrl } from '@/lib/media-url'
|
||||||
|
import { formatMultiTrackTime } from '@/lib/multitrack-utils'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
import { CompareVideo } from '@/components/widgets/compareVideoWidget'
|
||||||
|
import { MultiTrackRuler, MULTITRACK_LEFT_GUTTER, MULTITRACK_RIGHT_RESERVE } from './multitrack/MultiTrackRuler'
|
||||||
|
import { DEFAULT_PROJECT_DATA, type ProjectClip, type ProjectData, type ProjectVideoFile } from '@/types/project'
|
||||||
|
|
||||||
|
const MIN_CLIP_FRAMES = 1
|
||||||
|
const PLAYBACK_UI_UPDATE_INTERVAL_MS = 100
|
||||||
|
const ICON_BUTTON_CLASS = 'h-6 w-6 shrink-0 [&_svg]:size-3.5'
|
||||||
|
|
||||||
|
interface GraphLink {
|
||||||
|
origin_id?: number | string
|
||||||
|
target_id?: number | string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ProjectNode {
|
||||||
|
id?: number | string
|
||||||
|
graph?: {
|
||||||
|
links?: Record<string, GraphLink> | GraphLink[] | Map<unknown, GraphLink>
|
||||||
|
_nodes?: Array<{ id?: number | string }>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const DROP_PROMPT_INPUT = Symbol('drop-prompt-input')
|
||||||
|
|
||||||
|
function ensureProjectData(value: unknown): ProjectData {
|
||||||
|
if (!value || typeof value !== 'object' || Array.isArray(value)) return DEFAULT_PROJECT_DATA
|
||||||
|
const data = value as Partial<ProjectData>
|
||||||
|
return {
|
||||||
|
project_name: typeof data.project_name === 'string' ? data.project_name : 'default',
|
||||||
|
width: Number.isFinite(data.width) ? Math.max(0, Number(data.width)) : 0,
|
||||||
|
height: Number.isFinite(data.height) ? Math.max(0, Number(data.height)) : 0,
|
||||||
|
frame_rate: Number.isFinite(data.frame_rate) && Number(data.frame_rate) > 0 ? Number(data.frame_rate) : 24,
|
||||||
|
clips: Array.isArray(data.clips) ? data.clips : [],
|
||||||
|
auto_combine: data.auto_combine !== false,
|
||||||
|
updated_at: data.updated_at,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function graphLinks(node: ProjectNode): GraphLink[] {
|
||||||
|
const links = node.graph?.links
|
||||||
|
if (!links) return []
|
||||||
|
if (Array.isArray(links)) return links.filter(Boolean)
|
||||||
|
if (links instanceof Map) return [...links.values()].filter(Boolean)
|
||||||
|
return Object.values(links).filter(Boolean)
|
||||||
|
}
|
||||||
|
|
||||||
|
function promptGraphNodeIds(
|
||||||
|
node: ProjectNode,
|
||||||
|
workflow: unknown,
|
||||||
|
output: Record<string, unknown>,
|
||||||
|
): Set<string> {
|
||||||
|
const ids = new Set(Object.keys(output))
|
||||||
|
for (const graphNode of node.graph?._nodes ?? []) {
|
||||||
|
if (graphNode.id != null) ids.add(String(graphNode.id))
|
||||||
|
}
|
||||||
|
if (workflow && typeof workflow === 'object' && 'nodes' in workflow && Array.isArray(workflow.nodes)) {
|
||||||
|
for (const workflowNode of workflow.nodes) {
|
||||||
|
if (workflowNode && typeof workflowNode === 'object' && 'id' in workflowNode && workflowNode.id != null) {
|
||||||
|
ids.add(String(workflowNode.id))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ids
|
||||||
|
}
|
||||||
|
|
||||||
|
function pruneExternalPromptConnections(
|
||||||
|
value: unknown,
|
||||||
|
keepIds: Set<string>,
|
||||||
|
graphNodeIds: Set<string>,
|
||||||
|
): unknown | typeof DROP_PROMPT_INPUT {
|
||||||
|
if (
|
||||||
|
Array.isArray(value)
|
||||||
|
&& value.length === 2
|
||||||
|
&& (typeof value[0] === 'string' || typeof value[0] === 'number')
|
||||||
|
&& typeof value[1] === 'number'
|
||||||
|
&& graphNodeIds.has(String(value[0]))
|
||||||
|
) {
|
||||||
|
return keepIds.has(String(value[0])) ? value : DROP_PROMPT_INPUT
|
||||||
|
}
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
return value.flatMap((item) => {
|
||||||
|
const pruned = pruneExternalPromptConnections(item, keepIds, graphNodeIds)
|
||||||
|
return pruned === DROP_PROMPT_INPUT ? [] : [pruned]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (value && typeof value === 'object') {
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(value).flatMap(([key, item]) => {
|
||||||
|
const pruned = pruneExternalPromptConnections(item, keepIds, graphNodeIds)
|
||||||
|
return pruned === DROP_PROMPT_INPUT ? [] : [[key, pruned]]
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
function downstreamNodeIds(node: ProjectNode): Set<string> {
|
||||||
|
const rootId = String(node.id ?? '')
|
||||||
|
const result = new Set<string>(rootId ? [rootId] : [])
|
||||||
|
const pending = rootId ? [rootId] : []
|
||||||
|
const links = graphLinks(node)
|
||||||
|
while (pending.length > 0) {
|
||||||
|
const originId = pending.shift()!
|
||||||
|
for (const link of links) {
|
||||||
|
if (String(link.origin_id ?? '') !== originId || link.target_id == null) continue
|
||||||
|
const targetId = String(link.target_id)
|
||||||
|
if (result.has(targetId)) continue
|
||||||
|
result.add(targetId)
|
||||||
|
pending.push(targetId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
function clipDuration(clip: ProjectClip): number {
|
||||||
|
return Math.max(MIN_CLIP_FRAMES, clip.source_end_frame - clip.source_start_frame)
|
||||||
|
}
|
||||||
|
|
||||||
|
function totalFrames(clips: ProjectClip[]): number {
|
||||||
|
return clips.filter((clip) => clip.enabled !== false).reduce((total, clip) => total + clipDuration(clip), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
function clipAtFrame(clips: ProjectClip[], frame: number): { clip: ProjectClip; start: number } | null {
|
||||||
|
let cursor = 0
|
||||||
|
for (const clip of clips) {
|
||||||
|
if (clip.enabled === false) continue
|
||||||
|
const end = cursor + clipDuration(clip)
|
||||||
|
if (frame < end) return { clip, start: cursor }
|
||||||
|
cursor = end
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
function clipStartFrame(clips: ProjectClip[], targetId: string): number {
|
||||||
|
let cursor = 0
|
||||||
|
for (const clip of clips) {
|
||||||
|
if (clip.enabled === false) continue
|
||||||
|
if (clip.id === targetId) return cursor
|
||||||
|
cursor += clipDuration(clip)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function errorMessage(payload: unknown, fallback: string): string {
|
||||||
|
if (payload && typeof payload === 'object' && 'error' in payload && typeof payload.error === 'string') {
|
||||||
|
return payload.error
|
||||||
|
}
|
||||||
|
return fallback
|
||||||
|
}
|
||||||
|
|
||||||
|
function projectClipUrl(clip: ProjectClip): string | null {
|
||||||
|
const url = mediaContentToViewUrl({ source_type: 'output', file_path: clip.file_path })
|
||||||
|
return url ? addMediaRevision(url, clip.media_revision) : null
|
||||||
|
}
|
||||||
|
|
||||||
|
function projectVideoFileUrl(file: ProjectVideoFile): string | null {
|
||||||
|
const url = mediaContentToViewUrl({ source_type: 'output', file_path: file.file_path })
|
||||||
|
return url ? addMediaRevision(url, file.media_revision) : null
|
||||||
|
}
|
||||||
|
|
||||||
|
function projectVideoFiles(clip: ProjectClip): ProjectVideoFile[] {
|
||||||
|
const files = clip.video_files?.length
|
||||||
|
? clip.video_files
|
||||||
|
: [{
|
||||||
|
file_path: clip.file_path,
|
||||||
|
file_name: clip.file_name,
|
||||||
|
media_revision: clip.media_revision,
|
||||||
|
source_frame_count: clip.source_frame_count,
|
||||||
|
}]
|
||||||
|
return files.some((file) => file.file_path === clip.file_path)
|
||||||
|
? files
|
||||||
|
: [{
|
||||||
|
file_path: clip.file_path,
|
||||||
|
file_name: clip.file_name,
|
||||||
|
media_revision: clip.media_revision,
|
||||||
|
source_frame_count: clip.source_frame_count,
|
||||||
|
}, ...files]
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectProjectVideoFile(clip: ProjectClip, file: ProjectVideoFile): ProjectClip {
|
||||||
|
const sourceFrameCount = Math.max(MIN_CLIP_FRAMES, file.source_frame_count)
|
||||||
|
const sourceStartFrame = Math.min(clip.source_start_frame, sourceFrameCount - 1)
|
||||||
|
return {
|
||||||
|
...clip,
|
||||||
|
file_path: file.file_path,
|
||||||
|
file_name: file.file_name,
|
||||||
|
media_revision: file.media_revision,
|
||||||
|
source_start_frame: sourceStartFrame,
|
||||||
|
source_end_frame: Math.max(sourceStartFrame + 1, Math.min(clip.source_end_frame, sourceFrameCount)),
|
||||||
|
source_frame_count: sourceFrameCount,
|
||||||
|
continuity_mode: file.continuity_mode ?? clip.continuity_mode,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ProjectVideoCombineWidget({ value, onChange, app, node }: Readonly<ReactWidgetProps<ProjectData>>) {
|
||||||
|
const data = ensureProjectData(value)
|
||||||
|
const locale = app?.ui?.settings?.settingsValues?.['Comfy.Locale']
|
||||||
|
const t = useCallback(
|
||||||
|
(path: string, params?: Record<string, string | number>) => translate(locale, path, params),
|
||||||
|
[locale],
|
||||||
|
)
|
||||||
|
const [currentFrame, setCurrentFrame] = useState(0)
|
||||||
|
const [isPlaying, setIsPlaying] = useState(false)
|
||||||
|
const [muted, setMuted] = useState(false)
|
||||||
|
const [zoom, setZoom] = useState(1)
|
||||||
|
const [timelineCollapsed, setTimelineCollapsed] = useState(false)
|
||||||
|
const [isRefreshing, setIsRefreshing] = useState(false)
|
||||||
|
const [isDeleting, setIsDeleting] = useState(false)
|
||||||
|
const [deletingFilePath, setDeletingFilePath] = useState<string | null>(null)
|
||||||
|
const [isCombining, setIsCombining] = useState(false)
|
||||||
|
const [projects, setProjects] = useState<string[]>(['default'])
|
||||||
|
const [selectedClipId, setSelectedClipId] = useState<string | null>(null)
|
||||||
|
const [previewFilePaths, setPreviewFilePaths] = useState<Record<string, string[]>>({})
|
||||||
|
const [playbackNonce, setPlaybackNonce] = useState(0)
|
||||||
|
const [previewPauseNonce, setPreviewPauseNonce] = useState(0)
|
||||||
|
const videoRefs = useRef(new Map<string, HTMLVideoElement>())
|
||||||
|
const currentFrameRef = useRef(0)
|
||||||
|
const playbackStartFrameRef = useRef(0)
|
||||||
|
const playbackStartedAtRef = useRef(0)
|
||||||
|
const playbackUiUpdatedAtRef = useRef(0)
|
||||||
|
const playbackRafRef = useRef<number | null>(null)
|
||||||
|
const timelineContainerRef = useRef<HTMLDivElement>(null)
|
||||||
|
const refreshRequestRef = useRef(0)
|
||||||
|
const deletingFileRef = useRef(false)
|
||||||
|
const latestDataRef = useRef(data)
|
||||||
|
latestDataRef.current = data
|
||||||
|
const canvasScale = useCanvasScale(app)
|
||||||
|
const timelineWidth = Math.max(1, useElementWidth(timelineContainerRef))
|
||||||
|
const scaledTimelineWidth = timelineWidth * zoom
|
||||||
|
const total = totalFrames(data.clips)
|
||||||
|
const active = clipAtFrame(data.clips, Math.min(currentFrame, Math.max(0, total - 1)))
|
||||||
|
const activeUrl = active ? projectClipUrl(active.clip) : null
|
||||||
|
const enabledClips = data.clips.filter((clip) => clip.enabled !== false)
|
||||||
|
const activeIndex = active ? enabledClips.findIndex((clip) => clip.id === active.clip.id) : -1
|
||||||
|
const nextClip = activeIndex >= 0 && enabledClips.length > 1
|
||||||
|
? enabledClips[(activeIndex + 1) % enabledClips.length]
|
||||||
|
: undefined
|
||||||
|
const nextUrl = nextClip ? projectClipUrl(nextClip) : null
|
||||||
|
const projectOptions = projects.includes(data.project_name) || !data.project_name
|
||||||
|
? projects
|
||||||
|
: [...projects, data.project_name]
|
||||||
|
|
||||||
|
function selectedFilePaths(clip: ProjectClip): string[] {
|
||||||
|
const availablePaths = new Set(projectVideoFiles(clip).map((file) => file.file_path))
|
||||||
|
if (availablePaths.size === 1) return [...availablePaths]
|
||||||
|
const storedPaths = [...new Set(previewFilePaths[clip.id] ?? [])]
|
||||||
|
.filter((path) => availablePaths.has(path)).slice(0, 2)
|
||||||
|
return storedPaths.includes(clip.file_path) ? storedPaths : [clip.file_path]
|
||||||
|
}
|
||||||
|
|
||||||
|
const activeSelectedFiles = active
|
||||||
|
? selectedFilePaths(active.clip)
|
||||||
|
.map((filePath) => projectVideoFiles(active.clip).find((file) => file.file_path === filePath))
|
||||||
|
.filter((file): file is ProjectVideoFile => Boolean(file))
|
||||||
|
: []
|
||||||
|
const compareUrls = activeSelectedFiles.length === 2
|
||||||
|
? activeSelectedFiles.map(projectVideoFileUrl)
|
||||||
|
: []
|
||||||
|
const isComparing = compareUrls.length === 2 && compareUrls.every(Boolean)
|
||||||
|
|
||||||
|
function selectClip(clip: ProjectClip) {
|
||||||
|
seek(clipStartFrame(data.clips, clip.id))
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectClipFile(clip: ProjectClip, filePath: string) {
|
||||||
|
const file = clip.video_files?.find((candidate) => candidate.file_path === filePath)
|
||||||
|
if (!file) return
|
||||||
|
onChange({
|
||||||
|
...data,
|
||||||
|
clips: data.clips.map((item) => item.id === clip.id ? selectProjectVideoFile(item, file) : item),
|
||||||
|
})
|
||||||
|
void persistSelectedClipFile(clip, file)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function persistSelectedClipFile(clip: ProjectClip, file: ProjectVideoFile) {
|
||||||
|
const projectName = data.project_name || 'default'
|
||||||
|
try {
|
||||||
|
const response = await app.api.fetchApi('/easy-media/project/video', {
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({
|
||||||
|
project_name: projectName,
|
||||||
|
segment_index: clip.index,
|
||||||
|
file_path: file.file_path,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
let payload: unknown
|
||||||
|
try {
|
||||||
|
payload = await response.json()
|
||||||
|
} catch (error) {
|
||||||
|
if (!(error instanceof SyntaxError)) throw error
|
||||||
|
throw new Error(t('projectVideoCombine.selectClipFileFailed'))
|
||||||
|
}
|
||||||
|
if (!response.ok) throw new Error(errorMessage(payload, t('projectVideoCombine.selectClipFileFailed')))
|
||||||
|
} catch (error) {
|
||||||
|
app.extensionManager.toast.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: t('projectVideoCombine.selectClipFileFailed'),
|
||||||
|
detail: error instanceof Error ? error.message : String(error),
|
||||||
|
life: 5000,
|
||||||
|
})
|
||||||
|
void refreshProject(projectName, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleClipFile(clip: ProjectClip, filePath: string) {
|
||||||
|
const currentPaths = selectedFilePaths(clip)
|
||||||
|
const selected = currentPaths.includes(filePath)
|
||||||
|
if (selected && currentPaths.length === 1) return
|
||||||
|
if (!selected && currentPaths.length >= 2) return
|
||||||
|
|
||||||
|
const nextPaths = selected
|
||||||
|
? currentPaths.filter((path) => path !== filePath)
|
||||||
|
: [...currentPaths, filePath]
|
||||||
|
setPreviewFilePaths((current) => ({ ...current, [clip.id]: nextPaths }))
|
||||||
|
selectClip(clip)
|
||||||
|
if (nextPaths[0] !== clip.file_path) selectClipFile(clip, nextPaths[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
const refreshProject = useCallback(async (projectName: string, showError = true) => {
|
||||||
|
if (!projectName || deletingFileRef.current) return
|
||||||
|
const requestId = ++refreshRequestRef.current
|
||||||
|
setIsRefreshing(true)
|
||||||
|
const switchingProject = projectName !== data.project_name
|
||||||
|
if (switchingProject) {
|
||||||
|
setIsPlaying(false)
|
||||||
|
setCurrentFrame(0)
|
||||||
|
setSelectedClipId(null)
|
||||||
|
setPreviewFilePaths({})
|
||||||
|
onChange({ ...DEFAULT_PROJECT_DATA, project_name: projectName, auto_combine: data.auto_combine })
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const response = await app.api.fetchApi(`/easy-media/project?project_name=${encodeURIComponent(projectName)}`)
|
||||||
|
const payload: unknown = await response.json()
|
||||||
|
if (!response.ok && response.status === 404 && projectName === 'default') {
|
||||||
|
if (requestId !== refreshRequestRef.current) return
|
||||||
|
onChange({ ...DEFAULT_PROJECT_DATA, project_name: 'default', auto_combine: data.auto_combine })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!response.ok) throw new Error(errorMessage(payload, t('projectVideoCombine.refreshFailed')))
|
||||||
|
if (requestId !== refreshRequestRef.current) return
|
||||||
|
onChange({ ...ensureProjectData(payload), auto_combine: data.auto_combine })
|
||||||
|
} catch (error) {
|
||||||
|
if (showError && requestId === refreshRequestRef.current) {
|
||||||
|
app.extensionManager.toast.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: t('projectVideoCombine.refreshFailed'),
|
||||||
|
detail: error instanceof Error ? error.message : String(error),
|
||||||
|
life: 5000,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (requestId === refreshRequestRef.current) setIsRefreshing(false)
|
||||||
|
}
|
||||||
|
}, [app, data.auto_combine, data.project_name, onChange, t])
|
||||||
|
|
||||||
|
const loadProjects = useCallback(async () => {
|
||||||
|
try {
|
||||||
|
const response = await app.api.fetchApi('/easy-media/projects')
|
||||||
|
const payload: unknown = await response.json()
|
||||||
|
if (!response.ok) throw new Error(errorMessage(payload, t('projectVideoCombine.projectListFailed')))
|
||||||
|
const names = payload && typeof payload === 'object' && 'projects' in payload && Array.isArray(payload.projects)
|
||||||
|
? payload.projects.filter((name): name is string => typeof name === 'string' && name.length > 0)
|
||||||
|
: []
|
||||||
|
setProjects(names.includes('default') ? names : ['default', ...names])
|
||||||
|
} catch (error) {
|
||||||
|
app.extensionManager.toast.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: t('projectVideoCombine.projectListFailed'),
|
||||||
|
detail: error instanceof Error ? error.message : String(error),
|
||||||
|
life: 5000,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, [app, t])
|
||||||
|
|
||||||
|
async function deleteClipFile(clip: ProjectClip, file: ProjectVideoFile) {
|
||||||
|
if (deletingFileRef.current) return
|
||||||
|
deletingFileRef.current = true
|
||||||
|
setDeletingFilePath(file.file_path)
|
||||||
|
const projectName = data.project_name || 'default'
|
||||||
|
try {
|
||||||
|
const confirmed = await app.extensionManager.dialog.confirm({
|
||||||
|
title: t('projectVideoCombine.deleteClipFileTitle'),
|
||||||
|
message: t('projectVideoCombine.deleteClipFileConfirm', { file: file.file_name }),
|
||||||
|
})
|
||||||
|
if (!confirmed) return
|
||||||
|
++refreshRequestRef.current
|
||||||
|
setIsRefreshing(false)
|
||||||
|
const response = await app.api.fetchApi('/easy-media/project/video', {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ project_name: projectName, segment_index: clip.index, file_path: file.file_path }),
|
||||||
|
})
|
||||||
|
let payload: unknown
|
||||||
|
try {
|
||||||
|
payload = await response.json()
|
||||||
|
} catch (error) {
|
||||||
|
if (!(error instanceof SyntaxError)) throw error
|
||||||
|
if (response.status === 404 || response.status === 405) {
|
||||||
|
throw new Error(t('projectVideoCombine.deleteClipFileUnavailable'))
|
||||||
|
}
|
||||||
|
throw new Error(t('projectVideoCombine.deleteClipFileInvalidResponse', { status: response.status }))
|
||||||
|
}
|
||||||
|
if (!response.ok) throw new Error(errorMessage(payload, t('projectVideoCombine.deleteClipFileFailed')))
|
||||||
|
if (
|
||||||
|
!payload || typeof payload !== 'object'
|
||||||
|
|| !('project_name' in payload) || payload.project_name !== projectName
|
||||||
|
|| !('clips' in payload) || !Array.isArray(payload.clips)
|
||||||
|
) {
|
||||||
|
throw new Error(t('projectVideoCombine.deleteClipFileInvalidResponse', { status: response.status }))
|
||||||
|
}
|
||||||
|
const current = latestDataRef.current
|
||||||
|
if ((current.project_name || 'default') !== projectName) return
|
||||||
|
const fresh = ensureProjectData(payload)
|
||||||
|
const replacement = fresh.clips.find((item) => item.id === clip.id)
|
||||||
|
const nextData = {
|
||||||
|
...current,
|
||||||
|
updated_at: fresh.updated_at,
|
||||||
|
clips: current.clips.flatMap((item) => {
|
||||||
|
if (item.id !== clip.id) return [item]
|
||||||
|
if (!replacement) return []
|
||||||
|
const files = projectVideoFiles(replacement)
|
||||||
|
const preferredPaths = [item.file_path, ...(previewFilePaths[item.id] ?? [])]
|
||||||
|
const selectedFile = preferredPaths
|
||||||
|
.map((path) => files.find((candidate) => candidate.file_path === path))
|
||||||
|
.find((candidate) => candidate !== undefined)
|
||||||
|
?? files.find((candidate) => candidate.file_path === replacement.file_path)!
|
||||||
|
return [selectProjectVideoFile({ ...item, video_files: files }, selectedFile)]
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
setPreviewFilePaths((currentPaths) => {
|
||||||
|
const nextPaths = { ...currentPaths }
|
||||||
|
const remainingClip = nextData.clips.find((item) => item.id === clip.id)
|
||||||
|
if (!remainingClip) {
|
||||||
|
delete nextPaths[clip.id]
|
||||||
|
return nextPaths
|
||||||
|
}
|
||||||
|
const availablePaths = new Set(projectVideoFiles(remainingClip).map((item) => item.file_path))
|
||||||
|
const selectedPaths = [...new Set(currentPaths[clip.id] ?? [])]
|
||||||
|
.filter((path) => availablePaths.has(path))
|
||||||
|
// A comparison requires two surviving selections. Otherwise explicitly
|
||||||
|
// reset to the saved primary video instead of retaining comparison state.
|
||||||
|
nextPaths[clip.id] = availablePaths.size > 1 && selectedPaths.length === 2
|
||||||
|
&& selectedPaths.includes(remainingClip.file_path)
|
||||||
|
? selectedPaths
|
||||||
|
: [remainingClip.file_path]
|
||||||
|
return nextPaths
|
||||||
|
})
|
||||||
|
setIsPlaying(false)
|
||||||
|
setPreviewPauseNonce((nonce) => nonce + 1)
|
||||||
|
setPlaybackNonce((nonce) => nonce + 1)
|
||||||
|
const nextFrame = Math.min(currentFrameRef.current, Math.max(0, totalFrames(nextData.clips) - 1))
|
||||||
|
currentFrameRef.current = nextFrame
|
||||||
|
setCurrentFrame(nextFrame)
|
||||||
|
setSelectedClipId(clipAtFrame(nextData.clips, nextFrame)?.clip.id ?? null)
|
||||||
|
onChange(nextData)
|
||||||
|
} catch (error) {
|
||||||
|
app.extensionManager.toast.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: t('projectVideoCombine.deleteClipFileFailed'),
|
||||||
|
detail: error instanceof Error ? error.message : String(error),
|
||||||
|
life: 5000,
|
||||||
|
})
|
||||||
|
} finally {
|
||||||
|
deletingFileRef.current = false
|
||||||
|
setDeletingFilePath(null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteProject() {
|
||||||
|
const projectName = data.project_name || 'default'
|
||||||
|
let confirmed = false
|
||||||
|
try {
|
||||||
|
confirmed = await app.extensionManager.dialog.confirm({
|
||||||
|
title: t('projectVideoCombine.deleteProjectTitle'),
|
||||||
|
message: t(projectName === 'default'
|
||||||
|
? 'projectVideoCombine.deleteDefaultProjectConfirm'
|
||||||
|
: 'projectVideoCombine.deleteProjectConfirm', { project: projectName }),
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
app.extensionManager.toast.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: t('projectVideoCombine.deleteProjectFailed'),
|
||||||
|
detail: error instanceof Error ? error.message : String(error),
|
||||||
|
life: 5000,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!confirmed) return
|
||||||
|
|
||||||
|
setIsDeleting(true)
|
||||||
|
setIsRefreshing(false)
|
||||||
|
++refreshRequestRef.current
|
||||||
|
try {
|
||||||
|
const response = await app.api.fetchApi(
|
||||||
|
`/easy-media/project?project_name=${encodeURIComponent(projectName)}`,
|
||||||
|
{ method: 'DELETE' },
|
||||||
|
)
|
||||||
|
const payload: unknown = await response.json()
|
||||||
|
if (!response.ok) throw new Error(errorMessage(payload, t('projectVideoCombine.deleteProjectFailed')))
|
||||||
|
setIsPlaying(false)
|
||||||
|
setCurrentFrame(0)
|
||||||
|
setSelectedClipId(null)
|
||||||
|
setPreviewFilePaths({})
|
||||||
|
setProjects((names) => projectName === 'default'
|
||||||
|
? names
|
||||||
|
: names.filter((name) => name !== projectName))
|
||||||
|
onChange({ ...DEFAULT_PROJECT_DATA, project_name: 'default', auto_combine: data.auto_combine })
|
||||||
|
app.extensionManager.toast.add({
|
||||||
|
severity: 'success',
|
||||||
|
summary: t('projectVideoCombine.deleteProjectSuccess'),
|
||||||
|
detail: t('projectVideoCombine.deleteProjectSuccessDetail', { project: projectName }),
|
||||||
|
life: 4000,
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
app.extensionManager.toast.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: t('projectVideoCombine.deleteProjectFailed'),
|
||||||
|
detail: error instanceof Error ? error.message : String(error),
|
||||||
|
life: 5000,
|
||||||
|
})
|
||||||
|
} finally {
|
||||||
|
setIsDeleting(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (data.clips.length === 0) void refreshProject(data.project_name || 'default', false)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleSuccess = () => void refreshProject(data.project_name || 'default', false)
|
||||||
|
app.api.addEventListener('execution_success', handleSuccess)
|
||||||
|
return () => app.api.removeEventListener('execution_success', handleSuccess)
|
||||||
|
}, [app.api, data.project_name, refreshProject])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleProjectRefresh = (event: CustomEvent<unknown>) => {
|
||||||
|
const payload = event.detail
|
||||||
|
const projectName = payload && typeof payload === 'object' && 'project_name' in payload
|
||||||
|
? String(payload.project_name)
|
||||||
|
: ''
|
||||||
|
const currentProjectName = data.project_name || 'default'
|
||||||
|
void refreshProject(projectName || currentProjectName, false)
|
||||||
|
}
|
||||||
|
app.api.addCustomEventListener('easy_multitrack_project_refresh', handleProjectRefresh)
|
||||||
|
return () => app.api.removeCustomEventListener('easy_multitrack_project_refresh', handleProjectRefresh)
|
||||||
|
}, [app.api, data.project_name, refreshProject])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleSelected = (event: CustomEvent<unknown>) => {
|
||||||
|
const payload = event.detail
|
||||||
|
if (!payload || typeof payload !== 'object') return
|
||||||
|
const nodeId = 'node_id' in payload ? String(payload.node_id) : ''
|
||||||
|
if (nodeId && nodeId !== String((node as ProjectNode).id ?? '')) return
|
||||||
|
const projectName = 'project_name' in payload ? String(payload.project_name) : ''
|
||||||
|
if (projectName) void refreshProject(projectName, false)
|
||||||
|
}
|
||||||
|
app.api.addCustomEventListener('easy-media.project.selected', handleSelected)
|
||||||
|
return () => app.api.removeCustomEventListener('easy-media.project.selected', handleSelected)
|
||||||
|
}, [app.api, node, refreshProject])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const syncNode = node as ProjectNode & { __easyMediaSyncPlay?: (startAt: number, muted?: boolean) => void }
|
||||||
|
syncNode.__easyMediaSyncPlay = (_startAt, syncMuted) => {
|
||||||
|
if (typeof syncMuted === 'boolean') setMuted(syncMuted)
|
||||||
|
currentFrameRef.current = 0
|
||||||
|
setCurrentFrame(0)
|
||||||
|
setSelectedClipId(clipAtFrame(data.clips, 0)?.clip.id ?? null)
|
||||||
|
setPlaybackNonce((nonce) => nonce + 1)
|
||||||
|
setIsPlaying(true)
|
||||||
|
}
|
||||||
|
return () => {
|
||||||
|
delete syncNode.__easyMediaSyncPlay
|
||||||
|
}
|
||||||
|
}, [data.clips, node])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
currentFrameRef.current = currentFrame
|
||||||
|
}, [currentFrame])
|
||||||
|
|
||||||
|
const pausePreviewMedia = useCallback(() => {
|
||||||
|
if (playbackRafRef.current !== null) {
|
||||||
|
cancelAnimationFrame(playbackRafRef.current)
|
||||||
|
playbackRafRef.current = null
|
||||||
|
}
|
||||||
|
for (const video of videoRefs.current.values()) video.pause()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
usePauseMediaOnPageExit(() => {
|
||||||
|
pausePreviewMedia()
|
||||||
|
setCurrentFrame(currentFrameRef.current)
|
||||||
|
setIsPlaying(false)
|
||||||
|
setPreviewPauseNonce((nonce) => nonce + 1)
|
||||||
|
})
|
||||||
|
|
||||||
|
useEffect(() => () => pausePreviewMedia(), [pausePreviewMedia])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const workflowStore = app.extensionManager.workflow
|
||||||
|
let activeWorkflowKey = workflowStore.activeWorkflow?.key ?? null
|
||||||
|
return workflowStore.$subscribe((_mutation: unknown, state: { activeWorkflow?: { key: string } | null }) => {
|
||||||
|
const nextWorkflowKey = state.activeWorkflow?.key ?? null
|
||||||
|
if (
|
||||||
|
activeWorkflowKey !== null
|
||||||
|
&& nextWorkflowKey !== null
|
||||||
|
&& nextWorkflowKey !== activeWorkflowKey
|
||||||
|
) {
|
||||||
|
pausePreviewMedia()
|
||||||
|
setCurrentFrame(currentFrameRef.current)
|
||||||
|
setIsPlaying(false)
|
||||||
|
setPreviewPauseNonce((nonce) => nonce + 1)
|
||||||
|
}
|
||||||
|
activeWorkflowKey = nextWorkflowKey
|
||||||
|
})
|
||||||
|
}, [app.extensionManager.workflow, pausePreviewMedia])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isPlaying || total <= 0) {
|
||||||
|
if (playbackRafRef.current !== null) cancelAnimationFrame(playbackRafRef.current)
|
||||||
|
playbackRafRef.current = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
playbackStartedAtRef.current = performance.now()
|
||||||
|
playbackUiUpdatedAtRef.current = playbackStartedAtRef.current
|
||||||
|
playbackStartFrameRef.current = currentFrameRef.current >= total ? 0 : currentFrameRef.current
|
||||||
|
|
||||||
|
function tick(now: number) {
|
||||||
|
const elapsedFrames = Math.floor(((now - playbackStartedAtRef.current) / 1000) * data.frame_rate)
|
||||||
|
const nextFrame = playbackStartFrameRef.current + elapsedFrames
|
||||||
|
if (nextFrame >= total) {
|
||||||
|
currentFrameRef.current = 0
|
||||||
|
playbackStartFrameRef.current = 0
|
||||||
|
playbackStartedAtRef.current = now
|
||||||
|
setCurrentFrame(0)
|
||||||
|
setSelectedClipId(clipAtFrame(data.clips, 0)?.clip.id ?? null)
|
||||||
|
setPlaybackNonce((nonce) => nonce + 1)
|
||||||
|
} else if (nextFrame !== currentFrameRef.current) {
|
||||||
|
currentFrameRef.current = nextFrame
|
||||||
|
if (now - playbackUiUpdatedAtRef.current >= PLAYBACK_UI_UPDATE_INTERVAL_MS) {
|
||||||
|
playbackUiUpdatedAtRef.current = now
|
||||||
|
setCurrentFrame(nextFrame)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
playbackRafRef.current = requestAnimationFrame(tick)
|
||||||
|
}
|
||||||
|
|
||||||
|
playbackRafRef.current = requestAnimationFrame(tick)
|
||||||
|
return () => {
|
||||||
|
if (playbackRafRef.current !== null) cancelAnimationFrame(playbackRafRef.current)
|
||||||
|
playbackRafRef.current = null
|
||||||
|
}
|
||||||
|
}, [data.clips, data.frame_rate, isPlaying, total])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const video = active ? videoRefs.current.get(active.clip.id) : undefined
|
||||||
|
if (!video || !active) return
|
||||||
|
const localSeconds = (
|
||||||
|
active.clip.source_start_frame + Math.max(0, currentFrameRef.current - active.start)
|
||||||
|
) / data.frame_rate
|
||||||
|
try {
|
||||||
|
if (Math.abs(video.currentTime - localSeconds) > 0.001) video.currentTime = localSeconds
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[ProjectVideoCombineWidget] failed to seek preview video:', error)
|
||||||
|
}
|
||||||
|
}, [active?.clip.id, activeUrl, data.frame_rate, isComparing, playbackNonce])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isPlaying) return
|
||||||
|
const video = active ? videoRefs.current.get(active.clip.id) : undefined
|
||||||
|
if (!video || !active) return
|
||||||
|
const localSeconds = (active.clip.source_start_frame + Math.max(0, currentFrame - active.start)) / data.frame_rate
|
||||||
|
try {
|
||||||
|
if (Math.abs(video.currentTime - localSeconds) > 0.001) video.currentTime = localSeconds
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[ProjectVideoCombineWidget] failed to seek paused preview video:', error)
|
||||||
|
}
|
||||||
|
}, [active?.clip.id, activeUrl, currentFrame, data.frame_rate, isComparing, isPlaying])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const video = nextClip ? videoRefs.current.get(nextClip.id) : undefined
|
||||||
|
if (!video || !nextClip) return
|
||||||
|
const preloadTime = nextClip.source_start_frame / data.frame_rate
|
||||||
|
try {
|
||||||
|
if (Math.abs(video.currentTime - preloadTime) > 0.001) video.currentTime = preloadTime
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[ProjectVideoCombineWidget] failed to preload the next preview video:', error)
|
||||||
|
}
|
||||||
|
}, [data.frame_rate, nextClip?.id, nextUrl])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const video = active ? videoRefs.current.get(active.clip.id) : undefined
|
||||||
|
if (!video || !active) return
|
||||||
|
for (const [clipId, candidate] of videoRefs.current) {
|
||||||
|
if (clipId !== active.clip.id) candidate.pause()
|
||||||
|
}
|
||||||
|
if (isPlaying) {
|
||||||
|
void video.play().catch((error: unknown) => {
|
||||||
|
console.error('[ProjectVideoCombineWidget] failed to play preview video:', error)
|
||||||
|
setIsPlaying(false)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
video.pause()
|
||||||
|
}
|
||||||
|
}, [active?.clip.id, activeUrl, isComparing, isPlaying, playbackNonce])
|
||||||
|
|
||||||
|
function seek(frame: number) {
|
||||||
|
const nextFrame = Math.max(0, Math.min(total, Math.round(frame)))
|
||||||
|
currentFrameRef.current = nextFrame
|
||||||
|
if (isPlaying) {
|
||||||
|
playbackStartFrameRef.current = nextFrame >= total ? 0 : nextFrame
|
||||||
|
playbackStartedAtRef.current = performance.now()
|
||||||
|
}
|
||||||
|
setCurrentFrame(nextFrame)
|
||||||
|
const nextActive = clipAtFrame(data.clips, Math.min(nextFrame, Math.max(0, total - 1)))
|
||||||
|
setSelectedClipId(nextActive?.clip.id ?? null)
|
||||||
|
}
|
||||||
|
|
||||||
|
function togglePlayback() {
|
||||||
|
setIsPlaying((playing) => {
|
||||||
|
if (playing) setCurrentFrame(currentFrameRef.current)
|
||||||
|
return !playing
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function combineProject() {
|
||||||
|
const projectName = data.project_name || 'default'
|
||||||
|
try {
|
||||||
|
const queue = await app.api.getQueue()
|
||||||
|
if (queue.Running.length > 0 || queue.Pending.length > 0) {
|
||||||
|
throw new Error(t('projectVideoCombine.queueBusy'))
|
||||||
|
}
|
||||||
|
setIsCombining(true)
|
||||||
|
const prompt = await app.graphToPrompt()
|
||||||
|
const keepIds = downstreamNodeIds(node as ProjectNode)
|
||||||
|
const allOutput = prompt.output as Record<string, { inputs?: Record<string, unknown> }>
|
||||||
|
const graphNodeIds = promptGraphNodeIds(node as ProjectNode, prompt.workflow, allOutput)
|
||||||
|
const filteredOutput = Object.fromEntries(
|
||||||
|
Object.entries(allOutput).filter(([nodeId]) => keepIds.has(nodeId)).map(([nodeId, apiNode]) => {
|
||||||
|
const prunedInputs = pruneExternalPromptConnections(apiNode.inputs ?? {}, keepIds, graphNodeIds)
|
||||||
|
const inputs = prunedInputs === DROP_PROMPT_INPUT
|
||||||
|
? {}
|
||||||
|
: prunedInputs as Record<string, unknown>
|
||||||
|
if (nodeId === String((node as ProjectNode).id ?? '')) {
|
||||||
|
inputs.project_name = projectName
|
||||||
|
inputs.project_data = JSON.stringify({ ...data, auto_combine: true })
|
||||||
|
}
|
||||||
|
return [nodeId, { ...apiNode, inputs }]
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
if (Object.keys(filteredOutput).length < 2) throw new Error(t('projectVideoCombine.connectSaveNode'))
|
||||||
|
await app.api.queuePrompt(0, { ...prompt, output: filteredOutput as typeof prompt.output })
|
||||||
|
app.extensionManager.toast.add({
|
||||||
|
severity: 'info',
|
||||||
|
summary: t('projectVideoCombine.combineQueued'),
|
||||||
|
detail: t('projectVideoCombine.combineQueuedDetail', { project: projectName }),
|
||||||
|
life: 4000,
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
app.extensionManager.toast.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: t('projectVideoCombine.combineFailed'),
|
||||||
|
detail: error instanceof Error ? error.message : String(error),
|
||||||
|
life: 6000,
|
||||||
|
})
|
||||||
|
} finally {
|
||||||
|
setIsCombining(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function tooltip(label: string, child: ReactNode) {
|
||||||
|
return <Tooltip><TooltipTrigger asChild><span className="inline-flex shrink-0">{child}</span></TooltipTrigger><TooltipContent>{label}</TooltipContent></Tooltip>
|
||||||
|
}
|
||||||
|
|
||||||
|
const playableWidth = Math.max(1, scaledTimelineWidth - MULTITRACK_LEFT_GUTTER - MULTITRACK_RIGHT_RESERVE)
|
||||||
|
const playheadLeft = MULTITRACK_LEFT_GUTTER + (Math.min(currentFrame, total) / Math.max(total, 1)) * playableWidth
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LocaleContext.Provider value={locale}>
|
||||||
|
<TooltipProvider>
|
||||||
|
<div className="flex h-full min-h-[520px] w-full flex-col overflow-hidden rounded-md border border-border bg-background text-foreground">
|
||||||
|
<div className="flex h-10 shrink-0 items-center justify-between border-b border-border px-2">
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<Select disabled={deletingFilePath !== null} value={data.project_name || 'default'} onOpenChange={(open) => { if (open) void loadProjects() }} onValueChange={(name) => void refreshProject(name)}>
|
||||||
|
<SelectTrigger className="h-7 w-32 text-xs" aria-label={t('projectVideoCombine.selectProject')}><SelectValue /></SelectTrigger>
|
||||||
|
<SelectContent>{projectOptions.map((name) => <SelectItem key={name} value={name}>{name}</SelectItem>)}</SelectContent>
|
||||||
|
</Select>
|
||||||
|
{tooltip(t('projectVideoCombine.deleteProject'), (
|
||||||
|
<Button type="button" variant="ghost" size="icon" className="h-7 w-7 text-destructive hover:text-destructive" disabled={isDeleting || isRefreshing || deletingFilePath !== null} aria-label={t('projectVideoCombine.deleteProject')} onClick={() => void deleteProject()}>
|
||||||
|
{isDeleting ? <Loader2 className="size-3.5 animate-spin" /> : <Trash2 className="size-3.5" />}
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
{tooltip(t('projectVideoCombine.refresh'), (
|
||||||
|
<Button type="button" variant="ghost" size="icon" className="h-7 w-7" disabled={isRefreshing || deletingFilePath !== null} aria-label={t('projectVideoCombine.refresh')} onClick={() => void refreshProject(data.project_name || 'default')}>
|
||||||
|
{isRefreshing ? <Loader2 className="size-3.5 animate-spin" /> : <RefreshCw className="size-3.5" />}
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
<label className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||||
|
<Checkbox checked={data.auto_combine} onCheckedChange={(checked) => onChange({ ...data, auto_combine: checked === true })} />
|
||||||
|
{t('projectVideoCombine.autoCombine')}
|
||||||
|
</label>
|
||||||
|
<Button type="button" size="sm" className="h-7 gap-1.5 text-xs" disabled={isCombining || deletingFilePath !== null || data.clips.length === 0} onClick={() => void combineProject()}>
|
||||||
|
{isCombining ? <Loader2 className="size-3.5 animate-spin" /> : <Play className="size-3.5" />}
|
||||||
|
{t('projectVideoCombine.combine')}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-black p-3">
|
||||||
|
{isComparing ? (
|
||||||
|
<CompareVideo
|
||||||
|
key={`${active!.clip.id}:${compareUrls.join('|')}`}
|
||||||
|
app={app}
|
||||||
|
sourceUrl={compareUrls[0]!}
|
||||||
|
outputUrl={compareUrls[1]!}
|
||||||
|
pausePlaybackNonce={previewPauseNonce}
|
||||||
|
parentPlayback={{
|
||||||
|
isPlaying,
|
||||||
|
currentTime: (active!.clip.source_start_frame + currentFrame - active!.start) / data.frame_rate,
|
||||||
|
startTime: active!.clip.source_start_frame / data.frame_rate,
|
||||||
|
endTime: active!.clip.source_end_frame / data.frame_rate,
|
||||||
|
muted,
|
||||||
|
onPause: () => {
|
||||||
|
setCurrentFrame(currentFrameRef.current)
|
||||||
|
setIsPlaying(false)
|
||||||
|
},
|
||||||
|
onSeek: (time) => seek(active!.start + time * data.frame_rate - active!.clip.source_start_frame),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : activeUrl ? (
|
||||||
|
[
|
||||||
|
{ clip: active!.clip, url: activeUrl, visible: true },
|
||||||
|
...(nextClip && nextUrl ? [{ clip: nextClip, url: nextUrl, visible: false }] : []),
|
||||||
|
].map(({ clip, url, visible }) => (
|
||||||
|
<video
|
||||||
|
ref={(element) => {
|
||||||
|
if (element) videoRefs.current.set(clip.id, element)
|
||||||
|
else videoRefs.current.delete(clip.id)
|
||||||
|
}}
|
||||||
|
key={clip.id}
|
||||||
|
src={url}
|
||||||
|
preload="auto"
|
||||||
|
playsInline
|
||||||
|
muted={!visible || muted}
|
||||||
|
aria-hidden={!visible}
|
||||||
|
className={visible
|
||||||
|
? 'h-full max-h-full w-full object-contain'
|
||||||
|
: 'pointer-events-none absolute left-0 top-0 h-px w-px opacity-0'}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
) : <div className="text-xs text-muted-foreground">{t('projectVideoCombine.emptyPreview')}</div>}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="grid h-9 shrink-0 grid-cols-[1fr_auto_1fr] items-center border-y border-border px-1 text-[10px]">
|
||||||
|
<div className="flex items-center">
|
||||||
|
{tooltip(muted ? t('projectVideoCombine.unmutePreview') : t('projectVideoCombine.mutePreview'), (
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
className={ICON_BUTTON_CLASS}
|
||||||
|
aria-label={muted ? t('projectVideoCombine.unmutePreview') : t('projectVideoCombine.mutePreview')}
|
||||||
|
aria-pressed={muted}
|
||||||
|
onClick={() => setMuted((current) => !current)}
|
||||||
|
>
|
||||||
|
{muted ? <VolumeX /> : <Volume2 />}
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2 text-muted-foreground">
|
||||||
|
<span className="w-16 text-right tabular-nums text-gradient">{formatMultiTrackTime(currentFrame, { frameRate: data.frame_rate, showFrames: true })}</span>
|
||||||
|
<Button type="button" variant="secondary" size="icon" className={`${ICON_BUTTON_CLASS} rounded-full`} disabled={total === 0} aria-label={isPlaying ? t('multitrack.pause') : t('multitrack.play')} onClick={togglePlayback}>{isPlaying ? <Pause /> : <Play />}</Button>
|
||||||
|
<span className="w-16 tabular-nums">{formatMultiTrackTime(total, { frameRate: data.frame_rate, showFrames: true })}</span>
|
||||||
|
</div>
|
||||||
|
<div className="ml-auto flex items-center gap-1">
|
||||||
|
{tooltip(timelineCollapsed ? t('multitrack.showTimeline') : t('multitrack.hideTimeline'), <Button type="button" variant="ghost" size="icon" className={ICON_BUTTON_CLASS} aria-label={timelineCollapsed ? t('multitrack.showTimeline') : t('multitrack.hideTimeline')} onClick={() => setTimelineCollapsed((collapsed) => !collapsed)}>{timelineCollapsed ? <Maximize2 /> : <Minimize2 />}</Button>)}
|
||||||
|
<ZoomOut className="size-3.5 text-muted-foreground" />
|
||||||
|
<Slider min={1} max={6} step={0.25} value={[zoom]} onValueChange={([next]) => setZoom(next)} className="h-3 w-12" aria-label={t('multitrack.timelineZoom')} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
ref={timelineContainerRef}
|
||||||
|
className={`no-scrollbar h-[104px] shrink-0 overflow-x-auto overflow-y-hidden bg-muted/20 ${timelineCollapsed ? 'hidden' : ''}`}
|
||||||
|
aria-hidden={timelineCollapsed}
|
||||||
|
>
|
||||||
|
<div style={{ width: scaledTimelineWidth, minWidth: '100%' }}>
|
||||||
|
<MultiTrackRuler totalLength={total} frameRate={data.frame_rate} width={scaledTimelineWidth} canvasScale={canvasScale} currentTime={currentFrame} taskMarkers={[]} selectedTaskMarkerId={null} onSeek={seek} onSelectTaskMarker={() => {}} onMoveTaskMarker={() => {}} onDeleteTaskMarker={() => {}} />
|
||||||
|
<div className="relative h-20" style={{ width: scaledTimelineWidth }}>
|
||||||
|
<div className="absolute top-2 flex h-14 overflow-hidden rounded-sm border border-border bg-muted/40" style={{ left: MULTITRACK_LEFT_GUTTER, width: playableWidth }}>
|
||||||
|
{data.clips.filter((clip) => clip.enabled !== false).map((clip) => {
|
||||||
|
const selected = selectedClipId === clip.id
|
||||||
|
const blockClassName = `h-full min-w-0 shrink-0 rounded-none border-r border-border px-2 ${selected ? 'bg-primary/20 ring-1 ring-inset ring-primary' : 'bg-secondary/40 hover:bg-secondary/60'}`
|
||||||
|
const blockStyle = { width: `${(clipDuration(clip) / Math.max(total, 1)) * 100}%` }
|
||||||
|
const label = (
|
||||||
|
<div className="flex min-w-0 flex-col items-center leading-tight">
|
||||||
|
<span className="truncate text-[11px] font-medium">{t('projectVideoCombine.clipLabel', { number: clip.index + 1 })}</span>
|
||||||
|
<span className="truncate text-[9px] text-muted-foreground">
|
||||||
|
{t('projectVideoCombine.clipContinuity', {
|
||||||
|
mode: t(clip.continuity_mode === 'shot'
|
||||||
|
? 'projectVideoCombine.continuityShot'
|
||||||
|
: clip.continuity_mode === 'context_swap'
|
||||||
|
? 'projectVideoCombine.continuityContextSwap'
|
||||||
|
: 'projectVideoCombine.continuityContext'),
|
||||||
|
})}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
const selectedPaths = selectedFilePaths(clip)
|
||||||
|
return (
|
||||||
|
<Popover key={clip.id} onOpenChange={(open) => { if (open) selectClip(clip) }}>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
<Button type="button" variant="ghost" className={`${blockClassName} relative justify-center`} style={blockStyle} aria-label={t('projectVideoCombine.selectClipFiles', { number: clip.index + 1 })}>
|
||||||
|
{label}
|
||||||
|
<span className="absolute right-2 flex items-center gap-0.5 text-[9px] text-muted-foreground">
|
||||||
|
{selectedPaths.length > 1 ? selectedPaths.length : null}
|
||||||
|
<ChevronDown className="size-3" />
|
||||||
|
</span>
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-64 p-1" align="center">
|
||||||
|
<div className="px-2 py-1 text-[10px] text-muted-foreground">{t('projectVideoCombine.selectClipFilesHint')}</div>
|
||||||
|
{projectVideoFiles(clip).map((file) => {
|
||||||
|
const checked = selectedPaths.includes(file.file_path)
|
||||||
|
const disabled = deletingFilePath !== null || (!checked && selectedPaths.length >= 2)
|
||||||
|
return (
|
||||||
|
<div key={file.file_path} className="flex items-center gap-1">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="ghost"
|
||||||
|
role="checkbox"
|
||||||
|
aria-checked={checked}
|
||||||
|
disabled={disabled}
|
||||||
|
className={cn('h-8 min-w-0 flex-1 justify-start gap-2 px-2 text-xs', disabled && 'opacity-50')}
|
||||||
|
onClick={() => toggleClipFile(clip, file.file_path)}
|
||||||
|
>
|
||||||
|
<span className={cn('flex size-4 shrink-0 items-center justify-center rounded-sm border border-border', checked && 'border-primary bg-primary text-primary-foreground')}>
|
||||||
|
{checked ? <Check className="size-3" /> : null}
|
||||||
|
</span>
|
||||||
|
<span className="truncate">{file.file_name}</span>
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
className="size-7 shrink-0 text-destructive hover:text-destructive"
|
||||||
|
disabled={deletingFilePath !== null || isDeleting || isRefreshing}
|
||||||
|
aria-label={t('projectVideoCombine.deleteClipFile', { file: file.file_name })}
|
||||||
|
title={t('projectVideoCombine.deleteClipFile', { file: file.file_name })}
|
||||||
|
onPointerDown={(event) => event.stopPropagation()}
|
||||||
|
onKeyDown={(event) => event.stopPropagation()}
|
||||||
|
onClick={(event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
|
void deleteClipFile(clip, file)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{deletingFilePath === file.file_path ? <Loader2 className="size-3.5 animate-spin" /> : <Trash2 className="size-3.5" />}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
<div className="pointer-events-none absolute top-0 h-20 w-px bg-destructive" style={{ left: playheadLeft }} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</TooltipProvider>
|
||||||
|
</LocaleContext.Provider>
|
||||||
|
)
|
||||||
|
}
|
||||||
226
frontend/src/components/widgets/PromptEnhancerAccountBar.tsx
Normal file
@ -0,0 +1,226 @@
|
|||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
import { KeyRound, LoaderCircle } from 'lucide-react'
|
||||||
|
import { Button } from '@/components/ui/button'
|
||||||
|
import { Badge } from '@/components/ui/badge'
|
||||||
|
import { LocaleContext, useT } from '@/lib/i18n'
|
||||||
|
import {
|
||||||
|
getPromptEnhancerAccountProvider,
|
||||||
|
loadPromptEnhancerBalance,
|
||||||
|
type PromptEnhancerBalance,
|
||||||
|
} from '@/lib/prompt-enhancer-account'
|
||||||
|
import {
|
||||||
|
readPromptEnhancerAccountSelection,
|
||||||
|
type PromptEnhancerAccountNode,
|
||||||
|
} from '@/lib/prompt-enhancer-account-node'
|
||||||
|
import type { ReactWidgetProps } from '@/lib/create-react-widget'
|
||||||
|
|
||||||
|
interface PromptEnhancerAccountBarProps {
|
||||||
|
apiKey: string
|
||||||
|
locale?: string
|
||||||
|
modelName: string
|
||||||
|
refreshToken?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
function openExternal(url: string): void {
|
||||||
|
globalThis.open(url, '_blank', 'noopener,noreferrer')
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatBalance(balance: PromptEnhancerBalance, locale?: string): string {
|
||||||
|
try {
|
||||||
|
return new Intl.NumberFormat(locale || undefined, {
|
||||||
|
style: 'currency',
|
||||||
|
currency: balance.currency,
|
||||||
|
minimumFractionDigits: 2,
|
||||||
|
maximumFractionDigits: 2,
|
||||||
|
}).format(balance.amount)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[PromptEnhancerAccountBar] failed to format balance:', error)
|
||||||
|
return `${balance.amount.toFixed(2)} ${balance.currency}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function PromptEnhancerAccountBarContent({
|
||||||
|
apiKey,
|
||||||
|
locale,
|
||||||
|
modelName,
|
||||||
|
refreshToken = 0,
|
||||||
|
}: Readonly<PromptEnhancerAccountBarProps>) {
|
||||||
|
const t = useT()
|
||||||
|
const provider = getPromptEnhancerAccountProvider(modelName)
|
||||||
|
const [balance, setBalance] = useState<PromptEnhancerBalance | null>(null)
|
||||||
|
const [balanceError, setBalanceError] = useState(false)
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const balanceRequest = provider.balanceRequest
|
||||||
|
const trimmedApiKey = apiKey.trim()
|
||||||
|
setBalance(null)
|
||||||
|
setBalanceError(false)
|
||||||
|
setLoading(Boolean(balanceRequest))
|
||||||
|
if (!balanceRequest) return
|
||||||
|
|
||||||
|
let cancelled = false
|
||||||
|
const loadBalance = async () => {
|
||||||
|
try {
|
||||||
|
const nextBalance = await loadPromptEnhancerBalance(provider, trimmedApiKey)
|
||||||
|
if (!cancelled) setBalance(nextBalance)
|
||||||
|
} catch (error) {
|
||||||
|
if (cancelled) return
|
||||||
|
console.error('[PromptEnhancerAccountBar] failed to load balance:', error)
|
||||||
|
setBalanceError(true)
|
||||||
|
} finally {
|
||||||
|
if (!cancelled) setLoading(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void loadBalance()
|
||||||
|
return () => {
|
||||||
|
cancelled = true
|
||||||
|
}
|
||||||
|
}, [apiKey, provider, refreshToken])
|
||||||
|
|
||||||
|
if (provider.id === 'local') {
|
||||||
|
return (
|
||||||
|
<div className="flex h-[30px] items-center border-t border-border px-2 text-[10px] text-muted-foreground">
|
||||||
|
{t('promptEnhancerAccount.localModel')}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const renderBalance = () => {
|
||||||
|
if (!provider.balanceRequest) {
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
className="h-6 px-1.5 text-[10px] cursor-pointer"
|
||||||
|
onClick={() => provider.balancePageUrl && openExternal(provider.balancePageUrl)}
|
||||||
|
size="sm"
|
||||||
|
type="button"
|
||||||
|
variant="link"
|
||||||
|
>
|
||||||
|
{t('promptEnhancerAccount.viewBalance')}
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<Badge className="h-5 gap-1 px-1.5 text-[10px]" variant="outline">
|
||||||
|
<LoaderCircle className="size-3 animate-spin" />
|
||||||
|
{t('promptEnhancerAccount.loadingBalance')}
|
||||||
|
</Badge>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (balance) {
|
||||||
|
return (
|
||||||
|
<Badge className="h-5 max-w-full truncate px-1.5 text-[10px] cursor-pointer" title={formatBalance(balance, locale)} variant="secondary" onClick={() => provider.balancePageUrl && openExternal(provider.balancePageUrl)}>
|
||||||
|
{t('promptEnhancerAccount.balance', { amount: formatBalance(balance, locale) })}
|
||||||
|
</Badge>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const label = balanceError
|
||||||
|
? t('promptEnhancerAccount.balanceUnavailable')
|
||||||
|
: t('promptEnhancerAccount.apiKeyRequired')
|
||||||
|
return (
|
||||||
|
<Badge className="h-5 px-1.5 text-[10px]" title={label} variant="outline">
|
||||||
|
{t('promptEnhancerAccount.balanceEmpty')}
|
||||||
|
</Badge>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex h-[30px] min-w-0 items-center justify-between gap-2">
|
||||||
|
<div className="min-w-0">{renderBalance()}</div>
|
||||||
|
{provider.apiKeyPageUrl ? (
|
||||||
|
<Button
|
||||||
|
className="h-6 shrink-0 px-1.5 text-[10px] cursor-pointer"
|
||||||
|
onClick={() => provider.apiKeyPageUrl && openExternal(provider.apiKeyPageUrl)}
|
||||||
|
size="sm"
|
||||||
|
type="button"
|
||||||
|
variant="outline"
|
||||||
|
>
|
||||||
|
<KeyRound className="size-1" />
|
||||||
|
{t('promptEnhancerAccount.apiKey')}
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function PromptEnhancerAccountBar(props: Readonly<PromptEnhancerAccountBarProps>) {
|
||||||
|
return (
|
||||||
|
<LocaleContext.Provider value={props.locale}>
|
||||||
|
<PromptEnhancerAccountBarContent {...props} />
|
||||||
|
</LocaleContext.Provider>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function PromptEnhancerAccountWidget({
|
||||||
|
app,
|
||||||
|
node,
|
||||||
|
}: Readonly<ReactWidgetProps<string>>) {
|
||||||
|
const accountNode = node as PromptEnhancerAccountNode
|
||||||
|
const [selection, setSelection] = useState(() => readPromptEnhancerAccountSelection(accountNode))
|
||||||
|
const [refreshToken, setRefreshToken] = useState(0)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let active = true
|
||||||
|
const originalOnConfigure = accountNode.onConfigure
|
||||||
|
const originalOnExecuted = accountNode.onExecuted
|
||||||
|
const originalOnWidgetChanged = accountNode.onWidgetChanged
|
||||||
|
|
||||||
|
const syncSelection = () => {
|
||||||
|
queueMicrotask(() => {
|
||||||
|
if (!active) return
|
||||||
|
const next = readPromptEnhancerAccountSelection(accountNode)
|
||||||
|
setSelection((current) => (
|
||||||
|
current.modelName === next.modelName && current.apiKey === next.apiKey
|
||||||
|
? current
|
||||||
|
: next
|
||||||
|
))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const wrappedOnConfigure = function (this: unknown, serialisedNode: unknown) {
|
||||||
|
originalOnConfigure?.call(this, serialisedNode)
|
||||||
|
syncSelection()
|
||||||
|
}
|
||||||
|
const wrappedOnExecuted = function (this: unknown, output: unknown) {
|
||||||
|
originalOnExecuted?.call(this, output)
|
||||||
|
const current = readPromptEnhancerAccountSelection(accountNode)
|
||||||
|
if (getPromptEnhancerAccountProvider(current.modelName).id === 'runninghub') {
|
||||||
|
setRefreshToken((token) => token + 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const wrappedOnWidgetChanged = function (
|
||||||
|
this: unknown,
|
||||||
|
name: string,
|
||||||
|
value: unknown,
|
||||||
|
oldValue: unknown,
|
||||||
|
widget: unknown,
|
||||||
|
) {
|
||||||
|
originalOnWidgetChanged?.call(this, name, value, oldValue, widget)
|
||||||
|
if (name === 'model' || name === 'model.model' || name === 'model.apikey' || name === 'apikey') {
|
||||||
|
syncSelection()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
accountNode.onConfigure = wrappedOnConfigure
|
||||||
|
accountNode.onExecuted = wrappedOnExecuted
|
||||||
|
accountNode.onWidgetChanged = wrappedOnWidgetChanged
|
||||||
|
syncSelection()
|
||||||
|
return () => {
|
||||||
|
active = false
|
||||||
|
if (accountNode.onConfigure === wrappedOnConfigure) accountNode.onConfigure = originalOnConfigure
|
||||||
|
if (accountNode.onExecuted === wrappedOnExecuted) accountNode.onExecuted = originalOnExecuted
|
||||||
|
if (accountNode.onWidgetChanged === wrappedOnWidgetChanged) {
|
||||||
|
accountNode.onWidgetChanged = originalOnWidgetChanged
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [accountNode])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PromptEnhancerAccountBar
|
||||||
|
apiKey={selection.apiKey}
|
||||||
|
locale={app?.ui?.settings?.settingsValues?.['Comfy.Locale']}
|
||||||
|
modelName={selection.modelName}
|
||||||
|
refreshToken={refreshToken}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
374
frontend/src/components/widgets/SamplingPreviewWidget.tsx
Normal file
@ -0,0 +1,374 @@
|
|||||||
|
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||||
|
import type { ComfyApp } from '@comfyorg/comfyui-frontend-types'
|
||||||
|
import { Eye, EyeOff } from 'lucide-react'
|
||||||
|
import { Button } from '@/components/ui/button'
|
||||||
|
import {
|
||||||
|
useSamplingPreviewFrames,
|
||||||
|
useSamplingPreviewPlayback,
|
||||||
|
type SamplingPreviewFrame,
|
||||||
|
} from '@/hooks/use-sampling-preview-progress'
|
||||||
|
import { LocaleContext, useT } from '@/lib/i18n'
|
||||||
|
|
||||||
|
export const SAMPLING_PREVIEW_EVENT = 'easy_media.sampling_preview'
|
||||||
|
const EXECUTION_START_EVENT = 'execution_start'
|
||||||
|
|
||||||
|
export interface SamplingPreviewPayload {
|
||||||
|
node_id: string
|
||||||
|
display_node_id?: string
|
||||||
|
prompt_id: string | null
|
||||||
|
image: string
|
||||||
|
images?: string[]
|
||||||
|
mime: string
|
||||||
|
step: number
|
||||||
|
total: number
|
||||||
|
fps: number | null
|
||||||
|
frame_count: number
|
||||||
|
segment_index: number
|
||||||
|
sampling_pass: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SamplingPreviewWidgetProps {
|
||||||
|
app: ComfyApp
|
||||||
|
nodeId: string | number | (() => string | number)
|
||||||
|
executionRevision?: number
|
||||||
|
onVisibilityChange?: (visible: boolean) => void
|
||||||
|
interactive?: boolean
|
||||||
|
visibilityControlOnly?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
function terminalNodeId(value: string | number | undefined) {
|
||||||
|
return value === undefined ? '' : String(value).split(':').at(-1)?.split('.').at(-1)
|
||||||
|
}
|
||||||
|
|
||||||
|
function eventTargetsNode(
|
||||||
|
payload: SamplingPreviewPayload,
|
||||||
|
nodeId: string | number | (() => string | number),
|
||||||
|
) {
|
||||||
|
const currentNodeId = typeof nodeId === 'function' ? nodeId() : nodeId
|
||||||
|
return [payload.display_node_id, payload.node_id]
|
||||||
|
.some((candidate) => terminalNodeId(candidate) === String(currentNodeId))
|
||||||
|
}
|
||||||
|
|
||||||
|
function previewBlob(image: string, mime: string) {
|
||||||
|
const binary = atob(image)
|
||||||
|
const bytes = new Uint8Array(binary.length)
|
||||||
|
for (let index = 0; index < binary.length; index += 1) {
|
||||||
|
bytes[index] = binary.charCodeAt(index)
|
||||||
|
}
|
||||||
|
return new Blob([bytes], { type: mime || 'image/jpeg' })
|
||||||
|
}
|
||||||
|
|
||||||
|
function PreviewCanvas({ frame, label }: { frame: SamplingPreviewFrame, label: string }) {
|
||||||
|
const canvasRef = useRef<HTMLCanvasElement>(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const canvas = canvasRef.current
|
||||||
|
if (!canvas) return
|
||||||
|
canvas.width = frame.bitmap.width
|
||||||
|
canvas.height = frame.bitmap.height
|
||||||
|
const context = canvas.getContext('2d')
|
||||||
|
if (!context) {
|
||||||
|
console.error('[SamplingPreviewWidget] 2D canvas context is unavailable')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
context.drawImage(frame.bitmap, 0, 0)
|
||||||
|
}, [frame])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<canvas
|
||||||
|
ref={canvasRef}
|
||||||
|
role="img"
|
||||||
|
aria-label={label}
|
||||||
|
className="absolute inset-0 h-full w-full object-contain"
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function SamplingPreviewWidgetInner({
|
||||||
|
app,
|
||||||
|
nodeId,
|
||||||
|
executionRevision = 0,
|
||||||
|
onVisibilityChange,
|
||||||
|
interactive = true,
|
||||||
|
visibilityControlOnly = false,
|
||||||
|
}: SamplingPreviewWidgetProps) {
|
||||||
|
const t = useT()
|
||||||
|
const [preview, setPreview] = useState<SamplingPreviewPayload | null>(null)
|
||||||
|
const [pausedPreview, setPausedPreview] = useState<SamplingPreviewPayload | null>(null)
|
||||||
|
const [previewUrl, setPreviewUrl] = useState('')
|
||||||
|
const [legacyPreviewUrls, setLegacyPreviewUrls] = useState<string[]>([])
|
||||||
|
const [isPlaying, setIsPlaying] = useState(true)
|
||||||
|
const [isPreviewVisible, setIsPreviewVisible] = useState(true)
|
||||||
|
const [frozenFallbackUrl, setFrozenFallbackUrl] = useState('')
|
||||||
|
const fallbackImageRef = useRef<HTMLImageElement>(null)
|
||||||
|
const frozenFallbackCanvasRef = useRef<HTMLCanvasElement>(null)
|
||||||
|
const activePromptIdRef = useRef<string | null>(null)
|
||||||
|
const playbackInteractive = interactive && !visibilityControlOnly
|
||||||
|
const visibilityInteractive = interactive || visibilityControlOnly
|
||||||
|
const displayedPreview = isPlaying ? preview : (pausedPreview ?? preview)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleExecutionStart = (event: CustomEvent<unknown>) => {
|
||||||
|
const detail = event.detail
|
||||||
|
activePromptIdRef.current = detail && typeof detail === 'object'
|
||||||
|
&& 'prompt_id' in detail && typeof detail.prompt_id === 'string'
|
||||||
|
? detail.prompt_id
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
const handlePreview = (event: CustomEvent<unknown>) => {
|
||||||
|
const payload = event.detail as SamplingPreviewPayload | undefined
|
||||||
|
if (!payload?.image || !eventTargetsNode(payload, nodeId)) return
|
||||||
|
if (
|
||||||
|
activePromptIdRef.current !== null
|
||||||
|
&& payload.prompt_id !== activePromptIdRef.current
|
||||||
|
) return
|
||||||
|
setPreview(payload)
|
||||||
|
}
|
||||||
|
app.api.addCustomEventListener(EXECUTION_START_EVENT, handleExecutionStart)
|
||||||
|
app.api.addCustomEventListener(SAMPLING_PREVIEW_EVENT, handlePreview)
|
||||||
|
return () => {
|
||||||
|
app.api.removeCustomEventListener(EXECUTION_START_EVENT, handleExecutionStart)
|
||||||
|
app.api.removeCustomEventListener(SAMPLING_PREVIEW_EVENT, handlePreview)
|
||||||
|
}
|
||||||
|
}, [app.api, nodeId])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setPreview(null)
|
||||||
|
setPausedPreview(null)
|
||||||
|
setIsPlaying(true)
|
||||||
|
setFrozenFallbackUrl('')
|
||||||
|
}, [executionRevision])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
onVisibilityChange?.(preview !== null)
|
||||||
|
}, [onVisibilityChange, preview])
|
||||||
|
|
||||||
|
const previewData = useMemo(
|
||||||
|
() => displayedPreview ? previewBlob(displayedPreview.image, displayedPreview.mime) : null,
|
||||||
|
[displayedPreview],
|
||||||
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!previewData) {
|
||||||
|
setPreviewUrl('')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const nextUrl = URL.createObjectURL(previewData)
|
||||||
|
setPreviewUrl(nextUrl)
|
||||||
|
return () => URL.revokeObjectURL(nextUrl)
|
||||||
|
}, [previewData])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const legacyImages = displayedPreview?.images ?? []
|
||||||
|
if (legacyImages.length === 0) {
|
||||||
|
setLegacyPreviewUrls([])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const nextUrls = legacyImages.map((image) => URL.createObjectURL(
|
||||||
|
previewBlob(image, 'image/jpeg'),
|
||||||
|
))
|
||||||
|
setLegacyPreviewUrls(nextUrls)
|
||||||
|
return () => nextUrls.forEach((url) => URL.revokeObjectURL(url))
|
||||||
|
}, [displayedPreview])
|
||||||
|
|
||||||
|
const decodedFrames = useSamplingPreviewFrames(
|
||||||
|
previewData,
|
||||||
|
displayedPreview?.image,
|
||||||
|
playbackInteractive,
|
||||||
|
)
|
||||||
|
const playbackFrameCount = legacyPreviewUrls.length
|
||||||
|
|| displayedPreview?.frame_count
|
||||||
|
|| decodedFrames.length
|
||||||
|
const playbackRevision = displayedPreview
|
||||||
|
? `${displayedPreview.segment_index}:${displayedPreview.sampling_pass}:${displayedPreview.frame_count}:${displayedPreview.fps}`
|
||||||
|
: undefined
|
||||||
|
|
||||||
|
const { frameIndex, progress: playbackProgress } = useSamplingPreviewPlayback(
|
||||||
|
playbackRevision,
|
||||||
|
playbackFrameCount,
|
||||||
|
displayedPreview?.fps ?? null,
|
||||||
|
isPlaying,
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!displayedPreview) return null
|
||||||
|
const passLabel = t(`samplingPreview.${displayedPreview.sampling_pass}`)
|
||||||
|
const decodedFrameIndex = decodedFrames.length <= 1 || playbackFrameCount <= 1
|
||||||
|
? 0
|
||||||
|
: Math.min(
|
||||||
|
decodedFrames.length - 1,
|
||||||
|
Math.floor(frameIndex / playbackFrameCount * decodedFrames.length),
|
||||||
|
)
|
||||||
|
const decodedFrame = decodedFrames[decodedFrameIndex]
|
||||||
|
const legacyPreviewUrl = legacyPreviewUrls[
|
||||||
|
Math.min(frameIndex, legacyPreviewUrls.length - 1)
|
||||||
|
]
|
||||||
|
const usesAnimatedImageFallback = (
|
||||||
|
displayedPreview.mime === 'image/webp'
|
||||||
|
&& legacyPreviewUrls.length === 0
|
||||||
|
&& decodedFrame === undefined
|
||||||
|
)
|
||||||
|
const freezeAnimatedFallback = () => {
|
||||||
|
if (!usesAnimatedImageFallback) return
|
||||||
|
const image = fallbackImageRef.current
|
||||||
|
const canvas = frozenFallbackCanvasRef.current
|
||||||
|
if (!image?.complete || image.naturalWidth <= 0 || image.naturalHeight <= 0 || !canvas) return
|
||||||
|
canvas.width = image.naturalWidth
|
||||||
|
canvas.height = image.naturalHeight
|
||||||
|
const context = canvas.getContext('2d')
|
||||||
|
if (!context) {
|
||||||
|
console.error('[SamplingPreviewWidget] 2D canvas context is unavailable')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
context.drawImage(image, 0, 0)
|
||||||
|
setFrozenFallbackUrl(previewUrl)
|
||||||
|
}
|
||||||
|
const togglePlayback = () => {
|
||||||
|
if (isPlaying) {
|
||||||
|
freezeAnimatedFallback()
|
||||||
|
setPausedPreview(preview)
|
||||||
|
setIsPlaying(false)
|
||||||
|
} else {
|
||||||
|
setPausedPreview(null)
|
||||||
|
setIsPlaying(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const playbackLabel = t(isPlaying ? 'samplingPreview.pausePreview' : 'samplingPreview.resumePreview')
|
||||||
|
const metaLabel = t('samplingPreview.meta', {
|
||||||
|
segment: displayedPreview.segment_index + 1,
|
||||||
|
pass: passLabel,
|
||||||
|
step: displayedPreview.step,
|
||||||
|
total: displayedPreview.total,
|
||||||
|
})
|
||||||
|
const progressBar = (
|
||||||
|
<div
|
||||||
|
role="progressbar"
|
||||||
|
aria-label={t('samplingPreview.playbackProgress')}
|
||||||
|
aria-valuemin={0}
|
||||||
|
aria-valuemax={100}
|
||||||
|
aria-valuenow={Math.round(playbackProgress)}
|
||||||
|
className="h-1.5 w-full overflow-hidden rounded-full bg-muted"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="h-full rounded-full bg-primary"
|
||||||
|
style={{ width: `${playbackProgress}%` }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="relative flex h-full w-full flex-col overflow-hidden rounded-lg border border-border bg-black">
|
||||||
|
{isPreviewVisible ? (
|
||||||
|
playbackInteractive ? (
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="ghost"
|
||||||
|
aria-label={playbackLabel}
|
||||||
|
onClick={togglePlayback}
|
||||||
|
className="relative min-h-0 flex-1 rounded-none p-0 hover:bg-black"
|
||||||
|
>
|
||||||
|
{legacyPreviewUrl ? (
|
||||||
|
<img
|
||||||
|
src={legacyPreviewUrl}
|
||||||
|
alt={t('samplingPreview.title')}
|
||||||
|
draggable={false}
|
||||||
|
className="absolute inset-0 h-full w-full object-contain"
|
||||||
|
/>
|
||||||
|
) : decodedFrame ? (
|
||||||
|
<PreviewCanvas
|
||||||
|
frame={decodedFrame}
|
||||||
|
label={t('samplingPreview.title')}
|
||||||
|
/>
|
||||||
|
) : previewUrl ? (
|
||||||
|
<>
|
||||||
|
<img
|
||||||
|
ref={fallbackImageRef}
|
||||||
|
src={previewUrl}
|
||||||
|
alt={t('samplingPreview.title')}
|
||||||
|
draggable={false}
|
||||||
|
onLoad={() => {
|
||||||
|
if (!isPlaying && !frozenFallbackUrl) freezeAnimatedFallback()
|
||||||
|
}}
|
||||||
|
className="absolute inset-0 h-full w-full object-contain"
|
||||||
|
/>
|
||||||
|
<canvas
|
||||||
|
ref={frozenFallbackCanvasRef}
|
||||||
|
data-testid="sampling-preview-frozen-frame"
|
||||||
|
aria-hidden="true"
|
||||||
|
hidden={isPlaying || !frozenFallbackUrl}
|
||||||
|
className="absolute inset-0 h-full w-full object-contain"
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
<div className="relative min-h-0 flex-1">
|
||||||
|
{legacyPreviewUrl ? (
|
||||||
|
<img
|
||||||
|
src={legacyPreviewUrl}
|
||||||
|
alt={t('samplingPreview.title')}
|
||||||
|
draggable={false}
|
||||||
|
className="absolute inset-0 h-full w-full object-contain"
|
||||||
|
/>
|
||||||
|
) : previewUrl ? (
|
||||||
|
<img
|
||||||
|
src={previewUrl}
|
||||||
|
alt={t('samplingPreview.title')}
|
||||||
|
draggable={false}
|
||||||
|
className="absolute inset-0 h-full w-full object-contain"
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
<div
|
||||||
|
data-testid="sampling-preview-placeholder"
|
||||||
|
aria-hidden="true"
|
||||||
|
className="min-h-0 flex-1 bg-black"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<div className="shrink-0 border-t border-border bg-background px-2 py-1 gap-0">
|
||||||
|
<div className="flex items-center justify-between text-[10px] text-muted-foreground">
|
||||||
|
<span>{metaLabel}</span>
|
||||||
|
{visibilityInteractive ? (
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
aria-label={t(
|
||||||
|
isPreviewVisible
|
||||||
|
? 'samplingPreview.hidePreview'
|
||||||
|
: 'samplingPreview.showPreview',
|
||||||
|
)}
|
||||||
|
onClick={() => setIsPreviewVisible((visible) => !visible)}
|
||||||
|
className="pointer-events-auto h-6 w-6"
|
||||||
|
>
|
||||||
|
{isPreviewVisible ? <EyeOff /> : <Eye />}
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
{playbackInteractive ? (
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="ghost"
|
||||||
|
aria-label={playbackLabel}
|
||||||
|
onClick={togglePlayback}
|
||||||
|
className="h-3 w-full rounded-full p-0 hover:bg-muted"
|
||||||
|
>
|
||||||
|
{progressBar}
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
<div className="h-3 w-full rounded-full p-0">{progressBar}</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SamplingPreviewWidget(props: SamplingPreviewWidgetProps) {
|
||||||
|
const locale = props.app?.ui?.settings?.settingsValues?.['Comfy.Locale']
|
||||||
|
return (
|
||||||
|
<LocaleContext.Provider value={locale}>
|
||||||
|
<SamplingPreviewWidgetInner {...props} />
|
||||||
|
</LocaleContext.Provider>
|
||||||
|
)
|
||||||
|
}
|
||||||