@ssml-builder-js/ssml-editor-react 2.13.0 → 2.14.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/CHANGELOG.md +11 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +67 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/VisualSsmlEditor.tsx +79 -16
package/dist/index.mjs
CHANGED
|
@@ -4999,28 +4999,72 @@ function localizedElementLabel(element, locale) {
|
|
|
4999
4999
|
function filteredVoices(voiceCatalog, locale, region, style) {
|
|
5000
5000
|
return (voiceCatalog ?? []).filter((voice) => {
|
|
5001
5001
|
if (locale && voice.locale.toLowerCase() !== locale.toLowerCase()) return false;
|
|
5002
|
-
|
|
5002
|
+
const regions = [voice.region, ...voice.regions ?? []].filter(
|
|
5003
|
+
(candidate) => Boolean(candidate)
|
|
5004
|
+
);
|
|
5005
|
+
if (region && regions.length > 0 && !regions.some((candidate) => candidate.toLowerCase() === region.toLowerCase()))
|
|
5006
|
+
return false;
|
|
5003
5007
|
if (style && !voice.styles?.some((candidate) => candidate.toLowerCase() === style.toLowerCase())) return false;
|
|
5004
5008
|
return true;
|
|
5005
5009
|
});
|
|
5006
5010
|
}
|
|
5007
|
-
function
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5011
|
+
function VoiceCapabilityMatrix({
|
|
5012
|
+
voice,
|
|
5013
|
+
locale
|
|
5014
|
+
}) {
|
|
5015
|
+
const status = voice.status ?? (voice.preview ? "preview" : void 0);
|
|
5016
|
+
return /* @__PURE__ */ jsxs2("div", { className: "ssml-editor-voice-capabilities", "data-voice-capabilities": "", children: [
|
|
5017
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
5018
|
+
locale === "ja" ? "\u30B9\u30C6\u30FC\u30BF\u30B9" : "Status",
|
|
5019
|
+
": ",
|
|
5020
|
+
status?.toUpperCase() ?? (locale === "ja" ? "GA" : "GA"),
|
|
5021
|
+
status === "preview" || status === "deprecated" ? /* @__PURE__ */ jsx6("span", { role: "status", "aria-label": status, className: "ssml-editor-voice-warning-badge", children: status === "preview" ? "\u26A0 Preview" : "\u26A0 Deprecated" }) : null
|
|
5022
|
+
] }),
|
|
5023
|
+
(voice.regions?.length || voice.region) && /* @__PURE__ */ jsxs2("div", { children: [
|
|
5024
|
+
locale === "ja" ? "\u30EA\u30FC\u30B8\u30E7\u30F3" : "Regions",
|
|
5025
|
+
":",
|
|
5026
|
+
" ",
|
|
5027
|
+
[...voice.regions ?? [], ...voice.region ? [voice.region] : []].filter((region, index, all) => all.indexOf(region) === index).join(", ")
|
|
5028
|
+
] }),
|
|
5029
|
+
voice.supportedTags && voice.supportedTags.length > 0 && /* @__PURE__ */ jsxs2("div", { children: [
|
|
5030
|
+
locale === "ja" ? "\u5BFE\u5FDC\u30BF\u30B0" : "Supported tags",
|
|
5031
|
+
": ",
|
|
5032
|
+
voice.supportedTags.join(", ")
|
|
5033
|
+
] }),
|
|
5034
|
+
voice.unsupportedTags && voice.unsupportedTags.length > 0 && /* @__PURE__ */ jsxs2("div", { className: "ssml-editor-voice-unsupported", children: [
|
|
5035
|
+
locale === "ja" ? "\u975E\u5BFE\u5FDC\u30BF\u30B0" : "Unsupported tags",
|
|
5036
|
+
": ",
|
|
5037
|
+
voice.unsupportedTags.join(", ")
|
|
5038
|
+
] })
|
|
5039
|
+
] });
|
|
5040
|
+
}
|
|
5041
|
+
function DefaultVoiceSelector({
|
|
5042
|
+
value,
|
|
5043
|
+
voices,
|
|
5044
|
+
selectedVoice,
|
|
5045
|
+
readOnly,
|
|
5046
|
+
locale,
|
|
5047
|
+
onChange
|
|
5048
|
+
}) {
|
|
5049
|
+
return /* @__PURE__ */ jsxs2(Fragment3, { children: [
|
|
5050
|
+
/* @__PURE__ */ jsxs2(
|
|
5051
|
+
"select",
|
|
5052
|
+
{
|
|
5053
|
+
"aria-label": locale === "ja" ? "\u97F3\u58F0" : "Voice",
|
|
5054
|
+
value,
|
|
5055
|
+
disabled: readOnly,
|
|
5056
|
+
onChange: (event) => onChange(event.target.value),
|
|
5057
|
+
children: [
|
|
5058
|
+
/* @__PURE__ */ jsx6("option", { value: "", children: locale === "ja" ? "\u97F3\u58F0\u3092\u9078\u629E" : "Select a voice" }),
|
|
5059
|
+
voices.map((voice) => /* @__PURE__ */ jsxs2("option", { value: voice.name, children: [
|
|
5060
|
+
voice.name,
|
|
5061
|
+
voice.preview || voice.status === "preview" ? " (preview)" : ""
|
|
5062
|
+
] }, voice.name))
|
|
5063
|
+
]
|
|
5064
|
+
}
|
|
5065
|
+
),
|
|
5066
|
+
selectedVoice ? /* @__PURE__ */ jsx6(VoiceCapabilityMatrix, { voice: selectedVoice, locale }) : null
|
|
5067
|
+
] });
|
|
5024
5068
|
}
|
|
5025
5069
|
function VisualElementInspector({
|
|
5026
5070
|
document: document2,
|
|
@@ -5041,6 +5085,9 @@ function VisualElementInspector({
|
|
|
5041
5085
|
}
|
|
5042
5086
|
const fields = getElementFields(element);
|
|
5043
5087
|
const availableVoices = filteredVoices(voiceCatalog, voiceLocale, voiceRegion, voiceStyle);
|
|
5088
|
+
const selectedVoice = voiceCatalog?.find(
|
|
5089
|
+
(voice) => voice.name === (element.type === "voice" ? element.name : void 0)
|
|
5090
|
+
);
|
|
5044
5091
|
const renderSelector = renderVoiceSelector ?? DefaultVoiceSelector;
|
|
5045
5092
|
return /* @__PURE__ */ jsxs2("fieldset", { children: [
|
|
5046
5093
|
/* @__PURE__ */ jsx6("legend", { children: `<${elementLabel(element)}>` }),
|
|
@@ -5086,6 +5133,7 @@ function VisualElementInspector({
|
|
|
5086
5133
|
field.key === "name" && elementLabel(element) === "voice" && voiceCatalog ? renderSelector({
|
|
5087
5134
|
value: inputValue,
|
|
5088
5135
|
voices: availableVoices,
|
|
5136
|
+
selectedVoice,
|
|
5089
5137
|
readOnly,
|
|
5090
5138
|
locale,
|
|
5091
5139
|
onChange: (value2) => commit(updateOptionalElementProperty(document2, path, field.key, value2))
|
|
@@ -5260,6 +5308,7 @@ function VisualSsmlEditor({
|
|
|
5260
5308
|
voiceCatalog ? (renderVoiceSelector ?? DefaultVoiceSelector)({
|
|
5261
5309
|
value: selectedElement.voice ?? "",
|
|
5262
5310
|
voices: filteredVoices(voiceCatalog, voiceLocale, voiceRegion, voiceStyle),
|
|
5311
|
+
selectedVoice: voiceCatalog?.find((voice) => voice.name === selectedElement.voice),
|
|
5263
5312
|
readOnly,
|
|
5264
5313
|
locale,
|
|
5265
5314
|
onChange: (value) => commit(updateOptionalElementProperty(document2, selectedPath ?? [], "voice", value))
|