@nebula.js/stardust 4.0.0-alpha.7 → 4.0.0-alpha.9
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/core/esm/dev.js +1996 -1790
- package/core/esm/dev.js.map +1 -1
- package/core/esm/index.js +3 -3
- package/core/esm/index.js.map +1 -1
- package/core/package.json +1 -1
- package/dist/stardust.dev.js +2026 -1797
- package/dist/stardust.dev.js.map +1 -1
- package/dist/stardust.js +13 -13
- package/dist/stardust.js.map +1 -1
- package/package.json +11 -11
- package/types/index.d.ts +24 -13
package/core/esm/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @nebula.js/stardust v4.0.0-alpha.
|
|
2
|
+
* @nebula.js/stardust v4.0.0-alpha.9
|
|
3
3
|
* Copyright (c) 2023 QlikTech International AB
|
|
4
4
|
* Released under the MIT license.
|
|
5
5
|
*/
|
|
@@ -1653,6 +1653,246 @@ var Visualization_UnfulfilledCalculationCondition = {
|
|
|
1653
1653
|
"zh-TW": "不符計算條件"
|
|
1654
1654
|
}
|
|
1655
1655
|
};
|
|
1656
|
+
var Object_Listbox_Selected = {
|
|
1657
|
+
id: "Object.Listbox.Selected",
|
|
1658
|
+
locale: {
|
|
1659
|
+
"de-DE": "Ausgewählt",
|
|
1660
|
+
"en-US": "Selected",
|
|
1661
|
+
"es-ES": "Seleccionado",
|
|
1662
|
+
"fr-FR": "Sélectionné",
|
|
1663
|
+
"it-IT": "Selezionato",
|
|
1664
|
+
"ja-JP": "選択済み",
|
|
1665
|
+
"ko-KR": "선택됨",
|
|
1666
|
+
"nl-NL": "Geselecteerd",
|
|
1667
|
+
"pl-PL": "Wybrane",
|
|
1668
|
+
"pt-BR": "Selecionado",
|
|
1669
|
+
"ru-RU": "Выбранные",
|
|
1670
|
+
"sv-SE": "Urval",
|
|
1671
|
+
"tr-TR": "Seçilen",
|
|
1672
|
+
"zh-CN": "已选择",
|
|
1673
|
+
"zh-TW": "已選取"
|
|
1674
|
+
}
|
|
1675
|
+
};
|
|
1676
|
+
var Object_Listbox_Alternative = {
|
|
1677
|
+
id: "Object.Listbox.Alternative",
|
|
1678
|
+
locale: {
|
|
1679
|
+
"de-DE": "Alternative",
|
|
1680
|
+
"en-US": "Alternative",
|
|
1681
|
+
"es-ES": "Alternativo",
|
|
1682
|
+
"fr-FR": "Alternatif",
|
|
1683
|
+
"it-IT": "Alternativo",
|
|
1684
|
+
"ja-JP": "代替",
|
|
1685
|
+
"ko-KR": "대체 항목",
|
|
1686
|
+
"nl-NL": "Alternatief",
|
|
1687
|
+
"pl-PL": "Alternatywne",
|
|
1688
|
+
"pt-BR": "Alternativo",
|
|
1689
|
+
"ru-RU": "Альтернативные",
|
|
1690
|
+
"sv-SE": "Alternativ",
|
|
1691
|
+
"tr-TR": "Alternatif",
|
|
1692
|
+
"zh-CN": "可选",
|
|
1693
|
+
"zh-TW": "替代選項"
|
|
1694
|
+
}
|
|
1695
|
+
};
|
|
1696
|
+
var Object_Listbox_Optional = {
|
|
1697
|
+
id: "Object.Listbox.Optional",
|
|
1698
|
+
locale: {
|
|
1699
|
+
"de-DE": "Optional",
|
|
1700
|
+
"en-US": "Optional",
|
|
1701
|
+
"es-ES": "Opcional",
|
|
1702
|
+
"fr-FR": "Facultatif",
|
|
1703
|
+
"it-IT": "Opzionale",
|
|
1704
|
+
"ja-JP": "オプション",
|
|
1705
|
+
"ko-KR": "선택 사항",
|
|
1706
|
+
"nl-NL": "Optioneel",
|
|
1707
|
+
"pl-PL": "Opcjonalne",
|
|
1708
|
+
"pt-BR": "Opcional",
|
|
1709
|
+
"ru-RU": "Дополнительные",
|
|
1710
|
+
"sv-SE": "Valfritt",
|
|
1711
|
+
"tr-TR": "İsteğe bağlı",
|
|
1712
|
+
"zh-CN": "可选",
|
|
1713
|
+
"zh-TW": "選用"
|
|
1714
|
+
}
|
|
1715
|
+
};
|
|
1716
|
+
var Object_Listbox_SelectedExcluded = {
|
|
1717
|
+
id: "Object.Listbox.SelectedExcluded",
|
|
1718
|
+
locale: {
|
|
1719
|
+
"de-DE": "Ausgeschlossen ausgewählt",
|
|
1720
|
+
"en-US": "Selected excluded",
|
|
1721
|
+
"es-ES": "Seleccionado excluido",
|
|
1722
|
+
"fr-FR": "Sélectionné exclu",
|
|
1723
|
+
"it-IT": "Selezionato escluso",
|
|
1724
|
+
"ja-JP": "選択された除外値",
|
|
1725
|
+
"ko-KR": "제외 항목 선택됨",
|
|
1726
|
+
"nl-NL": "Geselecteerde uitgesloten",
|
|
1727
|
+
"pl-PL": "Wybrane wykluczone",
|
|
1728
|
+
"pt-BR": "Excluído selecionado",
|
|
1729
|
+
"ru-RU": "Выбранные исключенные элементы",
|
|
1730
|
+
"sv-SE": "Urval uteslutet",
|
|
1731
|
+
"tr-TR": "Seçili hariç tutulan",
|
|
1732
|
+
"zh-CN": "已排除选择",
|
|
1733
|
+
"zh-TW": "已選取排除值"
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1736
|
+
var Object_Listbox_Locked = {
|
|
1737
|
+
id: "Object.Listbox.Locked",
|
|
1738
|
+
locale: {
|
|
1739
|
+
"de-DE": "Gesperrt",
|
|
1740
|
+
"en-US": "Locked",
|
|
1741
|
+
"es-ES": "Bloqueado",
|
|
1742
|
+
"fr-FR": "Verrouillé",
|
|
1743
|
+
"it-IT": "Bloccato",
|
|
1744
|
+
"ja-JP": "ロック済み",
|
|
1745
|
+
"ko-KR": "잠김",
|
|
1746
|
+
"nl-NL": "Vergrendeld",
|
|
1747
|
+
"pl-PL": "Zablokowane",
|
|
1748
|
+
"pt-BR": "Bloqueado",
|
|
1749
|
+
"ru-RU": "Заблокированные",
|
|
1750
|
+
"sv-SE": "Låst",
|
|
1751
|
+
"tr-TR": "Kilitli",
|
|
1752
|
+
"zh-CN": "已锁定",
|
|
1753
|
+
"zh-TW": "已鎖定"
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
var Object_Listbox_Excluded = {
|
|
1757
|
+
id: "Object.Listbox.Excluded",
|
|
1758
|
+
locale: {
|
|
1759
|
+
"de-DE": "Ausgeschlossen",
|
|
1760
|
+
"en-US": "Excluded",
|
|
1761
|
+
"es-ES": "Excluido",
|
|
1762
|
+
"fr-FR": "Exclu",
|
|
1763
|
+
"it-IT": "Escluso",
|
|
1764
|
+
"ja-JP": "除外済み",
|
|
1765
|
+
"ko-KR": "제외됨",
|
|
1766
|
+
"nl-NL": "Uitgesloten",
|
|
1767
|
+
"pl-PL": "Wykluczone",
|
|
1768
|
+
"pt-BR": "Excluído",
|
|
1769
|
+
"ru-RU": "Исключенные",
|
|
1770
|
+
"sv-SE": "Uteslutet",
|
|
1771
|
+
"tr-TR": "Hariç tutulan",
|
|
1772
|
+
"zh-CN": "已排除",
|
|
1773
|
+
"zh-TW": "已排除"
|
|
1774
|
+
}
|
|
1775
|
+
};
|
|
1776
|
+
var Object_Listbox_ExcludedLock = {
|
|
1777
|
+
id: "Object.Listbox.ExcludedLock",
|
|
1778
|
+
locale: {
|
|
1779
|
+
"de-DE": "Ausgeschlossene Sperre",
|
|
1780
|
+
"en-US": "Excluded lock",
|
|
1781
|
+
"es-ES": "Bloqueo excluido",
|
|
1782
|
+
"fr-FR": "Exclu verrouillé",
|
|
1783
|
+
"it-IT": "Blocco escluso",
|
|
1784
|
+
"ja-JP": "除外されたロック",
|
|
1785
|
+
"ko-KR": "제외된 잠금",
|
|
1786
|
+
"nl-NL": "Uitsluitingsvergrendeling",
|
|
1787
|
+
"pl-PL": "Wykluczone zablokowane",
|
|
1788
|
+
"pt-BR": "Bloqueado excluído",
|
|
1789
|
+
"ru-RU": "Блокировать исключенные элементы",
|
|
1790
|
+
"sv-SE": "Uteslutet låst",
|
|
1791
|
+
"tr-TR": "Hariç tutulan kilit",
|
|
1792
|
+
"zh-CN": "已排除锁定",
|
|
1793
|
+
"zh-TW": "已排除鎖定"
|
|
1794
|
+
}
|
|
1795
|
+
};
|
|
1796
|
+
var Listbox_ScreenReader_SelectionMenu_WithAccSelMenu = {
|
|
1797
|
+
id: "Listbox.ScreenReader.SelectionMenu.WithAccSelMenu",
|
|
1798
|
+
locale: {
|
|
1799
|
+
"de-DE": "Drücken Sie gleichzeitig die Umschalt- und die Tabulatortaste, um den Fokus in das Auswahlmenü zu setzen.",
|
|
1800
|
+
"en-US": "Press Shift plus Tab to set focus on the selections menu.",
|
|
1801
|
+
"es-ES": "Pulse Mayús + Tabulador para establecer el foco en el menú de selecciones.",
|
|
1802
|
+
"fr-FR": "Appuyez sur Maj + Tab pour mettre le focus sur le menu de sélections.",
|
|
1803
|
+
"it-IT": "Premere insieme i tasti MAIUSC+TAB per evidenziare il menu di selezione.",
|
|
1804
|
+
"ja-JP": "Shift キー + Tab キーを押して、選択メニューで焦点を設定します。",
|
|
1805
|
+
"ko-KR": "선택 메뉴에 초점을 설정하려면 Shift+Tab을 누르십시오.",
|
|
1806
|
+
"nl-NL": "Druk op Shift + Tab om de focus in te stellen op het selectiemenu.",
|
|
1807
|
+
"pl-PL": "Naciśnij Shift i Tab, aby ustawić ostrość na menu selekcji.",
|
|
1808
|
+
"pt-BR": "Pressione Shift + Tab para definir o foco sobre o menu de seleções.",
|
|
1809
|
+
"ru-RU": "Нажмите сочетание клавиш \"Shift + Tab\" для установки фокуса на меню выбора.",
|
|
1810
|
+
"sv-SE": "Tryck på Skift plus Tabb när du vill ställa in fokus på urvalsmenyn.",
|
|
1811
|
+
"tr-TR": "Odağı seçim menüsüne ayarlamak için Shift ve Sekme tuşlarına birlikte basın.",
|
|
1812
|
+
"zh-CN": "按下 Shift 加 Tab 以将焦点设置在选择菜单上。",
|
|
1813
|
+
"zh-TW": "按下 Shift 加 Tab 以在選項功能表上設定焦點。"
|
|
1814
|
+
}
|
|
1815
|
+
};
|
|
1816
|
+
var Listbox_ScreenReader_SearchThenSelectionsMenu_WithAccSelMenu = {
|
|
1817
|
+
id: "Listbox.ScreenReader.SearchThenSelectionsMenu.WithAccSelMenu",
|
|
1818
|
+
locale: {
|
|
1819
|
+
"de-DE": "Drücken Sie die Umschalttaste zusammen mit der Tabulatortaste, um den Fokus in die Suchleiste zu setzen, und dann erneut beide Tasten, um den Fokus in das Auswahlmenü zu setzen.",
|
|
1820
|
+
"en-US": "Press Shift plus Tab to set focus on the search bar, then Shift plus Tab again to set focus on the selections menu.",
|
|
1821
|
+
"es-ES": "Pulse Mayús + Tabulador para establecer el foco en la barra de búsqueda, luego Mayús + Tabulador nuevamente para establecer el foco en el menú de selecciones.",
|
|
1822
|
+
"fr-FR": "Appuyez sur Maj + Tab pour définir le focus sur la barre de recherche, puis de nouveau sur Maj + Tab pour définir le focus sur le menu de sélections.",
|
|
1823
|
+
"it-IT": "Premere MAIUSC+TAB per impostare lo stato attivo sulla barra di ricerca, quindi premere nuovamente MAIUSC+TAB per impostare lo stato attivo sul menu selezioni.",
|
|
1824
|
+
"ja-JP": "Shift + Tab を押して検索バーにフォーカスを設定し、Shift + Tab をもう一度押して選択メニューにフォーカスを設定します。",
|
|
1825
|
+
"ko-KR": "Shift+Tab을 눌러 검색 막대에 초점을 맞춘 다음 Shift+Tab을 다시 눌러 선택 메뉴에 초점을 맞추십시오.",
|
|
1826
|
+
"nl-NL": "Druk op Shift + Tab om de focus in te stellen op de zoekbalk, druk vervolgens nogmaals op Shift + Tab om de focus in te stellen op het selectiemenu.",
|
|
1827
|
+
"pl-PL": "Naciśnij Shift i Tab, aby ustawić ostrość na pasek wyszukiwania. Następnie ponownie użyj tej kombinacji klawiszy, aby ustawić ostrość na menu selekcji.",
|
|
1828
|
+
"pt-BR": "Pressione Shift + Tab para definir o foco na barra de pesquisa e Shift + Tab novamente para definir o foco no menu de seleções.",
|
|
1829
|
+
"ru-RU": "Нажмите сочетание клавиш \"Shift + Tab\" для установки фокуса на панель поиска. Затем нажмите сочетание клавиш \"Shift + Tab\" снова, чтобы установить фокус на меню выборки.",
|
|
1830
|
+
"sv-SE": "Tryck på Skift plus Tabb för att ställa in fokus på sökfältet, sedan Skift plus Tabb igen för att ställa in fokus på urvalsmenyn.",
|
|
1831
|
+
"tr-TR": "Odağı arama çubuğuna ayarlamak için Shift ve Sekme tuşlarına birlikte basın, ardından bu tuşlara birlikte tekrar basarak odağı seçim menüsüne ayarlayın.",
|
|
1832
|
+
"zh-CN": "按 Shift+Tab 在搜索栏上设置焦点,然后再次按 Shift+Tab 在“选择”菜单上设置焦点。",
|
|
1833
|
+
"zh-TW": "按下 Shift 加 Tab 鍵以設定搜尋列上的焦點,然後再次按下 Shift 加 Tab 鍵,以設定選項功能表上的焦點。"
|
|
1834
|
+
}
|
|
1835
|
+
};
|
|
1836
|
+
var ScreenReader_ZeroSelected = {
|
|
1837
|
+
id: "ScreenReader.ZeroSelected",
|
|
1838
|
+
locale: {
|
|
1839
|
+
"de-DE": "Es sind keine Werte ausgewählt.",
|
|
1840
|
+
"en-US": "No values are selected.",
|
|
1841
|
+
"es-ES": "No se ha seleccionado ningún valor.",
|
|
1842
|
+
"fr-FR": "Aucune valeur n'a été sélectionnée.",
|
|
1843
|
+
"it-IT": "Nessun valore selezionato.",
|
|
1844
|
+
"ja-JP": "値が選択されていません。",
|
|
1845
|
+
"ko-KR": "선택된 값이 없습니다.",
|
|
1846
|
+
"nl-NL": "Geen waarden geselecteerd.",
|
|
1847
|
+
"pl-PL": "Brak wybranych wartości.",
|
|
1848
|
+
"pt-BR": "Nenhum valor selecionado.",
|
|
1849
|
+
"ru-RU": "Значения не выбраны.",
|
|
1850
|
+
"sv-SE": "Inga värden är valda.",
|
|
1851
|
+
"tr-TR": "Seçilen değer yok.",
|
|
1852
|
+
"zh-CN": "未选择值。",
|
|
1853
|
+
"zh-TW": "沒有選取任何值。"
|
|
1854
|
+
}
|
|
1855
|
+
};
|
|
1856
|
+
var ScreenReader_OneSelected = {
|
|
1857
|
+
id: "ScreenReader.OneSelected",
|
|
1858
|
+
locale: {
|
|
1859
|
+
"de-DE": "Es ist ein Wert ausgewählt.",
|
|
1860
|
+
"en-US": "There is one selected value.",
|
|
1861
|
+
"es-ES": "Hay un valor seleccionado.",
|
|
1862
|
+
"fr-FR": "Une valeur a été sélectionnée.",
|
|
1863
|
+
"it-IT": "È presente un valore selezionato.",
|
|
1864
|
+
"ja-JP": "値が 1 つ選択されています。",
|
|
1865
|
+
"ko-KR": "하나의 값이 선택되었습니다.",
|
|
1866
|
+
"nl-NL": "Er is één waarde geselecteerd.",
|
|
1867
|
+
"pl-PL": "Jest jedna wybrana wartość.",
|
|
1868
|
+
"pt-BR": "Há um valor selecionado.",
|
|
1869
|
+
"ru-RU": "Выбрано одно значение.",
|
|
1870
|
+
"sv-SE": "Ett värde är valt.",
|
|
1871
|
+
"tr-TR": "Seçilen bir değer var.",
|
|
1872
|
+
"zh-CN": "存在一个已选择的值。",
|
|
1873
|
+
"zh-TW": "有一個選取的值。"
|
|
1874
|
+
}
|
|
1875
|
+
};
|
|
1876
|
+
var ScreenReader_ManySelected = {
|
|
1877
|
+
id: "ScreenReader.ManySelected",
|
|
1878
|
+
locale: {
|
|
1879
|
+
"de-DE": "Es sind {0} Werte ausgewählt.",
|
|
1880
|
+
"en-US": "There are {0} selected values.",
|
|
1881
|
+
"es-ES": "Hay {0} valores seleccionados.",
|
|
1882
|
+
"fr-FR": "{0} valeurs ont été sélectionnées.",
|
|
1883
|
+
"it-IT": "Sono presenti {0} valori selezionati.",
|
|
1884
|
+
"ja-JP": "値が {0} つ選択されています。",
|
|
1885
|
+
"ko-KR": "{0}개의 값이 선택되었습니다.",
|
|
1886
|
+
"nl-NL": "Er zijn {0} waarden geselecteerd.",
|
|
1887
|
+
"pl-PL": "Wybranych wartości: {0}",
|
|
1888
|
+
"pt-BR": "Há {0} valores selecionados.",
|
|
1889
|
+
"ru-RU": "Выбраны значения: {0}.",
|
|
1890
|
+
"sv-SE": "{0} värden är valda.",
|
|
1891
|
+
"tr-TR": "Seçilen {0} değer var.",
|
|
1892
|
+
"zh-CN": "存在 {0} 个已选择的值。",
|
|
1893
|
+
"zh-TW": "有 {0} 個選取的值。"
|
|
1894
|
+
}
|
|
1895
|
+
};
|
|
1656
1896
|
var all = {
|
|
1657
1897
|
Cancel: Cancel$1,
|
|
1658
1898
|
CurrentSelections_All: CurrentSelections_All,
|
|
@@ -1691,7 +1931,19 @@ var all = {
|
|
|
1691
1931
|
Visualization_Invalid_Dimension: Visualization_Invalid_Dimension,
|
|
1692
1932
|
Visualization_Invalid_Measure: Visualization_Invalid_Measure,
|
|
1693
1933
|
Visualization_LayoutError: Visualization_LayoutError,
|
|
1694
|
-
Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition
|
|
1934
|
+
Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition,
|
|
1935
|
+
Object_Listbox_Selected: Object_Listbox_Selected,
|
|
1936
|
+
Object_Listbox_Alternative: Object_Listbox_Alternative,
|
|
1937
|
+
Object_Listbox_Optional: Object_Listbox_Optional,
|
|
1938
|
+
Object_Listbox_SelectedExcluded: Object_Listbox_SelectedExcluded,
|
|
1939
|
+
Object_Listbox_Locked: Object_Listbox_Locked,
|
|
1940
|
+
Object_Listbox_Excluded: Object_Listbox_Excluded,
|
|
1941
|
+
Object_Listbox_ExcludedLock: Object_Listbox_ExcludedLock,
|
|
1942
|
+
Listbox_ScreenReader_SelectionMenu_WithAccSelMenu: Listbox_ScreenReader_SelectionMenu_WithAccSelMenu,
|
|
1943
|
+
Listbox_ScreenReader_SearchThenSelectionsMenu_WithAccSelMenu: Listbox_ScreenReader_SearchThenSelectionsMenu_WithAccSelMenu,
|
|
1944
|
+
ScreenReader_ZeroSelected: ScreenReader_ZeroSelected,
|
|
1945
|
+
ScreenReader_OneSelected: ScreenReader_OneSelected,
|
|
1946
|
+
ScreenReader_ManySelected: ScreenReader_ManySelected
|
|
1695
1947
|
};
|
|
1696
1948
|
|
|
1697
1949
|
function appLocaleFn(language) {
|
|
@@ -3967,7 +4219,7 @@ function resolveProps(defaultProps, props) {
|
|
|
3967
4219
|
return output;
|
|
3968
4220
|
}
|
|
3969
4221
|
|
|
3970
|
-
function composeClasses(slots, getUtilityClass, classes) {
|
|
4222
|
+
function composeClasses(slots, getUtilityClass, classes = undefined) {
|
|
3971
4223
|
const output = {};
|
|
3972
4224
|
Object.keys(slots).forEach(
|
|
3973
4225
|
// `Objet.keys(slots)` can't be wider than `T` because we infer `T` from `slots`.
|
|
@@ -3975,7 +4227,10 @@ function composeClasses(slots, getUtilityClass, classes) {
|
|
|
3975
4227
|
slot => {
|
|
3976
4228
|
output[slot] = slots[slot].reduce((acc, key) => {
|
|
3977
4229
|
if (key) {
|
|
3978
|
-
|
|
4230
|
+
const utilityClass = getUtilityClass(key);
|
|
4231
|
+
if (utilityClass !== '') {
|
|
4232
|
+
acc.push(utilityClass);
|
|
4233
|
+
}
|
|
3979
4234
|
if (classes && classes[key]) {
|
|
3980
4235
|
acc.push(classes[key]);
|
|
3981
4236
|
}
|
|
@@ -6217,6 +6472,11 @@ function unstable_createStyleFunctionSx() {
|
|
|
6217
6472
|
if (val == null) {
|
|
6218
6473
|
return null;
|
|
6219
6474
|
}
|
|
6475
|
+
if (themeKey === 'typography' && val === 'inherit') {
|
|
6476
|
+
return {
|
|
6477
|
+
[prop]: val
|
|
6478
|
+
};
|
|
6479
|
+
}
|
|
6220
6480
|
const themeMapping = getPath$1(theme, themeKey) || {};
|
|
6221
6481
|
if (style) {
|
|
6222
6482
|
return style(props);
|
|
@@ -7537,7 +7797,14 @@ function createTypography(palette, typography) {
|
|
|
7537
7797
|
body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),
|
|
7538
7798
|
button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
|
|
7539
7799
|
caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
|
|
7540
|
-
overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps)
|
|
7800
|
+
overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps),
|
|
7801
|
+
inherit: {
|
|
7802
|
+
fontFamily: 'inherit',
|
|
7803
|
+
fontWeight: 'inherit',
|
|
7804
|
+
fontSize: 'inherit',
|
|
7805
|
+
lineHeight: 'inherit',
|
|
7806
|
+
letterSpacing: 'inherit'
|
|
7807
|
+
}
|
|
7541
7808
|
};
|
|
7542
7809
|
return deepmerge(_extends$4({
|
|
7543
7810
|
htmlFontSize,
|
|
@@ -8064,7 +8331,7 @@ function create$3(definition) {
|
|
|
8064
8331
|
return cache[key];
|
|
8065
8332
|
}
|
|
8066
8333
|
|
|
8067
|
-
const NEBULA_VERSION_HASH = "
|
|
8334
|
+
const NEBULA_VERSION_HASH = "64ea" ;
|
|
8068
8335
|
ClassNameGenerator$1.configure(componentName => {
|
|
8069
8336
|
return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
|
|
8070
8337
|
});
|
|
@@ -8272,7 +8539,7 @@ function boot(_ref2) {
|
|
|
8272
8539
|
const appRef = React__default.createRef();
|
|
8273
8540
|
const element = document.createElement('div');
|
|
8274
8541
|
element.style.display = 'none';
|
|
8275
|
-
element.setAttribute('data-nebulajs-version', "4.0.0-alpha.
|
|
8542
|
+
element.setAttribute('data-nebulajs-version', "4.0.0-alpha.9" );
|
|
8276
8543
|
element.setAttribute('data-app-id', app.id);
|
|
8277
8544
|
document.body.appendChild(element);
|
|
8278
8545
|
const root = client.createRoot(element);
|
|
@@ -9071,21 +9338,70 @@ function fillRange(elementNbrs, elemNumbersOrdered) {
|
|
|
9071
9338
|
return elemNumbersOrdered.slice(min, max + 1);
|
|
9072
9339
|
}
|
|
9073
9340
|
|
|
9341
|
+
const PREFIX$c = 'RowColumn';
|
|
9342
|
+
const rowColClasses = {
|
|
9343
|
+
row: "".concat(PREFIX$c, "-row"),
|
|
9344
|
+
rowBorderBottom: "".concat(PREFIX$c, "-rowBorderBottom"),
|
|
9345
|
+
column: "".concat(PREFIX$c, "-column"),
|
|
9346
|
+
fieldRoot: "".concat(PREFIX$c, "-fieldRoot"),
|
|
9347
|
+
cell: "".concat(PREFIX$c, "-cell"),
|
|
9348
|
+
labelText: "".concat(PREFIX$c, "-labelText"),
|
|
9349
|
+
labelDense: "".concat(PREFIX$c, "-labelDense"),
|
|
9350
|
+
highlighted: "".concat(PREFIX$c, "-highlighted"),
|
|
9351
|
+
checkboxLabel: "".concat(PREFIX$c, "-checkboxLabel"),
|
|
9352
|
+
icon: "".concat(PREFIX$c, "-icon"),
|
|
9353
|
+
S: "".concat(PREFIX$c, "-S"),
|
|
9354
|
+
XS: "".concat(PREFIX$c, "-XS"),
|
|
9355
|
+
A: "".concat(PREFIX$c, "-A"),
|
|
9356
|
+
X: "".concat(PREFIX$c, "-X"),
|
|
9357
|
+
frequencyCount: "".concat(PREFIX$c, "-frequencyCount"),
|
|
9358
|
+
barContainer: "".concat(PREFIX$c, "-barContainer"),
|
|
9359
|
+
bar: "".concat(PREFIX$c, "-bar"),
|
|
9360
|
+
barSelected: "".concat(PREFIX$c, "-barSelected"),
|
|
9361
|
+
barWithCheckbox: "".concat(PREFIX$c, "-barWithCheckbox"),
|
|
9362
|
+
barSelectedWithCheckbox: "".concat(PREFIX$c, "-barSelectedWithCheckbox"),
|
|
9363
|
+
excludedTextWithCheckbox: "".concat(PREFIX$c, "-excludedTextWithCheckbox")
|
|
9364
|
+
};
|
|
9365
|
+
|
|
9366
|
+
/* eslint-disable no-underscore-dangle */
|
|
9367
|
+
const dataItemSelector = ".".concat(rowColClasses.fieldRoot);
|
|
9074
9368
|
const getKeyAsToggleSelected = event => !(event !== null && event !== void 0 && event.metaKey || event !== null && event !== void 0 && event.ctrlKey);
|
|
9075
9369
|
function useSelectionsInteractions(_ref) {
|
|
9370
|
+
var _loaderRef$current2, _loaderRef$current2$_;
|
|
9076
9371
|
let {
|
|
9077
9372
|
selectionState,
|
|
9078
9373
|
selections,
|
|
9079
9374
|
checkboxes = false,
|
|
9080
|
-
doc = document
|
|
9375
|
+
doc = document,
|
|
9376
|
+
loaderRef
|
|
9081
9377
|
} = _ref;
|
|
9082
9378
|
const currentSelect = useRef({
|
|
9083
9379
|
startElemNumber: undefined,
|
|
9084
9380
|
elemNumbers: [],
|
|
9085
9381
|
isRange: false,
|
|
9086
9382
|
toggle: false,
|
|
9087
|
-
active: false
|
|
9383
|
+
active: false,
|
|
9384
|
+
touchElemNumbers: [],
|
|
9385
|
+
touchRangeSmall: false
|
|
9088
9386
|
});
|
|
9387
|
+
useEffect$1(() => {
|
|
9388
|
+
var _loaderRef$current, _loaderRef$current$_l;
|
|
9389
|
+
if (!((_loaderRef$current = loaderRef.current) !== null && _loaderRef$current !== void 0 && (_loaderRef$current$_l = _loaderRef$current._listRef) !== null && _loaderRef$current$_l !== void 0 && _loaderRef$current$_l._outerRef)) {
|
|
9390
|
+
return undefined;
|
|
9391
|
+
}
|
|
9392
|
+
const preventGestureStart = e => e.preventDefault();
|
|
9393
|
+
const preventGestureChange = e => e.preventDefault();
|
|
9394
|
+
const preventGestureEnd = e => e.preventDefault();
|
|
9395
|
+
const listRef = loaderRef.current._listRef._outerRef;
|
|
9396
|
+
listRef.addEventListener('gesturestart', preventGestureStart);
|
|
9397
|
+
listRef.addEventListener('gesturechange', preventGestureChange);
|
|
9398
|
+
listRef.addEventListener('gestureend', preventGestureEnd);
|
|
9399
|
+
return () => {
|
|
9400
|
+
listRef.removeEventListener('gesturestart', preventGestureStart);
|
|
9401
|
+
listRef.removeEventListener('gesturechange', preventGestureChange);
|
|
9402
|
+
listRef.removeEventListener('gestureend', preventGestureEnd);
|
|
9403
|
+
};
|
|
9404
|
+
}, [(_loaderRef$current2 = loaderRef.current) === null || _loaderRef$current2 === void 0 ? void 0 : (_loaderRef$current2$_ = _loaderRef$current2._listRef) === null || _loaderRef$current2$_ === void 0 ? void 0 : _loaderRef$current2$_._outerRef]);
|
|
9089
9405
|
|
|
9090
9406
|
// eslint-disable-next-line arrow-body-style
|
|
9091
9407
|
const doSelect = () => {
|
|
@@ -9097,6 +9413,10 @@ function useSelectionsInteractions(_ref) {
|
|
|
9097
9413
|
toggle: currentSelect.current.toggle
|
|
9098
9414
|
});
|
|
9099
9415
|
};
|
|
9416
|
+
const getRange = (start, end) => {
|
|
9417
|
+
const elemNumbersOrdered = getElemNumbersFromPages(selectionState.enginePages);
|
|
9418
|
+
return fillRange([start, end], elemNumbersOrdered);
|
|
9419
|
+
};
|
|
9100
9420
|
const addToRange = elemNumber => {
|
|
9101
9421
|
const {
|
|
9102
9422
|
startElemNumber
|
|
@@ -9104,9 +9424,7 @@ function useSelectionsInteractions(_ref) {
|
|
|
9104
9424
|
if (startElemNumber === elemNumber) {
|
|
9105
9425
|
return;
|
|
9106
9426
|
}
|
|
9107
|
-
const
|
|
9108
|
-
const elemNumbersOrdered = getElemNumbersFromPages(selectionState.enginePages);
|
|
9109
|
-
const toMaybeAdd = fillRange(rangeEnds, elemNumbersOrdered);
|
|
9427
|
+
const toMaybeAdd = getRange(currentSelect.current.startElemNumber, elemNumber);
|
|
9110
9428
|
selectionState.updateItems(toMaybeAdd, true, currentSelect.current.elemNumbers);
|
|
9111
9429
|
};
|
|
9112
9430
|
const selectManually = function () {
|
|
@@ -9202,6 +9520,48 @@ function useSelectionsInteractions(_ref) {
|
|
|
9202
9520
|
const elemNumber = +event.currentTarget.getAttribute('data-n');
|
|
9203
9521
|
addToRange(elemNumber);
|
|
9204
9522
|
}, []);
|
|
9523
|
+
const onTouchStart = useCallback(event => {
|
|
9524
|
+
var _event$touches$0$targ, _event$touches$0$targ2, _event$touches$1$targ, _event$touches$1$targ2;
|
|
9525
|
+
// Handle range selection with two finger touch
|
|
9526
|
+
if (currentSelect.current.active || currentSelect.current.isRange || selectionState.isSingleSelect || event.touches.length <= 1) {
|
|
9527
|
+
return;
|
|
9528
|
+
}
|
|
9529
|
+
if (event.touches.length > 2) {
|
|
9530
|
+
doSelect();
|
|
9531
|
+
return;
|
|
9532
|
+
}
|
|
9533
|
+
const startTouchElemNumber = Number((_event$touches$0$targ = event.touches[0].target) === null || _event$touches$0$targ === void 0 ? void 0 : (_event$touches$0$targ2 = _event$touches$0$targ.closest(dataItemSelector)) === null || _event$touches$0$targ2 === void 0 ? void 0 : _event$touches$0$targ2.getAttribute('data-n'));
|
|
9534
|
+
const endTouchElemNumber = Number((_event$touches$1$targ = event.touches[1].target) === null || _event$touches$1$targ === void 0 ? void 0 : (_event$touches$1$targ2 = _event$touches$1$targ.closest(dataItemSelector)) === null || _event$touches$1$targ2 === void 0 ? void 0 : _event$touches$1$targ2.getAttribute('data-n'));
|
|
9535
|
+
if (Number.isNaN(startTouchElemNumber) || Number.isNaN(startTouchElemNumber)) {
|
|
9536
|
+
doSelect();
|
|
9537
|
+
return;
|
|
9538
|
+
}
|
|
9539
|
+
currentSelect.current.active = true;
|
|
9540
|
+
const range = getRange(startTouchElemNumber, endTouchElemNumber);
|
|
9541
|
+
if (range.length < 7) {
|
|
9542
|
+
currentSelect.current.touchRangeSmall = true;
|
|
9543
|
+
}
|
|
9544
|
+
currentSelect.current.elemNumbers = [];
|
|
9545
|
+
currentSelect.current.touchElemNumbers = [startTouchElemNumber, endTouchElemNumber];
|
|
9546
|
+
}, []);
|
|
9547
|
+
const onTouchEnd = useCallback(() => {
|
|
9548
|
+
if (currentSelect.current.touchElemNumbers.length !== 2) {
|
|
9549
|
+
return;
|
|
9550
|
+
}
|
|
9551
|
+
if (currentSelect.current.touchRangeSmall) {
|
|
9552
|
+
currentSelect.current.touchRangeSmall = false;
|
|
9553
|
+
currentSelect.current.touchElemNumbers = [];
|
|
9554
|
+
currentSelect.current.active = false;
|
|
9555
|
+
return;
|
|
9556
|
+
}
|
|
9557
|
+
const [startTouchElemNumber, endTouchElemNumber] = currentSelect.current.touchElemNumbers;
|
|
9558
|
+
currentSelect.current.startElemNumber = startTouchElemNumber;
|
|
9559
|
+
addToRange(endTouchElemNumber);
|
|
9560
|
+
currentSelect.current.touchElemNumbers = [];
|
|
9561
|
+
currentSelect.current.active = false;
|
|
9562
|
+
currentSelect.current.toggle = true;
|
|
9563
|
+
doSelect();
|
|
9564
|
+
}, []);
|
|
9205
9565
|
useEffect$1(() => {
|
|
9206
9566
|
doc.addEventListener('mouseup', onMouseUpDoc);
|
|
9207
9567
|
return () => {
|
|
@@ -9234,7 +9594,9 @@ function useSelectionsInteractions(_ref) {
|
|
|
9234
9594
|
Object.assign(interactionEvents, {
|
|
9235
9595
|
onMouseUp,
|
|
9236
9596
|
onMouseDown,
|
|
9237
|
-
onMouseEnter
|
|
9597
|
+
onMouseEnter,
|
|
9598
|
+
onTouchStart,
|
|
9599
|
+
onTouchEnd
|
|
9238
9600
|
});
|
|
9239
9601
|
}
|
|
9240
9602
|
return {
|
|
@@ -9369,15 +9731,14 @@ function useTempKeyboard(_ref) {
|
|
|
9369
9731
|
enabled
|
|
9370
9732
|
} = _ref;
|
|
9371
9733
|
const [keyboardActive, setKeyboardActive] = useState$1(false);
|
|
9372
|
-
const innerTabStops = !enabled || keyboardActive;
|
|
9373
9734
|
const keyboard = {
|
|
9374
9735
|
enabled,
|
|
9375
9736
|
active: keyboardActive,
|
|
9376
|
-
innerTabStops
|
|
9377
|
-
//
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
blur
|
|
9737
|
+
// innerTabStops: whether keyboard permits inner tab stops
|
|
9738
|
+
// (inner = everything inside .listbox-container)
|
|
9739
|
+
|
|
9740
|
+
innerTabStops: !enabled || keyboardActive,
|
|
9741
|
+
blur(resetFocus) {
|
|
9381
9742
|
var _containerRef$current;
|
|
9382
9743
|
if (!enabled) {
|
|
9383
9744
|
return;
|
|
@@ -9392,7 +9753,7 @@ function useTempKeyboard(_ref) {
|
|
|
9392
9753
|
vizCell.focus();
|
|
9393
9754
|
}
|
|
9394
9755
|
},
|
|
9395
|
-
focus
|
|
9756
|
+
focus() {
|
|
9396
9757
|
if (!enabled) {
|
|
9397
9758
|
return;
|
|
9398
9759
|
}
|
|
@@ -9400,12 +9761,13 @@ function useTempKeyboard(_ref) {
|
|
|
9400
9761
|
const c = containerRef.current;
|
|
9401
9762
|
const searchField = c === null || c === void 0 ? void 0 : c.querySelector('.search input');
|
|
9402
9763
|
const lastSelectedRow = c === null || c === void 0 ? void 0 : c.querySelector('.value.last-focused');
|
|
9403
|
-
const
|
|
9404
|
-
const
|
|
9764
|
+
const firstRowElement = c === null || c === void 0 ? void 0 : c.querySelector('.value.selector, .value');
|
|
9765
|
+
const confirmButton = c === null || c === void 0 ? void 0 : c.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
|
|
9766
|
+
const elementToFocus = searchField || lastSelectedRow || firstRowElement || confirmButton;
|
|
9405
9767
|
elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.setAttribute('tabIndex', 0);
|
|
9406
9768
|
elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.focus();
|
|
9407
9769
|
},
|
|
9408
|
-
focusSelection
|
|
9770
|
+
focusSelection() {
|
|
9409
9771
|
const confirmButton = document.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
|
|
9410
9772
|
confirmButton === null || confirmButton === void 0 ? void 0 : confirmButton.setAttribute('tabIndex', 0);
|
|
9411
9773
|
confirmButton === null || confirmButton === void 0 ? void 0 : confirmButton.focus();
|
|
@@ -9414,6 +9776,7 @@ function useTempKeyboard(_ref) {
|
|
|
9414
9776
|
return keyboard;
|
|
9415
9777
|
}
|
|
9416
9778
|
|
|
9779
|
+
/* eslint-disable no-param-reassign */
|
|
9417
9780
|
const getElementIndex = currentTarget => +currentTarget.getAttribute('data-n');
|
|
9418
9781
|
const focusSearch = container => {
|
|
9419
9782
|
const searchField = container === null || container === void 0 ? void 0 : container.querySelector('.search input');
|
|
@@ -9574,7 +9937,6 @@ function getListboxInlineKeyboardNavigation(_ref2) {
|
|
|
9574
9937
|
let {
|
|
9575
9938
|
keyboard,
|
|
9576
9939
|
hovering,
|
|
9577
|
-
setHovering,
|
|
9578
9940
|
updateKeyScroll,
|
|
9579
9941
|
containerRef,
|
|
9580
9942
|
currentScrollIndex,
|
|
@@ -9605,81 +9967,44 @@ function getListboxInlineKeyboardNavigation(_ref2) {
|
|
|
9605
9967
|
// 3. Blur row and focus the listbox container.
|
|
9606
9968
|
keyboard.blur();
|
|
9607
9969
|
const c = currentTarget.closest('.listbox-container');
|
|
9608
|
-
c.setAttribute('tabIndex',
|
|
9970
|
+
c.setAttribute('tabIndex', -1);
|
|
9609
9971
|
c === null || c === void 0 ? void 0 : c.focus();
|
|
9610
9972
|
}
|
|
9611
9973
|
};
|
|
9612
|
-
const updateKeyScrollOnHover = newState => {
|
|
9613
|
-
if (hovering) {
|
|
9614
|
-
updateKeyScroll(newState);
|
|
9615
|
-
}
|
|
9616
|
-
};
|
|
9617
9974
|
const handleKeyDown = event => {
|
|
9618
9975
|
const {
|
|
9619
9976
|
keyCode,
|
|
9620
|
-
ctrlKey = false,
|
|
9621
9977
|
shiftKey = false
|
|
9622
9978
|
} = event.nativeEvent;
|
|
9623
9979
|
const prevent = () => {
|
|
9624
9980
|
event.stopPropagation();
|
|
9625
9981
|
event.preventDefault();
|
|
9626
9982
|
};
|
|
9627
|
-
switch (keyCode) {
|
|
9628
|
-
case KEYS.PAGE_UP:
|
|
9629
|
-
updateKeyScrollOnHover({
|
|
9630
|
-
up: currentScrollIndex.stop - currentScrollIndex.start
|
|
9631
|
-
});
|
|
9632
|
-
prevent();
|
|
9633
|
-
break;
|
|
9634
|
-
case KEYS.PAGE_DOWN:
|
|
9635
|
-
updateKeyScrollOnHover({
|
|
9636
|
-
down: currentScrollIndex.stop - currentScrollIndex.start
|
|
9637
|
-
});
|
|
9638
|
-
prevent();
|
|
9639
|
-
break;
|
|
9640
|
-
case KEYS.HOME:
|
|
9641
|
-
updateKeyScrollOnHover({
|
|
9642
|
-
scrollPosition: ctrlKey && shiftKey ? 'overflowStart' : 'start'
|
|
9643
|
-
});
|
|
9644
|
-
prevent();
|
|
9645
|
-
break;
|
|
9646
|
-
case KEYS.END:
|
|
9647
|
-
updateKeyScrollOnHover({
|
|
9648
|
-
scrollPosition: ctrlKey && shiftKey ? 'overflowEnd' : 'end'
|
|
9649
|
-
});
|
|
9650
|
-
prevent();
|
|
9651
|
-
break;
|
|
9652
|
-
case KEYS.ARROW_UP:
|
|
9653
|
-
updateKeyScrollOnHover({
|
|
9654
|
-
up: 1
|
|
9655
|
-
});
|
|
9656
|
-
prevent();
|
|
9657
|
-
break;
|
|
9658
|
-
case KEYS.ARROW_DOWN:
|
|
9659
|
-
updateKeyScrollOnHover({
|
|
9660
|
-
down: 1
|
|
9661
|
-
});
|
|
9662
|
-
prevent();
|
|
9663
|
-
break;
|
|
9664
|
-
}
|
|
9665
9983
|
if (!keyboard.enabled) {
|
|
9666
9984
|
// Other keys should not be handled unless keyboard is enabled.
|
|
9667
|
-
return
|
|
9985
|
+
return;
|
|
9668
9986
|
}
|
|
9669
9987
|
const container = event.currentTarget.closest('.listbox-container');
|
|
9988
|
+
const inSelection = isModal();
|
|
9670
9989
|
switch (keyCode) {
|
|
9671
9990
|
case KEYS.TAB:
|
|
9672
|
-
if (
|
|
9673
|
-
|
|
9991
|
+
if (inSelection) {
|
|
9992
|
+
if (shiftKey) {
|
|
9993
|
+
focusRow(container) || focusSearch(container);
|
|
9994
|
+
} else {
|
|
9995
|
+
focusSearch(container) || focusRow(container);
|
|
9996
|
+
}
|
|
9997
|
+
} else if (shiftKey) {
|
|
9998
|
+
keyboard.blur(true);
|
|
9674
9999
|
} else {
|
|
9675
|
-
|
|
10000
|
+
break;
|
|
9676
10001
|
}
|
|
9677
10002
|
prevent();
|
|
9678
10003
|
break;
|
|
9679
10004
|
case KEYS.ENTER:
|
|
9680
10005
|
case KEYS.SPACE:
|
|
9681
10006
|
if (!event.target.classList.contains('listbox-container')) {
|
|
9682
|
-
|
|
10007
|
+
break; // don't mess with keydown handlers within the listbox (e.g. row seletion)
|
|
9683
10008
|
}
|
|
9684
10009
|
|
|
9685
10010
|
keyboard.focus();
|
|
@@ -9687,13 +10012,53 @@ function getListboxInlineKeyboardNavigation(_ref2) {
|
|
|
9687
10012
|
break;
|
|
9688
10013
|
case KEYS.ESCAPE:
|
|
9689
10014
|
blur(event);
|
|
9690
|
-
prevent();
|
|
9691
10015
|
break;
|
|
9692
|
-
case KEYS.ARROW_LEFT:
|
|
9693
|
-
case KEYS.ARROW_RIGHT:
|
|
9694
|
-
return undefined;
|
|
9695
10016
|
}
|
|
9696
|
-
|
|
10017
|
+
};
|
|
10018
|
+
const globalKeyDown = event => {
|
|
10019
|
+
if (!hovering.current) {
|
|
10020
|
+
return;
|
|
10021
|
+
}
|
|
10022
|
+
const {
|
|
10023
|
+
keyCode,
|
|
10024
|
+
ctrlKey = false,
|
|
10025
|
+
shiftKey = false
|
|
10026
|
+
} = event;
|
|
10027
|
+
switch (keyCode) {
|
|
10028
|
+
case KEYS.ARROW_UP:
|
|
10029
|
+
updateKeyScroll({
|
|
10030
|
+
up: 1
|
|
10031
|
+
});
|
|
10032
|
+
break;
|
|
10033
|
+
case KEYS.ARROW_DOWN:
|
|
10034
|
+
updateKeyScroll({
|
|
10035
|
+
down: 1
|
|
10036
|
+
});
|
|
10037
|
+
break;
|
|
10038
|
+
case KEYS.PAGE_UP:
|
|
10039
|
+
updateKeyScroll({
|
|
10040
|
+
up: currentScrollIndex.stop - currentScrollIndex.start
|
|
10041
|
+
});
|
|
10042
|
+
break;
|
|
10043
|
+
case KEYS.PAGE_DOWN:
|
|
10044
|
+
updateKeyScroll({
|
|
10045
|
+
down: currentScrollIndex.stop - currentScrollIndex.start
|
|
10046
|
+
});
|
|
10047
|
+
break;
|
|
10048
|
+
case KEYS.HOME:
|
|
10049
|
+
updateKeyScroll({
|
|
10050
|
+
scrollPosition: ctrlKey && shiftKey ? 'overflowStart' : 'start'
|
|
10051
|
+
});
|
|
10052
|
+
break;
|
|
10053
|
+
case KEYS.END:
|
|
10054
|
+
updateKeyScroll({
|
|
10055
|
+
scrollPosition: ctrlKey && shiftKey ? 'overflowEnd' : 'end'
|
|
10056
|
+
});
|
|
10057
|
+
break;
|
|
10058
|
+
default:
|
|
10059
|
+
return;
|
|
10060
|
+
}
|
|
10061
|
+
event.preventDefault();
|
|
9697
10062
|
};
|
|
9698
10063
|
const focusOnHoverDisabled = () => {
|
|
9699
10064
|
const selectNotAllowed = (constraints === null || constraints === void 0 ? void 0 : constraints.select) || (constraints === null || constraints === void 0 ? void 0 : constraints.active);
|
|
@@ -9702,50 +10067,22 @@ function getListboxInlineKeyboardNavigation(_ref2) {
|
|
|
9702
10067
|
};
|
|
9703
10068
|
const handleOnMouseEnter = () => {
|
|
9704
10069
|
if (!focusOnHoverDisabled()) {
|
|
9705
|
-
|
|
9706
|
-
setHovering(true);
|
|
9707
|
-
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : (_containerRef$current2 = _containerRef$current.focus) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.call(_containerRef$current);
|
|
10070
|
+
hovering.current = true;
|
|
9708
10071
|
}
|
|
9709
10072
|
};
|
|
9710
10073
|
const handleOnMouseLeave = () => {
|
|
9711
|
-
if (hovering) {
|
|
9712
|
-
|
|
9713
|
-
setHovering(false);
|
|
9714
|
-
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : (_containerRef$current4 = _containerRef$current3.blur) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.call(_containerRef$current3);
|
|
10074
|
+
if (hovering.current) {
|
|
10075
|
+
hovering.current = false;
|
|
9715
10076
|
}
|
|
9716
10077
|
};
|
|
9717
10078
|
return {
|
|
9718
10079
|
handleKeyDown,
|
|
9719
10080
|
handleOnMouseEnter,
|
|
9720
|
-
handleOnMouseLeave
|
|
10081
|
+
handleOnMouseLeave,
|
|
10082
|
+
globalKeyDown
|
|
9721
10083
|
};
|
|
9722
10084
|
}
|
|
9723
10085
|
|
|
9724
|
-
const PREFIX$c = 'RowColumn';
|
|
9725
|
-
const rowColClasses = {
|
|
9726
|
-
row: "".concat(PREFIX$c, "-row"),
|
|
9727
|
-
rowBorderBottom: "".concat(PREFIX$c, "-rowBorderBottom"),
|
|
9728
|
-
column: "".concat(PREFIX$c, "-column"),
|
|
9729
|
-
fieldRoot: "".concat(PREFIX$c, "-fieldRoot"),
|
|
9730
|
-
cell: "".concat(PREFIX$c, "-cell"),
|
|
9731
|
-
labelText: "".concat(PREFIX$c, "-labelText"),
|
|
9732
|
-
labelDense: "".concat(PREFIX$c, "-labelDense"),
|
|
9733
|
-
highlighted: "".concat(PREFIX$c, "-highlighted"),
|
|
9734
|
-
checkboxLabel: "".concat(PREFIX$c, "-checkboxLabel"),
|
|
9735
|
-
icon: "".concat(PREFIX$c, "-icon"),
|
|
9736
|
-
S: "".concat(PREFIX$c, "-S"),
|
|
9737
|
-
XS: "".concat(PREFIX$c, "-XS"),
|
|
9738
|
-
A: "".concat(PREFIX$c, "-A"),
|
|
9739
|
-
X: "".concat(PREFIX$c, "-X"),
|
|
9740
|
-
frequencyCount: "".concat(PREFIX$c, "-frequencyCount"),
|
|
9741
|
-
barContainer: "".concat(PREFIX$c, "-barContainer"),
|
|
9742
|
-
bar: "".concat(PREFIX$c, "-bar"),
|
|
9743
|
-
barSelected: "".concat(PREFIX$c, "-barSelected"),
|
|
9744
|
-
barWithCheckbox: "".concat(PREFIX$c, "-barWithCheckbox"),
|
|
9745
|
-
barSelectedWithCheckbox: "".concat(PREFIX$c, "-barSelectedWithCheckbox"),
|
|
9746
|
-
excludedTextWithCheckbox: "".concat(PREFIX$c, "-excludedTextWithCheckbox")
|
|
9747
|
-
};
|
|
9748
|
-
|
|
9749
10086
|
const isExcluded = c => c ? c.qState === 'X' || c.qState === 'XS' || c.qState === 'XL' : null;
|
|
9750
10087
|
const isAlternative = c => c ? c.qState === 'A' : null;
|
|
9751
10088
|
const excludedOrAlternative = _ref => {
|
|
@@ -9838,7 +10175,7 @@ const ellipsis = {
|
|
|
9838
10175
|
const iconWidth = 24; // tick and lock icon width in px
|
|
9839
10176
|
|
|
9840
10177
|
const RowColRoot = styled$1('div', {
|
|
9841
|
-
shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth'].includes(prop)
|
|
10178
|
+
shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth', 'direction'].includes(prop)
|
|
9842
10179
|
})(_ref2 => {
|
|
9843
10180
|
var _theme$listBox$conten, _theme$listBox, _theme$listBox$conten2, _theme$listBox$conten3, _theme$listBox2, _theme$listBox2$conte, _theme$listBox3, _theme$listBox3$conte, _theme$listBox4, _theme$listBox4$conte;
|
|
9844
10181
|
let {
|
|
@@ -9847,7 +10184,8 @@ const RowColRoot = styled$1('div', {
|
|
|
9847
10184
|
isGridMode,
|
|
9848
10185
|
isGridCol,
|
|
9849
10186
|
dense,
|
|
9850
|
-
frequencyWidth
|
|
10187
|
+
frequencyWidth,
|
|
10188
|
+
direction
|
|
9851
10189
|
} = _ref2;
|
|
9852
10190
|
return {
|
|
9853
10191
|
'&:focus': {
|
|
@@ -9960,7 +10298,7 @@ const RowColRoot = styled$1('div', {
|
|
|
9960
10298
|
justifyContent: 'flex-end'
|
|
9961
10299
|
}, ellipsis), {}, {
|
|
9962
10300
|
flex: "0 1 ".concat(frequencyWidth, "px"),
|
|
9963
|
-
textAlign: 'right',
|
|
10301
|
+
textAlign: direction === 'rtl' ? 'left' : 'right',
|
|
9964
10302
|
paddingLeft: '2px'
|
|
9965
10303
|
}),
|
|
9966
10304
|
["&.".concat(rowColClasses.barContainer)]: {
|
|
@@ -9993,7 +10331,7 @@ const RowColRoot = styled$1('div', {
|
|
|
9993
10331
|
}
|
|
9994
10332
|
},
|
|
9995
10333
|
["& .".concat(rowColClasses.barWithCheckbox)]: {
|
|
9996
|
-
left: barWithCheckboxLeftPadPx,
|
|
10334
|
+
left: direction === 'rtl' ? barPadPx : barWithCheckboxLeftPadPx,
|
|
9997
10335
|
width: "calc(100% - ".concat(barWithCheckboxLeftPadPx + barPadPx, "px)")
|
|
9998
10336
|
},
|
|
9999
10337
|
["& .".concat(rowColClasses.barSelectedWithCheckbox)]: {
|
|
@@ -10439,21 +10777,23 @@ function getGridItemSizes(_ref) {
|
|
|
10439
10777
|
}
|
|
10440
10778
|
|
|
10441
10779
|
const ItemGrid = styled$1(Grid, {
|
|
10442
|
-
shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'cellPaddingRight'].includes(prop)
|
|
10780
|
+
shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'cellPaddingRight', 'direction'].includes(prop)
|
|
10443
10781
|
})(_ref => {
|
|
10444
10782
|
let {
|
|
10445
10783
|
dataLayout,
|
|
10446
10784
|
layoutOrder,
|
|
10447
10785
|
itemPadding,
|
|
10448
|
-
cellPaddingRight
|
|
10786
|
+
cellPaddingRight,
|
|
10787
|
+
direction
|
|
10449
10788
|
} = _ref;
|
|
10789
|
+
const att = "padding".concat(direction === 'rtl' ? 'Left' : 'Right');
|
|
10450
10790
|
return {
|
|
10451
10791
|
["&.".concat(rowColClasses.fieldRoot)]: _objectSpread2(_objectSpread2({}, getGridItemSizes({
|
|
10452
10792
|
dataLayout,
|
|
10453
10793
|
layoutOrder,
|
|
10454
10794
|
itemPadding
|
|
10455
10795
|
})), {}, {
|
|
10456
|
-
|
|
10796
|
+
[att]: cellPaddingRight ? '8px' : undefined
|
|
10457
10797
|
})
|
|
10458
10798
|
};
|
|
10459
10799
|
});
|
|
@@ -10562,6 +10902,8 @@ function RowColumn(_ref) {
|
|
|
10562
10902
|
onMouseDown,
|
|
10563
10903
|
onMouseUp,
|
|
10564
10904
|
onMouseEnter,
|
|
10905
|
+
onTouchStart,
|
|
10906
|
+
onTouchEnd,
|
|
10565
10907
|
pages,
|
|
10566
10908
|
isLocked,
|
|
10567
10909
|
column = false,
|
|
@@ -10720,6 +11062,7 @@ function RowColumn(_ref) {
|
|
|
10720
11062
|
isGridMode: dataLayout === 'grid',
|
|
10721
11063
|
dense: dense,
|
|
10722
11064
|
frequencyWidth: frequencyWidth,
|
|
11065
|
+
direction: direction,
|
|
10723
11066
|
"data-testid": "listbox.item"
|
|
10724
11067
|
}, /*#__PURE__*/React__default.createElement(ItemGrid, {
|
|
10725
11068
|
role: "row",
|
|
@@ -10743,9 +11086,12 @@ function RowColumn(_ref) {
|
|
|
10743
11086
|
onMouseUp: onMouseUp,
|
|
10744
11087
|
onMouseEnter: onMouseEnter,
|
|
10745
11088
|
onKeyDown: handleKeyDownCallback,
|
|
11089
|
+
onTouchStart: onTouchStart,
|
|
11090
|
+
onTouchEnd: onTouchEnd,
|
|
10746
11091
|
onContextMenu: preventContextMenu,
|
|
10747
11092
|
tabIndex: isFirstElement && keyboard.innerTabStops ? 0 : -1,
|
|
10748
|
-
"data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber
|
|
11093
|
+
"data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber,
|
|
11094
|
+
direction: direction
|
|
10749
11095
|
}, (cell === null || cell === void 0 ? void 0 : cell.qFrequency) && /*#__PURE__*/React__default.createElement(Histogram, {
|
|
10750
11096
|
qFrequency: cell === null || cell === void 0 ? void 0 : cell.qFrequency,
|
|
10751
11097
|
histogram: histogram,
|
|
@@ -13380,7 +13726,8 @@ function ListBox(_ref) {
|
|
|
13380
13726
|
selectionState,
|
|
13381
13727
|
selections,
|
|
13382
13728
|
checkboxes,
|
|
13383
|
-
doc: document
|
|
13729
|
+
doc: document,
|
|
13730
|
+
loaderRef
|
|
13384
13731
|
});
|
|
13385
13732
|
const {
|
|
13386
13733
|
layoutOptions = {}
|
|
@@ -13746,13 +14093,16 @@ const Item = React__default.forwardRef((_ref, ref) => {
|
|
|
13746
14093
|
} = useActionState(item);
|
|
13747
14094
|
if (hidden) return null;
|
|
13748
14095
|
const spacing = Number.parseInt(theme.spacing(0.5), 10);
|
|
13749
|
-
const
|
|
14096
|
+
const keyboardAction = item.keyboardAction || item.action;
|
|
14097
|
+
const handleKeyDown = keyboardAction ? e => ['Enter'].includes(e.key) && keyboardAction() : null;
|
|
14098
|
+
const handleKeyUp = keyboardAction ? e => [' ', 'Spacebar'].includes(e.key) && keyboardAction() : null;
|
|
13750
14099
|
const btnId = "actions-toolbar-".concat(item.key);
|
|
13751
14100
|
return /*#__PURE__*/React__default.createElement(IconButton, {
|
|
13752
14101
|
ref: !addAnchor ? ref : null,
|
|
13753
14102
|
title: item.label,
|
|
13754
14103
|
onClick: item.action,
|
|
13755
14104
|
onKeyDown: handleKeyDown,
|
|
14105
|
+
onKeyUp: handleKeyUp,
|
|
13756
14106
|
disabled: disabled,
|
|
13757
14107
|
style: style,
|
|
13758
14108
|
className: [ActionElement.className, btnId].join(' '),
|
|
@@ -13818,8 +14168,8 @@ function useDefaultSelectionActions(_ref) {
|
|
|
13818
14168
|
onCancel();
|
|
13819
14169
|
api.cancel();
|
|
13820
14170
|
},
|
|
13821
|
-
keyboardAction:
|
|
13822
|
-
onKeyDeactivate(
|
|
14171
|
+
keyboardAction: () => {
|
|
14172
|
+
onKeyDeactivate();
|
|
13823
14173
|
onCancel();
|
|
13824
14174
|
api.cancel();
|
|
13825
14175
|
},
|
|
@@ -13833,8 +14183,8 @@ function useDefaultSelectionActions(_ref) {
|
|
|
13833
14183
|
onConfirm();
|
|
13834
14184
|
api.confirm();
|
|
13835
14185
|
},
|
|
13836
|
-
keyboardAction:
|
|
13837
|
-
onKeyDeactivate(
|
|
14186
|
+
keyboardAction: () => {
|
|
14187
|
+
onKeyDeactivate();
|
|
13838
14188
|
onConfirm();
|
|
13839
14189
|
api.confirm();
|
|
13840
14190
|
},
|
|
@@ -13864,6 +14214,7 @@ const StyledPopover$1 = styled$1(Popover)(_ref => {
|
|
|
13864
14214
|
function MoreItem(_ref2) {
|
|
13865
14215
|
let {
|
|
13866
14216
|
item,
|
|
14217
|
+
autoFocus,
|
|
13867
14218
|
onActionClick = () => {}
|
|
13868
14219
|
} = _ref2;
|
|
13869
14220
|
const {
|
|
@@ -13876,6 +14227,7 @@ function MoreItem(_ref2) {
|
|
|
13876
14227
|
onActionClick();
|
|
13877
14228
|
};
|
|
13878
14229
|
return !hidden ? /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
14230
|
+
autoFocus: autoFocus,
|
|
13879
14231
|
title: item.label,
|
|
13880
14232
|
onClick: handleClick,
|
|
13881
14233
|
disabled: disabled,
|
|
@@ -13896,6 +14248,7 @@ const More$1 = React__default.forwardRef((_ref3, ref) => {
|
|
|
13896
14248
|
onCloseOrActionClick = () => {}
|
|
13897
14249
|
} = _ref3;
|
|
13898
14250
|
const showActions = actions.length > 0;
|
|
14251
|
+
const autoFocusIndex = actions.findIndex(action => !action.disabled);
|
|
13899
14252
|
return showActions && /*#__PURE__*/React__default.createElement(StyledPopover$1
|
|
13900
14253
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
13901
14254
|
, _extends$6({}, popoverProps, {
|
|
@@ -13935,6 +14288,7 @@ const More$1 = React__default.forwardRef((_ref3, ref) => {
|
|
|
13935
14288
|
React__default.createElement(MoreItem, {
|
|
13936
14289
|
key: ix,
|
|
13937
14290
|
item: item,
|
|
14291
|
+
autoFocus: ix === autoFocusIndex,
|
|
13938
14292
|
onActionClick: onCloseOrActionClick
|
|
13939
14293
|
}))));
|
|
13940
14294
|
});
|
|
@@ -13958,7 +14312,8 @@ function getActionsKeyDownHandler(_ref) {
|
|
|
13958
14312
|
let {
|
|
13959
14313
|
keyboardNavigation,
|
|
13960
14314
|
focusHandler,
|
|
13961
|
-
getEnabledButton
|
|
14315
|
+
getEnabledButton,
|
|
14316
|
+
selections
|
|
13962
14317
|
} = _ref;
|
|
13963
14318
|
const handleActionsKeyDown = evt => {
|
|
13964
14319
|
const {
|
|
@@ -13998,6 +14353,14 @@ function getActionsKeyDownHandler(_ref) {
|
|
|
13998
14353
|
}
|
|
13999
14354
|
}
|
|
14000
14355
|
break;
|
|
14356
|
+
case KEYS.ESCAPE:
|
|
14357
|
+
if (selections) {
|
|
14358
|
+
selections.onCancel();
|
|
14359
|
+
selections.api.cancel();
|
|
14360
|
+
evt.preventDefault();
|
|
14361
|
+
evt.stopPropagation();
|
|
14362
|
+
}
|
|
14363
|
+
break;
|
|
14001
14364
|
}
|
|
14002
14365
|
};
|
|
14003
14366
|
return handleActionsKeyDown;
|
|
@@ -14139,8 +14502,9 @@ function ActionsToolbar(_ref3) {
|
|
|
14139
14502
|
const handleActionsKeyDown = useMemo$1(() => getActionsKeyDownHandler({
|
|
14140
14503
|
keyboardNavigation,
|
|
14141
14504
|
focusHandler,
|
|
14142
|
-
getEnabledButton
|
|
14143
|
-
|
|
14505
|
+
getEnabledButton,
|
|
14506
|
+
selections
|
|
14507
|
+
}), [keyboardNavigation, focusHandler, getEnabledButton, selections]);
|
|
14144
14508
|
useEffect$1(() => () => {
|
|
14145
14509
|
setShowMoreItems(false);
|
|
14146
14510
|
}, [popover.show, show, selections.show]);
|
|
@@ -16335,22 +16699,24 @@ function showToolbarDetached(_ref) {
|
|
|
16335
16699
|
const actionToolbarWidth = 128;
|
|
16336
16700
|
const notSufficientSpace = containerWidth < contentWidth + actionToolbarWidth;
|
|
16337
16701
|
const isTruncated = (titleRef === null || titleRef === void 0 ? void 0 : (_titleRef$current2 = titleRef.current) === null || _titleRef$current2 === void 0 ? void 0 : _titleRef$current2.scrollWidth) > (titleRef === null || titleRef === void 0 ? void 0 : (_titleRef$current3 = titleRef.current) === null || _titleRef$current3 === void 0 ? void 0 : _titleRef$current3.offsetWidth);
|
|
16338
|
-
|
|
16702
|
+
const isDetached = !!(notSufficientSpace | isTruncated);
|
|
16703
|
+
return isDetached;
|
|
16339
16704
|
}
|
|
16340
16705
|
|
|
16341
16706
|
function getListboxActionProps(_ref) {
|
|
16342
16707
|
let {
|
|
16343
|
-
|
|
16708
|
+
isDetached,
|
|
16344
16709
|
showToolbar,
|
|
16345
16710
|
containerRef,
|
|
16346
16711
|
isLocked,
|
|
16347
16712
|
listboxSelectionToolbarItems,
|
|
16348
|
-
selections
|
|
16713
|
+
selections,
|
|
16714
|
+
keyboard
|
|
16349
16715
|
} = _ref;
|
|
16350
16716
|
return {
|
|
16351
|
-
show: showToolbar && !
|
|
16717
|
+
show: showToolbar && !isDetached,
|
|
16352
16718
|
popover: {
|
|
16353
|
-
show: showToolbar &&
|
|
16719
|
+
show: showToolbar && isDetached,
|
|
16354
16720
|
anchorEl: containerRef.current
|
|
16355
16721
|
},
|
|
16356
16722
|
more: {
|
|
@@ -16367,8 +16733,12 @@ function getListboxActionProps(_ref) {
|
|
|
16367
16733
|
selections: {
|
|
16368
16734
|
show: showToolbar,
|
|
16369
16735
|
api: selections,
|
|
16370
|
-
onConfirm: () => {
|
|
16371
|
-
|
|
16736
|
+
onConfirm: () => {
|
|
16737
|
+
keyboard === null || keyboard === void 0 ? void 0 : keyboard.focus();
|
|
16738
|
+
},
|
|
16739
|
+
onCancel: () => {
|
|
16740
|
+
keyboard === null || keyboard === void 0 ? void 0 : keyboard.focus();
|
|
16741
|
+
}
|
|
16372
16742
|
}
|
|
16373
16743
|
};
|
|
16374
16744
|
}
|
|
@@ -16397,20 +16767,18 @@ const classes$4 = {
|
|
|
16397
16767
|
listboxWrapper: "".concat(PREFIX$4, "-listboxWrapper")
|
|
16398
16768
|
};
|
|
16399
16769
|
const StyledGrid$3 = styled$1(Grid, {
|
|
16400
|
-
shouldForwardProp: p => !['containerPadding'
|
|
16770
|
+
shouldForwardProp: p => !['containerPadding'].includes(p)
|
|
16401
16771
|
})(_ref => {
|
|
16402
16772
|
var _theme$listBox$backgr, _theme$listBox;
|
|
16403
16773
|
let {
|
|
16404
16774
|
theme,
|
|
16405
|
-
containerPadding
|
|
16406
|
-
hasIcon
|
|
16775
|
+
containerPadding
|
|
16407
16776
|
} = _ref;
|
|
16408
16777
|
return {
|
|
16409
16778
|
backgroundColor: (_theme$listBox$backgr = (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.backgroundColor) !== null && _theme$listBox$backgr !== void 0 ? _theme$listBox$backgr : theme.palette.background.default,
|
|
16410
16779
|
["& .".concat(classes$4.listBoxHeader)]: {
|
|
16411
16780
|
alignSelf: 'center',
|
|
16412
|
-
display: 'flex'
|
|
16413
|
-
width: "calc(100% - ".concat(hasIcon ? BUTTON_ICON_WIDTH : 0, "px)")
|
|
16781
|
+
display: 'flex'
|
|
16414
16782
|
},
|
|
16415
16783
|
["& .".concat(classes$4.screenReaderOnly)]: {
|
|
16416
16784
|
position: 'absolute',
|
|
@@ -16421,7 +16789,7 @@ const StyledGrid$3 = styled$1(Grid, {
|
|
|
16421
16789
|
["& .".concat(classes$4.listboxWrapper)]: {
|
|
16422
16790
|
padding: containerPadding
|
|
16423
16791
|
},
|
|
16424
|
-
'&:focus
|
|
16792
|
+
'&:focus': {
|
|
16425
16793
|
boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
|
|
16426
16794
|
},
|
|
16427
16795
|
'&:focus-visible': {
|
|
@@ -16473,7 +16841,8 @@ function ListBoxInline(_ref4) {
|
|
|
16473
16841
|
showGray = true,
|
|
16474
16842
|
scrollState = undefined,
|
|
16475
16843
|
renderedCallback,
|
|
16476
|
-
toolbar = true
|
|
16844
|
+
toolbar = true,
|
|
16845
|
+
isPopover = false
|
|
16477
16846
|
} = options;
|
|
16478
16847
|
|
|
16479
16848
|
// Hook that will trigger update when used in useEffects.
|
|
@@ -16502,7 +16871,7 @@ function ListBoxInline(_ref4) {
|
|
|
16502
16871
|
const [searchContainer, searchContainerRef] = useRefWithCallback();
|
|
16503
16872
|
const [showToolbar, setShowToolbar] = useState$1(false);
|
|
16504
16873
|
const [showSearch, setShowSearch] = useState$1(false);
|
|
16505
|
-
const
|
|
16874
|
+
const hovering = useRef(false);
|
|
16506
16875
|
const [keyScroll, setKeyScroll] = useState$1({
|
|
16507
16876
|
down: 0,
|
|
16508
16877
|
up: 0,
|
|
@@ -16529,11 +16898,11 @@ function ListBoxInline(_ref4) {
|
|
|
16529
16898
|
const {
|
|
16530
16899
|
handleKeyDown,
|
|
16531
16900
|
handleOnMouseEnter,
|
|
16532
|
-
handleOnMouseLeave
|
|
16533
|
-
|
|
16901
|
+
handleOnMouseLeave,
|
|
16902
|
+
globalKeyDown
|
|
16903
|
+
} = useMemo$1(() => getListboxInlineKeyboardNavigation({
|
|
16534
16904
|
keyboard,
|
|
16535
16905
|
hovering,
|
|
16536
|
-
setHovering,
|
|
16537
16906
|
updateKeyScroll,
|
|
16538
16907
|
containerRef,
|
|
16539
16908
|
currentScrollIndex,
|
|
@@ -16541,9 +16910,15 @@ function ListBoxInline(_ref4) {
|
|
|
16541
16910
|
appSelections,
|
|
16542
16911
|
constraints,
|
|
16543
16912
|
isModal: isModalMode
|
|
16544
|
-
});
|
|
16545
|
-
const showDetachedToolbarOnly = toolbar && ((layout === null || layout === void 0 ? void 0 : layout.title) === '' || (layout === null || layout === void 0 ? void 0 : layout.showTitle) === false);
|
|
16546
|
-
const showToolbarWithTitle = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '' && (layout === null || layout === void 0 ? void 0 : layout.showTitle) !== false;
|
|
16913
|
+
}), [keyboard, hovering, updateKeyScroll, containerRef, currentScrollIndex, app, appSelections, constraints, isModalMode]);
|
|
16914
|
+
const showDetachedToolbarOnly = toolbar && ((layout === null || layout === void 0 ? void 0 : layout.title) === '' || (layout === null || layout === void 0 ? void 0 : layout.showTitle) === false) && !isPopover;
|
|
16915
|
+
const showToolbarWithTitle = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '' && (layout === null || layout === void 0 ? void 0 : layout.showTitle) !== false || isPopover;
|
|
16916
|
+
useEffect$1(() => {
|
|
16917
|
+
document.addEventListener('keydown', globalKeyDown);
|
|
16918
|
+
return () => {
|
|
16919
|
+
document.removeEventListener('keydown', globalKeyDown);
|
|
16920
|
+
};
|
|
16921
|
+
}, [globalKeyDown]);
|
|
16547
16922
|
useEffect$1(() => {
|
|
16548
16923
|
const show = () => {
|
|
16549
16924
|
setShowToolbar(true);
|
|
@@ -16554,6 +16929,14 @@ function ListBoxInline(_ref4) {
|
|
|
16554
16929
|
setShowSearch(false);
|
|
16555
16930
|
}
|
|
16556
16931
|
};
|
|
16932
|
+
if (isPopover) {
|
|
16933
|
+
if (!selections.isActive()) {
|
|
16934
|
+
selections.begin('/qListObjectDef');
|
|
16935
|
+
selections.on('activated', show);
|
|
16936
|
+
selections.on('deactivated', hide);
|
|
16937
|
+
}
|
|
16938
|
+
setShowToolbar(isPopover);
|
|
16939
|
+
}
|
|
16557
16940
|
if (selections) {
|
|
16558
16941
|
if (!selections.isModal()) {
|
|
16559
16942
|
selections.on('activated', show);
|
|
@@ -16567,7 +16950,7 @@ function ListBoxInline(_ref4) {
|
|
|
16567
16950
|
selections.removeListener('deactivated', hide);
|
|
16568
16951
|
}
|
|
16569
16952
|
};
|
|
16570
|
-
}, [selections]);
|
|
16953
|
+
}, [selections, isPopover]);
|
|
16571
16954
|
useEffect$1(() => {
|
|
16572
16955
|
if (!searchContainer || !searchContainer.current) {
|
|
16573
16956
|
return;
|
|
@@ -16615,13 +16998,14 @@ function ListBoxInline(_ref4) {
|
|
|
16615
16998
|
input === null || input === void 0 ? void 0 : input.focus();
|
|
16616
16999
|
}
|
|
16617
17000
|
};
|
|
16618
|
-
const getActionToolbarProps =
|
|
16619
|
-
isPopover,
|
|
17001
|
+
const getActionToolbarProps = isDetached => getListboxActionProps({
|
|
17002
|
+
isDetached: isPopover ? false : isDetached,
|
|
16620
17003
|
showToolbar,
|
|
16621
17004
|
containerRef,
|
|
16622
17005
|
isLocked,
|
|
16623
17006
|
listboxSelectionToolbarItems,
|
|
16624
|
-
selections
|
|
17007
|
+
selections,
|
|
17008
|
+
keyboard
|
|
16625
17009
|
});
|
|
16626
17010
|
const shouldAutoFocus = searchVisible && search === 'toggle';
|
|
16627
17011
|
const showSearchIcon = searchEnabled !== false && search === 'toggle';
|
|
@@ -16630,6 +17014,11 @@ function ListBoxInline(_ref4) {
|
|
|
16630
17014
|
const iconsWidth = (showSearchOrLockIcon ? BUTTON_ICON_WIDTH : 0) + (isDrillDown ? ICON_WIDTH + ICON_PADDING : 0); // Drill-down icon needs padding right so there is space between the icon and the title
|
|
16631
17015
|
const headerPaddingLeft = CELL_PADDING_LEFT - (showSearchOrLockIcon ? ICON_PADDING : 0);
|
|
16632
17016
|
const headerPaddingRight = isRtl ? CELL_PADDING_LEFT - (showIcons ? ICON_PADDING : 0) : 0;
|
|
17017
|
+
const isDetached = showToolbarDetached({
|
|
17018
|
+
containerRef,
|
|
17019
|
+
titleRef,
|
|
17020
|
+
iconsWidth
|
|
17021
|
+
});
|
|
16633
17022
|
|
|
16634
17023
|
// Add a container padding for grid mode to harmonize with the grid item margins (should sum to 8px).
|
|
16635
17024
|
const isGridMode = (layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.dataLayout) === 'grid';
|
|
@@ -16678,7 +17067,7 @@ function ListBoxInline(_ref4) {
|
|
|
16678
17067
|
}, getActionToolbarProps(true))), /*#__PURE__*/React__default.createElement(StyledGrid$3, {
|
|
16679
17068
|
className: "listbox-container",
|
|
16680
17069
|
container: true,
|
|
16681
|
-
tabIndex: keyboard.
|
|
17070
|
+
tabIndex: keyboard.enabled ? -1 : undefined,
|
|
16682
17071
|
direction: "column",
|
|
16683
17072
|
gap: 0,
|
|
16684
17073
|
containerPadding: containerPadding,
|
|
@@ -16690,35 +17079,21 @@ function ListBoxInline(_ref4) {
|
|
|
16690
17079
|
onKeyDown: handleKeyDown,
|
|
16691
17080
|
onMouseEnter: handleOnMouseEnter,
|
|
16692
17081
|
onMouseLeave: handleOnMouseLeave,
|
|
16693
|
-
ref: containerRef
|
|
16694
|
-
hasIcon: showIcons
|
|
17082
|
+
ref: containerRef
|
|
16695
17083
|
}, showToolbarWithTitle && /*#__PURE__*/React__default.createElement(Grid, {
|
|
16696
17084
|
item: true,
|
|
16697
17085
|
container: true,
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
|
|
16702
|
-
|
|
16703
|
-
sx: {
|
|
16704
|
-
flexDirection: isRtl ? 'row-reverse' : 'row'
|
|
16705
|
-
},
|
|
16706
|
-
wrap: "nowrap"
|
|
16707
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
16708
|
-
item: true,
|
|
16709
|
-
container: true,
|
|
16710
|
-
height: headerHeight,
|
|
16711
|
-
sx: {
|
|
16712
|
-
flexDirection: isRtl ? 'row-reverse' : 'row'
|
|
16713
|
-
},
|
|
17086
|
+
minHeight: headerHeight,
|
|
17087
|
+
flexDirection: isRtl ? 'row-reverse' : 'row',
|
|
17088
|
+
marginY: 1,
|
|
17089
|
+
paddingLeft: "".concat(headerPaddingLeft, "px"),
|
|
17090
|
+
paddingRight: "".concat(headerPaddingRight, "px"),
|
|
16714
17091
|
wrap: "nowrap"
|
|
16715
17092
|
}, showIcons && /*#__PURE__*/React__default.createElement(Grid, {
|
|
16716
17093
|
item: true,
|
|
16717
|
-
|
|
16718
|
-
|
|
16719
|
-
|
|
16720
|
-
width: iconsWidth
|
|
16721
|
-
}
|
|
17094
|
+
container: true,
|
|
17095
|
+
alignItems: "center",
|
|
17096
|
+
width: iconsWidth
|
|
16722
17097
|
}, isLocked ? lockIconComp : showSearchIcon && searchIconComp, isDrillDown && /*#__PURE__*/React__default.createElement(DrillDownIcon, {
|
|
16723
17098
|
tabIndex: -1,
|
|
16724
17099
|
title: translator.get('Listbox.DrillDown'),
|
|
@@ -16728,27 +17103,21 @@ function ListBoxInline(_ref4) {
|
|
|
16728
17103
|
}
|
|
16729
17104
|
})), /*#__PURE__*/React__default.createElement(Grid, {
|
|
16730
17105
|
item: true,
|
|
16731
|
-
|
|
16732
|
-
|
|
16733
|
-
|
|
17106
|
+
xs: true,
|
|
17107
|
+
minWidth: 0 // needed to text-overflow see: https://css-tricks.com/flexbox-truncated-text/
|
|
17108
|
+
,
|
|
17109
|
+
justifyContent: isRtl ? 'flex-end' : 'flex-start',
|
|
16734
17110
|
className: classes$4.listBoxHeader
|
|
16735
17111
|
}, /*#__PURE__*/React__default.createElement(Title, {
|
|
16736
17112
|
variant: "h6",
|
|
16737
17113
|
noWrap: true,
|
|
16738
17114
|
ref: titleRef,
|
|
16739
17115
|
title: layout.title
|
|
16740
|
-
}, layout.title))
|
|
16741
|
-
item: true,
|
|
16742
|
-
xs: true
|
|
16743
|
-
}), /*#__PURE__*/React__default.createElement(Grid, {
|
|
17116
|
+
}, layout.title)), /*#__PURE__*/React__default.createElement(Grid, {
|
|
16744
17117
|
item: true
|
|
16745
17118
|
}, /*#__PURE__*/React__default.createElement(ActionsToolbar, _extends$6({
|
|
16746
17119
|
direction: direction
|
|
16747
|
-
}, getActionToolbarProps(
|
|
16748
|
-
containerRef,
|
|
16749
|
-
titleRef,
|
|
16750
|
-
iconsWidth
|
|
16751
|
-
})))))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
17120
|
+
}, getActionToolbarProps(isDetached))))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
16752
17121
|
item: true,
|
|
16753
17122
|
container: true,
|
|
16754
17123
|
direction: "column",
|
|
@@ -19844,7 +20213,7 @@ function viz() {
|
|
|
19844
20213
|
id: model.id,
|
|
19845
20214
|
/**
|
|
19846
20215
|
* This visualizations Enigma model, a representation of the generic object.
|
|
19847
|
-
* @type {
|
|
20216
|
+
* @type {EngineAPI.IGenericObject}
|
|
19848
20217
|
*/
|
|
19849
20218
|
model,
|
|
19850
20219
|
/**
|
|
@@ -19993,14 +20362,17 @@ async function init(model, optional, halo, initialError) {
|
|
|
19993
20362
|
*/
|
|
19994
20363
|
|
|
19995
20364
|
/**
|
|
19996
|
-
* @interface
|
|
19997
|
-
* @description
|
|
19998
|
-
* @
|
|
19999
|
-
* @property {
|
|
20000
|
-
* @property {
|
|
20001
|
-
* @property {
|
|
20002
|
-
* @property {
|
|
20003
|
-
* @property {
|
|
20365
|
+
* @interface RenderConfig
|
|
20366
|
+
* @description Configuration for rendering a visualisation, either creating or fetching an existing object.
|
|
20367
|
+
* @property {HTMLElement} element Target html element to render in to
|
|
20368
|
+
* @property {object=} options Options passed into the visualisation
|
|
20369
|
+
* @property {Plugin[]} [plugins] plugins passed into the visualisation
|
|
20370
|
+
* @property {string=} id For existing objects: Engine identifier of object to render
|
|
20371
|
+
* @property {string=} type For creating objects: Type of visualisation to render
|
|
20372
|
+
* @property {string=} version For creating objects: Version of visualization to render
|
|
20373
|
+
* @property {(Field[])=} fields For creating objects: Data fields to use
|
|
20374
|
+
* @property {boolean=} [extendProperties=false] For creating objects: Whether to deeply extend properties or not. If false then subtrees will be overwritten.
|
|
20375
|
+
* @property {EngineAPI.IGenericObjectProperties=} properties For creating objects: Explicit properties to set
|
|
20004
20376
|
* @example
|
|
20005
20377
|
* // A config for Creating objects:
|
|
20006
20378
|
* const createConfig = {
|
|
@@ -20015,6 +20387,12 @@ async function init(model, optional, halo, initialError) {
|
|
|
20015
20387
|
* }
|
|
20016
20388
|
* };
|
|
20017
20389
|
* nebbie.render(createConfig);
|
|
20390
|
+
* // A config for rendering an existing object:
|
|
20391
|
+
* const createConfig = {
|
|
20392
|
+
* id: 'jG5LP',
|
|
20393
|
+
* element: document.querySelector('.line'),
|
|
20394
|
+
* };
|
|
20395
|
+
* nebbie.render(createConfig);
|
|
20018
20396
|
*/
|
|
20019
20397
|
async function createSessionObject(_ref, halo) {
|
|
20020
20398
|
let {
|
|
@@ -20073,6 +20451,71 @@ async function createSessionObject(_ref, halo) {
|
|
|
20073
20451
|
}, halo, error, onDestroy);
|
|
20074
20452
|
}
|
|
20075
20453
|
|
|
20454
|
+
/**
|
|
20455
|
+
* @typedef {string | EngineAPI.INxDimension | EngineAPI.INxMeasure | LibraryField} Field
|
|
20456
|
+
*/
|
|
20457
|
+
|
|
20458
|
+
/**
|
|
20459
|
+
* @interface CreateConfig
|
|
20460
|
+
* @description Rendering configuration for creating and rendering a new object
|
|
20461
|
+
* @property {string} type
|
|
20462
|
+
* @property {string=} version
|
|
20463
|
+
* @property {(Field[])=} fields
|
|
20464
|
+
* @property {EngineAPI.IGenericObjectProperties=} properties
|
|
20465
|
+
*/
|
|
20466
|
+
|
|
20467
|
+
async function createObject(_ref, halo, generateOnly) {
|
|
20468
|
+
let {
|
|
20469
|
+
type,
|
|
20470
|
+
version,
|
|
20471
|
+
fields,
|
|
20472
|
+
properties,
|
|
20473
|
+
extendProperties /* , options, plugins, element */
|
|
20474
|
+
} = _ref;
|
|
20475
|
+
let mergedProps = {};
|
|
20476
|
+
// let error;
|
|
20477
|
+
try {
|
|
20478
|
+
const t = halo.types.get({
|
|
20479
|
+
name: type,
|
|
20480
|
+
version
|
|
20481
|
+
});
|
|
20482
|
+
mergedProps = await t.initialProperties(properties, extendProperties);
|
|
20483
|
+
const sn = await t.supernova();
|
|
20484
|
+
if (fields) {
|
|
20485
|
+
populateData({
|
|
20486
|
+
sn,
|
|
20487
|
+
properties: mergedProps,
|
|
20488
|
+
fields
|
|
20489
|
+
}, halo);
|
|
20490
|
+
}
|
|
20491
|
+
if (properties && sn && sn.qae.properties.onChange) {
|
|
20492
|
+
sn.qae.properties.onChange.call({}, mergedProps);
|
|
20493
|
+
}
|
|
20494
|
+
} catch (e) {
|
|
20495
|
+
// error = e;
|
|
20496
|
+
// minimal dummy object properties to allow it to be created
|
|
20497
|
+
// and rendered with the error
|
|
20498
|
+
if (!generateOnly) {
|
|
20499
|
+
mergedProps = {
|
|
20500
|
+
qInfo: {
|
|
20501
|
+
qType: type
|
|
20502
|
+
},
|
|
20503
|
+
visualization: type
|
|
20504
|
+
};
|
|
20505
|
+
} else {
|
|
20506
|
+
mergedProps = null;
|
|
20507
|
+
}
|
|
20508
|
+
// console.error(e); // eslint-disable-line
|
|
20509
|
+
}
|
|
20510
|
+
|
|
20511
|
+
if (!generateOnly) {
|
|
20512
|
+
const model = await halo.app.createObject(mergedProps);
|
|
20513
|
+
modelStore.set(model.id, model);
|
|
20514
|
+
return model;
|
|
20515
|
+
}
|
|
20516
|
+
return mergedProps;
|
|
20517
|
+
}
|
|
20518
|
+
|
|
20076
20519
|
async function getObject$1(_ref, halo) {
|
|
20077
20520
|
let {
|
|
20078
20521
|
id,
|
|
@@ -20417,21 +20860,6 @@ async function initSheet(model, optional, halo, initialError) {
|
|
|
20417
20860
|
return api;
|
|
20418
20861
|
}
|
|
20419
20862
|
|
|
20420
|
-
/**
|
|
20421
|
-
* @interface BaseConfig
|
|
20422
|
-
* @description Basic rendering configuration for rendering an object
|
|
20423
|
-
* @property {HTMLElement} element
|
|
20424
|
-
* @property {object=} options
|
|
20425
|
-
* @property {Plugin[]} [plugins]
|
|
20426
|
-
*/
|
|
20427
|
-
|
|
20428
|
-
/**
|
|
20429
|
-
* @interface GetConfig
|
|
20430
|
-
* @description Rendering configuration for rendering an existing object
|
|
20431
|
-
* @extends BaseConfig
|
|
20432
|
-
* @property {string} id
|
|
20433
|
-
*/
|
|
20434
|
-
|
|
20435
20863
|
async function getObject(_ref, halo) {
|
|
20436
20864
|
let {
|
|
20437
20865
|
id,
|
|
@@ -21871,7 +22299,6 @@ function onTakeSnapshot(cb) {
|
|
|
21871
22299
|
* @ignore
|
|
21872
22300
|
* @example
|
|
21873
22301
|
* import { onContextMenu } from '@nebula.js/stardust';
|
|
21874
|
-
|
|
21875
22302
|
* onContextMenu((menu, event) => {
|
|
21876
22303
|
* menu.addItem(item, index);
|
|
21877
22304
|
* });
|
|
@@ -22631,1603 +23058,1350 @@ var semver = {
|
|
|
22631
23058
|
};
|
|
22632
23059
|
|
|
22633
23060
|
(function (module, exports) {
|
|
22634
|
-
|
|
22635
|
-
|
|
22636
|
-
|
|
22637
|
-
|
|
22638
|
-
|
|
22639
|
-
|
|
22640
|
-
|
|
22641
|
-
|
|
22642
|
-
|
|
22643
|
-
|
|
22644
|
-
|
|
22645
|
-
|
|
22646
|
-
};
|
|
22647
|
-
} else {
|
|
22648
|
-
debug = function () {};
|
|
22649
|
-
}
|
|
22650
|
-
|
|
22651
|
-
// Note: this is the semver.org version of the spec that it implements
|
|
22652
|
-
// Not necessarily the package version of this code.
|
|
22653
|
-
exports.SEMVER_SPEC_VERSION = '2.0.0';
|
|
22654
|
-
|
|
22655
|
-
var MAX_LENGTH = 256;
|
|
22656
|
-
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
|
22657
|
-
/* istanbul ignore next */ 9007199254740991;
|
|
22658
|
-
|
|
22659
|
-
// Max safe segment length for coercion.
|
|
22660
|
-
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
22661
|
-
|
|
22662
|
-
// The actual regexps go on exports.re
|
|
22663
|
-
var re = exports.re = [];
|
|
22664
|
-
var src = exports.src = [];
|
|
22665
|
-
var t = exports.tokens = {};
|
|
22666
|
-
var R = 0;
|
|
22667
|
-
|
|
22668
|
-
function tok (n) {
|
|
22669
|
-
t[n] = R++;
|
|
22670
|
-
}
|
|
22671
|
-
|
|
22672
|
-
// The following Regular Expressions can be used for tokenizing,
|
|
22673
|
-
// validating, and parsing SemVer version strings.
|
|
22674
|
-
|
|
22675
|
-
// ## Numeric Identifier
|
|
22676
|
-
// A single `0`, or a non-zero digit followed by zero or more digits.
|
|
22677
|
-
|
|
22678
|
-
tok('NUMERICIDENTIFIER');
|
|
22679
|
-
src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*';
|
|
22680
|
-
tok('NUMERICIDENTIFIERLOOSE');
|
|
22681
|
-
src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+';
|
|
22682
|
-
|
|
22683
|
-
// ## Non-numeric Identifier
|
|
22684
|
-
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
|
22685
|
-
// more letters, digits, or hyphens.
|
|
22686
|
-
|
|
22687
|
-
tok('NONNUMERICIDENTIFIER');
|
|
22688
|
-
src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
|
|
22689
|
-
|
|
22690
|
-
// ## Main Version
|
|
22691
|
-
// Three dot-separated numeric identifiers.
|
|
22692
|
-
|
|
22693
|
-
tok('MAINVERSION');
|
|
22694
|
-
src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
|
|
22695
|
-
'(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
|
|
22696
|
-
'(' + src[t.NUMERICIDENTIFIER] + ')';
|
|
22697
|
-
|
|
22698
|
-
tok('MAINVERSIONLOOSE');
|
|
22699
|
-
src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
|
22700
|
-
'(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
|
22701
|
-
'(' + src[t.NUMERICIDENTIFIERLOOSE] + ')';
|
|
22702
|
-
|
|
22703
|
-
// ## Pre-release Version Identifier
|
|
22704
|
-
// A numeric identifier, or a non-numeric identifier.
|
|
22705
|
-
|
|
22706
|
-
tok('PRERELEASEIDENTIFIER');
|
|
22707
|
-
src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] +
|
|
22708
|
-
'|' + src[t.NONNUMERICIDENTIFIER] + ')';
|
|
22709
|
-
|
|
22710
|
-
tok('PRERELEASEIDENTIFIERLOOSE');
|
|
22711
|
-
src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] +
|
|
22712
|
-
'|' + src[t.NONNUMERICIDENTIFIER] + ')';
|
|
22713
|
-
|
|
22714
|
-
// ## Pre-release Version
|
|
22715
|
-
// Hyphen, followed by one or more dot-separated pre-release version
|
|
22716
|
-
// identifiers.
|
|
22717
|
-
|
|
22718
|
-
tok('PRERELEASE');
|
|
22719
|
-
src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] +
|
|
22720
|
-
'(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))';
|
|
22721
|
-
|
|
22722
|
-
tok('PRERELEASELOOSE');
|
|
22723
|
-
src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +
|
|
22724
|
-
'(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))';
|
|
22725
|
-
|
|
22726
|
-
// ## Build Metadata Identifier
|
|
22727
|
-
// Any combination of digits, letters, or hyphens.
|
|
22728
|
-
|
|
22729
|
-
tok('BUILDIDENTIFIER');
|
|
22730
|
-
src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
|
|
22731
|
-
|
|
22732
|
-
// ## Build Metadata
|
|
22733
|
-
// Plus sign, followed by one or more period-separated build metadata
|
|
22734
|
-
// identifiers.
|
|
22735
|
-
|
|
22736
|
-
tok('BUILD');
|
|
22737
|
-
src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] +
|
|
22738
|
-
'(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))';
|
|
22739
|
-
|
|
22740
|
-
// ## Full Version String
|
|
22741
|
-
// A main version, followed optionally by a pre-release version and
|
|
22742
|
-
// build metadata.
|
|
22743
|
-
|
|
22744
|
-
// Note that the only major, minor, patch, and pre-release sections of
|
|
22745
|
-
// the version string are capturing groups. The build metadata is not a
|
|
22746
|
-
// capturing group, because it should not ever be used in version
|
|
22747
|
-
// comparison.
|
|
22748
|
-
|
|
22749
|
-
tok('FULL');
|
|
22750
|
-
tok('FULLPLAIN');
|
|
22751
|
-
src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] +
|
|
22752
|
-
src[t.PRERELEASE] + '?' +
|
|
22753
|
-
src[t.BUILD] + '?';
|
|
22754
|
-
|
|
22755
|
-
src[t.FULL] = '^' + src[t.FULLPLAIN] + '$';
|
|
22756
|
-
|
|
22757
|
-
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
|
22758
|
-
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
|
22759
|
-
// common in the npm registry.
|
|
22760
|
-
tok('LOOSEPLAIN');
|
|
22761
|
-
src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] +
|
|
22762
|
-
src[t.PRERELEASELOOSE] + '?' +
|
|
22763
|
-
src[t.BUILD] + '?';
|
|
22764
|
-
|
|
22765
|
-
tok('LOOSE');
|
|
22766
|
-
src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$';
|
|
22767
|
-
|
|
22768
|
-
tok('GTLT');
|
|
22769
|
-
src[t.GTLT] = '((?:<|>)?=?)';
|
|
22770
|
-
|
|
22771
|
-
// Something like "2.*" or "1.2.x".
|
|
22772
|
-
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
|
22773
|
-
// Only the first item is strictly required.
|
|
22774
|
-
tok('XRANGEIDENTIFIERLOOSE');
|
|
22775
|
-
src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
|
|
22776
|
-
tok('XRANGEIDENTIFIER');
|
|
22777
|
-
src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*';
|
|
22778
|
-
|
|
22779
|
-
tok('XRANGEPLAIN');
|
|
22780
|
-
src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' +
|
|
22781
|
-
'(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
|
|
22782
|
-
'(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
|
|
22783
|
-
'(?:' + src[t.PRERELEASE] + ')?' +
|
|
22784
|
-
src[t.BUILD] + '?' +
|
|
22785
|
-
')?)?';
|
|
22786
|
-
|
|
22787
|
-
tok('XRANGEPLAINLOOSE');
|
|
22788
|
-
src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
|
22789
|
-
'(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
|
22790
|
-
'(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
|
22791
|
-
'(?:' + src[t.PRERELEASELOOSE] + ')?' +
|
|
22792
|
-
src[t.BUILD] + '?' +
|
|
22793
|
-
')?)?';
|
|
22794
|
-
|
|
22795
|
-
tok('XRANGE');
|
|
22796
|
-
src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$';
|
|
22797
|
-
tok('XRANGELOOSE');
|
|
22798
|
-
src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$';
|
|
22799
|
-
|
|
22800
|
-
// Coercion.
|
|
22801
|
-
// Extract anything that could conceivably be a part of a valid semver
|
|
22802
|
-
tok('COERCE');
|
|
22803
|
-
src[t.COERCE] = '(^|[^\\d])' +
|
|
22804
|
-
'(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
|
|
22805
|
-
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
|
22806
|
-
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
|
22807
|
-
'(?:$|[^\\d])';
|
|
22808
|
-
tok('COERCERTL');
|
|
22809
|
-
re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g');
|
|
22810
|
-
|
|
22811
|
-
// Tilde ranges.
|
|
22812
|
-
// Meaning is "reasonably at or greater than"
|
|
22813
|
-
tok('LONETILDE');
|
|
22814
|
-
src[t.LONETILDE] = '(?:~>?)';
|
|
22815
|
-
|
|
22816
|
-
tok('TILDETRIM');
|
|
22817
|
-
src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+';
|
|
22818
|
-
re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g');
|
|
22819
|
-
var tildeTrimReplace = '$1~';
|
|
22820
|
-
|
|
22821
|
-
tok('TILDE');
|
|
22822
|
-
src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$';
|
|
22823
|
-
tok('TILDELOOSE');
|
|
22824
|
-
src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$';
|
|
22825
|
-
|
|
22826
|
-
// Caret ranges.
|
|
22827
|
-
// Meaning is "at least and backwards compatible with"
|
|
22828
|
-
tok('LONECARET');
|
|
22829
|
-
src[t.LONECARET] = '(?:\\^)';
|
|
22830
|
-
|
|
22831
|
-
tok('CARETTRIM');
|
|
22832
|
-
src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+';
|
|
22833
|
-
re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g');
|
|
22834
|
-
var caretTrimReplace = '$1^';
|
|
22835
|
-
|
|
22836
|
-
tok('CARET');
|
|
22837
|
-
src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$';
|
|
22838
|
-
tok('CARETLOOSE');
|
|
22839
|
-
src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$';
|
|
22840
|
-
|
|
22841
|
-
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
|
22842
|
-
tok('COMPARATORLOOSE');
|
|
22843
|
-
src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$';
|
|
22844
|
-
tok('COMPARATOR');
|
|
22845
|
-
src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$';
|
|
22846
|
-
|
|
22847
|
-
// An expression to strip any whitespace between the gtlt and the thing
|
|
22848
|
-
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
22849
|
-
tok('COMPARATORTRIM');
|
|
22850
|
-
src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] +
|
|
22851
|
-
'\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')';
|
|
22852
|
-
|
|
22853
|
-
// this one has to use the /g flag
|
|
22854
|
-
re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g');
|
|
22855
|
-
var comparatorTrimReplace = '$1$2$3';
|
|
22856
|
-
|
|
22857
|
-
// Something like `1.2.3 - 1.2.4`
|
|
22858
|
-
// Note that these all use the loose form, because they'll be
|
|
22859
|
-
// checked against either the strict or loose comparator form
|
|
22860
|
-
// later.
|
|
22861
|
-
tok('HYPHENRANGE');
|
|
22862
|
-
src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' +
|
|
22863
|
-
'\\s+-\\s+' +
|
|
22864
|
-
'(' + src[t.XRANGEPLAIN] + ')' +
|
|
22865
|
-
'\\s*$';
|
|
22866
|
-
|
|
22867
|
-
tok('HYPHENRANGELOOSE');
|
|
22868
|
-
src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' +
|
|
22869
|
-
'\\s+-\\s+' +
|
|
22870
|
-
'(' + src[t.XRANGEPLAINLOOSE] + ')' +
|
|
22871
|
-
'\\s*$';
|
|
22872
|
-
|
|
22873
|
-
// Star ranges basically just allow anything at all.
|
|
22874
|
-
tok('STAR');
|
|
22875
|
-
src[t.STAR] = '(<|>)?=?\\s*\\*';
|
|
22876
|
-
|
|
22877
|
-
// Compile to actual regexp objects.
|
|
22878
|
-
// All are flag-free, unless they were created above with a flag.
|
|
22879
|
-
for (var i = 0; i < R; i++) {
|
|
22880
|
-
debug(i, src[i]);
|
|
22881
|
-
if (!re[i]) {
|
|
22882
|
-
re[i] = new RegExp(src[i]);
|
|
22883
|
-
}
|
|
22884
|
-
}
|
|
22885
|
-
|
|
22886
|
-
exports.parse = parse;
|
|
22887
|
-
function parse (version, options) {
|
|
22888
|
-
if (!options || typeof options !== 'object') {
|
|
22889
|
-
options = {
|
|
22890
|
-
loose: !!options,
|
|
22891
|
-
includePrerelease: false
|
|
22892
|
-
};
|
|
22893
|
-
}
|
|
22894
|
-
|
|
22895
|
-
if (version instanceof SemVer) {
|
|
22896
|
-
return version
|
|
22897
|
-
}
|
|
22898
|
-
|
|
22899
|
-
if (typeof version !== 'string') {
|
|
22900
|
-
return null
|
|
22901
|
-
}
|
|
22902
|
-
|
|
22903
|
-
if (version.length > MAX_LENGTH) {
|
|
22904
|
-
return null
|
|
22905
|
-
}
|
|
22906
|
-
|
|
22907
|
-
var r = options.loose ? re[t.LOOSE] : re[t.FULL];
|
|
22908
|
-
if (!r.test(version)) {
|
|
22909
|
-
return null
|
|
22910
|
-
}
|
|
22911
|
-
|
|
22912
|
-
try {
|
|
22913
|
-
return new SemVer(version, options)
|
|
22914
|
-
} catch (er) {
|
|
22915
|
-
return null
|
|
22916
|
-
}
|
|
22917
|
-
}
|
|
22918
|
-
|
|
22919
|
-
exports.valid = valid;
|
|
22920
|
-
function valid (version, options) {
|
|
22921
|
-
var v = parse(version, options);
|
|
22922
|
-
return v ? v.version : null
|
|
22923
|
-
}
|
|
22924
|
-
|
|
22925
|
-
exports.clean = clean;
|
|
22926
|
-
function clean (version, options) {
|
|
22927
|
-
var s = parse(version.trim().replace(/^[=v]+/, ''), options);
|
|
22928
|
-
return s ? s.version : null
|
|
22929
|
-
}
|
|
22930
|
-
|
|
22931
|
-
exports.SemVer = SemVer;
|
|
22932
|
-
|
|
22933
|
-
function SemVer (version, options) {
|
|
22934
|
-
if (!options || typeof options !== 'object') {
|
|
22935
|
-
options = {
|
|
22936
|
-
loose: !!options,
|
|
22937
|
-
includePrerelease: false
|
|
22938
|
-
};
|
|
22939
|
-
}
|
|
22940
|
-
if (version instanceof SemVer) {
|
|
22941
|
-
if (version.loose === options.loose) {
|
|
22942
|
-
return version
|
|
22943
|
-
} else {
|
|
22944
|
-
version = version.version;
|
|
22945
|
-
}
|
|
22946
|
-
} else if (typeof version !== 'string') {
|
|
22947
|
-
throw new TypeError('Invalid Version: ' + version)
|
|
22948
|
-
}
|
|
22949
|
-
|
|
22950
|
-
if (version.length > MAX_LENGTH) {
|
|
22951
|
-
throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
|
|
22952
|
-
}
|
|
22953
|
-
|
|
22954
|
-
if (!(this instanceof SemVer)) {
|
|
22955
|
-
return new SemVer(version, options)
|
|
22956
|
-
}
|
|
22957
|
-
|
|
22958
|
-
debug('SemVer', version, options);
|
|
22959
|
-
this.options = options;
|
|
22960
|
-
this.loose = !!options.loose;
|
|
22961
|
-
|
|
22962
|
-
var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
22963
|
-
|
|
22964
|
-
if (!m) {
|
|
22965
|
-
throw new TypeError('Invalid Version: ' + version)
|
|
22966
|
-
}
|
|
22967
|
-
|
|
22968
|
-
this.raw = version;
|
|
22969
|
-
|
|
22970
|
-
// these are actually numbers
|
|
22971
|
-
this.major = +m[1];
|
|
22972
|
-
this.minor = +m[2];
|
|
22973
|
-
this.patch = +m[3];
|
|
22974
|
-
|
|
22975
|
-
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
22976
|
-
throw new TypeError('Invalid major version')
|
|
22977
|
-
}
|
|
22978
|
-
|
|
22979
|
-
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
22980
|
-
throw new TypeError('Invalid minor version')
|
|
22981
|
-
}
|
|
22982
|
-
|
|
22983
|
-
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
22984
|
-
throw new TypeError('Invalid patch version')
|
|
22985
|
-
}
|
|
22986
|
-
|
|
22987
|
-
// numberify any prerelease numeric ids
|
|
22988
|
-
if (!m[4]) {
|
|
22989
|
-
this.prerelease = [];
|
|
22990
|
-
} else {
|
|
22991
|
-
this.prerelease = m[4].split('.').map(function (id) {
|
|
22992
|
-
if (/^[0-9]+$/.test(id)) {
|
|
22993
|
-
var num = +id;
|
|
22994
|
-
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
22995
|
-
return num
|
|
22996
|
-
}
|
|
22997
|
-
}
|
|
22998
|
-
return id
|
|
22999
|
-
});
|
|
23000
|
-
}
|
|
23001
|
-
|
|
23002
|
-
this.build = m[5] ? m[5].split('.') : [];
|
|
23003
|
-
this.format();
|
|
23004
|
-
}
|
|
23005
|
-
|
|
23006
|
-
SemVer.prototype.format = function () {
|
|
23007
|
-
this.version = this.major + '.' + this.minor + '.' + this.patch;
|
|
23008
|
-
if (this.prerelease.length) {
|
|
23009
|
-
this.version += '-' + this.prerelease.join('.');
|
|
23010
|
-
}
|
|
23011
|
-
return this.version
|
|
23012
|
-
};
|
|
23013
|
-
|
|
23014
|
-
SemVer.prototype.toString = function () {
|
|
23015
|
-
return this.version
|
|
23016
|
-
};
|
|
23017
|
-
|
|
23018
|
-
SemVer.prototype.compare = function (other) {
|
|
23019
|
-
debug('SemVer.compare', this.version, this.options, other);
|
|
23020
|
-
if (!(other instanceof SemVer)) {
|
|
23021
|
-
other = new SemVer(other, this.options);
|
|
23022
|
-
}
|
|
23023
|
-
|
|
23024
|
-
return this.compareMain(other) || this.comparePre(other)
|
|
23025
|
-
};
|
|
23026
|
-
|
|
23027
|
-
SemVer.prototype.compareMain = function (other) {
|
|
23028
|
-
if (!(other instanceof SemVer)) {
|
|
23029
|
-
other = new SemVer(other, this.options);
|
|
23030
|
-
}
|
|
23031
|
-
|
|
23032
|
-
return compareIdentifiers(this.major, other.major) ||
|
|
23033
|
-
compareIdentifiers(this.minor, other.minor) ||
|
|
23034
|
-
compareIdentifiers(this.patch, other.patch)
|
|
23035
|
-
};
|
|
23036
|
-
|
|
23037
|
-
SemVer.prototype.comparePre = function (other) {
|
|
23038
|
-
if (!(other instanceof SemVer)) {
|
|
23039
|
-
other = new SemVer(other, this.options);
|
|
23040
|
-
}
|
|
23041
|
-
|
|
23042
|
-
// NOT having a prerelease is > having one
|
|
23043
|
-
if (this.prerelease.length && !other.prerelease.length) {
|
|
23044
|
-
return -1
|
|
23045
|
-
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
23046
|
-
return 1
|
|
23047
|
-
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
23048
|
-
return 0
|
|
23049
|
-
}
|
|
23050
|
-
|
|
23051
|
-
var i = 0;
|
|
23052
|
-
do {
|
|
23053
|
-
var a = this.prerelease[i];
|
|
23054
|
-
var b = other.prerelease[i];
|
|
23055
|
-
debug('prerelease compare', i, a, b);
|
|
23056
|
-
if (a === undefined && b === undefined) {
|
|
23057
|
-
return 0
|
|
23058
|
-
} else if (b === undefined) {
|
|
23059
|
-
return 1
|
|
23060
|
-
} else if (a === undefined) {
|
|
23061
|
-
return -1
|
|
23062
|
-
} else if (a === b) {
|
|
23063
|
-
continue
|
|
23064
|
-
} else {
|
|
23065
|
-
return compareIdentifiers(a, b)
|
|
23066
|
-
}
|
|
23067
|
-
} while (++i)
|
|
23068
|
-
};
|
|
23069
|
-
|
|
23070
|
-
SemVer.prototype.compareBuild = function (other) {
|
|
23071
|
-
if (!(other instanceof SemVer)) {
|
|
23072
|
-
other = new SemVer(other, this.options);
|
|
23073
|
-
}
|
|
23074
|
-
|
|
23075
|
-
var i = 0;
|
|
23076
|
-
do {
|
|
23077
|
-
var a = this.build[i];
|
|
23078
|
-
var b = other.build[i];
|
|
23079
|
-
debug('prerelease compare', i, a, b);
|
|
23080
|
-
if (a === undefined && b === undefined) {
|
|
23081
|
-
return 0
|
|
23082
|
-
} else if (b === undefined) {
|
|
23083
|
-
return 1
|
|
23084
|
-
} else if (a === undefined) {
|
|
23085
|
-
return -1
|
|
23086
|
-
} else if (a === b) {
|
|
23087
|
-
continue
|
|
23088
|
-
} else {
|
|
23089
|
-
return compareIdentifiers(a, b)
|
|
23090
|
-
}
|
|
23091
|
-
} while (++i)
|
|
23092
|
-
};
|
|
23093
|
-
|
|
23094
|
-
// preminor will bump the version up to the next minor release, and immediately
|
|
23095
|
-
// down to pre-release. premajor and prepatch work the same way.
|
|
23096
|
-
SemVer.prototype.inc = function (release, identifier) {
|
|
23097
|
-
switch (release) {
|
|
23098
|
-
case 'premajor':
|
|
23099
|
-
this.prerelease.length = 0;
|
|
23100
|
-
this.patch = 0;
|
|
23101
|
-
this.minor = 0;
|
|
23102
|
-
this.major++;
|
|
23103
|
-
this.inc('pre', identifier);
|
|
23104
|
-
break
|
|
23105
|
-
case 'preminor':
|
|
23106
|
-
this.prerelease.length = 0;
|
|
23107
|
-
this.patch = 0;
|
|
23108
|
-
this.minor++;
|
|
23109
|
-
this.inc('pre', identifier);
|
|
23110
|
-
break
|
|
23111
|
-
case 'prepatch':
|
|
23112
|
-
// If this is already a prerelease, it will bump to the next version
|
|
23113
|
-
// drop any prereleases that might already exist, since they are not
|
|
23114
|
-
// relevant at this point.
|
|
23115
|
-
this.prerelease.length = 0;
|
|
23116
|
-
this.inc('patch', identifier);
|
|
23117
|
-
this.inc('pre', identifier);
|
|
23118
|
-
break
|
|
23119
|
-
// If the input is a non-prerelease version, this acts the same as
|
|
23120
|
-
// prepatch.
|
|
23121
|
-
case 'prerelease':
|
|
23122
|
-
if (this.prerelease.length === 0) {
|
|
23123
|
-
this.inc('patch', identifier);
|
|
23124
|
-
}
|
|
23125
|
-
this.inc('pre', identifier);
|
|
23126
|
-
break
|
|
23127
|
-
|
|
23128
|
-
case 'major':
|
|
23129
|
-
// If this is a pre-major version, bump up to the same major version.
|
|
23130
|
-
// Otherwise increment major.
|
|
23131
|
-
// 1.0.0-5 bumps to 1.0.0
|
|
23132
|
-
// 1.1.0 bumps to 2.0.0
|
|
23133
|
-
if (this.minor !== 0 ||
|
|
23134
|
-
this.patch !== 0 ||
|
|
23135
|
-
this.prerelease.length === 0) {
|
|
23136
|
-
this.major++;
|
|
23137
|
-
}
|
|
23138
|
-
this.minor = 0;
|
|
23139
|
-
this.patch = 0;
|
|
23140
|
-
this.prerelease = [];
|
|
23141
|
-
break
|
|
23142
|
-
case 'minor':
|
|
23143
|
-
// If this is a pre-minor version, bump up to the same minor version.
|
|
23144
|
-
// Otherwise increment minor.
|
|
23145
|
-
// 1.2.0-5 bumps to 1.2.0
|
|
23146
|
-
// 1.2.1 bumps to 1.3.0
|
|
23147
|
-
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
23148
|
-
this.minor++;
|
|
23149
|
-
}
|
|
23150
|
-
this.patch = 0;
|
|
23151
|
-
this.prerelease = [];
|
|
23152
|
-
break
|
|
23153
|
-
case 'patch':
|
|
23154
|
-
// If this is not a pre-release version, it will increment the patch.
|
|
23155
|
-
// If it is a pre-release it will bump up to the same patch version.
|
|
23156
|
-
// 1.2.0-5 patches to 1.2.0
|
|
23157
|
-
// 1.2.0 patches to 1.2.1
|
|
23158
|
-
if (this.prerelease.length === 0) {
|
|
23159
|
-
this.patch++;
|
|
23160
|
-
}
|
|
23161
|
-
this.prerelease = [];
|
|
23162
|
-
break
|
|
23163
|
-
// This probably shouldn't be used publicly.
|
|
23164
|
-
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
|
|
23165
|
-
case 'pre':
|
|
23166
|
-
if (this.prerelease.length === 0) {
|
|
23167
|
-
this.prerelease = [0];
|
|
23168
|
-
} else {
|
|
23169
|
-
var i = this.prerelease.length;
|
|
23170
|
-
while (--i >= 0) {
|
|
23171
|
-
if (typeof this.prerelease[i] === 'number') {
|
|
23172
|
-
this.prerelease[i]++;
|
|
23173
|
-
i = -2;
|
|
23174
|
-
}
|
|
23175
|
-
}
|
|
23176
|
-
if (i === -1) {
|
|
23177
|
-
// didn't increment anything
|
|
23178
|
-
this.prerelease.push(0);
|
|
23179
|
-
}
|
|
23180
|
-
}
|
|
23181
|
-
if (identifier) {
|
|
23182
|
-
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
|
23183
|
-
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
|
23184
|
-
if (this.prerelease[0] === identifier) {
|
|
23185
|
-
if (isNaN(this.prerelease[1])) {
|
|
23186
|
-
this.prerelease = [identifier, 0];
|
|
23187
|
-
}
|
|
23188
|
-
} else {
|
|
23189
|
-
this.prerelease = [identifier, 0];
|
|
23190
|
-
}
|
|
23191
|
-
}
|
|
23192
|
-
break
|
|
23193
|
-
|
|
23194
|
-
default:
|
|
23195
|
-
throw new Error('invalid increment argument: ' + release)
|
|
23196
|
-
}
|
|
23197
|
-
this.format();
|
|
23198
|
-
this.raw = this.version;
|
|
23199
|
-
return this
|
|
23200
|
-
};
|
|
23201
|
-
|
|
23202
|
-
exports.inc = inc;
|
|
23203
|
-
function inc (version, release, loose, identifier) {
|
|
23204
|
-
if (typeof (loose) === 'string') {
|
|
23205
|
-
identifier = loose;
|
|
23206
|
-
loose = undefined;
|
|
23207
|
-
}
|
|
23208
|
-
|
|
23209
|
-
try {
|
|
23210
|
-
return new SemVer(version, loose).inc(release, identifier).version
|
|
23211
|
-
} catch (er) {
|
|
23212
|
-
return null
|
|
23213
|
-
}
|
|
23214
|
-
}
|
|
23215
|
-
|
|
23216
|
-
exports.diff = diff;
|
|
23217
|
-
function diff (version1, version2) {
|
|
23218
|
-
if (eq(version1, version2)) {
|
|
23219
|
-
return null
|
|
23220
|
-
} else {
|
|
23221
|
-
var v1 = parse(version1);
|
|
23222
|
-
var v2 = parse(version2);
|
|
23223
|
-
var prefix = '';
|
|
23224
|
-
if (v1.prerelease.length || v2.prerelease.length) {
|
|
23225
|
-
prefix = 'pre';
|
|
23226
|
-
var defaultResult = 'prerelease';
|
|
23227
|
-
}
|
|
23228
|
-
for (var key in v1) {
|
|
23229
|
-
if (key === 'major' || key === 'minor' || key === 'patch') {
|
|
23230
|
-
if (v1[key] !== v2[key]) {
|
|
23231
|
-
return prefix + key
|
|
23232
|
-
}
|
|
23233
|
-
}
|
|
23234
|
-
}
|
|
23235
|
-
return defaultResult // may be undefined
|
|
23236
|
-
}
|
|
23237
|
-
}
|
|
23238
|
-
|
|
23239
|
-
exports.compareIdentifiers = compareIdentifiers;
|
|
23240
|
-
|
|
23241
|
-
var numeric = /^[0-9]+$/;
|
|
23242
|
-
function compareIdentifiers (a, b) {
|
|
23243
|
-
var anum = numeric.test(a);
|
|
23244
|
-
var bnum = numeric.test(b);
|
|
23245
|
-
|
|
23246
|
-
if (anum && bnum) {
|
|
23247
|
-
a = +a;
|
|
23248
|
-
b = +b;
|
|
23249
|
-
}
|
|
23250
|
-
|
|
23251
|
-
return a === b ? 0
|
|
23252
|
-
: (anum && !bnum) ? -1
|
|
23253
|
-
: (bnum && !anum) ? 1
|
|
23254
|
-
: a < b ? -1
|
|
23255
|
-
: 1
|
|
23256
|
-
}
|
|
23257
|
-
|
|
23258
|
-
exports.rcompareIdentifiers = rcompareIdentifiers;
|
|
23259
|
-
function rcompareIdentifiers (a, b) {
|
|
23260
|
-
return compareIdentifiers(b, a)
|
|
23261
|
-
}
|
|
23262
|
-
|
|
23263
|
-
exports.major = major;
|
|
23264
|
-
function major (a, loose) {
|
|
23265
|
-
return new SemVer(a, loose).major
|
|
23266
|
-
}
|
|
23267
|
-
|
|
23268
|
-
exports.minor = minor;
|
|
23269
|
-
function minor (a, loose) {
|
|
23270
|
-
return new SemVer(a, loose).minor
|
|
23271
|
-
}
|
|
23272
|
-
|
|
23273
|
-
exports.patch = patch;
|
|
23274
|
-
function patch (a, loose) {
|
|
23275
|
-
return new SemVer(a, loose).patch
|
|
23276
|
-
}
|
|
23277
|
-
|
|
23278
|
-
exports.compare = compare;
|
|
23279
|
-
function compare (a, b, loose) {
|
|
23280
|
-
return new SemVer(a, loose).compare(new SemVer(b, loose))
|
|
23281
|
-
}
|
|
23282
|
-
|
|
23283
|
-
exports.compareLoose = compareLoose;
|
|
23284
|
-
function compareLoose (a, b) {
|
|
23285
|
-
return compare(a, b, true)
|
|
23286
|
-
}
|
|
23287
|
-
|
|
23288
|
-
exports.compareBuild = compareBuild;
|
|
23289
|
-
function compareBuild (a, b, loose) {
|
|
23290
|
-
var versionA = new SemVer(a, loose);
|
|
23291
|
-
var versionB = new SemVer(b, loose);
|
|
23292
|
-
return versionA.compare(versionB) || versionA.compareBuild(versionB)
|
|
23293
|
-
}
|
|
23294
|
-
|
|
23295
|
-
exports.rcompare = rcompare;
|
|
23296
|
-
function rcompare (a, b, loose) {
|
|
23297
|
-
return compare(b, a, loose)
|
|
23298
|
-
}
|
|
23299
|
-
|
|
23300
|
-
exports.sort = sort;
|
|
23301
|
-
function sort (list, loose) {
|
|
23302
|
-
return list.sort(function (a, b) {
|
|
23303
|
-
return exports.compareBuild(a, b, loose)
|
|
23304
|
-
})
|
|
23305
|
-
}
|
|
23306
|
-
|
|
23307
|
-
exports.rsort = rsort;
|
|
23308
|
-
function rsort (list, loose) {
|
|
23309
|
-
return list.sort(function (a, b) {
|
|
23310
|
-
return exports.compareBuild(b, a, loose)
|
|
23311
|
-
})
|
|
23312
|
-
}
|
|
23313
|
-
|
|
23314
|
-
exports.gt = gt;
|
|
23315
|
-
function gt (a, b, loose) {
|
|
23316
|
-
return compare(a, b, loose) > 0
|
|
23317
|
-
}
|
|
23318
|
-
|
|
23319
|
-
exports.lt = lt;
|
|
23320
|
-
function lt (a, b, loose) {
|
|
23321
|
-
return compare(a, b, loose) < 0
|
|
23322
|
-
}
|
|
23323
|
-
|
|
23324
|
-
exports.eq = eq;
|
|
23325
|
-
function eq (a, b, loose) {
|
|
23326
|
-
return compare(a, b, loose) === 0
|
|
23327
|
-
}
|
|
23328
|
-
|
|
23329
|
-
exports.neq = neq;
|
|
23330
|
-
function neq (a, b, loose) {
|
|
23331
|
-
return compare(a, b, loose) !== 0
|
|
23332
|
-
}
|
|
23333
|
-
|
|
23334
|
-
exports.gte = gte;
|
|
23335
|
-
function gte (a, b, loose) {
|
|
23336
|
-
return compare(a, b, loose) >= 0
|
|
23337
|
-
}
|
|
23338
|
-
|
|
23339
|
-
exports.lte = lte;
|
|
23340
|
-
function lte (a, b, loose) {
|
|
23341
|
-
return compare(a, b, loose) <= 0
|
|
23342
|
-
}
|
|
23343
|
-
|
|
23344
|
-
exports.cmp = cmp;
|
|
23345
|
-
function cmp (a, op, b, loose) {
|
|
23346
|
-
switch (op) {
|
|
23347
|
-
case '===':
|
|
23348
|
-
if (typeof a === 'object')
|
|
23349
|
-
a = a.version;
|
|
23350
|
-
if (typeof b === 'object')
|
|
23351
|
-
b = b.version;
|
|
23352
|
-
return a === b
|
|
23353
|
-
|
|
23354
|
-
case '!==':
|
|
23355
|
-
if (typeof a === 'object')
|
|
23356
|
-
a = a.version;
|
|
23357
|
-
if (typeof b === 'object')
|
|
23358
|
-
b = b.version;
|
|
23359
|
-
return a !== b
|
|
23360
|
-
|
|
23361
|
-
case '':
|
|
23362
|
-
case '=':
|
|
23363
|
-
case '==':
|
|
23364
|
-
return eq(a, b, loose)
|
|
23365
|
-
|
|
23366
|
-
case '!=':
|
|
23367
|
-
return neq(a, b, loose)
|
|
23368
|
-
|
|
23369
|
-
case '>':
|
|
23370
|
-
return gt(a, b, loose)
|
|
23371
|
-
|
|
23372
|
-
case '>=':
|
|
23373
|
-
return gte(a, b, loose)
|
|
23374
|
-
|
|
23375
|
-
case '<':
|
|
23376
|
-
return lt(a, b, loose)
|
|
23377
|
-
|
|
23378
|
-
case '<=':
|
|
23379
|
-
return lte(a, b, loose)
|
|
23380
|
-
|
|
23381
|
-
default:
|
|
23382
|
-
throw new TypeError('Invalid operator: ' + op)
|
|
23383
|
-
}
|
|
23384
|
-
}
|
|
23385
|
-
|
|
23386
|
-
exports.Comparator = Comparator;
|
|
23387
|
-
function Comparator (comp, options) {
|
|
23388
|
-
if (!options || typeof options !== 'object') {
|
|
23389
|
-
options = {
|
|
23390
|
-
loose: !!options,
|
|
23391
|
-
includePrerelease: false
|
|
23392
|
-
};
|
|
23393
|
-
}
|
|
23394
|
-
|
|
23395
|
-
if (comp instanceof Comparator) {
|
|
23396
|
-
if (comp.loose === !!options.loose) {
|
|
23397
|
-
return comp
|
|
23398
|
-
} else {
|
|
23399
|
-
comp = comp.value;
|
|
23400
|
-
}
|
|
23401
|
-
}
|
|
23402
|
-
|
|
23403
|
-
if (!(this instanceof Comparator)) {
|
|
23404
|
-
return new Comparator(comp, options)
|
|
23405
|
-
}
|
|
23406
|
-
|
|
23407
|
-
debug('comparator', comp, options);
|
|
23408
|
-
this.options = options;
|
|
23409
|
-
this.loose = !!options.loose;
|
|
23410
|
-
this.parse(comp);
|
|
23411
|
-
|
|
23412
|
-
if (this.semver === ANY) {
|
|
23413
|
-
this.value = '';
|
|
23414
|
-
} else {
|
|
23415
|
-
this.value = this.operator + this.semver.version;
|
|
23416
|
-
}
|
|
23417
|
-
|
|
23418
|
-
debug('comp', this);
|
|
23419
|
-
}
|
|
23420
|
-
|
|
23421
|
-
var ANY = {};
|
|
23422
|
-
Comparator.prototype.parse = function (comp) {
|
|
23423
|
-
var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
23424
|
-
var m = comp.match(r);
|
|
23425
|
-
|
|
23426
|
-
if (!m) {
|
|
23427
|
-
throw new TypeError('Invalid comparator: ' + comp)
|
|
23428
|
-
}
|
|
23429
|
-
|
|
23430
|
-
this.operator = m[1] !== undefined ? m[1] : '';
|
|
23431
|
-
if (this.operator === '=') {
|
|
23432
|
-
this.operator = '';
|
|
23433
|
-
}
|
|
23434
|
-
|
|
23435
|
-
// if it literally is just '>' or '' then allow anything.
|
|
23436
|
-
if (!m[2]) {
|
|
23437
|
-
this.semver = ANY;
|
|
23438
|
-
} else {
|
|
23439
|
-
this.semver = new SemVer(m[2], this.options.loose);
|
|
23440
|
-
}
|
|
23441
|
-
};
|
|
23442
|
-
|
|
23443
|
-
Comparator.prototype.toString = function () {
|
|
23444
|
-
return this.value
|
|
23445
|
-
};
|
|
23446
|
-
|
|
23447
|
-
Comparator.prototype.test = function (version) {
|
|
23448
|
-
debug('Comparator.test', version, this.options.loose);
|
|
23449
|
-
|
|
23450
|
-
if (this.semver === ANY || version === ANY) {
|
|
23451
|
-
return true
|
|
23452
|
-
}
|
|
23453
|
-
|
|
23454
|
-
if (typeof version === 'string') {
|
|
23455
|
-
try {
|
|
23456
|
-
version = new SemVer(version, this.options);
|
|
23457
|
-
} catch (er) {
|
|
23458
|
-
return false
|
|
23459
|
-
}
|
|
23460
|
-
}
|
|
23461
|
-
|
|
23462
|
-
return cmp(version, this.operator, this.semver, this.options)
|
|
23463
|
-
};
|
|
23464
|
-
|
|
23465
|
-
Comparator.prototype.intersects = function (comp, options) {
|
|
23466
|
-
if (!(comp instanceof Comparator)) {
|
|
23467
|
-
throw new TypeError('a Comparator is required')
|
|
23468
|
-
}
|
|
23469
|
-
|
|
23470
|
-
if (!options || typeof options !== 'object') {
|
|
23471
|
-
options = {
|
|
23472
|
-
loose: !!options,
|
|
23473
|
-
includePrerelease: false
|
|
23474
|
-
};
|
|
23475
|
-
}
|
|
23476
|
-
|
|
23477
|
-
var rangeTmp;
|
|
23478
|
-
|
|
23479
|
-
if (this.operator === '') {
|
|
23480
|
-
if (this.value === '') {
|
|
23481
|
-
return true
|
|
23482
|
-
}
|
|
23483
|
-
rangeTmp = new Range(comp.value, options);
|
|
23484
|
-
return satisfies(this.value, rangeTmp, options)
|
|
23485
|
-
} else if (comp.operator === '') {
|
|
23486
|
-
if (comp.value === '') {
|
|
23487
|
-
return true
|
|
23488
|
-
}
|
|
23489
|
-
rangeTmp = new Range(this.value, options);
|
|
23490
|
-
return satisfies(comp.semver, rangeTmp, options)
|
|
23491
|
-
}
|
|
23492
|
-
|
|
23493
|
-
var sameDirectionIncreasing =
|
|
23494
|
-
(this.operator === '>=' || this.operator === '>') &&
|
|
23495
|
-
(comp.operator === '>=' || comp.operator === '>');
|
|
23496
|
-
var sameDirectionDecreasing =
|
|
23497
|
-
(this.operator === '<=' || this.operator === '<') &&
|
|
23498
|
-
(comp.operator === '<=' || comp.operator === '<');
|
|
23499
|
-
var sameSemVer = this.semver.version === comp.semver.version;
|
|
23500
|
-
var differentDirectionsInclusive =
|
|
23501
|
-
(this.operator === '>=' || this.operator === '<=') &&
|
|
23502
|
-
(comp.operator === '>=' || comp.operator === '<=');
|
|
23503
|
-
var oppositeDirectionsLessThan =
|
|
23504
|
-
cmp(this.semver, '<', comp.semver, options) &&
|
|
23505
|
-
((this.operator === '>=' || this.operator === '>') &&
|
|
23506
|
-
(comp.operator === '<=' || comp.operator === '<'));
|
|
23507
|
-
var oppositeDirectionsGreaterThan =
|
|
23508
|
-
cmp(this.semver, '>', comp.semver, options) &&
|
|
23509
|
-
((this.operator === '<=' || this.operator === '<') &&
|
|
23510
|
-
(comp.operator === '>=' || comp.operator === '>'));
|
|
23511
|
-
|
|
23512
|
-
return sameDirectionIncreasing || sameDirectionDecreasing ||
|
|
23513
|
-
(sameSemVer && differentDirectionsInclusive) ||
|
|
23514
|
-
oppositeDirectionsLessThan || oppositeDirectionsGreaterThan
|
|
23515
|
-
};
|
|
23516
|
-
|
|
23517
|
-
exports.Range = Range;
|
|
23518
|
-
function Range (range, options) {
|
|
23519
|
-
if (!options || typeof options !== 'object') {
|
|
23520
|
-
options = {
|
|
23521
|
-
loose: !!options,
|
|
23522
|
-
includePrerelease: false
|
|
23523
|
-
};
|
|
23524
|
-
}
|
|
23525
|
-
|
|
23526
|
-
if (range instanceof Range) {
|
|
23527
|
-
if (range.loose === !!options.loose &&
|
|
23528
|
-
range.includePrerelease === !!options.includePrerelease) {
|
|
23529
|
-
return range
|
|
23530
|
-
} else {
|
|
23531
|
-
return new Range(range.raw, options)
|
|
23532
|
-
}
|
|
23533
|
-
}
|
|
23534
|
-
|
|
23535
|
-
if (range instanceof Comparator) {
|
|
23536
|
-
return new Range(range.value, options)
|
|
23537
|
-
}
|
|
23538
|
-
|
|
23539
|
-
if (!(this instanceof Range)) {
|
|
23540
|
-
return new Range(range, options)
|
|
23541
|
-
}
|
|
23542
|
-
|
|
23543
|
-
this.options = options;
|
|
23544
|
-
this.loose = !!options.loose;
|
|
23545
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
23546
|
-
|
|
23547
|
-
// First, split based on boolean or ||
|
|
23548
|
-
this.raw = range;
|
|
23549
|
-
this.set = range.split(/\s*\|\|\s*/).map(function (range) {
|
|
23550
|
-
return this.parseRange(range.trim())
|
|
23551
|
-
}, this).filter(function (c) {
|
|
23552
|
-
// throw out any that are not relevant for whatever reason
|
|
23553
|
-
return c.length
|
|
23554
|
-
});
|
|
23555
|
-
|
|
23556
|
-
if (!this.set.length) {
|
|
23557
|
-
throw new TypeError('Invalid SemVer Range: ' + range)
|
|
23558
|
-
}
|
|
23559
|
-
|
|
23560
|
-
this.format();
|
|
23561
|
-
}
|
|
23562
|
-
|
|
23563
|
-
Range.prototype.format = function () {
|
|
23564
|
-
this.range = this.set.map(function (comps) {
|
|
23565
|
-
return comps.join(' ').trim()
|
|
23566
|
-
}).join('||').trim();
|
|
23567
|
-
return this.range
|
|
23568
|
-
};
|
|
23569
|
-
|
|
23570
|
-
Range.prototype.toString = function () {
|
|
23571
|
-
return this.range
|
|
23572
|
-
};
|
|
23573
|
-
|
|
23574
|
-
Range.prototype.parseRange = function (range) {
|
|
23575
|
-
var loose = this.options.loose;
|
|
23576
|
-
range = range.trim();
|
|
23577
|
-
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
23578
|
-
var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
23579
|
-
range = range.replace(hr, hyphenReplace);
|
|
23580
|
-
debug('hyphen replace', range);
|
|
23581
|
-
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
|
23582
|
-
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
23583
|
-
debug('comparator trim', range, re[t.COMPARATORTRIM]);
|
|
23584
|
-
|
|
23585
|
-
// `~ 1.2.3` => `~1.2.3`
|
|
23586
|
-
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
23587
|
-
|
|
23588
|
-
// `^ 1.2.3` => `^1.2.3`
|
|
23589
|
-
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
23590
|
-
|
|
23591
|
-
// normalize spaces
|
|
23592
|
-
range = range.split(/\s+/).join(' ');
|
|
23593
|
-
|
|
23594
|
-
// At this point, the range is completely trimmed and
|
|
23595
|
-
// ready to be split into comparators.
|
|
23596
|
-
|
|
23597
|
-
var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
23598
|
-
var set = range.split(' ').map(function (comp) {
|
|
23599
|
-
return parseComparator(comp, this.options)
|
|
23600
|
-
}, this).join(' ').split(/\s+/);
|
|
23601
|
-
if (this.options.loose) {
|
|
23602
|
-
// in loose mode, throw out any that are not valid comparators
|
|
23603
|
-
set = set.filter(function (comp) {
|
|
23604
|
-
return !!comp.match(compRe)
|
|
23605
|
-
});
|
|
23606
|
-
}
|
|
23607
|
-
set = set.map(function (comp) {
|
|
23608
|
-
return new Comparator(comp, this.options)
|
|
23609
|
-
}, this);
|
|
23610
|
-
|
|
23611
|
-
return set
|
|
23612
|
-
};
|
|
23613
|
-
|
|
23614
|
-
Range.prototype.intersects = function (range, options) {
|
|
23615
|
-
if (!(range instanceof Range)) {
|
|
23616
|
-
throw new TypeError('a Range is required')
|
|
23617
|
-
}
|
|
23618
|
-
|
|
23619
|
-
return this.set.some(function (thisComparators) {
|
|
23620
|
-
return (
|
|
23621
|
-
isSatisfiable(thisComparators, options) &&
|
|
23622
|
-
range.set.some(function (rangeComparators) {
|
|
23623
|
-
return (
|
|
23624
|
-
isSatisfiable(rangeComparators, options) &&
|
|
23625
|
-
thisComparators.every(function (thisComparator) {
|
|
23626
|
-
return rangeComparators.every(function (rangeComparator) {
|
|
23627
|
-
return thisComparator.intersects(rangeComparator, options)
|
|
23628
|
-
})
|
|
23629
|
-
})
|
|
23630
|
-
)
|
|
23631
|
-
})
|
|
23632
|
-
)
|
|
23633
|
-
})
|
|
23634
|
-
};
|
|
23635
|
-
|
|
23636
|
-
// take a set of comparators and determine whether there
|
|
23637
|
-
// exists a version which can satisfy it
|
|
23638
|
-
function isSatisfiable (comparators, options) {
|
|
23639
|
-
var result = true;
|
|
23640
|
-
var remainingComparators = comparators.slice();
|
|
23641
|
-
var testComparator = remainingComparators.pop();
|
|
23642
|
-
|
|
23643
|
-
while (result && remainingComparators.length) {
|
|
23644
|
-
result = remainingComparators.every(function (otherComparator) {
|
|
23645
|
-
return testComparator.intersects(otherComparator, options)
|
|
23646
|
-
});
|
|
23647
|
-
|
|
23648
|
-
testComparator = remainingComparators.pop();
|
|
23649
|
-
}
|
|
23650
|
-
|
|
23651
|
-
return result
|
|
23652
|
-
}
|
|
23061
|
+
exports = module.exports = SemVer;
|
|
23062
|
+
var debug;
|
|
23063
|
+
/* istanbul ignore next */
|
|
23064
|
+
if (typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
|
|
23065
|
+
debug = function () {
|
|
23066
|
+
var args = Array.prototype.slice.call(arguments, 0);
|
|
23067
|
+
args.unshift('SEMVER');
|
|
23068
|
+
console.log.apply(console, args);
|
|
23069
|
+
};
|
|
23070
|
+
} else {
|
|
23071
|
+
debug = function () {};
|
|
23072
|
+
}
|
|
23653
23073
|
|
|
23654
|
-
|
|
23655
|
-
|
|
23656
|
-
|
|
23657
|
-
|
|
23658
|
-
|
|
23659
|
-
|
|
23660
|
-
|
|
23661
|
-
|
|
23662
|
-
|
|
23074
|
+
// Note: this is the semver.org version of the spec that it implements
|
|
23075
|
+
// Not necessarily the package version of this code.
|
|
23076
|
+
exports.SEMVER_SPEC_VERSION = '2.0.0';
|
|
23077
|
+
var MAX_LENGTH = 256;
|
|
23078
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */9007199254740991;
|
|
23079
|
+
|
|
23080
|
+
// Max safe segment length for coercion.
|
|
23081
|
+
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
23082
|
+
|
|
23083
|
+
// The actual regexps go on exports.re
|
|
23084
|
+
var re = exports.re = [];
|
|
23085
|
+
var src = exports.src = [];
|
|
23086
|
+
var t = exports.tokens = {};
|
|
23087
|
+
var R = 0;
|
|
23088
|
+
function tok(n) {
|
|
23089
|
+
t[n] = R++;
|
|
23090
|
+
}
|
|
23091
|
+
|
|
23092
|
+
// The following Regular Expressions can be used for tokenizing,
|
|
23093
|
+
// validating, and parsing SemVer version strings.
|
|
23094
|
+
|
|
23095
|
+
// ## Numeric Identifier
|
|
23096
|
+
// A single `0`, or a non-zero digit followed by zero or more digits.
|
|
23097
|
+
|
|
23098
|
+
tok('NUMERICIDENTIFIER');
|
|
23099
|
+
src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*';
|
|
23100
|
+
tok('NUMERICIDENTIFIERLOOSE');
|
|
23101
|
+
src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+';
|
|
23102
|
+
|
|
23103
|
+
// ## Non-numeric Identifier
|
|
23104
|
+
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
|
23105
|
+
// more letters, digits, or hyphens.
|
|
23106
|
+
|
|
23107
|
+
tok('NONNUMERICIDENTIFIER');
|
|
23108
|
+
src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
|
|
23109
|
+
|
|
23110
|
+
// ## Main Version
|
|
23111
|
+
// Three dot-separated numeric identifiers.
|
|
23112
|
+
|
|
23113
|
+
tok('MAINVERSION');
|
|
23114
|
+
src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')';
|
|
23115
|
+
tok('MAINVERSIONLOOSE');
|
|
23116
|
+
src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')';
|
|
23117
|
+
|
|
23118
|
+
// ## Pre-release Version Identifier
|
|
23119
|
+
// A numeric identifier, or a non-numeric identifier.
|
|
23120
|
+
|
|
23121
|
+
tok('PRERELEASEIDENTIFIER');
|
|
23122
|
+
src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + '|' + src[t.NONNUMERICIDENTIFIER] + ')';
|
|
23123
|
+
tok('PRERELEASEIDENTIFIERLOOSE');
|
|
23124
|
+
src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + '|' + src[t.NONNUMERICIDENTIFIER] + ')';
|
|
23125
|
+
|
|
23126
|
+
// ## Pre-release Version
|
|
23127
|
+
// Hyphen, followed by one or more dot-separated pre-release version
|
|
23128
|
+
// identifiers.
|
|
23129
|
+
|
|
23130
|
+
tok('PRERELEASE');
|
|
23131
|
+
src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))';
|
|
23132
|
+
tok('PRERELEASELOOSE');
|
|
23133
|
+
src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))';
|
|
23134
|
+
|
|
23135
|
+
// ## Build Metadata Identifier
|
|
23136
|
+
// Any combination of digits, letters, or hyphens.
|
|
23137
|
+
|
|
23138
|
+
tok('BUILDIDENTIFIER');
|
|
23139
|
+
src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
|
|
23140
|
+
|
|
23141
|
+
// ## Build Metadata
|
|
23142
|
+
// Plus sign, followed by one or more period-separated build metadata
|
|
23143
|
+
// identifiers.
|
|
23144
|
+
|
|
23145
|
+
tok('BUILD');
|
|
23146
|
+
src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))';
|
|
23147
|
+
|
|
23148
|
+
// ## Full Version String
|
|
23149
|
+
// A main version, followed optionally by a pre-release version and
|
|
23150
|
+
// build metadata.
|
|
23151
|
+
|
|
23152
|
+
// Note that the only major, minor, patch, and pre-release sections of
|
|
23153
|
+
// the version string are capturing groups. The build metadata is not a
|
|
23154
|
+
// capturing group, because it should not ever be used in version
|
|
23155
|
+
// comparison.
|
|
23156
|
+
|
|
23157
|
+
tok('FULL');
|
|
23158
|
+
tok('FULLPLAIN');
|
|
23159
|
+
src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + src[t.PRERELEASE] + '?' + src[t.BUILD] + '?';
|
|
23160
|
+
src[t.FULL] = '^' + src[t.FULLPLAIN] + '$';
|
|
23161
|
+
|
|
23162
|
+
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
|
23163
|
+
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
|
23164
|
+
// common in the npm registry.
|
|
23165
|
+
tok('LOOSEPLAIN');
|
|
23166
|
+
src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + src[t.PRERELEASELOOSE] + '?' + src[t.BUILD] + '?';
|
|
23167
|
+
tok('LOOSE');
|
|
23168
|
+
src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$';
|
|
23169
|
+
tok('GTLT');
|
|
23170
|
+
src[t.GTLT] = '((?:<|>)?=?)';
|
|
23171
|
+
|
|
23172
|
+
// Something like "2.*" or "1.2.x".
|
|
23173
|
+
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
|
23174
|
+
// Only the first item is strictly required.
|
|
23175
|
+
tok('XRANGEIDENTIFIERLOOSE');
|
|
23176
|
+
src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
|
|
23177
|
+
tok('XRANGEIDENTIFIER');
|
|
23178
|
+
src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*';
|
|
23179
|
+
tok('XRANGEPLAIN');
|
|
23180
|
+
src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:' + src[t.PRERELEASE] + ')?' + src[t.BUILD] + '?' + ')?)?';
|
|
23181
|
+
tok('XRANGEPLAINLOOSE');
|
|
23182
|
+
src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:' + src[t.PRERELEASELOOSE] + ')?' + src[t.BUILD] + '?' + ')?)?';
|
|
23183
|
+
tok('XRANGE');
|
|
23184
|
+
src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$';
|
|
23185
|
+
tok('XRANGELOOSE');
|
|
23186
|
+
src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$';
|
|
23187
|
+
|
|
23188
|
+
// Coercion.
|
|
23189
|
+
// Extract anything that could conceivably be a part of a valid semver
|
|
23190
|
+
tok('COERCE');
|
|
23191
|
+
src[t.COERCE] = '(^|[^\\d])' + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:$|[^\\d])';
|
|
23192
|
+
tok('COERCERTL');
|
|
23193
|
+
re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g');
|
|
23194
|
+
|
|
23195
|
+
// Tilde ranges.
|
|
23196
|
+
// Meaning is "reasonably at or greater than"
|
|
23197
|
+
tok('LONETILDE');
|
|
23198
|
+
src[t.LONETILDE] = '(?:~>?)';
|
|
23199
|
+
tok('TILDETRIM');
|
|
23200
|
+
src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+';
|
|
23201
|
+
re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g');
|
|
23202
|
+
var tildeTrimReplace = '$1~';
|
|
23203
|
+
tok('TILDE');
|
|
23204
|
+
src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$';
|
|
23205
|
+
tok('TILDELOOSE');
|
|
23206
|
+
src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$';
|
|
23207
|
+
|
|
23208
|
+
// Caret ranges.
|
|
23209
|
+
// Meaning is "at least and backwards compatible with"
|
|
23210
|
+
tok('LONECARET');
|
|
23211
|
+
src[t.LONECARET] = '(?:\\^)';
|
|
23212
|
+
tok('CARETTRIM');
|
|
23213
|
+
src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+';
|
|
23214
|
+
re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g');
|
|
23215
|
+
var caretTrimReplace = '$1^';
|
|
23216
|
+
tok('CARET');
|
|
23217
|
+
src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$';
|
|
23218
|
+
tok('CARETLOOSE');
|
|
23219
|
+
src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$';
|
|
23220
|
+
|
|
23221
|
+
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
|
23222
|
+
tok('COMPARATORLOOSE');
|
|
23223
|
+
src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$';
|
|
23224
|
+
tok('COMPARATOR');
|
|
23225
|
+
src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$';
|
|
23226
|
+
|
|
23227
|
+
// An expression to strip any whitespace between the gtlt and the thing
|
|
23228
|
+
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
23229
|
+
tok('COMPARATORTRIM');
|
|
23230
|
+
src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')';
|
|
23231
|
+
|
|
23232
|
+
// this one has to use the /g flag
|
|
23233
|
+
re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g');
|
|
23234
|
+
var comparatorTrimReplace = '$1$2$3';
|
|
23235
|
+
|
|
23236
|
+
// Something like `1.2.3 - 1.2.4`
|
|
23237
|
+
// Note that these all use the loose form, because they'll be
|
|
23238
|
+
// checked against either the strict or loose comparator form
|
|
23239
|
+
// later.
|
|
23240
|
+
tok('HYPHENRANGE');
|
|
23241
|
+
src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAIN] + ')' + '\\s*$';
|
|
23242
|
+
tok('HYPHENRANGELOOSE');
|
|
23243
|
+
src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s*$';
|
|
23244
|
+
|
|
23245
|
+
// Star ranges basically just allow anything at all.
|
|
23246
|
+
tok('STAR');
|
|
23247
|
+
src[t.STAR] = '(<|>)?=?\\s*\\*';
|
|
23248
|
+
|
|
23249
|
+
// Compile to actual regexp objects.
|
|
23250
|
+
// All are flag-free, unless they were created above with a flag.
|
|
23251
|
+
for (var i = 0; i < R; i++) {
|
|
23252
|
+
debug(i, src[i]);
|
|
23253
|
+
if (!re[i]) {
|
|
23254
|
+
re[i] = new RegExp(src[i]);
|
|
23255
|
+
}
|
|
23256
|
+
}
|
|
23257
|
+
exports.parse = parse;
|
|
23258
|
+
function parse(version, options) {
|
|
23259
|
+
if (!options || typeof options !== 'object') {
|
|
23260
|
+
options = {
|
|
23261
|
+
loose: !!options,
|
|
23262
|
+
includePrerelease: false
|
|
23263
|
+
};
|
|
23264
|
+
}
|
|
23265
|
+
if (version instanceof SemVer) {
|
|
23266
|
+
return version;
|
|
23267
|
+
}
|
|
23268
|
+
if (typeof version !== 'string') {
|
|
23269
|
+
return null;
|
|
23270
|
+
}
|
|
23271
|
+
if (version.length > MAX_LENGTH) {
|
|
23272
|
+
return null;
|
|
23273
|
+
}
|
|
23274
|
+
var r = options.loose ? re[t.LOOSE] : re[t.FULL];
|
|
23275
|
+
if (!r.test(version)) {
|
|
23276
|
+
return null;
|
|
23277
|
+
}
|
|
23278
|
+
try {
|
|
23279
|
+
return new SemVer(version, options);
|
|
23280
|
+
} catch (er) {
|
|
23281
|
+
return null;
|
|
23282
|
+
}
|
|
23283
|
+
}
|
|
23284
|
+
exports.valid = valid;
|
|
23285
|
+
function valid(version, options) {
|
|
23286
|
+
var v = parse(version, options);
|
|
23287
|
+
return v ? v.version : null;
|
|
23288
|
+
}
|
|
23289
|
+
exports.clean = clean;
|
|
23290
|
+
function clean(version, options) {
|
|
23291
|
+
var s = parse(version.trim().replace(/^[=v]+/, ''), options);
|
|
23292
|
+
return s ? s.version : null;
|
|
23293
|
+
}
|
|
23294
|
+
exports.SemVer = SemVer;
|
|
23295
|
+
function SemVer(version, options) {
|
|
23296
|
+
if (!options || typeof options !== 'object') {
|
|
23297
|
+
options = {
|
|
23298
|
+
loose: !!options,
|
|
23299
|
+
includePrerelease: false
|
|
23300
|
+
};
|
|
23301
|
+
}
|
|
23302
|
+
if (version instanceof SemVer) {
|
|
23303
|
+
if (version.loose === options.loose) {
|
|
23304
|
+
return version;
|
|
23305
|
+
} else {
|
|
23306
|
+
version = version.version;
|
|
23307
|
+
}
|
|
23308
|
+
} else if (typeof version !== 'string') {
|
|
23309
|
+
throw new TypeError('Invalid Version: ' + version);
|
|
23310
|
+
}
|
|
23311
|
+
if (version.length > MAX_LENGTH) {
|
|
23312
|
+
throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters');
|
|
23313
|
+
}
|
|
23314
|
+
if (!(this instanceof SemVer)) {
|
|
23315
|
+
return new SemVer(version, options);
|
|
23316
|
+
}
|
|
23317
|
+
debug('SemVer', version, options);
|
|
23318
|
+
this.options = options;
|
|
23319
|
+
this.loose = !!options.loose;
|
|
23320
|
+
var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
23321
|
+
if (!m) {
|
|
23322
|
+
throw new TypeError('Invalid Version: ' + version);
|
|
23323
|
+
}
|
|
23324
|
+
this.raw = version;
|
|
23663
23325
|
|
|
23664
|
-
|
|
23665
|
-
|
|
23666
|
-
|
|
23667
|
-
|
|
23668
|
-
|
|
23669
|
-
|
|
23670
|
-
|
|
23671
|
-
|
|
23672
|
-
|
|
23673
|
-
|
|
23674
|
-
|
|
23675
|
-
|
|
23676
|
-
|
|
23677
|
-
return comp
|
|
23678
|
-
}
|
|
23326
|
+
// these are actually numbers
|
|
23327
|
+
this.major = +m[1];
|
|
23328
|
+
this.minor = +m[2];
|
|
23329
|
+
this.patch = +m[3];
|
|
23330
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
23331
|
+
throw new TypeError('Invalid major version');
|
|
23332
|
+
}
|
|
23333
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
23334
|
+
throw new TypeError('Invalid minor version');
|
|
23335
|
+
}
|
|
23336
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
23337
|
+
throw new TypeError('Invalid patch version');
|
|
23338
|
+
}
|
|
23679
23339
|
|
|
23680
|
-
|
|
23681
|
-
|
|
23682
|
-
|
|
23340
|
+
// numberify any prerelease numeric ids
|
|
23341
|
+
if (!m[4]) {
|
|
23342
|
+
this.prerelease = [];
|
|
23343
|
+
} else {
|
|
23344
|
+
this.prerelease = m[4].split('.').map(function (id) {
|
|
23345
|
+
if (/^[0-9]+$/.test(id)) {
|
|
23346
|
+
var num = +id;
|
|
23347
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
23348
|
+
return num;
|
|
23349
|
+
}
|
|
23350
|
+
}
|
|
23351
|
+
return id;
|
|
23352
|
+
});
|
|
23353
|
+
}
|
|
23354
|
+
this.build = m[5] ? m[5].split('.') : [];
|
|
23355
|
+
this.format();
|
|
23356
|
+
}
|
|
23357
|
+
SemVer.prototype.format = function () {
|
|
23358
|
+
this.version = this.major + '.' + this.minor + '.' + this.patch;
|
|
23359
|
+
if (this.prerelease.length) {
|
|
23360
|
+
this.version += '-' + this.prerelease.join('.');
|
|
23361
|
+
}
|
|
23362
|
+
return this.version;
|
|
23363
|
+
};
|
|
23364
|
+
SemVer.prototype.toString = function () {
|
|
23365
|
+
return this.version;
|
|
23366
|
+
};
|
|
23367
|
+
SemVer.prototype.compare = function (other) {
|
|
23368
|
+
debug('SemVer.compare', this.version, this.options, other);
|
|
23369
|
+
if (!(other instanceof SemVer)) {
|
|
23370
|
+
other = new SemVer(other, this.options);
|
|
23371
|
+
}
|
|
23372
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
23373
|
+
};
|
|
23374
|
+
SemVer.prototype.compareMain = function (other) {
|
|
23375
|
+
if (!(other instanceof SemVer)) {
|
|
23376
|
+
other = new SemVer(other, this.options);
|
|
23377
|
+
}
|
|
23378
|
+
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
23379
|
+
};
|
|
23380
|
+
SemVer.prototype.comparePre = function (other) {
|
|
23381
|
+
if (!(other instanceof SemVer)) {
|
|
23382
|
+
other = new SemVer(other, this.options);
|
|
23383
|
+
}
|
|
23683
23384
|
|
|
23684
|
-
|
|
23685
|
-
|
|
23686
|
-
|
|
23687
|
-
|
|
23688
|
-
|
|
23689
|
-
|
|
23690
|
-
|
|
23691
|
-
|
|
23692
|
-
|
|
23693
|
-
|
|
23694
|
-
|
|
23385
|
+
// NOT having a prerelease is > having one
|
|
23386
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
23387
|
+
return -1;
|
|
23388
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
23389
|
+
return 1;
|
|
23390
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
23391
|
+
return 0;
|
|
23392
|
+
}
|
|
23393
|
+
var i = 0;
|
|
23394
|
+
do {
|
|
23395
|
+
var a = this.prerelease[i];
|
|
23396
|
+
var b = other.prerelease[i];
|
|
23397
|
+
debug('prerelease compare', i, a, b);
|
|
23398
|
+
if (a === undefined && b === undefined) {
|
|
23399
|
+
return 0;
|
|
23400
|
+
} else if (b === undefined) {
|
|
23401
|
+
return 1;
|
|
23402
|
+
} else if (a === undefined) {
|
|
23403
|
+
return -1;
|
|
23404
|
+
} else if (a === b) {
|
|
23405
|
+
continue;
|
|
23406
|
+
} else {
|
|
23407
|
+
return compareIdentifiers(a, b);
|
|
23408
|
+
}
|
|
23409
|
+
} while (++i);
|
|
23410
|
+
};
|
|
23411
|
+
SemVer.prototype.compareBuild = function (other) {
|
|
23412
|
+
if (!(other instanceof SemVer)) {
|
|
23413
|
+
other = new SemVer(other, this.options);
|
|
23414
|
+
}
|
|
23415
|
+
var i = 0;
|
|
23416
|
+
do {
|
|
23417
|
+
var a = this.build[i];
|
|
23418
|
+
var b = other.build[i];
|
|
23419
|
+
debug('prerelease compare', i, a, b);
|
|
23420
|
+
if (a === undefined && b === undefined) {
|
|
23421
|
+
return 0;
|
|
23422
|
+
} else if (b === undefined) {
|
|
23423
|
+
return 1;
|
|
23424
|
+
} else if (a === undefined) {
|
|
23425
|
+
return -1;
|
|
23426
|
+
} else if (a === b) {
|
|
23427
|
+
continue;
|
|
23428
|
+
} else {
|
|
23429
|
+
return compareIdentifiers(a, b);
|
|
23430
|
+
}
|
|
23431
|
+
} while (++i);
|
|
23432
|
+
};
|
|
23695
23433
|
|
|
23696
|
-
|
|
23697
|
-
|
|
23698
|
-
|
|
23699
|
-
|
|
23700
|
-
|
|
23701
|
-
|
|
23702
|
-
|
|
23703
|
-
|
|
23704
|
-
|
|
23705
|
-
|
|
23706
|
-
|
|
23707
|
-
|
|
23708
|
-
|
|
23709
|
-
|
|
23710
|
-
|
|
23711
|
-
|
|
23712
|
-
|
|
23713
|
-
|
|
23714
|
-
|
|
23715
|
-
|
|
23716
|
-
|
|
23717
|
-
|
|
23718
|
-
|
|
23719
|
-
|
|
23720
|
-
|
|
23721
|
-
|
|
23722
|
-
|
|
23434
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
23435
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
23436
|
+
SemVer.prototype.inc = function (release, identifier) {
|
|
23437
|
+
switch (release) {
|
|
23438
|
+
case 'premajor':
|
|
23439
|
+
this.prerelease.length = 0;
|
|
23440
|
+
this.patch = 0;
|
|
23441
|
+
this.minor = 0;
|
|
23442
|
+
this.major++;
|
|
23443
|
+
this.inc('pre', identifier);
|
|
23444
|
+
break;
|
|
23445
|
+
case 'preminor':
|
|
23446
|
+
this.prerelease.length = 0;
|
|
23447
|
+
this.patch = 0;
|
|
23448
|
+
this.minor++;
|
|
23449
|
+
this.inc('pre', identifier);
|
|
23450
|
+
break;
|
|
23451
|
+
case 'prepatch':
|
|
23452
|
+
// If this is already a prerelease, it will bump to the next version
|
|
23453
|
+
// drop any prereleases that might already exist, since they are not
|
|
23454
|
+
// relevant at this point.
|
|
23455
|
+
this.prerelease.length = 0;
|
|
23456
|
+
this.inc('patch', identifier);
|
|
23457
|
+
this.inc('pre', identifier);
|
|
23458
|
+
break;
|
|
23459
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
23460
|
+
// prepatch.
|
|
23461
|
+
case 'prerelease':
|
|
23462
|
+
if (this.prerelease.length === 0) {
|
|
23463
|
+
this.inc('patch', identifier);
|
|
23464
|
+
}
|
|
23465
|
+
this.inc('pre', identifier);
|
|
23466
|
+
break;
|
|
23467
|
+
case 'major':
|
|
23468
|
+
// If this is a pre-major version, bump up to the same major version.
|
|
23469
|
+
// Otherwise increment major.
|
|
23470
|
+
// 1.0.0-5 bumps to 1.0.0
|
|
23471
|
+
// 1.1.0 bumps to 2.0.0
|
|
23472
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
23473
|
+
this.major++;
|
|
23474
|
+
}
|
|
23475
|
+
this.minor = 0;
|
|
23476
|
+
this.patch = 0;
|
|
23477
|
+
this.prerelease = [];
|
|
23478
|
+
break;
|
|
23479
|
+
case 'minor':
|
|
23480
|
+
// If this is a pre-minor version, bump up to the same minor version.
|
|
23481
|
+
// Otherwise increment minor.
|
|
23482
|
+
// 1.2.0-5 bumps to 1.2.0
|
|
23483
|
+
// 1.2.1 bumps to 1.3.0
|
|
23484
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
23485
|
+
this.minor++;
|
|
23486
|
+
}
|
|
23487
|
+
this.patch = 0;
|
|
23488
|
+
this.prerelease = [];
|
|
23489
|
+
break;
|
|
23490
|
+
case 'patch':
|
|
23491
|
+
// If this is not a pre-release version, it will increment the patch.
|
|
23492
|
+
// If it is a pre-release it will bump up to the same patch version.
|
|
23493
|
+
// 1.2.0-5 patches to 1.2.0
|
|
23494
|
+
// 1.2.0 patches to 1.2.1
|
|
23495
|
+
if (this.prerelease.length === 0) {
|
|
23496
|
+
this.patch++;
|
|
23497
|
+
}
|
|
23498
|
+
this.prerelease = [];
|
|
23499
|
+
break;
|
|
23500
|
+
// This probably shouldn't be used publicly.
|
|
23501
|
+
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
|
|
23502
|
+
case 'pre':
|
|
23503
|
+
if (this.prerelease.length === 0) {
|
|
23504
|
+
this.prerelease = [0];
|
|
23505
|
+
} else {
|
|
23506
|
+
var i = this.prerelease.length;
|
|
23507
|
+
while (--i >= 0) {
|
|
23508
|
+
if (typeof this.prerelease[i] === 'number') {
|
|
23509
|
+
this.prerelease[i]++;
|
|
23510
|
+
i = -2;
|
|
23511
|
+
}
|
|
23512
|
+
}
|
|
23513
|
+
if (i === -1) {
|
|
23514
|
+
// didn't increment anything
|
|
23515
|
+
this.prerelease.push(0);
|
|
23516
|
+
}
|
|
23517
|
+
}
|
|
23518
|
+
if (identifier) {
|
|
23519
|
+
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
|
23520
|
+
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
|
23521
|
+
if (this.prerelease[0] === identifier) {
|
|
23522
|
+
if (isNaN(this.prerelease[1])) {
|
|
23523
|
+
this.prerelease = [identifier, 0];
|
|
23524
|
+
}
|
|
23525
|
+
} else {
|
|
23526
|
+
this.prerelease = [identifier, 0];
|
|
23527
|
+
}
|
|
23528
|
+
}
|
|
23529
|
+
break;
|
|
23530
|
+
default:
|
|
23531
|
+
throw new Error('invalid increment argument: ' + release);
|
|
23532
|
+
}
|
|
23533
|
+
this.format();
|
|
23534
|
+
this.raw = this.version;
|
|
23535
|
+
return this;
|
|
23536
|
+
};
|
|
23537
|
+
exports.inc = inc;
|
|
23538
|
+
function inc(version, release, loose, identifier) {
|
|
23539
|
+
if (typeof loose === 'string') {
|
|
23540
|
+
identifier = loose;
|
|
23541
|
+
loose = undefined;
|
|
23542
|
+
}
|
|
23543
|
+
try {
|
|
23544
|
+
return new SemVer(version, loose).inc(release, identifier).version;
|
|
23545
|
+
} catch (er) {
|
|
23546
|
+
return null;
|
|
23547
|
+
}
|
|
23548
|
+
}
|
|
23549
|
+
exports.diff = diff;
|
|
23550
|
+
function diff(version1, version2) {
|
|
23551
|
+
if (eq(version1, version2)) {
|
|
23552
|
+
return null;
|
|
23553
|
+
} else {
|
|
23554
|
+
var v1 = parse(version1);
|
|
23555
|
+
var v2 = parse(version2);
|
|
23556
|
+
var prefix = '';
|
|
23557
|
+
if (v1.prerelease.length || v2.prerelease.length) {
|
|
23558
|
+
prefix = 'pre';
|
|
23559
|
+
var defaultResult = 'prerelease';
|
|
23560
|
+
}
|
|
23561
|
+
for (var key in v1) {
|
|
23562
|
+
if (key === 'major' || key === 'minor' || key === 'patch') {
|
|
23563
|
+
if (v1[key] !== v2[key]) {
|
|
23564
|
+
return prefix + key;
|
|
23565
|
+
}
|
|
23566
|
+
}
|
|
23567
|
+
}
|
|
23568
|
+
return defaultResult; // may be undefined
|
|
23569
|
+
}
|
|
23570
|
+
}
|
|
23723
23571
|
|
|
23724
|
-
|
|
23725
|
-
|
|
23726
|
-
|
|
23727
|
-
|
|
23728
|
-
|
|
23729
|
-
|
|
23730
|
-
|
|
23731
|
-
|
|
23732
|
-
|
|
23733
|
-
|
|
23734
|
-
|
|
23572
|
+
exports.compareIdentifiers = compareIdentifiers;
|
|
23573
|
+
var numeric = /^[0-9]+$/;
|
|
23574
|
+
function compareIdentifiers(a, b) {
|
|
23575
|
+
var anum = numeric.test(a);
|
|
23576
|
+
var bnum = numeric.test(b);
|
|
23577
|
+
if (anum && bnum) {
|
|
23578
|
+
a = +a;
|
|
23579
|
+
b = +b;
|
|
23580
|
+
}
|
|
23581
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
23582
|
+
}
|
|
23583
|
+
exports.rcompareIdentifiers = rcompareIdentifiers;
|
|
23584
|
+
function rcompareIdentifiers(a, b) {
|
|
23585
|
+
return compareIdentifiers(b, a);
|
|
23586
|
+
}
|
|
23587
|
+
exports.major = major;
|
|
23588
|
+
function major(a, loose) {
|
|
23589
|
+
return new SemVer(a, loose).major;
|
|
23590
|
+
}
|
|
23591
|
+
exports.minor = minor;
|
|
23592
|
+
function minor(a, loose) {
|
|
23593
|
+
return new SemVer(a, loose).minor;
|
|
23594
|
+
}
|
|
23595
|
+
exports.patch = patch;
|
|
23596
|
+
function patch(a, loose) {
|
|
23597
|
+
return new SemVer(a, loose).patch;
|
|
23598
|
+
}
|
|
23599
|
+
exports.compare = compare;
|
|
23600
|
+
function compare(a, b, loose) {
|
|
23601
|
+
return new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
23602
|
+
}
|
|
23603
|
+
exports.compareLoose = compareLoose;
|
|
23604
|
+
function compareLoose(a, b) {
|
|
23605
|
+
return compare(a, b, true);
|
|
23606
|
+
}
|
|
23607
|
+
exports.compareBuild = compareBuild;
|
|
23608
|
+
function compareBuild(a, b, loose) {
|
|
23609
|
+
var versionA = new SemVer(a, loose);
|
|
23610
|
+
var versionB = new SemVer(b, loose);
|
|
23611
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
23612
|
+
}
|
|
23613
|
+
exports.rcompare = rcompare;
|
|
23614
|
+
function rcompare(a, b, loose) {
|
|
23615
|
+
return compare(b, a, loose);
|
|
23616
|
+
}
|
|
23617
|
+
exports.sort = sort;
|
|
23618
|
+
function sort(list, loose) {
|
|
23619
|
+
return list.sort(function (a, b) {
|
|
23620
|
+
return exports.compareBuild(a, b, loose);
|
|
23621
|
+
});
|
|
23622
|
+
}
|
|
23623
|
+
exports.rsort = rsort;
|
|
23624
|
+
function rsort(list, loose) {
|
|
23625
|
+
return list.sort(function (a, b) {
|
|
23626
|
+
return exports.compareBuild(b, a, loose);
|
|
23627
|
+
});
|
|
23628
|
+
}
|
|
23629
|
+
exports.gt = gt;
|
|
23630
|
+
function gt(a, b, loose) {
|
|
23631
|
+
return compare(a, b, loose) > 0;
|
|
23632
|
+
}
|
|
23633
|
+
exports.lt = lt;
|
|
23634
|
+
function lt(a, b, loose) {
|
|
23635
|
+
return compare(a, b, loose) < 0;
|
|
23636
|
+
}
|
|
23637
|
+
exports.eq = eq;
|
|
23638
|
+
function eq(a, b, loose) {
|
|
23639
|
+
return compare(a, b, loose) === 0;
|
|
23640
|
+
}
|
|
23641
|
+
exports.neq = neq;
|
|
23642
|
+
function neq(a, b, loose) {
|
|
23643
|
+
return compare(a, b, loose) !== 0;
|
|
23644
|
+
}
|
|
23645
|
+
exports.gte = gte;
|
|
23646
|
+
function gte(a, b, loose) {
|
|
23647
|
+
return compare(a, b, loose) >= 0;
|
|
23648
|
+
}
|
|
23649
|
+
exports.lte = lte;
|
|
23650
|
+
function lte(a, b, loose) {
|
|
23651
|
+
return compare(a, b, loose) <= 0;
|
|
23652
|
+
}
|
|
23653
|
+
exports.cmp = cmp;
|
|
23654
|
+
function cmp(a, op, b, loose) {
|
|
23655
|
+
switch (op) {
|
|
23656
|
+
case '===':
|
|
23657
|
+
if (typeof a === 'object') a = a.version;
|
|
23658
|
+
if (typeof b === 'object') b = b.version;
|
|
23659
|
+
return a === b;
|
|
23660
|
+
case '!==':
|
|
23661
|
+
if (typeof a === 'object') a = a.version;
|
|
23662
|
+
if (typeof b === 'object') b = b.version;
|
|
23663
|
+
return a !== b;
|
|
23664
|
+
case '':
|
|
23665
|
+
case '=':
|
|
23666
|
+
case '==':
|
|
23667
|
+
return eq(a, b, loose);
|
|
23668
|
+
case '!=':
|
|
23669
|
+
return neq(a, b, loose);
|
|
23670
|
+
case '>':
|
|
23671
|
+
return gt(a, b, loose);
|
|
23672
|
+
case '>=':
|
|
23673
|
+
return gte(a, b, loose);
|
|
23674
|
+
case '<':
|
|
23675
|
+
return lt(a, b, loose);
|
|
23676
|
+
case '<=':
|
|
23677
|
+
return lte(a, b, loose);
|
|
23678
|
+
default:
|
|
23679
|
+
throw new TypeError('Invalid operator: ' + op);
|
|
23680
|
+
}
|
|
23681
|
+
}
|
|
23682
|
+
exports.Comparator = Comparator;
|
|
23683
|
+
function Comparator(comp, options) {
|
|
23684
|
+
if (!options || typeof options !== 'object') {
|
|
23685
|
+
options = {
|
|
23686
|
+
loose: !!options,
|
|
23687
|
+
includePrerelease: false
|
|
23688
|
+
};
|
|
23689
|
+
}
|
|
23690
|
+
if (comp instanceof Comparator) {
|
|
23691
|
+
if (comp.loose === !!options.loose) {
|
|
23692
|
+
return comp;
|
|
23693
|
+
} else {
|
|
23694
|
+
comp = comp.value;
|
|
23695
|
+
}
|
|
23696
|
+
}
|
|
23697
|
+
if (!(this instanceof Comparator)) {
|
|
23698
|
+
return new Comparator(comp, options);
|
|
23699
|
+
}
|
|
23700
|
+
debug('comparator', comp, options);
|
|
23701
|
+
this.options = options;
|
|
23702
|
+
this.loose = !!options.loose;
|
|
23703
|
+
this.parse(comp);
|
|
23704
|
+
if (this.semver === ANY) {
|
|
23705
|
+
this.value = '';
|
|
23706
|
+
} else {
|
|
23707
|
+
this.value = this.operator + this.semver.version;
|
|
23708
|
+
}
|
|
23709
|
+
debug('comp', this);
|
|
23710
|
+
}
|
|
23711
|
+
var ANY = {};
|
|
23712
|
+
Comparator.prototype.parse = function (comp) {
|
|
23713
|
+
var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
23714
|
+
var m = comp.match(r);
|
|
23715
|
+
if (!m) {
|
|
23716
|
+
throw new TypeError('Invalid comparator: ' + comp);
|
|
23717
|
+
}
|
|
23718
|
+
this.operator = m[1] !== undefined ? m[1] : '';
|
|
23719
|
+
if (this.operator === '=') {
|
|
23720
|
+
this.operator = '';
|
|
23721
|
+
}
|
|
23735
23722
|
|
|
23736
|
-
|
|
23737
|
-
|
|
23738
|
-
|
|
23739
|
-
|
|
23740
|
-
|
|
23741
|
-
|
|
23742
|
-
|
|
23743
|
-
|
|
23744
|
-
|
|
23745
|
-
|
|
23746
|
-
|
|
23747
|
-
|
|
23748
|
-
|
|
23749
|
-
|
|
23750
|
-
|
|
23751
|
-
|
|
23752
|
-
|
|
23753
|
-
|
|
23754
|
-
|
|
23755
|
-
|
|
23756
|
-
|
|
23757
|
-
|
|
23758
|
-
|
|
23759
|
-
|
|
23760
|
-
|
|
23761
|
-
|
|
23762
|
-
|
|
23763
|
-
|
|
23764
|
-
|
|
23765
|
-
|
|
23766
|
-
|
|
23767
|
-
|
|
23768
|
-
|
|
23769
|
-
|
|
23770
|
-
|
|
23771
|
-
|
|
23772
|
-
|
|
23773
|
-
|
|
23774
|
-
|
|
23775
|
-
|
|
23776
|
-
|
|
23777
|
-
|
|
23778
|
-
|
|
23779
|
-
|
|
23780
|
-
|
|
23781
|
-
|
|
23782
|
-
|
|
23783
|
-
|
|
23784
|
-
|
|
23785
|
-
|
|
23786
|
-
|
|
23723
|
+
// if it literally is just '>' or '' then allow anything.
|
|
23724
|
+
if (!m[2]) {
|
|
23725
|
+
this.semver = ANY;
|
|
23726
|
+
} else {
|
|
23727
|
+
this.semver = new SemVer(m[2], this.options.loose);
|
|
23728
|
+
}
|
|
23729
|
+
};
|
|
23730
|
+
Comparator.prototype.toString = function () {
|
|
23731
|
+
return this.value;
|
|
23732
|
+
};
|
|
23733
|
+
Comparator.prototype.test = function (version) {
|
|
23734
|
+
debug('Comparator.test', version, this.options.loose);
|
|
23735
|
+
if (this.semver === ANY || version === ANY) {
|
|
23736
|
+
return true;
|
|
23737
|
+
}
|
|
23738
|
+
if (typeof version === 'string') {
|
|
23739
|
+
try {
|
|
23740
|
+
version = new SemVer(version, this.options);
|
|
23741
|
+
} catch (er) {
|
|
23742
|
+
return false;
|
|
23743
|
+
}
|
|
23744
|
+
}
|
|
23745
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
23746
|
+
};
|
|
23747
|
+
Comparator.prototype.intersects = function (comp, options) {
|
|
23748
|
+
if (!(comp instanceof Comparator)) {
|
|
23749
|
+
throw new TypeError('a Comparator is required');
|
|
23750
|
+
}
|
|
23751
|
+
if (!options || typeof options !== 'object') {
|
|
23752
|
+
options = {
|
|
23753
|
+
loose: !!options,
|
|
23754
|
+
includePrerelease: false
|
|
23755
|
+
};
|
|
23756
|
+
}
|
|
23757
|
+
var rangeTmp;
|
|
23758
|
+
if (this.operator === '') {
|
|
23759
|
+
if (this.value === '') {
|
|
23760
|
+
return true;
|
|
23761
|
+
}
|
|
23762
|
+
rangeTmp = new Range(comp.value, options);
|
|
23763
|
+
return satisfies(this.value, rangeTmp, options);
|
|
23764
|
+
} else if (comp.operator === '') {
|
|
23765
|
+
if (comp.value === '') {
|
|
23766
|
+
return true;
|
|
23767
|
+
}
|
|
23768
|
+
rangeTmp = new Range(this.value, options);
|
|
23769
|
+
return satisfies(comp.semver, rangeTmp, options);
|
|
23770
|
+
}
|
|
23771
|
+
var sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>');
|
|
23772
|
+
var sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<');
|
|
23773
|
+
var sameSemVer = this.semver.version === comp.semver.version;
|
|
23774
|
+
var differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<=');
|
|
23775
|
+
var oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && (this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<');
|
|
23776
|
+
var oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && (this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>');
|
|
23777
|
+
return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
|
|
23778
|
+
};
|
|
23779
|
+
exports.Range = Range;
|
|
23780
|
+
function Range(range, options) {
|
|
23781
|
+
if (!options || typeof options !== 'object') {
|
|
23782
|
+
options = {
|
|
23783
|
+
loose: !!options,
|
|
23784
|
+
includePrerelease: false
|
|
23785
|
+
};
|
|
23786
|
+
}
|
|
23787
|
+
if (range instanceof Range) {
|
|
23788
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
23789
|
+
return range;
|
|
23790
|
+
} else {
|
|
23791
|
+
return new Range(range.raw, options);
|
|
23792
|
+
}
|
|
23793
|
+
}
|
|
23794
|
+
if (range instanceof Comparator) {
|
|
23795
|
+
return new Range(range.value, options);
|
|
23796
|
+
}
|
|
23797
|
+
if (!(this instanceof Range)) {
|
|
23798
|
+
return new Range(range, options);
|
|
23799
|
+
}
|
|
23800
|
+
this.options = options;
|
|
23801
|
+
this.loose = !!options.loose;
|
|
23802
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
23787
23803
|
|
|
23788
|
-
|
|
23789
|
-
|
|
23790
|
-
|
|
23791
|
-
|
|
23792
|
-
|
|
23793
|
-
|
|
23804
|
+
// First, split based on boolean or ||
|
|
23805
|
+
this.raw = range;
|
|
23806
|
+
this.set = range.split(/\s*\|\|\s*/).map(function (range) {
|
|
23807
|
+
return this.parseRange(range.trim());
|
|
23808
|
+
}, this).filter(function (c) {
|
|
23809
|
+
// throw out any that are not relevant for whatever reason
|
|
23810
|
+
return c.length;
|
|
23811
|
+
});
|
|
23812
|
+
if (!this.set.length) {
|
|
23813
|
+
throw new TypeError('Invalid SemVer Range: ' + range);
|
|
23814
|
+
}
|
|
23815
|
+
this.format();
|
|
23816
|
+
}
|
|
23817
|
+
Range.prototype.format = function () {
|
|
23818
|
+
this.range = this.set.map(function (comps) {
|
|
23819
|
+
return comps.join(' ').trim();
|
|
23820
|
+
}).join('||').trim();
|
|
23821
|
+
return this.range;
|
|
23822
|
+
};
|
|
23823
|
+
Range.prototype.toString = function () {
|
|
23824
|
+
return this.range;
|
|
23825
|
+
};
|
|
23826
|
+
Range.prototype.parseRange = function (range) {
|
|
23827
|
+
var loose = this.options.loose;
|
|
23828
|
+
range = range.trim();
|
|
23829
|
+
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
23830
|
+
var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
23831
|
+
range = range.replace(hr, hyphenReplace);
|
|
23832
|
+
debug('hyphen replace', range);
|
|
23833
|
+
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
|
23834
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
23835
|
+
debug('comparator trim', range, re[t.COMPARATORTRIM]);
|
|
23836
|
+
|
|
23837
|
+
// `~ 1.2.3` => `~1.2.3`
|
|
23838
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
23839
|
+
|
|
23840
|
+
// `^ 1.2.3` => `^1.2.3`
|
|
23841
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
23842
|
+
|
|
23843
|
+
// normalize spaces
|
|
23844
|
+
range = range.split(/\s+/).join(' ');
|
|
23845
|
+
|
|
23846
|
+
// At this point, the range is completely trimmed and
|
|
23847
|
+
// ready to be split into comparators.
|
|
23848
|
+
|
|
23849
|
+
var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
23850
|
+
var set = range.split(' ').map(function (comp) {
|
|
23851
|
+
return parseComparator(comp, this.options);
|
|
23852
|
+
}, this).join(' ').split(/\s+/);
|
|
23853
|
+
if (this.options.loose) {
|
|
23854
|
+
// in loose mode, throw out any that are not valid comparators
|
|
23855
|
+
set = set.filter(function (comp) {
|
|
23856
|
+
return !!comp.match(compRe);
|
|
23857
|
+
});
|
|
23858
|
+
}
|
|
23859
|
+
set = set.map(function (comp) {
|
|
23860
|
+
return new Comparator(comp, this.options);
|
|
23861
|
+
}, this);
|
|
23862
|
+
return set;
|
|
23863
|
+
};
|
|
23864
|
+
Range.prototype.intersects = function (range, options) {
|
|
23865
|
+
if (!(range instanceof Range)) {
|
|
23866
|
+
throw new TypeError('a Range is required');
|
|
23867
|
+
}
|
|
23868
|
+
return this.set.some(function (thisComparators) {
|
|
23869
|
+
return isSatisfiable(thisComparators, options) && range.set.some(function (rangeComparators) {
|
|
23870
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every(function (thisComparator) {
|
|
23871
|
+
return rangeComparators.every(function (rangeComparator) {
|
|
23872
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
23873
|
+
});
|
|
23874
|
+
});
|
|
23875
|
+
});
|
|
23876
|
+
});
|
|
23877
|
+
};
|
|
23794
23878
|
|
|
23795
|
-
|
|
23796
|
-
|
|
23797
|
-
|
|
23798
|
-
|
|
23799
|
-
|
|
23800
|
-
|
|
23801
|
-
|
|
23802
|
-
|
|
23803
|
-
|
|
23804
|
-
|
|
23805
|
-
|
|
23806
|
-
|
|
23807
|
-
|
|
23808
|
-
|
|
23809
|
-
// if we're including prereleases in the match, then we need
|
|
23810
|
-
// to fix this to -0, the lowest possible prerelease value
|
|
23811
|
-
pr = options.includePrerelease ? '-0' : '';
|
|
23812
|
-
|
|
23813
|
-
if (xM) {
|
|
23814
|
-
if (gtlt === '>' || gtlt === '<') {
|
|
23815
|
-
// nothing is allowed
|
|
23816
|
-
ret = '<0.0.0-0';
|
|
23817
|
-
} else {
|
|
23818
|
-
// nothing is forbidden
|
|
23819
|
-
ret = '*';
|
|
23820
|
-
}
|
|
23821
|
-
} else if (gtlt && anyX) {
|
|
23822
|
-
// we know patch is an x, because we have any x at all.
|
|
23823
|
-
// replace X with 0
|
|
23824
|
-
if (xm) {
|
|
23825
|
-
m = 0;
|
|
23826
|
-
}
|
|
23827
|
-
p = 0;
|
|
23828
|
-
|
|
23829
|
-
if (gtlt === '>') {
|
|
23830
|
-
// >1 => >=2.0.0
|
|
23831
|
-
// >1.2 => >=1.3.0
|
|
23832
|
-
// >1.2.3 => >= 1.2.4
|
|
23833
|
-
gtlt = '>=';
|
|
23834
|
-
if (xm) {
|
|
23835
|
-
M = +M + 1;
|
|
23836
|
-
m = 0;
|
|
23837
|
-
p = 0;
|
|
23838
|
-
} else {
|
|
23839
|
-
m = +m + 1;
|
|
23840
|
-
p = 0;
|
|
23841
|
-
}
|
|
23842
|
-
} else if (gtlt === '<=') {
|
|
23843
|
-
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
|
23844
|
-
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
|
23845
|
-
gtlt = '<';
|
|
23846
|
-
if (xm) {
|
|
23847
|
-
M = +M + 1;
|
|
23848
|
-
} else {
|
|
23849
|
-
m = +m + 1;
|
|
23850
|
-
}
|
|
23851
|
-
}
|
|
23852
|
-
|
|
23853
|
-
ret = gtlt + M + '.' + m + '.' + p + pr;
|
|
23854
|
-
} else if (xm) {
|
|
23855
|
-
ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr;
|
|
23856
|
-
} else if (xp) {
|
|
23857
|
-
ret = '>=' + M + '.' + m + '.0' + pr +
|
|
23858
|
-
' <' + M + '.' + (+m + 1) + '.0' + pr;
|
|
23859
|
-
}
|
|
23860
|
-
|
|
23861
|
-
debug('xRange return', ret);
|
|
23862
|
-
|
|
23863
|
-
return ret
|
|
23864
|
-
})
|
|
23865
|
-
}
|
|
23879
|
+
// take a set of comparators and determine whether there
|
|
23880
|
+
// exists a version which can satisfy it
|
|
23881
|
+
function isSatisfiable(comparators, options) {
|
|
23882
|
+
var result = true;
|
|
23883
|
+
var remainingComparators = comparators.slice();
|
|
23884
|
+
var testComparator = remainingComparators.pop();
|
|
23885
|
+
while (result && remainingComparators.length) {
|
|
23886
|
+
result = remainingComparators.every(function (otherComparator) {
|
|
23887
|
+
return testComparator.intersects(otherComparator, options);
|
|
23888
|
+
});
|
|
23889
|
+
testComparator = remainingComparators.pop();
|
|
23890
|
+
}
|
|
23891
|
+
return result;
|
|
23892
|
+
}
|
|
23866
23893
|
|
|
23867
|
-
|
|
23868
|
-
|
|
23869
|
-
|
|
23870
|
-
|
|
23871
|
-
|
|
23872
|
-
|
|
23873
|
-
|
|
23894
|
+
// Mostly just for testing and legacy API reasons
|
|
23895
|
+
exports.toComparators = toComparators;
|
|
23896
|
+
function toComparators(range, options) {
|
|
23897
|
+
return new Range(range, options).set.map(function (comp) {
|
|
23898
|
+
return comp.map(function (c) {
|
|
23899
|
+
return c.value;
|
|
23900
|
+
}).join(' ').trim().split(' ');
|
|
23901
|
+
});
|
|
23902
|
+
}
|
|
23874
23903
|
|
|
23875
|
-
|
|
23876
|
-
|
|
23877
|
-
|
|
23878
|
-
|
|
23879
|
-
|
|
23880
|
-
|
|
23881
|
-
|
|
23882
|
-
|
|
23883
|
-
|
|
23884
|
-
|
|
23885
|
-
|
|
23886
|
-
|
|
23887
|
-
|
|
23888
|
-
|
|
23889
|
-
|
|
23890
|
-
|
|
23891
|
-
|
|
23892
|
-
|
|
23893
|
-
|
|
23894
|
-
|
|
23895
|
-
|
|
23896
|
-
|
|
23897
|
-
|
|
23898
|
-
|
|
23899
|
-
|
|
23900
|
-
|
|
23901
|
-
|
|
23902
|
-
|
|
23903
|
-
|
|
23904
|
-
|
|
23905
|
-
|
|
23906
|
-
|
|
23904
|
+
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
|
23905
|
+
// already replaced the hyphen ranges
|
|
23906
|
+
// turn into a set of JUST comparators.
|
|
23907
|
+
function parseComparator(comp, options) {
|
|
23908
|
+
debug('comp', comp, options);
|
|
23909
|
+
comp = replaceCarets(comp, options);
|
|
23910
|
+
debug('caret', comp);
|
|
23911
|
+
comp = replaceTildes(comp, options);
|
|
23912
|
+
debug('tildes', comp);
|
|
23913
|
+
comp = replaceXRanges(comp, options);
|
|
23914
|
+
debug('xrange', comp);
|
|
23915
|
+
comp = replaceStars(comp, options);
|
|
23916
|
+
debug('stars', comp);
|
|
23917
|
+
return comp;
|
|
23918
|
+
}
|
|
23919
|
+
function isX(id) {
|
|
23920
|
+
return !id || id.toLowerCase() === 'x' || id === '*';
|
|
23921
|
+
}
|
|
23922
|
+
|
|
23923
|
+
// ~, ~> --> * (any, kinda silly)
|
|
23924
|
+
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
|
|
23925
|
+
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
|
|
23926
|
+
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
|
|
23927
|
+
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
|
|
23928
|
+
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
|
|
23929
|
+
function replaceTildes(comp, options) {
|
|
23930
|
+
return comp.trim().split(/\s+/).map(function (comp) {
|
|
23931
|
+
return replaceTilde(comp, options);
|
|
23932
|
+
}).join(' ');
|
|
23933
|
+
}
|
|
23934
|
+
function replaceTilde(comp, options) {
|
|
23935
|
+
var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
23936
|
+
return comp.replace(r, function (_, M, m, p, pr) {
|
|
23937
|
+
debug('tilde', comp, _, M, m, p, pr);
|
|
23938
|
+
var ret;
|
|
23939
|
+
if (isX(M)) {
|
|
23940
|
+
ret = '';
|
|
23941
|
+
} else if (isX(m)) {
|
|
23942
|
+
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
|
|
23943
|
+
} else if (isX(p)) {
|
|
23944
|
+
// ~1.2 == >=1.2.0 <1.3.0
|
|
23945
|
+
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
|
|
23946
|
+
} else if (pr) {
|
|
23947
|
+
debug('replaceTilde pr', pr);
|
|
23948
|
+
ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
|
|
23949
|
+
} else {
|
|
23950
|
+
// ~1.2.3 == >=1.2.3 <1.3.0
|
|
23951
|
+
ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
|
|
23952
|
+
}
|
|
23953
|
+
debug('tilde return', ret);
|
|
23954
|
+
return ret;
|
|
23955
|
+
});
|
|
23956
|
+
}
|
|
23907
23957
|
|
|
23908
|
-
|
|
23909
|
-
|
|
23910
|
-
|
|
23911
|
-
|
|
23912
|
-
|
|
23913
|
-
|
|
23914
|
-
|
|
23915
|
-
|
|
23916
|
-
|
|
23917
|
-
|
|
23918
|
-
|
|
23919
|
-
|
|
23920
|
-
|
|
23921
|
-
|
|
23922
|
-
|
|
23923
|
-
|
|
23924
|
-
|
|
23925
|
-
|
|
23926
|
-
|
|
23927
|
-
|
|
23928
|
-
|
|
23929
|
-
|
|
23930
|
-
|
|
23931
|
-
|
|
23932
|
-
|
|
23933
|
-
|
|
23934
|
-
|
|
23935
|
-
|
|
23936
|
-
|
|
23937
|
-
|
|
23938
|
-
|
|
23939
|
-
|
|
23940
|
-
|
|
23941
|
-
|
|
23942
|
-
|
|
23943
|
-
|
|
23944
|
-
|
|
23945
|
-
|
|
23946
|
-
|
|
23947
|
-
|
|
23948
|
-
|
|
23949
|
-
|
|
23950
|
-
|
|
23951
|
-
|
|
23952
|
-
|
|
23953
|
-
|
|
23954
|
-
|
|
23955
|
-
|
|
23956
|
-
|
|
23957
|
-
|
|
23958
|
-
|
|
23959
|
-
|
|
23960
|
-
|
|
23961
|
-
|
|
23962
|
-
|
|
23963
|
-
|
|
23964
|
-
|
|
23958
|
+
// ^ --> * (any, kinda silly)
|
|
23959
|
+
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
|
|
23960
|
+
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
|
|
23961
|
+
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
|
|
23962
|
+
// ^1.2.3 --> >=1.2.3 <2.0.0
|
|
23963
|
+
// ^1.2.0 --> >=1.2.0 <2.0.0
|
|
23964
|
+
function replaceCarets(comp, options) {
|
|
23965
|
+
return comp.trim().split(/\s+/).map(function (comp) {
|
|
23966
|
+
return replaceCaret(comp, options);
|
|
23967
|
+
}).join(' ');
|
|
23968
|
+
}
|
|
23969
|
+
function replaceCaret(comp, options) {
|
|
23970
|
+
debug('caret', comp, options);
|
|
23971
|
+
var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
23972
|
+
return comp.replace(r, function (_, M, m, p, pr) {
|
|
23973
|
+
debug('caret', comp, _, M, m, p, pr);
|
|
23974
|
+
var ret;
|
|
23975
|
+
if (isX(M)) {
|
|
23976
|
+
ret = '';
|
|
23977
|
+
} else if (isX(m)) {
|
|
23978
|
+
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
|
|
23979
|
+
} else if (isX(p)) {
|
|
23980
|
+
if (M === '0') {
|
|
23981
|
+
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
|
|
23982
|
+
} else {
|
|
23983
|
+
ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0';
|
|
23984
|
+
}
|
|
23985
|
+
} else if (pr) {
|
|
23986
|
+
debug('replaceCaret pr', pr);
|
|
23987
|
+
if (M === '0') {
|
|
23988
|
+
if (m === '0') {
|
|
23989
|
+
ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + m + '.' + (+p + 1);
|
|
23990
|
+
} else {
|
|
23991
|
+
ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
|
|
23992
|
+
}
|
|
23993
|
+
} else {
|
|
23994
|
+
ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + (+M + 1) + '.0.0';
|
|
23995
|
+
}
|
|
23996
|
+
} else {
|
|
23997
|
+
debug('no pr');
|
|
23998
|
+
if (M === '0') {
|
|
23999
|
+
if (m === '0') {
|
|
24000
|
+
ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + m + '.' + (+p + 1);
|
|
24001
|
+
} else {
|
|
24002
|
+
ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
|
|
24003
|
+
}
|
|
24004
|
+
} else {
|
|
24005
|
+
ret = '>=' + M + '.' + m + '.' + p + ' <' + (+M + 1) + '.0.0';
|
|
24006
|
+
}
|
|
24007
|
+
}
|
|
24008
|
+
debug('caret return', ret);
|
|
24009
|
+
return ret;
|
|
24010
|
+
});
|
|
24011
|
+
}
|
|
24012
|
+
function replaceXRanges(comp, options) {
|
|
24013
|
+
debug('replaceXRanges', comp, options);
|
|
24014
|
+
return comp.split(/\s+/).map(function (comp) {
|
|
24015
|
+
return replaceXRange(comp, options);
|
|
24016
|
+
}).join(' ');
|
|
24017
|
+
}
|
|
24018
|
+
function replaceXRange(comp, options) {
|
|
24019
|
+
comp = comp.trim();
|
|
24020
|
+
var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
24021
|
+
return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
|
|
24022
|
+
debug('xRange', comp, ret, gtlt, M, m, p, pr);
|
|
24023
|
+
var xM = isX(M);
|
|
24024
|
+
var xm = xM || isX(m);
|
|
24025
|
+
var xp = xm || isX(p);
|
|
24026
|
+
var anyX = xp;
|
|
24027
|
+
if (gtlt === '=' && anyX) {
|
|
24028
|
+
gtlt = '';
|
|
24029
|
+
}
|
|
23965
24030
|
|
|
23966
|
-
|
|
23967
|
-
|
|
23968
|
-
|
|
23969
|
-
|
|
23970
|
-
|
|
23971
|
-
|
|
23972
|
-
|
|
23973
|
-
|
|
23974
|
-
|
|
24031
|
+
// if we're including prereleases in the match, then we need
|
|
24032
|
+
// to fix this to -0, the lowest possible prerelease value
|
|
24033
|
+
pr = options.includePrerelease ? '-0' : '';
|
|
24034
|
+
if (xM) {
|
|
24035
|
+
if (gtlt === '>' || gtlt === '<') {
|
|
24036
|
+
// nothing is allowed
|
|
24037
|
+
ret = '<0.0.0-0';
|
|
24038
|
+
} else {
|
|
24039
|
+
// nothing is forbidden
|
|
24040
|
+
ret = '*';
|
|
24041
|
+
}
|
|
24042
|
+
} else if (gtlt && anyX) {
|
|
24043
|
+
// we know patch is an x, because we have any x at all.
|
|
24044
|
+
// replace X with 0
|
|
24045
|
+
if (xm) {
|
|
24046
|
+
m = 0;
|
|
24047
|
+
}
|
|
24048
|
+
p = 0;
|
|
24049
|
+
if (gtlt === '>') {
|
|
24050
|
+
// >1 => >=2.0.0
|
|
24051
|
+
// >1.2 => >=1.3.0
|
|
24052
|
+
// >1.2.3 => >= 1.2.4
|
|
24053
|
+
gtlt = '>=';
|
|
24054
|
+
if (xm) {
|
|
24055
|
+
M = +M + 1;
|
|
24056
|
+
m = 0;
|
|
24057
|
+
p = 0;
|
|
24058
|
+
} else {
|
|
24059
|
+
m = +m + 1;
|
|
24060
|
+
p = 0;
|
|
24061
|
+
}
|
|
24062
|
+
} else if (gtlt === '<=') {
|
|
24063
|
+
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
|
24064
|
+
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
|
24065
|
+
gtlt = '<';
|
|
24066
|
+
if (xm) {
|
|
24067
|
+
M = +M + 1;
|
|
24068
|
+
} else {
|
|
24069
|
+
m = +m + 1;
|
|
24070
|
+
}
|
|
24071
|
+
}
|
|
24072
|
+
ret = gtlt + M + '.' + m + '.' + p + pr;
|
|
24073
|
+
} else if (xm) {
|
|
24074
|
+
ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr;
|
|
24075
|
+
} else if (xp) {
|
|
24076
|
+
ret = '>=' + M + '.' + m + '.0' + pr + ' <' + M + '.' + (+m + 1) + '.0' + pr;
|
|
24077
|
+
}
|
|
24078
|
+
debug('xRange return', ret);
|
|
24079
|
+
return ret;
|
|
24080
|
+
});
|
|
24081
|
+
}
|
|
23975
24082
|
|
|
23976
|
-
|
|
23977
|
-
|
|
23978
|
-
|
|
23979
|
-
|
|
23980
|
-
|
|
23981
|
-
|
|
23982
|
-
|
|
23983
|
-
|
|
23984
|
-
|
|
23985
|
-
|
|
23986
|
-
|
|
23987
|
-
|
|
23988
|
-
|
|
23989
|
-
|
|
23990
|
-
|
|
23991
|
-
|
|
23992
|
-
|
|
23993
|
-
|
|
23994
|
-
|
|
23995
|
-
|
|
23996
|
-
|
|
24083
|
+
// Because * is AND-ed with everything else in the comparator,
|
|
24084
|
+
// and '' means "any version", just remove the *s entirely.
|
|
24085
|
+
function replaceStars(comp, options) {
|
|
24086
|
+
debug('replaceStars', comp, options);
|
|
24087
|
+
// Looseness is ignored here. star is always as loose as it gets!
|
|
24088
|
+
return comp.trim().replace(re[t.STAR], '');
|
|
24089
|
+
}
|
|
24090
|
+
|
|
24091
|
+
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
|
24092
|
+
// M, m, patch, prerelease, build
|
|
24093
|
+
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
|
24094
|
+
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
|
|
24095
|
+
// 1.2 - 3.4 => >=1.2.0 <3.5.0
|
|
24096
|
+
function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) {
|
|
24097
|
+
if (isX(fM)) {
|
|
24098
|
+
from = '';
|
|
24099
|
+
} else if (isX(fm)) {
|
|
24100
|
+
from = '>=' + fM + '.0.0';
|
|
24101
|
+
} else if (isX(fp)) {
|
|
24102
|
+
from = '>=' + fM + '.' + fm + '.0';
|
|
24103
|
+
} else {
|
|
24104
|
+
from = '>=' + from;
|
|
24105
|
+
}
|
|
24106
|
+
if (isX(tM)) {
|
|
24107
|
+
to = '';
|
|
24108
|
+
} else if (isX(tm)) {
|
|
24109
|
+
to = '<' + (+tM + 1) + '.0.0';
|
|
24110
|
+
} else if (isX(tp)) {
|
|
24111
|
+
to = '<' + tM + '.' + (+tm + 1) + '.0';
|
|
24112
|
+
} else if (tpr) {
|
|
24113
|
+
to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
|
|
24114
|
+
} else {
|
|
24115
|
+
to = '<=' + to;
|
|
24116
|
+
}
|
|
24117
|
+
return (from + ' ' + to).trim();
|
|
24118
|
+
}
|
|
23997
24119
|
|
|
23998
|
-
|
|
23999
|
-
|
|
24000
|
-
|
|
24001
|
-
|
|
24002
|
-
|
|
24003
|
-
|
|
24004
|
-
|
|
24005
|
-
|
|
24006
|
-
|
|
24007
|
-
|
|
24008
|
-
|
|
24009
|
-
|
|
24010
|
-
|
|
24011
|
-
|
|
24012
|
-
|
|
24013
|
-
|
|
24014
|
-
|
|
24015
|
-
|
|
24016
|
-
|
|
24017
|
-
|
|
24018
|
-
|
|
24120
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
|
24121
|
+
Range.prototype.test = function (version) {
|
|
24122
|
+
if (!version) {
|
|
24123
|
+
return false;
|
|
24124
|
+
}
|
|
24125
|
+
if (typeof version === 'string') {
|
|
24126
|
+
try {
|
|
24127
|
+
version = new SemVer(version, this.options);
|
|
24128
|
+
} catch (er) {
|
|
24129
|
+
return false;
|
|
24130
|
+
}
|
|
24131
|
+
}
|
|
24132
|
+
for (var i = 0; i < this.set.length; i++) {
|
|
24133
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
24134
|
+
return true;
|
|
24135
|
+
}
|
|
24136
|
+
}
|
|
24137
|
+
return false;
|
|
24138
|
+
};
|
|
24139
|
+
function testSet(set, version, options) {
|
|
24140
|
+
for (var i = 0; i < set.length; i++) {
|
|
24141
|
+
if (!set[i].test(version)) {
|
|
24142
|
+
return false;
|
|
24143
|
+
}
|
|
24144
|
+
}
|
|
24145
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
24146
|
+
// Find the set of versions that are allowed to have prereleases
|
|
24147
|
+
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
|
24148
|
+
// That should allow `1.2.3-pr.2` to pass.
|
|
24149
|
+
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
|
24150
|
+
// even though it's within the range set by the comparators.
|
|
24151
|
+
for (i = 0; i < set.length; i++) {
|
|
24152
|
+
debug(set[i].semver);
|
|
24153
|
+
if (set[i].semver === ANY) {
|
|
24154
|
+
continue;
|
|
24155
|
+
}
|
|
24156
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
24157
|
+
var allowed = set[i].semver;
|
|
24158
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
24159
|
+
return true;
|
|
24160
|
+
}
|
|
24161
|
+
}
|
|
24162
|
+
}
|
|
24019
24163
|
|
|
24020
|
-
|
|
24021
|
-
|
|
24022
|
-
|
|
24023
|
-
|
|
24024
|
-
|
|
24025
|
-
|
|
24026
|
-
|
|
24027
|
-
|
|
24028
|
-
|
|
24029
|
-
|
|
24030
|
-
|
|
24031
|
-
|
|
24032
|
-
|
|
24033
|
-
|
|
24034
|
-
|
|
24035
|
-
|
|
24036
|
-
|
|
24037
|
-
|
|
24038
|
-
|
|
24039
|
-
|
|
24040
|
-
|
|
24041
|
-
|
|
24042
|
-
|
|
24043
|
-
|
|
24044
|
-
|
|
24045
|
-
|
|
24046
|
-
|
|
24047
|
-
|
|
24048
|
-
|
|
24049
|
-
|
|
24050
|
-
|
|
24051
|
-
|
|
24052
|
-
|
|
24053
|
-
|
|
24054
|
-
|
|
24055
|
-
|
|
24056
|
-
|
|
24057
|
-
|
|
24058
|
-
|
|
24059
|
-
|
|
24060
|
-
|
|
24061
|
-
|
|
24062
|
-
|
|
24063
|
-
|
|
24064
|
-
|
|
24065
|
-
|
|
24066
|
-
|
|
24067
|
-
|
|
24068
|
-
|
|
24069
|
-
|
|
24070
|
-
|
|
24071
|
-
|
|
24072
|
-
|
|
24164
|
+
// Version has a -pre, but it's not one of the ones we like.
|
|
24165
|
+
return false;
|
|
24166
|
+
}
|
|
24167
|
+
return true;
|
|
24168
|
+
}
|
|
24169
|
+
exports.satisfies = satisfies;
|
|
24170
|
+
function satisfies(version, range, options) {
|
|
24171
|
+
try {
|
|
24172
|
+
range = new Range(range, options);
|
|
24173
|
+
} catch (er) {
|
|
24174
|
+
return false;
|
|
24175
|
+
}
|
|
24176
|
+
return range.test(version);
|
|
24177
|
+
}
|
|
24178
|
+
exports.maxSatisfying = maxSatisfying;
|
|
24179
|
+
function maxSatisfying(versions, range, options) {
|
|
24180
|
+
var max = null;
|
|
24181
|
+
var maxSV = null;
|
|
24182
|
+
try {
|
|
24183
|
+
var rangeObj = new Range(range, options);
|
|
24184
|
+
} catch (er) {
|
|
24185
|
+
return null;
|
|
24186
|
+
}
|
|
24187
|
+
versions.forEach(function (v) {
|
|
24188
|
+
if (rangeObj.test(v)) {
|
|
24189
|
+
// satisfies(v, range, options)
|
|
24190
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
24191
|
+
// compare(max, v, true)
|
|
24192
|
+
max = v;
|
|
24193
|
+
maxSV = new SemVer(max, options);
|
|
24194
|
+
}
|
|
24195
|
+
}
|
|
24196
|
+
});
|
|
24197
|
+
return max;
|
|
24198
|
+
}
|
|
24199
|
+
exports.minSatisfying = minSatisfying;
|
|
24200
|
+
function minSatisfying(versions, range, options) {
|
|
24201
|
+
var min = null;
|
|
24202
|
+
var minSV = null;
|
|
24203
|
+
try {
|
|
24204
|
+
var rangeObj = new Range(range, options);
|
|
24205
|
+
} catch (er) {
|
|
24206
|
+
return null;
|
|
24207
|
+
}
|
|
24208
|
+
versions.forEach(function (v) {
|
|
24209
|
+
if (rangeObj.test(v)) {
|
|
24210
|
+
// satisfies(v, range, options)
|
|
24211
|
+
if (!min || minSV.compare(v) === 1) {
|
|
24212
|
+
// compare(min, v, true)
|
|
24213
|
+
min = v;
|
|
24214
|
+
minSV = new SemVer(min, options);
|
|
24215
|
+
}
|
|
24216
|
+
}
|
|
24217
|
+
});
|
|
24218
|
+
return min;
|
|
24219
|
+
}
|
|
24220
|
+
exports.minVersion = minVersion;
|
|
24221
|
+
function minVersion(range, loose) {
|
|
24222
|
+
range = new Range(range, loose);
|
|
24223
|
+
var minver = new SemVer('0.0.0');
|
|
24224
|
+
if (range.test(minver)) {
|
|
24225
|
+
return minver;
|
|
24226
|
+
}
|
|
24227
|
+
minver = new SemVer('0.0.0-0');
|
|
24228
|
+
if (range.test(minver)) {
|
|
24229
|
+
return minver;
|
|
24230
|
+
}
|
|
24231
|
+
minver = null;
|
|
24232
|
+
for (var i = 0; i < range.set.length; ++i) {
|
|
24233
|
+
var comparators = range.set[i];
|
|
24234
|
+
comparators.forEach(function (comparator) {
|
|
24235
|
+
// Clone to avoid manipulating the comparator's semver object.
|
|
24236
|
+
var compver = new SemVer(comparator.semver.version);
|
|
24237
|
+
switch (comparator.operator) {
|
|
24238
|
+
case '>':
|
|
24239
|
+
if (compver.prerelease.length === 0) {
|
|
24240
|
+
compver.patch++;
|
|
24241
|
+
} else {
|
|
24242
|
+
compver.prerelease.push(0);
|
|
24243
|
+
}
|
|
24244
|
+
compver.raw = compver.format();
|
|
24245
|
+
/* fallthrough */
|
|
24246
|
+
case '':
|
|
24247
|
+
case '>=':
|
|
24248
|
+
if (!minver || gt(minver, compver)) {
|
|
24249
|
+
minver = compver;
|
|
24250
|
+
}
|
|
24251
|
+
break;
|
|
24252
|
+
case '<':
|
|
24253
|
+
case '<=':
|
|
24254
|
+
/* Ignore maximum versions */
|
|
24255
|
+
break;
|
|
24256
|
+
/* istanbul ignore next */
|
|
24257
|
+
default:
|
|
24258
|
+
throw new Error('Unexpected operation: ' + comparator.operator);
|
|
24259
|
+
}
|
|
24260
|
+
});
|
|
24261
|
+
}
|
|
24262
|
+
if (minver && range.test(minver)) {
|
|
24263
|
+
return minver;
|
|
24264
|
+
}
|
|
24265
|
+
return null;
|
|
24266
|
+
}
|
|
24267
|
+
exports.validRange = validRange;
|
|
24268
|
+
function validRange(range, options) {
|
|
24269
|
+
try {
|
|
24270
|
+
// Return '*' instead of '' so that truthiness works.
|
|
24271
|
+
// This will throw if it's invalid anyway
|
|
24272
|
+
return new Range(range, options).range || '*';
|
|
24273
|
+
} catch (er) {
|
|
24274
|
+
return null;
|
|
24275
|
+
}
|
|
24276
|
+
}
|
|
24073
24277
|
|
|
24074
|
-
|
|
24075
|
-
|
|
24076
|
-
|
|
24077
|
-
|
|
24078
|
-
|
|
24079
|
-
return new Range(range, options).range || '*'
|
|
24080
|
-
} catch (er) {
|
|
24081
|
-
return null
|
|
24082
|
-
}
|
|
24083
|
-
}
|
|
24278
|
+
// Determine if version is less than all the versions possible in the range
|
|
24279
|
+
exports.ltr = ltr;
|
|
24280
|
+
function ltr(version, range, options) {
|
|
24281
|
+
return outside(version, range, '<', options);
|
|
24282
|
+
}
|
|
24084
24283
|
|
|
24085
|
-
|
|
24086
|
-
|
|
24087
|
-
|
|
24088
|
-
|
|
24089
|
-
|
|
24284
|
+
// Determine if version is greater than all the versions possible in the range.
|
|
24285
|
+
exports.gtr = gtr;
|
|
24286
|
+
function gtr(version, range, options) {
|
|
24287
|
+
return outside(version, range, '>', options);
|
|
24288
|
+
}
|
|
24289
|
+
exports.outside = outside;
|
|
24290
|
+
function outside(version, range, hilo, options) {
|
|
24291
|
+
version = new SemVer(version, options);
|
|
24292
|
+
range = new Range(range, options);
|
|
24293
|
+
var gtfn, ltefn, ltfn, comp, ecomp;
|
|
24294
|
+
switch (hilo) {
|
|
24295
|
+
case '>':
|
|
24296
|
+
gtfn = gt;
|
|
24297
|
+
ltefn = lte;
|
|
24298
|
+
ltfn = lt;
|
|
24299
|
+
comp = '>';
|
|
24300
|
+
ecomp = '>=';
|
|
24301
|
+
break;
|
|
24302
|
+
case '<':
|
|
24303
|
+
gtfn = lt;
|
|
24304
|
+
ltefn = gte;
|
|
24305
|
+
ltfn = gt;
|
|
24306
|
+
comp = '<';
|
|
24307
|
+
ecomp = '<=';
|
|
24308
|
+
break;
|
|
24309
|
+
default:
|
|
24310
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
24311
|
+
}
|
|
24090
24312
|
|
|
24091
|
-
|
|
24092
|
-
|
|
24093
|
-
|
|
24094
|
-
|
|
24095
|
-
}
|
|
24313
|
+
// If it satisifes the range it is not outside
|
|
24314
|
+
if (satisfies(version, range, options)) {
|
|
24315
|
+
return false;
|
|
24316
|
+
}
|
|
24096
24317
|
|
|
24097
|
-
|
|
24098
|
-
|
|
24099
|
-
version = new SemVer(version, options);
|
|
24100
|
-
range = new Range(range, options);
|
|
24101
|
-
|
|
24102
|
-
var gtfn, ltefn, ltfn, comp, ecomp;
|
|
24103
|
-
switch (hilo) {
|
|
24104
|
-
case '>':
|
|
24105
|
-
gtfn = gt;
|
|
24106
|
-
ltefn = lte;
|
|
24107
|
-
ltfn = lt;
|
|
24108
|
-
comp = '>';
|
|
24109
|
-
ecomp = '>=';
|
|
24110
|
-
break
|
|
24111
|
-
case '<':
|
|
24112
|
-
gtfn = lt;
|
|
24113
|
-
ltefn = gte;
|
|
24114
|
-
ltfn = gt;
|
|
24115
|
-
comp = '<';
|
|
24116
|
-
ecomp = '<=';
|
|
24117
|
-
break
|
|
24118
|
-
default:
|
|
24119
|
-
throw new TypeError('Must provide a hilo val of "<" or ">"')
|
|
24120
|
-
}
|
|
24121
|
-
|
|
24122
|
-
// If it satisifes the range it is not outside
|
|
24123
|
-
if (satisfies(version, range, options)) {
|
|
24124
|
-
return false
|
|
24125
|
-
}
|
|
24126
|
-
|
|
24127
|
-
// From now on, variable terms are as if we're in "gtr" mode.
|
|
24128
|
-
// but note that everything is flipped for the "ltr" function.
|
|
24129
|
-
|
|
24130
|
-
for (var i = 0; i < range.set.length; ++i) {
|
|
24131
|
-
var comparators = range.set[i];
|
|
24132
|
-
|
|
24133
|
-
var high = null;
|
|
24134
|
-
var low = null;
|
|
24135
|
-
|
|
24136
|
-
comparators.forEach(function (comparator) {
|
|
24137
|
-
if (comparator.semver === ANY) {
|
|
24138
|
-
comparator = new Comparator('>=0.0.0');
|
|
24139
|
-
}
|
|
24140
|
-
high = high || comparator;
|
|
24141
|
-
low = low || comparator;
|
|
24142
|
-
if (gtfn(comparator.semver, high.semver, options)) {
|
|
24143
|
-
high = comparator;
|
|
24144
|
-
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
24145
|
-
low = comparator;
|
|
24146
|
-
}
|
|
24147
|
-
});
|
|
24148
|
-
|
|
24149
|
-
// If the edge version comparator has a operator then our version
|
|
24150
|
-
// isn't outside it
|
|
24151
|
-
if (high.operator === comp || high.operator === ecomp) {
|
|
24152
|
-
return false
|
|
24153
|
-
}
|
|
24154
|
-
|
|
24155
|
-
// If the lowest version comparator has an operator and our version
|
|
24156
|
-
// is less than it then it isn't higher than the range
|
|
24157
|
-
if ((!low.operator || low.operator === comp) &&
|
|
24158
|
-
ltefn(version, low.semver)) {
|
|
24159
|
-
return false
|
|
24160
|
-
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
24161
|
-
return false
|
|
24162
|
-
}
|
|
24163
|
-
}
|
|
24164
|
-
return true
|
|
24165
|
-
}
|
|
24318
|
+
// From now on, variable terms are as if we're in "gtr" mode.
|
|
24319
|
+
// but note that everything is flipped for the "ltr" function.
|
|
24166
24320
|
|
|
24167
|
-
|
|
24168
|
-
|
|
24169
|
-
|
|
24170
|
-
|
|
24171
|
-
|
|
24321
|
+
for (var i = 0; i < range.set.length; ++i) {
|
|
24322
|
+
var comparators = range.set[i];
|
|
24323
|
+
var high = null;
|
|
24324
|
+
var low = null;
|
|
24325
|
+
comparators.forEach(function (comparator) {
|
|
24326
|
+
if (comparator.semver === ANY) {
|
|
24327
|
+
comparator = new Comparator('>=0.0.0');
|
|
24328
|
+
}
|
|
24329
|
+
high = high || comparator;
|
|
24330
|
+
low = low || comparator;
|
|
24331
|
+
if (gtfn(comparator.semver, high.semver, options)) {
|
|
24332
|
+
high = comparator;
|
|
24333
|
+
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
24334
|
+
low = comparator;
|
|
24335
|
+
}
|
|
24336
|
+
});
|
|
24172
24337
|
|
|
24173
|
-
|
|
24174
|
-
|
|
24175
|
-
|
|
24176
|
-
|
|
24177
|
-
|
|
24178
|
-
}
|
|
24338
|
+
// If the edge version comparator has a operator then our version
|
|
24339
|
+
// isn't outside it
|
|
24340
|
+
if (high.operator === comp || high.operator === ecomp) {
|
|
24341
|
+
return false;
|
|
24342
|
+
}
|
|
24179
24343
|
|
|
24180
|
-
|
|
24181
|
-
|
|
24182
|
-
|
|
24183
|
-
|
|
24184
|
-
|
|
24185
|
-
|
|
24186
|
-
|
|
24187
|
-
|
|
24188
|
-
|
|
24189
|
-
|
|
24190
|
-
|
|
24191
|
-
|
|
24192
|
-
|
|
24193
|
-
|
|
24194
|
-
|
|
24195
|
-
|
|
24196
|
-
|
|
24197
|
-
|
|
24198
|
-
|
|
24199
|
-
|
|
24200
|
-
|
|
24201
|
-
|
|
24202
|
-
|
|
24203
|
-
|
|
24204
|
-
|
|
24205
|
-
|
|
24206
|
-
|
|
24207
|
-
|
|
24208
|
-
|
|
24209
|
-
|
|
24210
|
-
|
|
24211
|
-
|
|
24212
|
-
|
|
24213
|
-
|
|
24214
|
-
|
|
24215
|
-
|
|
24216
|
-
|
|
24217
|
-
|
|
24218
|
-
|
|
24219
|
-
|
|
24220
|
-
|
|
24221
|
-
|
|
24222
|
-
|
|
24223
|
-
|
|
24224
|
-
|
|
24225
|
-
|
|
24226
|
-
|
|
24227
|
-
|
|
24228
|
-
|
|
24229
|
-
|
|
24230
|
-
|
|
24344
|
+
// If the lowest version comparator has an operator and our version
|
|
24345
|
+
// is less than it then it isn't higher than the range
|
|
24346
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
24347
|
+
return false;
|
|
24348
|
+
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
24349
|
+
return false;
|
|
24350
|
+
}
|
|
24351
|
+
}
|
|
24352
|
+
return true;
|
|
24353
|
+
}
|
|
24354
|
+
exports.prerelease = prerelease;
|
|
24355
|
+
function prerelease(version, options) {
|
|
24356
|
+
var parsed = parse(version, options);
|
|
24357
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
24358
|
+
}
|
|
24359
|
+
exports.intersects = intersects;
|
|
24360
|
+
function intersects(r1, r2, options) {
|
|
24361
|
+
r1 = new Range(r1, options);
|
|
24362
|
+
r2 = new Range(r2, options);
|
|
24363
|
+
return r1.intersects(r2);
|
|
24364
|
+
}
|
|
24365
|
+
exports.coerce = coerce;
|
|
24366
|
+
function coerce(version, options) {
|
|
24367
|
+
if (version instanceof SemVer) {
|
|
24368
|
+
return version;
|
|
24369
|
+
}
|
|
24370
|
+
if (typeof version === 'number') {
|
|
24371
|
+
version = String(version);
|
|
24372
|
+
}
|
|
24373
|
+
if (typeof version !== 'string') {
|
|
24374
|
+
return null;
|
|
24375
|
+
}
|
|
24376
|
+
options = options || {};
|
|
24377
|
+
var match = null;
|
|
24378
|
+
if (!options.rtl) {
|
|
24379
|
+
match = version.match(re[t.COERCE]);
|
|
24380
|
+
} else {
|
|
24381
|
+
// Find the right-most coercible string that does not share
|
|
24382
|
+
// a terminus with a more left-ward coercible string.
|
|
24383
|
+
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
|
|
24384
|
+
//
|
|
24385
|
+
// Walk through the string checking with a /g regexp
|
|
24386
|
+
// Manually set the index so as to pick up overlapping matches.
|
|
24387
|
+
// Stop when we get a match that ends at the string end, since no
|
|
24388
|
+
// coercible string can be more right-ward without the same terminus.
|
|
24389
|
+
var next;
|
|
24390
|
+
while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
24391
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
24392
|
+
match = next;
|
|
24393
|
+
}
|
|
24394
|
+
re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
|
|
24395
|
+
}
|
|
24396
|
+
// leave it in a clean state
|
|
24397
|
+
re[t.COERCERTL].lastIndex = -1;
|
|
24398
|
+
}
|
|
24399
|
+
if (match === null) {
|
|
24400
|
+
return null;
|
|
24401
|
+
}
|
|
24402
|
+
return parse(match[2] + '.' + (match[3] || '0') + '.' + (match[4] || '0'), options);
|
|
24403
|
+
}
|
|
24404
|
+
})(semver, semverExports);
|
|
24231
24405
|
|
|
24232
24406
|
const LOADED = {};
|
|
24233
24407
|
|
|
@@ -24651,8 +24825,9 @@ function nuked() {
|
|
|
24651
24825
|
const api = /** @lends Embed# */{
|
|
24652
24826
|
/**
|
|
24653
24827
|
* Renders a visualization or sheet into an HTMLElement.
|
|
24828
|
+
* Visualizations can either be existing objects or created on the fly.
|
|
24654
24829
|
* Support for sense sheets is experimental.
|
|
24655
|
-
* @param {
|
|
24830
|
+
* @param {RenderConfig} cfg The render configuration.
|
|
24656
24831
|
* @returns {Promise<Viz|Sheet>} A controller to the rendered visualization or sheet.
|
|
24657
24832
|
* @example
|
|
24658
24833
|
* // render from existing object
|
|
@@ -24675,6 +24850,37 @@ function nuked() {
|
|
|
24675
24850
|
}
|
|
24676
24851
|
return createSessionObject(cfg, halo);
|
|
24677
24852
|
},
|
|
24853
|
+
/**
|
|
24854
|
+
* Creates a visualization model
|
|
24855
|
+
* @param {CreateConfig} cfg The create configuration.
|
|
24856
|
+
* @experimental
|
|
24857
|
+
* @returns {Promise<EngineAPI.IGenericObject>} An engima model
|
|
24858
|
+
* @example
|
|
24859
|
+
* // create a barchart in the app and return the model
|
|
24860
|
+
* const model = await n.create({
|
|
24861
|
+
* type: 'barchart',
|
|
24862
|
+
* fields: ['Product', { qLibraryId: 'u378hn', type: 'measure' }],
|
|
24863
|
+
* properties: { showTitle: true }
|
|
24864
|
+
* }
|
|
24865
|
+
* );
|
|
24866
|
+
*/
|
|
24867
|
+
create: async cfg => createObject(cfg, halo, false),
|
|
24868
|
+
/**
|
|
24869
|
+
* Generates properties for a visualization object
|
|
24870
|
+
* @param {CreateConfig} cfg The create configuration.
|
|
24871
|
+
* @experimental
|
|
24872
|
+
* @returns {Promise<object>} The objects properties
|
|
24873
|
+
* @example
|
|
24874
|
+
* // generate properties for a barchart
|
|
24875
|
+
* const properties = await n.create({
|
|
24876
|
+
* type: 'barchart',
|
|
24877
|
+
* fields: ['Product', { qLibraryId: 'u378hn', type: 'measure' }],
|
|
24878
|
+
* properties: { showTitle: true }
|
|
24879
|
+
* },
|
|
24880
|
+
* true
|
|
24881
|
+
* );
|
|
24882
|
+
*/
|
|
24883
|
+
generateProperties: async cfg => createObject(cfg, halo, true),
|
|
24678
24884
|
/**
|
|
24679
24885
|
* Updates the current context of this embed instance.
|
|
24680
24886
|
* Use this when you want to change some part of the current context, like theme.
|