@lvce-editor/title-bar-worker 2.24.0 → 2.26.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.
@@ -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 = {};
@@ -1177,7 +1179,9 @@ const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled,
1177
1179
  controlsOverlayEnabled,
1178
1180
  titleBarStyleCustom,
1179
1181
  titleBarButtons,
1180
- assetDir
1182
+ assetDir,
1183
+ layoutControlsEnabled: false,
1184
+ commandCenterEnabled: false
1181
1185
  };
1182
1186
  set$3(id, state, state);
1183
1187
  };
@@ -1242,6 +1246,7 @@ const diff3 = uid => {
1242
1246
  return diffResult;
1243
1247
  };
1244
1248
 
1249
+ const ContentInfo = 'contentinfo';
1245
1250
  const Menu$1 = 'menu';
1246
1251
  const MenuBar = 'menubar';
1247
1252
  const MenuItem$1 = 'menuitem';
@@ -1527,6 +1532,8 @@ const getKeyCodeString = keyCode => {
1527
1532
  }
1528
1533
  };
1529
1534
 
1535
+ const Script = 2;
1536
+
1530
1537
  const CtrlCmd = 1 << 11 >>> 0;
1531
1538
  const Shift = 1 << 10 >>> 0;
1532
1539
 
@@ -1601,6 +1608,35 @@ const getKeyBindings$1 = () => {
1601
1608
  }];
1602
1609
  };
1603
1610
 
1611
+ const Separator = 1;
1612
+ const None = 0;
1613
+ const SubMenu = 4;
1614
+ const Checked = 2;
1615
+ const Unchecked = 3;
1616
+ const Disabled = 5;
1617
+ const RestoreFocus = 6;
1618
+ const Ignore = 7;
1619
+
1620
+ const getMenuEntriesTitleBarContextMenu = async state => {
1621
+ // TODO checked state should be depending on whether or not that feature is currently visible or not
1622
+ return [{
1623
+ id: 'MenuBar',
1624
+ label: 'menu bar',
1625
+ flags: Checked,
1626
+ command: ''
1627
+ }, {
1628
+ id: 'Command center',
1629
+ label: 'command center',
1630
+ flags: Checked,
1631
+ command: ''
1632
+ }, {
1633
+ id: 'layout controls',
1634
+ label: 'layout controls',
1635
+ flags: Checked,
1636
+ command: ''
1637
+ }];
1638
+ };
1639
+
1604
1640
  /**
1605
1641
  * @enum {string}
1606
1642
  */
@@ -1665,15 +1701,6 @@ const Terminal = 14;
1665
1701
  const TitleBar = 15;
1666
1702
  const View = 16;
