@lvce-editor/title-bar-worker 4.25.0 → 4.25.1

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.
@@ -54,6 +54,61 @@ class VError extends Error {
54
54
  }
55
55
  }
56
56
 
57
+ class AssertionError extends Error {
58
+ constructor(message) {
59
+ super(message);
60
+ this.name = 'AssertionError';
61
+ }
62
+ }
63
+ const Object$1 = 1;
64
+ const Number$1 = 2;
65
+ const Array$1 = 3;
66
+ const String$1 = 4;
67
+ const Boolean$1 = 5;
68
+ const Function = 6;
69
+ const Null = 7;
70
+ const Unknown$1 = 8;
71
+ const getType = value => {
72
+ switch (typeof value) {
73
+ case 'number':
74
+ return Number$1;
75
+ case 'function':
76
+ return Function;
77
+ case 'string':
78
+ return String$1;
79
+ case 'object':
80
+ if (value === null) {
81
+ return Null;
82
+ }
83
+ if (Array.isArray(value)) {
84
+ return Array$1;
85
+ }
86
+ return Object$1;
87
+ case 'boolean':
88
+ return Boolean$1;
89
+ default:
90
+ return Unknown$1;
91
+ }
92
+ };
93
+ const object = value => {
94
+ const type = getType(value);
95
+ if (type !== Object$1) {
96
+ throw new AssertionError('expected value to be of type object');
97
+ }
98
+ };
99
+ const number = value => {
100
+ const type = getType(value);
101
+ if (type !== Number$1) {
102
+ throw new AssertionError('expected value to be of type number');
103
+ }
104
+ };
105
+ const array = value => {
106
+ const type = getType(value);
107
+ if (type !== Array$1) {
108
+ throw new AssertionError('expected value to be of type array');
109
+ }
110
+ };
111
+
57
112
  const isMessagePort = value => {
58
113
  return value && value instanceof MessagePort;
59
114
  };
@@ -602,6 +657,9 @@ const restoreExistingError = (error, currentStack) => {
602
657
  };
