ssml-builder-js 2.10.0 → 2.11.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/dist/core.mjs CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  validateAzureSsml,
15
15
  validateSsml,
16
16
  validateSsmlStructureIntegrity
17
- } from "./chunk-GW6CKHXF.mjs";
17
+ } from "./chunk-SNRI43QJ.mjs";
18
18
  import "./chunk-6S5ODO6A.mjs";
19
19
  export {
20
20
  areAzureLanguagesEquivalent,
package/dist/elements.js CHANGED
@@ -956,6 +956,9 @@ var AZURE_VOICE_DEFINITIONS = [
956
956
  },
957
957
  { name: "es-ES-ElviraNeural", locale: "es-ES" },
958
958
  { name: "fil-PH-AngeloNeural", locale: "fil-PH" },
959
+ { name: "fil-PH-Angelo:DragonHDLatestNeural", locale: "fil-PH" },
960
+ { name: "fil-PH-BlessicaNeural", locale: "fil-PH" },
961
+ { name: "fil-PH-Blessica:DragonHDLatestNeural", locale: "fil-PH" },
959
962
  { name: "fr-FR-DeniseNeural", locale: "fr-FR", styles: ["cheerful", "sad"] },
960
963
  { name: "fr-FR-HenriNeural", locale: "fr-FR", styles: ["cheerful", "sad"] },
961
964
  { name: "id-ID-GadisNeural", locale: "id-ID" },
@@ -1050,6 +1053,18 @@ var ALLOWED_SILENCE_TYPES = /* @__PURE__ */ new Set([
1050
1053
  "Enumerationcomma"
1051
1054
  ]);
1052
1055
  var ALLOWED_VISEME_TYPES = /* @__PURE__ */ new Set(["redlips_front", "FacialExpression"]);
1056
+ var DEFAULT_PREVIEW_TAGS = /* @__PURE__ */ new Set(["mstts:voiceconversion"]);
1057
+ function featureStatusForTag(name, options) {
1058
+ const tagName = canonicalTagName(name);
1059
+ const configured = Object.entries(options.tagStatuses ?? {}).find(
1060
+ ([candidate]) => canonicalTagName(candidate) === tagName
1061
+ )?.[1];
1062
+ if (configured) return configured;
1063
+ if ((options.previewTags ?? [...DEFAULT_PREVIEW_TAGS]).some((candidate) => canonicalTagName(candidate) === tagName))
1064
+ return "preview";
1065
+ if ((options.deprecatedTags ?? []).some((candidate) => canonicalTagName(candidate) === tagName)) return "deprecated";
1066
+ return void 0;
1067
+ }
1053
1068
  function decodeAttribute(value) {
1054
1069
  return value.replace(
1055
1070
  /&(?:amp|apos|gt|lt|quot);/gi,
@@ -1166,9 +1181,9 @@ function isValidAzureAudioDuration(value) {
1166
1181
  return Number(clock[1]) > 0 || Number(clock[2]) > 0 || Number(clock[3]) > 0 || Number(clock[4] ?? 0) > 0;
1167
1182
  }
1168
1183
  function isValidAzureBackgroundAudioDuration(value) {
1169
- const match = /^(\d+(?:\.\d+)?)(ms|s)?$/i.exec(value.trim());
1184
+ const match = /^(\d+)$/.exec(value.trim());
1170
1185
  if (!match) return false;
1171
- const milliseconds = Number(match[1]) * (match[2]?.toLowerCase() === "s" ? 1e3 : 1);
1186
+ const milliseconds = Number(match[1]);
1172
1187
  return Number.isFinite(milliseconds) && milliseconds >= 0 && milliseconds <= 1e4;
1173
1188
  }
1174
1189
  function attr(token, name) {
@@ -1319,6 +1334,25 @@ function validateAudioSource(token, source, diagnostics, options, elementName2)
1319
1334
  }
1320
1335
  function validateElement(token, source, diagnostics, voiceName, options, voiceCatalog) {
1321
1336
  const name = token.name.toLowerCase();
1337
+ const tagStatus = featureStatusForTag(token.name, options);
1338
+ if (tagStatus === "preview")
1339
+ addDiagnostic(
1340
+ diagnostics,
1341
+ source,
1342
+ token.start,
1343
+ `<${token.name}> is an Azure Speech preview feature and may change or require preview access.`,
1344
+ "warning",
1345
+ "azure-preview-tag"
1346
+ );
1347
+ if (tagStatus === "deprecated")
1348
+ addDiagnostic(
1349
+ diagnostics,
1350
+ source,
1351
+ token.start,
1352
+ `<${token.name}> is deprecated by Azure Speech; migrate to a supported alternative.`,
1353
+ "info",
1354
+ "azure-deprecated-tag"
1355
+ );
1322
1356
  if (name === "voice" && !attr(token, "name")?.trim())
1323
1357
  addDiagnostic(diagnostics, source, token.start, '<voice> requires a non-empty "name" attribute.');
1324
1358
  if (name === "break") {
@@ -1530,6 +1564,24 @@ function validateAzureSsml(ssml, options = {}) {
1530
1564
  const name = attr(token, "name")?.trim();
1531
1565
  const language = attr(token, "xml:lang")?.trim() || (speak ? attr(speak, "xml:lang")?.trim() : void 0);
1532
1566
  const definition = name ? voiceCatalog.get(name.toLowerCase()) : void 0;
1567
+ if (name && definition?.status === "preview")
1568
+ addDiagnostic(
1569
+ diagnostics,
1570
+ ssml,
1571
+ token.start,
1572
+ `Voice "${name}" is an Azure Speech preview voice and may change or require preview access.`,
1573
+ "warning",
1574
+ "azure-preview-voice"
1575
+ );
1576
+ if (name && definition?.status === "deprecated")
1577
+ addDiagnostic(
1578
+ diagnostics,
1579
+ ssml,
1580
+ token.start,
1581
+ `Voice "${name}" is deprecated by Azure Speech; migrate to a supported voice.`,
1582
+ "info",
1583
+ "azure-deprecated-voice"
1584
+ );
1533
1585
  if (name && !definition && policySeverity)
1534
1586
  addDiagnostic(
1535
1587
  diagnostics,
@@ -2295,6 +2347,7 @@ var ssmlPresets_exports = {};
2295
2347
  __export(ssmlPresets_exports, {
2296
2348
  AUDIO_DURATION_DESCRIPTIONS: () => AUDIO_DURATION_DESCRIPTIONS,
2297
2349
  AUDIO_DURATION_PRESETS: () => AUDIO_DURATION_PRESETS,
2350
+ BACKGROUND_AUDIO_DURATION_PRESETS: () => BACKGROUND_AUDIO_DURATION_PRESETS,
2298
2351
  BREAK_STRENGTH_PRESETS: () => BREAK_STRENGTH_PRESETS,
2299
2352
  BREAK_TIME_DESCRIPTIONS: () => BREAK_TIME_DESCRIPTIONS,
2300
2353
  BREAK_TIME_PRESETS: () => BREAK_TIME_PRESETS,
@@ -2376,6 +2429,9 @@ var AZURE_VOICE_STYLE_MAP = {
2376
2429
  ],
2377
2430
  "es-ES-ElviraNeural": [],
2378
2431
  "fil-PH-AngeloNeural": [],
2432
+ "fil-PH-Angelo:DragonHDLatestNeural": [],
2433
+ "fil-PH-BlessicaNeural": [],
2434
+ "fil-PH-Blessica:DragonHDLatestNeural": [],
2379
2435
  "fr-FR-DeniseNeural": ["cheerful", "sad"],
2380
2436
  "fr-FR-HenriNeural": ["cheerful", "sad"],
2381
2437
  "id-ID-GadisNeural": [],
@@ -2653,6 +2709,7 @@ var SAY_AS_PRESETS = [
2653
2709
  var LANGUAGE_PRESETS = ["ja-JP", "en-US", "de-DE", "fr-FR"];
2654
2710
  var SILENCE_VALUE_PRESETS = ["300ms", "500ms", "1s"];
2655
2711
  var AUDIO_DURATION_PRESETS = ["5s", "10s", "30s"];
2712
+ var BACKGROUND_AUDIO_DURATION_PRESETS = ["0", "500", "1000", "3000", "10000"];
2656
2713
  var SILENCE_TYPE_PRESETS = [
2657
2714
  "Leading",
2658
2715
  "Tailing",
@@ -2714,8 +2771,8 @@ var SSML_ATTRIBUTE_PRESETS = {
2714
2771
  },
2715
2772
  "mstts:backgroundaudio": {
2716
2773
  volume: PROSODY_VOLUME_PRESETS,
2717
- fadein: AUDIO_DURATION_PRESETS,
2718
- fadeout: AUDIO_DURATION_PRESETS
2774
+ fadein: BACKGROUND_AUDIO_DURATION_PRESETS,
2775
+ fadeout: BACKGROUND_AUDIO_DURATION_PRESETS
2719
2776
  },
2720
2777
  silence: {
2721
2778
  type: SILENCE_TYPE_PRESETS,
@@ -3220,7 +3277,7 @@ var SSML_COMPLETION_SNIPPETS = [
3220
3277
  },
3221
3278
  {
3222
3279
  label: "mstts:backgroundaudio",
3223
- insertText: `<mstts:backgroundaudio src="\${1:https://example.com/audio.mp3}" volume="\${2:-3dB}" />`
3280
+ insertText: `<mstts:backgroundaudio src="\${1:https://example.com/audio.mp3}" volume="\${2:70}" fadein="\${3:1000}" fadeout="\${4:1000}" />`
3224
3281
  },
3225
3282
  {
3226
3283
  label: "mstts:ttsembedding",
@@ -3999,18 +4056,18 @@ var SSML_TAG_DEFINITIONS = [
3999
4056
  },
4000
4057
  {
4001
4058
  name: "volume",
4002
- description: "The background audio volume, for example `-3dB` or `medium`.",
4003
- example: "-3dB"
4059
+ description: "The background audio volume from 0 to 100.",
4060
+ example: "70"
4004
4061
  },
4005
4062
  {
4006
4063
  name: "fadein",
4007
- description: "The fade-in duration, for example `1s`.",
4008
- example: "1s"
4064
+ description: "The fade-in duration in milliseconds from 0 to 10000.",
4065
+ example: "1000"
4009
4066
  },
4010
4067
  {
4011
4068
  name: "fadeout",
4012
- description: "The fade-out duration, for example `500ms`.",
4013
- example: "500ms"
4069
+ description: "The fade-out duration in milliseconds from 0 to 10000.",
4070
+ example: "1000"
4014
4071
  }
4015
4072
  ]
4016
4073
  },