@theia/core 1.77.0-next.0 → 1.77.0-next.12

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.
Files changed (65) hide show
  1. package/lib/browser/catalog.json +256 -14
  2. package/lib/browser/menu/browser-menu-plugin.d.ts +42 -1
  3. package/lib/browser/menu/browser-menu-plugin.d.ts.map +1 -1
  4. package/lib/browser/menu/browser-menu-plugin.js +152 -5
  5. package/lib/browser/menu/browser-menu-plugin.js.map +1 -1
  6. package/lib/browser/shell/application-shell.js +1 -1
  7. package/lib/browser/shell/application-shell.js.map +1 -1
  8. package/lib/browser/tree/tree-widget.d.ts +28 -0
  9. package/lib/browser/tree/tree-widget.d.ts.map +1 -1
  10. package/lib/browser/tree/tree-widget.js +59 -3
  11. package/lib/browser/tree/tree-widget.js.map +1 -1
  12. package/lib/browser/tree/tree-widget.spec.js +53 -3
  13. package/lib/browser/tree/tree-widget.spec.js.map +1 -1
  14. package/lib/common/core-preferences.d.ts +1 -1
  15. package/lib/common/core-preferences.d.ts.map +1 -1
  16. package/lib/common/core-preferences.js +7 -6
  17. package/lib/common/core-preferences.js.map +1 -1
  18. package/lib/electron-browser/menu/electron-main-menu-factory.d.ts +5 -0
  19. package/lib/electron-browser/menu/electron-main-menu-factory.d.ts.map +1 -1
  20. package/lib/electron-browser/menu/electron-main-menu-factory.js +39 -8
  21. package/lib/electron-browser/menu/electron-main-menu-factory.js.map +1 -1
  22. package/lib/electron-browser/menu/electron-menu-contribution.d.ts +8 -1
  23. package/lib/electron-browser/menu/electron-menu-contribution.d.ts.map +1 -1
  24. package/lib/electron-browser/menu/electron-menu-contribution.js +50 -4
  25. package/lib/electron-browser/menu/electron-menu-contribution.js.map +1 -1
  26. package/lib/electron-browser/preload.d.ts.map +1 -1
  27. package/lib/electron-browser/preload.js +1 -0
  28. package/lib/electron-browser/preload.js.map +1 -1
  29. package/lib/electron-common/electron-api.d.ts +2 -0
  30. package/lib/electron-common/electron-api.d.ts.map +1 -1
  31. package/lib/electron-common/electron-api.js +2 -1
  32. package/lib/electron-common/electron-api.js.map +1 -1
  33. package/lib/electron-main/electron-api-main.d.ts.map +1 -1
  34. package/lib/electron-main/electron-api-main.js +15 -0
  35. package/lib/electron-main/electron-api-main.js.map +1 -1
  36. package/lib/node/backend-application-module.d.ts.map +1 -1
  37. package/lib/node/backend-application-module.js +3 -0
  38. package/lib/node/backend-application-module.js.map +1 -1
  39. package/lib/node/bundled-resource-provider.d.ts +86 -0
  40. package/lib/node/bundled-resource-provider.d.ts.map +1 -0
  41. package/lib/node/bundled-resource-provider.js +241 -0
  42. package/lib/node/bundled-resource-provider.js.map +1 -0
  43. package/lib/node/bundled-resource-provider.spec.d.ts +2 -0
  44. package/lib/node/bundled-resource-provider.spec.d.ts.map +1 -0
  45. package/lib/node/bundled-resource-provider.spec.js +160 -0
  46. package/lib/node/bundled-resource-provider.spec.js.map +1 -0
  47. package/lib/node/index.d.ts +1 -0
  48. package/lib/node/index.d.ts.map +1 -1
  49. package/lib/node/index.js +3 -1
  50. package/lib/node/index.js.map +1 -1
  51. package/package.json +4 -4
  52. package/src/browser/menu/browser-menu-plugin.ts +169 -6
  53. package/src/browser/shell/application-shell.ts +1 -1
  54. package/src/browser/tree/tree-widget.spec.tsx +59 -3
  55. package/src/browser/tree/tree-widget.tsx +64 -2
  56. package/src/common/core-preferences.ts +8 -7
  57. package/src/electron-browser/menu/electron-main-menu-factory.ts +45 -7
  58. package/src/electron-browser/menu/electron-menu-contribution.ts +50 -5
  59. package/src/electron-browser/preload.ts +3 -1
  60. package/src/electron-common/electron-api.ts +2 -0
  61. package/src/electron-main/electron-api-main.ts +16 -1
  62. package/src/node/backend-application-module.ts +4 -0
  63. package/src/node/bundled-resource-provider.spec.ts +196 -0
  64. package/src/node/bundled-resource-provider.ts +266 -0
  65. package/src/node/index.ts +1 -0
