mbeditor 0.14.2 → 0.14.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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -0
  3. data/app/assets/javascripts/mbeditor/application.js +5 -1
  4. data/app/assets/javascripts/mbeditor/collaboration_identity.js +4 -2
  5. data/app/assets/javascripts/mbeditor/collaboration_service.js +74 -2
  6. data/app/assets/javascripts/mbeditor/components/AiRoundTripModal.js +452 -0
  7. data/app/assets/javascripts/mbeditor/components/ChangelogView.js +1 -1
  8. data/app/assets/javascripts/mbeditor/components/CombinedFileView.js +3 -2
  9. data/app/assets/javascripts/mbeditor/components/EditorPanel.js +28 -27
  10. data/app/assets/javascripts/mbeditor/components/FileHistoryPanel.js +2 -7
  11. data/app/assets/javascripts/mbeditor/components/FileTree.js +144 -4
  12. data/app/assets/javascripts/mbeditor/components/GitPanel.js +1 -1
  13. data/app/assets/javascripts/mbeditor/components/ImportConflictModal.js +7 -68
  14. data/app/assets/javascripts/mbeditor/components/ImportDialog.js +2 -16
  15. data/app/assets/javascripts/mbeditor/components/MbeditorApp.js +340 -472
  16. data/app/assets/javascripts/mbeditor/components/ModalDialog.js +203 -0
  17. data/app/assets/javascripts/mbeditor/components/PastePlaceModal.js +1 -9
  18. data/app/assets/javascripts/mbeditor/components/Popover.js +88 -0
  19. data/app/assets/javascripts/mbeditor/components/PopupMenu.js +166 -0
  20. data/app/assets/javascripts/mbeditor/components/ProblemsPanel.js +8 -4
  21. data/app/assets/javascripts/mbeditor/components/QuickOpenDialog.js +5 -7
  22. data/app/assets/javascripts/mbeditor/components/SettingsModal.js +3 -14
  23. data/app/assets/javascripts/mbeditor/components/ShortcutHelp.js +4 -25
  24. data/app/assets/javascripts/mbeditor/components/TabBar.js +15 -32
  25. data/app/assets/javascripts/mbeditor/components/TestResultsPanel.js +2 -7
  26. data/app/assets/javascripts/mbeditor/editor_plugins.js +3 -23
  27. data/app/assets/javascripts/mbeditor/file_service.js +1 -1
  28. data/app/assets/javascripts/mbeditor/git_service.js +0 -7
  29. data/app/assets/javascripts/mbeditor/patch_select.js +156 -0
  30. data/app/assets/javascripts/mbeditor/tab_manager.js +19 -0
  31. data/app/assets/stylesheets/mbeditor/application.css +7 -110
  32. data/app/assets/stylesheets/mbeditor/editor.css +195 -192
  33. data/app/assets/stylesheets/mbeditor/glass.css +1 -1
  34. data/app/channels/mbeditor/collaboration_channel.rb +24 -5
  35. data/app/controllers/mbeditor/editors_controller.rb +75 -38
  36. data/app/controllers/mbeditor/git_controller.rb +1 -12
  37. data/app/services/mbeditor/ai_bundle_service.rb +181 -0
  38. data/app/services/mbeditor/archive_service.rb +43 -6
  39. data/app/services/mbeditor/availability_probe.rb +2 -2
  40. data/app/services/mbeditor/code_search_service.rb +1 -3
  41. data/app/services/mbeditor/collaboration_doc_store.rb +37 -1
  42. data/app/services/mbeditor/exclusion_matcher.rb +0 -4
  43. data/app/services/mbeditor/file_import_service.rb +4 -1
  44. data/app/services/mbeditor/file_operation_service.rb +3 -3
  45. data/app/services/mbeditor/git_service.rb +11 -45
  46. data/app/services/mbeditor/js_definition_service.rb +1 -0
  47. data/app/services/mbeditor/model_graph_service.rb +1 -0
  48. data/app/services/mbeditor/patch_apply_service.rb +185 -0
  49. data/app/services/mbeditor/rails_related_files_service.rb +1 -1
  50. data/app/services/mbeditor/redmine_config_error.rb +6 -0
  51. data/app/services/mbeditor/redmine_disabled_error.rb +10 -0
  52. data/app/services/mbeditor/redmine_service.rb +0 -8
  53. data/app/services/mbeditor/ruby_definition_service.rb +1 -0
  54. data/app/services/mbeditor/schema_service.rb +1 -0
  55. data/app/services/mbeditor/test_runner_service.rb +1 -1
  56. data/lib/mbeditor/rack/silence_ping_request.rb +14 -14
  57. data/lib/mbeditor/route_map.rb +5 -2
  58. data/lib/mbeditor/ruby_lsp_client.rb +7 -26
  59. data/lib/mbeditor/version.rb +1 -1
  60. data/public/monaco-editor/VERSIONS +2 -1
  61. data/public/monaco-editor/monaco.js +226 -226
  62. metadata +11 -4
  63. data/app/assets/javascripts/mbeditor/components/CommitGraph.js +0 -65
  64. data/app/services/mbeditor/git_commit_graph_service.rb +0 -62
@@ -297,7 +297,6 @@ html, body, #mbeditor-root {
297
297
  flex-shrink: 0;
