|
| 1 | +<script setup lang="ts"> |
| 2 | +import type { ProvenanceDetails } from '#shared/types' |
| 3 | +
|
| 4 | +defineProps<{ |
| 5 | + /** Parsed provenance details from the API */ |
| 6 | + details: ProvenanceDetails |
| 7 | + /** Optional: link "View on npm" to package provenance page */ |
| 8 | + packageName?: string |
| 9 | + version?: string |
| 10 | +}>() |
| 11 | +</script> |
| 12 | + |
| 13 | +<template> |
| 14 | + <section id="provenance" aria-labelledby="provenance-heading" class="scroll-mt-20"> |
| 15 | + <h2 id="provenance-heading" class="group text-xs text-fg-subtle uppercase tracking-wider mb-3"> |
| 16 | + <a |
| 17 | + href="#provenance" |
| 18 | + class="inline-flex items-center gap-1.5 text-fg-subtle hover:text-fg-muted transition-colors duration-200 no-underline" |
| 19 | + > |
| 20 | + {{ $t('package.provenance_section.title') }} |
| 21 | + <span |
| 22 | + class="i-carbon-link w-3 h-3 block opacity-0 group-hover:opacity-100 transition-opacity duration-200" |
| 23 | + aria-hidden="true" |
| 24 | + /> |
| 25 | + </a> |
| 26 | + </h2> |
| 27 | + |
| 28 | + <div class="space-y-3"> |
| 29 | + <p class="flex items-center gap-2 text-sm text-fg m-0"> |
| 30 | + <span |
| 31 | + class="i-solar-shield-check-outline w-4 h-4 shrink-0 text-emerald-500" |
| 32 | + aria-hidden="true" |
| 33 | + /> |
| 34 | + <span>{{ |
| 35 | + $t('package.provenance_section.built_and_signed_on', { provider: details.providerLabel }) |
| 36 | + }}</span> |
| 37 | + </p> |
| 38 | + <a |
| 39 | + v-if="details.buildSummaryUrl" |
| 40 | + :href="details.buildSummaryUrl" |
| 41 | + target="_blank" |
| 42 | + rel="noopener noreferrer" |
| 43 | + class="link text-sm font-medium block" |
| 44 | + > |
| 45 | + {{ $t('package.provenance_section.view_build_summary') }} |
| 46 | + </a> |
| 47 | + |
| 48 | + <dl class="space-y-3 m-0"> |
| 49 | + <div v-if="details.sourceCommitUrl" class="flex flex-col gap-0.5"> |
| 50 | + <dt class="font-mono text-xs text-fg-muted m-0"> |
| 51 | + {{ $t('package.provenance_section.source_commit') }} |
| 52 | + </dt> |
| 53 | + <dd class="m-0"> |
| 54 | + <a |
| 55 | + :href="details.sourceCommitUrl" |
| 56 | + target="_blank" |
| 57 | + rel="noopener noreferrer" |
| 58 | + class="link font-mono text-sm break-all" |
| 59 | + > |
| 60 | + {{ |
| 61 | + details.sourceCommitSha |
| 62 | + ? `${details.sourceCommitSha.slice(0, 12)}` |
| 63 | + : details.sourceCommitUrl |
| 64 | + }} |
| 65 | + </a> |
| 66 | + </dd> |
| 67 | + </div> |
| 68 | + <div v-if="details.buildFileUrl" class="flex flex-col gap-0.5"> |
| 69 | + <dt class="font-mono text-xs text-fg-muted m-0"> |
| 70 | + {{ $t('package.provenance_section.build_file') }} |
| 71 | + </dt> |
| 72 | + <dd class="m-0"> |
| 73 | + <a |
| 74 | + :href="details.buildFileUrl" |
| 75 | + target="_blank" |
| 76 | + rel="noopener noreferrer" |
| 77 | + class="link font-mono text-sm break-all" |
| 78 | + > |
| 79 | + {{ details.buildFilePath ?? details.buildFileUrl }} |
| 80 | + </a> |
| 81 | + </dd> |
| 82 | + </div> |
| 83 | + <div v-if="details.publicLedgerUrl" class="flex flex-col gap-0.5"> |
| 84 | + <dt class="font-mono text-xs text-fg-muted m-0"> |
| 85 | + {{ $t('package.provenance_section.public_ledger') }} |
| 86 | + </dt> |
| 87 | + <dd class="m-0"> |
| 88 | + <a |
| 89 | + :href="details.publicLedgerUrl" |
| 90 | + target="_blank" |
| 91 | + rel="noopener noreferrer" |
| 92 | + class="link text-sm" |
| 93 | + > |
| 94 | + {{ $t('package.provenance_section.transparency_log_entry') }} |
| 95 | + </a> |
| 96 | + </dd> |
| 97 | + </div> |
| 98 | + </dl> |
| 99 | + </div> |
| 100 | + |
| 101 | + <p v-if="packageName && version" class="mt-4 m-0"> |
| 102 | + <a |
| 103 | + :href="`https://www.npmjs.com/package/${packageName}/v/${version}#provenance`" |
| 104 | + target="_blank" |
| 105 | + rel="noopener noreferrer" |
| 106 | + class="link-subtle font-mono text-sm" |
| 107 | + > |
| 108 | + {{ $t('common.view_on_npm') }} |
| 109 | + </a> |
| 110 | + </p> |
| 111 | + </section> |
| 112 | +</template> |
0 commit comments