@lvce-editor/title-bar-worker 4.28.2 → 4.28.3
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 +48 -22
- 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,7 +4240,7 @@ 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
|
|
|
@@ -4605,7 +4608,7 @@ const loadContent2Command = async uid => {
|
|
|
4605
4608
|
titleWidth: latest.newState.titleWidth,
|
|
4606
4609
|
workspaceUri: latest.newState.workspaceUri
|
|
4607
4610
|
};
|
|
4608
|
-
set$
|
|
4611
|
+
set$2(uid, latest.oldState, nextState, nextState);
|
|
4609
4612
|
};
|
|
4610
4613
|
|
|
4611
4614
|
const renderFocusContext = (oldState, newState) => {
|
|
@@ -4931,7 +4934,7 @@ const render3 = async (uid, diffResult) => {
|
|
|
4931
4934
|
newState,
|
|
4932
4935
|
oldState
|
|
4933
4936
|
} = get(uid);
|
|
4934
|
-
set$
|
|
4937
|
+
set$2(uid, newState, newState);
|
|
4935
4938
|
const commands = [];
|
|
4936
4939
|
for (const item of numbers) {
|
|
4937
4940
|
if (!pendingDiffs.has(item)) {
|
|
@@ -5049,6 +5052,28 @@ const setPlatform = (state, platform) => {
|
|
|
5049
5052
|
};
|
|
5050
5053
|
};
|
|
5051
5054
|
|
|
5055
|
+
const setShowSideBarThings = (state, showSideBarThings) => {
|
|
5056
|
+
const {
|
|
5057
|
+
focused,
|
|
5058
|
+
focusedIndex,
|
|
5059
|
+
isMenuOpen,
|
|
5060
|
+
menus,
|
|
5061
|
+
showSideBarThings: currentShowSideBarThings
|
|
5062
|
+
} = state;
|
|
5063
|
+
if (showSideBarThings === currentShowSideBarThings) {
|
|
5064
|
+
return state;
|
|
5065
|
+
}
|
|
5066
|
+
return {
|
|
5067
|
+
...state,
|
|
5068
|
+
focused: showSideBarThings && focused,
|
|
5069
|
+
focusedIndex: showSideBarThings ? focusedIndex : -1,
|
|
5070
|
+
isMenuOpen: showSideBarThings && isMenuOpen,
|
|
5071
|
+
menus: showSideBarThings ? menus : [],
|
|
5072
|
+
showSideBarThings
|
|
5073
|
+
};
|
|
5074
|
+
};
|
|
5075
|
+
const set = wrapCommand(setShowSideBarThings);
|
|
5076
|
+
|
|
5052
5077
|
const setTitleTemplate = async (state, titleTemplate) => {
|
|
5053
5078
|
const {
|
|
5054
5079
|
applicationName,
|
|
@@ -5125,7 +5150,7 @@ const create = (id, uri, x, y, width, height) => {
|
|
|
5125
5150
|
x,
|
|
5126
5151
|
y
|
|
5127
5152
|
};
|
|
5128
|
-
set$
|
|
5153
|
+
set$2(id, state, state);
|
|
5129
5154
|
return state;
|
|
5130
5155
|
};
|
|
5131
5156
|
|
|
@@ -5445,7 +5470,7 @@ const selectIndexNone = async (state, item) => {
|
|
|
5445
5470
|
menus: []
|
|
5446
5471
|
};
|
|
5447
5472
|
if (storedState) {
|
|
5448
|
-
set$
|
|
5473
|
+
set$2(uid, storedState.oldState, closedState, closedState);
|
|
5449
5474
|
if (latestState.menus.length > 0) {
|
|
5450
5475
|
const [command, ...args] = renderMenus(latestState, closedState);
|
|
5451
5476
|
await invoke$2(command, ...args);
|
|
@@ -5460,7 +5485,7 @@ const selectIndexNone = async (state, item) => {
|
|
|
5460
5485
|
menus: []
|
|
5461
5486
|
};
|
|
5462
5487
|
if (storedState) {
|
|
5463
|
-
set$
|
|
5488
|
+
set$2(uid, finalState, finalState, finalState);
|
|
5464
5489
|
}
|
|
5465
5490
|
return finalState;
|
|
5466
5491
|
};
|
|
@@ -5730,7 +5755,7 @@ const toggleMenu = async state => {
|
|
|
5730
5755
|
};
|
|
5731
5756
|
|
|
5732
5757
|
const wakeUp = sleepState => {
|
|
5733
|
-
set$
|
|
5758
|
+
set$2(sleepState.uid, sleepState, sleepState);
|
|
5734
5759
|
};
|
|
5735
5760
|
|
|
5736
5761
|
const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
|
|
@@ -5796,6 +5821,7 @@ const commandMap = {
|
|
|
5796
5821
|
'TitleBar.saveState': wrapGetter(saveState),
|
|
5797
5822
|
'TitleBar.setComponentState': setComponentState,
|
|
5798
5823
|
'TitleBar.setPlatform': wrapCommand(setPlatform),
|
|
5824
|
+
'TitleBar.setShowSideBarThings': set,
|
|
5799
5825
|
'TitleBar.setTitleTemplate': wrapCommand(setTitleTemplate),
|
|
5800
5826
|
'TitleBar.setWidth': wrapCommand(setWidth),
|
|
5801
5827
|
'TitleBar.showCommandCenter': wrapCommand(showCommandCenter),
|
|
@@ -5812,7 +5838,7 @@ const listen = async () => {
|
|
|
5812
5838
|
const rpc = await create$3({
|
|
5813
5839
|
commandMap: commandMap
|
|
5814
5840
|
});
|
|
5815
|
-
set$
|
|
5841
|
+
set$3(rpc);
|
|
5816
5842
|
};
|
|
5817
5843
|
|
|
5818
5844
|
const main = async () => {
|