@trackunit/react-map-adapter-google 0.0.201-alpha-b8d3d323d1a.0 → 0.0.201
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.
- package/index.cjs.js +674 -282
- package/index.esm.js +675 -283
- package/migrations/entry.js.map +1 -0
- package/package.json +5 -5
- package/src/GoogleMapsLayerPort.d.ts +136 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../../../../libs/react/map-adapter-google/migrations/entry.ts"],"names":[],"mappings":"","sourcesContent":["export {};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-map-adapter-google",
|
|
3
|
-
"version": "0.0.201
|
|
3
|
+
"version": "0.0.201",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"@loaders.gl/core": "~4.5.2",
|
|
15
15
|
"@luma.gl/core": "^9.4.1",
|
|
16
16
|
"@luma.gl/engine": "^9.4.1",
|
|
17
|
-
"@trackunit/react-map-adapter-shared": "0.0.
|
|
18
|
-
"@trackunit/react-map-color-utils": "0.0.
|
|
19
|
-
"@trackunit/geo-json-utils": "1.21.
|
|
17
|
+
"@trackunit/react-map-adapter-shared": "0.0.210",
|
|
18
|
+
"@trackunit/react-map-color-utils": "0.0.183",
|
|
19
|
+
"@trackunit/geo-json-utils": "1.21.42",
|
|
20
20
|
"@googlemaps/markerclusterer": "^2.6.2",
|
|
21
21
|
"@vis.gl/react-google-maps": "^1.7.1",
|
|
22
22
|
"es-toolkit": "^1.52.0",
|
|
23
23
|
"react-device-detect": "^2.2.3",
|
|
24
24
|
"zod": "^3.25.76",
|
|
25
|
-
"@trackunit/react-map-draw": "0.0.
|
|
25
|
+
"@trackunit/react-map-draw": "0.0.48",
|
|
26
26
|
"terra-draw-google-maps-adapter": "^1.6.2"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
@@ -70,6 +70,17 @@ export declare class GoogleMapsLayerPort implements LayerPort {
|
|
|
70
70
|
private selectedShapeFeatureId;
|
|
71
71
|
private hoveredShapeHandleId;
|
|
72
72
|
private hoveredShapeFeatureId;
|
|
73
|
+
/**
|
|
74
|
+
* The shape feature under the pointer, from Google's own mouseover and
|
|
75
|
+
* mouseout. The snapshot hover above may instead come from `layers.hover()`
|
|
76
|
+
* (a list row), which no shape change may end on the consumer's behalf.
|
|
77
|
+
*/
|
|
78
|
+
private pointerShapeHover;
|
|
79
|
+
/**
|
|
80
|
+
* The `hover-end`s queued by `endShapeHover`, by handle id then feature id,
|
|
81
|
+
* so each feature has at most one queued and the reason it was queued for.
|
|
82
|
+
*/
|
|
83
|
+
private readonly pendingShapeHoverEnds;
|
|
73
84
|
private theme;
|
|
74
85
|
private lastShapeClickTime;
|
|
75
86
|
private lastShapeClickEntity;
|
|
@@ -120,20 +131,114 @@ export declare class GoogleMapsLayerPort implements LayerPort {
|
|
|
120
131
|
private renderMarkerSource;
|
|
121
132
|
private removeMarkerSourceInternal;
|
|
122
133
|
private syncShapeSource;
|
|
123
|
-
|
|
124
|
-
|
|
134
|
+
private isShapeConfigUnchanged;
|
|
135
|
+
/**
|
|
136
|
+
* Patch a source in place. Returns the ids of the features whose shapes were
|
|
137
|
+
* touched, or null when the change needs a rebuild: the interactive mode
|
|
138
|
+
* changed, or a feature without an id (or with a duplicate id) has to be
|
|
139
|
+
* restyled or re-synced, since only shapes mapped by id can be touched one
|
|
140
|
+
* feature at a time.
|
|
141
|
+
*/
|
|
142
|
+
private patchShapeSourceInPlace;
|
|
143
|
+
/**
|
|
144
|
+
* Sync a changed features collection one feature at a time, keyed on feature
|
|
145
|
+
* id, so the shapes of every feature that is still there stay on the map: a
|
|
146
|
+
* fleet map re-emits its whole site collection after each clusters query,
|
|
147
|
+
* usually with the same sites in it, and tearing every polygon down for that
|
|
148
|
+
* blanks the map for a frame. A feature whose geometry or clipped fill changed
|
|
149
|
+
* is re-rendered, one whose resolved style or z-index changed is patched in
|
|
150
|
+
* place, a new one is rendered and a gone one removed. The antimeridian merge
|
|
151
|
+
* runs on the new collection first (the previous one is kept merged and
|
|
152
|
+
* indexed on `tracked`), so a merged feature is compared with its merged
|
|
153
|
+
* predecessor. Returns the ids of the features that are still there and were
|
|
154
|
+
* repainted with their base style (re-rendered, added or restyled; a z-index
|
|
155
|
+
* change alone repaints nothing), or null (nothing changed yet) when either
|
|
156
|
+
* collection has a feature without an id or with a duplicate id: that source
|
|
157
|
+
* is rebuilt as a whole.
|
|
158
|
+
*/
|
|
159
|
+
private syncShapeFeaturesById;
|
|
160
|
+
/** Tear the source down (update case) and build every shape from scratch. */
|
|
161
|
+
private rebuildShapeSource;
|
|
162
|
+
/** Render one feature's shapes and point markers onto `tracked`, the same way for a rebuild and an id-keyed sync. */
|
|
163
|
+
private renderShapeFeature;
|
|
125
164
|
/**
|
|
126
165
|
* Patch only features whose fill-override or z-index changed (ADR-0021 Path B).
|
|
127
|
-
* Returns the
|
|
166
|
+
* Returns the ids of the features that were re-rendered, already carrying the
|
|
167
|
+
* style from `config`.
|
|
128
168
|
*/
|
|
129
169
|
private syncShapeTilingOverrides;
|
|
170
|
+
/**
|
|
171
|
+
* Restyle only the features whose resolved style (feature style or base
|
|
172
|
+
* style) changed between two configs, on the shapes that already sit on the
|
|
173
|
+
* map. Mirrors
|
|
174
|
+
* what the create helpers derive from a style (clickability from fill
|
|
175
|
+
* visibility, hit-polyline weight from stroke width) so a patched source is
|
|
176
|
+
* indistinguishable from a rebuilt one. Features in `alreadyRebuiltFeatureIds`
|
|
177
|
+
* were just re-rendered with the new style and are skipped. Returns the ids
|
|
178
|
+
* of the features it restyled.
|
|
179
|
+
*/
|
|
180
|
+
private syncShapeFeatureStyles;
|
|
181
|
+
/**
|
|
182
|
+
* Apply `style` to every shape and point marker of one feature, in place.
|
|
183
|
+
* Returns whether the feature had anything on the map to restyle.
|
|
184
|
+
*/
|
|
185
|
+
private restyleFeatureShapes;
|
|
186
|
+
/**
|
|
187
|
+
* Whether the port can still get mouse events for a feature. Google only
|
|
188
|
+
* dispatches them on clickable shapes, and a polygon whose fill is hidden is
|
|
189
|
+
* not clickable outside stroke mode, unless the feature keeps an interactive
|
|
190
|
+
* polyline (stroke hit target, tiled outline, line) or a point marker. A
|
|
191
|
+
* feature with nothing on the map, or on a non-interactive source, has no
|
|
192
|
+
* listeners at all.
|
|
193
|
+
*/
|
|
194
|
+
private isFeatureHoverable;
|
|
195
|
+
/**
|
|
196
|
+
* End a shape hover that Google can no longer end for us. The emit is deferred
|
|
197
|
+
* because a consumer reacting to hover-end may synchronously push a new
|
|
198
|
+
* snapshot while this sync is still running. When it runs, the hover-end goes
|
|
199
|
+
* out if the latest snapshot still names this feature as hovered, or if the
|
|
200
|
+
* snapshot names no hovered feature while the pointer record still names this
|
|
201
|
+
* one (a consumer that never mirrors pointer hovers into the snapshot gets its
|
|
202
|
+
* hover-end too). A hover the consumer moved elsewhere by then is left alone:
|
|
203
|
+
* its hover-end handler clears whatever is hovered. The pointer record is
|
|
204
|
+
* kept until then, and cleared only here or by Google's own mouseout. A
|
|
205
|
+
* hover ended for a lost surface is kept after all when the surface is back
|
|
206
|
+
* by the time the emit runs (a fill hidden and shown within one tick) and the
|
|
207
|
+
* pointer still rests on the feature: Google can end that hover itself.
|
|
208
|
+
*/
|
|
209
|
+
private endShapeHover;
|
|
210
|
+
private clearPointerShapeHover;
|
|
211
|
+
/** The `ShapeType` a feature's own listeners report, looked up by id in `features`. */
|
|
212
|
+
private shapeTypeOfFeature;
|
|
130
213
|
/** Remove all map shapes (and their listeners) for a single feature id. */
|
|
131
214
|
private removeFeatureShapes;
|
|
132
|
-
/**
|
|
215
|
+
/** Take a single feature's point markers off the map; their listeners live on the dropped elements. */
|
|
216
|
+
private removeFeaturePointMarkers;
|
|
217
|
+
/**
|
|
218
|
+
* Listener rule for polygons, applied at creation and in place: a polygon of
|
|
219
|
+
* an interactive source has interaction listeners if and only if it is
|
|
220
|
+
* clickable. Google dispatches nothing on an unclickable polygon, so
|
|
221
|
+
* listeners there would only be stale state.
|
|
222
|
+
*/
|
|
223
|
+
private syncPolygonListeners;
|
|
224
|
+
/** Undo `attachShapeInteractionListeners` for one shape; a no-op when it has none. */
|
|
225
|
+
private detachShapeInteractionListeners;
|
|
226
|
+
/**
|
|
227
|
+
* Update the z-index of one feature's fill-bearing polygons (full and
|
|
228
|
+
* fill-only alike) without a geometry rebuild. Without an override the render
|
|
229
|
+
* path passes no `zIndex`, so a dropped override (a hover promotion that
|
|
230
|
+
* ended) restores that default by setting the option to undefined.
|
|
231
|
+
*/
|
|
133
232
|
private updateFeatureShapeZIndex;
|
|
134
233
|
private removeShapeSourceInternal;
|
|
135
234
|
private applyShapeSelectionState;
|
|
136
235
|
private applyShapeHoverState;
|
|
236
|
+
/**
|
|
237
|
+
* Repaint only the features a hover or selection transition touches: the one
|
|
238
|
+
* that lost it and the one that got it, each on its own source. The rest of
|
|
239
|
+
* a source keeps its paint. `setTheme` is the one full repaint.
|
|
240
|
+
*/
|
|
241
|
+
private repaintInteractionTransition;
|
|
137
242
|
private syncRouteSource;
|
|
138
243
|
private removeRouteSourceInternal;
|
|
139
244
|
private syncImageOverlay;
|
|
@@ -216,8 +321,27 @@ export declare class GoogleMapsLayerPort implements LayerPort {
|
|
|
216
321
|
*
|
|
217
322
|
* Called whenever hover, selection, or theme changes on the given handleId.
|
|
218
323
|
* When neither hover nor selection targets a feature, it reverts to its base style.
|
|
324
|
+
* `onlyFeatureIds` limits the repaint to those features (in-place restyles).
|
|
219
325
|
*/
|
|
220
326
|
private applyGoogleShapeInteraction;
|
|
327
|
+
/** `base` with the interaction overrides that are set layered on top of it. */
|
|
328
|
+
private styleWithOverrides;
|
|
329
|
+
private isFillVisible;
|
|
330
|
+
/**
|
|
331
|
+
* Whether a polygon is a hit target, at creation and in place: never in stroke
|
|
332
|
+
* mode (the hit polylines take over) and never with a hidden fill. A fill-only
|
|
333
|
+
* tiling polygon additionally needs an interactive source; a full polygon stays
|
|
334
|
+
* clickable on a non-interactive source, as it always has.
|
|
335
|
+
*/
|
|
336
|
+
private isPolygonClickable;
|
|
337
|
+
/** Fill paint shared by full and fill-only polygons. */
|
|
338
|
+
private polygonFillOptionsFromStyle;
|
|
339
|
+
/** The one place polygon paint and its defaults are derived from a `ShapeStyle`. */
|
|
340
|
+
private polygonOptionsFromStyle;
|
|
341
|
+
/** The one place polyline paint and its defaults are derived from a `ShapeStyle`. */
|
|
342
|
+
private polylineOptionsFromStyle;
|
|
343
|
+
/** Width of the invisible stroke hit target; thin strokes still need a grabbable one. */
|
|
344
|
+
private strokeHitWeightFromStyle;
|
|
221
345
|
private createPolygon;
|
|
222
346
|
private createPolyline;
|
|
223
347
|
/**
|
|
@@ -226,6 +350,12 @@ export declare class GoogleMapsLayerPort implements LayerPort {
|
|
|
226
350
|
* An optional `zIndex` controls the Google Maps rendering order for hover promotion.
|
|
227
351
|
*/
|
|
228
352
|
private createFillOnlyPolygon;
|
|
353
|
+
/**
|
|
354
|
+
* One polygon ring set (a Polygon, or one part of a MultiPolygon) with its
|
|
355
|
+
* hit targets: the polygon itself outside stroke mode, invisible hit
|
|
356
|
+
* polylines in stroke mode.
|
|
357
|
+
*/
|
|
358
|
+
private renderPolygonPart;
|
|
229
359
|
/**
|
|
230
360
|
* Render a polygonal feature whose fill is tiled (ADR-0021): the visible
|
|
231
361
|
* outline is drawn from the feature's full geometry as polylines (so it stays
|
|
@@ -245,6 +375,8 @@ export declare class GoogleMapsLayerPort implements LayerPort {
|
|
|
245
375
|
*/
|
|
246
376
|
private createStrokeHitPolylines;
|
|
247
377
|
private createShapePointMarker;
|
|
378
|
+
/** The style-derived part of a point marker's element; shared by creation and in-place restyling. */
|
|
379
|
+
private applyShapePointStyle;
|
|
248
380
|
private createRoutePolyline;
|
|
249
381
|
private attachMarkerInteractionListeners;
|
|
250
382
|
private attachClusterInteractionListeners;
|