@@ -1101,6 +1101,18 @@
1101
1101
  ],
1102
1102
  "url": "https://github.com/cloudcannon/configuration-types/releases/latest/download/cloudcannon-schemas.schema.json"
1103
1103
  },
1104
+ {
1105
+ "name": "CloudCannon Initial Site Settings",
1106
+ "description": "Supporting configuration file for CloudCannon containing build settings and site mode for new sites",
1107
+ "fileMatch": ["**/.cloudcannon/initial-site-settings.json"],
1108
+ "url": "https://github.com/cloudcannon/configuration-types/releases/latest/download/cloudcannon-initial-site-settings.schema.json"
1109
+ },
1110
+ {
1111
+ "name": "CloudCannon Routing",
1112
+ "description": "Supporting configuration file for CloudCannon containing an array of route rules for redirects and rewrites",
1113
+ "fileMatch": ["**/.cloudcannon/routing.json"],
1114
+ "url": "https://github.com/cloudcannon/configuration-types/releases/latest/download/cloudcannon-routing.schema.json"
1115
+ },
1104
1116
  {
1105
1117
  "name": "Lando (landofile)",
1106
1118
  "description": "The configuration file for a Lando app. Documentation: https://github.com/lando-community/lando-spec",
@@ -1417,6 +1429,36 @@
1417
1429
  "fileMatch": ["boyka-config.json"],
1418
1430
  "url": "https://www.schemastore.org/boyka-config.json"
1419
1431
  },
1432
+ {
1433
+ "name": "Breadkit board definition",
1434
+ "description": "Board geometry and electrical strip definitions for Breadkit",
1435
+ "fileMatch": ["*.bkboard.yml", "*.bkboard.yaml"],
1436
+ "url": "https://breadkit.github.io/breadkit/schema/board-v1.json"
1437
+ },
1438
+ {
1439
+ "name": "Breadkit circuit IR",
1440
+ "description": "Resolved single-board Breadkit circuit interchange format",
1441
+ "fileMatch": ["*.bkir.json"],
1442
+ "url": "https://breadkit.github.io/breadkit/schema/ir-v1.json"
1443
+ },
1444
+ {
1445
+ "name": "Breadkit circuit IR v2",
1446
+ "description": "Resolved multi-board Breadkit circuit interchange format",
1447
+ "fileMatch": ["*.bkir-v2.json"],
1448
+ "url": "https://breadkit.github.io/breadkit/schema/ir-v2.json"
1449
+ },
1450
+ {
1451
+ "name": "Breadkit lint results",
1452
+ "description": "JSON results produced by the Breadkit circuit linter",
1453
+ "fileMatch": ["*.bklint.json"],
1454
+ "url": "https://breadkit.github.io/breadkit-lint/schemas/lint-v1.json"
1455
+ },
1456
+ {
1457
+ "name": "Breadkit part definition",
1458
+ "description": "Part pin, footprint, and rendering definitions for Breadkit",
1459
+ "fileMatch": ["*.bkpart.yml", "*.bkpart.yaml"],
1460
+ "url": "https://breadkit.github.io/breadkit/schema/part-v1.json"
1461
+ },
1420
1462
  {
1421
1463
  "name": "BrickKit",
1422
1464
  "description": "BrickKit project configuration (brickkit.yaml): declares components, install sources, deploy target and resource bindings",
@@ -1447,6 +1489,12 @@
1447
1489
  "fileMatch": [],
1448
1490
  "url": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/partial-scheduled.json"
1449
1491
  },
1492
+ {
1493
+ "name": "partial-inwards.json",
1494
+ "description": "Inwards architecture linter configuration for pyproject.toml",
1495
+ "fileMatch": [],
1496
+ "url": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/partial-inwards.json"
1497
+ },
1450
1498
  {
1451
1499
  "name": "bozr.suite.json",
1452
1500
  "description": "Bozr test suite file",
@@ -1686,6 +1734,16 @@
1686
1734
  "fileMatch": ["catalog-info.yaml", "*.catalog-info.yaml"],
1687
1735
  "url": "https://www.schemastore.org/catalog-info.json"
1688
1736
  },
