You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte-kit-vice/src/uix/sema/components/password-field.ts

45 lines
1.5 KiB

import { semaSelector } from '$uix/morfo';
import { passwordFieldMorfo } from '$uix/morfo/components/password-field';
import { soundTuning } from '../sounds';
import type { Sema } from '../sema-map';
/**
* PasswordField perceptual defaults.
*
* - `commit-submit` → standard commit chime (Enter pressed in the input).
* - `commit-toggle-visibility` → soft commit click on the eye button.
* Per book cap. 23: togglear visibilidad fija un estado, no cambia el
* contexto operativo.
* - `signal-notify-caps-state` → tap when caps lock state flips while
* typing — subtle audio counterpart to the visible indicator. Per book
* cap. 24: signal.notify + neutral (the system orients attention without
* urgency).
* Typing itself (`commit-input`) is silent.
*/
const onPart = (
part: 'provider' | 'input' | 'visibility-trigger' | 'caps-lock-indicator',
matchers?: Parameters<typeof semaSelector<typeof passwordFieldMorfo>>[2]
) => semaSelector(passwordFieldMorfo, part, matchers);
export const passwordFieldSema: Sema = {
name: 'password-field',
cascade: [
{
selector: onPart('input', { eventName: 'commit-submit' }),
sound: soundTuning('form.commit.soft'),
haptic: { kind: 'tap' }
},
{
selector: onPart('visibility-trigger', { eventName: 'commit-toggle-visibility' }),
sound: soundTuning('form.commit.subtle'),
haptic: { kind: 'tap' }
},
{
selector: onPart('caps-lock-indicator', { eventName: 'signal-notify-caps-state' }),
sound: soundTuning('form.commit.subtle'),
haptic: { kind: 'tap' }
}
]
};

Powered by TurnKey Linux.