Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
# Agent Notes

FidoCadJS is a TypeScript browser port of FidoCadJ, built with Vite, Vitest,
and jsdom. Keep the project small, readable, and close to the Java reference
where that helps preserve FCL behavior.
FidoCadJS is a self-contained FidoCad parser and editor implemented in TypeScript, built with Vite, Vitest,
and jsdom. It was originaly developed as a browser port of FidoCadJ.

## Goals

- Preserve compatibility with the FidoCadJ file format and drawing semantics.
- Prefer clear TypeScript over broad abstractions.
- Keep browser behavior deterministic and covered by focused tests.
- Use `~/FidoCadJ` only as read-only reference material.
- Keep dependencies minimal; ask before adding any new package.

## Quality Rules

- Read `AGENTS.md` before meaningful work.
- Write tests alongside new modules and meaningful behavior changes.
- Run the relevant build or test command after non-trivial edits.
- Comment only where code intent is not obvious from local context.
Expand Down Expand Up @@ -44,4 +41,4 @@ where that helps preserve FCL behavior.
- Use `npm test` for the main Vitest suite.
- Use `npm run build` for production build validation.
- Use Playwright or browser tests only when changing interactive UI behavior.

- Prefer e2e tests to unit tests.
177 changes: 0 additions & 177 deletions MINIMAL-FIDOSPECS.md

This file was deleted.

8 changes: 0 additions & 8 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/**
* @file app.ts
* @author Dante Loi
* @date 2026-04-24
* @brief Application entry point & UI bootstrap
* @copyright Copyright 2026 Dante Loi - GPL v3
*/

import { CircuitPanel } from './circuit/CircuitPanel.js';
import { loadStandardLibraries } from './circuit/controllers/LibraryLoader.js';
import { LibraryModel } from './librarymodel/LibraryModel.js';
Expand Down
11 changes: 0 additions & 11 deletions src/circuit/CanvasManager.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
/**
* @file CanvasManager.ts
* @author Dante Loi
* @date 2026-05-13
* @brief Canvas element lifecycle manager extracted from CircuitPanel
* @copyright Copyright 2026 Dante Loi - GPL v3
* @details Handles canvas creation, ResizeObserver for responsive sizing,
* device-pixel-ratio change detection, and cleanup on destroy.
* Extracted during agent-friendly refactoring (P2.1).
*/

export class CanvasManager {
readonly canvas: HTMLCanvasElement;
private container: HTMLElement;
Expand Down
52 changes: 0 additions & 52 deletions src/circuit/CircuitPanel.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/**
* @file CircuitPanel.ts
* @author Dante Loi
* @date 2026-04-24
* @brief Main editor panel controller coordinating input, model, and views
* @copyright Copyright 2026 Dante Loi - GPL v3
*/

import { DrawingModel } from './model/DrawingModel.js';
import { ParserActions } from './controllers/ParserActions.js';
import { MapCoordinates } from '../geom/MapCoordinates.js';
Expand Down Expand Up @@ -372,10 +364,6 @@ export class CircuitPanel implements KeyboardHost, EditorFacade {
this.onZoomChange?.();
}

getZoom(): number {
return this.mapCoordinates.getXMagnitude();
}

isSnapActive(): boolean {
return this.mapCoordinates.getSnap();
}
Expand Down Expand Up @@ -990,46 +978,6 @@ export class CircuitPanel implements KeyboardHost, EditorFacade {
isImageAttached(): boolean {
return this.model.getImgCanvas().isAttached();
}

getImageAlpha(): number {
return this.model.getImgCanvas().getAlpha();
}

setImageAlpha(a: number): void {
this.model.getImgCanvas().setAlpha(a);
this.model.setModified(true);
this.render();
}

getImageScale(): number {
return this.model.getImgCanvas().getScale();
}

setImageScale(s: number): void {
this.model.getImgCanvas().setScale(s);
this.model.setModified(true);
this.render();
}

getImageX(): number {
return this.model.getImgCanvas().getX();
}

setImageX(x: number): void {
this.model.getImgCanvas().setX(x);
this.model.setModified(true);
this.render();
}

getImageY(): number {
return this.model.getImgCanvas().getY();
}

setImageY(y: number): void {
this.model.getImgCanvas().setY(y);
this.model.setModified(true);
this.render();
}
}

function hexToRgb(hex: string): { r: number; g: number; b: number } {
Expand Down
11 changes: 0 additions & 11 deletions src/circuit/ContextMenuManager.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
/**
* @file ContextMenuManager.ts
* @author Dante Loi
* @date 2026-05-13
* @brief Context menu management extracted from CircuitPanel
* @copyright Copyright 2026 Dante Loi - GPL v3
* @details Builds and shows the right-click context menu, handles add/remove
* node actions. Extracted mechanically during agent-friendly refactoring
* (P2.6).
*/

import { getString } from '../i18n/i18n.js';
import { ContextMenu } from '../ui/ContextMenu.js';
import { PrimitiveMacro } from '../primitives/PrimitiveMacro.js';
Expand Down
20 changes: 0 additions & 20 deletions src/circuit/EditorFacade.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
/**
* @file EditorFacade.ts
* @author Dante Loi
* @date 2026-05-13
* @brief Narrow interface that UI components consume instead of concrete CircuitPanel
* @copyright Copyright 2026 Dante Loi - GPL v3
* @details Extracted during agent-friendly refactoring. This interface exposes only
* the methods and properties that UI classes (ToolbarController, MenuBar,
* PropertiesPanelController, ExportDialog, SettingsManager) actually call.
* CircuitPanel implements this interface so UI code can be mocked in tests.
*/

import type { MapCoordinates } from '../geom/MapCoordinates.js';
import type { DrawingModel } from './model/DrawingModel.js';
import type { LayerDesc } from '../layers/LayerDesc.js';
Expand Down Expand Up @@ -112,12 +100,4 @@ export interface EditorFacade {
attachImage(file: File): Promise<void>;
detachImage(): void;
isImageAttached(): boolean;
getImageAlpha(): number;
setImageAlpha(a: number): void;
getImageScale(): number;
setImageScale(s: number): void;
getImageX(): number;
setImageX(x: number): void;
getImageY(): number;
setImageY(y: number): void;
}
Loading
Loading