diff --git a/docs/components/home/Banner.vue b/docs/components/home/Banner.vue index 5f83d6a0..1e2105db 100644 --- a/docs/components/home/Banner.vue +++ b/docs/components/home/Banner.vue @@ -3,15 +3,30 @@ import { $fetch } from 'ohmyfetch' import Star from '~icons/carbon/star' import Download from '~icons/carbon/download' -const githubData = ref() +const starGazersCount = ref(0) -$fetch('https://api.github.com/repos/bcakmakoglu/vue-flow?page=$i&per_page=100').then((data) => { - githubData.value = data +const downloadCount = ref(0) + +const starGazersCountTransitioned = useTransition(starGazersCount, { + duration: 1000, + transition: (n) => { + return n === 0 ? 0 : n === 1 ? 1 : 2 ** (-10 * n) * Math.sin((n * 10 - 0.75) * ((2 * Math.PI) / 3)) + 1 + }, +}) + +const downloadCountTransitioned = useTransition(downloadCount, { + duration: 1000, + transition: (n) => { + return n === 0 ? 0 : n === 1 ? 1 : 2 ** (-10 * n) * Math.sin((n * 10 - 0.75) * ((2 * Math.PI) / 3)) + 1 + }, +}) + +$fetch('https://api.github.com/repos/bcakmakoglu/vue-flow?page=$i&per_page=100').then((data) => { + starGazersCount.value = data.stargazers_count }) -const npmData = ref() $fetch('https://api.npmjs.org/downloads/point/last-month/@vue-flow/core').then((data) => { - npmData.value = data + downloadCount.value = data.downloads }) @@ -21,17 +36,19 @@ $fetch('https://api.npmjs.org/downloads/point/last-month/@vue-flow/core').then((
Stargazers
-
{{ githubData?.stargazers_count }}
+
+ {{ Math.floor(starGazersCountTransitioned) }} +
Downloads (last month)
-
{{ npmData?.downloads }}
+
+ {{ Math.floor(downloadCountTransitioned) }} +
License
-
- {{ githubData?.license.key.toUpperCase() }} -
+
MIT
diff --git a/docs/src/custom.d.ts b/docs/src/custom.d.ts index 34b82b3b..a4ce1637 100644 --- a/docs/src/custom.d.ts +++ b/docs/src/custom.d.ts @@ -1 +1,13 @@ declare const __ANALYTICS_ID__: string + +declare module 'virtual:icons/*' { + import type { FunctionalComponent, SVGAttributes } from 'vue' + const component: FunctionalComponent + export default component +} + +declare module '~icons/*' { + import type { FunctionalComponent, SVGAttributes } from 'vue' + const component: FunctionalComponent + export default component +}