1667
1703
 
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
1704
  const menuEntrySeparator = {
1678
1705
  id: 'separator',
1679
1706
  label: '',
@@ -1941,6 +1968,10 @@ const getFilePathElectron = async file => {
1941
1968
  const showContextMenu = async (x, y, id, ...args) => {
1942
1969
  return invoke$1('ContextMenu.show', x, y, id, ...args);
1943
1970
  };
1971
+ const showContextMenu2 = async (uid, menuId, x, y, args) => {
1972
+ // @ts-ignore
1973
+ await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
1974
+ };
1944
1975
  const getElectronVersion = async () => {
1945
1976
  return invoke$1('Process.getElectronVersion');
1946
1977
  };
@@ -2170,7 +2201,7 @@ const openExtensionSearch = async () => {
2170
2201
  };
2171
2202
  const setExtensionsSearchValue = async searchValue => {
2172
2203
  // @ts-ignore
2173
- return invoke$1('Extensions.handleInput', searchValue);
2204
+ return invoke$1('Extensions.handleInput', searchValue, Script);
2174
2205
  };
2175
2206
  const openExternal = async uri => {
2176
2207
  // @ts-ignore
@@ -2272,6 +2303,7 @@ const RendererWorker = {
2272
2303
  setWebViewPort,
2273
2304
  setWorkspacePath,
2274
2305
  showContextMenu,
2306
+ showContextMenu2,
2275
2307
  showErrorDialog,
2276
2308
  showMessageBox,
2277
2309
  showSaveFilePicker,
@@ -2420,38 +2452,46 @@ const getMenuEntries$5 = () => {
2420
2452
  return [{
2421
2453
  id: File$1,
2422
2454
  label: file(),
2423
- flags: SubMenu
2455
+ flags: SubMenu,
2456
+ command: ''
2424
2457
  }, {
2425
2458
  id: Edit,
2426
2459
  label: edit(),
2427
- flags: SubMenu
2460
+ flags: SubMenu,
2461
+ command: ''
2428
2462
  }, {
2429
2463
  id: Selection,
2430
2464
  label: selection(),
2431
- flags: SubMenu
2465
+ flags: SubMenu,
2466
+ command: ''
2432
2467
  }, {
2433
2468
  id: View,
2434
2469
  label: view(),
2435
- flags: SubMenu
2470
+ flags: SubMenu,
2471
+ command: ''
2436
2472
  }, {
2437
2473
  id: Go,
2438
2474
  label: go(),
2439
- flags: SubMenu
2475
+ flags: SubMenu,
2476
+ command: ''
2440
2477
  }, {
2441
2478
  id: Run,
2442
2479
  label: run(),
2443
2480
  keyboardShortCut: 'Alt+r',
2444
- flags: SubMenu
2481
+ flags: SubMenu,
2482
+ command: ''
2445
2483
  }, {
2446
2484
  id: Terminal,
2447
2485
  label: terminal(),
2448
2486
  keyboardShortCut: 'Alt+t',
2449
- flags: SubMenu
2487
+ flags: SubMenu,
2488
+ command: ''
2450
2489
  }, {
2451
2490
  id: Help,
2452
2491
  label: help(),
2453
2492
  keyboardShortCut: 'Alt+h',
2454
- flags: SubMenu
2493
+ flags: SubMenu,
2494
+ command: ''
2455
2495
  }];
2456
2496
  };
2457
2497
 
@@ -2459,27 +2499,33 @@ const getMenuEntries$4 = () => {
2459
2499
  return [{
2460
2500
  id: File$1,
2461
2501
  label: file(),
2462
- flags: None
2502
+ flags: None,
2503
+ command: ''
2463
2504
  }, {
2464
2505
  id: Edit,
2465
2506
  label: edit(),
2466
- flags: None
2507
+ flags: None,
2508
+ command: ''
2467
2509
  }, {
2468
2510
  id: Selection,
2469
2511
  label: selection(),
2470
- flags: None
2512
+ flags: None,
2513
+ command: ''
2471
2514
  }, {
2472
2515
  id: View,
2473
2516
  label: view(),
2474
- flags: None
2517
+ flags: None,
2518
+ command: ''
2475
2519
  }, {
2476
2520
  id: Go,
2477
2521
  label: go(),
2478
- flags: None
2522
+ flags: None,
2523
+ command: ''
2479
2524
  }, {
2480
2525
  id: Help,
2481
2526
  label: help(),
2482
- flags: None
2527
+ flags: None,
2528
+ command: ''
2483
2529
  }];
2484
2530
  };
2485
2531
 
@@ -2516,8 +2562,9 @@ const MenuEntriesView = {
2516
2562
 
2517
2563
  const menus$1 = [MenuEntriesEdit, MenuEntriesFile, MenuEntriesGo, MenuEntriesHelp, MenuEntriesRun, MenuEntriesSelection, MenuEntriesTerminal, MenuEntriesTitleBar, MenuEntriesView, MenuEntriesOpenRecent];
2518
2564
 
2565
+ const MenuIdTitleBarContextMenu = 50;
2519
2566
  const getMenuIds = () => {
2520
- return menus$1.map(menu => menu.id);
2567
+ return [...menus$1.map(menu => menu.id), MenuIdTitleBarContextMenu];
2521
2568
  };
2522
2569
  const getMenuEntries$1 = async (id, platform) => {
2523
2570
  const menu = menus$1.find(item => item.id === id);
@@ -2527,6 +2574,14 @@ const getMenuEntries$1 = async (id, platform) => {
2527
2574
  return menu.getMenuEntries(platform);
2528
2575
  };
2529
2576
 
2577
+ const getMenuEntries2 = async (state, props) => {
2578
+ if (props.menuId === MenuIdTitleBarContextMenu) {
2579
+ return getMenuEntriesTitleBarContextMenu();
2580
+ }
2581
+ // TODO
2582
+ return [];
2583
+ };
2584
+
2530
2585
  const maximize = async () => {
2531
2586
  await invoke('ElectronWindow.maximize');
2532
2587
  };
@@ -2567,7 +2622,18 @@ const handleClick$1 = async (state, className) => {
2567
2622
  return state;
2568
2623
  };
2569
2624
 
2570
- const handleContextMenu = state => {
2625
+ const show2 = async (uid, menuId, x, y, args) => {
2626
+ // @ts-ignore
2627
+ await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
2628
+ };
2629
+
2630
+ const handleContextMenu = async (state, button, eventX, eventY) => {
2631
+ const {
2632
+ uid
2633
+ } = state;
2634
+ await show2(uid, MenuIdTitleBarContextMenu, eventX, eventY, {
2635
+ menuId: MenuIdTitleBarContextMenu
2636
+ });
2571
2637
  return state;
2572
2638
  };
2573
2639
 
@@ -2827,6 +2893,11 @@ const handlePointerOver = (state, name) => {
2827
2893
  return handleMouseOver(state, index);
2828
2894
  };
2829
2895
 
2896
+ const hideMenuBar = async state => {
2897
+ // TODO
2898
+ return state;
2899
+ };
2900
+
2830
2901
  const createTextMeasureContext = (letterSpacing, font) => {
2831
2902
  const canvas = new OffscreenCanvas(0, 0);
2832
2903
  const ctx = canvas.getContext('2d');
@@ -3240,6 +3311,7 @@ const HandlePointerOut = 7;
3240
3311
  const HandlePointerOver = 8;
3241
3312
  const HandleMenuClick = 9;
3242
3313
  const HandleMenuMouseOver = 10;
3314
+ const HandleContextMenu = 11;
3243
3315
 
3244
3316
  const getItemVirtualDom = item => {
3245
3317
  // @ts-ignore
@@ -3362,7 +3434,7 @@ const getTitleBarVirtualDom = state => {
3362
3434
  type: Div,
3363
3435
  className: 'Viewlet TitleBar',
3364
3436
  id: 'TitleBar',
3365
- role: 'contentinfo',
3437
+ role: ContentInfo,
3366
3438
  ariaLabel: 'Title Bar',
3367
3439
  childCount: 4
3368
3440
  }];
@@ -3434,6 +3506,9 @@ const renderEventListeners = () => {
3434
3506
  return [{
3435
3507
  name: HandleClickMinimize,
3436
3508
  params: ['handleClickMinimize']
3509
+ }, {
3510
+ name: HandleContextMenu,
3511
+ params: ['handleContextMenu', Button, ClientX, ClientY]
3437
3512
  }, {
3438
3513
  name: HandleClickToggleClose,
3439
3514
  params: ['handleClickClose']
@@ -3495,6 +3570,11 @@ const saveState = state => {
3495
3570
  };
3496
3571
  };
3497
3572
 
3573
+ const showMenuBar = async state => {
3574
+ // TODO
3575
+ return state;
3576
+ };
3577
+
3498
3578
  const create = (id, uri, x, y, width, height) => {
3499
3579
  const state = {
3500
3580
  ...createDefaultState(),
@@ -4008,16 +4088,17 @@ const commandMap = {
4008
4088
  'TitleBar.diff2': diff2,
4009
4089
  'TitleBar.diff3': diff3,
4010
4090
  'TitleBar.focus': wrapCommand(focus),
4011
- 'TitleBar.focusMenuBar': wrapCommand(focus),
4012
4091
  'TitleBar.focusFirst': wrapCommand(focusFirst),
4013
4092
  'TitleBar.focusIndex': wrapCommand(focusLast),
4014
4093
  'TitleBar.focusLast': wrapCommand(focusIndex),
4094
+ 'TitleBar.focusMenuBar': wrapCommand(focus),
4015
4095
  'TitleBar.focusNext': wrapCommand(focusNext),
4016
4096
  'TitleBar.focusPrevious': wrapCommand(focusPrevious),
4017
4097
  'TitleBar.getCommandIds': getCommandIds,
4018
4098
  'TitleBar.getCommands': getCommandIds,
4019
4099
  'TitleBar.getKeyBindings': getKeyBindings$1,
4020
4100
  'TitleBar.getMenuEntries': getMenuEntries$1,
4101
+ 'TitleBar.getMenuEntries2': getMenuEntries2,
4021
4102
  'TitleBar.getMenuIds': getMenuIds,
4022
4103
  'TitleBar.getMenus': getMenus,
4023
4104
  'TitleBar.handleButtonsClick': handleClick$1,
@@ -4044,11 +4125,13 @@ const commandMap = {
4044
4125
  'TitleBar.handleMouseOver': wrapCommand(handleMouseOver),
4045
4126
  'TitleBar.handlePointerOut': wrapCommand(handlePointerOut),
4046
4127
  'TitleBar.handlePointerOver': wrapCommand(handlePointerOver),
4128
+ 'TitleBar.hideMenuBar': wrapCommand(hideMenuBar),
4047
4129
  'TitleBar.loadContent2': wrapCommand(loadContent2),
4048
4130
  'TitleBar.render3': render3,
4049
4131
  'TitleBar.renderEventListeners': renderEventListeners,
4050
4132
  'TitleBar.resize': wrapCommand(resize),
4051
4133
  'TitleBar.saveState': wrapGetter(saveState),
4134
+ 'TitleBar.showMenuBar': wrapCommand(showMenuBar),
4052
4135
  'TitleBar.terminate': terminate,
4053
4136
  'TitleBar.toggleIndex': wrapCommand(toggleIndex),
4054
4137
  'TitleBar.toggleMenu': wrapCommand(toggleMenu)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "2.24.0",
3
+ "version": "2.26.0",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",