@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
@@ -0,0 +1,352 @@
1
+ import type { PreparedStyle } from '../paint.js';
2
+ import type { GlTileData } from './buckets.js';
3
+ import type { Rgba } from './color.js';
4
+ import type { MarkerBatch } from './markers.js';
5
+ import type { OverlayPass } from './overlays.js';
6
+ import type { LabelBatch } from './placement.js';
7
+ import type { GL } from './shaders.js';
8
+ /** A rectangle in device pixels, top-left origin. */
9
+ export interface DeviceRect {
10
+ x: number;
11
+ y: number;
12
+ width: number;
13
+ height: number;
14
+ }
15
+ /** One tile's data placed on screen. */
16
+ export interface RenderTile {
17
+ data: GlTileData;
18
+ /** Where the data tile's square lands, in device pixels: its top-left
19
+ * corner and its edge length. */
20
+ x: number;
21
+ y: number;
22
+ size: number;
23
+ /**
24
+ * The part of the viewport this tile draws into. Its own square, unless
25
+ * it is standing in for a tile that has no data yet — an ancestor scaled
26
+ * up, drawn only over the square it covers for.
27
+ */
28
+ clip: DeviceRect;
29
+ }
30
+ /** Everything a frame is drawn from. */
31
+ export interface RenderFrame {
32
+ /** Device pixels. */
33
+ width: number;
34
+ height: number;
35
+ /** The camera zoom: what zoom ramps and layer ranges resolve at. */
36
+ zoom: number;
37
+ /** Device pixels per logical pixel: what style lengths are multiplied by. */
38
+ scale: number;
39
+ style: PreparedStyle;
40
+ background?: string;
41
+ /**
42
+ * Each source's tiles, in the map's order — a basemap, then a pyramid
43
+ * over it. Each is drawn whole, layer-major, before the next, which is
44
+ * how the retained renderer lays one source's tiles over another's.
45
+ */
46
+ sources: readonly (readonly RenderTile[])[];
47
+ /**
48
+ * Leave out the style layers that begin within this many levels of the
49
+ * zoom: a layer whose `minZoom` is above `zoom - detail` is skipped. `0`
50
+ * (the default) draws what the style says.
51
+ *
52
+ * The layers a style brings in last as the map zooms in are its details —
53
+ * buildings, service roads, paths, sites — so this drops exactly those, in
54
+ * that order, and it needs nothing from the style that the style has not
55
+ * already said.
56
+ */
57
+ detail?: number;
58
+ /** The fill edge pass for this frame, over the renderer's `antialias`. */
59
+ edges?: boolean;
60
+ }
61
+ /** A second scene, and how much of it to show over the first. */
62
+ export interface FadeFrame {
63
+ frame: RenderFrame;
64
+ /** `0` shows only the base scene, `1` only this one. */
65
+ alpha: number;
66
+ }
67
+ /**
68
+ * The attribution: a box of the theme's background, and the text in it —
69
+ * one label's worth of instance data from the labels' atlas, set level and
70
+ * on whole pixels.
71
+ */
72
+ export interface AttributionDraw {
73
+ /** Device pixels, top-left origin. */
74
+ box: DeviceRect;
75
+ /** Premultiplied, its opacity folded in. */
76
+ boxColor: Rgba;
77
+ text: LabelBatch;
78
+ }
79
+ /** The overlays' bucket, and where its units land this frame. */
80
+ export interface OverlayDraw {
81
+ data: GlTileData;
82
+ passes: readonly OverlayPass[];
83
+ /** Device pixels per unit of the bucket's records. */
84
+ unit: number;
85
+ /** Where the bucket's origin lands, in device pixels. */
86
+ x: number;
87
+ y: number;
88
+ }
89
+ /** What a frame draws over its scene, in this order. */
90
+ export interface RenderExtras {
91
+ /** A second scene, faded in over the first. */
92
+ fade?: FadeFrame | null;
93
+ /** The labels, over both. */
94
+ labels?: LabelBatch | null;
95
+ /** The overlays, over the labels — where the retained renderer draws
96
+ * them. */
97
+ overlays?: OverlayDraw | null;
98
+ /** The markers, over the labels — where the retained renderer draws
99
+ * them, a marker being what the user aims at. */
100
+ markers?: MarkerBatch | null;
101
+ /** The attribution, over everything — drawn last, as the retained
102
+ * renderer draws it. */
103
+ attribution?: AttributionDraw | null;
104
+ }
105
+ export interface GlRenderOptions {
106
+ /**
107
+ * Draw each polygon's boundary as a half-pixel antialiased line after the
108
+ * fill. `true` by default. There is no multisampling on these surfaces
109
+ * (x11-dri exposes no `renderbufferStorageMultisample`), so without it a
110
+ * fill's edge is a staircase; this is the same trade MapLibre's
111
+ * `fill-antialias` makes.
112
+ */
113
+ antialias?: boolean;
114
+ /**
115
+ * `'nonzero'` (the default) is the rule the retained renderer fills with,
116
+ * and costs two stencil passes, one per facing — or one, on a GL table
117
+ * with `stencilOpSeparate` (x11-dri 0.8, and the Cocoa backend's), which
118
+ * counts both facings in the same draw. `'evenodd'` is one pass —
119
+ * and wrong wherever two features of one layer overlap, which real
120
+ * landuse does: the overlap is cut out as if it were a hole.
121
+ */
122
+ fillRule?: 'nonzero' | 'evenodd';
123
+ /**
124
+ * Draw into an offscreen framebuffer and copy it to the surface. `'auto'`
125
+ * (the default) does that only when the surface has no stencil buffer —
126
+ * which is XQuartz's Apple-DRI surface today, whose context ntk creates
127
+ * without one.
128
+ */
129
+ offscreen?: 'auto' | boolean;
130
+ }
131
+ /** What one frame cost, and what it drew. */
132
+ export interface GlRenderStats {
133
+ tiles: number;
134
+ layers: number;
135
+ drawCalls: number;
136
+ /** Segment instances drawn, every pass counted — the frame's work. */
137
+ instances: number;
138
+ /** Tiles uploaded this frame, and their bytes. */
139
+ uploads: number;
140
+ uploadBytes: number;
141
+ /** Milliseconds on this thread issuing the frame — not the GPU's time. */
142
+ cpuMs: number;
143
+ offscreen: boolean;
144
+ /** How much of a second scene was faded in; `0` when there was none. */
145
+ fade: number;
146
+ /** Labels drawn. */
147
+ labels: number;
148
+ /** Markers drawn. */
149
+ markers: number;
150
+ /** Overlay passes drawn — a line with a casing is two. */
151
+ overlays: number;
152
+ }
153
+ /**
154
+ * A style's or an overlay's dash array as the line program draws it: in
155
+ * device pixels, and read as a canvas reads one — an odd number of entries
156
+ * is repeated to make an even one, and an entry that is negative or not a
157
+ * number, or entries that are all zero, make a solid line. A pattern of
158
+ * more than four dashes is cut to its first four.
159
+ */
160
+ export declare function dashPattern(dash: readonly number[] | undefined, scale: number): number[] | null;
161
+ export declare class GlMapRenderer {
162
+ private readonly _gl;
163
+ private readonly _options;
164
+ private readonly _line;
165
+ private readonly _fan;
166
+ private readonly _cover;
167
+ private _blit;
168
+ private readonly _corners;
169
+ private readonly _coverVao;
170
+ private readonly _tiles;
171
+ private readonly _colors;
172
+ private _stencil;
173
+ /** Whether the table sets each facing's stencil operation apart, which
174
+ * makes the non-zero winding one pass. */
175
+ private readonly _separate;
176
+ /** Offscreen targets by role: `'output'` stands in for a surface with no
177
+ * stencil buffer, `'fade'` holds the scene being faded in. */
178
+ private readonly _targets;
179
+ /** The label pass: its program, its instance buffer and the vertex array
180
+ * over it, and the atlas texture with the atlas generation it holds. */
181
+ private _label;
182
+ private _labelVao;
183
+ private _labelBuffer;
184
+ private _marker;
185
+ private _markerVao;
186
+ private _markerBuffer;
187
+ private _circle;
188
+ private _raster;
189
+ private _atlasTexture;
190
+ private _atlasOwner;
191
+ private _stats;
192
+ /** Bytes of tile geometry resident on the GPU. */
193
+ gpuBytes: number;
194
+ constructor(gl: GL, options?: GlRenderOptions);
195
+ set antialias(on: boolean);
196
+ set fillRule(rule: 'nonzero' | 'evenodd');
197
+ private static _emptyStats;
198
+ /**
199
+ * What a frame would cost, in the unit `stats.instances` counts — segment
200
+ * instances, every pass included — without drawing it. The same gates the
201
+ * frame itself applies, over the ranges' record counts, so it is a walk of
202
+ * a few hundred numbers: cheap enough to price several versions of the
203
+ * next frame and draw the one that fits.
204
+ */
205
+ estimate(frame: RenderFrame): number;
206
+ /**
207
+ * Draw a frame into whatever framebuffer is bound — and, given `fade`, a
208
+ * second scene over it at `fade.alpha`, and given `labels`, the labels
209
+ * over both.
210
+ *
211
+ * The second scene is drawn whole into an offscreen target and composited
212
+ * once, rather than layer by layer at reduced opacity: a map faded layer
213
+ * by layer shows its casings through its fills and its water through its
214
+ * land. Both scenes are opaque, so the composite is exactly a cross-fade.
215
+ * Labels go on after it, at full strength: they are placed for the view,
216
+ * not for either level, and a name that dimmed with the level it came
217
+ * from would blink at every level change.
218
+ */
219
+ render(frame: RenderFrame, extras?: RenderExtras): GlRenderStats;
220
+ /** Drop one tile's buffers. */
221
+ release(data: GlTileData): void;
222
+ /** Whether a tile's buffers are resident. */
223
+ resident(data: GlTileData): boolean;
224
+ dispose(): void;
225
+ /** The whole style, into the bound framebuffer, from a clear. */
226
+ private _scene;
227
+ private _fill;
228
+ /**
229
+ * A polygon's ranges, over every tile that has them: the winding number
230
+ * into the stencil buffer, the colour wherever it is not zero, then the
231
+ * edge — the antialiasing, or an outline.
232
+ */
233
+ private _fillWith;
234
+ private _lines;
235
+ /**
236
+ * A circle layer: a disc per point, one instanced draw per tile — the
237
+ * radius, colours and stroke `paint.ts` reads, at this zoom.
238
+ */
239
+ private _circles;
240
+ /**
241
+ * A raster source's tiles: each one's image over its square, clipped to
242
+ * the part of the view it draws. Past the source's depth the square is
243
+ * the data tile's, larger than the view's cells, so the image is drawn
244
+ * whole and stretched — the retained renderer's rule since #98.
245
+ */
246
+ private _rasters;
247
+ /**
248
+ * A stroke of one layer's ranges — of the line stream, or of the fill
249
+ * stream as a polygon's outline. A translucent one is drawn each pixel
250
+ * once: two capsules overlap at every join, and colour laid down twice
251
+ * there is a darker bead at every vertex. So the pixels a capsule covers
252
+ * wholly go first, under the stencil, the first capsule to reach one
253
+ * taking it; then the antialiased fringe, where nothing has been yet.
254
+ */
255
+ private _strokeWith;
256
+ /** One layer's ranges as capsules, over every tile that has them. `part`
257
+ * 1 draws only the pixels a capsule covers wholly, 2 only the rest, and
258
+ * 0 both. */
259
+ private _segments;
260
+ /** The union of the squares a layer draws in, as a scissor box; null
261
+ * when no tile draws it. */
262
+ private _unionOf;
263
+ /** The stencil back to zero over a box, the colour untouched. */
264
+ private _clearStencil;
265
+ /**
266
+ * The overlays, over the labels — the retained renderer's order — from
267
+ * their bucket, placed this frame, pass by pass: a fill as a style's fill
268
+ * layer is drawn, a stroke as its line layer is. Answers how many passes
269
+ * it drew.
270
+ */
271
+ private _overlays;
272
+ /**
273
+ * Every tile's ranges for one layer: scissor, place, draw. The loop the
274
+ * whole frame is made of, so it allocates nothing and sets only what
275
+ * changes between tiles.
276
+ */
277
+ private _eachTile;
278
+ /**
279
+ * The attribution, over whatever is bound: its box — the cover program,
280
+ * scissored to it — and then its text, one more label quad.
281
+ */
282
+ private _attribution;
283
+ /**
284
+ * A batch of labels, over whatever is bound: one instanced draw of the
285
+ * batch's quads, after the atlas texture has what the batch draws.
286
+ * Answers how many it drew.
287
+ */
288
+ private _labels;
289
+ /**
290
+ * The markers, over whatever is bound: one instanced draw of a quad each,
291
+ * every pixel shaded by its distance to the marker's outline. Answers how
292
+ * many it drew.
293
+ */
294
+ private _markers;
295
+ /**
296
+ * Take what the atlas has waiting into the texture — a few dozen rasters
297
+ * a frame at most, so a batch landing is spread over frames rather than
298
+ * paid in one. A texture that is new, or another atlas's, starts over:
299
+ * the atlas queues everything again. Leaves the texture bound.
300
+ *
301
+ * The rasters go up as the text engine read them back — straight RGBA,
302
+ * white where the glyphs are — because the shader reads only alpha:
303
+ * premultiplying them first was a pass over every pixel for nothing.
304
+ */
305
+ private _uploadAtlas;
306
+ private _color;
307
+ private _gpu;
308
+ /**
309
+ * The vertex array for a range: the corner quad per vertex, and records
310
+ * `first`, `first + 1` (and the third attribute) per instance.
311
+ *
312
+ * One per range because instanced attributes ignore `first` — GL 4.1 and
313
+ * ES 3.0 have no base instance — so the range's start is baked into the
314
+ * attribute offsets instead. A tile has one range per style layer it
315
+ * draws, so this is two dozen small objects per tile, made once.
316
+ */
317
+ private _vao;
318
+ private _drawCover;
319
+ /**
320
+ * Does the bound framebuffer have a stencil buffer? Asked by drawing
321
+ * rather than by querying, because the query differs between the default
322
+ * framebuffer of a core profile (where `STENCIL_BITS` is gone) and a
323
+ * user one, and the Cocoa surface is the second while XQuartz's is the
324
+ * first. Two pixels, one read-back, on the first frame only.
325
+ *
326
+ * Both halves are needed, and the first version had only the second: **a
327
+ * framebuffer with no stencil buffer passes every stencil test**, so "write
328
+ * 1, then draw where it is 1" draws either way and cannot tell the two
329
+ * apart. XQuartz's surface — which has none — answered yes, the frame went
330
+ * straight to it, and every fill's cover pass painted the whole view in
331
+ * that layer's colour. So pixel 0 asks the question that only a real
332
+ * buffer answers "no" to: a draw where a *cleared* stencil is not zero.
333
+ */
334
+ private _probeStencil;
335
+ /** An offscreen colour target with its own stencil, made or remade at
336
+ * this size. Leaves its framebuffer bound. */
337
+ private _target;
338
+ /** An offscreen target onto the bound framebuffer: a copy at `alpha` 1,
339
+ * a cross-fade below it. */
340
+ private _composite;
341
+ private _dropTarget;
342
+ }
343
+ /**
344
+ * A clip rectangle as a GL scissor box: whole pixels, bottom-left origin,
345
+ * clamped to the viewport, or null when nothing of it is visible.
346
+ *
347
+ * Rounded edge by edge rather than origin-and-size, so two tiles that share
348
+ * an edge round it to the same pixel column and neither a gap nor a double
349
+ * row can open between them at any fractional zoom.
350
+ */
351
+ export declare function scissorOf(clip: DeviceRect, width: number, height: number): number[] | null;
352
+ //# sourceMappingURL=renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/maps/gl/renderer.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAqBjD,OAAO,KAAK,EAAE,EAAE,EAAW,MAAM,cAAc,CAAC;AAIhD,qDAAqD;AACrD,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;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