@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,283 @@
1
+ import type { A11ySceneItem } from 'react-x11/node';
2
+ import type { MapMarker } from './overlay.js';
3
+ import type { LngLat, LngLatBounds, MapCamera, ScreenRect, Transform } from './proj.js';
4
+ import type { FitBoundsOptions, MapFrameStats, MapHandle, MapPointerEvent } from './types.js';
5
+ /** Where a map with no camera given starts. */
6
+ export declare const DEFAULT_CAMERA: MapCamera;
7
+ /** Logical pixels the pointer may travel before a press becomes a drag. */
8
+ export declare const DRAG_THRESHOLD = 3;
9
+ /**
10
+ * How long after the last camera change the map counts as moving.
11
+ *
12
+ * One window for both renderers, and both ask it the same question — is this
13
+ * a gesture? The retained renderer rasterizes nothing inside it, so a drag or
14
+ * a wheel is composites only; the GL renderer draws at reduced detail inside
15
+ * it when adaptive quality asks, and admits no new labels. `onMoveEnd` fires
16
+ * when it closes. Long enough that a wheel zoom's many notches count as one
17
+ * gesture, short enough that the map sharpens before the user has finished
18
+ * looking. (The retained renderer had 140 ms and the GL proof of concept
19
+ * 180; the retained number was the one its tests had pinned.)
20
+ */
21
+ export declare const SETTLE_MS = 140;
22
+ /** A zoom on the {@link ZOOM_STEP} grid — also what a label placement is
23
+ * keyed on, so a placement and the zooms a wheel produces agree. */
24
+ export declare function quantizeZoom(zoom: number): number;
25
+ /** The props the controller reads — `<Map>`'s, whichever renderer draws. */
26
+ export interface MapControllerProps {
27
+ camera?: MapCamera;
28
+ onCameraChange?: (camera: MapCamera) => void;
29
+ onMoveEnd?: (camera: MapCamera) => void;
30
+ minZoom?: number;
31
+ maxZoom?: number;
32
+ interactive?: boolean;
33
+ markers?: readonly MapMarker[];
34
+ onMapClick?: (event: MapPointerEvent) => void;
35
+ onMarkerClick?: (marker: MapMarker, event: MapPointerEvent) => void;
36
+ onMarkerHover?: (marker: MapMarker | null, event: MapPointerEvent | null) => void;
37
+ }
38
+ /**
39
+ * A renderer, as the controller sees it: where its pane is, and what a camera
40
+ * move costs it. Nothing about how it draws.
41
+ */
42
+ export interface MapView {
43
+ /** The pane, in the window's logical pixels — empty before layout. */
44
+ pane(): ScreenRect;
45
+ /** Device pixels per logical pixel. */
46
+ scale(): number;
47
+ /**
48
+ * The camera moved, and the view should show it. `blit` says whether the
49
+ * move is a translation of what is already on screen — a pan — rather
50
+ * than a zoom or a jump: the retained renderer's difference between a
51
+ * blit and a repaint.
52
+ */
53
+ moved(previous: MapCamera, next: MapCamera, blit: boolean): void;
54
+ /** The settle window closed: the map is still, and may sharpen. */
55
+ settled(): void;
56
+ /** `refresh()`: throw away everything derived from the style. */
57
+ refresh(): void;
58
+ stats(): MapFrameStats | null;
59
+ /** Take the keyboard focus — a pan is where the arrows start working. */
60
+ focus(): void;
61
+ }
62
+ /** A pointer event as the controller reads it: pane-local logical pixels,
63
+ * the button, the click count and the modifiers. */
64
+ export interface MapPointerInput {
65
+ x: number;
66
+ y: number;
67
+ /** `1` left, `2` middle, `3` right. */
68
+ button?: number;
69
+ /** The click count: `2` is the second press of a double click. */
70
+ detail?: number;
71
+ shiftKey?: boolean;
72
+ ctrlKey?: boolean;
73
+ altKey?: boolean;
74
+ metaKey?: boolean;
75
+ }
76
+ /** What a press began — see {@link MapController.pointerDown}. */
77
+ export type PressKind = 'marker' | 'pan' | 'frozen';
78
+ export declare class MapController {
79
+ /**
80
+ * What `<Map>`'s ref hands out. Made once, so it is the **same object**
81
+ * for the life of the mount — across a renderer switch too, which is
82
+ * what lets an application hold it in a ref and never look again.
83
+ */
84
+ readonly handle: MapHandle;
85
+ /**
86
+ * Set by the view for the length of a frame. A camera change made inside
87
+ * one — the fit that a `fitBounds` asked for before layout, applied at
88
+ * the first frame with a size — is already what the frame draws, so it
89
+ * claims nothing and starts no gesture.
90
+ */
91
+ painting: boolean;
92
+ private _props;
93
+ /** The camera, when the application does not control it. */
94
+ private _camera;
95
+ private _view;
96
+ private _gesture;
97
+ private _hover;
98
+ /** Wall-clock time the settle window closes at. */
99
+ private _settleAt;
100
+ private _settleTimer;
101
+ private _glide;
102
+ private _glideTimer;
103
+ private _pendingFit;
104
+ constructor(seed?: MapCamera);
105
+ /** The props to read from here on. Read lazily, at event and frame time,
106
+ * so a new object per render costs an assignment. */
107
+ setProps(props: MapControllerProps): void;
108
+ get props(): MapControllerProps;
109
+ /** The renderer drawing the map from now on. */
110
+ attach(view: MapView): void;
111
+ /** …and letting go, if it still is: during a renderer switch the new
112
+ * view can attach before the old one is torn down. */
113
+ detach(view: MapView): void;
114
+ get view(): MapView | null;
115
+ /**
116
+ * Stop the timers — the settle window's, and a wheel glide in flight.
117
+ * They are the only things held that outlive a frame. The camera and the
118
+ * view stay, so a mount that React only pretends to tear down (a
119
+ * strict-mode double effect) comes back to a working controller; the next
120
+ * camera move arms the settle timer again, and the next notch a glide.
121
+ */
122
+ dispose(): void;
123
+ private _minZoom;
124
+ private _maxZoom;
125
+ private _interactive;
126
+ private _markers;
127
+ /** The camera in effect: the application's when it controls one. */
128
+ camera(): MapCamera;
129
+ /** The camera this controller keeps for itself — the one in effect
130
+ * whenever the application is not controlling it. */
131
+ ownCamera(): MapCamera;
132
+ /** The pane, in the window's logical pixels — empty with no view. */
133
+ pane(): ScreenRect;
134
+ /** A camera resolved against the pane. */
135
+ transform(camera?: MapCamera): Transform;
136
+ /**
137
+ * Move the camera — the one place it changes.
138
+ *
139
+ * Clamped (the zoom to the range, the latitude to what Web Mercator can
140
+ * represent; the longitude is not, because the map wraps and a camera just
141
+ * past the antimeridian is a camera in the next copy of the world),
142
+ * reported, and the settle window restarted: every camera move is a
143
+ * gesture, not only a pointer one, because an application animating the
144
+ * camera with `panBy` in a loop wants what a drag wants.
145
+ *
146
+ * A camera the application controls is only *asked* to move:
147
+ * `onCameraChange` is the request, and the view hears about the move when
148
+ * the new `camera` prop arrives. Telling it here as well was a double
149
+ * shift — the retained renderer blitted the pane for the request and then
150
+ * again for the prop, and `scrollContents` adds two shifts in a frame
151
+ * together.
152
+ */
153
+ apply(next: MapCamera, blit: boolean): void;
154
+ getCamera(): MapCamera;
155
+ setCamera(camera: Partial<MapCamera>): void;
156
+ /** Move by a distance in pane-local logical pixels. */
157
+ panBy(dx: number, dy: number): void;
158
+ zoomIn(step?: number): void;
159
+ zoomOut(step?: number): void;
160
+ zoomTo(zoom: number): void;
161
+ /**
162
+ * Zoom by `delta` levels about a pane-local point that must not move —
163
+ * the pointer under a wheel, the pane's centre for a key.
164
+ */
165
+ zoomAbout(delta: number, x: number, y: number): void;
166
+ /**
167
+ * A scroll, as a zoom: where the wheel wants the camera, and how the
168
+ * frames after it get there.
169
+ *
170
+ * **Two devices arrive here and they want opposite things.** A wheel
171
+ * *clicks*: one event carrying a whole notch, with nothing in between, so
172
+ * the notch becomes a target the frames after it glide towards. A touchpad
173
+ * *measures*: a stream of fractions that is already as smooth as the hand
174
+ * making it, which wants applying the moment it arrives and only needs
175
+ * keeping from rounding away. `ev.smooth` is core's word for which device
176
+ * this is — "a whole notch is worth easing towards, a stream of measured
177
+ * pixels is not" (react-x11's docs/events.md).
178
+ *
179
+ * Either way the *target* accumulates. A second notch arriving mid-glide
180
+ * lengthens the one gesture instead of starting another, and a fraction
181
+ * too small to move the quantized camera is still on the books when the
182
+ * next one arrives.
183
+ */
184
+ private _wheelZoom;
185
+ /** Keep stepping a glide until it arrives. Idempotent: a notch arriving
186
+ * mid-glide moves the target and finds the timer already running. */
187
+ private _armGlide;
188
+ /**
189
+ * One step of a glide: how far the camera moves this frame.
190
+ *
191
+ * Exponential rather than a curve with a duration, because the distance is
192
+ * not known when it starts — a second notch moves the target while the
193
+ * first is still being delivered — and because `elapsed` being the real
194
+ * gap between two frames is what makes the glide the same speed on a
195
+ * display that paints 120 frames a second and one that manages 30.
196
+ *
197
+ * Returns whether the camera moved. The move itself is what brings the
198
+ * frame that shows it: `apply` tells the view, exactly as a drag's every
199
+ * pointer step does.
200
+ */
201
+ stepZoom(at: number, elapsed: number): boolean;
202
+ fitBounds(bounds: LngLatBounds, options?: FitBoundsOptions): void;
203
+ fitMarkers(ids?: readonly string[], options?: FitBoundsOptions): void;
204
+ /** What the pane can see — the whole world before it has a size. */
205
+ getBounds(): LngLatBounds;
206
+ project(position: LngLat): {
207
+ x: number;
208
+ y: number;
209
+ };
210
+ unproject(x: number, y: number): LngLat;
211
+ markerAt(x: number, y: number): MapMarker | null;
212
+ /**
213
+ * A view is about to draw a frame: a `fitBounds` that arrived before the
214
+ * pane had a size is applied now, so the frame draws it.
215
+ */
216
+ beginFrame(): void;
217
+ /** Whether the camera moved within the settle window. */
218
+ get moving(): boolean;
219
+ /** …or a press is still down: what the retained renderer holds
220
+ * rasterization off for. */
221
+ get gesturing(): boolean;
222
+ /** Whether a pan gesture is under way — a press that may yet drag. */
223
+ get dragging(): boolean;
224
+ /**
225
+ * Restart the settle window. When it closes the camera has held still for
226
+ * {@link SETTLE_MS}: `onMoveEnd` fires — the moment an application fetches
227
+ * what is now on screen — and the view is told it may sharpen.
228
+ *
229
+ * Wall-clock time rather than a frame clock: this is a window a hundred
230
+ * and forty milliseconds long compared inside a timer callback, and a
231
+ * timer is the one thing that runs when no frame does.
232
+ */
233
+ touch(): void;
234
+ /**
235
+ * A press. Answers what it began, for the view to capture the pointer — and
236
+ * for a pan, to take the focus — or null when nothing is.
237
+ *
238
+ * A press on a marker is a marker gesture: its release is a marker click.
239
+ * A press anywhere else is a pan, or on a map that does not move a
240
+ * `'frozen'` press, which pans nothing and is still a click when it is
241
+ * released — an application listening for clicks on a frozen map gets
242
+ * them.
243
+ */
244
+ pointerDown(input: MapPointerInput): PressKind;
245
+ /** The pointer moved with the press still down. */
246
+ pointerDrag(input: MapPointerInput): void;
247
+ /**
248
+ * The press let go. A release within the drag threshold of a marker press
249
+ * is that marker's click, then the map's; one that ended no drag is the
250
+ * map's click. And the second release of a double click zooms in about the
251
+ * pointer, Shift for out — the convention every map client has.
252
+ */
253
+ pointerUp(input: MapPointerInput): void;
254
+ /** The pointer moved with nothing pressed: the marker under it, if that
255
+ * changed, is `onMarkerHover`'s. */
256
+ pointerMove(input: MapPointerInput): void;
257
+ /**
258
+ * The pointer left the map. No event: there is no position on the map to
259
+ * report, and inventing one would be worse than saying so.
260
+ */
261
+ pointerLeave(): void;
262
+ /**
263
+ * The wheel, which is a zoom about the pointer. True when it was consumed
264
+ * — always, on a map that moves: a wheel over a map is never meant for
265
+ * whatever is behind it.
266
+ */
267
+ wheel(input: MapPointerInput, deltaY: number, smooth?: boolean): boolean;
268
+ /** A key: the arrows pan, +/− zoom about the centre. True when it was one
269
+ * of those, on a map that moves. */
270
+ keyDown(keysym: number, shiftKey: boolean): boolean;
271
+ /** Where a pointer event happened, in every space that could be wanted. */
272
+ pointerEvent(input: MapPointerInput, marker: MapMarker | null): MapPointerEvent;
273
+ /**
274
+ * What a screen reader meets: the markers in view, as buttons.
275
+ *
276
+ * A map is one painted rectangle to an assistive technology, and its
277
+ * markers are the only things in it that are *objects* rather than
278
+ * cartography — so those are the scene. Announcing every road would be
279
+ * worse than announcing none. The same whichever renderer draws.
280
+ */
281
+ markerScene(): A11ySceneItem[];
282
+ }
283
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/maps/controller.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAU9C,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,SAAS,EACT,UAAU,EACV,SAAS,EACV,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa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