Skip to content

Conversation

@Crypt212
Copy link
Owner

No description provided.

Crypt212 added 29 commits April 12, 2025 22:12
- Add HEX/RGB/HSL conversions
- Implement alpha channel support
- Add color validation
- Complete test coverage
- Add core pixel tracking functionality
- Include 22 unit tests for all methods
- Document API usage in Markdown
refactor: deprecate validateColorArray
- Converted Color class to be fully immutable (all properties private/frozen)
- Added caching mechanism using static Map to reuse existing color instances
- Implemented Symbol-keyed constructor to enforce factory pattern
- Added validation for all color inputs (RGB, HSL, Hex)
- Maintained all existing functionality (conversions, mixing, comparisons)
- Added cache management methods (clearCache, cacheSize)
- Updated tests to verify immutability and caching behavior

Benefits:
- Improved performance by avoiding duplicate color instances
- Safer usage due to immutability
- Maintained backward compatibility with existing API
- Added Color Class and DirtyRectangle as a composed dependancy in CanvasGrid
- Modified initializeBlankCanvas, loadImage and setColor to utilize
the new Color Class integration
- Modified class constructor, initializeBlankCanvas and setColor methods
  to utilize the DirtyRectangle Class integration
- Maintained existing pixel matrix API

refactor: rename lastChange property and methods to ChangeBuffer

- Added ColorClass as a composed dependancy in CanvasGrid
- Modified initializeBlankCanvas, loadImage and setColor to utilize the new integeration
- Maintained existing pixel matrix API

doc: complete documentation for CanvasGrid class and add markdown jsdocs file

test: update test suite for modified CanvasGrid API
- Fixed undo/redo edge cases and addActionGroup buffer management
- Refactored circular buffer logic for clarity
- Added comprehensive JSDoc with usage examples
- Expanded test coverage for:
  - Buffer wraparound scenarios
  - Consecutive undo/redo operations
  - Action data shallow copying
- Generated API documentation (jsdoc-to-markdown)
feat(color): add compositeOver method for compositing one color over another
… of 10% and more edge cases, increasing number of tests to 57
test(pixel-layer): enhance existing weak tests and add more tests for
edge cases and uncovered branches, with number of tests reaching 25 tests
- Renamed `ActionHistory` → `History` for broader use cases
- Moved from `scripts/action-history.js` → `src/services/history.js`
- Simplified API:
  - `addActionGroup()` → `addRecord()`
  - `addActionData()` → `setRecordData()`
  - Removed action group names (now ID-only)
  - Record data is now a generic object
- Added `isStart`/`isEnd` getters for clearer state checks
- Improved index wrapping logic with `#wrapIndex()`
- Updated tests (moved/renamed test file accordingly)

BREAKING CHANGES:
- All `ActionHistory` imports must be updated to `History`
- Method signatures changed (no more action group names)
…ling

- Moved `pixel-layer.js` from `scripts/` to `src/core/layers/`
- Replaced `ActionHistory` with generic `History` service
- Added action lifecycle methods:
  - `startAction()` with timeout protection (default: 30s)
  - `endAction()` and `cancelAction()` for explicit control
  - Batched steps (max 10 steps or 100 changes) for performance
- Improved undo/redo:
  - Auto-merges small steps before applying
  - Added safety checks for active actions
  - 1000-step cancellation: 384ms → 65ms
  - Memory footprint reduced by 30% for large actions
- Stricter validation:
  - `setColor()` throws if called outside an action (unless `quietly: true`)
  - Added `isInAction` getter to check state

BREAKING CHANGES:
- `createAction()` → `startAction()`
- `commitChange()` → `addActionStep()`
- Requires `History` service instead of `ActionHistory`
…ve to services

- Added:
  - `mergeInPlace()` for performance-critical mutable merges
  - `length` getter to check change count
- Changed:
  - Moved from `scripts/` to `src/services/` (updated imports to `#`)
- Tests:
  - Added tests for `mergeInPlace()`
  - Moved tests to `tests/services/`
@Crypt212 Crypt212 closed this Jul 10, 2025
@Crypt212 Crypt212 deleted the rescue-operation branch July 10, 2025 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants