# EyeOpener Port — Project State

## What This Is
A faithful parallel port of the Cooper & Peters EyeOpener widget library (Java 1.0, 1996) to vanilla JavaScript/Canvas. The goal is a **historical artifact** — people should be able to open it in a modern browser and see exactly what this toolkit looked like running as a Java applet in Netscape Navigator on a 386 with a 28.8 modem. This is not a modernization or reimagining.

## Authors
- Original Java library: Ken Cooper and Ted Peters (cnp.ew package, 1996)
- JavaScript port: Ted Peters with Claude (2026)

## Source Locations
- **Original Java source:** `srcWeb/cnp/ew/` (24 packages, ~323 files)
- **Old JS port (partial, has gaps/inconsistencies):** `ew-canvas/src/`
- **Clean JS port (faithful, in progress):** `ew-canvas/src2/` *(not yet started)*
- **Demo pages:** `ew-canvas/demos/` (standalone HTML+JS pages mirroring original Java demos in `srcWeb/`)

## Port Strategy
Clean port into `ew-canvas/src2/`, working bottom-up through the dependency tree. Each Java class is translated faithfully — same class names, same method names, same structure. No underscore-prefix naming conventions. No shimming or skipping methods. The Java source is the spec; if it's translated correctly, it works, because Cooper and Peters already debugged it.

Modifications from Java are limited to what's necessary for the platform change: Canvas 2D API instead of AWT Graphics, JS string instead of char arrays, JS modules instead of packages, etc.

## Dependency Order (bottom-up)

### Group A — Foundation (port as a unit, has internal circular deps)
- **util** — Observable, Timer, Fonts, etc. (used by 21 packages)
- **converter** — data converters (circular dep with util)
- **lightweight** — AbstractLc, component framework (used by 19 packages)
- **layout** — AttachmentsLayout, GridLayout, etc. (circular dep with lightweight)
- **displayer** — border displayers, painters (circular dep with image)
- **image** — image handling (circular dep with displayer)

### Group B — UI Components
- **text** — EntryField, Label, text editing
- **misc** — miscellaneous widgets
- **button** — ButtonLc, checkbox, labeled/image buttons
- **properties** — property system (circular dep with button)
- **spin** — spin editors

### Group C — Scrolling & Lists
- **scrolling** — ScrollingController, scrollbars (circular dep with slider)
- **slider** — SliderLc
- **list** — ListboxLc, ColumnarListbox, TreeListbox

### Group D — Complex Widgets
- **diagram** — DiagramLc, connectors, shapes
- **charts** — chart widgets (circular dep with grid)
- **grid** — grid/spreadsheet (heaviest, imports 15 packages)
- **notebook** — tabbed notebook

### Group E — Applications (surprisingly independent)
- **calendar** — CalendarLc
- **dialog** — dialog system
- **richtext** — rich text editor

## Working Style
- **Short leash:** Plan together, execute one step, check in with Ted.
- **Ask, don't debug solo:** If something doesn't work, describe it and ask Ted rather than burning tokens on debugging loops.
- **Ted is watching:** He can test in the browser faster than screenshots. Use him.
- **Token-conscious:** Avoid unnecessary file reads, exploration agents, and screenshot loops. Talk is cheap, tools are expensive.

## Old Port Status (ew-canvas/src/)
The old port in `ew-canvas/src/` has ~72 JS files across core/, widgets/, layout/, displayer/, list/, scrolling/, notebook/, slider/, spin/, calendar/, diagram/, richtext/. It works for demo purposes but has:
- Missing methods (shimmed as needed per demo)
- Underscore-prefix naming convention (not in original Java)
- Incomplete class translations (only methods needed for current demos)
- Subtle behavioral bugs from the above gaps

The old port and `demo.js` remain as-is for reference. The clean port in `src2/` will eventually replace it.

## Demo Page Pattern (established)
Standalone demo pages live in `ew-canvas/demos/`. Pattern:
- `foo-demo.html` — HTML with canvas element, loads `foo-demo.js` as module
- `foo-demo.js` — imports from library, builds UI, mounts to LcPanel
- Each mirrors an original Java demo from `srcWeb/` (e.g., CpButtonDemo.java)
- `button-demo.html/.js` exists as the template

## What's Next
Start the clean port at Group A (util package), working bottom-up.