298
298
  }
299
299
 
300
-
301
300
  /* ── The gutter ──────────────────────────────────────────────
302
301
  One draggable strip, always in the gap between two cards, never inside
303
302
  either of them. 6px in its thin dimension and transparent: wider reads as a
@@ -368,7 +367,6 @@ html, body, #mbeditor-root {
368
367
  gap: 6px;
369
368
  }
370
369
 
371
-
372
370
  .ide-sidebar-content {
373
371
  flex: 1;
374
372
  overflow: hidden;
@@ -386,9 +384,12 @@ html, body, #mbeditor-root {
386
384
  overflow-x: hidden;
387
385
  }
388
386
 
389
- .ide-sidebar-scrollable::-webkit-scrollbar { width: 6px; }
390
- .ide-sidebar-scrollable::-webkit-scrollbar-track { background: transparent; }
391
- .ide-sidebar-scrollable::-webkit-scrollbar-thumb { background: var(--ide-scrollbar); border-radius: 3px; }
387
+ .ide-sidebar-scrollable { scrollbar-color: var(--ide-scrollbar) transparent; }
388
+ @supports not (scrollbar-color: auto) {
389
+ .ide-sidebar-scrollable::-webkit-scrollbar { width: 6px; }
390
+ .ide-sidebar-scrollable::-webkit-scrollbar-track { background: transparent; }
391
+ .ide-sidebar-scrollable::-webkit-scrollbar-thumb { background: var(--ide-scrollbar); border-radius: 3px; }
392
+ }
392
393
 
393
394
  /* ── File Tree ────────────────────────────────────────────── */
394
395
  .file-tree-root { padding: 4px 0; }
@@ -412,6 +413,10 @@ html, body, #mbeditor-root {
412
413
  .tree-item.active { background: var(--ide-active-bg); }
413
414
  .tree-item.selected { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ide-accent) 35%, transparent); background: color-mix(in srgb, var(--ide-accent) 8%, transparent); }
414
415
  .tree-item.active.selected { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ide-accent) 55%, transparent); }
416
+ /* The keyboard's current row (aria-activedescendant), shown only while arrow
417
+ keys are driving the focused tree: FileTree adds .kbd-nav on a handled key
418
+ and drops it on mousedown. */
419
+ .file-tree.kbd-nav:focus .tree-item.is-cursor { outline: 1px solid var(--ide-accent-fg); outline-offset: -1px; }
415
420
  .tree-item.drag-over { background: rgba(100, 160, 220, 0.25); box-shadow: inset 0 0 0 1px rgba(100, 160, 220, 0.7); }
416
421
  /* External file drop (import) — green, to read as "add" rather than "move" */
417
422
  .tree-item.drag-over-external { background: rgba(120, 200, 140, 0.22); box-shadow: inset 0 0 0 1px rgba(120, 200, 140, 0.75); }
@@ -523,8 +528,18 @@ html, body, #mbeditor-root {
523
528
  flex-shrink: 0;
524
529
  }
525
530
 
531
+ /* The one deliberate ::-webkit-scrollbar holdout. The standard properties
532
+ cannot express a 3px bar — `thin` takes ~8px of layout out of a 35px row —
533
+ so Chrome/Safari keep the WebKit pseudo-elements here. They only honour
534
+ those while the element's scrollbar-color and scrollbar-width are both
535
+ `auto`, hence the reset of the inherited/universal values. Engines without
536
+ ::-webkit-scrollbar (Firefox) get the standard properties instead. */
537
+ .tab-bar { scrollbar-color: auto; scrollbar-width: auto; }
526
538
  .tab-bar::-webkit-scrollbar { height: 3px; }
527
539
  .tab-bar::-webkit-scrollbar-thumb { background: var(--ide-hover-bg); }
540
+ @supports not selector(::-webkit-scrollbar) {
541
+ .tab-bar { scrollbar-color: var(--ide-hover-bg) transparent; scrollbar-width: thin; }
542
+ }
528
543
 
529
544
  .tab-new-file-btn {
530
545
  display: flex;
@@ -708,7 +723,6 @@ html, body, #mbeditor-root {
708
723
  border-bottom: 1px solid var(--ide-panel-bg-alt);
709
724
  user-select: none;
710
725
  }
711
- .search-results-empty { padding: 12px 8px; font-size: 12px; color: var(--ide-text-muted); }
712
726
  .search-loading-more {
713
727
  padding: 10px;
714
728
  font-size: 11px;
@@ -717,17 +731,71 @@ html, body, #mbeditor-root {
717
731
  user-select: none;
718
732
  }
719
733
 
