@react-x11/components 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/README.md +95 -34
  2. package/dist/charts/node.d.ts +1 -1
  3. package/dist/charts/node.d.ts.map +1 -1
  4. package/dist/charts/node.js +6 -2
  5. package/dist/charts/node.js.map +1 -1
  6. package/dist/embed/client.d.ts +48 -3
  7. package/dist/embed/client.d.ts.map +1 -1
  8. package/dist/embed/client.js +79 -5
  9. package/dist/embed/client.js.map +1 -1
  10. package/dist/embed/index.d.ts +1 -1
  11. package/dist/embed/index.d.ts.map +1 -1
  12. package/dist/embed/index.js +1 -1
  13. package/dist/embed/index.js.map +1 -1
  14. package/dist/html/node.d.ts +3 -1
  15. package/dist/html/node.d.ts.map +1 -1
  16. package/dist/html/node.js +7 -5
  17. package/dist/html/node.js.map +1 -1
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/{markdown → internal/markdown}/ast.d.ts +12 -0
  23. package/dist/internal/markdown/ast.d.ts.map +1 -0
  24. package/dist/internal/markdown/ast.js +22 -0
  25. package/dist/internal/markdown/ast.js.map +1 -0
  26. package/dist/internal/markdown/parse.d.ts.map +1 -0
  27. package/dist/{markdown → internal/markdown}/parse.js +112 -22
  28. package/dist/internal/markdown/parse.js.map +1 -0
  29. package/dist/internal/markdown/stringify.d.ts +4 -0
  30. package/dist/internal/markdown/stringify.d.ts.map +1 -0
  31. package/dist/internal/markdown/stringify.js +684 -0
  32. package/dist/internal/markdown/stringify.js.map +1 -0
  33. package/dist/internal/markdown/tags.d.ts.map +1 -0
  34. package/dist/internal/markdown/tags.js.map +1 -0
  35. package/dist/internal/scroll.d.ts +3 -2
  36. package/dist/internal/scroll.d.ts.map +1 -1
  37. package/dist/internal/scroll.js +1 -0
  38. package/dist/internal/scroll.js.map +1 -1
  39. package/dist/maps/anchors.d.ts +98 -0
  40. package/dist/maps/anchors.d.ts.map +1 -0
  41. package/dist/maps/anchors.js +531 -0
  42. package/dist/maps/anchors.js.map +1 -0
  43. package/dist/maps/controller.d.ts +283 -0
  44. package/dist/maps/controller.d.ts.map +1 -0
  45. package/dist/maps/controller.js +743 -0
  46. package/dist/maps/controller.js.map +1 -0
  47. package/dist/maps/gl/buckets.d.ts +95 -0
  48. package/dist/maps/gl/buckets.d.ts.map +1 -0
  49. package/dist/maps/gl/buckets.js +362 -0
  50. package/dist/maps/gl/buckets.js.map +1 -0
  51. package/dist/maps/gl/build-worker.d.ts +13 -0
  52. package/dist/maps/gl/build-worker.d.ts.map +1 -0
  53. package/dist/maps/gl/build-worker.js +44 -0
  54. package/dist/maps/gl/build-worker.js.map +1 -0
  55. package/dist/maps/gl/color.d.ts +8 -0
  56. package/dist/maps/gl/color.d.ts.map +1 -0
  57. package/dist/maps/gl/color.js +57 -0
  58. package/dist/maps/gl/color.js.map +1 -0
  59. package/dist/maps/gl/cover.d.ts +51 -0
  60. package/dist/maps/gl/cover.d.ts.map +1 -0
  61. package/dist/maps/gl/cover.js +124 -0
  62. package/dist/maps/gl/cover.js.map +1 -0
  63. package/dist/maps/gl/index.d.ts +3 -0
  64. package/dist/maps/gl/index.d.ts.map +1 -0
  65. package/dist/maps/gl/index.js +20 -0
  66. package/dist/maps/gl/index.js.map +1 -0
  67. package/dist/maps/gl/markers.d.ts +28 -0
  68. package/dist/maps/gl/markers.d.ts.map +1 -0
  69. package/dist/maps/gl/markers.js +60 -0
  70. package/dist/maps/gl/markers.js.map +1 -0
  71. package/dist/maps/gl/overlays.d.ts +68 -0
  72. package/dist/maps/gl/overlays.d.ts.map +1 -0
  73. package/dist/maps/gl/overlays.js +300 -0
  74. package/dist/maps/gl/overlays.js.map +1 -0
  75. package/dist/maps/gl/pane.d.ts +12 -0
  76. package/dist/maps/gl/pane.d.ts.map +1 -0
  77. package/dist/maps/gl/pane.js +37 -0
  78. package/dist/maps/gl/pane.js.map +1 -0
  79. package/dist/maps/gl/placement.d.ts +111 -0
  80. package/dist/maps/gl/placement.d.ts.map +1 -0
  81. package/dist/maps/gl/placement.js +567 -0
  82. package/dist/maps/gl/placement.js.map +1 -0
  83. package/dist/maps/gl/renderer.d.ts +352 -0
  84. package/dist/maps/gl/renderer.d.ts.map +1 -0
  85. package/dist/maps/gl/renderer.js +1127 -0
  86. package/dist/maps/gl/renderer.js.map +1 -0
  87. package/dist/maps/gl/shaders.d.ts +120 -0
  88. package/dist/maps/gl/shaders.d.ts.map +1 -0
  89. package/dist/maps/gl/shaders.js +451 -0
  90. package/dist/maps/gl/shaders.js.map +1 -0
  91. package/dist/maps/gl/store.d.ts +115 -0
  92. package/dist/maps/gl/store.d.ts.map +1 -0
  93. package/dist/maps/gl/store.js +469 -0
  94. package/dist/maps/gl/store.js.map +1 -0
  95. package/dist/maps/gl/text.d.ts +154 -0
  96. package/dist/maps/gl/text.d.ts.map +1 -0
  97. package/dist/maps/gl/text.js +382 -0
  98. package/dist/maps/gl/text.js.map +1 -0
  99. package/dist/maps/gl/view.d.ts +54 -0
  100. package/dist/maps/gl/view.d.ts.map +1 -0
  101. package/dist/maps/gl/view.js +974 -0
  102. package/dist/maps/gl/view.js.map +1 -0
  103. package/dist/maps/index.d.ts +1 -1
  104. package/dist/maps/index.d.ts.map +1 -1
  105. package/dist/maps/index.js +216 -52
  106. package/dist/maps/index.js.map +1 -1
  107. package/dist/maps/labels.d.ts +37 -16
  108. package/dist/maps/labels.d.ts.map +1 -1
  109. package/dist/maps/labels.js +188 -119
  110. package/dist/maps/labels.js.map +1 -1
  111. package/dist/maps/node.d.ts +162 -56
  112. package/dist/maps/node.d.ts.map +1 -1
  113. package/dist/maps/node.js +607 -515
  114. package/dist/maps/node.js.map +1 -1
  115. package/dist/maps/overlay.d.ts +72 -9
  116. package/dist/maps/overlay.d.ts.map +1 -1
  117. package/dist/maps/overlay.js +108 -28
  118. package/dist/maps/overlay.js.map +1 -1
  119. package/dist/maps/paint.d.ts +3 -0
  120. package/dist/maps/paint.d.ts.map +1 -1
  121. package/dist/maps/paint.js.map +1 -1
  122. package/dist/maps/proj.d.ts +14 -0
  123. package/dist/maps/proj.d.ts.map +1 -1
  124. package/dist/maps/proj.js +28 -0
  125. package/dist/maps/proj.js.map +1 -1
  126. package/dist/maps/renderer.d.ts +69 -0
  127. package/dist/maps/renderer.d.ts.map +1 -0
  128. package/dist/maps/renderer.js +66 -0
  129. package/dist/maps/renderer.js.map +1 -0
  130. package/dist/maps/sources.d.ts +25 -3
  131. package/dist/maps/sources.d.ts.map +1 -1
  132. package/dist/maps/sources.js +17 -0
  133. package/dist/maps/sources.js.map +1 -1
  134. package/dist/maps/theme.d.ts +19 -0
  135. package/dist/maps/theme.d.ts.map +1 -0
  136. package/dist/maps/theme.js +44 -0
  137. package/dist/maps/theme.js.map +1 -0
  138. package/dist/maps/tiles.d.ts +117 -17
  139. package/dist/maps/tiles.d.ts.map +1 -1
  140. package/dist/maps/tiles.js +163 -30
  141. package/dist/maps/tiles.js.map +1 -1
  142. package/dist/maps/types.d.ts +188 -20
  143. package/dist/maps/types.d.ts.map +1 -1
  144. package/dist/markdown/expressions.d.ts +1 -1
  145. package/dist/markdown/expressions.d.ts.map +1 -1
  146. package/dist/markdown/expressions.js.map +1 -1
  147. package/dist/markdown/index.d.ts +7 -6
  148. package/dist/markdown/index.d.ts.map +1 -1
  149. package/dist/markdown/index.js +9 -7
  150. package/dist/markdown/index.js.map +1 -1
  151. package/dist/markdown/spans.d.ts +1 -1
  152. package/dist/markdown/spans.d.ts.map +1 -1
  153. package/dist/media-player/index.d.ts +11 -3
  154. package/dist/media-player/index.d.ts.map +1 -1
  155. package/dist/media-player/index.js +13 -2
  156. package/dist/media-player/index.js.map +1 -1
  157. package/dist/rich-text-editor/clipboard.d.ts +23 -0
  158. package/dist/rich-text-editor/clipboard.d.ts.map +1 -0
  159. package/dist/rich-text-editor/clipboard.js +307 -0
  160. package/dist/rich-text-editor/clipboard.js.map +1 -0
  161. package/dist/rich-text-editor/collab.d.ts +32 -0
  162. package/dist/rich-text-editor/collab.d.ts.map +1 -0
  163. package/dist/rich-text-editor/collab.js +55 -0
  164. package/dist/rich-text-editor/collab.js.map +1 -0
  165. package/dist/rich-text-editor/commands.d.ts +50 -0
  166. package/dist/rich-text-editor/commands.d.ts.map +1 -0
  167. package/dist/rich-text-editor/commands.js +376 -0
  168. package/dist/rich-text-editor/commands.js.map +1 -0
  169. package/dist/rich-text-editor/drag.d.ts +68 -0
  170. package/dist/rich-text-editor/drag.d.ts.map +1 -0
  171. package/dist/rich-text-editor/drag.js +148 -0
  172. package/dist/rich-text-editor/drag.js.map +1 -0
  173. package/dist/rich-text-editor/html.d.ts +145 -0
  174. package/dist/rich-text-editor/html.d.ts.map +1 -0
  175. package/dist/rich-text-editor/html.js +516 -0
  176. package/dist/rich-text-editor/html.js.map +1 -0
  177. package/dist/rich-text-editor/index.d.ts +263 -0
  178. package/dist/rich-text-editor/index.d.ts.map +1 -0
  179. package/dist/rich-text-editor/index.js +822 -0
  180. package/dist/rich-text-editor/index.js.map +1 -0
  181. package/dist/rich-text-editor/inline.d.ts +94 -0
  182. package/dist/rich-text-editor/inline.d.ts.map +1 -0
  183. package/dist/rich-text-editor/inline.js +252 -0
  184. package/dist/rich-text-editor/inline.js.map +1 -0
  185. package/dist/rich-text-editor/keymap.d.ts +71 -0
  186. package/dist/rich-text-editor/keymap.d.ts.map +1 -0
  187. package/dist/rich-text-editor/keymap.js +393 -0
  188. package/dist/rich-text-editor/keymap.js.map +1 -0
  189. package/dist/rich-text-editor/keys.d.ts +29 -0
  190. package/dist/rich-text-editor/keys.d.ts.map +1 -0
  191. package/dist/rich-text-editor/keys.js +93 -0
  192. package/dist/rich-text-editor/keys.js.map +1 -0
  193. package/dist/rich-text-editor/look.d.ts +71 -0
  194. package/dist/rich-text-editor/look.d.ts.map +1 -0
  195. package/dist/rich-text-editor/look.js +342 -0
  196. package/dist/rich-text-editor/look.js.map +1 -0
  197. package/dist/rich-text-editor/markdown.d.ts +18 -0
  198. package/dist/rich-text-editor/markdown.d.ts.map +1 -0
  199. package/dist/rich-text-editor/markdown.js +496 -0
  200. package/dist/rich-text-editor/markdown.js.map +1 -0
  201. package/dist/rich-text-editor/nodes.d.ts +135 -0
  202. package/dist/rich-text-editor/nodes.d.ts.map +1 -0
  203. package/dist/rich-text-editor/nodes.js +397 -0
  204. package/dist/rich-text-editor/nodes.js.map +1 -0
  205. package/dist/rich-text-editor/render.d.ts +68 -0
  206. package/dist/rich-text-editor/render.d.ts.map +1 -0
  207. package/dist/rich-text-editor/render.js +500 -0
  208. package/dist/rich-text-editor/render.js.map +1 -0
  209. package/dist/rich-text-editor/schema.d.ts +16 -0
  210. package/dist/rich-text-editor/schema.d.ts.map +1 -0
  211. package/dist/rich-text-editor/schema.js +386 -0
  212. package/dist/rich-text-editor/schema.js.map +1 -0
  213. package/dist/rich-text-editor/store.d.ts +11 -0
  214. package/dist/rich-text-editor/store.d.ts.map +1 -0
  215. package/dist/rich-text-editor/store.js +43 -0
  216. package/dist/rich-text-editor/store.js.map +1 -0
  217. package/dist/rich-text-editor/suggest.d.ts +127 -0
  218. package/dist/rich-text-editor/suggest.d.ts.map +1 -0
  219. package/dist/rich-text-editor/suggest.js +0 -0
  220. package/dist/rich-text-editor/suggest.js.map +1 -0
  221. package/dist/rich-text-editor/tables.d.ts +41 -0
  222. package/dist/rich-text-editor/tables.d.ts.map +1 -0
  223. package/dist/rich-text-editor/tables.js +204 -0
  224. package/dist/rich-text-editor/tables.js.map +1 -0
  225. package/dist/rich-text-editor/toolbar.d.ts +58 -0
  226. package/dist/rich-text-editor/toolbar.d.ts.map +1 -0
  227. package/dist/rich-text-editor/toolbar.js +548 -0
  228. package/dist/rich-text-editor/toolbar.js.map +1 -0
  229. package/dist/rich-text-editor/view.d.ts +368 -0
  230. package/dist/rich-text-editor/view.d.ts.map +1 -0
  231. package/dist/rich-text-editor/view.js +1968 -0
  232. package/dist/rich-text-editor/view.js.map +1 -0
  233. package/dist/rich-text-editor/virtual.d.ts +54 -0
  234. package/dist/rich-text-editor/virtual.d.ts.map +1 -0
  235. package/dist/rich-text-editor/virtual.js +262 -0
  236. package/dist/rich-text-editor/virtual.js.map +1 -0
  237. package/dist/richtext/node.d.ts +25 -2
  238. package/dist/richtext/node.d.ts.map +1 -1
  239. package/dist/richtext/node.js +46 -24
  240. package/dist/richtext/node.js.map +1 -1
  241. package/dist/terminal/backends.d.ts +4 -1
  242. package/dist/terminal/backends.d.ts.map +1 -1
  243. package/dist/terminal/backends.js.map +1 -1
  244. package/dist/terminal/index.d.ts +18 -7
  245. package/dist/terminal/index.d.ts.map +1 -1
  246. package/dist/terminal/index.js +28 -11
  247. package/dist/terminal/index.js.map +1 -1
  248. package/package.json +23 -4
  249. package/src/charts/node.ts +6 -2
  250. package/src/embed/client.ts +102 -8
  251. package/src/embed/index.ts +2 -0
  252. package/src/html/node.ts +7 -5
  253. package/src/index.ts +2 -0
  254. package/src/{markdown → internal/markdown}/ast.ts +24 -7
  255. package/src/{markdown → internal/markdown}/parse.ts +134 -24
  256. package/src/internal/markdown/stringify.ts +772 -0
  257. package/src/internal/scroll.ts +5 -3
  258. package/src/maps/anchors.ts +607 -0
  259. package/src/maps/controller.ts +999 -0
  260. package/src/maps/gl/buckets.ts +457 -0
  261. package/src/maps/gl/build-worker.ts +55 -0
  262. package/src/maps/gl/color.ts +62 -0
  263. package/src/maps/gl/cover.ts +170 -0
  264. package/src/maps/gl/index.ts +23 -0
  265. package/src/maps/gl/markers.ts +83 -0
  266. package/src/maps/gl/overlays.ts +379 -0
  267. package/src/maps/gl/pane.ts +42 -0
  268. package/src/maps/gl/placement.ts +816 -0
  269. package/src/maps/gl/renderer.ts +1576 -0
  270. package/src/maps/gl/shaders.ts +486 -0
  271. package/src/maps/gl/store.ts +566 -0
  272. package/src/maps/gl/text.ts +495 -0
  273. package/src/maps/gl/view.ts +1224 -0
  274. package/src/maps/index.ts +270 -81
  275. package/src/maps/labels.ts +214 -121
  276. package/src/maps/node.ts +763 -629
  277. package/src/maps/overlay.ts +148 -43
  278. package/src/maps/paint.ts +3 -0
  279. package/src/maps/proj.ts +31 -0
  280. package/src/maps/renderer.ts +155 -0
  281. package/src/maps/sources.ts +38 -3
  282. package/src/maps/theme.ts +51 -0
  283. package/src/maps/tiles.ts +191 -33
  284. package/src/maps/types.ts +188 -20
  285. package/src/markdown/expressions.ts +5 -1
  286. package/src/markdown/index.ts +14 -11
  287. package/src/markdown/spans.ts +1 -1
  288. package/src/media-player/index.ts +18 -4
  289. package/src/rich-text-editor/clipboard.ts +439 -0
  290. package/src/rich-text-editor/collab.ts +91 -0
  291. package/src/rich-text-editor/commands.ts +448 -0
  292. package/src/rich-text-editor/dom-globals.d.ts +23 -0
  293. package/src/rich-text-editor/drag.ts +211 -0
  294. package/src/rich-text-editor/html.ts +619 -0
  295. package/src/rich-text-editor/index.ts +1331 -0
  296. package/src/rich-text-editor/inline.ts +345 -0
  297. package/src/rich-text-editor/keymap.ts +510 -0
  298. package/src/rich-text-editor/keys.ts +119 -0
  299. package/src/rich-text-editor/look.ts +427 -0
  300. package/src/rich-text-editor/markdown.ts +653 -0
  301. package/src/rich-text-editor/nodes.ts +497 -0
  302. package/src/rich-text-editor/render.ts +800 -0
  303. package/src/rich-text-editor/schema.ts +431 -0
  304. package/src/rich-text-editor/store.ts +39 -0
  305. package/src/rich-text-editor/suggest.ts +597 -0
  306. package/src/rich-text-editor/tables.ts +272 -0
  307. package/src/rich-text-editor/toolbar.ts +724 -0
  308. package/src/rich-text-editor/view.ts +2287 -0
  309. package/src/rich-text-editor/virtual.ts +347 -0
  310. package/src/richtext/node.ts +59 -30
  311. package/src/terminal/backends.ts +4 -1
  312. package/src/terminal/index.ts +43 -15
  313. package/dist/markdown/ast.d.ts.map +0 -1
  314. package/dist/markdown/ast.js +0 -17
  315. package/dist/markdown/ast.js.map +0 -1
  316. package/dist/markdown/parse.d.ts.map +0 -1
  317. package/dist/markdown/parse.js.map +0 -1
  318. package/dist/markdown/tags.d.ts.map +0 -1
  319. package/dist/markdown/tags.js.map +0 -1
  320. /package/dist/{markdown → internal/markdown}/parse.d.ts +0 -0
  321. /package/dist/{markdown → internal/markdown}/tags.d.ts +0 -0
  322. /package/dist/{markdown → internal/markdown}/tags.js +0 -0
  323. /package/src/{markdown → internal/markdown}/tags.ts +0 -0
