@react-x11/components 0.4.0 → 0.6.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 (248) hide show
  1. package/README.md +143 -8
  2. package/dist/charts/components.d.ts +3 -1
  3. package/dist/charts/components.d.ts.map +1 -1
  4. package/dist/charts/components.js +8 -4
  5. package/dist/charts/components.js.map +1 -1
  6. package/dist/charts/node.d.ts +13 -6
  7. package/dist/charts/node.d.ts.map +1 -1
  8. package/dist/charts/node.js +75 -24
  9. package/dist/charts/node.js.map +1 -1
  10. package/dist/charts/render.d.ts +4 -0
  11. package/dist/charts/render.d.ts.map +1 -1
  12. package/dist/charts/render.js +11 -6
  13. package/dist/charts/render.js.map +1 -1
  14. package/dist/code-editor/node.d.ts +47 -16
  15. package/dist/code-editor/node.d.ts.map +1 -1
  16. package/dist/code-editor/node.js +121 -51
  17. package/dist/code-editor/node.js.map +1 -1
  18. package/dist/flow/draw.d.ts +19 -1
  19. package/dist/flow/draw.d.ts.map +1 -1
  20. package/dist/flow/draw.js +64 -35
  21. package/dist/flow/draw.js.map +1 -1
  22. package/dist/flow/index.d.ts.map +1 -1
  23. package/dist/flow/index.js +24 -8
  24. package/dist/flow/index.js.map +1 -1
  25. package/dist/flow/model.d.ts +4 -2
  26. package/dist/flow/model.d.ts.map +1 -1
  27. package/dist/flow/model.js +4 -2
  28. package/dist/flow/model.js.map +1 -1
  29. package/dist/flow/node.d.ts +40 -9
  30. package/dist/flow/node.d.ts.map +1 -1
  31. package/dist/flow/node.js +142 -53
  32. package/dist/flow/node.js.map +1 -1
  33. package/dist/flow/types.d.ts +46 -21
  34. package/dist/flow/types.d.ts.map +1 -1
  35. package/dist/formula/index.d.ts +4 -2
  36. package/dist/formula/index.d.ts.map +1 -1
  37. package/dist/formula/index.js.map +1 -1
  38. package/dist/formula/node.d.ts +5 -1
  39. package/dist/formula/node.d.ts.map +1 -1
  40. package/dist/formula/node.js +19 -3
  41. package/dist/formula/node.js.map +1 -1
  42. package/dist/html/controls.d.ts +4 -1
  43. package/dist/html/controls.d.ts.map +1 -1
  44. package/dist/html/controls.js.map +1 -1
  45. package/dist/html/css/cascade.d.ts +11 -5
  46. package/dist/html/css/cascade.d.ts.map +1 -1
  47. package/dist/html/css/cascade.js +18 -8
  48. package/dist/html/css/cascade.js.map +1 -1
  49. package/dist/html/css/parse.d.ts +15 -10
  50. package/dist/html/css/parse.d.ts.map +1 -1
  51. package/dist/html/css/parse.js +41 -16
  52. package/dist/html/css/parse.js.map +1 -1
  53. package/dist/html/css/style.d.ts +3 -0
  54. package/dist/html/css/style.d.ts.map +1 -1
  55. package/dist/html/css/style.js +3 -1
  56. package/dist/html/css/style.js.map +1 -1
  57. package/dist/html/css/values.d.ts +14 -1
  58. package/dist/html/css/values.d.ts.map +1 -1
  59. package/dist/html/css/values.js +11 -8
  60. package/dist/html/css/values.js.map +1 -1
  61. package/dist/html/index.d.ts.map +1 -1
  62. package/dist/html/index.js +1 -0
  63. package/dist/html/index.js.map +1 -1
  64. package/dist/html/layout/boxes.d.ts +12 -5
  65. package/dist/html/layout/boxes.d.ts.map +1 -1
  66. package/dist/html/layout/boxes.js +7 -4
  67. package/dist/html/layout/boxes.js.map +1 -1
  68. package/dist/html/layout/inline.d.ts.map +1 -1
  69. package/dist/html/layout/inline.js +22 -1
  70. package/dist/html/layout/inline.js.map +1 -1
  71. package/dist/html/node.d.ts +22 -8
  72. package/dist/html/node.d.ts.map +1 -1
  73. package/dist/html/node.js +97 -15
  74. package/dist/html/node.js.map +1 -1
  75. package/dist/html/paint.d.ts +3 -0
  76. package/dist/html/paint.d.ts.map +1 -1
  77. package/dist/html/paint.js +2 -2
  78. package/dist/html/paint.js.map +1 -1
  79. package/dist/index.d.ts +8 -2
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +21 -0
  82. package/dist/index.js.map +1 -1
  83. package/dist/maps/clip.d.ts +43 -0
  84. package/dist/maps/clip.d.ts.map +1 -0
  85. package/dist/maps/clip.js +171 -0
  86. package/dist/maps/clip.js.map +1 -0
  87. package/dist/maps/gzip.d.ts +15 -0
  88. package/dist/maps/gzip.d.ts.map +1 -0
  89. package/dist/maps/gzip.js +56 -0
  90. package/dist/maps/gzip.js.map +1 -0
  91. package/dist/maps/index.d.ts +55 -0
  92. package/dist/maps/index.d.ts.map +1 -0
  93. package/dist/maps/index.js +141 -0
  94. package/dist/maps/index.js.map +1 -0
  95. package/dist/maps/labels.d.ts +123 -0
  96. package/dist/maps/labels.d.ts.map +1 -0
  97. package/dist/maps/labels.js +323 -0
  98. package/dist/maps/labels.js.map +1 -0
  99. package/dist/maps/mvt.d.ts +244 -0
  100. package/dist/maps/mvt.d.ts.map +1 -0
  101. package/dist/maps/mvt.js +820 -0
  102. package/dist/maps/mvt.js.map +1 -0
  103. package/dist/maps/node.d.ts +278 -0
  104. package/dist/maps/node.d.ts.map +1 -0
  105. package/dist/maps/node.js +1459 -0
  106. package/dist/maps/node.js.map +1 -0
  107. package/dist/maps/overlay.d.ts +157 -0
  108. package/dist/maps/overlay.d.ts.map +1 -0
  109. package/dist/maps/overlay.js +472 -0
  110. package/dist/maps/overlay.js.map +1 -0
  111. package/dist/maps/paint.d.ts +226 -0
  112. package/dist/maps/paint.d.ts.map +1 -0
  113. package/dist/maps/paint.js +705 -0
  114. package/dist/maps/paint.js.map +1 -0
  115. package/dist/maps/proj.d.ts +281 -0
  116. package/dist/maps/proj.d.ts.map +1 -0
  117. package/dist/maps/proj.js +451 -0
  118. package/dist/maps/proj.js.map +1 -0
  119. package/dist/maps/sources.d.ts +256 -0
  120. package/dist/maps/sources.d.ts.map +1 -0
  121. package/dist/maps/sources.js +210 -0
  122. package/dist/maps/sources.js.map +1 -0
  123. package/dist/maps/style.d.ts +141 -0
  124. package/dist/maps/style.d.ts.map +1 -0
  125. package/dist/maps/style.js +147 -0
  126. package/dist/maps/style.js.map +1 -0
  127. package/dist/maps/styles.d.ts +82 -0
  128. package/dist/maps/styles.d.ts.map +1 -0
  129. package/dist/maps/styles.js +898 -0
  130. package/dist/maps/styles.js.map +1 -0
  131. package/dist/maps/tiles.d.ts +283 -0
  132. package/dist/maps/tiles.d.ts.map +1 -0
  133. package/dist/maps/tiles.js +469 -0
  134. package/dist/maps/tiles.js.map +1 -0
  135. package/dist/maps/types.d.ts +244 -0
  136. package/dist/maps/types.d.ts.map +1 -0
  137. package/dist/maps/types.js +2 -0
  138. package/dist/maps/types.js.map +1 -0
  139. package/dist/markdown/ast.d.ts +80 -6
  140. package/dist/markdown/ast.d.ts.map +1 -1
  141. package/dist/markdown/ast.js +13 -4
  142. package/dist/markdown/ast.js.map +1 -1
  143. package/dist/markdown/expressions.d.ts +27 -0
  144. package/dist/markdown/expressions.d.ts.map +1 -0
  145. package/dist/markdown/expressions.js +203 -0
  146. package/dist/markdown/expressions.js.map +1 -0
  147. package/dist/markdown/index.d.ts +61 -2
  148. package/dist/markdown/index.d.ts.map +1 -1
  149. package/dist/markdown/index.js +101 -2
  150. package/dist/markdown/index.js.map +1 -1
  151. package/dist/markdown/parse.d.ts +1 -1
  152. package/dist/markdown/parse.d.ts.map +1 -1
  153. package/dist/markdown/parse.js +163 -15
  154. package/dist/markdown/parse.js.map +1 -1
  155. package/dist/markdown/spans.d.ts.map +1 -1
  156. package/dist/markdown/spans.js +4 -0
  157. package/dist/markdown/spans.js.map +1 -1
  158. package/dist/markdown/tags.d.ts +35 -0
  159. package/dist/markdown/tags.d.ts.map +1 -0
  160. package/dist/markdown/tags.js +213 -0
  161. package/dist/markdown/tags.js.map +1 -0
  162. package/dist/reorder/hx.d.ts +18 -0
  163. package/dist/reorder/hx.d.ts.map +1 -0
  164. package/dist/reorder/hx.js +10 -0
  165. package/dist/reorder/hx.js.map +1 -0
  166. package/dist/reorder/index.d.ts +314 -0
  167. package/dist/reorder/index.d.ts.map +1 -0
  168. package/dist/reorder/index.js +1539 -0
  169. package/dist/reorder/index.js.map +1 -0
  170. package/dist/reorder/model.d.ts +107 -0
  171. package/dist/reorder/model.d.ts.map +1 -0
  172. package/dist/reorder/model.js +162 -0
  173. package/dist/reorder/model.js.map +1 -0
  174. package/dist/richtext/node.d.ts +15 -5
  175. package/dist/richtext/node.d.ts.map +1 -1
  176. package/dist/richtext/node.js +40 -11
  177. package/dist/richtext/node.js.map +1 -1
  178. package/dist/richtext/runs.d.ts +35 -13
  179. package/dist/richtext/runs.d.ts.map +1 -1
  180. package/dist/richtext/runs.js +83 -27
  181. package/dist/richtext/runs.js.map +1 -1
  182. package/dist/tabs/index.d.ts +17 -0
  183. package/dist/tabs/index.d.ts.map +1 -1
  184. package/dist/tabs/index.js +849 -186
  185. package/dist/tabs/index.js.map +1 -1
  186. package/dist/terminal/vt/fonts.d.ts +45 -15
  187. package/dist/terminal/vt/fonts.d.ts.map +1 -1
  188. package/dist/terminal/vt/fonts.js +89 -19
  189. package/dist/terminal/vt/fonts.js.map +1 -1
  190. package/dist/terminal/vt/node.d.ts +42 -0
  191. package/dist/terminal/vt/node.d.ts.map +1 -1
  192. package/dist/terminal/vt/node.js +95 -11
  193. package/dist/terminal/vt/node.js.map +1 -1
  194. package/dist/terminal/vt/renderer.d.ts.map +1 -1
  195. package/dist/terminal/vt/renderer.js +13 -3
  196. package/dist/terminal/vt/renderer.js.map +1 -1
  197. package/package.json +14 -3
  198. package/src/charts/components.ts +14 -7
  199. package/src/charts/node.ts +81 -26
  200. package/src/charts/render.ts +16 -6
  201. package/src/code-editor/node.ts +147 -53
  202. package/src/flow/draw.ts +104 -35
  203. package/src/flow/index.ts +33 -13
  204. package/src/flow/model.ts +4 -2
  205. package/src/flow/node.ts +158 -59
  206. package/src/flow/types.ts +46 -21
  207. package/src/formula/index.ts +4 -2
  208. package/src/formula/node.ts +24 -5
  209. package/src/html/controls.ts +4 -1
  210. package/src/html/css/cascade.ts +18 -7
  211. package/src/html/css/parse.ts +46 -21
  212. package/src/html/css/style.ts +6 -1
  213. package/src/html/css/values.ts +25 -9
  214. package/src/html/index.ts +1 -0
  215. package/src/html/layout/boxes.ts +19 -9
  216. package/src/html/layout/inline.ts +23 -1
  217. package/src/html/node.ts +110 -17
  218. package/src/html/paint.ts +17 -2
  219. package/src/index.ts +102 -0
  220. package/src/maps/clip.ts +184 -0
  221. package/src/maps/gzip.ts +66 -0
  222. package/src/maps/index.ts +316 -0
  223. package/src/maps/labels.ts +442 -0
  224. package/src/maps/mvt.ts +857 -0
  225. package/src/maps/node.ts +1819 -0
  226. package/src/maps/overlay.ts +639 -0
  227. package/src/maps/paint.ts +978 -0
  228. package/src/maps/proj.ts +641 -0
  229. package/src/maps/sources.ts +425 -0
  230. package/src/maps/style.ts +309 -0
  231. package/src/maps/styles.ts +1040 -0
  232. package/src/maps/tiles.ts +676 -0
  233. package/src/maps/types.ts +260 -0
  234. package/src/markdown/ast.ts +85 -9
  235. package/src/markdown/expressions.ts +223 -0
  236. package/src/markdown/index.ts +190 -5
  237. package/src/markdown/parse.ts +230 -15
  238. package/src/markdown/spans.ts +4 -0
  239. package/src/markdown/tags.ts +240 -0
  240. package/src/reorder/hx.ts +31 -0
  241. package/src/reorder/index.ts +2223 -0
  242. package/src/reorder/model.ts +232 -0
  243. package/src/richtext/node.ts +49 -14
  244. package/src/richtext/runs.ts +115 -30
  245. package/src/tabs/index.ts +1040 -204
  246. package/src/terminal/vt/fonts.ts +128 -36
  247. package/src/terminal/vt/node.ts +105 -12
  248. package/src/terminal/vt/renderer.ts +13 -3
