mirror of
https://github.com/tiennm99/rplace.git
synced 2026-10-11 03:13:48 +00:00
Replaces the synchronous reactive pipeline with a debounced worker RPC. Slider drags and file loads no longer block the main thread. - image-pipeline.js: pure staged pipeline (transform → resize → color-correction → quantize). Each upstream stage keeps one cached slot keyed on the inputs it depends on, so a single-slider change reruns only the downstream stages. - image-pipeline-worker.js: hosts the pipeline inside a module Worker. Accepts set-source (transferable) and run(params). Returns indices + preview RGBA as transferable ArrayBuffers. - image-pipeline-client.js: main-thread RPC with request-id tracking and stale-response dropping. - ImageImporter.svelte: two-tier scheduler — throttled quick request (<=384px) for the preview panel while inputs churn, debounced full request (180ms) for overlay/buildPixels/opaque-count on settle. Source buffer cloned and transferred to the worker on load/resume. Main bundle shrinks ~4KB (pipeline code now in its own worker chunk).