@biodiv-platform/naksha-gmaps-view 4.4.9 → 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 +3 -2
- package/dist/index.js +1 -1
- package/package.json +29 -18
- package/dist/esm/index.js +0 -1
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
CHANGED
|
@@ -9,6 +9,7 @@ interface NakshaGmapsViewProps {
|
|
|
9
9
|
maxZoom?: any;
|
|
10
10
|
options?: any;
|
|
11
11
|
}
|
|
12
|
-
declare function NakshaGmapsView({ defaultViewState, gmapAccessToken, gmapRegion, features, mapStyle, maxZoom, options, }: NakshaGmapsViewProps): JSX.Element;
|
|
12
|
+
declare function NakshaGmapsView({ defaultViewState, gmapAccessToken, gmapRegion, features, mapStyle, maxZoom, options, }: NakshaGmapsViewProps): React.JSX.Element;
|
|
13
13
|
|
|
14
|
-
export { NakshaGmapsView
|
|
14
|
+
export { NakshaGmapsView };
|
|
15
|
+
export type { NakshaGmapsViewProps };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
}
|
package/dist/esm/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var y=Object.defineProperty;var u=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var d=(o,t,e)=>t in o?y(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,p=(o,t)=>{for(var e in t||(t={}))b.call(t,e)&&d(o,e,t[e]);if(u)for(var e of u(t))x.call(t,e)&&d(o,e,t[e]);return o};import{GMAPS_LIBRARIES as N,mapboxToGmapsViewState as R}from"@biodiv-platform/naksha-commons";import{GoogleMap as O,LoadScriptNext as T}from"@react-google-maps/api";import{useEffect as k,useRef as I,useState as S}from"react";var f={mapTypeControlOptions:{position:10}};import M from"@turf/bbox";var l=o=>{let t=M(o);return{east:t[2],north:t[3],south:t[1],west:t[0]}};import{jsx as g}from"react/jsx-runtime";function D({defaultViewState:o,gmapAccessToken:t,gmapRegion:e,features:r,mapStyle:h,maxZoom:i,options:G}){let a=I(null),[c]=S(R(o)),[m,w]=S(),A=()=>{a.current.state.map.data.forEach(function(s){a.current.state.map.data.remove(s)});let n=Array.isArray(r)?{type:"FeatureCollection",features:r}:r;if(n){n&&a.current.state.map.data.addGeoJson(n);let s=l(n);s&&a.current.state.map.fitBounds(s),i&&google.maps.event.addListenerOnce(a.current.state.map,"idle",function(){let P=a.current.state.map.getZoom();a.current.state.map.setZoom(Math.min(i,P))})}};k(()=>{m&&A()},[m,r]);let L=()=>w(!0);return g(T,{googleMapsApiKey:t,region:e,libraries:N.DEFAULT,children:g(O,{id:"naksha-gmaps-view",mapContainerStyle:h||{height:"100%",width:"100%"},zoom:c.zoom,center:c.center,options:p(p({},f),G||{}),ref:a,onLoad:L})})}export{D as NakshaGmapsView};
|