flexdesk 0.17.5 → 0.17.7

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 (282) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/LICENSE +0 -0
  3. package/README.md +0 -0
  4. package/THIRD_PARTY_LICENSES.md +0 -0
  5. package/canvas.js +0 -0
  6. package/charts.js +0 -0
  7. package/core.js +0 -0
  8. package/css/base.css +68 -0
  9. package/css/flexdesk.css +68 -0
  10. package/css/overrides.css +0 -0
  11. package/css/reset.css +0 -0
  12. package/css/tokens.css +11 -0
  13. package/dist/canvas.js +0 -0
  14. package/dist/canvas.js.map +0 -0
  15. package/dist/charts.js +0 -0
  16. package/dist/charts.js.map +0 -0
  17. package/dist/chunk-3PHCPZHT.js +0 -0
  18. package/dist/chunk-3PHCPZHT.js.map +0 -0
  19. package/dist/chunk-CVMCZZX2.js +0 -0
  20. package/dist/chunk-CVMCZZX2.js.map +0 -0
  21. package/dist/chunk-D3COLZZ2.js +0 -0
  22. package/dist/chunk-D3COLZZ2.js.map +0 -0
  23. package/dist/chunk-FOOS3T5L.js +0 -0
  24. package/dist/chunk-FOOS3T5L.js.map +0 -0
  25. package/dist/chunk-GOQLR5WR.js +0 -0
  26. package/dist/chunk-GOQLR5WR.js.map +0 -0
  27. package/dist/chunk-HNU6MM2B.js +0 -0
  28. package/dist/chunk-HNU6MM2B.js.map +0 -0
  29. package/dist/chunk-HYJYYEPK.js +0 -0
  30. package/dist/chunk-HYJYYEPK.js.map +0 -0
  31. package/dist/chunk-JKZLNKG6.js +0 -0
  32. package/dist/chunk-JKZLNKG6.js.map +0 -0
  33. package/dist/chunk-JYWURG5T.js +0 -0
  34. package/dist/chunk-JYWURG5T.js.map +0 -0
  35. package/dist/chunk-LWV23YVE.js +0 -0
  36. package/dist/chunk-LWV23YVE.js.map +0 -0
  37. package/dist/chunk-N7HC3ADV.js +0 -0
  38. package/dist/chunk-N7HC3ADV.js.map +0 -0
  39. package/dist/chunk-RKNFBX5K.js +0 -0
  40. package/dist/chunk-RKNFBX5K.js.map +0 -0
  41. package/dist/chunk-RMTRWWEO.js +0 -0
  42. package/dist/chunk-RMTRWWEO.js.map +0 -0
  43. package/dist/chunk-UURZ37SD.js +0 -0
  44. package/dist/chunk-UURZ37SD.js.map +0 -0
  45. package/dist/chunk-UWO43BZU.js +0 -0
  46. package/dist/chunk-UWO43BZU.js.map +0 -0
  47. package/dist/chunk-WVFGV5FT.js +0 -0
  48. package/dist/chunk-WVFGV5FT.js.map +0 -0
  49. package/dist/core.js +0 -0
  50. package/dist/core.js.map +0 -0
  51. package/dist/editor.js +12 -0
  52. package/dist/editor.js.map +2 -2
  53. package/dist/flexdesk.css +68 -0
  54. package/dist/flow.js +0 -0
  55. package/dist/flow.js.map +0 -0
  56. package/dist/host.js +0 -0
  57. package/dist/host.js.map +0 -0
  58. package/dist/reset.css +0 -0
  59. package/dist/tile_registry-6WZPTUZV.js +0 -0
  60. package/dist/tile_registry-6WZPTUZV.js.map +0 -0
  61. package/dist/tiles.js +0 -0
  62. package/dist/tiles.js.map +0 -0
  63. package/dist/tokens.css +11 -0
  64. package/dist/widgets.js +0 -0
  65. package/dist/widgets.js.map +0 -0
  66. package/dist/wm.js +0 -0
  67. package/dist/wm.js.map +0 -0
  68. package/docs/README.md +0 -0
  69. package/docs/best-practices.md +0 -0
  70. package/docs/components/charts.md +0 -0
  71. package/docs/components/command-palette.md +0 -0
  72. package/docs/components/conversation.md +0 -0
  73. package/docs/components/data-table-grid.md +0 -0
  74. package/docs/components/data-table.md +0 -0
  75. package/docs/components/editor.md +21 -0
  76. package/docs/components/flow-canvas-editor.md +0 -0
  77. package/docs/components/flow-editors.md +0 -0
  78. package/docs/components/flow-lane-editor.md +0 -0
  79. package/docs/components/flow-outline-editor.md +0 -0
  80. package/docs/components/forms-and-dialogs.md +0 -0
  81. package/docs/components/input-fields.md +0 -0
  82. package/docs/components/keymap.md +0 -0
  83. package/docs/components/layout-widgets.md +38 -0
  84. package/docs/components/markdown-and-outline.md +0 -0
  85. package/docs/components/menus.md +0 -0
  86. package/docs/components/notifications.md +0 -0
  87. package/docs/components/panels-and-desktops.md +0 -0
  88. package/docs/components/record-list-and-fact-table.md +0 -0
  89. package/docs/components/settings-view.md +0 -0
  90. package/docs/components/shell.md +0 -0
  91. package/docs/components/slide-out-panel.md +0 -0
  92. package/docs/components/tiles.md +0 -0
  93. package/docs/components/wizard.md +0 -0
  94. package/docs/concepts/building-and-packaging.md +0 -0
  95. package/docs/concepts/domain-neutrality.md +0 -0
  96. package/docs/concepts/host-port.md +0 -0
  97. package/docs/concepts/packages-and-entry-points.md +0 -0
  98. package/docs/concepts/peer-dependencies.md +0 -0
  99. package/docs/concepts/state-guard.md +0 -0
  100. package/docs/concepts/styling.md +0 -0
  101. package/docs/quickstart.md +0 -0
  102. package/editor.js +0 -0
  103. package/flow.js +0 -0
  104. package/host.js +0 -0
  105. package/package.json +1 -1
  106. package/src/canvas/canvas_adapter.js +0 -0
  107. package/src/canvas/edge_router.js +0 -0
  108. package/src/canvas/graph/connector_router.js +0 -0
  109. package/src/canvas/graph/history_service.js +0 -0
  110. package/src/canvas/graph/node_platform.js +0 -0
  111. package/src/canvas/index.js +0 -0
  112. package/src/canvas/layered_layout.js +0 -0
  113. package/src/charts/chart_types.js +0 -0
  114. package/src/charts/data_series_plot_window.js +0 -0
  115. package/src/charts/downsample.js +0 -0
  116. package/src/charts/plot_config.js +0 -0
  117. package/src/charts/plot_config_editor.js +0 -0
  118. package/src/charts/plot_grid.js +0 -0
  119. package/src/charts/plot_popout_window.js +0 -0
  120. package/src/charts/plotly_wrapper.js +0 -0
  121. package/src/charts/series_transforms.js +0 -0
  122. package/src/core/event_bus.js +0 -0
  123. package/src/core/logging.js +0 -0
  124. package/src/core/settings.js +0 -0
  125. package/src/core/state_guard.js +0 -0
  126. package/src/core/state_guard_config.js +0 -0
  127. package/src/core/state_machine.js +0 -0
  128. package/src/editor/editor_pane.js +0 -0
  129. package/src/editor/monaco_editor_factory.js +7 -1
  130. package/src/editor/monaco_loader.js +37 -0
  131. package/src/editor/notebook_search.js +0 -0
  132. package/src/editor/notebook_tab_bar.js +0 -0
  133. package/src/editor/notebook_undo_manager.js +0 -0
  134. package/src/editor/split_pane_container.js +0 -0
  135. package/src/flow/canvas_editor/connections.js +0 -0
  136. package/src/flow/canvas_editor/editor.js +0 -0
  137. package/src/flow/canvas_editor/index.js +0 -0
  138. package/src/flow/canvas_editor/layout.js +0 -0
  139. package/src/flow/canvas_editor/strings.js +0 -0
  140. package/src/flow/kit/always_before.js +0 -0
  141. package/src/flow/kit/catalogue.js +0 -0
  142. package/src/flow/kit/chip_input.js +0 -0
  143. package/src/flow/kit/dom.js +0 -0
  144. package/src/flow/kit/findings.js +0 -0
  145. package/src/flow/kit/history.js +0 -0
  146. package/src/flow/kit/index.js +0 -0
  147. package/src/flow/kit/keys.js +0 -0
  148. package/src/flow/kit/logic_graph.js +0 -0
  149. package/src/flow/kit/references.js +0 -0
  150. package/src/flow/kit/settings_panel.js +0 -0
  151. package/src/flow/kit/settings_schema.js +0 -0
  152. package/src/flow/kit/step_picker.js +0 -0
  153. package/src/flow/kit/strings.js +0 -0
  154. package/src/flow/kit/value_picker.js +0 -0
  155. package/src/flow/kit/widgets.js +0 -0
  156. package/src/flow/lanes/editor.js +0 -0
  157. package/src/flow/lanes/index.js +0 -0
  158. package/src/flow/lanes/layout.js +0 -0
  159. package/src/flow/lanes/pipeline.js +0 -0
  160. package/src/flow/lanes/preview.js +0 -0
  161. package/src/flow/lanes/strings.js +0 -0
  162. package/src/flow/outline/editor.js +0 -0
  163. package/src/flow/outline/index.js +0 -0
  164. package/src/flow/outline/mapping.js +0 -0
  165. package/src/flow/outline/menu.js +0 -0
  166. package/src/flow/outline/operations.js +0 -0
  167. package/src/flow/outline/recognise.js +0 -0
  168. package/src/flow/outline/strings.js +0 -0
  169. package/src/help/help_modal.js +0 -0
  170. package/src/help/help_registry.js +0 -0
  171. package/src/host/external_links.js +0 -0
  172. package/src/host/file_picker.js +0 -0
  173. package/src/host/host.js +0 -0
  174. package/src/host/photino_host.js +0 -0
  175. package/src/host/photino_host.md +0 -0
  176. package/src/host/pywebview_host.js +0 -0
  177. package/src/tiles/chart_tiles.js +0 -0
  178. package/src/tiles/config_schema.js +0 -0
  179. package/src/tiles/figure_tile.js +0 -0
  180. package/src/tiles/layout_persistence.js +0 -0
  181. package/src/tiles/list_tiles.js +0 -0
  182. package/src/tiles/scope_picker.js +0 -0
  183. package/src/tiles/tile_base.js +0 -0
  184. package/src/tiles/tile_config_form.js +0 -0
  185. package/src/tiles/tile_grid.js +0 -0
  186. package/src/tiles/tile_registry.js +0 -0
  187. package/src/tiling/bottom_panel_tabs.js +0 -0
  188. package/src/tiling/command_palette.js +0 -0
  189. package/src/tiling/content_registry.js +0 -0
  190. package/src/tiling/desktops.js +0 -0
  191. package/src/tiling/entity_sources.js +0 -0
  192. package/src/tiling/keymap.js +0 -0
  193. package/src/tiling/kind_taxonomy.js +0 -0
  194. package/src/tiling/landing_table.js +0 -0
  195. package/src/tiling/loading_overlay.js +0 -0
  196. package/src/tiling/nav_panel.js +0 -0
  197. package/src/tiling/page_factory.js +0 -0
  198. package/src/tiling/panel_availability.js +0 -0
  199. package/src/tiling/panel_keys.js +0 -0
  200. package/src/tiling/shell.js +0 -0
  201. package/src/tiling/tab_strip.js +0 -0
  202. package/src/tiling/tile_breadcrumb.js +0 -0
  203. package/src/tiling/tile_renderer.js +0 -0
  204. package/src/tiling/tile_tab_menu.js +0 -0
  205. package/src/tiling/tile_tree.js +0 -0
  206. package/src/tiling/wm.js +0 -0
  207. package/src/tiling/zoom.js +0 -0
  208. package/src/ui/base/component_base.js +0 -0
  209. package/src/ui/base/controller_base.js +0 -0
  210. package/src/ui/base/page_base.js +0 -0
  211. package/src/ui/components/about_dialog.js +0 -0
  212. package/src/ui/components/action_dropdown.js +0 -0
  213. package/src/ui/components/alert_log.js +0 -0
  214. package/src/ui/components/alerts_pane.js +0 -0
  215. package/src/ui/components/attribute_list_editor.js +0 -0
  216. package/src/ui/components/autocomplete_field.js +0 -0
  217. package/src/ui/components/cell_editor_host.js +0 -0
  218. package/src/ui/components/cell_editors.js +0 -0
  219. package/src/ui/components/cell_grid.js +0 -0
  220. package/src/ui/components/cell_paste.js +0 -0
  221. package/src/ui/components/cell_selection.js +0 -0
  222. package/src/ui/components/choice_controls.js +0 -0
  223. package/src/ui/components/color_field.js +0 -0
  224. package/src/ui/components/color_list_field.js +0 -0
  225. package/src/ui/components/column_fit.js +0 -0
  226. package/src/ui/components/column_groups.js +0 -0
  227. package/src/ui/components/column_order.js +0 -0
  228. package/src/ui/components/computing_status_window.js +0 -0
  229. package/src/ui/components/confirm_dialog.js +0 -0
  230. package/src/ui/components/context_menu.js +0 -0
  231. package/src/ui/components/conversation_view.js +0 -0
  232. package/src/ui/components/crosstab.js +0 -0
  233. package/src/ui/components/data_table.js +0 -0
  234. package/src/ui/components/detail_header.js +0 -0
  235. package/src/ui/components/document_outline.js +0 -0
  236. package/src/ui/components/drag_reorder.js +0 -0
  237. package/src/ui/components/fact_table.js +0 -0
  238. package/src/ui/components/fill_handle.js +0 -0
  239. package/src/ui/components/gallery_picker.js +0 -0
  240. package/src/ui/components/header_actions.js +0 -0
  241. package/src/ui/components/inline_renamer.js +0 -0
  242. package/src/ui/components/job_progress.js +0 -0
  243. package/src/ui/components/managed_window.js +0 -0
  244. package/src/ui/components/menu_bar.js +0 -0
  245. package/src/ui/components/modal.js +0 -0
  246. package/src/ui/components/notification_history.js +0 -0
  247. package/src/ui/components/progress.js +0 -0
  248. package/src/ui/components/record_list.js +0 -0
  249. package/src/ui/components/row_activation.js +0 -0
  250. package/src/ui/components/section_stack.js +0 -0
  251. package/src/ui/components/series.js +0 -0
  252. package/src/ui/components/settings_view.js +0 -0
  253. package/src/ui/components/slide_out_panel.js +0 -0
  254. package/src/ui/components/slider_field.js +0 -0
  255. package/src/ui/components/sortable_list.js +0 -0
  256. package/src/ui/components/staged_edits.js +0 -0
  257. package/src/ui/components/staged_history.js +0 -0
  258. package/src/ui/components/table_filter_chips.js +0 -0
  259. package/src/ui/components/table_state_store.js +0 -0
  260. package/src/ui/components/table_structure.js +0 -0
  261. package/src/ui/components/table_values.js +0 -0
  262. package/src/ui/components/tabs.js +0 -0
  263. package/src/ui/components/tag_input.js +0 -0
  264. package/src/ui/components/toast.js +0 -0
  265. package/src/ui/components/toggle_field.js +0 -0
  266. package/src/ui/components/tree_view.js +0 -0
  267. package/src/ui/components/tsv.js +0 -0
  268. package/src/ui/components/window_taskbar.js +0 -0
  269. package/src/ui/components/wizard.js +0 -0
  270. package/src/ui/controllers/window_chrome_controller.js +0 -0
  271. package/src/ui/notification_center.js +0 -0
  272. package/src/ui/utils/auto_scrollbars.js +0 -0
  273. package/src/ui/utils/markdown.js +0 -0
  274. package/src/ui/utils/native_context_menu.js +0 -0
  275. package/src/ui/utils/overlay_scrollbar.js +0 -0
  276. package/src/ui/utils/raf_resize_observer.js +0 -0
  277. package/src/ui/utils/scroll_lock.js +0 -0
  278. package/src/ui/utils/strip_scroll.js +0 -0
  279. package/src/ui/utils/tooltip_service.js +0 -0
  280. package/tiles.js +0 -0
  281. package/widgets.js +0 -0
  282. package/wm.js +0 -0
