-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
somoore
committed
Sep 26, 2022
1 parent
a2c611f
commit c545f76
Showing
8 changed files
with
118 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"label": "code coverage", | ||
"source": "./coverage/coverage-summary.json", | ||
"attribute": "total.statements.pct" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
interface ClipboardItem { | ||
readonly types: string[]; | ||
readonly presentationStyle: 'unspecified' | 'inline' | 'attachment'; | ||
getType(): Promise<Blob>; | ||
} | ||
|
||
interface ClipboardItemData { | ||
[mimeType: string]: Blob | string | Promise<Blob | string>; | ||
} | ||
|
||
declare var ClipboardItem: { | ||
prototype: ClipboardItem; | ||
new (itemData: ClipboardItemData): ClipboardItem; | ||
}; | ||
|
||
let anyNavigator: any; | ||
|
||
anyNavigator = window.navigator; | ||
|
||
export interface ImageItem { | ||
url: string; | ||
} | ||
|
||
export interface TextItem { | ||
text: string; | ||
} | ||
|
||
export const useClipboard = () => { | ||
const addToClipboard = async (item: ImageItem | TextItem) => { | ||
try { | ||
let blob; | ||
|
||
if ('url' in item) { | ||
const data = await fetch(item.url); | ||
blob = await data.blob(); | ||
} else { | ||
blob = new Blob([item.text], { type: 'text/plain' }); | ||
} | ||
|
||
await anyNavigator.clipboard.write([ | ||
new ClipboardItem({ | ||
[blob.type]: blob, | ||
}), | ||
]); | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
}; | ||
|
||
return { | ||
addToClipboard, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,9 +239,9 @@ | |
integrity sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw== | ||
|
||
"@babel/helper-validator-identifier@^7.18.6": | ||
version "7.18.6" | ||
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz#9c97e30d31b2b8c72a1d08984f2ca9b574d7a076" | ||
integrity sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g== | ||
version "7.19.1" | ||
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" | ||
integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== | ||
|
||
"@babel/helper-validator-option@^7.18.6": | ||
version "7.18.6" | ||
|
@@ -1286,9 +1286,9 @@ | |
picomatch "^2.2.2" | ||
|
||
"@sinclair/typebox@^0.24.1": | ||
version "0.24.41" | ||
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.41.tgz#45470b8bae32a28f1e0501066d0bacbd8b772804" | ||
integrity sha512-TJCgQurls4FipFvHeC+gfAzb+GGstL0TDwYJKQVtTeSvJIznWzP7g3bAd5gEBlr8+bIxqnWS9VGVWREDhmE8jA== | ||
version "0.24.43" | ||
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.43.tgz#2e2bce0e5e493aaf639beed0cd6c88cfde7dd3d7" | ||
integrity sha512-1orQTvtazZmsPeBroJjysvsOQCYV2yjWlebkSY38pl5vr2tdLjEJ+LoxITlGNZaH2RE19WlAwQMkH/7C14wLfw== | ||
|
||
"@sinonjs/commons@^1.7.0": | ||
version "1.8.3" | ||
|
@@ -1444,9 +1444,9 @@ | |
pretty-format "^25.2.1" | ||
|
||
"@types/jest@^29.0.1": | ||
version "29.0.1" | ||
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.0.1.tgz#b5610ae1a1c5f6e0f6beb132941722da7c493c28" | ||
integrity sha512-CAZrjLRZs4xEdIrfrdV74xK1Vo/BKQZwUcjJv3gp6gMeV3BsVxMnXTcgtYOKyphT4DPPo7jxVEVhuwJTQn3oPQ== | ||
version "29.0.3" | ||
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.0.3.tgz#b61a5ed100850686b8d3c5e28e3a1926b2001b59" | ||
integrity sha512-F6ukyCTwbfsEX5F2YmVYmM5TcTHy1q9P5rWlRbrk56KyMh3v9xRGUO3aa8+SkvMi0SHXtASJv1283enXimC0Og== | ||
dependencies: | ||
expect "^29.0.0" | ||
pretty-format "^29.0.0" | ||
|
@@ -1462,9 +1462,9 @@ | |
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== | ||
|
||
"@types/node@*": | ||
version "18.7.17" | ||
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.17.tgz#52438111ea98f77475470fc62d79b9eb96bb2c92" | ||
integrity sha512-0UyfUnt02zIuqp7yC8RYtDkp/vo8bFaQ13KkSEvUAohPOAlnVNbj5Fi3fgPSuwzakS+EvvnnZ4x9y7i6ASaSPQ== | ||
version "18.7.20" | ||
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.20.tgz#d9442de7b5cb166476340b4271b15300fe058a39" | ||
integrity sha512-adzY4vLLr5Uivmx8+zfSJ5fbdgKxX8UMtjtl+17n0B1q1Nz8JEmE151vefMdpD+1gyh+77weN4qEhej/O7budQ== | ||
|
||
"@types/normalize-package-data@^2.4.0": | ||
version "2.4.1" | ||
|
@@ -1493,7 +1493,7 @@ | |
dependencies: | ||
"@types/react" "*" | ||
|
||
"@types/react@*", "@types/react@^18.0.19": | ||
"@types/react@*": | ||
version "18.0.19" | ||
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.19.tgz#269a5f35b9a73c69dfb0c7189017013ab02acbaa" | ||
integrity sha512-BDc3Q+4Q3zsn7k9xZrKfjWyJsSlEDMs38gD1qp2eDazLCdcPqAT+vq1ND+Z8AGel/UiwzNUk8ptpywgNQcJ1MQ== | ||
|
@@ -1502,6 +1502,15 @@ | |
"@types/scheduler" "*" | ||
csstype "^3.0.2" | ||
|
||
"@types/react@^18.0.19": | ||
version "18.0.21" | ||
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.21.tgz#b8209e9626bb00a34c76f55482697edd2b43cc67" | ||
integrity sha512-7QUCOxvFgnD5Jk8ZKlUAhVcRj7GuJRjnjjiY/IUBWKgOlnvDvTMLD4RTF7NPyVmbRhNrbomZiOepg7M/2Kj1mA== | ||
dependencies: | ||
"@types/prop-types" "*" | ||
"@types/scheduler" "*" | ||
csstype "^3.0.2" | ||
|
||
"@types/[email protected]": | ||
version "1.17.1" | ||
resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6" | ||
|
@@ -1537,9 +1546,9 @@ | |
"@types/yargs-parser" "*" | ||
|
||
"@types/yargs@^17.0.8": | ||
version "17.0.12" | ||
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.12.tgz#0745ff3e4872b4ace98616d4b7e37ccbd75f9526" | ||
integrity sha512-Nz4MPhecOFArtm81gFQvQqdV7XYCrWKx5uUt6GNHredFHn1i2mtWqXTON7EPXMtNi1qjtjEM/VCHDhcHsAMLXQ== | ||
version "17.0.13" | ||
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.13.tgz#34cced675ca1b1d51fcf4d34c3c6f0fa142a5c76" | ||
integrity sha512-9sWaruZk2JGxIQU+IhI1fhPYRcQ0UuTNuKuCW9bR5fp7qi2Llf7WDzNa17Cy7TKnh3cdxDOiyTu6gaLS0eDatg== | ||
dependencies: | ||
"@types/yargs-parser" "*" | ||
|
||
|
@@ -2371,6 +2380,11 @@ cosmiconfig@^6.0.0: | |
path-type "^4.0.0" | ||
yaml "^1.7.2" | ||
|
||
coverage-badges@^1.0.7: | ||
version "1.0.7" | ||
resolved "https://registry.yarnpkg.com/coverage-badges/-/coverage-badges-1.0.7.tgz#ec5109f2c7c61fe9f7230685e4b40c868c2b12f2" | ||
integrity sha512-slYFleOr+QreEVAAocjfN8oUmlCKQi/Zol08/IwVQooJU7C8LLqlz+KNf5hgz13TBHNB7fZdJAPKheTpVq8OzQ== | ||
|
||
cross-spawn@^6.0.0, cross-spawn@^6.0.5: | ||
version "6.0.5" | ||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" | ||
|