dsh-mimo-speak 0.0.0-stage → 0.1.2
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/LICENSE +21 -0
- package/README.md +197 -2
- package/README.zh.md +166 -0
- package/cordis.patch.yml +20 -0
- package/icon.svg +6 -0
- package/lib/client.js +3607 -0
- package/lib/client.js.map +1 -0
- package/lib/node/brief.d.ts +23 -0
- package/lib/node/brief.js +110 -0
- package/lib/node/brief.js.map +1 -0
- package/lib/node/client/BundleConfigCard.d.ts +15 -0
- package/lib/node/client/BundleConfigCard.js +22 -0
- package/lib/node/client/BundleConfigCard.js.map +1 -0
- package/lib/node/client/PlayerBar.d.ts +45 -0
- package/lib/node/client/PlayerBar.js +83 -0
- package/lib/node/client/PlayerBar.js.map +1 -0
- package/lib/node/client/SettingsSectionCard.d.ts +14 -0
- package/lib/node/client/SettingsSectionCard.js +19 -0
- package/lib/node/client/SettingsSectionCard.js.map +1 -0
- package/lib/node/client/SpeakAction.d.ts +32 -0
- package/lib/node/client/SpeakAction.js +651 -0
- package/lib/node/client/SpeakAction.js.map +1 -0
- package/lib/node/client/SpeakerIcon.d.ts +11 -0
- package/lib/node/client/SpeakerIcon.js +5 -0
- package/lib/node/client/SpeakerIcon.js.map +1 -0
- package/lib/node/client/TtsSettingsForm.d.ts +27 -0
- package/lib/node/client/TtsSettingsForm.js +164 -0
- package/lib/node/client/TtsSettingsForm.js.map +1 -0
- package/lib/node/client/api.d.ts +89 -0
- package/lib/node/client/api.js +247 -0
- package/lib/node/client/api.js.map +1 -0
- package/lib/node/client/audio-bus.d.ts +29 -0
- package/lib/node/client/audio-bus.js +91 -0
- package/lib/node/client/audio-bus.js.map +1 -0
- package/lib/node/client/chat-text.d.ts +32 -0
- package/lib/node/client/chat-text.js +90 -0
- package/lib/node/client/chat-text.js.map +1 -0
- package/lib/node/client/highlight.d.ts +45 -0
- package/lib/node/client/highlight.js +198 -0
- package/lib/node/client/highlight.js.map +1 -0
- package/lib/node/client/index.d.ts +26 -0
- package/lib/node/client/index.js +89 -0
- package/lib/node/client/index.js.map +1 -0
- package/lib/node/client/locales.d.ts +19 -0
- package/lib/node/client/locales.js +180 -0
- package/lib/node/client/locales.js.map +1 -0
- package/lib/node/client/panel-visibility.d.ts +24 -0
- package/lib/node/client/panel-visibility.js +16 -0
- package/lib/node/client/panel-visibility.js.map +1 -0
- package/lib/node/client/settings-controller.d.ts +116 -0
- package/lib/node/client/settings-controller.js +201 -0
- package/lib/node/client/settings-controller.js.map +1 -0
- package/lib/node/client/settings-registration.d.ts +24 -0
- package/lib/node/client/settings-registration.js +21 -0
- package/lib/node/client/settings-registration.js.map +1 -0
- package/lib/node/client/slots.d.ts +48 -0
- package/lib/node/client/slots.js +15 -0
- package/lib/node/client/slots.js.map +1 -0
- package/lib/node/client/speech-cache.d.ts +59 -0
- package/lib/node/client/speech-cache.js +68 -0
- package/lib/node/client/speech-cache.js.map +1 -0
- package/lib/node/client/split-speech.d.ts +20 -0
- package/lib/node/client/split-speech.js +100 -0
- package/lib/node/client/split-speech.js.map +1 -0
- package/lib/node/client/status.d.ts +28 -0
- package/lib/node/client/status.js +60 -0
- package/lib/node/client/status.js.map +1 -0
- package/lib/node/client/stream-dispose.d.ts +119 -0
- package/lib/node/client/stream-dispose.js +249 -0
- package/lib/node/client/stream-dispose.js.map +1 -0
- package/lib/node/client/styles.d.ts +19 -0
- package/lib/node/client/styles.js +176 -0
- package/lib/node/client/styles.js.map +1 -0
- package/lib/node/client/use-audio-player.d.ts +44 -0
- package/lib/node/client/use-audio-player.js +102 -0
- package/lib/node/client/use-audio-player.js.map +1 -0
- package/lib/node/client/use-audio-queue.d.ts +44 -0
- package/lib/node/client/use-audio-queue.js +151 -0
- package/lib/node/client/use-audio-queue.js.map +1 -0
- package/lib/node/client/use-stream-player.d.ts +41 -0
- package/lib/node/client/use-stream-player.js +60 -0
- package/lib/node/client/use-stream-player.js.map +1 -0
- package/lib/node/edge-tts.d.ts +21 -0
- package/lib/node/edge-tts.js +111 -0
- package/lib/node/edge-tts.js.map +1 -0
- package/lib/node/index.d.ts +97 -0
- package/lib/node/index.js +463 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/normalize.d.ts +30 -0
- package/lib/node/normalize.js +72 -0
- package/lib/node/normalize.js.map +1 -0
- package/lib/node/settings.d.ts +186 -0
- package/lib/node/settings.js +74 -0
- package/lib/node/settings.js.map +1 -0
- package/lib/node/summarize.d.ts +29 -0
- package/lib/node/summarize.js +131 -0
- package/lib/node/summarize.js.map +1 -0
- package/lib/node/tool.d.ts +54 -0
- package/lib/node/tool.js +123 -0
- package/lib/node/tool.js.map +1 -0
- package/lib/node/tts.d.ts +127 -0
- package/lib/node/tts.js +361 -0
- package/lib/node/tts.js.map +1 -0
- package/lib/node/wav.d.ts +32 -0
- package/lib/node/wav.js +63 -0
- package/lib/node/wav.js.map +1 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +122 -4
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sentence highlighting for the speak entry.
|
|
3
|
+
*
|
|
4
|
+
* While a chunk plays, the sentence it came from is tinted inside the message
|
|
5
|
+
* bubble. The highlighter walks the message's text nodes once, indexes their
|
|
6
|
+
* letters/digits (a normalization that survives Markdown and inline styles),
|
|
7
|
+
* and maps each chunk text back to DOM ranges through the CSS Custom
|
|
8
|
+
* Highlight API — so no DOM is mutated and scroll position never jumps.
|
|
9
|
+
*
|
|
10
|
+
* When the API is unavailable the highlighter silently no-ops.
|
|
11
|
+
* @module dsh-mimo-speak/client/highlight
|
|
12
|
+
*/
|
|
13
|
+
const STYLE_ID = 'dsh-mimo-speak-highlight-style';
|
|
14
|
+
const HIGHLIGHT_NAME = 'dsh-mimo-speak-sentence';
|
|
15
|
+
/**
|
|
16
|
+
* The instance that most recently painted. Every instance writes the same
|
|
17
|
+
* highlight name, so a clear() from a stale instance — an older message
|
|
18
|
+
* finishing while the new one speaks — would otherwise wipe the live paint.
|
|
19
|
+
*/
|
|
20
|
+
let owner = null;
|
|
21
|
+
/** Whether the browser supports the CSS Custom Highlight API. */
|
|
22
|
+
function highlightSupported() {
|
|
23
|
+
return typeof window !== 'undefined'
|
|
24
|
+
&& typeof window.CSS !== 'undefined'
|
|
25
|
+
&& window.CSS.highlights !== undefined
|
|
26
|
+
&& typeof window.Highlight === 'function';
|
|
27
|
+
}
|
|
28
|
+
function ensureStyle() {
|
|
29
|
+
if (typeof document === 'undefined' || document.getElementById(STYLE_ID) !== null)
|
|
30
|
+
return;
|
|
31
|
+
const style = document.createElement('style');
|
|
32
|
+
style.id = STYLE_ID;
|
|
33
|
+
style.textContent = `::highlight(${HIGHLIGHT_NAME}){background-color:color-mix(in srgb,var(--dsw-alias-brand-primary,#ffc400) 26%,transparent)}`;
|
|
34
|
+
document.head.appendChild(style);
|
|
35
|
+
}
|
|
36
|
+
/** Keep only letters and digits, case-folded, so matching ignores Markdown. */
|
|
37
|
+
function keyChar(char) {
|
|
38
|
+
const code = char.codePointAt(0);
|
|
39
|
+
if (code === undefined)
|
|
40
|
+
return '';
|
|
41
|
+
if ((code >= 0x30 && code <= 0x39) || (code >= 0x61 && code <= 0x7a))
|
|
42
|
+
return char;
|
|
43
|
+
if (code >= 0x41 && code <= 0x5a)
|
|
44
|
+
return char.toLowerCase();
|
|
45
|
+
if (code >= 0x4e00 && code <= 0x9fff)
|
|
46
|
+
return char;
|
|
47
|
+
// Latin letters beyond ASCII, Cyrillic, etc.: keep the normalized glyph.
|
|
48
|
+
if (/\p{L}/u.test(char) || /\p{N}/u.test(char))
|
|
49
|
+
return char.normalize('NFC').toLowerCase();
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
52
|
+
/** Build the folded key plus per-key source offsets for one string. */
|
|
53
|
+
function keyOf(text) {
|
|
54
|
+
let key = '';
|
|
55
|
+
const at = [];
|
|
56
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
57
|
+
const folded = keyChar(text[index]);
|
|
58
|
+
if (folded === '')
|
|
59
|
+
continue;
|
|
60
|
+
key += folded;
|
|
61
|
+
at.push(index);
|
|
62
|
+
}
|
|
63
|
+
return { key, at };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Locate the message bubble containing the speak button, by walking up from
|
|
67
|
+
* the button until an ancestor's text carries the opening of the spoken text.
|
|
68
|
+
* @param fromEl - the action row element (or any descendant of the bubble).
|
|
69
|
+
* @param probeText - the speakable text whose opening identifies the bubble.
|
|
70
|
+
* @returns the closest matching ancestor, or null.
|
|
71
|
+
*/
|
|
72
|
+
export function findMessageContainer(fromEl, probeText) {
|
|
73
|
+
if (fromEl === null || typeof document === 'undefined')
|
|
74
|
+
return null;
|
|
75
|
+
const probe = keyOf(probeText.slice(0, 80)).key.slice(0, 40);
|
|
76
|
+
if (probe === '')
|
|
77
|
+
return null;
|
|
78
|
+
let element = fromEl.parentElement;
|
|
79
|
+
for (let depth = 0; element !== null && depth < 14; depth += 1, element = element.parentElement) {
|
|
80
|
+
const key = keyOf(element.textContent ?? '').key;
|
|
81
|
+
if (key.includes(probe))
|
|
82
|
+
return element;
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
/** Highlight one sentence of one message while it plays. */
|
|
87
|
+
export class SentenceHighlighter {
|
|
88
|
+
container;
|
|
89
|
+
token = {};
|
|
90
|
+
nodes = [];
|
|
91
|
+
map = [];
|
|
92
|
+
key = '';
|
|
93
|
+
/** Text length the index was built from; a re-render invalidates it. */
|
|
94
|
+
indexedSignature = '';
|
|
95
|
+
constructor(container) {
|
|
96
|
+
this.container = container ?? document.body;
|
|
97
|
+
if (highlightSupported())
|
|
98
|
+
ensureStyle();
|
|
99
|
+
}
|
|
100
|
+
/** Whether any highlight can actually be painted. */
|
|
101
|
+
get supported() {
|
|
102
|
+
return highlightSupported();
|
|
103
|
+
}
|
|
104
|
+
/** Index the message's text nodes, rebuilding when the text changed. */
|
|
105
|
+
index() {
|
|
106
|
+
// Markdown can re-render while a reply settles; rebuild on a length change
|
|
107
|
+
// so ranges never point at a stale text node.
|
|
108
|
+
const signature = `${this.container.textContent?.length ?? -1}`;
|
|
109
|
+
if (this.indexedSignature === signature)
|
|
110
|
+
return;
|
|
111
|
+
this.indexedSignature = signature;
|
|
112
|
+
this.nodes.length = 0;
|
|
113
|
+
this.map.length = 0;
|
|
114
|
+
this.key = '';
|
|
115
|
+
const walker = document.createTreeWalker(this.container, NodeFilter.SHOW_TEXT, {
|
|
116
|
+
acceptNode: (node) => {
|
|
117
|
+
const parent = node.parentElement;
|
|
118
|
+
if (parent === null)
|
|
119
|
+
return NodeFilter.FILTER_REJECT;
|
|
120
|
+
const tag = parent.tagName;
|
|
121
|
+
if (tag === 'SCRIPT' || tag === 'STYLE' || tag === 'BUTTON' || tag === 'PRE')
|
|
122
|
+
return NodeFilter.FILTER_REJECT;
|
|
123
|
+
if (parent.closest('.mimo-speak-root') !== null)
|
|
124
|
+
return NodeFilter.FILTER_REJECT;
|
|
125
|
+
const value = node.nodeValue ?? '';
|
|
126
|
+
if (value.trim() === '')
|
|
127
|
+
return NodeFilter.FILTER_REJECT;
|
|
128
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
let node;
|
|
132
|
+
while ((node = walker.nextNode()) !== null) {
|
|
133
|
+
const text = node.nodeValue ?? '';
|
|
134
|
+
const { key, at } = keyOf(text);
|
|
135
|
+
if (key === '')
|
|
136
|
+
continue;
|
|
137
|
+
this.nodes.push({ node: node, text, keyLength: at.length });
|
|
138
|
+
for (let index = 0; index < at.length; index += 1) {
|
|
139
|
+
this.map.push([this.nodes.length - 1, at[index]]);
|
|
140
|
+
}
|
|
141
|
+
this.key += key;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Paint the sentence `text` onto the message, searching from the key offset
|
|
146
|
+
* `from` so repeated phrases highlight their later occurrence.
|
|
147
|
+
* @param text - one chunk (a substring of the message).
|
|
148
|
+
* @param from - key offset to search from.
|
|
149
|
+
* @returns the key offset just past the painted range (feed it back next).
|
|
150
|
+
*/
|
|
151
|
+
show(text, from) {
|
|
152
|
+
if (!highlightSupported())
|
|
153
|
+
return from;
|
|
154
|
+
try {
|
|
155
|
+
this.index();
|
|
156
|
+
const { key } = keyOf(text);
|
|
157
|
+
if (key === '' || this.key === '')
|
|
158
|
+
return from;
|
|
159
|
+
let start = this.key.indexOf(key, Math.max(0, from));
|
|
160
|
+
if (start < 0)
|
|
161
|
+
start = this.key.indexOf(key);
|
|
162
|
+
if (start < 0)
|
|
163
|
+
return from;
|
|
164
|
+
const end = start + key.length;
|
|
165
|
+
if (start >= this.map.length || end > this.map.length)
|
|
166
|
+
return from;
|
|
167
|
+
const first = this.map[start];
|
|
168
|
+
const last = this.map[end - 1];
|
|
169
|
+
const range = new Range();
|
|
170
|
+
range.setStart(this.nodes[first[0]].node, first[1]);
|
|
171
|
+
range.setEnd(this.nodes[last[0]].node, last[1] + 1);
|
|
172
|
+
const highlight = new Highlight(range);
|
|
173
|
+
owner = this.token;
|
|
174
|
+
window.CSS.highlights.set(HIGHLIGHT_NAME, highlight);
|
|
175
|
+
return end;
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
// Painting is decorative: it must never break playback.
|
|
179
|
+
return from;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/** Remove the painted sentence, unless another instance owns it now. */
|
|
183
|
+
clear() {
|
|
184
|
+
if (!highlightSupported())
|
|
185
|
+
return;
|
|
186
|
+
if (owner !== null && owner !== this.token)
|
|
187
|
+
return;
|
|
188
|
+
owner = null;
|
|
189
|
+
try {
|
|
190
|
+
;
|
|
191
|
+
window.CSS.highlights.delete(HIGHLIGHT_NAME);
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
// Nothing painted.
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=highlight.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AAA;YAC9B,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAA;YACzB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YACnD,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;YACnD,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,CAAA;YACtC,KAAK,GAAG,IAAI,CAAC,KAAK,CACjB;YAAC,MAAM,CAAC,GAA8C,CAAC,UAAU,CAAC,GAAG,CAAC,cAAc,EAAE,SAAS,CAAC,CAAA;YACjG,OAAO,GAAG,CAAA;QACZ,CAAC;QAAC,MAAM,CAAC;YACP,wDAAwD;YACxD,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;IAED,wEAAwE;IACxE,KAAK;QACH,IAAI,CAAC,kBAAkB,EAAE;YAAE,OAAM;QACjC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK;YAAE,OAAM;QAClD,KAAK,GAAG,IAAI,CAAA;QACZ,IAAI,CAAC;YACH,CAAC;YAAC,MAAM,CAAC,GAA8C,CAAC,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;QAC3F,CAAC;QAAC,MAAM,CAAC;YACP,mBAAmB;QACrB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MiMo TTS speech synthesis, browser half.
|
|
3
|
+
*
|
|
4
|
+
* Two contributions, both registered through the typed slot system:
|
|
5
|
+
* - `plugins.bundle.config` (keyed by the npm package name): the plugin's
|
|
6
|
+
* configuration card on the Plugins page, mounted on the bundle's detail
|
|
7
|
+
* page — the official seat for a bundle's own configuration;
|
|
8
|
+
* - `conversation.chat.assistant-actions`: the volume button under every
|
|
9
|
+
* finalized assistant message, with its floating player (draggable progress
|
|
10
|
+
* bar) once audio exists.
|
|
11
|
+
*
|
|
12
|
+
* Neither entry owns business state: configuration flows through
|
|
13
|
+
* `ctx.configForms` (`mimo-speak` namespace), synthesis through the Host's
|
|
14
|
+
* `/api/mimo-speak` routes, text from the Conversation binding through `useChat`,
|
|
15
|
+
* and copy through `ctx.locale`.
|
|
16
|
+
* @module dsh-mimo-speak/client
|
|
17
|
+
*/
|
|
18
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
19
|
+
export type { BundleConfigCardProps, SettingsSectionCardProps, SpeakActionInjected, SpeakActionProps, } from './slots.ts';
|
|
20
|
+
/** Required services (cordis fiber inject); remote.credentials stores the API key. */
|
|
21
|
+
export declare const inject: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Mount the speak entry and the Plugins-page configuration card.
|
|
24
|
+
* @param ctx - the browser plugin context.
|
|
25
|
+
*/
|
|
26
|
+
export declare function apply(ctx: ClientContext): void;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MiMo TTS speech synthesis, browser half.
|
|
3
|
+
*
|
|
4
|
+
* Two contributions, both registered through the typed slot system:
|
|
5
|
+
* - `plugins.bundle.config` (keyed by the npm package name): the plugin's
|
|
6
|
+
* configuration card on the Plugins page, mounted on the bundle's detail
|
|
7
|
+
* page — the official seat for a bundle's own configuration;
|
|
8
|
+
* - `conversation.chat.assistant-actions`: the volume button under every
|
|
9
|
+
* finalized assistant message, with its floating player (draggable progress
|
|
10
|
+
* bar) once audio exists.
|
|
11
|
+
*
|
|
12
|
+
* Neither entry owns business state: configuration flows through
|
|
13
|
+
* `ctx.configForms` (`mimo-speak` namespace), synthesis through the Host's
|
|
14
|
+
* `/api/mimo-speak` routes, text from the Conversation binding through `useChat`,
|
|
15
|
+
* and copy through `ctx.locale`.
|
|
16
|
+
* @module dsh-mimo-speak/client
|
|
17
|
+
*/
|
|
18
|
+
import { MIMOSPEAK_NAMESPACE, MIMOSPEAK_PACKAGE_KEY } from "../settings.js";
|
|
19
|
+
import { BundleConfigCard } from "./BundleConfigCard.js";
|
|
20
|
+
import { SettingsSectionCard } from "./SettingsSectionCard.js";
|
|
21
|
+
import { requestSpeech } from "./api.js";
|
|
22
|
+
import { NS, en, zh } from "./locales.js";
|
|
23
|
+
import { SETTINGS_SECTION_ID, SETTINGS_SECTION_ORDER } from "./settings-registration.js";
|
|
24
|
+
import { SpeakAction } from "./SpeakAction.js";
|
|
25
|
+
import { TtsSettingsController } from "./settings-controller.js";
|
|
26
|
+
import { ensureTtsStatus, ttsStatusStore } from "./status.js";
|
|
27
|
+
import { injectStyles } from "./styles.js";
|
|
28
|
+
/** Required services (cordis fiber inject); remote.credentials stores the API key. */
|
|
29
|
+
export const inject = ['slots', 'locale', 'configForms', 'remote', 'remote.credentials'];
|
|
30
|
+
/**
|
|
31
|
+
* Mount the speak entry and the Plugins-page configuration card.
|
|
32
|
+
* @param ctx - the browser plugin context.
|
|
33
|
+
*/
|
|
34
|
+
export function apply(ctx) {
|
|
35
|
+
ctx.effect(() => injectStyles(), 'dsh-mimo-speak: styles');
|
|
36
|
+
ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-mimo-speak: dictionaries');
|
|
37
|
+
const t = ctx.locale.bind(NS);
|
|
38
|
+
// The typed API key stores through the platform's credentials remote — the
|
|
39
|
+
// same host operation the official add-model credential editor writes
|
|
40
|
+
// through — so the literal key never lands in a configuration file.
|
|
41
|
+
const controller = new TtsSettingsController(ctx.configForms.get(MIMOSPEAK_NAMESPACE), async (ref, value) => (await ctx.remote.credentials.set(ref, value)).ok);
|
|
42
|
+
ctx.effect(() => () => { controller.dispose(); }, 'dsh-mimo-speak: settings form');
|
|
43
|
+
// The configuration card edits the plugin's configuration namespace, so it
|
|
44
|
+
// exists only while the Host serves it — a deployment without the plugin
|
|
45
|
+
// shows no trace of it.
|
|
46
|
+
ctx.effect(() => ctx.configForms.whileServed([MIMOSPEAK_NAMESPACE], () => {
|
|
47
|
+
// Keyed by the package name: the Plugins page dispatches
|
|
48
|
+
// `plugins.bundle.config` with `entryKey: pkg.name`.
|
|
49
|
+
const offCard = ctx.slots.inject('plugins.bundle.config', () => ctx.slots.register({
|
|
50
|
+
name: 'plugins.bundle.config',
|
|
51
|
+
key: MIMOSPEAK_PACKAGE_KEY,
|
|
52
|
+
locale: NS,
|
|
53
|
+
inject: () => controller.inject(),
|
|
54
|
+
}, BundleConfigCard));
|
|
55
|
+
return () => { offCard(); };
|
|
56
|
+
}), 'dsh-mimo-speak: plugins-page card');
|
|
57
|
+
// The same form also has a seat in DSH's global Settings panel. It uses its
|
|
58
|
+
// own controller so mounting one surface never discards the other's draft;
|
|
59
|
+
// both are gated on the Host serving the namespace.
|
|
60
|
+
const settingsController = new TtsSettingsController(ctx.configForms.get(MIMOSPEAK_NAMESPACE), async (ref, value) => (await ctx.remote.credentials.set(ref, value)).ok);
|
|
61
|
+
ctx.effect(() => () => { settingsController.dispose(); }, 'dsh-mimo-speak: settings-section form');
|
|
62
|
+
ctx.effect(() => ctx.configForms.whileServed([MIMOSPEAK_NAMESPACE], () => {
|
|
63
|
+
const offSection = ctx.slots.inject('settings.section', () => ctx.slots.register({
|
|
64
|
+
name: 'settings.section',
|
|
65
|
+
id: SETTINGS_SECTION_ID,
|
|
66
|
+
order: SETTINGS_SECTION_ORDER,
|
|
67
|
+
label: () => t('settingsTitle'),
|
|
68
|
+
locale: NS,
|
|
69
|
+
inject: () => settingsController.inject(),
|
|
70
|
+
}, SettingsSectionCard));
|
|
71
|
+
return () => { offSection(); };
|
|
72
|
+
}), 'dsh-mimo-speak: settings section');
|
|
73
|
+
// Automatic read-aloud needs the resolved engine settings before the user
|
|
74
|
+
// ever hovers a speaker, so prime the status mirror once at boot instead of
|
|
75
|
+
// waiting for the first interaction.
|
|
76
|
+
void ensureTtsStatus();
|
|
77
|
+
ctx.slots.inject('conversation.chat.assistant-actions', () => ctx.slots.register({
|
|
78
|
+
name: 'conversation.chat.assistant-actions',
|
|
79
|
+
id: 'mimo-speak',
|
|
80
|
+
order: 20,
|
|
81
|
+
locale: NS,
|
|
82
|
+
inject: () => ({
|
|
83
|
+
hooks: { status: ttsStatusStore() },
|
|
84
|
+
ensureStatus: () => { void ensureTtsStatus(); },
|
|
85
|
+
synthesize: requestSpeech,
|
|
86
|
+
}),
|
|
87
|
+
}, SpeakAction));
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAcH,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAE3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA2B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAM1C,sFAAsF;AACtF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAA;AAExF;;;GAGG;AACH,MAAM,UAAU,KA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kC,CACnC,CAAA;IAED,0EAA0E;IAC1E,4EAA4E;IAC5E,qCAAqC;IACrC,KAAK,eAAe,EAAE,CAAA;IAEtB,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,qCAAqC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC/E,IAAI,EAAE,qCAAqC;QAC3C,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YACb,KAAK,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE;YACnC,YAAY,EAAE,GAAG,EAAE,GAAG,KAAK,eAAe,EAAE,CAAA,CAAC,CAAC;YAC9C,UAAU,EAAE,aAAa;SAC1B,CAAC;KACH,EAAE,WAAW,CAAC,CAAC,CAAA;AAClB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale bundles for the MiMo TTS plugin: the speak entry under each finalized
|
|
3
|
+
* assistant message, its player, and the Plugins-page configuration card.
|
|
4
|
+
* @module dsh-mimo-speak/client/locales
|
|
5
|
+
*/
|
|
6
|
+
/** Dictionary namespace owned by this plugin. */
|
|
7
|
+
export declare const NS = "settings.mimo-speak";
|
|
8
|
+
/** Locale keys this plugin renders. */
|
|
9
|
+
export type MimottsLocaleKey = 'speak' | 'synthesize' | 'play' | 'pause' | 'stop' | 'progress' | 'emptyText' | 'truncated' | 'error.notConfigured' | 'error.badRequest' | 'error.timeout' | 'error.upstream' | 'error.invalidAudio' | 'error.voiceSample' | 'error.generic' | 'audition' | 'auditioning' | 'auditionHint' | 'apiKey' | 'apiKeyHint' | 'apiKeySet' | 'apiKeyUnset' | 'apiKeyRef' | 'apiKeyRefDefault' | 'baseUrl' | 'baseUrlHint' | 'model' | 'modelHint' | 'voice' | 'voiceHint' | 'voiceSamplePath' | 'voiceSamplePathHint' | 'style' | 'styleHint' | 'maxChars' | 'maxCharsHint' | 'chunkChars' | 'chunkCharsHint' | 'timeoutMs' | 'timeoutMsHint' | 'autoRead' | 'autoReadHint' | 'fallbackEngine' | 'fallbackEngineNone' | 'fallbackEngineEdge' | 'fallbackEngineHint' | 'edgeVoice' | 'edgeVoiceHint' | 'readScope' | 'readScopeBrief' | 'readScopeText' | 'readScopeAll' | 'readScopeSmart' | 'readScopeHint' | 'briefPrefix' | 'highlight' | 'highlightHint' | 'muteWhileRecording' | 'muteWhileRecordingHint' | 'voiceInputNote' | 'fallbackUsed' | 'test' | 'testing' | 'testOk' | 'testFailed' | 'engineMimo' | 'engineEdge' | 'sectionConnection' | 'sectionVoice' | 'sectionBehavior' | 'sectionAudition' | 'autoplayHint' | 'progressBar' | 'progressBarHint' | 'overridden' | 'reset' | 'invalidNumber' | 'readOnly' | 'unavailable' | 'save' | 'saving' | 'saveFailed' | 'settingsTitle';
|
|
10
|
+
/** English copy. */
|
|
11
|
+
export declare const en: Record<MimottsLocaleKey, string>;
|
|
12
|
+
/** Simplified Chinese copy. */
|
|
13
|
+
export declare const zh: Record<MimottsLocaleKey, string>;
|
|
14
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
15
|
+
interface LocaleNamespaceMap {
|
|
16
|
+
/** MiMo TTS speak entry, player, and Plugins-page card copy. */
|
|
17
|
+
'settings.mimo-speak': MimottsLocaleKey;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale bundles for the MiMo TTS plugin: the speak entry under each finalized
|
|
3
|
+
* assistant message, its player, and the Plugins-page configuration card.
|
|
4
|
+
* @module dsh-mimo-speak/client/locales
|
|
5
|
+
*/
|
|
6
|
+
/** Dictionary namespace owned by this plugin. */
|
|
7
|
+
export const NS = 'settings.mimo-speak';
|
|
8
|
+
/** English copy. */
|
|
9
|
+
export const en = {
|
|
10
|
+
speak: 'Read aloud',
|
|
11
|
+
synthesize: 'Synthesizing…',
|
|
12
|
+
play: 'Play',
|
|
13
|
+
pause: 'Pause',
|
|
14
|
+
stop: 'Stop reading',
|
|
15
|
+
progress: 'Playback position',
|
|
16
|
+
emptyText: 'This message carries no speakable text.',
|
|
17
|
+
truncated: 'The reply is long; only the opening is spoken.',
|
|
18
|
+
'error.notConfigured': 'Set the MiMo API key on the plugin card on the Plugins page first.',
|
|
19
|
+
'error.badRequest': 'The text could not be spoken as-is.',
|
|
20
|
+
'error.timeout': 'MiMo TTS did not answer in time.',
|
|
21
|
+
'error.upstream': 'MiMo TTS rejected the request.',
|
|
22
|
+
'error.invalidAudio': 'MiMo TTS returned audio that could not be played.',
|
|
23
|
+
'error.voiceSample': 'The voice-clone sample could not be read on the Host.',
|
|
24
|
+
'error.generic': 'Speech synthesis failed.',
|
|
25
|
+
audition: 'Play sample',
|
|
26
|
+
auditioning: 'Preparing sample…',
|
|
27
|
+
auditionHint: 'Speaks a sample sentence with the style and voice currently on this card (saved or not).',
|
|
28
|
+
apiKey: 'API Key',
|
|
29
|
+
apiKeyHint: 'Paste the MiMo API key here. It is stored in the host credentials store and never rides a page response; clearing the field and saving changes nothing.',
|
|
30
|
+
apiKeyRef: 'Credential reference:',
|
|
31
|
+
apiKeyRefDefault: 'Credential reference: MIMO_API_KEY (default).',
|
|
32
|
+
apiKeySet: 'A key is configured.',
|
|
33
|
+
apiKeyUnset: 'No key is configured.',
|
|
34
|
+
baseUrl: 'Endpoint base',
|
|
35
|
+
baseUrlHint: 'Leave blank to use https://api.xiaomimimo.com/v1; /chat/completions is appended.',
|
|
36
|
+
model: 'Model',
|
|
37
|
+
modelHint: 'Leave blank to use mimo-v2.5-tts.',
|
|
38
|
+
voice: 'Preset voice',
|
|
39
|
+
voiceHint: 'Pick a preset voice; ignored while a voice-clone sample is set.',
|
|
40
|
+
voiceSamplePath: 'Voice-clone sample (Host path)',
|
|
41
|
+
voiceSamplePathHint: 'A 5–15 s WAV (24 kHz / 16-bit / mono) on the Host. Leave blank to speak with the preset voice.',
|
|
42
|
+
style: 'Default speaking style',
|
|
43
|
+
styleHint: 'A natural-language phrase such as "开心", "语速慢", or "东北话". Leave blank to let the model judge for itself (recommended).',
|
|
44
|
+
maxChars: 'Max characters per request',
|
|
45
|
+
maxCharsHint: 'Longer replies are spoken from the beginning up to this budget, cut at a sentence boundary.',
|
|
46
|
+
chunkChars: 'Characters per playback chunk',
|
|
47
|
+
chunkCharsHint: 'Replies are split into chunks around this size and played back-to-back while the next chunk synthesizes, so the first sound starts in seconds. Smaller = faster start, more requests.',
|
|
48
|
+
timeoutMs: 'Request timeout (ms)',
|
|
49
|
+
timeoutMsHint: 'Upper bound on one synthesis round-trip to MiMo TTS.',
|
|
50
|
+
autoRead: 'Automatic read-aloud',
|
|
51
|
+
autoReadHint: 'Speak each newly finished assistant reply with the configured voice and style. Keep the conversation open; if the browser blocks autoplay, tap the speaker on the message.',
|
|
52
|
+
fallbackEngine: 'Fallback engine',
|
|
53
|
+
fallbackEngineNone: 'Off — MiMo only',
|
|
54
|
+
fallbackEngineEdge: 'Edge TTS (keyless)',
|
|
55
|
+
fallbackEngineHint: 'When MiMo fails or is unreachable, Edge TTS speaks the reply instead. Edge is keyless but uses a different voice.',
|
|
56
|
+
edgeVoice: 'Edge voice',
|
|
57
|
+
edgeVoiceHint: 'Any Edge neural voice, e.g. zh-CN-XiaoxiaoNeural (recommended) or zh-CN-YunxiNeural.',
|
|
58
|
+
readScope: 'Read scope',
|
|
59
|
+
readScopeBrief: 'Brief — summarize, then read',
|
|
60
|
+
briefPrefix: 'Brief summary. ',
|
|
61
|
+
readScopeText: 'Prose only — skip code and tables',
|
|
62
|
+
readScopeAll: 'Read everything — including code',
|
|
63
|
+
readScopeSmart: 'Smart — prose plus short code snippets',
|
|
64
|
+
readScopeHint: 'Which parts of a reply the speaker reads aloud. Brief first asks the model already configured in this conversation to condense the reply into one or two spoken sentences (about 80 characters), then reads only that summary — code and tables never reach it. When no model can answer, it falls back to the offline rule: the first sentence of every block, capped at 6 sentences / 260 characters. Smart skips long code listings but reads short snippets.',
|
|
65
|
+
highlight: 'Sentence highlight',
|
|
66
|
+
highlightHint: 'Tint the sentence being read inside the message. Streaming read-aloud only.',
|
|
67
|
+
fallbackUsed: 'MiMo did not answer — this read uses the Edge fallback voice.',
|
|
68
|
+
muteWhileRecording: 'Stop when the microphone opens',
|
|
69
|
+
muteWhileRecordingHint: 'Reading stops the moment a recorder starts, so the microphone never captures the assistant reading its own reply. Pairs with the official voice-input bundle.',
|
|
70
|
+
voiceInputNote: 'Voice input itself is the official @deepseek-ai/dsh-experimental-voice-input-bundle — install it from Plugins; this plugin only handles playback.',
|
|
71
|
+
test: 'Test connection',
|
|
72
|
+
testing: 'Testing…',
|
|
73
|
+
testOk: 'OK — {engine} answered in {ms} ms',
|
|
74
|
+
testFailed: 'Connection failed',
|
|
75
|
+
engineMimo: 'MiMo',
|
|
76
|
+
engineEdge: 'Edge',
|
|
77
|
+
sectionConnection: 'Connection',
|
|
78
|
+
sectionVoice: 'Voice',
|
|
79
|
+
sectionBehavior: 'Read-aloud behaviour',
|
|
80
|
+
sectionAudition: 'Sample and connection test',
|
|
81
|
+
autoplayHint: 'Autoplay was blocked — press play to start.',
|
|
82
|
+
progressBar: 'Progress bar',
|
|
83
|
+
progressBarHint: 'Show the scrub track in the floating player. Off keeps only play/pause.',
|
|
84
|
+
overridden: 'Overridden',
|
|
85
|
+
reset: 'Reset to default',
|
|
86
|
+
invalidNumber: 'Enter a number, or leave blank to use the default.',
|
|
87
|
+
readOnly: 'This deployment stores settings read-only.',
|
|
88
|
+
unavailable: 'This plugin is not loaded, so it cannot be configured right now.',
|
|
89
|
+
save: 'Save',
|
|
90
|
+
saving: 'Saving…',
|
|
91
|
+
saveFailed: 'The deployment did not accept these values; they were left for you to correct.',
|
|
92
|
+
settingsTitle: 'MiMo read-aloud',
|
|
93
|
+
};
|
|
94
|
+
/** Simplified Chinese copy. */
|
|
95
|
+
export const zh = {
|
|
96
|
+
speak: '朗读',
|
|
97
|
+
synthesize: '正在合成…',
|
|
98
|
+
play: '播放',
|
|
99
|
+
pause: '暂停',
|
|
100
|
+
stop: '停止朗读',
|
|
101
|
+
progress: '播放进度',
|
|
102
|
+
emptyText: '这条消息没有可朗读的文本。',
|
|
103
|
+
truncated: '回复较长,只朗读开头部分。',
|
|
104
|
+
'error.notConfigured': '请先在「插件」页的本插件卡片里配置 MiMo API Key。',
|
|
105
|
+
'error.badRequest': '这段文本无法直接朗读。',
|
|
106
|
+
'error.timeout': 'MiMo TTS 响应超时。',
|
|
107
|
+
'error.upstream': 'MiMo TTS 拒绝了这次请求。',
|
|
108
|
+
'error.invalidAudio': 'MiMo TTS 返回的音频无法播放。',
|
|
109
|
+
'error.voiceSample': '宿主上的音色克隆样本无法读取。',
|
|
110
|
+
'error.generic': '语音合成失败。',
|
|
111
|
+
audition: '试听',
|
|
112
|
+
auditioning: '正在准备试听…',
|
|
113
|
+
auditionHint: '用卡片当前的风格与音色(含未保存的修改)朗读一句示例。',
|
|
114
|
+
apiKey: 'API Key',
|
|
115
|
+
apiKeyHint: '在这里粘贴 MiMo API Key。密钥只存进宿主凭据存储,不会回传到页面;清空后保存不会改动已存的密钥。',
|
|
116
|
+
apiKeyRef: '凭据引用名:',
|
|
117
|
+
apiKeyRefDefault: '凭据引用名:MIMO_API_KEY(默认)。',
|
|
118
|
+
apiKeySet: '已配置密钥。',
|
|
119
|
+
apiKeyUnset: '未配置密钥。',
|
|
120
|
+
baseUrl: '接口地址',
|
|
121
|
+
baseUrlHint: '留空使用 https://api.xiaomimimo.com/v1,自动追加 /chat/completions。',
|
|
122
|
+
model: '模型',
|
|
123
|
+
modelHint: '留空使用 mimo-v2.5-tts。',
|
|
124
|
+
voice: '预置音色',
|
|
125
|
+
voiceHint: '从预置音色中选择;配置了克隆样本时忽略此项。',
|
|
126
|
+
voiceSamplePath: '音色克隆样本(宿主路径)',
|
|
127
|
+
voiceSamplePathHint: '宿主上的 5–15 秒 WAV(24kHz/16bit/单声道)。留空则使用预置音色。',
|
|
128
|
+
style: '默认风格',
|
|
129
|
+
styleHint: '自然语言描述,例如「开心」「语速慢」「东北话」。留空由模型自行判断(推荐)。',
|
|
130
|
+
maxChars: '单次最大字符数',
|
|
131
|
+
maxCharsHint: '超出预算的回复只朗读开头,并在句末截断。',
|
|
132
|
+
chunkChars: '每块字符数',
|
|
133
|
+
chunkCharsHint: '回复按这个大小切成块、块间连续播放,同时后台合成下一块,所以声音几秒内就起。越小起声越快,但请求次数越多。',
|
|
134
|
+
timeoutMs: '请求超时(毫秒)',
|
|
135
|
+
timeoutMsHint: '单次合成请求的最长等待时间。',
|
|
136
|
+
autoRead: '自动朗读',
|
|
137
|
+
autoReadHint: '助手每条新回复完成后,用配置的音色与风格自动朗读。需停留在对话页;若浏览器拦截自动播放,点消息上的喇叭即可。',
|
|
138
|
+
fallbackEngine: '兜底引擎',
|
|
139
|
+
fallbackEngineNone: '关闭 — 仅用 MiMo',
|
|
140
|
+
fallbackEngineEdge: 'Edge TTS(免 Key)',
|
|
141
|
+
fallbackEngineHint: 'MiMo 失败或不可达时,改用 Edge TTS 朗读。Edge 免 Key,但音色不同(默认晓晓)。',
|
|
142
|
+
edgeVoice: 'Edge 音色',
|
|
143
|
+
edgeVoiceHint: '任意 Edge 神经语音,例如 zh-CN-XiaoxiaoNeural(推荐)或 zh-CN-YunxiNeural。',
|
|
144
|
+
readScope: '朗读范围',
|
|
145
|
+
readScopeBrief: '简要播报 — 先摘要再念',
|
|
146
|
+
briefPrefix: '简要播报。',
|
|
147
|
+
readScopeText: '只读正文 — 跳过代码和表格',
|
|
148
|
+
readScopeAll: '全部朗读 — 含代码',
|
|
149
|
+
readScopeSmart: '智能朗读 — 正文 + 短代码',
|
|
150
|
+
readScopeHint: '决定朗读回复的哪些部分。简要播报会先把回复交给当前对话所用的模型,浓缩成一两句口播摘要(约 80 字)再朗读,代码和表格不会进入摘要;模型不可用时退回规则摘要:每段只取第一句,上限 6 句 / 260 字。智能模式跳过长代码列表,只读短片段。',
|
|
151
|
+
highlight: '句子高亮',
|
|
152
|
+
highlightHint: '朗读时在消息正文里高亮当前句子(仅流式朗读路径生效)。',
|
|
153
|
+
fallbackUsed: 'MiMo 这次没响应,已改用 Edge 兜底音色朗读。',
|
|
154
|
+
muteWhileRecording: '开麦时停止朗读',
|
|
155
|
+
muteWhileRecordingHint: '麦克风一打开就停止朗读,避免把自己的播报声录进去变成新的输入。配合官方语音输入插件使用。',
|
|
156
|
+
voiceInputNote: '语音输入由官方 @deepseek-ai/dsh-experimental-voice-input-bundle 提供,在插件页安装即可;本插件只管播放。',
|
|
157
|
+
test: '测试连接',
|
|
158
|
+
testing: '测试中…',
|
|
159
|
+
testOk: '正常 — {engine} 用时 {ms} 毫秒',
|
|
160
|
+
testFailed: '连接失败',
|
|
161
|
+
engineMimo: 'MiMo',
|
|
162
|
+
engineEdge: 'Edge',
|
|
163
|
+
sectionConnection: '连接',
|
|
164
|
+
sectionVoice: '声音',
|
|
165
|
+
sectionBehavior: '朗读行为',
|
|
166
|
+
sectionAudition: '试听与测试',
|
|
167
|
+
autoplayHint: '浏览器拦截了自动播放,点「播放」开始。',
|
|
168
|
+
progressBar: '显示进度条',
|
|
169
|
+
progressBarHint: '在悬浮播放器里显示可拖动的进度条;关闭后只保留播放/暂停按钮。',
|
|
170
|
+
overridden: '已覆盖',
|
|
171
|
+
reset: '恢复默认',
|
|
172
|
+
invalidNumber: '请填数字;留空表示使用默认值。',
|
|
173
|
+
readOnly: '本部署的设置为只读。',
|
|
174
|
+
unavailable: '该插件当前未加载,暂时无法配置。',
|
|
175
|
+
save: '保存',
|
|
176
|
+
saving: '保存中…',
|
|
177
|
+
saveFailed: '本部署没有接受这些值,已保留供你修改。',
|
|
178
|
+
settingsTitle: 'MiMo 朗读',
|
|
179
|
+
};
|
|
180
|
+
//# sourceMappingURL=locales.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales.js","sourceRoot":"","sources":["../../../src/client/locales.ts"],"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Ac,EAAE,cAAc;IAC9B,WAAW,EAAE,OAAO;IACpB,aAAa,EAAE,gBAAgB;IAC/B,YAAY,EAAE,YAAY;IAC1B,cAAc,EAAE,iBAAiB;IACjC,aAAa,EAAE,2HAA2H;IAC1I,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,6BAA6B;IAC5C,YAAY,EAAE,6BAA6B;IAC3C,kBAAkB,EAAE,SAAS;IAC7B,sBAAsB,EAAE,8CAA8C;IACtE,cAAc,EAAE,+EAA+E;IAC/F,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,0BAA0B;IAClC,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;IAClB,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,MAAM;IACvB,eAAe,EAAE,OAAO;IACxB,YAAY,EAAE,qBAAqB;IACnC,WAAW,EAAE,OAAO;IACpB,eAAe,EAAE,iCAAiC;IAClD,UAAU,EAAE,KAAK;IACjB,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,iBAAiB;IAChC,QAAQ,EAAE,YAAY;IACtB,WAAW,EAAE,kBAAkB;IAC/B,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,qBAAqB;IACjC,aAAa,EAAE,SAAS;CACzB,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visibility rule for the speak action's floating player panel.
|
|
3
|
+
*
|
|
4
|
+
* The panel exists only to host the optional progress bar. With the bar off the
|
|
5
|
+
* speaker button is the whole control, so the panel — and every note it would
|
|
6
|
+
* otherwise carry — stays out of the message row.
|
|
7
|
+
* @module dsh-mimo-speak/client/panel-visibility
|
|
8
|
+
*/
|
|
9
|
+
/** Inputs that decide whether the floating player panel may render. */
|
|
10
|
+
export interface PlayerPanelState {
|
|
11
|
+
/** Whether the user enabled the seekable progress bar. */
|
|
12
|
+
progressBar: boolean;
|
|
13
|
+
/** Whether the reader has opened the panel for this entry. */
|
|
14
|
+
panelOpen: boolean;
|
|
15
|
+
/** Whether a player holds audio ready to play. */
|
|
16
|
+
hasAudio: boolean;
|
|
17
|
+
/** Whether synthesis is still in flight (the panel would show a shimmer). */
|
|
18
|
+
loading: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @param state - the panel's inputs.
|
|
22
|
+
* @returns whether the panel may render beside the speaker button.
|
|
23
|
+
*/
|
|
24
|
+
export declare function playerPanelVisible(state: PlayerPanelState): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visibility rule for the speak action's floating player panel.
|
|
3
|
+
*
|
|
4
|
+
* The panel exists only to host the optional progress bar. With the bar off the
|
|
5
|
+
* speaker button is the whole control, so the panel — and every note it would
|
|
6
|
+
* otherwise carry — stays out of the message row.
|
|
7
|
+
* @module dsh-mimo-speak/client/panel-visibility
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @param state - the panel's inputs.
|
|
11
|
+
* @returns whether the panel may render beside the speaker button.
|
|
12
|
+
*/
|
|
13
|
+
export function playerPanelVisible(state) {
|
|
14
|
+
return state.progressBar && state.panelOpen && (state.hasAudio || state.loading);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=panel-visibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel-visibility.js","sourceRoot":"","sources":["../../../src/client/panel-visibility.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAcH;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAuB;IACxD,OAAO,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;AAClF,CAAC"}
|