1737
+ {
1738
+ "name": "CausalJSON",
1739
+ "description": "Open Causal Graph Format: causal graphs (DAGs, ADMGs, MAGs, PAGs, causal loop diagrams) with citation metadata",
1740
+ "fileMatch": ["*.causal.json"],
1741
+ "url": "https://opencausal.org/causaljson/0.2/causaljson.schema.json",
1742
+ "versions": {
1743
+ "0.1": "https://opencausal.org/causaljson/0.1/causaljson.schema.json",
1744
+ "0.2": "https://opencausal.org/causaljson/0.2/causaljson.schema.json"
1745
+ }
1746
+ },
1689
1747
  {
1690
1748
  "name": "Changie",
1691
1749
  "description": "Changie configuration file",
@@ -3515,7 +3573,7 @@
3515
3573
  "name": "Expo SDK",
3516
3574
  "description": "Expo SDK app manifest",
3517
3575
  "fileMatch": [],
3518
- "url": "https://www.schemastore.org/expo-53.0.0.json",
3576
+ "url": "https://www.schemastore.org/expo-57.0.0.json",
3519
3577
  "versions": {
3520
3578
  "37.0.0": "https://www.schemastore.org/expo-37.0.0.json",
3521
3579
  "38.0.0": "https://www.schemastore.org/expo-38.0.0.json",
@@ -3526,7 +3584,11 @@
3526
3584
  "46.0.0": "https://www.schemastore.org/expo-46.0.0.json",
3527
3585
  "50.0.0": "https://www.schemastore.org/expo-50.0.0.json",
3528
3586
  "52.0.0": "https://www.schemastore.org/expo-52.0.0.json",
3529
- "53.0.0": "https://www.schemastore.org/expo-53.0.0.json"
3587
+ "53.0.0": "https://www.schemastore.org/expo-53.0.0.json",
3588
+ "54.0.0": "https://www.schemastore.org/expo-54.0.0.json",
3589
+ "55.0.0": "https://www.schemastore.org/expo-55.0.0.json",
3590
+ "56.0.0": "https://www.schemastore.org/expo-56.0.0.json",
3591
+ "57.0.0": "https://www.schemastore.org/expo-57.0.0.json"
3530
3592
  }
3531
3593
  },
3532
3594
  {
@@ -4633,6 +4695,12 @@
4633
4695
  "fileMatch": ["jest.config.json"],
4634
4696
  "url": "https://www.schemastore.org/jest.json"
4635
4697
  },
4698
+ {
4699
+ "name": "JevGate",
4700
+ "description": "JevGate code-review gate configuration",
4701
+ "fileMatch": ["jevgate.toml"],
4702
+ "url": "https://raw.githubusercontent.com/Tech-Byte-Frontier/jevgate/main/jevgate.schema.json"
4703
+ },
4636
4704
  {
4637
4705
  "name": "JDownloader2 crawler single-rules",
4638
4706
  "description": "A validating a single jdownloader2 rule",
@@ -5537,6 +5605,12 @@
5537
5605
  "fileMatch": ["mycode.json"],
5538
5606
  "url": "https://www.schemastore.org/mycode.json"
5539
5607
  },
5608
+ {
5609
+ "name": "Nais manifests",
5610
+ "description": "Nais manifest files",
5611
+ "fileMatch": ["nais.yaml", "**/.nais/*.yaml"],
5612
+ "url": "https://schemas.nais.io/editor.json"
5613
+ },
5540
5614
  {
5541
5615
  "name": "napari plugin manifest",
5542
5616
  "description": "a napari plugin manifest",
@@ -6849,16 +6923,22 @@
6849
6923
  "url": "https://github.com/Vivswan/github-settings-as-code/releases/latest/download/settings.schema.json"
6850
6924
  },
6851
6925
  {
6852
- "name": "reposets Configuration",
6926
+ "name": "reposets.config.toml",
6853
6927
  "description": "Configuration for the reposets CLI tool for syncing GitHub repository settings",
6854
6928
  "fileMatch": ["reposets.config.toml", "reposets.config.json"],
6855
- "url": "https://raw.githubusercontent.com/spencerbeggs/reposets/main/package/schemas/reposets.config.schema.json"
6929
+ "url": "https://raw.githubusercontent.com/spencerbeggs/reposets/main/schemas/3.0/config.json",
6930
+ "versions": {
6931
+ "3.0": "https://raw.githubusercontent.com/spencerbeggs/reposets/main/schemas/3.0/config.json"
6932
+ }
6856
6933
  },
6857
6934
  {
6858
- "name": "reposets Credentials",
6935
+ "name": "reposets.credentials.toml",
6859
6936
  "description": "Authentication profiles for the reposets CLI tool",
6860
6937
  "fileMatch": ["reposets.credentials.toml", "reposets.credentials.json"],
6861
- "url": "https://raw.githubusercontent.com/spencerbeggs/reposets/main/package/schemas/reposets.credentials.schema.json"
6938
+ "url": "https://raw.githubusercontent.com/spencerbeggs/reposets/main/schemas/3.0/credentials.json",
6939
+ "versions": {
6940
+ "3.0": "https://raw.githubusercontent.com/spencerbeggs/reposets/main/schemas/3.0/credentials.json"
6941
+ }
6862
6942
  },
6863
6943
  {
6864
6944
  "name": "*.resjson",
@@ -7256,6 +7336,12 @@
7256
7336
  "fileMatch": ["sergen.json", "sergen.*.json", "*.sergen.json"],
7257
7337
  "url": "https://www.schemastore.org/sergen.json"
7258
7338
  },