package/dist/tokens.css CHANGED
@@ -102,6 +102,14 @@
102
102
  --state-active: rgba(255, 255, 255, 0.08);
103
103
  --state-selected: rgba(0, 122, 204, 0.15);
104
104
 
105
+ /* ── Overlay scrollbars (installOverlayScrollbar) ─────────── */
106
+ --scrollbar-size: 6px;
107
+ --scrollbar-radius: 3px;
108
+ --scrollbar-track: rgba(255, 255, 255, 0.08);
109
+ --scrollbar-thumb: rgba(255, 255, 255, 0.28);
110
+ --scrollbar-thumb-hover: rgba(255, 255, 255, 0.38);
111
+ --scrollbar-thumb-active: rgba(255, 255, 255, 0.48);
112
+
105
113
  /* ── Shadows / elevation ──────────────────────────────────── */
106
114
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
107
115
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
@@ -119,6 +127,9 @@
119
127
  stack from 6000 to 6999 (managed_window.js), so a popover at
120
128
  --z-popover would open behind the window that opened it. */
121
129
  --z-over-windows: 7100;
130
+ /* An overlay scrollbar inside a scroll container: over the container's
131
+ content and its dropdowns, under managed windows (6000+). */
132
+ --z-scrollbar: 500;
122
133
 
