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

42 lines
1.5 KiB

import { semaSelector } from '$uix/morfo';
import { collapsibleMorfo } from '$uix/morfo/components/collapsible';
import { soundTuning } from '../sounds';
import type { Sema } from '../sema-map';
/**
* Collapsible perceptual defaults — MIRRORS ACCORDION.
*
* Collapsible is the single-panel sibling of Accordion (which already
* ships a pack). Coherence demands they share the perceptual signature:
* a user disclosing a section gets the same cue regardless of whether
* the surface is grouped (accordion) or standalone (collapsible).
*
* Per `src/uix/sema/components/accordion.ts`:
* - `expand` (emerge.open / verb=expand in our case): `emerge.soft`
* — soft chime at gain 0.08. The family base ascending contour
* reads as "panel reveals".
* - `collapse` (emerge.close / verb=collapse): `emerge.exit` at
* gain 0.06 — descending pitch, same direction discipline as the
* rest of the system (dialog, drawer, popover, menus).
*
* No haptic — disclosure is a deliberate, already-acknowledged gesture
* on a trigger button; tactile feedback on top would be noise.
*/
const onContent = (matchers?: Parameters<typeof semaSelector<typeof collapsibleMorfo>>[2]) =>
semaSelector(collapsibleMorfo, 'content', matchers);
export const collapsibleSema: Sema = {
name: 'collapsible',
cascade: [
{
selector: onContent({ eventName: 'expand' }),
sound: soundTuning('emerge.soft')
},
{
selector: onContent({ eventName: 'collapse' }),
sound: soundTuning('emerge.exit', { gain: 0.06 })
}
]
};

Powered by TurnKey Linux.