[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:
@@ -1,5 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
## 1.5.0 (2026-11-23)
|
||||
|
||||
- `Button bind:element`: the `<button>` itself, for focusing it from outside (return focus after a dialog or a scene
|
||||
change). Asked by Rosea.
|
||||
|
||||
## 1.4.0 (2026-11-23)
|
||||
|
||||
- `DomiCredit link={false}`: the same credit with the URL as plain text, for an offline app (asked by Rosea). The licence
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
This folder is @domi/ui v1.4.0, copied unchanged from domi-design by tools/vendor.mjs.
|
||||
This folder is @domi/ui v1.5.0, copied unchanged from domi-design by tools/vendor.mjs.
|
||||
Licence: Common Public Attribution License 1.0 (LICENSE). Original Code: @domi/ui. Initial Developer: Marek Novák.
|
||||
|
||||
Attribution Information (Exhibit B). Any app built with this code shows, prominently in its user interface when
|
||||
|
||||
@@ -1 +1 @@
|
||||
v1.4.0
|
||||
v1.5.0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@domi/ui",
|
||||
"version": "1.4.0",
|
||||
"description": "The Domi design system: tokens for every Domi app, struck buttons and fields with an integrated send button, Svelte 5 components. Vendored copy of v1.4.0: do not edit here; change domi-design and vendor the next tag.",
|
||||
"version": "1.5.0",
|
||||
"description": "The Domi design system: tokens for every Domi app, struck buttons and fields with an integrated send button, Svelte 5 components. Vendored copy of v1.5.0: do not edit here; change domi-design and vendor the next tag.",
|
||||
"license": "CPAL-1.0",
|
||||
"type": "module",
|
||||
"svelte": "./src/index.ts",
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
force?: string;
|
||||
class?: string;
|
||||
children?: Snippet;
|
||||
/** The <button> element, for focusing it from outside (bind:element), e.g. to return focus after a dialog. */
|
||||
element?: HTMLButtonElement | null;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -59,6 +61,7 @@
|
||||
// Taken out of rest, so the button can run them before its own (a spread before the attribute would lose them).
|
||||
onkeydown: passedKeydown,
|
||||
onblur: passedBlur,
|
||||
element = $bindable(null),
|
||||
...rest
|
||||
}: Props = $props();
|
||||
|
||||
@@ -117,6 +120,7 @@
|
||||
</script>
|
||||
|
||||
<button
|
||||
bind:this={element}
|
||||
{...rest}
|
||||
{type}
|
||||
{disabled}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
export const tokens = {
|
||||
"name": "@domi/ui",
|
||||
"version": "1.4.0",
|
||||
"version": "1.5.0",
|
||||
"note": "GENERATED by tools/build-tokens.mjs. Colours are sRGB hex. Use roles, never the hex in a component.",
|
||||
"themes": {
|
||||
"dark": {
|
||||
|
||||
@@ -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} />
|
||||
|
||||
Reference in New Issue
Block a user