From 5ea337fb51d3c07567ed3985f9cd02084615207d Mon Sep 17 00:00:00 2001 From: Dariusz L Date: Fri, 14 Aug 2026 16:56:46 +0200 Subject: [PATCH] refactor: standardize frontend file naming --- Doc/ARCHITECTURE.md | 16 ++++----- Doc/BUILDING.md | 12 +++---- js/app/{CanvasView.js => canvas_view.js} | 30 ++++++++-------- ...sWidgetTypes.js => canvas_widget_types.js} | 0 ...nections.js => layer_forge_connections.js} | 2 +- ...iewManager.js => batch_preview_manager.js} | 0 js/canvas/{Canvas.js => canvas.js} | 34 +++++++++---------- .../{CanvasHistory.js => canvas_history.js} | 0 ...Interactions.js => canvas_interactions.js} | 6 ++-- .../{CanvasLayers.js => canvas_layers.js} | 16 ++++----- ...sLayersPanel.js => canvas_layers_panel.js} | 6 ++-- .../{CanvasRenderer.js => canvas_renderer.js} | 2 +- ...CanvasSelection.js => canvas_selection.js} | 4 +-- js/canvas/{CanvasState.js => canvas_state.js} | 12 +++---- ...ustomShapeMenu.js => custom_shape_menu.js} | 2 +- js/canvas/{ShapeTool.js => shape_tool.js} | 2 +- js/{CanvasView.js => canvas_view.js} | 2 +- js/io/{CanvasIO.js => canvas_io.js} | 14 ++++---- .../{ImageAnalysis.js => image_analysis.js} | 6 ++-- ...egration.js => mask_editor_integration.js} | 16 ++++----- ...{MaskPixelUtils.js => mask_pixel_utils.js} | 0 ...ssingUtils.js => mask_processing_utils.js} | 4 +-- ...askResultUtils.js => mask_result_utils.js} | 4 +-- js/mask/{MaskTool.js => mask_tool.js} | 4 +-- js/mask/mask_utils.js | 2 +- ...gration.js => sam_detector_integration.js} | 10 +++--- ...anvasBlobUtils.js => canvas_blob_utils.js} | 0 ...sExportUtils.js => canvas_export_utils.js} | 2 +- js/media/{ImageCache.js => image_cache.js} | 0 ...geUploadUtils.js => image_upload_utils.js} | 6 ++-- js/media/{ImageUtils.js => image_utils.js} | 4 +-- .../{PreviewUtils.js => preview_utils.js} | 6 ++-- ...eManager.js => image_reference_manager.js} | 0 ...-saver.worker.js => state_saver.worker.js} | 0 .../{ErrorHandler.js => error_handler.js} | 0 ...vasInputUtils.js => canvas_input_utils.js} | 0 ...{CanvasStateKey.js => canvas_state_key.js} | 2 +- ...ipboardManager.js => clipboard_manager.js} | 8 ++--- .../{ClipspaceUtils.js => clipspace_utils.js} | 0 js/utils/{CommonUtils.js => common_utils.js} | 0 js/utils/{IconLoader.js => icon_loader.js} | 4 +-- ...RemovalUtils.js => layer_removal_utils.js} | 0 .../{MattingUtils.js => matting_utils.js} | 0 ...putUtils.js => multi_image_input_utils.js} | 0 ...ficationUtils.js => notification_utils.js} | 0 ...ResourceManager.js => resource_manager.js} | 2 +- ...SocketManager.js => web_socket_manager.js} | 2 +- package.json | 2 +- src/app/{CanvasView.ts => canvas_view.ts} | 32 ++++++++--------- ...sWidgetTypes.ts => canvas_widget_types.ts} | 2 +- ...nections.ts => layer_forge_connections.ts} | 6 ++-- ...iewManager.ts => batch_preview_manager.ts} | 2 +- src/canvas/{Canvas.ts => canvas.ts} | 34 +++++++++---------- .../{CanvasHistory.ts => canvas_history.ts} | 0 ...Interactions.ts => canvas_interactions.ts} | 8 ++--- .../{CanvasLayers.ts => canvas_layers.ts} | 18 +++++----- ...sLayersPanel.ts => canvas_layers_panel.ts} | 8 ++--- .../{CanvasRenderer.ts => canvas_renderer.ts} | 2 +- ...CanvasSelection.ts => canvas_selection.ts} | 4 +-- .../{CanvasState.ts => canvas_state.ts} | 16 ++++----- ...ustomShapeMenu.ts => custom_shape_menu.ts} | 4 +-- src/canvas/{ShapeTool.ts => shape_tool.ts} | 4 +-- src/{CanvasView.ts => canvas_view.ts} | 2 +- src/io/{CanvasIO.ts => canvas_io.ts} | 16 ++++----- .../{ImageAnalysis.ts => image_analysis.ts} | 6 ++-- ...egration.ts => mask_editor_integration.ts} | 16 ++++----- ...{MaskPixelUtils.ts => mask_pixel_utils.ts} | 0 ...ssingUtils.ts => mask_processing_utils.ts} | 4 +-- ...askResultUtils.ts => mask_result_utils.ts} | 4 +-- src/mask/{MaskTool.ts => mask_tool.ts} | 6 ++-- src/mask/mask_utils.ts | 4 +-- ...gration.ts => sam_detector_integration.ts} | 10 +++--- ...anvasBlobUtils.ts => canvas_blob_utils.ts} | 0 ...sExportUtils.ts => canvas_export_utils.ts} | 2 +- src/media/{ImageCache.ts => image_cache.ts} | 0 ...geUploadUtils.ts => image_upload_utils.ts} | 6 ++-- src/media/{ImageUtils.ts => image_utils.ts} | 4 +-- .../{PreviewUtils.ts => preview_utils.ts} | 6 ++-- ...eManager.ts => image_reference_manager.ts} | 2 +- ...-saver.worker.ts => state_saver.worker.ts} | 0 .../{ErrorHandler.ts => error_handler.ts} | 0 src/shared/types.ts | 4 +-- ...vasInputUtils.ts => canvas_input_utils.ts} | 0 ...{CanvasStateKey.ts => canvas_state_key.ts} | 2 +- ...ipboardManager.ts => clipboard_manager.ts} | 8 ++--- .../{ClipspaceUtils.ts => clipspace_utils.ts} | 0 src/utils/{CommonUtils.ts => common_utils.ts} | 0 src/utils/{IconLoader.ts => icon_loader.ts} | 4 +-- ...RemovalUtils.ts => layer_removal_utils.ts} | 0 .../{MattingUtils.ts => matting_utils.ts} | 0 ...putUtils.ts => multi_image_input_utils.ts} | 0 ...ficationUtils.ts => notification_utils.ts} | 0 ...ResourceManager.ts => resource_manager.ts} | 2 +- ...SocketManager.ts => web_socket_manager.ts} | 2 +- tests/test_app_module_boundaries.mjs | 10 +++--- tests/test_architecture_boundaries.mjs | 6 ++-- tests/test_async_lifecycle_resilience.mjs | 10 +++--- ...tch_and_mask_refactor_characterization.mjs | 4 +-- ...st_blob_image_loading_characterization.mjs | 14 ++++---- tests/test_canvas_blob_characterization.mjs | 14 ++++---- .../test_canvas_context_characterization.mjs | 4 +-- tests/test_canvas_export_characterization.mjs | 2 +- tests/test_canvas_export_utils.mjs | 2 +- tests/test_canvas_history.mjs | 2 +- ...canvas_input_identity_characterization.mjs | 4 +-- ..._canvas_input_options_characterization.mjs | 10 +++--- ...test_canvas_io_tensor_characterization.mjs | 4 +-- ...est_canvas_operations_characterization.mjs | 12 +++---- .../test_canvas_png_blob_characterization.mjs | 4 +-- .../test_canvas_renderer_characterization.mjs | 4 +-- tests/test_canvas_state_key.mjs | 2 +- tests/test_comfyui_integration_contracts.mjs | 12 +++---- tests/test_common_utils.mjs | 2 +- tests/test_db_characterization.mjs | 4 +-- ..._distance_field_cache_characterization.mjs | 2 +- tests/test_error_handler.mjs | 2 +- tests/test_frontend_entrypoint.mjs | 6 ++-- tests/test_image_cache_characterization.mjs | 14 ++++---- tests/test_image_loading_characterization.mjs | 6 ++-- ...st_image_reference_gc_characterization.mjs | 4 +-- tests/test_image_upload_characterization.mjs | 4 +-- ...mage_upload_transport_characterization.mjs | 4 +-- tests/test_image_utils.mjs | 4 +-- .../test_layer_geometry_characterization.mjs | 8 ++--- tests/test_layer_removal_characterization.mjs | 8 ++--- tests/test_log_system.mjs | 2 +- ..._manual_image_loading_characterization.mjs | 10 +++--- tests/test_mask_pixel_characterization.mjs | 24 ++++++------- .../test_mask_processing_characterization.mjs | 4 +-- tests/test_mask_result_characterization.mjs | 16 ++++----- .../test_matting_status_characterization.mjs | 4 +-- ...est_multi_image_input_characterization.mjs | 8 ++--- tests/test_persistence_resilience.mjs | 2 +- tests/test_point_type_characterization.mjs | 2 +- tests/test_preview_characterization.mjs | 2 +- tests/test_source_layout.mjs | 18 +++++----- tests/test_stability_characterization.mjs | 4 +-- ...iant_and_get_all_keys_characterization.mjs | 4 +-- 138 files changed, 391 insertions(+), 391 deletions(-) rename js/app/{CanvasView.js => canvas_view.js} (99%) rename js/app/{CanvasWidgetTypes.js => canvas_widget_types.js} (100%) rename js/app/{LayerForgeConnections.js => layer_forge_connections.js} (99%) rename js/canvas/{BatchPreviewManager.js => batch_preview_manager.js} (100%) rename js/canvas/{Canvas.js => canvas.js} (95%) rename js/canvas/{CanvasHistory.js => canvas_history.js} (100%) rename js/canvas/{CanvasInteractions.js => canvas_interactions.js} (99%) rename js/canvas/{CanvasLayers.js => canvas_layers.js} (99%) rename js/canvas/{CanvasLayersPanel.js => canvas_layers_panel.js} (99%) rename js/canvas/{CanvasRenderer.js => canvas_renderer.js} (99%) rename js/canvas/{CanvasSelection.js => canvas_selection.js} (97%) rename js/canvas/{CanvasState.js => canvas_state.js} (97%) rename js/canvas/{CustomShapeMenu.js => custom_shape_menu.js} (99%) rename js/canvas/{ShapeTool.js => shape_tool.js} (98%) rename js/{CanvasView.js => canvas_view.js} (75%) rename js/io/{CanvasIO.js => canvas_io.js} (99%) rename js/mask/{ImageAnalysis.js => image_analysis.js} (98%) rename js/mask/{MaskEditorIntegration.js => mask_editor_integration.js} (97%) rename js/mask/{MaskPixelUtils.js => mask_pixel_utils.js} (100%) rename js/mask/{MaskProcessingUtils.js => mask_processing_utils.js} (98%) rename js/mask/{MaskResultUtils.js => mask_result_utils.js} (81%) rename js/mask/{MaskTool.js => mask_tool.js} (99%) rename js/mask/{SAMDetectorIntegration.js => sam_detector_integration.js} (98%) rename js/media/{CanvasBlobUtils.js => canvas_blob_utils.js} (100%) rename js/media/{CanvasExportUtils.js => canvas_export_utils.js} (94%) rename js/media/{ImageCache.js => image_cache.js} (100%) rename js/media/{ImageUploadUtils.js => image_upload_utils.js} (97%) rename js/media/{ImageUtils.js => image_utils.js} (99%) rename js/media/{PreviewUtils.js => preview_utils.js} (98%) rename js/persistence/{ImageReferenceManager.js => image_reference_manager.js} (100%) rename js/persistence/{state-saver.worker.js => state_saver.worker.js} (100%) rename js/shared/{ErrorHandler.js => error_handler.js} (100%) rename js/utils/{CanvasInputUtils.js => canvas_input_utils.js} (100%) rename js/utils/{CanvasStateKey.js => canvas_state_key.js} (97%) rename js/utils/{ClipboardManager.js => clipboard_manager.js} (98%) rename js/utils/{ClipspaceUtils.js => clipspace_utils.js} (100%) rename js/utils/{CommonUtils.js => common_utils.js} (100%) rename js/utils/{IconLoader.js => icon_loader.js} (99%) rename js/utils/{LayerRemovalUtils.js => layer_removal_utils.js} (100%) rename js/utils/{MattingUtils.js => matting_utils.js} (100%) rename js/utils/{MultiImageInputUtils.js => multi_image_input_utils.js} (100%) rename js/utils/{NotificationUtils.js => notification_utils.js} (100%) rename js/utils/{ResourceManager.js => resource_manager.js} (97%) rename js/utils/{WebSocketManager.js => web_socket_manager.js} (99%) rename src/app/{CanvasView.ts => canvas_view.ts} (99%) rename src/app/{CanvasWidgetTypes.ts => canvas_widget_types.ts} (67%) rename src/app/{LayerForgeConnections.ts => layer_forge_connections.ts} (99%) rename src/canvas/{BatchPreviewManager.ts => batch_preview_manager.ts} (99%) rename src/canvas/{Canvas.ts => canvas.ts} (96%) rename src/canvas/{CanvasHistory.ts => canvas_history.ts} (100%) rename src/canvas/{CanvasInteractions.ts => canvas_interactions.ts} (99%) rename src/canvas/{CanvasLayers.ts => canvas_layers.ts} (99%) rename src/canvas/{CanvasLayersPanel.ts => canvas_layers_panel.ts} (99%) rename src/canvas/{CanvasRenderer.ts => canvas_renderer.ts} (99%) rename src/canvas/{CanvasSelection.ts => canvas_selection.ts} (97%) rename src/canvas/{CanvasState.ts => canvas_state.ts} (97%) rename src/canvas/{CustomShapeMenu.ts => custom_shape_menu.ts} (99%) rename src/canvas/{ShapeTool.ts => shape_tool.ts} (97%) rename src/{CanvasView.ts => canvas_view.ts} (75%) rename src/io/{CanvasIO.ts => canvas_io.ts} (99%) rename src/mask/{ImageAnalysis.ts => image_analysis.ts} (98%) rename src/mask/{MaskEditorIntegration.ts => mask_editor_integration.ts} (97%) rename src/mask/{MaskPixelUtils.ts => mask_pixel_utils.ts} (100%) rename src/mask/{MaskProcessingUtils.ts => mask_processing_utils.ts} (99%) rename src/mask/{MaskResultUtils.ts => mask_result_utils.ts} (89%) rename src/mask/{MaskTool.ts => mask_tool.ts} (99%) rename src/mask/{SAMDetectorIntegration.ts => sam_detector_integration.ts} (98%) rename src/media/{CanvasBlobUtils.ts => canvas_blob_utils.ts} (100%) rename src/media/{CanvasExportUtils.ts => canvas_export_utils.ts} (98%) rename src/media/{ImageCache.ts => image_cache.ts} (100%) rename src/media/{ImageUploadUtils.ts => image_upload_utils.ts} (97%) rename src/media/{ImageUtils.ts => image_utils.ts} (99%) rename src/media/{PreviewUtils.ts => preview_utils.ts} (98%) rename src/persistence/{ImageReferenceManager.ts => image_reference_manager.ts} (99%) rename src/persistence/{state-saver.worker.ts => state_saver.worker.ts} (100%) rename src/shared/{ErrorHandler.ts => error_handler.ts} (100%) rename src/utils/{CanvasInputUtils.ts => canvas_input_utils.ts} (100%) rename src/utils/{CanvasStateKey.ts => canvas_state_key.ts} (98%) rename src/utils/{ClipboardManager.ts => clipboard_manager.ts} (98%) rename src/utils/{ClipspaceUtils.ts => clipspace_utils.ts} (100%) rename src/utils/{CommonUtils.ts => common_utils.ts} (100%) rename src/utils/{IconLoader.ts => icon_loader.ts} (99%) rename src/utils/{LayerRemovalUtils.ts => layer_removal_utils.ts} (100%) rename src/utils/{MattingUtils.ts => matting_utils.ts} (100%) rename src/utils/{MultiImageInputUtils.ts => multi_image_input_utils.ts} (100%) rename src/utils/{NotificationUtils.ts => notification_utils.ts} (100%) rename src/utils/{ResourceManager.ts => resource_manager.ts} (97%) rename src/utils/{WebSocketManager.ts => web_socket_manager.ts} (99%) diff --git a/Doc/ARCHITECTURE.md b/Doc/ARCHITECTURE.md index d7028c9..2a44e16 100644 --- a/Doc/ARCHITECTURE.md +++ b/Doc/ARCHITECTURE.md @@ -22,17 +22,17 @@ be edited independently. These modules are the main seams between the frontend domains: -- `app/CanvasView.ts` composes the canvas runtime without registering a second +- `app/canvas_view.ts` composes the canvas runtime without registering a second ComfyUI extension as an import side effect. -- `app/LayerForgeConnections.ts` owns graph identity, workflow connections, +- `app/layer_forge_connections.ts` owns graph identity, workflow connections, and ComfyUI event/WebSocket integration. -- `canvas/CanvasHistory.ts` owns bounded undo/redo stacks and snapshot +- `canvas/canvas_history.ts` owns bounded undo/redo stacks and snapshot cloning. -- `io/CanvasIO.ts` owns image input/output transport and render/export +- `io/canvas_io.ts` owns image input/output transport and render/export coordination. -- `media/ImageCache.ts` owns in-memory image identity and cache lifetime; +- `media/image_cache.ts` owns in-memory image identity and cache lifetime; IndexedDB persistence remains under `persistence/`. -- `mask/MaskResultUtils.ts` owns shared mask-result conversion and application; +- `mask/mask_result_utils.ts` owns shared mask-result conversion and application; editor-specific side effects stay in the individual integrations. - `persistence/contracts.ts` owns the shared persisted-state and worker-message contracts used by the database and persistence worker. @@ -54,8 +54,8 @@ The lower-level domains remain independent of application composition: dependencies; - ComfyUI-provided modules under `scripts/` are external runtime dependencies. -The root `src/CanvasView.ts` file is the single served bootstrap. It invokes -the registration function from `src/app/CanvasView.ts`; the implementation +The root `src/canvas_view.ts` file is the single served bootstrap. It invokes +the registration function from `src/app/canvas_view.ts`; the implementation module itself must not register the extension as an import side effect. The dependency rules are covered by `tests/test_architecture_boundaries.mjs`. diff --git a/Doc/BUILDING.md b/Doc/BUILDING.md index 612c9d8..b11de1d 100644 --- a/Doc/BUILDING.md +++ b/Doc/BUILDING.md @@ -35,18 +35,18 @@ The generated files in `js/` are served by ComfyUI. Keep `src/` as the source of The frontend is organized by responsibility: -- `src/CanvasView.ts` is the stable ComfyUI bootstrap. Its implementation is in `src/app/CanvasView.ts`. -- `src/app/LayerForgeConnections.ts` contains graph identity, workflow +- `src/canvas_view.ts` is the stable ComfyUI bootstrap. Its implementation is in `src/app/canvas_view.ts`. +- `src/app/layer_forge_connections.ts` contains graph identity, workflow connections, and ComfyUI event/WebSocket integration used by the canvas. - `src/canvas/` contains the canvas runtime, layers, state, rendering, selection, tools, and interactions. -- `src/canvas/CanvasHistory.ts` contains the bounded undo/redo snapshot model. +- `src/canvas/canvas_history.ts` contains the bounded undo/redo snapshot model. - `src/io/` contains ComfyUI input and output handling. - `src/mask/` contains mask editing, mask algorithms, and detector/editor integrations. -- `src/mask/MaskResultUtils.ts` contains shared mask-result conversion and +- `src/mask/mask_result_utils.ts` contains shared mask-result conversion and application helpers; SAM and matting integrations retain their own side effects. - `src/media/` contains image, blob, upload, preview, and export helpers. -- `src/media/ImageCache.ts` contains the in-memory image cache. IndexedDB image +- `src/media/image_cache.ts` contains the in-memory image cache. IndexedDB image persistence and reference tracking remain in `src/persistence/`. - `src/persistence/` contains IndexedDB and image-reference persistence. - `src/persistence/contracts.ts` contains shared persisted-state and worker @@ -54,7 +54,7 @@ The frontend is organized by responsibility: - `src/shared/` contains shared types and error handling. - `src/utils/` contains smaller cross-cutting browser and ComfyUI helpers. -ComfyUI scans the generated web directory recursively. Only `js/CanvasView.js` invokes `registerLayerForgeExtension`; `js/app/CanvasView.js` exports the registration function without invoking it, preventing duplicate extension registration. +ComfyUI scans the generated web directory recursively. Only `js/canvas_view.js` invokes `registerLayerForgeExtension`; `js/app/canvas_view.js` exports the registration function without invoking it, preventing duplicate extension registration. ## Watch mode diff --git a/js/app/CanvasView.js b/js/app/canvas_view.js similarity index 99% rename from js/app/CanvasView.js rename to js/app/canvas_view.js index 0d12eff..1266381 100644 --- a/js/app/CanvasView.js +++ b/js/app/canvas_view.js @@ -6,23 +6,23 @@ import { api } from "../../../scripts/api.js"; import { ChangeTracker } from "../../../scripts/changeTracker.js"; // @ts-ignore import { $el } from "../../../scripts/ui.js"; -import { addStylesheet, getUrl, loadTemplate } from "../utils/ResourceManager.js"; -import { Canvas, configureCanvasImagePreviewWidget } from "../canvas/Canvas.js"; -import { canvasNodeInstances, installLayerForgeMultiImagePromptPatch, installLayerForgeVirtualWirePatch, isLayerForgeTransportInput, pruneLayerForgeTransportInputs, scheduleLayerForgeImageConnectionConversion, } from "./LayerForgeConnections.js"; +import { addStylesheet, getUrl, loadTemplate } from "../utils/resource_manager.js"; +import { Canvas, configureCanvasImagePreviewWidget } from "../canvas/canvas.js"; +import { canvasNodeInstances, installLayerForgeMultiImagePromptPatch, installLayerForgeVirtualWirePatch, isLayerForgeTransportInput, pruneLayerForgeTransportInputs, scheduleLayerForgeImageConnectionConversion, } from "./layer_forge_connections.js"; import { clearAllCanvasStates, getCanvasState, setCanvasState } from "../persistence/db.js"; -import { getCanvasStateKey } from "../utils/CanvasStateKey.js"; -import { createCanvas } from "../utils/CommonUtils.js"; -import { loadImageFromBlob } from "../media/ImageUtils.js"; +import { getCanvasStateKey } from "../utils/canvas_state_key.js"; +import { createCanvas } from "../utils/common_utils.js"; +import { loadImageFromBlob } from "../media/image_utils.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { showErrorNotification, showSuccessNotification, showInfoNotification, showWarningNotification } from "../utils/NotificationUtils.js"; -import { iconLoader, LAYERFORGE_TOOLS } from "../utils/IconLoader.js"; -import { exportCanvasImage } from "../media/CanvasExportUtils.js"; -import { getFlattenedCanvasBlob } from "../media/CanvasBlobUtils.js"; -import { loadPreviewImage } from "../media/PreviewUtils.js"; -import { getImageAddMode } from "../utils/CanvasInputUtils.js"; -import { clearLayerForgeImageInputLinks, getLayerForgeImageInputLinks, getLayerForgeMaskInputSlot, hasLayerForgeImageInput, } from "../utils/MultiImageInputUtils.js"; -import { fetchMattingModelStatus, fetchMattingSettings, saveMattingSettings as saveMattingSettingsToServer, } from "../utils/MattingUtils.js"; -import { cancelSAMDetectorMonitoring, setupSAMDetectorHook } from "../mask/SAMDetectorIntegration.js"; +import { showErrorNotification, showSuccessNotification, showInfoNotification, showWarningNotification } from "../utils/notification_utils.js"; +import { iconLoader, LAYERFORGE_TOOLS } from "../utils/icon_loader.js"; +import { exportCanvasImage } from "../media/canvas_export_utils.js"; +import { getFlattenedCanvasBlob } from "../media/canvas_blob_utils.js"; +import { loadPreviewImage } from "../media/preview_utils.js"; +import { getImageAddMode } from "../utils/canvas_input_utils.js"; +import { clearLayerForgeImageInputLinks, getLayerForgeImageInputLinks, getLayerForgeMaskInputSlot, hasLayerForgeImageInput, } from "../utils/multi_image_input_utils.js"; +import { fetchMattingModelStatus, fetchMattingSettings, saveMattingSettings as saveMattingSettingsToServer, } from "../utils/matting_utils.js"; +import { cancelSAMDetectorMonitoring, setupSAMDetectorHook } from "../mask/sam_detector_integration.js"; const log = createModuleLogger('Canvas_view'); const DEFAULT_MATTING_SETTINGS = { modelPath: '', diff --git a/js/app/CanvasWidgetTypes.js b/js/app/canvas_widget_types.js similarity index 100% rename from js/app/CanvasWidgetTypes.js rename to js/app/canvas_widget_types.js diff --git a/js/app/LayerForgeConnections.js b/js/app/layer_forge_connections.js similarity index 99% rename from js/app/LayerForgeConnections.js rename to js/app/layer_forge_connections.js index 8692857..8ba70a5 100644 --- a/js/app/LayerForgeConnections.js +++ b/js/app/layer_forge_connections.js @@ -1,7 +1,7 @@ // Graph integration for virtual image links and multi-image prompt transport. // @ts-ignore import { app } from "../../../scripts/app.js"; -import { addLayerForgeImageInputLink, getLayerForgeImageInputLinks, getLayerForgeImageInputSlot, LAYERFORGE_MAX_IMAGE_INPUTS, removeLayerForgeImageInputLink, } from "../utils/MultiImageInputUtils.js"; +import { addLayerForgeImageInputLink, getLayerForgeImageInputLinks, getLayerForgeImageInputSlot, LAYERFORGE_MAX_IMAGE_INPUTS, removeLayerForgeImageInputLink, } from "../utils/multi_image_input_utils.js"; export const canvasNodeInstances = new Map(); let layerForgeQuickCreateMenu = null; let layerForgeQuickCreateCanvas = null; diff --git a/js/canvas/BatchPreviewManager.js b/js/canvas/batch_preview_manager.js similarity index 100% rename from js/canvas/BatchPreviewManager.js rename to js/canvas/batch_preview_manager.js diff --git a/js/canvas/Canvas.js b/js/canvas/canvas.js similarity index 95% rename from js/canvas/Canvas.js rename to js/canvas/canvas.js index d0ca08f..359f4ca 100644 --- a/js/canvas/Canvas.js +++ b/js/canvas/canvas.js @@ -1,22 +1,22 @@ // @ts-ignore import { api } from "../../../scripts/api.js"; -import { MaskTool } from "../mask/MaskTool.js"; -import { ShapeTool } from "./ShapeTool.js"; -import { CustomShapeMenu } from "./CustomShapeMenu.js"; -import { CanvasState } from "./CanvasState.js"; -import { CanvasInteractions } from "./CanvasInteractions.js"; -import { CanvasLayers } from "./CanvasLayers.js"; -import { CanvasLayersPanel } from "./CanvasLayersPanel.js"; -import { CanvasRenderer } from "./CanvasRenderer.js"; -import { CanvasIO } from "../io/CanvasIO.js"; -import { ImageReferenceManager } from "../persistence/ImageReferenceManager.js"; -import { BatchPreviewManager } from "./BatchPreviewManager.js"; -import { ImageCache } from "../media/ImageCache.js"; +import { MaskTool } from "../mask/mask_tool.js"; +import { ShapeTool } from "./shape_tool.js"; +import { CustomShapeMenu } from "./custom_shape_menu.js"; +import { CanvasState } from "./canvas_state.js"; +import { CanvasInteractions } from "./canvas_interactions.js"; +import { CanvasLayers } from "./canvas_layers.js"; +import { CanvasLayersPanel } from "./canvas_layers_panel.js"; +import { CanvasRenderer } from "./canvas_renderer.js"; +import { CanvasIO } from "../io/canvas_io.js"; +import { ImageReferenceManager } from "../persistence/image_reference_manager.js"; +import { BatchPreviewManager } from "./batch_preview_manager.js"; +import { ImageCache } from "../media/image_cache.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { debounce, createCanvas } from "../utils/CommonUtils.js"; -import { MaskEditorIntegration } from "../mask/MaskEditorIntegration.js"; -import { CanvasSelection } from "./CanvasSelection.js"; -import { removeLayersWithLifecycle } from "../utils/LayerRemovalUtils.js"; +import { debounce, createCanvas } from "../utils/common_utils.js"; +import { MaskEditorIntegration } from "../mask/mask_editor_integration.js"; +import { CanvasSelection } from "./canvas_selection.js"; +import { removeLayersWithLifecycle } from "../utils/layer_removal_utils.js"; const useChainCallback = (original, next) => { if (original === undefined || original === null) { return next; @@ -187,7 +187,7 @@ export class Canvas { this.render(); } else { - log.warn("$$canvas-image-preview widget not found in Canvas.js"); + log.warn("$$canvas-image-preview widget not found in canvas.js"); } } /** diff --git a/js/canvas/CanvasHistory.js b/js/canvas/canvas_history.js similarity index 100% rename from js/canvas/CanvasHistory.js rename to js/canvas/canvas_history.js diff --git a/js/canvas/CanvasInteractions.js b/js/canvas/canvas_interactions.js similarity index 99% rename from js/canvas/CanvasInteractions.js rename to js/canvas/canvas_interactions.js index 2831ae0..a23fe7a 100644 --- a/js/canvas/CanvasInteractions.js +++ b/js/canvas/canvas_interactions.js @@ -1,7 +1,7 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { snapToGrid, getSnapAdjustment, isPointInRotatedLayer } from "../utils/CommonUtils.js"; -import { loadImageFromBlob } from "../media/ImageUtils.js"; -import { getImageAddMode } from "../utils/CanvasInputUtils.js"; +import { snapToGrid, getSnapAdjustment, isPointInRotatedLayer } from "../utils/common_utils.js"; +import { loadImageFromBlob } from "../media/image_utils.js"; +import { getImageAddMode } from "../utils/canvas_input_utils.js"; const log = createModuleLogger('CanvasInteractions'); export class CanvasInteractions { constructor(canvas) { diff --git a/js/canvas/CanvasLayers.js b/js/canvas/canvas_layers.js similarity index 99% rename from js/canvas/CanvasLayers.js rename to js/canvas/canvas_layers.js index da1f222..80425bc 100644 --- a/js/canvas/CanvasLayers.js +++ b/js/canvas/canvas_layers.js @@ -1,17 +1,17 @@ import { saveImage } from "../persistence/db.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { generateUUID, generateUniqueFileName, createCanvas, getBoundsFromPoints, getLayerWorldCorners, isPointInLayerLocalBounds, isPointInRotatedLayer, localToWorld, worldToLayerLocal } from "../utils/CommonUtils.js"; -import { withErrorHandling, createValidationError } from "../shared/ErrorHandler.js"; -import { showErrorNotification } from "../utils/NotificationUtils.js"; -import { addStylesheet, getUrl } from "../utils/ResourceManager.js"; +import { generateUUID, generateUniqueFileName, createCanvas, getBoundsFromPoints, getLayerWorldCorners, isPointInLayerLocalBounds, isPointInRotatedLayer, localToWorld, worldToLayerLocal } from "../utils/common_utils.js"; +import { withErrorHandling, createValidationError } from "../shared/error_handler.js"; +import { showErrorNotification } from "../utils/notification_utils.js"; +import { addStylesheet, getUrl } from "../utils/resource_manager.js"; // @ts-ignore import { app } from "../../../scripts/app.js"; // @ts-ignore import { ComfyApp } from "../../../scripts/app.js"; -import { ClipboardManager } from "../utils/ClipboardManager.js"; -import { createDistanceFieldMaskSync } from "../mask/ImageAnalysis.js"; -import { fillInverseAlphaMask } from "../mask/MaskPixelUtils.js"; -import { blobToDataUrl } from "../media/ImageUtils.js"; +import { ClipboardManager } from "../utils/clipboard_manager.js"; +import { createDistanceFieldMaskSync } from "../mask/image_analysis.js"; +import { fillInverseAlphaMask } from "../mask/mask_pixel_utils.js"; +import { blobToDataUrl } from "../media/image_utils.js"; const log = createModuleLogger('CanvasLayers'); export class CanvasLayers { constructor(canvas) { diff --git a/js/canvas/CanvasLayersPanel.js b/js/canvas/canvas_layers_panel.js similarity index 99% rename from js/canvas/CanvasLayersPanel.js rename to js/canvas/canvas_layers_panel.js index 95e1441..b15ce01 100644 --- a/js/canvas/CanvasLayersPanel.js +++ b/js/canvas/canvas_layers_panel.js @@ -1,7 +1,7 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { iconLoader, LAYERFORGE_TOOLS } from "../utils/IconLoader.js"; -import { createCanvas } from "../utils/CommonUtils.js"; -import { addStylesheet, getUrl } from "../utils/ResourceManager.js"; +import { iconLoader, LAYERFORGE_TOOLS } from "../utils/icon_loader.js"; +import { createCanvas } from "../utils/common_utils.js"; +import { addStylesheet, getUrl } from "../utils/resource_manager.js"; const log = createModuleLogger('CanvasLayersPanel'); export class CanvasLayersPanel { constructor(canvas) { diff --git a/js/canvas/CanvasRenderer.js b/js/canvas/canvas_renderer.js similarity index 99% rename from js/canvas/CanvasRenderer.js rename to js/canvas/canvas_renderer.js index 1dc8bac..55f7cf0 100644 --- a/js/canvas/CanvasRenderer.js +++ b/js/canvas/canvas_renderer.js @@ -1,5 +1,5 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { getBoundsFromPoints, getLayerWorldBounds, isPointInRotatedLayer, localToWorld, worldToLocal } from "../utils/CommonUtils.js"; +import { getBoundsFromPoints, getLayerWorldBounds, isPointInRotatedLayer, localToWorld, worldToLocal } from "../utils/common_utils.js"; const log = createModuleLogger('CanvasRenderer'); export class CanvasRenderer { constructor(canvas) { diff --git a/js/canvas/CanvasSelection.js b/js/canvas/canvas_selection.js similarity index 97% rename from js/canvas/CanvasSelection.js rename to js/canvas/canvas_selection.js index 8c5c181..3469a46 100644 --- a/js/canvas/CanvasSelection.js +++ b/js/canvas/canvas_selection.js @@ -1,6 +1,6 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { generateUUID } from "../utils/CommonUtils.js"; -import { removeLayersWithLifecycle } from "../utils/LayerRemovalUtils.js"; +import { generateUUID } from "../utils/common_utils.js"; +import { removeLayersWithLifecycle } from "../utils/layer_removal_utils.js"; const log = createModuleLogger('CanvasSelection'); export class CanvasSelection { constructor(canvas) { diff --git a/js/canvas/CanvasState.js b/js/canvas/canvas_state.js similarity index 97% rename from js/canvas/CanvasState.js rename to js/canvas/canvas_state.js index 58554e9..742d4e0 100644 --- a/js/canvas/CanvasState.js +++ b/js/canvas/canvas_state.js @@ -1,10 +1,10 @@ import { getCanvasState, setCanvasState, saveImage, getImage } from "../persistence/db.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { showAlertNotification } from "../utils/NotificationUtils.js"; -import { generateUUID, cloneLayers, getStateSignature, debounce, createCanvas, cloneCanvas } from "../utils/CommonUtils.js"; -import { loadImage } from "../media/ImageUtils.js"; -import { getCanvasStateKey } from "../utils/CanvasStateKey.js"; -import { HistoryStack } from "./CanvasHistory.js"; +import { showAlertNotification } from "../utils/notification_utils.js"; +import { generateUUID, cloneLayers, getStateSignature, debounce, createCanvas, cloneCanvas } from "../utils/common_utils.js"; +import { loadImage } from "../media/image_utils.js"; +import { getCanvasStateKey } from "../utils/canvas_state_key.js"; +import { HistoryStack } from "./canvas_history.js"; import { CURRENT_PERSISTED_STATE_VERSION, migratePersistedCanvasState, } from '../persistence/contracts.js'; const log = createModuleLogger('CanvasState'); export class CanvasState { @@ -38,7 +38,7 @@ export class CanvasState { this._debouncedSave = null; try { // @ts-ignore - this.stateSaverWorker = new Worker(new URL('../persistence/state-saver.worker.js', import.meta.url), { type: 'module' }); + this.stateSaverWorker = new Worker(new URL('../persistence/state_saver.worker.js', import.meta.url), { type: 'module' }); log.info("State saver worker initialized successfully."); this.stateSaverWorker.onmessage = (e) => { log.info("Message from state saver worker:", e.data); diff --git a/js/canvas/CustomShapeMenu.js b/js/canvas/custom_shape_menu.js similarity index 99% rename from js/canvas/CustomShapeMenu.js rename to js/canvas/custom_shape_menu.js index 5a174f6..4c41527 100644 --- a/js/canvas/CustomShapeMenu.js +++ b/js/canvas/custom_shape_menu.js @@ -1,5 +1,5 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { addStylesheet, getUrl } from "../utils/ResourceManager.js"; +import { addStylesheet, getUrl } from "../utils/resource_manager.js"; const log = createModuleLogger('CustomShapeMenu'); export class CustomShapeMenu { constructor(canvas) { diff --git a/js/canvas/ShapeTool.js b/js/canvas/shape_tool.js similarity index 98% rename from js/canvas/ShapeTool.js rename to js/canvas/shape_tool.js index 786daa1..5aa90cd 100644 --- a/js/canvas/ShapeTool.js +++ b/js/canvas/shape_tool.js @@ -1,5 +1,5 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { getBoundsFromPoints } from '../utils/CommonUtils.js'; +import { getBoundsFromPoints } from '../utils/common_utils.js'; const log = createModuleLogger('ShapeTool'); export class ShapeTool { constructor(canvas) { diff --git a/js/CanvasView.js b/js/canvas_view.js similarity index 75% rename from js/CanvasView.js rename to js/canvas_view.js index bdcd661..ba15ebc 100644 --- a/js/CanvasView.js +++ b/js/canvas_view.js @@ -1,5 +1,5 @@ // Stable frontend entrypoint loaded by ComfyUI. // The implementation module is also served recursively, so registration is // intentionally invoked only from this root bootstrap. -import { registerLayerForgeExtension } from "./app/CanvasView.js"; +import { registerLayerForgeExtension } from "./app/canvas_view.js"; registerLayerForgeExtension(); diff --git a/js/io/CanvasIO.js b/js/io/canvas_io.js similarity index 99% rename from js/io/CanvasIO.js rename to js/io/canvas_io.js index 57b9d9c..dedb8d8 100644 --- a/js/io/CanvasIO.js +++ b/js/io/canvas_io.js @@ -1,11 +1,11 @@ -import { createCanvas } from "../utils/CommonUtils.js"; +import { createCanvas } from "../utils/common_utils.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { showErrorNotification } from "../utils/NotificationUtils.js"; -import { webSocketManager } from "../utils/WebSocketManager.js"; -import { scaleImageToFit, loadImage, blobToDataUrl, tensorToImageData, createImageFromImageData } from "../media/ImageUtils.js"; -import { postImageBlob } from "../media/ImageUploadUtils.js"; -import { getImageAddMode, isFitOnAddEnabled } from "../utils/CanvasInputUtils.js"; -import { getLayerForgeImageInputLinks, getLayerForgeImageInputSlot, getLayerForgeMaskInputSlot, hasLayerForgeImageInput, removeLayerForgeImageInputLink, } from "../utils/MultiImageInputUtils.js"; +import { showErrorNotification } from "../utils/notification_utils.js"; +import { webSocketManager } from "../utils/web_socket_manager.js"; +import { scaleImageToFit, loadImage, blobToDataUrl, tensorToImageData, createImageFromImageData } from "../media/image_utils.js"; +import { postImageBlob } from "../media/image_upload_utils.js"; +import { getImageAddMode, isFitOnAddEnabled } from "../utils/canvas_input_utils.js"; +import { getLayerForgeImageInputLinks, getLayerForgeImageInputSlot, getLayerForgeMaskInputSlot, hasLayerForgeImageInput, removeLayerForgeImageInputLink, } from "../utils/multi_image_input_utils.js"; const log = createModuleLogger('CanvasIO'); const IMAGE_CACHE_BUSTER_QUERY_KEYS = new Set([ 'cachebust', diff --git a/js/mask/ImageAnalysis.js b/js/mask/image_analysis.js similarity index 98% rename from js/mask/ImageAnalysis.js rename to js/mask/image_analysis.js index 4785afb..a68d693 100644 --- a/js/mask/ImageAnalysis.js +++ b/js/mask/image_analysis.js @@ -1,7 +1,7 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { createCanvas } from "../utils/CommonUtils.js"; -import { calculateDistanceTransform, rasterizeDistanceFieldMask } from "./MaskPixelUtils.js"; -import { withErrorHandling, createValidationError } from "../shared/ErrorHandler.js"; +import { createCanvas } from "../utils/common_utils.js"; +import { calculateDistanceTransform, rasterizeDistanceFieldMask } from "./mask_pixel_utils.js"; +import { withErrorHandling, createValidationError } from "../shared/error_handler.js"; const log = createModuleLogger('ImageAnalysis'); /** * Creates a distance field mask based on the alpha channel of an image. diff --git a/js/mask/MaskEditorIntegration.js b/js/mask/mask_editor_integration.js similarity index 97% rename from js/mask/MaskEditorIntegration.js rename to js/mask/mask_editor_integration.js index eac53f7..a256428 100644 --- a/js/mask/MaskEditorIntegration.js +++ b/js/mask/mask_editor_integration.js @@ -3,15 +3,15 @@ import { app } from "../../../scripts/app.js"; // @ts-ignore import { ComfyApp } from "../../../scripts/app.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { showErrorNotification } from "../utils/NotificationUtils.js"; -import { uploadImageBlob } from "../media/ImageUploadUtils.js"; -import { processMaskForViewport } from "./MaskProcessingUtils.js"; -import { applyMaskResultToTool } from "./MaskResultUtils.js"; -import { updateNodePreview } from "../media/PreviewUtils.js"; +import { showErrorNotification } from "../utils/notification_utils.js"; +import { uploadImageBlob } from "../media/image_upload_utils.js"; +import { processMaskForViewport } from "./mask_processing_utils.js"; +import { applyMaskResultToTool } from "./mask_result_utils.js"; +import { updateNodePreview } from "../media/preview_utils.js"; import { mask_editor_showing, mask_editor_listen_for_cancel } from "./mask_utils.js"; -import { cloneCanvas } from "../utils/CommonUtils.js"; -import { getFlattenedCanvasBlob } from "../media/CanvasBlobUtils.js"; -import { loadImage } from "../media/ImageUtils.js"; +import { cloneCanvas } from "../utils/common_utils.js"; +import { getFlattenedCanvasBlob } from "../media/canvas_blob_utils.js"; +import { loadImage } from "../media/image_utils.js"; const log = createModuleLogger('MaskEditorIntegration'); export class MaskEditorIntegration { constructor(canvas) { diff --git a/js/mask/MaskPixelUtils.js b/js/mask/mask_pixel_utils.js similarity index 100% rename from js/mask/MaskPixelUtils.js rename to js/mask/mask_pixel_utils.js diff --git a/js/mask/MaskProcessingUtils.js b/js/mask/mask_processing_utils.js similarity index 98% rename from js/mask/MaskProcessingUtils.js rename to js/mask/mask_processing_utils.js index d87598e..3de1f5c 100644 --- a/js/mask/MaskProcessingUtils.js +++ b/js/mask/mask_processing_utils.js @@ -1,6 +1,6 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { createCanvas } from "../utils/CommonUtils.js"; -import { withErrorHandling, createValidationError } from "../shared/ErrorHandler.js"; +import { createCanvas } from "../utils/common_utils.js"; +import { withErrorHandling, createValidationError } from "../shared/error_handler.js"; const log = createModuleLogger('MaskProcessingUtils'); async function processImagePixels(sourceImage, targetWidth, targetHeight, pixelTransform, contextErrorMessage) { const { canvas: tempCanvas, ctx: tempCtx } = createCanvas(targetWidth, targetHeight, '2d', { willReadFrequently: true }); diff --git a/js/mask/MaskResultUtils.js b/js/mask/mask_result_utils.js similarity index 81% rename from js/mask/MaskResultUtils.js rename to js/mask/mask_result_utils.js index d9acfb7..32118de 100644 --- a/js/mask/MaskResultUtils.js +++ b/js/mask/mask_result_utils.js @@ -1,5 +1,5 @@ -import { convertToImage } from "../media/ImageUtils.js"; -import { processImageToMask } from "./MaskProcessingUtils.js"; +import { convertToImage } from "../media/image_utils.js"; +import { processImageToMask } from "./mask_processing_utils.js"; export async function createMaskImageFromResult(sourceImage, options) { const processedMask = await processImageToMask(sourceImage, { targetWidth: options.targetWidth, diff --git a/js/mask/MaskTool.js b/js/mask/mask_tool.js similarity index 99% rename from js/mask/MaskTool.js rename to js/mask/mask_tool.js index 7197038..8da2d86 100644 --- a/js/mask/MaskTool.js +++ b/js/mask/mask_tool.js @@ -1,6 +1,6 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { createCanvas, createCanvasWithContext } from "../utils/CommonUtils.js"; -import { applyLuminanceAsAlpha, calculateDistanceTransform, imageDataToBinaryMask, rasterizeDistanceFieldMask } from "./MaskPixelUtils.js"; +import { createCanvas, createCanvasWithContext } from "../utils/common_utils.js"; +import { applyLuminanceAsAlpha, calculateDistanceTransform, imageDataToBinaryMask, rasterizeDistanceFieldMask } from "./mask_pixel_utils.js"; const log = createModuleLogger('Mask_tool'); export class MaskTool { constructor(canvasInstance, callbacks = {}) { diff --git a/js/mask/mask_utils.js b/js/mask/mask_utils.js index c8ba488..5aaf224 100644 --- a/js/mask/mask_utils.js +++ b/js/mask/mask_utils.js @@ -1,5 +1,5 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { withErrorHandling, createValidationError } from "../shared/ErrorHandler.js"; +import { withErrorHandling, createValidationError } from "../shared/error_handler.js"; const log = createModuleLogger('MaskUtils'); export function new_editor(app) { if (!app) diff --git a/js/mask/SAMDetectorIntegration.js b/js/mask/sam_detector_integration.js similarity index 98% rename from js/mask/SAMDetectorIntegration.js rename to js/mask/sam_detector_integration.js index 97a3366..0961110 100644 --- a/js/mask/SAMDetectorIntegration.js +++ b/js/mask/sam_detector_integration.js @@ -1,11 +1,11 @@ // @ts-ignore import { ComfyApp } from "../../../scripts/app.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { showInfoNotification, showSuccessNotification, showErrorNotification } from "../utils/NotificationUtils.js"; -import { uploadCanvasAsImage, uploadImageBlob } from "../media/ImageUploadUtils.js"; -import { applyMaskResultToTool } from "./MaskResultUtils.js"; -import { updateNodePreview } from "../media/PreviewUtils.js"; -import { validateAndFixClipspace } from "../utils/ClipspaceUtils.js"; +import { showInfoNotification, showSuccessNotification, showErrorNotification } from "../utils/notification_utils.js"; +import { uploadCanvasAsImage, uploadImageBlob } from "../media/image_upload_utils.js"; +import { applyMaskResultToTool } from "./mask_result_utils.js"; +import { updateNodePreview } from "../media/preview_utils.js"; +import { validateAndFixClipspace } from "../utils/clipspace_utils.js"; const log = createModuleLogger('SAMDetectorIntegration'); function scheduleSAMMonitoringTimeout(node, callback, delay) { const existingTimers = node.samMonitoringTimers; diff --git a/js/media/CanvasBlobUtils.js b/js/media/canvas_blob_utils.js similarity index 100% rename from js/media/CanvasBlobUtils.js rename to js/media/canvas_blob_utils.js diff --git a/js/media/CanvasExportUtils.js b/js/media/canvas_export_utils.js similarity index 94% rename from js/media/CanvasExportUtils.js rename to js/media/canvas_export_utils.js index 4f730af..0fdf4b5 100644 --- a/js/media/CanvasExportUtils.js +++ b/js/media/canvas_export_utils.js @@ -1,4 +1,4 @@ -import { getFlattenedCanvasBlob } from './CanvasBlobUtils.js'; +import { getFlattenedCanvasBlob } from './canvas_blob_utils.js'; function openBlob(blob) { const url = URL.createObjectURL(blob); window.open(url, '_blank'); diff --git a/js/media/ImageCache.js b/js/media/image_cache.js similarity index 100% rename from js/media/ImageCache.js rename to js/media/image_cache.js diff --git a/js/media/ImageUploadUtils.js b/js/media/image_upload_utils.js similarity index 97% rename from js/media/ImageUploadUtils.js rename to js/media/image_upload_utils.js index 161a27c..9a9d936 100644 --- a/js/media/ImageUploadUtils.js +++ b/js/media/image_upload_utils.js @@ -1,9 +1,9 @@ // @ts-ignore import { api } from "../../../scripts/api.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { withErrorHandling, createValidationError, createNetworkError } from "../shared/ErrorHandler.js"; -import { resolveCanvasBlob } from './CanvasBlobUtils.js'; -import { loadImage } from './ImageUtils.js'; +import { withErrorHandling, createValidationError, createNetworkError } from "../shared/error_handler.js"; +import { resolveCanvasBlob } from './canvas_blob_utils.js'; +import { loadImage } from './image_utils.js'; const log = createModuleLogger('ImageUploadUtils'); export async function postImageBlob(request, transport = (input, init) => api.fetchApi(input, init)) { const formData = new FormData(); diff --git a/js/media/ImageUtils.js b/js/media/image_utils.js similarity index 99% rename from js/media/ImageUtils.js rename to js/media/image_utils.js index 7d685f1..c4dbb21 100644 --- a/js/media/ImageUtils.js +++ b/js/media/image_utils.js @@ -1,6 +1,6 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { withErrorHandling, createValidationError } from "../shared/ErrorHandler.js"; -import { createCanvas } from "../utils/CommonUtils.js"; +import { withErrorHandling, createValidationError } from "../shared/error_handler.js"; +import { createCanvas } from "../utils/common_utils.js"; const log = createModuleLogger('ImageUtils'); function tensorToRgbaPixels(tensor, dimensionsLog) { const shape = tensor.shape; diff --git a/js/media/PreviewUtils.js b/js/media/preview_utils.js similarity index 98% rename from js/media/PreviewUtils.js rename to js/media/preview_utils.js index 273b22a..a8152b7 100644 --- a/js/media/PreviewUtils.js +++ b/js/media/preview_utils.js @@ -1,7 +1,7 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { withErrorHandling, createValidationError } from "../shared/ErrorHandler.js"; -import { resolveCanvasBlob, supportsFlattenedCanvasBlob } from './CanvasBlobUtils.js'; -import { loadImage, loadImageFromBlob } from './ImageUtils.js'; +import { withErrorHandling, createValidationError } from "../shared/error_handler.js"; +import { resolveCanvasBlob, supportsFlattenedCanvasBlob } from './canvas_blob_utils.js'; +import { loadImage, loadImageFromBlob } from './image_utils.js'; const log = createModuleLogger('PreviewUtils'); export async function loadPreviewImage(blob, options) { const isCanvasSource = options.source === 'canvas'; diff --git a/js/persistence/ImageReferenceManager.js b/js/persistence/image_reference_manager.js similarity index 100% rename from js/persistence/ImageReferenceManager.js rename to js/persistence/image_reference_manager.js diff --git a/js/persistence/state-saver.worker.js b/js/persistence/state_saver.worker.js similarity index 100% rename from js/persistence/state-saver.worker.js rename to js/persistence/state_saver.worker.js diff --git a/js/shared/ErrorHandler.js b/js/shared/error_handler.js similarity index 100% rename from js/shared/ErrorHandler.js rename to js/shared/error_handler.js diff --git a/js/utils/CanvasInputUtils.js b/js/utils/canvas_input_utils.js similarity index 100% rename from js/utils/CanvasInputUtils.js rename to js/utils/canvas_input_utils.js diff --git a/js/utils/CanvasStateKey.js b/js/utils/canvas_state_key.js similarity index 97% rename from js/utils/CanvasStateKey.js rename to js/utils/canvas_state_key.js index 57c1919..8074795 100644 --- a/js/utils/CanvasStateKey.js +++ b/js/utils/canvas_state_key.js @@ -1,4 +1,4 @@ -import { generateUUID } from "./CommonUtils.js"; +import { generateUUID } from "./common_utils.js"; const WORKFLOW_ID_PROPERTY = "__layerForgeWorkflowId"; const WORKFLOW_EXTRA_ID = "layerforgeWorkflowId"; function getRootGraph(node) { diff --git a/js/utils/ClipboardManager.js b/js/utils/clipboard_manager.js similarity index 98% rename from js/utils/ClipboardManager.js rename to js/utils/clipboard_manager.js index 0ffe8af..2b5d845 100644 --- a/js/utils/ClipboardManager.js +++ b/js/utils/clipboard_manager.js @@ -1,8 +1,8 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { showNotification, showInfoNotification, showErrorNotification, showWarningNotification } from "./NotificationUtils.js"; -import { withErrorHandling, createValidationError, createNetworkError, createFileError } from "../shared/ErrorHandler.js"; -import { safeClipspacePaste } from "./ClipspaceUtils.js"; -import { loadImage, loadImageFromBlob } from "../media/ImageUtils.js"; +import { showNotification, showInfoNotification, showErrorNotification, showWarningNotification } from "./notification_utils.js"; +import { withErrorHandling, createValidationError, createNetworkError, createFileError } from "../shared/error_handler.js"; +import { safeClipspacePaste } from "./clipspace_utils.js"; +import { loadImage, loadImageFromBlob } from "../media/image_utils.js"; // @ts-ignore import { api } from "../../../scripts/api.js"; const log = createModuleLogger('ClipboardManager'); diff --git a/js/utils/ClipspaceUtils.js b/js/utils/clipspace_utils.js similarity index 100% rename from js/utils/ClipspaceUtils.js rename to js/utils/clipspace_utils.js diff --git a/js/utils/CommonUtils.js b/js/utils/common_utils.js similarity index 100% rename from js/utils/CommonUtils.js rename to js/utils/common_utils.js diff --git a/js/utils/IconLoader.js b/js/utils/icon_loader.js similarity index 99% rename from js/utils/IconLoader.js rename to js/utils/icon_loader.js index bcea112..c7bc7a6 100644 --- a/js/utils/IconLoader.js +++ b/js/utils/icon_loader.js @@ -1,6 +1,6 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { createCanvas } from "./CommonUtils.js"; -import { withErrorHandling, createValidationError } from "../shared/ErrorHandler.js"; +import { createCanvas } from "./common_utils.js"; +import { withErrorHandling, createValidationError } from "../shared/error_handler.js"; const log = createModuleLogger('IconLoader'); // Define tool constants for LayerForge export const LAYERFORGE_TOOLS = { diff --git a/js/utils/LayerRemovalUtils.js b/js/utils/layer_removal_utils.js similarity index 100% rename from js/utils/LayerRemovalUtils.js rename to js/utils/layer_removal_utils.js diff --git a/js/utils/MattingUtils.js b/js/utils/matting_utils.js similarity index 100% rename from js/utils/MattingUtils.js rename to js/utils/matting_utils.js diff --git a/js/utils/MultiImageInputUtils.js b/js/utils/multi_image_input_utils.js similarity index 100% rename from js/utils/MultiImageInputUtils.js rename to js/utils/multi_image_input_utils.js diff --git a/js/utils/NotificationUtils.js b/js/utils/notification_utils.js similarity index 100% rename from js/utils/NotificationUtils.js rename to js/utils/notification_utils.js diff --git a/js/utils/ResourceManager.js b/js/utils/resource_manager.js similarity index 97% rename from js/utils/ResourceManager.js rename to js/utils/resource_manager.js index b9edea0..d7554bf 100644 --- a/js/utils/ResourceManager.js +++ b/js/utils/resource_manager.js @@ -1,7 +1,7 @@ // @ts-ignore import { $el } from "../../../scripts/ui.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { withErrorHandling, createValidationError, createNetworkError } from "../shared/ErrorHandler.js"; +import { withErrorHandling, createValidationError, createNetworkError } from "../shared/error_handler.js"; const log = createModuleLogger('ResourceManager'); export const addStylesheet = withErrorHandling(function (url) { if (!url) { diff --git a/js/utils/WebSocketManager.js b/js/utils/web_socket_manager.js similarity index 99% rename from js/utils/WebSocketManager.js rename to js/utils/web_socket_manager.js index adc780a..34de6af 100644 --- a/js/utils/WebSocketManager.js +++ b/js/utils/web_socket_manager.js @@ -1,5 +1,5 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { withErrorHandling, createValidationError, createNetworkError } from "../shared/ErrorHandler.js"; +import { withErrorHandling, createValidationError, createNetworkError } from "../shared/error_handler.js"; const log = createModuleLogger('WebSocketManager'); export class WebSocketManager { constructor(url) { diff --git a/package.json b/package.json index 96b994a..a1f7bcf 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "test:coverage": "node --experimental-test-coverage --test tests/*.mjs", "lint": "eslint js/ tests/ --max-warnings=0", "lint:fix": "eslint js/ tests/ --fix", - "test:coverage:critical": "node --experimental-test-coverage --test-coverage-include=js/canvas/CanvasHistory.js --test-coverage-include=js/persistence/contracts.js --test-coverage-include=js/utils/WebSocketManager.js --test-coverage-lines=65 --test-coverage-functions=65 --test-coverage-branches=50 --test tests/test_canvas_history.mjs tests/test_persistence_contracts.mjs tests/test_persistence_resilience.mjs tests/test_async_lifecycle_resilience.mjs", + "test:coverage:critical": "node --experimental-test-coverage --test-coverage-include=js/canvas/canvas_history.js --test-coverage-include=js/persistence/contracts.js --test-coverage-include=js/utils/web_socket_manager.js --test-coverage-lines=65 --test-coverage-functions=65 --test-coverage-branches=50 --test tests/test_canvas_history.mjs tests/test_persistence_contracts.mjs tests/test_persistence_resilience.mjs tests/test_async_lifecycle_resilience.mjs", "watch": ".\\node_modules\\.bin\\tsc.cmd --watch", "watch:build": "nodemon --watch src --ext ts,css,html --exec .\\build.bat" }, diff --git a/src/app/CanvasView.ts b/src/app/canvas_view.ts similarity index 99% rename from src/app/CanvasView.ts rename to src/app/canvas_view.ts index 39aee35..39b6d6c 100644 --- a/src/app/CanvasView.ts +++ b/src/app/canvas_view.ts @@ -9,10 +9,10 @@ import {ChangeTracker} from "../../../scripts/changeTracker.js"; // @ts-ignore import {$el} from "../../../scripts/ui.js"; -import { addStylesheet, getUrl, loadTemplate } from "../utils/ResourceManager.js"; +import { addStylesheet, getUrl, loadTemplate } from "../utils/resource_manager.js"; -import {Canvas, configureCanvasImagePreviewWidget} from "../canvas/Canvas.js"; -import type {CanvasWidget} from "./CanvasWidgetTypes.js"; +import {Canvas, configureCanvasImagePreviewWidget} from "../canvas/canvas.js"; +import type {CanvasWidget} from "./canvas_widget_types.js"; import { canvasNodeInstances, installLayerForgeMultiImagePromptPatch, @@ -20,18 +20,18 @@ import { isLayerForgeTransportInput, pruneLayerForgeTransportInputs, scheduleLayerForgeImageConnectionConversion, -} from "./LayerForgeConnections.js"; +} from "./layer_forge_connections.js"; import {clearAllCanvasStates, getCanvasState, setCanvasState} from "../persistence/db.js"; -import {getCanvasStateKey} from "../utils/CanvasStateKey.js"; -import {generateUniqueFileName, createCanvas} from "../utils/CommonUtils.js"; -import { loadImageFromBlob } from "../media/ImageUtils.js"; +import {getCanvasStateKey} from "../utils/canvas_state_key.js"; +import {generateUniqueFileName, createCanvas} from "../utils/common_utils.js"; +import { loadImageFromBlob } from "../media/image_utils.js"; import {createModuleLogger} from "../log_system/log_funcs.js"; -import {showErrorNotification, showSuccessNotification, showInfoNotification, showWarningNotification} from "../utils/NotificationUtils.js"; -import { iconLoader, LAYERFORGE_TOOLS } from "../utils/IconLoader.js"; -import { exportCanvasImage, type CanvasExportAction } from "../media/CanvasExportUtils.js"; -import { getFlattenedCanvasBlob, type CanvasBlobVariant } from "../media/CanvasBlobUtils.js"; -import { loadPreviewImage } from "../media/PreviewUtils.js"; -import { getImageAddMode } from "../utils/CanvasInputUtils.js"; +import {showErrorNotification, showSuccessNotification, showInfoNotification, showWarningNotification} from "../utils/notification_utils.js"; +import { iconLoader, LAYERFORGE_TOOLS } from "../utils/icon_loader.js"; +import { exportCanvasImage, type CanvasExportAction } from "../media/canvas_export_utils.js"; +import { getFlattenedCanvasBlob, type CanvasBlobVariant } from "../media/canvas_blob_utils.js"; +import { loadPreviewImage } from "../media/preview_utils.js"; +import { getImageAddMode } from "../utils/canvas_input_utils.js"; import { addLayerForgeImageInputLink, clearLayerForgeImageInputLinks, @@ -41,15 +41,15 @@ import { hasLayerForgeImageInput, LAYERFORGE_MAX_IMAGE_INPUTS, removeLayerForgeImageInputLink, -} from "../utils/MultiImageInputUtils.js"; +} from "../utils/multi_image_input_utils.js"; import { fetchMattingModelStatus, fetchMattingSettings, saveMattingSettings as saveMattingSettingsToServer, type MattingServerSettings, type MattingSettingsUpdate, -} from "../utils/MattingUtils.js"; -import { cancelSAMDetectorMonitoring, registerImageInClipspace, startSAMDetectorMonitoring, setupSAMDetectorHook } from "../mask/SAMDetectorIntegration.js"; +} from "../utils/matting_utils.js"; +import { cancelSAMDetectorMonitoring, registerImageInClipspace, startSAMDetectorMonitoring, setupSAMDetectorHook } from "../mask/sam_detector_integration.js"; import type { ComfyNode, Layer, AddMode } from '../shared/types'; const log = createModuleLogger('Canvas_view'); diff --git a/src/app/CanvasWidgetTypes.ts b/src/app/canvas_widget_types.ts similarity index 67% rename from src/app/CanvasWidgetTypes.ts rename to src/app/canvas_widget_types.ts index 1884f5a..42ab815 100644 --- a/src/app/CanvasWidgetTypes.ts +++ b/src/app/canvas_widget_types.ts @@ -1,4 +1,4 @@ -import type { Canvas } from "../canvas/Canvas.js"; +import type { Canvas } from "../canvas/canvas.js"; export interface CanvasWidget { canvas: Canvas; diff --git a/src/app/LayerForgeConnections.ts b/src/app/layer_forge_connections.ts similarity index 99% rename from src/app/LayerForgeConnections.ts rename to src/app/layer_forge_connections.ts index 8501cef..e0e0fed 100644 --- a/src/app/LayerForgeConnections.ts +++ b/src/app/layer_forge_connections.ts @@ -2,7 +2,7 @@ // @ts-ignore import {app} from "../../../scripts/app.js"; -import {showErrorNotification} from "../utils/NotificationUtils.js"; +import {showErrorNotification} from "../utils/notification_utils.js"; import { addLayerForgeImageInputLink, clearLayerForgeImageInputLinks, @@ -12,8 +12,8 @@ import { hasLayerForgeImageInput, LAYERFORGE_MAX_IMAGE_INPUTS, removeLayerForgeImageInputLink, -} from "../utils/MultiImageInputUtils.js"; -import type {CanvasWidget} from "./CanvasWidgetTypes.js"; +} from "../utils/multi_image_input_utils.js"; +import type {CanvasWidget} from "./canvas_widget_types.js"; export const canvasNodeInstances = new Map(); diff --git a/src/canvas/BatchPreviewManager.ts b/src/canvas/batch_preview_manager.ts similarity index 99% rename from src/canvas/BatchPreviewManager.ts rename to src/canvas/batch_preview_manager.ts index 4c495a6..1a9e33c 100644 --- a/src/canvas/BatchPreviewManager.ts +++ b/src/canvas/batch_preview_manager.ts @@ -1,5 +1,5 @@ import {createModuleLogger} from "../log_system/log_funcs.js"; -import type { Canvas } from './Canvas'; +import type { Canvas } from './canvas'; import type { Layer, Point } from '../shared/types'; const log = createModuleLogger('BatchPreviewManager'); diff --git a/src/canvas/Canvas.ts b/src/canvas/canvas.ts similarity index 96% rename from src/canvas/Canvas.ts rename to src/canvas/canvas.ts index 9706b29..8eac35a 100644 --- a/src/canvas/Canvas.ts +++ b/src/canvas/canvas.ts @@ -6,23 +6,23 @@ import {app} from "../../../scripts/app.js"; import {ComfyApp} from "../../../scripts/app.js"; import {removeImage} from "../persistence/db.js"; -import {MaskTool} from "../mask/MaskTool.js"; -import {ShapeTool} from "./ShapeTool.js"; -import {CustomShapeMenu} from "./CustomShapeMenu.js"; -import {CanvasState} from "./CanvasState.js"; -import {CanvasInteractions} from "./CanvasInteractions.js"; -import {CanvasLayers} from "./CanvasLayers.js"; -import {CanvasLayersPanel} from "./CanvasLayersPanel.js"; -import {CanvasRenderer} from "./CanvasRenderer.js"; -import {CanvasIO} from "../io/CanvasIO.js"; -import {ImageReferenceManager} from "../persistence/ImageReferenceManager.js"; -import {BatchPreviewManager} from "./BatchPreviewManager.js"; -import {ImageCache} from "../media/ImageCache.js"; +import {MaskTool} from "../mask/mask_tool.js"; +import {ShapeTool} from "./shape_tool.js"; +import {CustomShapeMenu} from "./custom_shape_menu.js"; +import {CanvasState} from "./canvas_state.js"; +import {CanvasInteractions} from "./canvas_interactions.js"; +import {CanvasLayers} from "./canvas_layers.js"; +import {CanvasLayersPanel} from "./canvas_layers_panel.js"; +import {CanvasRenderer} from "./canvas_renderer.js"; +import {CanvasIO} from "../io/canvas_io.js"; +import {ImageReferenceManager} from "../persistence/image_reference_manager.js"; +import {BatchPreviewManager} from "./batch_preview_manager.js"; +import {ImageCache} from "../media/image_cache.js"; import {createModuleLogger} from "../log_system/log_funcs.js"; -import { debounce, createCanvas } from "../utils/CommonUtils.js"; -import {MaskEditorIntegration} from "../mask/MaskEditorIntegration.js"; -import {CanvasSelection} from "./CanvasSelection.js"; -import {removeLayersWithLifecycle} from "../utils/LayerRemovalUtils.js"; +import { debounce, createCanvas } from "../utils/common_utils.js"; +import {MaskEditorIntegration} from "../mask/mask_editor_integration.js"; +import {CanvasSelection} from "./canvas_selection.js"; +import {removeLayersWithLifecycle} from "../utils/layer_removal_utils.js"; import type { ComfyNode, Layer, Viewport, Point, AddMode, Shape, OutputAreaBounds } from '../shared/types'; const useChainCallback = (original: any, next: any) => { @@ -271,7 +271,7 @@ export class Canvas { this.node.setDirtyCanvas?.(true, true); this.render(); } else { - log.warn("$$canvas-image-preview widget not found in Canvas.js"); + log.warn("$$canvas-image-preview widget not found in canvas.js"); } } diff --git a/src/canvas/CanvasHistory.ts b/src/canvas/canvas_history.ts similarity index 100% rename from src/canvas/CanvasHistory.ts rename to src/canvas/canvas_history.ts diff --git a/src/canvas/CanvasInteractions.ts b/src/canvas/canvas_interactions.ts similarity index 99% rename from src/canvas/CanvasInteractions.ts rename to src/canvas/canvas_interactions.ts index d98186f..9eb8bfc 100644 --- a/src/canvas/CanvasInteractions.ts +++ b/src/canvas/canvas_interactions.ts @@ -1,8 +1,8 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { snapToGrid, getSnapAdjustment, isPointInRotatedLayer } from "../utils/CommonUtils.js"; -import { loadImageFromBlob } from "../media/ImageUtils.js"; -import { getImageAddMode } from "../utils/CanvasInputUtils.js"; -import type { Canvas } from './Canvas'; +import { snapToGrid, getSnapAdjustment, isPointInRotatedLayer } from "../utils/common_utils.js"; +import { loadImageFromBlob } from "../media/image_utils.js"; +import { getImageAddMode } from "../utils/canvas_input_utils.js"; +import type { Canvas } from './canvas'; import type { Layer, Point } from '../shared/types'; const log = createModuleLogger('CanvasInteractions'); diff --git a/src/canvas/CanvasLayers.ts b/src/canvas/canvas_layers.ts similarity index 99% rename from src/canvas/CanvasLayers.ts rename to src/canvas/canvas_layers.ts index 30ba129..b905f76 100644 --- a/src/canvas/CanvasLayers.ts +++ b/src/canvas/canvas_layers.ts @@ -10,19 +10,19 @@ import { isPointInRotatedLayer, localToWorld, worldToLayerLocal -} from "../utils/CommonUtils.js"; -import {withErrorHandling, createValidationError} from "../shared/ErrorHandler.js"; -import {showErrorNotification, showSuccessNotification} from "../utils/NotificationUtils.js"; -import { addStylesheet, getUrl } from "../utils/ResourceManager.js"; +} from "../utils/common_utils.js"; +import {withErrorHandling, createValidationError} from "../shared/error_handler.js"; +import {showErrorNotification, showSuccessNotification} from "../utils/notification_utils.js"; +import { addStylesheet, getUrl } from "../utils/resource_manager.js"; // @ts-ignore import {app} from "../../../scripts/app.js"; // @ts-ignore import {ComfyApp} from "../../../scripts/app.js"; -import { ClipboardManager } from "../utils/ClipboardManager.js"; -import { createDistanceFieldMaskSync } from "../mask/ImageAnalysis.js"; -import { fillInverseAlphaMask } from "../mask/MaskPixelUtils.js"; -import { blobToDataUrl } from "../media/ImageUtils.js"; -import type { Canvas } from './Canvas'; +import { ClipboardManager } from "../utils/clipboard_manager.js"; +import { createDistanceFieldMaskSync } from "../mask/image_analysis.js"; +import { fillInverseAlphaMask } from "../mask/mask_pixel_utils.js"; +import { blobToDataUrl } from "../media/image_utils.js"; +import type { Canvas } from './canvas'; import type { Layer, Point, AddMode, ClipboardPreference } from '../shared/types'; const log = createModuleLogger('CanvasLayers'); diff --git a/src/canvas/CanvasLayersPanel.ts b/src/canvas/canvas_layers_panel.ts similarity index 99% rename from src/canvas/CanvasLayersPanel.ts rename to src/canvas/canvas_layers_panel.ts index 7f6c7a4..11443ed 100644 --- a/src/canvas/CanvasLayersPanel.ts +++ b/src/canvas/canvas_layers_panel.ts @@ -1,8 +1,8 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { iconLoader, LAYERFORGE_TOOLS } from "../utils/IconLoader.js"; -import { createCanvas } from "../utils/CommonUtils.js"; -import { addStylesheet, getUrl } from "../utils/ResourceManager.js"; -import type { Canvas } from './Canvas'; +import { iconLoader, LAYERFORGE_TOOLS } from "../utils/icon_loader.js"; +import { createCanvas } from "../utils/common_utils.js"; +import { addStylesheet, getUrl } from "../utils/resource_manager.js"; +import type { Canvas } from './canvas'; import type { Layer } from '../shared/types'; const log = createModuleLogger('CanvasLayersPanel'); diff --git a/src/canvas/CanvasRenderer.ts b/src/canvas/canvas_renderer.ts similarity index 99% rename from src/canvas/CanvasRenderer.ts rename to src/canvas/canvas_renderer.ts index d81869b..3049800 100644 --- a/src/canvas/CanvasRenderer.ts +++ b/src/canvas/canvas_renderer.ts @@ -1,5 +1,5 @@ import {createModuleLogger} from "../log_system/log_funcs.js"; -import { getBoundsFromPoints, getLayerWorldBounds, isPointInRotatedLayer, localToWorld, worldToLocal } from "../utils/CommonUtils.js"; +import { getBoundsFromPoints, getLayerWorldBounds, isPointInRotatedLayer, localToWorld, worldToLocal } from "../utils/common_utils.js"; const log = createModuleLogger('CanvasRenderer'); diff --git a/src/canvas/CanvasSelection.ts b/src/canvas/canvas_selection.ts similarity index 97% rename from src/canvas/CanvasSelection.ts rename to src/canvas/canvas_selection.ts index ef05849..4cb0ce4 100644 --- a/src/canvas/CanvasSelection.ts +++ b/src/canvas/canvas_selection.ts @@ -1,6 +1,6 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { generateUUID } from "../utils/CommonUtils.js"; -import { removeLayersWithLifecycle } from "../utils/LayerRemovalUtils.js"; +import { generateUUID } from "../utils/common_utils.js"; +import { removeLayersWithLifecycle } from "../utils/layer_removal_utils.js"; const log = createModuleLogger('CanvasSelection'); diff --git a/src/canvas/CanvasState.ts b/src/canvas/canvas_state.ts similarity index 97% rename from src/canvas/CanvasState.ts rename to src/canvas/canvas_state.ts index cdce9da..4bb2cc7 100644 --- a/src/canvas/CanvasState.ts +++ b/src/canvas/canvas_state.ts @@ -1,12 +1,12 @@ import {getCanvasState, setCanvasState, saveImage, getImage} from "../persistence/db.js"; import {createModuleLogger} from "../log_system/log_funcs.js"; -import {showAlertNotification, showAllNotificationTypes} from "../utils/NotificationUtils.js"; -import {generateUUID, cloneLayers, getStateSignature, debounce, createCanvas, cloneCanvas} from "../utils/CommonUtils.js"; -import {loadImage} from "../media/ImageUtils.js"; -import {getCanvasStateKey} from "../utils/CanvasStateKey.js"; -import {withErrorHandling} from "../shared/ErrorHandler.js"; -import {HistoryStack, type HistoryInfo} from "./CanvasHistory.js"; -import type { Canvas } from './Canvas'; +import {showAlertNotification, showAllNotificationTypes} from "../utils/notification_utils.js"; +import {generateUUID, cloneLayers, getStateSignature, debounce, createCanvas, cloneCanvas} from "../utils/common_utils.js"; +import {loadImage} from "../media/image_utils.js"; +import {getCanvasStateKey} from "../utils/canvas_state_key.js"; +import {withErrorHandling} from "../shared/error_handler.js"; +import {HistoryStack, type HistoryInfo} from "./canvas_history.js"; +import type { Canvas } from './canvas'; import type { Layer, ComfyNode } from '../shared/types'; import { CURRENT_PERSISTED_STATE_VERSION, @@ -66,7 +66,7 @@ export class CanvasState { try { // @ts-ignore - this.stateSaverWorker = new Worker(new URL('../persistence/state-saver.worker.js', import.meta.url), { type: 'module' }); + this.stateSaverWorker = new Worker(new URL('../persistence/state_saver.worker.js', import.meta.url), { type: 'module' }); log.info("State saver worker initialized successfully."); this.stateSaverWorker.onmessage = (e: MessageEvent) => { diff --git a/src/canvas/CustomShapeMenu.ts b/src/canvas/custom_shape_menu.ts similarity index 99% rename from src/canvas/CustomShapeMenu.ts rename to src/canvas/custom_shape_menu.ts index 55ef7bd..44b57eb 100644 --- a/src/canvas/CustomShapeMenu.ts +++ b/src/canvas/custom_shape_menu.ts @@ -1,6 +1,6 @@ import {createModuleLogger} from "../log_system/log_funcs.js"; -import { addStylesheet, getUrl } from "../utils/ResourceManager.js"; -import type { Canvas } from './Canvas'; +import { addStylesheet, getUrl } from "../utils/resource_manager.js"; +import type { Canvas } from './canvas'; const log = createModuleLogger('CustomShapeMenu'); diff --git a/src/canvas/ShapeTool.ts b/src/canvas/shape_tool.ts similarity index 97% rename from src/canvas/ShapeTool.ts rename to src/canvas/shape_tool.ts index 320674c..5643e61 100644 --- a/src/canvas/ShapeTool.ts +++ b/src/canvas/shape_tool.ts @@ -1,6 +1,6 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { getBoundsFromPoints } from '../utils/CommonUtils.js'; -import type { Canvas } from './Canvas.js'; +import { getBoundsFromPoints } from '../utils/common_utils.js'; +import type { Canvas } from './canvas.js'; import type { Point } from '../shared/types.js'; const log = createModuleLogger('ShapeTool'); diff --git a/src/CanvasView.ts b/src/canvas_view.ts similarity index 75% rename from src/CanvasView.ts rename to src/canvas_view.ts index 999a905..ebb5deb 100644 --- a/src/CanvasView.ts +++ b/src/canvas_view.ts @@ -1,6 +1,6 @@ // Stable frontend entrypoint loaded by ComfyUI. // The implementation module is also served recursively, so registration is // intentionally invoked only from this root bootstrap. -import { registerLayerForgeExtension } from "./app/CanvasView.js"; +import { registerLayerForgeExtension } from "./app/canvas_view.js"; registerLayerForgeExtension(); diff --git a/src/io/CanvasIO.ts b/src/io/canvas_io.ts similarity index 99% rename from src/io/CanvasIO.ts rename to src/io/canvas_io.ts index 6a7a988..9992036 100644 --- a/src/io/CanvasIO.ts +++ b/src/io/canvas_io.ts @@ -1,18 +1,18 @@ -import { createCanvas } from "../utils/CommonUtils.js"; +import { createCanvas } from "../utils/common_utils.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { showErrorNotification } from "../utils/NotificationUtils.js"; -import { webSocketManager } from "../utils/WebSocketManager.js"; -import { scaleImageToFit, loadImage, blobToDataUrl, tensorToImageData, createImageFromImageData } from "../media/ImageUtils.js"; -import { postImageBlob } from "../media/ImageUploadUtils.js"; -import { getImageAddMode, isFitOnAddEnabled } from "../utils/CanvasInputUtils.js"; +import { showErrorNotification } from "../utils/notification_utils.js"; +import { webSocketManager } from "../utils/web_socket_manager.js"; +import { scaleImageToFit, loadImage, blobToDataUrl, tensorToImageData, createImageFromImageData } from "../media/image_utils.js"; +import { postImageBlob } from "../media/image_upload_utils.js"; +import { getImageAddMode, isFitOnAddEnabled } from "../utils/canvas_input_utils.js"; import { getLayerForgeImageInputLinks, getLayerForgeImageInputSlot, getLayerForgeMaskInputSlot, hasLayerForgeImageInput, removeLayerForgeImageInputLink, -} from "../utils/MultiImageInputUtils.js"; -import type { Canvas } from '../canvas/Canvas'; +} from "../utils/multi_image_input_utils.js"; +import type { Canvas } from '../canvas/canvas'; import type { Layer, Shape, AddMode } from '../shared/types'; const log = createModuleLogger('CanvasIO'); diff --git a/src/mask/ImageAnalysis.ts b/src/mask/image_analysis.ts similarity index 98% rename from src/mask/ImageAnalysis.ts rename to src/mask/image_analysis.ts index fdd802f..686dc15 100644 --- a/src/mask/ImageAnalysis.ts +++ b/src/mask/image_analysis.ts @@ -1,7 +1,7 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { createCanvas } from "../utils/CommonUtils.js"; -import { calculateDistanceTransform, rasterizeDistanceFieldMask } from "./MaskPixelUtils.js"; -import { withErrorHandling, createValidationError } from "../shared/ErrorHandler.js"; +import { createCanvas } from "../utils/common_utils.js"; +import { calculateDistanceTransform, rasterizeDistanceFieldMask } from "./mask_pixel_utils.js"; +import { withErrorHandling, createValidationError } from "../shared/error_handler.js"; const log = createModuleLogger('ImageAnalysis'); diff --git a/src/mask/MaskEditorIntegration.ts b/src/mask/mask_editor_integration.ts similarity index 97% rename from src/mask/MaskEditorIntegration.ts rename to src/mask/mask_editor_integration.ts index a015a36..b87272f 100644 --- a/src/mask/MaskEditorIntegration.ts +++ b/src/mask/mask_editor_integration.ts @@ -5,15 +5,15 @@ import {ComfyApp} from "../../../scripts/app.js"; // @ts-ignore import {api} from "../../../scripts/api.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { showErrorNotification } from "../utils/NotificationUtils.js"; -import { uploadCanvasAsImage, uploadCanvasWithMaskAsImage, uploadImageBlob } from "../media/ImageUploadUtils.js"; -import { processMaskForViewport } from "./MaskProcessingUtils.js"; -import { applyMaskResultToTool } from "./MaskResultUtils.js"; -import { updateNodePreview } from "../media/PreviewUtils.js"; +import { showErrorNotification } from "../utils/notification_utils.js"; +import { uploadCanvasAsImage, uploadCanvasWithMaskAsImage, uploadImageBlob } from "../media/image_upload_utils.js"; +import { processMaskForViewport } from "./mask_processing_utils.js"; +import { applyMaskResultToTool } from "./mask_result_utils.js"; +import { updateNodePreview } from "../media/preview_utils.js"; import { mask_editor_showing, mask_editor_listen_for_cancel } from "./mask_utils.js"; -import { cloneCanvas } from "../utils/CommonUtils.js"; -import { getFlattenedCanvasBlob } from "../media/CanvasBlobUtils.js"; -import { loadImage } from "../media/ImageUtils.js"; +import { cloneCanvas } from "../utils/common_utils.js"; +import { getFlattenedCanvasBlob } from "../media/canvas_blob_utils.js"; +import { loadImage } from "../media/image_utils.js"; const log = createModuleLogger('MaskEditorIntegration'); diff --git a/src/mask/MaskPixelUtils.ts b/src/mask/mask_pixel_utils.ts similarity index 100% rename from src/mask/MaskPixelUtils.ts rename to src/mask/mask_pixel_utils.ts diff --git a/src/mask/MaskProcessingUtils.ts b/src/mask/mask_processing_utils.ts similarity index 99% rename from src/mask/MaskProcessingUtils.ts rename to src/mask/mask_processing_utils.ts index ac268b9..3cc28fd 100644 --- a/src/mask/MaskProcessingUtils.ts +++ b/src/mask/mask_processing_utils.ts @@ -1,6 +1,6 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { createCanvas } from "../utils/CommonUtils.js"; -import { withErrorHandling, createValidationError } from "../shared/ErrorHandler.js"; +import { createCanvas } from "../utils/common_utils.js"; +import { withErrorHandling, createValidationError } from "../shared/error_handler.js"; const log = createModuleLogger('MaskProcessingUtils'); diff --git a/src/mask/MaskResultUtils.ts b/src/mask/mask_result_utils.ts similarity index 89% rename from src/mask/MaskResultUtils.ts rename to src/mask/mask_result_utils.ts index 01f02c3..343b209 100644 --- a/src/mask/MaskResultUtils.ts +++ b/src/mask/mask_result_utils.ts @@ -1,5 +1,5 @@ -import {convertToImage} from "../media/ImageUtils.js"; -import {processImageToMask} from "./MaskProcessingUtils.js"; +import {convertToImage} from "../media/image_utils.js"; +import {processImageToMask} from "./mask_processing_utils.js"; export interface MaskResultOptions { targetWidth: number; diff --git a/src/mask/MaskTool.ts b/src/mask/mask_tool.ts similarity index 99% rename from src/mask/MaskTool.ts rename to src/mask/mask_tool.ts index f5d4a43..5ccc503 100644 --- a/src/mask/MaskTool.ts +++ b/src/mask/mask_tool.ts @@ -1,12 +1,12 @@ import {createModuleLogger} from "../log_system/log_funcs.js"; -import { createCanvas, createCanvasWithContext } from "../utils/CommonUtils.js"; +import { createCanvas, createCanvasWithContext } from "../utils/common_utils.js"; import { applyLuminanceAsAlpha, calculateDistanceTransform, imageDataToBinaryMask, rasterizeDistanceFieldMask -} from "./MaskPixelUtils.js"; -import type { Canvas } from '../canvas/Canvas'; +} from "./mask_pixel_utils.js"; +import type { Canvas } from '../canvas/canvas'; import type { Point, CanvasState, Layer } from '../shared/types'; const log = createModuleLogger('Mask_tool'); diff --git a/src/mask/mask_utils.ts b/src/mask/mask_utils.ts index 0ed9c75..02201ac 100644 --- a/src/mask/mask_utils.ts +++ b/src/mask/mask_utils.ts @@ -1,6 +1,6 @@ import {createModuleLogger} from "../log_system/log_funcs.js"; -import { withErrorHandling, createValidationError } from "../shared/ErrorHandler.js"; -import type { Canvas } from '../canvas/Canvas.js'; +import { withErrorHandling, createValidationError } from "../shared/error_handler.js"; +import type { Canvas } from '../canvas/canvas.js'; // @ts-ignore import {ComfyApp} from "../../../scripts/app.js"; diff --git a/src/mask/SAMDetectorIntegration.ts b/src/mask/sam_detector_integration.ts similarity index 98% rename from src/mask/SAMDetectorIntegration.ts rename to src/mask/sam_detector_integration.ts index 6dc0fbd..d6ea054 100644 --- a/src/mask/SAMDetectorIntegration.ts +++ b/src/mask/sam_detector_integration.ts @@ -3,11 +3,11 @@ import { api } from "../../../scripts/api.js"; // @ts-ignore import { ComfyApp } from "../../../scripts/app.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { showInfoNotification, showSuccessNotification, showErrorNotification } from "../utils/NotificationUtils.js"; -import { uploadCanvasAsImage, uploadImageBlob } from "../media/ImageUploadUtils.js"; -import { applyMaskResultToTool } from "./MaskResultUtils.js"; -import { updateNodePreview } from "../media/PreviewUtils.js"; -import { validateAndFixClipspace } from "../utils/ClipspaceUtils.js"; +import { showInfoNotification, showSuccessNotification, showErrorNotification } from "../utils/notification_utils.js"; +import { uploadCanvasAsImage, uploadImageBlob } from "../media/image_upload_utils.js"; +import { applyMaskResultToTool } from "./mask_result_utils.js"; +import { updateNodePreview } from "../media/preview_utils.js"; +import { validateAndFixClipspace } from "../utils/clipspace_utils.js"; import type { ComfyNode } from '../shared/types'; const log = createModuleLogger('SAMDetectorIntegration'); diff --git a/src/media/CanvasBlobUtils.ts b/src/media/canvas_blob_utils.ts similarity index 100% rename from src/media/CanvasBlobUtils.ts rename to src/media/canvas_blob_utils.ts diff --git a/src/media/CanvasExportUtils.ts b/src/media/canvas_export_utils.ts similarity index 98% rename from src/media/CanvasExportUtils.ts rename to src/media/canvas_export_utils.ts index 9875fea..c3687f1 100644 --- a/src/media/CanvasExportUtils.ts +++ b/src/media/canvas_export_utils.ts @@ -1,4 +1,4 @@ -import { getFlattenedCanvasBlob, type CanvasBlobVariant } from './CanvasBlobUtils.js'; +import { getFlattenedCanvasBlob, type CanvasBlobVariant } from './canvas_blob_utils.js'; export type CanvasExportAction = 'open' | 'copy' | 'download'; diff --git a/src/media/ImageCache.ts b/src/media/image_cache.ts similarity index 100% rename from src/media/ImageCache.ts rename to src/media/image_cache.ts diff --git a/src/media/ImageUploadUtils.ts b/src/media/image_upload_utils.ts similarity index 97% rename from src/media/ImageUploadUtils.ts rename to src/media/image_upload_utils.ts index b470c72..5ac7633 100644 --- a/src/media/ImageUploadUtils.ts +++ b/src/media/image_upload_utils.ts @@ -1,9 +1,9 @@ // @ts-ignore import { api } from "../../../scripts/api.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { withErrorHandling, createValidationError, createNetworkError } from "../shared/ErrorHandler.js"; -import { resolveCanvasBlob, type CanvasBlobVariant } from './CanvasBlobUtils.js'; -import { loadImage } from './ImageUtils.js'; +import { withErrorHandling, createValidationError, createNetworkError } from "../shared/error_handler.js"; +import { resolveCanvasBlob, type CanvasBlobVariant } from './canvas_blob_utils.js'; +import { loadImage } from './image_utils.js'; const log = createModuleLogger('ImageUploadUtils'); diff --git a/src/media/ImageUtils.ts b/src/media/image_utils.ts similarity index 99% rename from src/media/ImageUtils.ts rename to src/media/image_utils.ts index 44c30f3..9cccdfa 100644 --- a/src/media/ImageUtils.ts +++ b/src/media/image_utils.ts @@ -1,6 +1,6 @@ import {createModuleLogger} from "../log_system/log_funcs.js"; -import {withErrorHandling, createValidationError} from "../shared/ErrorHandler.js"; -import { createCanvas } from "../utils/CommonUtils.js"; +import {withErrorHandling, createValidationError} from "../shared/error_handler.js"; +import { createCanvas } from "../utils/common_utils.js"; import type { Tensor, ImageDataPixel } from '../shared/types'; const log = createModuleLogger('ImageUtils'); diff --git a/src/media/PreviewUtils.ts b/src/media/preview_utils.ts similarity index 98% rename from src/media/PreviewUtils.ts rename to src/media/preview_utils.ts index 464ccd8..ef87559 100644 --- a/src/media/PreviewUtils.ts +++ b/src/media/preview_utils.ts @@ -1,7 +1,7 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { withErrorHandling, createValidationError } from "../shared/ErrorHandler.js"; -import { resolveCanvasBlob, supportsFlattenedCanvasBlob, type CanvasBlobVariant } from './CanvasBlobUtils.js'; -import { loadImage, loadImageFromBlob } from './ImageUtils.js'; +import { withErrorHandling, createValidationError } from "../shared/error_handler.js"; +import { resolveCanvasBlob, supportsFlattenedCanvasBlob, type CanvasBlobVariant } from './canvas_blob_utils.js'; +import { loadImage, loadImageFromBlob } from './image_utils.js'; import type { ComfyNode } from '../shared/types'; const log = createModuleLogger('PreviewUtils'); diff --git a/src/persistence/ImageReferenceManager.ts b/src/persistence/image_reference_manager.ts similarity index 99% rename from src/persistence/ImageReferenceManager.ts rename to src/persistence/image_reference_manager.ts index 199bfe9..58a13fb 100644 --- a/src/persistence/ImageReferenceManager.ts +++ b/src/persistence/image_reference_manager.ts @@ -1,6 +1,6 @@ import {removeImage, getAllImageIds} from "./db.js"; import {createModuleLogger} from "../log_system/log_funcs.js"; -import type { Canvas } from '../canvas/Canvas'; +import type { Canvas } from '../canvas/canvas'; import type { Layer, CanvasState } from '../shared/types'; const log = createModuleLogger('ImageReferenceManager'); diff --git a/src/persistence/state-saver.worker.ts b/src/persistence/state_saver.worker.ts similarity index 100% rename from src/persistence/state-saver.worker.ts rename to src/persistence/state_saver.worker.ts diff --git a/src/shared/ErrorHandler.ts b/src/shared/error_handler.ts similarity index 100% rename from src/shared/ErrorHandler.ts rename to src/shared/error_handler.ts diff --git a/src/shared/types.ts b/src/shared/types.ts index f15231a..354eb8e 100644 --- a/src/shared/types.ts +++ b/src/shared/types.ts @@ -1,5 +1,5 @@ -import type { Canvas as CanvasClass } from '../canvas/Canvas'; -import type { CanvasLayers } from '../canvas/CanvasLayers'; +import type { Canvas as CanvasClass } from '../canvas/canvas'; +import type { CanvasLayers } from '../canvas/canvas_layers'; export interface ComfyWidget { name: string; diff --git a/src/utils/CanvasInputUtils.ts b/src/utils/canvas_input_utils.ts similarity index 100% rename from src/utils/CanvasInputUtils.ts rename to src/utils/canvas_input_utils.ts diff --git a/src/utils/CanvasStateKey.ts b/src/utils/canvas_state_key.ts similarity index 98% rename from src/utils/CanvasStateKey.ts rename to src/utils/canvas_state_key.ts index 4a3e939..28b99af 100644 --- a/src/utils/CanvasStateKey.ts +++ b/src/utils/canvas_state_key.ts @@ -1,4 +1,4 @@ -import {generateUUID} from "./CommonUtils.js"; +import {generateUUID} from "./common_utils.js"; const WORKFLOW_ID_PROPERTY = "__layerForgeWorkflowId"; const WORKFLOW_EXTRA_ID = "layerforgeWorkflowId"; diff --git a/src/utils/ClipboardManager.ts b/src/utils/clipboard_manager.ts similarity index 98% rename from src/utils/ClipboardManager.ts rename to src/utils/clipboard_manager.ts index fcddb56..3ae1940 100644 --- a/src/utils/ClipboardManager.ts +++ b/src/utils/clipboard_manager.ts @@ -1,8 +1,8 @@ import {createModuleLogger} from "../log_system/log_funcs.js"; -import { showNotification, showInfoNotification, showErrorNotification, showWarningNotification } from "./NotificationUtils.js"; -import { withErrorHandling, createValidationError, createNetworkError, createFileError } from "../shared/ErrorHandler.js"; -import { safeClipspacePaste } from "./ClipspaceUtils.js"; -import { loadImage, loadImageFromBlob } from "../media/ImageUtils.js"; +import { showNotification, showInfoNotification, showErrorNotification, showWarningNotification } from "./notification_utils.js"; +import { withErrorHandling, createValidationError, createNetworkError, createFileError } from "../shared/error_handler.js"; +import { safeClipspacePaste } from "./clipspace_utils.js"; +import { loadImage, loadImageFromBlob } from "../media/image_utils.js"; // @ts-ignore import {api} from "../../../scripts/api.js"; diff --git a/src/utils/ClipspaceUtils.ts b/src/utils/clipspace_utils.ts similarity index 100% rename from src/utils/ClipspaceUtils.ts rename to src/utils/clipspace_utils.ts diff --git a/src/utils/CommonUtils.ts b/src/utils/common_utils.ts similarity index 100% rename from src/utils/CommonUtils.ts rename to src/utils/common_utils.ts diff --git a/src/utils/IconLoader.ts b/src/utils/icon_loader.ts similarity index 99% rename from src/utils/IconLoader.ts rename to src/utils/icon_loader.ts index d7a4a45..1517c6b 100644 --- a/src/utils/IconLoader.ts +++ b/src/utils/icon_loader.ts @@ -1,6 +1,6 @@ import { createModuleLogger } from "../log_system/log_funcs.js"; -import { createCanvas } from "./CommonUtils.js"; -import { withErrorHandling, createValidationError } from "../shared/ErrorHandler.js"; +import { createCanvas } from "./common_utils.js"; +import { withErrorHandling, createValidationError } from "../shared/error_handler.js"; const log = createModuleLogger('IconLoader'); diff --git a/src/utils/LayerRemovalUtils.ts b/src/utils/layer_removal_utils.ts similarity index 100% rename from src/utils/LayerRemovalUtils.ts rename to src/utils/layer_removal_utils.ts diff --git a/src/utils/MattingUtils.ts b/src/utils/matting_utils.ts similarity index 100% rename from src/utils/MattingUtils.ts rename to src/utils/matting_utils.ts diff --git a/src/utils/MultiImageInputUtils.ts b/src/utils/multi_image_input_utils.ts similarity index 100% rename from src/utils/MultiImageInputUtils.ts rename to src/utils/multi_image_input_utils.ts diff --git a/src/utils/NotificationUtils.ts b/src/utils/notification_utils.ts similarity index 100% rename from src/utils/NotificationUtils.ts rename to src/utils/notification_utils.ts diff --git a/src/utils/ResourceManager.ts b/src/utils/resource_manager.ts similarity index 97% rename from src/utils/ResourceManager.ts rename to src/utils/resource_manager.ts index 920ae40..f9f8cec 100644 --- a/src/utils/ResourceManager.ts +++ b/src/utils/resource_manager.ts @@ -1,7 +1,7 @@ // @ts-ignore import { $el } from "../../../scripts/ui.js"; import { createModuleLogger } from "../log_system/log_funcs.js"; -import { withErrorHandling, createValidationError, createNetworkError } from "../shared/ErrorHandler.js"; +import { withErrorHandling, createValidationError, createNetworkError } from "../shared/error_handler.js"; const log = createModuleLogger('ResourceManager'); diff --git a/src/utils/WebSocketManager.ts b/src/utils/web_socket_manager.ts similarity index 99% rename from src/utils/WebSocketManager.ts rename to src/utils/web_socket_manager.ts index 9c21a00..966345b 100644 --- a/src/utils/WebSocketManager.ts +++ b/src/utils/web_socket_manager.ts @@ -1,5 +1,5 @@ import {createModuleLogger} from "../log_system/log_funcs.js"; -import { withErrorHandling, createValidationError, createNetworkError } from "../shared/ErrorHandler.js"; +import { withErrorHandling, createValidationError, createNetworkError } from "../shared/error_handler.js"; import type { WebSocketMessage, AckCallbacks } from "../shared/types.js"; const log = createModuleLogger('WebSocketManager'); diff --git a/tests/test_app_module_boundaries.mjs b/tests/test_app_module_boundaries.mjs index bcbb76e..1aef805 100644 --- a/tests/test_app_module_boundaries.mjs +++ b/tests/test_app_module_boundaries.mjs @@ -2,9 +2,9 @@ import assert from 'node:assert/strict'; import { access, readFile } from 'node:fs/promises'; import test from 'node:test'; -const canvasViewPath = new URL('../src/app/CanvasView.ts', import.meta.url); -const widgetTypesPath = new URL('../src/app/CanvasWidgetTypes.ts', import.meta.url); -const connectionsPath = new URL('../src/app/LayerForgeConnections.ts', import.meta.url); +const canvasViewPath = new URL('../src/app/canvas_view.ts', import.meta.url); +const widgetTypesPath = new URL('../src/app/canvas_widget_types.ts', import.meta.url); +const connectionsPath = new URL('../src/app/layer_forge_connections.ts', import.meta.url); test('app integration responsibilities have dedicated modules', async () => { await Promise.all([ @@ -15,8 +15,8 @@ test('app integration responsibilities have dedicated modules', async () => { const canvasViewSource = await readFile(canvasViewPath, 'utf8'); const connectionsSource = await readFile(connectionsPath, 'utf8'); - assert.match(canvasViewSource, /from ["']\.\/CanvasWidgetTypes\.js["']/); - assert.match(canvasViewSource, /from ["']\.\/LayerForgeConnections\.js["']/); + assert.match(canvasViewSource, /from ["']\.\/canvas_widget_types\.js["']/); + assert.match(canvasViewSource, /from ["']\.\/layer_forge_connections\.js["']/); assert.match(connectionsSource, /export const canvasNodeInstances/); assert.match(connectionsSource, /export const installLayerForgeVirtualWirePatch/); assert.match(connectionsSource, /export const installLayerForgeMultiImagePromptPatch/); diff --git a/tests/test_architecture_boundaries.mjs b/tests/test_architecture_boundaries.mjs index 01de861..8552927 100644 --- a/tests/test_architecture_boundaries.mjs +++ b/tests/test_architecture_boundaries.mjs @@ -50,7 +50,7 @@ function extractImports(source) { function getDomain(filePath) { const pathFromRoot = relative(SRC_ROOT, filePath); const [domain] = pathFromRoot.split(sep); - return domain === 'CanvasView.ts' ? 'root' : domain; + return domain === 'canvas_view.ts' ? 'root' : domain; } function getImportedDomain(importerPath, specifier) { @@ -70,9 +70,9 @@ test('source root contains only the stable ComfyUI bootstrap', async () => { .map((filePath) => relative(SRC_ROOT, filePath)) .sort(); - assert.deepEqual(rootFiles, ['CanvasView.ts']); + assert.deepEqual(rootFiles, ['canvas_view.ts']); - const bootstrapSource = await readFile(resolve(SRC_ROOT, 'CanvasView.ts'), 'utf8'); + const bootstrapSource = await readFile(resolve(SRC_ROOT, 'canvas_view.ts'), 'utf8'); assert.match(bootstrapSource, /registerLayerForgeExtension\(\);/); assert.doesNotMatch(bootstrapSource, /app\.registerExtension\(/); }); diff --git a/tests/test_async_lifecycle_resilience.mjs b/tests/test_async_lifecycle_resilience.mjs index bbe0430..36df3f2 100644 --- a/tests/test_async_lifecycle_resilience.mjs +++ b/tests/test_async_lifecycle_resilience.mjs @@ -49,7 +49,7 @@ test('WebSocket manager reconnects and rejects pending acknowledgements on destr }); try { - const { WebSocketManager, webSocketManager } = await import('../js/utils/WebSocketManager.js?resilience'); + const { WebSocketManager, webSocketManager } = await import('../js/utils/web_socket_manager.js?resilience'); const manager = new WebSocketManager('ws://localhost/layerforge/canvas_ws'); manager.reconnectInterval = 0; @@ -87,10 +87,10 @@ test('WebSocket manager reconnects and rejects pending acknowledgements on destr test('async integrations cancel work and ignore results after their owner is destroyed', async () => { const [canvasSource, samSource, maskSource, canvasStateSource] = await Promise.all([ - readFile(new URL('../src/app/CanvasView.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/mask/SAMDetectorIntegration.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/mask/MaskEditorIntegration.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/canvas/CanvasState.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/app/canvas_view.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/mask/sam_detector_integration.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/mask/mask_editor_integration.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas_state.ts', import.meta.url), 'utf8'), ]); assert.match(canvasSource, /new AbortController\(\)/); diff --git a/tests/test_batch_and_mask_refactor_characterization.mjs b/tests/test_batch_and_mask_refactor_characterization.mjs index ff90536..4df4221 100644 --- a/tests/test_batch_and_mask_refactor_characterization.mjs +++ b/tests/test_batch_and_mask_refactor_characterization.mjs @@ -3,8 +3,8 @@ import { readFile } from 'node:fs/promises'; import test from 'node:test'; const [canvasIOSource, maskEditorSource] = await Promise.all([ - readFile(new URL('../src/io/CanvasIO.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/mask/MaskEditorIntegration.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/io/canvas_io.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/mask/mask_editor_integration.ts', import.meta.url), 'utf8'), ]); function getMethodBody(source, methodName, nextMethodName) { diff --git a/tests/test_blob_image_loading_characterization.mjs b/tests/test_blob_image_loading_characterization.mjs index 0528bb0..e63a83e 100644 --- a/tests/test_blob_image_loading_characterization.mjs +++ b/tests/test_blob_image_loading_characterization.mjs @@ -2,15 +2,15 @@ import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; -import { blobToDataUrl, loadImageFromBlob } from '../js/media/ImageUtils.js'; +import { blobToDataUrl, loadImageFromBlob } from '../js/media/image_utils.js'; const sourceFiles = await Promise.all([ - readFile(new URL('../src/media/ImageUtils.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/utils/ClipboardManager.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/canvas/CanvasInteractions.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/app/CanvasView.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/canvas/CanvasLayers.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/io/CanvasIO.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/media/image_utils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/utils/clipboard_manager.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas_interactions.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/app/canvas_view.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas_layers.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/io/canvas_io.ts', import.meta.url), 'utf8'), ]); test('Blob and File image entry points use the shared loading helpers', () => { diff --git a/tests/test_canvas_blob_characterization.mjs b/tests/test_canvas_blob_characterization.mjs index 2e45e23..72de3b8 100644 --- a/tests/test_canvas_blob_characterization.mjs +++ b/tests/test_canvas_blob_characterization.mjs @@ -6,15 +6,15 @@ import { getFlattenedCanvasBlob, resolveCanvasBlob, supportsFlattenedCanvasBlob, -} from '../js/media/CanvasBlobUtils.js'; -import { createPreviewFromCanvas } from '../js/media/PreviewUtils.js'; +} from '../js/media/canvas_blob_utils.js'; +import { createPreviewFromCanvas } from '../js/media/preview_utils.js'; const sourceFiles = await Promise.all([ - readFile(new URL('../src/media/ImageUploadUtils.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/media/PreviewUtils.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/mask/MaskEditorIntegration.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/app/CanvasView.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/media/CanvasBlobUtils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/media/image_upload_utils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/media/preview_utils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/mask/mask_editor_integration.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/app/canvas_view.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/media/canvas_blob_utils.ts', import.meta.url), 'utf8'), ]); function installPreviewStubs() { diff --git a/tests/test_canvas_context_characterization.mjs b/tests/test_canvas_context_characterization.mjs index a78ea0f..5cae8dd 100644 --- a/tests/test_canvas_context_characterization.mjs +++ b/tests/test_canvas_context_characterization.mjs @@ -2,10 +2,10 @@ import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; -import { createCanvas, createCanvasWithContext } from '../js/utils/CommonUtils.js'; +import { createCanvas, createCanvasWithContext } from '../js/utils/common_utils.js'; const maskToolSource = await readFile( - new URL('../src/mask/MaskTool.ts', import.meta.url), + new URL('../src/mask/mask_tool.ts', import.meta.url), 'utf8', ); diff --git a/tests/test_canvas_export_characterization.mjs b/tests/test_canvas_export_characterization.mjs index 0d4f68e..e28e7ab 100644 --- a/tests/test_canvas_export_characterization.mjs +++ b/tests/test_canvas_export_characterization.mjs @@ -3,7 +3,7 @@ import { readFile } from 'node:fs/promises'; import test from 'node:test'; const canvasViewSource = await readFile( - new URL('../js/app/CanvasView.js', import.meta.url), + new URL('../js/app/canvas_view.js', import.meta.url), 'utf8' ); diff --git a/tests/test_canvas_export_utils.mjs b/tests/test_canvas_export_utils.mjs index 0d79ab1..47a521a 100644 --- a/tests/test_canvas_export_utils.mjs +++ b/tests/test_canvas_export_utils.mjs @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import test from 'node:test'; -import { exportCanvasImage } from '../js/media/CanvasExportUtils.js'; +import { exportCanvasImage } from '../js/media/canvas_export_utils.js'; function installBrowserStubs() { const globalKeys = ['ClipboardItem', 'URL', 'document', 'navigator', 'window']; diff --git a/tests/test_canvas_history.mjs b/tests/test_canvas_history.mjs index ee71edb..7d1a24a 100644 --- a/tests/test_canvas_history.mjs +++ b/tests/test_canvas_history.mjs @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import test from 'node:test'; -import { HistoryStack } from '../js/canvas/CanvasHistory.js'; +import { HistoryStack } from '../js/canvas/canvas_history.js'; test('history stack keeps independent snapshots and supports undo/redo', () => { const history = new HistoryStack({ diff --git a/tests/test_canvas_input_identity_characterization.mjs b/tests/test_canvas_input_identity_characterization.mjs index caa53d7..9f8e6a0 100644 --- a/tests/test_canvas_input_identity_characterization.mjs +++ b/tests/test_canvas_input_identity_characterization.mjs @@ -3,8 +3,8 @@ import { readFile } from 'node:fs/promises'; import test from 'node:test'; const [canvasIOSource, canvasSource] = await Promise.all([ - readFile(new URL('../src/io/CanvasIO.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/canvas/Canvas.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/io/canvas_io.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas.ts', import.meta.url), 'utf8'), ]); test('CanvasIO preserves ordered source and backend image identity semantics', () => { diff --git a/tests/test_canvas_input_options_characterization.mjs b/tests/test_canvas_input_options_characterization.mjs index 2c24545..870c262 100644 --- a/tests/test_canvas_input_options_characterization.mjs +++ b/tests/test_canvas_input_options_characterization.mjs @@ -5,13 +5,13 @@ import test from 'node:test'; import { getImageAddMode, isFitOnAddEnabled, -} from '../js/utils/CanvasInputUtils.js'; +} from '../js/utils/canvas_input_utils.js'; const [canvasIOSource, canvasViewSource, interactionsSource, inputUtilsSource] = await Promise.all([ - readFile(new URL('../src/io/CanvasIO.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/app/CanvasView.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/canvas/CanvasInteractions.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/utils/CanvasInputUtils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/io/canvas_io.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/app/canvas_view.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas_interactions.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/utils/canvas_input_utils.ts', import.meta.url), 'utf8'), ]); test('image entry points use the shared fit_on_add policy', () => { diff --git a/tests/test_canvas_io_tensor_characterization.mjs b/tests/test_canvas_io_tensor_characterization.mjs index 3bebab6..49c4933 100644 --- a/tests/test_canvas_io_tensor_characterization.mjs +++ b/tests/test_canvas_io_tensor_characterization.mjs @@ -5,7 +5,7 @@ import test from 'node:test'; import { createImageFromImageData, tensorToImageData, -} from '../js/media/ImageUtils.js'; +} from '../js/media/image_utils.js'; function installImageDataCanvasStubs() { const originalDocument = Object.getOwnPropertyDescriptor(globalThis, 'document'); @@ -105,7 +105,7 @@ test('tensor to image pipeline preserves RGB pixels and data URL conversion', as }); test('CanvasIO uses one tensor-to-image helper for all RGB image entry points', async () => { - const source = await readFile(new URL('../src/io/CanvasIO.ts', import.meta.url), 'utf8'); + const source = await readFile(new URL('../src/io/canvas_io.ts', import.meta.url), 'utf8'); assert.match(source, /private async tensorToRgbImage\(/); assert.doesNotMatch(source, /convertTensorToImageData|createImageFromData/); diff --git a/tests/test_canvas_operations_characterization.mjs b/tests/test_canvas_operations_characterization.mjs index 5c2f6de..81e6f27 100644 --- a/tests/test_canvas_operations_characterization.mjs +++ b/tests/test_canvas_operations_characterization.mjs @@ -2,14 +2,14 @@ import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; -import { cloneCanvas } from '../js/utils/CommonUtils.js'; +import { cloneCanvas } from '../js/utils/common_utils.js'; const [layersSource, stateSource, maskEditorSource, commonUtilsSource, historySource] = await Promise.all([ - readFile(new URL('../src/canvas/CanvasLayers.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/canvas/CanvasState.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/mask/MaskEditorIntegration.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/utils/CommonUtils.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/canvas/CanvasHistory.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas_layers.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas_state.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/mask/mask_editor_integration.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/utils/common_utils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas_history.ts', import.meta.url), 'utf8'), ]); test('mirror commands share the selected-layer flip lifecycle', () => { diff --git a/tests/test_canvas_png_blob_characterization.mjs b/tests/test_canvas_png_blob_characterization.mjs index 38d3480..8c92784 100644 --- a/tests/test_canvas_png_blob_characterization.mjs +++ b/tests/test_canvas_png_blob_characterization.mjs @@ -3,11 +3,11 @@ import { readFile } from 'node:fs/promises'; import test from 'node:test'; const canvasIOSource = await readFile( - new URL('../src/io/CanvasIO.ts', import.meta.url), + new URL('../src/io/canvas_io.ts', import.meta.url), 'utf8' ); const canvasIOCompiledSource = await readFile( - new URL('../js/io/CanvasIO.js', import.meta.url), + new URL('../js/io/canvas_io.js', import.meta.url), 'utf8' ); diff --git a/tests/test_canvas_renderer_characterization.mjs b/tests/test_canvas_renderer_characterization.mjs index b2498b0..a4ca3f5 100644 --- a/tests/test_canvas_renderer_characterization.mjs +++ b/tests/test_canvas_renderer_characterization.mjs @@ -3,8 +3,8 @@ import { readFile } from 'node:fs/promises'; import test from 'node:test'; const [canvasIOSource, canvasLayersSource] = await Promise.all([ - readFile(new URL('../src/io/CanvasIO.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/canvas/CanvasLayers.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/io/canvas_io.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas_layers.ts', import.meta.url), 'utf8'), ]); test('output paths preserve their current render bounds and mask responsibilities', () => { diff --git a/tests/test_canvas_state_key.mjs b/tests/test_canvas_state_key.mjs index cfdd7db..b871d57 100644 --- a/tests/test_canvas_state_key.mjs +++ b/tests/test_canvas_state_key.mjs @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import test from 'node:test'; -import {getCanvasStateKey, getWorkflowIdentity} from '../js/utils/CanvasStateKey.js'; +import {getCanvasStateKey, getWorkflowIdentity} from '../js/utils/canvas_state_key.js'; test('LayerForge state keys isolate equal node IDs between workflows', () => { const firstNode = {id: 1, graph: {rootGraph: {id: 'workflow-a'}}}; diff --git a/tests/test_comfyui_integration_contracts.mjs b/tests/test_comfyui_integration_contracts.mjs index 152321c..88ca16c 100644 --- a/tests/test_comfyui_integration_contracts.mjs +++ b/tests/test_comfyui_integration_contracts.mjs @@ -3,12 +3,12 @@ import { readFile } from 'node:fs/promises'; import test from 'node:test'; const [appSource, canvasSource, canvasIOSource, webSocketSource, clipboardSource, mattingSource, routesSource, mattingApiSource] = await Promise.all([ - readFile(new URL('../src/app/CanvasView.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/canvas/Canvas.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/io/CanvasIO.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/utils/WebSocketManager.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/utils/ClipboardManager.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/utils/MattingUtils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/app/canvas_view.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/io/canvas_io.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/utils/web_socket_manager.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/utils/clipboard_manager.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/utils/matting_utils.ts', import.meta.url), 'utf8'), readFile(new URL('../python/routes.py', import.meta.url), 'utf8'), readFile(new URL('../python/matting/api.py', import.meta.url), 'utf8'), ]); diff --git a/tests/test_common_utils.mjs b/tests/test_common_utils.mjs index e8c8359..b5ca7e6 100644 --- a/tests/test_common_utils.mjs +++ b/tests/test_common_utils.mjs @@ -15,7 +15,7 @@ import { radiansToDegrees, snapToGrid, worldToLocal, -} from '../js/utils/CommonUtils.js'; +} from '../js/utils/common_utils.js'; test('common numeric helpers keep canvas math stable', () => { assert.equal(snapToGrid(95, 64), 64); diff --git a/tests/test_db_characterization.mjs b/tests/test_db_characterization.mjs index 49d0e63..a225fe9 100644 --- a/tests/test_db_characterization.mjs +++ b/tests/test_db_characterization.mjs @@ -166,7 +166,7 @@ test('IndexedDB persistence preserves state and image lifecycle behavior', async test('the worker uses shared database infrastructure for canvas-state persistence', async () => { const sharedSource = await readFile(new URL('../src/persistence/db_shared.ts', import.meta.url), 'utf8'); - const workerSource = await readFile(new URL('../src/persistence/state-saver.worker.ts', import.meta.url), 'utf8'); + const workerSource = await readFile(new URL('../src/persistence/state_saver.worker.ts', import.meta.url), 'utf8'); assert.match(sharedSource, /export const DB_NAME = 'CanvasNodeDB'/); assert.match(sharedSource, /export const STATE_STORE_NAME = 'CanvasState'/); @@ -184,7 +184,7 @@ test('the worker uses shared database infrastructure for canvas-state persistenc test('database callers share one transaction helper while preserving store and worker options', async () => { const [dbSource, workerSource] = await Promise.all([ readFile(new URL('../src/persistence/db.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/persistence/state-saver.worker.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/persistence/state_saver.worker.ts', import.meta.url), 'utf8'), ]); assert.equal((dbSource.match(/executeDBStoreRequest { const handler = new ErrorHandler(); diff --git a/tests/test_frontend_entrypoint.mjs b/tests/test_frontend_entrypoint.mjs index ade8d4f..c514fb7 100644 --- a/tests/test_frontend_entrypoint.mjs +++ b/tests/test_frontend_entrypoint.mjs @@ -3,16 +3,16 @@ import { readFile } from 'node:fs/promises'; import test from 'node:test'; const entrypointSource = await readFile( - new URL('../js/CanvasView.js', import.meta.url), + new URL('../js/canvas_view.js', import.meta.url), 'utf8' ); const implementationSource = await readFile( - new URL('../js/app/CanvasView.js', import.meta.url), + new URL('../js/app/canvas_view.js', import.meta.url), 'utf8' ); test('frontend entrypoint registers the LayerForge ComfyUI extension contract', () => { - assert.match(entrypointSource, /import \{ registerLayerForgeExtension \} from ["']\.\/app\/CanvasView\.js["']/); + assert.match(entrypointSource, /import \{ registerLayerForgeExtension \} from ["']\.\/app\/canvas_view\.js["']/); assert.match(entrypointSource, /registerLayerForgeExtension\(\);/); assert.match(implementationSource, /app\.registerExtension\(\{/); assert.match(implementationSource, /name:\s*["']Comfy\.LayerForgeNode["']/); diff --git a/tests/test_image_cache_characterization.mjs b/tests/test_image_cache_characterization.mjs index 0640eb4..26628bb 100644 --- a/tests/test_image_cache_characterization.mjs +++ b/tests/test_image_cache_characterization.mjs @@ -2,14 +2,14 @@ import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; -import { ImageCache } from '../js/media/ImageCache.js'; +import { ImageCache } from '../js/media/image_cache.js'; const sourceFiles = await Promise.all([ - readFile(new URL('../src/media/ImageCache.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/canvas/Canvas.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/canvas/CanvasLayers.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/canvas/CanvasState.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/app/CanvasView.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/media/image_cache.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas_layers.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas_state.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/app/canvas_view.ts', import.meta.url), 'utf8'), ]); test('image cache preserves key/value storage and clearing behavior', () => { @@ -37,7 +37,7 @@ test('layer persistence uses one image cache contract', () => { assert.match(cacheSource, /private cache: Map/); assert.match(cacheSource, /export class ImageCache/); assert.match(canvasSource, /imageCache: ImageCache/); - assert.match(canvasSource, /from "\.\.\/media\/ImageCache\.js"/); + assert.match(canvasSource, /from "\.\.\/media\/image_cache\.js"/); assert.doesNotMatch(canvasSource, /persistence\/ImageCache/); assert.match(canvasSource, /this\.imageCache = new ImageCache\(\)/); assert.match(layersSource, /imageCache\.set\(imageId, image\.src\)/); diff --git a/tests/test_image_loading_characterization.mjs b/tests/test_image_loading_characterization.mjs index 977d326..ccdc0ad 100644 --- a/tests/test_image_loading_characterization.mjs +++ b/tests/test_image_loading_characterization.mjs @@ -2,11 +2,11 @@ import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; -import { CanvasState } from '../js/canvas/CanvasState.js'; +import { CanvasState } from '../js/canvas/canvas_state.js'; const [canvasStateSource, maskEditorSource] = await Promise.all([ - readFile(new URL('../src/canvas/CanvasState.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/mask/MaskEditorIntegration.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas_state.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/mask/mask_editor_integration.ts', import.meta.url), 'utf8'), ]); function installImageStub() { diff --git a/tests/test_image_reference_gc_characterization.mjs b/tests/test_image_reference_gc_characterization.mjs index 715242a..2f03ba0 100644 --- a/tests/test_image_reference_gc_characterization.mjs +++ b/tests/test_image_reference_gc_characterization.mjs @@ -2,10 +2,10 @@ import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; -import { ImageReferenceManager } from '../js/persistence/ImageReferenceManager.js'; +import { ImageReferenceManager } from '../js/persistence/image_reference_manager.js'; const source = await readFile( - new URL('../src/persistence/ImageReferenceManager.ts', import.meta.url), + new URL('../src/persistence/image_reference_manager.ts', import.meta.url), 'utf8' ); diff --git a/tests/test_image_upload_characterization.mjs b/tests/test_image_upload_characterization.mjs index 59c57cb..3733f51 100644 --- a/tests/test_image_upload_characterization.mjs +++ b/tests/test_image_upload_characterization.mjs @@ -2,10 +2,10 @@ import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; -import { resolveCanvasBlob } from '../js/media/CanvasBlobUtils.js'; +import { resolveCanvasBlob } from '../js/media/canvas_blob_utils.js'; const source = await readFile( - new URL('../src/media/ImageUploadUtils.ts', import.meta.url), + new URL('../src/media/image_upload_utils.ts', import.meta.url), 'utf8' ); function getFunctionBody(functionName, nextFunctionName) { diff --git a/tests/test_image_upload_transport_characterization.mjs b/tests/test_image_upload_transport_characterization.mjs index dc736f6..71703bd 100644 --- a/tests/test_image_upload_transport_characterization.mjs +++ b/tests/test_image_upload_transport_characterization.mjs @@ -3,8 +3,8 @@ import { readFile } from 'node:fs/promises'; import test from 'node:test'; const [canvasIOSource, imageUploadSource] = await Promise.all([ - readFile(new URL('../src/io/CanvasIO.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/media/ImageUploadUtils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/io/canvas_io.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/media/image_upload_utils.ts', import.meta.url), 'utf8'), ]); test('current upload callers preserve their endpoint and form-data contracts', () => { diff --git a/tests/test_image_utils.mjs b/tests/test_image_utils.mjs index b59cd2e..015ade6 100644 --- a/tests/test_image_utils.mjs +++ b/tests/test_image_utils.mjs @@ -8,8 +8,8 @@ import { prepareImageForCanvas, tensorToImageData, validateImageData, -} from '../js/media/ImageUtils.js'; -import { ErrorTypes } from '../js/shared/ErrorHandler.js'; +} from '../js/media/image_utils.js'; +import { ErrorTypes } from '../js/shared/error_handler.js'; test('image validation accepts tensor-like payloads and normalizes array data', () => { const payload = [{ diff --git a/tests/test_layer_geometry_characterization.mjs b/tests/test_layer_geometry_characterization.mjs index b768e5f..a626ee3 100644 --- a/tests/test_layer_geometry_characterization.mjs +++ b/tests/test_layer_geometry_characterization.mjs @@ -2,8 +2,8 @@ import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; -import { CanvasRenderer } from '../js/canvas/CanvasRenderer.js'; -import { ShapeTool } from '../js/canvas/ShapeTool.js'; +import { CanvasRenderer } from '../js/canvas/canvas_renderer.js'; +import { ShapeTool } from '../js/canvas/shape_tool.js'; import { getBoundsFromPoints, @@ -12,10 +12,10 @@ import { isPointInRotatedLayer, localToWorld, worldToLocal, -} from '../js/utils/CommonUtils.js'; +} from '../js/utils/common_utils.js'; const canvasLayersSource = await readFile( - new URL('../src/canvas/CanvasLayers.ts', import.meta.url), + new URL('../src/canvas/canvas_layers.ts', import.meta.url), 'utf8' ); diff --git a/tests/test_layer_removal_characterization.mjs b/tests/test_layer_removal_characterization.mjs index c3761c5..d60df4a 100644 --- a/tests/test_layer_removal_characterization.mjs +++ b/tests/test_layer_removal_characterization.mjs @@ -2,12 +2,12 @@ import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; -import { CanvasSelection } from '../js/canvas/CanvasSelection.js'; -import { removeLayersWithLifecycle } from '../js/utils/LayerRemovalUtils.js'; +import { CanvasSelection } from '../js/canvas/canvas_selection.js'; +import { removeLayersWithLifecycle } from '../js/utils/layer_removal_utils.js'; const [canvasSource, selectionSource] = await Promise.all([ - readFile(new URL('../src/canvas/Canvas.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/canvas/CanvasSelection.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/canvas/canvas_selection.ts', import.meta.url), 'utf8'), ]); function createCanvas(layers) { diff --git a/tests/test_log_system.mjs b/tests/test_log_system.mjs index 5f06485..16db211 100644 --- a/tests/test_log_system.mjs +++ b/tests/test_log_system.mjs @@ -44,7 +44,7 @@ test('canonical logger handles levels, retention, and callsites', () => { assert.equal(logger.normalizeLevel('warning'), LogLevel.WARN); assert.equal(logger.normalizeLevel('critical'), LogLevel.FATAL); assert.equal(logger.parseJsonPayloadFromString('message {"value": 1}').value.value, 1); - assert.match(logger.formatSuffix('canvas', 'Canvas.ts:10:2'), /Canvas\.ts:10:2/); + assert.match(logger.formatSuffix('canvas', 'canvas.ts:10:2'), /canvas\.ts:10:2/); logger.setModuleLevel('quiet', LogLevel.NONE); assert.equal(logger.isLevelEnabled('quiet', LogLevel.ERROR), false); diff --git a/tests/test_manual_image_loading_characterization.mjs b/tests/test_manual_image_loading_characterization.mjs index 9943ba3..74f7e17 100644 --- a/tests/test_manual_image_loading_characterization.mjs +++ b/tests/test_manual_image_loading_characterization.mjs @@ -3,11 +3,11 @@ import { readFile } from 'node:fs/promises'; import test from 'node:test'; const [imageUtilsSource, clipboardSource, uploadSource, previewSource, viewSource] = await Promise.all([ - readFile(new URL('../src/media/ImageUtils.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/utils/ClipboardManager.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/media/ImageUploadUtils.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/media/PreviewUtils.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/app/CanvasView.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/media/image_utils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/utils/clipboard_manager.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/media/image_upload_utils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/media/preview_utils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/app/canvas_view.ts', import.meta.url), 'utf8'), ]); test('targeted image consumers use the shared Image loading lifecycle', () => { diff --git a/tests/test_mask_pixel_characterization.mjs b/tests/test_mask_pixel_characterization.mjs index d277610..48f72df 100644 --- a/tests/test_mask_pixel_characterization.mjs +++ b/tests/test_mask_pixel_characterization.mjs @@ -2,13 +2,13 @@ import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; -import { MaskTool } from '../js/mask/MaskTool.js'; +import { MaskTool } from '../js/mask/mask_tool.js'; import { applyLuminanceAsAlpha, fillInverseAlphaMask, imageDataToBinaryMask, rasterizeDistanceFieldMask, -} from '../js/mask/MaskPixelUtils.js'; +} from '../js/mask/mask_pixel_utils.js'; function installCanvasStub(sourceAlpha) { const originalDocument = Object.getOwnPropertyDescriptor(globalThis, 'document'); @@ -116,7 +116,7 @@ test('distance-field mask preserves alpha-distance behavior for transparent pixe const stubs = installCanvasStub([255, 128, 0]); try { - const { createDistanceFieldMaskSync } = await import('../js/mask/ImageAnalysis.js?characterization'); + const { createDistanceFieldMaskSync } = await import('../js/mask/image_analysis.js?characterization'); createDistanceFieldMaskSync({ width: 3, height: 1 }, 100); assert.deepEqual([...stubs.output.data], [ @@ -130,16 +130,16 @@ test('distance-field mask preserves alpha-distance behavior for transparent pixe }); test('mask consumers use one shared distance transform implementation', async () => { - const { calculateDistanceTransform } = await import('../js/mask/MaskPixelUtils.js?characterization'); - const imageAnalysisSource = await readFile(new URL('../src/mask/ImageAnalysis.ts', import.meta.url), 'utf8'); - const maskToolSource = await readFile(new URL('../src/mask/MaskTool.ts', import.meta.url), 'utf8'); + const { calculateDistanceTransform } = await import('../js/mask/mask_pixel_utils.js?characterization'); + const imageAnalysisSource = await readFile(new URL('../src/mask/image_analysis.ts', import.meta.url), 'utf8'); + const maskToolSource = await readFile(new URL('../src/mask/mask_tool.ts', import.meta.url), 'utf8'); assert.deepEqual( [...calculateDistanceTransform(new Uint8Array([1, 1, 0]), 3, 1)], [2, 1, 0], ); - assert.match(imageAnalysisSource, /from "\.\/MaskPixelUtils\.js"/); - assert.match(maskToolSource, /from "\.\/MaskPixelUtils\.js"/); + assert.match(imageAnalysisSource, /from "\.\/mask_pixel_utils\.js"/); + assert.match(maskToolSource, /from "\.\/mask_pixel_utils\.js"/); assert.match(maskToolSource, /calculateDistanceTransform\(binaryData, width, height\)/); assert.match(imageAnalysisSource, /rasterizeDistanceFieldMask\(distanceField, binaryMask, threshold, maskData\.data\)/); assert.match(maskToolSource, /rasterizeDistanceFieldMask\(distanceMap, binaryData, threshold, outputData\.data\)/); @@ -402,11 +402,11 @@ test('MaskTool feather rasterization preserves edge interpolation and threshold- }); test('CanvasIO and CanvasLayers preserve inverse-alpha mask generation', async () => { - const canvasIOSource = await readFile(new URL('../src/io/CanvasIO.ts', import.meta.url), 'utf8'); - const canvasLayersSource = await readFile(new URL('../src/canvas/CanvasLayers.ts', import.meta.url), 'utf8'); + const canvasIOSource = await readFile(new URL('../src/io/canvas_io.ts', import.meta.url), 'utf8'); + const canvasLayersSource = await readFile(new URL('../src/canvas/canvas_layers.ts', import.meta.url), 'utf8'); - assert.doesNotMatch(canvasIOSource, /from "\.\/utils\/MaskPixelUtils\.js"/); - assert.match(canvasLayersSource, /from "\.\.\/mask\/MaskPixelUtils\.js"/); + assert.doesNotMatch(canvasIOSource, /from "\.\/utils\/mask_pixel_utils\.js"/); + assert.match(canvasLayersSource, /from "\.\.\/mask\/mask_pixel_utils\.js"/); assert.match(canvasIOSource, /renderLayerVisibilityMask\(/); assert.doesNotMatch(canvasIOSource, /fillInverseAlphaMask\(visibilityData, maskData\)/); assert.match(canvasLayersSource, /fillInverseAlphaMask\(visibilityData, maskData\)/); diff --git a/tests/test_mask_processing_characterization.mjs b/tests/test_mask_processing_characterization.mjs index d825cc4..4627b33 100644 --- a/tests/test_mask_processing_characterization.mjs +++ b/tests/test_mask_processing_characterization.mjs @@ -1,11 +1,11 @@ import assert from 'node:assert/strict'; import test from 'node:test'; -import { ErrorTypes } from '../js/shared/ErrorHandler.js'; +import { ErrorTypes } from '../js/shared/error_handler.js'; import { processImageToMask, processImageWithTransform, -} from '../js/mask/MaskProcessingUtils.js'; +} from '../js/mask/mask_processing_utils.js'; function installCanvasStub(sourcePixels) { const originalDocument = Object.getOwnPropertyDescriptor(globalThis, 'document'); diff --git a/tests/test_mask_result_characterization.mjs b/tests/test_mask_result_characterization.mjs index b34a3b4..61e69d3 100644 --- a/tests/test_mask_result_characterization.mjs +++ b/tests/test_mask_result_characterization.mjs @@ -5,7 +5,7 @@ import test from 'node:test'; import { applyMaskResultToTool, createMaskImageFromResult, -} from '../js/mask/MaskResultUtils.js'; +} from '../js/mask/mask_result_utils.js'; function installMaskConversionStubs(sourcePixels) { const originalDocument = Object.getOwnPropertyDescriptor(globalThis, 'document'); @@ -140,16 +140,16 @@ test('mask result application processes before resolving and updating the target }); test('mask integrations share conversion but retain their own side effects', async () => { - const processingSource = await readFile(new URL('../src/mask/MaskProcessingUtils.ts', import.meta.url), 'utf8'); - const resultSource = await readFile(new URL('../src/mask/MaskResultUtils.ts', import.meta.url), 'utf8'); - const maskEditorSource = await readFile(new URL('../src/mask/MaskEditorIntegration.ts', import.meta.url), 'utf8'); - const samSource = await readFile(new URL('../src/mask/SAMDetectorIntegration.ts', import.meta.url), 'utf8'); + const processingSource = await readFile(new URL('../src/mask/mask_processing_utils.ts', import.meta.url), 'utf8'); + const resultSource = await readFile(new URL('../src/mask/mask_result_utils.ts', import.meta.url), 'utf8'); + const maskEditorSource = await readFile(new URL('../src/mask/mask_editor_integration.ts', import.meta.url), 'utf8'); + const samSource = await readFile(new URL('../src/mask/sam_detector_integration.ts', import.meta.url), 'utf8'); - assert.match(resultSource, /from "\.\/MaskProcessingUtils\.js"/); + assert.match(resultSource, /from "\.\/mask_processing_utils\.js"/); assert.match(resultSource, /export async function applyMaskResultToTool/); assert.doesNotMatch(processingSource, /createMaskImageFromResult|applyMaskResultToTool/); - assert.match(maskEditorSource, /from "\.\/MaskResultUtils\.js"/); - assert.match(samSource, /from "\.\/MaskResultUtils\.js"/); + assert.match(maskEditorSource, /from "\.\/mask_result_utils\.js"/); + assert.match(samSource, /from "\.\/mask_result_utils\.js"/); assert.match(maskEditorSource, /applyMaskResultToTool\(/); assert.match(samSource, /applyMaskResultToTool\(/); assert.doesNotMatch(maskEditorSource, /processImageToMask|convertToImage/); diff --git a/tests/test_matting_status_characterization.mjs b/tests/test_matting_status_characterization.mjs index 399f37d..9886cd4 100644 --- a/tests/test_matting_status_characterization.mjs +++ b/tests/test_matting_status_characterization.mjs @@ -2,10 +2,10 @@ import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; -import { fetchMattingModelStatus } from '../js/utils/MattingUtils.js'; +import { fetchMattingModelStatus } from '../js/utils/matting_utils.js'; const canvasViewSource = await readFile( - new URL('../src/app/CanvasView.ts', import.meta.url), + new URL('../src/app/canvas_view.ts', import.meta.url), 'utf8', ); diff --git a/tests/test_multi_image_input_characterization.mjs b/tests/test_multi_image_input_characterization.mjs index 217d3de..2a9d080 100644 --- a/tests/test_multi_image_input_characterization.mjs +++ b/tests/test_multi_image_input_characterization.mjs @@ -3,10 +3,10 @@ import { readFile } from 'node:fs/promises'; import test from 'node:test'; const [utilitySource, canvasViewSource, connectionsSource, canvasIOSource] = await Promise.all([ - readFile(new URL('../src/utils/MultiImageInputUtils.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/app/CanvasView.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/app/LayerForgeConnections.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/io/CanvasIO.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/utils/multi_image_input_utils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/app/canvas_view.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/app/layer_forge_connections.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/io/canvas_io.ts', import.meta.url), 'utf8'), ]); test('LayerForge exposes an ordered virtual multi-image input contract', () => { diff --git a/tests/test_persistence_resilience.mjs b/tests/test_persistence_resilience.mjs index 600e1da..3f5ec30 100644 --- a/tests/test_persistence_resilience.mjs +++ b/tests/test_persistence_resilience.mjs @@ -98,7 +98,7 @@ test('state saver worker ignores malformed messages and reports storage failures console.error = (...args) => errors.push(args); try { - await import('../js/persistence/state-saver.worker.js?resilience-worker'); + await import('../js/persistence/state_saver.worker.js?resilience-worker'); await globalThis.self.onmessage({ data: { stateKey: '', state: null } }); assert.match(errors.flat().join(' '), /Invalid data received/); diff --git a/tests/test_point_type_characterization.mjs b/tests/test_point_type_characterization.mjs index 5e16cb2..ab3992a 100644 --- a/tests/test_point_type_characterization.mjs +++ b/tests/test_point_type_characterization.mjs @@ -3,7 +3,7 @@ import { readFile } from 'node:fs/promises'; import test from 'node:test'; const commonUtilsSource = await readFile( - new URL('../src/utils/CommonUtils.ts', import.meta.url), + new URL('../src/utils/common_utils.ts', import.meta.url), 'utf8', ); const typesSource = await readFile( diff --git a/tests/test_preview_characterization.mjs b/tests/test_preview_characterization.mjs index 07459cb..49de01c 100644 --- a/tests/test_preview_characterization.mjs +++ b/tests/test_preview_characterization.mjs @@ -5,7 +5,7 @@ import { createPreviewFromBlob, createPreviewFromCanvas, loadPreviewImage, -} from '../js/media/PreviewUtils.js'; +} from '../js/media/preview_utils.js'; function installPreviewStubs({ fail = false } = {}) { const originalImage = Object.getOwnPropertyDescriptor(globalThis, 'Image'); diff --git a/tests/test_source_layout.mjs b/tests/test_source_layout.mjs index aab1a76..be07425 100644 --- a/tests/test_source_layout.mjs +++ b/tests/test_source_layout.mjs @@ -3,11 +3,11 @@ import { access, readFile } from 'node:fs/promises'; import test from 'node:test'; const requiredSourceModules = [ - '../src/app/CanvasView.ts', - '../src/canvas/Canvas.ts', - '../src/io/CanvasIO.ts', - '../src/mask/MaskTool.ts', - '../src/media/ImageUtils.ts', + '../src/app/canvas_view.ts', + '../src/canvas/canvas.ts', + '../src/io/canvas_io.ts', + '../src/mask/mask_tool.ts', + '../src/media/image_utils.ts', '../src/persistence/db.ts', '../src/shared/types.ts', ]; @@ -15,13 +15,13 @@ const requiredSourceModules = [ test('frontend source layout keeps domain modules and a single registration bootstrap', async () => { await Promise.all(requiredSourceModules.map((path) => access(new URL(path, import.meta.url)))); - const bootstrapSource = await readFile(new URL('../src/CanvasView.ts', import.meta.url), 'utf8'); - const implementationSource = await readFile(new URL('../src/app/CanvasView.ts', import.meta.url), 'utf8'); - const canvasStateSource = await readFile(new URL('../src/canvas/CanvasState.ts', import.meta.url), 'utf8'); + const bootstrapSource = await readFile(new URL('../src/canvas_view.ts', import.meta.url), 'utf8'); + const implementationSource = await readFile(new URL('../src/app/canvas_view.ts', import.meta.url), 'utf8'); + const canvasStateSource = await readFile(new URL('../src/canvas/canvas_state.ts', import.meta.url), 'utf8'); assert.match(bootstrapSource, /registerLayerForgeExtension\(\);/); assert.match(implementationSource, /export function registerLayerForgeExtension\(\)/); assert.match(implementationSource, /app\.registerExtension\(\{/); assert.doesNotMatch(implementationSource, /^registerLayerForgeExtension\(\);/m); - assert.match(canvasStateSource, /new URL\('\.\.\/persistence\/state-saver\.worker\.js'/); + assert.match(canvasStateSource, /new URL\('\.\.\/persistence\/state_saver\.worker\.js'/); }); diff --git a/tests/test_stability_characterization.mjs b/tests/test_stability_characterization.mjs index d84a6c1..d74f25b 100644 --- a/tests/test_stability_characterization.mjs +++ b/tests/test_stability_characterization.mjs @@ -1,8 +1,8 @@ import assert from 'node:assert/strict'; import test from 'node:test'; -import {HistoryStack} from '../js/canvas/CanvasHistory.js'; -import {ImageReferenceManager} from '../js/persistence/ImageReferenceManager.js'; +import {HistoryStack} from '../js/canvas/canvas_history.js'; +import {ImageReferenceManager} from '../js/persistence/image_reference_manager.js'; function createReferenceCanvas(layers = []) { return { diff --git a/tests/test_variant_and_get_all_keys_characterization.mjs b/tests/test_variant_and_get_all_keys_characterization.mjs index 123c5bd..173dec7 100644 --- a/tests/test_variant_and_get_all_keys_characterization.mjs +++ b/tests/test_variant_and_get_all_keys_characterization.mjs @@ -3,8 +3,8 @@ import { readFile } from 'node:fs/promises'; import test from 'node:test'; const [blobSource, exportSource, dbSource, sharedSource] = await Promise.all([ - readFile(new URL('../src/media/CanvasBlobUtils.ts', import.meta.url), 'utf8'), - readFile(new URL('../src/media/CanvasExportUtils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/media/canvas_blob_utils.ts', import.meta.url), 'utf8'), + readFile(new URL('../src/media/canvas_export_utils.ts', import.meta.url), 'utf8'), readFile(new URL('../src/persistence/db.ts', import.meta.url), 'utf8'), readFile(new URL('../src/persistence/db_shared.ts', import.meta.url), 'utf8'), ]);