7339
+ {
7340
+ "name": "serve.json",
7341
+ "description": "Configuration file for Vercel's serve static file server",
7342
+ "fileMatch": ["vercel.serve.json"],
7343
+ "url": "https://www.schemastore.org/serve.json"
7344
+ },
7259
7345
  {
7260
7346
  "name": "settings.job",
7261
7347
  "description": "Azure Webjob settings file",
@@ -9197,11 +9283,12 @@
9197
9283
  "name": "Apollo Router",
9198
9284
  "description": "Apollo Router: The runtime for graph-based API orchestration",
9199
9285
  "fileMatch": ["apollo-router-*.json"],
9200
- "url": "https://www.schemastore.org/apollo-router-2.9.0.json",
9286
+ "url": "https://www.schemastore.org/apollo-router-2.17.0.json",
9201
9287
  "versions": {
9202
9288
  "2.8.1": "https://www.schemastore.org/apollo-router-2.8.1.json",
9203
9289
  "2.8.2": "https://www.schemastore.org/apollo-router-2.8.2.json",
9204
- "2.9.0": "https://www.schemastore.org/apollo-router-2.9.0.json"
9290
+ "2.9.0": "https://www.schemastore.org/apollo-router-2.9.0.json",
9291
+ "2.17.0": "https://www.schemastore.org/apollo-router-2.17.0.json"
9205
9292
  }
9206
9293
  },
9207
9294
  {
@@ -10628,9 +10715,104 @@
10628
10715
  },
10629
10716
  {
10630
10717
  "name": "moon.yml",
10631
- "description": "Moonrepo project configuration file",
10632
- "fileMatch": ["moon.yml"],
10633
- "url": "https://raw.githubusercontent.com/moonrepo/moon/master/website/static/schemas/project.json"
10718
+ "description": "moon (moonrepo) project configuration file",
10719
+ "fileMatch": [
10720
+ "moon.yml",
10721
+ "moon.yaml",
10722
+ "moon.json",
10723
+ "moon.jsonc",
10724
+ "moon.toml"
10725
+ ],
10726
+ "url": "https://moonrepo.dev/schemas/v2/project.json",
10727
+ "versions": {
10728
+ "1": "https://moonrepo.dev/schemas/v1/project.json",
10729
+ "2": "https://moonrepo.dev/schemas/v2/project.json"
10730
+ }
10731
+ },
10732
+ {
10733
+ "name": "moon workspace",
10734
+ "description": "moon (moonrepo) workspace configuration file",
10735
+ "fileMatch": [
10736
+ "**/.moon/workspace.yml",
10737
+ "**/.moon/workspace.yaml",
10738
+ "**/.moon/workspace.json",
10739
+ "**/.moon/workspace.jsonc",
10740
+ "**/.moon/workspace.toml",
10741
+ "**/.config/moon/workspace.yml",
10742
+ "**/.config/moon/workspace.yaml",
10743
+ "**/.config/moon/workspace.json",
10744
+ "**/.config/moon/workspace.jsonc",
10745
+ "**/.config/moon/workspace.toml"
10746
+ ],
10747
+ "url": "https://moonrepo.dev/schemas/v2/workspace.json",
10748
+ "versions": {
10749
+ "1": "https://moonrepo.dev/schemas/v1/workspace.json",
10750
+ "2": "https://moonrepo.dev/schemas/v2/workspace.json"
10751
+ }
10752
+ },
10753
+ {
10754
+ "name": "moon toolchains",
10755
+ "description": "moon (moonrepo) toolchains configuration file",
10756
+ "fileMatch": [
10757
+ "**/.moon/toolchains.yml",
10758
+ "**/.moon/toolchains.yaml",
10759
+ "**/.moon/toolchains.json",
10760
+ "**/.moon/toolchains.jsonc",
10761
+ "**/.moon/toolchains.toml",
10762
+ "**/.config/moon/toolchains.yml",
10763
+ "**/.config/moon/toolchains.yaml",
10764
+ "**/.config/moon/toolchains.json",
10765
+ "**/.config/moon/toolchains.jsonc",
10766
+ "**/.config/moon/toolchains.toml"
10767
+ ],
10768
+ "url": "https://moonrepo.dev/schemas/v2/toolchains.json"
10769
+ },
10770
+ {
10771
+ "name": "moon extensions",
10772
+ "description": "moon (moonrepo) extensions configuration file",
10773
+ "fileMatch": [
10774
+ "**/.moon/extensions.yml",
10775
+ "**/.moon/extensions.yaml",
10776
+ "**/.moon/extensions.json",
10777
+ "**/.moon/extensions.jsonc",
10778
+ "**/.moon/extensions.toml",
10779
+ "**/.config/moon/extensions.yml",
10780
+ "**/.config/moon/extensions.yaml",
10781
+ "**/.config/moon/extensions.json",
10782
+ "**/.config/moon/extensions.jsonc",
10783
+ "**/.config/moon/extensions.toml"
10784
+ ],
10785
+ "url": "https://moonrepo.dev/schemas/v2/extensions.json"
10786
+ },
10787
+ {
10788
+ "name": "moon tasks",
10789
+ "description": "moon (moonrepo) inherited tasks configuration file",
10790
+ "fileMatch": [
10791
+ "**/.moon/tasks/**/*.yml",
10792
+ "**/.moon/tasks/**/*.yaml",
10793
+ "**/.moon/tasks/**/*.json",
10794
+ "**/.moon/tasks/**/*.jsonc",
10795
+ "**/.moon/tasks/**/*.toml",
10796
+ "**/.config/moon/tasks/**/*.yml",
10797
+ "**/.config/moon/tasks/**/*.yaml",
10798
+ "**/.config/moon/tasks/**/*.json",
10799
+ "**/.config/moon/tasks/**/*.jsonc",
10800
+ "**/.config/moon/tasks/**/*.toml"
10801
+ ],
10802
+ "url": "https://moonrepo.dev/schemas/v2/tasks.json",
10803
+ "versions": {
10804
+ "1": "https://moonrepo.dev/schemas/v1/tasks.json",
10805
+ "2": "https://moonrepo.dev/schemas/v2/tasks.json"
10806
+ }
10807
+ },
10808
+ {
10809
+ "name": "moon template",
10810
+ "description": "moon (moonrepo) code generation template configuration file (template.yml)",
10811
+ "url": "https://moonrepo.dev/schemas/v2/template.json",
10812
+ "versions": {
10813
+ "1": "https://moonrepo.dev/schemas/v1/template.json",
10814
+ "2": "https://moonrepo.dev/schemas/v2/template.json"
10815
+ }
10634
10816
  },