123
134
  /* ── Transitions ──────────────────────────────────────────── */
124
135
  --transition-fast: 120ms ease;
package/dist/widgets.js CHANGED
File without changes
File without changes
package/dist/wm.js CHANGED
File without changes
package/dist/wm.js.map CHANGED
File without changes
package/docs/README.md CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -20,3 +20,24 @@ A non-positive or non-number cap throws a `RangeError`. With `noAutoHeight`
20
20
  the container's own layout decides the size and `setMaxHeight` has no effect.
21
21
  Before 0.17.0 the cap was a fixed 400px, switched on by `data-code-max-height="true"`
22
22
  on a `.notebook-editor-container` ancestor; that attribute is no longer read.
23
+
24
+ ## Monaco's `Canceled` rejections are hidden (0.17.6)
25
+
26
+ When an editor gets focus, Monaco's word highlighter starts a 50 ms timer and
27
+ never catches its promise. Dispose the editor inside those 50 ms (re-render a
28
+ view right after focus moves back to it, as an Edit > Undo from the menu bar
29
+ does) and Monaco rejects that promise with its CancellationError, which nothing
30
+ handles. VS Code hides these with its own handler; standalone Monaco has none.
31
+
32
+ The first `initMonaco()` that starts a load now installs one window
33
+ `unhandledrejection` listener. It calls `preventDefault()` only when the
34
+ rejection's reason has `name === 'Canceled'` and `message === 'Canceled'`, which
35
+ is Monaco's CancellationError. Every other rejection still reaches the page and
36
+ its console. The listener is installed once per page, however often
37
+ `initMonaco()` is called or retried, and stays for the life of the page, as
38
+ Monaco does.
39
+
40
+ Until 0.17.6 the browser logged an uncaught `Canceled: Canceled` from
41
+ `Delayer.cancel`. The editor handle's `dispose()` caught only a `Canceled` that
42
+ Monaco's `dispose()` throws at once, not this later one.
43
+ `tests/monaco_cancellation_guard.test.mjs` holds it.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -36,6 +36,44 @@ at the right edge of a window that was not maximized, so those panes had no
36
36
  scrollbar at all (BUG-0036). `tests/autoscroll_resize_handle_not_cover.test.mjs`
