@lvce-editor/activity-bar-worker 3.2.0 → 4.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.
- package/dist/activityBarWorkerMain.js +45 -14
- package/package.json +1 -1
|
@@ -613,7 +613,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
613
613
|
}
|
|
614
614
|
};
|
|
615
615
|
};
|
|
616
|
-
const create$1$
|
|
616
|
+
const create$1$1 = (id, error) => {
|
|
617
617
|
return {
|
|
618
618
|
jsonrpc: Two$1,
|
|
619
619
|
id,
|
|
@@ -624,7 +624,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
624
624
|
const prettyError = preparePrettyError(error);
|
|
625
625
|
logError(error, prettyError);
|
|
626
626
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
627
|
-
return create$1$
|
|
627
|
+
return create$1$1(id, errorProperty);
|
|
628
628
|
};
|
|
629
629
|
const create$3 = (message, result) => {
|
|
630
630
|
return {
|
|
@@ -749,14 +749,14 @@ const execute = (command, ...args) => {
|
|
|
749
749
|
};
|
|
750
750
|
|
|
751
751
|
const Two = '2.0';
|
|
752
|
-
const create$
|
|
752
|
+
const create$t = (method, params) => {
|
|
753
753
|
return {
|
|
754
754
|
jsonrpc: Two,
|
|
755
755
|
method,
|
|
756
756
|
params
|
|
757
757
|
};
|
|
758
758
|
};
|
|
759
|
-
const create$
|
|
759
|
+
const create$s = (id, method, params) => {
|
|
760
760
|
const message = {
|
|
761
761
|
id,
|
|
762
762
|
jsonrpc: Two,
|
|
@@ -766,14 +766,14 @@ const create$r = (id, method, params) => {
|
|
|
766
766
|
return message;
|
|
767
767
|
};
|
|
768
768
|
let id = 0;
|
|
769
|
-
const create$
|
|
769
|
+
const create$r = () => {
|
|
770
770
|
return ++id;
|
|
771
771
|
};
|
|
772
772
|
|
|
773
773
|
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
774
774
|
|
|
775
775
|
const registerPromise = map => {
|
|
776
|
-
const id = create$
|
|
776
|
+
const id = create$r();
|
|
777
777
|
const {
|
|
778
778
|
promise,
|
|
779
779
|
resolve
|
|
@@ -791,7 +791,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
791
791
|
id,
|
|
792
792
|
promise
|
|
793
793
|
} = registerPromise(callbacks);
|
|
794
|
-
const message = create$
|
|
794
|
+
const message = create$s(id, method, params);
|
|
795
795
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
796
796
|
ipc.sendAndTransfer(message);
|
|
797
797
|
} else {
|
|
@@ -827,7 +827,7 @@ const createRpc = ipc => {
|
|
|
827
827
|
* @deprecated
|
|
828
828
|
*/
|
|
829
829
|
send(method, ...params) {
|
|
830
|
-
const message = create$
|
|
830
|
+
const message = create$t(method, params);
|
|
831
831
|
ipc.send(message);
|
|
832
832
|
}
|
|
833
833
|
};
|
|
@@ -863,7 +863,7 @@ const listen$1 = async (module, options) => {
|
|
|
863
863
|
const ipc = module.wrap(rawIpc);
|
|
864
864
|
return ipc;
|
|
865
865
|
};
|
|
866
|
-
const create$
|
|
866
|
+
const create$2$1 = async ({
|
|
867
867
|
commandMap
|
|
868
868
|
}) => {
|
|
869
869
|
// TODO create a commandMap per rpc instance
|
|
@@ -875,7 +875,7 @@ const create$1$1 = async ({
|
|
|
875
875
|
};
|
|
876
876
|
const WebWorkerRpcClient = {
|
|
877
877
|
__proto__: null,
|
|
878
|
-
create: create$
|
|
878
|
+
create: create$2$1
|
|
879
879
|
};
|
|
880
880
|
const createMockRpc = ({
|
|
881
881
|
commandMap
|
|
@@ -904,6 +904,7 @@ const ToolBar = 'toolbar';
|
|
|
904
904
|
|
|
905
905
|
const Div = 4;
|
|
906
906
|
const Text = 12;
|
|
907
|
+
const Reference = 100;
|
|
907
908
|
|
|
908
909
|
const Button$1 = 'event.button';
|
|
909
910
|
const ClientX = 'event.clientX';
|
|
@@ -1001,7 +1002,6 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
|
1001
1002
|
number(menuId);
|
|
1002
1003
|
number(x);
|
|
1003
1004
|
number(y);
|
|
1004
|
-
// @ts-ignore
|
|
1005
1005
|
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1006
1006
|
};
|
|
1007
1007
|
|
|
@@ -1661,6 +1661,13 @@ const handleContextMenu = async (state, button, eventX, eventY) => {
|
|
|
1661
1661
|
return state;
|
|
1662
1662
|
};
|
|
1663
1663
|
|
|
1664
|
+
const handleFocus = state => {
|
|
1665
|
+
return {
|
|
1666
|
+
...state,
|
|
1667
|
+
focused: true
|
|
1668
|
+
};
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1664
1671
|
const Account = 'Account';
|
|
1665
1672
|
const DebugAlt2 = 'DebugAlt2';
|
|
1666
1673
|
const Extensions$1 = 'Extensions';
|
|
@@ -1904,13 +1911,25 @@ const getActiveView = async () => {
|
|
|
1904
1911
|
}
|
|
1905
1912
|
};
|
|
1906
1913
|
|
|
1914
|
+
const getSideBarVisible = async () => {
|
|
1915
|
+
try {
|
|
1916
|
+
const visible = await invoke('Layout.getSideBarVisible');
|
|
1917
|
+
return visible;
|
|
1918
|
+
} catch {
|
|
1919
|
+
return true;
|
|
1920
|
+
}
|
|
1921
|
+
};
|
|
1922
|
+
|
|
1907
1923
|
const loadContent = async state => {
|
|
1908
1924
|
const {
|
|
1909
1925
|
height,
|
|
1910
1926
|
itemHeight
|
|
1911
1927
|
} = state;
|
|
1912
1928
|
const items = getActivityBarItems(state);
|
|
1929
|
+
// TODO parallelize async calls
|
|
1930
|
+
// or add one function that returns all needed data
|
|
1913
1931
|
const activeView = await getActiveView();
|
|
1932
|
+
const sideBarVisible = await getSideBarVisible();
|
|
1914
1933
|
const index = items.findIndex(item => item.id === activeView);
|
|
1915
1934
|
const itemsWithSelected = markSelected(items, index);
|
|
1916
1935
|
const filteredItems = getFilteredActivityBarItems(itemsWithSelected, height, itemHeight);
|
|
@@ -1924,7 +1943,7 @@ const loadContent = async state => {
|
|
|
1924
1943
|
initial: false,
|
|
1925
1944
|
selectedIndex: index,
|
|
1926
1945
|
sideBarLocation: sidebarLocation,
|
|
1927
|
-
sideBarVisible
|
|
1946
|
+
sideBarVisible
|
|
1928
1947
|
};
|
|
1929
1948
|
};
|
|
1930
1949
|
|
|
@@ -1972,6 +1991,7 @@ const NavigateChild = 7;
|
|
|
1972
1991
|
const NavigateParent = 8;
|
|
1973
1992
|
const RemoveChild = 9;
|
|
1974
1993
|
const NavigateSibling = 10;
|
|
1994
|
+
const SetReferenceNodeUid = 11;
|
|
1975
1995
|
|
|
1976
1996
|
const isKey = key => {
|
|
1977
1997
|
return key !== 'type' && key !== 'childCount';
|
|
@@ -2039,6 +2059,16 @@ const compareNodes = (oldNode, newNode) => {
|
|
|
2039
2059
|
if (oldNode.type !== newNode.type) {
|
|
2040
2060
|
return null;
|
|
2041
2061
|
}
|
|
2062
|
+
// Handle reference nodes - special handling for uid changes
|
|
2063
|
+
if (oldNode.type === Reference) {
|
|
2064
|
+
if (oldNode.uid !== newNode.uid) {
|
|
2065
|
+
patches.push({
|
|
2066
|
+
type: SetReferenceNodeUid,
|
|
2067
|
+
uid: newNode.uid
|
|
2068
|
+
});
|
|
2069
|
+
}
|
|
2070
|
+
return patches;
|
|
2071
|
+
}
|
|
2042
2072
|
// Handle text nodes
|
|
2043
2073
|
if (oldNode.type === Text && newNode.type === Text) {
|
|
2044
2074
|
if (oldNode.text !== newNode.text) {
|
|
@@ -2518,8 +2548,8 @@ const renderEventListeners = () => {
|
|
|
2518
2548
|
}, {
|
|
2519
2549
|
name: HandleMouseDown,
|
|
2520
2550
|
params: ['handleClick', Button$1, ClientX, ClientY],
|
|
2521
|
-
preventDefault:
|
|
2522
|
-
stopPropagation:
|
|
2551
|
+
preventDefault: false,
|
|
2552
|
+
stopPropagation: false
|
|
2523
2553
|
}];
|
|
2524
2554
|
};
|
|
2525
2555
|
|
|
@@ -2590,6 +2620,7 @@ const commandMap = {
|
|
|
2590
2620
|
'ActivityBar.handleClick': wrapCommand(handleClick),
|
|
2591
2621
|
'ActivityBar.handleClickIndex': wrapCommand(handleClickIndex),
|
|
2592
2622
|
'ActivityBar.handleContextMenu': wrapCommand(handleContextMenu),
|
|
2623
|
+
'ActivityBar.handleFocus': wrapCommand(handleFocus),
|
|
2593
2624
|
'ActivityBar.handleSettingsChanged': wrapCommand(handleSettingsChanged),
|
|
2594
2625
|
'ActivityBar.handleSideBarHidden': wrapCommand(handleSideBarHidden),
|
|
2595
2626
|
'ActivityBar.handleSideBarViewletChange': wrapCommand(handleSideBarViewletChange),
|