10635
10817
  {
10636
10818
  "name": "WireMock stub mapping",
@@ -11721,14 +11903,74 @@
11721
11903
  "url": "https://defakto-security.github.io/build-actions/ci.schema.json"
11722
11904
  },
11723
11905
  {
11724
- "name": "AAES evidence export (aaes.export/v1)",
11725
- "description": "One JSON value in an aaes.export/v1 JSON Lines evidence export: a header, entry, or anchor line recording authorization decisions for AI agent actions; cryptographic verification is separate from structural validation",
11726
- "url": "https://aaes.ai/spec/v1/export.schema.json"
11906
+ "name": "AAES evidence export (aaes.export/v2)",
11907
+ "description": "One JSON value in an aaes.export/v2 JSON Lines evidence export: a header, entry, or anchor line recording authorization decisions for AI agent actions; cryptographic verification is separate from structural validation",
11908
+ "url": "https://aaes.ai/spec/v2/export.schema.json"
11727
11909
  },
11728
11910
  {
11729
11911
  "name": "AAES evidence pack manifest (aaes.evidence-pack/1)",
11730
11912
  "description": "Manifest for an AAES evidence pack directory: stated population, explicit coverage exclusions, and file inventory for examiner review of AI agent action evidence",
11731
11913
  "url": "https://aaes.ai/spec/v1/evidence-pack-manifest.schema.json"
11914
+ },
11915
+ {
11916
+ "name": "Allstar Action",
11917
+ "description": "Allstar action policy configuration",
11918
+ "fileMatch": [],
11919
+ "url": "https://www.schemastore.org/allstar-action.json"
11920
+ },
11921
+ {
11922
+ "name": "Allstar Administrators",
11923
+ "description": "Allstar repository administrator policy configuration",
11924
+ "fileMatch": [],
11925
+ "url": "https://www.schemastore.org/allstar-admin.json"
11926
+ },
11927
+ {
11928
+ "name": "Allstar Binary Artifacts",
11929
+ "description": "Allstar binary artifacts policy configuration",
11930
+ "fileMatch": ["binary_artifacts.yaml"],
11931
+ "url": "https://www.schemastore.org/allstar-binary.json"
11932
+ },
11933
+ {
11934
+ "name": "Allstar Branch Protection",
11935
+ "description": "Allstar branch protection policy configuration",
11936
+ "fileMatch": ["branch_protection.yaml"],
11937
+ "url": "https://www.schemastore.org/allstar-branch.json"
11938
+ },
11939
+ {
11940
+ "name": "Allstar CODEOWNERS",
11941
+ "description": "Allstar CODEOWNERS policy configuration",
11942
+ "fileMatch": [],
11943
+ "url": "https://www.schemastore.org/allstar-codeowners.json"
11944
+ },
11945
+ {
11946
+ "name": "Allstar Configuration",
11947
+ "description": "Allstar organization-level configuration file",
11948
+ "fileMatch": ["allstar.yaml"],
11949
+ "url": "https://www.schemastore.org/allstar-config.json"
11950
+ },
11951
+ {
11952
+ "name": "Allstar Dangerous Workflow",
11953
+ "description": "Allstar dangerous workflow policy configuration",
11954
+ "fileMatch": ["dangerous_workflow.yaml"],
11955
+ "url": "https://www.schemastore.org/allstar-workflow.json"
11956
+ },
11957
+ {
11958
+ "name": "Allstar Outside Collaborators",
11959
+ "description": "Allstar outside collaborators policy configuration",
11960
+ "fileMatch": [],
11961
+ "url": "https://www.schemastore.org/allstar-outside.json"
11962
+ },
11963
+ {
11964
+ "name": "Allstar Scorecard",
11965
+ "description": "Allstar Scorecard policy configuration",
11966
+ "fileMatch": [],
11967
+ "url": "https://www.schemastore.org/allstar-scorecard.json"
11968
+ },
11969
+ {
11970
+ "name": "Allstar Security",
11971
+ "description": "Allstar security policy configuration",
11972
+ "fileMatch": [],
11973
+ "url": "https://www.schemastore.org/allstar-security.json"
11732
11974
  }
