+
diff --git a/src/components/components.test.ts b/src/components/components.test.ts
index eff85b3..af4d301 100644
--- a/src/components/components.test.ts
+++ b/src/components/components.test.ts
@@ -48,6 +48,23 @@ describe('StringChips', () => {
expect(all.every((c) => c.find('.chip-check').exists())).toBe(true)
})
+ it('puts one sliding cursor on the string being tuned, none when not listening', () => {
+ const mountChips = (props = {}) =>
+ mount(StringChips, {
+ props: {
+ tuning: preset('std6'),
+ isListening: true,
+ tunedStrings: new Set(),
+ lockedStringIndex: 1,
+ ...props,
+ },
+ })
+ const cursor = mountChips().findAll('.chip-cursor')
+ expect(cursor).toHaveLength(1)
+ expect(cursor[0].attributes('style')).toContain('--index: 4') // A2 is the 5th chip
+ expect(mountChips({ isListening: false }).find('.chip-cursor').exists()).toBe(false)
+ })
+
it('marks the locked and the tuned strings, and selects by position in the tuning', async () => {
const wrapper = mount(StringChips, {
props: {
diff --git a/src/composables/useTheme.ts b/src/composables/useTheme.ts
index 1fa499a..de12cde 100644
--- a/src/composables/useTheme.ts
+++ b/src/composables/useTheme.ts
@@ -1,4 +1,5 @@
-import { computed, watch } from 'vue'
+import { computed, nextTick, watch } from 'vue'
+import { revealChange } from '../ui/motion'
import { useSettings } from './useSettings'
const { settings, setTheme: _setTheme } = useSettings()
@@ -21,12 +22,17 @@ watch(
export function useTheme() {
const isDark = computed(() => settings.value.theme === 'dark')
- function toggleTheme() {
- _setTheme(settings.value.theme === 'dark' ? 'light' : 'dark')
+ // The new theme opens as a circle from where the user tapped
+ function setTheme(t: 'dark' | 'light') {
+ if (t === settings.value.theme) return
+ return revealChange(async () => {
+ _setTheme(t)
+ await nextTick() // the watch above has put data-theme on the page
+ })
}
- function setTheme(t: 'dark' | 'light') {
- _setTheme(t)
+ function toggleTheme() {
+ return setTheme(settings.value.theme === 'dark' ? 'light' : 'dark')
}
return { isDark, toggleTheme, setTheme }
diff --git a/src/ui/README.md b/src/ui/README.md
index 2e5e376..4af486b 100644
--- a/src/ui/README.md
+++ b/src/ui/README.md
@@ -10,25 +10,27 @@ them here first.
## Layers
-| File | What it holds |
-| --- | --- |
-| `styles/tokens.css` | Every colour (dark and light), spacing, radius, size, font, shadow, blur and duration, as custom properties |
-| `styles/base.css` | Page defaults: reset, font, the focus ring, reduced motion |
-| `styles/materials.css` | The three materials as classes, and the shared interaction states |
-| `index.css` | Imports the three above; `main.ts` loads it once |
-| `icons.ts` | The icon set, on a 24 px grid |
-| `index.ts` | Exports every component |
+| File | What it holds |
+| ---------------------- | ----------------------------------------------------------------------------------------------------------- |
+| `styles/tokens.css` | Every colour (dark and light), spacing, radius, size, font, shadow, blur and duration, as custom properties |
+| `styles/base.css` | Page defaults: reset, font, the focus ring, reduced motion |
+| `styles/materials.css` | The three materials as classes, and the shared interaction states |
+| `styles/motion.css` | The shared transitions (`ui-fade`, `ui-swap`, `ui-pop`) and keyframes (`ui-rise`, `ui-draw`) |
+| `index.css` | Imports the styles above; `main.ts` loads it once |
+| `icons.ts` | The icon set, on a 24 px grid |
+| `motion.ts` | `revealChange()`: a whole-page change that opens as a circle from the last tap |
+| `index.ts` | Exports every component |
## Materials
Liquid Glass is used sparingly: never in the content layer, and never on top of another glass.
-| Class | Use |
-| --- | --- |
-| `.ui-glass` | Controls on the background: the tuning pill, icon buttons, the chip track, Start/Stop |
-| `.ui-glass--sheet` | Sheets and dialogs. Inside them use filled controls only |
-| `.ui-material` | Content: the ring lens, the meter, the card on tablet and desktop |
-| `.ui-pressable` | Hover and pressed veils, a slight swell when pressed, 40 % when disabled |
+| Class | Use |
+| ------------------ | ------------------------------------------------------------------------------------- |
+| `.ui-glass` | Controls on the background: the tuning pill, icon buttons, the chip track, Start/Stop |
+| `.ui-glass--sheet` | Sheets and dialogs. Inside them use filled controls only |
+| `.ui-material` | Content: the ring lens, the meter, the card on tablet and desktop |
+| `.ui-pressable` | Hover and pressed veils, a slight swell when pressed, 40 % when disabled |
## Colour
@@ -43,22 +45,41 @@ Everything else is neutral. Selected segments are white or grey, not coloured.
## Components
-| Component | Props | Notes |
-| --- | --- | --- |
-| `UiIcon` | `name`, `size`, `strokeWidth`, `label` | Decorative unless it has a `label` |
-| `UiSurface` | `material` (`glass` / `sheet` / `thin`), `radius`, `as` | A container made of one material |
-| `UiButton` | `variant` (`primary` / `glass`), `size` (`lg` / `xl`), `align`, `block`, `loading`, `disabled` | Slots: `leading`, default, `trailing`. With `loading` it is busy and shows a spinner |
-| `UiIconButton` | `icon`, `label`, `variant` (`glass` / `fill` / `plain`) | `label` is required: the button has no text |
-| `UiSegmentedControl` | `options`, `label`, `size` (`sm` / `md` / `lg`), `v-model` | A radio group: arrow keys move the choice |
-| `UiSearchField` | `label`, `clearLabel`, `placeholder`, `size`, `autofocus`, `v-model` | Clear button while there is text |
-| `UiListRow` | `title`, `selected` | Slots: `meta`, default (second line), `action` (kept outside the row's button) |
-| `UiStatusPill` | `tone` (`success` / `warning` / `neutral`), `icon`, `hidden` | Tokens: `--status-pill-height`, `--status-pill-font-size` |
-| `UiSection` | `label` | A labelled group inside a sheet |
-| `UiSheet` | `title`, `closeLabel`, `size` (`md` / `lg`) | Slots: default (scrolls), `toolbar`, `subheader`. A bottom sheet on a phone, a dialog on wider screens. Closes with Escape or a tap outside, and keeps focus inside. Animate with `` |
+| Component | Props | Notes |
+| -------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `UiIcon` | `name`, `size`, `strokeWidth`, `label`, `draw` | Decorative unless it has a `label`. With `draw` its strokes draw themselves in |
+| `UiSurface` | `material` (`glass` / `sheet` / `thin`), `radius`, `as` | A container made of one material |
+| `UiButton` | `variant` (`primary` / `glass`), `size` (`lg` / `xl`), `align`, `block`, `loading`, `disabled` | Slots: `leading`, default, `trailing`. With `loading` it is busy and shows a spinner |
+| `UiIconButton` | `icon`, `label`, `variant` (`glass` / `fill` / `plain`) | `label` is required: the button has no text |
+| `UiSegmentedControl` | `options`, `label`, `size` (`sm` / `md` / `lg`), `v-model` | A radio group: arrow keys move the choice |
+| `UiSearchField` | `label`, `clearLabel`, `placeholder`, `size`, `autofocus`, `v-model` | Clear button while there is text |
+| `UiListRow` | `title`, `selected` | Slots: `meta`, default (second line), `action` (kept outside the row's button) |
+| `UiStatusPill` | `tone` (`success` / `warning` / `neutral`), `icon`, `hidden` | Tokens: `--status-pill-height`, `--status-pill-font-size` |
+| `UiSection` | `label` | A labelled group inside a sheet |
+| `UiSheet` | `title`, `closeLabel`, `size` (`md` / `lg`) | Slots: default (scrolls), `toolbar`, `subheader`. A bottom sheet on a phone, a dialog on wider screens. Closes with Escape or a tap outside, and keeps focus inside. Animate with `` |
+
+## Motion
+
+Things arrive with `--ease-out` or a gentle `--ease-spring` and leave faster with `--ease-in`.
+Durations are `--duration-fast` (150 ms), `--duration-base` (250 ms) and `--duration-slow` (420 ms).
+
+| What moves | How |
+| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
+| Theme | The new theme opens as a circle from the tapped button (`revealChange`, View Transitions API). Browsers without the API switch at once |
+| Segmented control | One thumb slides under the chosen option; the label's weight eases (Nunito is variable) |
+| Sheet | The scrim darkens and blurs in while the panel slides up whole. On wider screens the dialog rises and grows a little |
+| Buttons | Press: a slight swell that springs back. Start turning into Stop eases between the two colours |
+| String chips | The locked outline is one cursor that slides to the next string; a tuned string's check pops in |
+| Ring | The note is replaced by the next one (`ui-swap`). A confirmed string's arc fades out. At the end the check draws itself and the ring bounces |
+| Screen | The pieces rise into place one after another when the app opens |
+
+Use the shared transitions with Vue: ``, ``, ``. An element that declares its own `transition` replaces theirs, so it must list `opacity` and `transform` too.
+
+**Reduce Motion** turns every animation off, the theme reveal included.
## Accessibility
- Every control is at least 44 pt.
- Keyboard focus shows a 3 pt accent ring.
- A state is never shown by colour alone: tuned chips carry a check, hints carry an arrow and a word.
-- *Reduce Transparency* makes the materials solid. *Increase Contrast* strengthens their edges. *Reduce Motion* removes the animations.
+- _Reduce Transparency_ makes the materials solid. _Increase Contrast_ strengthens their edges. _Reduce Motion_ removes the animations.
diff --git a/src/ui/UiButton.vue b/src/ui/UiButton.vue
index d67bbd7..1b28a9c 100644
--- a/src/ui/UiButton.vue
+++ b/src/ui/UiButton.vue
@@ -54,6 +54,12 @@ withDefaults(
font-size: var(--font-size-headline);
font-weight: var(--font-weight-semibold);
white-space: nowrap;
+ /* Start turning into Stop eases from accent to glass */
+ transition:
+ background-color var(--duration-base) var(--ease-out),
+ color var(--duration-base) var(--ease-out),
+ transform var(--duration-base) var(--ease-spring),
+ opacity var(--duration-fast);
}
.ui-button--lg {
diff --git a/src/ui/UiIcon.vue b/src/ui/UiIcon.vue
index 6672101..ea807c1 100644
--- a/src/ui/UiIcon.vue
+++ b/src/ui/UiIcon.vue
@@ -11,6 +11,8 @@ const props = withDefaults(
strokeWidth?: number
/** Accessible name; without it the icon is decorative and hidden from screen readers */
label?: string
+ /** Draw the strokes in when the icon appears (a check that writes itself) */
+ draw?: boolean
}>(),
{ size: 24, strokeWidth: undefined, label: undefined },
)
@@ -34,7 +36,13 @@ const icon = computed(() => ICONS[props.name])
:aria-hidden="label ? undefined : 'true'"
focusable="false"
>
-
+
@@ -43,4 +51,9 @@ const icon = computed(() => ICONS[props.name])
flex: none;
display: block;
}
+
+.ui-icon__draw {
+ stroke-dasharray: 1;
+ animation: ui-draw var(--duration-slow) var(--ease-out) var(--ui-icon-draw-delay, 0ms) both;
+}
diff --git a/src/ui/UiSegmentedControl.vue b/src/ui/UiSegmentedControl.vue
index 09636be..33b7c1c 100644
--- a/src/ui/UiSegmentedControl.vue
+++ b/src/ui/UiSegmentedControl.vue
@@ -1,5 +1,5 @@
-