720
- /* ── Shortcut Help Drawer ────────────────────────────────── */
721
- .shelp-backdrop {
734
+ /* ── Modal dialog shell (components/ModalDialog.js) ──────── */
735
+ /* The native <dialog> is an unstyled shell exactly the size of the panel it
736
+ wraps: the panel classes below (.schema-modal, .shelp-panel, …) keep all the
737
+ visual styling, and a pointer outside the dialog box is a backdrop click.
738
+ Top layer replaces the z-index ladder the overlay divs used to need.
739
+ Vendored pico.classless.css styles every <dialog> as its own full-viewport
740
+ flex overlay (inset 0, min-width/height 100%, tinted background, blur).
741
+ Left in place, the dialog box covers the whole screen, so no click ever
742
+ lands "outside" it and the backdrop never dismisses — hence the explicit
743
+ reset of position, size, display and backdrop-filter back to UA centring. */
744
+ dialog.mb-dialog {
745
+ display: block;
722
746
  position: fixed;
723
747
  inset: 0;
748
+ margin: auto;
749
+ width: fit-content;
750
+ height: fit-content;
751
+ min-width: 0;
752
+ min-height: 0;
753
+ max-width: none;
754
+ max-height: none;
755
+ padding: 0;
756
+ border: 0;
757
+ background: transparent;
758
+ -webkit-backdrop-filter: none;
759
+ backdrop-filter: none;
760
+ color: inherit;
761
+ overflow: visible;
762
+ }
763
+ dialog.mb-dialog:not([open]) { display: none; }
764
+ /* Both rules: without them a scroll gesture over the backdrop or past the end
765
+ of the dialog's content chains to the page behind. */
766
+ dialog.mb-dialog:modal { overscroll-behavior: contain; }
767
+ dialog.mb-dialog::backdrop {
724
768
  background: rgba(0, 0, 0, 0.55);
725
- z-index: 9000;
726
- display: flex;
727
- align-items: center;
728
- justify-content: center;
769
+ overflow: hidden;
770
+ overscroll-behavior: contain;
729
771
  }
772
+ dialog.mb-dialog-light::backdrop { background: rgba(0, 0, 0, 0.45); }
730
773
 
774
+ /* ── Popover shell (components/Popover.js) ───────────────── */
775
+ /* Undo the UA [popover] defaults (centred via inset:0 + margin:auto, Canvas
776
+ colours, a medium border, padding, overflow:auto) so the caller's inline
777
+ top/left/right place it and the component class styles it. :where() keeps
778
+ this at zero specificity, so any component rule wins whatever its order. */
779
+ :where(.mb-popover[popover]) {
780
+ inset: auto;
781
+ margin: 0;
782
+ padding: 0;
783
+ border: 0;
784
+ background: none;
785
+ color: inherit;
786
+ overflow: visible;
787
+ }
788
+
789
+ /* MbeditorDialogs.confirm / .prompt — reuses the .schema-modal panel. */
790
+ .mb-confirm { min-width: 360px; max-width: min(520px, 94vw); }
791
+ .mb-confirm .schema-modal-body { padding: 14px 16px; }
792
+ .mb-confirm-message { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
793
+ .mb-confirm-message + .import-dest-input { margin-top: 10px; }
794
+ .mb-confirm .import-dest-input { width: 100%; box-sizing: border-box; }
795
+ /* pico.classless.css makes [type=submit] a full-width block. */
796
+ .mb-confirm .import-conflict-btn { width: auto; margin: 0; }
797
+
798
+ /* ── Shortcut Help Drawer ────────────────────────────────── */
731
799
  .shelp-panel {
732
800
  background: var(--ide-panel-bg);
733
801
  color: var(--ide-text);
@@ -1051,13 +1119,6 @@ body.mbeditor-migration-pending .ide-statusbar {
1051
1119
  .statusbar-btn:hover { background: color-mix(in srgb, var(--ide-accent-text) 15%, transparent); }
1052
1120
  .statusbar-btn:disabled { opacity: 0.5; cursor: not-allowed; }
1053
1121
 
1054
- .titlebar-git-btn {
1055
- min-width: 62px;
1056
- justify-content: center;
1057
- position: relative;
1058
- z-index: 1;
1059
- }
1060
-
1061
1122
  .statusbar-sep { width: 1px; height: 14px; background: color-mix(in srgb, var(--ide-accent-text) 20%, transparent); margin: 0 2px; }
1062
1123
 
1063
1124
  /* ── Collaboration presence ────────────────────────────────────────────────
@@ -1078,10 +1139,10 @@ body.mbeditor-migration-pending .ide-statusbar {
1078
1139
  /* Own popover rather than a title attribute: native tooltips wait ~1s before
1079
1140
  appearing, cannot show the colour swatch, and collapse the newlines this
1080
1141
  content needs. Fixed positioning is anchored from the chip's rect at hover
1081
- time — the titlebar never scrolls, so there is nothing to keep in sync. */
1142
+ time — the titlebar never scrolls, so there is nothing to keep in sync.
1143
+ Rendered as a manual popover (top layer), so it needs no z-index. */
1082
1144
  .collab-hovercard {
1083
1145
  position: fixed;
1084
- z-index: 4000;
1085
1146
  min-width: 180px;
1086
1147
  max-width: 320px;
1087
1148
  padding: 8px 10px;
@@ -1141,10 +1202,10 @@ body.mbeditor-migration-pending .ide-statusbar {
1141
1202
  }
1142
1203
  .collab-avatar-overflow { position: relative; }
1143
1204
  /* Fixed and anchored from the button's rect, like .collab-hovercard: inside the
1144
- title bar it was painted under the editor whatever its z-index. */
1205
+ title bar it was painted under the editor whatever its z-index. A manual
1206
+ popover now, so the top layer handles stacking. */
1145
1207
  .collab-overflow-popover {
1146
1208
  position: fixed;
1147
- z-index: 4000;
1148
1209
  min-width: 180px;
1149
1210
  max-width: 260px;
1150
1211
  max-height: 240px;
@@ -1223,13 +1284,6 @@ body.mbeditor-migration-pending .ide-statusbar {
1223
1284
  min-height: 0;
1224
1285
  }
1225
1286
 
1226
- .search-input-wrap {
1227
- display: flex;
1228
- flex-shrink: 0;
1229
- align-items: center;
1230
- gap: 4px;
1231
- }
1232
-
1233
1287
  .search-input-shell {
1234
1288
  width: 100%;
1235
1289
  position: relative;
@@ -1303,34 +1357,6 @@ body.mbeditor-migration-pending .ide-statusbar {
1303
1357
 
1304
1358
  /* ── old .search-options-row / .search-option-btn removed ── */
1305
1359
 
1306
- /* Use .search-panel ancestor for higher specificity than button:not(.pico-btn) */
1307
- .search-panel .search-btn {
1308
- flex-shrink: 0;
1309
- width: 26px;
1310
- height: 26px;
1311
- padding: 0;
1312
- margin: 0;
1313
- border: 1px solid var(--ide-border-input);
1314
- border-radius: 4px;
1315
- background: var(--ide-input-bg);
1316
- color: var(--ide-text-muted);
1317
- font-size: 12px;
1318
- display: inline-flex;
1319
- align-items: center;
1320
- justify-content: center;
1321
- cursor: pointer;
1322
- }
1323
-
1324
- .search-panel .search-btn:hover {
1325
- color: var(--ide-text);
1326
- border-color: var(--ide-accent-fg);
1327
- }
1328
-
1329
- .search-panel .search-btn:disabled {
1330
- opacity: 0.5;
1331
- cursor: not-allowed;
1332
- }
1333
-
1334
1360
  .search-input {
1335
1361
  width: 100%;
1336
1362
  margin-bottom: 0;
@@ -1528,15 +1554,6 @@ body.mbeditor-migration-pending .ide-statusbar {
1528
1554
  border-radius: 2px;
1529
1555
  }
1530
1556
 
1531
- .search-results-loading-more {
1532
- padding: 8px 10px;
1533
- font-size: 11px;
1534
- color: var(--ide-text-muted);
1535
- display: flex;
1536
- align-items: center;
1537
- gap: 6px;
1538
- }
1539
-
1540
1557
  /* ── Rails Panel ─────────────────────────────────────────── */
1541
1558
  .rails-panel {
1542
1559
  display: flex;
@@ -1553,20 +1570,6 @@ body.mbeditor-migration-pending .ide-statusbar {
1553
1570
  font-size: 12px;
1554
1571
  }
1555
1572
 
1556
- .rails-group {
1557
- margin-bottom: 4px;
1558
- }
1559
-
1560
- .rails-group-title {
1561
- padding: 4px 12px 2px;
1562
- font-size: 10px;
1563
- font-weight: 700;
1564
- letter-spacing: 0.08em;
1565
- text-transform: uppercase;
1566
- color: var(--ide-text-muted);
1567
- user-select: none;
1568
- }
1569
-
1570
1573
  .rails-group-item {
1571
1574
  display: flex;
1572
1575
  align-items: center;
@@ -1584,6 +1587,11 @@ body.mbeditor-migration-pending .ide-statusbar {
1584
1587
  background: var(--ide-hover-bg);
1585
1588
  }
1586
1589
 
1590
+ .rails-group-item-open {
1591
+ outline: 1px solid var(--ide-accent);
1592
+ outline-offset: -1px;
1593
+ }
1594
+
1587
1595
  .rails-group-item-name {
1588
1596
  overflow: hidden;
1589
1597
  text-overflow: ellipsis;
@@ -1642,15 +1650,6 @@ body.mbeditor-migration-pending .ide-statusbar {
1642
1650
  }
1643
1651
 
1644
1652
  /* ── Schema modal ─────────────────────────────────────────── */
1645
- .schema-modal-overlay {
1646
- position: fixed;
1647
- inset: 0;
1648
- background: rgba(0,0,0,0.55);
1649
- z-index: 9000;
1650
- display: flex;
1651
- align-items: center;
1652
- justify-content: center;
1653
- }
1654
1653
  .schema-modal {
1655
1654
  background: var(--ide-bg, #1e1e1e);
1656
1655
  border: 1px solid var(--ide-border, #3c3c3c);
@@ -2370,7 +2369,6 @@ body.mbeditor-migration-pending .ide-statusbar {
2370
2369
  /* A sticky header still needs its own fill, or scrolled rows show through it. */
2371
2370
  .ide-sidebar-scrollable .collapsible-header-static:hover { background: var(--ide-panel-bg); }
2372
2371
 
2373
-
2374
2372
  .collapsible-toggle {
2375
2373
  font-size: 8px;
2376
2374
  width: 16px;
@@ -2464,9 +2462,12 @@ body.mbeditor-migration-pending .ide-statusbar {
2464
2462
  overflow-y: auto;
2465
2463
  overflow-x: hidden;
2466
2464
  }
2467
- .ide-sidebar-fixed .collapsible-content::-webkit-scrollbar { width: 6px; }
2468
- .ide-sidebar-fixed .collapsible-content::-webkit-scrollbar-track { background: transparent; }
2469
- .ide-sidebar-fixed .collapsible-content::-webkit-scrollbar-thumb { background: var(--ide-scrollbar); border-radius: 3px; }
2465
+ .ide-sidebar-fixed .collapsible-content { scrollbar-color: var(--ide-scrollbar) transparent; }
2466
+ @supports not (scrollbar-color: auto) {
2467
+ .ide-sidebar-fixed .collapsible-content::-webkit-scrollbar { width: 6px; }
2468
+ .ide-sidebar-fixed .collapsible-content::-webkit-scrollbar-track { background: transparent; }
2469
+ .ide-sidebar-fixed .collapsible-content::-webkit-scrollbar-thumb { background: var(--ide-scrollbar); border-radius: 3px; }
2470
+ }
2470
2471
 
2471
2472
  .open-editors-group-header {
2472
2473
  font-size: 10px;
@@ -2711,8 +2712,6 @@ body.mbeditor-migration-pending .ide-statusbar {
2711
2712
  font-style: italic;
2712
2713
  }
2713
2714
 
2714
-
2715
-
2716
2715
  .project-action-btn {
2717
2716
  width: 24px;
2718
2717
  height: 24px;
@@ -2746,8 +2745,8 @@ body.mbeditor-migration-pending .ide-statusbar {
2746
2745
 
2747
2746
  /* Context menu */
2748
2747
  .context-menu {
2748
+ /* Rendered as a popover (top layer): no z-index to keep ahead of. */
2749
2749
  position: fixed;
2750
- z-index: 9999;
2751
2750
  min-width: 180px;
2752
2751
  background: var(--ide-panel-bg);
2753
2752
  border: 1px solid var(--ide-border-input);
@@ -2759,25 +2758,50 @@ body.mbeditor-migration-pending .ide-statusbar {
2759
2758
  user-select: none;
2760
2759
  }
2761
2760
 
2762
- .context-menu-item {
2761
+ /* Items are <button>s (PopupMenu.js). Two classes deep so the reset beats
2762
+ pico.classless's button rules (background, border, padding, focus shadow). */
2763
+ .context-menu .context-menu-item {
2764
+ appearance: none;
2763
2765
  display: flex;
2764
2766
  align-items: center;
2765
2767
  gap: 8px;
2768
+ inline-size: 100%;
2769
+ margin: 0;
2766
2770
  padding: 6px 14px;
2771
+ border: 0;
2772
+ border-radius: 0;
2773
+ background: transparent;
2774
+ box-shadow: none;
2775
+ color: inherit;
2776
+ font: inherit;
2777
+ text-align: start;
2767
2778
  cursor: pointer;
2768
2779
  white-space: nowrap;
2769
2780
  }
2770
2781
 
2771
- .context-menu-item:hover {
2782
+ /* Hover moves focus onto the item (PopupMenu), so these are one item. While
2783
+ the keyboard owns the menu, an item merely under the pointer stays plain. */
2784
+ .context-menu .context-menu-item:hover,
2785
+ .context-menu .context-menu-item:focus-visible {
2772
2786
  background: var(--ide-active-bg);
2773
2787
  color: #ffffff;
2774
2788
  }
2775
2789
 
2776
- .context-menu-item-danger:hover {
2790
+ .context-menu:has(.context-menu-item:focus-visible) .context-menu-item:hover:not(:focus-visible) {
2791
+ background: transparent;
2792
+ color: inherit;
2793
+ }
2794
+
2795
+ .context-menu .context-menu-item-danger:hover,
2796
+ .context-menu .context-menu-item-danger:focus-visible {
2777
2797
  background: rgba(244, 135, 113, 0.15);
2778
2798
  color: var(--ide-danger);
2779
2799
  }
2780
2800
 
2801
+ .context-menu-group:focus {
2802
+ outline: none;
2803
+ }
2804
+
2781
2805
  .context-menu-icon {
2782
2806
  width: 14px;
2783
2807
  text-align: center;
@@ -2786,30 +2810,11 @@ body.mbeditor-migration-pending .ide-statusbar {
2786
2810
  opacity: 0.8;
2787
2811
  }
2788
2812
 
2789
- .context-menu-divider {
2813
+ .context-menu .context-menu-divider {
2790
2814
  height: 1px;
2791
- background: var(--ide-border);
2792
2815
  margin: 4px 0;
2793
- }
2794
-
2795
- .ide-tab-context-menu-item {
2796
- padding: 6px 14px;
2797
- cursor: pointer;
2798
- color: #ccc;
2799
- font-size: 12px;
2800
- display: flex;
2801
- align-items: center;
2802
- gap: 8px;
2803
- background: transparent;
2804
- }
2805
-
2806
- .ide-tab-context-menu-item:hover {
2807
- background: #094771;
2808
- }
2809
-
2810
- .ide-tab-context-menu-item i {
2811
- width: 14px;
2812
- text-align: center;
2816
+ border: 0;
2817
+ background: var(--ide-border);
2813
2818
  }
2814
2819
 
2815
2820
  .collapsible-content {
@@ -2832,16 +2837,10 @@ body.mbeditor-migration-pending .ide-statusbar {
2832
2837
  window, not a centred modal. The rows are 22px and single-line — the path
2833
2838
  sits beside the name rather than under it, which is what lets a full
2834
2839
  viewport of results be scanned without scrolling. */
2835
- .quick-open-overlay {
2836
- position: fixed;
2837
- inset: 0;
2838
- background: rgba(0,0,0,0.35);
2839
- display: flex;
2840
- align-items: flex-start;
2841
- justify-content: center;
2842
- padding-top: 6px;
2843
- z-index: 9999;
2844
- }
2840
+ /* Quick Open is a ModalDialog pinned to the top like VS Code's, over a
2841
+ lighter backdrop than the centred dialogs. */
2842
+ dialog.mb-dialog.mb-dialog-top { margin: 6px auto auto; }
2843
+ dialog.mb-dialog-top::backdrop { background: rgba(0, 0, 0, 0.35); }
2845
2844
 
2846
2845
  /* Always a frosted panel — VS Code's Quick Open floats over the editor, not
2847
2846
  inside it, so it stays readable whether or not the glass theme is on. */
@@ -2988,42 +2987,21 @@ body.mbeditor-migration-pending .ide-statusbar {
2988
2987
  .pdf-icon { color: var(--ide-danger) !important; }
2989
2988
 
2990
2989
  /* ── Scrollbars ────────────────────────────────────────────── */
2991
- ::-webkit-scrollbar { width: 8px; height: 8px; }
2992
- ::-webkit-scrollbar-track { background: var(--ide-bg); }
2993
- ::-webkit-scrollbar-thumb { background: var(--ide-scrollbar); border-radius: 4px; }
2994
- ::-webkit-scrollbar-thumb:hover { background: var(--ide-hover-bg); }
2995
-
2996
- /* ── Notification toast ─────────────────────────────────────── */
2997
- .ide-toast {
2998
- position: fixed;
2999
- bottom: 32px;
3000
- right: 16px;
3001
- background: var(--ide-panel-bg-alt);
3002
- border: 1px solid var(--ide-border-input);
3003
- border-radius: 6px;
3004
- padding: 8px 14px;
3005
- font-size: 12px;
3006
- color: var(--ide-text);
3007
- z-index: 10000;
3008
- box-shadow: 0 4px 16px rgba(0,0,0,0.5);
3009
- animation: toast-in 0.15s ease;
3010
- }
3011
-
3012
- @keyframes toast-in {
3013
- from { opacity: 0; transform: translateY(8px); }
3014
- to { opacity: 1; transform: translateY(0); }
2990
+ /* Standard properties. scrollbar-color inherits, so :root colours every
2991
+ native scrollbar; scrollbar-width does not, hence the universal rule (zero
2992
+ specificity, so any component rule overrides it). Where these apply, Chrome
2993
+ and Safari ignore ::-webkit-scrollbar, so the WebKit rules are only the
2994
+ fallback for engines without scrollbar-color. */
2995
+ :root { scrollbar-color: var(--ide-scrollbar) var(--ide-bg); }
2996
+ * { scrollbar-width: thin; }
2997
+ @supports not (scrollbar-color: auto) {
2998
+ ::-webkit-scrollbar { width: 8px; height: 8px; }
2999
+ ::-webkit-scrollbar-track { background: var(--ide-bg); }
3000
+ ::-webkit-scrollbar-thumb { background: var(--ide-scrollbar); border-radius: 4px; }
3001
+ ::-webkit-scrollbar-thumb:hover { background: var(--ide-hover-bg); }
3015
3002
  }
3016
3003
 
3017
3004
  /* ── Draft restore dialog ───────────────────────────────────── */
3018
- .ide-draft-restore-overlay {
3019
- position: fixed;
3020
- inset: 0;
3021
- background: rgba(0,0,0,0.55);
3022
- z-index: 10001;
3023
- display: flex;
3024
- align-items: center;
3025
- justify-content: center;
3026
- }
3027
3005
  .ide-draft-restore-dialog {
3028
3006
  background: var(--ide-panel-bg-alt);
3029
3007
  border: 1px solid var(--ide-border-input);
@@ -3082,16 +3060,6 @@ body.mbeditor-migration-pending .ide-statusbar {
3082
3060
  /* ══ SETTINGS MODAL ═════════════════════════════════════════════════════════
3083
3061
  * VS Code-style: left nav of sections, scrolling right pane of rows.
3084
3062
  * ─────────────────────────────────────────────────────────────────────────── */
3085
- .ide-settings-overlay {
3086
- position: fixed;
3087
- inset: 0;
3088
- background: rgba(0,0,0,0.45);
3089
- z-index: 9100;
3090
- display: flex;
3091
- align-items: center;
3092
- justify-content: center;
3093
- }
3094
-
3095
3063
  /* Frosted like Quick Open — it floats over the editor, not inside it. */
3096
3064
  .ide-settings-modal {
3097
3065
  backdrop-filter: blur(20px) saturate(180%);
@@ -3264,8 +3232,7 @@ main { padding: unset; }
3264
3232
 
3265
3233
  /* Compact spinner size for non-button IDE loading states */
3266
3234
  .ide-loading-state[aria-busy="true"]::before,
3267
- .git-empty[aria-busy="true"]::before,
3268
- .search-results-loading-more[aria-busy="true"]::before {
3235
+ .git-empty[aria-busy="true"]::before {
3269
3236
  --pico-loading-spinner-opacity: 0.7;
3270
3237
  width: 14px;
3271
3238
  height: 14px;
@@ -3364,7 +3331,6 @@ textarea {
3364
3331
  .git-header-btn,
3365
3332
  .git-action-btn,
3366
3333
  .project-action-btn,
3367
- .search-clear-btn,
3368
3334
  .quick-open-clear-btn,
3369
3335
  .shelp-close {
3370
3336
  padding: 0;
@@ -3376,14 +3342,6 @@ textarea {
3376
3342
  justify-content: center;
3377
3343
  }
3378
3344
 
3379
- /* Context menu items */
3380
- .context-menu-item {
3381
- --pico-form-element-spacing-vertical: 6px;
3382
- font-size: 12px;
3383
- border-radius: 0;
3384
- border: none;
3385
- }
3386
-
3387
3345
  /* Tree inline create input — ultra-compact */
3388
3346
  .tree-inline-input {
3389
3347
  padding: 1px 4px;
@@ -3469,7 +3427,6 @@ button:not(.pico-btn) { margin-bottom: 0; }
3469
3427
  .ide-shell .git-action-btn { border-radius: 4px; } /* matched to explorer buttons */
3470
3428
  .ide-shell .ide-icon-btn,
3471
3429
  .ide-shell .tab-close,
3472
- .ide-shell .search-clear-btn,
3473
3430
  .ide-shell .quick-open-clear-btn,
3474
3431
  .ide-shell .shelp-close { border-radius: 3px; }
3475
3432
  .ide-shell .statusbar-btn { border-radius: 2px; }
@@ -4117,11 +4074,6 @@ input.ide-model-graph-search[type="search"] {
4117
4074
  needs has actually failed — an empty room is silence, not a warning. */
4118
4075
  .mbeditor-collab-trouble { color: var(--ide-warning, #cca700); }
4119
4076
  .mbeditor-conflict-chip { color: var(--ide-error, #f48771); }
4120
- .mbeditor-modal-backdrop {
4121
- position: fixed; inset: 0; z-index: 5000;
4122
- background: rgba(0, 0, 0, 0.45);
4123
- display: flex; align-items: center; justify-content: center;
4124
- }
4125
4077
  .mbeditor-collab-diag {
4126
4078
  width: min(560px, 92vw);
4127
4079
  max-height: 80vh; overflow-y: auto;
@@ -4167,3 +4119,54 @@ input.ide-model-graph-search[type="search"] {
4167
4119
  .paste-place-name { font-family: var(--ide-mono-font, monospace); min-width: 160px; }
4168
4120
  .paste-place-row select { flex: 1; min-width: 0; color: var(--ide-text, #d4d4d4); background: var(--ide-input-bg, #3c3c3c); border: 1px solid var(--ide-border, #3c3c3c); }
4169
4121
  .paste-place-diff { height: 260px; margin-top: 8px; border: 1px solid var(--ide-border, #3c3c3c); }
4122
+
4123
+ /* AI round trip modal — reuses the schema-modal shell */
4124
+ .ai-modal { width: 80vw; height: 80vh; max-width: none; max-height: none; min-width: 0; overflow: hidden; }
4125
+ .ai-modal .schema-modal-body { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
4126
+ .ai-tabs { display: flex; gap: 4px; }
4127
+ .ai-tab {
4128
+ background: none; border: 0; border-bottom: 2px solid transparent;
4129
+ color: var(--ide-text-muted, #999); font-size: 13px; padding: 2px 10px; cursor: pointer;
4130
+ }
4131
+ .ai-tab.active { color: var(--ide-text, #ccc); border-bottom-color: var(--ide-accent, #0e639c); }
4132
+ .ai-pane { padding: 12px 16px; font-size: 12px; flex: 1; min-height: 0; display: flex; flex-direction: column; }
4133
+ .ai-hint { margin: 0 0 8px; color: var(--ide-text-muted, #999); }
4134
+ .ai-dir-list, .ai-dir-list li { list-style: none; margin: 0; }
4135
+ .ai-dir-list { padding-left: 16px; }
4136
+ .ai-pane > .ai-dir-list { padding-left: 0; flex: 1; min-height: 0; overflow-y: auto; }
4137
+ .ai-dir-row { display: flex; align-items: center; gap: 4px; padding: 2px 0; }
4138
+ .ai-dir-toggle { width: 16px; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; font-size: 9px; }
4139
+ .ai-patch {
4140
+ width: 100%; box-sizing: border-box; flex: 1; min-height: 120px; resize: none;
4141
+ font-family: var(--ide-mono-font, monospace); font-size: 12px;
4142
+ color: var(--ide-text, #d4d4d4); background: var(--ide-input-bg, #3c3c3c);
4143
+ border: 1px solid var(--ide-border, #3c3c3c);
4144
+ }
4145
+ .ai-error { margin-top: 8px; color: var(--ide-error, #f48771); white-space: pre-wrap; font-family: inherit; }
4146
+ .ai-result { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
4147
+ .ai-edit-diff { margin-left: auto; background: none; border: 0; color: var(--ide-accent, #4a8fd6); cursor: pointer; font-size: 12px; padding: 0; }
4148
+ .ai-files { margin-top: 4px; }
4149
+ .ai-file { display: block; margin-bottom: 8px; }
4150
+ .ai-status { font-weight: 600; text-transform: uppercase; font-size: 10px; margin-right: 4px; }
4151
+ .ai-status-created { color: #2ea043; }
4152
+ .ai-status-deleted { color: var(--ide-error, #f48771); }
4153
+ .ai-status-renamed { color: var(--ide-accent, #0e639c); }
4154
+ .ai-status-modified { color: var(--ide-text-muted, #999); }
4155
+ .ai-diff {
4156
+ margin-top: 8px; flex: 1; min-height: 0; overflow: auto;
4157
+ border: 1px solid var(--ide-border, #3c3c3c);
4158
+ font-family: var(--ide-mono-font, monospace); font-size: 12px;
4159
+ }
4160
+ .ai-diff-line { white-space: pre; min-height: 1.4em; line-height: 1.4; padding: 0 6px; }
4161
+ .ai-diff-add { background: rgba(46, 160, 67, 0.22); }
4162
+ .ai-diff-del { background: rgba(248, 81, 73, 0.22); }
4163
+ .ai-diff-hunk { color: var(--ide-accent, #4a8fd6); opacity: 0.85; }
4164
+ .ai-diff-meta { color: var(--ide-text-muted, #999); }
4165
+ .ai-diff-file { font-weight: 600; }
4166
+ .ai-diff-off { opacity: 0.4; }
4167
+ .ai-diff-prefix { display: inline-block; width: 1ch; margin-right: 1ch; user-select: none; }
4168
+ .ai-file-row {
4169
+ display: flex; align-items: center; gap: 6px; padding: 3px 6px; cursor: pointer;
4170
+ background: var(--ide-hover-bg, rgba(128, 128, 128, 0.15)); border-top: 1px solid var(--ide-border, #3c3c3c);
4171
+ }
4172
+ .ai-hunk-row { display: flex; align-items: center; gap: 6px; }
@@ -153,7 +153,7 @@ html[data-glass] .search-input {
153
153
  /* ── Quick open ───────────────────────────────────────────────────────────── */
154
154
  /* The frosted box itself is the default look now (editor.css) regardless of
155
155
  the glass setting — only the capsule-row treatment is glass-specific. */
156
- html[data-glass] .quick-open-overlay { background: color-mix(in srgb, var(--ide-bg) 30%, transparent); }
156
+ html[data-glass] dialog.mb-dialog-top::backdrop { background: color-mix(in srgb, var(--ide-bg) 30%, transparent); }
157
157
  html[data-glass] .quick-open-result { border-radius: 999px; margin: 0 6px; }
158
158
  html[data-glass] .quick-open-result:hover { background: var(--g-hover); }
159
159
 
@@ -14,6 +14,19 @@ module Mbeditor
14
14
 
15
15
  STREAM_PREFIX = "mbeditor_collab"
16
16
 
17
+ # A room is identified by workspace *and* relative path. Keying on the path
18
+ # alone means two workspaces that both contain "README.md" share one buffer,
19
+ # so pointing `workspace_root` at a different project seeds its file with the
20
+ # previous project's content. The NUL separator cannot occur in either part.
21
+ def self.room_key(path)
22
+ "#{WorkspaceRootResolver.call}\0#{path}"
23
+ end
24
+
25
+ # Called by endpoints that rewrite files server-side.
26
+ def self.files_written(relative_paths)
27
+ relative_paths.compact.each { |p| CollaborationDocStore.discard_idle(room_key(p)) }
28
+ end
29
+
17
30
  def subscribed
18
31
  return unless mbeditor_authenticated?
19
32
 
@@ -57,6 +70,16 @@ module Mbeditor
57
70
  relay("type" => "request_snapshot")
58
71
  end
59
72
 
73
+ # Answered to the asker only: the one granted client rewrites the shared doc
74
+ # to the new disk content, everyone else receives that as a doc_update.
75
+ def claim_disk_write(data)
76
+ key = data["key"].to_s
77
+ return if key.empty?
78
+
79
+ transmit({ "type" => "disk_claim", "key" => key,
80
+ "granted" => CollaborationDocStore.claim_disk_write(room_key, key) })
81
+ end
82
+
60
83
  def awareness(data)
61
84
  bytes = data["awareness"]
62
85
  return if bytes.nil?
@@ -88,12 +111,8 @@ module Mbeditor
88
111
  "seed" => CollaborationDocStore.claim_seed(room_key) })
89
112
  end
90
113
 
91
- # A room is identified by workspace *and* relative path. Keying on the path
92
- # alone means two workspaces that both contain "README.md" share one buffer,
93
- # so pointing `workspace_root` at a different project seeds its file with the
94
- # previous project's content. The NUL separator cannot occur in either part.
95
114
  def room_key
96
- @room_key ||= "#{WorkspaceRootResolver.call}\0#{@path}"
115
+ @room_key ||= self.class.room_key(@path)
97
116
  end
98
117
 
99
118
  def stream_name