11733
11975
  ]
11734
11976
  }
@@ -1,6 +1,6 @@
1
1
  import { MenuBar, Menu as MenuWidget, Widget } from '@lumino/widgets';
2
2
  import { CommandRegistry as LuminoCommandRegistry } from '@lumino/commands';
3
- import { PreferenceService } from '../../common';
3
+ import { DisposableCollection, PreferenceService } from '../../common';
4
4
  import { KeybindingRegistry } from '../keybinding';
5
5
  import { FrontendApplication } from '../frontend-application';
6
6
  import { FrontendApplicationContribution } from '../frontend-application-contribution';
@@ -85,10 +85,51 @@ export declare class BrowserMenuBarContribution implements FrontendApplicationCo
85
85
  protected readonly factory: BrowserMainMenuFactory;
86
86
  protected readonly shell: ApplicationShell;
87
87
  protected readonly preferenceService: PreferenceService;
88
+ protected toggleModeListeners: DisposableCollection;
89
+ protected menuWidget?: MenuBarWidget;
90
+ protected logoWidget?: Widget;
88
91
  constructor(factory: BrowserMainMenuFactory);
89
92
  onStart(app: FrontendApplication): void;
90
93
  get menuBar(): MenuBarWidget | undefined;
91
94
  protected appendMenu(shell: ApplicationShell): void;
95
+ /**
96
+ * Manages Lumino menu bar visibility and Alt-key toggling in Electron.
97
+ *
98
+ * With native title bar, the native Electron menu bar handles toggle via
99
+ * `autoHideMenuBar`, so the Lumino menu bar is simply hidden.
100
+ *
101
+ * With custom title bar, the Lumino menu bar is the only menu bar visible
102
+ * to the user. For 'toggle' mode, an Alt-key listener is installed to
103
+ * show/hide the menu bar widget.
104
+ */
105
+ protected updateElectronMenuToggleMode(menu: MenuBarWidget, logo: Widget): void;
106
+ /**
107
+ * Establishes the resting visibility of the menu bar widgets in Electron, i.e. the state
108
+ * a clean Alt press toggles away from in 'toggle' mode.
109
+ */
110
+ protected applyElectronMenuBarVisibility(menu: MenuBarWidget, logo: Widget, pref: string): void;
111
+ /**
112
+ * The widgets a clean Alt press shows and hides in 'toggle' mode in Electron.
113
+ */
114
+ protected getElectronToggleTargets(menu: MenuBarWidget, logo: Widget): Widget[];
115
+ /**
116
+ * Manages Alt-key toggle behavior for 'toggle' mode in the browser.
117
+ * The top panel's initial visibility is handled by {@link ApplicationShell.setTopPanelVisibility};
118
+ * this method only installs or removes the Alt-key listener.
119
+ */
120
+ protected updateBrowserMenuToggleMode(menu: MenuBarWidget): void;
121
+ /**
122
+ * Installs Alt-key listeners to toggle menu bar visibility.
123
+ * A clean Alt press (press and release without other keys) shows the
124
+ * given toggle targets and focuses the first menu. Pressing Alt again
125
+ * or clicking outside hides them.
126
+ *
127
+ * @param menu the menu bar widget to focus when shown
128
+ * @param toggleTargets supplies the widgets to show/hide on Alt toggle. It is consulted on
129
+ * each gesture, because the targets can depend on state that changes while the listener is
130
+ * installed, e.g. whether the window is in full screen.
131
+ */
132
+ protected installAltKeyToggle(menu: MenuBarWidget, toggleTargets: () => Widget[]): DisposableCollection;
92
133
  protected createLogo(): Widget;
93
134
  }
