{"id":13394620,"url":"https://github.com/gilbox/react-track","last_synced_at":"2025-10-09T21:09:46.120Z","repository":{"id":57346593,"uuid":"41589399","full_name":"gilbox/react-track","owner":"gilbox","description":"Track the position of DOM elements. Create cool animations.","archived":false,"fork":false,"pushed_at":"2017-06-02T12:34:48.000Z","size":5009,"stargazers_count":342,"open_issues_count":2,"forks_count":23,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-09-04T06:49:49.012Z","etag":null,"topics":["animation","dom-element","react"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/gilbox.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}},"created_at":"2015-08-29T10:28:59.000Z","updated_at":"2025-08-15T21:34:15.000Z","dependencies_parsed_at":"2022-09-17T23:21:18.775Z","dependency_job_id":null,"html_url":"https://github.com/gilbox/react-track","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/gilbox/react-track","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbox%2Freact-track","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbox%2Freact-track/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbox%2Freact-track/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbox%2Freact-track/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gilbox","download_url":"https://codeload.github.com/gilbox/react-track/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbox%2Freact-track/sbom","scorecard":{"id":426756,"data":{"date":"2025-08-11","repo":{"name":"github.com/gilbox/react-track","commit":"107f9582b4fccabda704f5a4ed4fb12c70d5fb69"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":3,"reason":"Found 9/28 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 11 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"84 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-hr2v-3952-633q","Warn: Project is vulnerable to: GHSA-6h5x-7c5m-7cr7","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-mpcf-4gmh-23w8","Warn: Project is vulnerable to: GHSA-9qj9-36jm-prpv","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-xf7w-r453-m56c","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-6x33-pw7p-hmpq","Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-wrvr-8mpx-r7pp","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-3fx5-fwvr-xrjg","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-28xh-wpgr-7fm8","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-hxcm-v35h-mg2x","Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-c9g6-9335-x697","Warn: Project is vulnerable to: GHSA-2m39-62fm-q8r3","Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-g7q5-pjjr-gqvp","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-662x-fhqg-9p8v","Warn: Project is vulnerable to: GHSA-394c-5j6w-4xmx","Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3","Warn: Project is vulnerable to: GHSA-pv4c-p2j5-38j4","Warn: Project is vulnerable to: GHSA-46c4-8wrp-j99v","Warn: Project is vulnerable to: GHSA-9m6j-fcg5-2442","Warn: Project is vulnerable to: GHSA-hh27-ffr2-f2jc","Warn: Project is vulnerable to: GHSA-rqff-837h-mm52","Warn: Project is vulnerable to: GHSA-8v38-pw62-9cw2","Warn: Project is vulnerable to: GHSA-hgjh-723h-mx2j","Warn: Project is vulnerable to: GHSA-jf5r-8hm2-f872","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-cf66-xwfp-gvc4","Warn: Project is vulnerable to: GHSA-4v9v-hfq4-rm2v","Warn: Project is vulnerable to: GHSA-9jgg-88mc-972h","Warn: Project is vulnerable to: GHSA-g78m-2chm-r7qv"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T02:23:44.811Z","repository_id":57346593,"created_at":"2025-08-19T02:23:44.811Z","updated_at":"2025-08-19T02:23:44.811Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278981564,"owners_count":26079652,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["animation","dom-element","react"],"created_at":"2024-07-30T17:01:25.764Z","updated_at":"2025-10-09T21:09:46.091Z","avatar_url":"https://github.com/gilbox.png","language":"JavaScript","readme":"# react-track\n\nAvoid it if you can, but for a certain class of (mostly animation-related)\nproblems, you need to query the DOM. This library provides a way to track\nDOM elements in a functional, declarative manner.\n\n    npm install react-track --save\n\n\n**Note: tweening, animation, and timeline-related stuff lives here: [`react-imation`](https://github.com/gilbox/react-imation)**\n\n\n- [Demo](http://gilbox.github.io/react-track/examples/demo/demo.html): [[source](https://github.com/gilbox/react-track/blob/master/examples/demo/app.js)] tracking components and tweening\n\n\n## `\u003cTrackDocument /\u003e`\n\nUsed to track:\n\n- `document.documentElement`\n- `document.documentElement.getBoundingClientRect()`\n\n```\nimport {TrackDocument, Track} from 'react-track';\nimport {getDocumentRect,\n        getDocumentElement} from 'react-track/tracking-formulas';\n\n// ...render:\n  \u003cTrackDocument formulas={[getDocumentRect]}\u003e\n  {rect =\u003e\n    \u003cdiv\u003e\n      The height of documentElement is {rect.height}\n    \u003c/div\u003e}\n  \u003c/TrackDocument\u003e\n```\n\n## `\u003cTrack /\u003e`\n\nUse `\u003cTrack /\u003e` to track any Component instance. For example,\ntrack an `\u003ch2 /\u003e`:\n\n    import {TrackDocument, Track} from 'react-track';\n    import {topTop} from 'react-track/tracking-formulas';\n\n\n    // ...render:\n      \u003cTrackDocument formulas={[topTop]}\u003e\n      {topTop =\u003e\n\n        \u003cTrack component=\"h2\" formulas={[topTop]}\u003e\n        {(H2,posTopTop) =\u003e\n          \u003cH2\u003eMy top is {posTopTop}px from the viewport's top.\u003c/H2\u003e\n        }\u003c/Track\u003e\n\n      }\u003c/TrackDocument\u003e\n\n\nor track your `AwesomeComponent`\n\n    // ...render:\n      \u003cTrackDocument formulas={[topTop]}\u003e\n      {topTop =\u003e\n\n        \u003cTrack component={AwesomeComponent} formulas={[topTop]}\u003e\n        {(AwesomeComponentTracked,posTopTop) =\u003e\n          \u003cAwesomeComponentTracked\u003e\n            My top is {posTopTop}px from the viewport's top.\n          \u003c/AwesomeComponentTracked\u003e\n        }\u003c/Track\u003e\n\n      }\u003c/TrackDocument\u003e\n\nIt's important to note that `AwesomeComponent` must be stateful in this example.\nAt the time of writing `react-track` does not support stateless functional\ncomponents (SFCs) due to its reliance on the ref attribute, which such\ncomponents do not provide. In order to track an SFC, wrap it in a\n[TrackedDiv](#trackeddiv-).\n\nNote that in the code above, there are two different\nscopes with a `topTop` variable. One scope is nested\ninside of the other. The `topTop` variable of the inner\nscope is the result of calling the `topTop` of the\nouter scope which returns type function. Here is the definition of the `topTop`\nfunction of the outer scope:\n\n    export const topTop = containerRect =\u003e rect =\u003e\n      ~~(rect.top - containerRect.top);\n\nIn the outer scope, the `\u003cTrackDocument /\u003e` component supplies\nthe `containerRect` argument, which comes from\n`document.documentElement.getClientBoundingRect()`.\nIn the inner scope, the `\u003cTrack /\u003e` component supplies the `rect` argument\nwhich comes from `awesomeDOMElement.getClientBoundingRect()`.\n\n### `trackedRef`\n\n`\u003cTrack /\u003e` supports an optional `trackedRef` prop which\nis type `Function`, and works the same way as the functional form of \nReact's built-in `ref` prop.\n\n## `\u003cTrackedDiv /\u003e`\n\nIt's pretty common to need to track a div, so there's\n`TrackedDiv` component which is a slightly simpler version of `Track`:\n\n    import {TrackDocument, TrackedDiv} from 'react-track';\n    import {topBottom} from 'react-track/tracking-formulas';\n\n    // ...render:\n      \u003cTrackDocument formulas={[topBottom]}\u003e\n      {topBottom =\u003e\n\n        \u003cTrackedDiv formulas={[topBottom]}\u003e\n        {(posTopBottom) =\u003e\n          \u003cb\u003eMy top is {posTopBottom}px from the viewport's bottom\u003c/b\u003e\n        }\u003c/TrackedDiv\u003e\n\n      }\u003c/TrackDocument\u003e\n\n## `tracking-formulas.js`\n\nThe tracking components\nexplained above all accept a `formulas` prop which expects an array\nof formula functions. When a tracking component renders, it passes\nthe same arguments to all of the `formulas` and the results\nare passed as arguments into the function which you should\nsupply to the `children` prop of the tracking component.\n\nThe signature for all formula functions which are passed as an\narray into the `formulas` prop is:\n\n    trackingFormula(rect, element) {\n      // return any type\n    }\n\nOf course, it's common to only utilize the first\nor second argument.\n\nNotice that all of the following are valid formulas\nthat only utilize a single argument:\n\n    const getDocumentRect = documentRect =\u003e documentRect;\n    const getDocumentElement = (_,documentElement) =\u003e documentElement;\n    const calculateScrollY = ({top}) =\u003e -top;\n\nHere's a valid formula which returns a valid formula:\n\n    const centerCenter = (containerRect, container) =\u003e rect =\u003e\n      ~~(rect.top + rect.height / 2 - containerRect.top - container.clientHeight / 2);\n\nWhen a formula returns a formula, we are calculating something that\nrelies on tracking two different elements. In this case, `centerCenter`\ncalculates the distance from the vertical center of some element to\nthe vertical center of some container element. The container element could\nbe `document.documentElement` if you utilize `TrackDocument`,\nor it could be any other DOM element if you utilize `Track` or `TrackedDiv`.\n\nCreating custom formulas is relatively easy.\nCheck out [`tracking-formulas.js`](https://github.com/gilbox/react-track/blob/master/src/tracking-formulas.js)\nfor inspiration.\n\n## Contributing\n\n### Publishing to NPM\n\n- First make sure to bump the version number in `package.json` in accordance with semantic versioning practices. If you think a major version bump is warranted, go for it!\n\n        # preparation\n        npm run build-npm\n        \n        # actually publish to npm\n        npm run publish\n\n- Create a git tag and publish it\n\n        git tag vVERSION.NUMBER.WHATEVER\n        git push origin vVERSION.NUMBER.WHATEVER\n","funding_links":[],"categories":["JavaScript","UI Animation","Uncategorized","Ferramentas"],"sub_categories":["Form Components","Uncategorized","GraphQL"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilbox%2Freact-track","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgilbox%2Freact-track","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilbox%2Freact-track/lists"}