datastake-daf 0.6.294 β†’ 0.6.296

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.
@@ -1,488 +0,0 @@
1
- import React, { useEffect, useRef } from 'react';
2
- import mapboxgl from 'mapbox-gl';
3
-
4
- /**
5
- * NoConflictGlobe - Mapbox component with aggressive CSS isolation
6
- * Uses unique CSS classes and inline styles to prevent any conflicts
7
- */
8
- const NoConflictGlobe = ({
9
- projects = [],
10
- mapConfig = {},
11
- onProjectClick = () => {},
12
- type = "default",
13
- color = "#00809E"
14
- }) => {
15
- const mapContainer = useRef(null);
16
- const map = useRef(null);
17
- const boundsRef = useRef(null);
18
-
19
- useEffect(() => {
20
- if (map.current) return;
21
-
22
- console.log('πŸ—ΊοΈ [NO CONFLICT GLOBE] Creating map with aggressive isolation...');
23
-
24
- // Set Mapbox access token
25
- mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
26
-
27
- // Create map
28
- map.current = new mapboxgl.Map({
29
- container: mapContainer.current,
30
- style: 'mapbox://styles/mapbox/satellite-v9',
31
- center: [0, 0],
32
- zoom: mapConfig.maxZoom || 3,
33
- projection: 'globe',
34
- attributionControl: false
35
- });
36
-
37
- // Add markers when map loads
38
- map.current.on('load', () => {
39
- console.log('πŸ—ΊοΈ [NO CONFLICT GLOBE] Map loaded, adding markers...');
40
-
41
- // Inject aggressive CSS isolation
42
- const styleId = 'no-conflict-globe-styles';
43
- let existingStyle = document.getElementById(styleId);
44
- if (!existingStyle) {
45
- const style = document.createElement('style');
46
- style.id = styleId;
47
- style.textContent = `
48
- /* NO CONFLICT GLOBE - Aggressive CSS Isolation */
49
- .no-conflict-globe-container {
50
- position: relative !important;
51
- width: 100% !important;
52
- height: 100% !important;
53
- overflow: hidden !important;
54
- font: 12px/20px Helvetica Neue, Arial, Helvetica, sans-serif !important;
55
- -webkit-tap-highlight-color: rgb(0 0 0/0) !important;
56
- isolation: isolate !important;
57
- }
58
-
59
- .no-conflict-globe-container .mapboxgl-canvas-container {
60
- position: relative !important;
61
- left: 0 !important;
62
- top: 0 !important;
63
- transform: none !important;
64
- width: 100% !important;
65
- height: 100% !important;
66
- overflow: hidden !important;
67
- isolation: isolate !important;
68
- }
69
-
70
- .no-conflict-globe-container .mapboxgl-canvas-container canvas {
71
- position: absolute !important;
72
- left: 0 !important;
73
- top: 0 !important;
74
- transform: none !important;
75
- width: 100% !important;
76
- height: 100% !important;
77
- isolation: isolate !important;
78
- }
79
-
80
- /* Override ALL possible Leaflet CSS interference */
81
- .no-conflict-globe-container .mapboxgl-marker {
82
- position: absolute !important;
83
- left: auto !important;
84
- top: auto !important;
85
- transform: none !important;
86
- pointer-events: auto !important;
87
- z-index: 1000 !important;
88
- isolation: isolate !important;
89
- }
90
-
91
- .no-conflict-globe-container .mapboxgl-marker .no-conflict-marker {
92
- position: relative !important;
93
- left: auto !important;
94
- top: auto !important;
95
- transform: none !important;
96
- pointer-events: auto !important;
97
- cursor: pointer !important;
98
- display: flex !important;
99
- align-items: center !important;
100
- justify-content: center !important;
101
- isolation: isolate !important;
102
- }
103
-
104
- /* Override Leaflet pane positioning */
105
- .no-conflict-globe-container .mapboxgl-marker-pane {
106
- position: absolute !important;
107
- left: 0 !important;
108
- top: 0 !important;
109
- transform: none !important;
110
- z-index: 600 !important;
111
- isolation: isolate !important;
112
- }
113
-
114
- .no-conflict-globe-container .mapboxgl-tile-container {
115
- position: absolute !important;
116
- left: 0 !important;
117
- top: 0 !important;
118
- transform: none !important;
119
- isolation: isolate !important;
120
- }
121
-
122
- .no-conflict-globe-container .mapboxgl-zoom-animated {
123
- transform-origin: 0 0 !important;
124
- isolation: isolate !important;
125
- }
126
-
127
- .no-conflict-globe-container .mapboxgl-marker.leaflet-interactive {
128
- cursor: pointer !important;
129
- }
130
-
131
- /* Popup styles with isolation */
132
- .no-conflict-globe-container .mapboxgl-popup {
133
- position: absolute !important;
134
- left: auto !important;
135
- top: auto !important;
136
- transform: none !important;
137
- z-index: 700 !important;
138
- text-align: center !important;
139
- margin-bottom: 20px !important;
140
- isolation: isolate !important;
141
- }
142
-
143
- .no-conflict-globe-container .mapboxgl-popup-content-wrapper {
144
- padding: 1px !important;
145
- text-align: left !important;
146
- border-radius: 12px !important;
147
- background: white !important;
148
- color: #333 !important;
149
- box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4) !important;
150
- isolation: isolate !important;
151
- }
152
-
153
- .no-conflict-globe-container .mapboxgl-popup-content {
154
- margin: 13px 24px 13px 20px !important;
155
- line-height: 1.3 !important;
156
- font-size: 13px !important;
157
- min-height: 1px !important;
158
- isolation: isolate !important;
159
- }
160
-
161
- .no-conflict-globe-container .mapboxgl-popup-content p {
162
- margin: 17px 0 !important;
163
- }
164
-
165
- .no-conflict-globe-container .mapboxgl-popup-tip-container {
166
- width: 40px !important;
167
- height: 20px !important;
168
- position: absolute !important;
169
- left: 50% !important;
170
- margin-top: -1px !important;
171
- margin-left: -20px !important;
172
- overflow: hidden !important;
173
- pointer-events: none !important;
174
- isolation: isolate !important;
175
- }
176
-
177
- .no-conflict-globe-container .mapboxgl-popup-tip {
178
- width: 17px !important;
179
- height: 17px !important;
180
- padding: 1px !important;
181
- margin: -10px auto 0 !important;
182
- pointer-events: auto !important;
183
- transform: rotate(45deg) !important;
184
- background: white !important;
185
- box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4) !important;
186
- isolation: isolate !important;
187
- }
188
-
189
- .no-conflict-globe-container .mapboxgl-popup-close-button {
190
- position: absolute !important;
191
- top: 0 !important;
192
- right: 0 !important;
193
- border: none !important;
194
- text-align: center !important;
195
- width: 24px !important;
196
- height: 24px !important;
197
- font: 16px/24px Tahoma, Verdana, sans-serif !important;
198
- color: #757575 !important;
199
- text-decoration: none !important;
200
- background: transparent !important;
201
- cursor: pointer !important;
202
- isolation: isolate !important;
203
- }
204
-
205
- .no-conflict-globe-container .mapboxgl-popup-close-button:hover {
206
- color: #585858 !important;
207
- }
208
-
209
- /* Hide Mapbox attribution completely */
210
- .no-conflict-globe-container .mapboxgl-ctrl-attribution {
211
- display: none !important;
212
- }
213
-
214
- .no-conflict-globe-container .mapboxgl-ctrl-logo {
215
- display: none !important;
216
- }
217
-
218
- /* Override any Leaflet pane positioning */
219
- .no-conflict-globe-container .mapboxgl-overlay-pane {
220
- position: absolute !important;
221
- left: 0 !important;
222
- top: 0 !important;
223
- transform: none !important;
224
- z-index: 400 !important;
225
- isolation: isolate !important;
226
- }
227
-
228
- .no-conflict-globe-container .mapboxgl-shadow-pane {
229
- position: absolute !important;
230
- left: 0 !important;
231
- top: 0 !important;
232
- transform: none !important;
233
- z-index: 500 !important;
234
- isolation: isolate !important;
235
- }
236
-
237
- .no-conflict-globe-container .mapboxgl-tooltip-pane {
238
- position: absolute !important;
239
- left: 0 !important;
240
- top: 0 !important;
241
- transform: none !important;
242
- z-index: 650 !important;
243
- isolation: isolate !important;
244
- }
245
-
246
- .no-conflict-globe-container .mapboxgl-popup-pane {
247
- position: absolute !important;
248
- left: 0 !important;
249
- top: 0 !important;
250
- transform: none !important;
251
- z-index: 700 !important;
252
- isolation: isolate !important;
253
- }
254
-
255
- /* Override any Leaflet div icon styles */
256
- .no-conflict-globe-container .mapboxgl-marker .leaflet-div-icon {
257
- background: none !important;
258
- border: none !important;
259
- position: relative !important;
260
- left: auto !important;
261
- top: auto !important;
262
- transform: none !important;
263
- }
264
-
265
- /* Override any Leaflet marker icon styles */
266
- .no-conflict-globe-container .mapboxgl-marker .leaflet-marker-icon {
267
- position: relative !important;
268
- left: auto !important;
269
- top: auto !important;
270
- transform: none !important;
271
- }
272
-
273
- /* Override any Leaflet marker shadow styles */
274
- .no-conflict-globe-container .mapboxgl-marker .leaflet-marker-shadow {
275
- display: none !important;
276
- }
277
-
278
- /* Override any Leaflet interactive styles */
279
- .no-conflict-globe-container .mapboxgl-marker.leaflet-interactive {
280
- cursor: pointer !important;
281
- pointer-events: auto !important;
282
- }
283
-
284
- /* Override any Leaflet zoom animations */
285
- .no-conflict-globe-container .mapboxgl-zoom-animated {
286
- transform-origin: 0 0 !important;
287
- }
288
-
289
- /* Override any Leaflet tile styles */
290
- .no-conflict-globe-container .mapboxgl-tile {
291
- position: absolute !important;
292
- left: 0 !important;
293
- top: 0 !important;
294
- transform: none !important;
295
- }
296
-
297
- /* Override any Leaflet image layer styles */
298
- .no-conflict-globe-container .mapboxgl-image-layer {
299
- position: absolute !important;
300
- left: 0 !important;
301
- top: 0 !important;
302
- transform: none !important;
303
- }
304
- `;
305
- document.head.appendChild(style);
306
- }
307
-
308
- // Calculate bounds to fit all markers
309
- const bounds = new mapboxgl.LngLatBounds();
310
- let hasValidCoordinates = false;
311
-
312
- projects.forEach((project, index) => {
313
- console.log(`πŸ“ [NO CONFLICT GLOBE] Adding marker ${index}:`, project);
314
-
315
- // Create marker element with unique class
316
- const el = document.createElement('div');
317
- el.className = 'no-conflict-marker';
318
- el.style.cursor = 'pointer';
319
- el.style.boxShadow = '0px 3.45px 3.45px 0px #00000029';
320
- el.style.display = 'flex';
321
- el.style.alignItems = 'center';
322
- el.style.justifyContent = 'center';
323
- el.style.position = 'relative';
324
- el.style.left = 'auto';
325
- el.style.top = 'auto';
326
- el.style.transform = 'none';
327
- el.style.zIndex = '1000';
328
- el.style.isolation = 'isolate';
329
-
330
- if (type === "location") {
331
- // Location marker - SVG map pin style
332
- el.style.width = '28px';
333
- el.style.height = '33px';
334
- el.innerHTML = `
335
- <svg
336
- width="28"
337
- height="33"
338
- viewBox="0 0 28 33"
339
- fill="none"
340
- xmlns="http://www.w3.org/2000/svg"
341
- >
342
- <path
343
- d="M5.14346 4.87419C10.0688 -0.15896 18.0528 -0.162058 22.9757 4.86861C27.6563 9.65161 27.8841 17.2616 23.6622 22.3255H23.6608C23.427 22.6141 23.1808 22.894 22.9211 23.1623L14.0671 32.2101L5.44057 23.3948L5.13868 23.096C0.215857 18.0655 0.218422 9.90737 5.14346 4.87419Z"
344
- fill="${color}"
345
- stroke="white"
346
- />
347
- </svg>
348
- `;
349
- } else {
350
- // Default circular marker style
351
- el.style.width = '30px';
352
- el.style.height = '30px';
353
- el.style.backgroundColor = color;
354
- el.style.borderRadius = '50%';
355
- el.style.border = '2px solid white';
356
- el.style.color = 'white';
357
- el.style.fontWeight = 'bold';
358
- el.style.fontSize = '14px';
359
- el.style.textAlign = 'center';
360
- el.style.lineHeight = '1';
361
- el.innerHTML = `<span style="display: block; line-height: 1;">${project.percentageCompletion || 0}</span>`;
362
- }
363
-
364
- // Create popup content
365
- const popupContent = `
366
- <div style="padding: 12px; min-width: 200px;">
367
- <h3 style="margin: 0 0 8px 0; font-size: 16px; color: #333;">${project.name}</h3>
368
- <p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
369
- <strong>Country:</strong> ${project.country || 'N/A'}
370
- </p>
371
- <p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
372
- <strong>Sector:</strong> ${project.sectoralScope || 'Project'}
373
- </p>
374
- <p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
375
- <strong>Completion:</strong> ${project.percentageCompletion || 0}%
376
- </p>
377
- <p style="margin: 4px 0 0 0; font-size: 12px; color: #666;">
378
- <strong>Coordinates:</strong> ${Number(project.latitude).toFixed(4)}, ${Number(project.longitude).toFixed(4)}
379
- </p>
380
- </div>
381
- `;
382
-
383
- // Create popup
384
- const popup = new mapboxgl.Popup({
385
- offset: 25,
386
- closeButton: true,
387
- closeOnClick: false
388
- }).setHTML(popupContent);
389
-
390
- // Ensure coordinates are valid numbers
391
- const lng = Number(project.longitude);
392
- const lat = Number(project.latitude);
393
-
394
- console.log(`πŸ“ [NO CONFLICT GLOBE] Marker ${index} coordinates:`, {
395
- original: { longitude: project.longitude, latitude: project.latitude },
396
- processed: { lng, lat },
397
- project: project.name
398
- });
399
-
400
- // Validate coordinates
401
- if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
402
- console.error(`❌ [NO CONFLICT GLOBE] Invalid coordinates for project ${index}:`, {
403
- lng, lat,
404
- original: { longitude: project.longitude, latitude: project.latitude },
405
- project: project.name
406
- });
407
- return;
408
- }
409
-
410
- // Add coordinates to bounds
411
- bounds.extend([lng, lat]);
412
- hasValidCoordinates = true;
413
-
414
- // Create marker with explicit positioning
415
- const marker = new mapboxgl.Marker({
416
- element: el,
417
- anchor: 'center'
418
- })
419
- .setLngLat([lng, lat])
420
- .setPopup(popup)
421
- .addTo(map.current);
422
-
423
- // Add click handler
424
- el.addEventListener('click', () => {
425
- console.log('πŸ“ [NO CONFLICT GLOBE] Marker clicked:', project);
426
- onProjectClick(project);
427
- });
428
-
429
- // Verify marker position after a short delay
430
- setTimeout(() => {
431
- const markerLngLat = marker.getLngLat();
432
- console.log(`πŸ” [NO CONFLICT GLOBE] Marker ${index} position verification:`, {
433
- expected: [lng, lat],
434
- actual: [markerLngLat.lng, markerLngLat.lat],
435
- project: project.name,
436
- match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
437
- });
438
- }, 100);
439
-
440
- console.log(`βœ… [NO CONFLICT GLOBE] Marker ${index} added at:`, [lng, lat]);
441
- });
442
-
443
- // Fit map to show all markers if we have valid coordinates
444
- if (hasValidCoordinates && !bounds.isEmpty()) {
445
- console.log('πŸ—ΊοΈ [NO CONFLICT GLOBE] Fitting map to bounds:', bounds);
446
- map.current.fitBounds(bounds, {
447
- padding: { top: 20, bottom: 20, left: 20, right: 20 },
448
- maxZoom: 6,
449
- duration: 1000
450
- });
451
- boundsRef.current = bounds;
452
- } else {
453
- boundsRef.current = null;
454
- }
455
- });
456
-
457
- return () => {
458
- if (map.current) {
459
- map.current.remove();
460
- map.current = null;
461
- }
462
- };
463
- }, [projects, onProjectClick, mapConfig]);
464
-
465
- return (
466
- <div
467
- className="no-conflict-globe-container"
468
- style={{
469
- width: '100%',
470
- height: '100%',
471
- position: 'relative',
472
- isolation: 'isolate'
473
- }}
474
- >
475
- <div
476
- ref={mapContainer}
477
- style={{
478
- width: '100%',
479
- height: '100%',
480
- position: 'relative',
481
- isolation: 'isolate'
482
- }}
483
- />
484
- </div>
485
- );
486
- };
487
-
488
- export default NoConflictGlobe;