@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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v4.0.0-alpha.7
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
  */
@@ -1720,6 +1720,246 @@
1720
1720
  "zh-TW": "不符計算條件"
1721
1721
  }
1722
1722
  };
1723
+ var Object_Listbox_Selected = {
1724
+ id: "Object.Listbox.Selected",
1725
+ locale: {
1726
+ "de-DE": "Ausgewählt",
1727
+ "en-US": "Selected",
1728
+ "es-ES": "Seleccionado",
1729
+ "fr-FR": "Sélectionné",
1730
+ "it-IT": "Selezionato",
1731
+ "ja-JP": "選択済み",
1732
+ "ko-KR": "선택됨",
1733
+ "nl-NL": "Geselecteerd",
1734
+ "pl-PL": "Wybrane",
1735
+ "pt-BR": "Selecionado",
1736
+ "ru-RU": "Выбранные",
1737
+ "sv-SE": "Urval",
1738
+ "tr-TR": "Seçilen",
1739
+ "zh-CN": "已选择",
1740
+ "zh-TW": "已選取"
1741
+ }
1742
+ };
1743
+ var Object_Listbox_Alternative = {
1744
+ id: "Object.Listbox.Alternative",
1745
+ locale: {
1746
+ "de-DE": "Alternative",
1747
+ "en-US": "Alternative",
1748
+ "es-ES": "Alternativo",
1749
+ "fr-FR": "Alternatif",
1750
+ "it-IT": "Alternativo",
1751
+ "ja-JP": "代替",
1752
+ "ko-KR": "대체 항목",
1753
+ "nl-NL": "Alternatief",
1754
+ "pl-PL": "Alternatywne",
1755
+ "pt-BR": "Alternativo",
1756
+ "ru-RU": "Альтернативные",
1757
+ "sv-SE": "Alternativ",
1758
+ "tr-TR": "Alternatif",
1759
+ "zh-CN": "可选",
1760
+ "zh-TW": "替代選項"
1761
+ }
1762
+ };
1763
+ var Object_Listbox_Optional = {
1764
+ id: "Object.Listbox.Optional",
1765
+ locale: {
1766
+ "de-DE": "Optional",
1767
+ "en-US": "Optional",
1768
+ "es-ES": "Opcional",
1769
+ "fr-FR": "Facultatif",
1770
+ "it-IT": "Opzionale",
1771
+ "ja-JP": "オプション",
1772
+ "ko-KR": "선택 사항",
1773
+ "nl-NL": "Optioneel",
1774
+ "pl-PL": "Opcjonalne",
1775
+ "pt-BR": "Opcional",
1776
+ "ru-RU": "Дополнительные",
1777
+ "sv-SE": "Valfritt",
1778
+ "tr-TR": "İsteğe bağlı",
1779
+ "zh-CN": "可选",
1780
+ "zh-TW": "選用"
1781
+ }
1782
+ };
1783
+ var Object_Listbox_SelectedExcluded = {
1784
+ id: "Object.Listbox.SelectedExcluded",
1785
+ locale: {
1786
+ "de-DE": "Ausgeschlossen ausgewählt",
1787
+ "en-US": "Selected excluded",
1788
+ "es-ES": "Seleccionado excluido",
1789
+ "fr-FR": "Sélectionné exclu",
1790
+ "it-IT": "Selezionato escluso",
1791
+ "ja-JP": "選択された除外値",
1792
+ "ko-KR": "제외 항목 선택됨",
1793
+ "nl-NL": "Geselecteerde uitgesloten",
1794
+ "pl-PL": "Wybrane wykluczone",
1795
+ "pt-BR": "Excluído selecionado",
1796
+ "ru-RU": "Выбранные исключенные элементы",
1797
+ "sv-SE": "Urval uteslutet",
1798
+ "tr-TR": "Seçili hariç tutulan",
1799
+ "zh-CN": "已排除选择",
1800
+ "zh-TW": "已選取排除值"
1801
+ }
1802
+ };
1803
+ var Object_Listbox_Locked = {
1804
+ id: "Object.Listbox.Locked",
1805
+ locale: {
1806
+ "de-DE": "Gesperrt",
1807
+ "en-US": "Locked",
1808
+ "es-ES": "Bloqueado",
1809
+ "fr-FR": "Verrouillé",
1810
+ "it-IT": "Bloccato",
1811
+ "ja-JP": "ロック済み",
1812
+ "ko-KR": "잠김",
1813
+ "nl-NL": "Vergrendeld",
1814
+ "pl-PL": "Zablokowane",
1815
+ "pt-BR": "Bloqueado",
1816
+ "ru-RU": "Заблокированные",
1817
+ "sv-SE": "Låst",
1818
+ "tr-TR": "Kilitli",
1819
+ "zh-CN": "已锁定",
1820
+ "zh-TW": "已鎖定"
1821
+ }
1822
+ };
1823
+ var Object_Listbox_Excluded = {
1824
+ id: "Object.Listbox.Excluded",
1825
+ locale: {
1826
+ "de-DE": "Ausgeschlossen",
1827
+ "en-US": "Excluded",
1828
+ "es-ES": "Excluido",
1829
+ "fr-FR": "Exclu",
1830
+ "it-IT": "Escluso",
1831
+ "ja-JP": "除外済み",
1832
+ "ko-KR": "제외됨",
1833
+ "nl-NL": "Uitgesloten",
1834
+ "pl-PL": "Wykluczone",
1835
+ "pt-BR": "Excluído",
1836
+ "ru-RU": "Исключенные",
1837
+ "sv-SE": "Uteslutet",
1838
+ "tr-TR": "Hariç tutulan",
1839
+ "zh-CN": "已排除",
1840
+ "zh-TW": "已排除"
1841
+ }
1842
+ };
1843
+ var Object_Listbox_ExcludedLock = {
1844
+ id: "Object.Listbox.ExcludedLock",
1845
+ locale: {
1846
+ "de-DE": "Ausgeschlossene Sperre",
1847
+ "en-US": "Excluded lock",
1848
+ "es-ES": "Bloqueo excluido",
1849
+ "fr-FR": "Exclu verrouillé",
1850
+ "it-IT": "Blocco escluso",
1851
+ "ja-JP": "除外されたロック",
1852
+ "ko-KR": "제외된 잠금",
1853
+ "nl-NL": "Uitsluitingsvergrendeling",
1854
+ "pl-PL": "Wykluczone zablokowane",
1855
+ "pt-BR": "Bloqueado excluído",
1856
+ "ru-RU": "Блокировать исключенные элементы",
1857
+ "sv-SE": "Uteslutet låst",
1858
+ "tr-TR": "Hariç tutulan kilit",
1859
+ "zh-CN": "已排除锁定",
1860
+ "zh-TW": "已排除鎖定"
1861
+ }
1862
+ };
1863
+ var Listbox_ScreenReader_SelectionMenu_WithAccSelMenu = {
1864
+ id: "Listbox.ScreenReader.SelectionMenu.WithAccSelMenu",
1865
+ locale: {
1866
+ "de-DE": "Drücken Sie gleichzeitig die Umschalt- und die Tabulatortaste, um den Fokus in das Auswahlmenü zu setzen.",
1867
+ "en-US": "Press Shift plus Tab to set focus on the selections menu.",
1868
+ "es-ES": "Pulse Mayús + Tabulador para establecer el foco en el menú de selecciones.",
1869
+ "fr-FR": "Appuyez sur Maj + Tab pour mettre le focus sur le menu de sélections.",
1870
+ "it-IT": "Premere insieme i tasti MAIUSC+TAB per evidenziare il menu di selezione.",
1871
+ "ja-JP": "Shift キー + Tab キーを押して、選択メニューで焦点を設定します。",
1872
+ "ko-KR": "선택 메뉴에 초점을 설정하려면 Shift+Tab을 누르십시오.",
1873
+ "nl-NL": "Druk op Shift + Tab om de focus in te stellen op het selectiemenu.",
1874
+ "pl-PL": "Naciśnij Shift i Tab, aby ustawić ostrość na menu selekcji.",
1875
+ "pt-BR": "Pressione Shift + Tab para definir o foco sobre o menu de seleções.",
1876
+ "ru-RU": "Нажмите сочетание клавиш \"Shift + Tab\" для установки фокуса на меню выбора.",
1877
+ "sv-SE": "Tryck på Skift plus Tabb när du vill ställa in fokus på urvalsmenyn.",
1878
+ "tr-TR": "Odağı seçim menüsüne ayarlamak için Shift ve Sekme tuşlarına birlikte basın.",
1879
+ "zh-CN": "按下 Shift 加 Tab 以将焦点设置在选择菜单上。",
1880
+ "zh-TW": "按下 Shift 加 Tab 以在選項功能表上設定焦點。"
1881
+ }
1882
+ };
1883
+ var Listbox_ScreenReader_SearchThenSelectionsMenu_WithAccSelMenu = {
1884
+ id: "Listbox.ScreenReader.SearchThenSelectionsMenu.WithAccSelMenu",
1885
+ locale: {
1886
+ "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.",
1887
+ "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.",
1888
+ "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.",
1889
+ "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.",
1890
+ "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.",
1891
+ "ja-JP": "Shift + Tab を押して検索バーにフォーカスを設定し、Shift + Tab をもう一度押して選択メニューにフォーカスを設定します。",
1892
+ "ko-KR": "Shift+Tab을 눌러 검색 막대에 초점을 맞춘 다음 Shift+Tab을 다시 눌러 선택 메뉴에 초점을 맞추십시오.",
1893
+ "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.",
1894
+ "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.",
1895
+ "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.",
1896
+ "ru-RU": "Нажмите сочетание клавиш \"Shift + Tab\" для установки фокуса на панель поиска. Затем нажмите сочетание клавиш \"Shift + Tab\" снова, чтобы установить фокус на меню выборки.",
1897
+ "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.",
1898
+ "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.",
1899
+ "zh-CN": "按 Shift+Tab 在搜索栏上设置焦点,然后再次按 Shift+Tab 在“选择”菜单上设置焦点。",
1900
+ "zh-TW": "按下 Shift 加 Tab 鍵以設定搜尋列上的焦點,然後再次按下 Shift 加 Tab 鍵,以設定選項功能表上的焦點。"
1901
+ }
1902
+ };
1903
+ var ScreenReader_ZeroSelected = {
1904
+ id: "ScreenReader.ZeroSelected",
1905
+ locale: {
1906
+ "de-DE": "Es sind keine Werte ausgewählt.",
1907
+ "en-US": "No values are selected.",
1908
+ "es-ES": "No se ha seleccionado ningún valor.",
1909
+ "fr-FR": "Aucune valeur n'a été sélectionnée.",
1910
+ "it-IT": "Nessun valore selezionato.",
1911
+ "ja-JP": "値が選択されていません。",
1912
+ "ko-KR": "선택된 값이 없습니다.",
1913
+ "nl-NL": "Geen waarden geselecteerd.",
1914
+ "pl-PL": "Brak wybranych wartości.",
1915
+ "pt-BR": "Nenhum valor selecionado.",
1916
+ "ru-RU": "Значения не выбраны.",
1917
+ "sv-SE": "Inga värden är valda.",
1918
+ "tr-TR": "Seçilen değer yok.",
1919
+ "zh-CN": "未选择值。",
1920
+ "zh-TW": "沒有選取任何值。"
1921
+ }
1922
+ };
1923
+ var ScreenReader_OneSelected = {
1924
+ id: "ScreenReader.OneSelected",
1925
+ locale: {
1926
+ "de-DE": "Es ist ein Wert ausgewählt.",
1927
+ "en-US": "There is one selected value.",
1928
+ "es-ES": "Hay un valor seleccionado.",
1929
+ "fr-FR": "Une valeur a été sélectionnée.",
1930
+ "it-IT": "È presente un valore selezionato.",
1931
+ "ja-JP": "値が 1 つ選択されています。",
1932
+ "ko-KR": "하나의 값이 선택되었습니다.",
1933
+ "nl-NL": "Er is één waarde geselecteerd.",
1934
+ "pl-PL": "Jest jedna wybrana wartość.",
1935
+ "pt-BR": "Há um valor selecionado.",
1936
+ "ru-RU": "Выбрано одно значение.",
1937
+ "sv-SE": "Ett värde är valt.",
1938
+ "tr-TR": "Seçilen bir değer var.",
1939
+ "zh-CN": "存在一个已选择的值。",
1940
+ "zh-TW": "有一個選取的值。"
1941
+ }
1942
+ };
1943
+ var ScreenReader_ManySelected = {
1944
+ id: "ScreenReader.ManySelected",
1945
+ locale: {
1946
+ "de-DE": "Es sind {0} Werte ausgewählt.",
1947
+ "en-US": "There are {0} selected values.",
1948
+ "es-ES": "Hay {0} valores seleccionados.",
1949
+ "fr-FR": "{0} valeurs ont été sélectionnées.",
1950
+ "it-IT": "Sono presenti {0} valori selezionati.",
1951
+ "ja-JP": "値が {0} つ選択されています。",
1952
+ "ko-KR": "{0}개의 값이 선택되었습니다.",
1953
+ "nl-NL": "Er zijn {0} waarden geselecteerd.",
1954
+ "pl-PL": "Wybranych wartości: {0}",
1955
+ "pt-BR": "Há {0} valores selecionados.",
1956
+ "ru-RU": "Выбраны значения: {0}.",
1957
+ "sv-SE": "{0} värden är valda.",
1958
+ "tr-TR": "Seçilen {0} değer var.",
1959
+ "zh-CN": "存在 {0} 个已选择的值。",
1960
+ "zh-TW": "有 {0} 個選取的值。"
1961
+ }
1962
+ };
1723
1963
  var all = {
1724
1964
  Cancel: Cancel$1,
1725
1965
  CurrentSelections_All: CurrentSelections_All,
@@ -1758,7 +1998,19 @@
1758
1998
  Visualization_Invalid_Dimension: Visualization_Invalid_Dimension,
1759
1999
  Visualization_Invalid_Measure: Visualization_Invalid_Measure,
1760
2000
  Visualization_LayoutError: Visualization_LayoutError,
1761
- Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition
2001
+ Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition,
2002
+ Object_Listbox_Selected: Object_Listbox_Selected,
2003
+ Object_Listbox_Alternative: Object_Listbox_Alternative,
2004
+ Object_Listbox_Optional: Object_Listbox_Optional,
2005
+ Object_Listbox_SelectedExcluded: Object_Listbox_SelectedExcluded,
2006
+ Object_Listbox_Locked: Object_Listbox_Locked,
2007
+ Object_Listbox_Excluded: Object_Listbox_Excluded,
2008
+ Object_Listbox_ExcludedLock: Object_Listbox_ExcludedLock,
2009
+ Listbox_ScreenReader_SelectionMenu_WithAccSelMenu: Listbox_ScreenReader_SelectionMenu_WithAccSelMenu,
2010
+ Listbox_ScreenReader_SearchThenSelectionsMenu_WithAccSelMenu: Listbox_ScreenReader_SearchThenSelectionsMenu_WithAccSelMenu,
2011
+ ScreenReader_ZeroSelected: ScreenReader_ZeroSelected,
2012
+ ScreenReader_OneSelected: ScreenReader_OneSelected,
2013
+ ScreenReader_ManySelected: ScreenReader_ManySelected
1762
2014
  };
1763
2015
 
1764
2016
  function appLocaleFn(language) {
@@ -4477,7 +4729,7 @@
4477
4729
  return output;
4478
4730
  }
4479
4731
 
