Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions ui/src/features/module/ModuleCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,10 @@
</div>
</div>

{#if module.params.length > 0 || expanded}
<!-- A TONE3000 module keeps its body with no knobs at all: the
photograph and the capture selector are what the module *is*, not
decoration on its controls (#6). -->
{#if module.params.length > 0 || expanded || artwork || variants.length > 1}
<div class="module-body flex flex-1 items-start gap-3 px-3 py-3">
{#if artwork}
<!-- The tone's own photograph, on the card rather than in the hover
Expand Down Expand Up @@ -888,7 +891,16 @@
</span>
{/if}
{/if}
<div class="flex min-w-0 flex-1 flex-col" {@attach measureControls}>
<!-- `min-w-52` when there is a capture selector: the row below takes
the knob grid's width, and a grid of one column (4rem) left the
trigger a sliver beside its two arrows — no name at all (#6). 13rem
is the three-column grid of the template's six knobs, so a sparse
card is exactly as wide as an ordinary TONE3000 one and the grid
centres inside it. -->
<div
class={['flex flex-1 flex-col', variants.length > 1 ? 'min-w-52' : 'min-w-0']}
{@attach measureControls}
>
{#if variants.length > 1}
<!-- A tone is usually several captures of one amp — two channels at
three gain settings, say — and choosing between them is playing,
Expand All @@ -899,7 +911,9 @@
<!-- `w-0 min-w-full`: the row takes the width the knob grid decided
and never asks for more. A capture name is long — that is what
they are like — and a card sized to one would not line up with
anything else in the rack; the trigger truncates instead. -->
anything else in the rack; the trigger truncates instead — from the
start, since captures of one tone share their opening words and
differ in the last ones ("… (mid gain)", "… (high gain)"). -->
<!-- No visible label: the selector sits alone above the knobs on a
card that is already a TONE3000 tone, and the names in it read
as captures on sight. The name it needs is on the control
Expand All @@ -924,6 +938,7 @@
value={String(module.tone3000?.modelId ?? '')}
onSelect={(v) => onSelectTone3000Model?.(Number(v))}
disabled={!editing}
truncate="start"
aria-label="Capture"
/>
{#if editing}
Expand Down
26 changes: 24 additions & 2 deletions ui/src/lib/components/Select.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@
* menu once it has done its work.
*/
footer?: Snippet<[() => void]>;
/**
* Which end of a label gives way when it does not fit. `end` is the usual
* trailing ellipsis. `start` drops the beginning instead, for lists whose
* entries share a prefix and differ at the end — a tone's captures are
* "EVH 5150III® 100S … (mid gain)" and "… (high gain)", and a trailing
* ellipsis cut off the only part that told them apart.
*/
truncate?: 'end' | 'start';
'aria-label'?: string;
}

Expand All @@ -81,6 +89,7 @@
filterable = true,
filterPlaceholder = 'Filter…',
footer,
truncate = 'end',
'aria-label': ariaLabel,
}: Props = $props();

Expand Down Expand Up @@ -183,6 +192,19 @@
};
</script>

<!-- A start-truncated label is the rtl-ellipsis trick: the box runs right to
left, so it overflows — and draws its ellipsis — on the left, while the
`<bdi>` keeps the text itself laid out left to right, so a trailing
"(mid gain)" keeps its parentheses where they belong. `text-left` puts a
label that does fit back where every other one sits. -->
{#snippet label(text: string)}
{#if truncate === 'start'}
<span class="block truncate text-left [direction:rtl]"><bdi>{text}</bdi></span>
{:else}
<span class="truncate">{text}</span>
{/if}
{/snippet}

<Popover
bind:open={() => open, setOpen}
maxHeight={MENU_MAX_HEIGHT}
Expand All @@ -206,7 +228,7 @@
{disabled}
aria-label={ariaLabel}
>
<span class="truncate">{selectedLabel || placeholder}</span>
{@render label(selectedLabel || placeholder)}
<CaretDownIcon size={14} class="shrink-0" />
</button>
{/if}
Expand Down Expand Up @@ -244,7 +266,7 @@
onmouseenter={() => (highlight = i)}
onclick={() => choose(o.value)}
>
{o.label}
{#if truncate === 'start'}{@render label(o.label)}{:else}{o.label}{/if}
</button>
</li>
{:else}
Expand Down
Loading