@goodandready/dsh-tts 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +74 -3
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -42,7 +42,20 @@ window.__ModuleLoader__.load({
|
|
|
42
42
|
'.dts-bad{font-size:12px;color:var(--dsw-alias-state-error-primary)}' +
|
|
43
43
|
'.dts-badge{font-size:11px;padding:2px 8px;border-radius:999px;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);white-space:nowrap}' +
|
|
44
44
|
'.dts-badge-on{color:var(--dsw-alias-state-success-primary);border-color:currentColor}' +
|
|
45
|
-
'.dts-link{background:none;border:none;color:var(--dsw-alias-label-secondary);cursor:pointer;font-size:12px;padding:0}'
|
|
45
|
+
'.dts-link{background:none;border:none;color:var(--dsw-alias-label-secondary);cursor:pointer;font-size:12px;padding:0}' +
|
|
46
|
+
// Карточка во вкладке «Настройки плагинов» — как у соседних
|
|
47
|
+
// плагинов: li в списке ядра, шапка со сбросом темы, шеврон.
|
|
48
|
+
'.dts-card{list-style:none;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;transition:border-color .16s,background .16s}' +
|
|
49
|
+
'.dts-card:hover{border-color:var(--dsw-alias-label-dimmed)}' +
|
|
50
|
+
'.dts-cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}' +
|
|
51
|
+
'.dts-cardHead{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}' +
|
|
52
|
+
'.dts-cardHead:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}' +
|
|
53
|
+
'.dts-headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}' +
|
|
54
|
+
'.dts-name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}' +
|
|
55
|
+
'.dts-descr{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}' +
|
|
56
|
+
'.dts-chev{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}' +
|
|
57
|
+
'.dts-chevOpen{transform:rotate(180deg)}' +
|
|
58
|
+
'.dts-cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding:16px 0 8px}'
|
|
46
59
|
|
|
47
60
|
const setCssId = 'dsh-tts/settings.module.css'
|
|
48
61
|
if (typeof document !== 'undefined' && !document.querySelector('style[data-plugin-css="' + setCssId + '"]')) {
|
|
@@ -353,6 +366,7 @@ window.__ModuleLoader__.load({
|
|
|
353
366
|
'down': 'Down',
|
|
354
367
|
'save': 'Save',
|
|
355
368
|
'saved': 'Saved',
|
|
369
|
+
'cardHint': 'Provider chain, voices and playback options.',
|
|
356
370
|
}
|
|
357
371
|
const ru = {
|
|
358
372
|
'general': 'Общее',
|
|
@@ -400,6 +414,7 @@ window.__ModuleLoader__.load({
|
|
|
400
414
|
'down': 'Ниже',
|
|
401
415
|
'save': 'Сохранить',
|
|
402
416
|
'saved': 'Сохранено',
|
|
417
|
+
'cardHint': 'Цепочка провайдеров, голоса и параметры чтения.',
|
|
403
418
|
}
|
|
404
419
|
|
|
405
420
|
function TtsSection(props) {
|
|
@@ -565,6 +580,41 @@ window.__ModuleLoader__.load({
|
|
|
565
580
|
)
|
|
566
581
|
}
|
|
567
582
|
|
|
583
|
+
|
|
584
|
+
// Карточка во вкладке «Настройки плагинов» — та же структура, что у
|
|
585
|
+
// ядра и соседних плагинов: li в списке, шапка-кнопка со сбросом
|
|
586
|
+
// темы (иначе браузерный стиль кнопки красит её фирменным акцентом),
|
|
587
|
+
// шеврон, тело с формой.
|
|
588
|
+
function TtsCard(props) {
|
|
589
|
+
const t = (props && props.t) || ((key) => key)
|
|
590
|
+
const [open, setOpen] = React.useState(false)
|
|
591
|
+
return React.createElement('li', { className: 'dts-card' + (open ? ' dts-cardOpen' : '') },
|
|
592
|
+
React.createElement('button', {
|
|
593
|
+
type: 'button',
|
|
594
|
+
className: 'dts-cardHead',
|
|
595
|
+
onClick: () => setOpen(!open),
|
|
596
|
+
'aria-expanded': open,
|
|
597
|
+
},
|
|
598
|
+
React.createElement('div', { className: 'dts-headText' },
|
|
599
|
+
React.createElement('div', { className: 'dts-name' }, t('title')),
|
|
600
|
+
React.createElement('div', { className: 'dts-descr' }, t('cardHint')),
|
|
601
|
+
),
|
|
602
|
+
React.createElement('svg', {
|
|
603
|
+
className: 'dts-chev' + (open ? ' dts-chevOpen' : ''),
|
|
604
|
+
width: 16, height: 16, viewBox: '0 0 16 16', fill: 'none',
|
|
605
|
+
},
|
|
606
|
+
React.createElement('path', {
|
|
607
|
+
d: 'M4 6l4 4 4-4', stroke: 'currentColor', 'stroke-width': 1.5,
|
|
608
|
+
'stroke-linecap': 'round', 'stroke-linejoin': 'round',
|
|
609
|
+
}),
|
|
610
|
+
),
|
|
611
|
+
),
|
|
612
|
+
open ? React.createElement('div', { className: 'dts-cardBody' },
|
|
613
|
+
React.createElement(TtsSection, props),
|
|
614
|
+
) : null,
|
|
615
|
+
)
|
|
616
|
+
}
|
|
617
|
+
|
|
568
618
|
// Кнопка в строке ввода: видно, что сейчас читается, и можно остановить.
|
|
569
619
|
function SpeakerControl() {
|
|
570
620
|
const p = usePlayer()
|
|
@@ -598,12 +648,30 @@ window.__ModuleLoader__.load({
|
|
|
598
648
|
// Подпись раздела рисует боковой список, а не наш компонент: props.t
|
|
599
649
|
// туда не доходит, поэтому берём переводчик, привязанный к namespace.
|
|
600
650
|
const t = ctx.locale.bind(NS)
|
|
651
|
+
// Штатное место настроек — карточка во вкладке «Настройки плагинов».
|
|
652
|
+
// Вкладка перебирает пространства настроек и ищет слот по entryKey,
|
|
653
|
+
// равному имени пространства: ключ обязан равняться NS, иначе карточка
|
|
654
|
+
// не появится молча, без единой ошибки в журнале.
|
|
655
|
+
let moved = false
|
|
656
|
+
try {
|
|
657
|
+
moved = !!ctx.slots.inject('settings.plugin.item', () => ctx.slots.register(
|
|
658
|
+
{
|
|
659
|
+
name: 'settings.plugin.item',
|
|
660
|
+
key: NS,
|
|
661
|
+
locale: NS,
|
|
662
|
+
inject: () => ({ ctx: ctx }),
|
|
663
|
+
},
|
|
664
|
+
TtsCard,
|
|
665
|
+
))
|
|
666
|
+
} catch (noPluginItemSlot) { moved = false }
|
|
667
|
+
if (moved) return
|
|
668
|
+
// Запасной путь для сборок без settings.plugin.item: прежний раздел
|
|
669
|
+
// в боковом списке, чтобы настройки не пропали.
|
|
601
670
|
ctx.slots.inject('settings.section', () => ctx.slots.register(
|
|
602
671
|
{
|
|
603
672
|
name: 'settings.section',
|
|
604
673
|
id: '@goodandready/dsh-tts',
|
|
605
674
|
order: 32,
|
|
606
|
-
// locale в записи слота — то, из-за чего компонент получает props.t.
|
|
607
675
|
locale: NS,
|
|
608
676
|
label: () => t('title'),
|
|
609
677
|
inject: () => ({ ctx: ctx }),
|
|
@@ -617,7 +685,10 @@ window.__ModuleLoader__.load({
|
|
|
617
685
|
registerSettings(ctx)
|
|
618
686
|
registerSpeaker(ctx)
|
|
619
687
|
ctx.effect(() => listenForVoice(), 'dsh-tts: замолкать, когда человек заговорил')
|
|
620
|
-
|
|
688
|
+
ctx.effect(() => {
|
|
689
|
+
const timer = setInterval(pollPending, 1000)
|
|
690
|
+
return () => clearInterval(timer)
|
|
691
|
+
}, 'dsh-tts: опрос готовых озвучек')
|
|
621
692
|
}
|
|
622
693
|
return module.exports
|
|
623
694
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-tts",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Text-to-speech for DeepSeek Harness: speak agent replies in the Web UI with a provider fallback chain (OpenAI, ElevenLabs, Google, Azure, Groq, Deepgram, OpenRouter, Edge, Piper, eSpeak).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|