MMnode/frontend/src/index.ts
Z User 8ede97ab11 feat: revert editor to pristine upstream, drop format label mapping and T2V==R2V, fix editor delivery
- frontend/src + messages restored byte-identical to upstream v1.3.3:
  format normalization shims, isMoxieEditorFormat gates, bundle marker,
  tooltip reword, and their tests all removed; editor bundle rebuilt from
  that pristine source so the editor behaves exactly like upstream
- format combo shows 'MiniMax' again (options=[MiniMax]); legacy queued
  'Moxie Multimedia' values still normalized to MiniMax at execution
- T2V resolves natively again: t2v stays t2v in h3_task_type,
  _multitrack_task_type and getMultiTrackTaskType; generation-mode t2v
  mapping and the zero-media cloud fallback removed (upstream behavior);
  Python tests and stub scripts updated accordingly
- editor delivery fix: core lets WEB_DIRECTORY overwrite the pack's
  EXTENSION_WEB_DIRS entry, so the /extensions listing never contained
  dist/release and a fresh browser never imported the editor (it only
  ever appeared from stale browser cache). web/js/editor-loader.js now
  imports the editor entry from the pack's own static mount, which
  serves index.js with no-cache (chunks stay cacheable); the
  /extensions/<pack>/index.js route was removed as a 404 trap
- shipped Moxie*.json templates carry format value MiniMax

Verified: frontend diff vs upstream = 0; bundle string checks + chunk
refs; vitest 565/566 (same pre-existing jsdom URL.revokeObjectURL env
failure); py_compile; test_t2v_r2v_and_loader.py ALL PASS;
test_rtx_upscale_integration.py ALL PASS
2026-09-27 21:24:56 +00:00

130 lines
4.7 KiB
TypeScript

import { addInlineStyles } from "@/lib/add-stylesheet";
import { getEasyMediaSyncPlayMenuItems, installEasyMediaSyncPlay } from "@/lib/sync-play";
import { preserveTimelineEditorNodeSize } from "@/lib/timeline-node-size";
import { preserveMultiImagesLoaderNodeSize } from '@/lib/multi-images-loader-node-size'
import { preserveCompareVideoNodeSize } from "@/lib/compare-video-node-size";
import { preserveVideoCombineNodeSize } from '@/lib/project-video-combine-node-size';
import type { ComfyApp } from '@comfyorg/comfyui-frontend-types'
import type { TimelineData } from '@/types/timeline'
import type { TrackData } from '@/types/multitrack'
import type { ImageData } from '@/components/widgets/MultiImagesLoaderWidget'
import type { CompareVideoSettings } from '@/components/widgets/compareVideoWidget'
import type { ProjectData } from '@/types/project'
import { DEFAULT_PROJECT_DATA } from '@/types/project'
import { suppressCompareVideoDefaultPreview } from '@/lib/compare-video-node'
import { installWorkflowSubmission } from '@/lib/workflow-submission'
import { installProjectSamplingPreview } from '@/lib/project-sampling-preview-node'
declare const __COMFY_EASY_MEDIA_GLOBAL_CSS__: string;
declare global {
// eslint-disable-next-line no-var
var comfyAPI: { app: { app: ComfyApp } } | undefined
}
const [
{ createReactWidget },
{ TimelineWidget, MultiTrackWidget, MultiImagesLoaderWidget, CompareVideoWidget, PromptEnhancerAccountWidget, ProjectVideoCombineWidget },
{ createDefaultTimelineData },
{ createDefaultTrackData },
] = await Promise.all([
import('@/lib/create-react-widget'),
import('@/components/widgets'),
import('@/lib/timeline-utils'),
import('@/lib/multitrack-utils'),
]);
const DEFAULT_TIMELINE_VALUE = JSON.stringify(createDefaultTimelineData())
const DEFAULT_TRACK_DATA_VALUE = JSON.stringify(createDefaultTrackData())
const DEFAULT_COMPARE_VIDEO_VALUE = JSON.stringify({
save_output: true,
filename_prefix: 'ComfyUI',
watch_output_history: false,
})
const comfyApp = globalThis.comfyAPI!.app.app
comfyApp.registerExtension({
name: 'Comfy.EasyMedia.widgets',
async setup() {
installWorkflowSubmission(comfyApp)
addInlineStyles(
__COMFY_EASY_MEDIA_GLOBAL_CSS__,
`${import.meta.env.PROJECT_NAME}-globals`,
);
},
beforeRegisterNodeDef(nodeType, nodeData) {
preserveTimelineEditorNodeSize(nodeType, nodeData)
preserveMultiImagesLoaderNodeSize(nodeType, nodeData)
preserveCompareVideoNodeSize(nodeType, nodeData)
preserveVideoCombineNodeSize(nodeType, nodeData)
installEasyMediaSyncPlay(nodeType, nodeData)
suppressCompareVideoDefaultPreview(nodeType, nodeData)
installProjectSamplingPreview(nodeType, nodeData, comfyApp)
},
getNodeMenuItems(node) {
const locale = comfyApp.ui?.settings?.settingsValues?.['Comfy.Locale']
return getEasyMediaSyncPlayMenuItems(node, comfyApp.canvas, locale)
},
getCustomWidgets() {
return {
TIMELINE: createReactWidget<TimelineData>(TimelineWidget, {
defaultValue: DEFAULT_TIMELINE_VALUE,
keepResponsiveWidthInLiteGraph: true,
domWidgetOptions: {
getMinHeight: () => 180,
},
}),
TRACK_DATA: createReactWidget<TrackData>(MultiTrackWidget, {
defaultValue: DEFAULT_TRACK_DATA_VALUE,
keepResponsiveWidthInLiteGraph: true,
domWidgetOptions: {
getMinHeight: () => 320,
},
}),
IMAGE_DATA: createReactWidget<ImageData>(MultiImagesLoaderWidget, {
defaultValue: JSON.stringify({ images: [] }),
keepResponsiveWidthInLiteGraph: true,
domWidgetOptions: {
getMinHeight: () => 320,
hideOnZoom: false,
serialize: true,
},
}),
PROJECT_DATA: createReactWidget<ProjectData>(ProjectVideoCombineWidget, {
defaultValue: JSON.stringify(DEFAULT_PROJECT_DATA),
keepResponsiveWidthInLiteGraph: true,
domWidgetOptions: {
getMinHeight: () => 520,
hideOnZoom: false,
serialize: true,
},
}),
EASY_COMPARE_VIDEO: createReactWidget<CompareVideoSettings>(CompareVideoWidget, {
defaultValue: DEFAULT_COMPARE_VIDEO_VALUE,
keepResponsiveWidthInLiteGraph: true,
domWidgetOptions: {
getMinHeight: () => 360,
hideOnZoom: false,
serialize: true,
},
}),
EASY_API_ACCOUNT: createReactWidget<string>(PromptEnhancerAccountWidget, {
defaultValue: '',
keepResponsiveWidthInLiteGraph: true,
height: 44,
domWidgetOptions: {
getMinHeight: () => 44,
getMaxHeight: () => 44,
hideOnZoom: false,
serialize: true,
},
}),
}
},
})