603
658
  const restoreMethodNotFoundError = (error, currentStack) => {
604
659
  const restoredError = new JsonRpcError(error.message);
660
+ Object.assign(restoredError, {
661
+ code: error.code
662
+ });
605
663
  const parentStack = getParentStack(error);
606
664
  setStack(restoredError, `${parentStack}${NewLine}${currentStack}`);
607
665
  return restoredError;
@@ -621,9 +679,13 @@ const applyDataProperties = (restoredError, error) => {
621
679
  // @ts-ignore
622
680
  restoredError.codeFrame = error.data.codeFrame;
623
681
  }
624
- if (error.data.code) {
682
+ if (typeof error.data.code === 'string' || typeof error.data.code === 'number') {
625
683
  // @ts-ignore
626
- restoredError.code = error.data.code;
684
+ Object.defineProperty(restoredError, 'code', {
685
+ configurable: true,
686
+ value: error.data.code,
687
+ writable: true
688
+ });
627
689
  }
628
690
  if (error.data.type) {
629
691
  // @ts-ignore
@@ -644,7 +706,14 @@ const applyDirectProperties = (restoredError, error) => {
644
706
  }
645
707
  };
646
708
  const restoreMessageError = (error, _currentStack) => {
647
- const restoredError = constructError(error.message, error.type, error.name);
709
+ const restoredError = constructError(error.message, error.type || error.data?.type, error.name);
710
+ if (typeof error.code === 'string' || typeof error.code === 'number') {
711
+ Object.defineProperty(restoredError, 'code', {
712
+ configurable: true,
713
+ value: error.code,
714
+ writable: true
715
+ });
716
+ }
648
717
  if (error.data) {
649
718
  applyDataProperties(restoredError, error);
650
719
  } else {
@@ -723,9 +792,9 @@ const getErrorProperty = (error, prettyError) => {
723
792
  return {
724
793
  code: Custom,
725
794
  data: {
726
- code: prettyError.code,
795
+ code: prettyError.code ?? error?.code,
727
796
  codeFrame: prettyError.codeFrame,
728
- name: prettyError.name,
797
+ name: prettyError.name ?? error?.name,
729
798
  stack: getStack(prettyError),
730
799
  type: getErrorType(prettyError)
731
800
  },
@@ -760,7 +829,12 @@ const getErrorResponseSimple = (id, error) => {
760
829
  return {
761
830
  error: {
762
831
  code: Custom,
763
- data: error,
832
+ data: error instanceof Error ? {
833
+ ...error,
834
+ code: 'code' in error ? error.code : undefined,
835
+ stack: error.stack,
836
+ type: error.name
837
+ } : error,
764
838
  // @ts-ignore
765
839
  message: error.message
766
840
  },
@@ -1370,7 +1444,7 @@ const Backslash$2 = 91;
1370
1444
  const Star$1 = 131;
1371
1445
  const Plus$1 = 132;
1372
1446
 
1373
- const Unknown$1 = 'Unknown';
1447
+ const Unknown = 'Unknown';
1374
1448
  const Backspace = 'Backspace';
1375
1449
  const Tab = 'Tab';
1376
1450
  const Enter = 'Enter';
@@ -1503,7 +1577,7 @@ const keyCodeStringMap = {
1503
1577
  [UpArrow$1]: UpArrow
1504
1578
  };
1505
1579
  const getKeyCodeString = keyCode => {
1506
- return keyCodeStringMap[keyCode] || Unknown$1;
1580
+ return keyCodeStringMap[keyCode] || Unknown;
1507
1581
  };
1508
1582
 
1509
1583
  const CtrlCmd = 1 << 11 >>> 0;
@@ -1557,61 +1631,6 @@ const {
1557
1631
  set: set$3
1558
1632
  } = create$2(RendererProcess);
1559
1633
 
1560
- class AssertionError extends Error {
1561
- constructor(message) {
1562
- super(message);
1563
- this.name = 'AssertionError';
1564
- }
1565
- }
1566
- const Object$1 = 1;
1567
- const Number$1 = 2;
1568
- const Array$1 = 3;
1569
- const String$1 = 4;
1570
- const Boolean$1 = 5;
1571
- const Function = 6;
1572
- const Null = 7;
1573
- const Unknown = 8;
1574
- const getType = value => {
1575
- switch (typeof value) {
1576
- case 'number':
1577
- return Number$1;
1578
- case 'function':
1579
- return Function;
1580
- case 'string':
1581
- return String$1;
1582
- case 'object':
1583
- if (value === null) {
1584
- return Null;
1585
- }
1586
- if (Array.isArray(value)) {
1587
- return Array$1;
1588
- }
1589
- return Object$1;
1590
- case 'boolean':
1591
- return Boolean$1;
1592
- default:
1593
- return Unknown;
1594
- }
1595
- };
1596
- const object = value => {
1597
- const type = getType(value);
1598
- if (type !== Object$1) {
1599
- throw new AssertionError('expected value to be of type object');
1600
- }
1601
- };
1602
- const number = value => {
1603
- const type = getType(value);
1604
- if (type !== Number$1) {
1605
- throw new AssertionError('expected value to be of type number');
1606
- }
1607
- };
1608
- const array = value => {
1609
- const type = getType(value);
1610
- if (type !== Array$1) {
1611
- throw new AssertionError('expected value to be of type array');
1612
- }
1613
- };
1614
-
1615
1634
  const {
1616
1635
  invoke: invoke$1,
1617
1636
  invokeAndTransfer,
@@ -2161,8 +2180,9 @@ const {
2161
2180
  getCommandIds,
2162
2181
  registerCommands,
2163
2182
  set: set$1,
2164
- wrapCommand,
2165
- wrapGetter
2183
+ wrapCommand: wrapNotification,
2184
+ wrapGetter,
2185
+ wrapSerialCommand: wrapCommand
2166
2186
  } = create$1();
2167
2187
 
2168
2188
  const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled, titleBarStyleCustom, assetDir) => {
@@ -2651,7 +2671,7 @@ const getMenuEntries$b = async (platform, autoSave$1, hasActiveTextEditor = fals
2651
2671
  const saveFlags = getSaveFlags(hasActiveTextEditor);
2652
2672
  const entries = [{
2653
2673
  command: 'Main.newFile',
2654
- flags: None,
2674
+ flags: RestoreEditorFocus,
2655
2675
  id: 'newFile',
2656
2676
  label: newFile()
2657
2677
  }, {
@@ -3805,136 +3825,6 @@ const handleClick$1 = async (state, buttonName) => {
3805
3825
  return state;
3806
3826
  };
3807
3827
 
3808
- const commandCenterItems = [{
3809
- command: 'QuickPick.showFile',
3810
- label: 'Go to File'
3811
- }, {
3812
- command: 'QuickPick.showCommands',
3813
- label: 'Show and Run Commands'
3814
- }, {
3815
- args: ['Search'],
3816
- command: 'Layout.openSideBarViewlet',
3817
- label: 'Search for Text'
3818
- }, {
3819
- args: ['symbol'],
3820
- command: 'QuickPick.show',
3821
- label: 'Go to Symbol in Editor'
3822
- }, {
3823
- args: ['Run And Debug'],
3824
- command: 'Layout.openSideBarViewlet',
3825
- label: 'Start Debugging'
3826
- }, {
3827
- command: 'QuickPick.showCommands',
3828
- label: 'Run Task'
3829
- }, {
3830
- command: 'QuickPick.showEverything',
3831
- label: 'More'
3832
- }];
3833
- const handleCommandCenterClick = async state => {
3834
- await invoke$1('QuickPick.show', 'custom', commandCenterItems, undefined, {
3835
- executeItemCommand: true,
3836
- mode: 'quickPick',
3837
- placeholder: 'Search files by name (append : to go to line or @ to go to symbol)',
3838
- waitUntil: 'visible'
3839
- });
3840
- return state;
3841
- };
3842
-
3843
- const handleCommandCenterKeyDown = async (state, key) => {
3844
- if (key !== 'Enter' && key !== ' ' && key !== 'Space') {
3845
- return state;
3846
- }
3847
- return handleCommandCenterClick(state);
3848
- };
3849
-
3850
- const show2 = async (uid, menuId, x, y, args) => {
3851
- await showContextMenu2(uid, menuId, x, y, args);
3852
- };
3853
-
3854
- const handleContextMenu = async (state, button, eventX, eventY) => {
3855
- const {
3856
- uid
3857
- } = state;
3858
- await show2(uid, MenuIdTitleBarContextMenu, eventX, eventY, {
3859
- menuId: MenuIdTitleBarContextMenu
3860
- });
3861
- return state;
3862
- };
3863
-
3864
- const handleElectronMenuClick = async (state, label) => {
3865
- const {
3866
- commandMap
3867
- } = state;
3868
- const commandPair = commandMap[label];
3869
- if (!commandPair) {
3870
- throw new Error(`no command found for ${label}`);
3871
- }
3872
- const {
3873
- args = [],
3874
- command
3875
- } = commandPair;
3876
- await invoke$1(command, ...args);
3877
- return state;
3878
- };
3879
-
3880
- const state = {
3881
- connected: false
3882
- };
3883
- const isConnected = () => {
3884
- const {
3885
- connected
3886
- } = state;
3887
- return connected;
3888
- };
3889
- const invoke = (method, ...params) => {
3890
- return invoke$2(method, ...params);
3891
- };
3892
- const set = rpc => {
3893
- set$3(rpc);
3894
- state.connected = true;
3895
- };
3896
-
3897
- const commandQueues = new Map();
3898
- const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
3899
- const executeViewletCommand = async (uid, command, ...args) => {
3900
- const fn = viewletCommandMap[`TitleBar.${command}`];
3901
- if (typeof fn !== 'function') {
3902
- throw new TypeError(`Viewlet command not found: ${command}`);
3903
- }
3904
- const previous = commandQueues.get(uid);
3905
- const {
3906
- promise: next,
3907
- resolve
3908
- } = Promise.withResolvers();
3909
- commandQueues.set(uid, next);
3910
- if (previous) {
3911
- await previous;
3912
- }
3913
- try {
3914
- await fn(uid, ...args);
3915
- await invoke$1('Viewlet.requestRender', uid);
3916
- } finally {
3917
- resolve();
3918
- if (commandQueues.get(uid) === next) {
3919
- commandQueues.delete(uid);
3920
- }
3921
- }
3922
- };
3923
- const rpc = await create$6({
3924
- commandMap: {
3925
- 'Viewlet.executeViewletCommand': executeViewletCommand
3926
- },
3927
- messagePort: port
3928
- });
3929
- if (setAsRendererProcess) {
3930
- set(rpc);
3931
- }
3932
- };
3933
-
3934
- const getMenuOffset = (x, clientX, iconWidth) => {
3935
- return clientX - x - iconWidth;
3936
- };
3937
-
3938
3828
  const getNavigableTitleBarEntries = state => {
3939
3829
  const {
3940
3830
  focusedIndex,
@@ -3945,17 +3835,30 @@ const getNavigableTitleBarEntries = state => {
3945
3835
  return getVisibleTitleBarEntries(titleBarEntries, width, focusedIndex, isMenuOpen);
3946
3836
  };
3947
3837
 
3948
- const getTitleBarIndexFromPosition = (titleBarEntries, x, y) => {
3949
- let currentX = 0;
3950
- for (let i = 0; i < titleBarEntries.length; i++) {
3951
- const entry = titleBarEntries[i];
3952
- const entryWidth = entry.width;
3953
- if (x >= currentX && x < currentX + entryWidth) {
3954
- return i;
3955
- }
3956
- currentX += entryWidth;
3838
+ const LeftClick = 0;
3839
+
3840
+ const closeMenu = (state, keepFocus) => {
3841
+ const {
3842
+ focused,
3843
+ focusedIndex,
3844
+ isMenuOpen,
3845
+ menus
3846
+ } = state;
3847
+ // TODO send to renderer process
3848
+ // 1. close menu
3849
+ // 2. focus top level entry
3850
+ const newFocused = keepFocus ? focused : false;
3851
+ const newFocusedIndex = keepFocus ? focusedIndex : -1;
3852
+ if (!isMenuOpen && menus.length === 0 && focused === newFocused && focusedIndex === newFocusedIndex) {
3853
+ return state;
3957
3854
  }
3958
- return -1;
3855
+ return {
3856
+ ...state,
3857
+ focused: newFocused,
3858
+ focusedIndex: newFocusedIndex,
3859
+ isMenuOpen: false,
3860
+ menus: []
3861
+ };
3959
3862
  };
3960
3863
 
3961
3864
  const toCommandInfo = entry => {
@@ -4145,6 +4048,180 @@ const openMenuAtIndex = async (state, index, shouldBeFocused) => {
4145
4048
  };
4146
4049
  };
4147
4050
 
4051
+ const toggleIndex = async (state, index) => {
4052
+ const {
4053
+ focusedIndex,
4054
+ isMenuOpen
4055
+ } = state;
4056
+ if (isMenuOpen && focusedIndex === index) {
4057
+ return closeMenu(state, /* keepFocus */true);
4058
+ }
4059
+ return openMenuAtIndex(state, index, /* focus */false);
4060
+ };
4061
+
4062
+ const handleClick = async (state, button, index) => {
4063
+ if (button !== LeftClick) {
4064
+ return state;
4065
+ }
4066
+ if (index === -1) {
4067
+ return state;
4068
+ }
4069
+ const newState = await toggleIndex(state, index);
4070
+ return {
4071
+ ...newState,
4072
+ focused: true
4073
+ };
4074
+ };
4075
+
4076
+ const handleClickByName = async (state, button, name) => {
4077
+ const entries = getNavigableTitleBarEntries(state);
4078
+ const index = entries.findIndex(entry => entry.label === name);
4079
+ return handleClick(state, button, index);
4080
+ };
4081
+
4082
+ const commandCenterItems = [{
4083
+ command: 'QuickPick.showFile',
4084
+ label: 'Go to File'
4085
+ }, {
4086
+ command: 'QuickPick.showCommands',
4087
+ label: 'Show and Run Commands'
4088
+ }, {
4089
+ args: ['Search'],
4090
+ command: 'Layout.openSideBarViewlet',
4091
+ label: 'Search for Text'
4092
+ }, {
4093
+ args: ['symbol'],
4094
+ command: 'QuickPick.show',
4095
+ label: 'Go to Symbol in Editor'
4096
+ }, {
4097
+ args: ['Run And Debug'],
4098
+ command: 'Layout.openSideBarViewlet',
4099
+ label: 'Start Debugging'
4100
+ }, {
4101
+ command: 'QuickPick.showCommands',
4102
+ label: 'Run Task'
4103
+ }, {
4104
+ command: 'QuickPick.showEverything',
4105
+ label: 'More'
4106
+ }];
4107
+ const handleCommandCenterClick = async state => {
4108
+ await invoke$1('QuickPick.show', 'custom', commandCenterItems, undefined, {
4109
+ executeItemCommand: true,
4110
+ mode: 'quickPick',
4111
+ placeholder: 'Search files by name (append : to go to line or @ to go to symbol)',
4112
+ waitUntil: 'visible'
4113
+ });
4114
+ return state;
4115
+ };
4116
+
4117
+ const handleCommandCenterKeyDown = async (state, key) => {
4118
+ if (key !== 'Enter' && key !== ' ' && key !== 'Space') {
4119
+ return state;
4120
+ }
4121
+ return handleCommandCenterClick(state);
4122
+ };
4123
+
4124
+ const show2 = async (uid, menuId, x, y, args) => {
4125
+ await showContextMenu2(uid, menuId, x, y, args);
4126
+ };
4127
+
4128
+ const handleContextMenu = async (state, button, eventX, eventY) => {
4129
+ const {
4130
+ uid
4131
+ } = state;
4132
+ await show2(uid, MenuIdTitleBarContextMenu, eventX, eventY, {
4133
+ menuId: MenuIdTitleBarContextMenu
4134
+ });
4135
+ return state;
4136
+ };
4137
+
4138
+ const handleElectronMenuClick = async (state, label) => {
4139
+ const {
4140
+ commandMap
4141
+ } = state;
4142
+ const commandPair = commandMap[label];
4143
+ if (!commandPair) {
4144
+ throw new Error(`no command found for ${label}`);
4145
+ }
4146
+ const {
4147
+ args = [],
4148
+ command
4149
+ } = commandPair;
4150
+ await invoke$1(command, ...args);
4151
+ return state;
4152
+ };
4153
+
4154
+ const state = {
4155
+ connected: false
4156
+ };
4157
+ const isConnected = () => {
4158
+ const {
4159
+ connected
4160
+ } = state;
4161
+ return connected;
4162
+ };
4163
+ const invoke = (method, ...params) => {
4164
+ return invoke$2(method, ...params);
4165
+ };
4166
+ const set = rpc => {
4167
+ set$3(rpc);
4168
+ state.connected = true;
4169
+ };
4170
+
4171
+ const commandQueues = new Map();
4172
+ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
4173
+ const executeViewletCommand = async (uid, command, ...args) => {
4174
+ const fn = viewletCommandMap[`TitleBar.${command}`];
4175
+ if (typeof fn !== 'function') {
4176
+ throw new TypeError(`Viewlet command not found: ${command}`);
4177
+ }
4178
+ const previous = commandQueues.get(uid);
4179
+ const {
4180
+ promise: next,
4181
+ resolve
4182
+ } = Promise.withResolvers();
4183
+ commandQueues.set(uid, next);
4184
+ if (previous) {
4185
+ await previous;
4186
+ }
4187
+ try {
4188
+ await fn(uid, ...args);
4189
+ await invoke$1('Viewlet.requestRender', uid);
4190
+ } finally {
4191
+ resolve();
4192
+ if (commandQueues.get(uid) === next) {
4193
+ commandQueues.delete(uid);
4194
+ }
4195
+ }
4196
+ };
4197
+ const rpc = await create$6({
4198
+ commandMap: {
4199
+ 'Viewlet.executeViewletCommand': executeViewletCommand
4200
+ },
4201
+ messagePort: port
4202
+ });
4203
+ if (setAsRendererProcess) {
4204
+ set(rpc);
4205
+ }
4206
+ };
4207
+
4208
+ const getMenuOffset = (x, clientX, iconWidth) => {
4209
+ return clientX - x - iconWidth;
4210
+ };
4211
+
4212
+ const getTitleBarIndexFromPosition = (titleBarEntries, x, y) => {
4213
+ let currentX = 0;
4214
+ for (let i = 0; i < titleBarEntries.length; i++) {
4215
+ const entry = titleBarEntries[i];
4216
+ const entryWidth = entry.width;
4217
+ if (x >= currentX && x < currentX + entryWidth) {
4218
+ return i;
4219
+ }
4220
+ currentX += entryWidth;
4221
+ }
4222
+ return -1;
4223
+ };
4224
+
4148
4225
  const focusIndex = async (state, index) => {
4149
4226
  object(state);
4150
4227
  number(index);
@@ -4466,7 +4543,7 @@ const renderFocusedIndex = (oldState, newState) => {
4466
4543
  if (newState.focusedIndex === -1) {
4467
4544
  return [];
4468
4545
  }
4469
- return [FocusSelector, newState.uid, '.ViewletTitleBarMenuBar'];
4546
+ return [FocusSelector, newState.uid, '.TitleBarMenuBar'];
4470
4547
  };
4471
4548
 
4472
4549
  const getKeyBindingString = (key, altKey, ctrlKey, shiftKey, metaKey) => {
@@ -4772,13 +4849,18 @@ const renderDirect = async (uid, commands) => {
4772
4849
  return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
4773
4850
  };
4774
4851
  const render3 = async (uid, diffResult) => {
4852
+ // State may change between the renderer worker's diff and render RPCs.
4853
+ const pendingDiffs = new Set([...diffResult, ...diff3(uid)]);
4775
4854
  const {
4776
4855
  newState,
4777
4856
  oldState
4778
4857
  } = get(uid);
4779
4858
  set$1(uid, newState, newState);
4780
4859
  const commands = [];
4781
- for (const item of diffResult) {
4860
+ for (const item of numbers) {
4861
+ if (!pendingDiffs.has(item)) {
4862
+ continue;
4863
+ }
4782
4864
  const fn = getRenderer3(item);
4783
4865
  const result = fn(oldState, newState);
4784
4866
  if (result.length > 0) {
@@ -4826,7 +4908,7 @@ const renderEventListeners = () => {
4826
4908
  params: ['handleMenuMouseOver', ClientX, ClientY]
4827
4909
  }, {
4828
4910
  name: HandleClick,
4829
- params: ['handleClickAt', Button, ClientX, ClientY]
4911
+ params: ['handleClickByName', Button, TargetName]
4830
4912
  }, {
4831
4913
  name: HandlePointerOut,
4832
4914
  params: ['handlePointerOut', ClientX, ClientY]
@@ -4971,30 +5053,6 @@ const create = (id, uri, x, y, width, height) => {
4971
5053
  return state;
4972
5054
  };
4973
5055
 
4974
- const closeMenu = (state, keepFocus) => {
4975
- const {
4976
- focused,
4977
- focusedIndex,
4978
- isMenuOpen,
4979
- menus
4980
- } = state;
4981
- // TODO send to renderer process
4982
- // 1. close menu
4983
- // 2. focus top level entry
4984
- const newFocused = keepFocus ? focused : false;
4985
- const newFocusedIndex = keepFocus ? focusedIndex : -1;
4986
- if (!isMenuOpen && menus.length === 0 && focused === newFocused && focusedIndex === newFocusedIndex) {
4987
- return state;
4988
- }
4989
- return {
4990
- ...state,
4991
- focused: newFocused,
4992
- focusedIndex: newFocusedIndex,
4993
- isMenuOpen: false,
4994
- menus: []
4995
- };
4996
- };
4997
-
4998
5056
  const first = () => {
4999
5057
  return 0;
5000
5058
  };
@@ -5041,33 +5099,6 @@ const focusPrevious = state => {
5041
5099
  return focusIndex(state, indexToFocus);
5042
5100
  };
5043
5101
 
5044
- const LeftClick = 0;
5045
-
5046
- const toggleIndex = async (state, index) => {
5047
- const {
5048
- focusedIndex,
5049
- isMenuOpen
5050
- } = state;
5051
- if (isMenuOpen && focusedIndex === index) {
5052
- return closeMenu(state, /* keepFocus */true);
5053
- }
5054
- return openMenuAtIndex(state, index, /* focus */false);
5055
- };
5056
-
5057
- const handleClick = async (state, button, index) => {
5058
- if (button !== LeftClick) {
5059
- return state;
5060
- }
5061
- if (index === -1) {
5062
- return state;
5063
- }
5064
- const newState = await toggleIndex(state, index);
5065
- return {
5066
- ...newState,
5067
- focused: true
5068
- };
5069
- };
5070
-
5071
5102
  const handleClickAt = async (state, button, eventX, eventY) => {
5072
5103
  const {
5073
5104
  iconWidth,
@@ -5616,6 +5647,7 @@ const commandMap = {
5616
5647
  'TitleBar.handleButtonsClick': handleClick$1,
5617
5648
  'TitleBar.handleClick': wrapCommand(handleClick),
5618
5649
  'TitleBar.handleClickAt': wrapCommand(handleClickAt),
5650
+ 'TitleBar.handleClickByName': wrapCommand(handleClickByName),
5619
5651
  'TitleBar.handleClickClose': wrapCommand(handleClickClose),
5620
5652
  'TitleBar.handleClickMinimize': wrapCommand(handleClickMinimize),
5621
5653
  'TitleBar.handleClickToggleMaximize': wrapCommand(handleClickToggleMaximize),
@@ -5642,7 +5674,8 @@ const commandMap = {
5642
5674
  'TitleBar.handlePointerOut': wrapCommand(handlePointerOut),
5643
5675
  'TitleBar.handlePointerOver': wrapCommand(handlePointerOver),
5644
5676
  'TitleBar.handleTitleBarContextMenu': wrapCommand(handleTitleBarContextMenu),
5645
- 'TitleBar.handleWorkspaceChange': wrapCommand(handleWorkspaceChange),
5677
+ // Workspace actions await this callback while holding the ordinary command queue.
5678
+ 'TitleBar.handleWorkspaceChange': wrapNotification(handleWorkspaceChange),
5646
5679
  'TitleBar.hideCommandCenter': wrapCommand(hideCommandCenter),
5647
5680
  'TitleBar.hideMenuBar': wrapCommand(hideMenuBar),
5648
5681
  'TitleBar.hydrateElectronApplicationMenu': wrapCommand(hydrate),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "4.25.0",
3
+ "version": "4.25.1",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",