@react-x11/components 0.4.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 (219) hide show
  1. package/README.md +125 -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 +7 -1
  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/reorder/hx.d.ts +18 -0
  140. package/dist/reorder/hx.d.ts.map +1 -0
  141. package/dist/reorder/hx.js +10 -0
  142. package/dist/reorder/hx.js.map +1 -0
  143. package/dist/reorder/index.d.ts +314 -0
  144. package/dist/reorder/index.d.ts.map +1 -0
  145. package/dist/reorder/index.js +1539 -0
  146. package/dist/reorder/index.js.map +1 -0
  147. package/dist/reorder/model.d.ts +107 -0
  148. package/dist/reorder/model.d.ts.map +1 -0
  149. package/dist/reorder/model.js +162 -0
  150. package/dist/reorder/model.js.map +1 -0
  151. package/dist/richtext/node.d.ts +15 -5
  152. package/dist/richtext/node.d.ts.map +1 -1
  153. package/dist/richtext/node.js +40 -11
  154. package/dist/richtext/node.js.map +1 -1
  155. package/dist/richtext/runs.d.ts +35 -13
  156. package/dist/richtext/runs.d.ts.map +1 -1
  157. package/dist/richtext/runs.js +83 -27
  158. package/dist/richtext/runs.js.map +1 -1
  159. package/dist/tabs/index.d.ts +17 -0
  160. package/dist/tabs/index.d.ts.map +1 -1
  161. package/dist/tabs/index.js +849 -186
  162. package/dist/tabs/index.js.map +1 -1
  163. package/dist/terminal/vt/fonts.d.ts +45 -15
  164. package/dist/terminal/vt/fonts.d.ts.map +1 -1
  165. package/dist/terminal/vt/fonts.js +89 -19
  166. package/dist/terminal/vt/fonts.js.map +1 -1
  167. package/dist/terminal/vt/node.d.ts +42 -0
  168. package/dist/terminal/vt/node.d.ts.map +1 -1
  169. package/dist/terminal/vt/node.js +95 -11
  170. package/dist/terminal/vt/node.js.map +1 -1
  171. package/dist/terminal/vt/renderer.d.ts.map +1 -1
  172. package/dist/terminal/vt/renderer.js +13 -3
  173. package/dist/terminal/vt/renderer.js.map +1 -1
  174. package/package.json +13 -3
  175. package/src/charts/components.ts +14 -7
  176. package/src/charts/node.ts +81 -26
  177. package/src/charts/render.ts +16 -6
  178. package/src/code-editor/node.ts +147 -53
  179. package/src/flow/draw.ts +104 -35
  180. package/src/flow/index.ts +33 -13
  181. package/src/flow/model.ts +4 -2
  182. package/src/flow/node.ts +158 -59
  183. package/src/flow/types.ts +46 -21
  184. package/src/formula/index.ts +4 -2
  185. package/src/formula/node.ts +24 -5
  186. package/src/html/controls.ts +4 -1
  187. package/src/html/css/cascade.ts +18 -7
  188. package/src/html/css/parse.ts +46 -21
  189. package/src/html/css/style.ts +6 -1
  190. package/src/html/css/values.ts +25 -9
  191. package/src/html/index.ts +1 -0
  192. package/src/html/layout/boxes.ts +19 -9
  193. package/src/html/layout/inline.ts +23 -1
  194. package/src/html/node.ts +110 -17
  195. package/src/html/paint.ts +17 -2
  196. package/src/index.ts +98 -0
  197. package/src/maps/clip.ts +184 -0
  198. package/src/maps/gzip.ts +66 -0
  199. package/src/maps/index.ts +316 -0
  200. package/src/maps/labels.ts +442 -0
  201. package/src/maps/mvt.ts +857 -0
  202. package/src/maps/node.ts +1819 -0
  203. package/src/maps/overlay.ts +639 -0
  204. package/src/maps/paint.ts +978 -0
  205. package/src/maps/proj.ts +641 -0
  206. package/src/maps/sources.ts +425 -0
  207. package/src/maps/style.ts +309 -0
  208. package/src/maps/styles.ts +1040 -0
  209. package/src/maps/tiles.ts +676 -0
  210. package/src/maps/types.ts +260 -0
  211. package/src/reorder/hx.ts +31 -0
  212. package/src/reorder/index.ts +2223 -0
  213. package/src/reorder/model.ts +232 -0
  214. package/src/richtext/node.ts +49 -14
  215. package/src/richtext/runs.ts +115 -30
  216. package/src/tabs/index.ts +1040 -204
  217. package/src/terminal/vt/fonts.ts +128 -36
  218. package/src/terminal/vt/node.ts +105 -12
  219. package/src/terminal/vt/renderer.ts +13 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/maps/labels.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAY,cAAc,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG/D,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGnD;kCACkC;AAClC,MAAM,WAAW,SAAS;IACxB,MAAM,CACJ,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC;QACD,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAChD,CAAC;CACH;AAED;+DAC+D;AAC/D,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QAAE,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CAC5D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B;mCAC+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX;;6DAEyD;IACzD,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,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,wBAAgB,WAAW,CACzB,UAAU,EAAE,SAAS,cAAc,EAAE,EACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7B,WAAW,EAAE,CAgGf;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,SAAS,WAAW,EAAE,EAC9B,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC7D,KAAK,EAAE,MAAM,EACb,IAAI,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,EACpE,MAAM,EAAE,WAAW,GAClB,MAAM,CAyCR;AAED,YAAY,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,323 @@
