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.
114 lines
3.6 KiB
114 lines
3.6 KiB
import { semaSelector } from '$uix/morfo';
|
|
import { wordsMorfo } from '$uix/morfo/components/words';
|
|
import { soundTuning } from '../sounds';
|
|
import type { Sema } from '../sema-map';
|
|
|
|
const onProvider = (matchers?: Parameters<typeof semaSelector<typeof wordsMorfo>>[2]) =>
|
|
semaSelector(wordsMorfo, 'provider', matchers);
|
|
|
|
const onContent = (matchers?: Parameters<typeof semaSelector<typeof wordsMorfo>>[2]) =>
|
|
semaSelector(wordsMorfo, 'content', matchers);
|
|
|
|
const onCommandButton = (matchers?: Parameters<typeof semaSelector<typeof wordsMorfo>>[2]) =>
|
|
semaSelector(wordsMorfo, 'command-button', matchers);
|
|
|
|
const onSlashMenu = (matchers?: Parameters<typeof semaSelector<typeof wordsMorfo>>[2]) =>
|
|
semaSelector(wordsMorfo, 'slash-menu', matchers);
|
|
|
|
const onLinkEditor = (matchers?: Parameters<typeof semaSelector<typeof wordsMorfo>>[2]) =>
|
|
semaSelector(wordsMorfo, 'link-editor', matchers);
|
|
|
|
const onFindReplace = (matchers?: Parameters<typeof semaSelector<typeof wordsMorfo>>[2]) =>
|
|
semaSelector(wordsMorfo, 'find-replace', matchers);
|
|
|
|
export const wordsSema: Sema = {
|
|
name: 'words',
|
|
cascade: [
|
|
{
|
|
// Words-level focus signal. Fires ONCE per real focus
|
|
// transition (provider target — see morfo note). Internal
|
|
// tool bounces (drawer / block-handle / inserter / float
|
|
// bar / popovers) do NOT re-fire because `isInsideWordsTool`
|
|
// holds `focused` across them.
|
|
selector: onProvider({ eventName: 'contact-focus' }),
|
|
sound: soundTuning('form.commit.subtle', {
|
|
gain: { op: 'multiply', factor: 0.55 },
|
|
pitch: { op: 'add', value: 40 }
|
|
}),
|
|
haptic: { kind: 'tick', intensity: 0.12, duration: 6 }
|
|
},
|
|
{
|
|
selector: onProvider({ eventName: 'commit-save-content' }),
|
|
sound: soundTuning('form.commit.soft'),
|
|
haptic: { kind: 'success' }
|
|
},
|
|
{
|
|
selector: onCommandButton({ eventName: 'commit-set-format' }),
|
|
sound: soundTuning('form.commit.subtle'),
|
|
haptic: { kind: 'tap' }
|
|
},
|
|
{
|
|
selector: onSlashMenu({ eventName: 'commit-set-slash' }),
|
|
sound: soundTuning('form.commit.soft', {
|
|
gain: { op: 'multiply', factor: 0.85 },
|
|
pitch: { op: 'add', value: 30 }
|
|
}),
|
|
haptic: { kind: 'tap' }
|
|
},
|
|
{
|
|
selector: onLinkEditor({ eventName: 'commit-set-link' }),
|
|
sound: soundTuning('form.commit.soft', {
|
|
gain: { op: 'multiply', factor: 0.9 },
|
|
pitch: { op: 'add', value: 20 }
|
|
}),
|
|
haptic: { kind: 'tap' }
|
|
},
|
|
{
|
|
selector: onLinkEditor({ eventName: 'commit-reset-link' }),
|
|
sound: soundTuning('form.commit.subtle', {
|
|
gain: { op: 'multiply', factor: 0.8 },
|
|
contour: 'descending'
|
|
}),
|
|
haptic: { kind: 'tap' }
|
|
},
|
|
{
|
|
selector: onFindReplace({ eventName: 'commit-set-replace' }),
|
|
sound: soundTuning('form.commit.subtle', {
|
|
gain: { op: 'multiply', factor: 0.85 }
|
|
}),
|
|
haptic: { kind: 'tap' }
|
|
},
|
|
{
|
|
selector: onContent({ eventName: 'commit-set-check' }),
|
|
sound: soundTuning('form.commit.subtle', {
|
|
gain: { op: 'multiply', factor: 0.85 }
|
|
}),
|
|
haptic: { kind: 'tap' }
|
|
},
|
|
{
|
|
selector: onProvider({ eventName: 'commit-restore-history' }),
|
|
sound: soundTuning('form.commit.subtle', {
|
|
gain: { op: 'multiply', factor: 0.85 },
|
|
contour: 'descending'
|
|
}),
|
|
haptic: { kind: 'tap' }
|
|
},
|
|
{
|
|
selector: onProvider({ eventName: 'commit-reset-content' }),
|
|
sound: soundTuning('form.commit.subtle', {
|
|
contour: 'descending',
|
|
pitch: { op: 'add', value: -80 }
|
|
}),
|
|
haptic: { kind: 'tap' }
|
|
},
|
|
{
|
|
selector: onContent({ eventName: 'signal-warn-invalid' }),
|
|
sound: soundTuning('form.commit.subtle', {
|
|
contour: 'descending',
|
|
pitch: { op: 'add', value: -120 }
|
|
}),
|
|
haptic: { kind: 'warning' }
|
|
}
|
|
]
|
|
};
|