@geops/rvf-mobility-web-component 0.1.50 → 0.1.51

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.51](https://github.com/geops/rvf-mobility-web-component/compare/v0.1.50...v0.1.51) (2025-09-25)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * set toolbar true by default as it was before ([29f0ae4](https://github.com/geops/rvf-mobility-web-component/commit/29f0ae4b07b7d3cd1d26432276268df72bba01e4))
11
+
5
12
  ### [0.1.50](https://github.com/geops/rvf-mobility-web-component/compare/v0.1.49...v0.1.50) (2025-09-24)
6
13
 
7
14
 
package/index.js CHANGED
@@ -1121,7 +1121,7 @@ sharing`,nextbike_df:"Frelo",yoio_freiburg:"Yoio",zeus_freiburg:"ZEUS"},JF="bicy
1121
1121
  title: "Liniennetzpl\xE4ne", // Text displayed on the layer tree and in the header of the details view.
1122
1122
  }
1123
1123
  </pre>}`},layertree:{defaultValue:"true",description:"Show/hide the layers tree button in the toolbar.",type:"boolean"},mainlink:{description:"A link displayed on bottom left of the map."},mainlinktitle:{description:"A title for the mainlink, used as tooltip."},mapsurl:{defaultValue:"https://maps.geops.io",description:null},maxextent:{defaultValue:pu.join(","),description:"The maximum extent of the map in EPSG:3857 coordinates.<br/>Ex: 831634,5933959,940649,6173660 ."},maxzoom:{defaultValue:"20",description:"The maximal zoom level of the map."},minzoom:{description:"The minimal zoom level of the map."},mots:{description:null},notification:{defaultValue:"false",description:`Add the notification layer to the map. This layer will display informations about disruptions on the network. Data comes from
1124
- our ${nP} .`,type:"boolean"},notificationat:{description:null},notificationtenant:{defaultValue:"rvf",description:null},notificationurl:{defaultValue:"https://moco.geops.io/api/v2/",description:`The ${nP} url to use.`},permalink:{defaultValue:"false",description:"Update some url parameters x,y,z,layers to the current window location. These parameters are used to store the current state of the map. They will be used on page load to configure the web-component.",type:"boolean"},print:{defaultValue:"true",description:"Show/hide the print button in the toolbar.",type:"boolean"},queryablelayers:{defaultValue:ZF,description:"A comma separated list of layers's name. The data of these layers will be queryable by click on the map (see selectedfeature event). If empty, all layers will not be queryable."},realtime:{defaultValue:"true",description:`Add the realtime layer to the map. Data comes from the ${v$} .`,type:"boolean"},realtimebboxparameters:{defaultValue:"line_tags=RVF",description:null},realtimetenant:{description:null},realtimeurl:{defaultValue:"wss://api.geops.io/tracker-ws/v1/ws",description:null},runs:{defaultValue:"false",description:"Shows the number of trips on a line in the sidebar, use only for debugging.",type:"boolean"},search:{defaultValue:"false",description:"Toggle the search stops input.",type:"boolean"},share:{defaultValue:"true",description:"Show/hide the share button in the toolbar.",type:"boolean"},stopsurl:{defaultValue:"https://api.geops.io/stops/v1/",description:null},tenant:{description:null},toolbar:{defaultValue:"false",description:"Show/hide the toolbar on the left.",type:"boolean"},zoom:{description:"The zoom level of the map."}},js=y$;function x$(r){let{apikey:t,baseLayer:e,map:n,notificationat:a,notificationtenant:i,notificationurl:c,previewNotifications:A}=it(),d=W5(()=>{if(!e)return null;let g=new fy({apiKey:t,apiParameters:{contentMedium:!0},date:a?new Date(a):void 0,maplibreLayer:e,name:zy,situations:A,tenant:i,url:c,...r||{},loadAll:!A});return A&&!g.getVisible()&&g.setVisible(!0),g},[t,e,a,i,c,A,r]);return s5(()=>{if(!(!n||!d))return n.addLayer(d),()=>{n.removeLayer(d)}},[n,d]),null}var Dy=m5(x$);function _$(r){let[t,e]=G5(),[n,a]=G5(),{children:i}=r;return s5(()=>()=>{n&&(n.style.height="",n.style.maxHeight="")},[n]),K("div",{ref:c=>{c&&(e(c),a(c.parentElement))},...r,onPointerDown:c=>{t.setPointerCapture(c.pointerId);let A=n.parentElement.getBoundingClientRect(),d=t.getBoundingClientRect(),g=A.top+(c.clientY-d.top);function m(T){n.style.height=`calc(100% - ${T.clientY-g}px)`,n.style.maxHeight="100%"}function x(T){T.target.releasePointerCapture(c.pointerId),document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",x)}document.addEventListener("pointerup",x),document.addEventListener("pointermove",m),document.addEventListener("pointercancel",T=>{document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",x),T.stopPropagation(),T.preventDefault()})},children:i})}var ky=_$;function w$({children:r,className:t,ScrollableHandlerProps:e={}}){let n=!!r;return Array.isArray(r)&&(n=r?.length&&(r||[]).find(a=>!!a)),n?K("div",{className:(ke("pointer-events-auto relative z-50 flex flex-col overflow-hidden bg-white transition-[min-height,max-height] @lg:transition-[width]"),t),children:n&&K($t,{children:[K(ky,{className:"absolute inset-0 flex h-[65px] touch-none justify-center @lg/main:hidden",style:{width:"100%"},...e,children:K("div",{className:"m-2 mr-[-60px] bg-gray-300",style:{borderRadius:2,height:4,width:32}})}),r]})}):null}var Zd=w$;var b$=async(r,t,e=0)=>{if(!r)return Promise.reject(new Error("No vehicle provided"));let{geometry:n,properties:{coordinate:a}}=r,i=t.getView(),c=e||i.getZoom(),A=c>0?i.getResolutionForZoom(c):void 0,d=a;if(!d&&n){let{coord:m}=Pc(Date.now(),r,!0);d=m}return d?(i.cancelAnimations(),new Promise(m=>{i.animate({center:d,duration:1e3,easing:ed,resolution:A},x=>{m(x)})})):Promise.reject(new Error("No center found"))},Zy=b$;var M$=(r,t=!1)=>{let e=Math.round(r/1e3/60);return e>5?"#dc2626":e>=3?"#ea580c":t?"#16a34a":"transparent"},gu=M$;var B$=(r,t,e)=>t?e?"#dc2626":"#a0a0a0":r===null?"transparent":gu(r,e),aP=B$;var S$=r=>`bold ${r}px arial`,oP=S$;var E$=r=>{let t=r;t<0&&(t=0);let e=Math.floor(t/36e5),n=Math.round(t%36e5/6e4),a="";return e>0&&(a+=`${e}h`),n>0&&(a+=`${n}m`),a||"0"},mu=E$;var T$=(r,t=!1)=>{if(t)return String.fromCodePoint(215);let e=mu(r);return e==="0"?"":`+${e}`},sP=T$;var I$=(r,t)=>`bold ${r}px arial`,Od=I$;var F$=(r="")=>r?.properties?.line?.name||r?.line?.name||r?.name||r||"",Ud=F$;var P$=16,R$=!1;function z$(r){let{apikey:t,baseLayer:e,isFollowing:n,isTracking:a,map:i,mots:c,realtimebboxparameters:A,realtimeurl:d,setIsFollowing:g,setIsTracking:m,setRealtimeLayer:x,setStation:T,setStopSequence:b,stationId:O,stopSequence:U,tenant:H,trainId:Q}=it(),q=W5(()=>!t||!d?null:new by({apiKey:t,bboxParameters:A?.split(" ").reduce((c1,g1)=>{if(!g1)return c1;let[_1,w1]=g1.split("=");return c1[_1]=w1,c1},{}),getMotsByZoom:c?()=>c.split(","):void 0,isQueryable:!0,name:Lu,tenant:H,url:d,zIndex:1,...r,styleOptions:{getDelayColor:aP,getDelayFont:oP,getDelayText:sP,getText:Ud,getTextFont:Od,...r?.styleOptions||{}}}),[t,d,A,c,H,r]);return s5(()=>{if(!(!i||!q))return i.getView()?.getCenter()?i.addLayer(q):i.once("moveend",()=>{i.addLayer(q)}),x(q),()=>{i.removeLayer(q),x(null)}},[i,x,q]),s5(()=>{U||g(!1)},[U,g]),s5(()=>{let e1=[];return a&&g(!1),()=>{je(e1)}},[a,g]),s5(()=>{if(!i)return;let e1=null;return e1=i.getView().on("change:center",c1=>{c1.target.getInteracting()&&(g(!1),m(!1))}),()=>{je(e1)}},[i,g,m]),s5(()=>{let e1=null;return q&&(q.engine.useThrottle=!n,q.engine.isUpdateBboxOnMoveEnd=!n,q.allowRenderWhenAnimating=!!n),!n||!U||!i||!q?void 0:(m(!1),(async g1=>{let _1=g1&&q?.trajectories?.[g1];_1||(_1=(await q.api.getTrajectory(U.id,q.mode))?.content),await Zy(_1,i,P$)===!0&&(e1=setInterval(()=>{Zy(q?.trajectories?.[U.id],i)},1e3))})(U.id),()=>{clearInterval(e1)})},[n,i,q,U,m]),s5(()=>{if(Q){let e1=q?.trajectories?.[Q]?.properties?.coordinate;e1&&i.getView().setCenter(e1)}},[i,Q,q]),s5(()=>{if(!(!O||!q?.api))return q?.api?.subscribe(`station ${O}`,({content:e1})=>{e1&&T(e1)}),()=>{T(null),O&&q?.api?.unsubscribe(`station ${O}`)}},[O,q?.api,T]),s5(()=>{if(!(!Q||!q?.api))return q.selectedVehicleId=Q,q.highlightTrajectory(Q).catch(e1=>{console.error("Error highlighting trajectory:",e1)}),q?.api?.subscribeStopSequence(Q,({content:e1})=>{if(e1){let[c1]=e1;c1&&b(c1)}}),()=>{b(null),Q&&q&&(q.api?.unsubscribeStopSequence(Q),q.selectedVehicleId=null,q.vectorLayer.getSource().clear())}},[Q,q,q?.api,b]),s5(()=>{if(!i||!e||!R$)return;let e1=i.once("rendercomplete",()=>{let c1=e.mapLibreMap?.getStyle()?.metadata,g1=[];for(let _1=0;_1<26;_1++)g1.push(Qs(_1,c1?.graphs));q.engine.graphByZoom=g1,q.engine.setBbox()});return()=>{je(e1)}},[i,e,q]),null}var Oy=m5(z$);var Uy="units",D$=[1,2,5],vu=25.4/.28,Ny=class extends Wr{constructor(t){t=t||{};let e=document.createElement("div");e.style.pointerEvents="none",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un;let n=t.className!==void 0?t.className:t.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=n+"-inner",this.element.className=n+" "+Vi,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=t.minWidth!==void 0?t.minWidth:64,this.maxWidth_=t.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(Uy,this.handleUnitsChanged_),this.setUnits(t.units||"metric"),this.scaleBar_=t.bar||!1,this.scaleBarSteps_=t.steps||4,this.scaleBarText_=t.text||!1,this.dpi_=t.dpi||void 0}getUnits(){return this.get(Uy)}handleUnitsChanged_(){this.updateElement_()}setUnits(t){this.set(Uy,t)}setDpi(t){this.dpi_=t}updateElement_(){let t=this.viewState_;if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let e=t.center,n=t.projection,a=this.getUnits(),i=a=="degrees"?"degrees":"m",c=vg(n,t.resolution,e,i),A=this.minWidth_*(this.dpi_||vu)/vu,d=this.maxWidth_!==void 0?this.maxWidth_*(this.dpi_||vu)/vu:void 0,g=A*c,m="";if(a=="degrees"){let e1=U4.degrees;g*=e1,g<e1/60?(m="\u2033",c*=3600):g<e1?(m="\u2032",c*=60):m="\xB0"}else if(a=="imperial")g<.9144?(m="in",c/=.0254):g<1609.344?(m="ft",c/=.3048):(m="mi",c/=1609.344);else if(a=="nautical")c/=1852,m="NM";else if(a=="metric")g<1e-6?(m="nm",c*=1e9):g<.001?(m="\u03BCm",c*=1e6):g<1?(m="mm",c*=1e3):g<1e3?m="m":(m="km",c/=1e3);else if(a=="us")g<.9144?(m="in",c*=39.37):g<1609.344?(m="ft",c/=.30480061):(m="mi",c/=1609.3472);else throw new Error("Invalid units");let x=3*Math.floor(Math.log(A*c)/Math.log(10)),T,b,O,U=0,H,Q;for(;;){O=Math.floor(x/3);let e1=Math.pow(10,O);if(T=D$[(x%3+3)%3]*e1,b=Math.round(T/c),isNaN(b)){this.element.style.display="none",this.renderedVisible_=!1;return}if(d!==void 0&&b>=d){T=U,b=H,O=Q;break}else if(b>=A)break;U=T,H=b,Q=O,++x}let q=this.scaleBar_?this.createScaleBar(b,T,m):T.toFixed(O<0?-O:0)+" "+m;this.renderedHTML_!=q&&(this.innerElement_.innerHTML=q,this.renderedHTML_=q),this.renderedWidth_!=b&&(this.innerElement_.style.width=b+"px",this.renderedWidth_=b),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(t,e,n){let a=this.getScaleForResolution(),i=a<1?Math.round(1/a).toLocaleString()+" : 1":"1 : "+Math.round(a).toLocaleString(),c=this.scaleBarSteps_,A=t/c,d=[this.createMarker("absolute")];for(let m=0;m<c;++m){let x=m%2===0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";d.push(`<div><div class="ol-scale-singlebar ${x}" style="width: ${A}px;"></div>`+this.createMarker("relative")+(m%2===0||c===2?this.createStepText(m,t,!1,e,n):"")+"</div>")}return d.push(this.createStepText(c,t,!0,e,n)),(this.scaleBarText_?`<div class="ol-scale-text" style="width: ${t}px;">`+i+"</div>":"")+d.join("")}createMarker(t){return`<div class="ol-scale-step-marker" style="position: ${t}; top: ${t==="absolute"?3:-10}px;"></div>`}createStepText(t,e,n,a,i){let A=(t===0?0:Math.round(a/this.scaleBarSteps_*t*100)/100)+(t===0?"":" "+i),d=t===0?-3:e/this.scaleBarSteps_*-1,g=t===0?0:e/this.scaleBarSteps_*2;return`<div class="ol-scale-step-text" style="margin-left: ${d}px;text-align: ${t===0?"left":"center"};min-width: ${g}px;left: ${n?e+"px":"unset"};">`+A+"</div>"}getScaleForResolution(){let t=vg(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m"),e=this.dpi_||vu,n=1e3/25.4;return t*n*e}render(t){let e=t.frameState;e?this.viewState_=e.viewState:this.viewState_=null,this.updateElement_()}},lP=Ny;var Qy=class extends Wr{dragPan;icon;onPointerDragRef;text;constructor(t={}){let e=document.createElement("div");e.className=t.className!==void 0?t.className:"ol-drag-pan-warning",e.style.display="none",e.style.pointerEvents="auto",super({element:e,render:t.render,target:t.target}),this.icon=document.createElement("div"),this.icon.className=`${e.className}-icon`,this.icon.innerHTML=`
1124
+ our ${nP} .`,type:"boolean"},notificationat:{description:null},notificationtenant:{defaultValue:"rvf",description:null},notificationurl:{defaultValue:"https://moco.geops.io/api/v2/",description:`The ${nP} url to use.`},permalink:{defaultValue:"false",description:"Update some url parameters x,y,z,layers to the current window location. These parameters are used to store the current state of the map. They will be used on page load to configure the web-component.",type:"boolean"},print:{defaultValue:"true",description:"Show/hide the print button in the toolbar.",type:"boolean"},queryablelayers:{defaultValue:ZF,description:"A comma separated list of layers's name. The data of these layers will be queryable by click on the map (see selectedfeature event). If empty, all layers will not be queryable."},realtime:{defaultValue:"true",description:`Add the realtime layer to the map. Data comes from the ${v$} .`,type:"boolean"},realtimebboxparameters:{defaultValue:"line_tags=RVF",description:null},realtimetenant:{description:null},realtimeurl:{defaultValue:"wss://api.geops.io/tracker-ws/v1/ws",description:null},runs:{defaultValue:"false",description:"Shows the number of trips on a line in the sidebar, use only for debugging.",type:"boolean"},search:{defaultValue:"false",description:"Toggle the search stops input.",type:"boolean"},share:{defaultValue:"true",description:"Show/hide the share button in the toolbar.",type:"boolean"},stopsurl:{defaultValue:"https://api.geops.io/stops/v1/",description:null},tenant:{description:null},toolbar:{defaultValue:"true",description:"Show/hide the toolbar on the top left.",type:"boolean"},zoom:{description:"The zoom level of the map."}},js=y$;function x$(r){let{apikey:t,baseLayer:e,map:n,notificationat:a,notificationtenant:i,notificationurl:c,previewNotifications:A}=it(),d=W5(()=>{if(!e)return null;let g=new fy({apiKey:t,apiParameters:{contentMedium:!0},date:a?new Date(a):void 0,maplibreLayer:e,name:zy,situations:A,tenant:i,url:c,...r||{},loadAll:!A});return A&&!g.getVisible()&&g.setVisible(!0),g},[t,e,a,i,c,A,r]);return s5(()=>{if(!(!n||!d))return n.addLayer(d),()=>{n.removeLayer(d)}},[n,d]),null}var Dy=m5(x$);function _$(r){let[t,e]=G5(),[n,a]=G5(),{children:i}=r;return s5(()=>()=>{n&&(n.style.height="",n.style.maxHeight="")},[n]),K("div",{ref:c=>{c&&(e(c),a(c.parentElement))},...r,onPointerDown:c=>{t.setPointerCapture(c.pointerId);let A=n.parentElement.getBoundingClientRect(),d=t.getBoundingClientRect(),g=A.top+(c.clientY-d.top);function m(T){n.style.height=`calc(100% - ${T.clientY-g}px)`,n.style.maxHeight="100%"}function x(T){T.target.releasePointerCapture(c.pointerId),document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",x)}document.addEventListener("pointerup",x),document.addEventListener("pointermove",m),document.addEventListener("pointercancel",T=>{document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",x),T.stopPropagation(),T.preventDefault()})},children:i})}var ky=_$;function w$({children:r,className:t,ScrollableHandlerProps:e={}}){let n=!!r;return Array.isArray(r)&&(n=r?.length&&(r||[]).find(a=>!!a)),n?K("div",{className:(ke("pointer-events-auto relative z-50 flex flex-col overflow-hidden bg-white transition-[min-height,max-height] @lg:transition-[width]"),t),children:n&&K($t,{children:[K(ky,{className:"absolute inset-0 flex h-[65px] touch-none justify-center @lg/main:hidden",style:{width:"100%"},...e,children:K("div",{className:"m-2 mr-[-60px] bg-gray-300",style:{borderRadius:2,height:4,width:32}})}),r]})}):null}var Zd=w$;var b$=async(r,t,e=0)=>{if(!r)return Promise.reject(new Error("No vehicle provided"));let{geometry:n,properties:{coordinate:a}}=r,i=t.getView(),c=e||i.getZoom(),A=c>0?i.getResolutionForZoom(c):void 0,d=a;if(!d&&n){let{coord:m}=Pc(Date.now(),r,!0);d=m}return d?(i.cancelAnimations(),new Promise(m=>{i.animate({center:d,duration:1e3,easing:ed,resolution:A},x=>{m(x)})})):Promise.reject(new Error("No center found"))},Zy=b$;var M$=(r,t=!1)=>{let e=Math.round(r/1e3/60);return e>5?"#dc2626":e>=3?"#ea580c":t?"#16a34a":"transparent"},gu=M$;var B$=(r,t,e)=>t?e?"#dc2626":"#a0a0a0":r===null?"transparent":gu(r,e),aP=B$;var S$=r=>`bold ${r}px arial`,oP=S$;var E$=r=>{let t=r;t<0&&(t=0);let e=Math.floor(t/36e5),n=Math.round(t%36e5/6e4),a="";return e>0&&(a+=`${e}h`),n>0&&(a+=`${n}m`),a||"0"},mu=E$;var T$=(r,t=!1)=>{if(t)return String.fromCodePoint(215);let e=mu(r);return e==="0"?"":`+${e}`},sP=T$;var I$=(r,t)=>`bold ${r}px arial`,Od=I$;var F$=(r="")=>r?.properties?.line?.name||r?.line?.name||r?.name||r||"",Ud=F$;var P$=16,R$=!1;function z$(r){let{apikey:t,baseLayer:e,isFollowing:n,isTracking:a,map:i,mots:c,realtimebboxparameters:A,realtimeurl:d,setIsFollowing:g,setIsTracking:m,setRealtimeLayer:x,setStation:T,setStopSequence:b,stationId:O,stopSequence:U,tenant:H,trainId:Q}=it(),q=W5(()=>!t||!d?null:new by({apiKey:t,bboxParameters:A?.split(" ").reduce((c1,g1)=>{if(!g1)return c1;let[_1,w1]=g1.split("=");return c1[_1]=w1,c1},{}),getMotsByZoom:c?()=>c.split(","):void 0,isQueryable:!0,name:Lu,tenant:H,url:d,zIndex:1,...r,styleOptions:{getDelayColor:aP,getDelayFont:oP,getDelayText:sP,getText:Ud,getTextFont:Od,...r?.styleOptions||{}}}),[t,d,A,c,H,r]);return s5(()=>{if(!(!i||!q))return i.getView()?.getCenter()?i.addLayer(q):i.once("moveend",()=>{i.addLayer(q)}),x(q),()=>{i.removeLayer(q),x(null)}},[i,x,q]),s5(()=>{U||g(!1)},[U,g]),s5(()=>{let e1=[];return a&&g(!1),()=>{je(e1)}},[a,g]),s5(()=>{if(!i)return;let e1=null;return e1=i.getView().on("change:center",c1=>{c1.target.getInteracting()&&(g(!1),m(!1))}),()=>{je(e1)}},[i,g,m]),s5(()=>{let e1=null;return q&&(q.engine.useThrottle=!n,q.engine.isUpdateBboxOnMoveEnd=!n,q.allowRenderWhenAnimating=!!n),!n||!U||!i||!q?void 0:(m(!1),(async g1=>{let _1=g1&&q?.trajectories?.[g1];_1||(_1=(await q.api.getTrajectory(U.id,q.mode))?.content),await Zy(_1,i,P$)===!0&&(e1=setInterval(()=>{Zy(q?.trajectories?.[U.id],i)},1e3))})(U.id),()=>{clearInterval(e1)})},[n,i,q,U,m]),s5(()=>{if(Q){let e1=q?.trajectories?.[Q]?.properties?.coordinate;e1&&i.getView().setCenter(e1)}},[i,Q,q]),s5(()=>{if(!(!O||!q?.api))return q?.api?.subscribe(`station ${O}`,({content:e1})=>{e1&&T(e1)}),()=>{T(null),O&&q?.api?.unsubscribe(`station ${O}`)}},[O,q?.api,T]),s5(()=>{if(!(!Q||!q?.api))return q.selectedVehicleId=Q,q.highlightTrajectory(Q).catch(e1=>{console.error("Error highlighting trajectory:",e1)}),q?.api?.subscribeStopSequence(Q,({content:e1})=>{if(e1){let[c1]=e1;c1&&b(c1)}}),()=>{b(null),Q&&q&&(q.api?.unsubscribeStopSequence(Q),q.selectedVehicleId=null,q.vectorLayer.getSource().clear())}},[Q,q,q?.api,b]),s5(()=>{if(!i||!e||!R$)return;let e1=i.once("rendercomplete",()=>{let c1=e.mapLibreMap?.getStyle()?.metadata,g1=[];for(let _1=0;_1<26;_1++)g1.push(Qs(_1,c1?.graphs));q.engine.graphByZoom=g1,q.engine.setBbox()});return()=>{je(e1)}},[i,e,q]),null}var Oy=m5(z$);var Uy="units",D$=[1,2,5],vu=25.4/.28,Ny=class extends Wr{constructor(t){t=t||{};let e=document.createElement("div");e.style.pointerEvents="none",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un;let n=t.className!==void 0?t.className:t.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=n+"-inner",this.element.className=n+" "+Vi,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=t.minWidth!==void 0?t.minWidth:64,this.maxWidth_=t.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(Uy,this.handleUnitsChanged_),this.setUnits(t.units||"metric"),this.scaleBar_=t.bar||!1,this.scaleBarSteps_=t.steps||4,this.scaleBarText_=t.text||!1,this.dpi_=t.dpi||void 0}getUnits(){return this.get(Uy)}handleUnitsChanged_(){this.updateElement_()}setUnits(t){this.set(Uy,t)}setDpi(t){this.dpi_=t}updateElement_(){let t=this.viewState_;if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let e=t.center,n=t.projection,a=this.getUnits(),i=a=="degrees"?"degrees":"m",c=vg(n,t.resolution,e,i),A=this.minWidth_*(this.dpi_||vu)/vu,d=this.maxWidth_!==void 0?this.maxWidth_*(this.dpi_||vu)/vu:void 0,g=A*c,m="";if(a=="degrees"){let e1=U4.degrees;g*=e1,g<e1/60?(m="\u2033",c*=3600):g<e1?(m="\u2032",c*=60):m="\xB0"}else if(a=="imperial")g<.9144?(m="in",c/=.0254):g<1609.344?(m="ft",c/=.3048):(m="mi",c/=1609.344);else if(a=="nautical")c/=1852,m="NM";else if(a=="metric")g<1e-6?(m="nm",c*=1e9):g<.001?(m="\u03BCm",c*=1e6):g<1?(m="mm",c*=1e3):g<1e3?m="m":(m="km",c/=1e3);else if(a=="us")g<.9144?(m="in",c*=39.37):g<1609.344?(m="ft",c/=.30480061):(m="mi",c/=1609.3472);else throw new Error("Invalid units");let x=3*Math.floor(Math.log(A*c)/Math.log(10)),T,b,O,U=0,H,Q;for(;;){O=Math.floor(x/3);let e1=Math.pow(10,O);if(T=D$[(x%3+3)%3]*e1,b=Math.round(T/c),isNaN(b)){this.element.style.display="none",this.renderedVisible_=!1;return}if(d!==void 0&&b>=d){T=U,b=H,O=Q;break}else if(b>=A)break;U=T,H=b,Q=O,++x}let q=this.scaleBar_?this.createScaleBar(b,T,m):T.toFixed(O<0?-O:0)+" "+m;this.renderedHTML_!=q&&(this.innerElement_.innerHTML=q,this.renderedHTML_=q),this.renderedWidth_!=b&&(this.innerElement_.style.width=b+"px",this.renderedWidth_=b),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(t,e,n){let a=this.getScaleForResolution(),i=a<1?Math.round(1/a).toLocaleString()+" : 1":"1 : "+Math.round(a).toLocaleString(),c=this.scaleBarSteps_,A=t/c,d=[this.createMarker("absolute")];for(let m=0;m<c;++m){let x=m%2===0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";d.push(`<div><div class="ol-scale-singlebar ${x}" style="width: ${A}px;"></div>`+this.createMarker("relative")+(m%2===0||c===2?this.createStepText(m,t,!1,e,n):"")+"</div>")}return d.push(this.createStepText(c,t,!0,e,n)),(this.scaleBarText_?`<div class="ol-scale-text" style="width: ${t}px;">`+i+"</div>":"")+d.join("")}createMarker(t){return`<div class="ol-scale-step-marker" style="position: ${t}; top: ${t==="absolute"?3:-10}px;"></div>`}createStepText(t,e,n,a,i){let A=(t===0?0:Math.round(a/this.scaleBarSteps_*t*100)/100)+(t===0?"":" "+i),d=t===0?-3:e/this.scaleBarSteps_*-1,g=t===0?0:e/this.scaleBarSteps_*2;return`<div class="ol-scale-step-text" style="margin-left: ${d}px;text-align: ${t===0?"left":"center"};min-width: ${g}px;left: ${n?e+"px":"unset"};">`+A+"</div>"}getScaleForResolution(){let t=vg(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m"),e=this.dpi_||vu,n=1e3/25.4;return t*n*e}render(t){let e=t.frameState;e?this.viewState_=e.viewState:this.viewState_=null,this.updateElement_()}},lP=Ny;var Qy=class extends Wr{dragPan;icon;onPointerDragRef;text;constructor(t={}){let e=document.createElement("div");e.className=t.className!==void 0?t.className:"ol-drag-pan-warning",e.style.display="none",e.style.pointerEvents="auto",super({element:e,render:t.render,target:t.target}),this.icon=document.createElement("div"),this.icon.className=`${e.className}-icon`,this.icon.innerHTML=`
1125
1125
  <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
1126
1126
  <path fill="none" stroke="currentColor" stroke-width="2" d="M22.999,25 L22.997,13.002 C22.997,11.896 23.893,11 24.999,11 C26.105,11 27.001,11.896 27.001,13.002 L26.999,26.002 M31,25.003 C31,23.897 31.896,23.001 33.002,23.001 C34.11,23.001 35.006,23.897 35.006,25.003 C35.006,25.003 35,26.125 35,32.001 C35,37.875 33.2,41.001 33.2,41.001 L19,41.001 C19,41.001 12.21,29.483 11.586,28.419 C10.962,27.355 10.804,26.369 11.586,25.587 C12.37,24.805 13.636,24.805 14.418,25.587 L18.998,30.169 L19,30.169 L19,25.001 L18.996,15.003 C18.996,13.897 19.894,13.001 21,13.001 C22.106,13.001 23.002,13.897 23.002,15.003 L23,26.015 M26.9942,22.997 C26.9942,21.891 27.8902,20.995 28.9962,20.995 C30.1042,20.995 31.0002,21.891 31.0002,22.997 L31.0002,26.001 M30,16.3046 C30.632,15.3606 31,14.2246 31,13.0006 C31,9.6846 28.314,7.0006 25,7.0006 C23.208,7.0006 21.616,7.8026 20.518,9.0486 C17.432,9.2986 15,11.8506 15,15.0006 C15,16.2166 15.368,17.3426 15.988,18.2866"/>
1127
1127
  </svg>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@geops/rvf-mobility-web-component",
3
3
  "license": "UNLICENSED",
4
4
  "description": "Web components for rvf in the domains of mobility and logistics.",
5
- "version": "0.1.50",
5
+ "version": "0.1.51",
6
6
  "homepage": "https://rvf-mobility-web-component-geops.vercel.app/",
7
7
  "type": "module",
8
8
  "main": "index.js",
@@ -241,8 +241,8 @@ const attrs: MobilityMapAttributes = {
241
241
  description: null, //`The tenant to use by default for all geOps APIs (Stops, Realtime, MOCO ...). Can be override for each API by other XXXXtenant parameters.`,
242
242
  },
243
243
  toolbar: {
244
- defaultValue: "false",
245
- description: "Show/hide the toolbar on the left.",
244
+ defaultValue: "true",
245
+ description: "Show/hide the toolbar on the top left.",
246
246
  type: "boolean",
247
247
  },
248
248
  zoom: {