{"id":26941959,"url":"https://github.com/kne-union/use-click-outside","last_synced_at":"2026-04-10T20:47:50.799Z","repository":{"id":57125145,"uuid":"262540535","full_name":"kne-union/use-click-outside","owner":"kne-union","description":"点击空白响应事件的hooks","archived":false,"fork":false,"pushed_at":"2024-02-08T03:32:25.000Z","size":7360,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T04:55:01.188Z","etag":null,"topics":["click","hooks","outside","react"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kne-union.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-05-09T09:55:52.000Z","updated_at":"2022-08-12T05:18:19.000Z","dependencies_parsed_at":"2025-04-02T16:42:33.296Z","dependency_job_id":"acfe5020-b2c8-4fe9-850b-cdb3563722aa","html_url":"https://github.com/kne-union/use-click-outside","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kne-union/use-click-outside","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kne-union%2Fuse-click-outside","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kne-union%2Fuse-click-outside/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kne-union%2Fuse-click-outside/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kne-union%2Fuse-click-outside/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kne-union","download_url":"https://codeload.github.com/kne-union/use-click-outside/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kne-union%2Fuse-click-outside/sbom","scorecard":{"id":564392,"data":{"date":"2025-08-11","repo":{"name":"github.com/kne-union/use-click-outside","commit":"9b752d5ce7c08c9a16d3e1a8a254ca3c611dba2e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/6 approved changesets -- score normalized to 0","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":"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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-example.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/kne-union/use-click-outside/publish-example.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-example.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/kne-union/use-click-outside/publish-example.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish-example.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/kne-union/use-click-outside/publish-example.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/kne-union/use-click-outside/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/kne-union/use-click-outside/publish.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/publish-example.yml:24","Warn: npmCommand not pinned by hash: .github/workflows/publish-example.yml:47","Warn: npmCommand not pinned by hash: .github/workflows/publish.yml:24","Warn: npmCommand not pinned by hash: .github/workflows/publish.yml:35","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   4 npmCommand dependencies pinned"],"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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/publish-example.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Info: no jobLevel write permissions found"],"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":"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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 2 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":"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"}}]},"last_synced_at":"2025-08-20T14:34:30.829Z","repository_id":57125145,"created_at":"2025-08-20T14:34:30.829Z","updated_at":"2025-08-20T14:34:30.829Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31658964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"ssl_error","status_checked_at":"2026-04-10T17:19:13.364Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["click","hooks","outside","react"],"created_at":"2025-04-02T16:38:16.741Z","updated_at":"2026-04-10T20:47:50.774Z","avatar_url":"https://github.com/kne-union.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# use-click-outside\n\n\n### 描述\n\n用于捕获dom以外的元素点击事件\n\n\n### 安装\n\n```shell\nnpm i --save @kne/use-click-outside\n```\n\n\n### 概述\n\n实现了一个点击容器之外触发回调函数的hooks\n\n\n### 示例\n\n\n#### 示例样式\n\n```scss\n.container{\n  width: 200px;\n  height: 200px;\n  border: solid 1px #ccc;\n  border-radius: 6px;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n}\n```\n\n#### 示例代码\n\n- 基本示例\n- 点击容器外部就弹窗提示\n- _useClickOutside(@kne/use-click-outside),_message(antd/lib/message)\n\n```jsx\nconst {default: useClickOutside} = _useClickOutside;\nconst {default: message} = _message;\n\nconst BaseExample = () =\u003e {\n    const ref = useClickOutside(() =\u003e {\n        message.success('点击了容器外部');\n    });\n    return \u003cdiv ref={ref} className=\"container\"\u003e\n        这是组件内部，点击外部试试\n    \u003c/div\u003e;\n};\n\nrender(\u003cBaseExample/\u003e);\n\n```\n\n\n### API\n\nconst ref = useClickOutside(callback, dom);\n\n注意：返回的ref必须传给一个dom的ref\n\n| 属性名      | 说明                  | 类型       | 默认值           |\n|----------|---------------------|----------|---------------|\n| callback | 模拟的失去焦点事件触发后执行的回调   | function | -             |\n| dom      | 可以触发点击的外部区域，默认为body | dom      | document.body |\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkne-union%2Fuse-click-outside","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkne-union%2Fuse-click-outside","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkne-union%2Fuse-click-outside/lists"}