[ui] DomiUi: @domi/ui v1.4.0: Water and Touch her are Button again (the handler fix from here), the credit is DomiCredit link={false}
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Button, DOMI_ATTRIBUTION_TEXT, strike } from '@domi/ui';
|
||||
import { Button, DomiCredit, strike } from '@domi/ui';
|
||||
import { PRODUCT_NAME, type Gardener } from '@rosea/schema';
|
||||
import { tick } from 'svelte';
|
||||
import { en } from './copy/en.js';
|
||||
@@ -244,11 +244,11 @@
|
||||
|
||||
<!--
|
||||
The licence's credit (CPAL-1.0 Exhibit B, for Rosea and for @domi/ui): its exact words, at the foot of every screen
|
||||
from the first open on (domi-ui.md D9). Plain text, not @domi/ui's DomiCredit link: the garden is offline, and a
|
||||
tap must never carry the player out of it, least of all on Android, which has no internet at all.
|
||||
from the first open on (domi-ui.md D9). link={false}: the address as plain text, because the garden is offline and
|
||||
a tap must never carry the player out of it, least of all on Android, which has no internet at all.
|
||||
-->
|
||||
{#snippet credit()}
|
||||
<p class="credit">{DOMI_ATTRIBUTION_TEXT}</p>
|
||||
<DomiCredit link={false} class="credit" />
|
||||
{/snippet}
|
||||
|
||||
{#if updateReady && onrefresh}
|
||||
@@ -311,11 +311,8 @@
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.credit {
|
||||
margin: var(--space-4) 0 0;
|
||||
font-size: 0.8rem;
|
||||
color: var(--ink-soft);
|
||||
text-align: center;
|
||||
.shell :global(.credit) {
|
||||
margin-top: var(--space-4);
|
||||
}
|
||||
|
||||
.update {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Button, strike } from '@domi/ui';
|
||||
import { Button } from '@domi/ui';
|
||||
import {
|
||||
careEvent, goodMoment, lightAt, localDay, newCare, newOpened, petalAt, petalsToday, pour, roseAt, ROSE, sentenceOpened, touch, TOUCH,
|
||||
UNTOUCHED, weedsToday, type Mood, type PetalNow, type Place, type RoseNow, type Stage, type TouchState
|
||||
@@ -266,14 +266,11 @@
|
||||
if (e.key === 'Escape') void closeRing();
|
||||
}}
|
||||
>
|
||||
<!-- Water and Touch her are @domi/ui's plate written as markup (INTEGRATE.md §3): Button sets its own
|
||||
onkeydown and onblur after the ones passed to it, and the pour needs both (domi-ui.md D3). -->
|
||||
<button
|
||||
type="button"
|
||||
class="domi-btn water"
|
||||
class:pouring
|
||||
<!-- Button runs a passed onkeydown and onblur before its own since @domi/ui 1.4.0 (the fix from here, domi-ui.md
|
||||
D3): the pour needs both. -->
|
||||
<Button
|
||||
class={pouring ? 'water pouring' : 'water'}
|
||||
aria-describedby="rose-water-hint"
|
||||
use:strike
|
||||
onpointerdown={(e) => {
|
||||
e.preventDefault();
|
||||
(e.currentTarget as HTMLElement).setPointerCapture?.(e.pointerId);
|
||||
@@ -290,7 +287,7 @@
|
||||
if (isPourKey(e)) stopPour();
|
||||
}}
|
||||
onblur={stopPour}
|
||||
><span class="domi-btn__label">{en.rose.water}</span></button>
|
||||
>{en.rose.water}</Button>
|
||||
{#if rose.needs.wind}
|
||||
<Button onclick={() => careBy('shade')}>{en.rose.shade}</Button>
|
||||
{/if}
|
||||
@@ -300,10 +297,7 @@
|
||||
{#if rose.needs.petals}
|
||||
<Button onclick={() => careBy('petals')}>{en.rose.petals}</Button>
|
||||
{/if}
|
||||
<button
|
||||
type="button"
|
||||
class="domi-btn"
|
||||
use:strike
|
||||
<Button
|
||||
onclick={() => {
|
||||
planet?.act('touch');
|
||||
touchHer();
|
||||
@@ -312,7 +306,7 @@
|
||||
// A held key is one touch, not a rush (thorns.md T2).
|
||||
if (e.repeat) e.preventDefault();
|
||||
}}
|
||||
><span class="domi-btn__label">{en.rose.touch.label}</span></button>
|
||||
>{en.rose.touch.label}</Button>
|
||||
<Button variant="quiet" onclick={() => void closeRing()}>{en.scene.close}</Button>
|
||||
</div>
|
||||
<p id="rose-water-hint" class="hint">{en.rose.waterHint}</p>
|
||||
@@ -375,13 +369,13 @@
|
||||
}
|
||||
|
||||
/* Water is held, not clicked: the page must not scroll or select under the finger (rose.md). */
|
||||
.care .water {
|
||||
.care :global(.water) {
|
||||
touch-action: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/* While she is being watered the plate stays pressed in (@domi/ui's own press, held). */
|
||||
.care .water.pouring {
|
||||
.care :global(.water.pouring) {
|
||||
background: var(--domi-plate-press);
|
||||
box-shadow: var(--domi-plate-shadow-press);
|
||||
}
|
||||
|
||||
@@ -23,11 +23,13 @@ const h1 = (): HTMLElement => screen.getByRole('heading', { level: 1 });
|
||||
describe('the licence credit (CPAL-1.0 Exhibit B; domi-ui.md D9)', () => {
|
||||
const credit = 'Built on Domi · https://aula.marek-novak.cz · Copyright (c) 2026 Marek Novák';
|
||||
|
||||
/** The credit line as a reader gets it: @domi/ui's DomiCredit sets its parts in spans. */
|
||||
const creditLine = (): string => document.querySelector('.domi-credit')?.textContent?.replace(/\s+/g, ' ').trim() ?? '';
|
||||
|
||||
it('stands at the foot of the first screen in its exact words, as plain text that leads nowhere', () => {
|
||||
render(Shell);
|
||||
const line = screen.getByText(credit);
|
||||
expect(line.textContent).toBe(credit);
|
||||
expect(line.closest('a')).toBeNull();
|
||||
expect(creditLine()).toBe(credit);
|
||||
expect(document.querySelector('.domi-credit a')).toBeNull();
|
||||
expect(document.querySelectorAll('a[href^="https://aula"]')).toHaveLength(0);
|
||||
});
|
||||
|
||||
@@ -35,7 +37,7 @@ describe('the licence credit (CPAL-1.0 Exhibit B; domi-ui.md D9)', () => {
|
||||
window.location.hash = '#letter';
|
||||
render(Shell, { letter: LETTER });
|
||||
await waitFor(() => expect(h1().textContent).toBe(en.letter.title));
|
||||
expect(screen.getByText(credit)).toBeTruthy();
|
||||
expect(creditLine()).toBe(credit);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ describe('her planet (planet-garden.md)', () => {
|
||||
await tick();
|
||||
const ring = screen.getByRole('group', { name: en.scene.ring });
|
||||
expect(her.getAttribute('aria-expanded')).toBe('true');
|
||||
expect(document.activeElement?.textContent).toBe(en.rose.water);
|
||||
expect(document.activeElement?.textContent?.trim()).toBe(en.rose.water);
|
||||
expect(screen.getByRole('button', { name: en.rose.touch.label })).toBeTruthy();
|
||||
expect(screen.queryByRole('button', { name: en.rose.weed })).toBeNull();
|
||||
await fireEvent.keyDown(ring, { key: 'Escape' });
|
||||
|
||||
Reference in New Issue
Block a user