ByeText is structured as a stateful text engine:
document.tsowns runs, dirty ranges, caches, and active plugins.measure.tswraps canvas measurement with a two-level cache and deterministic keys.break.tstokenizes measured runs into segment widths and computes line boundaries with prefix sums and binary search.layout.tsperforms full or incremental relayout and rebuilds lookup indices.render.tsredraws only dirty regions on a single 2D canvas.plugin.tsexposes structural extension points instead of method monkey-patching.
The core package stays dependency-free and tree-shakeable. Optional behavior lives in plugin packages.