{"id":22878831,"url":"https://github.com/taskworld/positioning-strategy","last_synced_at":"2025-05-07T00:29:25.873Z","repository":{"id":57327639,"uuid":"60164770","full_name":"taskworld/positioning-strategy","owner":"taskworld","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-06T04:21:39.000Z","size":270,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-06T05:26:04.672Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taskworld.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-06-01T09:43:48.000Z","updated_at":"2025-02-05T05:55:25.000Z","dependencies_parsed_at":"2025-05-06T05:33:48.393Z","dependency_job_id":null,"html_url":"https://github.com/taskworld/positioning-strategy","commit_stats":{"total_commits":25,"total_committers":3,"mean_commits":8.333333333333334,"dds":0.36,"last_synced_commit":"dd817d89ca3044a3accc2f220eb4c6bcc2e85686"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskworld%2Fpositioning-strategy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskworld%2Fpositioning-strategy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskworld%2Fpositioning-strategy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskworld%2Fpositioning-strategy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taskworld","download_url":"https://codeload.github.com/taskworld/positioning-strategy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252629908,"owners_count":21779338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-13T16:32:59.343Z","updated_at":"2025-05-07T00:29:25.853Z","avatar_url":"https://github.com/taskworld.png","language":"TypeScript","readme":"The [`positioning-strategy`](https://www.npmjs.com/package/positioning-strategy) module implements a function to calculate where to position an element relative to another element.\n\n## Usage\n\nThis module exports a single function,\n\n```ts\nfunction calculateChildPosition(\n  strategy,\n  parentRect,\n  childDimension,\n  viewportDimension,\n  options\n): { left: number, top: number }\n```\n\n### Parameters\n\n- `strategy` The wanted position of the child relative to the parent represented by the combination of two axes: (top, bottom) and (left, center, right)\n\n  Possible values are:  \n  `\"top left\"`, `\"top center\"`, `\"top right\"`,  \n  `\"bottom left\"`, `\"bottom center\"`, `\"bottom right\"`,  \n  `\"left top\"`, `\"left center\"`, `\"left bottom\"`,  \n  `\"right top\"`, `\"right center\"`, `\"right bottom\"`,  \n  including the shorthands: `\"top\"`, `\"bottom\"`, `\"left\"` and `\"right\"`\n\n- `parentRect` An object representing the rectangle of the parent. It has these properties:\n\n  - `left` The distance from the left edge of the viewport to the element.\n  - `top` The distance from the top edge of the viewport to the element.\n  - `width` The width of the element.\n  - `height` The height of the element.\n\n- `childDimension` An object representing the size of the child you want to position.\n\n  - `width` The width of the element.\n  - `height` The height of the element.\n\n- `viewportDimension` An object representing the size of the viewport.\n\n  - `width` The width of the element.\n  - `height` The height of the element.\n\n- `options` Optional.\n\n  - `gap` The distance between the child and the parent.\n\n### Return value\n\nIt returns an object representing where to position the child relative to the parent element. It contains these properties:\n\n- `left` The distance from the left edge of the viewport to the child.\n- `top` The distance from the top edge of the viewport to the child.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaskworld%2Fpositioning-strategy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaskworld%2Fpositioning-strategy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaskworld%2Fpositioning-strategy/lists"}