difurious/lightweight-charts-line-tools-core — reverse-engineered prompt

Reverse engineered prompt

GitHub

Build me a TypeScript core plugin for Lightweight Charts v5 that lets drawing tool plugins work on a chart, kind of like the old v3.8 line tools build but modern and modular.

I don’t need the actual rectangle, trend line, text, fib, or other tools included here. I need the shared core that those tools can register with. It should handle the chart interaction stuff, like click to draw, hover, selection, dragging tool bodies, dragging anchor points, coordinate conversion, infinite line clipping, shift key constraints, axis labels, and clean state management.

Please make it usable as a library, with a simple create plugin function, a way to register tool classes by name, and an API to start drawing a registered tool. Include a small browser test page that shows it working with Lightweight Charts and one dummy or example tool if needed.

Set up the build so it outputs browser and modern bundler versions, sourcemaps, and generated docs. Look up current Lightweight Charts v5 plugin docs online if you need to.

Want more depth? Deep Reverse