Skip to content

Commit 447f536

Browse files
committed
fix: add composable for package analysis and copy, fix create edge cases, add i18n
1 parent cab5532 commit 447f536

9 files changed

Lines changed: 500 additions & 132 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Composable for copying text to clipboard with a "copied" state.
3+
* The copied state automatically resets after a timeout.
4+
*/
5+
export function useCopyToClipboard(timeout = 2000) {
6+
const copied = ref(false)
7+
8+
async function copy(text: string | undefined | null) {
9+
if (!text) return false
10+
await navigator.clipboard.writeText(text)
11+
copied.value = true
12+
setTimeout(() => (copied.value = false), timeout)
13+
return true
14+
}
15+
16+
return { copied, copy }
17+
}

app/composables/usePackageAnalysis.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ModuleFormat, TypesStatus } from '#shared/utils/package-analysis'
1+
import type { ModuleFormat, TypesStatus, CreatePackageInfo } from '#shared/utils/package-analysis'
22

33
export interface PackageAnalysisResponse {
44
package: string
@@ -9,6 +9,7 @@ export interface PackageAnalysisResponse {
99
node?: string
1010
npm?: string
1111
}
12+
createPackage?: CreatePackageInfo
1213
}
1314

1415
/**

0 commit comments

Comments
 (0)