@lvce-editor/text-search-worker 3.48.0 → 3.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1747,250 +1747,592 @@ const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
1747
1747
 
1748
1748
  const Button$2 = 1;
1749
1749
 
1750
- const mergeClassNames = (...classNames) => {
1751
- return classNames.filter(Boolean).join(' ');
1752
- };
1753
-
1754
- const Button$1 = 1;
1755
- const Del$1 = 21;
1756
- const Div$1 = 4;
1757
- const H4$1 = 24;
1758
- const Img$1 = 17;
1759
- const Ins$1 = 20;
1760
- const Span$1 = 8;
1761
- const Text$1 = 12;
1762
- const TextArea$1 = 62;
1763
-
1764
- const getIconVirtualDom = (icon, type = Div$1) => {
1765
- return {
1766
- type,
1767
- className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
1768
- role: None$1,
1769
- childCount: 0
1770
- };
1771
- };
1772
-
1773
- const getActionButtonVirtualDom = action => {
1774
- const {
1775
- id,
1776
- icon,
1777
- command
1778
- } = action;
1779
- return [{
1780
- type: Button$1,
1781
- className: IconButton,
1782
- title: id,
1783
- 'data-command': command,
1784
- childCount: 1
1785
- }, getIconVirtualDom(icon)];
1750
+ var __defProp = Object.defineProperty;
1751
+ var __export = (target, all) => {
1752
+ for (var name in all) __defProp(target, name, {
1753
+ get: all[name],
1754
+ enumerable: true
1755
+ });
1786
1756
  };
1787
1757
 
1788
- const getActionVirtualDom = action => {
1789
- switch (action.type) {
1790
- case Button$2:
1791
- return getActionButtonVirtualDom(action);
1792
- default:
1793
- return [];
1794
- }
1758
+ // src/parts/MergeClassNames/MergeClassNames.ts
1759
+ var mergeClassNames = (...classNames) => {
1760
+ return classNames.filter(Boolean).join(" ");
1795
1761
  };
1796
1762
 
1797
- const getActionsVirtualDom = actions => {
1798
- return [{
1799
- type: Div$1,
1800
- className: Actions,
1801
- role: ToolBar,
1802
- childCount: actions.length
1803
- }, ...actions.flatMap(getActionVirtualDom)];
1804
- };
1763
+ // src/parts/VirtualDomElements/VirtualDomElements.ts
1764
+ var VirtualDomElements_exports = {};
1765
+ __export(VirtualDomElements_exports, {
1766
+ A: () => A,
1767
+ Abbr: () => Abbr,
1768
+ Article: () => Article,
1769
+ Aside: () => Aside,
1770
+ Audio: () => Audio,
1771
+ Br: () => Br,
1772
+ Button: () => Button$1,
1773
+ Cite: () => Cite,
1774
+ Col: () => Col,
1775
+ ColGroup: () => ColGroup,
1776
+ Data: () => Data,
1777
+ Dd: () => Dd,
1778
+ Del: () => Del$1,
1779
+ Div: () => Div$1,
1780
+ Dl: () => Dl,
1781
+ Figcaption: () => Figcaption,
1782
+ Figure: () => Figure,
1783
+ Footer: () => Footer,
1784
+ H1: () => H1,
1785
+ H2: () => H2,
1786
+ H3: () => H3,
1787
+ H4: () => H4$1,
1788
+ H5: () => H5,
1789
+ H6: () => H6,
1790
+ Header: () => Header,
1791
+ Hr: () => Hr,
1792
+ I: () => I,
1793
+ Img: () => Img$1,
1794
+ Input: () => Input,
1795
+ Ins: () => Ins$1,
1796
+ Kbd: () => Kbd,
1797
+ Li: () => Li,
1798
+ Nav: () => Nav,
1799
+ Ol: () => Ol,
1800
+ Option: () => Option,
1801
+ P: () => P,
1802
+ Pre: () => Pre,
1803
+ Root: () => Root,
1804
+ Search: () => Search$1,
1805
+ Section: () => Section,
1806
+ Select: () => Select,
1807
+ Span: () => Span$1,
1808
+ TBody: () => TBody,
1809
+ THead: () => THead,
1810
+ Table: () => Table,
1811
+ Td: () => Td,
1812
+ Text: () => Text$1,
1813
+ TextArea: () => TextArea$1,
1814
+ Tfoot: () => Tfoot,
1815
+ Th: () => Th,
1816
+ Time: () => Time,
1817
+ Tr: () => Tr,
1818
+ Ul: () => Ul,
1819
+ Video: () => Video
1820
+ });
1821
+ var Audio = 0;
1822
+ var Button$1 = 1;
1823
+ var Col = 2;
1824
+ var ColGroup = 3;
1825
+ var Div$1 = 4;
1826
+ var H1 = 5;
1827
+ var Input = 6;
1828
+ var Kbd = 7;
1829
+ var Span$1 = 8;
1830
+ var Table = 9;
1831
+ var TBody = 10;
1832
+ var Td = 11;
1833
+ var Text$1 = 12;
1834
+ var Th = 13;
1835
+ var THead = 14;
1836
+ var Tr = 15;
1837
+ var I = 16;
1838
+ var Img$1 = 17;
1839
+ var Root = 0;
1840
+ var Ins$1 = 20;
1841
+ var Del$1 = 21;
1842
+ var H2 = 22;
1843
+ var H3 = 23;
1844
+ var H4$1 = 24;
1845
+ var H5 = 25;
1846
+ var H6 = 26;
1847
+ var Article = 27;
1848
+ var Aside = 28;
1849
+ var Footer = 29;
1850
+ var Header = 30;
1851
+ var Nav = 40;
1852
+ var Section = 41;
1853
+ var Search$1 = 42;
1854
+ var Dd = 43;
1855
+ var Dl = 44;
1856
+ var Figcaption = 45;
1857
+ var Figure = 46;
1858
+ var Hr = 47;
1859
+ var Li = 48;
1860
+ var Ol = 49;
1861
+ var P = 50;
1862
+ var Pre = 51;
1863
+ var A = 53;
1864
+ var Abbr = 54;
1865
+ var Br = 55;
1866
+ var Cite = 56;
1867
+ var Data = 57;
1868
+ var Time = 58;
1869
+ var Tfoot = 59;
1870
+ var Ul = 60;
1871
+ var Video = 61;
1872
+ var TextArea$1 = 62;
1873
+ var Select = 63;
1874
+ var Option = 64;
1805
1875
 
1806
- const commandIds = ['clearSearchResults', 'collapseDetails', 'copy', 'dismissItem', 'expandDetails', 'focusFirst', 'focusIndex', 'focusLast', 'focusMatchCase', 'focusMatchCasePrevious', 'focusMatchWholeWord', 'focusNext', 'focusNextInput', 'focusNextPage', 'focusPreserveCasePrevious', 'focusPrevious', 'focusPreviousInput', 'focusPreviousPage', 'focusRegex', 'focusRegexNext', 'focusReplaceAll', 'focusReplaceValue', 'focusReplaceValueNext', 'focusReplaceValuePrevious', 'focusSearchValue', 'focusSearchValueNext', 'handleClick', 'handleClickAt', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleContextMenuMouseAt', 'handleExcludeInput', 'handleFocusIn', 'handleHeaderClick', 'handleIconThemeChange', 'handleIconThemeChange', 'handleIncludeInput', 'handleInput', 'handleListBlur', 'handleListFocus', 'handleReplaceInput', 'handleScrollBarCaptureLost', 'handleScrollBarClick', 'handleScrollBarMove', 'handleScrollBarThumbPointerMove', 'handleTouchEnd', 'handleTouchMove', 'handleTouchStart', 'handleUpdate', 'handleWheel', 'refresh', 'replaceAll', 'scrollDown', 'selectIndex', 'submit', 'toggleMatchCase', 'toggleMatchWholeWord', 'togglePreserveCase', 'toggleReplace', 'toggleSearchDetails', 'toggleUseRegularExpression'];
1876
+ // src/parts/PatchType/PatchType.ts
1877
+ var SetText = 1;
1878
+ var SetAttribute = 3;
1879
+ var RemoveAttribute = 4;
1880
+ var Add = 6;
1881
+ var NavigateChild = 7;
1882
+ var NavigateParent = 8;
1883
+ var RemoveChild = 9;
1884
+ var NavigateSibling = 10;
1807
1885
 
1808
- const getCommandIds = () => {
1809
- return commandIds;
1886
+ // src/parts/ApplyPendingPatches/ApplyPendingPatches.ts
1887
+ var applyPendingPatches = (patches, pendingPatches, skip) => {
1888
+ for (let k = 0; k < pendingPatches.length - skip; k += 2) {
1889
+ const type = pendingPatches[k];
1890
+ const index = pendingPatches[k + 1];
1891
+ if (type === NavigateParent) {
1892
+ patches.push({
1893
+ type
1894
+ });
1895
+ } else {
1896
+ patches.push({
1897
+ type,
1898
+ index
1899
+ });
1900
+ }
1901
+ }
1902
+ pendingPatches.length = 0;
1810
1903
  };
1811
1904
 
1812
- const getFlags = uid => {
1813
- const {
1814
- newState
1815
- } = get(uid);
1816
- return newState.flags;
1905
+ // src/parts/IsKey/IsKey.ts
1906
+ var isKey = key => {
1907
+ return key !== "type" && key !== "childCount";
1817
1908
  };
1818
1909
 
1819
- const getFocus = uid => {
1820
- const {
1821
- newState
1822
- } = get(uid);
1823
- return newState.focus;
1910
+ // src/parts/GetKeys/GetKeys.ts
1911
+ var getKeys = node => {
1912
+ const keys = Object.keys(node).filter(isKey);
1913
+ return keys;
1824
1914
  };
1825
1915
 
1826
- const Tab = 2;
1827
- const Enter = 3;
1828
- const End = 255;
1829
- const Home = 12;
1830
- const UpArrow = 14;
1831
- const DownArrow = 16;
1832
- const Delete = 18;
1833
- const KeyC = 31;
1834
-
1835
- const CtrlCmd = 1 << 11 >>> 0;
1836
- const Shift = 1 << 10 >>> 0;
1837
- const Alt = 1 << 9 >>> 0;
1838
-
1839
- const getKeyBindings = () => {
1840
- return [{
1841
- key: CtrlCmd | Alt | Enter,
1842
- command: 'Search.replaceAll',
1843
- when: FocusSearch
1844
- }, {
1845
- key: Tab,
1846
- command: 'Search.focusNextInput',
1847
- when: FocusSearch
1848
- }, {
1849
- key: Shift | Tab,
1850
- command: 'Search.focusPreviousInput',
1851
- when: FocusSearch
1852
- }, {
1853
- key: DownArrow,
1854
- command: 'Search.focusNext',
1855
- when: FocusSearchResults
1856
- }, {
1857
- key: UpArrow,
1858
- command: 'Search.focusPrevious',
1859
- when: FocusSearchResults
1860
- }, {
1861
- key: Delete,
1862
- command: 'Search.dismissItem',
1863
- when: FocusSearchResults
1864
- }, {
1865
- key: Home,
1866
- command: 'Search.focusFirst',
1867
- when: FocusSearchResults
1868
- }, {
1869
- key: End,
1870
- command: 'Search.focusLast',
1871
- when: FocusSearchResults
1872
- }, {
1873
- key: CtrlCmd | KeyC,
1874
- command: 'Search.copy',
1875
- when: FocusSearchResults
1876
- }, {
1877
- key: Enter,
1878
- command: 'Search.submit',
1879
- when: FocusSearchInput
1880
- }, {
1881
- key: Enter,
1882
- command: 'Search.submit',
1883
- when: FocusSearchReplaceInput
1884
- }];
1916
+ // src/parts/GetTotalChildCount/GetTotalChildCount.ts
1917
+ var getTotalChildCount = (nodes, index) => {
1918
+ let i = index;
1919
+ let pending = 1;
1920
+ while (pending) {
1921
+ const node = nodes[i];
1922
+ pending += node.childCount;
1923
+ pending--;
1924
+ i++;
1925
+ }
1926
+ return i - index;
1885
1927
  };
1886
1928
 
1887
- const ClearAll = 'ClearAll';
1888
- const CollapseAll = 'CollapseAll';
1889
- const ListFlat = 'ListFlat';
1890
- const NewFile = 'NewFile';
1891
- const Refresh = 'Refresh';
1892
-
1893
- const getActions = () => {
1894
- return [{
1895
- type: Button$2,
1896
- id: refresh$1(),
1897
- icon: Refresh,
1898
- command: 'refresh'
1899
- }, {
1900
- type: Button$2,
1901
- id: clearSearchResults(),
1902
- icon: ClearAll,
1903
- command: 'clearSearchResults'
1904
- }, {
1905
- type: Button$2,
1906
- id: openNewSearchEditor(),
1907
- icon: NewFile,
1908
- command: ''
1909
- }, {
1910
- type: Button$2,
1911
- id: viewAsTree(),
1912
- icon: ListFlat,
1913
- command: ''
1914
- }, {
1915
- type: Button$2,
1916
- id: collapseAll(),
1917
- icon: CollapseAll,
1918
- command: ''
1919
- }];
1920
- };
1921
-
1922
- const None = 0;
1923
- const Collapsed = 1;
1924
- const Expanded = 2;
1925
-
1926
- const getMatchCount = (results, startIndex) => {
1927
- for (let i = startIndex + 1; i < results.length; i++) {
1928
- const result = results[i];
1929
- if (result.type === File) {
1930
- return i - startIndex - 1;
1929
+ // src/parts/VirtualDomDiff/VirtualDomDiff.ts
1930
+ var diff$1 = (oldNodes, newNodes) => {
1931
+ const patches = [];
1932
+ const pendingPatches = [];
1933
+ let i = 0;
1934
+ let j = 0;
1935
+ let siblingOffset = 0;
1936
+ let maxSiblingOffset = 1;
1937
+ const indexStack = [0, 1];
1938
+ while (i < oldNodes.length && j < newNodes.length) {
1939
+ const oldNode = oldNodes[i];
1940
+ const newNode = newNodes[j];
1941
+ if (siblingOffset === maxSiblingOffset) {
1942
+ indexStack.pop();
1943
+ indexStack.pop();
1944
+ pendingPatches.push(NavigateParent, 0);
1945
+ maxSiblingOffset = indexStack.pop();
1946
+ siblingOffset = indexStack.pop() + 1;
1947
+ }
1948
+ while (siblingOffset === maxSiblingOffset) {
1949
+ pendingPatches.push(NavigateParent, 0);
1950
+ maxSiblingOffset = indexStack.pop();
1951
+ siblingOffset = indexStack.pop() + 1;
1952
+ }
1953
+ if (oldNode.type !== newNode.type) {
1954
+ let skip = 0;
1955
+ if (pendingPatches.length > 0 && pendingPatches.at(-2) === NavigateChild) {
1956
+ skip = 2;
1957
+ }
1958
+ applyPendingPatches(patches, pendingPatches, skip);
1959
+ const oldTotal = getTotalChildCount(oldNodes, i);
1960
+ const newTotal = getTotalChildCount(newNodes, j);
1961
+ patches.push({
1962
+ type: RemoveChild,
1963
+ index: siblingOffset
1964
+ });
1965
+ patches.push({
1966
+ type: Add,
1967
+ nodes: newNodes.slice(j, j + newTotal)
1968
+ });
1969
+ siblingOffset++;
1970
+ i += oldTotal;
1971
+ j += newTotal;
1972
+ continue;
1973
+ }
1974
+ if (oldNode.type === Text$1 && newNode.type === Text$1) {
1975
+ if (oldNode.text !== newNode.text) {
1976
+ if (siblingOffset !== 0) {
1977
+ pendingPatches.push(NavigateSibling, siblingOffset);
1978
+ }
1979
+ applyPendingPatches(patches, pendingPatches, 0);
1980
+ patches.push({
1981
+ type: SetText,
1982
+ value: newNode.text
1983
+ });
1984
+ }
1985
+ i++;
1986
+ j++;
1987
+ siblingOffset++;
1988
+ continue;
1989
+ }
1990
+ const oldKeys = getKeys(oldNode);
1991
+ const newKeys = getKeys(newNode);
1992
+ let hasAttributeChanges = false;
1993
+ for (const key of newKeys) {
1994
+ if (oldNode[key] !== newNode[key]) {
1995
+ hasAttributeChanges = true;
1996
+ break;
1997
+ }
1998
+ }
1999
+ for (const key of oldKeys) {
2000
+ if (!(key in newNode)) {
2001
+ hasAttributeChanges = true;
2002
+ break;
2003
+ }
2004
+ }
2005
+ if (hasAttributeChanges) {
2006
+ if (siblingOffset > 0) {
2007
+ pendingPatches.push(NavigateSibling, siblingOffset);
2008
+ }
2009
+ applyPendingPatches(patches, pendingPatches, 0);
2010
+ for (const key of newKeys) {
2011
+ if (oldNode[key] !== newNode[key]) {
2012
+ patches.push({
2013
+ type: SetAttribute,
2014
+ key,
2015
+ value: newNode[key]
2016
+ });
2017
+ }
2018
+ }
2019
+ for (const key of oldKeys) {
2020
+ if (!(key in newNode)) {
2021
+ patches.push({
2022
+ type: RemoveAttribute,
2023
+ key
2024
+ });
2025
+ }
2026
+ }
2027
+ }
2028
+ if (oldNode.childCount && newNode.childCount) {
2029
+ maxSiblingOffset = oldNode.childCount;
2030
+ indexStack.push(0, maxSiblingOffset);
2031
+ pendingPatches.push(NavigateChild, 0);
2032
+ i++;
2033
+ j++;
2034
+ continue;
2035
+ }
2036
+ if (oldNode.childCount) {
2037
+ applyPendingPatches(patches, pendingPatches, 0);
2038
+ for (let k = 0; k < oldNode.childCount; k++) {
2039
+ patches.push({
2040
+ type: RemoveChild,
2041
+ index: 0
2042
+ });
2043
+ }
2044
+ i += getTotalChildCount(oldNodes, i);
2045
+ j++;
2046
+ siblingOffset++;
2047
+ continue;
2048
+ }
2049
+ if (newNode.childCount) {
2050
+ applyPendingPatches(patches, pendingPatches, 0);
2051
+ const total = getTotalChildCount(newNodes, j);
2052
+ patches.push({
2053
+ type: Add,
2054
+ nodes: newNodes.slice(j + 1, j + total)
2055
+ });
2056
+ i++;
2057
+ j += total;
2058
+ continue;
1931
2059
  }
2060
+ i++;
2061
+ j++;
2062
+ siblingOffset++;
1932
2063
  }
1933
- return results.length - startIndex - 1;
1934
- };
1935
-
1936
- const getChildCount = (expanded, matchCount) => {
1937
- let childCount = 1;
1938
- if (expanded === Expanded || expanded === Collapsed) {
1939
- childCount += 2;
2064
+ while (i < oldNodes.length) {
2065
+ if (indexStack.length !== 2) {
2066
+ patches.push({
2067
+ type: NavigateParent
2068
+ });
2069
+ }
2070
+ patches.push({
2071
+ type: RemoveChild,
2072
+ index: siblingOffset
2073
+ });
2074
+ i += getTotalChildCount(oldNodes, i);
2075
+ indexStack.pop();
2076
+ indexStack.pop();
1940
2077
  }
1941
- if (matchCount) {
1942
- childCount++;
2078
+ while (j < newNodes.length) {
2079
+ if (siblingOffset > 0) {
2080
+ patches.push({
2081
+ type: NavigateSibling,
2082
+ index: siblingOffset
2083
+ });
2084
+ siblingOffset = 0;
2085
+ }
2086
+ const count = getTotalChildCount(newNodes, j);
2087
+ patches.push({
2088
+ type: Add,
2089
+ nodes: newNodes.slice(j, j + count)
2090
+ });
2091
+ j += count;
1943
2092
  }
1944
- childCount++;
1945
- return childCount;
2093
+ return patches;
1946
2094
  };
1947
2095
 
1948
- // TODO this should be in FileSystem module
1949
- const pathBaseName = path => {
1950
- return path.slice(path.lastIndexOf('/') + 1);
1951
- };
1952
- const getRelativePath = relativePath => {
1953
- if (relativePath.startsWith('./')) {
1954
- return `/${relativePath.slice(2)}`; // TODO support windows paths
1955
- }
1956
- return `/${relativePath}`; // TODO support windows paths
1957
- };
2096
+ const Button = 1;
2097
+ const Del = 21;
2098
+ const Div = 4;
2099
+ const H4 = 24;
2100
+ const Img = 17;
2101
+ const Ins = 20;
2102
+ const Span = 8;
2103
+ const Text = 12;
2104
+ const TextArea = 62;
1958
2105
 
1959
- const getSearchDisplayResultFile = (results, fileIcons, i, setSize, collapsedPaths, text, posInSet, relativeIndex, focused, originalResults) => {
1960
- const path = text;
1961
- const absolutePath = getRelativePath(path);
1962
- const baseName = pathBaseName(path);
1963
- const index = originalResults.indexOf(results[i]);
1964
- const matchCount = getMatchCount(results, index);
1965
- const expanded = collapsedPaths.includes(path) ? Collapsed : Expanded;
1966
- const childCount = getChildCount(expanded, matchCount);
1967
- const badgeText = `${matchCount}`;
2106
+ const getIconVirtualDom = (icon, type = Div) => {
1968
2107
  return {
1969
- badgeText,
1970
- childCount,
1971
- depth: 0,
1972
- expanded,
1973
- focused,
1974
- icon: fileIcons[relativeIndex],
1975
- matchLength: 0,
1976
- matchStart: 0,
1977
- posInSet,
1978
- replacement: '',
1979
- setSize,
1980
- text: baseName,
1981
- title: absolutePath
2108
+ type,
2109
+ className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
2110
+ role: None$1,
2111
+ childCount: 0
1982
2112
  };
1983
2113
  };
1984
2114
 
1985
- const getDisplayResultMatch = (setSize, searchTermLength, replacement, text, posInSet, start, focused) => {
1986
- return {
1987
- badgeText: '',
1988
- childCount: getChildCount(None, 0),
1989
- depth: 1,
1990
- expanded: None,
1991
- focused,
1992
- icon: '',
1993
- matchLength: searchTermLength,
2115
+ const getActionButtonVirtualDom = action => {
2116
+ const {
2117
+ id,
2118
+ icon,
2119
+ command
2120
+ } = action;
2121
+ return [{
2122
+ type: Button,
2123
+ className: IconButton,
2124
+ title: id,
2125
+ 'data-command': command,
2126
+ childCount: 1
2127
+ }, getIconVirtualDom(icon)];
2128
+ };
2129
+
2130
+ const getActionVirtualDom = action => {
2131
+ switch (action.type) {
2132
+ case Button$2:
2133
+ return getActionButtonVirtualDom(action);
2134
+ default:
2135
+ return [];
2136
+ }
2137
+ };
2138
+
2139
+ const getActionsVirtualDom = actions => {
2140
+ return [{
2141
+ type: Div,
2142
+ className: Actions,
2143
+ role: ToolBar,
2144
+ childCount: actions.length
2145
+ }, ...actions.flatMap(getActionVirtualDom)];
2146
+ };
2147
+
2148
+ const commandIds = ['clearSearchResults', 'collapseDetails', 'copy', 'dismissItem', 'expandDetails', 'focusFirst', 'focusIndex', 'focusLast', 'focusMatchCase', 'focusMatchCasePrevious', 'focusMatchWholeWord', 'focusNext', 'focusNextInput', 'focusNextPage', 'focusPreserveCasePrevious', 'focusPrevious', 'focusPreviousInput', 'focusPreviousPage', 'focusRegex', 'focusRegexNext', 'focusReplaceAll', 'focusReplaceValue', 'focusReplaceValueNext', 'focusReplaceValuePrevious', 'focusSearchValue', 'focusSearchValueNext', 'handleClick', 'handleClickAt', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleContextMenuMouseAt', 'handleExcludeInput', 'handleFocusIn', 'handleHeaderClick', 'handleIconThemeChange', 'handleIconThemeChange', 'handleIncludeInput', 'handleInput', 'handleListBlur', 'handleListFocus', 'handleReplaceInput', 'handleScrollBarCaptureLost', 'handleScrollBarClick', 'handleScrollBarMove', 'handleScrollBarThumbPointerMove', 'handleTouchEnd', 'handleTouchMove', 'handleTouchStart', 'handleUpdate', 'handleWheel', 'refresh', 'replaceAll', 'scrollDown', 'selectIndex', 'submit', 'toggleMatchCase', 'toggleMatchWholeWord', 'togglePreserveCase', 'toggleReplace', 'toggleSearchDetails', 'toggleUseRegularExpression'];
2149
+
2150
+ const getCommandIds = () => {
2151
+ return commandIds;
2152
+ };
2153
+
2154
+ const getFlags = uid => {
2155
+ const {
2156
+ newState
2157
+ } = get(uid);
2158
+ return newState.flags;
2159
+ };
2160
+
2161
+ const getFocus = uid => {
2162
+ const {
2163
+ newState
2164
+ } = get(uid);
2165
+ return newState.focus;
2166
+ };
2167
+
2168
+ const Tab = 2;
2169
+ const Enter = 3;
2170
+ const End = 255;
2171
+ const Home = 12;
2172
+ const UpArrow = 14;
2173
+ const DownArrow = 16;
2174
+ const Delete = 18;
2175
+ const KeyC = 31;
2176
+
2177
+ const CtrlCmd = 1 << 11 >>> 0;
2178
+ const Shift = 1 << 10 >>> 0;
2179
+ const Alt = 1 << 9 >>> 0;
2180
+
2181
+ const getKeyBindings = () => {
2182
+ return [{
2183
+ key: CtrlCmd | Alt | Enter,
2184
+ command: 'Search.replaceAll',
2185
+ when: FocusSearch
2186
+ }, {
2187
+ key: Tab,
2188
+ command: 'Search.focusNextInput',
2189
+ when: FocusSearch
2190
+ }, {
2191
+ key: Shift | Tab,
2192
+ command: 'Search.focusPreviousInput',
2193
+ when: FocusSearch
2194
+ }, {
2195
+ key: DownArrow,
2196
+ command: 'Search.focusNext',
2197
+ when: FocusSearchResults
2198
+ }, {
2199
+ key: UpArrow,
2200
+ command: 'Search.focusPrevious',
2201
+ when: FocusSearchResults
2202
+ }, {
2203
+ key: Delete,
2204
+ command: 'Search.dismissItem',
2205
+ when: FocusSearchResults
2206
+ }, {
2207
+ key: Home,
2208
+ command: 'Search.focusFirst',
2209
+ when: FocusSearchResults
2210
+ }, {
2211
+ key: End,
2212
+ command: 'Search.focusLast',
2213
+ when: FocusSearchResults
2214
+ }, {
2215
+ key: CtrlCmd | KeyC,
2216
+ command: 'Search.copy',
2217
+ when: FocusSearchResults
2218
+ }, {
2219
+ key: Enter,
2220
+ command: 'Search.submit',
2221
+ when: FocusSearchInput
2222
+ }, {
2223
+ key: Enter,
2224
+ command: 'Search.submit',
2225
+ when: FocusSearchReplaceInput
2226
+ }];
2227
+ };
2228
+
2229
+ const ClearAll = 'ClearAll';
2230
+ const CollapseAll = 'CollapseAll';
2231
+ const ListFlat = 'ListFlat';
2232
+ const NewFile = 'NewFile';
2233
+ const Refresh = 'Refresh';
2234
+
2235
+ const getActions = () => {
2236
+ return [{
2237
+ type: Button$2,
2238
+ id: refresh$1(),
2239
+ icon: Refresh,
2240
+ command: 'refresh'
2241
+ }, {
2242
+ type: Button$2,
2243
+ id: clearSearchResults(),
2244
+ icon: ClearAll,
2245
+ command: 'clearSearchResults'
2246
+ }, {
2247
+ type: Button$2,
2248
+ id: openNewSearchEditor(),
2249
+ icon: NewFile,
2250
+ command: ''
2251
+ }, {
2252
+ type: Button$2,
2253
+ id: viewAsTree(),
2254
+ icon: ListFlat,
2255
+ command: ''
2256
+ }, {
2257
+ type: Button$2,
2258
+ id: collapseAll(),
2259
+ icon: CollapseAll,
2260
+ command: ''
2261
+ }];
2262
+ };
2263
+
2264
+ const None = 0;
2265
+ const Collapsed = 1;
2266
+ const Expanded = 2;
2267
+
2268
+ const getMatchCount = (results, startIndex) => {
2269
+ for (let i = startIndex + 1; i < results.length; i++) {
2270
+ const result = results[i];
2271
+ if (result.type === File) {
2272
+ return i - startIndex - 1;
2273
+ }
2274
+ }
2275
+ return results.length - startIndex - 1;
2276
+ };
2277
+
2278
+ const getChildCount = (expanded, matchCount) => {
2279
+ let childCount = 1;
2280
+ if (expanded === Expanded || expanded === Collapsed) {
2281
+ childCount += 2;
2282
+ }
2283
+ if (matchCount) {
2284
+ childCount++;
2285
+ }
2286
+ childCount++;
2287
+ return childCount;
2288
+ };
2289
+
2290
+ // TODO this should be in FileSystem module
2291
+ const pathBaseName = path => {
2292
+ return path.slice(path.lastIndexOf('/') + 1);
2293
+ };
2294
+ const getRelativePath = relativePath => {
2295
+ if (relativePath.startsWith('./')) {
2296
+ return `/${relativePath.slice(2)}`; // TODO support windows paths
2297
+ }
2298
+ return `/${relativePath}`; // TODO support windows paths
2299
+ };
2300
+
2301
+ const getSearchDisplayResultFile = (results, fileIcons, i, setSize, collapsedPaths, text, posInSet, relativeIndex, focused, originalResults) => {
2302
+ const path = text;
2303
+ const absolutePath = getRelativePath(path);
2304
+ const baseName = pathBaseName(path);
2305
+ const index = originalResults.indexOf(results[i]);
2306
+ const matchCount = getMatchCount(results, index);
2307
+ const expanded = collapsedPaths.includes(path) ? Collapsed : Expanded;
2308
+ const childCount = getChildCount(expanded, matchCount);
2309
+ const badgeText = `${matchCount}`;
2310
+ return {
2311
+ badgeText,
2312
+ childCount,
2313
+ depth: 0,
2314
+ expanded,
2315
+ focused,
2316
+ icon: fileIcons[relativeIndex],
2317
+ matchLength: 0,
2318
+ matchStart: 0,
2319
+ posInSet,
2320
+ replacement: '',
2321
+ setSize,
2322
+ text: baseName,
2323
+ title: absolutePath
2324
+ };
2325
+ };
2326
+
2327
+ const getDisplayResultMatch = (setSize, searchTermLength, replacement, text, posInSet, start, focused) => {
2328
+ return {
2329
+ badgeText: '',
2330
+ childCount: getChildCount(None, 0),
2331
+ depth: 1,
2332
+ expanded: None,
2333
+ focused,
2334
+ icon: '',
2335
+ matchLength: searchTermLength,
1994
2336
  matchStart: start,
1995
2337
  posInSet,
1996
2338
  replacement,
@@ -2061,7 +2403,7 @@ const UseRegularExpression = 'UseRegularExpression';
2061
2403
 
2062
2404
  const getSearchDetailsToggleVirtualDom = () => {
2063
2405
  return [{
2064
- type: Div$1,
2406
+ type: Div,
2065
2407
  className: ToggleDetails,
2066
2408
  role: Button$3,
2067
2409
  tabIndex: 0,
@@ -2070,7 +2412,7 @@ const getSearchDetailsToggleVirtualDom = () => {
2070
2412
  name: ToggleSearchDetails,
2071
2413
  childCount: 1
2072
2414
  }, {
2073
- type: Div$1,
2415
+ type: Div,
2074
2416
  className: mergeClassNames(MaskIcon, MaskIconEllipsis),
2075
2417
  childCount: 0
2076
2418
  }];
@@ -2078,7 +2420,7 @@ const getSearchDetailsToggleVirtualDom = () => {
2078
2420
 
2079
2421
  const text = data => {
2080
2422
  return {
2081
- type: Text$1,
2423
+ type: Text,
2082
2424
  text: data,
2083
2425
  childCount: 0
2084
2426
  };
@@ -2092,7 +2434,7 @@ const getClassName = indented => {
2092
2434
  };
2093
2435
  const getSearchMessageVirtualDom = (message, indented) => {
2094
2436
  return [{
2095
- type: Div$1,
2437
+ type: Div,
2096
2438
  className: getClassName(indented),
2097
2439
  role: Status,
2098
2440
  tabIndex: 0,
@@ -2102,7 +2444,7 @@ const getSearchMessageVirtualDom = (message, indented) => {
2102
2444
 
2103
2445
  const getSearchHeaderDetailsCollapsedVirtualDom = message => {
2104
2446
  return [{
2105
- type: Div$1,
2447
+ type: Div,
2106
2448
  className: SearchHeaderDetails,
2107
2449
  childCount: 2
2108
2450
  }, ...getSearchMessageVirtualDom(message, true), ...getSearchDetailsToggleVirtualDom()];
@@ -2188,7 +2530,7 @@ const getSearchFieldButtonVirtualDom = button => {
2188
2530
  const role = getRole(flag);
2189
2531
  const disabled = getDisabled(flag);
2190
2532
  return [{
2191
- type: Button$1,
2533
+ type: Button,
2192
2534
  className: getSearchFieldButtonClassName(flag),
2193
2535
  name,
2194
2536
  title,
@@ -2198,7 +2540,7 @@ const getSearchFieldButtonVirtualDom = button => {
2198
2540
  tabIndex: 0,
2199
2541
  childCount: 1
2200
2542
  }, {
2201
- type: Span$1,
2543
+ type: Span,
2202
2544
  className: mergeClassNames(MaskIcon, icon),
2203
2545
  childCount: 0
2204
2546
  }];
@@ -2213,7 +2555,7 @@ const getOutSideButtonsDom = outsideButtons => {
2213
2555
  }
2214
2556
  return {
2215
2557
  preNodes: [{
2216
- type: Div$1,
2558
+ type: Div,
2217
2559
  className: SearchFieldContainer,
2218
2560
  role: None$1,
2219
2561
  childCount: 1 + outsideButtons.length
@@ -2229,12 +2571,12 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
2229
2571
  } = getOutSideButtonsDom(outsideButtons);
2230
2572
  const searchFieldClassName = hasError ? mergeClassNames(SearchField, SearchFieldError) : SearchField;
2231
2573
  const dom = [...preNodes, {
2232
- type: Div$1,
2574
+ type: Div,
2233
2575
  className: searchFieldClassName,
2234
2576
  role: None$1,
2235
2577
  childCount: 2
2236
2578
  }, {
2237
- type: TextArea$1,
2579
+ type: TextArea,
2238
2580
  className: MultilineInputBox,
2239
2581
  spellcheck: false,
2240
2582
  autocapitalize: 'off',
@@ -2245,7 +2587,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
2245
2587
  onFocus,
2246
2588
  childCount: 0
2247
2589
  }, {
2248
- type: Div$1,
2590
+ type: Div,
2249
2591
  className: SearchFieldButtons,
2250
2592
  childCount: insideButtons.length
2251
2593
  }, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom), ...postNodes];
@@ -2256,19 +2598,19 @@ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
2256
2598
  const includeButtons = getInputActionsInclude(flags);
2257
2599
  const excludeButtons = getInputActionsExclude(flags);
2258
2600
  return [{
2259
- type: Div$1,
2601
+ type: Div,
2260
2602
  className: SearchHeaderDetailsExpanded,
2261
2603
  childCount: 5
2262
2604
  }, {
2263
- type: Div$1,
2605
+ type: Div,
2264
2606
  className: SearchHeaderDetailsExpandedTop,
2265
2607
  childCount: 2
2266
2608
  }, ...getSearchDetailsToggleVirtualDom(), {
2267
- type: H4$1,
2609
+ type: H4,
2268
2610
  className: SearchHeaderDetailsHeading,
2269
2611
  childCount: 1
2270
2612
  }, text(filesToInclude()), ...getSearchFieldVirtualDom(FilesToInclude, 'Include', HandleIncludeInput, includeButtons.inside, includeButtons.outside), {
2271
- type: H4$1,
2613
+ type: H4,
2272
2614
  className: SearchHeaderDetailsHeading,
2273
2615
  childCount: 1
2274
2616
  }, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, 'Exclude', HandleExcludeInput, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message, false)];
@@ -2326,7 +2668,7 @@ const getInputActionsReplace = (flags, matchCount) => {
2326
2668
 
2327
2669
  const getSearchToggleVirtualDom = flags => {
2328
2670
  return [{
2329
- type: Button$1,
2671
+ type: Button,
2330
2672
  className: mergeClassNames(IconButton, SearchToggleButton, flags & ReplaceExpanded ? SearchToggleButtonExpanded : ''),
2331
2673
  title: toggleReplace$1(),
2332
2674
  ariaLabel: toggleReplace$1(),
@@ -2335,7 +2677,7 @@ const getSearchToggleVirtualDom = flags => {
2335
2677
  'data-command': 'toggleReplace',
2336
2678
  name: ToggleReplace
2337
2679
  }, {
2338
- type: Div$1,
2680
+ type: Div,
2339
2681
  className: mergeClassNames(MaskIcon, flags & ReplaceExpanded ? MaskIconChevronDown : MaskIconChevronRight),
2340
2682
  childCount: 0
2341
2683
  }];
@@ -2345,12 +2687,12 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
2345
2687
  const inputActions = getInputActionsInput(flags);
2346
2688
  const replaceActions = getInputActionsReplace(flags, matchCount);
2347
2689
  const dom = [{
2348
- type: Div$1,
2690
+ type: Div,
2349
2691
  className: SearchHeaderTop,
2350
2692
  role: None$1,
2351
2693
  childCount: 2
2352
2694
  }, ...getSearchToggleVirtualDom(flags), {
2353
- type: Div$1,
2695
+ type: Div,
2354
2696
  className: SearchHeaderTopRight,
2355
2697
  role: None$1,
2356
2698
  childCount: flags & ReplaceExpanded ? 2 : 1
@@ -2362,7 +2704,7 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
2362
2704
  };
2363
2705
 
2364
2706
  const parentNode = {
2365
- type: Div$1,
2707
+ type: Div,
2366
2708
  className: SearchHeader,
2367
2709
  role: None$1,
2368
2710
  childCount: 2,
@@ -2379,7 +2721,7 @@ const getSearchInputErrorVirtualDom = errorMessage => {
2379
2721
  return [];
2380
2722
  }
2381
2723
  return [{
2382
- type: Div$1,
2724
+ type: Div,
2383
2725
  className: SearchInputError,
2384
2726
  role: Alert,
2385
2727
  childCount: 1
@@ -2393,7 +2735,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
2393
2735
  return [];
2394
2736
  }
2395
2737
  return [{
2396
- type: Div$1,
2738
+ type: Div,
2397
2739
  className: mergeClassNames(ScrollBar, ScrollBarVertical),
2398
2740
  childCount: 1,
2399
2741
  onPointerDown: HandleScrollBarPointerDown,
@@ -2401,7 +2743,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
2401
2743
  ariaControls: TreeItems,
2402
2744
  ariaValueNow: scrollBarValue
2403
2745
  }, {
2404
- type: Div$1,
2746
+ type: Div,
2405
2747
  className: ScrollBarThumb,
2406
2748
  height: scrollBarHeight,
2407
2749
  translate: `0 ${scrollBarY}px`,
@@ -2427,26 +2769,26 @@ const getBadgeVirtualDom = (className, badgeText) => {
2427
2769
  return [];
2428
2770
  }
2429
2771
  return [{
2430
- type: Div$1,
2772
+ type: Div,
2431
2773
  className: mergeClassNames(Badge, className),
2432
2774
  childCount: 1
2433
2775
  }, text(badgeText)];
2434
2776
  };
2435
2777
 
2436
2778
  const chevronDownVirtualDom = {
2437
- type: Div$1,
2779
+ type: Div,
2438
2780
  className: mergeClassNames(Chevron, MaskIconChevronDown),
2439
2781
  childCount: 0
2440
2782
  };
2441
2783
  const chevronRightVirtualDom = {
2442
- type: Div$1,
2784
+ type: Div,
2443
2785
  className: mergeClassNames(Chevron, MaskIconChevronRight),
2444
2786
  childCount: 0
2445
2787
  };
2446
2788
 
2447
2789
  const getFileIconVirtualDom = icon => {
2448
2790
  return {
2449
- type: Img$1,
2791
+ type: Img,
2450
2792
  className: FileIcon,
2451
2793
  src: icon,
2452
2794
  role: None$1,
@@ -2466,22 +2808,22 @@ const getIconsVirtualDom = (expanded, icon) => {
2466
2808
  };
2467
2809
 
2468
2810
  const deleted = {
2469
- type: Del$1,
2811
+ type: Del,
2470
2812
  className: HighlightDeleted,
2471
2813
  childCount: 1
2472
2814
  };
2473
2815
  const inserted = {
2474
- type: Ins$1,
2816
+ type: Ins,
2475
2817
  className: HighlightInserted,
2476
2818
  childCount: 1
2477
2819
  };
2478
2820
  const highlighted = {
2479
- type: Span$1,
2821
+ type: Span,
2480
2822
  className: Highlight,
2481
2823
  childCount: 1
2482
2824
  };
2483
2825
  const label1 = {
2484
- type: Div$1,
2826
+ type: Div,
2485
2827
  className: mergeClassNames(Label, Grow),
2486
2828
  childCount: 1
2487
2829
  };
@@ -2536,7 +2878,7 @@ const getSearchResultVirtualDom = rowInfo => {
2536
2878
  badgeText
2537
2879
  } = rowInfo;
2538
2880
  const dom = [{
2539
- type: Div$1,
2881
+ type: Div,
2540
2882
  role: TreeItem$1,
2541
2883
  className: getSearchResultClassName(focused),
2542
2884
  title,
@@ -2550,11 +2892,11 @@ const getSearchResultVirtualDom = rowInfo => {
2550
2892
  paddingRight: PaddingRight,
2551
2893
  ariaExpanded: getAriaExpanded(expanded)
2552
2894
  }, ...getIconsVirtualDom(expanded, icon), ...getLabelVirtualDom(displayText, matchLength, matchStart, replacement), ...getBadgeVirtualDom(SourceControlBadge, badgeText), {
2553
- type: Div$1,
2895
+ type: Div,
2554
2896
  className: SearchRemove,
2555
2897
  childCount: 1
2556
2898
  }, {
2557
- type: Div$1,
2899
+ type: Div,
2558
2900
  className: CloseMaskIcon,
2559
2901
  childCount: 0
2560
2902
  }];
@@ -2564,7 +2906,7 @@ const getSearchResultVirtualDom = rowInfo => {
2564
2906
  const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
2565
2907
  const pixelOffset = deltaY % itemHeight;
2566
2908
  return [{
2567
- type: Div$1,
2909
+ type: Div,
2568
2910
  className: TreeItems$1,
2569
2911
  childCount: visibleItems.length,
2570
2912
  onClick: HandleClick,
@@ -2578,7 +2920,7 @@ const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
2578
2920
  const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight) => {
2579
2921
  const scrollBarDomNodes = scrollbarHeight === 0 ? 0 : 1;
2580
2922
  return [{
2581
- type: Div$1,
2923
+ type: Div,
2582
2924
  className: mergeClassNames(Viewlet, List, Tree, focusOutline ? FocusOutline : Empty),
2583
2925
  role: Tree$1,
2584
2926
  tabIndex: 0,
@@ -2590,7 +2932,7 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchI
2590
2932
  const errorDom = getSearchInputErrorVirtualDom(searchInputErrorMessage);
2591
2933
  const childCount = 2 + (errorDom.length > 0 ? 1 : 0);
2592
2934
  return [{
2593
- type: Div$1,
2935
+ type: Div,
2594
2936
  className: mergeClassNames(Viewlet, Search$2),
2595
2937
  childCount
2596
2938
  }, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
@@ -3911,7 +4253,7 @@ const DiffValue = {
3911
4253
 
3912
4254
  const modules = [DiffItems, DiffFocus, DiffIncludeValue, DiffExcludeValue, DiffReplaceValue, DiffValue];
3913
4255
 
3914
- const diff$1 = (oldState, newState) => {
4256
+ const diff = (oldState, newState) => {
3915
4257
  const diffResult = [];
3916
4258
  for (const module of modules) {
3917
4259
  if (!module.isEqual(oldState, newState)) {
@@ -3926,7 +4268,7 @@ const doRender = uid => {
3926
4268
  oldState,
3927
4269
  newState
3928
4270
  } = get(uid);
3929
- const diffResult = diff$1(oldState, newState);
4271
+ const diffResult = diff(oldState, newState);
3930
4272
  const commands = applyRender(oldState, newState, diffResult);
3931
4273
  return commands;
3932
4274
  };
@@ -3980,350 +4322,15 @@ const renderEventListeners = () => {
3980
4322
  }, {
3981
4323
  name: HandleHeaderClick2,
3982
4324
  params: ['handleHeaderClick', 'event.target.name']
4325
+ }, {
4326
+ name: HandleHeaderFocusIn,
4327
+ params: ['handleHeaderFocusIn']
4328
+ }, {
4329
+ name: HandleScrollBarPointerDown,
4330
+ params: ['handleScrollBarClick', 'event.deltaY']
3983
4331
  }];
3984
4332
  };
3985
4333
 
3986
- var __defProp = Object.defineProperty;
3987
- var __export = (target, all) => {
3988
- for (var name in all) __defProp(target, name, {
3989
- get: all[name],
3990
- enumerable: true
3991
- });
3992
- };
3993
-
3994
- // src/parts/VirtualDomElements/VirtualDomElements.ts
3995
- var VirtualDomElements_exports = {};
3996
- __export(VirtualDomElements_exports, {
3997
- A: () => A,
3998
- Abbr: () => Abbr,
3999
- Article: () => Article,
4000
- Aside: () => Aside,
4001
- Audio: () => Audio,
4002
- Br: () => Br,
4003
- Button: () => Button,
4004
- Cite: () => Cite,
4005
- Col: () => Col,
4006
- ColGroup: () => ColGroup,
4007
- Data: () => Data,
4008
- Dd: () => Dd,
4009
- Del: () => Del,
4010
- Div: () => Div,
4011
- Dl: () => Dl,
4012
- Figcaption: () => Figcaption,
4013
- Figure: () => Figure,
4014
- Footer: () => Footer,
4015
- H1: () => H1,
4016
- H2: () => H2,
4017
- H3: () => H3,
4018
- H4: () => H4,
4019
- H5: () => H5,
4020
- H6: () => H6,
4021
- Header: () => Header,
4022
- Hr: () => Hr,
4023
- I: () => I,
4024
- Img: () => Img,
4025
- Input: () => Input,
4026
- Ins: () => Ins,
4027
- Kbd: () => Kbd,
4028
- Li: () => Li,
4029
- Nav: () => Nav,
4030
- Ol: () => Ol,
4031
- Option: () => Option,
4032
- P: () => P,
4033
- Pre: () => Pre,
4034
- Root: () => Root,
4035
- Search: () => Search$1,
4036
- Section: () => Section,
4037
- Select: () => Select,
4038
- Span: () => Span,
4039
- TBody: () => TBody,
4040
- THead: () => THead,
4041
- Table: () => Table,
4042
- Td: () => Td,
4043
- Text: () => Text,
4044
- TextArea: () => TextArea,
4045
- Tfoot: () => Tfoot,
4046
- Th: () => Th,
4047
- Time: () => Time,
4048
- Tr: () => Tr,
4049
- Ul: () => Ul,
4050
- Video: () => Video
4051
- });
4052
- var Audio = 0;
4053
- var Button = 1;
4054
- var Col = 2;
4055
- var ColGroup = 3;
4056
- var Div = 4;
4057
- var H1 = 5;
4058
- var Input = 6;
4059
- var Kbd = 7;
4060
- var Span = 8;
4061
- var Table = 9;
4062
- var TBody = 10;
4063
- var Td = 11;
4064
- var Text = 12;
4065
- var Th = 13;
4066
- var THead = 14;
4067
- var Tr = 15;
4068
- var I = 16;
4069
- var Img = 17;
4070
- var Root = 0;
4071
- var Ins = 20;
4072
- var Del = 21;
4073
- var H2 = 22;
4074
- var H3 = 23;
4075
- var H4 = 24;
4076
- var H5 = 25;
4077
- var H6 = 26;
4078
- var Article = 27;
4079
- var Aside = 28;
4080
- var Footer = 29;
4081
- var Header = 30;
4082
- var Nav = 40;
4083
- var Section = 41;
4084
- var Search$1 = 42;
4085
- var Dd = 43;
4086
- var Dl = 44;
4087
- var Figcaption = 45;
4088
- var Figure = 46;
4089
- var Hr = 47;
4090
- var Li = 48;
4091
- var Ol = 49;
4092
- var P = 50;
4093
- var Pre = 51;
4094
- var A = 53;
4095
- var Abbr = 54;
4096
- var Br = 55;
4097
- var Cite = 56;
4098
- var Data = 57;
4099
- var Time = 58;
4100
- var Tfoot = 59;
4101
- var Ul = 60;
4102
- var Video = 61;
4103
- var TextArea = 62;
4104
- var Select = 63;
4105
- var Option = 64;
4106
-
4107
- // src/parts/PatchType/PatchType.ts
4108
- var SetText = 1;
4109
- var SetAttribute = 3;
4110
- var RemoveAttribute = 4;
4111
- var Add = 6;
4112
- var NavigateChild = 7;
4113
- var NavigateParent = 8;
4114
- var RemoveChild = 9;
4115
- var NavigateSibling = 10;
4116
-
4117
- // src/parts/ApplyPendingPatches/ApplyPendingPatches.ts
4118
- var applyPendingPatches = (patches, pendingPatches, skip) => {
4119
- for (let k = 0; k < pendingPatches.length - skip; k += 2) {
4120
- const type = pendingPatches[k];
4121
- const index = pendingPatches[k + 1];
4122
- if (type === NavigateParent) {
4123
- patches.push({
4124
- type
4125
- });
4126
- } else {
4127
- patches.push({
4128
- type,
4129
- index
4130
- });
4131
- }
4132
- }
4133
- pendingPatches.length = 0;
4134
- };
4135
-
4136
- // src/parts/IsKey/IsKey.ts
4137
- var isKey = key => {
4138
- return key !== "type" && key !== "childCount";
4139
- };
4140
-
4141
- // src/parts/GetKeys/GetKeys.ts
4142
- var getKeys = node => {
4143
- const keys = Object.keys(node).filter(isKey);
4144
- return keys;
4145
- };
4146
-
4147
- // src/parts/GetTotalChildCount/GetTotalChildCount.ts
4148
- var getTotalChildCount = (nodes, index) => {
4149
- let i = index;
4150
- let pending = 1;
4151
- while (pending) {
4152
- const node = nodes[i];
4153
- pending += node.childCount;
4154
- pending--;
4155
- i++;
4156
- }
4157
- return i - index;
4158
- };
4159
-
4160
- // src/parts/VirtualDomDiff/VirtualDomDiff.ts
4161
- var diff = (oldNodes, newNodes) => {
4162
- const patches = [];
4163
- const pendingPatches = [];
4164
- let i = 0;
4165
- let j = 0;
4166
- let siblingOffset = 0;
4167
- let maxSiblingOffset = 1;
4168
- const indexStack = [0, 1];
4169
- while (i < oldNodes.length && j < newNodes.length) {
4170
- const oldNode = oldNodes[i];
4171
- const newNode = newNodes[j];
4172
- if (siblingOffset === maxSiblingOffset) {
4173
- indexStack.pop();
4174
- indexStack.pop();
4175
- pendingPatches.push(NavigateParent, 0);
4176
- maxSiblingOffset = indexStack.pop();
4177
- siblingOffset = indexStack.pop() + 1;
4178
- }
4179
- while (siblingOffset === maxSiblingOffset) {
4180
- pendingPatches.push(NavigateParent, 0);
4181
- maxSiblingOffset = indexStack.pop();
4182
- siblingOffset = indexStack.pop() + 1;
4183
- }
4184
- if (oldNode.type !== newNode.type) {
4185
- let skip = 0;
4186
- if (pendingPatches.length > 0 && pendingPatches.at(-2) === NavigateChild) {
4187
- skip = 2;
4188
- }
4189
- applyPendingPatches(patches, pendingPatches, skip);
4190
- const oldTotal = getTotalChildCount(oldNodes, i);
4191
- const newTotal = getTotalChildCount(newNodes, j);
4192
- patches.push({
4193
- type: RemoveChild,
4194
- index: siblingOffset
4195
- });
4196
- patches.push({
4197
- type: Add,
4198
- nodes: newNodes.slice(j, j + newTotal)
4199
- });
4200
- siblingOffset++;
4201
- i += oldTotal;
4202
- j += newTotal;
4203
- continue;
4204
- }
4205
- if (oldNode.type === Text && newNode.type === Text) {
4206
- if (oldNode.text !== newNode.text) {
4207
- if (siblingOffset !== 0) {
4208
- pendingPatches.push(NavigateSibling, siblingOffset);
4209
- }
4210
- applyPendingPatches(patches, pendingPatches, 0);
4211
- patches.push({
4212
- type: SetText,
4213
- value: newNode.text
4214
- });
4215
- }
4216
- i++;
4217
- j++;
4218
- siblingOffset++;
4219
- continue;
4220
- }
4221
- const oldKeys = getKeys(oldNode);
4222
- const newKeys = getKeys(newNode);
4223
- let hasAttributeChanges = false;
4224
- for (const key of newKeys) {
4225
- if (oldNode[key] !== newNode[key]) {
4226
- hasAttributeChanges = true;
4227
- break;
4228
- }
4229
- }
4230
- for (const key of oldKeys) {
4231
- if (!(key in newNode)) {
4232
- hasAttributeChanges = true;
4233
- break;
4234
- }
4235
- }
4236
- if (hasAttributeChanges) {
4237
- if (siblingOffset > 0) {
4238
- pendingPatches.push(NavigateSibling, siblingOffset);
4239
- }
4240
- applyPendingPatches(patches, pendingPatches, 0);
4241
- for (const key of newKeys) {
4242
- if (oldNode[key] !== newNode[key]) {
4243
- patches.push({
4244
- type: SetAttribute,
4245
- key,
4246
- value: newNode[key]
4247
- });
4248
- }
4249
- }
4250
- for (const key of oldKeys) {
4251
- if (!(key in newNode)) {
4252
- patches.push({
4253
- type: RemoveAttribute,
4254
- key
4255
- });
4256
- }
4257
- }
4258
- }
4259
- if (oldNode.childCount && newNode.childCount) {
4260
- maxSiblingOffset = oldNode.childCount;
4261
- indexStack.push(0, maxSiblingOffset);
4262
- pendingPatches.push(NavigateChild, 0);
4263
- i++;
4264
- j++;
4265
- continue;
4266
- }
4267
- if (oldNode.childCount) {
4268
- applyPendingPatches(patches, pendingPatches, 0);
4269
- for (let k = 0; k < oldNode.childCount; k++) {
4270
- patches.push({
4271
- type: RemoveChild,
4272
- index: 0
4273
- });
4274
- }
4275
- i += getTotalChildCount(oldNodes, i);
4276
- j++;
4277
- siblingOffset++;
4278
- continue;
4279
- }
4280
- if (newNode.childCount) {
4281
- applyPendingPatches(patches, pendingPatches, 0);
4282
- const total = getTotalChildCount(newNodes, j);
4283
- patches.push({
4284
- type: Add,
4285
- nodes: newNodes.slice(j + 1, j + total)
4286
- });
4287
- i++;
4288
- j += total;
4289
- continue;
4290
- }
4291
- i++;
4292
- j++;
4293
- siblingOffset++;
4294
- }
4295
- while (i < oldNodes.length) {
4296
- if (indexStack.length !== 2) {
4297
- patches.push({
4298
- type: NavigateParent
4299
- });
4300
- }
4301
- patches.push({
4302
- type: RemoveChild,
4303
- index: siblingOffset
4304
- });
4305
- i += getTotalChildCount(oldNodes, i);
4306
- indexStack.pop();
4307
- indexStack.pop();
4308
- }
4309
- while (j < newNodes.length) {
4310
- if (siblingOffset > 0) {
4311
- patches.push({
4312
- type: NavigateSibling,
4313
- index: siblingOffset
4314
- });
4315
- siblingOffset = 0;
4316
- }
4317
- const count = getTotalChildCount(newNodes, j);
4318
- patches.push({
4319
- type: Add,
4320
- nodes: newNodes.slice(j, j + count)
4321
- });
4322
- j += count;
4323
- }
4324
- return patches;
4325
- };
4326
-
4327
4334
  const getDom = state => {
4328
4335
  const displayResults = getDisplayResults(state.listItems, state.itemHeight, state.fileCount, state.value, state.minLineY, state.maxLineY, state.replacement, state.icons, state.listFocusedIndex, state.collapsedPaths, state.items);
4329
4336
  const focusOutline = state.listFocused && state.listFocusedIndex === -1;
@@ -4341,7 +4348,7 @@ const renderIncremental = uid => {
4341
4348
  } = get(uid);
4342
4349
  const oldDom = getDom(oldState);
4343
4350
  const newDom = getDom(newState);
4344
- const patches = diff(oldDom, newDom);
4351
+ const patches = diff$1(oldDom, newDom);
4345
4352
  return patches;
4346
4353
  };
4347
4354