@@ -0,0 +1,451 @@
1
+ // Web Mercator, the slippy-map tile grid, and the camera — the arithmetic
2
+ // every other module here stands on, with no display anywhere in it.
3
+ //
4
+ // Three coordinate spaces, and knowing which one you are in is most of the
5
+ // correctness of a map:
6
+ //
7
+ // 1. **Geographic** — `{ lon, lat }` in WGS84 degrees, what an application
8
+ // says and what a marker is placed at.
9
+ // 2. **Mercator** — `{ x, y }` normalized to the unit square, y increasing
10
+ // *south*: the projection every provider's tiles are cut on
11
+ // (EPSG:3857, "Web Mercator"). Kept normalized rather than in metres or
12
+ // in pixels because it is the one space that does not depend on the
13
+ // zoom, so a cached derivation of it stays valid across one.
14
+ // 3. **Screen** — logical pixels in the pane, which is where the camera
15
+ // comes in.
16
+ //
17
+ // The screen conversion is deliberately written as *centre-relative*:
18
+ //
19
+ // screenX = paneCentreX + (mx - centreMx) * worldSize
20
+ //
21
+ // and not as `mx * worldSize - centreMx * worldSize`. The two are the same
22
+ // number in exact arithmetic and not in float64: at zoom 20 `worldSize` is
23
+ // 5.4e8, so `mx * worldSize` for a point in Melbourne is ~4.1e8 and the
24
+ // spacing between representable doubles there is ~6e-8 pixels — fine — but
25
+ // the *difference* of two such products loses the low bits of both, and a
26
+ // building's wall ends up a wobbling half-pixel from where its neighbour's
27
+ // begins. Subtracting first keeps the small quantity small. Everything in
28
+ // this file that produces a pixel does it in that order, and
29
+ // {@link tileTransform} is the same trick again for a tile's own integers.
30
+ /**
31
+ * The latitude Web Mercator can represent, `atan(sinh(pi))` in degrees.
32
+ *
33
+ * Not a rounding of 85: it is the exact latitude at which the projection's
34
+ * `y` reaches 1, and clamping to anything larger produces a `y` outside the
35
+ * unit square, which then addresses a tile row that does not exist. Every
36
+ * projection entry point clamps to it.
37
+ */
38
+ export const MAX_LATITUDE = 85.0511287798066;
39
+ /** WGS84's semi-major axis, in metres — what a scale bar is measured
40
+ * against. */
41
+ export const EARTH_RADIUS = 6378137;
42
+ /** The equator, in metres. */
43
+ export const EARTH_CIRCUMFERENCE = 2 * Math.PI * EARTH_RADIUS;
44
+ /** The tile size providers overwhelmingly serve vector tiles at. 256 is the
45
+ * older raster convention and is still common; both are supported per
46
+ * source, and this is only the default. */
47
+ export const DEFAULT_TILE_SIZE = 512;
48
+ const DEG = Math.PI / 180;
49
+ function clamp(value, low, high) {
50
+ return value < low ? low : value > high ? high : value;
51
+ }
52
+ /** Longitude folded into `[-180, 180)`. */
53
+ export function wrapLon(lon) {
54
+ if (lon >= -180 && lon < 180)
55
+ return lon;
56
+ const wrapped = ((((lon + 180) % 360) + 360) % 360) - 180;
57
+ return wrapped;
58
+ }
59
+ // --- the projection --------------------------------------------------------
60
+ /** Longitude to normalized mercator `x`. Not wrapped: a caller drawing world
61
+ * copies wants to know it went past the edge. */
62
+ export function mercatorXFromLon(lon) {
63
+ return (180 + lon) / 360;
64
+ }
65
+ /** Latitude to normalized mercator `y`, clamped to {@link MAX_LATITUDE}. */
66
+ export function mercatorYFromLat(lat) {
67
+ const phi = clamp(lat, -MAX_LATITUDE, MAX_LATITUDE);
68
+ return ((180 -
69
+ (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + phi * DEG * 0.5))) /
70
+ 360);
71
+ }
72
+ export function lonFromMercatorX(x) {
73
+ return x * 360 - 180;
74
+ }
75
+ export function latFromMercatorY(y) {
76
+ return (360 / Math.PI) * Math.atan(Math.exp((180 - y * 360) * DEG)) - 90;
77
+ }
78
+ export function project(position) {
79
+ return {
80
+ x: mercatorXFromLon(position.lon),
81
+ y: mercatorYFromLat(position.lat),
82
+ };
83
+ }
84
+ export function unproject(point) {
85
+ return { lon: lonFromMercatorX(point.x), lat: latFromMercatorY(point.y) };
86
+ }
87
+ /**
88
+ * How much Mercator stretches distance at this latitude — `1 / cos(lat)`.
89
+ *
90
+ * The reason a scale bar cannot be a constant: one pixel is 156 km at the
91
+ * equator on zoom 0 and 13 km at 85°N, on the same map.
92
+ */
93
+ export function mercatorScale(lat) {
94
+ return 1 / Math.cos(clamp(lat, -MAX_LATITUDE, MAX_LATITUDE) * DEG);
95
+ }
96
+ /** Ground metres one logical pixel covers, at this latitude and zoom. */
97
+ export function metresPerPixel(lat, zoom, tileSize = DEFAULT_TILE_SIZE) {
98
+ return ((EARTH_CIRCUMFERENCE *
99
+ Math.cos(clamp(lat, -MAX_LATITUDE, MAX_LATITUDE) * DEG)) /
100
+ (tileSize * Math.pow(2, zoom)));
101
+ }
102
+ /**
103
+ * Great-circle distance in metres, by the haversine formula.
104
+ *
105
+ * On the sphere rather than the WGS84 ellipsoid: the error is under 0.5%,
106
+ * which is well inside what a map at any zoom can draw, and the ellipsoidal
107
+ * form (Vincenty, Karney) is an iteration that a hover readout should not
108
+ * be running per frame.
109
+ */
110
+ export function distanceMetres(a, b) {
111
+ const dLat = (b.lat - a.lat) * DEG;
112
+ const dLon = (b.lon - a.lon) * DEG;
113
+ const sLat = Math.sin(dLat / 2);
114
+ const sLon = Math.sin(dLon / 2);
115
+ const h = sLat * sLat + Math.cos(a.lat * DEG) * Math.cos(b.lat * DEG) * sLon * sLon;
116
+ return 2 * EARTH_RADIUS * Math.asin(Math.min(1, Math.sqrt(h)));
117
+ }
118
+ // --- the tile grid ---------------------------------------------------------
119
+ /** Tiles across the world at this zoom: `2^z`. */
120
+ export function tileCountAt(z) {
121
+ return Math.pow(2, z);
122
+ }
123
+ /** A tile column folded into `[0, 2^z)`. Longitude wraps and latitude does
124
+ * not, so this exists for `x` and has no counterpart for `y`. */
125
+ export function wrapTileX(x, z) {
126
+ const n = tileCountAt(z);
127
+ return ((x % n) + n) % n;
128
+ }
129
+ /** The tile containing a position. */
130
+ export function tileOf(position, z) {
131
+ const n = tileCountAt(z);
132
+ const x = Math.floor(mercatorXFromLon(position.lon) * n);
133
+ const y = Math.floor(mercatorYFromLat(position.lat) * n);
134
+ return { z, x: wrapTileX(x, z), y: clamp(y, 0, n - 1) };
135
+ }
136
+ /** A tile's geographic extent. */
137
+ export function tileBounds(tile) {
138
+ const n = tileCountAt(tile.z);
139
+ return {
140
+ west: lonFromMercatorX(tile.x / n),
141
+ east: lonFromMercatorX((tile.x + 1) / n),
142
+ north: latFromMercatorY(tile.y / n),
143
+ south: latFromMercatorY((tile.y + 1) / n),
144
+ };
145
+ }
146
+ /** `z/x/y`, the key every cache here is keyed on. */
147
+ export function tileKey(tile) {
148
+ return `${tile.z}/${tile.x}/${tile.y}`;
149
+ }
150
+ /** A tile's parent, or null at the root — how a missing tile is covered by
151
+ * the coarser one that is already loaded. */
152
+ export function parentTile(tile) {
153
+ if (tile.z <= 0)
154
+ return null;
155
+ return { z: tile.z - 1, x: tile.x >> 1, y: tile.y >> 1 };
156
+ }
157
+ /** Whether `outer` contains `inner` in the pyramid — the test behind
158
+ * covering a gap with an ancestor's pixels. */
159
+ export function tileContains(outer, inner) {
160
+ if (outer.z > inner.z)
161
+ return false;
162
+ const shift = inner.z - outer.z;
163
+ return inner.x >> shift === outer.x && inner.y >> shift === outer.y;
164
+ }
165
+ // --- the camera ------------------------------------------------------------
166
+ /** Logical pixels across the whole world at this zoom. */
167
+ export function worldSize(zoom, tileSize = DEFAULT_TILE_SIZE) {
168
+ return tileSize * Math.pow(2, zoom);
169
+ }
170
+ export function transformFor(camera, size, tileSize = DEFAULT_TILE_SIZE) {
171
+ const center = project(camera.center);
172
+ return {
173
+ centerX: center.x,
174
+ centerY: center.y,
175
+ zoom: camera.zoom,
176
+ tileSize,
177
+ width: size.width,
178
+ height: size.height,
179
+ paneX: size.width / 2,
180
+ paneY: size.height / 2,
181
+ world: worldSize(camera.zoom, tileSize),
182
+ };
183
+ }
184
+ /** A mercator point in pane-local logical pixels. */
185
+ export function projectPoint(t, point) {
186
+ return {
187
+ x: t.paneX + (point.x - t.centerX) * t.world,
188
+ y: t.paneY + (point.y - t.centerY) * t.world,
189
+ };
190
+ }
191
+ /** A geographic position in pane-local logical pixels, taking the nearest
192
+ * copy of the world so a marker just past the antimeridian draws beside the
193
+ * map rather than a world away from it. */
194
+ export function projectLngLat(t, position) {
195
+ let mx = mercatorXFromLon(position.lon);
196
+ // The camera is somewhere in `[0, 1)`; a point more than half a world away
197
+ // in mercator is nearer in the other direction.
198
+ const shift = Math.round(mx - t.centerX);
199
+ mx -= shift;
200
+ return projectPoint(t, { x: mx, y: mercatorYFromLat(position.lat) });
201
+ }
202
+ /** A pane-local pixel back to a geographic position. */
203
+ export function unprojectPoint(t, x, y) {
204
+ const mx = t.centerX + (x - t.paneX) / t.world;
205
+ const my = clamp(t.centerY + (y - t.paneY) / t.world, 0, 1);
206
+ return { lon: wrapLon(lonFromMercatorX(mx)), lat: latFromMercatorY(my) };
207
+ }
208
+ /** What the pane can see, as geography. `west > east` when the view spans
209
+ * the antimeridian; a view wider than the world reports the whole of it. */
210
+ export function visibleBounds(t) {
211
+ const nw = unprojectPoint(t, 0, 0);
212
+ const se = unprojectPoint(t, t.width, t.height);
213
+ if (t.width >= t.world) {
214
+ return { west: -180, east: 180, south: se.lat, north: nw.lat };
215
+ }
216
+ return { west: nw.lon, north: nw.lat, east: se.lon, south: se.lat };
217
+ }
218
+ /**
219
+ * Which pyramid level serves a camera zoom.
220
+ *
221
+ * `floor` rather than `round`, which is the convention every slippy-map
222
+ * client uses: a zoom of 14.9 is served by z14 tiles scaled up, and the
223
+ * moment it crosses 15 the finer level takes over. Rounding instead would
224
+ * load z15 at 14.5 and draw it at 0.7× — more data, downsampled.
225
+ */
226
+ /**
227
+ * How many levels deeper than the view a source is read, because its tiles
228
+ * are smaller than the transform's cell.
229
+ *
230
+ * 0 for the 512-px vector sources this defaults to, 1 for the 256-px raster
231
+ * services, and it falls out of the arithmetic rather than being a special
232
+ * case: a tile is drawn at its natural size when
233
+ * `t.tileSize * 2^(zoom - z) === pyramid.tileSize`.
234
+ */
235
+ export function zoomOffsetFor(t, pyramid) {
236
+ if (!(pyramid.tileSize > 0) || !(t.tileSize > 0))
237
+ return 0;
238
+ return Math.round(Math.log2(t.tileSize / pyramid.tileSize));
239
+ }
240
+ export function sourceZoomFor(zoom, pyramid, overzoom = 0) {
241
+ return clamp(Math.floor(zoom), pyramid.minZoom, pyramid.maxZoom + Math.max(0, overzoom));
242
+ }
243
+ /**
244
+ * The tile whose **data** serves a tile the cover asked for.
245
+ *
246
+ * Itself, until the cover goes deeper than the pyramid does — past that,
247
+ * its ancestor at the deepest level the source cuts. This is what makes
248
+ * overzoom sharp rather than blurry: instead of drawing one z14 tile onto a
249
+ * surface and stretching it sixty-four times, the cover asks for z20 tiles,
250
+ * two hundred and fifty-six of them share that one z14 tile's data, and
251
+ * each is rasterized at its own natural size. One fetch, one parse, and
252
+ * detail limited by the data rather than by a bitmap.
253
+ */
254
+ export function dataTileFor(tile, maxZoom) {
255
+ if (tile.z <= maxZoom)
256
+ return tile;
257
+ const down = tile.z - maxZoom;
258
+ return { z: maxZoom, x: tile.x >> down, y: tile.y >> down };
259
+ }
260
+ /**
261
+ * Where a tile sits inside the data tile that serves it: cell
262
+ * `(x, y)` of a `span × span` grid, and `span` is 1 when the tile *is* its
263
+ * own data.
264
+ */
265
+ export function subTileOf(tile, maxZoom) {
266
+ if (tile.z <= maxZoom)
267
+ return { x: 0, y: 0, span: 1 };
268
+ const down = tile.z - maxZoom;
269
+ const span = 1 << down;
270
+ return {
271
+ x: tile.x - ((tile.x >> down) << down),
272
+ y: tile.y - ((tile.y >> down) << down),
273
+ span,
274
+ };
275
+ }
276
+ /**
277
+ * How large to rasterize a tile whose pyramid level is `z` at camera `zoom`.
278
+ *
279
+ * The rule: **rasterize at the size the tile has at integer zoom, and let
280
+ * the composite carry only the fraction.** `2^(zoom - z)` splits into
281
+ * `2^(floor(zoom) - z)`, a power of two that goes into the raster, times
282
+ * `2^frac(zoom)`, which is in `[1, 2)` and is a `drawImage` away. So a
283
+ * pinch never re-rasterizes — the expensive half of the frame is the same
284
+ * pixels at every zoom inside one level — and a tile is never composited at
285
+ * more than 2× upscale unless the cap below is what stopped it.
286
+ *
287
+ * `maxSize` is that cap, and it is about memory rather than sharpness: an
288
+ * argb32 surface is `4 * size²` bytes, so a 1024-pixel tile is 4 MB and a
289
+ * screenful of them is a real number. Past the cap the raster stays where it
290
+ * is and the composite upscales, which is the same trade a raster tile makes
291
+ * when it is overzoomed.
292
+ */
293
+ export function rasterFor(zoom, z, pyramid, scale, maxSize) {
294
+ const natural = pyramid.tileSize * scale;
295
+ const steps = Math.floor(zoom) - z;
296
+ let factor = Math.pow(2, clamp(steps, -2, 2));
297
+ while (factor > 1 && natural * factor > maxSize)
298
+ factor /= 2;
299
+ return { size: Math.max(1, Math.round(natural * factor)), factor };
300
+ }
301
+ /**
302
+ * Every tile the pane can see, centre-out.
303
+ *
304
+ * `padding` grows the rectangle in logical pixels, which is how a ring of
305
+ * tiles is kept warm so a pan has them before it needs them. The order is
306
+ * the load order and the draw order both: the tile under the pointer is the
307
+ * one whose arrival the user is waiting for.
308
+ */
309
+ export function tileCover(t, pyramid, padding = 0) {
310
+ // A source whose tiles are 256 px covers the transform's 512-px cell with
311
+ // two of them each way, so it is read one level **deeper** for the same
312
+ // view: the same ground, a finer grid, and each image drawn at its own
313
+ // natural size instead of stretched to twice it. This is the convention
314
+ // every web map uses, and getting it wrong is not a blurry map but a
315
+ // wrong one — see below.
316
+ const z = sourceZoomFor(t.zoom + zoomOffsetFor(t, pyramid), pyramid);
317
+ const n = tileCountAt(z);
318
+ // Screen size of one tile of this level, from **the transform's** world
319
+ // and not the pyramid's tile size.
320
+ //
321
+ // The distinction is the whole of react-x11-components#65. Placement below
322
+ // is `paneX + (ix - fx) * size` with `fx = centerX * n`, so the world this
323
+ // grid is laid out on is `n * size`. That has to be `t.world`, because
324
+ // `t.world` is what places every *other* thing in the pane — markers,
325
+ // overlays, labels, `project()`, and the shift a pan blit asks for. Using
326
+ // the pyramid's tile size here made `n * size` the world of a 256-px
327
+ // pyramid while everything else used a 512-px one, so on a raster source
328
+ // the tiles moved half as far as the pointer and the markers slid across
329
+ // them. `t.tileSize * 2^(zoom - z)` keeps `n * size === t.world` by
330
+ // construction, at every level, overzoomed or not.
331
+ const size = t.tileSize * Math.pow(2, t.zoom - z);
332
+ // The pane's edges as fractional tile coordinates. `centerX * n` is where
333
+ // the camera sits in this level's grid.
334
+ const fx = t.centerX * n;
335
+ const fy = t.centerY * n;
336
+ const left = fx - (t.paneX + padding) / size;
337
+ const right = fx + (t.width - t.paneX + padding) / size;
338
+ const top = fy - (t.paneY + padding) / size;
339
+ const bottom = fy + (t.height - t.paneY + padding) / size;
340
+ const yMin = Math.max(0, Math.floor(top));
341
+ const yMax = Math.min(n - 1, Math.ceil(bottom) - 1);
342
+ const xMin = Math.floor(left);
343
+ const xMax = Math.ceil(right) - 1;
344
+ const out = [];
345
+ // A pane wider than the world would otherwise ask for the same tile
346
+ // hundreds of times over; three copies is what a view at zoom 0 can show.
347
+ const span = Math.min(xMax - xMin, 3 * n - 1);
348
+ for (let ix = xMin; ix <= xMin + span; ix++) {
349
+ for (let iy = yMin; iy <= yMax; iy++) {
350
+ const x = t.paneX + (ix - fx) * size;
351
+ const y = t.paneY + (iy - fy) * size;
352
+ const cx = x + size / 2 - t.paneX;
353
+ const cy = y + size / 2 - t.paneY;
354
+ out.push({
355
+ tile: { z, x: wrapTileX(ix, z), y: iy },
356
+ worldCopy: Math.floor(ix / n),
357
+ x,
358
+ y,
359
+ size,
360
+ distance: Math.sqrt(cx * cx + cy * cy),
361
+ });
362
+ }
363
+ }
364
+ out.sort((a, b) => a.distance - b.distance);
365
+ return out;
366
+ }
367
+ /**
368
+ * The affine that takes a tile's own integer coordinates to pane pixels:
369
+ * `screenX = ox + local * k`.
370
+ *
371
+ * Two multiplies and an add per vertex, and — the point — the subtraction
372
+ * that could lose precision happened once, here, on the tile's index rather
373
+ * than on every one of its ten thousand vertices.
374
+ */
375
+ export function tileTransform(entry, extent) {
376
+ return { ox: entry.x, oy: entry.y, k: entry.size / extent };
377
+ }
378
+ /**
379
+ * The camera that frames `bounds` in a viewport.
380
+ *
381
+ * `padding` is logical pixels kept clear on every side. A degenerate box — a
382
+ * single point, or a set of markers all at one place — has no zoom that
383
+ * frames it, so `maxZoom` is what it lands at rather than infinity.
384
+ */
385
+ export function cameraForBounds(bounds, size, options) {
386
+ const tileSize = options?.tileSize ?? DEFAULT_TILE_SIZE;
387
+ const padding = options?.padding ?? 0;
388
+ const minZoom = options?.minZoom ?? 0;
389
+ const maxZoom = options?.maxZoom ?? 22;
390
+ const west = mercatorXFromLon(bounds.west);
391
+ let east = mercatorXFromLon(bounds.east);
392
+ // A box written across the antimeridian (west 170, east -170) is 20° wide,
393
+ // not 340°.
394
+ if (east < west)
395
+ east += 1;
396
+ const north = mercatorYFromLat(bounds.north);
397
+ const south = mercatorYFromLat(bounds.south);
398
+ const dx = Math.max(east - west, 1e-12);
399
+ const dy = Math.max(south - north, 1e-12);
400
+ const usableW = Math.max(1, size.width - padding * 2);
401
+ const usableH = Math.max(1, size.height - padding * 2);
402
+ const zoom = clamp(Math.log2(Math.min(usableW / (dx * tileSize), usableH / (dy * tileSize))), minZoom, maxZoom);
403
+ const mx = (west + east) / 2;
404
+ return {
405
+ center: {
406
+ lon: wrapLon(lonFromMercatorX(mx)),
407
+ lat: latFromMercatorY((north + south) / 2),
408
+ },
409
+ zoom,
410
+ };
411
+ }
412
+ /** The box that contains every position given, or null for none. Grows east
413
+ * rather than wrapping, so a set spanning the antimeridian comes back with
414
+ * `west > east` and {@link cameraForBounds} reads it the same way. */
415
+ export function boundsOf(positions) {
416
+ if (positions.length === 0)
417
+ return null;
418
+ let west = Infinity;
419
+ let east = -Infinity;
420
+ let south = Infinity;
421
+ let north = -Infinity;
422
+ for (const p of positions) {
423
+ const lon = wrapLon(p.lon);
424
+ if (lon < west)
425
+ west = lon;
426
+ if (lon > east)
427
+ east = lon;
428
+ if (p.lat < south)
429
+ south = p.lat;
430
+ if (p.lat > north)
431
+ north = p.lat;
432
+ }
433
+ // Two points either side of the antimeridian look 340° apart the long way
434
+ // round and 20° apart the short way; the short way is what was meant.
435
+ if (east - west > 180) {
436
+ let w = Infinity;
437
+ let e = -Infinity;
438
+ for (const p of positions) {
439
+ const lon = wrapLon(p.lon);
440
+ const shifted = lon < 0 ? lon + 360 : lon;
441
+ if (shifted < w)
442
+ w = shifted;
443
+ if (shifted > e)
444
+ e = shifted;
445
+ }
446
+ if (e - w < east - west)
447
+ return { west: wrapLon(w), east: wrapLon(e), south, north };
448
+ }
449
+ return { west, east, south, north };
450
+ }
451
+ //# sourceMappingURL=proj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proj.js","sourceRoot":"","sources":["../../src/maps/proj.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,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