37
37
  holds it.
38
38
 
39
+ ## `installOverlayScrollbar` is styled by flexdesk.css (0.17.7)
40
+
41
+ `installOverlayScrollbar(container, { orientation })` (from
42
+ `@flexdesk/widgets`) gives one container its own bar: a
43
+ `.overlay-scrollbar-v` or `.overlay-scrollbar-h` element, holding a `.track`
44
+ and a `.thumb`, appended to the container (or to its parent with
45
+ `externalBar: true`, as `installTabsScrollbars` does). flexdesk.css styles
46
+ it, so it works with only FlexDesk's stylesheets loaded:
47
+
48
+ - **It takes no layout space.** The bar is `position: absolute` at the
49
+ container's right edge (vertical) or bottom edge (horizontal),
50
+ `--scrollbar-size` thick, on `--z-scrollbar` (over the container's content,
51
+ under managed windows). The script keeps it pinned to the visible edge as
52
+ the container scrolls.
53
+ - **It shows on hover while the container overflows.** The script sets
54
+ `data-scrollable="1"` or `"0"` on the container, and shows the bar on
55
+ `mouseenter` and `focusin` when it is `"1"`. It hides the bar on leave,
56
+ unless the thumb is being dragged. The bar starts at `opacity: 0`.
57
+ - **The thumb drags; the rest lets clicks through.** The bar takes no
58
+ pointer events, so content under it stays clickable. The thumb takes them
59
+ back (`pointer-events: auto`) and is at least 30px long.
60
+ - **Colours are tokens** in tokens.css: `--scrollbar-track`,
61
+ `--scrollbar-thumb`, `--scrollbar-thumb-hover`, `--scrollbar-thumb-active`,
62
+ and `--scrollbar-radius` for the rounding. Override them to restyle every
63
+ overlay bar.
64
+
65
+ The rules key on the orientation classes, so a bar created with another
66
+ `className` (`installWorkspaceScrollbars` uses `panel-scrollbar` and
67
+ `tabs-scrollbar`) is styled the same way. `installCollapsibleScrollbars`,
68
+ `installTabsScrollbars` and `installWorkspaceScrollbars` all build on
69
+ `installOverlayScrollbar`, so none of them needs embedder CSS either.
70
+
71
+ Until 0.17.7 no FlexDesk stylesheet had a rule for these classes. The bar
72
+ was `position: static`: it sat in the scroll container's flow, its height fed
73
+ the container's content height, and the container grew without limit unless
74
+ the embedder brought its own CSS (BUG-0039).
75
+ `tests/overlay_scrollbar_styles.test.mjs` holds it.
76
+
39
77
  ## A stack of collapsible sections: `createSectionStack` (0.17.0)
