langie 1.11.0 → 1.11.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * langie v1.11.0
2
+ * langie v1.11.1
3
3
  * (c) 2026 nlit
4
4
  * @license Apache-2.0
5
5
  *
@@ -88,6 +88,8 @@ var EUROPEAN_LANGUAGES = [
88
88
  match: [
89
89
  "eng",
90
90
  "en",
91
+ "\u0430\u043D\u0433\u043B\u0438\u0439\u0441\u043A\u0438\u0439",
92
+ "\u0430\u043D\u0433\u043B",
91
93
  "united states",
92
94
  "united states of america",
93
95
  "usa",
@@ -101,6 +103,31 @@ var EUROPEAN_LANGUAGES = [
101
103
  ],
102
104
  suggest: ["irish", "scottish", "welsh"]
103
105
  },
106
+ // English variants: country name / abbreviation → the specific variant CODE.
107
+ // `lang` here is a variant code (not a language name) so Fuse matches it against
108
+ // the `code` key and ranks that exact variant first (e.g. "сша" → en-US #1).
109
+ // Latin "usa"/"us" stay on the `english` entry above (surface the whole group);
110
+ // these cover the Cyrillic exonyms the translated names never contain.
111
+ {
112
+ lang: "en-us",
113
+ match: ["\u0441\u0448\u0430", "\u0448\u0442\u0430\u0442\u044B", "\u0430\u043C\u0435\u0440\u0438\u043A\u0430", "\u0441\u043E\u0435\u0434\u0438\u043D\u0451\u043D\u043D\u044B\u0435 \u0448\u0442\u0430\u0442\u044B", "\u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u043D\u044B\u0435 \u0448\u0442\u0430\u0442\u044B"],
114
+ suggest: []
115
+ },
116
+ {
117
+ lang: "en-au",
118
+ match: ["\u0430\u0432\u0441\u0442\u0440\u0430\u043B\u0438\u044F"],
119
+ suggest: []
120
+ },
121
+ {
122
+ lang: "en-ca",
123
+ match: ["\u043A\u0430\u043D\u0430\u0434\u0430"],
124
+ suggest: []
125
+ },
126
+ {
127
+ lang: "en-ie",
128
+ match: ["\u0438\u0440\u043B\u0430\u043D\u0434\u0438\u044F"],
129
+ suggest: []
130
+ },
104
131
  {
105
132
  lang: "spanish",
106
133
  match: [
@@ -719,6 +746,7 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
719
746
  };
720
747
  const props = __props;
721
748
  const emit = __emit;
749
+ const multiselectRef = (0, import_vue3.ref)(null);
722
750
  const isLoading = (0, import_vue3.computed)(() => {
723
751
  return props.languages.length <= 0;
724
752
  });
@@ -731,8 +759,10 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
731
759
  return new import_fuse.default(validLanguages.value, {
732
760
  keys: ["name", "native_name", "search_alias", "code"],
733
761
  includeScore: true,
734
- threshold: 0.6,
735
- // Use highest threshold to catch all cases
762
+ threshold: 0.4,
763
+ // Trim fuzzy noise; short abbreviations (e.g. "сша") no longer rank below it
764
+ ignoreLocation: true,
765
+ // Match anywhere in the field, not just near position 0
736
766
  isCaseSensitive: false,
737
767
  minMatchCharLength: 1
738
768
  // Allow single character matches
@@ -813,33 +843,26 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
813
843
  });
814
844
  function handleSearch(query) {
815
845
  searchQuery.value = query;
816
- if (query.trim()) {
817
- (0, import_vue3.nextTick)(() => {
818
- const dropdown = document.querySelector(".multiselect-dropdown");
819
- const firstOption = dropdown?.querySelector(".multiselect-option");
820
- if (firstOption) {
821
- firstOption.scrollIntoView({ behavior: "smooth", block: "nearest" });
822
- firstOption.classList.add("multiselect-option-is-pointed");
823
- }
824
- });
825
- }
846
+ if (!query.trim()) return;
847
+ (0, import_vue3.nextTick)(() => {
848
+ multiselectRef.value?.setPointerFirst?.();
849
+ const dropdown = document.querySelector(".multiselect-dropdown");
850
+ if (dropdown) dropdown.scrollTop = 0;
851
+ });
826
852
  }
827
853
  function handleKeydown(event) {
828
854
  const keyboardEvent = event;
829
- if (keyboardEvent.key === "Tab" || keyboardEvent.key === "Enter") {
830
- const dropdown = document.querySelector(".multiselect-dropdown");
831
- const firstOption = dropdown?.querySelector(".multiselect-option");
832
- if (firstOption && searchQuery.value.trim()) {
833
- const langCode = firstOption.getAttribute("data-lang-code");
834
- if (langCode) {
835
- const language = validLanguages.value.find((lang) => lang.code === langCode);
836
- if (language) {
837
- selectedLanguage.value = language;
838
- searchQuery.value = "";
839
- keyboardEvent.preventDefault();
840
- }
841
- }
842
- }
855
+ if (keyboardEvent.key !== "Tab" && keyboardEvent.key !== "Enter") return;
856
+ if (!searchQuery.value.trim()) return;
857
+ const dropdown = document.querySelector(".multiselect-dropdown");
858
+ const pointed = dropdown?.querySelector(".multiselect-option.is-pointed [data-lang-code]") || dropdown?.querySelector(".multiselect-option [data-lang-code]");
859
+ const langCode = pointed?.getAttribute("data-lang-code");
860
+ if (!langCode) return;
861
+ const language = validLanguages.value.find((lang) => lang.code === langCode);
862
+ if (language) {
863
+ selectedLanguage.value = language;
864
+ searchQuery.value = "";
865
+ keyboardEvent.preventDefault();
843
866
  }
844
867
  }
845
868
  const onFlagError = (event) => {
@@ -867,6 +890,8 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
867
890
  [
868
891
  (0, import_vue2.createCommentVNode)(" Show multiselect when we have languages OR when not loading "),
869
892
  validLanguages.value.length > 0 || !isLoading.value ? ((0, import_vue2.openBlock)(), (0, import_vue2.createBlock)((0, import_vue2.unref)(import_multiselect.default), {
893
+ ref_key: "multiselectRef",
894
+ ref: multiselectRef,
870
895
  key: multiselectKey.value,
871
896
  modelValue: selectedLanguage.value,
872
897
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedLanguage.value = $event),
@@ -879,7 +904,7 @@ var LanguageSelect_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
879
904
  placeholder: validLanguages.value.length === 0 ? "No languages available" : __props.placeholder,
880
905
  disabled: props.disabled || validLanguages.value.length === 0,
881
906
  loading: isLoading.value,
882
- "track-by": "name",
907
+ "track-by": "code",
883
908
  label: "name",
884
909
  "value-prop": "code",
885
910
  "filter-results": false,