4480
- function composeClasses(slots, getUtilityClass, classes) {
4732
+ function composeClasses(slots, getUtilityClass, classes = undefined) {
4481
4733
  const output = {};
4482
4734
  Object.keys(slots).forEach(
4483
4735
  // `Objet.keys(slots)` can't be wider than `T` because we infer `T` from `slots`.
@@ -4485,7 +4737,10 @@
4485
4737
  slot => {
4486
4738
  output[slot] = slots[slot].reduce((acc, key) => {
4487
4739
  if (key) {
4488
- acc.push(getUtilityClass(key));
4740
+ const utilityClass = getUtilityClass(key);
4741
+ if (utilityClass !== '') {
4742
+ acc.push(utilityClass);
4743
+ }
4489
4744
  if (classes && classes[key]) {
4490
4745
  acc.push(classes[key]);
4491
4746
  }
@@ -8545,6 +8800,11 @@
8545
8800
  if (val == null) {
8546
8801
  return null;
8547
8802
  }
8803
+ if (themeKey === 'typography' && val === 'inherit') {
8804
+ return {
8805
+ [prop]: val
8806
+ };
8807
+ }
8548
8808
  const themeMapping = getPath$1(theme, themeKey) || {};
8549
8809
  if (style) {
8550
8810
  return style(props);
@@ -9961,7 +10221,14 @@
9961
10221
  body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),
9962
10222
  button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
9963
10223
  caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
9964
- overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps)
10224
+ overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps),
10225
+ inherit: {
10226
+ fontFamily: 'inherit',
10227
+ fontWeight: 'inherit',
10228
+ fontSize: 'inherit',
10229
+ lineHeight: 'inherit',
10230
+ letterSpacing: 'inherit'
10231
+ }
9965
10232
  };
9966
10233
  return deepmerge(_extends$6({
9967
10234
  htmlFontSize,
@@ -10184,6 +10451,30 @@
10184
10451
  });
10185
10452
  }
10186
10453
 
10454
+ const defaultContextValue = {
10455
+ disableDefaultClasses: false
10456
+ };
10457
+ const ClassNameConfiguratorContext = /*#__PURE__*/reactExports.createContext(defaultContextValue);
10458
+ /**
10459
+ * @ignore - internal hook.
10460
+ *
10461
+ * Wraps the `generateUtilityClass` function and controls how the classes are generated.
10462
+ * Currently it only affects whether the classes are applied or not.
10463
+ *
10464
+ * @returns Function to be called with the `generateUtilityClass` function specific to a component to generate the classes.
10465
+ */
10466
+ function useClassNamesOverride(generateUtilityClass) {
10467
+ const {
10468
+ disableDefaultClasses
10469
+ } = reactExports.useContext(ClassNameConfiguratorContext);
10470
+ return slot => {
10471
+ if (disableDefaultClasses) {
10472
+ return '';
10473
+ }
10474
+ return generateUtilityClass(slot);
10475
+ };
10476
+ }
10477
+
10187
10478
  /**
10188
10479
  * Extracts event handlers from a given object.
10189
10480
  * A prop is considered an event handler if it is a function and its name starts with `on`.
@@ -10805,7 +11096,7 @@
10805
11096
  function getUAString() {
10806
11097
  var uaData = navigator.userAgentData;
10807
11098
 
10808
- if (uaData != null && uaData.brands) {
11099
+ if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
10809
11100
  return uaData.brands.map(function (item) {
10810
11101
  return item.brand + "/" + item.version;
10811
11102
  }).join(' ');
@@ -11124,10 +11415,9 @@
11124
11415
  // Zooming can change the DPR, but it seems to report a value that will
11125
11416
  // cleanly divide the values into the appropriate subpixels.
11126
11417
 
11127
- function roundOffsetsByDPR(_ref) {
11418
+ function roundOffsetsByDPR(_ref, win) {
11128
11419
  var x = _ref.x,
11129
11420
  y = _ref.y;
11130
- var win = window;
11131
11421
  var dpr = win.devicePixelRatio || 1;
11132
11422
  return {
11133
11423
  x: round$1(x * dpr) / dpr || 0,
@@ -11210,7 +11500,7 @@
11210
11500
  var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
11211
11501
  x: x,
11212
11502
  y: y
11213
- }) : {
11503
+ }, getWindow(popper)) : {
11214
11504
  x: x,
11215
11505
  y: y
11216
11506
  };
@@ -12530,7 +12820,7 @@
12530
12820
  const slots = {
12531
12821
  root: ['root']
12532
12822
  };
12533
- return composeClasses(slots, getPopperUnstyledUtilityClass, {});
12823
+ return composeClasses(slots, useClassNamesOverride(getPopperUnstyledUtilityClass));
12534
12824
  };
12535
12825
  const defaultPopperOptions = {};
12536
12826
  const PopperTooltip = /*#__PURE__*/reactExports.forwardRef(function PopperTooltip(props, ref) {
@@ -12962,7 +13252,7 @@
12962
13252
  root: ['root', !open && exited && 'hidden'],
12963
13253
  backdrop: ['backdrop']
12964
13254
  };
12965
- return composeClasses(slots, getModalUtilityClass, undefined);
13255
+ return composeClasses(slots, useClassNamesOverride(getModalUtilityClass));
12966
13256
  };
12967
13257
  function getContainer(container) {
12968
13258
  return typeof container === 'function' ? container() : container;
@@ -15420,7 +15710,7 @@
15420
15710
  return cache[key];
15421
15711
  }
15422
15712
 
15423
- const NEBULA_VERSION_HASH = "a704" ;
15713
+ const NEBULA_VERSION_HASH = "64ea" ;
15424
15714
  ClassNameGenerator$1.configure(componentName => {
15425
15715
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
15426
15716
  });
@@ -15628,7 +15918,7 @@
15628
15918
  const appRef = React.createRef();
15629
15919
  const element = document.createElement('div');
15630
15920
  element.style.display = 'none';
15631
- element.setAttribute('data-nebulajs-version', "4.0.0-alpha.7" );
15921
+ element.setAttribute('data-nebulajs-version', "4.0.0-alpha.9" );
15632
15922
  element.setAttribute('data-app-id', app.id);
15633
15923
  document.body.appendChild(element);
15634
15924
  const root = client.createRoot(element);
@@ -21702,21 +21992,70 @@
21702
21992
  return elemNumbersOrdered.slice(min, max + 1);
21703
21993
  }
21704
21994
 
21995
+ const PREFIX$c = 'RowColumn';
21996
+ const rowColClasses = {
21997
+ row: "".concat(PREFIX$c, "-row"),
21998
+ rowBorderBottom: "".concat(PREFIX$c, "-rowBorderBottom"),
21999
+ column: "".concat(PREFIX$c, "-column"),
22000
+ fieldRoot: "".concat(PREFIX$c, "-fieldRoot"),
22001
+ cell: "".concat(PREFIX$c, "-cell"),
22002
+ labelText: "".concat(PREFIX$c, "-labelText"),
22003
+ labelDense: "".concat(PREFIX$c, "-labelDense"),
22004
+ highlighted: "".concat(PREFIX$c, "-highlighted"),
22005
+ checkboxLabel: "".concat(PREFIX$c, "-checkboxLabel"),
22006
+ icon: "".concat(PREFIX$c, "-icon"),
22007
+ S: "".concat(PREFIX$c, "-S"),
22008
+ XS: "".concat(PREFIX$c, "-XS"),
22009
+ A: "".concat(PREFIX$c, "-A"),
22010
+ X: "".concat(PREFIX$c, "-X"),
22011
+ frequencyCount: "".concat(PREFIX$c, "-frequencyCount"),
22012
+ barContainer: "".concat(PREFIX$c, "-barContainer"),
22013
+ bar: "".concat(PREFIX$c, "-bar"),
22014
+ barSelected: "".concat(PREFIX$c, "-barSelected"),
22015
+ barWithCheckbox: "".concat(PREFIX$c, "-barWithCheckbox"),
22016
+ barSelectedWithCheckbox: "".concat(PREFIX$c, "-barSelectedWithCheckbox"),
22017
+ excludedTextWithCheckbox: "".concat(PREFIX$c, "-excludedTextWithCheckbox")
22018
+ };
22019
+
22020
+ /* eslint-disable no-underscore-dangle */
22021
+ const dataItemSelector = ".".concat(rowColClasses.fieldRoot);
21705
22022
  const getKeyAsToggleSelected = event => !(event !== null && event !== void 0 && event.metaKey || event !== null && event !== void 0 && event.ctrlKey);
21706
22023
  function useSelectionsInteractions(_ref) {
22024
+ var _loaderRef$current2, _loaderRef$current2$_;
21707
22025
  let {
21708
22026
  selectionState,
21709
22027
  selections,
21710
22028
  checkboxes = false,
21711
- doc = document
22029
+ doc = document,
22030
+ loaderRef
21712
22031
  } = _ref;
21713
22032
  const currentSelect = reactExports.useRef({
21714
22033
  startElemNumber: undefined,
21715
22034
  elemNumbers: [],
21716
22035
  isRange: false,
21717
22036
  toggle: false,
21718
- active: false
22037
+ active: false,
22038
+ touchElemNumbers: [],
22039
+ touchRangeSmall: false
21719
22040
  });
22041
+ reactExports.useEffect(() => {
22042
+ var _loaderRef$current, _loaderRef$current$_l;
22043
+ 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)) {
22044
+ return undefined;
22045
+ }
22046
+ const preventGestureStart = e => e.preventDefault();
22047
+ const preventGestureChange = e => e.preventDefault();
22048
+ const preventGestureEnd = e => e.preventDefault();
22049
+ const listRef = loaderRef.current._listRef._outerRef;
22050
+ listRef.addEventListener('gesturestart', preventGestureStart);
22051
+ listRef.addEventListener('gesturechange', preventGestureChange);
22052
+ listRef.addEventListener('gestureend', preventGestureEnd);
22053
+ return () => {
22054
+ listRef.removeEventListener('gesturestart', preventGestureStart);
22055
+ listRef.removeEventListener('gesturechange', preventGestureChange);
22056
+ listRef.removeEventListener('gestureend', preventGestureEnd);
22057
+ };
22058
+ }, [(_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]);
21720
22059
 
21721
22060
  // eslint-disable-next-line arrow-body-style
21722
22061
  const doSelect = () => {
@@ -21728,6 +22067,10 @@
21728
22067
  toggle: currentSelect.current.toggle
21729
22068
  });
21730
22069
  };
22070
+ const getRange = (start, end) => {
22071
+ const elemNumbersOrdered = getElemNumbersFromPages(selectionState.enginePages);
22072
+ return fillRange([start, end], elemNumbersOrdered);
22073
+ };
21731
22074
  const addToRange = elemNumber => {
21732
22075
  const {
21733
22076
  startElemNumber
@@ -21735,9 +22078,7 @@
21735
22078
  if (startElemNumber === elemNumber) {
21736
22079
  return;
21737
22080
  }
21738
- const rangeEnds = [currentSelect.current.startElemNumber, elemNumber];
21739
- const elemNumbersOrdered = getElemNumbersFromPages(selectionState.enginePages);
21740
- const toMaybeAdd = fillRange(rangeEnds, elemNumbersOrdered);
22081
+ const toMaybeAdd = getRange(currentSelect.current.startElemNumber, elemNumber);
21741
22082
  selectionState.updateItems(toMaybeAdd, true, currentSelect.current.elemNumbers);
21742
22083
  };
21743
22084
  const selectManually = function () {
@@ -21833,6 +22174,48 @@
21833
22174
  const elemNumber = +event.currentTarget.getAttribute('data-n');
21834
22175
  addToRange(elemNumber);
21835
22176
  }, []);
22177
+ const onTouchStart = reactExports.useCallback(event => {
22178
+ var _event$touches$0$targ, _event$touches$0$targ2, _event$touches$1$targ, _event$touches$1$targ2;
22179
+ // Handle range selection with two finger touch
22180
+ if (currentSelect.current.active || currentSelect.current.isRange || selectionState.isSingleSelect || event.touches.length <= 1) {
22181
+ return;
22182
+ }
22183
+ if (event.touches.length > 2) {
22184
+ doSelect();
22185
+ return;
22186
+ }
22187
+ 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'));
22188
+ 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'));
22189
+ if (Number.isNaN(startTouchElemNumber) || Number.isNaN(startTouchElemNumber)) {
22190
+ doSelect();
22191
+ return;
22192
+ }
22193
+ currentSelect.current.active = true;
22194
+ const range = getRange(startTouchElemNumber, endTouchElemNumber);
22195
+ if (range.length < 7) {
22196
+ currentSelect.current.touchRangeSmall = true;
22197
+ }
22198
+ currentSelect.current.elemNumbers = [];
22199
+ currentSelect.current.touchElemNumbers = [startTouchElemNumber, endTouchElemNumber];
22200
+ }, []);
22201
+ const onTouchEnd = reactExports.useCallback(() => {
22202
+ if (currentSelect.current.touchElemNumbers.length !== 2) {
22203
+ return;
22204
+ }
22205
+ if (currentSelect.current.touchRangeSmall) {
22206
+ currentSelect.current.touchRangeSmall = false;
22207
+ currentSelect.current.touchElemNumbers = [];
22208
+ currentSelect.current.active = false;
22209
+ return;
22210
+ }
22211
+ const [startTouchElemNumber, endTouchElemNumber] = currentSelect.current.touchElemNumbers;
22212
+ currentSelect.current.startElemNumber = startTouchElemNumber;
22213
+ addToRange(endTouchElemNumber);
22214
+ currentSelect.current.touchElemNumbers = [];
22215
+ currentSelect.current.active = false;
22216
+ currentSelect.current.toggle = true;
22217
+ doSelect();
22218
+ }, []);
21836
22219
  reactExports.useEffect(() => {
21837
22220
  doc.addEventListener('mouseup', onMouseUpDoc);
21838
22221
  return () => {
@@ -21865,7 +22248,9 @@
21865
22248
  Object.assign(interactionEvents, {
21866
22249
  onMouseUp,
21867
22250
  onMouseDown,
21868
- onMouseEnter
22251
+ onMouseEnter,
22252
+ onTouchStart,
22253
+ onTouchEnd
21869
22254
  });
21870
22255
  }
21871
22256
  return {
@@ -22000,15 +22385,14 @@
22000
22385
  enabled
22001
22386
  } = _ref;
22002
22387
  const [keyboardActive, setKeyboardActive] = reactExports.useState(false);
22003
- const innerTabStops = !enabled || keyboardActive;
22004
22388
  const keyboard = {
22005
22389
  enabled,
22006
22390
  active: keyboardActive,
22007
- innerTabStops,
22008
- // does keyboard permit inner tab stops
22009
- outerTabStops: !innerTabStops,
22010
- // does keyboard permit outer tab stops
22011
- blur: resetFocus => {
22391
+ // innerTabStops: whether keyboard permits inner tab stops
22392
+ // (inner = everything inside .listbox-container)
22393
+
22394
+ innerTabStops: !enabled || keyboardActive,
22395
+ blur(resetFocus) {
22012
22396
  var _containerRef$current;
22013
22397
  if (!enabled) {
22014
22398
  return;
@@ -22023,7 +22407,7 @@
22023
22407
  vizCell.focus();
22024
22408
  }
22025
22409
  },
22026
- focus: () => {
22410
+ focus() {
22027
22411
  if (!enabled) {
22028
22412
  return;
22029
22413
  }
@@ -22031,12 +22415,13 @@
22031
22415
  const c = containerRef.current;
22032
22416
  const searchField = c === null || c === void 0 ? void 0 : c.querySelector('.search input');
22033
22417
  const lastSelectedRow = c === null || c === void 0 ? void 0 : c.querySelector('.value.last-focused');
22034
- const fieldElement = c === null || c === void 0 ? void 0 : c.querySelector('.value.selector, .value, .ActionsToolbar-item button');
22035
- const elementToFocus = searchField || lastSelectedRow || fieldElement;
22418
+ const firstRowElement = c === null || c === void 0 ? void 0 : c.querySelector('.value.selector, .value');
22419
+ const confirmButton = c === null || c === void 0 ? void 0 : c.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
22420
+ const elementToFocus = searchField || lastSelectedRow || firstRowElement || confirmButton;
22036
22421
  elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.setAttribute('tabIndex', 0);
22037
22422
  elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.focus();
22038
22423
  },
22039
- focusSelection: () => {
22424
+ focusSelection() {
22040
22425
  const confirmButton = document.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
22041
22426
  confirmButton === null || confirmButton === void 0 ? void 0 : confirmButton.setAttribute('tabIndex', 0);
22042
22427
  confirmButton === null || confirmButton === void 0 ? void 0 : confirmButton.focus();
@@ -22045,6 +22430,7 @@
22045
22430
  return keyboard;
22046
22431
  }
22047
22432
 
22433
+ /* eslint-disable no-param-reassign */
22048
22434
  const getElementIndex = currentTarget => +currentTarget.getAttribute('data-n');
22049
22435
  const focusSearch = container => {
22050
22436
  const searchField = container === null || container === void 0 ? void 0 : container.querySelector('.search input');
@@ -22205,7 +22591,6 @@
22205
22591
  let {
22206
22592
  keyboard,
22207
22593
  hovering,
22208
- setHovering,
22209
22594
  updateKeyScroll,
22210
22595
  containerRef,
22211
22596
  currentScrollIndex,
@@ -22236,81 +22621,44 @@
22236
22621
  // 3. Blur row and focus the listbox container.
22237
22622
  keyboard.blur();
22238
22623
  const c = currentTarget.closest('.listbox-container');
22239
- c.setAttribute('tabIndex', 0);
22624
+ c.setAttribute('tabIndex', -1);
22240
22625
  c === null || c === void 0 ? void 0 : c.focus();
22241
22626
  }
22242
22627
  };
22243
- const updateKeyScrollOnHover = newState => {
22244
- if (hovering) {
22245
- updateKeyScroll(newState);
22246
- }
22247
- };
22248
22628
  const handleKeyDown = event => {
22249
22629
  const {
22250
22630
  keyCode,
22251
- ctrlKey = false,
22252
22631
  shiftKey = false
22253
22632
  } = event.nativeEvent;
22254
22633
  const prevent = () => {
22255
22634
  event.stopPropagation();
22256
22635
  event.preventDefault();
22257
22636
  };
22258
- switch (keyCode) {
22259
- case KEYS.PAGE_UP:
22260
- updateKeyScrollOnHover({
22261
- up: currentScrollIndex.stop - currentScrollIndex.start
22262
- });
22263
- prevent();
22264
- break;
22265
- case KEYS.PAGE_DOWN:
22266
- updateKeyScrollOnHover({
22267
- down: currentScrollIndex.stop - currentScrollIndex.start
22268
- });
22269
- prevent();
22270
- break;
22271
- case KEYS.HOME:
22272
- updateKeyScrollOnHover({
22273
- scrollPosition: ctrlKey && shiftKey ? 'overflowStart' : 'start'
22274
- });
22275
- prevent();
22276
- break;
22277
- case KEYS.END:
22278
- updateKeyScrollOnHover({
22279
- scrollPosition: ctrlKey && shiftKey ? 'overflowEnd' : 'end'
22280
- });
22281
- prevent();
22282
- break;
22283
- case KEYS.ARROW_UP:
22284
- updateKeyScrollOnHover({
22285
- up: 1
22286
- });
22287
- prevent();
22288
- break;
22289
- case KEYS.ARROW_DOWN:
22290
- updateKeyScrollOnHover({
22291
- down: 1
22292
- });
22293
- prevent();
22294
- break;
22295
- }
22296
22637
  if (!keyboard.enabled) {
22297
22638
  // Other keys should not be handled unless keyboard is enabled.
22298
- return undefined;
22639
+ return;
22299
22640
  }
22300
22641
  const container = event.currentTarget.closest('.listbox-container');
22642
+ const inSelection = isModal();
22301
22643
  switch (keyCode) {
22302
22644
  case KEYS.TAB:
22303
- if (shiftKey) {
22304
- focusRow(container) || focusSearch(container);
22645
+ if (inSelection) {
22646
+ if (shiftKey) {
22647
+ focusRow(container) || focusSearch(container);
22648
+ } else {
22649
+ focusSearch(container) || focusRow(container);
22650
+ }
22651
+ } else if (shiftKey) {
22652
+ keyboard.blur(true);
22305
22653
  } else {
22306
- focusSearch(container) || focusRow(container);
22654
+ break;
22307
22655
  }
22308
22656
  prevent();
22309
22657
  break;
22310
22658
  case KEYS.ENTER:
22311
22659
  case KEYS.SPACE:
22312
22660
  if (!event.target.classList.contains('listbox-container')) {
22313
- return undefined; // don't mess with keydown handlers within the listbox (e.g. row seletion)
22661
+ break; // don't mess with keydown handlers within the listbox (e.g. row seletion)
22314
22662
  }
22315
22663
 
22316
22664
  keyboard.focus();
@@ -22318,13 +22666,53 @@
22318
22666
  break;
22319
22667
  case KEYS.ESCAPE:
22320
22668
  blur(event);
22321
- prevent();
22322
22669
  break;
22323
- case KEYS.ARROW_LEFT:
22324
- case KEYS.ARROW_RIGHT:
22325
- return undefined;
22326
22670
  }
22327
- return undefined;
22671
+ };
22672
+ const globalKeyDown = event => {
22673
+ if (!hovering.current) {
22674
+ return;
22675
+ }
22676
+ const {
22677
+ keyCode,
22678
+ ctrlKey = false,
22679
+ shiftKey = false
22680
+ } = event;
22681
+ switch (keyCode) {
22682
+ case KEYS.ARROW_UP:
22683
+ updateKeyScroll({
22684
+ up: 1
22685
+ });
22686
+ break;
22687
+ case KEYS.ARROW_DOWN:
22688
+ updateKeyScroll({
22689
+ down: 1
22690
+ });
22691
+ break;
22692
+ case KEYS.PAGE_UP:
22693
+ updateKeyScroll({
22694
+ up: currentScrollIndex.stop - currentScrollIndex.start
22695
+ });
22696
+ break;
22697
+ case KEYS.PAGE_DOWN:
22698
+ updateKeyScroll({
22699
+ down: currentScrollIndex.stop - currentScrollIndex.start
22700
+ });
22701
+ break;
22702
+ case KEYS.HOME:
22703
+ updateKeyScroll({
22704
+ scrollPosition: ctrlKey && shiftKey ? 'overflowStart' : 'start'
22705
+ });
22706
+ break;
22707
+ case KEYS.END:
22708
+ updateKeyScroll({
22709
+ scrollPosition: ctrlKey && shiftKey ? 'overflowEnd' : 'end'
22710
+ });
22711
+ break;
22712
+ default:
22713
+ return;
22714
+ }
22715
+ event.preventDefault();
22328
22716
  };
22329
22717
  const focusOnHoverDisabled = () => {
22330
22718
  const selectNotAllowed = (constraints === null || constraints === void 0 ? void 0 : constraints.select) || (constraints === null || constraints === void 0 ? void 0 : constraints.active);
@@ -22333,50 +22721,22 @@
22333
22721
  };
22334
22722
  const handleOnMouseEnter = () => {
22335
22723
  if (!focusOnHoverDisabled()) {
22336
- var _containerRef$current, _containerRef$current2;
22337
- setHovering(true);
22338
- 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);
22724
+ hovering.current = true;
22339
22725
  }
22340
22726
  };
22341
22727
  const handleOnMouseLeave = () => {
22342
- if (hovering) {
22343
- var _containerRef$current3, _containerRef$current4;
22344
- setHovering(false);
22345
- 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);
22728
+ if (hovering.current) {
22729
+ hovering.current = false;
22346
22730
  }
22347
22731
  };
22348
22732
  return {
22349
22733
  handleKeyDown,
22350
22734
  handleOnMouseEnter,
22351
- handleOnMouseLeave
22735
+ handleOnMouseLeave,
22736
+ globalKeyDown
22352
22737
  };
22353
22738
  }
22354
22739
 
22355
- const PREFIX$c = 'RowColumn';
22356
- const rowColClasses = {
22357
- row: "".concat(PREFIX$c, "-row"),
22358
- rowBorderBottom: "".concat(PREFIX$c, "-rowBorderBottom"),
22359
- column: "".concat(PREFIX$c, "-column"),
22360
- fieldRoot: "".concat(PREFIX$c, "-fieldRoot"),
22361
- cell: "".concat(PREFIX$c, "-cell"),
22362
- labelText: "".concat(PREFIX$c, "-labelText"),
22363
- labelDense: "".concat(PREFIX$c, "-labelDense"),
22364
- highlighted: "".concat(PREFIX$c, "-highlighted"),
22365
- checkboxLabel: "".concat(PREFIX$c, "-checkboxLabel"),
22366
- icon: "".concat(PREFIX$c, "-icon"),
22367
- S: "".concat(PREFIX$c, "-S"),
22368
- XS: "".concat(PREFIX$c, "-XS"),
22369
- A: "".concat(PREFIX$c, "-A"),
22370
- X: "".concat(PREFIX$c, "-X"),
22371
- frequencyCount: "".concat(PREFIX$c, "-frequencyCount"),
22372
- barContainer: "".concat(PREFIX$c, "-barContainer"),
22373
- bar: "".concat(PREFIX$c, "-bar"),
22374
- barSelected: "".concat(PREFIX$c, "-barSelected"),
22375
- barWithCheckbox: "".concat(PREFIX$c, "-barWithCheckbox"),
22376
- barSelectedWithCheckbox: "".concat(PREFIX$c, "-barSelectedWithCheckbox"),
22377
- excludedTextWithCheckbox: "".concat(PREFIX$c, "-excludedTextWithCheckbox")
22378
- };
22379
-
22380
22740
  const isExcluded = c => c ? c.qState === 'X' || c.qState === 'XS' || c.qState === 'XL' : null;
22381
22741
  const isAlternative = c => c ? c.qState === 'A' : null;
22382
22742
  const excludedOrAlternative = _ref => {
@@ -22469,7 +22829,7 @@
22469
22829
  const iconWidth = 24; // tick and lock icon width in px
22470
22830
 
22471
22831
  const RowColRoot = styled$1('div', {
22472
- shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth'].includes(prop)
22832
+ shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth', 'direction'].includes(prop)
22473
22833
  })(_ref2 => {
22474
22834
  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;
22475
22835
  let {
@@ -22478,7 +22838,8 @@
22478
22838
  isGridMode,
22479
22839
  isGridCol,
22480
22840
  dense,
22481
- frequencyWidth
22841
+ frequencyWidth,
22842
+ direction
22482
22843
  } = _ref2;
22483
22844
  return {
22484
22845
  '&:focus': {
@@ -22591,7 +22952,7 @@
22591
22952
  justifyContent: 'flex-end'
22592
22953
  }, ellipsis), {}, {
22593
22954
  flex: "0 1 ".concat(frequencyWidth, "px"),
22594
- textAlign: 'right',
22955
+ textAlign: direction === 'rtl' ? 'left' : 'right',
22595
22956
  paddingLeft: '2px'
22596
22957
  }),
22597
22958
  ["&.".concat(rowColClasses.barContainer)]: {
@@ -22624,7 +22985,7 @@
22624
22985
  }
22625
22986
  },
22626
22987
  ["& .".concat(rowColClasses.barWithCheckbox)]: {
22627
- left: barWithCheckboxLeftPadPx,
22988
+ left: direction === 'rtl' ? barPadPx : barWithCheckboxLeftPadPx,
22628
22989
  width: "calc(100% - ".concat(barWithCheckboxLeftPadPx + barPadPx, "px)")
22629
22990
  },
22630
22991
  ["& .".concat(rowColClasses.barSelectedWithCheckbox)]: {
@@ -23070,21 +23431,23 @@
23070
23431
  }
23071
23432
 
23072
23433
  const ItemGrid = styled$1(Grid$1, {
23073
- shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'cellPaddingRight'].includes(prop)
23434
+ shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'cellPaddingRight', 'direction'].includes(prop)
23074
23435
  })(_ref => {
23075
23436
  let {
23076
23437
  dataLayout,
23077
23438
  layoutOrder,
23078
23439
  itemPadding,
23079
- cellPaddingRight
23440
+ cellPaddingRight,
23441
+ direction
23080
23442
  } = _ref;
23443
+ const att = "padding".concat(direction === 'rtl' ? 'Left' : 'Right');
23081
23444
  return {
23082
23445
  ["&.".concat(rowColClasses.fieldRoot)]: _objectSpread2(_objectSpread2({}, getGridItemSizes({
23083
23446
  dataLayout,
23084
23447
  layoutOrder,
23085
23448
  itemPadding
23086
23449
  })), {}, {
23087
- paddingRight: cellPaddingRight ? '8px' : undefined
23450
+ [att]: cellPaddingRight ? '8px' : undefined
23088
23451
  })
23089
23452
  };
23090
23453
  });
@@ -23193,6 +23556,8 @@
23193
23556
  onMouseDown,
23194
23557
  onMouseUp,
23195
23558
  onMouseEnter,
23559
+ onTouchStart,
23560
+ onTouchEnd,
23196
23561
  pages,
23197
23562
  isLocked,
23198
23563
  column = false,
@@ -23351,6 +23716,7 @@
23351
23716
  isGridMode: dataLayout === 'grid',
23352
23717
  dense: dense,
23353
23718
  frequencyWidth: frequencyWidth,
23719
+ direction: direction,
23354
23720
  "data-testid": "listbox.item"
23355
23721
  }, /*#__PURE__*/React.createElement(ItemGrid, {
23356
23722
  role: "row",
@@ -23374,9 +23740,12 @@
23374
23740
  onMouseUp: onMouseUp,
23375
23741
  onMouseEnter: onMouseEnter,
23376
23742
  onKeyDown: handleKeyDownCallback,
23743
+ onTouchStart: onTouchStart,
23744
+ onTouchEnd: onTouchEnd,
23377
23745
  onContextMenu: preventContextMenu,
23378
23746
  tabIndex: isFirstElement && keyboard.innerTabStops ? 0 : -1,
23379
- "data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber
23747
+ "data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber,
23748
+ direction: direction
23380
23749
  }, (cell === null || cell === void 0 ? void 0 : cell.qFrequency) && /*#__PURE__*/React.createElement(Histogram, {
23381
23750
  qFrequency: cell === null || cell === void 0 ? void 0 : cell.qFrequency,
23382
23751
  histogram: histogram,
@@ -25865,7 +26234,8 @@
25865
26234
  selectionState,
25866
26235
  selections,
25867
26236
  checkboxes,
25868
- doc: document
26237
+ doc: document,
26238
+ loaderRef
25869
26239
  });
25870
26240
  const {
25871
26241
  layoutOptions = {}
@@ -26231,13 +26601,16 @@
26231
26601
  } = useActionState(item);
26232
26602
  if (hidden) return null;
26233
26603
  const spacing = Number.parseInt(theme.spacing(0.5), 10);
26234
- const handleKeyDown = item.keyboardAction ? e => ['Enter', ' ', 'Spacebar'].includes(e.key) && item.keyboardAction() : null;
26604
+ const keyboardAction = item.keyboardAction || item.action;
26605
+ const handleKeyDown = keyboardAction ? e => ['Enter'].includes(e.key) && keyboardAction() : null;
26606
+ const handleKeyUp = keyboardAction ? e => [' ', 'Spacebar'].includes(e.key) && keyboardAction() : null;
26235
26607
  const btnId = "actions-toolbar-".concat(item.key);
26236
26608
  return /*#__PURE__*/React.createElement(IconButton$1, {
26237
26609
  ref: !addAnchor ? ref : null,
26238
26610
  title: item.label,
26239
26611
  onClick: item.action,
26240
26612
  onKeyDown: handleKeyDown,
26613
+ onKeyUp: handleKeyUp,
26241
26614
  disabled: disabled,
26242
26615
  style: style,
26243
26616
  className: [ActionElement.className, btnId].join(' '),
@@ -26303,8 +26676,8 @@
26303
26676
  onCancel();
26304
26677
  api.cancel();
26305
26678
  },
26306
- keyboardAction: e => {
26307
- onKeyDeactivate(e);
26679
+ keyboardAction: () => {
26680
+ onKeyDeactivate();
26308
26681
  onCancel();
26309
26682
  api.cancel();
26310
26683
  },
@@ -26318,8 +26691,8 @@
26318
26691
  onConfirm();
26319
26692
  api.confirm();
26320
26693
  },
26321
- keyboardAction: e => {
26322
- onKeyDeactivate(e);
26694
+ keyboardAction: () => {
26695
+ onKeyDeactivate();
26323
26696
  onConfirm();
26324
26697
  api.confirm();
26325
26698
  },
@@ -26349,6 +26722,7 @@
26349
26722
  function MoreItem(_ref2) {
26350
26723
  let {
26351
26724
  item,
26725
+ autoFocus,
26352
26726
  onActionClick = () => {}
26353
26727
  } = _ref2;
26354
26728
  const {
@@ -26361,6 +26735,7 @@
26361
26735
  onActionClick();
26362
26736
  };
26363
26737
  return !hidden ? /*#__PURE__*/React.createElement(MenuItem$1, {
26738
+ autoFocus: autoFocus,
26364
26739
  title: item.label,
26365
26740
  onClick: handleClick,
26366
26741
  disabled: disabled,
@@ -26381,6 +26756,7 @@
26381
26756
  onCloseOrActionClick = () => {}
26382
26757
  } = _ref3;
26383
26758
  const showActions = actions.length > 0;
26759
+ const autoFocusIndex = actions.findIndex(action => !action.disabled);
26384
26760
  return showActions && /*#__PURE__*/React.createElement(StyledPopover$1
26385
26761
  // eslint-disable-next-line react/jsx-props-no-spreading
26386
26762
  , _extends$8({}, popoverProps, {
@@ -26420,6 +26796,7 @@
26420
26796
  React.createElement(MoreItem, {
26421
26797
  key: ix,
26422
26798
  item: item,
26799
+ autoFocus: ix === autoFocusIndex,
26423
26800
  onActionClick: onCloseOrActionClick
26424
26801
  }))));
26425
26802
  });
@@ -26443,7 +26820,8 @@
26443
26820
  let {
26444
26821
  keyboardNavigation,
26445
26822
  focusHandler,
26446
- getEnabledButton
26823
+ getEnabledButton,
26824
+ selections
26447
26825
  } = _ref;
26448
26826
  const handleActionsKeyDown = evt => {
26449
26827
  const {
@@ -26483,6 +26861,14 @@
26483
26861
  }
26484
26862
  }
26485
26863
  break;
26864
+ case KEYS.ESCAPE:
26865
+ if (selections) {
26866
+ selections.onCancel();
26867
+ selections.api.cancel();
26868
+ evt.preventDefault();
26869
+ evt.stopPropagation();
26870
+ }
26871
+ break;
26486
26872
  }
26487
26873
  };
26488
26874
  return handleActionsKeyDown;
@@ -26624,8 +27010,9 @@
26624
27010
  const handleActionsKeyDown = reactExports.useMemo(() => getActionsKeyDownHandler({
26625
27011
  keyboardNavigation,
26626
27012
  focusHandler,
26627
- getEnabledButton
26628
- }), [keyboardNavigation, focusHandler, getEnabledButton]);
27013
+ getEnabledButton,
27014
+ selections
27015
+ }), [keyboardNavigation, focusHandler, getEnabledButton, selections]);
26629
27016
  reactExports.useEffect(() => () => {
26630
27017
  setShowMoreItems(false);
26631
27018
  }, [popover.show, show, selections.show]);
@@ -28820,22 +29207,24 @@
28820
29207
  const actionToolbarWidth = 128;
28821
29208
  const notSufficientSpace = containerWidth < contentWidth + actionToolbarWidth;
28822
29209
  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);
28823
- return !!(notSufficientSpace | isTruncated);
29210
+ const isDetached = !!(notSufficientSpace | isTruncated);
29211
+ return isDetached;
28824
29212
  }
