{"_id":"@affino/selection-core","_rev":"8-565f60214ad90ad3b3cd7a99851fb20c","name":"@affino/selection-core","dist-tags":{"alpha":"1.0.0-alpha.1","latest":"1.1.1"},"versions":{"1.0.0-alpha.0":{"name":"@affino/selection-core","version":"1.0.0-alpha.0","keywords":["selection","grid","table","spreadsheet","headless"],"author":{"name":"Anton Pavlov","email":"pavlov@myyahho.com"},"license":"MIT","_id":"@affino/selection-core@1.0.0-alpha.0","maintainers":[{"name":"affino","email":"anton.pavlov.personal@gmail.com"}],"homepage":"https://github.com/affino/affino#readme","bugs":{"url":"https://github.com/affino/affino/issues"},"dist":{"shasum":"f420b367f34d3e58e934b001eca5debb61bf2172","tarball":"https://registry.npmjs.org/@affino/selection-core/-/selection-core-1.0.0-alpha.0.tgz","fileCount":27,"integrity":"sha512-QuXSQ7lSgfrXRm5nrzfbNWRaKcgzquAIWx7S9q/VVt0dxXejB+s95GuLiVT37+YvP52KHfPTWJMcFGGPvEl4Hg==","signatures":[{"sig":"MEUCIQDaC3NGxKl+RqQN+0+qUBxX0KwzKSisL6NIxqkm1IQXBQIgJxwVeFZVOHS0xYpVGQfHFil+rX4spqHVOZndZnvRfEU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45735},"main":"dist/index.js","type":"module","_from":"file:affino-selection-core-1.0.0-alpha.0.tgz","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./store":{"types":"./dist/store.d.ts","import":"./dist/store.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.json"},"_npmUser":{"name":"affino","email":"anton.pavlov.personal@gmail.com"},"_resolved":"/tmp/e14b900213ba5f8b7656fc19f0d9c474/affino-selection-core-1.0.0-alpha.0.tgz","_integrity":"sha512-QuXSQ7lSgfrXRm5nrzfbNWRaKcgzquAIWx7S9q/VVt0dxXejB+s95GuLiVT37+YvP52KHfPTWJMcFGGPvEl4Hg==","repository":{"url":"git+https://github.com/affino/affino.git","type":"git"},"_npmVersion":"10.8.2","description":"Framework-agnostic table selection primitives for grids and spreadsheets","directories":{},"sideEffects":false,"_nodeVersion":"20.19.6","_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.15","@vitest/coverage-v8":"^4.0.15"},"_npmOperationalInternal":{"tmp":"tmp/selection-core_1.0.0-alpha.0_1765919816002_0.677953230449621","host":"s3://npm-registry-packages-npm-production"}},"1.0.0-alpha.1":{"name":"@affino/selection-core","version":"1.0.0-alpha.1","keywords":["selection","grid","table","spreadsheet","headless"],"author":{"name":"Anton Pavlov","email":"pavlov@myyahho.com"},"license":"MIT","_id":"@affino/selection-core@1.0.0-alpha.1","maintainers":[{"name":"affino","email":"anton.pavlov.personal@gmail.com"}],"homepage":"https://ui.unitlab.io","bugs":{"url":"https://github.com/affinio/affinio/issues"},"dist":{"shasum":"5e1bcb8d8d8a7a36624daf26b9ef823014c2161c","tarball":"https://registry.npmjs.org/@affino/selection-core/-/selection-core-1.0.0-alpha.1.tgz","fileCount":27,"integrity":"sha512-+0A7aGL6ezWSAPQkuJDhaGbTypX4h9+aFVblkeWf6hyaSAlJ/xLqzYibk8PoWCTOszoz6F26dZxDQ6v4S/cMvA==","signatures":[{"sig":"MEUCIQD6z+CnEXzxGdYTSKjeDA3ceZA7IbOIssf/+imcbk4KJAIgTEm543n+GOJ8lmN2xeXwVfwMAI/rpIU1mkTE2/93sLs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45806},"main":"dist/index.js","type":"module","_from":"file:affino-selection-core-1.0.0-alpha.1.tgz","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./store":{"types":"./dist/store.d.ts","import":"./dist/store.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.json"},"_npmUser":{"name":"affino","email":"anton.pavlov.personal@gmail.com"},"_resolved":"/tmp/fed7d8cf54de58a0899c24a4fc8b3eb8/affino-selection-core-1.0.0-alpha.1.tgz","_integrity":"sha512-+0A7aGL6ezWSAPQkuJDhaGbTypX4h9+aFVblkeWf6hyaSAlJ/xLqzYibk8PoWCTOszoz6F26dZxDQ6v4S/cMvA==","repository":{"url":"git+https://github.com/affinio/affinio.git#main","type":"git"},"_npmVersion":"10.8.2","description":"Framework-agnostic table selection primitives for grids and spreadsheets","directories":{},"sideEffects":false,"_nodeVersion":"20.19.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"vitest":"^4.0.15","@vitest/coverage-v8":"^4.0.15"},"_npmOperationalInternal":{"tmp":"tmp/selection-core_1.0.0-alpha.1_1765925377075_0.5106645785552693","host":"s3://npm-registry-packages-npm-production"}},"1.0.0-alpha.2":{"name":"@affino/selection-core","version":"1.0.0-alpha.2","keywords":["selection","grid","table","spreadsheet","headless"],"author":{"name":"Anton Pavlov","email":"a.pavlov@affino.dev"},"license":"MIT","_id":"@affino/selection-core@1.0.0-alpha.2","maintainers":[{"name":"affino","email":"anton.pavlov.personal@gmail.com"}],"homepage":"https://affino.dev","bugs":{"url":"https://github.com/affinio/affinio/issues"},"dist":{"shasum":"6f55610fe35604fef5a4d83ed4e17749cad0989d","tarball":"https://registry.npmjs.org/@affino/selection-core/-/selection-core-1.0.0-alpha.2.tgz","fileCount":27,"integrity":"sha512-LWbFa+RevFqRxG1vixSC16pao0CY1B9c6WKRI5QXdhpepvDX6Z2lIH6U6/Vr2zRfIp9+OWiYCGTmZHO7wolAWg==","signatures":[{"sig":"MEYCIQDY/TgHBK0l7fNJNOCEGyigkNqtv4/NKCNAGZ69SDjjiwIhAM6BjIvjFRRgqcAJ6whz9OmlhFAQNNoGAr8HwIOC3Gej","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45807},"main":"dist/index.js","type":"module","_from":"file:affino-selection-core-1.0.0-alpha.2.tgz","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./store":{"types":"./dist/store.d.ts","import":"./dist/store.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.json"},"_npmUser":{"name":"affino","email":"anton.pavlov.personal@gmail.com"},"_resolved":"/tmp/419e9365720190dff6ddbf5d680d9cb1/affino-selection-core-1.0.0-alpha.2.tgz","_integrity":"sha512-LWbFa+RevFqRxG1vixSC16pao0CY1B9c6WKRI5QXdhpepvDX6Z2lIH6U6/Vr2zRfIp9+OWiYCGTmZHO7wolAWg==","repository":{"url":"git+https://github.com/affinio/affinio.git#main","type":"git"},"_npmVersion":"10.8.2","description":"Framework-agnostic headless selection primitives for grids and spreadsheets","directories":{},"sideEffects":false,"_nodeVersion":"20.19.6","_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.15","@vitest/coverage-v8":"^4.0.15"},"_npmOperationalInternal":{"tmp":"tmp/selection-core_1.0.0-alpha.2_1765983977956_0.0038899166703736388","host":"s3://npm-registry-packages-npm-production"}},"1.0.0-alpha.3":{"name":"@affino/selection-core","version":"1.0.0-alpha.3","keywords":["selection","grid","table","spreadsheet","headless"],"author":{"name":"Anton Pavlov","email":"a.pavlov@affino.dev"},"license":"MIT","_id":"@affino/selection-core@1.0.0-alpha.3","maintainers":[{"name":"affino","email":"anton.pavlov.personal@gmail.com"}],"homepage":"https://affino.dev","bugs":{"url":"https://github.com/affinio/affinio/issues"},"dist":{"shasum":"7f6cd809e5a93fc103485e584ca5175e3b40306e","tarball":"https://registry.npmjs.org/@affino/selection-core/-/selection-core-1.0.0-alpha.3.tgz","fileCount":27,"integrity":"sha512-uE0kbrev4XZTbOE/W0mChxGjFa+L/NURobELDgmJQt18ssir8c84LMkyJmcX9ORGpOJWK7KLnMW4mIoEYYhjgA==","signatures":[{"sig":"MEQCIGsswqgOhDhNv5odoZd3fALI6PSr6Aq0xDRluvoRdfFpAiAUsZpfUIyheW6lb8sNZpIw48gXFFHpyiLChGBtmwwfrA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45817},"main":"dist/index.js","type":"module","_from":"file:affino-selection-core-1.0.0-alpha.3.tgz","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./store":{"types":"./dist/store.d.ts","import":"./dist/store.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.json"},"_npmUser":{"name":"affino","email":"anton.pavlov.personal@gmail.com"},"_resolved":"/tmp/d289aeedcf8b0dd314a88c0bfb2b5d10/affino-selection-core-1.0.0-alpha.3.tgz","_integrity":"sha512-uE0kbrev4XZTbOE/W0mChxGjFa+L/NURobELDgmJQt18ssir8c84LMkyJmcX9ORGpOJWK7KLnMW4mIoEYYhjgA==","repository":{"url":"git+https://github.com/affinio/affinio.git#main","type":"git"},"_npmVersion":"10.8.2","description":"Framework-agnostic headless selection primitives for grids and spreadsheets","directories":{},"sideEffects":false,"_nodeVersion":"20.19.6","_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.15","@vitest/coverage-v8":"^4.0.15"},"_npmOperationalInternal":{"tmp":"tmp/selection-core_1.0.0-alpha.3_1765990382934_0.2957982702874744","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@affino/selection-core","version":"1.0.0","keywords":["selection","grid","table","spreadsheet","headless"],"author":{"name":"Anton Pavlov","email":"a.pavlov@affino.dev"},"license":"MIT","_id":"@affino/selection-core@1.0.0","maintainers":[{"name":"affino","email":"anton.pavlov.personal@gmail.com"}],"homepage":"https://affino.dev","bugs":{"url":"https://github.com/affinio/affinio/issues"},"dist":{"shasum":"f9f356010939c9293a81a07ab17b01fb2b9288e3","tarball":"https://registry.npmjs.org/@affino/selection-core/-/selection-core-1.0.0.tgz","fileCount":30,"integrity":"sha512-FLQfDV/8jUUl3LB8a4aA7PzQBIZeL9+VsiYTHh0rhBfKZ7XKqM6+ITQSJsiTIeKJXRwmCC/LGqHpOxPnIt/gwg==","signatures":[{"sig":"MEUCIQCJ65fezDDdUFus76yjL8ZDv4d+I2eGdMa/IP182p7CSQIgQibLy5qM5ac9aVNcqj3rXwh61eBU/z9mBXc/7gUFwt0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":54393},"main":"dist/index.js","type":"module","_from":"file:affino-selection-core-1.0.0.tgz","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.json"},"_npmUser":{"name":"affino","email":"anton.pavlov.personal@gmail.com"},"_resolved":"/tmp/1f9bb1d632758899bc45b0ef8452d2d6/affino-selection-core-1.0.0.tgz","_integrity":"sha512-FLQfDV/8jUUl3LB8a4aA7PzQBIZeL9+VsiYTHh0rhBfKZ7XKqM6+ITQSJsiTIeKJXRwmCC/LGqHpOxPnIt/gwg==","repository":{"url":"git+https://github.com/affinio/affinio.git#main","type":"git"},"_npmVersion":"10.8.2","description":"Framework-agnostic headless selection primitives for linear lists and adapters","directories":{},"sideEffects":false,"_nodeVersion":"20.19.6","dependencies":{"@affino/grid-selection-core":"1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.15","@vitest/coverage-v8":"^4.0.15"},"_npmOperationalInternal":{"tmp":"tmp/selection-core_1.0.0_1769943422656_0.38683465081864155","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@affino/selection-core","version":"1.1.0","keywords":["selection","grid","table","spreadsheet","headless"],"author":{"name":"Anton Pavlov","email":"a.pavlov@affino.dev"},"license":"MIT","_id":"@affino/selection-core@1.1.0","maintainers":[{"name":"affino","email":"anton.pavlov.personal@gmail.com"}],"homepage":"https://github.com/affinio/affinio/tree/main/packages/selection-core#readme","bugs":{"url":"https://github.com/affinio/affinio/issues"},"dist":{"shasum":"35cc2ece298e3c80d1f6769b22a70a0f210f965e","tarball":"https://registry.npmjs.org/@affino/selection-core/-/selection-core-1.1.0.tgz","fileCount":2,"integrity":"sha512-5w185C2KzSQYtqRAt264/mNIAZzSjScLl+iSmVj4Z9G687uhkObhMWnbIvE/RV2eM1GM5UzhESemGugmIdk/Sg==","signatures":[{"sig":"MEUCID0n9vMyhecvMXgDdLIwAYNgahp9axnMTqZl9ZgaQ9hEAiEAvFq2IOGvIInksvIdLiXWqD/gFfgK+uaF+OoHOm/uGN0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4217},"main":"dist/index.js","type":"module","_from":"file:affino-selection-core-1.1.0.tgz","types":"dist/index.d.ts","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.json"},"_npmUser":{"name":"affino","email":"anton.pavlov.personal@gmail.com"},"_resolved":"/tmp/55b058f90cbe91f6c76ca1f860b913b4/affino-selection-core-1.1.0.tgz","_integrity":"sha512-5w185C2KzSQYtqRAt264/mNIAZzSjScLl+iSmVj4Z9G687uhkObhMWnbIvE/RV2eM1GM5UzhESemGugmIdk/Sg==","repository":{"url":"git+https://github.com/affinio/affinio.git","type":"git","directory":"packages/selection-core"},"_npmVersion":"10.8.2","description":"Headless selection core for Affino UI primitives","directories":{},"sideEffects":false,"_nodeVersion":"20.20.1","dependencies":{"@affino/grid-selection-core":"1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.15","@vitest/coverage-v8":"^4.0.15"},"_npmOperationalInternal":{"tmp":"tmp/selection-core_1.1.0_1774271233263_0.7065748538620802","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@affino/selection-core","version":"1.1.1","author":{"name":"Anton Pavlov","email":"a.pavlov@affino.dev"},"type":"module","description":"Headless selection core for Affino UI primitives","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"main":"dist/index.js","types":"dist/index.d.ts","sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/affinio/affinio.git","directory":"packages/selection-core"},"homepage":"https://github.com/affinio/affinio/tree/main/packages/selection-core#readme","license":"MIT","keywords":["selection","grid","table","spreadsheet","headless"],"devDependencies":{"@vitest/coverage-v8":"^4.0.15","vitest":"^4.0.15"},"bugs":{"url":"https://github.com/affinio/affinio/issues"},"module":"dist/index.js","scripts":{"build":"tsc -p tsconfig.json","test":"vitest run"},"_id":"@affino/selection-core@1.1.1","_integrity":"sha512-mwP4URl+AuDsMdg9InkYcKIH367U+CdL/jPkBX74Wh4q/AaRhz0GMpe98DOF1O0fB/5p5vIxdFGA06qEx/5GTg==","_resolved":"/tmp/4b1d163ffebc5fdfd4be6a784157d352/affino-selection-core-1.1.1.tgz","_from":"file:affino-selection-core-1.1.1.tgz","_nodeVersion":"20.20.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-mwP4URl+AuDsMdg9InkYcKIH367U+CdL/jPkBX74Wh4q/AaRhz0GMpe98DOF1O0fB/5p5vIxdFGA06qEx/5GTg==","shasum":"e4c52fc43caa2d39923190382c4e02810046a29a","tarball":"https://registry.npmjs.org/@affino/selection-core/-/selection-core-1.1.1.tgz","fileCount":26,"unpackedSize":52987,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDyttRcxBCLxzcrbCeY/FnXLk4ux0iYhaOVHFhYn1qV7wIgL6CDfigmIyqBEohPksgWo9dlyhgzoKmnipTs1KRWuvM="}]},"_npmUser":{"name":"affino","email":"anton.pavlov.personal@gmail.com"},"directories":{},"maintainers":[{"name":"affino","email":"anton.pavlov.personal@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/selection-core_1.1.1_1774272360606_0.8090649744648017"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-16T21:16:55.868Z","modified":"2026-03-23T13:26:00.859Z","1.0.0-alpha.0":"2025-12-16T21:16:56.181Z","1.0.0-alpha.1":"2025-12-16T22:49:37.295Z","1.0.0-alpha.2":"2025-12-17T15:06:18.093Z","1.0.0-alpha.3":"2025-12-17T16:53:03.079Z","1.0.0":"2026-02-01T10:57:02.808Z","1.1.0":"2026-03-23T13:07:13.413Z","1.1.1":"2026-03-23T13:26:00.743Z"},"bugs":{"url":"https://github.com/affinio/affinio/issues"},"author":{"name":"Anton Pavlov","email":"a.pavlov@affino.dev"},"license":"MIT","homepage":"https://github.com/affinio/affinio/tree/main/packages/selection-core#readme","keywords":["selection","grid","table","spreadsheet","headless"],"repository":{"type":"git","url":"git+https://github.com/affinio/affinio.git","directory":"packages/selection-core"},"description":"Headless selection core for Affino UI primitives","maintainers":[{"name":"affino","email":"anton.pavlov.personal@gmail.com"}],"readme":"# @affino/selection-core\n\nHeadless selection primitives for Affino UI: linear selection (1D ranges) and grid selection (2D cells/areas).\n\nNeed Vue bindings or a listbox state machine? Use [`@affino/selection-vue`](../selection-vue/README.md) on top of\n[`@affino/listbox-core`](../listbox-core/README.md).\n\n## Features\n\n- Normalized 1D ranges (`start`, `end`) with anchor/focus semantics\n- Grid/cell selection snapshots with range + area normalization\n- Immutable merge/toggle/extend helpers\n- Deterministic `resolveLinearSelectionUpdate()` snapshots for stores/renderers\n- Deterministic `resolveSelectionUpdate()` snapshots for grid renderers/controllers\n- Zero DOM dependencies so adapters stay thin\n\n## Non-goals\n\n- No DOM manipulation\n- No event handling\n- No rendering concerns\n- No framework bindings\n\n## Mental model\n\n1. A selection is expressed as ranges + anchor + focus.\n2. Operations consume intent and emit new `HeadlessSelectionState` snapshots.\n3. Framework adapters translate user input into those operations.\n\n## Usage\n\n```ts\nimport {\n  selectLinearIndex,\n  extendLinearSelectionToIndex,\n  toggleLinearIndex,\n} from \"@affino/selection-core\"\n\nlet state = selectLinearIndex({ index: 2 })\nstate = extendLinearSelectionToIndex({ state, index: 6 })\nstate = toggleLinearIndex({ state, index: 4 })\n```\n\n## Package boundaries\n\n- `@affino/selection-core`: canonical package for 1D linear selection and 2D grid selection.\n- `@affino/selection-vue`: Vue bindings and stores on top of the headless primitives.\n- `@affino/grid-selection-core`: legacy package name kept only for transition strategy outside this package.\n\n## Migration guide\n\n### Preferred imports\n\nImport both linear and grid helpers from `@affino/selection-core`.\n\n```ts\nimport { selectSingleCell } from \"@affino/selection-core\"\nimport { selectLinearIndex } from \"@affino/selection-core\"\n```\n\n### Replace ad-hoc range mutation with intent operations\n\nPrefer operation helpers over manual `ranges` editing:\n\n- single click -> `selectLinearIndex`\n- shift extend -> `extendLinearSelectionToIndex`\n- cmd/ctrl toggle -> `toggleLinearIndex`\n- clear action -> `clearLinearSelection`\n\nUse `resolveLinearSelectionUpdate` only when hydrating external snapshots.\n\n## Guardrails\n\n- Treat returned states as immutable snapshots and replace the full value in stores.\n- Do not rely on invalid inputs being auto-corrected; pass finite integer indexes.\n- `resolveLinearSelectionUpdate` throws if `activeRangeIndex` is out of bounds.\n- Use one canonical source of truth for selection state in the adapter.\n\nSee `/demo-vue` for integration patterns.\n","readmeFilename":"README.md"}