ssml-builder-js 2.8.1 → 2.10.0
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/README.md +88 -12
- package/dist/{chunk-MWSDFGXW.mjs → chunk-BYIZQL2W.mjs} +854 -9
- package/dist/chunk-BYIZQL2W.mjs.map +1 -0
- package/dist/{chunk-VCDMKVVT.mjs → chunk-GW6CKHXF.mjs} +539 -25
- package/dist/chunk-GW6CKHXF.mjs.map +1 -0
- package/dist/core.d.mts +98 -3
- package/dist/core.d.ts +98 -3
- package/dist/core.js +544 -25
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +13 -3
- package/dist/elements.d.mts +10 -1
- package/dist/elements.d.ts +10 -1
- package/dist/elements.js +1140 -13
- package/dist/elements.js.map +1 -1
- package/dist/elements.mjs +292 -8
- package/dist/elements.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +544 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -3
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +47 -3
- package/dist/react.d.ts +47 -3
- package/dist/react.js +1095 -19
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +237 -5
- package/dist/react.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-MWSDFGXW.mjs.map +0 -1
- package/dist/chunk-VCDMKVVT.mjs.map +0 -1
package/dist/core.d.ts
CHANGED
|
@@ -103,11 +103,47 @@ interface MsttsAudioDurationElement extends SsmlElementBase {
|
|
|
103
103
|
type: "mstts:audioduration";
|
|
104
104
|
value?: SsmlAttributeValue;
|
|
105
105
|
}
|
|
106
|
+
interface SsmlDialogNode extends SsmlElementBase {
|
|
107
|
+
type: "mstts:dialog";
|
|
108
|
+
}
|
|
109
|
+
interface SsmlTurnNode extends SsmlElementBase {
|
|
110
|
+
type: "mstts:turn";
|
|
111
|
+
voice?: string;
|
|
112
|
+
speaker?: string;
|
|
113
|
+
}
|
|
114
|
+
interface SsmlBackgroundAudioNode extends SsmlElementBase {
|
|
115
|
+
type: "mstts:backgroundaudio";
|
|
116
|
+
src?: string;
|
|
117
|
+
volume?: SsmlAttributeValue;
|
|
118
|
+
fadeIn?: SsmlAttributeValue;
|
|
119
|
+
fadeOut?: SsmlAttributeValue;
|
|
120
|
+
/** XML spelling aliases retained for ergonomic object construction. */
|
|
121
|
+
fadein?: SsmlAttributeValue;
|
|
122
|
+
fadeout?: SsmlAttributeValue;
|
|
123
|
+
}
|
|
124
|
+
interface MsttsTtsEmbeddingElement extends SsmlElementBase {
|
|
125
|
+
type: "mstts:ttsembedding";
|
|
126
|
+
speakerProfileId?: string;
|
|
127
|
+
}
|
|
128
|
+
interface MsttsEmbeddingElement extends SsmlElementBase {
|
|
129
|
+
type: "mstts:embedding";
|
|
130
|
+
id?: string;
|
|
131
|
+
speakerProfileId?: string;
|
|
132
|
+
}
|
|
133
|
+
interface MsttsVoiceConversionElement extends SsmlElementBase {
|
|
134
|
+
type: "mstts:voiceconversion";
|
|
135
|
+
url?: string;
|
|
136
|
+
profile?: string;
|
|
137
|
+
speakerProfileId?: string;
|
|
138
|
+
}
|
|
139
|
+
type SsmlTtsEmbeddingNode = MsttsTtsEmbeddingElement;
|
|
140
|
+
type SsmlEmbeddingNode = MsttsEmbeddingElement;
|
|
141
|
+
type SsmlVoiceConversionNode = MsttsVoiceConversionElement;
|
|
106
142
|
interface CustomElement extends SsmlElementBase {
|
|
107
143
|
type: "custom" | "element";
|
|
108
144
|
name: string;
|
|
109
145
|
}
|
|
110
|
-
type SsmlElement = VoiceElement | ProsodyElement | BreakElement | ExpressAsElement | SayAsElement | PhonemeElement | EmphasisElement | AudioElement | SubElement | LangElement | MarkElement | BookmarkElement | LexiconElement | ParagraphElement | SentenceElement | WordElement | MsttsSilenceElement | MsttsVisemeElement | MsttsAudioDurationElement | CustomElement;
|
|
146
|
+
type SsmlElement = VoiceElement | ProsodyElement | BreakElement | ExpressAsElement | SayAsElement | PhonemeElement | EmphasisElement | AudioElement | SubElement | LangElement | MarkElement | BookmarkElement | LexiconElement | ParagraphElement | SentenceElement | WordElement | MsttsSilenceElement | MsttsVisemeElement | MsttsAudioDurationElement | SsmlDialogNode | SsmlTurnNode | SsmlBackgroundAudioNode | MsttsTtsEmbeddingElement | MsttsEmbeddingElement | MsttsVoiceConversionElement | CustomElement;
|
|
111
147
|
interface SsmlDocument {
|
|
112
148
|
type?: "speak";
|
|
113
149
|
version: string;
|
|
@@ -175,9 +211,51 @@ interface MapSsmlTextNodesOptions {
|
|
|
175
211
|
declare function extractSsmlText(ssml: string): string[];
|
|
176
212
|
declare function mapSsmlTextNodes(ssml: string, transform: (text: string, context: SsmlTextNodeContext) => string | Promise<string>, options?: MapSsmlTextNodesOptions): Promise<string>;
|
|
177
213
|
|
|
214
|
+
interface ExtractSsmlTranslatableTextOptions {
|
|
215
|
+
/** Element names whose descendants are not translation targets. */
|
|
216
|
+
skipTags?: readonly string[];
|
|
217
|
+
/** Include indentation and whitespace-only text nodes. Defaults to false. */
|
|
218
|
+
includeWhitespace?: boolean;
|
|
219
|
+
/** Further restrict text nodes after the skip-tag check. */
|
|
220
|
+
filter?: (context: SsmlTextNodeContext) => boolean;
|
|
221
|
+
}
|
|
222
|
+
interface FromPlainTextToSsmlOptions {
|
|
223
|
+
version?: string;
|
|
224
|
+
lang?: string;
|
|
225
|
+
/** Alias for lang, useful when options come from an application form. */
|
|
226
|
+
language?: string;
|
|
227
|
+
/** Wrap generated paragraphs in a voice element. */
|
|
228
|
+
voice?: string;
|
|
229
|
+
/** Alias for voice. */
|
|
230
|
+
voiceName?: string;
|
|
231
|
+
/** Generate sentence elements inside paragraphs. Defaults to true. */
|
|
232
|
+
includeSentences?: boolean;
|
|
233
|
+
/** Alias for includeSentences. */
|
|
234
|
+
splitSentences?: boolean;
|
|
235
|
+
}
|
|
236
|
+
interface SsmlStructureMismatch {
|
|
237
|
+
kind: "element" | "attribute" | "parse";
|
|
238
|
+
path: string;
|
|
239
|
+
original?: string;
|
|
240
|
+
translated?: string;
|
|
241
|
+
message: string;
|
|
242
|
+
}
|
|
243
|
+
interface SsmlStructureIntegrityResult {
|
|
244
|
+
isValid: boolean;
|
|
245
|
+
/** Alias for isValid for callers that prefer a shorter result property. */
|
|
246
|
+
valid: boolean;
|
|
247
|
+
errors: string[];
|
|
248
|
+
mismatches: SsmlStructureMismatch[];
|
|
249
|
+
/** Element or attribute names involved in each mismatch. */
|
|
250
|
+
mismatchedTags: string[];
|
|
251
|
+
}
|
|
252
|
+
declare function extractSsmlTranslatableText(ssml: string, options?: ExtractSsmlTranslatableTextOptions): string[];
|
|
253
|
+
declare function fromPlainTextToSsml(text: string, options?: FromPlainTextToSsmlOptions): string;
|
|
254
|
+
declare function validateSsmlStructureIntegrity(originalSsml: string, translatedSsml: string): SsmlStructureIntegrityResult;
|
|
255
|
+
|
|
178
256
|
type SsmlDiagnosticSeverity = "error" | "warning";
|
|
179
257
|
type SsmlDiagnosticSource = "ssml-static-validator";
|
|
180
|
-
type AzureDiagnosticCode = "azure-unknown-voice" | "azure-unsupported-style" | "azure-locale-mismatch";
|
|
258
|
+
type AzureDiagnosticCode = "azure-unknown-voice" | "azure-unsupported-style" | "azure-locale-mismatch" | "azure-unsupported-tag-for-voice" | "azure-unsupported-model-for-voice";
|
|
181
259
|
interface SsmlDiagnostic {
|
|
182
260
|
code?: AzureDiagnosticCode;
|
|
183
261
|
line: number;
|
|
@@ -191,6 +269,9 @@ interface AzureVoiceDefinition {
|
|
|
191
269
|
locale: string;
|
|
192
270
|
secondaryLocales?: readonly string[];
|
|
193
271
|
styles?: readonly string[];
|
|
272
|
+
supportedTags?: readonly string[];
|
|
273
|
+
unsupportedTags?: readonly string[];
|
|
274
|
+
models?: readonly string[];
|
|
194
275
|
}
|
|
195
276
|
/** Alias retained for consumers that prefer the metadata terminology. */
|
|
196
277
|
interface AzureVoiceMetadata extends AzureVoiceDefinition {
|
|
@@ -203,6 +284,8 @@ interface AzureValidationOptions {
|
|
|
203
284
|
customVoiceDefinitions?: readonly AzureVoiceDefinition[];
|
|
204
285
|
languageAliases?: Record<string, string | readonly string[]>;
|
|
205
286
|
maxLength?: number;
|
|
287
|
+
/** Optional model identifier used to validate a voice's model compatibility. */
|
|
288
|
+
model?: string;
|
|
206
289
|
normalizeLanguage?: (lang: string) => string;
|
|
207
290
|
unknownVoicePolicy?: "error" | "warn" | "ignore";
|
|
208
291
|
unsupportedStylePolicy?: "error" | "warn" | "ignore";
|
|
@@ -221,4 +304,16 @@ declare function normalizeAzureLanguage(language: string, options?: AzureLanguag
|
|
|
221
304
|
declare function areAzureLanguagesEquivalent(first: string, second: string, options?: AzureLanguageNormalizationOptions): boolean;
|
|
222
305
|
declare function validateAzureSsml(ssml: string, options?: AzureValidationOptions): SsmlDiagnostic[];
|
|
223
306
|
|
|
224
|
-
|
|
307
|
+
interface AzureVoiceCatalogMetadata {
|
|
308
|
+
apiVersion: string;
|
|
309
|
+
generatedAt: string;
|
|
310
|
+
regions: readonly string[];
|
|
311
|
+
voiceCount: number;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** Returns metadata for the built-in Azure voice catalog snapshot. */
|
|
315
|
+
declare function getAzureVoiceCatalogMetadata(): AzureVoiceCatalogMetadata;
|
|
316
|
+
/** Alias for consumers that refer to the bundled catalog as the built-in catalog. */
|
|
317
|
+
declare const getBuiltInVoiceCatalogMetadata: typeof getAzureVoiceCatalogMetadata;
|
|
318
|
+
|
|
319
|
+
export { type AudioElement, type AzureDiagnosticCode, type AzureLanguageNormalizationOptions, type AzureSsmlValidationOptions, type AzureValidationOptions, type AzureVoiceCatalogMetadata, type AzureVoiceDefinition, type AzureVoiceMetadata, type BookmarkElement, type BreakElement, type BuildPartialSsmlOptions, type CustomElement, type EmphasisElement, type ExpressAsElement, type ExtractSsmlTranslatableTextOptions, type FromPlainTextToSsmlOptions, type LangElement, type LexiconElement, type MapSsmlTextNodesOptions, type MarkElement, type MsttsAudioDurationElement, type MsttsEmbeddingElement, type MsttsSilenceElement, type MsttsTtsEmbeddingElement, type MsttsVisemeElement, type MsttsVoiceConversionElement, type NamedElement, type ParagraphElement, type PhonemeElement, type ProsodyElement, type SayAsElement, type SentenceElement, type SsmlAttributeValue, type SsmlAttributes, type SsmlBackgroundAudioNode, type SsmlBreakElement, type SsmlDiagnostic, type SsmlDiagnosticSeverity, type SsmlDiagnosticSource, type SsmlDialogNode, type SsmlDocument, type SsmlElement, type SsmlElementBase, type SsmlEmbeddingNode, type SsmlExpressAsElement, type SsmlNode, type SsmlPartialContext, type SsmlPartialProsody, type SsmlPartialVoice, type SsmlPhonemeElement, type SsmlProsodyElement, type SsmlSayAsElement, type SsmlStructureIntegrityResult, type SsmlStructureMismatch, type SsmlText, type SsmlTextNodeContext, type SsmlTtsEmbeddingNode, type SsmlTurnNode, type SsmlValidationError, type SsmlVoiceConversionNode, type SsmlVoiceElement, type SubElement, type VoiceElement, type WordElement, areAzureLanguagesEquivalent, buildPartialSsml, buildSsml, extractSsmlText, extractSsmlTranslatableText, fromPlainTextToSsml, getAzureVoiceCatalogMetadata, getBuiltInVoiceCatalogMetadata, isValidAzureAudioDuration, mapSsmlTextNodes, normalizeAzureLanguage, parseSsml, validateAzureSsml, validateSsml, validateSsmlStructureIntegrity };
|