28825
29213
 
28826
29214
  function getListboxActionProps(_ref) {
28827
29215
  let {
28828
- isPopover,
29216
+ isDetached,
28829
29217
  showToolbar,
28830
29218
  containerRef,
28831
29219
  isLocked,
28832
29220
  listboxSelectionToolbarItems,
28833
- selections
29221
+ selections,
29222
+ keyboard
28834
29223
  } = _ref;
28835
29224
  return {
28836
- show: showToolbar && !isPopover,
29225
+ show: showToolbar && !isDetached,
28837
29226
  popover: {
28838
- show: showToolbar && isPopover,
29227
+ show: showToolbar && isDetached,
28839
29228
  anchorEl: containerRef.current
28840
29229
  },
28841
29230
  more: {
@@ -28852,8 +29241,12 @@
28852
29241
  selections: {
28853
29242
  show: showToolbar,
28854
29243
  api: selections,
28855
- onConfirm: () => {},
28856
- onCancel: () => {}
29244
+ onConfirm: () => {
29245
+ keyboard === null || keyboard === void 0 ? void 0 : keyboard.focus();
29246
+ },
29247
+ onCancel: () => {
29248
+ keyboard === null || keyboard === void 0 ? void 0 : keyboard.focus();
29249
+ }
28857
29250
  }
28858
29251
  };
28859
29252
  }
@@ -28882,20 +29275,18 @@
28882
29275
  listboxWrapper: "".concat(PREFIX$4, "-listboxWrapper")
28883
29276
  };
