{"_id":"@affino/selection-vue","_rev":"2-45d28585b4ff66c210e52b2739cb5166","name":"@affino/selection-vue","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@affino/selection-vue","version":"1.0.0","keywords":["vue","selection","listbox","headless","adapter"],"author":{"name":"Anton Pavlov","email":"a.pavlov@affino.dev"},"license":"MIT","_id":"@affino/selection-vue@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":"453bb5ed4b4d0b8f96877a55684b3caa8f2bf0fa","tarball":"https://registry.npmjs.org/@affino/selection-vue/-/selection-vue-1.0.0.tgz","fileCount":15,"integrity":"sha512-tMwFFaIk35K+O9OcAouyeR/mtS/DFutVugZveuYsl2QQMkwDuQ5Mw/37FV5qtS+mx3Ul5MRk4YWfF1+wcKkMKQ==","signatures":[{"sig":"MEYCIQCM5cdf2cyqegMXBF1N2AadUcK/JSMpaQVXJ5K+x60pAAIhAJf0z3MqgPO1EK16yhgrI0cso+HSnNQxPKKFE4ePdZWR","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18357},"main":"dist/index.js","type":"module","_from":"file:affino-selection-vue-1.0.0.tgz","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"pnpm run clean && tsc -p tsconfig.json","clean":"rm -rf dist tsconfig.tsbuildinfo"},"_npmUser":{"name":"affino","email":"anton.pavlov.personal@gmail.com"},"_resolved":"/tmp/268c895cd9ff149c75219f895d9d7b02/affino-selection-vue-1.0.0.tgz","_integrity":"sha512-tMwFFaIk35K+O9OcAouyeR/mtS/DFutVugZveuYsl2QQMkwDuQ5Mw/37FV5qtS+mx3Ul5MRk4YWfF1+wcKkMKQ==","repository":{"url":"git+https://github.com/affinio/affinio.git#main","type":"git"},"_npmVersion":"10.8.2","description":"Vue 3 adapters for @affino/selection-core and @affino/listbox-core","directories":{},"sideEffects":false,"_nodeVersion":"20.19.6","dependencies":{"@affino/listbox-core":"^1.0.0","@affino/selection-core":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vue":"^3.4.0","vitest":"^4.0.15","@vitest/coverage-v8":"^4.0.15"},"peerDependencies":{"vue":"^3.3.0"},"_npmOperationalInternal":{"tmp":"tmp/selection-vue_1.0.0_1769943436092_0.6573152391974675","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@affino/selection-vue","version":"1.1.0","author":{"name":"Anton Pavlov","email":"a.pavlov@affino.dev"},"type":"module","description":"Vue 3 adapters for @affino/selection-core and @affino/listbox-core","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"main":"dist/index.js","types":"dist/index.d.ts","sideEffects":false,"peerDependencies":{"vue":"^3.3.0"},"dependencies":{"@affino/listbox-core":"^1.1.0","@affino/selection-core":"^1.1.0"},"devDependencies":{"@vitest/coverage-v8":"^4.0.15","vue":"^3.4.0","vitest":"^4.0.15"},"repository":{"type":"git","url":"git+https://github.com/affinio/affinio.git#main"},"homepage":"https://affino.dev","license":"MIT","keywords":["vue","selection","listbox","headless","adapter"],"bugs":{"url":"https://github.com/affinio/affinio/issues"},"module":"dist/index.js","scripts":{"clean":"rm -rf dist tsconfig.tsbuildinfo","build":"pnpm run clean && tsc -p tsconfig.json","test":"vitest run"},"_id":"@affino/selection-vue@1.1.0","_integrity":"sha512-RoQC9C2e/EK0i9NPM5UequBgXmgazAP5TsRo7NYUaB5bWuxLlcV/MxyJVLPD3uz7Hh7KP4qOfplzAqWyCvIPcQ==","_resolved":"/tmp/451ef145f1e667aa6ff2224dd23a74f3/affino-selection-vue-1.1.0.tgz","_from":"file:affino-selection-vue-1.1.0.tgz","_nodeVersion":"20.20.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-RoQC9C2e/EK0i9NPM5UequBgXmgazAP5TsRo7NYUaB5bWuxLlcV/MxyJVLPD3uz7Hh7KP4qOfplzAqWyCvIPcQ==","shasum":"3faefb20947570d54e6aa96c63c4ac1c15d926d1","tarball":"https://registry.npmjs.org/@affino/selection-vue/-/selection-vue-1.1.0.tgz","fileCount":15,"unpackedSize":18458,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDALfd+wAe+QMlSunWJc4J8pUMI6mF2JCUoAkihANgjdAIhAOyqPxQwP7193monA7tPw5fkkcukwud/StlJq+1qI1XR"}]},"_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-vue_1.1.0_1771153334005_0.36058726417998876"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-01T10:57:15.975Z","modified":"2026-02-15T11:02:14.296Z","1.0.0":"2026-02-01T10:57:16.243Z","1.1.0":"2026-02-15T11:02:14.173Z"},"bugs":{"url":"https://github.com/affinio/affinio/issues"},"author":{"name":"Anton Pavlov","email":"a.pavlov@affino.dev"},"license":"MIT","homepage":"https://affino.dev","keywords":["vue","selection","listbox","headless","adapter"],"repository":{"type":"git","url":"git+https://github.com/affinio/affinio.git#main"},"description":"Vue 3 adapters for @affino/selection-core and @affino/listbox-core","maintainers":[{"name":"affino","email":"anton.pavlov.personal@gmail.com"}],"readme":"# @affino/selection-vue\n\nHeadless Vue 3 bindings for the linear selection primitives that ship with `@affino/selection-core` plus the\nlistbox state machine from `@affino/listbox-core`.\n\n## Features\n\n- Immutable linear selection store + `useLinearSelectionStore()` composable\n- Listbox store with activation, range extension, toggle, select-all helpers + `useListboxStore()`\n- Each store ships snapshots only, so Vue components stay serializable and easy to debug\n\n## Usage (Linear)\n\n```ts\nimport {\n  clearLinearSelection,\n  extendLinearSelectionToIndex,\n  selectLinearIndex,\n  toggleLinearIndex,\n} from \"@affino/selection-core\"\nimport {\n  createLinearSelectionStore,\n  useLinearSelectionStore,\n} from \"@affino/selection-vue\"\n\nconst store = createLinearSelectionStore()\nconst { state } = useLinearSelectionStore(store)\n\nfunction handleClick(index: number, event: MouseEvent) {\n  const snapshot = store.peekState()\n  if (event.shiftKey && snapshot.ranges.length) {\n    store.applyResult(extendLinearSelectionToIndex({ state: snapshot, index }))\n  } else if (event.metaKey || event.ctrlKey) {\n    store.applyResult(toggleLinearIndex({ state: snapshot, index }))\n  } else {\n    store.applyResult(selectLinearIndex({ index }))\n  }\n}\n\nfunction clearAll() {\n  store.applyResult(clearLinearSelection())\n}\n```\n\n## Usage (Listbox)\n\n```ts\nimport { createListboxStore, useListboxStore } from \"@affino/selection-vue\"\n\nconst context = {\n  optionCount: options.length,\n  isDisabled: (index: number) => options[index]?.disabled ?? false,\n}\n\nconst listboxStore = createListboxStore({ context })\nconst { state } = useListboxStore(listboxStore)\n\nfunction handleArrow(delta: number, extend: boolean) {\n  listboxStore.move(delta, { extend })\n}\n\nfunction handleClick(index: number, event: MouseEvent) {\n  listboxStore.activate(index, { extend: event.shiftKey, toggle: event.metaKey || event.ctrlKey })\n}\n\nfunction selectEverything() {\n  listboxStore.selectAll()\n}\n```\n\n## API\n\n- `createLinearSelectionStore(options?)`\n- `useLinearSelectionStore(store)`\n- `createListboxStore({ context, initialState? })`\n- `useListboxStore(store)`\n\nEvery store exposes `getState()`, `peekState()`, `setState()`, `applyResult()`, `subscribe()`, `dispose()`, plus listbox helpers for\n`activate()`, `move()`, `toggleActiveOption()`, `clearSelection()`, and `selectAll()`.\n","readmeFilename":"README.md"}