@react-x11/components 0.3.0 → 0.5.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 (314) hide show
  1. package/README.md +131 -4
  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 +11 -1
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +26 -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/qml/containers.d.ts +3 -0
  140. package/dist/qml/containers.d.ts.map +1 -0
  141. package/dist/qml/containers.js +331 -0
  142. package/dist/qml/containers.js.map +1 -0
  143. package/dist/qml/controls.d.ts +12 -0
  144. package/dist/qml/controls.d.ts.map +1 -0
  145. package/dist/qml/controls.js +21 -0
  146. package/dist/qml/controls.js.map +1 -0
  147. package/dist/qml/globals.d.ts +6 -0
  148. package/dist/qml/globals.d.ts.map +1 -0
  149. package/dist/qml/globals.js +25 -0
  150. package/dist/qml/globals.js.map +1 -0
  151. package/dist/qml/index.d.ts +15 -0
  152. package/dist/qml/index.d.ts.map +1 -0
  153. package/dist/qml/index.js +25 -0
  154. package/dist/qml/index.js.map +1 -0
  155. package/dist/qml/interaction.d.ts +12 -0
  156. package/dist/qml/interaction.d.ts.map +1 -0
  157. package/dist/qml/interaction.js +246 -0
  158. package/dist/qml/interaction.js.map +1 -0
  159. package/dist/qml/ir.d.ts +106 -0
  160. package/dist/qml/ir.d.ts.map +1 -0
  161. package/dist/qml/ir.js +7 -0
  162. package/dist/qml/ir.js.map +1 -0
  163. package/dist/qml/layouts.d.ts +3 -0
  164. package/dist/qml/layouts.d.ts.map +1 -0
  165. package/dist/qml/layouts.js +122 -0
  166. package/dist/qml/layouts.js.map +1 -0
  167. package/dist/qml/models.d.ts +14 -0
  168. package/dist/qml/models.d.ts.map +1 -0
  169. package/dist/qml/models.js +80 -0
  170. package/dist/qml/models.js.map +1 -0
  171. package/dist/qml/objects.d.ts +228 -0
  172. package/dist/qml/objects.d.ts.map +1 -0
  173. package/dist/qml/objects.js +1103 -0
  174. package/dist/qml/objects.js.map +1 -0
  175. package/dist/qml/parse.d.ts +10 -0
  176. package/dist/qml/parse.d.ts.map +1 -0
  177. package/dist/qml/parse.js +607 -0
  178. package/dist/qml/parse.js.map +1 -0
  179. package/dist/qml/qtquick.d.ts +7 -0
  180. package/dist/qml/qtquick.d.ts.map +1 -0
  181. package/dist/qml/qtquick.js +347 -0
  182. package/dist/qml/qtquick.js.map +1 -0
  183. package/dist/qml/react.d.ts +83 -0
  184. package/dist/qml/react.d.ts.map +1 -0
  185. package/dist/qml/react.js +323 -0
  186. package/dist/qml/react.js.map +1 -0
  187. package/dist/qml/resolver.d.ts +38 -0
  188. package/dist/qml/resolver.d.ts.map +1 -0
  189. package/dist/qml/resolver.js +64 -0
  190. package/dist/qml/resolver.js.map +1 -0
  191. package/dist/qml/slots.d.ts +65 -0
  192. package/dist/qml/slots.d.ts.map +1 -0
  193. package/dist/qml/slots.js +230 -0
  194. package/dist/qml/slots.js.map +1 -0
  195. package/dist/qml/states.d.ts +5 -0
  196. package/dist/qml/states.d.ts.map +1 -0
  197. package/dist/qml/states.js +276 -0
  198. package/dist/qml/states.js.map +1 -0
  199. package/dist/qml/view-utils.d.ts +42 -0
  200. package/dist/qml/view-utils.d.ts.map +1 -0
  201. package/dist/qml/view-utils.js +121 -0
  202. package/dist/qml/view-utils.js.map +1 -0
  203. package/dist/reorder/hx.d.ts +18 -0
  204. package/dist/reorder/hx.d.ts.map +1 -0
  205. package/dist/reorder/hx.js +10 -0
  206. package/dist/reorder/hx.js.map +1 -0
  207. package/dist/reorder/index.d.ts +314 -0
  208. package/dist/reorder/index.d.ts.map +1 -0
  209. package/dist/reorder/index.js +1539 -0
  210. package/dist/reorder/index.js.map +1 -0
  211. package/dist/reorder/model.d.ts +107 -0
  212. package/dist/reorder/model.d.ts.map +1 -0
  213. package/dist/reorder/model.js +162 -0
  214. package/dist/reorder/model.js.map +1 -0
  215. package/dist/richtext/node.d.ts +15 -5
  216. package/dist/richtext/node.d.ts.map +1 -1
  217. package/dist/richtext/node.js +40 -11
  218. package/dist/richtext/node.js.map +1 -1
  219. package/dist/richtext/runs.d.ts +35 -13
  220. package/dist/richtext/runs.d.ts.map +1 -1
  221. package/dist/richtext/runs.js +83 -27
  222. package/dist/richtext/runs.js.map +1 -1
  223. package/dist/tabs/hx.d.ts +18 -0
  224. package/dist/tabs/hx.d.ts.map +1 -0
  225. package/dist/tabs/hx.js +10 -0
  226. package/dist/tabs/hx.js.map +1 -0
  227. package/dist/tabs/index.d.ts +160 -0
  228. package/dist/tabs/index.d.ts.map +1 -0
  229. package/dist/tabs/index.js +1265 -0
  230. package/dist/tabs/index.js.map +1 -0
  231. package/dist/terminal/vt/fonts.d.ts +45 -15
  232. package/dist/terminal/vt/fonts.d.ts.map +1 -1
  233. package/dist/terminal/vt/fonts.js +89 -19
  234. package/dist/terminal/vt/fonts.js.map +1 -1
  235. package/dist/terminal/vt/index.d.ts +1 -1
  236. package/dist/terminal/vt/index.d.ts.map +1 -1
  237. package/dist/terminal/vt/index.js +3 -3
  238. package/dist/terminal/vt/index.js.map +1 -1
  239. package/dist/terminal/vt/node.d.ts +42 -0
  240. package/dist/terminal/vt/node.d.ts.map +1 -1
  241. package/dist/terminal/vt/node.js +95 -11
  242. package/dist/terminal/vt/node.js.map +1 -1
  243. package/dist/terminal/vt/pty.d.ts +16 -0
  244. package/dist/terminal/vt/pty.d.ts.map +1 -1
  245. package/dist/terminal/vt/pty.js +186 -0
  246. package/dist/terminal/vt/pty.js.map +1 -1
  247. package/dist/terminal/vt/renderer.d.ts.map +1 -1
  248. package/dist/terminal/vt/renderer.js +13 -3
  249. package/dist/terminal/vt/renderer.js.map +1 -1
  250. package/package.json +23 -3
  251. package/src/charts/components.ts +14 -7
  252. package/src/charts/node.ts +81 -26
  253. package/src/charts/render.ts +16 -6
  254. package/src/code-editor/node.ts +147 -53
  255. package/src/flow/draw.ts +104 -35
  256. package/src/flow/index.ts +33 -13
  257. package/src/flow/model.ts +4 -2
  258. package/src/flow/node.ts +158 -59
  259. package/src/flow/types.ts +46 -21
  260. package/src/formula/index.ts +4 -2
  261. package/src/formula/node.ts +24 -5
  262. package/src/html/controls.ts +4 -1
  263. package/src/html/css/cascade.ts +18 -7
  264. package/src/html/css/parse.ts +46 -21
  265. package/src/html/css/style.ts +6 -1
  266. package/src/html/css/values.ts +25 -9
  267. package/src/html/index.ts +1 -0
  268. package/src/html/layout/boxes.ts +19 -9
  269. package/src/html/layout/inline.ts +23 -1
  270. package/src/html/node.ts +110 -17
  271. package/src/html/paint.ts +17 -2
  272. package/src/index.ts +142 -0
  273. package/src/maps/clip.ts +184 -0
  274. package/src/maps/gzip.ts +66 -0
  275. package/src/maps/index.ts +316 -0
  276. package/src/maps/labels.ts +442 -0
  277. package/src/maps/mvt.ts +857 -0
  278. package/src/maps/node.ts +1819 -0
  279. package/src/maps/overlay.ts +639 -0
  280. package/src/maps/paint.ts +978 -0
  281. package/src/maps/proj.ts +641 -0
  282. package/src/maps/sources.ts +425 -0
  283. package/src/maps/style.ts +309 -0
  284. package/src/maps/styles.ts +1040 -0
  285. package/src/maps/tiles.ts +676 -0
  286. package/src/maps/types.ts +260 -0
  287. package/src/qml/containers.tsx +380 -0
  288. package/src/qml/controls.tsx +47 -0
  289. package/src/qml/globals.ts +33 -0
  290. package/src/qml/index.ts +67 -0
  291. package/src/qml/interaction.tsx +317 -0
  292. package/src/qml/ir.ts +80 -0
  293. package/src/qml/layouts.tsx +141 -0
  294. package/src/qml/models.ts +101 -0
  295. package/src/qml/objects.ts +1431 -0
  296. package/src/qml/parse.ts +624 -0
  297. package/src/qml/qtquick.tsx +413 -0
  298. package/src/qml/react.tsx +454 -0
  299. package/src/qml/resolver.ts +99 -0
  300. package/src/qml/slots.ts +249 -0
  301. package/src/qml/states.ts +318 -0
  302. package/src/qml/view-utils.ts +140 -0
  303. package/src/reorder/hx.ts +31 -0
  304. package/src/reorder/index.ts +2223 -0
  305. package/src/reorder/model.ts +232 -0
  306. package/src/richtext/node.ts +49 -14
  307. package/src/richtext/runs.ts +115 -30
  308. package/src/tabs/hx.ts +31 -0
  309. package/src/tabs/index.ts +1686 -0
  310. package/src/terminal/vt/fonts.ts +128 -36
  311. package/src/terminal/vt/index.ts +4 -2
  312. package/src/terminal/vt/node.ts +105 -12
  313. package/src/terminal/vt/pty.ts +243 -0
  314. package/src/terminal/vt/renderer.ts +13 -3