28884
29277
  const StyledGrid$3 = styled$1(Grid$1, {
28885
- shouldForwardProp: p => !['containerPadding', 'hasIcon'].includes(p)
29278
+ shouldForwardProp: p => !['containerPadding'].includes(p)
28886
29279
  })(_ref => {
28887
29280
  var _theme$listBox$backgr, _theme$listBox;
28888
29281
  let {
28889
29282
  theme,
28890
- containerPadding,
28891
- hasIcon
29283
+ containerPadding
28892
29284
  } = _ref;
28893
29285
  return {
28894
29286
  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,
28895
29287
  ["& .".concat(classes$4.listBoxHeader)]: {
28896
29288
  alignSelf: 'center',
28897
- display: 'flex',
28898
- width: "calc(100% - ".concat(hasIcon ? BUTTON_ICON_WIDTH : 0, "px)")
29289
+ display: 'flex'
28899
29290
  },
28900
29291
  ["& .".concat(classes$4.screenReaderOnly)]: {
28901
29292
  position: 'absolute',
@@ -28906,7 +29297,7 @@
28906
29297
  ["& .".concat(classes$4.listboxWrapper)]: {
28907
29298
  padding: containerPadding
28908
29299
  },
28909
- '&:focus:not(:hover)': {
29300
+ '&:focus': {
28910
29301
  boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
28911
29302
  },
28912
29303
  '&:focus-visible': {
@@ -28958,7 +29349,8 @@
28958
29349
  showGray = true,
28959
29350
  scrollState = undefined,
28960
29351
  renderedCallback,
28961
- toolbar = true
29352
+ toolbar = true,
29353
+ isPopover = false
28962
29354
  } = options;
28963
29355
 
28964
29356
  // Hook that will trigger update when used in useEffects.
@@ -28987,7 +29379,7 @@
28987
29379
  const [searchContainer, searchContainerRef] = useRefWithCallback();
28988
29380
  const [showToolbar, setShowToolbar] = reactExports.useState(false);
28989
29381
  const [showSearch, setShowSearch] = reactExports.useState(false);
28990
- const [hovering, setHovering] = reactExports.useState(false);
29382
+ const hovering = reactExports.useRef(false);
28991
29383
  const [keyScroll, setKeyScroll] = reactExports.useState({
28992
29384
  down: 0,
28993
29385
  up: 0,
@@ -29014,11 +29406,11 @@
29014
29406
  const {
29015
29407
  handleKeyDown,
29016
29408
  handleOnMouseEnter,
29017
- handleOnMouseLeave
29018
- } = getListboxInlineKeyboardNavigation({
29409
+ handleOnMouseLeave,
29410
+ globalKeyDown
29411
+ } = reactExports.useMemo(() => getListboxInlineKeyboardNavigation({
29019
29412
  keyboard,
29020
29413
  hovering,
29021
- setHovering,
29022
29414
  updateKeyScroll,
29023
29415
  containerRef,
29024
29416
  currentScrollIndex,
@@ -29026,9 +29418,15 @@
29026
29418
  appSelections,
29027
29419
  constraints,
29028
29420
  isModal: isModalMode
29029
- });
29030
- const showDetachedToolbarOnly = toolbar && ((layout === null || layout === void 0 ? void 0 : layout.title) === '' || (layout === null || layout === void 0 ? void 0 : layout.showTitle) === false);
29031
- const showToolbarWithTitle = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '' && (layout === null || layout === void 0 ? void 0 : layout.showTitle) !== false;
29421
+ }), [keyboard, hovering, updateKeyScroll, containerRef, currentScrollIndex, app, appSelections, constraints, isModalMode]);
29422
+ const showDetachedToolbarOnly = toolbar && ((layout === null || layout === void 0 ? void 0 : layout.title) === '' || (layout === null || layout === void 0 ? void 0 : layout.showTitle) === false) && !isPopover;
29423
+ const showToolbarWithTitle = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '' && (layout === null || layout === void 0 ? void 0 : layout.showTitle) !== false || isPopover;
29424
+ reactExports.useEffect(() => {
29425
+ document.addEventListener('keydown', globalKeyDown);
29426
+ return () => {
29427
+ document.removeEventListener('keydown', globalKeyDown);
29428
+ };
29429
+ }, [globalKeyDown]);
29032
29430
  reactExports.useEffect(() => {
29033
29431
  const show = () => {
29034
29432
  setShowToolbar(true);
@@ -29039,6 +29437,14 @@
29039
29437
  setShowSearch(false);
29040
29438
  }
29041
29439
  };
29440
+ if (isPopover) {
29441
+ if (!selections.isActive()) {
29442
+ selections.begin('/qListObjectDef');
29443
+ selections.on('activated', show);
29444
+ selections.on('deactivated', hide);
29445
+ }
29446
+ setShowToolbar(isPopover);
29447
+ }
29042
29448
  if (selections) {
29043
29449
  if (!selections.isModal()) {
29044
29450
  selections.on('activated', show);
@@ -29052,7 +29458,7 @@
29052
29458
  selections.removeListener('deactivated', hide);
29053
29459
  }
29054
29460
  };
29055
- }, [selections]);
29461
+ }, [selections, isPopover]);
29056
29462
  reactExports.useEffect(() => {
29057
29463
  if (!searchContainer || !searchContainer.current) {
29058
29464
  return;
@@ -29100,13 +29506,14 @@
29100
29506
  input === null || input === void 0 ? void 0 : input.focus();
29101
29507
  }
29102
29508
  };
29103
- const getActionToolbarProps = isPopover => getListboxActionProps({
29104
- isPopover,
29509
+ const getActionToolbarProps = isDetached => getListboxActionProps({
29510
+ isDetached: isPopover ? false : isDetached,
29105
29511
  showToolbar,
29106
29512
  containerRef,
29107
29513
  isLocked,
29108
29514
  listboxSelectionToolbarItems,
29109
- selections
29515
+ selections,
29516
+ keyboard
29110
29517
  });
29111
29518
  const shouldAutoFocus = searchVisible && search === 'toggle';
29112
29519
  const showSearchIcon = searchEnabled !== false && search === 'toggle';
@@ -29115,6 +29522,11 @@
29115
29522
  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
29116
29523
  const headerPaddingLeft = CELL_PADDING_LEFT - (showSearchOrLockIcon ? ICON_PADDING : 0);
29117
29524
  const headerPaddingRight = isRtl ? CELL_PADDING_LEFT - (showIcons ? ICON_PADDING : 0) : 0;
29525
+ const isDetached = showToolbarDetached({
29526
+ containerRef,
29527
+ titleRef,
29528
+ iconsWidth
29529
+ });
29118
29530
 
29119
29531
  // Add a container padding for grid mode to harmonize with the grid item margins (should sum to 8px).
29120
29532
  const isGridMode = (layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.dataLayout) === 'grid';
@@ -29163,7 +29575,7 @@
29163
29575
  }, getActionToolbarProps(true))), /*#__PURE__*/React.createElement(StyledGrid$3, {
29164
29576
  className: "listbox-container",
29165
29577
  container: true,
29166
- tabIndex: keyboard.outerTabStops ? 0 : -1,
29578
+ tabIndex: keyboard.enabled ? -1 : undefined,
29167
29579
  direction: "column",
29168
29580
  gap: 0,
29169
29581
  containerPadding: containerPadding,
@@ -29175,35 +29587,21 @@
29175
29587
  onKeyDown: handleKeyDown,
29176
29588
  onMouseEnter: handleOnMouseEnter,
29177
29589
  onMouseLeave: handleOnMouseLeave,
29178
- ref: containerRef,
29179
- hasIcon: showIcons
29590
+ ref: containerRef
29180
29591
  }, showToolbarWithTitle && /*#__PURE__*/React.createElement(Grid$1, {
29181
29592
  item: true,
29182
29593
  container: true,
29183
- style: {
29184
- padding: theme.spacing(1),
29185
- paddingLeft: "".concat(headerPaddingLeft, "px"),
29186
- paddingRight: "".concat(headerPaddingRight, "px")
29187
- },
29188
- sx: {
29189
- flexDirection: isRtl ? 'row-reverse' : 'row'
29190
- },
29191
- wrap: "nowrap"
29192
- }, /*#__PURE__*/React.createElement(Grid$1, {
29193
- item: true,
29194
- container: true,
29195
- height: headerHeight,
29196
- sx: {
29197
- flexDirection: isRtl ? 'row-reverse' : 'row'
29198
- },
29594
+ minHeight: headerHeight,
29595
+ flexDirection: isRtl ? 'row-reverse' : 'row',
29596
+ marginY: 1,
29597
+ paddingLeft: "".concat(headerPaddingLeft, "px"),
29598
+ paddingRight: "".concat(headerPaddingRight, "px"),
29199
29599
  wrap: "nowrap"
29200
29600
  }, showIcons && /*#__PURE__*/React.createElement(Grid$1, {
29201
29601
  item: true,
29202
- sx: {
29203
- display: 'flex',
29204
- alignItems: 'center',
29205
- width: iconsWidth
29206
- }
29602
+ container: true,
29603
+ alignItems: "center",
29604
+ width: iconsWidth
29207
29605
  }, isLocked ? lockIconComp : showSearchIcon && searchIconComp, isDrillDown && /*#__PURE__*/React.createElement(DrillDownIcon, {
29208
29606
  tabIndex: -1,
29209
29607
  title: translator.get('Listbox.DrillDown'),
@@ -29213,27 +29611,21 @@
29213
29611
  }
29214
29612
  })), /*#__PURE__*/React.createElement(Grid$1, {
29215
29613
  item: true,
29216
- sx: {
29217
- justifyContent: isRtl ? 'flex-end' : 'flex-start'
29218
- },
29614
+ xs: true,
29615
+ minWidth: 0 // needed to text-overflow see: https://css-tricks.com/flexbox-truncated-text/
29616
+ ,
29617
+ justifyContent: isRtl ? 'flex-end' : 'flex-start',
29219
29618
  className: classes$4.listBoxHeader
29220
29619
  }, /*#__PURE__*/React.createElement(Title, {
29221
29620
  variant: "h6",
29222
29621
  noWrap: true,
29223
29622
  ref: titleRef,
29224
29623
  title: layout.title
29225
- }, layout.title))), /*#__PURE__*/React.createElement(Grid$1, {
29226
- item: true,
29227
- xs: true
29228
- }), /*#__PURE__*/React.createElement(Grid$1, {
29624
+ }, layout.title)), /*#__PURE__*/React.createElement(Grid$1, {
29229
29625
  item: true
29230
29626
  }, /*#__PURE__*/React.createElement(ActionsToolbar, _extends$8({
29231
29627
  direction: direction
29232
- }, getActionToolbarProps(showToolbarDetached({
29233
- containerRef,
29234
- titleRef,
29235
- iconsWidth
29236
- })))))), /*#__PURE__*/React.createElement(Grid$1, {
29628
+ }, getActionToolbarProps(isDetached))))), /*#__PURE__*/React.createElement(Grid$1, {
29237
29629
  item: true,
29238
29630
  container: true,
29239
29631
  direction: "column",
@@ -32329,7 +32721,7 @@
32329
32721
  id: model.id,
32330
32722
  /**
32331
32723
  * This visualizations Enigma model, a representation of the generic object.
32332
- * @type {string}
32724
+ * @type {EngineAPI.IGenericObject}
32333
32725
  */
32334
32726
  model,
32335
32727
  /**
@@ -32478,14 +32870,17 @@
32478
32870
  */
32479
32871
 
32480
32872
  /**
32481
- * @interface CreateConfig
32482
- * @description Rendering configuration for creating and rendering a new object
32483
- * @extends BaseConfig
32484
- * @property {string} type
32485
- * @property {string=} version
32486
- * @property {(Field[])=} fields
32487
- * @property {boolean} [extendProperties=false] Whether to deeply extend properties or not. If false then subtrees will be overwritten.
32488
- * @property {EngineAPI.IGenericObjectProperties=} properties
32873
+ * @interface RenderConfig
32874
+ * @description Configuration for rendering a visualisation, either creating or fetching an existing object.
32875
+ * @property {HTMLElement} element Target html element to render in to
32876
+ * @property {object=} options Options passed into the visualisation
32877
+ * @property {Plugin[]} [plugins] plugins passed into the visualisation
32878
+ * @property {string=} id For existing objects: Engine identifier of object to render
32879
+ * @property {string=} type For creating objects: Type of visualisation to render
32880
+ * @property {string=} version For creating objects: Version of visualization to render
32881
+ * @property {(Field[])=} fields For creating objects: Data fields to use
32882
+ * @property {boolean=} [extendProperties=false] For creating objects: Whether to deeply extend properties or not. If false then subtrees will be overwritten.
32883
+ * @property {EngineAPI.IGenericObjectProperties=} properties For creating objects: Explicit properties to set
32489
32884
  * @example
32490
32885
  * // A config for Creating objects:
32491
32886
  * const createConfig = {
@@ -32500,6 +32895,12 @@
32500
32895
  * }
32501
32896
  * };
32502
32897
  * nebbie.render(createConfig);
32898
+ * // A config for rendering an existing object:
32899
+ * const createConfig = {
32900
+ * id: 'jG5LP',
32901
+ * element: document.querySelector('.line'),
32902
+ * };
32903
+ * nebbie.render(createConfig);
32503
32904
  */
32504
32905
  async function createSessionObject(_ref, halo) {
32505
32906
  let {
@@ -32558,6 +32959,71 @@
32558
32959
  }, halo, error, onDestroy);
32559
32960
  }
32560
32961
 
32962
+ /**
32963
+ * @typedef {string | EngineAPI.INxDimension | EngineAPI.INxMeasure | LibraryField} Field
32964
+ */
32965
+
32966
+ /**
32967
+ * @interface CreateConfig
32968
+ * @description Rendering configuration for creating and rendering a new object
32969
+ * @property {string} type
32970
+ * @property {string=} version
32971
+ * @property {(Field[])=} fields
32972
+ * @property {EngineAPI.IGenericObjectProperties=} properties
32973
+ */
32974
+
32975
+ async function createObject(_ref, halo, generateOnly) {
32976
+ let {
32977
+ type,
32978
+ version,
32979
+ fields,
32980
+ properties,
32981
+ extendProperties /* , options, plugins, element */
32982
+ } = _ref;
32983
+ let mergedProps = {};
32984
+ // let error;
32985
+ try {
32986
+ const t = halo.types.get({
32987
+ name: type,
32988
+ version
32989
+ });
32990
+ mergedProps = await t.initialProperties(properties, extendProperties);
32991
+ const sn = await t.supernova();
32992
+ if (fields) {
32993
+ populateData({
32994
+ sn,
32995
+ properties: mergedProps,
32996
+ fields
32997
+ }, halo);
32998
+ }
32999
+ if (properties && sn && sn.qae.properties.onChange) {
33000
+ sn.qae.properties.onChange.call({}, mergedProps);
33001
+ }
33002
+ } catch (e) {
33003
+ // error = e;
33004
+ // minimal dummy object properties to allow it to be created
33005
+ // and rendered with the error
33006
+ if (!generateOnly) {
33007
+ mergedProps = {
33008
+ qInfo: {
33009
+ qType: type
33010
+ },
33011
+ visualization: type
33012
+ };
33013
+ } else {
33014
+ mergedProps = null;
33015
+ }
33016
+ // console.error(e); // eslint-disable-line
33017
+ }
33018
+
33019
+ if (!generateOnly) {
33020
+ const model = await halo.app.createObject(mergedProps);
33021
+ modelStore.set(model.id, model);
33022
+ return model;
33023
+ }
33024
+ return mergedProps;
33025
+ }
33026
+
32561
33027
  async function getObject$1(_ref, halo) {
32562
33028
  let {
32563
33029
  id,
@@ -32902,21 +33368,6 @@
32902
33368
  return api;
32903
33369
  }
32904
33370
 
32905
- /**
32906
- * @interface BaseConfig
32907
- * @description Basic rendering configuration for rendering an object
32908
- * @property {HTMLElement} element
32909
- * @property {object=} options
32910
- * @property {Plugin[]} [plugins]
32911
- */
32912
-
32913
- /**
32914
- * @interface GetConfig
32915
- * @description Rendering configuration for rendering an existing object
32916
- * @extends BaseConfig
32917
- * @property {string} id
32918
- */
32919
-
32920
33371
  async function getObject(_ref, halo) {
32921
33372
  let {
32922
33373
  id,
@@ -34356,7 +34807,6 @@
34356
34807
  * @ignore
34357
34808
  * @example
34358
34809
  * import { onContextMenu } from '@nebula.js/stardust';
34359
-
34360
34810
  * onContextMenu((menu, event) => {
34361
34811
  * menu.addItem(item, index);
34362
34812
  * });
@@ -35116,1603 +35566,1350 @@
35116
35566
  };
35117
35567
 
35118
35568
  (function (module, exports) {
35119
- exports = module.exports = SemVer;
35120
-
35121
- var debug;
35122
- /* istanbul ignore next */
35123
- if (typeof process === 'object' &&
35124
- process.env &&
35125
- process.env.NODE_DEBUG &&
35126
- /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
35127
- debug = function () {
35128
- var args = Array.prototype.slice.call(arguments, 0);
35129
- args.unshift('SEMVER');
35130
- console.log.apply(console, args);
35131
- };
35132
- } else {
35133
- debug = function () {};
35134
- }
35135
-
35136
- // Note: this is the semver.org version of the spec that it implements
35137
- // Not necessarily the package version of this code.
35138
- exports.SEMVER_SPEC_VERSION = '2.0.0';
35139
-
35140
- var MAX_LENGTH = 256;
35141
- var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
35142
- /* istanbul ignore next */ 9007199254740991;
35143
-
35144
- // Max safe segment length for coercion.
35145
- var MAX_SAFE_COMPONENT_LENGTH = 16;
35146
-
35147
- // The actual regexps go on exports.re
35148
- var re = exports.re = [];
35149
- var src = exports.src = [];
35150
- var t = exports.tokens = {};
35151
- var R = 0;
35152
-
35153
- function tok (n) {
35154
- t[n] = R++;
35155
- }
35156
-
35157
- // The following Regular Expressions can be used for tokenizing,
35158
- // validating, and parsing SemVer version strings.
35159
-
35160
- // ## Numeric Identifier
35161
- // A single `0`, or a non-zero digit followed by zero or more digits.
35162
-
35163
- tok('NUMERICIDENTIFIER');
35164
- src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*';
35165
- tok('NUMERICIDENTIFIERLOOSE');
35166
- src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+';
35167
-
35168
- // ## Non-numeric Identifier
35169
- // Zero or more digits, followed by a letter or hyphen, and then zero or
35170
- // more letters, digits, or hyphens.
35171
-
35172
- tok('NONNUMERICIDENTIFIER');
35173
- src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
35174
-
35175
- // ## Main Version
35176
- // Three dot-separated numeric identifiers.
35177
-
35178
- tok('MAINVERSION');
35179
- src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
35180
- '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
35181
- '(' + src[t.NUMERICIDENTIFIER] + ')';
35182
-
35183
- tok('MAINVERSIONLOOSE');
35184
- src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
35185
- '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
35186
- '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')';
35187
-
35188
- // ## Pre-release Version Identifier
35189
- // A numeric identifier, or a non-numeric identifier.
35190
-
35191
- tok('PRERELEASEIDENTIFIER');
35192
- src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] +
35193
- '|' + src[t.NONNUMERICIDENTIFIER] + ')';
35194
-
35195
- tok('PRERELEASEIDENTIFIERLOOSE');
35196
- src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] +
35197
- '|' + src[t.NONNUMERICIDENTIFIER] + ')';
35198
-
35199
- // ## Pre-release Version
35200
- // Hyphen, followed by one or more dot-separated pre-release version
35201
- // identifiers.
35202
-
35203
- tok('PRERELEASE');
35204
- src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] +
35205
- '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))';
35206
-
35207
- tok('PRERELEASELOOSE');
35208
- src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +
35209
- '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))';
35210
-
35211
- // ## Build Metadata Identifier
35212
- // Any combination of digits, letters, or hyphens.
35213
-
35214
- tok('BUILDIDENTIFIER');
35215
- src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
35216
-
35217
- // ## Build Metadata
35218
- // Plus sign, followed by one or more period-separated build metadata
35219
- // identifiers.
35220
-
35221
- tok('BUILD');
35222
- src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] +
35223
- '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))';
35224
-
35225
- // ## Full Version String
35226
- // A main version, followed optionally by a pre-release version and
35227
- // build metadata.
35228
-
35229
- // Note that the only major, minor, patch, and pre-release sections of
35230
- // the version string are capturing groups. The build metadata is not a
35231
- // capturing group, because it should not ever be used in version
35232
- // comparison.
35233
-
35234
- tok('FULL');
35235
- tok('FULLPLAIN');
35236
- src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] +
35237
- src[t.PRERELEASE] + '?' +
35238
- src[t.BUILD] + '?';
35239
-
35240
- src[t.FULL] = '^' + src[t.FULLPLAIN] + '$';
35241
-
35242
- // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
35243
- // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
35244
- // common in the npm registry.
35245
- tok('LOOSEPLAIN');
35246
- src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] +
35247
- src[t.PRERELEASELOOSE] + '?' +
35248
- src[t.BUILD] + '?';
35249
-
35250
- tok('LOOSE');
35251
- src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$';
35252
-
35253
- tok('GTLT');
35254
- src[t.GTLT] = '((?:<|>)?=?)';
35255
-
35256
- // Something like "2.*" or "1.2.x".
35257
- // Note that "x.x" is a valid xRange identifer, meaning "any version"
35258
- // Only the first item is strictly required.
35259
- tok('XRANGEIDENTIFIERLOOSE');
35260
- src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
35261
- tok('XRANGEIDENTIFIER');
35262
- src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*';
35263
-
35264
- tok('XRANGEPLAIN');
35265
- src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' +
35266
- '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
35267
- '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
35268
- '(?:' + src[t.PRERELEASE] + ')?' +
35269
- src[t.BUILD] + '?' +
35270
- ')?)?';
35271
-
35272
- tok('XRANGEPLAINLOOSE');
35273
- src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
35274
- '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
35275
- '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
35276
- '(?:' + src[t.PRERELEASELOOSE] + ')?' +
35277
- src[t.BUILD] + '?' +
35278
- ')?)?';
35279
-
35280
- tok('XRANGE');
35281
- src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$';
35282
- tok('XRANGELOOSE');
35283
- src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$';
35284
-
35285
- // Coercion.
35286
- // Extract anything that could conceivably be a part of a valid semver
35287
- tok('COERCE');
35288
- src[t.COERCE] = '(^|[^\\d])' +
35289
- '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
35290
- '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
35291
- '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
35292
- '(?:$|[^\\d])';
35293
- tok('COERCERTL');
35294
- re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g');
35295
-
35296
- // Tilde ranges.
35297
- // Meaning is "reasonably at or greater than"
35298
- tok('LONETILDE');
35299
- src[t.LONETILDE] = '(?:~>?)';
35300
-
35301
- tok('TILDETRIM');
35302
- src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+';
35303
- re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g');
35304
- var tildeTrimReplace = '$1~';
35305
-
35306
- tok('TILDE');
35307
- src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$';
35308
- tok('TILDELOOSE');
35309
- src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$';
35310
-
35311
- // Caret ranges.
35312
- // Meaning is "at least and backwards compatible with"
35313
- tok('LONECARET');
35314
- src[t.LONECARET] = '(?:\\^)';
35315
-
35316
- tok('CARETTRIM');
35317
- src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+';
35318
- re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g');
35319
- var caretTrimReplace = '$1^';
35320
-
35321
- tok('CARET');
35322
- src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$';
35323
- tok('CARETLOOSE');
35324
- src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$';
35325
-
35326
- // A simple gt/lt/eq thing, or just "" to indicate "any version"
35327
- tok('COMPARATORLOOSE');
35328
- src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$';
35329
- tok('COMPARATOR');
35330
- src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$';
35331
-
35332
- // An expression to strip any whitespace between the gtlt and the thing
35333
- // it modifies, so that `> 1.2.3` ==> `>1.2.3`
35334
- tok('COMPARATORTRIM');
35335
- src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] +
35336
- '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')';
35337
-
35338
- // this one has to use the /g flag
35339
- re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g');
35340
- var comparatorTrimReplace = '$1$2$3';
35341
-
35342
- // Something like `1.2.3 - 1.2.4`
35343
- // Note that these all use the loose form, because they'll be
35344
- // checked against either the strict or loose comparator form
35345
- // later.
35346
- tok('HYPHENRANGE');
35347
- src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' +
35348
- '\\s+-\\s+' +
35349
- '(' + src[t.XRANGEPLAIN] + ')' +
35350
- '\\s*$';
35351
-
35352
- tok('HYPHENRANGELOOSE');
35353
- src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' +
35354
- '\\s+-\\s+' +
35355
- '(' + src[t.XRANGEPLAINLOOSE] + ')' +
35356
- '\\s*$';
35357
-
35358
- // Star ranges basically just allow anything at all.
35359
- tok('STAR');
35360
- src[t.STAR] = '(<|>)?=?\\s*\\*';
35361
-
35362
- // Compile to actual regexp objects.
35363
- // All are flag-free, unless they were created above with a flag.
35364
- for (var i = 0; i < R; i++) {
35365
- debug(i, src[i]);
35366
- if (!re[i]) {
35367
- re[i] = new RegExp(src[i]);
35368
- }
35369
- }
35370
-
35371
- exports.parse = parse;
35372
- function parse (version, options) {
35373
- if (!options || typeof options !== 'object') {
35374
- options = {
35375
- loose: !!options,
35376
- includePrerelease: false
35377
- };
35378
- }
35379
-
35380
- if (version instanceof SemVer) {
35381
- return version
35382
- }
35383
-
35384
- if (typeof version !== 'string') {
35385
- return null
35386
- }
35387
-
35388
- if (version.length > MAX_LENGTH) {
35389
- return null
35390
- }
35391
-
35392
- var r = options.loose ? re[t.LOOSE] : re[t.FULL];
35393
- if (!r.test(version)) {
35394
- return null
35395
- }
35396
-
35397
- try {
35398
- return new SemVer(version, options)
35399
- } catch (er) {
35400
- return null
35401
- }
35402
- }
35403
-
35404
- exports.valid = valid;
35405
- function valid (version, options) {
35406
- var v = parse(version, options);
35407
- return v ? v.version : null
35408
- }
35409
-
35410
- exports.clean = clean;
35411
- function clean (version, options) {
35412
- var s = parse(version.trim().replace(/^[=v]+/, ''), options);
35413
- return s ? s.version : null
35414
- }
35415
-
35416
- exports.SemVer = SemVer;
35417
-
35418
- function SemVer (version, options) {
35419
- if (!options || typeof options !== 'object') {
35420
- options = {
35421
- loose: !!options,
35422
- includePrerelease: false
35423
- };
35424
- }
35425
- if (version instanceof SemVer) {
35426
- if (version.loose === options.loose) {
35427
- return version
35428
- } else {
35429
- version = version.version;
35430
- }
35431
- } else if (typeof version !== 'string') {
35432
- throw new TypeError('Invalid Version: ' + version)
35433
- }
35434
-
35435
- if (version.length > MAX_LENGTH) {
35436
- throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
35437
- }
35438
-
35439
- if (!(this instanceof SemVer)) {
35440
- return new SemVer(version, options)
35441
- }
35442
-
35443
- debug('SemVer', version, options);
35444
- this.options = options;
35445
- this.loose = !!options.loose;
35446
-
35447
- var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
35448
-
35449
- if (!m) {
35450
- throw new TypeError('Invalid Version: ' + version)
35451
- }
35452
-
35453
- this.raw = version;
35454
-
35455
- // these are actually numbers
35456
- this.major = +m[1];
35457
- this.minor = +m[2];
35458
- this.patch = +m[3];
35459
-
35460
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
35461
- throw new TypeError('Invalid major version')
35462
- }
35463
-
35464
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
35465
- throw new TypeError('Invalid minor version')
35466
- }
35467
-
35468
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
35469
- throw new TypeError('Invalid patch version')
35470
- }
35471
-
35472
- // numberify any prerelease numeric ids
35473
- if (!m[4]) {
35474
- this.prerelease = [];
35475
- } else {
35476
- this.prerelease = m[4].split('.').map(function (id) {
35477
- if (/^[0-9]+$/.test(id)) {
35478
- var num = +id;
35479
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
35480
- return num
35481
- }
35482
- }
35483
- return id
35484
- });
35485
- }
35486
-
35487
- this.build = m[5] ? m[5].split('.') : [];
35488
- this.format();
35489
- }
35490
-
35491
- SemVer.prototype.format = function () {
35492
- this.version = this.major + '.' + this.minor + '.' + this.patch;
35493
- if (this.prerelease.length) {
35494
- this.version += '-' + this.prerelease.join('.');
35495
- }
35496
- return this.version
35497
- };
35498
-
35499
- SemVer.prototype.toString = function () {
35500
- return this.version
35501
- };
35502
-
35503
- SemVer.prototype.compare = function (other) {
35504
- debug('SemVer.compare', this.version, this.options, other);
35505
- if (!(other instanceof SemVer)) {
35506
- other = new SemVer(other, this.options);
35507
- }
35508
-
35509
- return this.compareMain(other) || this.comparePre(other)
35510
- };
35511
-
35512
- SemVer.prototype.compareMain = function (other) {
35513
- if (!(other instanceof SemVer)) {
35514
- other = new SemVer(other, this.options);
35515
- }
35516
-
35517
- return compareIdentifiers(this.major, other.major) ||
35518
- compareIdentifiers(this.minor, other.minor) ||
35519
- compareIdentifiers(this.patch, other.patch)
35520
- };
35521
-
35522
- SemVer.prototype.comparePre = function (other) {
35523
- if (!(other instanceof SemVer)) {
35524
- other = new SemVer(other, this.options);
35525
- }
35526
-
35527
- // NOT having a prerelease is > having one
35528
- if (this.prerelease.length && !other.prerelease.length) {
35529
- return -1
35530
- } else if (!this.prerelease.length && other.prerelease.length) {
35531
- return 1
35532
- } else if (!this.prerelease.length && !other.prerelease.length) {
35533
- return 0
35534
- }
35535
-
35536
- var i = 0;
35537
- do {
35538
- var a = this.prerelease[i];
35539
- var b = other.prerelease[i];
35540
- debug('prerelease compare', i, a, b);
35541
- if (a === undefined && b === undefined) {
35542
- return 0
35543
- } else if (b === undefined) {
35544
- return 1
35545
- } else if (a === undefined) {
35546
- return -1
35547
- } else if (a === b) {
35548
- continue
35549
- } else {
35550
- return compareIdentifiers(a, b)
35551
- }
35552
- } while (++i)
35553
- };
35554
-
35555
- SemVer.prototype.compareBuild = function (other) {
35556
- if (!(other instanceof SemVer)) {
35557
- other = new SemVer(other, this.options);
35558
- }
35559
-
35560
- var i = 0;
35561
- do {
35562
- var a = this.build[i];
35563
- var b = other.build[i];
35564
- debug('prerelease compare', i, a, b);
35565
- if (a === undefined && b === undefined) {
35566
- return 0
35567
- } else if (b === undefined) {
35568
- return 1
35569
- } else if (a === undefined) {
35570
- return -1
35571
- } else if (a === b) {
35572
- continue
35573
- } else {
35574
- return compareIdentifiers(a, b)
35575
- }
35576
- } while (++i)
35577
- };
35578
-
35579
- // preminor will bump the version up to the next minor release, and immediately
35580
- // down to pre-release. premajor and prepatch work the same way.
35581
- SemVer.prototype.inc = function (release, identifier) {
35582
- switch (release) {
35583
- case 'premajor':
35584
- this.prerelease.length = 0;
35585
- this.patch = 0;
35586
- this.minor = 0;
35587
- this.major++;
35588
- this.inc('pre', identifier);
35589
- break
35590
- case 'preminor':
35591
- this.prerelease.length = 0;
35592
- this.patch = 0;
35593
- this.minor++;
35594
- this.inc('pre', identifier);
35595
- break
35596
- case 'prepatch':
35597
- // If this is already a prerelease, it will bump to the next version
35598
- // drop any prereleases that might already exist, since they are not
35599
- // relevant at this point.
35600
- this.prerelease.length = 0;
35601
- this.inc('patch', identifier);
35602
- this.inc('pre', identifier);
35603
- break
35604
- // If the input is a non-prerelease version, this acts the same as
35605
- // prepatch.
35606
- case 'prerelease':
35607
- if (this.prerelease.length === 0) {
35608
- this.inc('patch', identifier);
35609
- }
35610
- this.inc('pre', identifier);
35611
- break
35612
-
35613
- case 'major':
35614
- // If this is a pre-major version, bump up to the same major version.
35615
- // Otherwise increment major.
35616
- // 1.0.0-5 bumps to 1.0.0
35617
- // 1.1.0 bumps to 2.0.0
35618
- if (this.minor !== 0 ||
35619
- this.patch !== 0 ||
35620
- this.prerelease.length === 0) {
35621
- this.major++;
35622
- }
35623
- this.minor = 0;
35624
- this.patch = 0;
35625
- this.prerelease = [];
35626
- break
35627
- case 'minor':
35628
- // If this is a pre-minor version, bump up to the same minor version.
35629
- // Otherwise increment minor.
35630
- // 1.2.0-5 bumps to 1.2.0
35631
- // 1.2.1 bumps to 1.3.0
35632
- if (this.patch !== 0 || this.prerelease.length === 0) {
35633
- this.minor++;
35634
- }
35635
- this.patch = 0;
35636
- this.prerelease = [];
35637
- break
35638
- case 'patch':
35639
- // If this is not a pre-release version, it will increment the patch.
35640
- // If it is a pre-release it will bump up to the same patch version.
35641
- // 1.2.0-5 patches to 1.2.0
35642
- // 1.2.0 patches to 1.2.1
35643
- if (this.prerelease.length === 0) {
35644
- this.patch++;
35645
- }
35646
- this.prerelease = [];
35647
- break
35648
- // This probably shouldn't be used publicly.
35649
- // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
35650
- case 'pre':
35651
- if (this.prerelease.length === 0) {
35652
- this.prerelease = [0];
35653
- } else {
35654
- var i = this.prerelease.length;
35655
- while (--i >= 0) {
35656
- if (typeof this.prerelease[i] === 'number') {
35657
- this.prerelease[i]++;
35658
- i = -2;
35659
- }
35660
- }
35661
- if (i === -1) {
35662
- // didn't increment anything
35663
- this.prerelease.push(0);
35664
- }
35665
- }
35666
- if (identifier) {
35667
- // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
35668
- // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
35669
- if (this.prerelease[0] === identifier) {
35670
- if (isNaN(this.prerelease[1])) {
35671
- this.prerelease = [identifier, 0];
35672
- }
35673
- } else {
35674
- this.prerelease = [identifier, 0];
35675
- }
35676
- }
35677
- break
35678
-
35679
- default:
35680
- throw new Error('invalid increment argument: ' + release)
35681
- }
35682
- this.format();
35683
- this.raw = this.version;
35684
- return this
35685
- };
35686
-
35687
- exports.inc = inc;
35688
- function inc (version, release, loose, identifier) {
35689
- if (typeof (loose) === 'string') {
35690
- identifier = loose;
35691
- loose = undefined;
35692
- }
35693
-
35694
- try {
35695
- return new SemVer(version, loose).inc(release, identifier).version
35696
- } catch (er) {
35697
- return null
35698
- }
35699
- }
35700
-
35701
- exports.diff = diff;
35702
- function diff (version1, version2) {
35703
- if (eq(version1, version2)) {
35704
- return null
35705
- } else {
35706
- var v1 = parse(version1);
35707
- var v2 = parse(version2);
35708
- var prefix = '';
35709
- if (v1.prerelease.length || v2.prerelease.length) {
35710
- prefix = 'pre';
35711
- var defaultResult = 'prerelease';
35712
- }
35713
- for (var key in v1) {
35714
- if (key === 'major' || key === 'minor' || key === 'patch') {
35715
- if (v1[key] !== v2[key]) {
35716
- return prefix + key
35717
- }
35718
- }
35719
- }
35720
- return defaultResult // may be undefined
35721
- }
35722
- }
35723
-
35724
- exports.compareIdentifiers = compareIdentifiers;
35725
-
35726
- var numeric = /^[0-9]+$/;
35727
- function compareIdentifiers (a, b) {
35728
- var anum = numeric.test(a);
35729
- var bnum = numeric.test(b);
35730
-
35731
- if (anum && bnum) {
35732
- a = +a;
35733
- b = +b;
35734
- }
35735
-
35736
- return a === b ? 0
35737
- : (anum && !bnum) ? -1
35738
- : (bnum && !anum) ? 1
35739
- : a < b ? -1
35740
- : 1
35741
- }
35742
-
35743
- exports.rcompareIdentifiers = rcompareIdentifiers;
35744
- function rcompareIdentifiers (a, b) {
35745
- return compareIdentifiers(b, a)
35746
- }
35747
-
35748
- exports.major = major;
35749
- function major (a, loose) {
35750
- return new SemVer(a, loose).major
35751
- }
35752
-
35753
- exports.minor = minor;
35754
- function minor (a, loose) {
35755
- return new SemVer(a, loose).minor
35756
- }
35757
-
35758
- exports.patch = patch;
35759
- function patch (a, loose) {
35760
- return new SemVer(a, loose).patch
35761
- }
35762
-
35763
- exports.compare = compare;
35764
- function compare (a, b, loose) {
35765
- return new SemVer(a, loose).compare(new SemVer(b, loose))
35766
- }
35767
-
35768
- exports.compareLoose = compareLoose;
35769
- function compareLoose (a, b) {
35770
- return compare(a, b, true)
35771
- }
35772
-
35773
- exports.compareBuild = compareBuild;
35774
- function compareBuild (a, b, loose) {
35775
- var versionA = new SemVer(a, loose);
35776
- var versionB = new SemVer(b, loose);
35777
- return versionA.compare(versionB) || versionA.compareBuild(versionB)
35778
- }
35779
-
35780
- exports.rcompare = rcompare;
35781
- function rcompare (a, b, loose) {
35782
- return compare(b, a, loose)
35783
- }
35784
-
35785
- exports.sort = sort;
35786
- function sort (list, loose) {
35787
- return list.sort(function (a, b) {
35788
- return exports.compareBuild(a, b, loose)
35789
- })
35790
- }
35791
-
35792
- exports.rsort = rsort;
35793
- function rsort (list, loose) {
35794
- return list.sort(function (a, b) {
35795
- return exports.compareBuild(b, a, loose)
35796
- })
35797
- }
35798
-
35799
- exports.gt = gt;
35800
- function gt (a, b, loose) {
35801
- return compare(a, b, loose) > 0
35802
- }
35803
-
35804
- exports.lt = lt;
35805
- function lt (a, b, loose) {
35806
- return compare(a, b, loose) < 0
35807
- }
35808
-
35809
- exports.eq = eq;
35810
- function eq (a, b, loose) {
35811
- return compare(a, b, loose) === 0
35812
- }
35813
-
35814
- exports.neq = neq;
35815
- function neq (a, b, loose) {
35816
- return compare(a, b, loose) !== 0
35817
- }
35818
-
35819
- exports.gte = gte;
35820
- function gte (a, b, loose) {
35821
- return compare(a, b, loose) >= 0
35822
- }
35823
-
35824
- exports.lte = lte;
35825
- function lte (a, b, loose) {
35826
- return compare(a, b, loose) <= 0
35827
- }
35828
-
35829
- exports.cmp = cmp;
35830
- function cmp (a, op, b, loose) {
35831
- switch (op) {
35832
- case '===':
35833
- if (typeof a === 'object')
35834
- a = a.version;
35835
- if (typeof b === 'object')
35836
- b = b.version;
35837
- return a === b
35838
-
35839
- case '!==':
35840
- if (typeof a === 'object')
35841
- a = a.version;
35842
- if (typeof b === 'object')
35843
- b = b.version;
35844
- return a !== b
35845
-
35846
- case '':
35847
- case '=':
35848
- case '==':
35849
- return eq(a, b, loose)
35850
-
35851
- case '!=':
35852
- return neq(a, b, loose)
35853
-
35854
- case '>':
35855
- return gt(a, b, loose)
35856
-
35857
- case '>=':
35858
- return gte(a, b, loose)
35859
-
35860
- case '<':
35861
- return lt(a, b, loose)
35862
-
35863
- case '<=':
35864
- return lte(a, b, loose)
35865
-
35866
- default:
35867
- throw new TypeError('Invalid operator: ' + op)
35868
- }
35869
- }
35870
-
35871
- exports.Comparator = Comparator;
35872
- function Comparator (comp, options) {
35873
- if (!options || typeof options !== 'object') {
35874
- options = {
35875
- loose: !!options,
35876
- includePrerelease: false
35877
- };
35878
- }
35879
-
35880
- if (comp instanceof Comparator) {
35881
- if (comp.loose === !!options.loose) {
35882
- return comp
35883
- } else {
35884
- comp = comp.value;
35885
- }
35886
- }
35887
-
35888
- if (!(this instanceof Comparator)) {
35889
- return new Comparator(comp, options)
35890
- }
35891
-
35892
- debug('comparator', comp, options);
35893
- this.options = options;
35894
- this.loose = !!options.loose;
35895
- this.parse(comp);
35896
-
35897
- if (this.semver === ANY) {
35898
- this.value = '';
35899
- } else {
35900
- this.value = this.operator + this.semver.version;
35901
- }
35902
-
35903
- debug('comp', this);
35904
- }
35905
-
35906
- var ANY = {};
35907
- Comparator.prototype.parse = function (comp) {
35908
- var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
35909
- var m = comp.match(r);
35910
-
35911
- if (!m) {
35912
- throw new TypeError('Invalid comparator: ' + comp)
35913
- }
35914
-
35915
- this.operator = m[1] !== undefined ? m[1] : '';
35916
- if (this.operator === '=') {
35917
- this.operator = '';
35918
- }
35919
-
35920
- // if it literally is just '>' or '' then allow anything.
35921
- if (!m[2]) {
35922
- this.semver = ANY;
35923
- } else {
35924
- this.semver = new SemVer(m[2], this.options.loose);
35925
- }
35926
- };
35927
-
35928
- Comparator.prototype.toString = function () {
35929
- return this.value
35930
- };
35931
-
35932
- Comparator.prototype.test = function (version) {
35933
- debug('Comparator.test', version, this.options.loose);
35934
-
35935
- if (this.semver === ANY || version === ANY) {
35936
- return true
35937
- }
35938
-
35939
- if (typeof version === 'string') {
35940
- try {
35941
- version = new SemVer(version, this.options);
35942
- } catch (er) {
35943
- return false
35944
- }
35945
- }
35946
-
35947
- return cmp(version, this.operator, this.semver, this.options)
35948
- };
35949
-
35950
- Comparator.prototype.intersects = function (comp, options) {
35951
- if (!(comp instanceof Comparator)) {
35952
- throw new TypeError('a Comparator is required')
35953
- }
35954
-
35955
- if (!options || typeof options !== 'object') {
35956
- options = {
35957
- loose: !!options,
35958
- includePrerelease: false
35959
- };
35960
- }
35961
-
35962
- var rangeTmp;
35963
-
35964
- if (this.operator === '') {
35965
- if (this.value === '') {
35966
- return true
35967
- }
35968
- rangeTmp = new Range(comp.value, options);
35969
- return satisfies(this.value, rangeTmp, options)
35970
- } else if (comp.operator === '') {
35971
- if (comp.value === '') {
35972
- return true
35973
- }
35974
- rangeTmp = new Range(this.value, options);
35975
- return satisfies(comp.semver, rangeTmp, options)
35976
- }
35977
-
35978
- var sameDirectionIncreasing =
35979
- (this.operator === '>=' || this.operator === '>') &&
35980
- (comp.operator === '>=' || comp.operator === '>');
35981
- var sameDirectionDecreasing =
35982
- (this.operator === '<=' || this.operator === '<') &&
35983
- (comp.operator === '<=' || comp.operator === '<');
35984
- var sameSemVer = this.semver.version === comp.semver.version;
35985
- var differentDirectionsInclusive =
35986
- (this.operator === '>=' || this.operator === '<=') &&
35987
- (comp.operator === '>=' || comp.operator === '<=');
35988
- var oppositeDirectionsLessThan =
35989
- cmp(this.semver, '<', comp.semver, options) &&
35990
- ((this.operator === '>=' || this.operator === '>') &&
35991
- (comp.operator === '<=' || comp.operator === '<'));
35992
- var oppositeDirectionsGreaterThan =
35993
- cmp(this.semver, '>', comp.semver, options) &&
35994
- ((this.operator === '<=' || this.operator === '<') &&
35995
- (comp.operator === '>=' || comp.operator === '>'));
35996
-
35997
- return sameDirectionIncreasing || sameDirectionDecreasing ||
35998
- (sameSemVer && differentDirectionsInclusive) ||
35999
- oppositeDirectionsLessThan || oppositeDirectionsGreaterThan
36000
- };
36001
-
36002
- exports.Range = Range;
36003
- function Range (range, options) {
36004
- if (!options || typeof options !== 'object') {
36005
- options = {
36006
- loose: !!options,
36007
- includePrerelease: false
36008
- };
36009
- }
36010
-
36011
- if (range instanceof Range) {
36012
- if (range.loose === !!options.loose &&
36013
- range.includePrerelease === !!options.includePrerelease) {
36014
- return range
36015
- } else {
36016
- return new Range(range.raw, options)
36017
- }
36018
- }
36019
-
36020
- if (range instanceof Comparator) {
36021
- return new Range(range.value, options)
36022
- }
36023
-
36024
- if (!(this instanceof Range)) {
36025
- return new Range(range, options)
36026
- }
36027
-
36028
- this.options = options;
36029
- this.loose = !!options.loose;
36030
- this.includePrerelease = !!options.includePrerelease;
36031
-
36032
- // First, split based on boolean or ||
36033
- this.raw = range;
36034
- this.set = range.split(/\s*\|\|\s*/).map(function (range) {
36035
- return this.parseRange(range.trim())
36036
- }, this).filter(function (c) {
36037
- // throw out any that are not relevant for whatever reason
36038
- return c.length
36039
- });
36040
-
36041
- if (!this.set.length) {
36042
- throw new TypeError('Invalid SemVer Range: ' + range)
36043
- }
36044
-
36045
- this.format();
36046
- }
36047
-
36048
- Range.prototype.format = function () {
36049
- this.range = this.set.map(function (comps) {
36050
- return comps.join(' ').trim()
36051
- }).join('||').trim();
36052
- return this.range
36053
- };
36054
-
36055
- Range.prototype.toString = function () {
36056
- return this.range
36057
- };
36058
-
36059
- Range.prototype.parseRange = function (range) {
36060
- var loose = this.options.loose;
36061
- range = range.trim();
36062
- // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
36063
- var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
36064
- range = range.replace(hr, hyphenReplace);
36065
- debug('hyphen replace', range);
36066
- // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
36067
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
36068
- debug('comparator trim', range, re[t.COMPARATORTRIM]);
36069
-
36070
- // `~ 1.2.3` => `~1.2.3`
36071
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
36072
-
36073
- // `^ 1.2.3` => `^1.2.3`
36074
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
36075
-
36076
- // normalize spaces
36077
- range = range.split(/\s+/).join(' ');
36078
-
36079
- // At this point, the range is completely trimmed and
36080
- // ready to be split into comparators.
36081
-
36082
- var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
36083
- var set = range.split(' ').map(function (comp) {
36084
- return parseComparator(comp, this.options)
36085
- }, this).join(' ').split(/\s+/);
36086
- if (this.options.loose) {
36087
- // in loose mode, throw out any that are not valid comparators
36088
- set = set.filter(function (comp) {
36089
- return !!comp.match(compRe)
36090
- });
36091
- }
36092
- set = set.map(function (comp) {
36093
- return new Comparator(comp, this.options)
36094
- }, this);
36095
-
36096
- return set
36097
- };
36098
-
36099
- Range.prototype.intersects = function (range, options) {
36100
- if (!(range instanceof Range)) {
36101
- throw new TypeError('a Range is required')
36102
- }
36103
-
36104
- return this.set.some(function (thisComparators) {
36105
- return (
36106
- isSatisfiable(thisComparators, options) &&
36107
- range.set.some(function (rangeComparators) {
36108
- return (
36109
- isSatisfiable(rangeComparators, options) &&
36110
- thisComparators.every(function (thisComparator) {
36111
- return rangeComparators.every(function (rangeComparator) {
36112
- return thisComparator.intersects(rangeComparator, options)
36113
- })
36114
- })
36115
- )
36116
- })
36117
- )
36118
- })
36119
- };
36120
-
36121
- // take a set of comparators and determine whether there
36122
- // exists a version which can satisfy it
36123
- function isSatisfiable (comparators, options) {
36124
- var result = true;
36125
- var remainingComparators = comparators.slice();
36126
- var testComparator = remainingComparators.pop();
36127
-
36128
- while (result && remainingComparators.length) {
36129
- result = remainingComparators.every(function (otherComparator) {
36130
- return testComparator.intersects(otherComparator, options)
36131
- });
36132
-
36133
- testComparator = remainingComparators.pop();
36134
- }
36135
-
36136
- return result
36137
- }
36138
-
36139
- // Mostly just for testing and legacy API reasons
36140
- exports.toComparators = toComparators;
36141
- function toComparators (range, options) {
36142
- return new Range(range, options).set.map(function (comp) {
36143
- return comp.map(function (c) {
36144
- return c.value
36145
- }).join(' ').trim().split(' ')
36146
- })
36147
- }
36148
-
36149
- // comprised of xranges, tildes, stars, and gtlt's at this point.
36150
- // already replaced the hyphen ranges
36151
- // turn into a set of JUST comparators.
36152
- function parseComparator (comp, options) {
36153
- debug('comp', comp, options);
36154
- comp = replaceCarets(comp, options);
36155
- debug('caret', comp);
36156
- comp = replaceTildes(comp, options);
36157
- debug('tildes', comp);
36158
- comp = replaceXRanges(comp, options);
36159
- debug('xrange', comp);
36160
- comp = replaceStars(comp, options);
36161
- debug('stars', comp);
36162
- return comp
36163
- }
36164
-
36165
- function isX (id) {
36166
- return !id || id.toLowerCase() === 'x' || id === '*'
36167
- }
36168
-
36169
- // ~, ~> --> * (any, kinda silly)
36170
- // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
36171
- // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
36172
- // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
36173
- // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
36174
- // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
36175
- function replaceTildes (comp, options) {
36176
- return comp.trim().split(/\s+/).map(function (comp) {
36177
- return replaceTilde(comp, options)
36178
- }).join(' ')
36179
- }
36180
-
36181
- function replaceTilde (comp, options) {
36182
- var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
36183
- return comp.replace(r, function (_, M, m, p, pr) {
36184
- debug('tilde', comp, _, M, m, p, pr);
36185
- var ret;
36186
-
36187
- if (isX(M)) {
36188
- ret = '';
36189
- } else if (isX(m)) {
36190
- ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
36191
- } else if (isX(p)) {
36192
- // ~1.2 == >=1.2.0 <1.3.0
36193
- ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
36194
- } else if (pr) {
36195
- debug('replaceTilde pr', pr);
36196
- ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
36197
- ' <' + M + '.' + (+m + 1) + '.0';
36198
- } else {
36199
- // ~1.2.3 == >=1.2.3 <1.3.0
36200
- ret = '>=' + M + '.' + m + '.' + p +
36201
- ' <' + M + '.' + (+m + 1) + '.0';
36202
- }
36203
-
36204
- debug('tilde return', ret);
36205
- return ret
36206
- })
36207
- }
36208
-
36209
- // ^ --> * (any, kinda silly)
36210
- // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
36211
- // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
36212
- // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
36213
- // ^1.2.3 --> >=1.2.3 <2.0.0
36214
- // ^1.2.0 --> >=1.2.0 <2.0.0
36215
- function replaceCarets (comp, options) {
36216
- return comp.trim().split(/\s+/).map(function (comp) {
36217
- return replaceCaret(comp, options)
36218
- }).join(' ')
36219
- }
36220
-
36221
- function replaceCaret (comp, options) {
36222
- debug('caret', comp, options);
36223
- var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
36224
- return comp.replace(r, function (_, M, m, p, pr) {
36225
- debug('caret', comp, _, M, m, p, pr);
36226
- var ret;
36227
-
36228
- if (isX(M)) {
36229
- ret = '';
36230
- } else if (isX(m)) {
36231
- ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
36232
- } else if (isX(p)) {
36233
- if (M === '0') {
36234
- ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
36235
- } else {
36236
- ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0';
36237
- }
36238
- } else if (pr) {
36239
- debug('replaceCaret pr', pr);
36240
- if (M === '0') {
36241
- if (m === '0') {
36242
- ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
36243
- ' <' + M + '.' + m + '.' + (+p + 1);
36244
- } else {
36245
- ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
36246
- ' <' + M + '.' + (+m + 1) + '.0';
36247
- }
36248
- } else {
36249
- ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
36250
- ' <' + (+M + 1) + '.0.0';
36251
- }
36252
- } else {
36253
- debug('no pr');
36254
- if (M === '0') {
36255
- if (m === '0') {
36256
- ret = '>=' + M + '.' + m + '.' + p +
36257
- ' <' + M + '.' + m + '.' + (+p + 1);
36258
- } else {
36259
- ret = '>=' + M + '.' + m + '.' + p +
36260
- ' <' + M + '.' + (+m + 1) + '.0';
36261
- }
36262
- } else {
36263
- ret = '>=' + M + '.' + m + '.' + p +
36264
- ' <' + (+M + 1) + '.0.0';
36265
- }
36266
- }
36267
-
36268
- debug('caret return', ret);
36269
- return ret
36270
- })
36271
- }
36272
-
36273
- function replaceXRanges (comp, options) {
36274
- debug('replaceXRanges', comp, options);
36275
- return comp.split(/\s+/).map(function (comp) {
36276
- return replaceXRange(comp, options)
36277
- }).join(' ')
36278
- }
36279
-
36280
- function replaceXRange (comp, options) {
36281
- comp = comp.trim();
36282
- var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
36283
- return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
36284
- debug('xRange', comp, ret, gtlt, M, m, p, pr);
36285
- var xM = isX(M);
36286
- var xm = xM || isX(m);
36287
- var xp = xm || isX(p);
36288
- var anyX = xp;
36289
-
36290
- if (gtlt === '=' && anyX) {
36291
- gtlt = '';
36292
- }
36293
-
36294
- // if we're including prereleases in the match, then we need
36295
- // to fix this to -0, the lowest possible prerelease value
36296
- pr = options.includePrerelease ? '-0' : '';
36297
-
36298
- if (xM) {
36299
- if (gtlt === '>' || gtlt === '<') {
36300
- // nothing is allowed
36301
- ret = '<0.0.0-0';
36302
- } else {
36303
- // nothing is forbidden
36304
- ret = '*';
36305
- }
36306
- } else if (gtlt && anyX) {
36307
- // we know patch is an x, because we have any x at all.
36308
- // replace X with 0
36309
- if (xm) {
36310
- m = 0;
36311
- }
36312
- p = 0;
36313
-
36314
- if (gtlt === '>') {
36315
- // >1 => >=2.0.0
36316
- // >1.2 => >=1.3.0
36317
- // >1.2.3 => >= 1.2.4
36318
- gtlt = '>=';
36319
- if (xm) {
36320
- M = +M + 1;
36321
- m = 0;
36322
- p = 0;
36323
- } else {
36324
- m = +m + 1;
36325
- p = 0;
36326
- }
36327
- } else if (gtlt === '<=') {
36328
- // <=0.7.x is actually <0.8.0, since any 0.7.x should
36329
- // pass. Similarly, <=7.x is actually <8.0.0, etc.
36330
- gtlt = '<';
36331
- if (xm) {
36332
- M = +M + 1;
36333
- } else {
36334
- m = +m + 1;
36335
- }
36336
- }
36337
-
36338
- ret = gtlt + M + '.' + m + '.' + p + pr;
36339
- } else if (xm) {
36340
- ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr;
36341
- } else if (xp) {
36342
- ret = '>=' + M + '.' + m + '.0' + pr +
36343
- ' <' + M + '.' + (+m + 1) + '.0' + pr;
36344
- }
36345
-
36346
- debug('xRange return', ret);
36347
-
36348
- return ret
36349
- })
36350
- }
36351
-
36352
- // Because * is AND-ed with everything else in the comparator,
36353
- // and '' means "any version", just remove the *s entirely.
36354
- function replaceStars (comp, options) {
36355
- debug('replaceStars', comp, options);
36356
- // Looseness is ignored here. star is always as loose as it gets!
36357
- return comp.trim().replace(re[t.STAR], '')
36358
- }
36359
-
36360
- // This function is passed to string.replace(re[t.HYPHENRANGE])
36361
- // M, m, patch, prerelease, build
36362
- // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
36363
- // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
36364
- // 1.2 - 3.4 => >=1.2.0 <3.5.0
36365
- function hyphenReplace ($0,
36366
- from, fM, fm, fp, fpr, fb,
36367
- to, tM, tm, tp, tpr, tb) {
36368
- if (isX(fM)) {
36369
- from = '';
36370
- } else if (isX(fm)) {
36371
- from = '>=' + fM + '.0.0';
36372
- } else if (isX(fp)) {
36373
- from = '>=' + fM + '.' + fm + '.0';
36374
- } else {
36375
- from = '>=' + from;
36376
- }
36377
-
36378
- if (isX(tM)) {
36379
- to = '';
36380
- } else if (isX(tm)) {
36381
- to = '<' + (+tM + 1) + '.0.0';
36382
- } else if (isX(tp)) {
36383
- to = '<' + tM + '.' + (+tm + 1) + '.0';
36384
- } else if (tpr) {
36385
- to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
36386
- } else {
36387
- to = '<=' + to;
36388
- }
36389
-
36390
- return (from + ' ' + to).trim()
36391
- }
36392
-
36393
- // if ANY of the sets match ALL of its comparators, then pass
36394
- Range.prototype.test = function (version) {
36395
- if (!version) {
36396
- return false
36397
- }
36398
-
36399
- if (typeof version === 'string') {
36400
- try {
36401
- version = new SemVer(version, this.options);
36402
- } catch (er) {
36403
- return false
36404
- }
36405
- }
36406
-
36407
- for (var i = 0; i < this.set.length; i++) {
36408
- if (testSet(this.set[i], version, this.options)) {
36409
- return true
36410
- }
36411
- }
36412
- return false
36413
- };
36414
-
36415
- function testSet (set, version, options) {
36416
- for (var i = 0; i < set.length; i++) {
36417
- if (!set[i].test(version)) {
36418
- return false
36419
- }
36420
- }
36421
-
36422
- if (version.prerelease.length && !options.includePrerelease) {
36423
- // Find the set of versions that are allowed to have prereleases
36424
- // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
36425
- // That should allow `1.2.3-pr.2` to pass.
36426
- // However, `1.2.4-alpha.notready` should NOT be allowed,
36427
- // even though it's within the range set by the comparators.
36428
- for (i = 0; i < set.length; i++) {
36429
- debug(set[i].semver);
36430
- if (set[i].semver === ANY) {
36431
- continue
36432
- }
36433
-
36434
- if (set[i].semver.prerelease.length > 0) {
36435
- var allowed = set[i].semver;
36436
- if (allowed.major === version.major &&
36437
- allowed.minor === version.minor &&
36438
- allowed.patch === version.patch) {
36439
- return true
36440
- }
36441
- }
36442
- }
36443
-
36444
- // Version has a -pre, but it's not one of the ones we like.
36445
- return false
36446
- }
36447
-
36448
- return true
36449
- }
36450
-
36451
- exports.satisfies = satisfies;
36452
- function satisfies (version, range, options) {
36453
- try {
36454
- range = new Range(range, options);
36455
- } catch (er) {
36456
- return false
36457
- }
36458
- return range.test(version)
36459
- }
35569
+ exports = module.exports = SemVer;
35570
+ var debug;
35571
+ /* istanbul ignore next */
35572
+ if (typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
35573
+ debug = function () {
35574
+ var args = Array.prototype.slice.call(arguments, 0);
35575
+ args.unshift('SEMVER');
35576
+ console.log.apply(console, args);
35577
+ };
35578
+ } else {
35579
+ debug = function () {};
35580
+ }
36460
35581
 
