datastake-daf 0.6.285 β†’ 0.6.287

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.
@@ -20938,285 +20938,6 @@ Globe.propTypes = {
20938
20938
  nameAsSiderTitle: PropTypes__default["default"].bool
20939
20939
  };
20940
20940
 
20941
- const SimpleGlobe = _ref => {
20942
- let {
20943
- projects = [],
20944
- mapConfig = {},
20945
- showSider = false,
20946
- onProjectClick = () => {},
20947
- type = "default",
20948
- color = "var(--color-primary-60)",
20949
- renderTooltip: renderTooltip$1 = null
20950
- } = _ref;
20951
- const mapContainer = React.useRef(null);
20952
- const map = React.useRef(null);
20953
- const boundsRef = React.useRef(null);
20954
- React.useEffect(() => {
20955
- if (map.current) return; // Initialize map only once
20956
-
20957
- console.log('πŸ—ΊοΈ [SIMPLE GLOBE] Creating map...');
20958
-
20959
- // Set Mapbox access token
20960
- mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
20961
-
20962
- // Create map with custom Straatos style
20963
- map.current = new mapboxgl.Map({
20964
- container: mapContainer.current,
20965
- style: 'mapbox://styles/pietragottardo/cm9tt9zfi00d101pg1vdx26si',
20966
- center: [0, 0],
20967
- zoom: mapConfig.maxZoom || 3,
20968
- projection: 'globe',
20969
- attributionControl: false
20970
- });
20971
-
20972
- // Add markers when map loads
20973
- map.current.on('load', () => {
20974
- console.log('πŸ—ΊοΈ [SIMPLE GLOBE] Map loaded, adding markers...');
20975
-
20976
- // Hide Mapbox logo and attribution completely
20977
- map.current.getContainer();
20978
- const style = document.createElement('style');
20979
- style.textContent = "\n .mapboxgl-ctrl-logo,\n .mapboxgl-ctrl-attrib,\n .mapboxgl-ctrl-bottom-left,\n .mapboxgl-ctrl-bottom-right {\n display: none !important;\n }\n .mapboxgl-canvas-container {\n overflow: hidden !important;\n }\n .mapboxgl-canvas {\n overflow: hidden !important;\n }\n /* CRITICAL: Override Leaflet CSS interference with Mapbox */\n .daf-simple-globe-container .mapboxgl-canvas-container {\n position: relative !important;\n left: auto !important;\n top: auto !important;\n }\n .daf-simple-globe-container .mapboxgl-canvas-container canvas {\n position: relative !important;\n left: auto !important;\n top: auto !important;\n transform: none !important;\n }\n /* Prevent Leaflet styles from affecting Mapbox markers */\n .daf-simple-globe-container .daf-globe-marker {\n position: relative !important;\n left: auto !important;\n top: auto !important;\n }\n ";
20980
- document.head.appendChild(style);
20981
-
20982
- // Set the space background with stars
20983
- try {
20984
- map.current.setFog({
20985
- 'color': 'rgb(0, 0, 0)',
20986
- 'high-color': 'rgb(0, 0, 0)',
20987
- 'horizon-blend': 0.1,
20988
- 'space-color': 'rgb(0, 0, 0)',
20989
- 'star-intensity': 0.6
20990
- });
20991
- console.log('✨ [SIMPLE GLOBE] Space background with stars set');
20992
- } catch (e) {
20993
- console.log('⚠️ [SIMPLE GLOBE] Could not set fog, trying alternative...');
20994
- // Fallback: try simpler fog configuration
20995
- try {
20996
- map.current.setFog({
20997
- 'color': 'rgb(0, 0, 0)',
20998
- 'high-color': 'rgb(0, 0, 0)',
20999
- 'horizon-blend': 0.1
21000
- });
21001
- console.log('✨ [SIMPLE GLOBE] Alternative space background set');
21002
- } catch (e2) {
21003
- console.log('⚠️ [SIMPLE GLOBE] Could not set any fog configuration');
21004
- }
21005
- }
21006
-
21007
- // Calculate bounds to fit all markers
21008
- const bounds = new mapboxgl.LngLatBounds();
21009
- let hasValidCoordinates = false;
21010
- projects.forEach((project, index) => {
21011
- console.log("\uD83D\uDCCD [SIMPLE GLOBE] Adding marker ".concat(index, ":"), project);
21012
-
21013
- // Create marker element based on type
21014
- const el = document.createElement('div');
21015
- // Use a scoped class to avoid picking up broad styles like `.map-marker { width:100% }`
21016
- el.className = 'daf-globe-marker';
21017
- el.style.cursor = 'pointer';
21018
- el.style.boxShadow = '0px 3.45px 3.45px 0px #00000029';
21019
- el.style.display = 'flex';
21020
- el.style.alignItems = 'center';
21021
- el.style.justifyContent = 'center';
21022
- if (type === "location") {
21023
- // Location marker - SVG map pin style
21024
- el.style.width = '28px';
21025
- el.style.height = '33px';
21026
- el.innerHTML = "\n <svg\n width=\"28\"\n height=\"33\"\n viewBox=\"0 0 28 33\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n 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\"\n fill=\"".concat(color, "\"\n stroke=\"white\"\n />\n </svg>\n ");
21027
- } else {
21028
- // Default circular marker style
21029
- el.style.width = '30px';
21030
- el.style.height = '30px';
21031
- el.style.backgroundColor = color;
21032
- el.style.borderRadius = '50%';
21033
- el.style.border = '2px solid white';
21034
- el.style.color = 'white';
21035
- el.style.fontWeight = 'bold';
21036
- el.style.fontSize = '14px';
21037
- el.style.textAlign = 'center';
21038
- el.style.lineHeight = '1';
21039
- el.innerHTML = "<span style=\"display: block; line-height: 1;\">".concat(project.percentageCompletion || 0, "</span>");
21040
- }
21041
-
21042
- // Create popup content using custom renderTooltip or default
21043
- let popupContent;
21044
- if (renderTooltip$1 && typeof renderTooltip$1 === 'function') {
21045
- // Use custom renderTooltip function (same as MineSiteMap)
21046
- const tooltipData = renderTooltip$1(project);
21047
- popupContent = renderTooltip({
21048
- title: project.name,
21049
- subTitle: project.sectoralScope || 'Project',
21050
- items: tooltipData,
21051
- link: false
21052
- });
21053
- } else {
21054
- // Use default tooltip structure
21055
- const tooltipData = [{
21056
- label: "Country",
21057
- value: project.country || 'N/A'
21058
- }, {
21059
- label: "Sectoral Scope",
21060
- value: project.sectoralScope || 'Project'
21061
- }];
21062
- popupContent = renderTooltip({
21063
- title: project.name,
21064
- subTitle: project.sectoralScope || 'Project',
21065
- items: tooltipData,
21066
- link: false
21067
- });
21068
- }
21069
-
21070
- // Create popup
21071
- const popup = new mapboxgl.Popup({
21072
- offset: 25,
21073
- closeButton: true,
21074
- closeOnClick: false
21075
- }).setHTML(popupContent);
21076
-
21077
- // Ensure coordinates are valid numbers
21078
- const lng = Number(project.longitude);
21079
- const lat = Number(project.latitude);
21080
- console.log("\uD83D\uDCCD [SIMPLE GLOBE] Marker ".concat(index, " coordinates:"), {
21081
- lng,
21082
- lat
21083
- });
21084
-
21085
- // Validate coordinates
21086
- if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
21087
- console.error("\u274C [SIMPLE GLOBE] Invalid coordinates for project ".concat(index, ":"), {
21088
- lng,
21089
- lat
21090
- });
21091
- return;
21092
- }
21093
-
21094
- // Add coordinates to bounds
21095
- bounds.extend([lng, lat]);
21096
- hasValidCoordinates = true;
21097
-
21098
- // Add marker to map with proper coordinate order [lng, lat]
21099
- new mapboxgl.Marker(el).setLngLat([lng, lat]).setPopup(popup).addTo(map.current);
21100
-
21101
- // Add click handler
21102
- el.addEventListener('click', () => {
21103
- console.log('πŸ“ [SIMPLE GLOBE] Marker clicked:', project);
21104
- onProjectClick(project);
21105
- });
21106
- console.log("\u2705 [SIMPLE GLOBE] Marker ".concat(index, " added at:"), [lng, lat]);
21107
- });
21108
-
21109
- // Fit map to show all markers if we have valid coordinates
21110
- if (hasValidCoordinates && !bounds.isEmpty()) {
21111
- console.log('πŸ—ΊοΈ [SIMPLE GLOBE] Fitting map to bounds:', bounds);
21112
- map.current.fitBounds(bounds, {
21113
- padding: {
21114
- top: 20,
21115
- bottom: 20,
21116
- left: 20,
21117
- right: 20
21118
- },
21119
- maxZoom: 6,
21120
- duration: 1000
21121
- });
21122
- boundsRef.current = bounds;
21123
- } else {
21124
- boundsRef.current = null;
21125
- }
21126
- });
21127
- return () => {
21128
- if (map.current) {
21129
- map.current.remove();
21130
- map.current = null;
21131
- }
21132
- };
21133
- }, [projects, onProjectClick, mapConfig]);
21134
- const zoomIn = () => map.current && map.current.zoomIn();
21135
- const zoomOut = () => map.current && map.current.zoomOut();
21136
- const recenter = () => {
21137
- if (!map.current) return;
21138
- if (boundsRef.current && !boundsRef.current.isEmpty()) {
21139
- map.current.fitBounds(boundsRef.current, {
21140
- padding: {
21141
- top: 20,
21142
- bottom: 20,
21143
- left: 20,
21144
- right: 20
21145
- },
21146
- maxZoom: 6,
21147
- duration: 800
21148
- });
21149
- return;
21150
- }
21151
- map.current.easeTo({
21152
- center: [0, 0],
21153
- zoom: 3,
21154
- duration: 800
21155
- });
21156
- };
21157
- const pitchUp = () => {
21158
- var _map$current$getPitch, _map$current;
21159
- if (!map.current) return;
21160
- const next = Math.min((((_map$current$getPitch = (_map$current = map.current).getPitch) === null || _map$current$getPitch === void 0 ? void 0 : _map$current$getPitch.call(_map$current)) || 0) + 10, 85);
21161
- map.current.setPitch(next);
21162
- };
21163
- const pitchDown = () => {
21164
- var _map$current$getPitch2, _map$current2;
21165
- if (!map.current) return;
21166
- const next = Math.max((((_map$current$getPitch2 = (_map$current2 = map.current).getPitch) === null || _map$current$getPitch2 === void 0 ? void 0 : _map$current$getPitch2.call(_map$current2)) || 0) - 10, 0);
21167
- map.current.setPitch(next);
21168
- };
21169
- return /*#__PURE__*/jsxRuntime.jsx(Style$A, {
21170
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
21171
- className: "daf-simple-globe-container",
21172
- style: {
21173
- width: '100%',
21174
- height: '100%',
21175
- overflow: 'hidden',
21176
- position: 'relative'
21177
- },
21178
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
21179
- ref: mapContainer,
21180
- className: "daf-globe-map-container",
21181
- style: {
21182
- width: '100%',
21183
- height: '100%',
21184
- overflow: 'hidden',
21185
- position: 'relative'
21186
- }
21187
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
21188
- className: "map-control-buttons",
21189
- children: [/*#__PURE__*/jsxRuntime.jsx("button", {
21190
- type: "button",
21191
- "aria-label": "Zoom in",
21192
- onClick: zoomIn,
21193
- children: "+"
21194
- }), /*#__PURE__*/jsxRuntime.jsx("button", {
21195
- type: "button",
21196
- "aria-label": "Zoom out",
21197
- onClick: zoomOut,
21198
- children: "\u2212"
21199
- }), /*#__PURE__*/jsxRuntime.jsx("button", {
21200
- type: "button",
21201
- "aria-label": "Recenter",
21202
- onClick: recenter,
21203
- children: "\u25CE"
21204
- }), /*#__PURE__*/jsxRuntime.jsx("button", {
21205
- type: "button",
21206
- "aria-label": "Pitch up",
21207
- onClick: pitchUp,
21208
- children: "^"
21209
- }), /*#__PURE__*/jsxRuntime.jsx("button", {
21210
- type: "button",
21211
- "aria-label": "Pitch down",
21212
- onClick: pitchDown,
21213
- children: "\u02C5"
21214
- })]
21215
- })]
21216
- })
21217
- });
21218
- };
21219
-
21220
20941
  const IsolatedGlobe = _ref => {
21221
20942
  let {
21222
20943
  projects = [],
@@ -62427,7 +62148,6 @@ exports.SelectFiltersTimeFrame = Timeframe;
62427
62148
  exports.SettingsPopover = SettingsPopover;
62428
62149
  exports.Sidenav = Sidenav;
62429
62150
  exports.SidenavMenu = SidenavMenu;
62430
- exports.SimpleGlobe = SimpleGlobe;
62431
62151
  exports.StackChart = StackChart;
62432
62152
  exports.StakeholderMappings = index$1;
62433
62153
  exports.Steps = DAFSteps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.285",
3
+ "version": "0.6.287",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -47,16 +47,63 @@ const SimpleGlobe = ({
47
47
  // Set Mapbox access token
48
48
  mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
49
49
 
50
- // Create map with custom Straatos style
50
+ // Create map with custom Straatos style - 3D globe configuration
51
51
  map.current = new mapboxgl.Map({
52
52
  container: mapContainer.current,
53
53
  style: 'mapbox://styles/pietragottardo/cm9tt9zfi00d101pg1vdx26si',
54
54
  center: [0, 0],
55
55
  zoom: mapConfig.maxZoom || 3,
56
56
  projection: 'globe',
57
+ // 3D globe settings for proper rendering
58
+ pitch: 0,
59
+ bearing: 0,
60
+ antialias: true,
61
+ fadeDuration: 0,
57
62
  attributionControl: false
58
63
  });
59
64
 
65
+ // Configure 3D globe when style loads
66
+ map.current.on('style.load', () => {
67
+ console.log('🎨 [SIMPLE GLOBE] Style loaded, configuring 3D globe...');
68
+
69
+ // Set fog for the space background effect with stars
70
+ try {
71
+ map.current.setFog({
72
+ 'color': 'rgb(0, 0, 0)',
73
+ 'high-color': 'rgb(0, 0, 0)',
74
+ 'horizon-blend': 0.1,
75
+ 'space-color': 'rgb(0, 0, 0)',
76
+ 'star-intensity': 0.6
77
+ });
78
+ console.log('✨ [SIMPLE GLOBE] Space background with stars set');
79
+ } catch (e) {
80
+ console.log('⚠️ [SIMPLE GLOBE] Could not set fog, trying alternative...');
81
+ // Fallback: try simpler fog configuration
82
+ try {
83
+ map.current.setFog({
84
+ 'color': 'rgb(0, 0, 0)',
85
+ 'high-color': 'rgb(0, 0, 0)',
86
+ 'horizon-blend': 0.1
87
+ });
88
+ console.log('✨ [SIMPLE GLOBE] Alternative space background set');
89
+ } catch (e2) {
90
+ console.log('⚠️ [SIMPLE GLOBE] Could not set any fog configuration');
91
+ }
92
+ }
93
+
94
+ // Set lighting for better 3D globe visibility
95
+ try {
96
+ map.current.setLight({
97
+ 'anchor': 'viewport',
98
+ 'color': 'white',
99
+ 'intensity': 0.4
100
+ });
101
+ console.log('πŸ’‘ [SIMPLE GLOBE] Lighting configured for 3D globe');
102
+ } catch (e) {
103
+ console.log('⚠️ [SIMPLE GLOBE] Could not set lighting');
104
+ }
105
+ });
106
+
60
107
  // Add markers when map loads
61
108
  map.current.on('load', () => {
62
109
  console.log('πŸ—ΊοΈ [SIMPLE GLOBE] Map loaded, adding markers...');
@@ -98,31 +145,6 @@ const SimpleGlobe = ({
98
145
  `;
99
146
  document.head.appendChild(style);
100
147
 
101
- // Set the space background with stars
102
- try {
103
- map.current.setFog({
104
- 'color': 'rgb(0, 0, 0)',
105
- 'high-color': 'rgb(0, 0, 0)',
106
- 'horizon-blend': 0.1,
107
- 'space-color': 'rgb(0, 0, 0)',
108
- 'star-intensity': 0.6
109
- });
110
- console.log('✨ [SIMPLE GLOBE] Space background with stars set');
111
- } catch (e) {
112
- console.log('⚠️ [SIMPLE GLOBE] Could not set fog, trying alternative...');
113
- // Fallback: try simpler fog configuration
114
- try {
115
- map.current.setFog({
116
- 'color': 'rgb(0, 0, 0)',
117
- 'high-color': 'rgb(0, 0, 0)',
118
- 'horizon-blend': 0.1
119
- });
120
- console.log('✨ [SIMPLE GLOBE] Alternative space background set');
121
- } catch (e2) {
122
- console.log('⚠️ [SIMPLE GLOBE] Could not set any fog configuration');
123
- }
124
- }
125
-
126
148
  // Calculate bounds to fit all markers
127
149
  const bounds = new mapboxgl.LngLatBounds();
128
150
  let hasValidCoordinates = false;
@@ -221,11 +243,19 @@ const SimpleGlobe = ({
221
243
  const lng = Number(project.longitude);
222
244
  const lat = Number(project.latitude);
223
245
 
224
- console.log(`πŸ“ [SIMPLE GLOBE] Marker ${index} coordinates:`, { lng, lat });
246
+ console.log(`πŸ“ [SIMPLE GLOBE] Marker ${index} coordinates:`, {
247
+ lng,
248
+ lat,
249
+ project: project.name
250
+ });
225
251
 
226
252
  // Validate coordinates
227
253
  if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
228
- console.error(`❌ [SIMPLE GLOBE] Invalid coordinates for project ${index}:`, { lng, lat });
254
+ console.error(`❌ [SIMPLE GLOBE] Invalid coordinates for project ${index}:`, {
255
+ lng,
256
+ lat,
257
+ project: project.name
258
+ });
229
259
  return;
230
260
  }
231
261
 
@@ -233,8 +263,11 @@ const SimpleGlobe = ({
233
263
  bounds.extend([lng, lat]);
234
264
  hasValidCoordinates = true;
235
265
 
236
- // Add marker to map with proper coordinate order [lng, lat]
237
- const marker = new mapboxgl.Marker(el)
266
+ // Create marker with explicit positioning and anchor for 3D globe
267
+ const marker = new mapboxgl.Marker({
268
+ element: el,
269
+ anchor: 'center'
270
+ })
238
271
  .setLngLat([lng, lat])
239
272
  .setPopup(popup)
240
273
  .addTo(map.current);
@@ -244,6 +277,17 @@ const SimpleGlobe = ({
244
277
  console.log('πŸ“ [SIMPLE GLOBE] Marker clicked:', project);
245
278
  onProjectClick(project);
246
279
  });
280
+
281
+ // Verify marker position after a short delay (like other Globe components)
282
+ setTimeout(() => {
283
+ const markerLngLat = marker.getLngLat();
284
+ console.log(`πŸ” [SIMPLE GLOBE] Marker ${index} position verification:`, {
285
+ expected: [lng, lat],
286
+ actual: [markerLngLat.lng, markerLngLat.lat],
287
+ project: project.name,
288
+ match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
289
+ });
290
+ }, 100);
247
291
 
248
292
  console.log(`βœ… [SIMPLE GLOBE] Marker ${index} added at:`, [lng, lat]);
249
293
  });
@@ -260,6 +304,14 @@ const SimpleGlobe = ({
260
304
  } else {
261
305
  boundsRef.current = null;
262
306
  }
307
+
308
+ // Force resize for 3D globe rendering
309
+ setTimeout(() => {
310
+ if (map.current && map.current.resize) {
311
+ map.current.resize();
312
+ console.log('πŸ”„ [SIMPLE GLOBE] Map resized for 3D globe rendering');
313
+ }
314
+ }, 100);
263
315
  });
264
316
 
265
317
  return () => {
package/src/index.js CHANGED
@@ -62,7 +62,6 @@ export { default as TooltipIcon } from "./@daf/core/components/Icon/TooltipIcon.
62
62
  export { default as MineSiteMap } from "./@daf/core/components/Dashboard/Map/index.jsx";
63
63
  export { default as InExpandableWidgetMap } from "./@daf/core/components/Dashboard/Map/InExpandableWidgetMap/index.jsx";
64
64
  export { default as Globe } from "./@daf/core/components/Dashboard/Globe/index.jsx";
65
- export { default as SimpleGlobe } from "./@daf/core/components/Dashboard/Globe/SimpleGlobe.jsx";
66
65
  export { default as IsolatedGlobe } from "./@daf/core/components/Dashboard/Globe/IsolatedGlobe.jsx";
67
66
  export { default as NoConflictGlobe } from "./@daf/core/components/Dashboard/Globe/NoConflictGlobe.jsx";
68
67
  export { default as WidgetPlaceholder } from "./@daf/core/components/Dashboard/Widget/WidgetPlaceholder/index.jsx";