1
+ import { GeomType, GeometryBuffer } from './mvt.js';
2
+ import { resolveZoomed } from './style.js';
3
+ import { tileCountAt, tileKey } from './proj.js';
4
+ function num(value, zoom, fallback) {
5
+ return value === undefined ? fallback : resolveZoomed(value, zoom);
6
+ }
7
+ /**
8
+ * The label candidates one tile contributes.
9
+ *
10
+ * Point geometry anchors at the point. Line and polygon geometry anchor at
11
+ * the **midpoint of the longest part** — which is not a true label
12
+ * placement (a street name should follow its street, and a country name
13
+ * should sit at the pole of inaccessibility of its border) but is the
14
+ * anchor those two would start from, and is right often enough to be worth
15
+ * having while line placement is unwritten. See `docs/prd-maps.md`.
16
+ */
17
+ export function collectLabels(tile, id, prepared, zoom, buffer) {
18
+ const out = [];
19
+ const n = tileCountAt(id.z);
20
+ const key = tileKey(id);
21
+ for (let i = 0; i < prepared.layers.length; i++) {
22
+ const { layer, filter } = prepared.layers[i];
23
+ if (layer.type !== 'symbol' || layer.visible === false)
24
+ continue;
25
+ if (layer.minZoom !== undefined && zoom < layer.minZoom)
26
+ continue;
27
+ if (layer.maxZoom !== undefined && zoom >= layer.maxZoom)
28
+ continue;
29
+ const source = tile.layers.get(layer.sourceLayer);
30
+ if (!source || source.length === 0)
31
+ continue;
32
+ const symbol = layer;
33
+ const size = num(symbol.textSize, zoom, 12);
34
+ const color = symbol.textColor
35
+ ? resolveZoomed(symbol.textColor, zoom)
36
+ : '#000000';
37
+ const halo = symbol.textHaloColor
38
+ ? resolveZoomed(symbol.textHaloColor, zoom)
39
+ : undefined;
40
+ const haloWidth = num(symbol.textHaloWidth, zoom, 1);
41
+ const rank = symbol.rank ?? 0;
42
+ const repeat = symbol.repeatDistance ?? 250;
43
+ const extent = source.extent;
44
+ const cursor = source.feature(0);
45
+ for (let f = 0; f < source.length; f++) {
46
+ source.seek(f, cursor);
47
+ if (!filter(cursor))
48
+ continue;
49
+ const raw = cursor.get(symbol.textField);
50
+ // The schema's fallback: a translated name field is absent for most
51
+ // features, and the local `name` is what a map without a translation
52
+ // shows rather than nothing.
53
+ const text = typeof raw === 'string' && raw.length > 0
54
+ ? raw
55
+ : symbol.textField !== 'name'
56
+ ? typeof cursor.get('name') === 'string'
57
+ ? String(cursor.get('name'))
58
+ : ''
59
+ : '';
60
+ if (text.length === 0)
61
+ continue;
62
+ cursor.readGeometry(buffer);
63
+ const anchor = anchorOf(buffer, cursor.type);
64
+ if (!anchor)
65
+ continue;
66
+ out.push({
67
+ id: `${key}:${layer.id}:${f}`,
68
+ key: `${layer.id}|${text}`,
69
+ text,
70
+ // Tile-local to normalized mercator, the same arithmetic the
71
+ // rasterizer's transform does and for the same precision reason.
72
+ mx: (id.x + anchor.x / extent) / n,
73
+ my: (id.y + anchor.y / extent) / n,
74
+ rank,
75
+ size,
76
+ color,
77
+ halo,
78
+ haloWidth,
79
+ repeat,
80
+ });
81
+ }
82
+ }
83
+ return out;
84
+ }
85
+ function anchorOf(buffer, type) {
86
+ if (buffer.points === 0)
87
+ return null;
88
+ if (type === GeomType.Point) {
89
+ return { x: buffer.coords[0], y: buffer.coords[1] };
90
+ }
91
+ // The longest part, by its box — a cheap stand-in for arc length that
92
+ // does not need a second pass over the vertices.
93
+ let best = 0;
94
+ let bestSpan = -1;
95
+ for (let part = 0; part < buffer.parts; part++) {
96
+ const at = part * 4;
97
+ const span = buffer.partBounds[at + 2] -
98
+ buffer.partBounds[at] +
99
+ (buffer.partBounds[at + 3] - buffer.partBounds[at + 1]);
100
+ if (span > bestSpan) {
101
+ bestSpan = span;
102
+ best = part;
103
+ }
104
+ }
105
+ const from = buffer.starts[best];
106
+ const to = buffer.starts[best + 1];
107
+ if (to <= from)
108
+ return null;
109
+ const mid = from + ((to - from) >> 1);
110
+ return { x: buffer.coords[mid * 2], y: buffer.coords[mid * 2 + 1] };
111
+ }
112
+ /** Cache of shaped strings, owned by the element. */
113
+ export class LabelShaper {
114
+ _cache = new Map();
115
+ _fonts;
116
+ _family;
117
+ /** Device pixels per logical pixel. Text is shaped at the device size the
118
+ * panel wants, exactly as core shapes a `<text>` — a label on a retina
119
+ * screen is sharper, not bigger. */
120
+ _scale;
121
+ constructor(fonts, family, scale) {
122
+ this._fonts = fonts;
123
+ this._family = family;
124
+ this._scale = scale;
125
+ }
126
+ /** Re-point at a new font manager, face or scale, dropping what was
127
+ * shaped for the old one. */
128
+ reconfigure(fonts, family, scale) {
129
+ if (this._fonts === fonts &&
130
+ this._family === family &&
131
+ this._scale === scale) {
132
+ return;
133
+ }
134
+ this._fonts = fonts;
135
+ this._family = family;
136
+ this._scale = scale;
137
+ this._cache.clear();
138
+ }
139
+ /** Shape one label, or null on a backend with no font manager. Widths
140
+ * come back in **logical** pixels, which is what placement is in. */
141
+ shape(text, size, color) {
142
+ const fonts = this._fonts;
143
+ if (!fonts)
144
+ return null;
145
+ const key = `${this._family}|${size}|${color}|${text}`;
146
+ const hit = this._cache.get(key);
147
+ if (hit)
148
+ return hit;
149
+ // Bounded, so a map panned across a continent cannot turn the cache
150
+ // into a leak. Cleared wholesale rather than evicted one at a time: the
151
+ // labels on screen are re-shaped on the next frame and the cost of that
152
+ // is a few hundred strings once.
153
+ if (this._cache.size > 4000)
154
+ this._cache.clear();
155
+ const layout = fonts.layout(text, {
156
+ family: this._family,
157
+ size: size * this._scale,
158
+ weight: 400,
159
+ style: 'normal',
160
+ color,
161
+ });
162
+ const shaped = {
163
+ width: layout.width / this._scale,
164
+ height: layout.height / this._scale,
165
+ layout,
166
+ };
167
+ this._cache.set(key, shaped);
168
+ return shaped;
169
+ }
170
+ }
171
+ /**
172
+ * Place candidates against each other, in world pixels.
173
+ *
174
+ * Greedy by rank, which is what every map does: sort, and take a label if
175
+ * nothing already taken overlaps it. The order has to be **total and
176
+ * stable** — rank, then the candidate's id — because a tie broken by array
177
+ * order would flicker as tiles arrived in a different order.
178
+ */
179
+ export function placeLabels(candidates, worldSize, shaper, options) {
180
+ const padding = options?.padding ?? 2;
181
+ const sorted = [...candidates].sort((a, b) => b.rank - a.rank || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
182
+ const placed = [];
183
+ // A sparse grid over world pixels. The cell is sized for the labels
184
+ // themselves, so a box touches one or two cells and a collision test is a
185
+ // handful of comparisons rather than a scan of everything placed.
186
+ const CELL = 64;
187
+ const grid = new Map();
188
+ const cellKey = (cx, cy) => cx * 0x40000 + cy;
189
+ /** Where each distinct text has already been placed, for the
190
+ * repeat-distance rule. */
191
+ const byText = new Map();
192
+ for (const candidate of sorted) {
193
+ const shaped = shaper.shape(candidate.text, candidate.size, candidate.color);
194
+ if (!shaped)
195
+ return placed; // no font manager: nothing can be measured
196
+ const wx = candidate.mx * worldSize;
197
+ const wy = candidate.my * worldSize;
198
+ // The repeat test before the overlap test, because it is the cheaper
199
+ // one and because it is what rejects most of a street layer: a street
200
+ // is one feature per segment, so the same name arrives a dozen times
201
+ // strung out along the road, none of them overlapping any other.
202
+ if (candidate.repeat > 0) {
203
+ const already = byText.get(candidate.key);
204
+ if (already) {
205
+ const limit = candidate.repeat * candidate.repeat;
206
+ let tooClose = false;
207
+ for (const at of already) {
208
+ const dx = at.wx - wx;
209
+ const dy = at.wy - wy;
210
+ if (dx * dx + dy * dy < limit) {
211
+ tooClose = true;
212
+ break;
213
+ }
214
+ }
215
+ if (tooClose)
216
+ continue;
217
+ }
218
+ }
219
+ const width = shaped.width + padding * 2;
220
+ const height = shaped.height + padding * 2;
221
+ const left = wx - width / 2;
222
+ const top = wy - height / 2;
223
+ const x0 = Math.floor(left / CELL);
224
+ const x1 = Math.floor((left + width) / CELL);
225
+ const y0 = Math.floor(top / CELL);
226
+ const y1 = Math.floor((top + height) / CELL);
227
+ let free = true;
228
+ for (let cx = x0; cx <= x1 && free; cx++) {
229
+ for (let cy = y0; cy <= y1 && free; cy++) {
230
+ const bucket = grid.get(cellKey(cx, cy));
231
+ if (!bucket)
232
+ continue;
233
+ for (const other of bucket) {
234
+ if (left < other.wx - other.width / 2 + other.width &&
235
+ left + width > other.wx - other.width / 2 &&
236
+ top < other.wy - other.height / 2 + other.height &&
237
+ top + height > other.wy - other.height / 2) {
238
+ free = false;
239
+ break;
240
+ }
241
+ }
242
+ }
243
+ }
244
+ if (!free)
245
+ continue;
246
+ const entry = {
247
+ ...candidate,
248
+ wx,
249
+ wy,
250
+ width,
251
+ height,
252
+ shaped,
253
+ };
254
+ placed.push(entry);
255
+ if (candidate.repeat > 0) {
256
+ const already = byText.get(candidate.key);
257
+ if (already)
258
+ already.push({ wx, wy });
259
+ else
260
+ byText.set(candidate.key, [{ wx, wy }]);
261
+ }
262
+ for (let cx = x0; cx <= x1; cx++) {
263
+ for (let cy = y0; cy <= y1; cy++) {
264
+ const at = cellKey(cx, cy);
265
+ const bucket = grid.get(at);
266
+ if (bucket)
267
+ bucket.push(entry);
268
+ else
269
+ grid.set(at, [entry]);
270
+ }
271
+ }
272
+ }
273
+ return placed;
274
+ }
275
+ /**
276
+ * Draw the placed labels that land in the pane.
277
+ *
278
+ * The halo is the same string shaped a second time in the halo colour and
279
+ * drawn four times around the glyphs, rather than a real outline: ntk has
280
+ * no glyph-outline stroke, and both runs are cached, so a label costs five
281
+ * composites of two shaped runs. That is cheap for the few dozen labels a
282
+ * pane holds and it is the difference between a place name that is
283
+ * readable over a motorway and one that is not.
284
+ */
285
+ export function drawLabels(ctx, placed, transform, pane, scale, clip, shaper) {
286
+ let drawn = 0;
287
+ const world = transform.world;
288
+ const originX = pane.x + transform.paneX - transform.centerX * world;
289
+ const originY = pane.y + transform.paneY - transform.centerY * world;
290
+ for (const label of placed) {
291
+ const x = originX + label.wx - label.shaped.width / 2;
292
+ const y = originY + label.wy - label.shaped.height / 2;
293
+ if (x + label.shaped.width < pane.x ||
294
+ y + label.shaped.height < pane.y ||
295
+ x > pane.x + pane.width ||
296
+ y > pane.y + pane.height) {
297
+ continue;
298
+ }
299
+ if (clip &&
300
+ (x + label.shaped.width < clip.x ||
301
+ y + label.shaped.height < clip.y ||
302
+ x > clip.x + clip.width ||
303
+ y > clip.y + clip.height)) {
304
+ continue;
305
+ }
306
+ const dx = Math.round(x * scale);
307
+ const dy = Math.round(y * scale);
308
+ if (label.halo !== undefined && label.haloWidth > 0) {
309
+ const halo = shaper.shape(label.text, label.size, label.halo);
310
+ if (halo) {
311
+ const offset = Math.max(1, Math.round(label.haloWidth * scale));
312
+ halo.layout.draw(ctx, dx - offset, dy);
313
+ halo.layout.draw(ctx, dx + offset, dy);
314
+ halo.layout.draw(ctx, dx, dy - offset);
315
+ halo.layout.draw(ctx, dx, dy + offset);
316
+ }
317
+ }
318
+ label.shaped.layout.draw(ctx, dx, dy);
319
+ drawn++;
320
+ }
321
+ return drawn;
322
+ }
323
+ //# sourceMappingURL=labels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels.js","sourceRoot":"","sources":["../../src/maps/labels.ts"],"names":[],"mappings":"AAoBA,O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AC;QACtC,KAAK,EAAE,CAAC;IACV,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -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,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,qBAAa,cAAe,YAAW,YAAY;IACjD,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,SAAK;IACV,MAAM,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