36461
- exports.maxSatisfying = maxSatisfying;
36462
- function maxSatisfying (versions, range, options) {
36463
- var max = null;
36464
- var maxSV = null;
36465
- try {
36466
- var rangeObj = new Range(range, options);
36467
- } catch (er) {
36468
- return null
36469
- }
36470
- versions.forEach(function (v) {
36471
- if (rangeObj.test(v)) {
36472
- // satisfies(v, range, options)
36473
- if (!max || maxSV.compare(v) === -1) {
36474
- // compare(max, v, true)
36475
- max = v;
36476
- maxSV = new SemVer(max, options);
36477
- }
36478
- }
36479
- });
36480
- return max
36481
- }
35582
+ // Note: this is the semver.org version of the spec that it implements
35583
+ // Not necessarily the package version of this code.
35584
+ exports.SEMVER_SPEC_VERSION = '2.0.0';
35585
+ var MAX_LENGTH = 256;
35586
+ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */9007199254740991;
35587
+
35588
+ // Max safe segment length for coercion.
35589
+ var MAX_SAFE_COMPONENT_LENGTH = 16;
35590
+
35591
+ // The actual regexps go on exports.re
35592
+ var re = exports.re = [];
35593
+ var src = exports.src = [];
35594
+ var t = exports.tokens = {};
35595
+ var R = 0;
35596
+ function tok(n) {
35597
+ t[n] = R++;
35598
+ }
35599
+
35600
+ // The following Regular Expressions can be used for tokenizing,
35601
+ // validating, and parsing SemVer version strings.
35602
+
35603
+ // ## Numeric Identifier
35604
+ // A single `0`, or a non-zero digit followed by zero or more digits.
35605
+
35606
+ tok('NUMERICIDENTIFIER');
35607
+ src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*';
35608
+ tok('NUMERICIDENTIFIERLOOSE');
35609
+ src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+';
35610
+
35611
+ // ## Non-numeric Identifier
35612
+ // Zero or more digits, followed by a letter or hyphen, and then zero or
35613
+ // more letters, digits, or hyphens.
35614
+
35615
+ tok('NONNUMERICIDENTIFIER');
35616
+ src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
35617
+
35618
+ // ## Main Version
35619
+ // Three dot-separated numeric identifiers.
35620
+
35621
+ tok('MAINVERSION');
35622
+ src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')';
35623
+ tok('MAINVERSIONLOOSE');
35624
+ src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')';
35625
+
35626
+ // ## Pre-release Version Identifier
35627
+ // A numeric identifier, or a non-numeric identifier.
35628
+
35629
+ tok('PRERELEASEIDENTIFIER');
35630
+ src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + '|' + src[t.NONNUMERICIDENTIFIER] + ')';
35631
+ tok('PRERELEASEIDENTIFIERLOOSE');
35632
+ src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + '|' + src[t.NONNUMERICIDENTIFIER] + ')';
35633
+
35634
+ // ## Pre-release Version
35635
+ // Hyphen, followed by one or more dot-separated pre-release version
35636
+ // identifiers.
35637
+
35638
+ tok('PRERELEASE');
35639
+ src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))';
35640
+ tok('PRERELEASELOOSE');
35641
+ src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))';
35642
+
35643
+ // ## Build Metadata Identifier
35644
+ // Any combination of digits, letters, or hyphens.
35645
+
35646
+ tok('BUILDIDENTIFIER');
35647
+ src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
35648
+
35649
+ // ## Build Metadata
35650
+ // Plus sign, followed by one or more period-separated build metadata
35651
+ // identifiers.
35652
+
35653
+ tok('BUILD');
35654
+ src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))';
35655
+
35656
+ // ## Full Version String
35657
+ // A main version, followed optionally by a pre-release version and
35658
+ // build metadata.
35659
+
35660
+ // Note that the only major, minor, patch, and pre-release sections of
35661
+ // the version string are capturing groups. The build metadata is not a
35662
+ // capturing group, because it should not ever be used in version
35663
+ // comparison.
35664
+
35665
+ tok('FULL');
35666
+ tok('FULLPLAIN');
35667
+ src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + src[t.PRERELEASE] + '?' + src[t.BUILD] + '?';
35668
+ src[t.FULL] = '^' + src[t.FULLPLAIN] + '$';
35669
+
35670
+ // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
35671
+ // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
35672
+ // common in the npm registry.
35673
+ tok('LOOSEPLAIN');
35674
+ src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + src[t.PRERELEASELOOSE] + '?' + src[t.BUILD] + '?';
35675
+ tok('LOOSE');
35676
+ src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$';
35677
+ tok('GTLT');
35678
+ src[t.GTLT] = '((?:<|>)?=?)';
35679
+
35680
+ // Something like "2.*" or "1.2.x".
35681
+ // Note that "x.x" is a valid xRange identifer, meaning "any version"
35682
+ // Only the first item is strictly required.
35683
+ tok('XRANGEIDENTIFIERLOOSE');
35684
+ src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
35685
+ tok('XRANGEIDENTIFIER');
35686
+ src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*';
35687
+ tok('XRANGEPLAIN');
35688
+ src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:' + src[t.PRERELEASE] + ')?' + src[t.BUILD] + '?' + ')?)?';
35689
+ tok('XRANGEPLAINLOOSE');
35690
+ src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:' + src[t.PRERELEASELOOSE] + ')?' + src[t.BUILD] + '?' + ')?)?';
35691
+ tok('XRANGE');
35692
+ src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$';
35693
+ tok('XRANGELOOSE');
35694
+ src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$';
35695
+
35696
+ // Coercion.
35697
+ // Extract anything that could conceivably be a part of a valid semver
35698
+ tok('COERCE');
35699
+ src[t.COERCE] = '(^|[^\\d])' + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:$|[^\\d])';
35700
+ tok('COERCERTL');
35701
+ re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g');
35702
+
35703
+ // Tilde ranges.
35704
+ // Meaning is "reasonably at or greater than"
35705
+ tok('LONETILDE');
35706
+ src[t.LONETILDE] = '(?:~>?)';
35707
+ tok('TILDETRIM');
35708
+ src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+';
35709
+ re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g');
35710
+ var tildeTrimReplace = '$1~';
35711
+ tok('TILDE');
35712
+ src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$';
35713
+ tok('TILDELOOSE');
35714
+ src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$';
35715
+
35716
+ // Caret ranges.
35717
+ // Meaning is "at least and backwards compatible with"
35718
+ tok('LONECARET');
35719
+ src[t.LONECARET] = '(?:\\^)';
35720
+ tok('CARETTRIM');
35721
+ src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+';
35722
+ re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g');
35723
+ var caretTrimReplace = '$1^';
35724
+ tok('CARET');
35725
+ src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$';
35726
+ tok('CARETLOOSE');
35727
+ src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$';
35728
+
35729
+ // A simple gt/lt/eq thing, or just "" to indicate "any version"
35730
+ tok('COMPARATORLOOSE');
35731
+ src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$';
35732
+ tok('COMPARATOR');
35733
+ src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$';
35734
+
35735
+ // An expression to strip any whitespace between the gtlt and the thing
35736
+ // it modifies, so that `> 1.2.3` ==> `>1.2.3`
35737
+ tok('COMPARATORTRIM');
35738
+ src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')';
35739
+
35740
+ // this one has to use the /g flag
35741
+ re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g');
35742
+ var comparatorTrimReplace = '$1$2$3';
35743
+
35744
+ // Something like `1.2.3 - 1.2.4`
35745
+ // Note that these all use the loose form, because they'll be
35746
+ // checked against either the strict or loose comparator form
35747
+ // later.
35748
+ tok('HYPHENRANGE');
35749
+ src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAIN] + ')' + '\\s*$';
35750
+ tok('HYPHENRANGELOOSE');
35751
+ src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s*$';
35752
+
35753
+ // Star ranges basically just allow anything at all.
35754
+ tok('STAR');
35755
+ src[t.STAR] = '(<|>)?=?\\s*\\*';
35756
+
35757
+ // Compile to actual regexp objects.
35758
+ // All are flag-free, unless they were created above with a flag.
35759
+ for (var i = 0; i < R; i++) {
35760
+ debug(i, src[i]);
35761
+ if (!re[i]) {
35762
+ re[i] = new RegExp(src[i]);
35763
+ }
35764
+ }
35765
+ exports.parse = parse;
35766
+ function parse(version, options) {
35767
+ if (!options || typeof options !== 'object') {
35768
+ options = {
35769
+ loose: !!options,
35770
+ includePrerelease: false
35771
+ };
35772
+ }
35773
+ if (version instanceof SemVer) {
35774
+ return version;
35775
+ }
35776
+ if (typeof version !== 'string') {
35777
+ return null;
35778
+ }
35779
+ if (version.length > MAX_LENGTH) {
35780
+ return null;
35781
+ }
35782
+ var r = options.loose ? re[t.LOOSE] : re[t.FULL];
35783
+ if (!r.test(version)) {
35784
+ return null;
35785
+ }
35786
+ try {
35787
+ return new SemVer(version, options);
35788
+ } catch (er) {
35789
+ return null;
35790
+ }
35791
+ }
35792
+ exports.valid = valid;
35793
+ function valid(version, options) {
35794
+ var v = parse(version, options);
35795
+ return v ? v.version : null;
35796
+ }
35797
+ exports.clean = clean;
35798
+ function clean(version, options) {
35799
+ var s = parse(version.trim().replace(/^[=v]+/, ''), options);
35800
+ return s ? s.version : null;
35801
+ }
35802
+ exports.SemVer = SemVer;
35803
+ function SemVer(version, options) {
35804
+ if (!options || typeof options !== 'object') {
35805
+ options = {
35806
+ loose: !!options,
35807
+ includePrerelease: false
35808
+ };
35809
+ }
35810
+ if (version instanceof SemVer) {
35811
+ if (version.loose === options.loose) {
35812
+ return version;
35813
+ } else {
35814
+ version = version.version;
35815
+ }
35816
+ } else if (typeof version !== 'string') {
35817
+ throw new TypeError('Invalid Version: ' + version);
35818
+ }
35819
+ if (version.length > MAX_LENGTH) {
35820
+ throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters');
35821
+ }
35822
+ if (!(this instanceof SemVer)) {
35823
+ return new SemVer(version, options);
35824
+ }
35825
+ debug('SemVer', version, options);
35826
+ this.options = options;
35827
+ this.loose = !!options.loose;
35828
+ var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
35829
+ if (!m) {
35830
+ throw new TypeError('Invalid Version: ' + version);
35831
+ }
35832
+ this.raw = version;
36482
35833
 
36483
- exports.minSatisfying = minSatisfying;
36484
- function minSatisfying (versions, range, options) {
36485
- var min = null;
36486
- var minSV = null;
36487
- try {
36488
- var rangeObj = new Range(range, options);
36489
- } catch (er) {
36490
- return null
36491
- }
36492
- versions.forEach(function (v) {
36493
- if (rangeObj.test(v)) {
36494
- // satisfies(v, range, options)
36495
- if (!min || minSV.compare(v) === 1) {
36496
- // compare(min, v, true)
36497
- min = v;
36498
- minSV = new SemVer(min, options);
36499
- }
36500
- }
36501
- });
36502
- return min
36503
- }
35834
+ // these are actually numbers
35835
+ this.major = +m[1];
35836
+ this.minor = +m[2];
35837
+ this.patch = +m[3];
35838
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
35839
+ throw new TypeError('Invalid major version');
35840
+ }
35841
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
35842
+ throw new TypeError('Invalid minor version');
35843
+ }
35844
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
35845
+ throw new TypeError('Invalid patch version');
35846
+ }
36504
35847
 
