@lvce-editor/title-bar-worker 4.16.1 → 4.17.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.
- package/dist/titleBarWorkerMain.js +72 -31
- package/package.json +1 -1
|
@@ -1032,7 +1032,7 @@ const createMockRpc = ({
|
|
|
1032
1032
|
};
|
|
1033
1033
|
|
|
1034
1034
|
const rpcs = Object.create(null);
|
|
1035
|
-
const set$
|
|
1035
|
+
const set$4 = (id, rpc) => {
|
|
1036
1036
|
rpcs[id] = rpc;
|
|
1037
1037
|
};
|
|
1038
1038
|
const get$1 = id => {
|
|
@@ -1065,7 +1065,7 @@ const create$2 = rpcId => {
|
|
|
1065
1065
|
const mockRpc = createMockRpc({
|
|
1066
1066
|
commandMap
|
|
1067
1067
|
});
|
|
1068
|
-
set$
|
|
1068
|
+
set$4(rpcId, mockRpc);
|
|
1069
1069
|
// @ts-ignore
|
|
1070
1070
|
mockRpc[Symbol.dispose] = () => {
|
|
1071
1071
|
remove(rpcId);
|
|
@@ -1074,7 +1074,7 @@ const create$2 = rpcId => {
|
|
|
1074
1074
|
return mockRpc;
|
|
1075
1075
|
},
|
|
1076
1076
|
set(rpc) {
|
|
1077
|
-
set$
|
|
1077
|
+
set$4(rpcId, rpc);
|
|
1078
1078
|
}
|
|
1079
1079
|
};
|
|
1080
1080
|
};
|
|
@@ -1495,6 +1495,7 @@ const parseKey = rawKey => {
|
|
|
1495
1495
|
|
|
1496
1496
|
const Electron$1 = 2;
|
|
1497
1497
|
|
|
1498
|
+
const RendererProcess = 1670;
|
|
1498
1499
|
const RendererWorker = 1;
|
|
1499
1500
|
|
|
1500
1501
|
const FocusSelector = 'Viewlet.focusSelector';
|
|
@@ -1503,6 +1504,11 @@ const SetFocusContext = 'Viewlet.setFocusContext';
|
|
|
1503
1504
|
|
|
1504
1505
|
const FocusTitleBarMenuBar = 26;
|
|
1505
1506
|
|
|
1507
|
+
const {
|
|
1508
|
+
invoke: invoke$2,
|
|
1509
|
+
set: set$3
|
|
1510
|
+
} = create$2(RendererProcess);
|
|
1511
|
+
|
|
1506
1512
|
class AssertionError extends Error {
|
|
1507
1513
|
constructor(message) {
|
|
1508
1514
|
super(message);
|
|
@@ -1559,32 +1565,32 @@ const array = value => {
|
|
|
1559
1565
|
};
|
|
1560
1566
|
|
|
1561
1567
|
const {
|
|
1562
|
-
invoke,
|
|
1568
|
+
invoke: invoke$1,
|
|
1563
1569
|
invokeAndTransfer,
|
|
1564
|
-
set: set$
|
|
1570
|
+
set: set$2
|
|
1565
1571
|
} = create$2(RendererWorker);
|
|
1566
1572
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1567
1573
|
number(uid);
|
|
1568
1574
|
number(menuId);
|
|
1569
1575
|
number(x);
|
|
1570
1576
|
number(y);
|
|
1571
|
-
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1577
|
+
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1572
1578
|
};
|
|
1573
1579
|
const sendMessagePortToTextMeasurementWorker = async port => {
|
|
1574
1580
|
const command = 'TextMeasurement.handleMessagePort';
|
|
1575
1581
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
|
|
1576
1582
|
};
|
|
1577
1583
|
const getWindowId$1 = async () => {
|
|
1578
|
-
return invoke('GetWindowId.getWindowId');
|
|
1584
|
+
return invoke$1('GetWindowId.getWindowId');
|
|
1579
1585
|
};
|
|
1580
1586
|
const minimizeWindow = async () => {
|
|
1581
|
-
return invoke('ElectronWindow.minimize');
|
|
1587
|
+
return invoke$1('ElectronWindow.minimize');
|
|
1582
1588
|
};
|
|
1583
1589
|
const maximizeWindow = async () => {
|
|
1584
|
-
return invoke('ElectronWindow.maximize');
|
|
1590
|
+
return invoke$1('ElectronWindow.maximize');
|
|
1585
1591
|
};
|
|
1586
1592
|
const closeWindow = async () => {
|
|
1587
|
-
return invoke('ElectronWindow.close');
|
|
1593
|
+
return invoke$1('ElectronWindow.close');
|
|
1588
1594
|
};
|
|
1589
1595
|
|
|
1590
1596
|
const toCommandId = key => {
|
|
@@ -2109,7 +2115,7 @@ const {
|
|
|
2109
2115
|
get,
|
|
2110
2116
|
getCommandIds,
|
|
2111
2117
|
registerCommands,
|
|
2112
|
-
set,
|
|
2118
|
+
set: set$1,
|
|
2113
2119
|
wrapCommand,
|
|
2114
2120
|
wrapGetter
|
|
2115
2121
|
} = create$1();
|
|
@@ -2145,7 +2151,7 @@ const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled,
|
|
|
2145
2151
|
x,
|
|
2146
2152
|
y
|
|
2147
2153
|
};
|
|
2148
|
-
set(id, state, state);
|
|
2154
|
+
set$1(id, state, state);
|
|
2149
2155
|
};
|
|
2150
2156
|
|
|
2151
2157
|
const isEqual$3 = (oldState, newState) => {
|
|
@@ -2259,7 +2265,7 @@ const isTextEditorUri = uri => {
|
|
|
2259
2265
|
};
|
|
2260
2266
|
const hasActiveTextEditor = async () => {
|
|
2261
2267
|
try {
|
|
2262
|
-
const activeEditorId = await invoke('GetActiveEditor.getActiveEditorId');
|
|
2268
|
+
const activeEditorId = await invoke$1('GetActiveEditor.getActiveEditorId');
|
|
2263
2269
|
return typeof activeEditorId === 'number' && activeEditorId >= 0;
|
|
2264
2270
|
} catch {
|
|
2265
2271
|
return false;
|
|
@@ -2267,7 +2273,7 @@ const hasActiveTextEditor = async () => {
|
|
|
2267
2273
|
};
|
|
2268
2274
|
const hasOpenTextEditor = async () => {
|
|
2269
2275
|
try {
|
|
2270
|
-
const openEditorUris = await invoke('GetActiveEditor.getOpenEditorUris');
|
|
2276
|
+
const openEditorUris = await invoke$1('GetActiveEditor.getOpenEditorUris');
|
|
2271
2277
|
if (Array.isArray(openEditorUris)) {
|
|
2272
2278
|
return openEditorUris.some(isTextEditorUri);
|
|
2273
2279
|
}
|
|
@@ -2291,7 +2297,7 @@ const sideBarLeft = 1;
|
|
|
2291
2297
|
const sideBarRight = 2;
|
|
2292
2298
|
const getSideBarPosition = async () => {
|
|
2293
2299
|
try {
|
|
2294
|
-
return await invoke('Layout.getSideBarPosition');
|
|
2300
|
+
return await invoke$1('Layout.getSideBarPosition');
|
|
2295
2301
|
} catch {
|
|
2296
2302
|
return sideBarRight;
|
|
2297
2303
|
}
|
|
@@ -2581,7 +2587,7 @@ const View = 16;
|
|
|
2581
2587
|
|
|
2582
2588
|
const getAutoSave = async () => {
|
|
2583
2589
|
try {
|
|
2584
|
-
return await invoke('Preferences.get', 'files.autoSave');
|
|
2590
|
+
return await invoke$1('Preferences.get', 'files.autoSave');
|
|
2585
2591
|
} catch {
|
|
2586
2592
|
return 'off';
|
|
2587
2593
|
}
|
|
@@ -2769,7 +2775,7 @@ const normalizeUri = value => {
|
|
|
2769
2775
|
}
|
|
2770
2776
|
};
|
|
2771
2777
|
const getRecentlyOpened = async () => {
|
|
2772
|
-
const recentlyOpened = await invoke(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
2778
|
+
const recentlyOpened = await invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
2773
2779
|
if (!Array.isArray(recentlyOpened)) {
|
|
2774
2780
|
return [];
|
|
2775
2781
|
}
|
|
@@ -3338,7 +3344,7 @@ const toElectronMenu = (map, rootId) => {
|
|
|
3338
3344
|
|
|
3339
3345
|
const setItems = async items => {
|
|
3340
3346
|
const windowId = await getWindowId();
|
|
3341
|
-
return invoke('WebView.compatSharedProcessInvoke', 'ElectronApplicationMenu.setItems', windowId, items);
|
|
3347
|
+
return invoke$1('WebView.compatSharedProcessInvoke', 'ElectronApplicationMenu.setItems', windowId, items);
|
|
3342
3348
|
};
|
|
3343
3349
|
const hydrate = async state => {
|
|
3344
3350
|
const {
|
|
@@ -3479,7 +3485,7 @@ const commandCenterItems = [{
|
|
|
3479
3485
|
label: 'More'
|
|
3480
3486
|
}];
|
|
3481
3487
|
const handleCommandCenterClick = async state => {
|
|
3482
|
-
await invoke('QuickPick.show', 'custom', commandCenterItems, undefined, {
|
|
3488
|
+
await invoke$1('QuickPick.show', 'custom', commandCenterItems, undefined, {
|
|
3483
3489
|
executeItemCommand: true,
|
|
3484
3490
|
mode: 'quickPick',
|
|
3485
3491
|
placeholder: 'Search files by name (append : to go to line or @ to go to symbol)',
|
|
@@ -3521,10 +3527,35 @@ const handleElectronMenuClick = async (state, label) => {
|
|
|
3521
3527
|
args = [],
|
|
3522
3528
|
command
|
|
3523
3529
|
} = commandPair;
|
|
3524
|
-
await invoke(command, ...args);
|
|
3530
|
+
await invoke$1(command, ...args);
|
|
3525
3531
|
return state;
|
|
3526
3532
|
};
|
|
3527
3533
|
|
|
3534
|
+
const state = {
|
|
3535
|
+
connected: false
|
|
3536
|
+
};
|
|
3537
|
+
const isConnected = () => {
|
|
3538
|
+
const {
|
|
3539
|
+
connected
|
|
3540
|
+
} = state;
|
|
3541
|
+
return connected;
|
|
3542
|
+
};
|
|
3543
|
+
const invoke = (method, ...params) => {
|
|
3544
|
+
return invoke$2(method, ...params);
|
|
3545
|
+
};
|
|
3546
|
+
const set = rpc => {
|
|
3547
|
+
set$3(rpc);
|
|
3548
|
+
state.connected = true;
|
|
3549
|
+
};
|
|
3550
|
+
|
|
3551
|
+
const handleMessagePort = async port => {
|
|
3552
|
+
const rpc = await create$5({
|
|
3553
|
+
commandMap: {},
|
|
3554
|
+
messagePort: port
|
|
3555
|
+
});
|
|
3556
|
+
set(rpc);
|
|
3557
|
+
};
|
|
3558
|
+
|
|
3528
3559
|
const getMenuOffset = (x, clientX, iconWidth) => {
|
|
3529
3560
|
return clientX - x - iconWidth;
|
|
3530
3561
|
};
|
|
@@ -3620,7 +3651,7 @@ const toCommandInfo = entry => {
|
|
|
3620
3651
|
const addMenuEntryKeyBindings = async entries => {
|
|
3621
3652
|
try {
|
|
3622
3653
|
const commands = entries.map(toCommandInfo);
|
|
3623
|
-
const keys = await invoke('Layout.getKeyBindings', commands);
|
|
3654
|
+
const keys = await invoke$1('Layout.getKeyBindings', commands);
|
|
3624
3655
|
if (!keys.some(Boolean)) {
|
|
3625
3656
|
return entries;
|
|
3626
3657
|
}
|
|
@@ -4041,7 +4072,7 @@ const getTitleBarMenuBarWidth = (windowWidth, menuBarX, iconWidth, titleWidth) =
|
|
|
4041
4072
|
};
|
|
4042
4073
|
|
|
4043
4074
|
const getWorkspaceUri = () => {
|
|
4044
|
-
return invoke('Workspace.getUri');
|
|
4075
|
+
return invoke$1('Workspace.getUri');
|
|
4045
4076
|
};
|
|
4046
4077
|
|
|
4047
4078
|
const loadContent2 = async state => {
|
|
@@ -4097,7 +4128,7 @@ const loadContent2Command = async uid => {
|
|
|
4097
4128
|
titleWidth: latest.newState.titleWidth,
|
|
4098
4129
|
workspaceUri: latest.newState.workspaceUri
|
|
4099
4130
|
};
|
|
4100
|
-
set(uid, latest.oldState, nextState, nextState);
|
|
4131
|
+
set$1(uid, latest.oldState, nextState, nextState);
|
|
4101
4132
|
};
|
|
4102
4133
|
|
|
4103
4134
|
const renderFocusContext = (oldState, newState) => {
|
|
@@ -4111,7 +4142,7 @@ const renderFocusedIndex = (oldState, newState) => {
|
|
|
4111
4142
|
if (newState.focusedIndex === -1) {
|
|
4112
4143
|
return [];
|
|
4113
4144
|
}
|
|
4114
|
-
return [FocusSelector, '.ViewletTitleBarMenuBar'];
|
|
4145
|
+
return [FocusSelector, newState.uid, '.ViewletTitleBarMenuBar'];
|
|
4115
4146
|
};
|
|
4116
4147
|
|
|
4117
4148
|
const MaskIconCheck = 'MaskIconCheck';
|
|
@@ -4630,12 +4661,18 @@ const getRenderer3 = diffType => {
|
|
|
4630
4661
|
}
|
|
4631
4662
|
};
|
|
4632
4663
|
|
|
4664
|
+
const renderDirect = async (uid, commands) => {
|
|
4665
|
+
const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
|
|
4666
|
+
const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
|
|
4667
|
+
const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
|
|
4668
|
+
return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
|
|
4669
|
+
};
|
|
4633
4670
|
const render3 = async (uid, diffResult) => {
|
|
4634
4671
|
const {
|
|
4635
4672
|
newState,
|
|
4636
4673
|
oldState
|
|
4637
4674
|
} = get(uid);
|
|
4638
|
-
set(uid, newState, newState);
|
|
4675
|
+
set$1(uid, newState, newState);
|
|
4639
4676
|
const commands = [];
|
|
4640
4677
|
for (const item of diffResult) {
|
|
4641
4678
|
const fn = getRenderer3(item);
|
|
@@ -4644,6 +4681,9 @@ const render3 = async (uid, diffResult) => {
|
|
|
4644
4681
|
commands.push(result);
|
|
4645
4682
|
}
|
|
4646
4683
|
}
|
|
4684
|
+
if (isConnected()) {
|
|
4685
|
+
return renderDirect(uid, commands);
|
|
4686
|
+
}
|
|
4647
4687
|
return commands;
|
|
4648
4688
|
};
|
|
4649
4689
|
|
|
@@ -4802,7 +4842,7 @@ const create = (id, uri, x, y, width, height) => {
|
|
|
4802
4842
|
x,
|
|
4803
4843
|
y
|
|
4804
4844
|
};
|
|
4805
|
-
set(id, state, state);
|
|
4845
|
+
set$1(id, state, state);
|
|
4806
4846
|
return state;
|
|
4807
4847
|
};
|
|
4808
4848
|
|
|
@@ -5130,7 +5170,7 @@ const handleKeyEnterMenuClosed = state => {
|
|
|
5130
5170
|
};
|
|
5131
5171
|
|
|
5132
5172
|
const executeMenuItemCommand = async item => {
|
|
5133
|
-
await invoke(item.command, ...(item.args || []));
|
|
5173
|
+
await invoke$1(item.command, ...(item.args || []));
|
|
5134
5174
|
};
|
|
5135
5175
|
|
|
5136
5176
|
const selectIndexIgnore = async (state, item) => {
|
|
@@ -5152,7 +5192,7 @@ const selectIndexNone = async (state, item) => {
|
|
|
5152
5192
|
menus: []
|
|
5153
5193
|
};
|
|
5154
5194
|
if (storedState) {
|
|
5155
|
-
set(uid, storedState.oldState, newState, newState);
|
|
5195
|
+
set$1(uid, storedState.oldState, newState, newState);
|
|
5156
5196
|
}
|
|
5157
5197
|
return newState;
|
|
5158
5198
|
};
|
|
@@ -5160,7 +5200,7 @@ const selectIndexNone = async (state, item) => {
|
|
|
5160
5200
|
const selectIndexRestoreEditorFocus = async (state, item) => {
|
|
5161
5201
|
await executeMenuItemCommand(item);
|
|
5162
5202
|
try {
|
|
5163
|
-
await invoke('Main.focus');
|
|
5203
|
+
await invoke$1('Main.focus');
|
|
5164
5204
|
} catch {
|
|
5165
5205
|
// Focus restoration is best effort and must not turn a successful command into a failure.
|
|
5166
5206
|
}
|
|
@@ -5402,7 +5442,7 @@ const toggleMenu = async state => {
|
|
|
5402
5442
|
};
|
|
5403
5443
|
|
|
5404
5444
|
const wakeUp = sleepState => {
|
|
5405
|
-
set(sleepState.uid, sleepState, sleepState);
|
|
5445
|
+
set$1(sleepState.uid, sleepState, sleepState);
|
|
5406
5446
|
};
|
|
5407
5447
|
|
|
5408
5448
|
const commandMap = {
|
|
@@ -5445,6 +5485,7 @@ const commandMap = {
|
|
|
5445
5485
|
'TitleBar.handleKeySpace': wrapCommand(handleKeySpace),
|
|
5446
5486
|
'TitleBar.handleMenuClick': wrapCommand(handleMenuClick),
|
|
5447
5487
|
'TitleBar.handleMenuMouseOver': wrapCommand(handleMenuMouseOver),
|
|
5488
|
+
'TitleBar.handleMessagePort': handleMessagePort,
|
|
5448
5489
|
'TitleBar.handleMouseOut': wrapCommand(handleMouseOut),
|
|
5449
5490
|
'TitleBar.handleMouseOver': wrapCommand(handleMouseOver),
|
|
5450
5491
|
'TitleBar.handlePointerOut': wrapCommand(handlePointerOut),
|
|
@@ -5476,7 +5517,7 @@ const listen = async () => {
|
|
|
5476
5517
|
const rpc = await create$3({
|
|
5477
5518
|
commandMap: commandMap
|
|
5478
5519
|
});
|
|
5479
|
-
set$
|
|
5520
|
+
set$2(rpc);
|
|
5480
5521
|
};
|
|
5481
5522
|
|
|
5482
5523
|
const main = async () => {
|