This repository is a TypeScript-based web library designed for browser screenshot capture and annotation. It functions as a plugin that initializes a DOM overlay, captures screen content via multiple strategies (WebRTC, html2canvas, DOM rendering), and provides a rich annotation interface for drawing shapes, text, and cropping. The architecture is monolithic, bundling into UMD, ESM, and CommonJS formats via Rollup, and utilizes MobX for reactive state management across canvas elements and UI components. The system relies on a core entry point in `src/main.ts` which exports the `ScreenShot` class. Data flows from the source manager selecting a capture strategy, rendering to an HTML5 Canvas, and then managing user interactions through a centralized store system. External dependencies include `html2canvas` for DOM capture, `nanoid` for ID generation, and `mobx` for state. The codebase includes comprehensive unit testing via Jest and E2E testing via Playwright, indicating a focus on reliability. While the library is well-structured with clear separation of concerns between application logic, canvas features, and shared utilities, it is tightly coupled to the browser environment and specific canvas element types. The presence of a `TEST_IMPROVEMENT_PLAN.md` suggests ongoing refinement of test coverage, but the core architecture remains stable and functional for its intended domain of web-based screenshot tools.
pdf-annotate.js is a JavaScript library that provides an annotation layer for PDF.js, enabling users to add various types of annotations (highlight, underline, strikethrough, freehand drawing, text boxes, points, shapes) to PDF documents. The library features a modular architecture with separate concerns for UI interactions, rendering, storage adapters, and accessibility. It integrates with PDF.js to render PDF pages and overlays annotation SVGs, handling coordinate transformations that account for viewport scaling and rotation. The library provides a storage adapter pattern for persisting annotations (with implementations for localStorage), comprehensive UI components for annotation creation and editing, and accessibility features for screen reader users through clever DOM manipulation techniques.