36505
- exports.minVersion = minVersion;
36506
- function minVersion (range, loose) {
36507
- range = new Range(range, loose);
35848
+ // numberify any prerelease numeric ids
35849
+ if (!m[4]) {
35850
+ this.prerelease = [];
35851
+ } else {
35852
+ this.prerelease = m[4].split('.').map(function (id) {
35853
+ if (/^[0-9]+$/.test(id)) {
35854
+ var num = +id;
35855
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
35856
+ return num;
35857
+ }
35858
+ }
35859
+ return id;
35860
+ });
35861
+ }
35862
+ this.build = m[5] ? m[5].split('.') : [];
35863
+ this.format();
35864
+ }
35865
+ SemVer.prototype.format = function () {
35866
+ this.version = this.major + '.' + this.minor + '.' + this.patch;
35867
+ if (this.prerelease.length) {
35868
+ this.version += '-' + this.prerelease.join('.');
35869
+ }
35870
+ return this.version;
35871
+ };
35872
+ SemVer.prototype.toString = function () {
35873
+ return this.version;
35874
+ };
35875
+ SemVer.prototype.compare = function (other) {
35876
+ debug('SemVer.compare', this.version, this.options, other);
35877
+ if (!(other instanceof SemVer)) {
35878
+ other = new SemVer(other, this.options);
35879
+ }
35880
+ return this.compareMain(other) || this.comparePre(other);
35881
+ };
35882
+ SemVer.prototype.compareMain = function (other) {
35883
+ if (!(other instanceof SemVer)) {
35884
+ other = new SemVer(other, this.options);
35885
+ }
35886
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
35887
+ };
35888
+ SemVer.prototype.comparePre = function (other) {
35889
+ if (!(other instanceof SemVer)) {
35890
+ other = new SemVer(other, this.options);
35891
+ }
36508
35892
 
36509
- var minver = new SemVer('0.0.0');
36510
- if (range.test(minver)) {
36511
- return minver
36512
- }
35893
+ // NOT having a prerelease is > having one
35894
+ if (this.prerelease.length && !other.prerelease.length) {
35895
+ return -1;
35896
+ } else if (!this.prerelease.length && other.prerelease.length) {
35897
+ return 1;
35898
+ } else if (!this.prerelease.length && !other.prerelease.length) {
35899
+ return 0;
35900
+ }
35901
+ var i = 0;
35902
+ do {
35903
+ var a = this.prerelease[i];
35904
+ var b = other.prerelease[i];
35905
+ debug('prerelease compare', i, a, b);
35906
+ if (a === undefined && b === undefined) {
35907
+ return 0;
35908
+ } else if (b === undefined) {
35909
+ return 1;
35910
+ } else if (a === undefined) {
35911
+ return -1;
35912
+ } else if (a === b) {
35913
+ continue;
35914
+ } else {
35915
+ return compareIdentifiers(a, b);
35916
+ }
35917
+ } while (++i);
35918
+ };
35919
+ SemVer.prototype.compareBuild = function (other) {
35920
+ if (!(other instanceof SemVer)) {
35921
+ other = new SemVer(other, this.options);
35922
+ }
35923
+ var i = 0;
35924
+ do {
35925
+ var a = this.build[i];
35926
+ var b = other.build[i];
35927
+ debug('prerelease compare', i, a, b);
35928
+ if (a === undefined && b === undefined) {
35929
+ return 0;
35930
+ } else if (b === undefined) {
35931
+ return 1;
35932
+ } else if (a === undefined) {
35933
+ return -1;
35934
+ } else if (a === b) {
35935
+ continue;
35936
+ } else {
35937
+ return compareIdentifiers(a, b);
35938
+ }
35939
+ } while (++i);
35940
+ };
36513
35941
 
