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/splitter.ts

54 lines
2.0 KiB

import { semaSelector } from '$uix/morfo';
import { splitterMorfo } from '$uix/morfo/components/splitter';
import type { Sema } from '../sema-map';
/**
* Splitter perceptual defaults — mirrors the Slider's three-event shape
* (handle-pick → handle-drag → commit-set) with a heavier sonic register
* appropriate to moving whole panels rather than a thumb on a track.
*
* Sound:
* - `handle-pick` → `handle.pickup.air` (gain 0.10, slightly softer
* than slider's 0.12 — splitters get grabbed more often)
* - `handle-drag` → channel-only rule. Per-emit `signal.overrides`
* from soma name the sound (`step` — the gesture sounds by
* REPETITION, cadence = ratchet) and drive the velocity haptic;
* a `sound:` here would clobber that name.
* - `commit-set` → `handle.snap.chime` + tap haptic for the
* "I committed to this layout" landing cue.
*
* Haptic mirrors slider: tick on pick, tick driven by velocity during
* drag (also from soma overrides), tap on commit.
*/
const onResizeTrigger = (matchers?: Parameters<typeof semaSelector<typeof splitterMorfo>>[2]) =>
semaSelector(splitterMorfo, 'resize-trigger', matchers);
const onProvider = (matchers?: Parameters<typeof semaSelector<typeof splitterMorfo>>[2]) =>
semaSelector(splitterMorfo, 'provider', matchers);
export const splitterSema: Sema = {
name: 'splitter',
cascade: [
{
selector: onResizeTrigger({ eventName: 'handle-pick' }),
channels: ['sound', 'haptic'],
sound: 'air',
haptic: { kind: 'tick', intensity: 0.2, duration: 6 }
},
{
// Channels-only — the per-emit `signal.overrides` from soma
// own the gesture (`sound: 'step'` + the haptic curve). Adding
// a `sound:` here would clobber them.
selector: onResizeTrigger({ eventName: 'handle-drag' }),
channels: ['sound', 'haptic']
},
{
selector: onProvider({ eventName: 'commit-set' }),
channels: ['sound', 'haptic'],
sound: 'snap',
haptic: { kind: 'tap', intensity: 0.5, duration: 22 }
}
]
};

Powered by TurnKey Linux.