ssml-builder-js 2.14.0 → 2.15.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 +6 -4
- package/dist/{chunk-UZSCXPC5.mjs → chunk-BDY2Q2JL.mjs} +2 -2
- package/dist/{chunk-AQ55MOPU.mjs → chunk-FXUM45ZY.mjs} +305 -173
- package/dist/chunk-FXUM45ZY.mjs.map +1 -0
- package/dist/{chunk-QFIBPCO4.mjs → chunk-WXFLUCLR.mjs} +164 -17
- package/dist/chunk-WXFLUCLR.mjs.map +1 -0
- package/dist/core.d.mts +48 -17
- package/dist/core.d.ts +48 -17
- package/dist/core.js +303 -170
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +3 -1
- package/dist/elements.js +38 -16
- package/dist/elements.js.map +1 -1
- package/dist/elements.mjs +2 -2
- package/dist/{index.d-CUXRwSw0.d.mts → index.d-8BvkB9gz.d.mts} +22 -2
- package/dist/{index.d-CUXRwSw0.d.ts → index.d-8BvkB9gz.d.ts} +22 -2
- package/dist/index.d.mts +114 -18
- package/dist/index.d.ts +114 -18
- package/dist/index.js +1783 -1281
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +307 -86
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +11 -2
- package/dist/react.d.ts +11 -2
- package/dist/react.js +115 -28
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +79 -14
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-AQ55MOPU.mjs.map +0 -1
- package/dist/chunk-QFIBPCO4.mjs.map +0 -1
- /package/dist/{chunk-UZSCXPC5.mjs.map → chunk-BDY2Q2JL.mjs.map} +0 -0
package/dist/core.d.ts
CHANGED
|
@@ -188,6 +188,45 @@ interface BuildPartialSsmlOptions extends SsmlPartialContext {
|
|
|
188
188
|
declare function buildPartialSsml(text: string, context?: SsmlPartialContext): string;
|
|
189
189
|
declare function buildPartialSsml(options: BuildPartialSsmlOptions): string;
|
|
190
190
|
|
|
191
|
+
interface SsmlTextNodeContext {
|
|
192
|
+
parentTag: string;
|
|
193
|
+
parentAttributes: Record<string, string>;
|
|
194
|
+
ancestorTags: string[];
|
|
195
|
+
path: string[];
|
|
196
|
+
}
|
|
197
|
+
interface SsmlSourceTextSegment {
|
|
198
|
+
text: string;
|
|
199
|
+
range: {
|
|
200
|
+
start: number;
|
|
201
|
+
end: number;
|
|
202
|
+
};
|
|
203
|
+
sourceNodePath: string[];
|
|
204
|
+
}
|
|
205
|
+
interface SsmlSourceMarker {
|
|
206
|
+
kind: "mark" | "bookmark";
|
|
207
|
+
name: string;
|
|
208
|
+
originalTextRange: {
|
|
209
|
+
start: number;
|
|
210
|
+
end: number;
|
|
211
|
+
};
|
|
212
|
+
sourceNodePath: string[];
|
|
213
|
+
}
|
|
214
|
+
interface SsmlSourceMap {
|
|
215
|
+
text: string;
|
|
216
|
+
segments: SsmlSourceTextSegment[];
|
|
217
|
+
markers: SsmlSourceMarker[];
|
|
218
|
+
}
|
|
219
|
+
interface MapSsmlTextNodesOptions {
|
|
220
|
+
/** Element names whose text should not be passed to the transform. */
|
|
221
|
+
skipTags?: readonly string[];
|
|
222
|
+
/** Decides whether an individual text node should be passed to the transform. */
|
|
223
|
+
filter?: (context: SsmlTextNodeContext) => boolean;
|
|
224
|
+
}
|
|
225
|
+
/** Returns decoded source text segments and marker locations with indexed SSML paths. */
|
|
226
|
+
declare function getSsmlSourceMap(ssml: string): SsmlSourceMap;
|
|
227
|
+
declare function extractSsmlText(ssml: string): string[];
|
|
228
|
+
declare function mapSsmlTextNodes(ssml: string, transform: (text: string, context: SsmlTextNodeContext) => string | Promise<string>, options?: MapSsmlTextNodesOptions): Promise<string>;
|
|
229
|
+
|
|
191
230
|
interface SsmlTextRange {
|
|
192
231
|
start: number;
|
|
193
232
|
end: number;
|
|
@@ -206,6 +245,10 @@ interface SsmlChunk {
|
|
|
206
245
|
hasBackgroundAudio: boolean;
|
|
207
246
|
/** Best-effort path to the first source element represented by this chunk. */
|
|
208
247
|
sourceNodePath?: string[];
|
|
248
|
+
/** Exact source segments represented by this chunk, used for event mapping. */
|
|
249
|
+
sourceTextSegments?: SsmlSourceTextSegment[];
|
|
250
|
+
/** Exact marker locations represented by this chunk, used for bookmark mapping. */
|
|
251
|
+
sourceMarkers?: SsmlSourceMarker[];
|
|
209
252
|
}
|
|
210
253
|
interface SplitSsmlOptions {
|
|
211
254
|
maxLength?: number;
|
|
@@ -228,21 +271,6 @@ interface SsmlValidationError {
|
|
|
228
271
|
}
|
|
229
272
|
declare function validateSsml(xmlString: string): SsmlValidationError | null;
|
|
230
273
|
|
|
231
|
-
interface SsmlTextNodeContext {
|
|
232
|
-
parentTag: string;
|
|
233
|
-
parentAttributes: Record<string, string>;
|
|
234
|
-
ancestorTags: string[];
|
|
235
|
-
path: string[];
|
|
236
|
-
}
|
|
237
|
-
interface MapSsmlTextNodesOptions {
|
|
238
|
-
/** Element names whose text should not be passed to the transform. */
|
|
239
|
-
skipTags?: readonly string[];
|
|
240
|
-
/** Decides whether an individual text node should be passed to the transform. */
|
|
241
|
-
filter?: (context: SsmlTextNodeContext) => boolean;
|
|
242
|
-
}
|
|
243
|
-
declare function extractSsmlText(ssml: string): string[];
|
|
244
|
-
declare function mapSsmlTextNodes(ssml: string, transform: (text: string, context: SsmlTextNodeContext) => string | Promise<string>, options?: MapSsmlTextNodesOptions): Promise<string>;
|
|
245
|
-
|
|
246
274
|
interface ExtractSsmlTranslatableTextOptions {
|
|
247
275
|
/** Element names whose descendants are not translation targets. */
|
|
248
276
|
skipTags?: readonly string[];
|
|
@@ -318,6 +346,8 @@ interface AzureValidationOptions {
|
|
|
318
346
|
customVoiceDefinitions?: readonly AzureVoiceDefinition[];
|
|
319
347
|
/** Host-side validation hook for URL-bearing SSML attributes. */
|
|
320
348
|
urlValidator?: AzureUrlValidator;
|
|
349
|
+
/** Source path associated with a chunk being validated. */
|
|
350
|
+
sourceNodePath?: readonly string[];
|
|
321
351
|
/** Alias for urlValidator retained for applications that use the longer name. */
|
|
322
352
|
customUrlValidator?: AzureUrlValidator;
|
|
323
353
|
/** Controls deduplication, caching, cancellation, and concurrency for URL checks. */
|
|
@@ -353,7 +383,8 @@ type AzureUrlValidationResult = boolean | {
|
|
|
353
383
|
type AzureUrlValidator = (url: string, context: {
|
|
354
384
|
tag: string;
|
|
355
385
|
attribute: string;
|
|
356
|
-
|
|
386
|
+
sourceNodePath?: readonly string[];
|
|
387
|
+
}, signal: AbortSignal) => AzureUrlValidationResult | Promise<AzureUrlValidationResult>;
|
|
357
388
|
interface AzureUrlValidationRunnerOptions {
|
|
358
389
|
concurrency?: number;
|
|
359
390
|
cache?: Map<string, AzureUrlValidationResult>;
|
|
@@ -393,4 +424,4 @@ declare function getAzureVoiceCatalogMetadata(): AzureVoiceCatalogMetadata;
|
|
|
393
424
|
/** Alias for consumers that refer to the bundled catalog as the built-in catalog. */
|
|
394
425
|
declare const getBuiltInVoiceCatalogMetadata: typeof getAzureVoiceCatalogMetadata;
|
|
395
426
|
|
|
396
|
-
export { type AudioElement, type AzureDiagnosticCode, type AzureLanguageNormalizationOptions, type AzureSsmlValidationOptions, type AzureUrlValidationResult, type AzureUrlValidationRunnerOptions, type AzureUrlValidator, 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 SplitSsmlOptions, type SsmlAttributeValue, type SsmlAttributes, type SsmlBackgroundAudioNode, type SsmlBreakElement, type SsmlChunk, type SsmlChunkContext, 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 SsmlTextRange, type SsmlTtsEmbeddingNode, type SsmlTurnNode, type SsmlValidationError, type SsmlVoiceConversionNode, type SsmlVoiceElement, type SubElement, type VoiceElement, type WordElement, areAzureLanguagesEquivalent, buildPartialSsml, buildSsml, createAzureUrlValidatorRunner, extractSsmlText, extractSsmlTranslatableText, fromPlainTextToSsml, getAzureVoiceCatalogMetadata, getBuiltInVoiceCatalogMetadata, isValidAzureAudioDuration, mapSsmlTextNodes, normalizeAzureLanguage, parseSsml, splitSsmlDocument, validateAzureSsml, validateSsml, validateSsmlStructureIntegrity };
|
|
427
|
+
export { type AudioElement, type AzureDiagnosticCode, type AzureLanguageNormalizationOptions, type AzureSsmlValidationOptions, type AzureUrlValidationResult, type AzureUrlValidationRunnerOptions, type AzureUrlValidator, 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 SplitSsmlOptions, type SsmlAttributeValue, type SsmlAttributes, type SsmlBackgroundAudioNode, type SsmlBreakElement, type SsmlChunk, type SsmlChunkContext, 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 SsmlSourceMap, type SsmlSourceMarker, type SsmlSourceTextSegment, type SsmlStructureIntegrityResult, type SsmlStructureMismatch, type SsmlText, type SsmlTextNodeContext, type SsmlTextRange, type SsmlTtsEmbeddingNode, type SsmlTurnNode, type SsmlValidationError, type SsmlVoiceConversionNode, type SsmlVoiceElement, type SubElement, type VoiceElement, type WordElement, areAzureLanguagesEquivalent, buildPartialSsml, buildSsml, createAzureUrlValidatorRunner, extractSsmlText, extractSsmlTranslatableText, fromPlainTextToSsml, getAzureVoiceCatalogMetadata, getBuiltInVoiceCatalogMetadata, getSsmlSourceMap, isValidAzureAudioDuration, mapSsmlTextNodes, normalizeAzureLanguage, parseSsml, splitSsmlDocument, validateAzureSsml, validateSsml, validateSsmlStructureIntegrity };
|