ssml-builder-js 2.7.0 → 2.8.1

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/react.mjs CHANGED
@@ -1,5 +1,7 @@
1
1
  "use client";
2
2
  import {
3
+ AUDIO_DURATION_DESCRIPTIONS,
4
+ AUDIO_DURATION_PRESETS,
3
5
  BREAK_TIME_DESCRIPTIONS,
4
6
  BREAK_TIME_PRESETS,
5
7
  DEFAULT_LOCALE,
@@ -42,7 +44,7 @@ import {
42
44
  updateEditableText,
43
45
  updateTagAttribute,
44
46
  validateSsml
45
- } from "./chunk-QJTVHANI.mjs";
47
+ } from "./chunk-MWSDFGXW.mjs";
46
48
  import "./chunk-6S5ODO6A.mjs";
47
49
 
48
50
  // packages/ssml-editor-react/src/SsmlEditor.tsx
@@ -503,7 +505,7 @@ function TimingPopovers(props) {
503
505
 
504
506
  // packages/ssml-editor-react/src/hooks/useSsmlEditorState.ts
505
507
  import { useCallback, useEffect, useId, useRef, useState } from "react";
506
- var TIMING_INSERTION_TAGS = /* @__PURE__ */ new Set(["break", "mstts:silence"]);
508
+ var TIMING_INSERTION_TAGS = /* @__PURE__ */ new Set(["break", "mstts:silence", "mstts:audioduration"]);
507
509
  var PROSODY_INSERTION_TAGS = /* @__PURE__ */ new Set(["prosody", "mstts:express-as", "voice", "emphasis"]);
508
510
  var TEXT_INSERTION_TAGS = /* @__PURE__ */ new Set(["sub", "say-as", "phoneme", "w", "lang"]);
509
511
  var EMPTY_SELECTION_OVERLAY = {
@@ -1407,7 +1409,7 @@ function registerSsmlCodeLens(monaco, editor, onOpenPopover) {
1407
1409
  break;
1408
1410
  }
1409
1411
  const tag = source.slice(tagStart, tagEnd + 1);
1410
- const tagName = tag.match(/^<\s*(prosody|break)\b/i)?.[1]?.toLowerCase();
1412
+ const tagName = tag.match(/^<\s*(prosody|break|mstts:audioduration)\b/i)?.[1]?.toLowerCase();
1411
1413
  index = tagEnd + 1;
1412
1414
  if (!tagName) {
1413
1415
  continue;
@@ -1437,7 +1439,22 @@ function registerSsmlCodeLens(monaco, editor, onOpenPopover) {
1437
1439
  elementRange
1438
1440
  })
1439
1441
  );
1440
- } else if (/\/\s*>$/.test(tag)) {
1442
+ } else if (tagName === "mstts:audioduration" && /\/\s*>$/.test(tag)) {
1443
+ lenses.push(
1444
+ createLens(
1445
+ model,
1446
+ tagStart,
1447
+ tagEnd + 1,
1448
+ `\u26A1 Duration: ${getAttributeValue(tag, "value") ?? "default"} (Click to edit)`,
1449
+ { type: "attribute", insertionId: "mstts:audioduration", attributeName: "value", tagRange }
1450
+ ),
1451
+ createLens(model, tagStart, tagEnd + 1, "Delete", {
1452
+ type: "delete",
1453
+ tagRange,
1454
+ elementRange
1455
+ })
1456
+ );
1457
+ } else if (tagName === "break" && /\/\s*>$/.test(tag)) {
1441
1458
  lenses.push(
1442
1459
  createLens(
1443
1460
  model,
@@ -1784,7 +1801,7 @@ function useSsmlMonaco({
1784
1801
 
1785
1802
  // packages/ssml-editor-react/src/SsmlEditor.tsx
1786
1803
  var UNGROUPED_TOOLBAR_GROUP = "__ssml-editor-ungrouped__";
1787
- var TIMING_POPOVER_TAGS = /* @__PURE__ */ new Set(["break", "mstts:silence"]);
1804
+ var TIMING_POPOVER_TAGS = /* @__PURE__ */ new Set(["break", "mstts:silence", "mstts:audioduration"]);
1788
1805
  var PROSODY_POPOVER_TAGS = /* @__PURE__ */ new Set(["prosody", "mstts:express-as", "voice", "emphasis"]);
1789
1806
  var TEXT_POPOVER_TAGS = /* @__PURE__ */ new Set(["sub", "say-as", "phoneme", "w", "lang"]);
1790
1807
  function localizedText(value) {
@@ -2012,13 +2029,34 @@ var SSML_INSERTIONS = [
2012
2029
  suffix: "",
2013
2030
  mode: "insert"
2014
2031
  })
2032
+ },
2033
+ {
2034
+ id: "mstts:audioduration",
2035
+ icon: "\u25F7",
2036
+ tagName: "mstts:audioduration",
2037
+ selfClosing: true,
2038
+ labels: { ja: "\u97F3\u58F0\u9577", en: "Audio duration" },
2039
+ descriptions: {
2040
+ ja: "\u5408\u6210\u97F3\u58F0\u306E\u76EE\u6A19\u6642\u9593\u3092\u6307\u5B9A\u3057\u307E\u3059\u3002",
2041
+ en: "Sets the target duration of synthesized audio."
2042
+ },
2043
+ parameterDescription: {
2044
+ ja: "\u76EE\u6A19\u6642\u9593\u3092\u9078\u629E\u3057\u307E\u3059\u3002",
2045
+ en: "Selects the target duration."
2046
+ },
2047
+ options: createInsertionOptions(AUDIO_DURATION_PRESETS, AUDIO_DURATION_DESCRIPTIONS),
2048
+ createTemplate: (value) => ({
2049
+ prefix: `<mstts:audioduration value="${value}"/>`,
2050
+ suffix: "",
2051
+ mode: "insert"
2052
+ })
2015
2053
  }
2016
2054
  ];
2017
2055
  var DEFAULT_INSERTION_GROUPS = [
2018
2056
  {
2019
2057
  id: "pauses",
2020
2058
  labels: { ja: "\u9593\u30FB\u7121\u97F3", en: "Pauses" },
2021
- insertionIds: ["break", "mstts:silence"]
2059
+ insertionIds: ["break", "mstts:silence", "mstts:audioduration"]
2022
2060
  },
2023
2061
  {
2024
2062
  id: "prosody",