36514
- minver = new SemVer('0.0.0-0');
36515
- if (range.test(minver)) {
36516
- return minver
36517
- }
35942
+ // preminor will bump the version up to the next minor release, and immediately
35943
+ // down to pre-release. premajor and prepatch work the same way.
35944
+ SemVer.prototype.inc = function (release, identifier) {
35945
+ switch (release) {
35946
+ case 'premajor':
35947
+ this.prerelease.length = 0;
35948
+ this.patch = 0;
35949
+ this.minor = 0;
35950
+ this.major++;
35951
+ this.inc('pre', identifier);
35952
+ break;
35953
+ case 'preminor':
35954
+ this.prerelease.length = 0;
35955
+ this.patch = 0;
35956
+ this.minor++;
35957
+ this.inc('pre', identifier);
35958
+ break;
35959
+ case 'prepatch':
35960
+ // If this is already a prerelease, it will bump to the next version
35961
+ // drop any prereleases that might already exist, since they are not
35962
+ // relevant at this point.
35963
+ this.prerelease.length = 0;
35964
+ this.inc('patch', identifier);
35965
+ this.inc('pre', identifier);
35966
+ break;
35967
+ // If the input is a non-prerelease version, this acts the same as
35968
+ // prepatch.
35969
+ case 'prerelease':
35970
+ if (this.prerelease.length === 0) {
35971
+ this.inc('patch', identifier);
35972
+ }
35973
+ this.inc('pre', identifier);
35974
+ break;
35975
+ case 'major':
35976
+ // If this is a pre-major version, bump up to the same major version.
35977
+ // Otherwise increment major.
35978
+ // 1.0.0-5 bumps to 1.0.0
35979
+ // 1.1.0 bumps to 2.0.0
35980
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
35981
+ this.major++;
35982
+ }
35983
+ this.minor = 0;
35984
+ this.patch = 0;
35985
+ this.prerelease = [];
35986
+ break;
35987
+ case 'minor':
35988
+ // If this is a pre-minor version, bump up to the same minor version.
35989
+ // Otherwise increment minor.
35990
+ // 1.2.0-5 bumps to 1.2.0
35991
+ // 1.2.1 bumps to 1.3.0
35992
+ if (this.patch !== 0 || this.prerelease.length === 0) {
35993
+ this.minor++;
35994
+ }
35995
+ this.patch = 0;
35996
+ this.prerelease = [];
35997
+ break;
35998
+ case 'patch':
35999
+ // If this is not a pre-release version, it will increment the patch.
36000
+ // If it is a pre-release it will bump up to the same patch version.
36001
+ // 1.2.0-5 patches to 1.2.0
36002
+ // 1.2.0 patches to 1.2.1
36003
+ if (this.prerelease.length === 0) {
36004
+ this.patch++;
36005
+ }
36006
+ this.prerelease = [];
36007
+ break;
36008
+ // This probably shouldn't be used publicly.
36009
+ // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
36010
+ case 'pre':
36011
+ if (this.prerelease.length === 0) {
36012
+ this.prerelease = [0];
36013
+ } else {
36014
+ var i = this.prerelease.length;
36015
+ while (--i >= 0) {
36016
+ if (typeof this.prerelease[i] === 'number') {
36017
+ this.prerelease[i]++;
36018
+ i = -2;
36019
+ }
36020
+ }
36021
+ if (i === -1) {
36022
+ // didn't increment anything
36023
+ this.prerelease.push(0);
36024
+ }
36025
+ }
36026
+ if (identifier) {
36027
+ // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
36028
+ // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
36029
+ if (this.prerelease[0] === identifier) {
36030
+ if (isNaN(this.prerelease[1])) {
36031
+ this.prerelease = [identifier, 0];
36032
+ }
36033
+ } else {
36034
+ this.prerelease = [identifier, 0];
36035
+ }
36036
+ }
36037
+ break;
36038
+ default:
36039
+ throw new Error('invalid increment argument: ' + release);
36040
+ }
36041
+ this.format();
36042
+ this.raw = this.version;
36043
+ return this;
36044
+ };
36045
+ exports.inc = inc;
36046
+ function inc(version, release, loose, identifier) {
36047
+ if (typeof loose === 'string') {
36048
+ identifier = loose;
36049
+ loose = undefined;
36050
+ }
36051
+ try {
36052
+ return new SemVer(version, loose).inc(release, identifier).version;
36053
+ } catch (er) {
36054
+ return null;
36055
+ }
36056
+ }
36057
+ exports.diff = diff;
36058
+ function diff(version1, version2) {
36059
+ if (eq(version1, version2)) {
36060
+ return null;
36061
+ } else {
36062
+ var v1 = parse(version1);
36063
+ var v2 = parse(version2);
36064
+ var prefix = '';
36065
+ if (v1.prerelease.length || v2.prerelease.length) {
36066
+ prefix = 'pre';
36067
+ var defaultResult = 'prerelease';
36068
+ }
36069
+ for (var key in v1) {
36070
+ if (key === 'major' || key === 'minor' || key === 'patch') {
36071
+ if (v1[key] !== v2[key]) {
36072
+ return prefix + key;
36073
+ }
36074
+ }
36075
+ }
36076
+ return defaultResult; // may be undefined
36077
+ }
36078
+ }
36518
36079
 
36519
- minver = null;
36520
- for (var i = 0; i < range.set.length; ++i) {
36521
- var comparators = range.set[i];
36522
-
36523
- comparators.forEach(function (comparator) {
36524
- // Clone to avoid manipulating the comparator's semver object.
36525
- var compver = new SemVer(comparator.semver.version);
36526
- switch (comparator.operator) {
36527
- case '>':
36528
- if (compver.prerelease.length === 0) {
36529
- compver.patch++;
36530
- } else {
36531
- compver.prerelease.push(0);
36532
- }
36533
- compver.raw = compver.format();
36534
- /* fallthrough */
36535
- case '':
36536
- case '>=':
36537
- if (!minver || gt(minver, compver)) {
36538
- minver = compver;
36539
- }
36540
- break
36541
- case '<':
36542
- case '<=':
36543
- /* Ignore maximum versions */
36544
- break
36545
- /* istanbul ignore next */
36546
- default:
36547
- throw new Error('Unexpected operation: ' + comparator.operator)
36548
- }
36549
- });
36550
- }
36080
+ exports.compareIdentifiers = compareIdentifiers;
36081
+ var numeric = /^[0-9]+$/;
36082
+ function compareIdentifiers(a, b) {
36083
+ var anum = numeric.test(a);
36084
+ var bnum = numeric.test(b);
36085
+ if (anum && bnum) {
36086
+ a = +a;
36087
+ b = +b;
36088
+ }
36089
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
36090
+ }
36091
+ exports.rcompareIdentifiers = rcompareIdentifiers;
36092
+ function rcompareIdentifiers(a, b) {
36093
+ return compareIdentifiers(b, a);
36094
+ }
36095
+ exports.major = major;
36096
+ function major(a, loose) {
36097
+ return new SemVer(a, loose).major;
36098
+ }
36099
+ exports.minor = minor;
36100
+ function minor(a, loose) {
36101
+ return new SemVer(a, loose).minor;
36102
+ }
36103
+ exports.patch = patch;
36104
+ function patch(a, loose) {
36105
+ return new SemVer(a, loose).patch;
36106
+ }
36107
+ exports.compare = compare;
36108
+ function compare(a, b, loose) {
36109
+ return new SemVer(a, loose).compare(new SemVer(b, loose));
36110
+ }
36111
+ exports.compareLoose = compareLoose;
36112
+ function compareLoose(a, b) {
36113
+ return compare(a, b, true);
36114
+ }
36115
+ exports.compareBuild = compareBuild;
36116
+ function compareBuild(a, b, loose) {
36117
+ var versionA = new SemVer(a, loose);
36118
+ var versionB = new SemVer(b, loose);
36119
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
36120
+ }
36121
+ exports.rcompare = rcompare;
36122
+ function rcompare(a, b, loose) {
36123
+ return compare(b, a, loose);
36124
+ }
36125
+ exports.sort = sort;
36126
+ function sort(list, loose) {
36127
+ return list.sort(function (a, b) {
36128
+ return exports.compareBuild(a, b, loose);
36129
+ });
36130
+ }
36131
+ exports.rsort = rsort;
36132
+ function rsort(list, loose) {
36133
+ return list.sort(function (a, b) {
36134
+ return exports.compareBuild(b, a, loose);
36135
+ });
36136
+ }
36137
+ exports.gt = gt;
36138
+ function gt(a, b, loose) {
36139
+ return compare(a, b, loose) > 0;
36140
+ }
36141
+ exports.lt = lt;
36142
+ function lt(a, b, loose) {
36143
+ return compare(a, b, loose) < 0;
36144
+ }
36145
+ exports.eq = eq;
36146
+ function eq(a, b, loose) {
36147
+ return compare(a, b, loose) === 0;
36148
+ }
36149
+ exports.neq = neq;
36150
+ function neq(a, b, loose) {
36151
+ return compare(a, b, loose) !== 0;
36152
+ }
36153
+ exports.gte = gte;
36154
+ function gte(a, b, loose) {
36155
+ return compare(a, b, loose) >= 0;
36156
+ }
36157
+ exports.lte = lte;
36158
+ function lte(a, b, loose) {
36159
+ return compare(a, b, loose) <= 0;
36160
+ }
36161
+ exports.cmp = cmp;
36162
+ function cmp(a, op, b, loose) {
36163
+ switch (op) {
36164
+ case '===':
36165
+ if (typeof a === 'object') a = a.version;
36166
+ if (typeof b === 'object') b = b.version;
36167
+ return a === b;
36168
+ case '!==':
36169
+ if (typeof a === 'object') a = a.version;
36170
+ if (typeof b === 'object') b = b.version;
36171
+ return a !== b;
36172
+ case '':
36173
+ case '=':
36174
+ case '==':
36175
+ return eq(a, b, loose);
36176
+ case '!=':
36177
+ return neq(a, b, loose);
36178
+ case '>':
36179
+ return gt(a, b, loose);
36180
+ case '>=':
36181
+ return gte(a, b, loose);
36182
+ case '<':
36183
+ return lt(a, b, loose);
36184
+ case '<=':
36185
+ return lte(a, b, loose);
36186
+ default:
36187
+ throw new TypeError('Invalid operator: ' + op);
36188
+ }
36189
+ }
36190
+ exports.Comparator = Comparator;
36191
+ function Comparator(comp, options) {
36192
+ if (!options || typeof options !== 'object') {
36193
+ options = {
36194
+ loose: !!options,
36195
+ includePrerelease: false
36196
+ };
36197
+ }
36198
+ if (comp instanceof Comparator) {
36199
+ if (comp.loose === !!options.loose) {
36200
+ return comp;
36201
+ } else {
36202
+ comp = comp.value;
36203
+ }
36204
+ }
36205
+ if (!(this instanceof Comparator)) {
36206
+ return new Comparator(comp, options);
36207
+ }
36208
+ debug('comparator', comp, options);
36209
+ this.options = options;
36210
+ this.loose = !!options.loose;
36211
+ this.parse(comp);
36212
+ if (this.semver === ANY) {
36213
+ this.value = '';
36214
+ } else {
36215
+ this.value = this.operator + this.semver.version;
36216
+ }
36217
+ debug('comp', this);
36218
+ }
36219
+ var ANY = {};
36220
+ Comparator.prototype.parse = function (comp) {
36221
+ var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
36222
+ var m = comp.match(r);
36223
+ if (!m) {
36224
+ throw new TypeError('Invalid comparator: ' + comp);
36225
+ }
36226
+ this.operator = m[1] !== undefined ? m[1] : '';
36227
+ if (this.operator === '=') {
36228
+ this.operator = '';
36229
+ }
36551
36230
 
36552
- if (minver && range.test(minver)) {
36553
- return minver
36554
- }
36231
+ // if it literally is just '>' or '' then allow anything.
36232
+ if (!m[2]) {
36233
+ this.semver = ANY;
36234
+ } else {
36235
+ this.semver = new SemVer(m[2], this.options.loose);
36236
+ }
36237
+ };
36238
+ Comparator.prototype.toString = function () {
36239
+ return this.value;
36240
+ };
36241
+ Comparator.prototype.test = function (version) {
36242
+ debug('Comparator.test', version, this.options.loose);
36243
+ if (this.semver === ANY || version === ANY) {
36244
+ return true;
36245
+ }
36246
+ if (typeof version === 'string') {
36247
+ try {
36248
+ version = new SemVer(version, this.options);
36249
+ } catch (er) {
36250
+ return false;
36251
+ }
36252
+ }
36253
+ return cmp(version, this.operator, this.semver, this.options);
36254
+ };
36255
+ Comparator.prototype.intersects = function (comp, options) {
36256
+ if (!(comp instanceof Comparator)) {
36257
+ throw new TypeError('a Comparator is required');
36258
+ }
36259
+ if (!options || typeof options !== 'object') {
36260
+ options = {
36261
+ loose: !!options,
36262
+ includePrerelease: false
36263
+ };
36264
+ }
36265
+ var rangeTmp;
36266
+ if (this.operator === '') {
36267
+ if (this.value === '') {
36268
+ return true;
36269
+ }
36270
+ rangeTmp = new Range(comp.value, options);
36271
+ return satisfies(this.value, rangeTmp, options);
36272
+ } else if (comp.operator === '') {
36273
+ if (comp.value === '') {
36274
+ return true;
36275
+ }
36276
+ rangeTmp = new Range(this.value, options);
36277
+ return satisfies(comp.semver, rangeTmp, options);
36278
+ }
36279
+ var sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>');
36280
+ var sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<');
36281
+ var sameSemVer = this.semver.version === comp.semver.version;
36282
+ var differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<=');
36283
+ var oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && (this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<');
36284
+ var oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && (this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>');
36285
+ return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
36286
+ };
36287
+ exports.Range = Range;
36288
+ function Range(range, options) {
36289
+ if (!options || typeof options !== 'object') {
36290
+ options = {
36291
+ loose: !!options,
36292
+ includePrerelease: false
36293
+ };
36294
+ }
36295
+ if (range instanceof Range) {
36296
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
36297
+ return range;
36298
+ } else {
36299
+ return new Range(range.raw, options);
36300
+ }
36301
+ }
36302
+ if (range instanceof Comparator) {
36303
+ return new Range(range.value, options);
36304
+ }
36305
+ if (!(this instanceof Range)) {
36306
+ return new Range(range, options);
36307
+ }
36308
+ this.options = options;
36309
+ this.loose = !!options.loose;
36310
+ this.includePrerelease = !!options.includePrerelease;
36555
36311
 
36556
- return null
36557
- }
36312
+ // First, split based on boolean or ||
36313
+ this.raw = range;
36314
+ this.set = range.split(/\s*\|\|\s*/).map(function (range) {
36315
+ return this.parseRange(range.trim());
36316
+ }, this).filter(function (c) {
36317
+ // throw out any that are not relevant for whatever reason
36318
+ return c.length;
36319
+ });
36320
+ if (!this.set.length) {
36321
+ throw new TypeError('Invalid SemVer Range: ' + range);
36322
+ }
36323
+ this.format();
36324
+ }
36325
+ Range.prototype.format = function () {
36326
+ this.range = this.set.map(function (comps) {
36327
+ return comps.join(' ').trim();
36328
+ }).join('||').trim();
36329
+ return this.range;
36330
+ };
36331
+ Range.prototype.toString = function () {
36332
+ return this.range;
36333
+ };
36334
+ Range.prototype.parseRange = function (range) {
36335
+ var loose = this.options.loose;
36336
+ range = range.trim();
36337
+ // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
36338
+ var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
36339
+ range = range.replace(hr, hyphenReplace);
36340
+ debug('hyphen replace', range);
36341
+ // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
36342
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
36343
+ debug('comparator trim', range, re[t.COMPARATORTRIM]);
36344
+
36345
+ // `~ 1.2.3` => `~1.2.3`
36346
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
36347
+
36348
+ // `^ 1.2.3` => `^1.2.3`
36349
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
36350
+
36351
+ // normalize spaces
36352
+ range = range.split(/\s+/).join(' ');
36353
+
36354
+ // At this point, the range is completely trimmed and
36355
+ // ready to be split into comparators.
36356
+
36357
+ var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
36358
+ var set = range.split(' ').map(function (comp) {
36359
+ return parseComparator(comp, this.options);
36360
+ }, this).join(' ').split(/\s+/);
36361
+ if (this.options.loose) {
36362
+ // in loose mode, throw out any that are not valid comparators
36363
+ set = set.filter(function (comp) {
36364
+ return !!comp.match(compRe);
36365
+ });
36366
+ }
36367
+ set = set.map(function (comp) {
36368
+ return new Comparator(comp, this.options);
36369
+ }, this);
36370
+ return set;
36371
+ };
36372
+ Range.prototype.intersects = function (range, options) {
36373
+ if (!(range instanceof Range)) {
36374
+ throw new TypeError('a Range is required');
36375
+ }
36376
+ return this.set.some(function (thisComparators) {
36377
+ return isSatisfiable(thisComparators, options) && range.set.some(function (rangeComparators) {
36378
+ return isSatisfiable(rangeComparators, options) && thisComparators.every(function (thisComparator) {
36379
+ return rangeComparators.every(function (rangeComparator) {
36380
+ return thisComparator.intersects(rangeComparator, options);
36381
+ });
36382
+ });
36383
+ });
36384
+ });
36385
+ };
36558
36386
 
36559
- exports.validRange = validRange;
36560
- function validRange (range, options) {
36561
- try {
36562
- // Return '*' instead of '' so that truthiness works.
36563
- // This will throw if it's invalid anyway
36564
- return new Range(range, options).range || '*'
36565
- } catch (er) {
36566
- return null
36567
- }
36568
- }
36387
+ // take a set of comparators and determine whether there
36388
+ // exists a version which can satisfy it
36389
+ function isSatisfiable(comparators, options) {
36390
+ var result = true;
36391
+ var remainingComparators = comparators.slice();
36392
+ var testComparator = remainingComparators.pop();
36393
+ while (result && remainingComparators.length) {
36394
+ result = remainingComparators.every(function (otherComparator) {
36395
+ return testComparator.intersects(otherComparator, options);
36396
+ });
36397
+ testComparator = remainingComparators.pop();
36398
+ }
36399
+ return result;
36400
+ }
36569
36401
 
36570
- // Determine if version is less than all the versions possible in the range
36571
- exports.ltr = ltr;
36572
- function ltr (version, range, options) {
36573
- return outside(version, range, '<', options)
36574
- }
36402
+ // Mostly just for testing and legacy API reasons
36403
+ exports.toComparators = toComparators;
36404
+ function toComparators(range, options) {
36405
+ return new Range(range, options).set.map(function (comp) {
36406
+ return comp.map(function (c) {
36407
+ return c.value;
36408
+ }).join(' ').trim().split(' ');
36409
+ });
36410
+ }
36575
36411
 
36576
- // Determine if version is greater than all the versions possible in the range.
36577
- exports.gtr = gtr;
36578
- function gtr (version, range, options) {
36579
- return outside(version, range, '>', options)
36580
- }
36412
+ // comprised of xranges, tildes, stars, and gtlt's at this point.
36413
+ // already replaced the hyphen ranges
36414
+ // turn into a set of JUST comparators.
36415
+ function parseComparator(comp, options) {
36416
+ debug('comp', comp, options);
36417
+ comp = replaceCarets(comp, options);
36418
+ debug('caret', comp);
36419
+ comp = replaceTildes(comp, options);
36420
+ debug('tildes', comp);
36421
+ comp = replaceXRanges(comp, options);
36422
+ debug('xrange', comp);
36423
+ comp = replaceStars(comp, options);
36424
+ debug('stars', comp);
36425
+ return comp;
36426
+ }
36427
+ function isX(id) {
36428
+ return !id || id.toLowerCase() === 'x' || id === '*';
36429
+ }
36430
+
36431
+ // ~, ~> --> * (any, kinda silly)
36432
+ // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
36433
+ // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
36434
+ // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
36435
+ // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
36436
+ // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
36437
+ function replaceTildes(comp, options) {
36438
+ return comp.trim().split(/\s+/).map(function (comp) {
36439
+ return replaceTilde(comp, options);
36440
+ }).join(' ');
36441
+ }
36442
+ function replaceTilde(comp, options) {
36443
+ var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
36444
+ return comp.replace(r, function (_, M, m, p, pr) {
36445
+ debug('tilde', comp, _, M, m, p, pr);
36446
+ var ret;
36447
+ if (isX(M)) {
36448
+ ret = '';
36449
+ } else if (isX(m)) {
36450
+ ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
36451
+ } else if (isX(p)) {
36452
+ // ~1.2 == >=1.2.0 <1.3.0
36453
+ ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
36454
+ } else if (pr) {
36455
+ debug('replaceTilde pr', pr);
36456
+ ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
36457
+ } else {
36458
+ // ~1.2.3 == >=1.2.3 <1.3.0
36459
+ ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
36460
+ }
36461
+ debug('tilde return', ret);
36462
+ return ret;
36463
+ });
36464
+ }
36581
36465
 
