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.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141<script lang="ts"> import Menu from './Menu.svelte'; import type { FilterInput } from './filter-input.svelte'; import { FILTER_SUGGESTIONS } from './session-filter';
let { filter, up = false }: { filter: FilterInput; up?: boolean } = $props();
let open = $state(false); let host = $state<HTMLButtonElement>();</script>
<span class="filter-menu"> <button type="button" bind:this={host} class="trigger" class:active={filter.chips.length > 0} class:typed={filter.hasTyped} aria-haspopup="menu" aria-expanded={open} aria-label="filter options" title="filter sessions" onclick={() => (open = !open)} > <svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"> <path d="M2.5 3.5h11l-4 4.8v4l-3 1.4V8.3z" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linejoin="round" /> </svg> </button>
<Menu bind:open {host} label="filter sessions" {up}> {#each FILTER_SUGGESTIONS as item, index (item.token)} {#if index > 0 && FILTER_SUGGESTIONS[index - 1].key !== item.key} <div class="separator" role="separator"></div> {/if} {@const checked = filter.effective[item.key] === item.value} {@const isDefault = checked && filter.defaults?.[item.key] === item.value && filter.activeTyped[item.key] === undefined} <button type="button" class="item" role="menuitemcheckbox" aria-checked={checked} onclick={() => filter.select(item.token)} > <span class="desc-label">{item.description}</span> {#if isDefault}<span class="note">default</span>{/if} </button> {/each} {#if filter.hasTyped} <div class="separator" role="separator"></div> <button type="button" class="item" role="menuitem" onclick={() => { filter.clear(); open = false; }} > <span class="desc-label">clear typed filters</span> </button> {/if} </Menu></span>
<style> .filter-menu { position: relative; display: inline-flex; flex: none; align-items: center; } .trigger { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; color: var(--muted); font: inherit; background: none; border: 0; border-radius: 6px; cursor: pointer; transition: background-color 120ms ease, color 120ms ease; } .trigger:hover { color: var(--text); background: color-mix(in oklab, var(--text) 8%, transparent); } .trigger.active { color: var(--text); } .trigger.typed { color: var(--accent); } .filter-menu .item { min-height: 28px; padding: 4px 10px; line-height: 1.25; } .desc-label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .item[aria-checked='true'] .desc-label { font-weight: 600; } .note { flex: none; } .filter-menu .item:focus-visible:not(:disabled) { outline: 2px solid var(--focus-ring); outline-offset: -2px; } .separator { height: 1px; margin: 0 6px; background: color-mix(in oklab, var(--text) 14%, transparent); } @media (max-width: 760px) { .trigger { width: 32px; height: 32px; } }</style>