40
78
 
41
79
  Inspector-style panel content: titled sections in a column, each opened and
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/editor.js CHANGED
File without changes
package/flow.js CHANGED
File without changes
package/host.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flexdesk",
3
- "version": "0.17.5",
3
+ "version": "0.17.7",
4
4
  "description": "A tiling window manager and widget set for desktop-class web applications. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -22,7 +22,13 @@ export function setDefaultLanguage(id) {
22
22
  if (typeof id === 'string' && id) _defaultLanguage = id;
23
23
  }
24
24
 
25
- /** Dispose a Monaco editor, swallowing the benign "Canceled" error from pending async ops. */
25
+ /**
26
+ * Dispose a Monaco editor, swallowing a "Canceled" error that `dispose()` throws
27
+ * synchronously. It cannot catch the asynchronous kind — a pending Delayer's
28
+ * promise rejected by the dispose, which surfaces later as an unhandled
29
+ * rejection; the loader's window listener hides those (see
30
+ * `installCancellationGuard` in monaco_loader.js, BUG-0038).
31
+ */
26
32
  function safeDispose(editor) {
27
33
  try { editor.dispose(); } catch (e) { if (e?.message !== 'Canceled') throw e; }
28
34
  }
@@ -38,6 +38,38 @@ let _attempt = null;
38
38
  */
