[ui] DomiUi: @domi/ui v1.5.0: Move the chair is Button too (bind:element), so every button is the shared one

This commit is contained in:
2026-11-23 02:50:05 +01:00
parent 87ca83cd1b
commit a240d35ca2
11 changed files with 32 additions and 22 deletions
+4 -6
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { Button, DomiCredit, strike } from '@domi/ui';
import { Button, DomiCredit } from '@domi/ui';
import { PRODUCT_NAME, type Gardener } from '@rosea/schema';
import { tick } from 'svelte';
import { en } from './copy/en.js';
@@ -80,7 +80,7 @@
let sunLine = $state<HTMLElement>();
/** The in-game sunset is showing (chair-sunset.md). */
let watching = $state(false);
let chairButton = $state<HTMLButtonElement>();
let chairButton = $state<HTMLButtonElement | null>(null);
async function stopWatching(): Promise<void> {
watching = false;
@@ -225,10 +225,8 @@
<p class="hint">{en.sunset.notKept}</p>
{/if}
<Button variant="quiet" onclick={() => (changing = true)}>{place ? en.sunset.change : en.sunset.choose}</Button>
<!-- @domi/ui's quiet button written as markup (INTEGRATE.md §3): focus comes back here after the sunset. -->
<button type="button" class="domi-btn domi-btn--quiet" bind:this={chairButton} use:strike onclick={() => (watching = true)}>
<span class="domi-btn__label">{en.chair.move}</span>
</button>
<!-- Focus comes back here after the sunset (bind:element, @domi/ui 1.5.0). -->
<Button variant="quiet" bind:element={chairButton} onclick={() => (watching = true)}>{en.chair.move}</Button>
</div>
{#if watching}
<ChairSunset {place} guessed={choice?.kind === 'device-zone'} now={sunset.now} onclose={stopWatching} />