@lvce-editor/title-bar-worker 4.0.0 → 4.2.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.
- package/dist/titleBarWorkerMain.js +74 -157
- package/package.json +1 -1
|
@@ -1238,139 +1238,74 @@ const Backslash = 'Backslash';
|
|
|
1238
1238
|
const Star = '*';
|
|
1239
1239
|
const Plus = '+';
|
|
1240
1240
|
|
|
1241
|
+
const keyCodeStringMap = {
|
|
1242
|
+
[Backquote$1]: Backquote,
|
|
1243
|
+
[Backslash$1]: Backslash,
|
|
1244
|
+
[Backspace$1]: Backspace,
|
|
1245
|
+
[Comma$1]: Comma,
|
|
1246
|
+
[Delete$1]: Delete,
|
|
1247
|
+
[Digit0$1]: Digit0,
|
|
1248
|
+
[Digit1$1]: Digit1,
|
|
1249
|
+
[Digit2$1]: Digit2,
|
|
1250
|
+
[Digit3$1]: Digit3,
|
|
1251
|
+
[Digit4$1]: Digit4,
|
|
1252
|
+
[Digit5$1]: Digit5,
|
|
1253
|
+
[Digit6$1]: Digit6,
|
|
1254
|
+
[Digit7$1]: Digit7,
|
|
1255
|
+
[Digit8$1]: Digit8,
|
|
1256
|
+
[Digit9$1]: Digit9,
|
|
1257
|
+
[DownArrow$1]: DownArrow,
|
|
1258
|
+
[End$1]: End,
|
|
1259
|
+
[Enter$1]: Enter,
|
|
1260
|
+
[Equal$1]: Equal,
|
|
1261
|
+
[Escape$1]: Escape,
|
|
1262
|
+
[F1$1]: F1,
|
|
1263
|
+
[F2$1]: F2,
|
|
1264
|
+
[F3$1]: F3,
|
|
1265
|
+
[F4$1]: F4,
|
|
1266
|
+
[F5$1]: F5,
|
|
1267
|
+
[F6$1]: F6,
|
|
1268
|
+
[Home$1]: Home,
|
|
1269
|
+
[Insert$1]: Insert,
|
|
1270
|
+
[KeyA$1]: KeyA,
|
|
1271
|
+
[KeyB$1]: KeyB,
|
|
1272
|
+
[KeyC$1]: KeyC,
|
|
1273
|
+
[KeyD$1]: KeyD,
|
|
1274
|
+
[KeyE$1]: KeyE,
|
|
1275
|
+
[KeyF$1]: KeyF,
|
|
1276
|
+
[KeyG$1]: KeyG,
|
|
1277
|
+
[KeyH$1]: KeyH,
|
|
1278
|
+
[KeyI$1]: KeyI,
|
|
1279
|
+
[KeyJ$1]: KeyJ,
|
|
1280
|
+
[KeyK$1]: KeyK,
|
|
1281
|
+
[KeyL$1]: KeyL,
|
|
1282
|
+
[KeyM$1]: KeyM,
|
|
1283
|
+
[KeyN$1]: KeyN,
|
|
1284
|
+
[KeyO$1]: KeyO,
|
|
1285
|
+
[KeyP$1]: KeyP,
|
|
1286
|
+
[KeyQ$1]: KeyQ,
|
|
1287
|
+
[KeyR$1]: KeyR,
|
|
1288
|
+
[KeyS$1]: KeyS,
|
|
1289
|
+
[KeyT$1]: KeyT,
|
|
1290
|
+
[KeyU$1]: KeyU,
|
|
1291
|
+
[KeyV$1]: KeyV,
|
|
1292
|
+
[KeyW$1]: KeyW,
|
|
1293
|
+
[KeyX$1]: KeyX,
|
|
1294
|
+
[KeyY$1]: KeyY,
|
|
1295
|
+
[KeyZ$1]: KeyZ,
|
|
1296
|
+
[LeftArrow$1]: LeftArrow,
|
|
1297
|
+
[Minus$1]: Minus,
|
|
1298
|
+
[PageDown$1]: PageDown,
|
|
1299
|
+
[PageUp$1]: PageUp,
|
|
1300
|
+
[Plus$1]: Plus,
|
|
1301
|
+
[RightArrow$1]: RightArrow,
|
|
1302
|
+
[Space$1]: Space,
|
|
1303
|
+
[Star$1]: Star,
|
|
1304
|
+
[Tab$1]: Tab,
|
|
1305
|
+
[UpArrow$1]: UpArrow
|
|
1306
|
+
};
|
|
1241
1307
|
const getKeyCodeString = keyCode => {
|
|
1242
|
-
|
|
1243
|
-
case Backquote$1:
|
|
1244
|
-
return Backquote;
|
|
1245
|
-
case Backslash$1:
|
|
1246
|
-
return Backslash;
|
|
1247
|
-
case Backspace$1:
|
|
1248
|
-
return Backspace;
|
|
1249
|
-
case Comma$1:
|
|
1250
|
-
return Comma;
|
|
1251
|
-
case Delete$1:
|
|
1252
|
-
return Delete;
|
|
1253
|
-
case Digit0$1:
|
|
1254
|
-
return Digit0;
|
|
1255
|
-
case Digit1$1:
|
|
1256
|
-
return Digit1;
|
|
1257
|
-
case Digit2$1:
|
|
1258
|
-
return Digit2;
|
|
1259
|
-
case Digit3$1:
|
|
1260
|
-
return Digit3;
|
|
1261
|
-
case Digit4$1:
|
|
1262
|
-
return Digit4;
|
|
1263
|
-
case Digit5$1:
|
|
1264
|
-
return Digit5;
|
|
1265
|
-
case Digit6$1:
|
|
1266
|
-
return Digit6;
|
|
1267
|
-
case Digit7$1:
|
|
1268
|
-
return Digit7;
|
|
1269
|
-
case Digit8$1:
|
|
1270
|
-
return Digit8;
|
|
1271
|
-
case Digit9$1:
|
|
1272
|
-
return Digit9;
|
|
1273
|
-
case DownArrow$1:
|
|
1274
|
-
return DownArrow;
|
|
1275
|
-
case End$1:
|
|
1276
|
-
return End;
|
|
1277
|
-
case Enter$1:
|
|
1278
|
-
return Enter;
|
|
1279
|
-
case Equal$1:
|
|
1280
|
-
return Equal;
|
|
1281
|
-
case Escape$1:
|
|
1282
|
-
return Escape;
|
|
1283
|
-
case F1$1:
|
|
1284
|
-
return F1;
|
|
1285
|
-
case F2$1:
|
|
1286
|
-
return F2;
|
|
1287
|
-
case F3$1:
|
|
1288
|
-
return F3;
|
|
1289
|
-
case F4$1:
|
|
1290
|
-
return F4;
|
|
1291
|
-
case F5$1:
|
|
1292
|
-
return F5;
|
|
1293
|
-
case F6$1:
|
|
1294
|
-
return F6;
|
|
1295
|
-
case Home$1:
|
|
1296
|
-
return Home;
|
|
1297
|
-
case Insert$1:
|
|
1298
|
-
return Insert;
|
|
1299
|
-
case KeyA$1:
|
|
1300
|
-
return KeyA;
|
|
1301
|
-
case KeyB$1:
|
|
1302
|
-
return KeyB;
|
|
1303
|
-
case KeyC$1:
|
|
1304
|
-
return KeyC;
|
|
1305
|
-
case KeyD$1:
|
|
1306
|
-
return KeyD;
|
|
1307
|
-
case KeyE$1:
|
|
1308
|
-
return KeyE;
|
|
1309
|
-
case KeyF$1:
|
|
1310
|
-
return KeyF;
|
|
1311
|
-
case KeyG$1:
|
|
1312
|
-
return KeyG;
|
|
1313
|
-
case KeyH$1:
|
|
1314
|
-
return KeyH;
|
|
1315
|
-
case KeyI$1:
|
|
1316
|
-
return KeyI;
|
|
1317
|
-
case KeyJ$1:
|
|
1318
|
-
return KeyJ;
|
|
1319
|
-
case KeyK$1:
|
|
1320
|
-
return KeyK;
|
|
1321
|
-
case KeyL$1:
|
|
1322
|
-
return KeyL;
|
|
1323
|
-
case KeyM$1:
|
|
1324
|
-
return KeyM;
|
|
1325
|
-
case KeyN$1:
|
|
1326
|
-
return KeyN;
|
|
1327
|
-
case KeyO$1:
|
|
1328
|
-
return KeyO;
|
|
1329
|
-
case KeyP$1:
|
|
1330
|
-
return KeyP;
|
|
1331
|
-
case KeyQ$1:
|
|
1332
|
-
return KeyQ;
|
|
1333
|
-
case KeyR$1:
|
|
1334
|
-
return KeyR;
|
|
1335
|
-
case KeyS$1:
|
|
1336
|
-
return KeyS;
|
|
1337
|
-
case KeyT$1:
|
|
1338
|
-
return KeyT;
|
|
1339
|
-
case KeyU$1:
|
|
1340
|
-
return KeyU;
|
|
1341
|
-
case KeyV$1:
|
|
1342
|
-
return KeyV;
|
|
1343
|
-
case KeyW$1:
|
|
1344
|
-
return KeyW;
|
|
1345
|
-
case KeyX$1:
|
|
1346
|
-
return KeyX;
|
|
1347
|
-
case KeyY$1:
|
|
1348
|
-
return KeyY;
|
|
1349
|
-
case KeyZ$1:
|
|
1350
|
-
return KeyZ;
|
|
1351
|
-
case LeftArrow$1:
|
|
1352
|
-
return LeftArrow;
|
|
1353
|
-
case Minus$1:
|
|
1354
|
-
return Minus;
|
|
1355
|
-
case PageDown$1:
|
|
1356
|
-
return PageDown;
|
|
1357
|
-
case PageUp$1:
|
|
1358
|
-
return PageUp;
|
|
1359
|
-
case Plus$1:
|
|
1360
|
-
return Plus;
|
|
1361
|
-
case RightArrow$1:
|
|
1362
|
-
return RightArrow;
|
|
1363
|
-
case Space$1:
|
|
1364
|
-
return Space;
|
|
1365
|
-
case Star$1:
|
|
1366
|
-
return Star;
|
|
1367
|
-
case Tab$1:
|
|
1368
|
-
return Tab;
|
|
1369
|
-
case UpArrow$1:
|
|
1370
|
-
return UpArrow;
|
|
1371
|
-
default:
|
|
1372
|
-
return Unknown;
|
|
1373
|
-
}
|
|
1308
|
+
return keyCodeStringMap[keyCode] || Unknown;
|
|
1374
1309
|
};
|
|
1375
1310
|
|
|
1376
1311
|
const CtrlCmd = 1 << 11 >>> 0;
|
|
@@ -1635,7 +1570,6 @@ const i18nString = (key, placeholders = emptyObject) => {
|
|
|
1635
1570
|
const About = 'About';
|
|
1636
1571
|
const Appearance = 'Appearance';
|
|
1637
1572
|
const Chat = 'Chat';
|
|
1638
|
-
const CheckForUpdates = 'Check For Updates';
|
|
1639
1573
|
const ClearRecentlyOpened = 'Clear Recently Opened';
|
|
1640
1574
|
const Close = 'Close';
|
|
1641
1575
|
const Exit = 'Exit';
|
|
@@ -2148,22 +2082,11 @@ const toggleDeveloperTools = () => {
|
|
|
2148
2082
|
const openProcessExplorer = () => {
|
|
2149
2083
|
return i18nString(OpenProcessExplorer);
|
|
2150
2084
|
};
|
|
2151
|
-
const checkForUpdates = () => {
|
|
2152
|
-
return i18nString(CheckForUpdates);
|
|
2153
|
-
};
|
|
2154
2085
|
const about = () => {
|
|
2155
2086
|
return i18nString(About);
|
|
2156
2087
|
};
|
|
2157
2088
|
|
|
2158
|
-
const isAutoUpdateSupported = platform => {
|
|
2159
|
-
if (platform !== Electron) {
|
|
2160
|
-
return false;
|
|
2161
|
-
}
|
|
2162
|
-
return false;
|
|
2163
|
-
};
|
|
2164
|
-
|
|
2165
2089
|
const getMenuEntries$9 = async platform => {
|
|
2166
|
-
const autoUpdateSupported = isAutoUpdateSupported(platform);
|
|
2167
2090
|
const entries = [];
|
|
2168
2091
|
if (platform !== Web) {
|
|
2169
2092
|
entries.push({
|
|
@@ -2178,14 +2101,6 @@ const getMenuEntries$9 = async platform => {
|
|
|
2178
2101
|
label: openProcessExplorer()
|
|
2179
2102
|
});
|
|
2180
2103
|
}
|
|
2181
|
-
if (autoUpdateSupported) {
|
|
2182
|
-
entries.push(menuEntrySeparator, {
|
|
2183
|
-
command: 'AutoUpdater.checkForUpdates',
|
|
2184
|
-
flags: RestoreFocus,
|
|
2185
|
-
id: 'checkForUpdates',
|
|
2186
|
-
label: checkForUpdates()
|
|
2187
|
-
});
|
|
2188
|
-
}
|
|
2189
2104
|
if (entries.length > 0) {
|
|
2190
2105
|
entries.push(menuEntrySeparator);
|
|
2191
2106
|
}
|
|
@@ -3289,6 +3204,10 @@ const addWidths = async (entries, labelPadding, fontWeight, fontSize, fontFamily
|
|
|
3289
3204
|
return withWidths;
|
|
3290
3205
|
};
|
|
3291
3206
|
|
|
3207
|
+
const getTitleBarMenuBarWidth = (windowWidth, menuBarX, iconWidth, titleWidth) => {
|
|
3208
|
+
return windowWidth / 2 - titleWidth / 2 - menuBarX - iconWidth;
|
|
3209
|
+
};
|
|
3210
|
+
|
|
3292
3211
|
const getWorkspaceUri = () => {
|
|
3293
3212
|
return invoke('Workspace.getUri');
|
|
3294
3213
|
};
|
|
@@ -3311,6 +3230,7 @@ const loadContent2 = async state => {
|
|
|
3311
3230
|
const title = getTitle(workspaceUri, state.titleTemplate, state.appName);
|
|
3312
3231
|
const titleWidth = await measureTitleWidth(title, labelFontWeight, labelFontSize, labelFontFamily, labelLetterSpacing);
|
|
3313
3232
|
const iconWidth = 30;
|
|
3233
|
+
const width = getTitleBarMenuBarWidth(state.width, state.x, iconWidth, titleWidth);
|
|
3314
3234
|
|
|
3315
3235
|
// TODO load preferences here
|
|
3316
3236
|
|
|
@@ -3324,7 +3244,8 @@ const loadContent2 = async state => {
|
|
|
3324
3244
|
title,
|
|
3325
3245
|
titleBarButtons: buttons,
|
|
3326
3246
|
titleBarEntries: withWidths,
|
|
3327
|
-
titleWidth
|
|
3247
|
+
titleWidth,
|
|
3248
|
+
width
|
|
3328
3249
|
};
|
|
3329
3250
|
};
|
|
3330
3251
|
|
|
@@ -3843,10 +3764,6 @@ const renderEventListeners = () => {
|
|
|
3843
3764
|
}];
|
|
3844
3765
|
};
|
|
3845
3766
|
|
|
3846
|
-
const getTitleBarMenuBarWidth = (windowWidth, menuBarX, iconWidth, titleWidth) => {
|
|
3847
|
-
return windowWidth / 2 - titleWidth / 2 - menuBarX - iconWidth;
|
|
3848
|
-
};
|
|
3849
|
-
|
|
3850
3767
|
const resize = async (state, dimensions) => {
|
|
3851
3768
|
const {
|
|
3852
3769
|
iconWidth,
|