94
135
  //# sourceMappingURL=browser-menu-plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser-menu-plugin.d.ts","sourceRoot":"","sources":["../../../src/browser/menu/browser-menu-plugin.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAQ,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAIH,iBAAiB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAmB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,e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I/E;;;;OAIG;IACH,SAAS,CAAC,2BAA2B,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAQhE;;;;;;;;;;OAUG;IACH,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,MAAM,EAAE,GAAG,oBAAoB;IAsFvG,SAAS,CAAC,UAAU,IAAI,MAAM;CAMjC"}
@@ -60,7 +60,7 @@ let BrowserMainMenuFactory = class BrowserMainMenuFactory {
60
60
  return this.corePreferences.get('window.menuBarVisibility', 'classic');
61
61
  }
62
62
  showMenuBar(menuBar, preference = this.getMenuBarVisibility()) {
63
- if (preference && ['classic', 'visible'].includes(preference)) {
63
+ if (preference && ['classic', 'visible', 'toggle'].includes(preference)) {
64
64
  menuBar.clearMenus();
65
65
  this.fillMenuBar(menuBar);
66
66
  }
@@ -372,6 +372,7 @@ exports.DynamicMenuWidget = DynamicMenuWidget;
372
372
  let BrowserMenuBarContribution = class BrowserMenuBarContribution {
373
373
  constructor(factory) {
374
374
  this.factory = factory;
375
+ this.toggleModeListeners = new common_1.DisposableCollection();
375
376
  }
376
377
  onStart(app) {
377
378
  this.appendMenu(app.shell);
@@ -384,18 +385,164 @@ let BrowserMenuBarContribution = class BrowserMenuBarContribution {
384
385
  shell.addWidget(logo, { area: 'top' });
385
386
  const menu = this.factory.createMenuBar();
386
387
  shell.addWidget(menu, { area: 'top' });
387
- // Hiding the menu is only necessary in electron
388
- // In the browser we hide the whole top panel
388
+ this.menuWidget = menu;
389
+ this.logoWidget = logo;
389
390
  if (common_1.environment.electron.is()) {
390
391
  this.preferenceService.ready.then(() => {
391
- menu.setHidden(['compact', 'hidden'].includes(this.preferenceService.get('window.menuBarVisibility', '')));
392
+ this.updateElectronMenuToggleMode(menu, logo);
392
393
  });
393
394
  this.preferenceService.onPreferenceChanged(change => {
394
395
  if (change.preferenceName === 'window.menuBarVisibility') {
395
- menu.setHidden(['compact', 'hidden'].includes(this.preferenceService.get('window.menuBarVisibility', 'classic')));
396
+ this.updateElectronMenuToggleMode(menu, logo);
396
397
  }
397
398
  });
398
399
  }
400
+ else {
401
+ // In the browser, the whole top panel is hidden for compact/hidden/toggle
402
+ // (handled by ApplicationShell). For toggle mode, this installs an Alt-key
403
+ // listener that temporarily shows the top panel.
404
+ this.preferenceService.ready.then(() => {
405
+ this.updateBrowserMenuToggleMode(menu);
406
+ });
407
+ this.preferenceService.onPreferenceChanged(change => {
408
+ if (change.preferenceName === 'window.menuBarVisibility') {
409
+ this.updateBrowserMenuToggleMode(menu);
410
+ }
411
+ });
412
+ }
413
+ }
414
+ /**
415
+ * Manages Lumino menu bar visibility and Alt-key toggling in Electron.
416
+ *
417
+ * With native title bar, the native Electron menu bar handles toggle via
418
+ * `autoHideMenuBar`, so the Lumino menu bar is simply hidden.
419
+ *
420
+ * With custom title bar, the Lumino menu bar is the only menu bar visible
421
+ * to the user. For 'toggle' mode, an Alt-key listener is installed to
422
+ * show/hide the menu bar widget.
423
+ */
424
+ updateElectronMenuToggleMode(menu, logo) {
425
+ this.toggleModeListeners.dispose();
426
+ const pref = this.preferenceService.get('window.menuBarVisibility', 'classic');
427
+ this.applyElectronMenuBarVisibility(menu, logo, pref);
428
+ if (pref === 'toggle') {
429
+ this.toggleModeListeners = this.installAltKeyToggle(menu, () => this.getElectronToggleTargets(menu, logo));
430
+ }
431
+ }
432
+ /**
433
+ * Establishes the resting visibility of the menu bar widgets in Electron, i.e. the state
434
+ * a clean Alt press toggles away from in 'toggle' mode.
435
+ */
436
+ applyElectronMenuBarVisibility(menu, logo, pref) {
437
+ const shouldHide = ['compact', 'hidden', 'toggle'].includes(pref);
438
+ menu.setHidden(shouldHide);
439
+ logo.setHidden(shouldHide);
440
+ }
441
+ /**
442
+ * The widgets a clean Alt press shows and hides in 'toggle' mode in Electron.
443
+ */
444
+ getElectronToggleTargets(menu, logo) {
445
+ return [menu, logo];
446
+ }
447
+ /**
448
+ * Manages Alt-key toggle behavior for 'toggle' mode in the browser.
449
+ * The top panel's initial visibility is handled by {@link ApplicationShell.setTopPanelVisibility};
450
+ * this method only installs or removes the Alt-key listener.
451
+ */
452
+ updateBrowserMenuToggleMode(menu) {
453
+ this.toggleModeListeners.dispose();
454
+ const pref = this.preferenceService.get('window.menuBarVisibility', 'classic');
455
+ if (pref === 'toggle') {
456
+ this.toggleModeListeners = this.installAltKeyToggle(menu, () => [this.shell.topPanel]);
457
+ }
458
+ }
459
+ /**
460
+ * Installs Alt-key listeners to toggle menu bar visibility.
461
+ * A clean Alt press (press and release without other keys) shows the
462
+ * given toggle targets and focuses the first menu. Pressing Alt again
463
+ * or clicking outside hides them.
464
+ *
465
+ * @param menu the menu bar widget to focus when shown
466
+ * @param toggleTargets supplies the widgets to show/hide on Alt toggle. It is consulted on
467
+ * each gesture, because the targets can depend on state that changes while the listener is
468
+ * installed, e.g. whether the window is in full screen.
469
+ */
470
+ installAltKeyToggle(menu, toggleTargets) {
471
+ const disposables = new common_1.DisposableCollection();
472
+ let altKeyPressed = false;
473
+ let lastKeyWasAlt = false;
474
+ const isHidden = () => toggleTargets().some(w => w.isHidden);
475
+ const hide = () => {
476
+ for (const w of toggleTargets()) {
477
+ w.setHidden(true);
478
+ }
479
+ };
480
+ const show = () => {
481
+ for (const w of toggleTargets()) {
482
+ w.setHidden(false);
483
+ }
484
+ };
485
+ const onKeyDown = (e) => {
486
+ if (e.key === 'Alt') {
487
+ if (!e.repeat) {
488
+ altKeyPressed = true;
489
+ lastKeyWasAlt = true;
490
+ }
491
+ }
492
+ else {
493
+ // Any other key invalidates the Alt-only gesture
494
+ lastKeyWasAlt = false;
495
+ }
496
+ };
497
+ // Mouse interaction while Alt is held is a modifier gesture of its own, e.g. Alt+click to add a
498
+ // cursor or Alt+scroll to scroll faster, so it invalidates the Alt-only gesture as any other key does.
499
+ const onPointerInteraction = () => {
500
+ lastKeyWasAlt = false;
501
+ };
502
+ const onKeyUp = (e) => {
503
+ if (e.key !== 'Alt') {
504
+ return;
505
+ }
506
+ const wasCleanAltPress = altKeyPressed && lastKeyWasAlt;
507
+ altKeyPressed = false;
508
+ lastKeyWasAlt = false;
509
+ if (!wasCleanAltPress) {
510
+ return;
511
+ }
512
+ // Keep the browser from acting on the solitary Alt press itself: Firefox, for
513
+ // instance, focuses its own menu bar, which would then toggle along with ours.
514
+ e.preventDefault();
515
+ if (isHidden()) {
516
+ show();
517
+ menu.activeIndex = 0;
518
+ menu.node.focus();
519
+ }
520
+ else {
521
+ hide();
522
+ }
523
+ };
524
+ // When a menu closes and focus leaves the menu bar, hide it again
525
+ const onFocusOut = () => {
526
+ // Use setTimeout to allow focus to settle (e.g. focus moving between menu items)
527
+ setTimeout(() => {
528
+ if (!isHidden() && !menu.node.contains(document.activeElement)) {
529
+ hide();
530
+ }
531
+ }, 100);
532
+ };
533
+ document.addEventListener('keydown', onKeyDown, true);
534
+ document.addEventListener('keyup', onKeyUp, true);
535
+ document.addEventListener('mousedown', onPointerInteraction, true);
536
+ document.addEventListener('wheel', onPointerInteraction, { capture: true, passive: true });
537
+ menu.node.addEventListener('focusout', onFocusOut);
538
+ disposables.push(common_1.Disposable.create(() => {
539
+ document.removeEventListener('keydown', onKeyDown, true);
540
+ document.removeEventListener('keyup', onKeyUp, true);
541
+ document.removeEventListener('mousedown', onPointerInteraction, true);
542
+ document.removeEventListener('wheel', onPointerInteraction, true);
543
+ menu.node.removeEventListener('focusout', onFocusOut);
544
+ }));
545
+ return disposables;
399
546
  }
400
547
  createLogo() {
401
548
  const logo = new widgets_1.Widget();