dragoman 0.4.19

Server for scholarly metadata in commonmeta format stored in a SQLite database.
<script>
  let { code } = $props()
  let copied = $state(false)

  function copy() {
    navigator.clipboard.writeText(code).then(() => {
      copied = true
      setTimeout(() => { copied = false }, 2000)
    })
  }
</script>

<div class="relative group my-3">
  <pre class="!my-0"><code>{code}</code></pre>
  <button
    type="button"
    onclick={copy}
    aria-label="Copy"
    class="absolute top-1.5 right-1.5 h-7 w-7 flex items-center justify-center rounded
           text-muted-foreground hover:text-foreground
           opacity-0 group-hover:opacity-100 transition-opacity"
  >
    {#if copied}
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" class="w-3.5 h-3.5">
        <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5" />
      </svg>
    {:else}
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" class="w-3.5 h-3.5">
        <path stroke-linecap="round" stroke-linejoin="round" d="M15.666 3.888A2.25 2.25 0 0 0 13.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 0 1-.75.75H9a.75.75 0 0 1-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 0 1-2.25 2.25H6.75A2.25 2.25 0 0 1 4.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 0 1 1.927-.184" />
      </svg>
    {/if}
  </button>
</div>