Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115<script lang="ts"> import ExpandIcon from './ExpandIcon.svelte'; import NameField from './NameField.svelte';
// The header of a group of windows, on a canvas or in the tiles, or of a // canvas on a canvas: its name, which a double-click renames, a button that // lets it go (`onungroup`) or closes it (`onclose`), and where it can fill // the board (`onexpand`), one that does. The header itself is the handle // that carries it. let { name, placeholder, renaming = $bindable(false), onrename, onungroup, onclose, expanded = false, onexpand, class: kind = '', ...rest }: { name: string; placeholder: string; renaming?: boolean; onrename: (name: string) => void; onungroup?: () => void; onclose?: () => void; expanded?: boolean; onexpand?: () => void; class?: string; [attribute: `data-${string}`]: string; } = $props();</script>
<header class={['section-head', kind]} {...rest}> {#if renaming} <NameField value={name} {placeholder} label="{placeholder} name" ondone={(next) => { renaming = false; if (next !== null) onrename(next); }} /> {:else} <span class="name" class:unnamed={!name} title="Double-click to rename" role="presentation" ondblclick={() => (renaming = true)}>{name || placeholder}</span> {/if} {#if onexpand} <button class="nodrag" aria-label={`${expanded ? 'Unfocus' : 'Focus'} ${placeholder}`} aria-pressed={expanded} title={expanded ? 'Back to the board (esc)' : 'Focus: fill the board with it'} onclick={onexpand}> <ExpandIcon {expanded} /> </button> {/if} {#if onungroup} <button class="ungroup nodrag" aria-label="Ungroup" title="Ungroup: the windows stay where they are" onclick={onungroup}> <svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><path d="M6.5 8H2m0 0 2-2M2 8l2 2M9.5 8H14m0 0-2-2m2 2-2 2" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" /></svg> </button> {/if} {#if onclose} <button class="nodrag" aria-label="Close {placeholder}" title="Close {placeholder} and the windows in it" onclick={onclose}> <svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><path d="M4.5 4.5l7 7M11.5 4.5l-7 7" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" /></svg> </button> {/if}</header>
<style> .section-head { display: flex; flex: none; align-items: center; gap: 6px; /* As tall as a compact title bar (nodes/WindowFrame.svelte). */ height: 24px; padding: 0 4px 0 12px; color: var(--text); font-size: calc(12px * var(--ui-scale)); font-weight: 600; cursor: grab; } .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .unnamed { color: var(--muted); font-weight: 400; } /* Over a canvas child's resize corner, which zoomed out covers them. */ button { position: relative; z-index: 1; display: grid; flex: none; place-items: center; width: 20px; height: 20px; padding: 0; color: var(--muted); background: none; border: 0; border-radius: 6px; cursor: pointer; } button:hover, button[aria-pressed='true'] { color: var(--text); } button:hover { background: var(--hover); }</style>