{"_id":"@abdur008/radial-layout","name":"@abdur008/radial-layout","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@abdur008/radial-layout","version":"1.0.0","description":"Dynamic radial and orbital layout engine with collision avoidance, anchor slot snapping, and honeycomb grouping for canvas workspaces.","author":{"name":"Blueprinto Team"},"license":"MIT","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup","dev":"tsup --watch","test":"bun test","typecheck":"tsc --noEmit"},"keywords":["radial-layout","orbital-layout","canvas-layout","graph-layout","collision-detection","anchor-snapping","honeycomb-clustering"],"devDependencies":{"@types/bun":"latest","@types/node":"^20.17.0","tsup":"^8.3.6","typescript":"^5.7.3"},"gitHead":"814d31f9c0e1f3bfd79eb98b6b98a91d7255282f","_id":"@abdur008/radial-layout@1.0.0","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-spm88ipGm7glNuRYw5bHsz4Kz5vBlfT4Wb5AD4iT/LfYbZkBjkRWooWsVqm/VgZ5StjsUiN0eQrSAkG+n99p0A==","shasum":"b5b00550fc4713e4b8a302823cd2f7b96a4df0ce","tarball":"https://registry.npmjs.org/@abdur008/radial-layout/-/radial-layout-1.0.0.tgz","fileCount":8,"unpackedSize":67962,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBn7FMwJq4QN38QWjiLPI55vVl1Rqe3pQ17vzJ/A3oI4AiEA21VQGPIK2g/cCzJBsf23IUI5Kf/hSsq8gAaIATE2kww="}]},"_npmUser":{"name":"abdur008","email":"abdurfreelance@gmail.com"},"directories":{},"maintainers":[{"name":"abdur008","email":"abdurfreelance@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/radial-layout_1.0.0_1786824244739_0.09201243266634807"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-15T20:04:04.630Z","1.0.0":"2026-08-15T20:04:04.881Z","modified":"2026-08-15T20:04:05.046Z"},"maintainers":[{"name":"abdur008","email":"abdurfreelance@gmail.com"}],"description":"Dynamic radial and orbital layout engine with collision avoidance, anchor slot snapping, and honeycomb grouping for canvas workspaces.","keywords":["radial-layout","orbital-layout","canvas-layout","graph-layout","collision-detection","anchor-snapping","honeycomb-clustering"],"author":{"name":"Blueprinto Team"},"license":"MIT","readme":"# @abdur008/radial-layout\n\nDynamic radial and orbital layout engine for canvas workspaces, node graphs, and diagramming tools. Provides collision detection, anchor budget management, honeycomb clustering, and proximity snapping.\n\n## Installation\n\n```bash\n# Using bun\nbun add @abdur008/radial-layout\n\n# Using npm\nnpm install @abdur008/radial-layout\n```\n\n## Features\n\n- **Radial Slot Distribution:** Calculates uniform angular coordinates for 1 to $N$ anchors around any central hub.\n- **Collision Avoidance:** Built-in footprint radii calculation for standalone nodes, grouped clusters, and vertical stacks.\n- **Honeycomb Grouping:** Automatic centroid calculation and hexagonal offset distribution for multi-node sets.\n- **Proximity Snapping:** Computes nearest slots, occupied states, and merge candidate detection.\n- **Zero Runtime Dependencies:** Lightweight and pure TypeScript.\n\n## Quick Start\n\n```typescript\nimport {\n  generateRadialPositions,\n  countAnchorPoints,\n  findClosestAnchorSlot,\n  detectMergeCandidate,\n} from \"@abdur008/radial-layout\";\n\n// 1. Generate 8 slots around a center point with 500px radius\nconst slots = generateRadialPositions(8, 500);\n\n// 2. Find closest slot to user cursor/drop coordinate\nconst dropPosition = { x: 120, y: -480 };\nconst match = findClosestAnchorSlot(dropPosition, slots);\nconsole.log(\"Snapped to slot index:\", match?.slotIndex);\n\n// 3. Count logical anchor points\nconst nodes = [\n  { id: \"node-1\", x: 0, y: -500 },\n  { id: \"node-2\", x: 350, y: -350, groupId: \"group-a\" },\n  { id: \"node-3\", x: 380, y: -320, groupId: \"group-a\" }, // Shares anchor with node-2\n];\nconsole.log(\"Total anchor usage:\", countAnchorPoints(nodes)); // Output: 2\n```\n\n## API Reference\n\n### `generateRadialPositions(count, radius, startAngle?, center?)`\nGenerates equidistant coordinates on a radial ring.\n\n### `calculateEffectiveRingRadius(config?)`\nCalculates the minimum ring radius to avoid visual collision with a central hub.\n\n### `countAnchorPoints(nodes)`\nCounts logical slots consumed: ungrouped standalone nodes + unique group IDs.\n\n### `detectMergeCandidate(dragPos, activeNodeId, nodes, config?)`\nEvaluates if a node is within merge distance of another node or group.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-4b1cd3b10db54037688d0650540388e5"}