@lvce-editor/activity-bar-worker 7.19.1 → 7.20.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.
@@ -249,7 +249,7 @@ const {
249
249
  get: get$2,
250
250
  getCommandIds,
251
251
  registerCommands,
252
- set: set$3,
252
+ set: set$5,
253
253
  wrapAsyncCommand,
254
254
  wrapCommand,
255
255
  wrapGetter
@@ -284,7 +284,7 @@ const create$9 = (id, uri, x, y, width, height, args, parentUid, platform = 0) =
284
284
  x,
285
285
  y
286
286
  };
287
- set$3(id, state, state);
287
+ set$5(id, state, state);
288
288
  return state;
289
289
  };
290
290
 
@@ -594,6 +594,7 @@ const LeftClick = 0;
594
594
  const Electron = 2;
595
595
 
596
596
  const ExtensionManagementWorker = 9006;
597
+ const RendererProcess = 1670;
597
598
  const RendererWorker = 1;
598
599
 
599
600
  const Left = 1;
@@ -1966,7 +1967,7 @@ const createMockRpc = ({
1966
1967
  };
1967
1968
 
1968
1969
  const rpcs = Object.create(null);
1969
- const set$2 = (id, rpc) => {
1970
+ const set$4 = (id, rpc) => {
1970
1971
  rpcs[id] = rpc;
1971
1972
  };
1972
1973
  const get = id => {
@@ -1999,7 +2000,7 @@ const create = rpcId => {
1999
2000
  const mockRpc = createMockRpc({
2000
2001
  commandMap
2001
2002
  });
2002
- set$2(rpcId, mockRpc);
2003
+ set$4(rpcId, mockRpc);
2003
2004
  // @ts-ignore
2004
2005
  mockRpc[Symbol.dispose] = () => {
2005
2006
  remove(rpcId);
@@ -2008,27 +2009,32 @@ const create = rpcId => {
2008
2009
  return mockRpc;
2009
2010
  },
2010
2011
  set(rpc) {
2011
- set$2(rpcId, rpc);
2012
+ set$4(rpcId, rpc);
2012
2013
  }
2013
2014
  };
2014
2015
  };
2015
2016
 
2016
2017
  const {
2017
- invoke: invoke$1,
2018
- set: set$1
2018
+ invoke: invoke$3,
2019
+ set: set$3
2019
2020
  } = create(ExtensionManagementWorker);
2020
2021
 
2021
2022
  const {
2022
- invoke,
2023
+ invoke: invoke$2,
2024
+ set: set$2
2025
+ } = create(RendererProcess);
2026
+
2027
+ const {
2028
+ invoke: invoke$1,
2023
2029
  invokeAndTransfer,
2024
- set
2030
+ set: set$1
2025
2031
  } = create(RendererWorker);
2026
2032
  const showContextMenu2 = async (uid, menuId, x, y, args) => {
2027
2033
  number(uid);
2028
2034
  number(menuId);
2029
2035
  number(x);
2030
2036
  number(y);
2031
- await invoke('ContextMenu.show2', uid, menuId, x, y, args);
2037
+ await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
2032
2038
  };
2033
2039
  const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
2034
2040
  const command = 'Extensions.handleMessagePort';
@@ -2046,7 +2052,7 @@ const handleClickAccount = async (state, eventX, eventY, viewletId) => {
2046
2052
  uid
2047
2053
  } = state;
2048
2054
  try {
2049
- await invoke('Layout.refreshAuthState');
2055
+ await invoke$1('Layout.refreshAuthState');
2050
2056
  } catch {
2051
2057
  // Keep the account menu available when auth is unavailable.
2052
2058
  }
@@ -2238,7 +2244,7 @@ const getBadgeText = badgeCount => {
2238
2244
 
2239
2245
  const updateItemsWithBadgeCount = async items => {
2240
2246
  try {
2241
- const badgeCounts = await invoke('Layout.getBadgeCounts');
2247
+ const badgeCounts = await invoke$1('Layout.getBadgeCounts');
2242
2248
  const newItems = items.map(item => {
2243
2249
  const badgeCount = badgeCounts[item.id] || 0;
2244
2250
  const badgeText = getBadgeText(badgeCount);
@@ -2389,7 +2395,7 @@ const getSideBarChange = (sideBarVisible, currentViewletId, viewletId) => {
2389
2395
  };
2390
2396
 
2391
2397
  const toggle = async id => {
2392
- await invoke('Layout.toggleSideBarView', id);
2398
+ await invoke$1('Layout.toggleSideBarView', id);
2393
2399
  };
2394
2400
 
2395
2401
  const handleClickOther = async (state, viewletId) => {
@@ -2502,18 +2508,18 @@ const handleClick = async (state, button, eventX, eventY, targetName = '') => {
2502
2508
  };
2503
2509
 
2504
2510
  const handleClickSignIn = async state => {
2505
- await invoke('Layout.signIn');
2511
+ await invoke$1('Layout.signIn');
2506
2512
  return state;
2507
2513
  };
2508
2514
 
2509
2515
  const handleClickSignOut = async state => {
2510
- await invoke('Layout.signOut');
2516
+ await invoke$1('Layout.signOut');
2511
2517
  return state;
2512
2518
  };
2513
2519
 
2514
2520
  const getSideBarPosition = async () => {
2515
2521
  try {
2516
- return await invoke('Layout.getSideBarPosition');
2522
+ return await invoke$1('Layout.getSideBarPosition');
2517
2523
  } catch {
2518
2524
  return Left;
2519
2525
  }
@@ -2542,7 +2548,7 @@ const handleExtensionManagementMessagePort = async port => {
2542
2548
  commandMap: commandMap$1,
2543
2549
  messagePort: port
2544
2550
  });
2545
- set$1(rpc);
2551
+ set$3(rpc);
2546
2552
  };
2547
2553
 
2548
2554
  const hashString = value => {
@@ -2661,7 +2667,7 @@ const getActivityBarItems = (state, contributedViews = []) => {
2661
2667
 
2662
2668
  const getContributedViews = async platform => {
2663
2669
  try {
2664
- const views = await invoke$1('Extensions.getViews', '', platform);
2670
+ const views = await invoke$3('Extensions.getViews', '', platform);
2665
2671
  if (!Array.isArray(views)) {
2666
2672
  return [];
2667
2673
  }
@@ -2725,6 +2731,31 @@ const handleFocus = state => {
2725
2731
  };
2726
2732
  };
2727
2733
 
2734
+ const state = {
2735
+ connected: false
2736
+ };
2737
+ const isConnected = () => {
2738
+ const {
2739
+ connected
2740
+ } = state;
2741
+ return connected;
2742
+ };
2743
+ const invoke = (method, ...params) => {
2744
+ return invoke$2(method, ...params);
2745
+ };
2746
+ const set = rpc => {
2747
+ set$2(rpc);
2748
+ state.connected = true;
2749
+ };
2750
+
2751
+ const handleMessagePort = async port => {
2752
+ const rpc = await create$4({
2753
+ commandMap: {},
2754
+ messagePort: port
2755
+ });
2756
+ set(rpc);
2757
+ };
2758
+
2728
2759
  const handleResize = (state, dimensions) => {
2729
2760
  const {
2730
2761
  activityBarItems,
@@ -2749,7 +2780,7 @@ const handleResize = (state, dimensions) => {
2749
2780
 
2750
2781
  const getAccountEnabled = async defaultValue => {
2751
2782
  try {
2752
- const value = await invoke('Preferences.get', 'activityBar.accountEnabled');
2783
+ const value = await invoke$1('Preferences.get', 'activityBar.accountEnabled');
2753
2784
  return typeof value === 'boolean' ? value : defaultValue;
2754
2785
  } catch {
2755
2786
  return defaultValue;
@@ -2783,7 +2814,7 @@ const handleSettingsChanged = async state => {
2783
2814
 
2784
2815
  const getSideBarVisible = async () => {
2785
2816
  try {
2786
- const visible = await invoke('Layout.getSideBarVisible');
2817
+ const visible = await invoke$1('Layout.getSideBarVisible');
2787
2818
  return visible;
2788
2819
  } catch {
2789
2820
  return true;
@@ -2879,7 +2910,7 @@ const handleUpdateStateChange = async (state, config) => {
2879
2910
 
2880
2911
  const getActiveView = async () => {
2881
2912
  try {
2882
- const activeView = await invoke('Layout.getActiveSideBarView');
2913
+ const activeView = await invoke$1('Layout.getActiveSideBarView');
2883
2914
  return activeView;
2884
2915
  } catch {
2885
2916
  return Explorer;
@@ -3548,14 +3579,23 @@ const applyRender = (oldState, newState, diffResult) => {
3548
3579
  return commands;
3549
3580
  };
3550
3581
 
3582
+ const renderDirect = async (uid, commands) => {
3583
+ const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
3584
+ const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
3585
+ const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
3586
+ return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
3587
+ };
3551
3588
  const render2 = (uid, diffResult) => {
3552
3589
  const {
3553
3590
  newState,
3554
3591
  oldState
3555
3592
  } = get$2(uid);
3556
- set$3(uid, newState, newState);
3593
+ set$5(uid, newState, newState);
3557
3594
  const commands = applyRender(oldState, newState, diffResult);
3558
- return commands;
3595
+ if (!isConnected()) {
3596
+ return commands;
3597
+ }
3598
+ return renderDirect(uid, commands);
3559
3599
  };
3560
3600
 
3561
3601
  const renderEventListeners = () => {
@@ -3763,7 +3803,7 @@ const toggleActivityBarItem = async (state, itemId) => {
3763
3803
  };
3764
3804
 
3765
3805
  const wakeUp = sleepState => {
3766
- set$3(sleepState.uid, sleepState, sleepState);
3806
+ set$5(sleepState.uid, sleepState, sleepState);
3767
3807
  };
3768
3808
 
3769
3809
  const commandMap = {
@@ -3795,6 +3835,7 @@ const commandMap = {
3795
3835
  'ActivityBar.handleExtensionManagementMessagePort': handleExtensionManagementMessagePort,
3796
3836
  'ActivityBar.handleExtensionsChanged': wrapCommand(handleExtensionsChanged),
3797
3837
  'ActivityBar.handleFocus': wrapCommand(handleFocus),
3838
+ 'ActivityBar.handleMessagePort': handleMessagePort,
3798
3839
  'ActivityBar.handleSettingsChanged': wrapCommand(handleSettingsChanged),
3799
3840
  'ActivityBar.handleSideBarStateChange': wrapCommand(handleSideBarStateChange),
3800
3841
  'ActivityBar.handleUpdateStateChange': wrapCommand(handleUpdateStateChange),
@@ -3821,14 +3862,14 @@ const initializeExtensionManagementWorker = async () => {
3821
3862
  commandMap: {},
3822
3863
  send
3823
3864
  });
3824
- set$1(rpc);
3865
+ set$3(rpc);
3825
3866
  };
3826
3867
 
3827
3868
  const initializeRendererWorker = async () => {
3828
3869
  const rpc = await create$1({
3829
3870
  commandMap: commandMap
3830
3871
  });
3831
- set(rpc);
3872
+ set$1(rpc);
3832
3873
  };
3833
3874
 
3834
3875
  const listen = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/activity-bar-worker",
3
- "version": "7.19.1",
3
+ "version": "7.20.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",