chadtmiller.com/monolith
An atproto PDS
0
0
<script lang="ts">
import { words } from '#lib/words';
// A scope's tokens as they are written, in its order, behind a
// disclosure; under each `include:`, the scope strings its set grants.
let { tokens }: { tokens: { token: string; grant: string[] }[] } = $props();
// A scope string's runs, each ending at a `.`, `:`, `?` or `&`, where it
// may wrap before breaking inside a name.
const runs = (scope: string): string[] => scope.split(/(?<=[.:?&])/);
</script>
{#snippet code(scope: string)}<code>{#each runs(scope) as run, i (i)}{run}<wbr />{/each}</code>{/snippet}
<details class="details">
<summary>{words.technicalDetails}</summary>
<ul class="tokens">
{#each tokens as { token, grant }, i (i)}
<li>
{@render code(token)}
{#if grant.length}
<ul class="grant">
{#each grant as scope, j (j)}<li>{@render code(scope)}</li>{/each}
</ul>
{/if}
</li>
{/each}
</ul>
</details>
<style>
.details {
font-size: var(--text-sm);
}
summary {
width: fit-content;
color: var(--mute);
font-weight: var(--weight-medium);
cursor: pointer;
border-radius: var(--radius-sm);
}
summary:hover {
color: var(--fg);
}
ul {
display: flex;
flex-direction: column;
gap: var(--space-1);
}
.tokens {
margin-top: var(--space-2);
padding: var(--space-2-5) var(--space-3);
border-radius: var(--radius-md);
background: var(--soft);
}
.grant {
margin-top: var(--space-1);
padding-left: var(--space-3);
border-left: var(--border) solid var(--line);
color: var(--mute);
}
code {
overflow-wrap: anywhere;
}
</style>