36582
- exports.outside = outside;
36583
- function outside (version, range, hilo, options) {
36584
- version = new SemVer(version, options);
36585
- range = new Range(range, options);
36586
-
36587
- var gtfn, ltefn, ltfn, comp, ecomp;
36588
- switch (hilo) {
36589
- case '>':
36590
- gtfn = gt;
36591
- ltefn = lte;
36592
- ltfn = lt;
36593
- comp = '>';
36594
- ecomp = '>=';
36595
- break
36596
- case '<':
36597
- gtfn = lt;
36598
- ltefn = gte;
36599
- ltfn = gt;
36600
- comp = '<';
36601
- ecomp = '<=';
36602
- break
36603
- default:
36604
- throw new TypeError('Must provide a hilo val of "<" or ">"')
36605
- }
36466
+ // ^ --> * (any, kinda silly)
36467
+ // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
36468
+ // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
36469
+ // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
36470
+ // ^1.2.3 --> >=1.2.3 <2.0.0
36471
+ // ^1.2.0 --> >=1.2.0 <2.0.0
36472
+ function replaceCarets(comp, options) {
36473
+ return comp.trim().split(/\s+/).map(function (comp) {
36474
+ return replaceCaret(comp, options);
36475
+ }).join(' ');
36476
+ }
36477
+ function replaceCaret(comp, options) {
36478
+ debug('caret', comp, options);
36479
+ var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
36480
+ return comp.replace(r, function (_, M, m, p, pr) {
36481
+ debug('caret', comp, _, M, m, p, pr);
36482
+ var ret;
36483
+ if (isX(M)) {
36484
+ ret = '';
36485
+ } else if (isX(m)) {
36486
+ ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
36487
+ } else if (isX(p)) {
36488
+ if (M === '0') {
36489
+ ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
36490
+ } else {
36491
+ ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0';
36492
+ }
36493
+ } else if (pr) {
36494
+ debug('replaceCaret pr', pr);
36495
+ if (M === '0') {
36496
+ if (m === '0') {
36497
+ ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + m + '.' + (+p + 1);
36498
+ } else {
36499
+ ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
36500
+ }
36501
+ } else {
36502
+ ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + (+M + 1) + '.0.0';
36503
+ }
36504
+ } else {
36505
+ debug('no pr');
36506
+ if (M === '0') {
36507
+ if (m === '0') {
36508
+ ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + m + '.' + (+p + 1);
36509
+ } else {
36510
+ ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
36511
+ }
36512
+ } else {
36513
+ ret = '>=' + M + '.' + m + '.' + p + ' <' + (+M + 1) + '.0.0';
36514
+ }
36515
+ }
36516
+ debug('caret return', ret);
36517
+ return ret;
36518
+ });
36519
+ }
36520
+ function replaceXRanges(comp, options) {
36521
+ debug('replaceXRanges', comp, options);
36522
+ return comp.split(/\s+/).map(function (comp) {
36523
+ return replaceXRange(comp, options);
36524
+ }).join(' ');
36525
+ }
36526
+ function replaceXRange(comp, options) {
36527
+ comp = comp.trim();
36528
+ var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
36529
+ return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
36530
+ debug('xRange', comp, ret, gtlt, M, m, p, pr);
36531
+ var xM = isX(M);
36532
+ var xm = xM || isX(m);
36533
+ var xp = xm || isX(p);
36534
+ var anyX = xp;
36535
+ if (gtlt === '=' && anyX) {
36536
+ gtlt = '';
36537
+ }
36538
+
36539
+ // if we're including prereleases in the match, then we need
36540
+ // to fix this to -0, the lowest possible prerelease value
36541
+ pr = options.includePrerelease ? '-0' : '';
36542
+ if (xM) {
36543
+ if (gtlt === '>' || gtlt === '<') {
36544
+ // nothing is allowed
36545
+ ret = '<0.0.0-0';
36546
+ } else {
36547
+ // nothing is forbidden
36548
+ ret = '*';
36549
+ }
36550
+ } else if (gtlt && anyX) {
36551
+ // we know patch is an x, because we have any x at all.
36552
+ // replace X with 0
36553
+ if (xm) {
36554
+ m = 0;
36555
+ }
36556
+ p = 0;
36557
+ if (gtlt === '>') {
36558
+ // >1 => >=2.0.0
36559
+ // >1.2 => >=1.3.0
36560
+ // >1.2.3 => >= 1.2.4
36561
+ gtlt = '>=';
36562
+ if (xm) {
36563
+ M = +M + 1;
36564
+ m = 0;
36565
+ p = 0;
36566
+ } else {
36567
+ m = +m + 1;
36568
+ p = 0;
36569
+ }
36570
+ } else if (gtlt === '<=') {
36571
+ // <=0.7.x is actually <0.8.0, since any 0.7.x should
36572
+ // pass. Similarly, <=7.x is actually <8.0.0, etc.
36573
+ gtlt = '<';
36574
+ if (xm) {
36575
+ M = +M + 1;
36576
+ } else {
36577
+ m = +m + 1;
36578
+ }
36579
+ }
36580
+ ret = gtlt + M + '.' + m + '.' + p + pr;
36581
+ } else if (xm) {
36582
+ ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr;
36583
+ } else if (xp) {
36584
+ ret = '>=' + M + '.' + m + '.0' + pr + ' <' + M + '.' + (+m + 1) + '.0' + pr;
36585
+ }
36586
+ debug('xRange return', ret);
36587
+ return ret;
36588
+ });
36589
+ }
36606
36590
 
36607
- // If it satisifes the range it is not outside
36608
- if (satisfies(version, range, options)) {
36609
- return false
36610
- }
36591
+ // Because * is AND-ed with everything else in the comparator,
36592
+ // and '' means "any version", just remove the *s entirely.
36593
+ function replaceStars(comp, options) {
36594
+ debug('replaceStars', comp, options);
36595
+ // Looseness is ignored here. star is always as loose as it gets!
36596
+ return comp.trim().replace(re[t.STAR], '');
36597
+ }
36598
+
36599
+ // This function is passed to string.replace(re[t.HYPHENRANGE])
36600
+ // M, m, patch, prerelease, build
36601
+ // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
36602
+ // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
36603
+ // 1.2 - 3.4 => >=1.2.0 <3.5.0
36604
+ function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) {
36605
+ if (isX(fM)) {
36606
+ from = '';
36607
+ } else if (isX(fm)) {
36608
+ from = '>=' + fM + '.0.0';
36609
+ } else if (isX(fp)) {
36610
+ from = '>=' + fM + '.' + fm + '.0';
36611
+ } else {
36612
+ from = '>=' + from;
36613
+ }
36614
+ if (isX(tM)) {
36615
+ to = '';
36616
+ } else if (isX(tm)) {
36617
+ to = '<' + (+tM + 1) + '.0.0';
36618
+ } else if (isX(tp)) {
36619
+ to = '<' + tM + '.' + (+tm + 1) + '.0';
36620
+ } else if (tpr) {
36621
+ to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
36622
+ } else {
36623
+ to = '<=' + to;
36624
+ }
36625
+ return (from + ' ' + to).trim();
36626
+ }
36611
36627
 
36612
- // From now on, variable terms are as if we're in "gtr" mode.
36613
- // but note that everything is flipped for the "ltr" function.
36614
-
36615
- for (var i = 0; i < range.set.length; ++i) {
36616
- var comparators = range.set[i];
36617
-
36618
- var high = null;
36619
- var low = null;
36620
-
36621
- comparators.forEach(function (comparator) {
36622
- if (comparator.semver === ANY) {
36623
- comparator = new Comparator('>=0.0.0');
36624
- }
36625
- high = high || comparator;
36626
- low = low || comparator;
36627
- if (gtfn(comparator.semver, high.semver, options)) {
36628
- high = comparator;
36629
- } else if (ltfn(comparator.semver, low.semver, options)) {
36630
- low = comparator;
36631
- }
36632
- });
36633
-
36634
- // If the edge version comparator has a operator then our version
36635
- // isn't outside it
36636
- if (high.operator === comp || high.operator === ecomp) {
36637
- return false
36638
- }
36639
-
36640
- // If the lowest version comparator has an operator and our version
36641
- // is less than it then it isn't higher than the range
36642
- if ((!low.operator || low.operator === comp) &&
36643
- ltefn(version, low.semver)) {
36644
- return false
36645
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
36646
- return false
36647
- }
36648
- }
36649
- return true
36650
- }
36628
+ // if ANY of the sets match ALL of its comparators, then pass
36629
+ Range.prototype.test = function (version) {
36630
+ if (!version) {
36631
+ return false;
36632
+ }
36633
+ if (typeof version === 'string') {
36634
+ try {
36635
+ version = new SemVer(version, this.options);
36636
+ } catch (er) {
36637
+ return false;
36638
+ }
36639
+ }
36640
+ for (var i = 0; i < this.set.length; i++) {
36641
+ if (testSet(this.set[i], version, this.options)) {
36642
+ return true;
36643
+ }
36644
+ }
36645
+ return false;
36646
+ };
36647
+ function testSet(set, version, options) {
36648
+ for (var i = 0; i < set.length; i++) {
36649
+ if (!set[i].test(version)) {
36650
+ return false;
36651
+ }
36652
+ }
36653
+ if (version.prerelease.length && !options.includePrerelease) {
36654
+ // Find the set of versions that are allowed to have prereleases
36655
+ // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
36656
+ // That should allow `1.2.3-pr.2` to pass.
36657
+ // However, `1.2.4-alpha.notready` should NOT be allowed,
36658
+ // even though it's within the range set by the comparators.
36659
+ for (i = 0; i < set.length; i++) {
36660
+ debug(set[i].semver);
36661
+ if (set[i].semver === ANY) {
36662
+ continue;
36663
+ }
36664
+ if (set[i].semver.prerelease.length > 0) {
36665
+ var allowed = set[i].semver;
36666
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
36667
+ return true;
36668
+ }
36669
+ }
36670
+ }
36651
36671
 
36652
- exports.prerelease = prerelease;
36653
- function prerelease (version, options) {
36654
- var parsed = parse(version, options);
36655
- return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
36656
- }
36672
+ // Version has a -pre, but it's not one of the ones we like.
36673
+ return false;
36674
+ }
36675
+ return true;
36676
+ }
36677
+ exports.satisfies = satisfies;
36678
+ function satisfies(version, range, options) {
36679
+ try {
36680
+ range = new Range(range, options);
36681
+ } catch (er) {
36682
+ return false;
36683
+ }
36684
+ return range.test(version);
36685
+ }
36686
+ exports.maxSatisfying = maxSatisfying;
36687
+ function maxSatisfying(versions, range, options) {
36688
+ var max = null;
36689
+ var maxSV = null;
36690
+ try {
36691
+ var rangeObj = new Range(range, options);
36692
+ } catch (er) {
36693
+ return null;
36694
+ }
36695
+ versions.forEach(function (v) {
36696
+ if (rangeObj.test(v)) {
36697
+ // satisfies(v, range, options)
36698
+ if (!max || maxSV.compare(v) === -1) {
36699
+ // compare(max, v, true)
36700
+ max = v;
36701
+ maxSV = new SemVer(max, options);
36702
+ }
36703
+ }
36704
+ });
36705
+ return max;
36706
+ }
36707
+ exports.minSatisfying = minSatisfying;
36708
+ function minSatisfying(versions, range, options) {
36709
+ var min = null;
36710
+ var minSV = null;
36711
+ try {
36712
+ var rangeObj = new Range(range, options);
36713
+ } catch (er) {
36714
+ return null;
36715
+ }
36716
+ versions.forEach(function (v) {
36717
+ if (rangeObj.test(v)) {
36718
+ // satisfies(v, range, options)
36719
+ if (!min || minSV.compare(v) === 1) {
36720
+ // compare(min, v, true)
36721
+ min = v;
36722
+ minSV = new SemVer(min, options);
36723
+ }
36724
+ }
36725
+ });
36726
+ return min;
36727
+ }
36728
+ exports.minVersion = minVersion;
36729
+ function minVersion(range, loose) {
36730
+ range = new Range(range, loose);
36731
+ var minver = new SemVer('0.0.0');
36732
+ if (range.test(minver)) {
36733
+ return minver;
36734
+ }
36735
+ minver = new SemVer('0.0.0-0');
36736
+ if (range.test(minver)) {
36737
+ return minver;
36738
+ }
36739
+ minver = null;
36740
+ for (var i = 0; i < range.set.length; ++i) {
36741
+ var comparators = range.set[i];
36742
+ comparators.forEach(function (comparator) {
36743
+ // Clone to avoid manipulating the comparator's semver object.
36744
+ var compver = new SemVer(comparator.semver.version);
36745
+ switch (comparator.operator) {
36746
+ case '>':
36747
+ if (compver.prerelease.length === 0) {
36748
+ compver.patch++;
36749
+ } else {
36750
+ compver.prerelease.push(0);
36751
+ }
36752
+ compver.raw = compver.format();
36753
+ /* fallthrough */
36754
+ case '':
36755
+ case '>=':
36756
+ if (!minver || gt(minver, compver)) {
36757
+ minver = compver;
36758
+ }
36759
+ break;
36760
+ case '<':
36761
+ case '<=':
36762
+ /* Ignore maximum versions */
36763
+ break;
36764
+ /* istanbul ignore next */
36765
+ default:
36766
+ throw new Error('Unexpected operation: ' + comparator.operator);
36767
+ }
36768
+ });
36769
+ }
36770
+ if (minver && range.test(minver)) {
36771
+ return minver;
36772
+ }
36773
+ return null;
36774
+ }
36775
+ exports.validRange = validRange;
36776
+ function validRange(range, options) {
36777
+ try {
36778
+ // Return '*' instead of '' so that truthiness works.
36779
+ // This will throw if it's invalid anyway
36780
+ return new Range(range, options).range || '*';
36781
+ } catch (er) {
36782
+ return null;
36783
+ }
36784
+ }
36657
36785
 
36658
- exports.intersects = intersects;
36659
- function intersects (r1, r2, options) {
36660
- r1 = new Range(r1, options);
36661
- r2 = new Range(r2, options);
36662
- return r1.intersects(r2)
36663
- }
36786
+ // Determine if version is less than all the versions possible in the range
36787
+ exports.ltr = ltr;
36788
+ function ltr(version, range, options) {
36789
+ return outside(version, range, '<', options);
36790
+ }
36664
36791
 
36665
- exports.coerce = coerce;
36666
- function coerce (version, options) {
36667
- if (version instanceof SemVer) {
36668
- return version
36669
- }
36792
+ // Determine if version is greater than all the versions possible in the range.
36793
+ exports.gtr = gtr;
36794
+ function gtr(version, range, options) {
36795
+ return outside(version, range, '>', options);
36796
+ }
36797
+ exports.outside = outside;
36798
+ function outside(version, range, hilo, options) {
36799
+ version = new SemVer(version, options);
36800
+ range = new Range(range, options);
36801
+ var gtfn, ltefn, ltfn, comp, ecomp;
36802
+ switch (hilo) {
36803
+ case '>':
36804
+ gtfn = gt;
36805
+ ltefn = lte;
36806
+ ltfn = lt;
36807
+ comp = '>';
36808
+ ecomp = '>=';
36809
+ break;
36810
+ case '<':
36811
+ gtfn = lt;
36812
+ ltefn = gte;
36813
+ ltfn = gt;
36814
+ comp = '<';
36815
+ ecomp = '<=';
36816
+ break;
36817
+ default:
36818
+ throw new TypeError('Must provide a hilo val of "<" or ">"');
36819
+ }
36670
36820
 
36671
- if (typeof version === 'number') {
36672
- version = String(version);
36673
- }
36821
+ // If it satisifes the range it is not outside
36822
+ if (satisfies(version, range, options)) {
36823
+ return false;
36824
+ }
36674
36825
 
36675
- if (typeof version !== 'string') {
36676
- return null
36677
- }
36826
+ // From now on, variable terms are as if we're in "gtr" mode.
36827
+ // but note that everything is flipped for the "ltr" function.
36678
36828
 
36679
- options = options || {};
36680
-
36681
- var match = null;
36682
- if (!options.rtl) {
36683
- match = version.match(re[t.COERCE]);
36684
- } else {
36685
- // Find the right-most coercible string that does not share
36686
- // a terminus with a more left-ward coercible string.
36687
- // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
36688
- //
36689
- // Walk through the string checking with a /g regexp
36690
- // Manually set the index so as to pick up overlapping matches.
36691
- // Stop when we get a match that ends at the string end, since no
36692
- // coercible string can be more right-ward without the same terminus.
36693
- var next;
36694
- while ((next = re[t.COERCERTL].exec(version)) &&
36695
- (!match || match.index + match[0].length !== version.length)
36696
- ) {
36697
- if (!match ||
36698
- next.index + next[0].length !== match.index + match[0].length) {
36699
- match = next;
36700
- }
36701
- re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
36702
- }
36703
- // leave it in a clean state
36704
- re[t.COERCERTL].lastIndex = -1;
36705
- }
36829
+ for (var i = 0; i < range.set.length; ++i) {
36830
+ var comparators = range.set[i];
36831
+ var high = null;
36832
+ var low = null;
36833
+ comparators.forEach(function (comparator) {
36834
+ if (comparator.semver === ANY) {
36835
+ comparator = new Comparator('>=0.0.0');
36836
+ }
36837
+ high = high || comparator;
36838
+ low = low || comparator;
36839
+ if (gtfn(comparator.semver, high.semver, options)) {
36840
+ high = comparator;
36841
+ } else if (ltfn(comparator.semver, low.semver, options)) {
36842
+ low = comparator;
36843
+ }
36844
+ });
36706
36845
 
36707
- if (match === null) {
36708
- return null
36709
- }
36846
+ // If the edge version comparator has a operator then our version
36847
+ // isn't outside it
36848
+ if (high.operator === comp || high.operator === ecomp) {
36849
+ return false;
36850
+ }
36710
36851
 
36711
- return parse(match[2] +
36712
- '.' + (match[3] || '0') +
36713
- '.' + (match[4] || '0'), options)
36714
- }
36715
- } (semver, semverExports));
36852
+ // If the lowest version comparator has an operator and our version
36853
+ // is less than it then it isn't higher than the range
36854
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
36855
+ return false;
36856
+ } else if (low.operator === ecomp && ltfn(version, low.semver)) {
36857
+ return false;
36858
+ }
36859
+ }
36860
+ return true;
36861
+ }
36862
+ exports.prerelease = prerelease;
36863
+ function prerelease(version, options) {
36864
+ var parsed = parse(version, options);
36865
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
36866
+ }
36867
+ exports.intersects = intersects;
36868
+ function intersects(r1, r2, options) {
36869
+ r1 = new Range(r1, options);
36870
+ r2 = new Range(r2, options);
36871
+ return r1.intersects(r2);
36872
+ }
36873
+ exports.coerce = coerce;
36874
+ function coerce(version, options) {
36875
+ if (version instanceof SemVer) {
36876
+ return version;
36877
+ }
36878
+ if (typeof version === 'number') {
36879
+ version = String(version);
36880
+ }
36881
+ if (typeof version !== 'string') {
36882
+ return null;
36883
+ }
36884
+ options = options || {};
36885
+ var match = null;
36886
+ if (!options.rtl) {
36887
+ match = version.match(re[t.COERCE]);
36888
+ } else {
36889
+ // Find the right-most coercible string that does not share
36890
+ // a terminus with a more left-ward coercible string.
36891
+ // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
36892
+ //
36893
+ // Walk through the string checking with a /g regexp
36894
+ // Manually set the index so as to pick up overlapping matches.
36895
+ // Stop when we get a match that ends at the string end, since no
36896
+ // coercible string can be more right-ward without the same terminus.
36897
+ var next;
36898
+ while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) {
36899
+ if (!match || next.index + next[0].length !== match.index + match[0].length) {
36900
+ match = next;
36901
+ }
36902
+ re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
36903
+ }
36904
+ // leave it in a clean state
36905
+ re[t.COERCERTL].lastIndex = -1;
36906
+ }
36907
+ if (match === null) {
36908
+ return null;
36909
+ }
36910
+ return parse(match[2] + '.' + (match[3] || '0') + '.' + (match[4] || '0'), options);
36911
+ }
36912
+ })(semver, semverExports);
36716
36913
 
36717
36914
  const LOADED = {};
36718
36915
 
@@ -37136,8 +37333,9 @@
37136
37333
  const api = /** @lends Embed# */{
37137
37334
  /**
37138
37335
  * Renders a visualization or sheet into an HTMLElement.
37336
+ * Visualizations can either be existing objects or created on the fly.
37139
37337
  * Support for sense sheets is experimental.
37140
- * @param {CreateConfig | GetConfig} cfg - The render configuration.
37338
+ * @param {RenderConfig} cfg The render configuration.
37141
37339
  * @returns {Promise<Viz|Sheet>} A controller to the rendered visualization or sheet.
37142
37340
  * @example
37143
37341
  * // render from existing object
@@ -37160,6 +37358,37 @@
37160
37358
  }
37161
37359
  return createSessionObject(cfg, halo);
37162
37360
  },
37361
+ /**
37362
+ * Creates a visualization model
37363
+ * @param {CreateConfig} cfg The create configuration.
37364
+ * @experimental
37365
+ * @returns {Promise<EngineAPI.IGenericObject>} An engima model
37366
+ * @example
37367
+ * // create a barchart in the app and return the model
37368
+ * const model = await n.create({
37369
+ * type: 'barchart',
37370
+ * fields: ['Product', { qLibraryId: 'u378hn', type: 'measure' }],
37371
+ * properties: { showTitle: true }
37372
+ * }
37373
+ * );
37374
+ */
37375
+ create: async cfg => createObject(cfg, halo, false),
37376
+ /**
37377
+ * Generates properties for a visualization object
37378
+ * @param {CreateConfig} cfg The create configuration.
37379
+ * @experimental
37380
+ * @returns {Promise<object>} The objects properties
37381
+ * @example
37382
+ * // generate properties for a barchart
37383
+ * const properties = await n.create({
37384
+ * type: 'barchart',
37385
+ * fields: ['Product', { qLibraryId: 'u378hn', type: 'measure' }],
37386
+ * properties: { showTitle: true }
37387
+ * },
37388
+ * true
37389
+ * );
37390
+ */
37391
+ generateProperties: async cfg => createObject(cfg, halo, true),
37163
37392
  /**
37164
37393
  * Updates the current context of this embed instance.
37165
37394
  * Use this when you want to change some part of the current context, like theme.