@@ -0,0 +1,244 @@
1
+ /** What a feature's geometry is. The numbers are the specification's. */
2
+ export declare const enum GeomType {
3
+ Unknown = 0,
4
+ Point = 1,
5
+ LineString = 2,
6
+ Polygon = 3
7
+ }
8
+ /** A tag value. MVT's seven value types collapse to these three in
9
+ * JavaScript; which of the four numeric ones it was is not information a
10
+ * style can use. */
11
+ export type FeatureValue = string | number | boolean;
12
+ /**
13
+ * Decoded geometry, as flat typed arrays.
14
+ *
15
+ * `coords` is `[x0, y0, x1, y1, …]` in **tile-local integers** — the space
16
+ * `extent` divides, not pixels and not degrees. `starts` indexes it in
17
+ * *points*: part `i` covers `coords[2 * starts[i] .. 2 * starts[i + 1])`,
18
+ * and `starts` has `parts + 1` entries so the last part needs no special
19
+ * case.
20
+ *
21
+ * `areas[i]` is part `i`'s signed area by the surveyor's formula, and is
22
+ * meaningful for {@link GeomType.Polygon} only: positive is an exterior
23
+ * ring, negative an interior one. It is filled during the same pass that
24
+ * reads the vertices, because a second pass over 4,000 points to learn one
25
+ * sign is the sort of thing that turns a 6 ms tile into an 11 ms one.
26
+ */
27
+ export interface GeometryData {
28
+ coords: Int32Array;
29
+ starts: Uint32Array;
30
+ areas: Float64Array;
31
+ parts: number;
32
+ points: number;
33
+ }
34
+ /**
35
+ * A growable {@link GeometryData} a caller keeps between features.
36
+ *
37
+ * The rasterizer allocates one of these per tile — or per element, since it
38
+ * is only scratch — and every feature reads into it. Capacity ratchets up
39
+ * to the largest feature seen and then stops moving, which for a tile means
40
+ * two or three grows in total rather than two per feature.
41
+ */
42
+ export declare class GeometryBuffer implements GeometryData {
43
+ coords: Int32Array;
44
+ starts: Uint32Array;
45
+ areas: Float64Array;
46
+ parts: number;
47
+ points: number;
48
+ constructor(points?: number, parts?: number);
49
+ /** Room for `points` vertices, keeping what is already written. */
50
+ reserveCoords(points: number): void;
51
+ /**
52
+ * Per-part bounding boxes, four numbers each: `minX, minY, maxX, maxY`.
53
+ *
54
+ * The feature-wide box is not enough, and the case that proves it is the
55
+ * one that dominates a low-zoom frame: OSM's `land` layer at zoom 8 is a
56
+ * **single feature** whose geometry is thousands of separate rings, most
57
+ * of them a fraction of a pixel across. Culled as one feature it is never
58
+ * culled; culled per part, almost all of it goes.
59
+ */
60
+ partBounds: Float64Array;
61
+ /** Room for `parts` parts, keeping what is already written. */
62
+ reserveParts(parts: number): void;
63
+ /** The bounding box of everything written, in tile-local integers.
64
+ * Free here — the read already touches every vertex — and what lets a
65
+ * painter skip a building that is a third of a pixel across, which at a
66
+ * country-wide zoom is most of what a tile contains. */
67
+ minX: number;
68
+ minY: number;
69
+ maxX: number;
70
+ maxY: number;
71
+ reset(): void;
72
+ }
73
+ /** A malformed tile. Thrown rather than tolerated: a truncated protobuf is
74
+ * a transport bug, and silently rendering the half of a tile that parsed
75
+ * is how a map ends up missing a river nobody can explain. */
76
+ export declare class MvtError extends Error {
77
+ constructor(message: string);
78
+ }
79
+ declare class Reader {
80
+ buf: Uint8Array;
81
+ pos: number;
82
+ end: number;
83
+ constructor(buf: Uint8Array, pos?: number, end?: number);
84
+ /**
85
+ * A varint, as a JavaScript number.
86
+ *
87
+ * Unrolled to seven bytes — 2^49, which covers every field MVT puts in a
88
+ * varint except a feature `id` that used the full 64 bits. Past that the
89
+ * slow path accumulates in floating point and loses the low bits above
90
+ * 2^53; the alternative is a BigInt per id, which costs every tile
91
+ * something to be exact about a case that does not occur in tiles cut
92
+ * from OSM (whose largest ids are ~2^33).
93
+ */
94
+ varint(): number;
95
+ /** A zigzag-encoded signed varint. */
96
+ svarint(): number;
97
+ skip(wire: number): void;
98
+ /** One view over the whole buffer rather than one per read: only a
99
+ * layer's `values` use these, but a dense tile has thousands of them. */
100
+ private _view;
101
+ private view;
102
+ float(): number;
103
+ double(): number;
104
+ string(): string;
105
+ }
106
+ /** A decoded tile: its layers, by name. Layers are ordered as the tile
107
+ * ordered them, which is the order a producer means them to be drawn in
108
+ * when a style says nothing. */
109
+ export interface VectorTile {
110
+ layers: Map<string, VectorTileLayer>;
111
+ /** Layer names in tile order. */
112
+ order: string[];
113
+ }
114
+ /**
115
+ * One layer of a tile.
116
+ *
117
+ * `keys` and `values` are decoded eagerly because MVT **deduplicates**
118
+ * them — a tile with 12,000 features has perhaps 40 keys and 2,000 distinct
119
+ * values, so decoding them once is cheaper than decoding a feature's tags
120
+ * lazily would be. Features are the other way round: their byte ranges are
121
+ * collected on construction and nothing inside one is touched until it is
122
+ * asked for.
123
+ */
124
+ export declare class VectorTileLayer {
125
+ readonly name: string;
126
+ readonly version: number;
127
+ /** Tile-local coordinate units across the tile's square. 4096 unless the
128
+ * producer said otherwise. */
129
+ readonly extent: number;
130
+ readonly keys: string[];
131
+ readonly values: FeatureValue[];
132
+ /** How many features. */
133
+ readonly length: number;
134
+ private readonly _buf;
135
+ /** Byte offset of feature `i`, with a sentinel: `[starts[i], starts[i+1])`
136
+ * is not a valid span (features are not contiguous), so both ends are
137
+ * stored. */
138
+ private readonly _at;
139
+ private readonly _to;
140
+ private _keyIndex;
141
+ constructor(reader: Reader, end: number);
142
+ /** Which tag index a key name has, or -1. Built on first use, because a
143
+ * style usually reads two or three of a layer's forty keys. */
144
+ keyIndex(key: string): number;
145
+ /** Feature `i`, as a fresh cursor. */
146
+ feature(i: number): FeatureCursor;
147
+ /**
148
+ * Point an existing cursor at feature `i`.
149
+ *
150
+ * The whole reason the cursor is a separate object: a rasterizer walks
151
+ * twelve thousand features and wants none of them to be an allocation.
152
+ */
153
+ seek(i: number, cursor: FeatureCursor): FeatureCursor;
154
+ /** Every feature, as fresh cursors. Convenience — the allocation-free
155
+ * path is {@link seek}. */
156
+ features(): Generator<FeatureCursor>;
157
+ }
158
+ /** A position on a cursor's feature. */
159
+ export interface TilePoint {
160
+ x: number;
161
+ y: number;
162
+ }
163
+ /**
164
+ * One feature, as a movable cursor over the tile's bytes.
165
+ *
166
+ * Nothing inside the feature is decoded until it is asked for, and a
167
+ * cursor's own state is four numbers, so `layer.seek(i, cursor)` in a loop
168
+ * allocates nothing.
169
+ */
170
+ export declare class FeatureCursor {
171
+ /** The feature's `id`, or undefined when it carries none. Ids above 2^53
172
+ * lose their low bits — see {@link Reader.varint}. */
173
+ id: number | undefined;
174
+ type: GeomType;
175
+ layer: VectorTileLayer | null;
176
+ private _buf;
177
+ private _tagAt;
178
+ private _tagTo;
179
+ private _geomAt;
180
+ private _geomTo;
181
+ /**
182
+ * The feature's tags as key/value **indices**, decoded on the first
183
+ * {@link get} and reused for every one after it.
184
+ *
185
+ * The reason this exists rather than a scan of the bytes per call: a
186
+ * style asks the same feature about the same two or three keys once per
187
+ * style layer over that source layer, and a road network is fourteen
188
+ * such layers (seven classes, a casing pass and a fill pass). Re-decoding
189
+ * a feature's varints fourteen times over is, on the corpus, most of the
190
+ * cost of a zoom-12 tile. Decoded once, a lookup is a scan over a dozen
191
+ * integers.
192
+ */
193
+ private _tagKeys;
194
+ private _tagValues;
195
+ private _tagCount;
196
+ /** @internal */
197
+ _bind(layer: VectorTileLayer, buf: Uint8Array, at: number, to: number): void;
198
+ /** Tile-local units across this feature's tile. */
199
+ get extent(): number;
200
+ /**
201
+ * One tag, by key name.
202
+ *
203
+ * A linear scan of the tag pairs rather than a materialized object: a
204
+ * feature has five to fifteen tags and a style filter reads one or two of
205
+ * them, so the scan is quicker than the object it would have built and
206
+ * costs nothing to throw away.
207
+ */
208
+ get(key: string): FeatureValue | undefined;
209
+ /** Decode the tag pairs into the cursor's own arrays. Grown, never
210
+ * shrunk, so a cursor walking a layer settles on one allocation. */
211
+ private _loadTags;
212
+ has(key: string): boolean;
213
+ /** Every tag, as an object. For a hover readout or a click payload — not
214
+ * for a filter, which should use {@link get}. */
215
+ properties(): Record<string, FeatureValue>;
216
+ /**
217
+ * Read this feature's geometry into `into`, in tile-local integers.
218
+ *
219
+ * The one hot loop in the decoder. Everything about its shape is about
220
+ * not allocating: the cursor deltas accumulate in two locals, the
221
+ * vertices go into a typed array the caller owns, and a polygon's ring
222
+ * areas and the whole feature's bounding box are accumulated in the same
223
+ * pass rather than in two more over the same points.
224
+ */
225
+ readGeometry(into: GeometryBuffer): GeometryData;
226
+ /** Geometry as arrays of its own — the convenience form. */
227
+ geometry(): GeometryData;
228
+ }
229
+ /**
230
+ * Decode a tile.
231
+ *
232
+ * Cheap: it walks the tile's top-level fields and each layer's, which is
233
+ * the layer names, their key and value tables, and one byte range per
234
+ * feature. No geometry is touched, so a style that draws four of a tile's
235
+ * fourteen layers pays for four.
236
+ *
237
+ * The bytes must be the raw protobuf. Tiles are almost always served
238
+ * `Content-Encoding: gzip` and sometimes gzipped *inside* that, which is a
239
+ * transport concern and deliberately not this function's — a source adapter
240
+ * un-gzips (`src/maps/sources.ts` does).
241
+ */
242
+ export declare function parseTile(bytes: Uint8Array): VectorTile;
243
+ export {};
244
+ //# sourceMappingURL=mvt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mvt.d.ts","sourceRoot":"","sources":["../../src/maps/mvt.ts"],"names":[],"mappings":"AAqCA,yEAAyE;AACzE,0BAAkB,QAAQ;IACxB,OAAO,IAAI;IACX,KAAK,IAAI;IACT,UAAU,IAAI;IACd,OAAO,IAAI;CACZ;AAED;;qBAEqB;AACrB,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAErD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,MAAM,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