@lvce-editor/title-bar-worker 2.25.0 → 2.27.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 +142 -31
- package/package.json +1 -1
|
@@ -1029,7 +1029,9 @@ const createDefaultState = (uid = DEFAULT_UID) => ({
|
|
|
1029
1029
|
uid,
|
|
1030
1030
|
width: 800,
|
|
1031
1031
|
x: 0,
|
|
1032
|
-
y: 0
|
|
1032
|
+
y: 0,
|
|
1033
|
+
layoutControlsEnabled: false,
|
|
1034
|
+
commandCenterEnabled: false
|
|
1033
1035
|
});
|
|
1034
1036
|
|
|
1035
1037
|
const emptyObject = {};
|
|
@@ -1048,6 +1050,8 @@ const About = 'About';
|
|
|
1048
1050
|
const CheckForUpdates = 'Check For Updates';
|
|
1049
1051
|
const ClearRecentlyOpened = 'Clear Recently Opened';
|
|
1050
1052
|
const Close = 'Close';
|
|
1053
|
+
const MenuBar$1 = 'Menu Bar';
|
|
1054
|
+
const CommandCenter = 'Command Center';
|
|
1051
1055
|
const Edit$1 = 'Edit';
|
|
1052
1056
|
const File$2 = 'File';
|
|
1053
1057
|
const Go$1 = 'Go';
|
|
@@ -1096,6 +1100,12 @@ const maximize$1 = () => {
|
|
|
1096
1100
|
const close$1 = () => {
|
|
1097
1101
|
return i18nString(Close);
|
|
1098
1102
|
};
|
|
1103
|
+
const menuBar = () => {
|
|
1104
|
+
return i18nString(MenuBar$1);
|
|
1105
|
+
};
|
|
1106
|
+
const commandCenter = () => {
|
|
1107
|
+
return i18nString(CommandCenter);
|
|
1108
|
+
};
|
|
1099
1109
|
|
|
1100
1110
|
const getTitleBarButtonsElectron = (controlsOverlayEnabled, titleBarStyleCustom) => {
|
|
1101
1111
|
if (controlsOverlayEnabled) {
|
|
@@ -1177,7 +1187,9 @@ const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled,
|
|
|
1177
1187
|
controlsOverlayEnabled,
|
|
1178
1188
|
titleBarStyleCustom,
|
|
1179
1189
|
titleBarButtons,
|
|
1180
|
-
assetDir
|
|
1190
|
+
assetDir,
|
|
1191
|
+
layoutControlsEnabled: false,
|
|
1192
|
+
commandCenterEnabled: false
|
|
1181
1193
|
};
|
|
1182
1194
|
set$3(id, state, state);
|
|
1183
1195
|
};
|
|
@@ -1242,6 +1254,7 @@ const diff3 = uid => {
|
|
|
1242
1254
|
return diffResult;
|
|
1243
1255
|
};
|
|
1244
1256
|
|
|
1257
|
+
const ContentInfo = 'contentinfo';
|
|
1245
1258
|
const Menu$1 = 'menu';
|
|
1246
1259
|
const MenuBar = 'menubar';
|
|
1247
1260
|
const MenuItem$1 = 'menuitem';
|
|
@@ -1527,6 +1540,8 @@ const getKeyCodeString = keyCode => {
|
|
|
1527
1540
|
}
|
|
1528
1541
|
};
|
|
1529
1542
|
|
|
1543
|
+
const Script = 2;
|
|
1544
|
+
|
|
1530
1545
|
const CtrlCmd = 1 << 11 >>> 0;
|
|
1531
1546
|
const Shift = 1 << 10 >>> 0;
|
|
1532
1547
|
|
|
@@ -1601,6 +1616,39 @@ const getKeyBindings$1 = () => {
|
|
|
1601
1616
|
}];
|
|
1602
1617
|
};
|
|
1603
1618
|
|
|
1619
|
+
const Separator = 1;
|
|
1620
|
+
const None = 0;
|
|
1621
|
+
const SubMenu = 4;
|
|
1622
|
+
const Checked = 2;
|
|
1623
|
+
const Unchecked = 3;
|
|
1624
|
+
const Disabled = 5;
|
|
1625
|
+
const RestoreFocus = 6;
|
|
1626
|
+
const Ignore = 7;
|
|
1627
|
+
|
|
1628
|
+
const getMenuEntriesTitleBarContextMenu = async state => {
|
|
1629
|
+
const {
|
|
1630
|
+
titleBarMenuBarEnabled,
|
|
1631
|
+
commandCenterEnabled
|
|
1632
|
+
} = state;
|
|
1633
|
+
// TODO checked state should be depending on whether or not that feature is currently visible or not
|
|
1634
|
+
return [{
|
|
1635
|
+
id: 'MenuBar',
|
|
1636
|
+
label: menuBar(),
|
|
1637
|
+
flags: titleBarMenuBarEnabled ? Checked : Unchecked,
|
|
1638
|
+
command: titleBarMenuBarEnabled ? 'TitleBar.hideMenuBar' : 'TitleBar.showMenuBar'
|
|
1639
|
+
}, {
|
|
1640
|
+
id: 'Command center',
|
|
1641
|
+
label: commandCenter(),
|
|
1642
|
+
flags: commandCenterEnabled ? Checked : Unchecked,
|
|
1643
|
+
command: commandCenterEnabled ? 'TitleBar.hideCommandCenter' : 'TitleBar.showCommandCenter'
|
|
1644
|
+
}, {
|
|
1645
|
+
id: 'layout controls',
|
|
1646
|
+
label: 'layout controls',
|
|
1647
|
+
flags: Checked,
|
|
1648
|
+
command: ''
|
|
1649
|
+
}];
|
|
1650
|
+
};
|
|
1651
|
+
|
|
1604
1652
|
/**
|
|
1605
1653
|
* @enum {string}
|
|
1606
1654
|
*/
|
|
@@ -1665,15 +1713,6 @@ const Terminal = 14;
|
|
|
1665
1713
|
const TitleBar = 15;
|
|
1666
1714
|
const View = 16;
|
|
1667
1715
|
|
|
1668
|
-
const Separator = 1;
|
|
1669
|
-
const None = 0;
|
|
1670
|
-
const SubMenu = 4;
|
|
1671
|
-
const Checked = 2;
|
|
1672
|
-
const Unchecked = 3;
|
|
1673
|
-
const Disabled = 5;
|
|
1674
|
-
const RestoreFocus = 6;
|
|
1675
|
-
const Ignore = 7;
|
|
1676
|
-
|
|
1677
1716
|
const menuEntrySeparator = {
|
|
1678
1717
|
id: 'separator',
|
|
1679
1718
|
label: '',
|
|
@@ -1941,6 +1980,10 @@ const getFilePathElectron = async file => {
|
|
|
1941
1980
|
const showContextMenu = async (x, y, id, ...args) => {
|
|
1942
1981
|
return invoke$1('ContextMenu.show', x, y, id, ...args);
|
|
1943
1982
|
};
|
|
1983
|
+
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1984
|
+
// @ts-ignore
|
|
1985
|
+
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1986
|
+
};
|
|
1944
1987
|
const getElectronVersion = async () => {
|
|
1945
1988
|
return invoke$1('Process.getElectronVersion');
|
|
1946
1989
|
};
|
|
@@ -2170,7 +2213,7 @@ const openExtensionSearch = async () => {
|
|
|
2170
2213
|
};
|
|
2171
2214
|
const setExtensionsSearchValue = async searchValue => {
|
|
2172
2215
|
// @ts-ignore
|
|
2173
|
-
return invoke$1('Extensions.handleInput', searchValue);
|
|
2216
|
+
return invoke$1('Extensions.handleInput', searchValue, Script);
|
|
2174
2217
|
};
|
|
2175
2218
|
const openExternal = async uri => {
|
|
2176
2219
|
// @ts-ignore
|
|
@@ -2272,6 +2315,7 @@ const RendererWorker = {
|
|
|
2272
2315
|
setWebViewPort,
|
|
2273
2316
|
setWorkspacePath,
|
|
2274
2317
|
showContextMenu,
|
|
2318
|
+
showContextMenu2,
|
|
2275
2319
|
showErrorDialog,
|
|
2276
2320
|
showMessageBox,
|
|
2277
2321
|
showSaveFilePicker,
|
|
@@ -2420,38 +2464,46 @@ const getMenuEntries$5 = () => {
|
|
|
2420
2464
|
return [{
|
|
2421
2465
|
id: File$1,
|
|
2422
2466
|
label: file(),
|
|
2423
|
-
flags: SubMenu
|
|
2467
|
+
flags: SubMenu,
|
|
2468
|
+
command: ''
|
|
2424
2469
|
}, {
|
|
2425
2470
|
id: Edit,
|
|
2426
2471
|
label: edit(),
|
|
2427
|
-
flags: SubMenu
|
|
2472
|
+
flags: SubMenu,
|
|
2473
|
+
command: ''
|
|
2428
2474
|
}, {
|
|
2429
2475
|
id: Selection,
|
|
2430
2476
|
label: selection(),
|
|
2431
|
-
flags: SubMenu
|
|
2477
|
+
flags: SubMenu,
|
|
2478
|
+
command: ''
|
|
2432
2479
|
}, {
|
|
2433
2480
|
id: View,
|
|
2434
2481
|
label: view(),
|
|
2435
|
-
flags: SubMenu
|
|
2482
|
+
flags: SubMenu,
|
|
2483
|
+
command: ''
|
|
2436
2484
|
}, {
|
|
2437
2485
|
id: Go,
|
|
2438
2486
|
label: go(),
|
|
2439
|
-
flags: SubMenu
|
|
2487
|
+
flags: SubMenu,
|
|
2488
|
+
command: ''
|
|
2440
2489
|
}, {
|
|
2441
2490
|
id: Run,
|
|
2442
2491
|
label: run(),
|
|
2443
2492
|
keyboardShortCut: 'Alt+r',
|
|
2444
|
-
flags: SubMenu
|
|
2493
|
+
flags: SubMenu,
|
|
2494
|
+
command: ''
|
|
2445
2495
|
}, {
|
|
2446
2496
|
id: Terminal,
|
|
2447
2497
|
label: terminal(),
|
|
2448
2498
|
keyboardShortCut: 'Alt+t',
|
|
2449
|
-
flags: SubMenu
|
|
2499
|
+
flags: SubMenu,
|
|
2500
|
+
command: ''
|
|
2450
2501
|
}, {
|
|
2451
2502
|
id: Help,
|
|
2452
2503
|
label: help(),
|
|
2453
2504
|
keyboardShortCut: 'Alt+h',
|
|
2454
|
-
flags: SubMenu
|
|
2505
|
+
flags: SubMenu,
|
|
2506
|
+
command: ''
|
|
2455
2507
|
}];
|
|
2456
2508
|
};
|
|
2457
2509
|
|
|
@@ -2459,27 +2511,33 @@ const getMenuEntries$4 = () => {
|
|
|
2459
2511
|
return [{
|
|
2460
2512
|
id: File$1,
|
|
2461
2513
|
label: file(),
|
|
2462
|
-
flags: None
|
|
2514
|
+
flags: None,
|
|
2515
|
+
command: ''
|
|
2463
2516
|
}, {
|
|
2464
2517
|
id: Edit,
|
|
2465
2518
|
label: edit(),
|
|
2466
|
-
flags: None
|
|
2519
|
+
flags: None,
|
|
2520
|
+
command: ''
|
|
2467
2521
|
}, {
|
|
2468
2522
|
id: Selection,
|
|
2469
2523
|
label: selection(),
|
|
2470
|
-
flags: None
|
|
2524
|
+
flags: None,
|
|
2525
|
+
command: ''
|
|
2471
2526
|
}, {
|
|
2472
2527
|
id: View,
|
|
2473
2528
|
label: view(),
|
|
2474
|
-
flags: None
|
|
2529
|
+
flags: None,
|
|
2530
|
+
command: ''
|
|
2475
2531
|
}, {
|
|
2476
2532
|
id: Go,
|
|
2477
2533
|
label: go(),
|
|
2478
|
-
flags: None
|
|
2534
|
+
flags: None,
|
|
2535
|
+
command: ''
|
|
2479
2536
|
}, {
|
|
2480
2537
|
id: Help,
|
|
2481
2538
|
label: help(),
|
|
2482
|
-
flags: None
|
|
2539
|
+
flags: None,
|
|
2540
|
+
command: ''
|
|
2483
2541
|
}];
|
|
2484
2542
|
};
|
|
2485
2543
|
|
|
@@ -2516,8 +2574,9 @@ const MenuEntriesView = {
|
|
|
2516
2574
|
|
|
2517
2575
|
const menus$1 = [MenuEntriesEdit, MenuEntriesFile, MenuEntriesGo, MenuEntriesHelp, MenuEntriesRun, MenuEntriesSelection, MenuEntriesTerminal, MenuEntriesTitleBar, MenuEntriesView, MenuEntriesOpenRecent];
|
|
2518
2576
|
|
|
2577
|
+
const MenuIdTitleBarContextMenu = 50;
|
|
2519
2578
|
const getMenuIds = () => {
|
|
2520
|
-
return menus$1.map(menu => menu.id);
|
|
2579
|
+
return [...menus$1.map(menu => menu.id), MenuIdTitleBarContextMenu];
|
|
2521
2580
|
};
|
|
2522
2581
|
const getMenuEntries$1 = async (id, platform) => {
|
|
2523
2582
|
const menu = menus$1.find(item => item.id === id);
|
|
@@ -2527,6 +2586,14 @@ const getMenuEntries$1 = async (id, platform) => {
|
|
|
2527
2586
|
return menu.getMenuEntries(platform);
|
|
2528
2587
|
};
|
|
2529
2588
|
|
|
2589
|
+
const getMenuEntries2 = async (state, props) => {
|
|
2590
|
+
if (props.menuId === MenuIdTitleBarContextMenu) {
|
|
2591
|
+
return getMenuEntriesTitleBarContextMenu(state);
|
|
2592
|
+
}
|
|
2593
|
+
// TODO
|
|
2594
|
+
return [];
|
|
2595
|
+
};
|
|
2596
|
+
|
|
2530
2597
|
const maximize = async () => {
|
|
2531
2598
|
await invoke('ElectronWindow.maximize');
|
|
2532
2599
|
};
|
|
@@ -2567,7 +2634,18 @@ const handleClick$1 = async (state, className) => {
|
|
|
2567
2634
|
return state;
|
|
2568
2635
|
};
|
|
2569
2636
|
|
|
2570
|
-
const
|
|
2637
|
+
const show2 = async (uid, menuId, x, y, args) => {
|
|
2638
|
+
// @ts-ignore
|
|
2639
|
+
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
2640
|
+
};
|
|
2641
|
+
|
|
2642
|
+
const handleContextMenu = async (state, button, eventX, eventY) => {
|
|
2643
|
+
const {
|
|
2644
|
+
uid
|
|
2645
|
+
} = state;
|
|
2646
|
+
await show2(uid, MenuIdTitleBarContextMenu, eventX, eventY, {
|
|
2647
|
+
menuId: MenuIdTitleBarContextMenu
|
|
2648
|
+
});
|
|
2571
2649
|
return state;
|
|
2572
2650
|
};
|
|
2573
2651
|
|
|
@@ -2827,6 +2905,18 @@ const handlePointerOver = (state, name) => {
|
|
|
2827
2905
|
return handleMouseOver(state, index);
|
|
2828
2906
|
};
|
|
2829
2907
|
|
|
2908
|
+
const hideCommandCenter = async state => {
|
|
2909
|
+
// TODO
|
|
2910
|
+
return state;
|
|
2911
|
+
};
|
|
2912
|
+
|
|
2913
|
+
const hideMenuBar = async state => {
|
|
2914
|
+
return {
|
|
2915
|
+
...state,
|
|
2916
|
+
titleBarMenuBarEnabled: false
|
|
2917
|
+
};
|
|
2918
|
+
};
|
|
2919
|
+
|
|
2830
2920
|
const createTextMeasureContext = (letterSpacing, font) => {
|
|
2831
2921
|
const canvas = new OffscreenCanvas(0, 0);
|
|
2832
2922
|
const ctx = canvas.getContext('2d');
|
|
@@ -3240,6 +3330,7 @@ const HandlePointerOut = 7;
|
|
|
3240
3330
|
const HandlePointerOver = 8;
|
|
3241
3331
|
const HandleMenuClick = 9;
|
|
3242
3332
|
const HandleMenuMouseOver = 10;
|
|
3333
|
+
const HandleContextMenu = 11;
|
|
3243
3334
|
|
|
3244
3335
|
const getItemVirtualDom = item => {
|
|
3245
3336
|
// @ts-ignore
|
|
@@ -3362,7 +3453,7 @@ const getTitleBarVirtualDom = state => {
|
|
|
3362
3453
|
type: Div,
|
|
3363
3454
|
className: 'Viewlet TitleBar',
|
|
3364
3455
|
id: 'TitleBar',
|
|
3365
|
-
role:
|
|
3456
|
+
role: ContentInfo,
|
|
3366
3457
|
ariaLabel: 'Title Bar',
|
|
3367
3458
|
childCount: 4
|
|
3368
3459
|
}];
|
|
@@ -3434,6 +3525,9 @@ const renderEventListeners = () => {
|
|
|
3434
3525
|
return [{
|
|
3435
3526
|
name: HandleClickMinimize,
|
|
3436
3527
|
params: ['handleClickMinimize']
|
|
3528
|
+
}, {
|
|
3529
|
+
name: HandleContextMenu,
|
|
3530
|
+
params: ['handleContextMenu', Button, ClientX, ClientY]
|
|
3437
3531
|
}, {
|
|
3438
3532
|
name: HandleClickToggleClose,
|
|
3439
3533
|
params: ['handleClickClose']
|
|
@@ -3495,6 +3589,18 @@ const saveState = state => {
|
|
|
3495
3589
|
};
|
|
3496
3590
|
};
|
|
3497
3591
|
|
|
3592
|
+
const showCommandCenter = async state => {
|
|
3593
|
+
// TODO
|
|
3594
|
+
return state;
|
|
3595
|
+
};
|
|
3596
|
+
|
|
3597
|
+
const showMenuBar = async state => {
|
|
3598
|
+
return {
|
|
3599
|
+
...state,
|
|
3600
|
+
titleBarMenuBarEnabled: true
|
|
3601
|
+
};
|
|
3602
|
+
};
|
|
3603
|
+
|
|
3498
3604
|
const create = (id, uri, x, y, width, height) => {
|
|
3499
3605
|
const state = {
|
|
3500
3606
|
...createDefaultState(),
|
|
@@ -4008,16 +4114,17 @@ const commandMap = {
|
|
|
4008
4114
|
'TitleBar.diff2': diff2,
|
|
4009
4115
|
'TitleBar.diff3': diff3,
|
|
4010
4116
|
'TitleBar.focus': wrapCommand(focus),
|
|
4011
|
-
'TitleBar.focusMenuBar': wrapCommand(focus),
|
|
4012
4117
|
'TitleBar.focusFirst': wrapCommand(focusFirst),
|
|
4013
4118
|
'TitleBar.focusIndex': wrapCommand(focusLast),
|
|
4014
4119
|
'TitleBar.focusLast': wrapCommand(focusIndex),
|
|
4120
|
+
'TitleBar.focusMenuBar': wrapCommand(focus),
|
|
4015
4121
|
'TitleBar.focusNext': wrapCommand(focusNext),
|
|
4016
4122
|
'TitleBar.focusPrevious': wrapCommand(focusPrevious),
|
|
4017
4123
|
'TitleBar.getCommandIds': getCommandIds,
|
|
4018
4124
|
'TitleBar.getCommands': getCommandIds,
|
|
4019
4125
|
'TitleBar.getKeyBindings': getKeyBindings$1,
|
|
4020
4126
|
'TitleBar.getMenuEntries': getMenuEntries$1,
|
|
4127
|
+
'TitleBar.getMenuEntries2': getMenuEntries2,
|
|
4021
4128
|
'TitleBar.getMenuIds': getMenuIds,
|
|
4022
4129
|
'TitleBar.getMenus': getMenus,
|
|
4023
4130
|
'TitleBar.handleButtonsClick': handleClick$1,
|
|
@@ -4026,7 +4133,7 @@ const commandMap = {
|
|
|
4026
4133
|
'TitleBar.handleClickClose': wrapCommand(handleClickClose),
|
|
4027
4134
|
'TitleBar.handleClickMinimize': wrapCommand(handleClickMinimize),
|
|
4028
4135
|
'TitleBar.handleClickToggleMaximize': wrapCommand(handleClickToggleMaximize),
|
|
4029
|
-
'TitleBar.handleContextMenu': handleContextMenu,
|
|
4136
|
+
'TitleBar.handleContextMenu': wrapCommand(handleContextMenu),
|
|
4030
4137
|
'TitleBar.handleFocus': wrapCommand(handleFocus),
|
|
4031
4138
|
'TitleBar.handleFocusOut': wrapCommand(handleFocusOut),
|
|
4032
4139
|
'TitleBar.handleKeyArrowDown': wrapCommand(handleKeyArrowDown),
|
|
@@ -4044,11 +4151,15 @@ const commandMap = {
|
|
|
4044
4151
|
'TitleBar.handleMouseOver': wrapCommand(handleMouseOver),
|
|
4045
4152
|
'TitleBar.handlePointerOut': wrapCommand(handlePointerOut),
|
|
4046
4153
|
'TitleBar.handlePointerOver': wrapCommand(handlePointerOver),
|
|
4154
|
+
'TitleBar.hideCommandCenter': wrapCommand(hideCommandCenter),
|
|
4155
|
+
'TitleBar.hideMenuBar': wrapCommand(hideMenuBar),
|
|
4047
4156
|
'TitleBar.loadContent2': wrapCommand(loadContent2),
|
|
4048
4157
|
'TitleBar.render3': render3,
|
|
4049
4158
|
'TitleBar.renderEventListeners': renderEventListeners,
|
|
4050
4159
|
'TitleBar.resize': wrapCommand(resize),
|
|
4051
4160
|
'TitleBar.saveState': wrapGetter(saveState),
|
|
4161
|
+
'TitleBar.showCommandCenter': wrapCommand(showCommandCenter),
|
|
4162
|
+
'TitleBar.showMenuBar': wrapCommand(showMenuBar),
|
|
4052
4163
|
'TitleBar.terminate': terminate,
|
|
4053
4164
|
'TitleBar.toggleIndex': wrapCommand(toggleIndex),
|
|
4054
4165
|
'TitleBar.toggleMenu': wrapCommand(toggleMenu)
|