react-route-profile 0.1.39 → 0.1.40
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 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var reactWrapper=require('@googlemaps/react-wrapper'),M=require('react'),jsxRuntime=require('react/jsx-runtime'),ht=require('./Loader.module-M6WPG37K.module.css')
|
|
1
|
+
'use strict';var reactWrapper=require('@googlemaps/react-wrapper'),M=require('react'),jsxRuntime=require('react/jsx-runtime'),ht=require('./Loader.module-M6WPG37K.module.css');require('./index-DIK6ZNA4.css');var kt=require('./GoogleMapCanvas.module-GCGVA6T4.module.css'),md=require('react-icons/md'),recharts=require('recharts'),b=require('./RouteMap.module-BNAAKWIR.module.css');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var M__namespace=/*#__PURE__*/_interopNamespace(M);var ht__default=/*#__PURE__*/_interopDefault(ht);var kt__default=/*#__PURE__*/_interopDefault(kt);var b__default=/*#__PURE__*/_interopDefault(b);var q=()=>typeof window>"u"?true:window.innerWidth>=window.innerHeight,j=()=>{let[e,t]=M.useState(q);return M.useEffect(()=>{let n=()=>t(q());return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),{isHorizontal:e,isVertical:!e}};var ee=(i=>(i.Asphalt="asphalt",i.Compacted="compacted",i.Concrete="concrete",i.Natural="natural",i.Penetrated="penetrated",i))(ee||{});var te={loader:{loadingMap:"Karte wird geladen..."},routeMap:{apiKeyMissing:"Die Karte kann nicht angezeigt werden: Der Google Maps API-Schl\xFCssel fehlt",googleMapsFailure:"Die Google Maps API konnte nicht geladen werden. Pr\xFCfen Sie Ihren API-Schl\xFCssel oder die Netzwerkverbindung.",expandRouteProfile:"Routenprofil erweitern",minimizeRouteProfile:"Routenprofil minimieren",scrollToExplore:"Zum Erkunden scrollen",scrollableRouteProfile:"Scrollbares Routenprofil"},tooltip:{elevation:"H\xF6henmeter"},surface:{asphalt:"Asphalt",compacted:"Verdichteter Belag",concrete:"Beton",natural:"Naturbelag",penetrated:"Penetrierter Belag"}};var re={loader:{loadingMap:"Loading map..."},routeMap:{apiKeyMissing:"Oops! Cannot display the map: Google Maps API key missing",googleMapsFailure:"Unable to load Google Maps API. Check your API key or network.",expandRouteProfile:"Expand route profile",minimizeRouteProfile:"Minimize route profile",scrollToExplore:"Scroll to explore",scrollableRouteProfile:"Scrollable route profile"},tooltip:{elevation:"Elevation"},surface:{asphalt:"Asphalt",compacted:"Compacted",concrete:"Concrete",natural:"Natural",penetrated:"Penetrated"}};var ne={loader:{loadingMap:"Na\u010D\xEDtavam mapu..."},routeMap:{apiKeyMissing:"Ups! Mapu nie je mo\u017En\xE9 zobrazi\u0165: ch\xFDba Google Maps API k\u013E\xFA\u010D",googleMapsFailure:"Google Maps API sa nepodarilo na\u010D\xEDta\u0165. Skontrolujte API k\u013E\xFA\u010D alebo sie\u0165.",expandRouteProfile:"Rozbali\u0165 profil trasy",minimizeRouteProfile:"Zbali\u0165 profil trasy",scrollToExplore:"Posunut\xEDm zobraz\xEDte viac",scrollableRouteProfile:"Posuvn\xFD profil trasy"},tooltip:{elevation:"Prev\xFD\u0161enie"},surface:{asphalt:"Asfalt",compacted:"Spevnen\xFD povrch",concrete:"Bet\xF3n",natural:"Pr\xEDrodn\xFD povrch",penetrated:"Penetra\u010Dn\xFD povrch"}};var oe={de:te,en:re,sk:ne},ie=M.createContext(oe.en),ae=({lang:e,children:t})=>{let n=M.useMemo(()=>oe[e??"en"],[e]);return jsxRuntime.jsx(ie.Provider,{value:n,children:t})},P=()=>M.useContext(ie);var w={colors:{primary:"rgba(14, 165, 233, 1)",primaryMuted:"rgba(14, 165, 233, 0.7)",accent:"rgba(132, 204, 22, 1)",surface:"rgba(248, 250, 252, 1)"},marker:{outer:"rgba(132, 204, 22, 1)",inner:"rgba(248, 250, 252, 1)",startInner:"rgba(34, 197, 94, 1)",finishInner:"rgba(239, 68, 68, 1)"},dots:{mapActive:"rgba(132, 204, 22, 1)",chart:"rgba(132, 204, 22, 1)",chartActive:"rgba(132, 204, 22, 1)"},map:{strokeWeight:10,markerSize:50,markerLabelFontSize:20,markerLabelFontWeight:"bold",hoverMarkerScale:6},chart:{margin:{top:4,right:8,bottom:4,left:8},gridStroke:"rgba(255,255,255,0.08)",gridDasharray:"3 3",axisStroke:"rgba(226, 232, 240, 0.7)",cursorStroke:"rgba(226,232,240,0.4)",cursorStrokeWidth:1,yAxisWidth:60,lineStrokeWidth:1,dotRadius:3,dotOpacity:.9,activeDotRadius:3,referenceDotRadius:7,referenceLineOpacity:.5,gradientStartOpacity:.6,gradientEndOpacity:.1,xTickFontSize:12,xTickDy:12,xTickUnitFontSize:10,xTickUnitDx:2,yTickFontSize:12,yTickDy:4,yTickUnitFontSize:10,yTickUnitDx:2},tooltip:{background:"rgba(15,23,42,0.9)",textColor:"#e2e8f0",padding:"6px 8px",borderRadius:6},markerShape:{size:33,lift:20,text:{fontSize:12,fontWeight:300,letterSpacing:2,xOffset:15,lineHeight:12,startLiftPerWord:10}}};var se=M.createContext(w),dt=e=>({colors:{...w.colors,...e?.colors??{}},marker:{...w.marker,...e?.marker??{}},dots:{...w.dots,...e?.dots??{}},map:{...w.map,...e?.map??{}},chart:{...w.chart,...e?.chart??{}},tooltip:{...w.tooltip,...e?.tooltip??{}},markerShape:{...w.markerShape,...e?.markerShape??{},text:{...w.markerShape.text,...e?.markerShape?.text??{}}}}),F=({theme:e,children:t})=>{let n=M.useMemo(()=>dt(e),[e]);return jsxRuntime.jsx(se.Provider,{value:n,children:t})},g=()=>M.useContext(se);var gt=({message:e,height:t="100dvh"})=>{let n=g(),{loader:r}=P(),o={height:t,background:n.colors.surface,color:n.colors.primary};return jsxRuntime.jsx("div",{className:ht__default.default.rrpLoader,style:o,children:e??r.loadingMap})},ce=gt;var H=e=>e.length?e[e.length-1].distance:0,ue=(e,t=2e3)=>{let n=[];for(let r=0;r<=e;r+=t)n.push(r);return n[n.length-1]<e&&n.push(e),n},U=e=>[...e.geoJson?.features?.find(o=>o?.geometry?.type==="LineString"&&o?.properties?.elevationProfile?.points)?.properties?.elevationProfile?.points||[]].sort((o,i)=>(o?.distance??0)-(i?.distance??0)),le=e=>(e.geoJson?.features?.find(r=>r?.geometry?.type==="LineString"&&r?.geometry?.coordinates)).geometry.coordinates,me=e=>{if(!e.length)return [0,0];let t=e.map(i=>i.elevation),n=Math.min(...t),r=Math.max(...t),o=Math.max(10,(r-n)*.05);return [Math.floor(n-o),Math.ceil(r+o)]},pe=(e,t=false)=>{let[n,r]=e,o=(r-n)*1.2,i=Math.max(10,Math.round(o/6/10)*10||50),a=t?-20:0,s=Math.floor((n-(o-(r-n))/2)/i)*i+a,c=Math.ceil((r+(o-(r-n))/2)/i)*i+a,p=[];for(let u=s;u<=c+i/2;u+=i)p.push(u);return [s,c,p]},de=(e,t)=>{if(!e?.length)return [];let r=(t?.features??[]).filter(i=>i?.geometry?.type==="Point"),o=[];return r.forEach(i=>{let a=i?.geometry?.coordinates;if(!Array.isArray(a)||a.length<2)return;let[s,c]=a;if(!Number.isFinite(c)||!Number.isFinite(s))return;let p=e.reduce((u,m)=>{let l=Math.pow(m.lat-c,2)+Math.pow(m.lng-s,2);return l<u.dist?{point:m,dist:l}:u},{point:null,dist:Number.POSITIVE_INFINITY});if(p.point){if(p.point.distance===0)return;o.push({distance:p.point.distance,elevation:p.point.elevation,name:i?.properties?.name});}}),o.sort((i,a)=>(i.distance??0)-(a.distance??0))},fe=(e,t)=>{if(!e.length)return null;let n=null,r=Number.POSITIVE_INFINITY;return e.forEach(([o,i])=>{let a=(i-t.lat)**2+(o-t.lng)**2;a<r&&(r=a,n={lat:i,lng:o});}),n},he=(e,t)=>{if(!e.length)return null;let n=null,r=Number.POSITIVE_INFINITY;return e.forEach(o=>{let i=(o.lat-t[0])**2+(o.lng-t[1])**2;i<r&&(r=i,n=o);}),n};var ge=(e,t,n=1e3)=>t&&Math.abs((t.distance??0)-(e.distance??0))<n;var xe={lat:48.9325937,lng:20.3452306},ye=13,ve=12;var we=`<svg stroke="currentColor" fill="#84CC16" stroke-width="2" viewBox="0 0 24 24" aria-hidden="true" height="200px" width="200px" xmlns="http://www.w3.org/2000/svg">
|
|
2
2
|
<path stroke-linecap="round" stroke-linejoin="round" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"></path>
|
|
3
3
|
<path fill="white" stroke-linecap="round" stroke-linejoin="round" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"></path>
|
|
4
4
|
</svg>
|