@lvce-editor/activity-bar-worker 4.1.0 → 4.4.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 +133 -90
- package/package.json +1 -1
|
@@ -457,12 +457,12 @@ const getErrorConstructor = (message, type) => {
|
|
|
457
457
|
switch (type) {
|
|
458
458
|
case DomException:
|
|
459
459
|
return DOMException;
|
|
460
|
-
case TypeError$1:
|
|
461
|
-
return TypeError;
|
|
462
|
-
case SyntaxError$1:
|
|
463
|
-
return SyntaxError;
|
|
464
460
|
case ReferenceError$1:
|
|
465
461
|
return ReferenceError;
|
|
462
|
+
case SyntaxError$1:
|
|
463
|
+
return SyntaxError;
|
|
464
|
+
case TypeError$1:
|
|
465
|
+
return TypeError;
|
|
466
466
|
default:
|
|
467
467
|
return Error;
|
|
468
468
|
}
|
|
@@ -618,27 +618,27 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
618
618
|
if (error && error.code === E_COMMAND_NOT_FOUND) {
|
|
619
619
|
return {
|
|
620
620
|
code: MethodNotFound,
|
|
621
|
-
|
|
622
|
-
|
|
621
|
+
data: error.stack,
|
|
622
|
+
message: error.message
|
|
623
623
|
};
|
|
624
624
|
}
|
|
625
625
|
return {
|
|
626
626
|
code: Custom,
|
|
627
|
-
message: prettyError.message,
|
|
628
627
|
data: {
|
|
629
|
-
stack: getStack(prettyError),
|
|
630
|
-
codeFrame: prettyError.codeFrame,
|
|
631
|
-
type: getErrorType(prettyError),
|
|
632
628
|
code: prettyError.code,
|
|
633
|
-
|
|
634
|
-
|
|
629
|
+
codeFrame: prettyError.codeFrame,
|
|
630
|
+
name: prettyError.name,
|
|
631
|
+
stack: getStack(prettyError),
|
|
632
|
+
type: getErrorType(prettyError)
|
|
633
|
+
},
|
|
634
|
+
message: prettyError.message
|
|
635
635
|
};
|
|
636
636
|
};
|
|
637
637
|
const create$1$1 = (id, error) => {
|
|
638
638
|
return {
|
|
639
|
-
|
|
639
|
+
error,
|
|
640
640
|
id,
|
|
641
|
-
|
|
641
|
+
jsonrpc: Two$1
|
|
642
642
|
};
|
|
643
643
|
};
|
|
644
644
|
const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
@@ -649,8 +649,8 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
649
649
|
};
|
|
650
650
|
const create$7 = (message, result) => {
|
|
651
651
|
return {
|
|
652
|
-
jsonrpc: Two$1,
|
|
653
652
|
id: message.id,
|
|
653
|
+
jsonrpc: Two$1,
|
|
654
654
|
result: result ?? null
|
|
655
655
|
};
|
|
656
656
|
};
|
|
@@ -660,14 +660,14 @@ const getSuccessResponse = (message, result) => {
|
|
|
660
660
|
};
|
|
661
661
|
const getErrorResponseSimple = (id, error) => {
|
|
662
662
|
return {
|
|
663
|
-
jsonrpc: Two$1,
|
|
664
|
-
id,
|
|
665
663
|
error: {
|
|
666
664
|
code: Custom,
|
|
665
|
+
data: error,
|
|
667
666
|
// @ts-ignore
|
|
668
|
-
message: error.message
|
|
669
|
-
|
|
670
|
-
|
|
667
|
+
message: error.message
|
|
668
|
+
},
|
|
669
|
+
id,
|
|
670
|
+
jsonrpc: Two$1
|
|
671
671
|
};
|
|
672
672
|
};
|
|
673
673
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
@@ -697,35 +697,35 @@ const normalizeParams = args => {
|
|
|
697
697
|
if (args.length === 1) {
|
|
698
698
|
const options = args[0];
|
|
699
699
|
return {
|
|
700
|
+
execute: options.execute,
|
|
700
701
|
ipc: options.ipc,
|
|
702
|
+
logError: options.logError || defaultLogError,
|
|
701
703
|
message: options.message,
|
|
702
|
-
execute: options.execute,
|
|
703
|
-
resolve: options.resolve || defaultResolve,
|
|
704
704
|
preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
|
|
705
|
-
|
|
706
|
-
|
|
705
|
+
requiresSocket: options.requiresSocket || defaultRequiresSocket,
|
|
706
|
+
resolve: options.resolve || defaultResolve
|
|
707
707
|
};
|
|
708
708
|
}
|
|
709
709
|
return {
|
|
710
|
+
execute: args[2],
|
|
710
711
|
ipc: args[0],
|
|
712
|
+
logError: args[5],
|
|
711
713
|
message: args[1],
|
|
712
|
-
execute: args[2],
|
|
713
|
-
resolve: args[3],
|
|
714
714
|
preparePrettyError: args[4],
|
|
715
|
-
|
|
716
|
-
|
|
715
|
+
requiresSocket: args[6],
|
|
716
|
+
resolve: args[3]
|
|
717
717
|
};
|
|
718
718
|
};
|
|
719
719
|
const handleJsonRpcMessage = async (...args) => {
|
|
720
720
|
const options = normalizeParams(args);
|
|
721
721
|
const {
|
|
722
|
-
message,
|
|
723
|
-
ipc,
|
|
724
722
|
execute,
|
|
725
|
-
|
|
726
|
-
preparePrettyError,
|
|
723
|
+
ipc,
|
|
727
724
|
logError,
|
|
728
|
-
|
|
725
|
+
message,
|
|
726
|
+
preparePrettyError,
|
|
727
|
+
requiresSocket,
|
|
728
|
+
resolve
|
|
729
729
|
} = options;
|
|
730
730
|
if ('id' in message) {
|
|
731
731
|
if ('method' in message) {
|
|
@@ -786,7 +786,6 @@ const registerPromise = map => {
|
|
|
786
786
|
};
|
|
787
787
|
};
|
|
788
788
|
|
|
789
|
-
// @ts-ignore
|
|
790
789
|
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
791
790
|
const {
|
|
792
791
|
id,
|
|
@@ -879,54 +878,6 @@ const create$3 = async ({
|
|
|
879
878
|
return rpc;
|
|
880
879
|
};
|
|
881
880
|
|
|
882
|
-
const Button$2 = 'button';
|
|
883
|
-
const None$1 = 'none';
|
|
884
|
-
const Tab$1 = 'tab';
|
|
885
|
-
const ToolBar = 'toolbar';
|
|
886
|
-
|
|
887
|
-
const Div = 4;
|
|
888
|
-
const Text = 12;
|
|
889
|
-
const Reference = 100;
|
|
890
|
-
|
|
891
|
-
const Button$1 = 'event.button';
|
|
892
|
-
const ClientX = 'event.clientX';
|
|
893
|
-
const ClientY = 'event.clientY';
|
|
894
|
-
|
|
895
|
-
const Enter = 3;
|
|
896
|
-
const Space = 9;
|
|
897
|
-
const PageUp = 10;
|
|
898
|
-
const PageDown = 11;
|
|
899
|
-
const End = 255;
|
|
900
|
-
const Home = 12;
|
|
901
|
-
const UpArrow = 14;
|
|
902
|
-
const DownArrow = 16;
|
|
903
|
-
|
|
904
|
-
const ActivityBar$3 = 1;
|
|
905
|
-
const Settings$1 = 12;
|
|
906
|
-
const ActivityBarAdditionalViews = 17;
|
|
907
|
-
|
|
908
|
-
const Separator = 1;
|
|
909
|
-
const None = 0;
|
|
910
|
-
const Checked = 2;
|
|
911
|
-
const Unchecked = 3;
|
|
912
|
-
|
|
913
|
-
const LeftClick = 0;
|
|
914
|
-
|
|
915
|
-
const Web = 1;
|
|
916
|
-
|
|
917
|
-
const RendererWorker = 1;
|
|
918
|
-
|
|
919
|
-
const Left = 1;
|
|
920
|
-
const Right = 2;
|
|
921
|
-
|
|
922
|
-
const SetCss = 'Viewlet.setCss';
|
|
923
|
-
const SetDom2 = 'Viewlet.setDom2';
|
|
924
|
-
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
925
|
-
const SetPatches = 'Viewlet.setPatches';
|
|
926
|
-
|
|
927
|
-
const FocusActivityBar = 5;
|
|
928
|
-
const FocusExplorer = 13;
|
|
929
|
-
|
|
930
881
|
const createMockRpc = ({
|
|
931
882
|
commandMap
|
|
932
883
|
}) => {
|
|
@@ -995,6 +946,54 @@ const create$2 = rpcId => {
|
|
|
995
946
|
};
|
|
996
947
|
};
|
|
997
948
|
|
|
949
|
+
const Button$2 = 'button';
|
|
950
|
+
const None$1 = 'none';
|
|
951
|
+
const Tab$1 = 'tab';
|
|
952
|
+
const ToolBar = 'toolbar';
|
|
953
|
+
|
|
954
|
+
const Div = 4;
|
|
955
|
+
const Text = 12;
|
|
956
|
+
const Reference = 100;
|
|
957
|
+
|
|
958
|
+
const Button$1 = 'event.button';
|
|
959
|
+
const ClientX = 'event.clientX';
|
|
960
|
+
const ClientY = 'event.clientY';
|
|
961
|
+
|
|
962
|
+
const Enter = 3;
|
|
963
|
+
const Space = 9;
|
|
964
|
+
const PageUp = 10;
|
|
965
|
+
const PageDown = 11;
|
|
966
|
+
const End = 255;
|
|
967
|
+
const Home = 12;
|
|
968
|
+
const UpArrow = 14;
|
|
969
|
+
const DownArrow = 16;
|
|
970
|
+
|
|
971
|
+
const ActivityBar$3 = 1;
|
|
972
|
+
const Settings$1 = 12;
|
|
973
|
+
const ActivityBarAdditionalViews = 17;
|
|
974
|
+
|
|
975
|
+
const Separator = 1;
|
|
976
|
+
const None = 0;
|
|
977
|
+
const Checked = 2;
|
|
978
|
+
const Unchecked = 3;
|
|
979
|
+
|
|
980
|
+
const LeftClick = 0;
|
|
981
|
+
|
|
982
|
+
const Web = 1;
|
|
983
|
+
|
|
984
|
+
const RendererWorker = 1;
|
|
985
|
+
|
|
986
|
+
const Left = 1;
|
|
987
|
+
const Right = 2;
|
|
988
|
+
|
|
989
|
+
const SetCss = 'Viewlet.setCss';
|
|
990
|
+
const SetDom2 = 'Viewlet.setDom2';
|
|
991
|
+
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
992
|
+
const SetPatches = 'Viewlet.setPatches';
|
|
993
|
+
|
|
994
|
+
const FocusActivityBar = 5;
|
|
995
|
+
const FocusExplorer = 13;
|
|
996
|
+
|
|
998
997
|
const {
|
|
999
998
|
invoke,
|
|
1000
999
|
set: set$1
|
|
@@ -1047,7 +1046,7 @@ const create$1 = () => {
|
|
|
1047
1046
|
},
|
|
1048
1047
|
getKeys() {
|
|
1049
1048
|
return Object.keys(states).map(key => {
|
|
1050
|
-
return Number.
|
|
1049
|
+
return Number.parseFloat(key);
|
|
1051
1050
|
});
|
|
1052
1051
|
},
|
|
1053
1052
|
registerCommands(commandMap) {
|
|
@@ -1089,6 +1088,37 @@ const create$1 = () => {
|
|
|
1089
1088
|
return fn(newState, ...args);
|
|
1090
1089
|
};
|
|
1091
1090
|
return wrapped;
|
|
1091
|
+
},
|
|
1092
|
+
wrapLoadContent(fn) {
|
|
1093
|
+
const wrapped = async (uid, ...args) => {
|
|
1094
|
+
const {
|
|
1095
|
+
newState,
|
|
1096
|
+
oldState
|
|
1097
|
+
} = states[uid];
|
|
1098
|
+
const result = await fn(newState, ...args);
|
|
1099
|
+
const {
|
|
1100
|
+
error,
|
|
1101
|
+
state
|
|
1102
|
+
} = result;
|
|
1103
|
+
if (oldState === state || newState === state) {
|
|
1104
|
+
return {
|
|
1105
|
+
error
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
const latestOld = states[uid];
|
|
1109
|
+
const latestNew = {
|
|
1110
|
+
...latestOld.newState,
|
|
1111
|
+
...state
|
|
1112
|
+
};
|
|
1113
|
+
states[uid] = {
|
|
1114
|
+
newState: latestNew,
|
|
1115
|
+
oldState: latestOld.oldState
|
|
1116
|
+
};
|
|
1117
|
+
return {
|
|
1118
|
+
error
|
|
1119
|
+
};
|
|
1120
|
+
};
|
|
1121
|
+
return wrapped;
|
|
1092
1122
|
}
|
|
1093
1123
|
};
|
|
1094
1124
|
};
|
|
@@ -1128,6 +1158,7 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
|
|
|
1128
1158
|
uid: id,
|
|
1129
1159
|
updateProgress: 0,
|
|
1130
1160
|
updateState: '',
|
|
1161
|
+
userLoginState: 'logged out',
|
|
1131
1162
|
width,
|
|
1132
1163
|
x,
|
|
1133
1164
|
y
|
|
@@ -1145,7 +1176,7 @@ const isEqual$1 = (oldState, newState) => {
|
|
|
1145
1176
|
};
|
|
1146
1177
|
|
|
1147
1178
|
const isEqual = (oldState, newState) => {
|
|
1148
|
-
return oldState.activityBarItems === newState.activityBarItems && oldState.filteredItems === newState.filteredItems && oldState.focusedIndex === newState.focusedIndex && oldState.updateProgress === newState.updateProgress && oldState.updateState === newState.updateState;
|
|
1179
|
+
return oldState.activityBarItems === newState.activityBarItems && oldState.filteredItems === newState.filteredItems && oldState.focusedIndex === newState.focusedIndex && oldState.sideBarLocation === newState.sideBarLocation && oldState.sideBarVisible === newState.sideBarVisible && oldState.updateProgress === newState.updateProgress && oldState.updateState === newState.updateState;
|
|
1149
1180
|
};
|
|
1150
1181
|
|
|
1151
1182
|
const RenderItems = 4;
|
|
@@ -1591,7 +1622,7 @@ const hide = async () => {
|
|
|
1591
1622
|
await invoke('Layout.hideSideBar');
|
|
1592
1623
|
};
|
|
1593
1624
|
|
|
1594
|
-
const handleClickOther = async (state,
|
|
1625
|
+
const handleClickOther = async (state, viewletId) => {
|
|
1595
1626
|
const {
|
|
1596
1627
|
currentViewletId,
|
|
1597
1628
|
sideBarVisible
|
|
@@ -1638,7 +1669,7 @@ const handleClickIndex = async (state, button, index, x, y) => {
|
|
|
1638
1669
|
case 'Settings':
|
|
1639
1670
|
return handleClickSettings(state, x, y);
|
|
1640
1671
|
default:
|
|
1641
|
-
return handleClickOther(state,
|
|
1672
|
+
return handleClickOther(state, viewletId);
|
|
1642
1673
|
}
|
|
1643
1674
|
};
|
|
1644
1675
|
|
|
@@ -1824,14 +1855,22 @@ const handleSettingsChanged = async state => {
|
|
|
1824
1855
|
};
|
|
1825
1856
|
};
|
|
1826
1857
|
|
|
1858
|
+
const clearItem = item => {
|
|
1859
|
+
const withoutSelected = setFlag(item, Selected, false);
|
|
1860
|
+
return setFlag(withoutSelected, Focused, false);
|
|
1861
|
+
};
|
|
1827
1862
|
const handleSideBarHidden = state => {
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1863
|
+
const {
|
|
1864
|
+
activityBarItems,
|
|
1865
|
+
height,
|
|
1866
|
+
itemHeight
|
|
1867
|
+
} = state;
|
|
1868
|
+
const itemsCleared = activityBarItems.map(clearItem);
|
|
1869
|
+
const filteredItems = getFilteredActivityBarItems(itemsCleared, height, itemHeight);
|
|
1832
1870
|
return {
|
|
1833
1871
|
...state,
|
|
1834
1872
|
activityBarItems: itemsCleared,
|
|
1873
|
+
filteredItems,
|
|
1835
1874
|
focusedIndex: -1,
|
|
1836
1875
|
selectedIndex: -1,
|
|
1837
1876
|
sideBarVisible: false
|
|
@@ -2492,6 +2531,9 @@ const renderIncremental = (oldState, newState) => {
|
|
|
2492
2531
|
const oldDom = renderItems(oldState, oldState)[2];
|
|
2493
2532
|
const newDom = renderItems(newState, newState)[2];
|
|
2494
2533
|
const patches = diffTree(oldDom, newDom);
|
|
2534
|
+
if (patches.length === 0) {
|
|
2535
|
+
return [];
|
|
2536
|
+
}
|
|
2495
2537
|
return [SetPatches, newState.uid, patches];
|
|
2496
2538
|
};
|
|
2497
2539
|
|
|
@@ -2619,6 +2661,7 @@ const commandMap = {
|
|
|
2619
2661
|
'ActivityBar.handleBlur': wrapCommand(handleBlur),
|
|
2620
2662
|
'ActivityBar.handleClick': wrapCommand(handleClick),
|
|
2621
2663
|
'ActivityBar.handleClickIndex': wrapCommand(handleClickIndex),
|
|
2664
|
+
'ActivityBar.handleClickSettings': wrapCommand(handleClickSettings),
|
|
2622
2665
|
'ActivityBar.handleContextMenu': wrapCommand(handleContextMenu),
|
|
2623
2666
|
'ActivityBar.handleFocus': wrapCommand(handleFocus),
|
|
2624
2667
|
'ActivityBar.handleSettingsChanged': wrapCommand(handleSettingsChanged),
|