@lvce-editor/title-bar-worker 4.28.2 → 4.28.4
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 +66 -50
- package/package.json +1 -1
|
@@ -1165,7 +1165,7 @@ const createMockRpc = ({
|
|
|
1165
1165
|
};
|
|
1166
1166
|
|
|
1167
1167
|
const rpcs = Object.create(null);
|
|
1168
|
-
const set$
|
|
1168
|
+
const set$6 = (id, rpc) => {
|
|
1169
1169
|
rpcs[id] = rpc;
|
|
1170
1170
|
};
|
|
1171
1171
|
const get$1 = id => {
|
|
@@ -1198,7 +1198,7 @@ const create$2 = rpcId => {
|
|
|
1198
1198
|
const mockRpc = createMockRpc({
|
|
1199
1199
|
commandMap
|
|
1200
1200
|
});
|
|
1201
|
-
set$
|
|
1201
|
+
set$6(rpcId, mockRpc);
|
|
1202
1202
|
// @ts-ignore
|
|
1203
1203
|
mockRpc[Symbol.dispose] = () => {
|
|
1204
1204
|
remove(rpcId);
|
|
@@ -1207,7 +1207,7 @@ const create$2 = rpcId => {
|
|
|
1207
1207
|
return mockRpc;
|
|
1208
1208
|
},
|
|
1209
1209
|
set(rpc) {
|
|
1210
|
-
set$
|
|
1210
|
+
set$6(rpcId, rpc);
|
|
1211
1211
|
}
|
|
1212
1212
|
};
|
|
1213
1213
|
};
|
|
@@ -1640,18 +1640,18 @@ const FocusTitleBarMenuBar = 26;
|
|
|
1640
1640
|
|
|
1641
1641
|
const {
|
|
1642
1642
|
invoke: invoke$3,
|
|
1643
|
-
set: set$
|
|
1643
|
+
set: set$5
|
|
1644
1644
|
} = create$2(MainProcess);
|
|
1645
1645
|
|
|
1646
1646
|
const {
|
|
1647
1647
|
invoke: invoke$2,
|
|
1648
|
-
set: set$
|
|
1648
|
+
set: set$4
|
|
1649
1649
|
} = create$2(RendererProcess);
|
|
1650
1650
|
|
|
1651
1651
|
const {
|
|
1652
1652
|
invoke: invoke$1,
|
|
1653
1653
|
invokeAndTransfer,
|
|
1654
|
-
set: set$
|
|
1654
|
+
set: set$3
|
|
1655
1655
|
} = create$2(RendererWorker);
|
|
1656
1656
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1657
1657
|
number(uid);
|
|
@@ -1945,6 +1945,7 @@ const createDefaultState = (uid = DEFAULT_UID) => ({
|
|
|
1945
1945
|
mainAreaUid: DEFAULT_MAIN_AREA_UID,
|
|
1946
1946
|
menus: [],
|
|
1947
1947
|
platform: Electron,
|
|
1948
|
+
showSideBarThings: true,
|
|
1948
1949
|
title: '',
|
|
1949
1950
|
titleBarButtons: [],
|
|
1950
1951
|
titleBarButtonsEnabled: true,
|
|
@@ -2193,7 +2194,7 @@ const {
|
|
|
2193
2194
|
get,
|
|
2194
2195
|
getCommandIds,
|
|
2195
2196
|
registerCommands,
|
|
2196
|
-
set: set$
|
|
2197
|
+
set: set$2,
|
|
2197
2198
|
wrapCommand: wrapNotification,
|
|
2198
2199
|
wrapGetter,
|
|
2199
2200
|
wrapSerialCommand: wrapCommand
|
|
@@ -2230,11 +2231,11 @@ const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled,
|
|
|
2230
2231
|
x,
|
|
2231
2232
|
y
|
|
2232
2233
|
};
|
|
2233
|
-
set$
|
|
2234
|
+
set$2(id, state, state);
|
|
2234
2235
|
};
|
|
2235
2236
|
|
|
2236
2237
|
const isEqual$3 = (oldState, newState) => {
|
|
2237
|
-
return oldState.commandCenterEnabled === newState.commandCenterEnabled && oldState.titleBarEntries === newState.titleBarEntries && oldState.titleBarMenuBarEnabled === newState.titleBarMenuBarEnabled && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen && oldState.title === newState.title && oldState.workspaceUri === newState.workspaceUri;
|
|
2238
|
+
return oldState.commandCenterEnabled === newState.commandCenterEnabled && oldState.titleBarEntries === newState.titleBarEntries && oldState.titleBarMenuBarEnabled === newState.titleBarMenuBarEnabled && oldState.showSideBarThings === newState.showSideBarThings && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen && oldState.title === newState.title && oldState.workspaceUri === newState.workspaceUri;
|
|
2238
2239
|
};
|
|
2239
2240
|
|
|
2240
2241
|
const isEqual$2 = (oldState, newState) => {
|
|
@@ -3316,7 +3317,7 @@ const initializeMainProcess = async () => {
|
|
|
3316
3317
|
commandMap: {},
|
|
3317
3318
|
send
|
|
3318
3319
|
});
|
|
3319
|
-
set$
|
|
3320
|
+
set$5(rpc);
|
|
3320
3321
|
};
|
|
3321
3322
|
|
|
3322
3323
|
// based on https://www.electronjs.org/docs/latest/api/menu-item#new-menuitemoptions
|
|
@@ -3745,6 +3746,7 @@ const getTitleBarVirtualDom = state => {
|
|
|
3745
3746
|
focusedIndex,
|
|
3746
3747
|
isMenuOpen,
|
|
3747
3748
|
platform,
|
|
3749
|
+
showSideBarThings,
|
|
3748
3750
|
title,
|
|
3749
3751
|
titleBarButtons,
|
|
3750
3752
|
titleBarButtonsEnabled,
|
|
@@ -3761,7 +3763,8 @@ const getTitleBarVirtualDom = state => {
|
|
|
3761
3763
|
const iconSrc = getIcon(assetDir);
|
|
3762
3764
|
const visibleEntries = getVisibleTitleBarEntries(titleBarEntries, width, focusedIndex, isMenuOpen);
|
|
3763
3765
|
const titleEnabled = titleBarTitleEnabled && !commandCenterEnabled;
|
|
3764
|
-
const
|
|
3766
|
+
const showSideBar = showSideBarThings !== false;
|
|
3767
|
+
const childCount = Number(showSideBar && titleBarIconEnabled) + Number(showSideBar && titleBarMenuBarEnabled) + Number(showSideBar && commandCenterEnabled) + Number(showSideBar && titleEnabled) + Number(titleBarButtonsEnabled);
|
|
3765
3768
|
return [{
|
|
3766
3769
|
ariaLabel: titleBar(),
|
|
3767
3770
|
childCount,
|
|
@@ -3770,7 +3773,7 @@ const getTitleBarVirtualDom = state => {
|
|
|
3770
3773
|
onContextMenu: HandleTitleBarContextMenu,
|
|
3771
3774
|
role: ContentInfo,
|
|
3772
3775
|
type: Div
|
|
3773
|
-
}, ...getTitleBarIconVirtualDom(titleBarIconEnabled, iconSrc), ...getTitleBarMenuBarVirtualDom(titleBarMenuBarEnabled, visibleEntries, focusedIndex), ...getCommandCenterVirtualDom(commandCenterEnabled), ...getTitleVirtualDom(titleEnabled, title), ...getTitleBarButtonsVirtualDom(titleBarButtonsEnabled, titleBarButtons)];
|
|
3776
|
+
}, ...getTitleBarIconVirtualDom(showSideBar && titleBarIconEnabled, iconSrc), ...getTitleBarMenuBarVirtualDom(showSideBar && titleBarMenuBarEnabled, visibleEntries, focusedIndex), ...getCommandCenterVirtualDom(showSideBar && commandCenterEnabled), ...getTitleVirtualDom(showSideBar && titleEnabled, title), ...getTitleBarButtonsVirtualDom(titleBarButtonsEnabled, titleBarButtons)];
|
|
3774
3777
|
};
|
|
3775
3778
|
|
|
3776
3779
|
const renderTitleBar = (oldState, newState) => {
|
|
@@ -4199,8 +4202,8 @@ const isConnected = () => {
|
|
|
4199
4202
|
const invoke = (method, ...params) => {
|
|
4200
4203
|
return invoke$2(method, ...params);
|
|
4201
4204
|
};
|
|
4202
|
-
const set = rpc => {
|
|
4203
|
-
set$
|
|
4205
|
+
const set$1 = rpc => {
|
|
4206
|
+
set$4(rpc);
|
|
4204
4207
|
state.connected = true;
|
|
4205
4208
|
};
|
|
4206
4209
|
|
|
@@ -4237,27 +4240,10 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
|
|
|
4237
4240
|
messagePort: port
|
|
4238
4241
|
});
|
|
4239
4242
|
if (setAsRendererProcess) {
|
|
4240
|
-
set(rpc);
|
|
4243
|
+
set$1(rpc);
|
|
4241
4244
|
}
|
|
4242
4245
|
};
|
|
4243
4246
|
|
|
4244
|
-
const getMenuOffset = (x, clientX, iconWidth) => {
|
|
4245
|
-
return clientX - x - iconWidth;
|
|
4246
|
-
};
|
|
4247
|
-
|
|
4248
|
-
const getTitleBarIndexFromPosition = (titleBarEntries, x, y) => {
|
|
4249
|
-
let currentX = 0;
|
|
4250
|
-
for (let i = 0; i < titleBarEntries.length; i++) {
|
|
4251
|
-
const entry = titleBarEntries[i];
|
|
4252
|
-
const entryWidth = entry.width;
|
|
4253
|
-
if (x >= currentX && x < currentX + entryWidth) {
|
|
4254
|
-
return i;
|
|
4255
|
-
}
|
|
4256
|
-
currentX += entryWidth;
|
|
4257
|
-
}
|
|
4258
|
-
return -1;
|
|
4259
|
-
};
|
|
4260
|
-
|
|
4261
4247
|
const focusIndex = async (state, index) => {
|
|
4262
4248
|
object(state);
|
|
4263
4249
|
number(index);
|
|
@@ -4300,17 +4286,7 @@ const ifElse = (menuOpenFunction, menuClosedFunction) => {
|
|
|
4300
4286
|
|
|
4301
4287
|
const handleMouseOut = ifElse(handleMouseOutMenuOpen, handleMouseOutMenuClosed);
|
|
4302
4288
|
|
|
4303
|
-
const handlePointerOut = (state,
|
|
4304
|
-
const {
|
|
4305
|
-
iconWidth,
|
|
4306
|
-
x
|
|
4307
|
-
} = state;
|
|
4308
|
-
const titleBarEntries = getNavigableTitleBarEntries(state);
|
|
4309
|
-
const menuX = getMenuOffset(x, clientX, iconWidth);
|
|
4310
|
-
const index = getTitleBarIndexFromPosition(titleBarEntries, menuX);
|
|
4311
|
-
if (index === -1) {
|
|
4312
|
-
return state;
|
|
4313
|
-
}
|
|
4289
|
+
const handlePointerOut = (state, _clientX, _clientY) => {
|
|
4314
4290
|
return handleMouseOut(state);
|
|
4315
4291
|
};
|
|
4316
4292
|
|
|
@@ -4605,7 +4581,7 @@ const loadContent2Command = async uid => {
|
|
|
4605
4581
|
titleWidth: latest.newState.titleWidth,
|
|
4606
4582
|
workspaceUri: latest.newState.workspaceUri
|
|
4607
4583
|
};
|
|
4608
|
-
set$
|
|
4584
|
+
set$2(uid, latest.oldState, nextState, nextState);
|
|
4609
4585
|
};
|
|
4610
4586
|
|
|
4611
4587
|
const renderFocusContext = (oldState, newState) => {
|
|
@@ -4931,7 +4907,7 @@ const render3 = async (uid, diffResult) => {
|
|
|
4931
4907
|
newState,
|
|
4932
4908
|
oldState
|
|
4933
4909
|
} = get(uid);
|
|
4934
|
-
set$
|
|
4910
|
+
set$2(uid, newState, newState);
|
|
4935
4911
|
const commands = [];
|
|
4936
4912
|
for (const item of numbers) {
|
|
4937
4913
|
if (!pendingDiffs.has(item)) {
|
|
@@ -5049,6 +5025,28 @@ const setPlatform = (state, platform) => {
|
|
|
5049
5025
|
};
|
|
5050
5026
|
};
|
|
5051
5027
|
|
|
5028
|
+
const setShowSideBarThings = (state, showSideBarThings) => {
|
|
5029
|
+
const {
|
|
5030
|
+
focused,
|
|
5031
|
+
focusedIndex,
|
|
5032
|
+
isMenuOpen,
|
|
5033
|
+
menus,
|
|
5034
|
+
showSideBarThings: currentShowSideBarThings
|
|
5035
|
+
} = state;
|
|
5036
|
+
if (showSideBarThings === currentShowSideBarThings) {
|
|
5037
|
+
return state;
|
|
5038
|
+
}
|
|
5039
|
+
return {
|
|
5040
|
+
...state,
|
|
5041
|
+
focused: showSideBarThings && focused,
|
|
5042
|
+
focusedIndex: showSideBarThings ? focusedIndex : -1,
|
|
5043
|
+
isMenuOpen: showSideBarThings && isMenuOpen,
|
|
5044
|
+
menus: showSideBarThings ? menus : [],
|
|
5045
|
+
showSideBarThings
|
|
5046
|
+
};
|
|
5047
|
+
};
|
|
5048
|
+
const set = wrapCommand(setShowSideBarThings);
|
|
5049
|
+
|
|
5052
5050
|
const setTitleTemplate = async (state, titleTemplate) => {
|
|
5053
5051
|
const {
|
|
5054
5052
|
applicationName,
|
|
@@ -5125,7 +5123,7 @@ const create = (id, uri, x, y, width, height) => {
|
|
|
5125
5123
|
x,
|
|
5126
5124
|
y
|
|
5127
5125
|
};
|
|
5128
|
-
set$
|
|
5126
|
+
set$2(id, state, state);
|
|
5129
5127
|
return state;
|
|
5130
5128
|
};
|
|
5131
5129
|
|
|
@@ -5175,6 +5173,23 @@ const focusPrevious = state => {
|
|
|
5175
5173
|
return focusIndex(state, indexToFocus);
|
|
5176
5174
|
};
|
|
5177
5175
|
|
|
5176
|
+
const getMenuOffset = (x, clientX, iconWidth) => {
|
|
5177
|
+
return clientX - x - iconWidth;
|
|
5178
|
+
};
|
|
5179
|
+
|
|
5180
|
+
const getTitleBarIndexFromPosition = (titleBarEntries, x, y) => {
|
|
5181
|
+
let currentX = 0;
|
|
5182
|
+
for (let i = 0; i < titleBarEntries.length; i++) {
|
|
5183
|
+
const entry = titleBarEntries[i];
|
|
5184
|
+
const entryWidth = entry.width;
|
|
5185
|
+
if (x >= currentX && x < currentX + entryWidth) {
|
|
5186
|
+
return i;
|
|
5187
|
+
}
|
|
5188
|
+
currentX += entryWidth;
|
|
5189
|
+
}
|
|
5190
|
+
return -1;
|
|
5191
|
+
};
|
|
5192
|
+
|
|
5178
5193
|
const handleClickAt = async (state, button, eventX, eventY) => {
|
|
5179
5194
|
const {
|
|
5180
5195
|
iconWidth,
|
|
@@ -5445,7 +5460,7 @@ const selectIndexNone = async (state, item) => {
|
|
|
5445
5460
|
menus: []
|
|
5446
5461
|
};
|
|
5447
5462
|
if (storedState) {
|
|
5448
|
-
set$
|
|
5463
|
+
set$2(uid, storedState.oldState, closedState, closedState);
|
|
5449
5464
|
if (latestState.menus.length > 0) {
|
|
5450
5465
|
const [command, ...args] = renderMenus(latestState, closedState);
|
|
5451
5466
|
await invoke$2(command, ...args);
|
|
@@ -5460,7 +5475,7 @@ const selectIndexNone = async (state, item) => {
|
|
|
5460
5475
|
menus: []
|
|
5461
5476
|
};
|
|
5462
5477
|
if (storedState) {
|
|
5463
|
-
set$
|
|
5478
|
+
set$2(uid, finalState, finalState, finalState);
|
|
5464
5479
|
}
|
|
5465
5480
|
return finalState;
|
|
5466
5481
|
};
|
|
@@ -5730,7 +5745,7 @@ const toggleMenu = async state => {
|
|
|
5730
5745
|
};
|
|
5731
5746
|
|
|
5732
5747
|
const wakeUp = sleepState => {
|
|
5733
|
-
set$
|
|
5748
|
+
set$2(sleepState.uid, sleepState, sleepState);
|
|
5734
5749
|
};
|
|
5735
5750
|
|
|
5736
5751
|
const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
|
|
@@ -5796,6 +5811,7 @@ const commandMap = {
|
|
|
5796
5811
|
'TitleBar.saveState': wrapGetter(saveState),
|
|
5797
5812
|
'TitleBar.setComponentState': setComponentState,
|
|
5798
5813
|
'TitleBar.setPlatform': wrapCommand(setPlatform),
|
|
5814
|
+
'TitleBar.setShowSideBarThings': set,
|
|
5799
5815
|
'TitleBar.setTitleTemplate': wrapCommand(setTitleTemplate),
|
|
5800
5816
|
'TitleBar.setWidth': wrapCommand(setWidth),
|
|
5801
5817
|
'TitleBar.showCommandCenter': wrapCommand(showCommandCenter),
|
|
@@ -5812,7 +5828,7 @@ const listen = async () => {
|
|
|
5812
5828
|
const rpc = await create$3({
|
|
5813
5829
|
commandMap: commandMap
|
|
5814
5830
|
});
|
|
5815
|
-
set$
|
|
5831
|
+
set$3(rpc);
|
|
5816
5832
|
};
|
|
5817
5833
|
|
|
5818
5834
|
const main = async () => {
|