11<script setup lang="ts">
2- import { ref , computed , onMounted , watch } from ' vue'
2+ import { computed , onMounted , watch } from ' vue'
33import { VueUiSparkline } from ' vue-data-ui/vue-ui-sparkline'
44import { useCssVariables } from ' ../composables/useColors'
55import { OKLCH_NEUTRAL_FALLBACK , lightenOklch } from ' ../utils/colors'
@@ -8,7 +8,12 @@ const { packageName } = defineProps<{
88 packageName: string
99}>()
1010
11- const showModal = shallowRef (false )
11+ function showChartModal() {
12+ const chartModal = document .querySelector <HTMLDialogElement >(' #chart-modal' )
13+ if (chartModal ) {
14+ chartModal .showModal ()
15+ }
16+ }
1217
1318const { data : packument } = usePackage (() => packageName )
1419const createdIso = computed (() => packument .value ?.time ?.created ?? null )
@@ -195,7 +200,7 @@ const config = computed(() => {
195200 <template #actions >
196201 <button
197202 type =" button"
198- @click =" showModal = true "
203+ @click =" showChartModal "
199204 class =" link-subtle font-mono text-sm inline-flex items-center gap-1.5 ms-auto shrink-0 self-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50 rounded"
200205 :title =" $t('package.downloads.analyze')"
201206 >
@@ -242,28 +247,13 @@ const config = computed(() => {
242247 </CollapsibleSection >
243248 </div >
244249
245- <ChartModal v-model:open =" showModal" >
246- <template #title >{{ $t('package.downloads.modal_title') }}</template >
247-
250+ <ChartModal >
248251 <PackageDownloadAnalytics
249252 :weeklyDownloads =" weeklyDownloads"
250253 :inModal =" true"
251254 :packageName =" packageName"
252255 :createdIso =" createdIso"
253256 />
254-
255- <template #after =" { close } " >
256- <div class =" sm:hidden flex justify-center" >
257- <button
258- type =" button"
259- @click =" close"
260- class =" w-12 h-12 bg-bg-elevated border border-border rounded-full shadow-lg flex items-center justify-center text-fg-muted hover:text-fg transition-colors"
261- :aria-label =" $t('common.close')"
262- >
263- <span class =" w-5 h-5 i-carbon:close" aria-hidden =" true" />
264- </button >
265- </div >
266- </template >
267257 </ChartModal >
268258</template >
269259
0 commit comments