{"_id":"@ancora/core","name":"@ancora/core","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@ancora/core","version":"0.1.0","description":"Framework-agnostic core for ancora: pin state machine, scroll-source discrimination, anchor math, and list-operation inference for pixel-stable chat/streaming lists.","license":"MIT","author":{"name":"Asish Samanta"},"type":"module","main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"sideEffects":false,"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest run","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"keywords":["virtualization","virtual-list","chat","streaming","scroll","stick-to-bottom","pin","anchor","headless"],"repository":{"type":"git","url":"git+https://github.com/asish-dev/ancora.git","directory":"packages/core"},"homepage":"https://github.com/asish-dev/ancora/tree/main/packages/core#readme","bugs":{"url":"https://github.com/asish-dev/ancora/issues"},"publishConfig":{"access":"public"},"engines":{"node":">=18"},"devDependencies":{"fast-check":"^3.23.0","tsup":"^8.3.0","typescript":"^5.7.0","vitest":"^2.1.0"},"_id":"@ancora/core@0.1.0","gitHead":"3bda6ae3a443681aea66bc6b5e719825d8717aef","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-MBQb4cyIl6oLgwgg1h6SqRMAvVjjDNKuoTQ/eGQo4jnqZ6S6SIQ8uksc7M2tLXhTMh4c3e991zbPT9cHNynotQ==","shasum":"8f9b9b9b6f6bb6d113d66f9c3ba52e429a3775b0","tarball":"https://registry.npmjs.org/@ancora/core/-/core-0.1.0.tgz","fileCount":9,"unpackedSize":80877,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBk1V4k/IxUAavrH522/AL3qLuVMmFqHnIaFoqDP9VZ3AiEAsd9RwM2J8UTsYBSmYbJKmvBbdsAKGuT2lxO+F4wgkoQ="}]},"_npmUser":{"name":"chad-dev","email":"asish043@gmail.com"},"directories":{},"maintainers":[{"name":"chad-dev","email":"asish043@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_0.1.0_1786558168214_0.961253551547925"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-12T18:09:28.113Z","0.1.0":"2026-08-12T18:09:28.357Z","modified":"2026-08-12T18:09:28.522Z"},"maintainers":[{"name":"chad-dev","email":"asish043@gmail.com"}],"description":"Framework-agnostic core for ancora: pin state machine, scroll-source discrimination, anchor math, and list-operation inference for pixel-stable chat/streaming lists.","homepage":"https://github.com/asish-dev/ancora/tree/main/packages/core#readme","keywords":["virtualization","virtual-list","chat","streaming","scroll","stick-to-bottom","pin","anchor","headless"],"repository":{"type":"git","url":"git+https://github.com/asish-dev/ancora.git","directory":"packages/core"},"author":{"name":"Asish Samanta"},"bugs":{"url":"https://github.com/asish-dev/ancora/issues"},"license":"MIT","readme":"# @ancora/core\n\nFramework-agnostic core behind [ancora](https://github.com/asish-dev/ancora) —\nthe pixel-stable virtualized message list for AI chat and streaming logs.\n\n**Most people want [`@ancora/react`](https://www.npmjs.com/package/@ancora/react),\nnot this package.** `@ancora/core` is the headless engine: pure logic, no DOM,\nno framework. Use it directly only if you are building an ancora adapter for\nanother framework (Vue, Svelte, Solid, …).\n\n```bash\nnpm install @ancora/core\n```\n\n## What's inside\n\n| Export | Responsibility |\n| --- | --- |\n| `PinController` | The pin/unpin state machine and scroll-source discrimination (user vs programmatic vs browser-clamp). Consumes scroll metrics + input signals; tells the host when to correct. |\n| `AnchorTracker` | Reading-mode anchor math: capture a reference item and compute the absolute scroll target that keeps it stationary across mutations. |\n| `ExpectedOffsetLedger` | Records programmatic scroll writes so their resulting scroll events aren't misread as user intent. |\n| `inferOperations` | Compiles a change of the message-key array into semantic operations (`prepend`, `append`, `growTail`, `swapKey`, `remove`, `reset`). |\n\n## Contract\n\nAn adapter drives the core from its framework's pre-paint commit phase\n(`useLayoutEffect` in React): feed scroll events and input signals into\n`PinController`, ask it for a correction, and apply that scroll write inside the\nsame commit — before paint. This timing is the whole game; correcting a frame\nlate (rAF / ResizeObserver) reintroduces the jitter the library exists to\nremove.\n\nSee the [pin contract](https://github.com/asish-dev/ancora/blob/main/docs/spec/pin-contract.md)\nand [operation-inference spec](https://github.com/asish-dev/ancora/blob/main/docs/spec/operation-inference.md)\nfor the precise, testable behavior.\n\n## License\n\nMIT © Asish Samanta\n","readmeFilename":"README.md","_rev":"1-1d36e24f290786729481ec3a55cbbc8f"}