Initial RuneStone project
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
<script lang="ts">
|
||||
import type { OutlineItem } from "$lib/workspace/outline";
|
||||
|
||||
type Props = {
|
||||
items: OutlineItem[];
|
||||
onJump: (line: number) => void;
|
||||
};
|
||||
|
||||
let { items, onJump }: Props = $props();
|
||||
</script>
|
||||
|
||||
<div class="outline">
|
||||
<div class="pane-label">Outline</div>
|
||||
{#if items.length === 0}
|
||||
<p class="placeholder">No headings or symbols in this file.</p>
|
||||
{:else}
|
||||
<ul>
|
||||
{#each items as item (item.line + item.text)}
|
||||
<li style:padding-left="{8 + (item.level - 1) * 12}px">
|
||||
<button type="button" onclick={() => onJump(item.line)}>{item.text}</button>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.outline {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.pane-label {
|
||||
padding: 6px 10px;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.06em;
|
||||
text-transform: uppercase;
|
||||
color: var(--rs-text-dim);
|
||||
border-bottom: 1px solid var(--rs-border);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
margin: 12px;
|
||||
color: var(--rs-text-dim);
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 6px 0;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
button {
|
||||
width: 100%;
|
||||
border-radius: var(--rs-control-radius);
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--rs-text);
|
||||
text-align: left;
|
||||
padding: 3px 8px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: var(--rs-bg-active);
|
||||
color: var(--rs-text-strong);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user