39
39
  export const monacoReady = new Promise(resolve => { _resolveMonaco = resolve; });
40
40
 
41
+ /**
42
+ * Monaco's asynchronous CancellationError is benign; keep it off the page.
43
+ *
44
+ * Monaco starts timers it never awaits: its WordHighlighter calls
45
+ * `runDelayer.trigger()` (a 50 ms Delayer) when an editor gets focus and
46
+ * drops the promise. Dispose the editor inside those 50 ms and
47
+ * `Delayer.dispose() -> cancel()` rejects that promise with a CancellationError
48
+ * (name and message both 'Canceled') that nothing handles, so the browser
49
+ * reports an uncaught 'Canceled' (BUG-0038). VS Code hides these with its own
50
+ * unhandledrejection handler; standalone Monaco has none, so FlexDesk installs
51
+ * one here: it calls preventDefault() for exactly that error and leaves every
52
+ * other rejection to surface as before.
53
+ *
54
+ * Installed once per page, by the first initMonaco() that starts a load, and
55
+ * kept for the life of the page — like Monaco itself, which cannot be unloaded.
56
+ */
57
+ let _cancellationGuardInstalled = false;
58
+
59
+ function isMonacoCancellation(reason) {
60
+ return reason?.name === 'Canceled' && reason?.message === 'Canceled';
61
+ }
62
+
63
+ function installCancellationGuard() {
64
+ if (_cancellationGuardInstalled) return;
65
+ _cancellationGuardInstalled = true;
66
+ // `?.`: the loader suites' stand-in pages (tests/monaco_env.mjs and the
67
+ // suites that set `window = globalThis` under Node) have no event target.
68
+ window.addEventListener?.('unhandledrejection', (event) => {
69
+ if (isMonacoCancellation(event.reason)) event.preventDefault();
70
+ });
71
+ }
72
+
41
73
  function injectLoaderScript(src) {
42
74
  return new Promise((resolve, reject) => {
43
75
  const s = document.createElement('script');
@@ -124,6 +156,10 @@ async function loadMonaco(basePath) {
124
156
  * given). An AMD-level failure is final for the page: every later call gets
125
157
  * the same rejection, and only a reload recovers (see `_attempt`).
126
158
  *
159
+ * The first call that starts a load also installs one window
160
+ * 'unhandledrejection' listener that hides Monaco's benign asynchronous
161
+ * CancellationError, and nothing else (see `installCancellationGuard`).
162
+ *
127
163
  * @param {string} [basePath] Path prefix for the vs/ directory. REQUIRED
128
164
  * unless an attempt is already in flight or has succeeded.
129
165
  * @returns {Promise<typeof monaco>}
@@ -136,6 +172,7 @@ export function initMonaco(basePath) {
136
172
  + "initMonaco('vendor/monaco'). Monaco is a peer dependency; the library "
137
173
  + 'does not guess where you put it.'));
138
174
  }
175
+ installCancellationGuard();
139
176
  const attempt = loadMonaco(basePath).then(
140
177
  (m) => { _resolveMonaco(m); return m; },
141
178
  (err) => {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/host/host.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/tiling/wm.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes