datastake-daf 0.6.286 → 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,301 +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
- project: project.name
21084
- });
21085
-
21086
- // Validate coordinates
21087
- if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
21088
- console.error("\u274C [SIMPLE GLOBE] Invalid coordinates for project ".concat(index, ":"), {
21089
- lng,
21090
- lat,
21091
- project: project.name
21092
- });
21093
- return;
21094
- }
21095
-
21096
- // Add coordinates to bounds
21097
- bounds.extend([lng, lat]);
21098
- hasValidCoordinates = true;
21099
-
21100
- // Create marker with explicit positioning and anchor
21101
- const marker = new mapboxgl.Marker({
21102
- element: el,
21103
- anchor: 'center'
21104
- }).setLngLat([lng, lat]).setPopup(popup).addTo(map.current);
21105
-
21106
- // Add click handler
21107
- el.addEventListener('click', () => {
21108
- console.log('📍 [SIMPLE GLOBE] Marker clicked:', project);
21109
- onProjectClick(project);
21110
- });
21111
-
21112
- // Verify marker position after a short delay (like other Globe components)
21113
- setTimeout(() => {
21114
- const markerLngLat = marker.getLngLat();
21115
- console.log("\uD83D\uDD0D [SIMPLE GLOBE] Marker ".concat(index, " position verification:"), {
21116
- expected: [lng, lat],
21117
- actual: [markerLngLat.lng, markerLngLat.lat],
21118
- project: project.name,
21119
- match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
21120
- });
21121
- }, 100);
21122
- console.log("\u2705 [SIMPLE GLOBE] Marker ".concat(index, " added at:"), [lng, lat]);
21123
- });
21124
-
21125
- // Fit map to show all markers if we have valid coordinates
21126
- if (hasValidCoordinates && !bounds.isEmpty()) {
21127
- console.log('🗺️ [SIMPLE GLOBE] Fitting map to bounds:', bounds);
21128
- map.current.fitBounds(bounds, {
21129
- padding: {
21130
- top: 20,
21131
- bottom: 20,
21132
- left: 20,
21133
- right: 20
21134
- },
21135
- maxZoom: 6,
21136
- duration: 1000
21137
- });
21138
- boundsRef.current = bounds;
21139
- } else {
21140
- boundsRef.current = null;
21141
- }
21142
- });
21143
- return () => {
21144
- if (map.current) {
21145
- map.current.remove();
21146
- map.current = null;
21147
- }
21148
- };
21149
- }, [projects, onProjectClick, mapConfig]);
21150
- const zoomIn = () => map.current && map.current.zoomIn();
21151
- const zoomOut = () => map.current && map.current.zoomOut();
21152
- const recenter = () => {
21153
- if (!map.current) return;
21154
- if (boundsRef.current && !boundsRef.current.isEmpty()) {
21155
- map.current.fitBounds(boundsRef.current, {
21156
- padding: {
21157
- top: 20,
21158
- bottom: 20,
21159
- left: 20,
21160
- right: 20
21161
- },
21162
- maxZoom: 6,
21163
- duration: 800
21164
- });
21165
- return;
21166
- }
21167
- map.current.easeTo({
21168
- center: [0, 0],
21169
- zoom: 3,
21170
- duration: 800
21171
- });
21172
- };
21173
- const pitchUp = () => {
21174
- var _map$current$getPitch, _map$current;
21175
- if (!map.current) return;
21176
- 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);
21177
- map.current.setPitch(next);
21178
- };
21179
- const pitchDown = () => {
21180
- var _map$current$getPitch2, _map$current2;
21181
- if (!map.current) return;
21182
- 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);
21183
- map.current.setPitch(next);
21184
- };
21185
- return /*#__PURE__*/jsxRuntime.jsx(Style$A, {
21186
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
21187
- className: "daf-simple-globe-container",
21188
- style: {
21189
- width: '100%',
21190
- height: '100%',
21191
- overflow: 'hidden',
21192
- position: 'relative'
21193
- },
21194
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
21195
- ref: mapContainer,
21196
- className: "daf-globe-map-container",
21197
- style: {
21198
- width: '100%',
21199
- height: '100%',
21200
- overflow: 'hidden',
21201
- position: 'relative'
21202
- }
21203
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
21204
- className: "map-control-buttons",
21205
- children: [/*#__PURE__*/jsxRuntime.jsx("button", {
21206
- type: "button",
21207
- "aria-label": "Zoom in",
21208
- onClick: zoomIn,
21209
- children: "+"
21210
- }), /*#__PURE__*/jsxRuntime.jsx("button", {
21211
- type: "button",
21212
- "aria-label": "Zoom out",
21213
- onClick: zoomOut,
21214
- children: "\u2212"
21215
- }), /*#__PURE__*/jsxRuntime.jsx("button", {
21216
- type: "button",
21217
- "aria-label": "Recenter",
21218
- onClick: recenter,
21219
- children: "\u25CE"
21220
- }), /*#__PURE__*/jsxRuntime.jsx("button", {
21221
- type: "button",
21222
- "aria-label": "Pitch up",
21223
- onClick: pitchUp,
21224
- children: "^"
21225
- }), /*#__PURE__*/jsxRuntime.jsx("button", {
21226
- type: "button",
21227
- "aria-label": "Pitch down",
21228
- onClick: pitchDown,
21229
- children: "\u02C5"
21230
- })]
21231
- })]
21232
- })
21233
- });
21234
- };
21235
-
21236
20941
  const IsolatedGlobe = _ref => {
21237
20942
  let {
21238
20943
  projects = [],
@@ -62443,7 +62148,6 @@ exports.SelectFiltersTimeFrame = Timeframe;
62443
62148
  exports.SettingsPopover = SettingsPopover;
62444
62149
  exports.Sidenav = Sidenav;
62445
62150
  exports.SidenavMenu = SidenavMenu;
62446
- exports.SimpleGlobe = SimpleGlobe;
62447
62151
  exports.StackChart = StackChart;
62448
62152
  exports.StakeholderMappings = index$1;
62449
62153
  exports.Steps = DAFSteps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.286",
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;
@@ -241,7 +263,7 @@ const SimpleGlobe = ({
241
263
  bounds.extend([lng, lat]);
242
264
  hasValidCoordinates = true;
243
265
 
244
- // Create marker with explicit positioning and anchor
266
+ // Create marker with explicit positioning and anchor for 3D globe
245
267
  const marker = new mapboxgl.Marker({
246
268
  element: el,
247
269
  anchor: 'center'
@@ -282,6 +304,14 @@ const SimpleGlobe = ({
282
304
  } else {
283
305
  boundsRef.current = null;
284
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);
285
315
  });
286
316
 
287
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";