@djangocfg/widget-chat 0.1.26 → 0.1.28
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/widget-chat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"description": "A transport-agnostic chat surface: a pure core, a store, primitives, a composer, and the assembled components a host mounts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chat",
|
|
@@ -66,19 +66,19 @@
|
|
|
66
66
|
"use-stick-to-bottom": "^1.1.6"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@djangocfg/api": "^2.1.
|
|
70
|
-
"@djangocfg/i18n": "^2.1.
|
|
71
|
-
"@djangocfg/ui-core": "^2.1.
|
|
69
|
+
"@djangocfg/api": "^2.1.627",
|
|
70
|
+
"@djangocfg/i18n": "^2.1.627",
|
|
71
|
+
"@djangocfg/ui-core": "^2.1.627",
|
|
72
72
|
"lucide-react": "^1.68.0",
|
|
73
73
|
"react": "^19.0.0",
|
|
74
74
|
"remark-gfm": "^4.0.0",
|
|
75
75
|
"streamdown": "^2.6.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@djangocfg/api": "^2.1.
|
|
79
|
-
"@djangocfg/i18n": "^2.1.
|
|
80
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
81
|
-
"@djangocfg/ui-core": "^2.1.
|
|
78
|
+
"@djangocfg/api": "^2.1.627",
|
|
79
|
+
"@djangocfg/i18n": "^2.1.627",
|
|
80
|
+
"@djangocfg/typescript-config": "^2.1.627",
|
|
81
|
+
"@djangocfg/ui-core": "^2.1.627",
|
|
82
82
|
"@storybook/react-vite": "^10.6.5",
|
|
83
83
|
"@types/node": "^25.9.5",
|
|
84
84
|
"@types/react": "19.3.0",
|
|
@@ -186,6 +186,22 @@ export const WEB_SPEECH_LANGUAGES: SpeechLanguage[] = [
|
|
|
186
186
|
{ name: '日本語', iso: 'ja', englishName: 'japanese', dialects: [{ code: 'ja-JP', region: 'Japan' }] },
|
|
187
187
|
{ name: 'हिन्दी', iso: 'hi', englishName: 'hindi', dialects: [{ code: 'hi-IN', region: 'India' }] },
|
|
188
188
|
{ name: 'ภาษาไทย', iso: 'th', englishName: 'thai', dialects: [{ code: 'th-TH', region: 'Thailand' }] },
|
|
189
|
+
{
|
|
190
|
+
name: 'العربية', iso: 'ar', englishName: 'arabic',
|
|
191
|
+
dialects: [
|
|
192
|
+
{ code: 'ar-SA', region: 'المملكة العربية السعودية' },
|
|
193
|
+
{ code: 'ar-EG', region: 'مصر' },
|
|
194
|
+
{ code: 'ar-AE', region: 'الإمارات' },
|
|
195
|
+
{ code: 'ar-MA', region: 'المغرب' },
|
|
196
|
+
{ code: 'ar-DZ', region: 'الجزائر' },
|
|
197
|
+
{ code: 'ar-JO', region: 'الأردن' },
|
|
198
|
+
{ code: 'ar-IQ', region: 'العراق' },
|
|
199
|
+
{ code: 'ar-KW', region: 'الكويت' },
|
|
200
|
+
{ code: 'ar-LB', region: 'لبنان' },
|
|
201
|
+
{ code: 'ar-QA', region: 'قطر' },
|
|
202
|
+
{ code: 'ar-TN', region: 'تونس' },
|
|
203
|
+
],
|
|
204
|
+
},
|
|
189
205
|
];
|
|
190
206
|
|
|
191
207
|
/** Flat list of every supported BCP-47 tag, useful for validation. */
|
|
@@ -35,8 +35,27 @@ const KNOWN_TAGS: ReadonlySet<string> = new Set(
|
|
|
35
35
|
),
|
|
36
36
|
);
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Primary subtags a browser or a UI locale spells differently from the catalogue:
|
|
40
|
+
* `zh` is Chinese (the catalogue keys it `cmn`), `no`/`nn` are Norwegian (keyed `nb`).
|
|
41
|
+
* Without this the 17 bundled UI locales left `zh` and `no` unresolved and dictation fell back to English.
|
|
42
|
+
*/
|
|
43
|
+
const ISO_ALIASES: Readonly<Record<string, string>> = { zh: "cmn", no: "nb", nn: "nb" };
|
|
44
|
+
|
|
45
|
+
/** Whole tags that name a catalogue dialect under another spelling (`zh-TW` is Mandarin in Traditional script). */
|
|
46
|
+
const TAG_ALIASES: Readonly<Record<string, string>> = {
|
|
47
|
+
"zh-tw": "cmn-Hant-TW",
|
|
48
|
+
"zh-hant": "cmn-Hant-TW",
|
|
49
|
+
"zh-hant-tw": "cmn-Hant-TW",
|
|
50
|
+
"zh-hk": "cmn-Hans-HK",
|
|
51
|
+
"zh-cn": "cmn-Hans-CN",
|
|
52
|
+
"zh-hans": "cmn-Hans-CN",
|
|
53
|
+
"zh-hans-cn": "cmn-Hans-CN",
|
|
54
|
+
};
|
|
55
|
+
|
|
38
56
|
function isoOf(tag: string): string {
|
|
39
|
-
|
|
57
|
+
const iso = tag.toLowerCase().split("-")[0] ?? "";
|
|
58
|
+
return ISO_ALIASES[iso] ?? iso;
|
|
40
59
|
}
|
|
41
60
|
|
|
42
61
|
/**
|
|
@@ -53,6 +72,8 @@ export function toSpeechTag(code: string | null | undefined): string | undefined
|
|
|
53
72
|
const trimmed = code.trim();
|
|
54
73
|
if (trimmed === "") return undefined;
|
|
55
74
|
if (KNOWN_TAGS.has(trimmed.toLowerCase())) return trimmed;
|
|
75
|
+
const aliased = TAG_ALIASES[trimmed.toLowerCase()];
|
|
76
|
+
if (aliased !== undefined) return aliased;
|
|
56
77
|
return ISO_TO_TAG.get(isoOf(trimmed));
|
|
57
78
|
}
|
|
58
79
|
|