@lvce-editor/renderer-process 5.0.0 → 6.0.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.
@@ -493,10 +493,10 @@ const getPlatform = () => {
493
493
  };
494
494
  const platform = getPlatform();
495
495
 
496
- const Two$1 = '2.0';
496
+ const Two = '2.0';
497
497
  const create$4$1 = (method, params) => {
498
498
  return {
499
- jsonrpc: Two$1,
499
+ jsonrpc: Two,
500
500
  method,
501
501
  params
502
502
  };
@@ -598,7 +598,7 @@ const create$2$1 = (method, params) => {
598
598
  promise
599
599
  } = registerPromise();
600
600
  const message = {
601
- jsonrpc: Two$1,
601
+ jsonrpc: Two,
602
602
  method,
603
603
  params,
604
604
  id
@@ -744,7 +744,7 @@ const unwrapJsonRpcResult = responseMessage => {
744
744
  };
745
745
  const create$1$1 = (message, error) => {
746
746
  return {
747
- jsonrpc: Two$1,
747
+ jsonrpc: Two,
748
748
  id: message.id,
749
749
  error
750
750
  };
@@ -777,7 +777,7 @@ const getErrorResponse = (message, error, ipc, preparePrettyError, logError) =>
777
777
  };
778
778
  const create$M = (message, result) => {
779
779
  return {
780
- jsonrpc: Two$1,
780
+ jsonrpc: Two,
781
781
  id: message.id,
782
782
  result: result ?? null
783
783
  };
@@ -819,7 +819,17 @@ const send$1 = (transport, method, ...params) => {
819
819
  const message = create$4$1(method, params);
820
820
  transport.send(message);
821
821
  };
822
- const invokeAndTransfer = async (ipc, handle, method, ...params) => {
822
+ const invoke$2 = async (ipc, method, ...params) => {
823
+ const {
824
+ message,
825
+ promise
826
+ } = create$2$1(method, params);
827
+ ipc.send(message);
828
+ const responseMessage = await promise;
829
+ const result = unwrapJsonRpcResult(responseMessage);
830
+ return result;
831
+ };
832
+ const invokeAndTransfer$1 = async (ipc, handle, method, ...params) => {
823
833
  const {
824
834
  message,
825
835
  promise
@@ -981,13 +991,39 @@ const hydrate$1 = async () => {
981
991
  // @ts-expect-error
982
992
  state$9.ipc = ipc;
983
993
  };
994
+
995
+ // TODO needed?
996
+ const dispose$j = () => {
997
+ // @ts-expect-error
998
+ if (state$9.rendererWorker) {
999
+ // @ts-expect-error
1000
+ state$9.rendererWorker.terminate();
1001
+ }
1002
+ };
984
1003
  const send = (method, ...params) => {
985
1004
  send$1(state$9.ipc, method, ...params);
986
1005
  };
1006
+ const invoke$1 = (method, ...params) => {
1007
+ return invoke$2(state$9.ipc, method, ...params);
1008
+ };
987
1009
  const sendAndTransfer = (message, transfer) => {
988
1010
  // @ts-expect-error
989
1011
  state$9.ipc.sendAndTransfer(message, transfer);
990
1012
  };
1013
+ const invokeAndTransfer = (method, transfer, ...params) => {
1014
+ return invokeAndTransfer$1(state$9.ipc, transfer, method, ...params);
1015
+ };
1016
+
1017
+ const RendererWorker = {
1018
+ __proto__: null,
1019
+ dispose: dispose$j,
1020
+ hydrate: hydrate$1,
1021
+ invoke: invoke$1,
1022
+ invokeAndTransfer,
1023
+ send,
1024
+ sendAndTransfer,
1025
+ state: state$9
1026
+ };
991
1027
 
992
1028
  let AssertionError$1 = class AssertionError extends Error {
993
1029
  constructor(message) {
@@ -1739,1394 +1775,1438 @@ const handleUnhandledError = (message, filename, lineno, colno, error) => {
1739
1775
  handleError$8(error, Boolean(error), '[renderer-process] Unhandled Error: ');
1740
1776
  };
1741
1777
 
1742
- const main = async () => {
1743
- onerror = handleUnhandledError;
1744
- onunhandledrejection = handleUnhandledRejection;
1745
- if ('SecurityPolicyViolationEvent' in self) {
1746
- self.addEventListener('securitypolicyviolation', handleContentSecurityPolicyViolation);
1747
- }
1748
- setLoad(load$1);
1749
- if (platform === Web) {
1750
- // disable prompt to download app as pwa
1751
- // @ts-expect-error
1752
- window.onbeforeinstallprompt = handleBeforeInstallPrompt;
1753
- }
1754
- // TODO this is discovered very late
1755
- await hydrate$1();
1756
- };
1757
-
1758
- main();
1759
-
1760
- const play = async src => {
1761
- const audio = new Audio(src);
1762
- await audio.play();
1763
- };
1764
-
1765
- const name$y = 'Audio';
1766
- const Commands$z = {
1767
- play: play
1768
- };
1769
-
1770
- const Audio_ipc = {
1771
- __proto__: null,
1772
- Commands: Commands$z,
1773
- name: name$y
1774
- };
1775
-
1776
- const readText = async () => {
1777
- return navigator.clipboard.readText();
1778
- };
1779
- const writeText = async text => {
1780
- string(text);
1781
- await navigator.clipboard.writeText(text);
1782
- };
1783
- const writeImage = async blob => {
1784
- await navigator.clipboard.write([new ClipboardItem({
1785
- [blob.type]: blob
1786
- })]);
1787
- };
1788
- const execCopy = async () => {
1789
- // @ts-expect-error
1790
- const text = getSelection().toString();
1791
- await writeText(text);
1792
- };
1793
-
1794
- const name$x = 'ClipBoard';
1795
- const Commands$y = {
1796
- execCopy: execCopy,
1797
- readText: readText,
1798
- writeImage: writeImage,
1799
- writeText: writeText
1800
- };
1801
-
1802
- const ClipBoard_ipc = {
1803
- __proto__: null,
1804
- Commands: Commands$y,
1805
- name: name$x
1806
- };
1807
-
1808
- const prompt$1 = message => {
1809
- return confirm(message);
1810
- };
1811
-
1812
- const name$w = 'ConfirmPrompt';
1813
- const Commands$x = {
1814
- prompt: prompt$1
1815
- };
1816
-
1817
- const ConfirmPrompt_ipc = {
1818
- __proto__: null,
1819
- Commands: Commands$x,
1820
- name: name$w
1821
- };
1822
-
1823
- const state$8 = {
1824
- styleSheets: Object.create(null)
1825
- };
1826
- const set$4 = (id, sheet) => {
1827
- state$8.styleSheets[id] = sheet;
1828
- };
1829
- const get$5 = id => {
1830
- return state$8.styleSheets[id];
1831
- };
1832
-
1833
- const addCssStyleSheet = async (id, text) => {
1834
- const existing = get$5(id);
1835
- if (existing) {
1836
- await existing.replace(text);
1837
- return;
1838
- }
1839
- const sheet = new CSSStyleSheet({});
1840
- set$4(id, sheet);
1841
- await sheet.replace(text);
1842
- document.adoptedStyleSheets.push(sheet);
1843
- };
1844
-
1845
- const name$v = 'Css';
1846
- const Commands$w = {
1847
- addCssStyleSheet: addCssStyleSheet
1848
- };
1849
-
1850
- const Css_ipc = {
1851
- __proto__: null,
1852
- Commands: Commands$w,
1853
- name: name$v
1778
+ // src/parts/ComponentUid/ComponentUid.ts
1779
+ var uidSymbol = Symbol("uid");
1780
+ var setComponentUid = ($Element, uid) => {
1781
+ $Element[uidSymbol] = uid;
1854
1782
  };
1855
-
1856
- const modules = ['ActivityBar', 'Ajax', 'Allocator', 'Callback', 'Command', 'Context', 'ContextMenu', 'Delay', 'Developer', 'DomPool', 'Editor', 'Exec', 'ExtensionHost', 'FileSystem', 'KeyBindings', 'Layout', 'Main', 'Notification', 'Panel', 'Parts', 'QuickPick', 'Renderer', 'RendererWorker', 'Search', 'SharedProcess', 'SideBar', 'StatusBar', 'TitleBar', 'Viewlet', 'ViewletController', 'ViewService', 'Vscode', 'Window', 'Workbench', 'Worker', 'Workspace'];
1857
-
1858
- // TODO send to renderer worker -> renderer worker has all state
1859
- const showState = async () => {
1860
- const state = Object.create(null);
1861
- for (const module of modules) {
1862
- let imported;
1863
- try {
1864
- imported = await import(`../${module}/${module}.js`);
1865
- } catch {}
1866
- if (imported?.state) {
1867
- state[module] = imported.state;
1783
+ var getUidTarget = $Element => {
1784
+ while ($Element) {
1785
+ if ($Element[uidSymbol]) {
1786
+ return $Element;
1868
1787
  }
1788
+ $Element = $Element.parentNode;
1869
1789
  }
1870
- info(state);
1790
+ return void 0;
1871
1791
  };
1872
-
1873
- const name$u = 'Developer';
1874
- const Commands$v = {
1875
- showState: showState
1792
+ var getComponentUid = $Element => {
1793
+ const $Target = getUidTarget($Element);
1794
+ return $Target[uidSymbol];
1876
1795
  };
1877
-
1878
- const Developer_ipc = {
1879
- __proto__: null,
1880
- Commands: Commands$v,
1881
- name: name$u
1796
+ var getComponentUidFromEvent = event => {
1797
+ const {
1798
+ target,
1799
+ currentTarget
1800
+ } = event;
1801
+ return getComponentUid(currentTarget || target);
1882
1802
  };
1883
1803
 
1884
- const downloadFile = (fileName, url) => {
1885
- const a = document.createElement('a');
1886
- a.href = url;
1887
- a.download = fileName;
1888
- a.click();
1804
+ // src/parts/IpcState/IpcState.ts
1805
+ var state$8 = {
1806
+ ipc: void 0
1889
1807
  };
1890
-
1891
- const name$t = 'Download';
1892
- const Commands$u = {
1893
- downloadFile: downloadFile
1808
+ var getIpc = () => {
1809
+ return state$8.ipc;
1894
1810
  };
1895
-
1896
- const Download_ipc = {
1897
- __proto__: null,
1898
- Commands: Commands$u,
1899
- name: name$t
1811
+ var setIpc = value => {
1812
+ state$8.ipc = value;
1900
1813
  };
1901
1814
 
1902
- // based on https://github.com/microsoft/vscode/blob/5f87632829dc3ac80203e2377727935184399431/src/vs/base/browser/ui/aria/aria.ts (License MIT)
1903
-
1904
- const state$7 = {
1905
- $AriaAlert1: undefined,
1906
- $AriaAlert2: undefined,
1907
- $AriaMessages: undefined
1908
- };
1909
- const getAriaAlert1 = () => {
1910
- return state$7.$AriaAlert1;
1911
- };
1912
- const getAriaAlert2 = () => {
1913
- return state$7.$AriaAlert2;
1914
- };
1915
- const setElements = ($AriaMessages, $AriaAlert1, $AriaAlert2) => {
1916
- state$7.$AriaMessages = $AriaMessages;
1917
- state$7.$AriaAlert1 = $AriaAlert1;
1918
- state$7.$AriaAlert2 = $AriaAlert2;
1919
- };
1920
- const hasElements = () => {
1921
- return state$7.$AriaMessages;
1815
+ // src/parts/ClearNode/ClearNode.ts
1816
+ var clearNode = $Node => {
1817
+ $Node.textContent = "";
1922
1818
  };
1923
1819
 
1924
- const True = 'true';
1925
- const False = 'false';
1926
-
1927
- const Alert = 'alert';
1928
- const Application = 'application';
1929
- const Code = 'code';
1930
- const Complementary = 'complementary';
1931
- const ContentInfo = 'contentinfo';
1932
- const Group = 'group';
1933
- const List$1 = 'list';
1934
- const ListBox = 'listbox';
1935
- const Log = 'log';
1936
- const Main$1 = 'main';
1937
- const Menu = 'menu';
1938
- const None$2 = 'none';
1939
- const Status = 'status';
1940
- const TabList = 'tablist';
1941
- const TextBox = 'textbox';
1942
- const ToolBar = 'toolbar';
1943
- const Tree = 'tree';
1944
- const ComboBox = 'combobox';
1945
-
1946
- const AriaOwns = 'aria-owns';
1947
- const AriaLabelledBy = 'aria-labelledby';
1948
- const AriaDescribedBy = 'aria-describedby';
1949
- const AriaActiveDescendant = 'aria-activedescendant';
1950
- const AriaSelected = 'aria-selected';
1951
- const AriaControls = 'aria-controls';
1952
- const AriaHidden = 'aria-hidden';
1953
-
1954
- // based on https://github.com/microsoft/vscode/blob/5f87632829dc3ac80203e2377727935184399431/src/vs/base/browser/ui/aria/aria.ts (License MIT)
1955
- const create$AriaAlert = () => {
1956
- const $AriaAlert = document.createElement('div');
1957
- $AriaAlert.className = 'AriaAlert';
1958
- $AriaAlert.role = Alert;
1959
- $AriaAlert.ariaAtomic = True;
1960
- return $AriaAlert;
1961
- };
1962
- const setMessage$3 = ($Old, $New, message) => {
1963
- $Old.textContent = String(Math.random());
1964
- $Old.ariaHidden = True;
1965
- $New.removeAttribute(AriaHidden);
1966
- $New.textContent = message;
1967
- };
1968
- const alert$1 = message => {
1969
- if (!message) {
1970
- return;
1971
- }
1972
- if (!hasElements()) {
1973
- const $AriaAlert1 = create$AriaAlert();
1974
- const $AriaAlert2 = create$AriaAlert();
1975
- // TODO find better name, for example AriaMessages, AriaOutlet, AriaContainer, ScreenReaderMessages
1976
- const $AriaMessages = document.createElement('div');
1977
- $AriaMessages.className = 'AriaContainer';
1978
- $AriaMessages.append($AriaAlert1, $AriaAlert2);
1979
- document.body.append($AriaMessages);
1980
- setElements($AriaMessages, $AriaAlert1, $AriaAlert2);
1981
- }
1982
- const $AriaAlert1 = getAriaAlert1();
1983
- const $AriaAlert2 = getAriaAlert2();
1984
- // @ts-expect-error
1985
- if ($AriaAlert1.textContent === message) {
1986
- setMessage$3($AriaAlert1, $AriaAlert2, message);
1987
- } else {
1988
- setMessage$3($AriaAlert2, $AriaAlert1, message);
1989
- }
1990
- };
1820
+ // src/parts/ElementTags/ElementTags.ts
1821
+ var Audio$2 = "audio";
1822
+ var Button = "button";
1823
+ var Col = "col";
1824
+ var ColGroup = "colgroup";
1825
+ var Del = "del";
1826
+ var Div = "div";
1827
+ var H1 = "h1";
1828
+ var H2 = "h2";
1829
+ var H3 = "h3";
1830
+ var H4 = "h4";
1831
+ var H5 = "h5";
1832
+ var H6 = "h6";
1833
+ var I = "i";
1834
+ var Img = "img";
1835
+ var Input$1 = "input";
1836
+ var Ins = "ins";
1837
+ var Kbd = "kbd";
1838
+ var Span = "span";
1839
+ var Table = "table";
1840
+ var TBody = "tbody";
1841
+ var Td = "td";
1842
+ var Th = "th";
1843
+ var THead = "thead";
1844
+ var Tr = "tr";
1845
+ var Article = "article";
1846
+ var Aside = "aside";
1847
+ var Footer = "footer";
1848
+ var Header = "header";
1849
+ var Nav = "nav";
1850
+ var Section = "section";
1851
+ var Search$1 = "search";
1852
+ var Dd = "dd";
1853
+ var Dl = "dl";
1854
+ var Figcaption = "figcaption";
1855
+ var Figure = "figure";
1856
+ var Hr = "hr";
1857
+ var Li = "li";
1858
+ var Ol = "ol";
1859
+ var P = "p";
1860
+ var Pre = "pre";
1861
+ var A = "a";
1862
+ var Br = "br";
1863
+ var Cite = "cite";
1864
+ var Data = "data";
1865
+ var Time$1 = "time";
1866
+ var Tfoot = "tfoot";
1867
+ var Ul = "ul";
1868
+ var Video$1 = "video";
1869
+ var TextArea = "textarea";
1870
+ var Select = "select";
1871
+ var Option = "option";
1991
1872
 
1992
- const AriaAlert = {
1993
- __proto__: null,
1994
- alert: alert$1
1995
- };
1873
+ // src/parts/VirtualDomElements/VirtualDomElements.ts
1874
+ var Audio2 = 0;
1875
+ var Button2 = 1;
1876
+ var Col2 = 2;
1877
+ var ColGroup2 = 3;
1878
+ var Div2 = 4;
1879
+ var H12 = 5;
1880
+ var Input2 = 6;
1881
+ var Kbd2 = 7;
1882
+ var Span2 = 8;
1883
+ var Table2 = 9;
1884
+ var TBody2 = 10;
1885
+ var Td2 = 11;
1886
+ var Text$2 = 12;
1887
+ var Th2 = 13;
1888
+ var THead2 = 14;
1889
+ var Tr2 = 15;
1890
+ var I2 = 16;
1891
+ var Img2 = 17;
1892
+ var Ins2 = 20;
1893
+ var Del2 = 21;
1894
+ var H22 = 22;
1895
+ var H32 = 23;
1896
+ var H42 = 24;
1897
+ var H52 = 25;
1898
+ var H62 = 26;
1899
+ var Article2 = 27;
1900
+ var Aside2 = 28;
1901
+ var Footer2 = 29;
1902
+ var Header2 = 30;
1903
+ var Nav2 = 40;
1904
+ var Section2 = 41;
1905
+ var Search2 = 42;
1906
+ var Dd2 = 43;
1907
+ var Dl2 = 44;
1908
+ var Figcaption2 = 45;
1909
+ var Figure2 = 46;
1910
+ var Hr2 = 47;
1911
+ var Li2 = 48;
1912
+ var Ol2 = 49;
1913
+ var P2 = 50;
1914
+ var Pre2 = 51;
1915
+ var A2 = 53;
1916
+ var Br2 = 55;
1917
+ var Cite2 = 56;
1918
+ var Data2 = 57;
1919
+ var Time2 = 58;
1920
+ var Tfoot2 = 59;
1921
+ var Ul2 = 60;
1922
+ var Video2 = 61;
1923
+ var TextArea2 = 62;
1924
+ var Select2 = 63;
1925
+ var Option2 = 64;
1996
1926
 
1997
- // TODO this file is not needed when all elements are position fixed
1998
- const state$6 = {
1999
- isInDom: false,
2000
- $PreviousFocusElement: undefined,
2001
- widgetSet: new Set(),
2002
- $Widgets: undefined
2003
- };
2004
- const create$Widgets = () => {
2005
- const $Widgets = document.createElement('div');
2006
- $Widgets.id = 'Widgets';
2007
- $Widgets.className = 'Widgets';
2008
- return $Widgets;
2009
- };
2010
- const append$1 = $Element => {
2011
- // TODO should not call append in the first place if it is already in dom
2012
- if (state$6.widgetSet.has($Element)) {
2013
- return;
2014
- }
2015
- state$6.widgetSet.add($Element);
2016
- if (state$6.$Widgets) {
2017
- // @ts-expect-error
2018
- state$6.$Widgets.append($Element);
2019
- } else {
2020
- // @ts-expect-error
2021
- state$6.$Widgets = create$Widgets();
2022
- // @ts-expect-error
2023
- state$6.$Widgets.append($Element);
2024
- // @ts-expect-error
2025
- document.body.append(state$6.$Widgets);
2026
- }
2027
- };
2028
- const remove$1 = $Element => {
2029
- if (!$Element) {
2030
- // TODO $Element should always be defined
2031
- return;
2032
- }
2033
- state$6.widgetSet.delete($Element);
2034
- $Element.remove();
2035
- // TODO state.$Widgets should always be defined at this point
2036
- if (state$6.widgetSet.size === 0 && state$6.$Widgets) {
2037
- // @ts-expect-error
2038
- state$6.$Widgets.remove();
2039
- state$6.$Widgets = undefined;
1927
+ // src/parts/ElementTagMap/ElementTagMap.ts
1928
+ var getElementTag = type => {
1929
+ switch (type) {
1930
+ case Audio2:
1931
+ return Audio$2;
1932
+ case H12:
1933
+ return H1;
1934
+ case H22:
1935
+ return H2;
1936
+ case H32:
1937
+ return H3;
1938
+ case H42:
1939
+ return H4;
1940
+ case H52:
1941
+ return H5;
1942
+ case H62:
1943
+ return H6;
1944
+ case Div2:
1945
+ return Div;
1946
+ case Kbd2:
1947
+ return Kbd;
1948
+ case Table2:
1949
+ return Table;
1950
+ case TBody2:
1951
+ return TBody;
1952
+ case Th2:
1953
+ return Th;
1954
+ case Td2:
1955
+ return Td;
1956
+ case THead2:
1957
+ return THead;
1958
+ case Tr2:
1959
+ return Tr;
1960
+ case Input2:
1961
+ return Input$1;
1962
+ case ColGroup2:
1963
+ return ColGroup;
1964
+ case Col2:
1965
+ return Col;
1966
+ case Button2:
1967
+ return Button;
1968
+ case Span2:
1969
+ return Span;
1970
+ case I2:
1971
+ return I;
1972
+ case Img2:
1973
+ return Img;
1974
+ case Ins2:
1975
+ return Ins;
1976
+ case Del2:
1977
+ return Del;
1978
+ case Article2:
1979
+ return Article;
1980
+ case Aside2:
1981
+ return Aside;
1982
+ case Footer2:
1983
+ return Footer;
1984
+ case Header2:
1985
+ return Header;
1986
+ case Nav2:
1987
+ return Nav;
1988
+ case Section2:
1989
+ return Section;
1990
+ case Search2:
1991
+ return Search$1;
1992
+ case Dd2:
1993
+ return Dd;
1994
+ case Dl2:
1995
+ return Dl;
1996
+ case Figcaption2:
1997
+ return Figcaption;
1998
+ case Figure2:
1999
+ return Figure;
2000
+ case Hr2:
2001
+ return Hr;
2002
+ case Li2:
2003
+ return Li;
2004
+ case Ol2:
2005
+ return Ol;
2006
+ case P2:
2007
+ return P;
2008
+ case Pre2:
2009
+ return Pre;
2010
+ case A2:
2011
+ return A;
2012
+ case Br2:
2013
+ return Br;
2014
+ case Cite2:
2015
+ return Cite;
2016
+ case Data2:
2017
+ return Data;
2018
+ case Time2:
2019
+ return Time$1;
2020
+ case Tfoot2:
2021
+ return Tfoot;
2022
+ case Ul2:
2023
+ return Ul;
2024
+ case Video2:
2025
+ return Video$1;
2026
+ case TextArea2:
2027
+ return TextArea;
2028
+ case Select2:
2029
+ return Select;
2030
+ case Option2:
2031
+ return Option;
2032
+ default:
2033
+ throw new Error(`element tag not found ${type}`);
2040
2034
  }
2041
2035
  };
2042
2036
 
2043
- // TODO not sure whether created dom node
2044
- // should stay in state or be removed
2045
- // one option would result in less memory usage
2046
- // the other option would result in less garbage collection
2047
-
2048
- // probably should optimize for less memory usage by default
2049
- // unless the element is very likely to be used again soon (<30s)
2050
- // but that's difficult to know
2051
-
2052
- // TODO hide widget after timeout or mousemove
2053
- const create$J = (message, x, y) => {
2054
- const $EditorError = document.createElement('div');
2055
- $EditorError.className = 'EditorWidgetError';
2056
- $EditorError.textContent = message;
2057
- $EditorError.style.left = `${x}px`;
2058
- $EditorError.style.top = `${y}px`;
2059
- alert$1(message);
2060
- append$1($EditorError);
2061
- return {
2062
- $EditorError
2063
- };
2064
- };
2065
-
2066
- const name$s = 'EditorError';
2067
- const Commands$t = {
2068
- create: create$J
2037
+ // src/parts/GetEventListenerOptions/GetEventListenerOptions.ts
2038
+ var getEventListenerOptions$1 = eventName => {
2039
+ switch (eventName) {
2040
+ case "wheel":
2041
+ return {
2042
+ passive: true
2043
+ };
2044
+ default:
2045
+ return void 0;
2046
+ }
2069
2047
  };
2070
2048
 
2071
- const EditorError_ipc = {
2072
- __proto__: null,
2073
- Commands: Commands$t,
2074
- name: name$s
2049
+ // src/parts/NameAnonymousFunction/NameAnonymousFunction.ts
2050
+ var nameAnonymousFunction$1 = (fn, name) => {
2051
+ Object.defineProperty(fn, "name", {
2052
+ value: name
2053
+ });
2075
2054
  };
2076
2055
 
2077
- const state$5 = {
2078
- /**
2079
- * @type {HTMLElement|undefined}
2080
- */
2081
- $PreviousFocusElement: undefined,
2082
- currentFocus: ''
2083
- };
2084
- const setElement = $Element => {
2085
- state$5.$PreviousFocusElement = $Element;
2086
- };
2087
- const getElement = () => {
2088
- return state$5.$PreviousFocusElement;
2056
+ // src/parts/GetWrappedListener/GetWrappedListener.ts
2057
+ var cache$1 = /* @__PURE__ */new Map();
2058
+ var getWrappedListener$1 = (listener, returnValue) => {
2059
+ if (!returnValue) {
2060
+ return listener;
2061
+ }
2062
+ if (!cache$1.has(listener)) {
2063
+ const wrapped = event => {
2064
+ const uid = getComponentUidFromEvent(event);
2065
+ const result = listener(event);
2066
+ if (result.length === 0) {
2067
+ return;
2068
+ }
2069
+ const ipc = getIpc();
2070
+ ipc.send("Viewlet.executeViewletCommand", uid, ...result);
2071
+ };
2072
+ nameAnonymousFunction$1(wrapped, listener.name);
2073
+ cache$1.set(listener, wrapped);
2074
+ }
2075
+ return cache$1.get(listener);
2089
2076
  };
2090
2077
 
2091
- const focus$i = $Element => {
2092
- if ($Element === document.activeElement) {
2078
+ // src/parts/AttachEvent/AttachEvent.ts
2079
+ var attachEvent$1 = ($Node, eventMap, key, value) => {
2080
+ const listener = eventMap[value];
2081
+ if (!listener) {
2082
+ console.warn("listener not found", value);
2093
2083
  return;
2094
2084
  }
2095
- setElement(document.activeElement);
2096
- $Element.focus({
2097
- preventScroll: true
2098
- });
2085
+ const options = getEventListenerOptions$1(eventMap);
2086
+ const wrapped = getWrappedListener$1(listener, eventMap.returnValue);
2087
+ $Node.addEventListener(key, wrapped, options);
2099
2088
  };
2100
- const focusPrevious$1 = () => {
2101
- const $Element = getElement();
2102
- if ($Element) {
2103
- // @ts-expect-error
2104
- $Element.focus();
2089
+
2090
+ // src/parts/VirtualDomElementProp/VirtualDomElementProp.ts
2091
+ var setProp = ($Element, key, value, eventMap) => {
2092
+ switch (key) {
2093
+ case "maskImage":
2094
+ $Element.style.maskImage = `url('${value}')`;
2095
+ $Element.style.webkitMaskImage = `url('${value}')`;
2096
+ break;
2097
+ case "paddingLeft":
2098
+ case "paddingRight":
2099
+ case "top":
2100
+ case "left":
2101
+ case "marginTop":
2102
+ $Element.style[key] = typeof value === "number" ? `${value}px` : value;
2103
+ break;
2104
+ case "translate":
2105
+ $Element.style[key] = value;
2106
+ break;
2107
+ case "width":
2108
+ case "height":
2109
+ if ($Element instanceof HTMLImageElement) {
2110
+ $Element[key] = value;
2111
+ } else if (typeof value === "number") {
2112
+ $Element.style[key] = `${value}px`;
2113
+ } else {
2114
+ $Element.style[key] = value;
2115
+ }
2116
+ break;
2117
+ case "style":
2118
+ throw new Error("style property is not supported");
2119
+ case "childCount":
2120
+ case "type":
2121
+ break;
2122
+ case "ariaOwns":
2123
+ if (value) {
2124
+ $Element.setAttribute("aria-owns", value);
2125
+ } else {
2126
+ $Element.removeAttribute("aria-owns");
2127
+ }
2128
+ break;
2129
+ case "inputType":
2130
+ $Element.type = value;
2131
+ break;
2132
+ case "ariaLabelledBy":
2133
+ $Element.setAttribute("aria-labelledby", value);
2134
+ break;
2135
+ case "onBlur":
2136
+ case "onChange":
2137
+ case "onClick":
2138
+ case "onContextMenu":
2139
+ case "onDblClick":
2140
+ case "onFocus":
2141
+ case "onFocusIn":
2142
+ case "onFocusIn":
2143
+ case "onFocusOut":
2144
+ case "onInput":
2145
+ case "onKeyDown":
2146
+ case "onMouseDown":
2147
+ case "onPointerDown":
2148
+ case "onPointerOut":
2149
+ case "onPointerOver":
2150
+ case "onWheel":
2151
+ const eventName = key.slice(2).toLowerCase();
2152
+ if (!eventMap || !value) {
2153
+ return;
2154
+ }
2155
+ attachEvent$1($Element, eventMap, eventName, value);
2156
+ break;
2157
+ default:
2158
+ if (key.startsWith("data-")) {
2159
+ $Element.dataset[key.slice("data-".length)] = value;
2160
+ } else {
2161
+ $Element[key] = value;
2162
+ }
2105
2163
  }
2106
2164
  };
2107
2165
 
2108
- const create$I = () => {
2109
- const $InputBox = document.createElement('input');
2110
- $InputBox.className = 'InputBox';
2111
- $InputBox.spellcheck = false;
2112
- $InputBox.autocapitalize = 'off';
2113
- // $InputBox.autocomplete = 'off' // TODO needed?
2114
- $InputBox.type = 'text';
2115
- $InputBox.setAttribute('autocorrect', 'off'); // for ios
2116
- return $InputBox;
2117
- };
2118
-
2119
- const setBounds$6 = ($Element, x, y, width, height) => {
2120
- $Element.style.top = `${y}px`;
2121
- $Element.style.left = `${x}px`;
2122
- $Element.style.width = `${width}px`;
2123
- $Element.style.height = `${height}px`;
2124
- };
2125
- const setYAndHeight = ($Element, y, height) => {
2126
- if (!$Element) {
2127
- return;
2166
+ // src/parts/VirtualDomElementProps/VirtualDomElementProps.ts
2167
+ var setProps = ($Element, props, eventMap) => {
2168
+ for (const key in props) {
2169
+ setProp($Element, key, props[key], eventMap);
2128
2170
  }
2129
- $Element.style.translate = typeof y === 'string' ? y : `0 ${y}px`;
2130
- $Element.style.height = typeof height === 'string' ? height : `${height}px`;
2131
- };
2132
- const setXAndWidth = ($Element, x, width) => {
2133
- $Element.style.translate = `${x}px 0`;
2134
- $Element.style.width = `${width}px`;
2135
- };
2136
- const setTop = ($Element, top) => {
2137
- $Element.style.top = `${top}px`;
2138
- };
2139
- const setWidth = ($Element, width) => {
2140
- $Element.style.width = `${width}px`;
2141
- };
2142
- const setXAndY = ($Element, x, y) => {
2143
- $Element.style.left = `${x}px`;
2144
- $Element.style.top = `${y}px`;
2145
- };
2146
-
2147
- /**
2148
- *
2149
- * @param {HTMLElement} $Element
2150
- * @param {number} x
2151
- * @param {number} y
2152
- */
2153
- const setXAndYTransform = ($Element, x, y) => {
2154
- $Element.style.translate = `${x}px ${y}px`;
2155
- };
2156
- const setHeight = ($Element, height) => {
2157
- $Element.style.height = `${height}px`;
2158
2171
  };
2159
2172
 
2160
- const FocusDebugInput = 6;
2161
- const FocusEditorRename = 11;
2162
- const FocusExplorer = 13;
2163
- const FocusExplorerEditBox = 14;
2164
- const FocusLocationList = 17;
2165
- const FocusMenu = 18;
2166
- const FocusQuickPickInput = 20;
2167
- const FocusSearchInput = 21;
2168
- const FocusSimpleBrowserInput = 23;
2169
- const FocusOutput = 28;
2170
-
2171
- const handleBlur$a = () => {
2172
- send( /* EditorRename.abort */'EditorRename.abort');
2173
+ // src/parts/VirtualDomElement/VirtualDomElement.ts
2174
+ var renderDomTextNode = element => {
2175
+ return document.createTextNode(element.text);
2173
2176
  };
2174
- const create$H = (x, y) => {
2175
- const $RenameWidgetInputBox = create$I();
2176
- $RenameWidgetInputBox.className = 'RenameWidgetInputBox';
2177
- $RenameWidgetInputBox.onblur = handleBlur$a;
2178
- const $RenameWidget = document.createElement('div');
2179
- $RenameWidget.className = 'RenameWidget';
2180
- $RenameWidget.append($RenameWidgetInputBox);
2181
- setXAndY($RenameWidget, x, y);
2182
- append$1($RenameWidget);
2183
- focus$i($RenameWidgetInputBox);
2184
- send('Focus.setFocus', FocusEditorRename);
2185
- return {
2186
- $RenameWidget,
2187
- $RenameWidgetInputBox
2188
- };
2177
+ var renderDomElement = (element, eventMap) => {
2178
+ const tag = getElementTag(element.type);
2179
+ const $Element = document.createElement(tag);
2180
+ setProps($Element, element, eventMap);
2181
+ return $Element;
2189
2182
  };
2190
- const dispose$i = state => {
2191
- // TODO focus editor
2192
- remove$1(state.$RenameWidget);
2183
+ var render = (element, eventMap) => {
2184
+ switch (element.type) {
2185
+ case Text$2:
2186
+ return renderDomTextNode(element);
2187
+ default:
2188
+ return renderDomElement(element, eventMap);
2189
+ }
2193
2190
  };
2194
2191
 
2195
- // TODO could also be event based
2196
- // finish -> finish -> finishWithValue
2197
-
2198
- const finish = state => {
2199
- const value = state.$RenameWidgetInputBox.value;
2200
- // TODO don't like side effect here
2201
- return value;
2192
+ // src/parts/RenderInternal/RenderInternal.ts
2193
+ var renderInternal2 = ($Parent, elements, eventMap) => {
2194
+ const max = elements.length - 1;
2195
+ let stack = [];
2196
+ for (let i = max; i >= 0; i--) {
2197
+ const element = elements[i];
2198
+ const $Element = render(element, eventMap);
2199
+ if (element.childCount > 0) {
2200
+ $Element.append(...stack.slice(0, element.childCount));
2201
+ stack = stack.slice(element.childCount);
2202
+ }
2203
+ stack.unshift($Element);
2204
+ }
2205
+ $Parent.append(...stack);
2202
2206
  };
2203
2207
 
2204
- const name$r = 'EditorRename';
2205
- const Commands$s = {
2206
- create: create$H,
2207
- dispose: dispose$i,
2208
- finish: finish
2208
+ // src/parts/VirtualDom/VirtualDom.ts
2209
+ var renderInto = ($Parent, dom, eventMap = {}) => {
2210
+ clearNode($Parent);
2211
+ renderInternal2($Parent, dom, eventMap);
2209
2212
  };
2210
-
2211
- const EditorRename_ipc = {
2212
- __proto__: null,
2213
- Commands: Commands$s,
2214
- name: name$r
2213
+ var render2 = (elements, eventMap = {}) => {
2214
+ const $Root = document.createElement("div");
2215
+ renderInternal2($Root, elements, eventMap);
2216
+ return $Root;
2215
2217
  };
2216
2218
 
2217
- const showDirectoryPicker = options => {
2218
- // @ts-expect-error
2219
- return window.showDirectoryPicker(options);
2219
+ // src/parts/RememberFocus/RememberFocus.ts
2220
+ var queryInputs = $Viewlet => {
2221
+ return [...$Viewlet.querySelectorAll("input, textarea")];
2220
2222
  };
2221
- const showFilePicker = options => {
2222
- // @ts-expect-error
2223
- return window.showFilePicker(options);
2224
- };
2225
- const showSaveFilePicker = options => {
2226
- // @ts-expect-error
2227
- return window.showSaveFilePicker(options);
2223
+ var rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
2224
+ const oldLeft = $Viewlet.style.left;
2225
+ const oldTop = $Viewlet.style.top;
2226
+ const oldWidth = $Viewlet.style.width;
2227
+ const oldHeight = $Viewlet.style.height;
2228
+ const focused = document.activeElement.getAttribute("name");
2229
+ const $$Inputs = queryInputs($Viewlet);
2230
+ const inputMap = /* @__PURE__ */Object.create(null);
2231
+ for (const $Input of $$Inputs) {
2232
+ inputMap[$Input.name] = $Input.value;
2233
+ }
2234
+ if (uid) {
2235
+ const $New = render2(dom, eventMap).firstChild;
2236
+ setComponentUid($New, uid);
2237
+ $Viewlet.replaceWith($New);
2238
+ $Viewlet = $New;
2239
+ } else {
2240
+ renderInto($Viewlet, dom, eventMap);
2241
+ }
2242
+ const $$NewInputs = queryInputs($Viewlet);
2243
+ for (const $Input of $$NewInputs) {
2244
+ $Input.value = inputMap[$Input.name] || $Input.value || "";
2245
+ }
2246
+ if (focused) {
2247
+ const $Focused = $Viewlet.querySelector(`[name="${focused}"]`);
2248
+ if ($Focused) {
2249
+ $Focused.focus();
2250
+ }
2251
+ }
2252
+ $Viewlet.style.top = oldTop;
2253
+ $Viewlet.style.left = oldLeft;
2254
+ $Viewlet.style.height = oldHeight;
2255
+ $Viewlet.style.width = oldWidth;
2256
+ return $Viewlet;
2228
2257
  };
2229
2258
 
2230
- const name$q = 'FilePicker';
2231
- const Commands$r = {
2232
- showDirectoryPicker: showDirectoryPicker,
2233
- showFilePicker: showFilePicker,
2234
- showSaveFilePicker: showSaveFilePicker
2259
+ const main = async () => {
2260
+ onerror = handleUnhandledError;
2261
+ onunhandledrejection = handleUnhandledRejection;
2262
+ if ('SecurityPolicyViolationEvent' in self) {
2263
+ self.addEventListener('securitypolicyviolation', handleContentSecurityPolicyViolation);
2264
+ }
2265
+ setLoad(load$1);
2266
+ if (platform === Web) {
2267
+ // disable prompt to download app as pwa
2268
+ // @ts-expect-error
2269
+ window.onbeforeinstallprompt = handleBeforeInstallPrompt;
2270
+ }
2271
+ // TODO this is discovered very late
2272
+ await hydrate$1();
2273
+ setIpc(RendererWorker);
2235
2274
  };
2236
2275
 
2237
- const FilePicker_ipc = {
2238
- __proto__: null,
2239
- Commands: Commands$r,
2240
- name: name$q
2241
- };
2276
+ main();
2242
2277
 
2243
- const requestPermission = (handle, options) => {
2244
- return handle.requestPermission(options);
2278
+ const play = async src => {
2279
+ const audio = new Audio(src);
2280
+ await audio.play();
2245
2281
  };
2246
2282
 
2247
- const name$p = 'FileSystemHandle';
2248
- const Commands$q = {
2249
- requestPermission: requestPermission
2283
+ const name$y = 'Audio';
2284
+ const Commands$z = {
2285
+ play: play
2250
2286
  };
2251
2287
 
2252
- const FileSystemHandle_ipc = {
2288
+ const Audio_ipc = {
2253
2289
  __proto__: null,
2254
- Commands: Commands$q,
2255
- name: name$p
2290
+ Commands: Commands$z,
2291
+ name: name$y
2256
2292
  };
2257
2293
 
2258
- const handleImageLoad = event => {
2259
- const $ImagePreviewImage = event.target;
2260
- const $ImagePreviewCaption = $ImagePreviewImage.nextSibling;
2261
- const width = $ImagePreviewImage.naturalWidth;
2262
- const height = $ImagePreviewImage.naturalHeight;
2263
- $ImagePreviewCaption.textContent = `${width} × ${height}`;
2264
- };
2265
- const handleImageError$1 = event => {
2266
- const $ImagePreviewImage = event.target;
2267
- const $ImagePreviewCaption = $ImagePreviewImage.nextSibling;
2268
- $ImagePreviewCaption.textContent = 'Image could not be loaded';
2294
+ const readText = async () => {
2295
+ return navigator.clipboard.readText();
2269
2296
  };
2270
-
2271
- // TODO duplicate code with below
2272
-
2273
- const showError = (message, y, x) => {
2274
- const $ImagePreviewImage = document.createElement('img');
2275
- $ImagePreviewImage.className = 'ImagePreviewImage';
2276
- $ImagePreviewImage.alt = '';
2277
- const $ImagePreviewCaption = document.createElement('figcaption');
2278
- $ImagePreviewCaption.className = 'ImagePreviewCaption';
2279
- $ImagePreviewCaption.textContent = message;
2280
- const $ImagePreview = document.createElement('figure');
2281
- $ImagePreview.className = 'ImagePreview';
2282
- $ImagePreview.append($ImagePreviewImage, $ImagePreviewCaption);
2283
- setXAndY($ImagePreview, x, y);
2284
- $ImagePreview.style.display = 'none';
2285
- append$1($ImagePreview);
2286
- return {
2287
- $ImagePreview,
2288
- $ImagePreviewCaption,
2289
- $ImagePreviewImage
2290
- };
2297
+ const writeText = async text => {
2298
+ string(text);
2299
+ await navigator.clipboard.writeText(text);
2291
2300
  };
2292
- const create$G = (uri, top, left) => {
2293
- const $ImagePreviewImage = document.createElement('img');
2294
- $ImagePreviewImage.className = 'ImagePreviewImage';
2295
- $ImagePreviewImage.src = uri;
2296
- $ImagePreviewImage.alt = '';
2297
- const $ImagePreviewCaption = document.createElement('figcaption');
2298
- $ImagePreviewCaption.className = 'ImagePreviewCaption';
2299
- const $ImagePreview = document.createElement('figure');
2300
- $ImagePreview.className = 'ImagePreview';
2301
- $ImagePreview.append($ImagePreviewImage, $ImagePreviewCaption);
2302
- $ImagePreviewImage.onload = handleImageLoad;
2303
- $ImagePreviewImage.onerror = handleImageError$1;
2304
- $ImagePreview.style.top = `${top}px`;
2305
- $ImagePreview.style.left = `${left}px`;
2306
- $ImagePreview.style.display = 'none';
2307
- append$1($ImagePreview);
2308
- return {
2309
- $ImagePreview,
2310
- $ImagePreviewCaption,
2311
- $ImagePreviewImage
2312
- };
2301
+ const writeImage = async blob => {
2302
+ await navigator.clipboard.write([new ClipboardItem({
2303
+ [blob.type]: blob
2304
+ })]);
2313
2305
  };
2314
- const update = (state, uri) => {
2315
- state.$ImagePreviewImage.uri = uri;
2306
+ const execCopy = async () => {
2307
+ // @ts-expect-error
2308
+ const text = getSelection().toString();
2309
+ await writeText(text);
2316
2310
  };
2317
- const dispose$h = state => {
2318
- remove$1(state.$ImagePreview);
2311
+
2312
+ const name$x = 'ClipBoard';
2313
+ const Commands$y = {
2314
+ execCopy: execCopy,
2315
+ readText: readText,
2316
+ writeImage: writeImage,
2317
+ writeText: writeText
2319
2318
  };
2320
2319
 
2321
- const ImagePreview$1 = {
2320
+ const ClipBoard_ipc = {
2322
2321
  __proto__: null,
2323
- create: create$G,
2324
- dispose: dispose$h,
2325
- showError,
2326
- update
2322
+ Commands: Commands$y,
2323
+ name: name$x
2327
2324
  };
2328
2325
 
2329
- const name$o = 'ImagePreview';
2330
- const Commands$p = {
2331
- create: create$G,
2332
- dispose: dispose$h,
2333
- showError: showError,
2334
- update: update
2326
+ const prompt$1 = message => {
2327
+ return confirm(message);
2335
2328
  };
2336
2329
 
2337
- const ImagePreview_ipc = {
2330
+ const name$w = 'ConfirmPrompt';
2331
+ const Commands$x = {
2332
+ prompt: prompt$1
2333
+ };
2334
+
2335
+ const ConfirmPrompt_ipc = {
2338
2336
  __proto__: null,
2339
- Commands: Commands$p,
2340
- name: name$o
2337
+ Commands: Commands$x,
2338
+ name: name$w
2341
2339
  };
2342
2340
 
2343
- const getOrigin = () => {
2344
- return location.origin;
2341
+ const state$7 = {
2342
+ styleSheets: Object.create(null)
2345
2343
  };
2346
- const getPathName = () => {
2347
- return location.pathname;
2344
+ const set$4 = (id, sheet) => {
2345
+ state$7.styleSheets[id] = sheet;
2348
2346
  };
2349
- const getHref = () => {
2350
- return location.href;
2347
+ const get$5 = id => {
2348
+ return state$7.styleSheets[id];
2351
2349
  };
2352
2350
 
2353
- // TODO should do nothing if it is already at this path
2354
- const setPathName = pathName => {
2355
- const currentPathName = getPathName();
2356
- if (currentPathName === pathName) {
2351
+ const addCssStyleSheet = async (id, text) => {
2352
+ const existing = get$5(id);
2353
+ if (existing) {
2354
+ await existing.replace(text);
2357
2355
  return;
2358
2356
  }
2359
- // @ts-expect-error
2360
- history.pushState(null, null, pathName);
2361
- };
2362
- const hydrate = () => {
2363
- // addEventListener('popstate', handlePopState)
2357
+ const sheet = new CSSStyleSheet({});
2358
+ set$4(id, sheet);
2359
+ await sheet.replace(text);
2360
+ document.adoptedStyleSheets.push(sheet);
2364
2361
  };
2365
2362
 
2366
- const getTitleBarHeight = () => {
2367
- if (
2368
- // @ts-expect-error
2369
- navigator.windowControlsOverlay?.getTitlebarAreaRect) {
2370
- // @ts-expect-error
2371
- const titleBarRect = navigator.windowControlsOverlay.getTitlebarAreaRect();
2372
- return titleBarRect.height;
2373
- }
2374
- return 0;
2363
+ const name$v = 'Css';
2364
+ const Commands$w = {
2365
+ addCssStyleSheet: addCssStyleSheet
2375
2366
  };
2376
- const getBounds = () => {
2377
- return {
2378
- windowWidth: window.innerWidth,
2379
- windowHeight: window.innerHeight,
2380
- titleBarHeight: getTitleBarHeight()
2381
- };
2367
+
2368
+ const Css_ipc = {
2369
+ __proto__: null,
2370
+ Commands: Commands$w,
2371
+ name: name$v
2382
2372
  };
2383
2373
 
2384
- const getInitData = () => {
2385
- const initData = {
2386
- Location: {
2387
- href: getHref()
2388
- },
2389
- Layout: {
2390
- bounds: getBounds()
2374
+ const modules = ['ActivityBar', 'Ajax', 'Allocator', 'Callback', 'Command', 'Context', 'ContextMenu', 'Delay', 'Developer', 'DomPool', 'Editor', 'Exec', 'ExtensionHost', 'FileSystem', 'KeyBindings', 'Layout', 'Main', 'Notification', 'Panel', 'Parts', 'QuickPick', 'Renderer', 'RendererWorker', 'Search', 'SharedProcess', 'SideBar', 'StatusBar', 'TitleBar', 'Viewlet', 'ViewletController', 'ViewService', 'Vscode', 'Window', 'Workbench', 'Worker', 'Workspace'];
2375
+
2376
+ // TODO send to renderer worker -> renderer worker has all state
2377
+ const showState = async () => {
2378
+ const state = Object.create(null);
2379
+ for (const module of modules) {
2380
+ let imported;
2381
+ try {
2382
+ imported = await import(`../${module}/${module}.js`);
2383
+ } catch {}
2384
+ if (imported?.state) {
2385
+ state[module] = imported.state;
2391
2386
  }
2392
- };
2393
- return initData;
2387
+ }
2388
+ info(state);
2394
2389
  };
2395
2390
 
2396
- const name$n = 'InitData';
2397
- const Commands$o = {
2398
- getInitData: getInitData
2391
+ const name$u = 'Developer';
2392
+ const Commands$v = {
2393
+ showState: showState
2399
2394
  };
2400
2395
 
2401
- const InitData_ipc = {
2396
+ const Developer_ipc = {
2402
2397
  __proto__: null,
2403
- Commands: Commands$o,
2404
- name: name$n
2398
+ Commands: Commands$v,
2399
+ name: name$u
2405
2400
  };
2406
2401
 
2407
- const name$m = 'IpcParent';
2408
- const Commands$n = {
2409
- create: create$L
2402
+ const downloadFile = (fileName, url) => {
2403
+ const a = document.createElement('a');
2404
+ a.href = url;
2405
+ a.download = fileName;
2406
+ a.click();
2410
2407
  };
2411
2408
 
2412
- const IpcParent_ipc = {
2409
+ const name$t = 'Download';
2410
+ const Commands$u = {
2411
+ downloadFile: downloadFile
2412
+ };
2413
+
2414
+ const Download_ipc = {
2413
2415
  __proto__: null,
2414
- Commands: Commands$n,
2415
- name: name$m
2416
+ Commands: Commands$u,
2417
+ name: name$t
2416
2418
  };
2417
2419
 
2418
- const name$l = 'Layout';
2419
- const Commands$m = {
2420
- getBounds: getBounds
2420
+ // based on https://github.com/microsoft/vscode/blob/5f87632829dc3ac80203e2377727935184399431/src/vs/base/browser/ui/aria/aria.ts (License MIT)
2421
+
2422
+ const state$6 = {
2423
+ $AriaAlert1: undefined,
2424
+ $AriaAlert2: undefined,
2425
+ $AriaMessages: undefined
2426
+ };
2427
+ const getAriaAlert1 = () => {
2428
+ return state$6.$AriaAlert1;
2429
+ };
2430
+ const getAriaAlert2 = () => {
2431
+ return state$6.$AriaAlert2;
2432
+ };
2433
+ const setElements = ($AriaMessages, $AriaAlert1, $AriaAlert2) => {
2434
+ state$6.$AriaMessages = $AriaMessages;
2435
+ state$6.$AriaAlert1 = $AriaAlert1;
2436
+ state$6.$AriaAlert2 = $AriaAlert2;
2437
+ };
2438
+ const hasElements = () => {
2439
+ return state$6.$AriaMessages;
2440
+ };
2441
+
2442
+ const True = 'true';
2443
+ const False = 'false';
2444
+
2445
+ const Alert = 'alert';
2446
+ const Application = 'application';
2447
+ const Code = 'code';
2448
+ const Complementary = 'complementary';
2449
+ const ContentInfo = 'contentinfo';
2450
+ const Group = 'group';
2451
+ const List$1 = 'list';
2452
+ const ListBox = 'listbox';
2453
+ const Log = 'log';
2454
+ const Main$1 = 'main';
2455
+ const Menu = 'menu';
2456
+ const None$2 = 'none';
2457
+ const Status = 'status';
2458
+ const TabList = 'tablist';
2459
+ const TextBox = 'textbox';
2460
+ const ToolBar = 'toolbar';
2461
+ const Tree = 'tree';
2462
+ const ComboBox = 'combobox';
2463
+
2464
+ const AriaOwns = 'aria-owns';
2465
+ const AriaLabelledBy = 'aria-labelledby';
2466
+ const AriaDescribedBy = 'aria-describedby';
2467
+ const AriaActiveDescendant = 'aria-activedescendant';
2468
+ const AriaSelected = 'aria-selected';
2469
+ const AriaControls = 'aria-controls';
2470
+ const AriaHidden = 'aria-hidden';
2471
+
2472
+ // based on https://github.com/microsoft/vscode/blob/5f87632829dc3ac80203e2377727935184399431/src/vs/base/browser/ui/aria/aria.ts (License MIT)
2473
+ const create$AriaAlert = () => {
2474
+ const $AriaAlert = document.createElement('div');
2475
+ $AriaAlert.className = 'AriaAlert';
2476
+ $AriaAlert.role = Alert;
2477
+ $AriaAlert.ariaAtomic = True;
2478
+ return $AriaAlert;
2479
+ };
2480
+ const setMessage$3 = ($Old, $New, message) => {
2481
+ $Old.textContent = String(Math.random());
2482
+ $Old.ariaHidden = True;
2483
+ $New.removeAttribute(AriaHidden);
2484
+ $New.textContent = message;
2485
+ };
2486
+ const alert$1 = message => {
2487
+ if (!message) {
2488
+ return;
2489
+ }
2490
+ if (!hasElements()) {
2491
+ const $AriaAlert1 = create$AriaAlert();
2492
+ const $AriaAlert2 = create$AriaAlert();
2493
+ // TODO find better name, for example AriaMessages, AriaOutlet, AriaContainer, ScreenReaderMessages
2494
+ const $AriaMessages = document.createElement('div');
2495
+ $AriaMessages.className = 'AriaContainer';
2496
+ $AriaMessages.append($AriaAlert1, $AriaAlert2);
2497
+ document.body.append($AriaMessages);
2498
+ setElements($AriaMessages, $AriaAlert1, $AriaAlert2);
2499
+ }
2500
+ const $AriaAlert1 = getAriaAlert1();
2501
+ const $AriaAlert2 = getAriaAlert2();
2502
+ // @ts-expect-error
2503
+ if ($AriaAlert1.textContent === message) {
2504
+ setMessage$3($AriaAlert1, $AriaAlert2, message);
2505
+ } else {
2506
+ setMessage$3($AriaAlert2, $AriaAlert1, message);
2507
+ }
2421
2508
  };
2422
2509
 
2423
- const Layout_ipc = {
2510
+ const AriaAlert = {
2424
2511
  __proto__: null,
2425
- Commands: Commands$m,
2426
- name: name$l
2512
+ alert: alert$1
2427
2513
  };
2428
2514
 
2429
- const name$k = 'Location';
2430
- const Commands$l = {
2431
- getHref: getHref,
2432
- getPathName: getPathName,
2433
- hydrate: hydrate,
2434
- setPathName: setPathName
2515
+ // TODO this file is not needed when all elements are position fixed
2516
+ const state$5 = {
2517
+ isInDom: false,
2518
+ $PreviousFocusElement: undefined,
2519
+ widgetSet: new Set(),
2520
+ $Widgets: undefined
2435
2521
  };
2436
-
2437
- const Location_ipc = {
2438
- __proto__: null,
2439
- Commands: Commands$l,
2440
- name: name$k
2522
+ const create$Widgets = () => {
2523
+ const $Widgets = document.createElement('div');
2524
+ $Widgets.id = 'Widgets';
2525
+ $Widgets.className = 'Widgets';
2526
+ return $Widgets;
2441
2527
  };
2442
-
2443
- const getElementHeight = $Element => {
2444
- document.body.append($Element);
2445
- const height = $Element.offsetHeight;
2528
+ const append$1 = $Element => {
2529
+ // TODO should not call append in the first place if it is already in dom
2530
+ if (state$5.widgetSet.has($Element)) {
2531
+ return;
2532
+ }
2533
+ state$5.widgetSet.add($Element);
2534
+ if (state$5.$Widgets) {
2535
+ // @ts-expect-error
2536
+ state$5.$Widgets.append($Element);
2537
+ } else {
2538
+ // @ts-expect-error
2539
+ state$5.$Widgets = create$Widgets();
2540
+ // @ts-expect-error
2541
+ state$5.$Widgets.append($Element);
2542
+ // @ts-expect-error
2543
+ document.body.append(state$5.$Widgets);
2544
+ }
2545
+ };
2546
+ const remove$1 = $Element => {
2547
+ if (!$Element) {
2548
+ // TODO $Element should always be defined
2549
+ return;
2550
+ }
2551
+ state$5.widgetSet.delete($Element);
2446
2552
  $Element.remove();
2447
- return height;
2553
+ // TODO state.$Widgets should always be defined at this point
2554
+ if (state$5.widgetSet.size === 0 && state$5.$Widgets) {
2555
+ // @ts-expect-error
2556
+ state$5.$Widgets.remove();
2557
+ state$5.$Widgets = undefined;
2558
+ }
2448
2559
  };
2449
2560
 
2450
- const measureTextHeight = (text, fontSize, fontFamily) => {
2451
- string(text);
2452
- string(fontSize);
2453
- string(fontFamily);
2454
- const $Measure = document.createElement('div');
2455
- $Measure.style.contain = 'content';
2456
- $Measure.style.position = 'absolute';
2457
- $Measure.style.top = '-9999px';
2458
- $Measure.style.left = '-9999px';
2459
- $Measure.textContent = text;
2460
- return getElementHeight($Measure);
2561
+ // TODO not sure whether created dom node
2562
+ // should stay in state or be removed
2563
+ // one option would result in less memory usage
2564
+ // the other option would result in less garbage collection
2565
+
2566
+ // probably should optimize for less memory usage by default
2567
+ // unless the element is very likely to be used again soon (<30s)
2568
+ // but that's difficult to know
2569
+
2570
+ // TODO hide widget after timeout or mousemove
2571
+ const create$J = (message, x, y) => {
2572
+ const $EditorError = document.createElement('div');
2573
+ $EditorError.className = 'EditorWidgetError';
2574
+ $EditorError.textContent = message;
2575
+ $EditorError.style.left = `${x}px`;
2576
+ $EditorError.style.top = `${y}px`;
2577
+ alert$1(message);
2578
+ append$1($EditorError);
2579
+ return {
2580
+ $EditorError
2581
+ };
2461
2582
  };
2462
2583
 
2463
- const name$j = 'MeasureTextHeight';
2464
- const Commands$k = {
2465
- measureTextHeight: measureTextHeight
2584
+ const name$s = 'EditorError';
2585
+ const Commands$t = {
2586
+ create: create$J
2466
2587
  };
2467
2588
 
2468
- const MeasureTextHeight_ipc = {
2589
+ const EditorError_ipc = {
2469
2590
  __proto__: null,
2470
- Commands: Commands$k,
2471
- name: name$j
2591
+ Commands: Commands$t,
2592
+ name: name$s
2472
2593
  };
2473
2594
 
2474
- const measureTextBlockHeight = (text, fontSize, fontFamily, lineHeight, width) => {
2475
- string(text);
2476
- number(fontSize);
2477
- string(fontFamily);
2478
- number(width);
2479
- string(lineHeight);
2480
- const $Measure = document.createElement('div');
2481
- $Measure.style.width = `${width}px`;
2482
- $Measure.style.contain = 'content';
2483
- $Measure.style.position = 'absolute';
2484
- $Measure.style.top = '-9999px';
2485
- $Measure.style.left = '-9999px';
2486
- $Measure.style.fontSize = `${fontSize}px`;
2487
- $Measure.style.lineHeight = lineHeight;
2488
- $Measure.textContent = text;
2489
- return getElementHeight($Measure);
2595
+ const state$4 = {
2596
+ /**
2597
+ * @type {HTMLElement|undefined}
2598
+ */
2599
+ $PreviousFocusElement: undefined,
2600
+ currentFocus: ''
2490
2601
  };
2491
-
2492
- const name$i = 'MeasureTextBlockHeight';
2493
- const Commands$j = {
2494
- measureTextBlockHeight: measureTextBlockHeight
2602
+ const setElement = $Element => {
2603
+ state$4.$PreviousFocusElement = $Element;
2495
2604
  };
2496
-
2497
- const MeasureTextBlockHeight_ipc = {
2498
- __proto__: null,
2499
- Commands: Commands$j,
2500
- name: name$i
2605
+ const getElement = () => {
2606
+ return state$4.$PreviousFocusElement;
2501
2607
  };
2502
2608
 
2503
- const setThemeColor = color => {
2504
- const meta = document.querySelector('meta[name="theme-color"]');
2505
- if (!meta) {
2609
+ const focus$i = $Element => {
2610
+ if ($Element === document.activeElement) {
2506
2611
  return;
2507
2612
  }
2508
- // @ts-expect-error
2509
- meta.content = color;
2613
+ setElement(document.activeElement);
2614
+ $Element.focus({
2615
+ preventScroll: true
2616
+ });
2510
2617
  };
2511
-
2512
- const name$h = 'Meta';
2513
- const Commands$i = {
2514
- setThemeColor: setThemeColor
2618
+ const focusPrevious$1 = () => {
2619
+ const $Element = getElement();
2620
+ if ($Element) {
2621
+ // @ts-expect-error
2622
+ $Element.focus();
2623
+ }
2515
2624
  };
2516
2625
 
2517
- const Meta_ipc = {
2518
- __proto__: null,
2519
- Commands: Commands$i,
2520
- name: name$h
2626
+ const create$I = () => {
2627
+ const $InputBox = document.createElement('input');
2628
+ $InputBox.className = 'InputBox';
2629
+ $InputBox.spellcheck = false;
2630
+ $InputBox.autocapitalize = 'off';
2631
+ // $InputBox.autocomplete = 'off' // TODO needed?
2632
+ $InputBox.type = 'text';
2633
+ $InputBox.setAttribute('autocorrect', 'off'); // for ios
2634
+ return $InputBox;
2521
2635
  };
2522
2636
 
2523
- const create$Notification = message => {
2524
- const $Notification = document.createElement('div');
2525
- $Notification.className = 'Notification';
2526
- $Notification.textContent = message;
2527
- return $Notification;
2528
- };
2529
- const create$F = (type, message) => {
2530
- // TODO this pattern might be also useful for activitybar, sidebar etc., creating elements as late as possible, only when actually needed
2531
- const $Notification = create$Notification(message);
2532
- append$1($Notification);
2637
+ const setBounds$6 = ($Element, x, y, width, height) => {
2638
+ $Element.style.top = `${y}px`;
2639
+ $Element.style.left = `${x}px`;
2640
+ $Element.style.width = `${width}px`;
2641
+ $Element.style.height = `${height}px`;
2533
2642
  };
2534
- const findIndex$1 = $Child => {
2535
- const $Parent = $Child.parentNode;
2536
- for (let i = 0; i < $Parent.children.length; i++) {
2537
- if ($Parent.children[i] === $Child) {
2538
- return i;
2539
- }
2643
+ const setYAndHeight = ($Element, y, height) => {
2644
+ if (!$Element) {
2645
+ return;
2540
2646
  }
2541
- return -1;
2647
+ $Element.style.translate = typeof y === 'string' ? y : `0 ${y}px`;
2648
+ $Element.style.height = typeof height === 'string' ? height : `${height}px`;
2542
2649
  };
2543
- const handleNotificationClick = event => {
2544
- const $Target = event.target;
2545
- switch ($Target.className) {
2546
- case 'NotificationOption':
2547
- const index = findIndex$1($Target);
2548
- send( /* Notification.handleClick */'Notification.handleClick', /* index */index);
2549
- break;
2550
- }
2650
+ const setXAndWidth = ($Element, x, width) => {
2651
+ $Element.style.translate = `${x}px 0`;
2652
+ $Element.style.width = `${width}px`;
2551
2653
  };
2552
- const create$NotificationWithOptions = (message, options) => {
2553
- const $NotificationMessage = document.createElement('p');
2554
- $NotificationMessage.className = 'NotificationMessage';
2555
- $NotificationMessage.textContent = message;
2556
- const $NotificationOptions = document.createElement('div');
2557
- $NotificationOptions.className = 'NotificationOptions';
2558
- for (const option of options) {
2559
- const $NotificationOption = document.createElement('button');
2560
- $NotificationOption.className = 'NotificationOption';
2561
- $NotificationOption.textContent = option;
2562
- $NotificationOptions.append($NotificationOption);
2563
- }
2564
- const $Notification = document.createElement('div');
2565
- $Notification.className = 'Notification';
2566
- $Notification.append($NotificationMessage, $NotificationOptions);
2567
- $Notification.onclick = handleNotificationClick;
2568
- return $Notification;
2654
+ const setTop = ($Element, top) => {
2655
+ $Element.style.top = `${top}px`;
2656
+ };
2657
+ const setWidth = ($Element, width) => {
2658
+ $Element.style.width = `${width}px`;
2659
+ };
2660
+ const setXAndY = ($Element, x, y) => {
2661
+ $Element.style.left = `${x}px`;
2662
+ $Element.style.top = `${y}px`;
2663
+ };
2664
+
2665
+ /**
2666
+ *
2667
+ * @param {HTMLElement} $Element
2668
+ * @param {number} x
2669
+ * @param {number} y
2670
+ */
2671
+ const setXAndYTransform = ($Element, x, y) => {
2672
+ $Element.style.translate = `${x}px ${y}px`;
2673
+ };
2674
+ const setHeight = ($Element, height) => {
2675
+ $Element.style.height = `${height}px`;
2676
+ };
2677
+
2678
+ const FocusDebugInput = 6;
2679
+ const FocusEditorRename = 11;
2680
+ const FocusExplorerEditBox = 14;
2681
+ const FocusLocationList = 17;
2682
+ const FocusMenu = 18;
2683
+ const FocusQuickPickInput = 20;
2684
+ const FocusSearchInput = 21;
2685
+ const FocusSimpleBrowserInput = 23;
2686
+ const FocusOutput = 28;
2687
+
2688
+ const handleBlur$a = () => {
2689
+ send( /* EditorRename.abort */'EditorRename.abort');
2569
2690
  };
2570
- const createWithOptions = (type, message, options) => {
2571
- const $Notification = create$NotificationWithOptions(message, options);
2572
- append$1($Notification);
2691
+ const create$H = (x, y) => {
2692
+ const $RenameWidgetInputBox = create$I();
2693
+ $RenameWidgetInputBox.className = 'RenameWidgetInputBox';
2694
+ $RenameWidgetInputBox.onblur = handleBlur$a;
2695
+ const $RenameWidget = document.createElement('div');
2696
+ $RenameWidget.className = 'RenameWidget';
2697
+ $RenameWidget.append($RenameWidgetInputBox);
2698
+ setXAndY($RenameWidget, x, y);
2699
+ append$1($RenameWidget);
2700
+ focus$i($RenameWidgetInputBox);
2701
+ send('Focus.setFocus', FocusEditorRename);
2702
+ return {
2703
+ $RenameWidget,
2704
+ $RenameWidgetInputBox
2705
+ };
2573
2706
  };
2574
- const dispose$g = id => {
2575
- // const $Notification = state.$Notifications
2707
+ const dispose$i = state => {
2708
+ // TODO focus editor
2709
+ remove$1(state.$RenameWidget);
2576
2710
  };
2577
2711
 
2578
- const name$g = 'Notification';
2712
+ // TODO could also be event based
2713
+ // finish -> finish -> finishWithValue
2579
2714
 
2580
- // prettier-ignore
2581
- const Commands$h = {
2582
- create: create$F,
2583
- createWithOptions: createWithOptions,
2584
- dispose: dispose$g
2715
+ const finish = state => {
2716
+ const value = state.$RenameWidgetInputBox.value;
2717
+ // TODO don't like side effect here
2718
+ return value;
2585
2719
  };
2586
2720
 
2587
- const Notification_ipc = {
2588
- __proto__: null,
2589
- Commands: Commands$h,
2590
- name: name$g
2721
+ const name$r = 'EditorRename';
2722
+ const Commands$s = {
2723
+ create: create$H,
2724
+ dispose: dispose$i,
2725
+ finish: finish
2591
2726
  };
2592
2727
 
2593
- const Two = '2.0';
2728
+ const EditorRename_ipc = {
2729
+ __proto__: null,
2730
+ Commands: Commands$s,
2731
+ name: name$r
2732
+ };
2594
2733
 
2595
- const state$4 = {
2596
- canvasObjects: Object.create(null)
2734
+ const showDirectoryPicker = options => {
2735
+ // @ts-expect-error
2736
+ return window.showDirectoryPicker(options);
2597
2737
  };
2598
- const get$4 = id => {
2599
- return state$4.canvasObjects[id];
2738
+ const showFilePicker = options => {
2739
+ // @ts-expect-error
2740
+ return window.showFilePicker(options);
2600
2741
  };
2601
- const set$3 = (canvasId, canvas) => {
2602
- state$4.canvasObjects[canvasId] = canvas;
2742
+ const showSaveFilePicker = options => {
2743
+ // @ts-expect-error
2744
+ return window.showSaveFilePicker(options);
2603
2745
  };
2604
2746
 
2605
- const get$3 = id => {
2606
- return get$4(id);
2747
+ const name$q = 'FilePicker';
2748
+ const Commands$r = {
2749
+ showDirectoryPicker: showDirectoryPicker,
2750
+ showFilePicker: showFilePicker,
2751
+ showSaveFilePicker: showSaveFilePicker
2607
2752
  };
2608
- const create$E = (canvasId, callbackId) => {
2609
- const canvas = document.createElement('canvas');
2610
- const offscreenCanvas = canvas.transferControlToOffscreen();
2611
- set$3(canvasId, canvas);
2612
- sendAndTransfer({
2613
- jsonrpc: Two,
2614
- id: callbackId,
2615
- params: [offscreenCanvas]
2616
- }, [offscreenCanvas]);
2753
+
2754
+ const FilePicker_ipc = {
2755
+ __proto__: null,
2756
+ Commands: Commands$r,
2757
+ name: name$q
2617
2758
  };
2618
2759
 
2619
- const name$f = 'OffscreenCanvas';
2760
+ const requestPermission = (handle, options) => {
2761
+ return handle.requestPermission(options);
2762
+ };
2620
2763
 
2621
- // prettier-ignore
2622
- const Commands$g = {
2623
- create: create$E
2764
+ const name$p = 'FileSystemHandle';
2765
+ const Commands$q = {
2766
+ requestPermission: requestPermission
2624
2767
  };
2625
2768
 
2626
- const OffscreenCanvas_ipc = {
2769
+ const FileSystemHandle_ipc = {
2627
2770
  __proto__: null,
2628
- Commands: Commands$g,
2629
- name: name$f
2771
+ Commands: Commands$q,
2772
+ name: name$p
2630
2773
  };
2631
2774
 
2632
- // TODO this module should be called dom or dom utils
2775
+ const handleImageLoad = event => {
2776
+ const $ImagePreviewImage = event.target;
2777
+ const $ImagePreviewCaption = $ImagePreviewImage.nextSibling;
2778
+ const width = $ImagePreviewImage.naturalWidth;
2779
+ const height = $ImagePreviewImage.naturalHeight;
2780
+ $ImagePreviewCaption.textContent = `${width} × ${height}`;
2781
+ };
2782
+ const handleImageError$1 = event => {
2783
+ const $ImagePreviewImage = event.target;
2784
+ const $ImagePreviewCaption = $ImagePreviewImage.nextSibling;
2785
+ $ImagePreviewCaption.textContent = 'Image could not be loaded';
2786
+ };
2633
2787
 
2634
- // TODO this module makes for weird code splitting chunks,
2635
- // maybe duplicate the code per file for better chunks
2788
+ // TODO duplicate code with below
2636
2789
 
2637
- const findIndex = ($Container, $Target) => {
2638
- while ($Target && $Target.parentNode !== $Container) {
2639
- $Target = $Target.parentNode;
2640
- }
2641
- if (!$Target) {
2642
- return -1;
2643
- }
2644
- for (let i = 0; i < $Container.children.length; i++) {
2645
- if ($Container.children[i] === $Target) {
2646
- return i;
2647
- }
2648
- }
2649
- return -1;
2790
+ const showError = (message, y, x) => {
2791
+ const $ImagePreviewImage = document.createElement('img');
2792
+ $ImagePreviewImage.className = 'ImagePreviewImage';
2793
+ $ImagePreviewImage.alt = '';
2794
+ const $ImagePreviewCaption = document.createElement('figcaption');
2795
+ $ImagePreviewCaption.className = 'ImagePreviewCaption';
2796
+ $ImagePreviewCaption.textContent = message;
2797
+ const $ImagePreview = document.createElement('figure');
2798
+ $ImagePreview.className = 'ImagePreview';
2799
+ $ImagePreview.append($ImagePreviewImage, $ImagePreviewCaption);
2800
+ setXAndY($ImagePreview, x, y);
2801
+ $ImagePreview.style.display = 'none';
2802
+ append$1($ImagePreview);
2803
+ return {
2804
+ $ImagePreview,
2805
+ $ImagePreviewCaption,
2806
+ $ImagePreviewImage
2807
+ };
2808
+ };
2809
+ const create$G = (uri, top, left) => {
2810
+ const $ImagePreviewImage = document.createElement('img');
2811
+ $ImagePreviewImage.className = 'ImagePreviewImage';
2812
+ $ImagePreviewImage.src = uri;
2813
+ $ImagePreviewImage.alt = '';
2814
+ const $ImagePreviewCaption = document.createElement('figcaption');
2815
+ $ImagePreviewCaption.className = 'ImagePreviewCaption';
2816
+ const $ImagePreview = document.createElement('figure');
2817
+ $ImagePreview.className = 'ImagePreview';
2818
+ $ImagePreview.append($ImagePreviewImage, $ImagePreviewCaption);
2819
+ $ImagePreviewImage.onload = handleImageLoad;
2820
+ $ImagePreviewImage.onerror = handleImageError$1;
2821
+ $ImagePreview.style.top = `${top}px`;
2822
+ $ImagePreview.style.left = `${left}px`;
2823
+ $ImagePreview.style.display = 'none';
2824
+ append$1($ImagePreview);
2825
+ return {
2826
+ $ImagePreview,
2827
+ $ImagePreviewCaption,
2828
+ $ImagePreviewImage
2829
+ };
2830
+ };
2831
+ const update = (state, uri) => {
2832
+ state.$ImagePreviewImage.uri = uri;
2833
+ };
2834
+ const dispose$h = state => {
2835
+ remove$1(state.$ImagePreview);
2650
2836
  };
2651
2837
 
2652
- const create$BackDrop = () => {
2653
- const $BackDrop = document.createElement('div');
2654
- $BackDrop.className = 'BackDrop';
2655
- return $BackDrop;
2838
+ const ImagePreview$1 = {
2839
+ __proto__: null,
2840
+ create: create$G,
2841
+ dispose: dispose$h,
2842
+ showError,
2843
+ update
2656
2844
  };
2657
2845
 
2658
- const BeforeInput = 'beforeinput';
2659
- const Blur = 'blur';
2660
- const Click = 'click';
2661
- const CompositionEnd = 'compositionend';
2662
- const CompositionStart = 'compositionstart';
2663
- const CompositionUpdate = 'compositionupdate';
2664
- const ContextMenu = 'contextmenu';
2665
- const Cut = 'cut';
2666
- const DoubleClick = 'dblclick';
2667
- const DragEnd = 'dragend';
2668
- const DragLeave = 'dragleave';
2669
- const DragOver = 'dragover';
2670
- const DragStart = 'dragstart';
2671
- const Drop = 'drop';
2672
- const Error$3 = 'error';
2673
- const Focus = 'focus';
2674
- const FocusIn = 'focusin';
2675
- const FocusOut = 'focusout';
2676
- const Input$1 = 'input';
2677
- const KeyDown = 'keydown';
2678
- const KeyUp = 'keyup';
2679
- const LostPointerCapture = 'lostpointercapture';
2680
- const MouseDown = 'mousedown';
2681
- const MouseEnter = 'mouseenter';
2682
- const MouseLeave = 'mouseleave';
2683
- const MouseUp = 'mouseup';
2684
- const Paste = 'paste';
2685
- const PointerDown = 'pointerdown';
2686
- const PointerMove = 'pointermove';
2687
- const PointerUp = 'pointerup';
2688
- const Resize = 'resize';
2689
- const Scroll = 'scroll';
2690
- const TouchEnd = 'touchend';
2691
- const TouchMove = 'touchmove';
2692
- const TouchStart = 'touchstart';
2693
- const Wheel = 'wheel';
2846
+ const name$o = 'ImagePreview';
2847
+ const Commands$p = {
2848
+ create: create$G,
2849
+ dispose: dispose$h,
2850
+ showError: showError,
2851
+ update: update
2852
+ };
2694
2853
 
2695
- // src/parts/ComponentUid/ComponentUid.ts
2696
- var uidSymbol$1 = Symbol("uid");
2697
- var getUidTarget$1 = $Element => {
2698
- while ($Element) {
2699
- if ($Element[uidSymbol$1]) {
2700
- return $Element;
2701
- }
2702
- $Element = $Element.parentNode;
2703
- }
2704
- return void 0;
2854
+ const ImagePreview_ipc = {
2855
+ __proto__: null,
2856
+ Commands: Commands$p,
2857
+ name: name$o
2705
2858
  };
2706
- var getComponentUid = $Element => {
2707
- const $Target = getUidTarget$1($Element);
2708
- return $Target[uidSymbol$1];
2859
+
2860
+ const getOrigin = () => {
2861
+ return location.origin;
2862
+ };
2863
+ const getPathName = () => {
2864
+ return location.pathname;
2865
+ };
2866
+ const getHref = () => {
2867
+ return location.href;
2868
+ };
2869
+
2870
+ // TODO should do nothing if it is already at this path
2871
+ const setPathName = pathName => {
2872
+ const currentPathName = getPathName();
2873
+ if (currentPathName === pathName) {
2874
+ return;
2875
+ }
2876
+ // @ts-expect-error
2877
+ history.pushState(null, null, pathName);
2709
2878
  };
2710
- var getComponentUidFromEvent = event => {
2711
- const {
2712
- target,
2713
- currentTarget
2714
- } = event;
2715
- return getComponentUid(currentTarget || target);
2879
+ const hydrate = () => {
2880
+ // addEventListener('popstate', handlePopState)
2716
2881
  };
2717
2882
 
2718
- // src/parts/IpcState/IpcState.ts
2719
- var state$3 = {
2720
- ipc: void 0
2883
+ const getTitleBarHeight = () => {
2884
+ if (
2885
+ // @ts-expect-error
2886
+ navigator.windowControlsOverlay?.getTitlebarAreaRect) {
2887
+ // @ts-expect-error
2888
+ const titleBarRect = navigator.windowControlsOverlay.getTitlebarAreaRect();
2889
+ return titleBarRect.height;
2890
+ }
2891
+ return 0;
2721
2892
  };
2722
- var getIpc = () => {
2723
- return state$3.ipc;
2893
+ const getBounds = () => {
2894
+ return {
2895
+ windowWidth: window.innerWidth,
2896
+ windowHeight: window.innerHeight,
2897
+ titleBarHeight: getTitleBarHeight()
2898
+ };
2724
2899
  };
2725
2900
 
2726
- // src/parts/ClearNode/ClearNode.ts
2727
- var clearNode = $Node => {
2728
- $Node.textContent = "";
2901
+ const getInitData = () => {
2902
+ const initData = {
2903
+ Location: {
2904
+ href: getHref()
2905
+ },
2906
+ Layout: {
2907
+ bounds: getBounds()
2908
+ }
2909
+ };
2910
+ return initData;
2729
2911
  };
2730
2912
 
2731
- // src/parts/ElementTags/ElementTags.ts
2732
- var Audio$2 = "audio";
2733
- var Button = "button";
2734
- var Col = "col";
2735
- var ColGroup = "colgroup";
2736
- var Del = "del";
2737
- var Div = "div";
2738
- var H1 = "h1";
2739
- var H2 = "h2";
2740
- var H3 = "h3";
2741
- var H4 = "h4";
2742
- var H5 = "h5";
2743
- var H6 = "h6";
2744
- var I = "i";
2745
- var Img = "img";
2746
- var Input = "input";
2747
- var Ins = "ins";
2748
- var Kbd = "kbd";
2749
- var Span = "span";
2750
- var Table = "table";
2751
- var TBody = "tbody";
2752
- var Td = "td";
2753
- var Th = "th";
2754
- var THead = "thead";
2755
- var Tr = "tr";
2756
- var Article = "article";
2757
- var Aside = "aside";
2758
- var Footer = "footer";
2759
- var Header = "header";
2760
- var Nav = "nav";
2761
- var Section = "section";
2762
- var Search$1 = "search";
2763
- var Dd = "dd";
2764
- var Dl = "dl";
2765
- var Figcaption = "figcaption";
2766
- var Figure = "figure";
2767
- var Hr = "hr";
2768
- var Li = "li";
2769
- var Ol = "ol";
2770
- var P = "p";
2771
- var Pre = "pre";
2772
- var A = "a";
2773
- var Br = "br";
2774
- var Cite = "cite";
2775
- var Data = "data";
2776
- var Time$1 = "time";
2777
- var Tfoot = "tfoot";
2778
- var Ul = "ul";
2779
- var Video$1 = "video";
2780
- var TextArea = "textarea";
2781
- var Select = "select";
2782
- var Option = "option";
2783
-
2784
- // src/parts/VirtualDomElements/VirtualDomElements.ts
2785
- var Audio2 = 0;
2786
- var Button2 = 1;
2787
- var Col2 = 2;
2788
- var ColGroup2 = 3;
2789
- var Div2 = 4;
2790
- var H12 = 5;
2791
- var Input2 = 6;
2792
- var Kbd2 = 7;
2793
- var Span2 = 8;
2794
- var Table2 = 9;
2795
- var TBody2 = 10;
2796
- var Td2 = 11;
2797
- var Text$2 = 12;
2798
- var Th2 = 13;
2799
- var THead2 = 14;
2800
- var Tr2 = 15;
2801
- var I2 = 16;
2802
- var Img2 = 17;
2803
- var Ins2 = 20;
2804
- var Del2 = 21;
2805
- var H22 = 22;
2806
- var H32 = 23;
2807
- var H42 = 24;
2808
- var H52 = 25;
2809
- var H62 = 26;
2810
- var Article2 = 27;
2811
- var Aside2 = 28;
2812
- var Footer2 = 29;
2813
- var Header2 = 30;
2814
- var Nav2 = 40;
2815
- var Section2 = 41;
2816
- var Search2 = 42;
2817
- var Dd2 = 43;
2818
- var Dl2 = 44;
2819
- var Figcaption2 = 45;
2820
- var Figure2 = 46;
2821
- var Hr2 = 47;
2822
- var Li2 = 48;
2823
- var Ol2 = 49;
2824
- var P2 = 50;
2825
- var Pre2 = 51;
2826
- var A2 = 53;
2827
- var Br2 = 55;
2828
- var Cite2 = 56;
2829
- var Data2 = 57;
2830
- var Time2 = 58;
2831
- var Tfoot2 = 59;
2832
- var Ul2 = 60;
2833
- var Video2 = 61;
2834
- var TextArea2 = 62;
2835
- var Select2 = 63;
2836
- var Option2 = 64;
2837
-
2838
- // src/parts/ElementTagMap/ElementTagMap.ts
2839
- var getElementTag = type => {
2840
- switch (type) {
2841
- case Audio2:
2842
- return Audio$2;
2843
- case H12:
2844
- return H1;
2845
- case H22:
2846
- return H2;
2847
- case H32:
2848
- return H3;
2849
- case H42:
2850
- return H4;
2851
- case H52:
2852
- return H5;
2853
- case H62:
2854
- return H6;
2855
- case Div2:
2856
- return Div;
2857
- case Kbd2:
2858
- return Kbd;
2859
- case Table2:
2860
- return Table;
2861
- case TBody2:
2862
- return TBody;
2863
- case Th2:
2864
- return Th;
2865
- case Td2:
2866
- return Td;
2867
- case THead2:
2868
- return THead;
2869
- case Tr2:
2870
- return Tr;
2871
- case Input2:
2872
- return Input;
2873
- case ColGroup2:
2874
- return ColGroup;
2875
- case Col2:
2876
- return Col;
2877
- case Button2:
2878
- return Button;
2879
- case Span2:
2880
- return Span;
2881
- case I2:
2882
- return I;
2883
- case Img2:
2884
- return Img;
2885
- case Ins2:
2886
- return Ins;
2887
- case Del2:
2888
- return Del;
2889
- case Article2:
2890
- return Article;
2891
- case Aside2:
2892
- return Aside;
2893
- case Footer2:
2894
- return Footer;
2895
- case Header2:
2896
- return Header;
2897
- case Nav2:
2898
- return Nav;
2899
- case Section2:
2900
- return Section;
2901
- case Search2:
2902
- return Search$1;
2903
- case Dd2:
2904
- return Dd;
2905
- case Dl2:
2906
- return Dl;
2907
- case Figcaption2:
2908
- return Figcaption;
2909
- case Figure2:
2910
- return Figure;
2911
- case Hr2:
2912
- return Hr;
2913
- case Li2:
2914
- return Li;
2915
- case Ol2:
2916
- return Ol;
2917
- case P2:
2918
- return P;
2919
- case Pre2:
2920
- return Pre;
2921
- case A2:
2922
- return A;
2923
- case Br2:
2924
- return Br;
2925
- case Cite2:
2926
- return Cite;
2927
- case Data2:
2928
- return Data;
2929
- case Time2:
2930
- return Time$1;
2931
- case Tfoot2:
2932
- return Tfoot;
2933
- case Ul2:
2934
- return Ul;
2935
- case Video2:
2936
- return Video$1;
2937
- case TextArea2:
2938
- return TextArea;
2939
- case Select2:
2940
- return Select;
2941
- case Option2:
2942
- return Option;
2943
- default:
2944
- throw new Error(`element tag not found ${type}`);
2945
- }
2913
+ const name$n = 'InitData';
2914
+ const Commands$o = {
2915
+ getInitData: getInitData
2946
2916
  };
2947
2917
 
2948
- // src/parts/GetEventListenerOptions/GetEventListenerOptions.ts
2949
- var getEventListenerOptions$1 = eventName => {
2950
- switch (eventName) {
2951
- case "wheel":
2952
- return {
2953
- passive: true
2954
- };
2955
- default:
2956
- return void 0;
2957
- }
2918
+ const InitData_ipc = {
2919
+ __proto__: null,
2920
+ Commands: Commands$o,
2921
+ name: name$n
2958
2922
  };
2959
2923
 
2960
- // src/parts/NameAnonymousFunction/NameAnonymousFunction.ts
2961
- var nameAnonymousFunction$1 = (fn, name) => {
2962
- Object.defineProperty(fn, "name", {
2963
- value: name
2964
- });
2924
+ const name$m = 'IpcParent';
2925
+ const Commands$n = {
2926
+ create: create$L
2965
2927
  };
2966
2928
 
2967
- // src/parts/GetWrappedListener/GetWrappedListener.ts
2968
- var cache$1 = /* @__PURE__ */new Map();
2969
- var getWrappedListener$1 = (listener, returnValue) => {
2970
- if (!returnValue) {
2971
- return listener;
2972
- }
2973
- if (!cache$1.has(listener)) {
2974
- const wrapped = event => {
2975
- const uid = getComponentUidFromEvent(event);
2976
- const result = listener(event);
2977
- if (result.length === 0) {
2978
- return;
2979
- }
2980
- const ipc = getIpc();
2981
- ipc.send("Viewlet.executeViewletCommand", uid, ...result);
2982
- };
2983
- nameAnonymousFunction$1(wrapped, listener.name);
2984
- cache$1.set(listener, wrapped);
2985
- }
2986
- return cache$1.get(listener);
2929
+ const IpcParent_ipc = {
2930
+ __proto__: null,
2931
+ Commands: Commands$n,
2932
+ name: name$m
2987
2933
  };
2988
2934
 
2989
- // src/parts/AttachEvent/AttachEvent.ts
2990
- var attachEvent$1 = ($Node, eventMap, key, value) => {
2991
- const listener = eventMap[value];
2992
- if (!listener) {
2993
- console.warn("listener not found", value);
2935
+ const name$l = 'Layout';
2936
+ const Commands$m = {
2937
+ getBounds: getBounds
2938
+ };
2939
+
2940
+ const Layout_ipc = {
2941
+ __proto__: null,
2942
+ Commands: Commands$m,
2943
+ name: name$l
2944
+ };
2945
+
2946
+ const name$k = 'Location';
2947
+ const Commands$l = {
2948
+ getHref: getHref,
2949
+ getPathName: getPathName,
2950
+ hydrate: hydrate,
2951
+ setPathName: setPathName
2952
+ };
2953
+
2954
+ const Location_ipc = {
2955
+ __proto__: null,
2956
+ Commands: Commands$l,
2957
+ name: name$k
2958
+ };
2959
+
2960
+ const getElementHeight = $Element => {
2961
+ document.body.append($Element);
2962
+ const height = $Element.offsetHeight;
2963
+ $Element.remove();
2964
+ return height;
2965
+ };
2966
+
2967
+ const measureTextHeight = (text, fontSize, fontFamily) => {
2968
+ string(text);
2969
+ string(fontSize);
2970
+ string(fontFamily);
2971
+ const $Measure = document.createElement('div');
2972
+ $Measure.style.contain = 'content';
2973
+ $Measure.style.position = 'absolute';
2974
+ $Measure.style.top = '-9999px';
2975
+ $Measure.style.left = '-9999px';
2976
+ $Measure.textContent = text;
2977
+ return getElementHeight($Measure);
2978
+ };
2979
+
2980
+ const name$j = 'MeasureTextHeight';
2981
+ const Commands$k = {
2982
+ measureTextHeight: measureTextHeight
2983
+ };
2984
+
2985
+ const MeasureTextHeight_ipc = {
2986
+ __proto__: null,
2987
+ Commands: Commands$k,
2988
+ name: name$j
2989
+ };
2990
+
2991
+ const measureTextBlockHeight = (text, fontSize, fontFamily, lineHeight, width) => {
2992
+ string(text);
2993
+ number(fontSize);
2994
+ string(fontFamily);
2995
+ number(width);
2996
+ string(lineHeight);
2997
+ const $Measure = document.createElement('div');
2998
+ $Measure.style.width = `${width}px`;
2999
+ $Measure.style.contain = 'content';
3000
+ $Measure.style.position = 'absolute';
3001
+ $Measure.style.top = '-9999px';
3002
+ $Measure.style.left = '-9999px';
3003
+ $Measure.style.fontSize = `${fontSize}px`;
3004
+ $Measure.style.lineHeight = lineHeight;
3005
+ $Measure.textContent = text;
3006
+ return getElementHeight($Measure);
3007
+ };
3008
+
3009
+ const name$i = 'MeasureTextBlockHeight';
3010
+ const Commands$j = {
3011
+ measureTextBlockHeight: measureTextBlockHeight
3012
+ };
3013
+
3014
+ const MeasureTextBlockHeight_ipc = {
3015
+ __proto__: null,
3016
+ Commands: Commands$j,
3017
+ name: name$i
3018
+ };
3019
+
3020
+ const setThemeColor = color => {
3021
+ const meta = document.querySelector('meta[name="theme-color"]');
3022
+ if (!meta) {
2994
3023
  return;
2995
3024
  }
2996
- const options = getEventListenerOptions$1(eventMap);
2997
- const wrapped = getWrappedListener$1(listener, eventMap.returnValue);
2998
- $Node.addEventListener(key, wrapped, options);
3025
+ // @ts-expect-error
3026
+ meta.content = color;
2999
3027
  };
3000
3028
 
3001
- // src/parts/VirtualDomElementProp/VirtualDomElementProp.ts
3002
- var setProp = ($Element, key, value, eventMap) => {
3003
- switch (key) {
3004
- case "maskImage":
3005
- $Element.style.maskImage = `url('${value}')`;
3006
- $Element.style.webkitMaskImage = `url('${value}')`;
3007
- break;
3008
- case "paddingLeft":
3009
- case "paddingRight":
3010
- case "top":
3011
- case "left":
3012
- case "marginTop":
3013
- $Element.style[key] = typeof value === "number" ? `${value}px` : value;
3014
- break;
3015
- case "translate":
3016
- $Element.style[key] = value;
3017
- break;
3018
- case "width":
3019
- case "height":
3020
- if ($Element instanceof HTMLImageElement) {
3021
- $Element[key] = value;
3022
- } else if (typeof value === "number") {
3023
- $Element.style[key] = `${value}px`;
3024
- } else {
3025
- $Element.style[key] = value;
3026
- }
3027
- break;
3028
- case "style":
3029
- throw new Error("style property is not supported");
3030
- case "childCount":
3031
- case "type":
3032
- break;
3033
- case "ariaOwns":
3034
- if (value) {
3035
- $Element.setAttribute("aria-owns", value);
3036
- } else {
3037
- $Element.removeAttribute("aria-owns");
3038
- }
3039
- break;
3040
- case "inputType":
3041
- $Element.type = value;
3042
- break;
3043
- case "ariaLabelledBy":
3044
- $Element.setAttribute("aria-labelledby", value);
3045
- break;
3046
- case "onBlur":
3047
- case "onChange":
3048
- case "onClick":
3049
- case "onContextMenu":
3050
- case "onDblClick":
3051
- case "onFocus":
3052
- case "onFocusIn":
3053
- case "onFocusIn":
3054
- case "onFocusOut":
3055
- case "onInput":
3056
- case "onKeyDown":
3057
- case "onMouseDown":
3058
- case "onPointerDown":
3059
- case "onPointerOut":
3060
- case "onPointerOver":
3061
- case "onWheel":
3062
- const eventName = key.slice(2).toLowerCase();
3063
- if (!eventMap || !value) {
3064
- return;
3065
- }
3066
- attachEvent$1($Element, eventMap, eventName, value);
3029
+ const name$h = 'Meta';
3030
+ const Commands$i = {
3031
+ setThemeColor: setThemeColor
3032
+ };
3033
+
3034
+ const Meta_ipc = {
3035
+ __proto__: null,
3036
+ Commands: Commands$i,
3037
+ name: name$h
3038
+ };
3039
+
3040
+ const create$Notification = message => {
3041
+ const $Notification = document.createElement('div');
3042
+ $Notification.className = 'Notification';
3043
+ $Notification.textContent = message;
3044
+ return $Notification;
3045
+ };
3046
+ const create$F = (type, message) => {
3047
+ // TODO this pattern might be also useful for activitybar, sidebar etc., creating elements as late as possible, only when actually needed
3048
+ const $Notification = create$Notification(message);
3049
+ append$1($Notification);
3050
+ };
3051
+ const findIndex$1 = $Child => {
3052
+ const $Parent = $Child.parentNode;
3053
+ for (let i = 0; i < $Parent.children.length; i++) {
3054
+ if ($Parent.children[i] === $Child) {
3055
+ return i;
3056
+ }
3057
+ }
3058
+ return -1;
3059
+ };
3060
+ const handleNotificationClick = event => {
3061
+ const $Target = event.target;
3062
+ switch ($Target.className) {
3063
+ case 'NotificationOption':
3064
+ const index = findIndex$1($Target);
3065
+ send( /* Notification.handleClick */'Notification.handleClick', /* index */index);
3067
3066
  break;
3068
- default:
3069
- if (key.startsWith("data-")) {
3070
- $Element.dataset[key.slice("data-".length)] = value;
3071
- } else {
3072
- $Element[key] = value;
3073
- }
3074
3067
  }
3075
3068
  };
3069
+ const create$NotificationWithOptions = (message, options) => {
3070
+ const $NotificationMessage = document.createElement('p');
3071
+ $NotificationMessage.className = 'NotificationMessage';
3072
+ $NotificationMessage.textContent = message;
3073
+ const $NotificationOptions = document.createElement('div');
3074
+ $NotificationOptions.className = 'NotificationOptions';
3075
+ for (const option of options) {
3076
+ const $NotificationOption = document.createElement('button');
3077
+ $NotificationOption.className = 'NotificationOption';
3078
+ $NotificationOption.textContent = option;
3079
+ $NotificationOptions.append($NotificationOption);
3080
+ }
3081
+ const $Notification = document.createElement('div');
3082
+ $Notification.className = 'Notification';
3083
+ $Notification.append($NotificationMessage, $NotificationOptions);
3084
+ $Notification.onclick = handleNotificationClick;
3085
+ return $Notification;
3086
+ };
3087
+ const createWithOptions = (type, message, options) => {
3088
+ const $Notification = create$NotificationWithOptions(message, options);
3089
+ append$1($Notification);
3090
+ };
3091
+ const dispose$g = id => {
3092
+ // const $Notification = state.$Notifications
3093
+ };
3076
3094
 
3077
- // src/parts/VirtualDomElementProps/VirtualDomElementProps.ts
3078
- var setProps = ($Element, props, eventMap) => {
3079
- for (const key in props) {
3080
- setProp($Element, key, props[key], eventMap);
3081
- }
3095
+ const name$g = 'Notification';
3096
+
3097
+ // prettier-ignore
3098
+ const Commands$h = {
3099
+ create: create$F,
3100
+ createWithOptions: createWithOptions,
3101
+ dispose: dispose$g
3082
3102
  };
3083
3103
 
3084
- // src/parts/VirtualDomElement/VirtualDomElement.ts
3085
- var renderDomTextNode = element => {
3086
- return document.createTextNode(element.text);
3104
+ const Notification_ipc = {
3105
+ __proto__: null,
3106
+ Commands: Commands$h,
3107
+ name: name$g
3087
3108
  };
3088
- var renderDomElement = (element, eventMap) => {
3089
- const tag = getElementTag(element.type);
3090
- const $Element = document.createElement(tag);
3091
- setProps($Element, element, eventMap);
3092
- return $Element;
3109
+
3110
+ const state$3 = {
3111
+ canvasObjects: Object.create(null)
3093
3112
  };
3094
- var render = (element, eventMap) => {
3095
- switch (element.type) {
3096
- case Text$2:
3097
- return renderDomTextNode(element);
3098
- default:
3099
- return renderDomElement(element, eventMap);
3100
- }
3113
+ const get$4 = id => {
3114
+ return state$3.canvasObjects[id];
3115
+ };
3116
+ const set$3 = (canvasId, canvas) => {
3117
+ state$3.canvasObjects[canvasId] = canvas;
3101
3118
  };
3102
3119
 
3103
- // src/parts/RenderInternal/RenderInternal.ts
3104
- var renderInternal2 = ($Parent, elements, eventMap) => {
3105
- const max = elements.length - 1;
3106
- let stack = [];
3107
- for (let i = max; i >= 0; i--) {
3108
- const element = elements[i];
3109
- const $Element = render(element, eventMap);
3110
- if (element.childCount > 0) {
3111
- $Element.append(...stack.slice(0, element.childCount));
3112
- stack = stack.slice(element.childCount);
3120
+ const get$3 = id => {
3121
+ return get$4(id);
3122
+ };
3123
+ const create$E = (canvasId, callbackId) => {
3124
+ const canvas = document.createElement('canvas');
3125
+ const offscreenCanvas = canvas.transferControlToOffscreen();
3126
+ set$3(canvasId, canvas);
3127
+ sendAndTransfer({
3128
+ jsonrpc: '2.0',
3129
+ id: callbackId,
3130
+ params: [offscreenCanvas]
3131
+ }, [offscreenCanvas]);
3132
+ };
3133
+
3134
+ const name$f = 'OffscreenCanvas';
3135
+
3136
+ // prettier-ignore
3137
+ const Commands$g = {
3138
+ create: create$E
3139
+ };
3140
+
3141
+ const OffscreenCanvas_ipc = {
3142
+ __proto__: null,
3143
+ Commands: Commands$g,
3144
+ name: name$f
3145
+ };
3146
+
3147
+ // TODO this module should be called dom or dom utils
3148
+
3149
+ // TODO this module makes for weird code splitting chunks,
3150
+ // maybe duplicate the code per file for better chunks
3151
+
3152
+ const findIndex = ($Container, $Target) => {
3153
+ while ($Target && $Target.parentNode !== $Container) {
3154
+ $Target = $Target.parentNode;
3155
+ }
3156
+ if (!$Target) {
3157
+ return -1;
3158
+ }
3159
+ for (let i = 0; i < $Container.children.length; i++) {
3160
+ if ($Container.children[i] === $Target) {
3161
+ return i;
3113
3162
  }
3114
- stack.unshift($Element);
3115
3163
  }
3116
- $Parent.append(...stack);
3164
+ return -1;
3117
3165
  };
3118
3166
 
3119
- // src/parts/VirtualDom/VirtualDom.ts
3120
- var renderInto = ($Parent, dom, eventMap = {}) => {
3121
- clearNode($Parent);
3122
- renderInternal2($Parent, dom, eventMap);
3123
- };
3124
- var render2 = (elements, eventMap = {}) => {
3125
- const $Root = document.createElement("div");
3126
- renderInternal2($Root, elements, eventMap);
3127
- return $Root;
3167
+ const create$BackDrop = () => {
3168
+ const $BackDrop = document.createElement('div');
3169
+ $BackDrop.className = 'BackDrop';
3170
+ return $BackDrop;
3128
3171
  };
3129
3172
 
3173
+ const BeforeInput = 'beforeinput';
3174
+ const Blur = 'blur';
3175
+ const Click = 'click';
3176
+ const CompositionEnd = 'compositionend';
3177
+ const CompositionStart = 'compositionstart';
3178
+ const CompositionUpdate = 'compositionupdate';
3179
+ const ContextMenu = 'contextmenu';
3180
+ const Cut = 'cut';
3181
+ const DoubleClick = 'dblclick';
3182
+ const DragEnd = 'dragend';
3183
+ const DragLeave = 'dragleave';
3184
+ const DragOver = 'dragover';
3185
+ const DragStart = 'dragstart';
3186
+ const Drop = 'drop';
3187
+ const Error$3 = 'error';
3188
+ const Focus = 'focus';
3189
+ const FocusIn = 'focusin';
3190
+ const FocusOut = 'focusout';
3191
+ const Input = 'input';
3192
+ const KeyDown = 'keydown';
3193
+ const KeyUp = 'keyup';
3194
+ const LostPointerCapture = 'lostpointercapture';
3195
+ const MouseDown = 'mousedown';
3196
+ const MouseEnter = 'mouseenter';
3197
+ const MouseLeave = 'mouseleave';
3198
+ const MouseUp = 'mouseup';
3199
+ const Paste = 'paste';
3200
+ const PointerDown = 'pointerdown';
3201
+ const PointerMove = 'pointermove';
3202
+ const PointerUp = 'pointerup';
3203
+ const Resize = 'resize';
3204
+ const Scroll = 'scroll';
3205
+ const TouchEnd = 'touchend';
3206
+ const TouchMove = 'touchmove';
3207
+ const TouchStart = 'touchstart';
3208
+ const Wheel = 'wheel';
3209
+
3130
3210
  // TODO when pressing tab -> focus next element in tab order and close menu
3131
3211
 
3132
3212
  // TODO menu and contextmenu should have own keybinding logic
@@ -4073,30 +4153,9 @@ const Transferrable_ipc = {
4073
4153
  name: name$8
4074
4154
  };
4075
4155
 
4076
- const uidSymbol = Symbol('uid');
4077
- const set$1 = ($Element, uid) => {
4078
- $Element[uidSymbol] = uid;
4079
- };
4080
- const getUidTarget = $Element => {
4081
- while ($Element) {
4082
- if ($Element[uidSymbol]) {
4083
- return $Element;
4084
- }
4085
- $Element = $Element.parentNode;
4086
- }
4087
- return undefined;
4088
- };
4089
- const get = $Element => {
4090
- const $Target = getUidTarget($Element);
4091
- return $Target[uidSymbol];
4092
- };
4093
- const fromEvent = event => {
4094
- const {
4095
- target,
4096
- currentTarget
4097
- } = event;
4098
- return get(currentTarget || target);
4099
- };
4156
+ const set$1 = setComponentUid;
4157
+ const get = getComponentUid;
4158
+ const fromEvent = getComponentUidFromEvent;
4100
4159
 
4101
4160
  const state$1 = {
4102
4161
  identifiers: new Uint32Array()
@@ -4123,47 +4182,7 @@ const setIdentifiers = identifiers => {
4123
4182
  setIdentifiers$1(identifiers);
4124
4183
  };
4125
4184
 
4126
- const queryInputs = $Viewlet => {
4127
- return [...$Viewlet.querySelectorAll('input, textarea')];
4128
- };
4129
- const rememberFocus = ($Viewlet, dom, eventMap, uid = 0) => {
4130
- // TODO replace this workaround with
4131
- // virtual dom diffing
4132
- const oldLeft = $Viewlet.style.left;
4133
- const oldTop = $Viewlet.style.top;
4134
- const oldWidth = $Viewlet.style.width;
4135
- const oldHeight = $Viewlet.style.height;
4136
- // @ts-expect-error
4137
- const focused = document.activeElement.getAttribute('name');
4138
- const $$Inputs = queryInputs($Viewlet);
4139
- const inputMap = Object.create(null);
4140
- for (const $Input of $$Inputs) {
4141
- inputMap[$Input.name] = $Input.value;
4142
- }
4143
- if (uid) {
4144
- const $New = render2(dom, eventMap).firstChild;
4145
- set$1($New, uid);
4146
- $Viewlet.replaceWith($New);
4147
- $Viewlet = $New;
4148
- } else {
4149
- renderInto($Viewlet, dom, eventMap);
4150
- }
4151
- const $$NewInputs = queryInputs($Viewlet);
4152
- for (const $Input of $$NewInputs) {
4153
- $Input.value = inputMap[$Input.name] || $Input.value || '';
4154
- }
4155
- if (focused) {
4156
- const $Focused = $Viewlet.querySelector(`[name="${focused}"]`);
4157
- if ($Focused) {
4158
- $Focused.focus();
4159
- }
4160
- }
4161
- $Viewlet.style.top = oldTop;
4162
- $Viewlet.style.left = oldLeft;
4163
- $Viewlet.style.height = oldHeight;
4164
- $Viewlet.style.width = oldWidth;
4165
- return $Viewlet;
4166
- };
4185
+ const rememberFocus = rememberFocus$1;
4167
4186
 
4168
4187
  const ActivityBar = 'ActivityBar';
4169
4188
  const Audio$1 = 'Audio';
@@ -4967,7 +4986,7 @@ const ModuleWorkerAndMessagePort = 8;
4967
4986
  const getData$1 = event => {
4968
4987
  return event.data;
4969
4988
  };
4970
- const attachEvents$d = that => {
4989
+ const attachEvents$c = that => {
4971
4990
  const handleMessage = (...args) => {
4972
4991
  const data = that.getData(...args);
4973
4992
  that.dispatchEvent(new MessageEvent('message', {
@@ -4984,7 +5003,7 @@ class Ipc extends EventTarget {
4984
5003
  constructor(rawIpc) {
4985
5004
  super();
4986
5005
  this._rawIpc = rawIpc;
4987
- attachEvents$d(this);
5006
+ attachEvents$c(this);
4988
5007
  }
4989
5008
  }
4990
5009
  const readyMessage = 'ready';
@@ -5650,7 +5669,7 @@ const create$z = async ({
5650
5669
  // TODO await promise
5651
5670
  // TODO call separate method HandleMessagePort.handleMessagePort or
5652
5671
  // HandleIncomingIpc.handleIncomingIpc
5653
- invokeAndTransfer(ipc, [port], 'initialize', 'message-port', port);
5672
+ invokeAndTransfer$1(ipc, [port], 'initialize', 'message-port', port);
5654
5673
  unhandleIpc(ipc);
5655
5674
  return undefined;
5656
5675
  };
@@ -5682,7 +5701,7 @@ const create$y = async ({
5682
5701
  }
5683
5702
  const windowIpc = IpcChildWithWindow$1.wrap(window);
5684
5703
  handleIpcOnce(windowIpc);
5685
- const webContentsIds = await invokeAndTransfer(windowIpc, [port], 'CreateMessagePort.createMessagePort', ipcId);
5704
+ const webContentsIds = await invokeAndTransfer$1(windowIpc, [port], 'CreateMessagePort.createMessagePort', ipcId);
5686
5705
  return webContentsIds;
5687
5706
  };
5688
5707
 
@@ -5753,11 +5772,11 @@ const ViewletActivityBarEvents = {
5753
5772
  returnValue: returnValue$6
5754
5773
  };
5755
5774
 
5756
- const Events$9 = ViewletActivityBarEvents;
5775
+ const Events$a = ViewletActivityBarEvents;
5757
5776
 
5758
5777
  const ViewletActivityBar = {
5759
5778
  __proto__: null,
5760
- Events: Events$9
5779
+ Events: Events$a
5761
5780
  };
5762
5781
 
5763
5782
  const executeViewletCommand = (uid, command, ...args) => {
@@ -5895,11 +5914,11 @@ const ViewletAudioEvents = {
5895
5914
  handleAudioError
5896
5915
  };
5897
5916
 
5898
- const Events$8 = ViewletAudioEvents;
5917
+ const Events$9 = ViewletAudioEvents;
5899
5918
 
5900
5919
  const ViewletAudio = {
5901
5920
  __proto__: null,
5902
- Events: Events$8
5921
+ Events: Events$9
5903
5922
  };
5904
5923
 
5905
5924
  const create$x = () => {
@@ -6275,7 +6294,7 @@ const ViewletDiffEditor = {
6275
6294
  setScrollBar: setScrollBar$2
6276
6295
  };
6277
6296
 
6278
- const attachEvents$c = ($Node, eventMap) => {
6297
+ const attachEvents$b = ($Node, eventMap) => {
6279
6298
  for (const [key, value] of Object.entries(eventMap)) {
6280
6299
  $Node.addEventListener(key, value);
6281
6300
  }
@@ -6397,17 +6416,17 @@ const create$s = () => {
6397
6416
  $ScrollBarThumb
6398
6417
  };
6399
6418
  };
6400
- const attachEvents$b = state => {
6419
+ const attachEvents$a = state => {
6401
6420
  const {
6402
6421
  $Viewlet,
6403
6422
  $ListItems,
6404
6423
  $ScrollBar
6405
6424
  } = state;
6406
6425
  $Viewlet.addEventListener(Wheel, handleWheel$3, Passive);
6407
- attachEvents$c($ListItems, {
6426
+ attachEvents$b($ListItems, {
6408
6427
  [MouseDown]: handleMousedown
6409
6428
  });
6410
- attachEvents$c($ScrollBar, {
6429
+ attachEvents$b($ScrollBar, {
6411
6430
  [PointerDown]: handleScrollBarPointerDown$3
6412
6431
  });
6413
6432
  };
@@ -6455,7 +6474,7 @@ const setBounds$4 = (state, x, y, width, height) => {
6455
6474
 
6456
6475
  const ViewletEditorCompletion = {
6457
6476
  __proto__: null,
6458
- attachEvents: attachEvents$b,
6477
+ attachEvents: attachEvents$a,
6459
6478
  create: create$s,
6460
6479
  dispose: dispose$c,
6461
6480
  handleError: handleError$6,
@@ -6699,11 +6718,11 @@ const create$p = () => {
6699
6718
  $Viewlet
6700
6719
  };
6701
6720
  };
6702
- const attachEvents$a = state => {
6721
+ const attachEvents$9 = state => {
6703
6722
  const {
6704
6723
  $Viewlet
6705
6724
  } = state;
6706
- attachEvents$c($Viewlet, {
6725
+ attachEvents$b($Viewlet, {
6707
6726
  [PointerDown]: handlePointerDown$5,
6708
6727
  [PointerUp]: handlePointerUp,
6709
6728
  [ContextMenu]: handleContextMenu$7,
@@ -6734,7 +6753,7 @@ const setDom$5 = (state, dom) => {
6734
6753
 
6735
6754
  const ViewletEditorImage = {
6736
6755
  __proto__: null,
6737
- attachEvents: attachEvents$a,
6756
+ attachEvents: attachEvents$9,
6738
6757
  create: create$p,
6739
6758
  setDom: setDom$5,
6740
6759
  setDragging,
@@ -7330,7 +7349,7 @@ const showOverlayMessage = (state, x, y, content) => {
7330
7349
  };
7331
7350
  const hideOverlayMessage = state => {
7332
7351
  // TODO pass id of the overlay message and remove widget by id
7333
- for (const $Widget of state$6.widgetSet) {
7352
+ for (const $Widget of state$5.widgetSet) {
7334
7353
  // @ts-expect-error
7335
7354
  if ($Widget.className === 'EditorOverlayMessage') {
7336
7355
  remove$1($Widget);
@@ -7637,8 +7656,6 @@ const ViewletExplorerEvents = {
7637
7656
  handleWheel: handleWheel$3
7638
7657
  };
7639
7658
 
7640
- const activeId$2 = 'TreeItemActive';
7641
- const focusClassName = 'FocusOutline';
7642
7659
  const create$i = () => {
7643
7660
  const $Viewlet = document.createElement('div');
7644
7661
  $Viewlet.className = 'Viewlet Explorer';
@@ -7649,25 +7666,7 @@ const create$i = () => {
7649
7666
  $Viewlet
7650
7667
  };
7651
7668
  };
7652
- const attachEvents$9 = state => {
7653
- const {
7654
- $Viewlet
7655
- } = state;
7656
- // TODO use the other mouse events that capture automatically
7657
- $Viewlet.addEventListener(MouseEnter, handleMouseEnter, Capture);
7658
- $Viewlet.addEventListener(MouseLeave, handleMouseLeave, Capture);
7659
- $Viewlet.addEventListener(Wheel, handleWheel$3, Passive);
7660
- attachEvents$c($Viewlet, {
7661
- [Blur]: handleBlur$5,
7662
- [Click]: handleClick$6,
7663
- [ContextMenu]: handleContextMenu$5,
7664
- [DragOver]: handleDragOver,
7665
- [DragStart]: handleDragStart$1,
7666
- [Drop]: handleDrop,
7667
- [Focus]: handleFocus$7,
7668
- [PointerDown]: handlePointerDown$4
7669
- });
7670
- };
7669
+ const Events$8 = ViewletExplorerEvents;
7671
7670
  const handleError$3 = (state, message) => {
7672
7671
  object(state);
7673
7672
  string(message);
@@ -7676,59 +7675,6 @@ const handleError$3 = (state, message) => {
7676
7675
  } = state;
7677
7676
  $Viewlet.textContent = message;
7678
7677
  };
7679
- const setFocusedIndex$4 = (state, oldIndex, newIndex, focused) => {
7680
- object(state);
7681
- number(oldIndex);
7682
- number(newIndex);
7683
- const {
7684
- $Viewlet
7685
- } = state;
7686
- switch (oldIndex) {
7687
- case -2:
7688
- break;
7689
- case -1:
7690
- $Viewlet.classList.remove(focusClassName);
7691
- break;
7692
- default:
7693
- const $Dirent = $Viewlet.children[oldIndex];
7694
- if ($Dirent) {
7695
- $Dirent.classList.remove(activeId$2);
7696
- $Dirent.classList.remove(focusClassName);
7697
- $Dirent.removeAttribute('id');
7698
- }
7699
- break;
7700
- }
7701
- switch (newIndex) {
7702
- case -2:
7703
- $Viewlet.classList.remove(focusClassName);
7704
- $Viewlet.removeAttribute(AriaActiveDescendant);
7705
- break;
7706
- case -1:
7707
- if (focused) {
7708
- $Viewlet.classList.add(focusClassName);
7709
- $Viewlet.removeAttribute(AriaActiveDescendant);
7710
- }
7711
- break;
7712
- default:
7713
- if (newIndex >= 0) {
7714
- const $Dirent = $Viewlet.children[newIndex];
7715
- if (!$Dirent) {
7716
- break;
7717
- }
7718
- $Dirent.id = activeId$2;
7719
- $Dirent.classList.add(activeId$2);
7720
- $Viewlet.setAttribute(AriaActiveDescendant, activeId$2);
7721
- if (focused) {
7722
- $Dirent.classList.add(focusClassName);
7723
- }
7724
- }
7725
- break;
7726
- }
7727
- if (focused) {
7728
- $Viewlet.focus();
7729
- send('Focus.setFocus', FocusExplorer);
7730
- }
7731
- };
7732
7678
  const focusInput = (state, id) => {
7733
7679
  const $Input = document.getElementById(id);
7734
7680
  if (!$Input) {
@@ -7762,19 +7708,18 @@ const setDom$4 = (state, dom) => {
7762
7708
  const {
7763
7709
  $Viewlet
7764
7710
  } = state;
7765
- rememberFocus($Viewlet, dom, ViewletExplorerEvents);
7711
+ rememberFocus($Viewlet, dom, ViewletExplorerEvents, 0);
7766
7712
  };
7767
7713
 
7768
7714
  const ViewletExplorer = {
7769
7715
  __proto__: null,
7770
- attachEvents: attachEvents$9,
7716
+ Events: Events$8,
7771
7717
  create: create$i,
7772
7718
  dispose: dispose$9,
7773
7719
  focusInput,
7774
7720
  handleError: handleError$3,
7775
7721
  setDom: setDom$4,
7776
- setDropTargets,
7777
- setFocusedIndex: setFocusedIndex$4
7722
+ setDropTargets
7778
7723
  };
7779
7724
 
7780
7725
  const handleIconError = event => {
@@ -7958,10 +7903,10 @@ const attachEvents$8 = state => {
7958
7903
  $ListItems,
7959
7904
  $ScrollBar
7960
7905
  } = state;
7961
- $ExtensionHeader.addEventListener(Input$1, handleInput$6, Capture);
7906
+ $ExtensionHeader.addEventListener(Input, handleInput$6, Capture);
7962
7907
  // @ts-expect-error
7963
7908
  $ExtensionHeader.addEventListener(Click, undefined);
7964
- attachEvents$c($ListItems, {
7909
+ attachEvents$b($ListItems, {
7965
7910
  [ContextMenu]: handleContextMenu$5,
7966
7911
  [PointerDown]: handlePointerDown$3,
7967
7912
  [Focus]: handleFocus$6,
@@ -7971,7 +7916,7 @@ const attachEvents$8 = state => {
7971
7916
  $ListItems.addEventListener(TouchMove, handleTouchMove, Passive);
7972
7917
  $ListItems.addEventListener(TouchEnd, handleTouchEnd, Passive);
7973
7918
  $ListItems.addEventListener(Wheel, handleWheel$3, Passive);
7974
- attachEvents$c($ScrollBar, {
7919
+ attachEvents$b($ScrollBar, {
7975
7920
  [PointerDown]: handleScrollBarPointerDown$2
7976
7921
  });
7977
7922
  };
@@ -8176,7 +8121,7 @@ const setDom$3 = (state, dom) => {
8176
8121
  const {
8177
8122
  $Viewlet
8178
8123
  } = state;
8179
- rememberFocus($Viewlet, dom, ViewletFindWidgetEvents);
8124
+ rememberFocus($Viewlet, dom, ViewletFindWidgetEvents, 0);
8180
8125
  };
8181
8126
 
8182
8127
  const ViewletFindWidget = {
@@ -8877,15 +8822,15 @@ const attachEvents$7 = state => {
8877
8822
  $SashSideBar,
8878
8823
  $SashPanel
8879
8824
  } = state;
8880
- attachEvents$c($SashSideBar, {
8825
+ attachEvents$b($SashSideBar, {
8881
8826
  [PointerDown]: handleSashPointerDown,
8882
8827
  [DoubleClick]: handleSashDoubleClick
8883
8828
  });
8884
- attachEvents$c($SashPanel, {
8829
+ attachEvents$b($SashPanel, {
8885
8830
  [PointerDown]: handleSashPointerDown,
8886
8831
  [DoubleClick]: handleSashDoubleClick
8887
8832
  });
8888
- attachEvents$c(window, {
8833
+ attachEvents$b(window, {
8889
8834
  [Resize]: handleResize,
8890
8835
  [Focus]: handleFocus$3,
8891
8836
  [Blur]: handleBlur$3,
@@ -8950,7 +8895,7 @@ const attachEvents$6 = state => {
8950
8895
  const {
8951
8896
  $Viewlet
8952
8897
  } = state;
8953
- attachEvents$c($Viewlet, {
8898
+ attachEvents$b($Viewlet, {
8954
8899
  [Drop]: handleDrop,
8955
8900
  [DragOver]: handleDragOver,
8956
8901
  [DragEnd]: handleDragEnd,
@@ -9037,7 +8982,11 @@ const ViewletMain = {
9037
8982
 
9038
8983
  // TODO
9039
8984
  const getUid = () => {
9040
- return get(document.getElementById('Main'));
8985
+ const $Main = document.getElementById('Main');
8986
+ if (!$Main) {
8987
+ return 0;
8988
+ }
8989
+ return get($Main);
9041
8990
  };
9042
8991
  const handleTabsWheel = event => {
9043
8992
  const uid = getUid();
@@ -9084,7 +9033,7 @@ const attachEvents$5 = state => {
9084
9033
  const {
9085
9034
  $MainTabs
9086
9035
  } = state;
9087
- attachEvents$c($MainTabs, {
9036
+ attachEvents$b($MainTabs, {
9088
9037
  [MouseDown]: handleTabsMouseDown,
9089
9038
  [ContextMenu]: handleTabsContextMenu,
9090
9039
  [DragStart]: handleDragStart
@@ -9261,13 +9210,13 @@ const attachEvents$4 = state => {
9261
9210
  $ButtonClose,
9262
9211
  $PanelHeader
9263
9212
  } = state;
9264
- attachEvents$c($PanelHeader, {
9213
+ attachEvents$b($PanelHeader, {
9265
9214
  [Click]: handleHeaderClick$2
9266
9215
  });
9267
- attachEvents$c($ButtonMaximize, {
9216
+ attachEvents$b($ButtonMaximize, {
9268
9217
  [Click]: handleClickMaximize
9269
9218
  });
9270
- attachEvents$c($ButtonClose, {
9219
+ attachEvents$b($ButtonClose, {
9271
9220
  [Click]: handleClickClose$1
9272
9221
  });
9273
9222
  };
@@ -9324,7 +9273,7 @@ const setActionsDom$1 = (state$1, actions, childUid) => {
9324
9273
  throw new Error(`child instance not found`);
9325
9274
  }
9326
9275
  const eventMap = instance.factory.EventMap;
9327
- rememberFocus($PanelActions, actions, eventMap);
9276
+ rememberFocus($PanelActions, actions, eventMap, 0);
9328
9277
  };
9329
9278
 
9330
9279
  const ViewletPanel = {
@@ -9583,11 +9532,11 @@ const attachEvents$3 = state => {
9583
9532
  $QuickPickItems,
9584
9533
  $QuickPickInput
9585
9534
  } = state;
9586
- attachEvents$c($QuickPickItems, {
9535
+ attachEvents$b($QuickPickItems, {
9587
9536
  [PointerDown]: handlePointerDown
9588
9537
  });
9589
9538
  $QuickPickItems.addEventListener(Wheel, handleWheel$3, Passive);
9590
- attachEvents$c($QuickPickInput, {
9539
+ attachEvents$b($QuickPickInput, {
9591
9540
  [Blur]: handleBlur$2,
9592
9541
  [BeforeInput]: handleBeforeInput
9593
9542
  });
@@ -10062,7 +10011,7 @@ const attachEvents$2 = state => {
10062
10011
  const {
10063
10012
  $SideBarTitleArea
10064
10013
  } = state;
10065
- attachEvents$c($SideBarTitleArea, {
10014
+ attachEvents$b($SideBarTitleArea, {
10066
10015
  [Click]: handleHeaderClick
10067
10016
  });
10068
10017
  };
@@ -10635,7 +10584,7 @@ const attachEvents = state => {
10635
10584
  const {
10636
10585
  $Viewlet
10637
10586
  } = state;
10638
- attachEvents$c($Viewlet, {
10587
+ attachEvents$b($Viewlet, {
10639
10588
  [ContextMenu]: handleContextMenu$1
10640
10589
  });
10641
10590
  };