@biodiv-platform/naksha-gmaps-view 4.4.8 → 4.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.
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +1 -0
- package/package.json +29 -18
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var x=Object.create;var c=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},g=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of N(e))!O.call(t,n)&&n!==o&&c(t,n,{get:()=>e[n],enumerable:!(r=M(e,n))||r.enumerable});return t};var k=(t,e,o)=>(o=t!=null?x(R(t)):{},g(e||!t||!t.__esModule?c(o,"default",{value:t,enumerable:!0}):o,t)),I=t=>g(c({},"__esModule",{value:!0}),t);var v={};T(v,{NakshaGmapsView:()=>V});module.exports=I(v);var m=require("@biodiv-platform/naksha-commons"),u=require("@react-google-maps/api"),s=require("react");var h={mapTypeControlOptions:{position:10}};var G=k(require("@turf/bbox"),1),w=t=>{let e=(0,G.default)(t);return{east:e[2],north:e[3],south:e[1],west:e[0]}};var d=require("react/jsx-runtime");function V({defaultViewState:t,gmapAccessToken:e,gmapRegion:o,features:r,mapStyle:n,maxZoom:f,options:A}){let a=(0,s.useRef)(null),[l]=(0,s.useState)((0,m.mapboxToGmapsViewState)(t)),[S,L]=(0,s.useState)(),P=()=>{a.current.state.map.data.forEach(function(i){a.current.state.map.data.remove(i)});let p=Array.isArray(r)?{type:"FeatureCollection",features:r}:r;if(p){p&&a.current.state.map.data.addGeoJson(p);let i=w(p);i&&a.current.state.map.fitBounds(i),f&&google.maps.event.addListenerOnce(a.current.state.map,"idle",function(){let b=a.current.state.map.getZoom();a.current.state.map.setZoom(Math.min(f,b))})}};(0,s.useEffect)(()=>{S&&P()},[S,r]);let y=()=>L(!0);return(0,d.jsx)(u.LoadScriptNext,{googleMapsApiKey:e,region:o,libraries:m.GMAPS_LIBRARIES.DEFAULT,children:(0,d.jsx)(u.GoogleMap,{id:"naksha-gmaps-view",mapContainerStyle:n||{height:"100%",width:"100%"},zoom:l.zoom,center:l.center,options:{...h,...A||{}},ref:a,onLoad:y})})}0&&(module.exports={NakshaGmapsView});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface NakshaGmapsViewProps {
|
|
4
|
+
defaultViewState?: any;
|
|
5
|
+
features?: any;
|
|
6
|
+
gmapAccessToken?: any;
|
|
7
|
+
gmapRegion?: any;
|
|
8
|
+
mapStyle?: React.CSSProperties;
|
|
9
|
+
maxZoom?: any;
|
|
10
|
+
options?: any;
|
|
11
|
+
}
|
|
12
|
+
declare function NakshaGmapsView({ defaultViewState, gmapAccessToken, gmapRegion, features, mapStyle, maxZoom, options, }: NakshaGmapsViewProps): React.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { NakshaGmapsView };
|
|
15
|
+
export type { NakshaGmapsViewProps };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface NakshaGmapsViewProps {
|
|
4
|
+
defaultViewState?: any;
|
|
5
|
+
features?: any;
|
|
6
|
+
gmapAccessToken?: any;
|
|
7
|
+
gmapRegion?: any;
|
|
8
|
+
mapStyle?: React.CSSProperties;
|
|
9
|
+
maxZoom?: any;
|
|
10
|
+
options?: any;
|
|
11
|
+
}
|
|
12
|
+
declare function NakshaGmapsView({ defaultViewState, gmapAccessToken, gmapRegion, features, mapStyle, maxZoom, options, }: NakshaGmapsViewProps): React.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { NakshaGmapsView };
|
|
15
|
+
export type { NakshaGmapsViewProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{GMAPS_LIBRARIES as L,mapboxToGmapsViewState as P}from"@biodiv-platform/naksha-commons";import{GoogleMap as y,LoadScriptNext as b}from"@react-google-maps/api";import{useEffect as x,useRef as M,useState as u}from"react";var c={mapTypeControlOptions:{position:10}};import A from"@turf/bbox";var m=n=>{let e=A(n);return{east:e[2],north:e[3],south:e[1],west:e[0]}};import{jsx as d}from"react/jsx-runtime";function C({defaultViewState:n,gmapAccessToken:e,gmapRegion:f,features:o,mapStyle:l,maxZoom:s,options:S}){let t=M(null),[p]=u(P(n)),[i,g]=u(),h=()=>{t.current.state.map.data.forEach(function(r){t.current.state.map.data.remove(r)});let a=Array.isArray(o)?{type:"FeatureCollection",features:o}:o;if(a){a&&t.current.state.map.data.addGeoJson(a);let r=m(a);r&&t.current.state.map.fitBounds(r),s&&google.maps.event.addListenerOnce(t.current.state.map,"idle",function(){let w=t.current.state.map.getZoom();t.current.state.map.setZoom(Math.min(s,w))})}};x(()=>{i&&h()},[i,o]);let G=()=>g(!0);return d(b,{googleMapsApiKey:e,region:f,libraries:L.DEFAULT,children:d(y,{id:"naksha-gmaps-view",mapContainerStyle:l||{height:"100%",width:"100%"},zoom:p.zoom,center:p.center,options:{...c,...S||{}},ref:t,onLoad:G})})}export{C as NakshaGmapsView};
|
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@biodiv-platform/naksha-gmaps-view",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"author": "harshzalavadiya",
|
|
5
|
-
"main": "./dist/index.
|
|
6
|
-
"module": "./dist/
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
7
8
|
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
8
16
|
"sideEffects": false,
|
|
9
17
|
"license": "Apache-2.0",
|
|
10
18
|
"repository": "strandls/naksha-components-react",
|
|
@@ -13,27 +21,30 @@
|
|
|
13
21
|
],
|
|
14
22
|
"scripts": {
|
|
15
23
|
"clean": "rm -rf node_modules dist .turbo",
|
|
16
|
-
"build": "tsup src/index.tsx --
|
|
17
|
-
"dev": "tsup src/index.tsx --
|
|
24
|
+
"build": "tsup src/index.tsx --format esm,cjs --dts --minify --external react",
|
|
25
|
+
"dev": "tsup src/index.tsx --format esm,cjs --watch --dts --external react"
|
|
18
26
|
},
|
|
19
27
|
"peerDependencies": {
|
|
20
|
-
"@react-google-maps/api": "
|
|
28
|
+
"@react-google-maps/api": ">=2.12.0",
|
|
21
29
|
"react": ">=18.2.0",
|
|
22
|
-
"react-map-gl": "
|
|
30
|
+
"react-map-gl": ">=7.0.15"
|
|
23
31
|
},
|
|
24
32
|
"devDependencies": {
|
|
25
|
-
"@biodiv-platform/eslint-preset": "
|
|
26
|
-
"@biodiv-platform/tsconfig": "
|
|
27
|
-
"@react-google-maps/api": "^2.
|
|
28
|
-
"@types/react": "^
|
|
29
|
-
"@types/react-dom": "^
|
|
30
|
-
"react": "
|
|
31
|
-
"react-map-gl": "^
|
|
32
|
-
"tsup": "^
|
|
33
|
-
"typescript": "^
|
|
33
|
+
"@biodiv-platform/eslint-preset": "workspace:*",
|
|
34
|
+
"@biodiv-platform/tsconfig": "workspace:*",
|
|
35
|
+
"@react-google-maps/api": "^2.20.8",
|
|
36
|
+
"@types/react": "^19.3.0",
|
|
37
|
+
"@types/react-dom": "^19.3.0",
|
|
38
|
+
"react": "^19.3.1",
|
|
39
|
+
"react-map-gl": "^8.1.3",
|
|
40
|
+
"tsup": "^9.0.0",
|
|
41
|
+
"typescript": "^5.8.3"
|
|
34
42
|
},
|
|
35
43
|
"dependencies": {
|
|
36
|
-
"@biodiv-platform/naksha-commons": "
|
|
37
|
-
"@turf/bbox": "^
|
|
44
|
+
"@biodiv-platform/naksha-commons": "workspace:*",
|
|
45
|
+
"@turf/bbox": "^7.4.0"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
38
49
|
}
|
|
39
50
|
}
|