@neshan-maps-platform/react-openlayers 2.0.16 → 3.0.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.
@@ -0,0 +1,27 @@
1
+ (function(y,A){typeof exports=="object"&&typeof module<"u"?module.exports=A(require("react"),require("@neshan-maps-platform/ol")):typeof define=="function"&&define.amd?define(["react","@neshan-maps-platform/ol"],A):(y=typeof globalThis<"u"?globalThis:y||self,y["neshan-ol-react-sdk"]=A(y.require$$0,y.ol))})(this,function(y,A){"use strict";var re={exports:{}},U={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var ge;function qe(){if(ge)return U;ge=1;var a=y,r=Symbol.for("react.element"),o=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,f=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_={key:!0,ref:!0,__self:!0,__source:!0};function F(x,p,O){var E,P={},R=null,T=null;O!==void 0&&(R=""+O),p.key!==void 0&&(R=""+p.key),p.ref!==void 0&&(T=p.ref);for(E in p)u.call(p,E)&&!_.hasOwnProperty(E)&&(P[E]=p[E]);if(x&&x.defaultProps)for(E in p=x.defaultProps,p)P[E]===void 0&&(P[E]=p[E]);return{$$typeof:r,type:x,key:R,ref:T,props:P,_owner:f.current}}return U.Fragment=o,U.jsx=F,U.jsxs=F,U}var Y={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var pe;function He(){return pe||(pe=1,process.env.NODE_ENV!=="production"&&function(){var a=y,r=Symbol.for("react.element"),o=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),x=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),$=Symbol.iterator,ae="@@iterator";function V(e){if(e===null||typeof e!="object")return null;var t=$&&e[$]||e[ae];return typeof t=="function"?t:null}var j=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function m(e){{for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];oe("error",e,n)}}function oe(e,t,n){{var i=j.ReactDebugCurrentFrame,c=i.getStackAddendum();c!==""&&(t+="%s",n=n.concat([c]));var d=n.map(function(s){return String(s)});d.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,d)}}var ie=!1,le=!1,h=!1,q=!1,H=!1,Te;Te=Symbol.for("react.module.reference");function Et(e){return!!(typeof e=="string"||typeof e=="function"||e===u||e===_||H||e===f||e===O||e===E||q||e===T||ie||le||h||typeof e=="object"&&e!==null&&(e.$$typeof===R||e.$$typeof===P||e.$$typeof===F||e.$$typeof===x||e.$$typeof===p||e.$$typeof===Te||e.getModuleId!==void 0))}function bt(e,t,n){var i=e.displayName;if(i)return i;var c=t.displayName||t.name||"";return c!==""?n+"("+c+")":n}function xe(e){return e.displayName||"Context"}function S(e){if(e==null)return null;if(typeof e.tag=="number"&&m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case u:return"Fragment";case o:return"Portal";case _:return"Profiler";case f:return"StrictMode";case O:return"Suspense";case E:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case x:var t=e;return xe(t)+".Consumer";case F:var n=e;return xe(n._context)+".Provider";case p:return bt(e,e.render,"ForwardRef");case P:var i=e.displayName||null;return i!==null?i:S(e.type)||"Memo";case R:{var c=e,d=c._payload,s=c._init;try{return S(s(d))}catch{return null}}}return null}var I=Object.assign,z=0,Se,Ce,Oe,je,ke,Fe,Ie;function Ae(){}Ae.__reactDisabledLog=!0;function Rt(){{if(z===0){Se=console.log,Ce=console.info,Oe=console.warn,je=console.error,ke=console.group,Fe=console.groupCollapsed,Ie=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ae,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}z++}}function wt(){{if(z--,z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:Se}),info:I({},e,{value:Ce}),warn:I({},e,{value:Oe}),error:I({},e,{value:je}),group:I({},e,{value:ke}),groupCollapsed:I({},e,{value:Fe}),groupEnd:I({},e,{value:Ie})})}z<0&&m("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var se=j.ReactCurrentDispatcher,ue;function K(e,t,n){{if(ue===void 0)try{throw Error()}catch(c){var i=c.stack.trim().match(/\n( *(at )?)/);ue=i&&i[1]||""}return`
18
+ `+ue+e}}var ce=!1,Z;{var Pt=typeof WeakMap=="function"?WeakMap:Map;Z=new Pt}function De(e,t){if(!e||ce)return"";{var n=Z.get(e);if(n!==void 0)return n}var i;ce=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var d;d=se.current,se.current=null,Rt();try{if(t){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(C){i=C}Reflect.construct(e,[],s)}else{try{s.call()}catch(C){i=C}e.call(s.prototype)}}else{try{throw Error()}catch(C){i=C}e()}}catch(C){if(C&&i&&typeof C.stack=="string"){for(var l=C.stack.split(`
19
+ `),b=i.stack.split(`
20
+ `),v=l.length-1,g=b.length-1;v>=1&&g>=0&&l[v]!==b[g];)g--;for(;v>=1&&g>=0;v--,g--)if(l[v]!==b[g]){if(v!==1||g!==1)do if(v--,g--,g<0||l[v]!==b[g]){var w=`
21
+ `+l[v].replace(" at new "," at ");return e.displayName&&w.includes("<anonymous>")&&(w=w.replace("<anonymous>",e.displayName)),typeof e=="function"&&Z.set(e,w),w}while(v>=1&&g>=0);break}}}finally{ce=!1,se.current=d,wt(),Error.prepareStackTrace=c}var W=e?e.displayName||e.name:"",Je=W?K(W):"";return typeof e=="function"&&Z.set(e,Je),Je}function Tt(e,t,n){return De(e,!1)}function xt(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function Q(e,t,n){if(e==null)return"";if(typeof e=="function")return De(e,xt(e));if(typeof e=="string")return K(e);switch(e){case O:return K("Suspense");case E:return K("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case p:return Tt(e.render);case P:return Q(e.type,t,n);case R:{var i=e,c=i._payload,d=i._init;try{return Q(d(c),t,n)}catch{}}}return""}var ee=Object.prototype.hasOwnProperty,Me={},Ge=j.ReactDebugCurrentFrame;function te(e){if(e){var t=e._owner,n=Q(e.type,e._source,t?t.type:null);Ge.setExtraStackFrame(n)}else Ge.setExtraStackFrame(null)}function St(e,t,n,i,c){{var d=Function.call.bind(ee);for(var s in e)if(d(e,s)){var l=void 0;try{if(typeof e[s]!="function"){var b=Error((i||"React class")+": "+n+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw b.name="Invariant Violation",b}l=e[s](t,s,i,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(v){l=v}l&&!(l instanceof Error)&&(te(c),m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",i||"React class",n,s,typeof l),te(null)),l instanceof Error&&!(l.message in Me)&&(Me[l.message]=!0,te(c),m("Failed %s type: %s",n,l.message),te(null))}}}var Ct=Array.isArray;function fe(e){return Ct(e)}function Ot(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,n=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function jt(e){try{return Ne(e),!1}catch{return!0}}function Ne(e){return""+e}function We(e){if(jt(e))return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ot(e)),Ne(e)}var B=j.ReactCurrentOwner,kt={key:!0,ref:!0,__self:!0,__source:!0},Ue,Ye,de;de={};function Ft(e){if(ee.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function It(e){if(ee.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function At(e,t){if(typeof e.ref=="string"&&B.current&&t&&B.current.stateNode!==t){var n=S(B.current.type);de[n]||(m('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',S(B.current.type),e.ref),de[n]=!0)}}function Dt(e,t){{var n=function(){Ue||(Ue=!0,m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function Mt(e,t){{var n=function(){Ye||(Ye=!0,m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var Gt=function(e,t,n,i,c,d,s){var l={$$typeof:r,type:e,key:t,ref:n,props:s,_owner:d};return l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l};function Nt(e,t,n,i,c){{var d,s={},l=null,b=null;n!==void 0&&(We(n),l=""+n),It(t)&&(We(t.key),l=""+t.key),Ft(t)&&(b=t.ref,At(t,c));for(d in t)ee.call(t,d)&&!kt.hasOwnProperty(d)&&(s[d]=t[d]);if(e&&e.defaultProps){var v=e.defaultProps;for(d in v)s[d]===void 0&&(s[d]=v[d])}if(l||b){var g=typeof e=="function"?e.displayName||e.name||"Unknown":e;l&&Dt(s,g),b&&Mt(s,g)}return Gt(e,l,b,c,i,B.current,s)}}var _e=j.ReactCurrentOwner,Le=j.ReactDebugCurrentFrame;function N(e){if(e){var t=e._owner,n=Q(e.type,e._source,t?t.type:null);Le.setExtraStackFrame(n)}else Le.setExtraStackFrame(null)}var ve;ve=!1;function he(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function $e(){{if(_e.current){var e=S(_e.current.type);if(e)return`
22
+
23
+ Check the render method of \``+e+"`."}return""}}function Wt(e){{if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),n=e.lineNumber;return`
24
+
25
+ Check your code at `+t+":"+n+"."}return""}}var Ve={};function Ut(e){{var t=$e();if(!t){var n=typeof e=="string"?e:e.displayName||e.name;n&&(t=`
26
+
27
+ Check the top-level render call using <`+n+">.")}return t}}function ze(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=Ut(t);if(Ve[n])return;Ve[n]=!0;var i="";e&&e._owner&&e._owner!==_e.current&&(i=" It was passed a child from "+S(e._owner.type)+"."),N(e),m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,i),N(null)}}function Be(e,t){{if(typeof e!="object")return;if(fe(e))for(var n=0;n<e.length;n++){var i=e[n];he(i)&&ze(i,t)}else if(he(e))e._store&&(e._store.validated=!0);else if(e){var c=V(e);if(typeof c=="function"&&c!==e.entries)for(var d=c.call(e),s;!(s=d.next()).done;)he(s.value)&&ze(s.value,t)}}}function Yt(e){{var t=e.type;if(t==null||typeof t=="string")return;var n;if(typeof t=="function")n=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===p||t.$$typeof===P))n=t.propTypes;else return;if(n){var i=S(t);St(n,e.props,"prop",i,e)}else if(t.PropTypes!==void 0&&!ve){ve=!0;var c=S(t);m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",c||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Lt(e){{for(var t=Object.keys(e.props),n=0;n<t.length;n++){var i=t[n];if(i!=="children"&&i!=="key"){N(e),m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",i),N(null);break}}e.ref!==null&&(N(e),m("Invalid attribute `ref` supplied to `React.Fragment`."),N(null))}}function Xe(e,t,n,i,c,d){{var s=Et(e);if(!s){var l="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(l+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var b=Wt(c);b?l+=b:l+=$e();var v;e===null?v="null":fe(e)?v="array":e!==void 0&&e.$$typeof===r?(v="<"+(S(e.type)||"Unknown")+" />",l=" Did you accidentally export a JSX literal instead of a component?"):v=typeof e,m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",v,l)}var g=Nt(e,t,n,c,d);if(g==null)return g;if(s){var w=t.children;if(w!==void 0)if(i)if(fe(w)){for(var W=0;W<w.length;W++)Be(w[W],e);Object.freeze&&Object.freeze(w)}else m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Be(w,e)}return e===u?Lt(g):Yt(g),g}}function $t(e,t,n){return Xe(e,t,n,!0)}function Vt(e,t,n){return Xe(e,t,n,!1)}var zt=Vt,Bt=$t;Y.Fragment=u,Y.jsx=zt,Y.jsxs=Bt}()),Y}process.env.NODE_ENV==="production"?re.exports=qe():re.exports=He();var Ke=re.exports;const Ze=Ke.jsx,Xt="",Qe={"ol-box":"_ol-box_1tyvt_1","ol-mouse-position":"_ol-mouse-position_1tyvt_1","ol-scale-line":"_ol-scale-line_1tyvt_1","ol-scale-line-inner":"_ol-scale-line-inner_1tyvt_1","ol-scale-bar":"_ol-scale-bar_1tyvt_1","ol-scale-bar-inner":"_ol-scale-bar-inner_1tyvt_1","ol-scale-step-marker":"_ol-scale-step-marker_1tyvt_1","ol-scale-step-text":"_ol-scale-step-text_1tyvt_1","ol-scale-text":"_ol-scale-text_1tyvt_1","ol-scale-singlebar":"_ol-scale-singlebar_1tyvt_1","ol-scale-singlebar-even":"_ol-scale-singlebar-even_1tyvt_1","ol-scale-singlebar-odd":"_ol-scale-singlebar-odd_1tyvt_1","ol-unsupported":"_ol-unsupported_1tyvt_1","ol-viewport":"_ol-viewport_1tyvt_1","ol-unselectable":"_ol-unselectable_1tyvt_1","ol-selectable":"_ol-selectable_1tyvt_1","ol-grabbing":"_ol-grabbing_1tyvt_1","ol-grab":"_ol-grab_1tyvt_1","ol-control":"_ol-control_1tyvt_1","ol-zoom":"_ol-zoom_1tyvt_1","ol-rotate":"_ol-rotate_1tyvt_1","ol-hidden":"_ol-hidden_1tyvt_1","ol-zoom-extent":"_ol-zoom-extent_1tyvt_1","ol-full-screen":"_ol-full-screen_1tyvt_1","ol-compass":"_ol-compass_1tyvt_1","ol-touch":"_ol-touch_1tyvt_1","ol-zoom-in":"_ol-zoom-in_1tyvt_1","ol-zoom-out":"_ol-zoom-out_1tyvt_1","ol-attribution":"_ol-attribution_1tyvt_1","ol-collapsed":"_ol-collapsed_1tyvt_1","ol-uncollapsible":"_ol-uncollapsible_1tyvt_1","ol-zoomslider":"_ol-zoomslider_1tyvt_1","ol-overviewmap":"_ol-overviewmap_1tyvt_1","ol-overviewmap-map":"_ol-overviewmap-map_1tyvt_1","ol-overviewmap-box":"_ol-overviewmap-box_1tyvt_1",map:"_map_1tyvt_2","map-popup-container":"_map-popup-container_1tyvt_7",touch:"_touch_1tyvt_26","mobile-layers-button":"_mobile-layers-button_1tyvt_30",floaten:"_floaten_1tyvt_45",float:"_float_1tyvt_45"},et={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class tt{constructor(r){this.code_=r.code,this.units_=r.units,this.extent_=r.extent!==void 0?r.extent:null,this.worldExtent_=r.worldExtent!==void 0?r.worldExtent:null,this.axisOrientation_=r.axisOrientation!==void 0?r.axisOrientation:"enu",this.global_=r.global!==void 0?r.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=r.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=r.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||et[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(r){this.global_=r,this.canWrapX_=!!(r&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(r){this.defaultTileGrid_=r}setExtent(r){this.extent_=r,this.canWrapX_=!!(this.global_&&r)}setWorldExtent(r){this.worldExtent_=r}setGetPointResolution(r){this.getPointResolutionFunc_=r}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const me=tt,L=6378137,D=Math.PI*L,rt=[-D,-D,D,D],nt=[-180,-85,180,85],X=L*Math.log(Math.tan(Math.PI/2));class M extends me{constructor(r){super({code:r,units:"m",extent:rt,global:!0,worldExtent:nt,getPointResolution:function(o,u){return o/Math.cosh(u[1]/L)}})}}const ye=[new M("EPSG:3857"),new M("EPSG:102100"),new M("EPSG:102113"),new M("EPSG:900913"),new M("http://www.opengis.net/def/crs/EPSG/0/3857"),new M("http://www.opengis.net/gml/srs/epsg.xml#3857")];function at(a,r,o){const u=a.length;o=o>1?o:2,r===void 0&&(o>2?r=a.slice():r=new Array(u));for(let f=0;f<u;f+=o){r[f]=D*a[f]/180;let _=L*Math.log(Math.tan(Math.PI*(+a[f+1]+90)/360));_>X?_=X:_<-X&&(_=-X),r[f+1]=_}return r}function ot(a,r,o){const u=a.length;o=o>1?o:2,r===void 0&&(o>2?r=a.slice():r=new Array(u));for(let f=0;f<u;f+=o)r[f]=180*a[f]/D,r[f+1]=360*Math.atan(Math.exp(a[f+1]/L))/Math.PI-90;return r}const it=6378137,Ee=[-180,-90,180,90],lt=Math.PI*it/180;class k extends me{constructor(r,o){super({code:r,units:"degrees",extent:Ee,axisOrientation:o,global:!0,metersPerUnit:lt,worldExtent:Ee})}}const be=[new k("CRS:84"),new k("EPSG:4326","neu"),new k("urn:ogc:def:crs:OGC:1.3:CRS84"),new k("urn:ogc:def:crs:OGC:2:84"),new k("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new k("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new k("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let ne={};function st(a){return ne[a]||ne[a.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function ut(a,r){ne[a]=r}let G={};function J(a,r,o){const u=a.getCode(),f=r.getCode();u in G||(G[u]={}),G[u][f]=o}function ct(a,r){let o;return a in G&&r in G[a]&&(o=G[a][r]),o}function Re(a,r){if(r!==void 0){for(let o=0,u=a.length;o<u;++o)r[o]=a[o];r=r}else r=a.slice();return r}function ft(a,r){if(r!==void 0&&a!==r){for(let o=0,u=a.length;o<u;++o)r[o]=a[o];a=r}return a}function dt(a){ut(a.getCode(),a),J(a,a,Re)}function _t(a){a.forEach(dt)}function we(a){return typeof a=="string"?st(a):a||null}function Pe(a){_t(a),a.forEach(function(r){a.forEach(function(o){r!==o&&J(r,o,Re)})})}function vt(a,r,o,u){a.forEach(function(f){r.forEach(function(_){J(f,_,o),J(_,f,u)})})}function ht(a,r){return mt(a,"EPSG:4326",r!==void 0?r:"EPSG:3857")}function gt(a,r){const o=a.getCode(),u=r.getCode();let f=ct(o,u);return f||(f=ft),f}function pt(a,r){const o=we(a),u=we(r);return gt(o,u)}function mt(a,r,o){return pt(r,o)(a,void 0,a.length)}function yt(){Pe(ye),Pe(be),vt(be,ye,at,ot)}return yt(),y.forwardRef(({options:a,mapKey:r,zoom:o,defaultType:u,scale:f,center:_,poi:F,traffic:x,onInit:p,className:O,style:E},P)=>{const R=y.useRef(null),T=y.useRef(null),[$,ae]=y.useState(!1),[V,j]=y.useState(null);y.useImperativeHandle(P,()=>({get mapContainer(){return R},get map(){return T.current},get isInitiated(){return $}}),[$,T.current]);const m=()=>{var q,H;if(V)return V;const h=(H=(q=R.current)==null?void 0:q.querySelector(".ol-viewport"))==null?void 0:H.querySelectorAll("div:last-child");if(h)return j(Array.from(h)[h.length-1]),V},oe=()=>{const h=m();h==null||h.style.setProperty("scale",""+f)},ie=()=>{const h=m();h==null||h.style.setProperty("bottom","0.2em"),h==null||h.style.setProperty("left","0.4em")},le=()=>{if(T.current!=null||!R.current)return;const h={};_!=null&&_.longitude&&_.latitude&&(h.center=ht([_==null?void 0:_.longitude,_==null?void 0:_.latitude])),o&&(h.zoom=o),T.current=new A.Map({target:R.current,key:r||"",mapType:u,poi:F,traffic:x,view:new A.View(h),controls:[],...a}),ae(!0),p&&p(T.current)};return y.useEffect(()=>{le(),oe(),ie()},[]),Ze("div",{ref:R,className:O||Qe.map,style:E})})});
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- @import"https://static.neshan.org/sdk/openlayers/5.3.0/ol.css";:root{--sm: .25em;--md: .5em;--lg: 1em;--text-xl: 1.3em;--text-lg: 1.05em;--text-nm: 1em;--text-sm: .85em;--text-xs: .8em;--text-xxs: .75em;--primary: #03a9f4}.pos-relative{position:relative}.pos-absolute{position:absolute}.pos-sticky{position:sticky}.d-block{display:block}.d-flex{display:flex}.flex-column{flex-flow:column}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-around{justify-content:space-around}.align-center{align-items:center}.text-center{text-align:center}.text-xl{font-size:var(--text-xl)}.text-lg{font-size:var(--text-lg)}.text-nm{font-size:var(--text-nm)}.text-sm{font-size:var(--text-sm)}.text-xs{font-size:var(--text-xs)}.text-xxs{font-size:var(--text-xxs)}.text-caption{font-size:var(--text-sm);color:gray}.mx-auto{margin-left:auto;margin-right:auto}.px-1{padding-left:var(--md);padding-right:var(--md)}.px-2{padding-left:var(--lg);padding-right:var(--lg)}.mt-1{margin-top:var(--sm)}.mt-2{margin-top:var(--md)}.mx-1{margin-left:var(--md);margin-right:var(--md)}.mx-2{margin-left:var(--lg);margin-right:var(--lg)}.my-2{margin-top:var(--md);margin-bottom:var(--md)}.box-shadow{box-shadow:0 2px 4px 1px #a8a8a8}.o-auto{overflow:auto}.o-hidden{overflow:hidden}.pointer{cursor:pointer}.select-none{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mamad .asghar{position:relative}._map_1yxt5_2{height:100%;direction:rtl}._map-popup-container_1yxt5_7{background-color:#fff;-webkit-box-shadow:0px 0px 4px 2px rgba(0,0,0,.5529411765);box-shadow:0 0 4px 2px #00000046;border-radius:5px;padding:2px 5px;font-size:var(--text-sm)}._map-popup-container_1yxt5_7:after{content:" ";position:absolute;top:100%;left:50%;margin-left:-10px;border-width:10px;border-style:solid;border-color:rgb(255,255,255) transparent transparent transparent}._touch_1yxt5_26 ._map-popup-container_1yxt5_7{font-size:var(--text-xs)}._mobile-layers-button_1yxt5_30{top:20%;right:10%;z-index:2;background:rgba(255,255,255,.701);border:none;border-radius:50%;height:2.3em;width:2.3em;padding:.25em;box-shadow:0 3px 10px #0003}._mobile-layers-button_1yxt5_30 img{width:100%}._mobile-layers-button_1yxt5_30._floaten_1yxt5_45{animation-name:_float_1yxt5_45;animation-duration:.35s;animation-iteration-count:1}@keyframes _float_1yxt5_45{0%,to{transform:translateY(0)}50%{transform:translateY(5px)}}
1
+ :root{--sm: .25em;--md: .5em;--lg: 1em;--text-xl: 1.3em;--text-lg: 1.05em;--text-nm: 1em;--text-sm: .85em;--text-xs: .8em;--text-xxs: .75em;--primary: #03a9f4}.pos-relative{position:relative}.pos-absolute{position:absolute}.pos-sticky{position:sticky}.d-block{display:block}.d-flex{display:flex}.flex-column{flex-flow:column}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-around{justify-content:space-around}.align-center{align-items:center}.text-center{text-align:center}.text-xl{font-size:var(--text-xl)}.text-lg{font-size:var(--text-lg)}.text-nm{font-size:var(--text-nm)}.text-sm{font-size:var(--text-sm)}.text-xs{font-size:var(--text-xs)}.text-xxs{font-size:var(--text-xxs)}.text-caption{font-size:var(--text-sm);color:gray}.mx-auto{margin-left:auto;margin-right:auto}.px-1{padding-left:var(--md);padding-right:var(--md)}.px-2{padding-left:var(--lg);padding-right:var(--lg)}.mt-1{margin-top:var(--sm)}.mt-2{margin-top:var(--md)}.mx-1{margin-left:var(--md);margin-right:var(--md)}.mx-2{margin-left:var(--lg);margin-right:var(--lg)}.my-2{margin-top:var(--md);margin-bottom:var(--md)}.box-shadow{box-shadow:0 2px 4px 1px #a8a8a8}.o-auto{overflow:auto}.o-hidden{overflow:hidden}.pointer{cursor:pointer}.select-none{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mamad .asghar{position:relative}:root,:host{--ol-background-color: white;--ol-accent-background-color: #F5F5F5;--ol-subtle-background-color: rgba(128, 128, 128, .25);--ol-partial-background-color: rgba(255, 255, 255, .75);--ol-foreground-color: #333333;--ol-subtle-foreground-color: #666666;--ol-brand-color: #00AAFF}._ol-box_1tyvt_1{box-sizing:border-box;border-radius:2px;border:1.5px solid var(--ol-background-color);background-color:var(--ol-partial-background-color)}._ol-mouse-position_1tyvt_1{top:8px;right:8px;position:absolute}._ol-scale-line_1tyvt_1{background:var(--ol-partial-background-color);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute}._ol-scale-line-inner_1tyvt_1{border:1px solid var(--ol-subtle-foreground-color);border-top:none;color:var(--ol-foreground-color);font-size:10px;text-align:center;margin:1px;will-change:contents,width;transition:all .25s}._ol-scale-bar_1tyvt_1{position:absolute;bottom:8px;left:8px}._ol-scale-bar-inner_1tyvt_1{display:flex}._ol-scale-step-marker_1tyvt_1{width:1px;height:15px;background-color:var(--ol-foreground-color);float:right;z-index:10}._ol-scale-step-text_1tyvt_1{position:absolute;bottom:-5px;font-size:10px;z-index:11;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}._ol-scale-text_1tyvt_1{position:absolute;font-size:12px;text-align:center;bottom:25px;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}._ol-scale-singlebar_1tyvt_1{position:relative;height:10px;z-index:9;box-sizing:border-box;border:1px solid var(--ol-foreground-color)}._ol-scale-singlebar-even_1tyvt_1{background-color:var(--ol-subtle-foreground-color)}._ol-scale-singlebar-odd_1tyvt_1{background-color:var(--ol-background-color)}._ol-unsupported_1tyvt_1{display:none}._ol-viewport_1tyvt_1,._ol-unselectable_1tyvt_1{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}._ol-viewport_1tyvt_1 canvas{all:unset;overflow:hidden}._ol-viewport_1tyvt_1{touch-action:none}._ol-selectable_1tyvt_1{-webkit-touch-callout:default;-webkit-user-select:text;-moz-user-select:text;user-select:text}._ol-grabbing_1tyvt_1{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}._ol-grab_1tyvt_1{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}._ol-control_1tyvt_1{position:absolute;background-color:var(--ol-subtle-background-color);border-radius:4px}._ol-zoom_1tyvt_1{top:.5em;left:.5em}._ol-rotate_1tyvt_1{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear}._ol-rotate_1tyvt_1._ol-hidden_1tyvt_1{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}._ol-zoom-extent_1tyvt_1{top:4.643em;left:.5em}._ol-full-screen_1tyvt_1{right:.5em;top:.5em}._ol-control_1tyvt_1 button{display:block;margin:1px;padding:0;color:var(--ol-subtle-foreground-color);font-weight:700;text-decoration:none;font-size:inherit;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:var(--ol-background-color);border:none;border-radius:2px}._ol-control_1tyvt_1 button::-moz-focus-inner{border:none;padding:0}._ol-zoom-extent_1tyvt_1 button{line-height:1.4em}._ol-compass_1tyvt_1{display:block;font-weight:400;will-change:transform}._ol-touch_1tyvt_1 ._ol-control_1tyvt_1 button{font-size:1.5em}._ol-touch_1tyvt_1 ._ol-zoom-extent_1tyvt_1{top:5.5em}._ol-control_1tyvt_1 button:hover,._ol-control_1tyvt_1 button:focus{text-decoration:none;outline:1px solid var(--ol-subtle-foreground-color);color:var(--ol-foreground-color)}._ol-zoom_1tyvt_1 ._ol-zoom-in_1tyvt_1{border-radius:2px 2px 0 0}._ol-zoom_1tyvt_1 ._ol-zoom-out_1tyvt_1{border-radius:0 0 2px 2px}._ol-attribution_1tyvt_1{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);display:flex;flex-flow:row-reverse;align-items:center}._ol-attribution_1tyvt_1 a{color:var(--ol-subtle-foreground-color);text-decoration:none}._ol-attribution_1tyvt_1 ul{margin:0;padding:1px .5em;color:var(--ol-foreground-color);text-shadow:0 0 2px var(--ol-background-color);font-size:12px}._ol-attribution_1tyvt_1 li{display:inline;list-style:none}._ol-attribution_1tyvt_1 li:not(:last-child):after{content:" "}._ol-attribution_1tyvt_1 img{max-height:2em;max-width:inherit;vertical-align:middle}._ol-attribution_1tyvt_1 button{flex-shrink:0}._ol-attribution_1tyvt_1._ol-collapsed_1tyvt_1 ul{display:none}._ol-attribution_1tyvt_1:not(._ol-collapsed_1tyvt_1){background:var(--ol-partial-background-color)}._ol-attribution_1tyvt_1._ol-uncollapsible_1tyvt_1{bottom:0;right:0;border-radius:4px 0 0}._ol-attribution_1tyvt_1._ol-uncollapsible_1tyvt_1 img{margin-top:-.2em;max-height:1.6em}._ol-attribution_1tyvt_1._ol-uncollapsible_1tyvt_1 button{display:none}._ol-zoomslider_1tyvt_1{top:4.5em;left:.5em;height:200px}._ol-zoomslider_1tyvt_1 button{position:relative;height:10px}._ol-touch_1tyvt_1 ._ol-zoomslider_1tyvt_1{top:5.5em}._ol-overviewmap_1tyvt_1{left:.5em;bottom:.5em}._ol-overviewmap_1tyvt_1._ol-uncollapsible_1tyvt_1{bottom:0;left:0;border-radius:0 4px 0 0}._ol-overviewmap_1tyvt_1 ._ol-overviewmap-map_1tyvt_1,._ol-overviewmap_1tyvt_1 button{display:block}._ol-overviewmap_1tyvt_1 ._ol-overviewmap-map_1tyvt_1{border:1px solid var(--ol-subtle-foreground-color);height:150px;width:150px}._ol-overviewmap_1tyvt_1:not(._ol-collapsed_1tyvt_1) button{bottom:0;left:0;position:absolute}._ol-overviewmap_1tyvt_1._ol-collapsed_1tyvt_1 ._ol-overviewmap-map_1tyvt_1,._ol-overviewmap_1tyvt_1._ol-uncollapsible_1tyvt_1 button{display:none}._ol-overviewmap_1tyvt_1:not(._ol-collapsed_1tyvt_1){background:var(--ol-subtle-background-color)}._ol-overviewmap-box_1tyvt_1{border:1.5px dotted var(--ol-subtle-foreground-color)}._ol-overviewmap_1tyvt_1 ._ol-overviewmap-box_1tyvt_1:hover{cursor:move}._map_1tyvt_2{height:100%;direction:rtl}._map-popup-container_1tyvt_7{background-color:#fff;-webkit-box-shadow:0px 0px 4px 2px rgba(0,0,0,.5529411765);box-shadow:0 0 4px 2px #00000046;border-radius:5px;padding:2px 5px;font-size:var(--text-sm)}._map-popup-container_1tyvt_7:after{content:" ";position:absolute;top:100%;left:50%;margin-left:-10px;border-width:10px;border-style:solid;border-color:rgb(255,255,255) transparent transparent transparent}._touch_1tyvt_26 ._map-popup-container_1tyvt_7{font-size:var(--text-xs)}._mobile-layers-button_1tyvt_30{top:20%;right:10%;z-index:2;background:rgba(255,255,255,.701);border:none;border-radius:50%;height:2.3em;width:2.3em;padding:.25em;box-shadow:0 3px 10px #0003}._mobile-layers-button_1tyvt_30 img{width:100%}._mobile-layers-button_1tyvt_30._floaten_1tyvt_45{animation-name:_float_1tyvt_45;animation-duration:.35s;animation-iteration-count:1}@keyframes _float_1tyvt_45{0%,to{transform:translateY(0)}50%{transform:translateY(5px)}}
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
- declare function App(): JSX.Element;
1
+ declare function App(): import("react/jsx-runtime").JSX.Element;
3
2
  export default App;
@@ -2,4 +2,3 @@
2
2
  import "../assets/main.scss";
3
3
  import { MapProps, NeshanMapRef } from "./Map.model";
4
4
  export declare const NeshanMap: import("react").ForwardRefExoticComponent<MapProps & import("react").RefAttributes<NeshanMapRef>>;
5
- export declare const NeshanMapWrappedInContext: import("react").ForwardRefExoticComponent<MapProps & import("react").RefAttributes<NeshanMapRef>>;
@@ -1,7 +1,7 @@
1
- import { Map } from "ol";
2
- import { MapOptions as MainMapOptions } from "ol/PluggableMap";
1
+ import { Map } from "@neshan-maps-platform/ol";
2
+ import { MapOptions as MainMapOptions } from "@neshan-maps-platform/ol/Map";
3
+ import { MapType } from "@neshan-maps-platform/ol/Map";
3
4
  import React from "react";
4
- import { Ol } from "@/assets/ol.model";
5
5
  export interface BaseMapOptions extends MainMapOptions {
6
6
  mapType?: MapType;
7
7
  poi?: boolean;
@@ -18,36 +18,26 @@ type MapOptionsUnion = {
18
18
  mapKey?: undefined;
19
19
  };
20
20
  export interface BaseMapProps {
21
- serviceKey?: string;
22
21
  zoom?: number;
23
22
  center?: CoordsObj;
24
23
  scale?: number;
25
24
  defaultType?: MapType;
26
25
  poi?: boolean;
27
26
  traffic?: boolean;
28
- onInit?: (ol: Ol, map: OlMap) => void;
27
+ onInit?: (map: Map) => void;
29
28
  className?: React.HTMLAttributes<HTMLDivElement>["className"];
30
29
  style?: React.HtmlHTMLAttributes<HTMLDivElement>["style"];
31
30
  }
32
31
  export type MapProps = BaseMapProps & MapOptionsUnion;
33
32
  export interface NeshanMapRef {
34
33
  mapContainer: React.RefObject<HTMLDivElement>;
35
- ol?: Ol;
36
- map: OlMap | null;
34
+ map: Map | null;
37
35
  isInitiated: boolean;
38
36
  }
39
37
  export declare interface CoordsObj {
40
38
  latitude: number;
41
39
  longitude: number;
42
40
  }
43
- export declare class OlMap extends Map {
44
- constructor(options: MapOptionsWithKey);
45
- setMapType(value: MapType): void;
46
- switchPoiLayer(value: boolean): void;
47
- switchTrafficLayer(value: boolean): void;
48
- }
49
- export declare type MapType = "neshan" | "dreamy" | "dreamy-gold" | "standard-night" | "standard-day" | "osm-bright";
50
- export declare type ViewType = undefined | "desktop" | "mobile";
51
41
  export declare interface Tile {
52
42
  title: MapType;
53
43
  url: string;
@@ -1,4 +1,3 @@
1
- import { NeshanMapWrappedInContext } from "./Map";
2
- export default NeshanMapWrappedInContext;
3
- export type { NeshanMapRef, OlMap } from "./Map.model";
4
- export type { Ol } from "@/assets/ol.model";
1
+ import { NeshanMap } from "./Map";
2
+ export default NeshanMap;
3
+ export type { NeshanMapRef } from "./Map.model";
@@ -2,7 +2,6 @@ import { Tile } from "../components/Map.model";
2
2
  export declare const urls: {
3
3
  reverse: string;
4
4
  search: string;
5
- map: string;
6
5
  };
7
6
  export declare const markerUrls: {
8
7
  main: string;
@@ -1,4 +1,4 @@
1
- import { Coordinate } from "ol/coordinate";
1
+ import { Coordinate } from "@neshan-maps-platform/ol/coordinate";
2
2
  import { CoordsObj } from "../components/Map.model";
3
3
  /**
4
4
  * Get the object of location and turns it into array
package/package.json CHANGED
@@ -3,32 +3,30 @@
3
3
  "title": "react-neshanmap-openlayers",
4
4
  "description": "A react map component wrapping neshan openlayers map.",
5
5
  "private": false,
6
- "version": "2.0.16",
6
+ "version": "3.0.0",
7
7
  "type": "module",
8
8
  "types": "./dist/types/components/index.d.ts",
9
9
  "files": [
10
10
  "./dist/**"
11
11
  ],
12
- "main": "./dist/React-Openlayers.js",
13
- "module": "./dist/React-Openlayers.js",
12
+ "main": "./dist/neshan-ol-react-sdk.umd.js",
13
+ "module": "./dist/neshan-ol-react-sdk.es.js",
14
14
  "scripts": {
15
15
  "dev": "vite",
16
- "build": "vite build && tsc",
16
+ "build": "rm -rf dist && vite build && tsc",
17
17
  "preview": "vite preview",
18
18
  "prepublishOnly": "yarn build"
19
19
  },
20
20
  "peerDependencies": {
21
- "react": "18.x",
22
- "react-dom": "18.x"
21
+ "@neshan-maps-platform/ol": "1.0.5",
22
+ "react": "18.2.0",
23
+ "react-dom": "18.2.0"
23
24
  },
24
25
  "devDependencies": {
25
26
  "@types/node": "^18.11.18",
26
- "@types/ol": "5",
27
- "@types/react": "^18.0.27",
27
+ "@types/react": "^18.2.38",
28
28
  "@types/react-dom": "^18.0.10",
29
29
  "@vitejs/plugin-react": "^3.1.0",
30
- "react": "^18.2.0",
31
- "react-dom": "^18.2.0",
32
30
  "sass": "^1.58.0",
33
31
  "typescript": "^4.9.3",
34
32
  "vite": "^4.1.0"