package/src/maps/types.ts CHANGED
@@ -27,6 +27,28 @@ export type {
27
27
  Zoomed,
28
28
  } from './style.js';
29
29
 
30
+ /** Which renderer draws a map — see `<Map renderer>`. */
31
+ export type MapRenderer = 'gl' | 'retained';
32
+
33
+ /**
34
+ * What `<Map renderer>` asks for: one of the two renderers, or `'auto'` —
35
+ * GL wherever this connection has direct GL, and the retained renderer
36
+ * everywhere else.
37
+ */
38
+ export type MapRendererRequest = 'auto' | MapRenderer;
39
+
40
+ /** Why a map is drawn with the renderer it is, when that is not what it
41
+ * asked for. */
42
+ export type MapRendererReason =
43
+ /** The connection has no direct GL — indirect GLX, or none at all —
44
+ * so `useSupports('shaders')` is false. */
45
+ | 'no-direct-gl'
46
+ /** GL failed at run time: no surface, a context that would not create, a
47
+ * shader that would not compile, a throw from a frame. */
48
+ | 'gl-failed'
49
+ /** `REACT_X11_MAP_RENDERER` chose it. */
50
+ | 'forced';
51
+
30
52
  /** Where a pointer event happened, in every space that could be wanted. */
31
53
  export interface MapPointerEvent {
32
54
  /** Geographic. */
@@ -45,18 +67,28 @@ export interface MapPointerEvent {
45
67
  button: number;
46
68
  }
47
69
 
48
- /** What one frame cost — for a performance HUD, and what
49
- * `scripts/bench/maps.ts` reads. */
70
+ /**
71
+ * What one frame cost — for a performance HUD, and what the benches read.
72
+ *
73
+ * The fields both renderers have are named the same; the ones only one of
74
+ * them has are optional, and present on that renderer's frames.
75
+ */
50
76
  export interface MapFrameStats {
77
+ /** Which renderer drew the frame. */
78
+ renderer: MapRenderer;
51
79
  /** Milliseconds spent rasterizing tiles into their surfaces this frame.
52
- * Bounded by `rasterBudgetMs` except for the one run that crossed it. */
80
+ * Bounded by `rasterBudgetMs` except for the one run that crossed it.
81
+ * Always `0` on the GL renderer, which rasterizes nothing. */
53
82
  rasterMs: number;
54
- /** …and compositing them, drawing the labels, overlays and markers. */
83
+ /** The rest of the frame on this thread: compositing tiles and drawing
84
+ * the labels, overlays and markers (retained), or issuing the frame's GL
85
+ * calls and placing its labels (GL — the GPU's own time is not in it). */
55
86
  drawMs: number;
56
87
  /** Tiles the cover asked for. */
57
88
  tiles: number;
58
- /** …of which were composited from their own finished surface. Under
59
- * `progressive` this also counts the half-drawn ones. */
89
+ /** …of which were drawn from their own data: a finished surface
90
+ * (retained; under `progressive` the half-drawn ones too) or their own
91
+ * geometry (GL). */
60
92
  ready: number;
61
93
  /** …and how many were drawn from a coarser ancestor instead, scaled up.
62
94
  * What covers a hole while zooming *in*. */
@@ -64,9 +96,19 @@ export interface MapFrameStats {
64
96
  /** …and how many from their finer descendants, scaled down. What covers
65
97
  * a hole while zooming *out*, where there is no ancestor to borrow. */
66
98
  fromDescendant: number;
67
- /** Tiles still to rasterize — non-zero means the map is still sharpening
68
- * and another frame is already scheduled. */
99
+ /** Tiles still to rasterize (retained) or to build (GL) — non-zero means
100
+ * the map is still sharpening and another frame is already scheduled. */
69
101
  pending: number;
102
+ /**
103
+ * Whether what is on screen is the previous style.
104
+ *
105
+ * True from a `mapStyle` change or `refresh()` until the swap: the new
106
+ * style is drawn behind the old picture — tiles, background and labels —
107
+ * and replaces all of it in one frame, so the map never shows the two at
108
+ * once. The first frame it is false again is the one that swapped. Never
109
+ * true under `progressive`, which shows the repaint as it happens.
110
+ */
111
+ restyling: boolean;
70
112
  /** Labels placed, and labels drawn. */
71
113
  labels: number;
72
114
  /**
@@ -77,10 +119,12 @@ export interface MapFrameStats {
77
119
  * difference is not something a user can see.
78
120
  */
79
121
  errors: number;
80
- /** Bytes of rendered surfaces the cache is holding. */
122
+ /** Bytes of rendered surfaces the cache is holding. `0` on the GL
123
+ * renderer, whose tiles are geometry — its bytes are `gl.gpuBytes`. */
81
124
  surfaceBytes: number;
82
125
  /**
83
- * What this pass repainted, in device pixels, or `null` for a full one.
126
+ * What this pass repainted, in device pixels, or `null` for a full one —
127
+ * which every GL frame is.
84
128
  *
85
129
  * The number to watch when a map looks busy: a frame that is only
86
130
  * continuing a rasterization should claim almost nothing, because the
@@ -90,7 +134,8 @@ export interface MapFrameStats {
90
134
  * many frames a second reads as flashing.
91
135
  */
92
136
  damage: { x: number; y: number; width: number; height: number } | null;
93
- /** What the rasterizer did, summed over the tiles drawn this frame. */
137
+ /** What the rasterizer did, summed over the tiles drawn this frame. All
138
+ * zeros on the GL renderer. */
94
139
  draw: {
95
140
  features: number;
96
141
  vertices: number;
@@ -98,6 +143,57 @@ export interface MapFrameStats {
98
143
  culled: number;
99
144
  batches: number;
100
145
  };
146
+ /** GL only: what the frame cost on the GPU's side of the thread. */
147
+ gl?: MapGlFrameStats;
148
+ }
149
+
150
+ /** What a GL frame cost, beyond what both renderers report. */
151
+ export interface MapGlFrameStats {
152
+ /** Milliseconds since the frame before — what a frame rate is made of. */
153
+ interval: number;
154
+ /** Milliseconds this thread spent issuing the frame's GL calls. */
155
+ cpuMs: number;
156
+ /** …building tiles' geometry, when the builds are on this thread. */
157
+ buildMs: number;
158
+ /** Tiles loaded and waiting for a build, and tiles still loading. */
159
+ building: number;
160
+ loading: number;
161
+ /** Bytes of tile geometry on the GPU. */
162
+ gpuBytes: number;
163
+ /** Segment instances drawn, every pass counted — the frame's work. */
164
+ instances: number;
165
+ drawCalls: number;
166
+ /** Tiles uploaded to the GPU this frame, and their bytes. */
167
+ uploads: number;
168
+ uploadBytes: number;
169
+ /** Whether the frame was drawn through an offscreen framebuffer — which
170
+ * a surface with no stencil buffer of its own needs. */
171
+ offscreen: boolean;
172
+ /** The pyramid level the view is drawn from, and the one fully shown:
173
+ * they differ while a level fades in (`levelFade`). */
174
+ level: number;
175
+ shownLevel: number;
176
+ /** How much of the arriving level was faded in; `0` with no fade. */
177
+ fade: number;
178
+ /** The adaptive-quality rung the frame was drawn at: `0` is everything,
179
+ * higher leaves more out (`adaptive`). */
180
+ quality: number;
181
+ /** What adaptive quality predicted a moving frame would cost, in ms, or
182
+ * `0` for a frame it did not price. */
183
+ predictedMs: number;
184
+ /** A settled frame's own time, drained and finished — what the cost
185
+ * model learns from — or `0`. Moving frames are never timed. */
186
+ measuredMs: number;
187
+ /** Whether the camera moved within the settle window. */
188
+ moving: boolean;
189
+ /** Label anchors considered, and labels placed, this frame. */
190
+ labelCandidates: number;
191
+ labelsPlaced: number;
192
+ /** Milliseconds this thread spent on labels: placing them, and measuring
193
+ * strings it had not measured before. */
194
+ labelMs: number;
195
+ /** Label text still waiting to be rasterized. */
196
+ textPending: boolean;
101
197
  }
102
198
 
103
199
  /** Options for framing a box. */
@@ -140,6 +236,11 @@ export interface MapViewProps {
140
236
  * Where tiles come from, drawn in order — a basemap, then an overlay
141
237
  * pyramid over it. Empty draws the style's background and nothing else,
142
238
  * which is what a map with only markers on it wants.
239
+ *
240
+ * Tiles are cached per source **object**, whatever its `id`: switching
241
+ * to another source shows only its tiles, and switching back finds the
242
+ * first one's still cached. So keep each source stable across renders —
243
+ * one made anew every render fetches every tile again every render.
143
244
  */
144
245
  sources?: readonly MapSource[];
145
246
  /** How to draw them. Defaults to {@link shortbreadStyle} in the theme's
@@ -187,11 +288,15 @@ export interface MapViewProps {
187
288
  * road casings, then roads, across a dozen frames — which is honest about
188
289
  * what the renderer is doing and does not look like a map.
189
290
  *
190
- * The one thing the default costs is a transition that invalidates every
191
- * surface at once: a `mapStyle` change, `refresh()`, or a display-scale
192
- * change leaves no finished tile *and* no finished ancestor, so the map
193
- * drops to its background colour until the new tiles land. `true` shows
194
- * it repainting instead.
291
+ * The difference is widest at a `mapStyle` change or `refresh()`, which
292
+ * redraws every tile at once. By default the previous style stays on
293
+ * screen whole — tiles, background and labels — while the new one is
294
+ * drawn behind it, and the view swaps in one frame once every tile in it
295
+ * that has data is redrawn; a tile still loading does not hold the swap.
296
+ * If the view keeps moving meanwhile, the wait is bounded, and a tile not
297
+ * redrawn by then shows the background until it is. `true` shows the
298
+ * repaint instead: the new background and labels at once, and each tile
299
+ * as it is redrawn.
195
300
  */
196
301
  progressive?: boolean;
197
302
  /**
@@ -249,12 +354,75 @@ export interface MapViewProps {
249
354
  ref?: Ref<unknown>;
250
355
  }
251
356
 
357
+ /**
358
+ * What only the GL renderer reads. Accepted by the retained renderer and
359
+ * ignored there, as the retained renderer's own — `progressive`,
360
+ * `rasterBudgetMs`, `rasterScale`, `surfaceBudget`, `batchVertices` — are
361
+ * ignored by GL: switching renderer is never a type error or a rewrite.
362
+ */
363
+ export interface MapGlProps {
364
+ /**
365
+ * Cross-fade between pyramid levels over this many milliseconds, instead
366
+ * of switching to the new level's geometry in one frame. `0` (the
367
+ * default) switches. While a level fades in the frame is drawn twice —
368
+ * the level leaving, and the level arriving over it.
369
+ */
370
+ levelFade?: number;
371
+ /**
372
+ * Trade detail for frame rate while the camera moves. `true` holds each
373
+ * moving frame to 12 ms; `{ budgetMs }` to another budget. When the camera
374
+ * settles the next frame draws everything again.
375
+ */
376
+ adaptive?: boolean | { budgetMs?: number };
377
+ /** Build tiles' geometry on this many worker threads, so no frame pays
378
+ * for a tile arriving. `0` (the default) builds on this thread, a few
379
+ * milliseconds a frame. */
380
+ buildWorkers?: number;
381
+ /** Antialias polygon edges with a half-pixel line. `true` by default; the
382
+ * surfaces have no multisampling, so without it an edge is a staircase. */
383
+ antialias?: boolean;
384
+ /** `'nonzero'` (the default, and the retained renderer's rule) or
385
+ * `'evenodd'`, one stencil pass cheaper and wrong wherever two features
386
+ * of one layer overlap. */
387
+ fillRule?: 'nonzero' | 'evenodd';
388
+ /**
389
+ * Raw GL after the map has drawn and before the swap, with the frame's
390
+ * framebuffer bound. What a test or a screenshot reads a frame back
391
+ * through: a capture of the window from outside does not see a GL surface
392
+ * on either backend.
393
+ */
394
+ onAfterDraw?: (gl: unknown, info: { width: number; height: number }) => void;
395
+ }
396
+
252
397
  /** What `<Map>` takes. */
253
- export interface MapProps extends Omit<MapViewProps, 'ref'> {
398
+ export interface MapProps extends Omit<MapViewProps, 'ref'>, MapGlProps {
254
399
  ref?: Ref<MapHandle>;
400
+ /**
401
+ * Which renderer draws the map: `'retained'` composites rasterized tile
402
+ * pictures and runs anywhere; `'gl'` draws every frame from the vector
403
+ * data on the GPU, and needs direct GL; `'auto'`, the default, takes GL
404
+ * where the connection has it and the retained renderer everywhere else.
405
+ * `REACT_X11_MAP_RENDERER` overrides it for every map. See the docs page's
406
+ * "Renderers".
407
+ */
408
+ renderer?: MapRendererRequest;
409
+ /** The map is drawn with a renderer other than the one it asked for, or
410
+ * changed renderer: `'auto'` finding no direct GL, or GL failing at run
411
+ * time. The camera and the handle carry over. */
412
+ onRendererChange?: (renderer: MapRenderer, reason: MapRendererReason) => void;
413
+ /**
414
+ * GL failed, on a map that asked for it by name (`renderer="gl"`). Such a
415
+ * map never falls back — an application that asked for GL wants to know it
416
+ * did not get it — so this is where it finds out; under `'auto'` a failure
417
+ * moves the map to the retained renderer and says so through
418
+ * `onRendererChange` instead.
419
+ */
420
+ onError?: (error: Error) => void;
255
421
  /** Anything absolutely positioned over the map — a legend, a control
256
- * panel. Laid out as siblings of the drawn pane rather than inside it,
257
- * because a registered element paints its children *before* its own
258
- * drawing and anything inside would be painted over. */
422
+ * panel. On the retained renderer they are siblings of the drawn pane
423
+ * rather than inside it, because a registered element paints its
424
+ * children *before* its own drawing and anything inside would be painted
425
+ * over; on GL they go inside the surface, whose children core draws
426
+ * above it — opaquely on X11, so give a legend a background of its own. */
259
427
  children?: ReactNode;
260
428
  }
@@ -15,7 +15,11 @@
15
15
  // in as few words as they can: do not pass `scope` alongside a document you
16
16
  // did not write.
17
17
 
18
- import type { BlockNode, Document, InlineNode } from './ast.js';
18
+ import type {
19
+ BlockNode,
20
+ Document,
21
+ InlineNode,
22
+ } from '../internal/markdown/ast.js';
19
23
 
20
24
  /** A compiled expression, or null if it would not compile at all. */
21
25
  type Compiled = ((...args: unknown[]) => unknown) | null;
@@ -10,8 +10,10 @@
10
10
  // pipeline is remark → rehype → DOM with Tailwind classes — an HTML pass
11
11
  // and a DOM renderer, neither of which exists here. What was worth taking
12
12
  // was taken: its `remend` package's unterminated-markdown behaviour is
13
- // implemented natively by `parse.ts`, as parser tolerance rather than a
14
- // repair pre-pass (one pass instead of repair-then-reparse).
13
+ // implemented natively by `src/internal/markdown/parse.ts`, as parser
14
+ // tolerance rather than a repair pre-pass (one pass instead of
15
+ // repair-then-reparse). The parser is shared with `<RichTextEditor>`, which
16
+ // reads and writes the same markdown this renders.
15
17
  //
16
18
  // So: `parse.ts` → AST → this file renders `<box>` structure with one
17
19
  // `<richtext>` per run of inline text, inside one `selectable` root. During
@@ -51,7 +53,7 @@ import type {
51
53
  InlineNode,
52
54
  ListBlock,
53
55
  TableBlock,
54
- } from './ast.js';
56
+ } from '../internal/markdown/ast.js';
55
57
  import {
56
58
  registerRichText,
57
59
  RICHTEXT_ELEMENT,
@@ -67,10 +69,10 @@ import {
67
69
  import type { CodeBlockLook } from '../codeblock/index.js';
68
70
  import type { Language } from '../code-language/index.js';
69
71
 
70
- import { parse } from './parse.js';
72
+ import { parse } from '../internal/markdown/parse.js';
71
73
  import { evaluator, resolveExpressions } from './expressions.js';
72
74
  import type { Evaluate } from './expressions.js';
73
- import { SPREAD_PREFIX } from './ast.js';
75
+ import { SPREAD_PREFIX } from '../internal/markdown/ast.js';
74
76
  import { runsOf, plainTextOf } from './spans.js';
75
77
  import type { InlineStyles } from './spans.js';
76
78
  import { useLinkClicks } from '../richtext/index.js';
@@ -85,11 +87,11 @@ export type {
85
87
  InlineNode,
86
88
  Document as MarkdownDocument,
87
89
  ParseOptions,
88
- } from './ast.js';
89
- export { SPREAD_PREFIX } from './ast.js';
90
- export { scanTag } from './tags.js';
91
- export type { ScannedTag, ScanResult } from './tags.js';
92
- export { parse, parseInline } from './parse.js';
90
+ } from '../internal/markdown/ast.js';
91
+ export { SPREAD_PREFIX } from '../internal/markdown/ast.js';
92
+ export { scanTag } from '../internal/markdown/tags.js';
93
+ export type { ScannedTag, ScanResult } from '../internal/markdown/tags.js';
94
+ export { parse, parseInline } from '../internal/markdown/parse.js';
93
95
 
94
96
  const h = React.createElement;
95
97
 
@@ -190,7 +192,8 @@ export interface MarkdownProps {
190
192
  * usual case.
191
193
  *
192
194
  * Block position only: a tag on its own line(s) is a component, and one in
193
- * the middle of a sentence is still text. See `ComponentInline` in ast.ts.
195
+ * the middle of a sentence is still text. See `ComponentInline` in
196
+ * src/internal/markdown/ast.ts.
194
197
  *
195
198
  * Give the map a stable identity — a new object per render defeats the
196
199
  * block cache, the same way a new `fences` map does.
@@ -1,7 +1,7 @@
1
1
  // Inline AST → the styled runs `<richtext>` renders. Pure: all the colour
2
2
  // and font decisions arrive in `InlineStyles`, which `index.ts` derives
3
3
  // from the theme once per render.
4
- import type { InlineNode } from './ast.js';
4
+ import type { InlineNode } from '../internal/markdown/ast.js';
5
5
  import type { TextRun } from '../richtext/node.js';
6
6
 
7
7
  /** The resolved look of inline text, for one block. */
@@ -32,12 +32,13 @@ import React, {
32
32
  useState,
33
33
  } from 'react';
34
34
  import type { ReactElement, ReactNode, Ref } from 'react';
35
- import { useTheme } from 'react-x11';
35
+ import { useApp, useTheme } from 'react-x11';
36
36
  import type { ForeignProps } from 'react-x11';
37
37
  import type { Style } from 'react-x11/style';
38
38
 
39
39
  import {
40
40
  BackendUnavailableError,
41
+ canHostXEmbed,
41
42
  resolveBackend,
42
43
  useEmbeddedClient,
43
44
  } from '../embed/index.js';
@@ -129,10 +130,13 @@ export interface MediaPlayerProps {
129
130
  onPlayingChange?: (playing: boolean) => void;
130
131
  /** The player process ended. */
131
132
  onExit?: (info: ExitInfo) => void;
132
- /** Spawn failures, control-channel failures, and the
133
- * `BackendUnavailableError` for a machine with neither player installed. */
133
+ /** Spawn failures, control-channel failures, the `BackendUnavailableError`
134
+ * for a machine with neither player installed, and the
135
+ * `EmbedUnsupportedError` for a react-x11 backend that cannot embed a
136
+ * player's window at all. */
134
137
  onError?: (err: Error) => void;
135
- /** Rendered instead of the surface when no backend is installed. */
138
+ /** Rendered instead of the surface when no player is available — none
139
+ * installed, or none can be embedded on this react-x11 backend. */
136
140
  fallback?: ReactNode;
137
141
  /** False holds off spawning entirely. */
138
142
  enabled?: boolean;
@@ -164,6 +168,11 @@ export interface MediaPlayerProps {
164
168
  *
165
169
  * The player's window stacks above everything drawn in this one, so nothing 2D
166
170
  * can overlap it — see "Controls" at the top of this file.
171
+ *
172
+ * **X11 only.** Both players are embedded by window id, which is XEmbed's
173
+ * mechanism; on a react-x11 backend with none — the native macOS one — the
174
+ * player is `'unavailable'` from the first render and `fallback` shows,
175
+ * rather than a player spawned at a window id that does not exist.
167
176
  */
168
177
  export function MediaPlayer(props: MediaPlayerProps): ReactElement {
169
178
  const {
@@ -174,6 +183,7 @@ export function MediaPlayer(props: MediaPlayerProps): ReactElement {
174
183
  stopSignal,
175
184
  } = props;
176
185
  const theme = useTheme() as unknown as Record<string, unknown>;
186
+ const embeddable = canHostXEmbed(useApp());
177
187
 
178
188
  const control = useRef<PlayerControl | null>(null);
179
189
  // Bumped when a control channel opens or closes. The prop-syncing effects
@@ -358,6 +368,10 @@ export function MediaPlayer(props: MediaPlayerProps): ReactElement {
358
368
  if (client.status === 'unavailable' && props.fallback !== undefined) {
359
369
  return h(React.Fragment, null, props.fallback);
360
370
  }
371
+ // No XEmbed on this app, and no `fallback`: an empty box holds the layout
372
+ // rather than a `<foreign>` with no socket to be — see the same branch in
373
+ // `../terminal/index.ts`.
374
+ if (!embeddable) return hx('box', { style: styles });
361
375
 
362
376
  const foreign: ForeignElementProps = {
363
377
  onReady: client.handleReady,