@mappedin/dynamic-focus 6.13.0-beta.0 → 6.15.0-beta.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 @@
1
+ var Wt=Object.defineProperty,yo=Object.defineProperties;var So=Object.getOwnPropertyDescriptors;var Ht=Object.getOwnPropertySymbols;var Eo=Object.prototype.hasOwnProperty,vo=Object.prototype.propertyIsEnumerable;var Kt=n=>{throw TypeError(n)};var Mt=(n,t,e)=>t in n?Wt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,G=(n,t)=>{for(var e in t||(t={}))Eo.call(t,e)&&Mt(n,e,t[e]);if(Ht)for(var e of Ht(t))vo.call(t,e)&&Mt(n,e,t[e]);return n},at=(n,t)=>yo(n,So(t)),a=(n,t)=>Wt(n,"name",{value:t,configurable:!0});var p=(n,t,e)=>Mt(n,typeof t!="symbol"?t+"":t,e),Dt=(n,t,e)=>t.has(n)||Kt("Cannot "+e);var o=(n,t,e)=>(Dt(n,t,"read from private field"),e?e.call(n):t.get(n)),c=(n,t,e)=>t.has(n)?Kt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),d=(n,t,e,i)=>(Dt(n,t,"write to private field"),i?i.call(n,e):t.set(n,e),e),E=(n,t,e)=>(Dt(n,t,"access private method"),e);var S={env:{NODE_ENV:"production",npm_package_version:"6.15.0-beta.0"}};import{Floor as Po,getMultiFloorState as Ro}from"@mappedin/mappedin-js";function Qt(n,t){if(n==null||t==null)return n===t;if(n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}a(Qt,"arraysEqual");var xt=class xt{constructor(){p(this,"_subscribers",{});p(this,"_abortController",new AbortController);p(this,"_cleanupFunctions",[])}get signal(){return this._abortController.signal}publish(t,e){!this._subscribers||!this._subscribers[t]||this.signal.aborted||this._subscribers[t].forEach(function(i){typeof i=="function"&&i(e)})}onAbort(t){this.signal.addEventListener("abort",()=>t(),{once:!0})}on(t,e,i){let s=i==null?void 0:i.signal;if(s!=null&&s.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(e);let r=a(()=>this.off(t,e),"cleanup");return s&&s.addEventListener("abort",r,{once:!0}),this._cleanupFunctions.push(r),r}off(t,e){if(!this._subscribers||this._subscribers[t]==null||this.signal.aborted)return;let i=this._subscribers[t].indexOf(e);i!==-1&&this._subscribers[t].splice(i,1)}destroy(){if(!this.signal.aborted){for(let t of this._cleanupFunctions)t();this._cleanupFunctions=[],this._subscribers={},this._abortController.abort()}}};a(xt,"PubSub");var vt=xt;import{Facade as Io,Floor as Ao,FloorStack as ko}from"@mappedin/mappedin-js";var k,lt,Z,I,v,T,W,K,_t=class _t{constructor(t,e){p(this,"__type","building");c(this,k);c(this,lt,new Map);c(this,Z,new Map);c(this,I,[]);c(this,v);c(this,T);p(this,"defaultFloor");p(this,"activeFloor");p(this,"excluded",!1);p(this,"floorsAltitudesMap",new Map);p(this,"aboveGroundFloors",[]);c(this,W);c(this,K);var s;d(this,k,t),d(this,lt,new Map(t.floors.map(r=>[r.id,r]))),d(this,Z,new Map(t.floors.map(r=>[r.elevation,r]))),d(this,I,Array.from(o(this,Z).values()).sort((r,u)=>r.elevation-u.elevation)),this.defaultFloor=t.defaultFloor,this.activeFloor=this.defaultFloor,d(this,v,e),this.aboveGroundFloors=o(this,I).filter(r=>r.elevation>=0);let i=(s=t.facade)==null?void 0:s.spaces.map(r=>o(this,v).getState(r)).sort((r,u)=>r.altitude-u.altitude);if(i&&i.length===this.aboveGroundFloors.length)for(let r in this.aboveGroundFloors){let u=this.aboveGroundFloors[r],f=i[r];this.floorsAltitudesMap.set(u.elevation,{altitude:f.altitude,visualHeight:f.height})}}get id(){return o(this,k).id}get name(){return o(this,k).name}get floors(){return o(this,k).floors}get floorStack(){return o(this,k)}get facade(){return o(this,k).facade}get isCurrentFloorStack(){return this.id===o(this,v).currentFloorStack.id}get isIndoor(){let t=o(this,v).getState(this.facade);return this.isCurrentFloorStack||(t==null?void 0:t.visible)===!1&&(t==null?void 0:t.opacity)===0}get canSetFloor(){return this.isIndoor||!this.excluded}get maxElevation(){return o(this,W)==null&&d(this,W,Math.max(...o(this,Z).keys())),o(this,W)}get minElevation(){return o(this,K)==null&&d(this,K,Math.min(...o(this,Z).keys())),o(this,K)}has(t){return Ao.is(t)?o(this,lt).has(t.id):ko.is(t)?t.id===o(this,k).id:Io.is(t)?t.id===this.facade.id:!1}getFloorByElevation(t){return o(this,Z).get(t)}getNearestFloorByElevation(t){let e=this.getFloorByElevation(t);if(e)return e;if(t>=0){if(t>this.maxElevation)return o(this,I)[o(this,I).length-1];for(let i=o(this,I).length-1;i>=0;i--){let s=o(this,I)[i];if(s.elevation<=t)return s}}else{if(t<this.minElevation)return o(this,I)[0];for(let i of o(this,I))if(i.elevation>=t)return i}}getHighestFloor(){return o(this,I)[o(this,I).length-1]}cancelAnimation(){o(this,T)&&(o(this,T).animation.cancel(),d(this,T,void 0))}async animateFacade(t,e={duration:150}){var u;let i=((u=o(this,T))==null?void 0:u.state)||o(this,v).getState(this.facade);if(!i||!t||(i==null?void 0:i.opacity)===t.opacity&&(i==null?void 0:i.visible)===t.visible)return{result:"completed"};this.cancelAnimation();let{opacity:s,visible:r}=t;if(o(this,v).updateState(this.facade,{visible:!0}),s!==void 0){d(this,T,{animation:o(this,v).animateState(this.facade,{opacity:s},{duration:e.duration}),state:t});let f=await o(this,T).animation;if(d(this,T,void 0),f.result==="cancelled")return f}return r===!1&&o(this,v).updateState(this.facade,{visible:r}),{result:"completed"}}destroy(){this.cancelAnimation(),o(this,k).floors.forEach(t=>{o(this,v).updateState(t,{visible:t.id===o(this,v).currentFloor.id})}),this.has(o(this,v).currentFloor)||o(this,v).updateState(this.facade,{visible:!0,opacity:1})}};k=new WeakMap,lt=new WeakMap,Z=new WeakMap,I=new WeakMap,v=new WeakMap,T=new WeakMap,W=new WeakMap,K=new WeakMap,a(_t,"Building");var wt=_t;function Xt(n,t,e){return n>=t?"in-range":n<=e?"out-of-range":"transition"}a(Xt,"getZoomState");function It(n,t,e){if(n.__type==="outdoors"&&"floor"in n)return n.floor;let i=n;if(i.excluded)return i.activeFloor;switch(t){case"lock-elevation":return i.getFloorByElevation(e);case"nearest-elevation":return i.getNearestFloorByElevation(e);default:break}return i.isIndoor?i.activeFloor:i.defaultFloor}a(It,"getFloorToShow");function Vo(n,t,e,i){return i?{facade:n,state:{type:"facade",visible:!1,opacity:0}}:t?{facade:n,state:{type:"facade",visible:!1,opacity:0}}:e?{facade:n,state:{type:"facade",visible:!0,opacity:.2}}:{facade:n,state:{type:"facade",visible:!0,opacity:1}}}a(Vo,"getFacadeState");function Bo(n,t,e){return{outdoorOpacity:"initial",floorStates:n.floors.map(i=>{let r=i.id===t.id&&e;return{floor:i,state:{type:"floor",visible:r,geometry:{visible:r},labels:{enabled:r},markers:{enabled:r},footprint:{visible:!1},occlusion:{enabled:!1}}}})}}a(Bo,"getSingleBuildingState");function Jt(n,t){if(!t.includes("lock-elevation"))return"initial";for(let e of n)if(typeof e.outdoorOpacity=="number"&&e.outdoorOpacity>=0&&e.outdoorOpacity<=1)return e.outdoorOpacity;return"initial"}a(Jt,"getOutdoorOpacity");function to(n,t,e){var i;switch(e){case"in-range":return(i=n[0])!=null&&i.canSetFloor?n[0]:void 0;case"out-of-range":return t;case"transition":default:return}}a(to,"getSetFloorTargetFromZoomState");function oo(n){var st;let{buildings:t,inViewSet:e,currentFloor:i,zoomState:s,mode:r,elevation:u,floorIdsInNavigation:f,floorStackIdsInNavigation:g,multiFloorView:m,getMultiFloorState:V,dynamicBuildingInteriors:$,isolateBelowGroundView:it,currentElevation:nt,forceInteriorsVisible:x,getFloorStackAltitudeData:B}=n,St=new Map,rt=it&&nt<0&&s==="in-range";for(let b of t){let Et=e.has(b.id),Y=rt&&b.minElevation>=0,po=Y?!1:Et,Tt=Y?!1:Lt({building:b,currentFloor:i,inRange:s==="in-range",inFocus:Et,mode:r,elevation:u,inNavigation:g.includes(b.id),dynamicBuildingInteriors:$,forceInteriorsVisible:x}),Ot=i.floorStack.id===b.id?b.activeFloor:It(b,r,u),go=m!=null&&m.enabled?V(b.floors,Ot||b.activeFloor,f,(st=B==null?void 0:B(b.id))!=null?st:b.floorsAltitudesMap,{color:m==null?void 0:m.footprintColor,spacesOpenToBelowEnabled:m==null?void 0:m.spacesOpenToBelowEnabled,__EXPERIMENTAL_darkenSpacesExposedToAbove:m==null?void 0:m.__EXPERIMENTAL_darkenSpacesExposedToAbove,opacity:m==null?void 0:m.footprintOpacity,outline:m==null?void 0:m.footprintOutline}):Bo(b.floorStack,Ot||b.activeFloor,Tt),Fo=it&&nt<0&&s==="in-range",bo=Vo(b.facade,Tt,Fo,Y);St.set(b.id,{building:b,showIndoor:Tt,floorStackState:go,facadeState:bo,inFocus:po,floorToShow:Ot,isAboveGroundInIsolation:Y})}return St}a(oo,"getBuildingStates");function eo(n,t){return n.excluded?"none":t?"indoor":"outdoor"}a(eo,"getBuildingAnimationType");function Lt(n){let{building:t,currentFloor:e,inRange:i,inFocus:s,mode:r,elevation:u,inNavigation:f,dynamicBuildingInteriors:g,forceInteriorsVisible:m}=n;if(t.id===e.floorStack.id)return!0;if(t.excluded)return!1;if(m===!0||f===!0)return!0;if(!g)return e.floorStack.type!=="Outdoor";if(!i||!s)return!1;switch(r){case"lock-elevation":return t.getFloorByElevation(u)!=null;default:break}return!0}a(Lt,"shouldShowIndoor");function io(n,t,e){return n!==t&&!e}a(io,"shouldDeferSetFloor");var no=["default-floor","lock-elevation","nearest-elevation"];import{Floor as Oo,FloorStack as Mo}from"@mappedin/mappedin-js";var Nt="[MappedinJS]";function Ct(n="",{prefix:t=Nt}={}){let e="".concat(t).concat(n?"-".concat(n):""),i=a((s,r)=>{if(typeof window<"u"&&window.rnDebug){let u=r.map(f=>f instanceof Error&&f.stack?"".concat(f.message,"\n").concat(f.stack):f);window.rnDebug("".concat(n," ").concat(s,": ").concat(u.join(" ")))}},"rnDebug");return{logState:S.env.NODE_ENV==="test"?3:0,log(...s){this.logState<=0&&(console.log(e,...s),i("log",s))},warn(...s){this.logState<=1&&(console.warn(e,...s),i("warn",s))},error(...s){this.logState<=2&&(console.error(e,...s),i("error",s))},assert(...s){console.assert(...s)},time(s){console.time(s)},timeEnd(s){console.timeEnd(s)},setLevel(s){0<=s&&s<=3&&(this.logState=s)}}}a(Ct,"createLogger");var To=Ct();var Q=To;function ro(n,t,e,i){return(n<t||n>e)&&Q.warn(i),Math.min(e,Math.max(t,n))}a(ro,"clampWithWarning");function Gt(n,t){return!Oo.is(n)||(n==null?void 0:n.floorStack)==null||!Mo.is(t)?!1:n.floorStack.id!==t.id?(Q.warn("Floor (".concat(n.id,") does not belong to floor stack (").concat(t.id,").")),!1):!0}a(Gt,"validateFloorForStack");function Zt(n,t,e,i){return ro(n,t,e,"".concat(i," must be between ").concat(t," and ").concat(e,"."))}a(Zt,"validateZoomThreshold");var X=Ct("",{prefix:"[DynamicFocus]"});var O,J,ut,Pt,Rt=class Rt{constructor(t,e){c(this,ut);p(this,"__type","outdoors");c(this,O);c(this,J);d(this,O,t),d(this,J,e)}get id(){return o(this,O).id}get floorStack(){return o(this,O)}get floor(){return o(this,O).defaultFloor}matchesFloorStack(t){return t===o(this,O)||t===o(this,O).id}show(){E(this,ut,Pt).call(this,!0)}hide(){E(this,ut,Pt).call(this,!1)}destroy(){this.matchesFloorStack(o(this,J).currentFloorStack)||this.hide()}};O=new WeakMap,J=new WeakMap,ut=new WeakSet,Pt=a(function(t){for(let e of o(this,O).floors)o(this,J).updateState(e,{visible:t})},"#setVisible"),a(Rt,"Outdoors");var At=Rt;function so(n,t){let e=n.getByType("floor-stack"),i=e.find(r=>{var u;return((u=r.type)==null?void 0:u.toLowerCase())==="outdoor"});if(i)return i;let s=e.find(r=>r.facade==null&&!t.has(r.id));return s||(X.warn("No good candidate for the outdoor floor stack was found. Using the first floor stack."),e[0])}a(so,"getOutdoorFloorStack");var ao={indoorZoomThreshold:18,outdoorZoomThreshold:17,setFloorOnFocus:!0,autoFocus:!1,indoorAnimationOptions:{duration:150},outdoorAnimationOptions:{duration:150},autoAdjustFacadeHeights:!1,mode:"default-floor",preloadFloors:!0,dynamicBuildingInteriors:!0,dynamicLayers:[],isolateBelowGroundView:!1,forceInteriorsVisible:!1,showLabelsAndMarkersOnAllVisibleFloors:!1},Ae=.2,ke=.4;function Do(n,t){return"".concat(t," ").concat(n)}a(Do,"formatMessage");var Ut=class Ut extends Error{constructor(t,e=Nt){super(Do(t,e)),this.name="MappedinError"}};a(Ut,"MappedinError");var kt=Ut;var xo=a(n=>n,"linearEase"),_o=a(n=>n*n,"quadEaseIn"),Lo=a(n=>1-Math.cos(n*Math.PI/2),"easeIn"),No=a(n=>1-(1-n)*(1-n),"quadEaseOut"),Co=a(n=>1-Math.pow(1-n,3),"cubicEaseOut"),Go={linear:xo,"ease-in":_o,"ease-out":No,"ease-in-out":Lo,"ease-out-cubic":Co};function Zo(n,t){let e=0;if(t.length<2)return e;let s=t[0]<t[1]?(r,u)=>r>u:(r,u)=>r<u;for(;e<t.length-1&&s(n,t[e+1]);)e++;return e>t.length-2?Math.max(0,t.length-2):e}a(Zo,"getInterpolationBreakpoint");function lo(n,t,e,i="ease-in"){if(t.length!==e.length)throw new kt("Input and output ranges must have the same number of values.");n=Math.max(t[0],Math.min(n,t[t.length-1]));let s=Zo(n,t),r=(n-t[s])/(t[s+1]-t[s]),u=typeof i=="function"?i(r):Go[i](r);return e[s]+u*(e[s+1]-e[s])}a(lo,"interpolateMulti");var M,dt,ct,_,ht,$t=class $t{constructor(t,e,i){p(this,"layers");p(this,"visible");c(this,M);c(this,dt,[]);c(this,ct,!1);c(this,_,new Map);p(this,"interpolationFn");c(this,ht,1);this.layers=t,this.visible=e,d(this,M,i)}processLayerGroup(t,e,i){if(!o(this,ct)&&(this.layers.forEach(s=>{let r=t[s];r&&o(this,dt).push(...r)}),d(this,ct,!0),this.visible)){let s=[e,i],r=[1,0];this.interpolationFn=u=>lo(u,s,r)}}setOpacity(t){var e,i,s;d(this,ht,t);for(let r of o(this,dt))if(r.startsWith("img_")){let u=o(this,M).Image3D.getById(r);if(u){let f=o(this,M).getState(u.image);o(this,_).has(r)||o(this,_).set(r,(e=f==null?void 0:f.opacity)!=null?e:1);let g=Math.min(o(this,_).get(r),t);o(this,M).updateState(u.image,{opacity:g})}}else{let u=(i=o(this,M).getMapData())==null?void 0:i.getById("space",r);if(!u)continue;let f=o(this,M).getState(u);o(this,_).has(r)||o(this,_).set(r,(s=f==null?void 0:f.opacity)!=null?s:1);let g=Math.min(o(this,_).get(r),t);o(this,M).updateState(u,{opacity:g,visible:g>0})}}get opacity(){return o(this,ht)}};M=new WeakMap,dt=new WeakMap,ct=new WeakMap,_=new WeakMap,ht=new WeakMap,a($t,"LayerGroup");var Vt=$t;function jt(n,t){n.forEach(e=>{if(e.interpolationFn!=null){let i=e.interpolationFn(t);i!=null&&(e.setOpacity(i),e.visible=i===1)}})}a(jt,"runLayerGroupInterpolations");var A,l,P,h,q,z,y,L,H,N,w,tt,ft,mt,pt,D,R,ot,U,j,F,Yt,co,ho,qt,gt,Ft,bt,yt,et,Bt,fo,mo,C,zt=class zt{constructor(t){c(this,F);c(this,A);c(this,l);c(this,P);c(this,h,ao);c(this,q,[]);c(this,z,new Set);c(this,y,new Map);c(this,L);c(this,H,!1);c(this,N,!1);c(this,w,0);c(this,tt,0);c(this,ft,[]);c(this,mt,{});c(this,pt,{});c(this,D,"transition");c(this,R,"outdoor");c(this,ot,[]);c(this,U,!1);c(this,j,[]);p(this,"sceneUpdateQueue",Promise.resolve());p(this,"on",a((t,e)=>{o(this,A).on(t,e)},"on"));p(this,"off",a((t,e)=>{o(this,A).off(t,e)},"off"));c(this,gt,a(t=>{if(!this.isEnabled)return;let{facades:e}=t;if(Qt(e,this.focusedFacades)&&o(this,R)==="transition"&&!o(this,N))return;d(this,N,!1),d(this,q,[]),o(this,z).clear();let i=o(this,h).isolateBelowGroundView&&o(this,w)<0;if(e.length>0)for(let s of e){let r=o(this,y).get(s.floorStack.id);if(r){if(i&&r.minElevation>=0)continue;o(this,z).add(r.id),o(this,q).push(r)}}o(this,h).autoFocus&&this.focus()},"#handleFacadesInViewChange"));c(this,Ft,a(async t=>{var f,g,m,V;if(!this.isEnabled)return;let{floor:e}=t,i=o(this,y).get(e.floorStack.id);i&&(i.activeFloor=e);let s=o(this,h).isolateBelowGroundView&&o(this,w)<0;(i==null?void 0:i.excluded)===!1&&!o(this,L).matchesFloorStack(e.floorStack)&&d(this,w,e.elevation);let r=o(this,h).isolateBelowGroundView&&o(this,w)<0,u=s&&!r;if(o(this,l).manualFloorVisibility===!0){t.reason!=="dynamic-focus"&&(u?(d(this,N,!0),o(this,l).Camera.updateFacadesInView(),o(this,h).autoFocus||(await o(this,C).call(this,e),o(this,A).publish("focus",{facades:this.focusedFacades}))):(await o(this,C).call(this,e),o(this,A).publish("focus",{facades:this.focusedFacades})));let $=(g=(f=i==null?void 0:i.floorsAltitudesMap.get(e.elevation))==null?void 0:f.altitude)!=null?g:0;o(this,l).options.multiFloorView!=null&&((m=o(this,l).options.multiFloorView)!=null&&m.enabled)&&((V=o(this,l).options.multiFloorView)!=null&&V.updateCameraElevationOnFloorChange)&&o(this,l).Camera.elevation!==$&&o(this,l).Camera.animateElevation($,{duration:750,easing:"ease-in-out"})}},"#handleFloorChangeStart"));c(this,bt,a(()=>{d(this,H,!0)},"#handleUserInteractionStart"));c(this,yt,a(()=>{d(this,H,!1)},"#handleUserInteractionEnd"));c(this,et,a(t=>{if(!this.isEnabled)return;let{zoomLevel:e}=t,i=Xt(e,o(this,h).indoorZoomThreshold,o(this,h).outdoorZoomThreshold);o(this,D)!==i&&(d(this,D,i),i==="in-range"?this.setIndoor():i==="out-of-range"&&this.setOutdoor()),jt(o(this,j),e)},"#handleCameraChange"));c(this,C,a(async t=>{var f,g,m;if(o(this,l).manualFloorVisibility!==!0||!this.isEnabled)return;let e=t||o(this,l).currentFloor,i=o(this,l).options.multiFloorView,s=((g=(f=o(this,l).Navigation)==null?void 0:f.floors)==null?void 0:g.map(V=>V.id))||[],r=((m=o(this,l).Navigation)==null?void 0:m.floorStacks.map(V=>V.id))||[],u=new Promise(async V=>{var nt;await this.sceneUpdateQueue;let $=oo({buildings:Array.from(o(this,y).values()),inViewSet:o(this,z),currentFloor:e,zoomState:o(this,D),mode:o(this,h).mode,elevation:o(this,w),floorIdsInNavigation:s,floorStackIdsInNavigation:r,multiFloorView:i,getMultiFloorState:(nt=o(this,h).customMultiFloorVisibilityState)!=null?nt:Ro,dynamicBuildingInteriors:o(this,h).dynamicBuildingInteriors,isolateBelowGroundView:o(this,h).isolateBelowGroundView,currentElevation:o(this,w),forceInteriorsVisible:o(this,h).forceInteriorsVisible,getFloorStackAltitudeData:a(x=>o(this,l).getFloorStackAltitudeData(x),"getFloorStackAltitudeData")}),it=[];await Promise.all(Array.from($.values()).map(async x=>{let{building:B,showIndoor:St,floorStackState:rt,facadeState:st,inFocus:b,isAboveGroundInIsolation:Et}=x;it.push(rt);let Y=eo(B,St);if(Y==="indoor")return E(this,F,fo).call(this,B,rt,st,b);if(Y==="outdoor")return E(this,F,mo).call(this,B,rt,st,r,Et)})),o(this,l).Outdoor.setOpacity(Jt(it,o(this,h).mode)),d(this,ot,o(this,q).filter(x=>{var B;return((B=$.get(x.id))==null?void 0:B.showIndoor)===!0}).map(x=>x.facade)),o(this,A).publish("focus",{facades:o(this,ot)}),V()});return this.sceneUpdateQueue=u,u},"#applyBuildingStates"));d(this,A,new vt),d(this,l,t),X.setLevel(Q.logState),d(this,P,o(this,l).getMapData()),d(this,w,o(this,l).currentFloor.elevation),d(this,tt,o(this,l).Camera.elevation);for(let e of o(this,P).getByType("facade"))o(this,y).set(e.floorStack.id,new wt(e.floorStack,o(this,l)));E(this,F,ho).call(this),d(this,L,new At(so(o(this,P),o(this,y)),o(this,l))),o(this,l).on("floor-change-start",o(this,Ft)),o(this,l).on("camera-change",o(this,et)),o(this,l).on("facades-in-view-change",o(this,gt)),o(this,l).on("user-interaction-start",o(this,bt)),o(this,l).on("user-interaction-end",o(this,yt))}enable(t){if(o(this,U)){X.warn("enable() called on an already enabled Dynamic Focus instance.");return}d(this,U,!0),o(this,l).manualFloorVisibility=!0,o(this,L).show(),this.updateState(G(G({},o(this,h)),t)),E(this,F,co).call(this),o(this,et).call(this,{zoomLevel:o(this,l).Camera.zoomLevel,center:o(this,l).Camera.center,bearing:o(this,l).Camera.bearing,pitch:o(this,l).Camera.pitch}),o(this,l).Camera.updateFacadesInView()}disable(){if(!o(this,U)){X.warn("disable() called on an already disabled Dynamic Focus instance.");return}d(this,U,!1),o(this,l).manualFloorVisibility=!1}get isEnabled(){return o(this,U)}get isIndoor(){return o(this,R)==="indoor"}get isOutdoor(){return o(this,R)==="outdoor"}get outdoorsFloorStack(){return o(this,L).floorStack}get layers(){return o(this,ft)}get layersBySpaceId(){return o(this,mt)}setIndoor(){d(this,R,"indoor"),d(this,D,"in-range"),E(this,F,Yt).call(this)}setOutdoor(){d(this,R,"outdoor"),d(this,D,"out-of-range"),E(this,F,Yt).call(this)}get focusedFacades(){return[...o(this,ot)]}getState(){return G({},o(this,h))}updateState(t){var s,r;let e=!1,i=o(this,h).isolateBelowGroundView&&o(this,w)<0;if(t.indoorZoomThreshold!=null&&(t.indoorZoomThreshold=Zt(t.indoorZoomThreshold,(s=t==null?void 0:t.outdoorZoomThreshold)!=null?s:o(this,h).outdoorZoomThreshold,o(this,l).Camera.maxZoomLevel,"indoorZoomThreshold"),e=!0),t.outdoorZoomThreshold!=null&&(t.outdoorZoomThreshold=Zt(t.outdoorZoomThreshold,o(this,l).Camera.minZoomLevel,(r=t==null?void 0:t.indoorZoomThreshold)!=null?r:o(this,h).indoorZoomThreshold,"outdoorZoomThreshold"),e=!0),t.mode!=null&&(t.mode=no.includes(t.mode)?t.mode:"default-floor"),t.autoAdjustFacadeHeights!=null&&(o(this,h).autoAdjustFacadeHeights=t.autoAdjustFacadeHeights),t.dynamicBuildingInteriors!=null&&t.dynamicBuildingInteriors!==o(this,h).dynamicBuildingInteriors&&(e=!0),t.isolateBelowGroundView!=null&&t.isolateBelowGroundView!==o(this,h).isolateBelowGroundView&&(e=!0),t.forceInteriorsVisible!=null&&t.forceInteriorsVisible!==o(this,h).forceInteriorsVisible&&(e=!0),t.showLabelsAndMarkersOnAllVisibleFloors!=null&&t.showLabelsAndMarkersOnAllVisibleFloors!==o(this,h).showLabelsAndMarkersOnAllVisibleFloors&&(e=!0),d(this,h,Object.assign({},o(this,h),Object.fromEntries(Object.entries(t).filter(([,u])=>u!=null)))),t.mode!=null&&t.preloadFloors&&E(this,F,qt).call(this,t.mode),e){let u=o(this,h).isolateBelowGroundView&&o(this,w)<0;i&&!u?(d(this,N,!0),o(this,l).Camera.updateFacadesInView(),o(this,h).autoFocus||o(this,C).call(this)):o(this,C).call(this)}}destroy(){this.disable(),o(this,l).off("facades-in-view-change",o(this,gt)),o(this,l).off("floor-change-start",o(this,Ft)),o(this,l).off("camera-change",o(this,et)),o(this,l).off("user-interaction-start",o(this,bt)),o(this,l).off("user-interaction-end",o(this,yt)),o(this,y).forEach(t=>t.destroy()),o(this,L).destroy(),o(this,A).destroy(),d(this,j,[])}async focus(t=o(this,h).setFloorOnFocus){if(t)if(io(o(this,tt),o(this,l).Camera.elevation,o(this,H)))d(this,tt,o(this,l).Camera.elevation),d(this,N,!0);else{let e=to(o(this,q),o(this,L),o(this,D)),i=e?It(e,o(this,h).mode,o(this,w)):void 0;i&&i.id!==o(this,l).currentFloor.id&&o(this,l).setFloor(i,{context:"dynamic-focus"})}await o(this,C).call(this),o(this,A).publish("focus",{facades:this.focusedFacades})}preloadFloors(){E(this,F,qt).call(this,o(this,h).mode)}setDefaultFloorForStack(t,e){if(!Gt(e,t))return;let i=o(this,y).get(t.id);i&&(i.defaultFloor=e)}resetDefaultFloorForStack(t){let e=o(this,y).get(t.id);e&&(e.defaultFloor=t.defaultFloor)}getDefaultFloorForStack(t){var e;return((e=o(this,y).get(t.id))==null?void 0:e.defaultFloor)||t.defaultFloor||t.floors[0]}setCurrentFloorForStack(t,e){if(!Gt(e,t))return;let i=o(this,y).get(t.id);i&&(i.activeFloor=e,o(this,C).call(this))}exclude(t){let e=Array.isArray(t)?t:[t];for(let i of e){let s=o(this,y).get(i.id);s&&(s.excluded=!0)}}include(t){let e=Array.isArray(t)?t:[t];for(let i of e){let s=o(this,y).get(i.id);s&&(s.excluded=!1)}}getCurrentFloorForStack(t){var e;return((e=o(this,y).get(t.id))==null?void 0:e.activeFloor)||this.getDefaultFloorForStack(t)}};A=new WeakMap,l=new WeakMap,P=new WeakMap,h=new WeakMap,q=new WeakMap,z=new WeakMap,y=new WeakMap,L=new WeakMap,H=new WeakMap,N=new WeakMap,w=new WeakMap,tt=new WeakMap,ft=new WeakMap,mt=new WeakMap,pt=new WeakMap,D=new WeakMap,R=new WeakMap,ot=new WeakMap,U=new WeakMap,j=new WeakMap,F=new WeakSet,Yt=a(function(){o(this,h).autoFocus&&(o(this,H)?this.focus():d(this,N,!0)),o(this,A).publish("state-change")},"#handleViewStateChange"),co=a(function(){d(this,j,[]);for(let t of o(this,h).dynamicLayers){let e=new Vt([t],!0,o(this,l));e.processLayerGroup(o(this,pt),o(this,h).outdoorZoomThreshold,o(this,h).indoorZoomThreshold),o(this,j).push(e)}jt(o(this,j),o(this,l).Camera.zoomLevel)},"#initializeLayerGroups"),ho=a(function(){var s,r,u;let t=(u=(r=(s=o(this,P).internal.mvf)==null?void 0:s.enterprise)==null?void 0:r.layers)!=null?u:[],e={},i={};t.forEach(f=>{e[f.name]||(e[f.name]=[]),e[f.name].push(...f.spaces.map(({spaceId:g})=>g));for(let{spaceId:g}of f.spaces)i[g]==null&&(i[g]=[]),i[g].push(f.name)}),d(this,ft,t.map(({name:f})=>f)),d(this,mt,i),d(this,pt,e)},"#setupLayers"),qt=a(function(t){o(this,l).preloadFloors(o(this,P).getByType("facade").map(e=>It(o(this,y).get(e.floorStack.id),t,o(this,w))).filter(e=>e!=null&&Po.is(e)))},"#preloadFloors"),gt=new WeakMap,Ft=new WeakMap,bt=new WeakMap,yt=new WeakMap,et=new WeakMap,Bt=a(function(t,e,i,s=!1){t.forEach(r=>{if(r.floor)if(e){let f=i!==void 0&&!s?at(G({},r.state),{labels:at(G({},r.state.labels),{enabled:r.state.labels.enabled&&i}),markers:at(G({},r.state.markers),{enabled:r.state.markers.enabled&&i}),occlusion:at(G({},r.state.occlusion),{enabled:r.state.occlusion.enabled&&i})}):r.state;o(this,l).updateState(r.floor,f)}else o(this,l).updateState(r.floor,{visible:!1})})},"#updateFloorVisibility"),fo=a(async function(t,e,i,s){return E(this,F,Bt).call(this,e.floorStates,!0,s,o(this,h).showLabelsAndMarkersOnAllVisibleFloors),t.animateFacade(i.state,o(this,h).indoorAnimationOptions)},"#animateIndoorSequence"),mo=a(async function(t,e,i,s,r){let u=r;u&&E(this,F,Bt).call(this,e.floorStates,!1,void 0,o(this,h).showLabelsAndMarkersOnAllVisibleFloors);let f=await t.animateFacade(i.state,o(this,h).outdoorAnimationOptions);return f.result==="completed"&&!u&&E(this,F,Bt).call(this,e.floorStates,Lt({building:t,currentFloor:o(this,l).currentFloor,inRange:o(this,D)==="in-range",inFocus:o(this,z).has(t.id),mode:o(this,h).mode,elevation:o(this,w),inNavigation:s.includes(t.floorStack.id),dynamicBuildingInteriors:o(this,h).dynamicBuildingInteriors,forceInteriorsVisible:o(this,h).forceInteriorsVisible}),void 0,o(this,h).showLabelsAndMarkersOnAllVisibleFloors),f},"#animateOutdoorSequence"),C=new WeakMap,a(zt,"DynamicFocus");var uo=zt;export{a,Ae as b,ke as c,uo as d};
@@ -1,11 +1,8 @@
1
- import { Facade, Floor, FloorStack, MapView, VisibilityState as BuildingFloorStackState } from "@mappedin/mappedin-js";
1
+ import { Facade, Floor, FloorStack, MapView, TFloorAltitudeData, VisibilityState as BuildingFloorStackState } from "@mappedin/mappedin-js";
2
2
 
3
3
  //#region src/types.d.ts
4
- type MultiFloorVisibilityState = (floors: Floor[], currentFloor: Floor, floorGap: number, floorIdsInNavigation: Floor['id'][], floorsVisualHeightMap?: Map<number, {
5
- altitude: number;
6
- effectiveHeight: number;
7
- }>, footprintConfig?: {
8
- color?: string;
4
+ type MultiFloorVisibilityState = (floors: Floor[], currentFloor: Floor, floorIdsInNavigation: Floor['id'][], floorsVisualHeightMap: Map<number, TFloorAltitudeData>, footprintConfig?: {
5
+ color?: string | Partial<Record<string, string>>;
9
6
  opacity?: number;
10
7
  outline?: boolean;
11
8
  spacesOpenToBelowEnabled?: boolean;
@@ -132,7 +129,7 @@ type DynamicFocusEventPayload<EventName extends keyof DynamicFocusEvents> = Dyna
132
129
  data: null;
133
130
  } ? DynamicFocusEvents[EventName]['data'] : DynamicFocusEvents[EventName];
134
131
  //#endregion
135
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/primitive.d.ts
132
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/primitive.d.ts
136
133
  /**
137
134
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
138
135
 
@@ -140,7 +137,7 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
140
137
  */
141
138
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
142
139
  //#endregion
143
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-any.d.ts
140
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/is-any.d.ts
144
141
  /**
145
142
  Returns a boolean for whether the given type is `any`.
146
143
 
@@ -155,8 +152,8 @@ import type {IsAny} from 'type-fest';
155
152
  const typedObject = {a: 1, b: 2} as const;
156
153
  const anyObject: any = {a: 1, b: 2};
157
154
 
158
- function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
159
- return obj[key];
155
+ function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(object: O, key: K) {
156
+ return object[key];
160
157
  }
161
158
 
162
159
  const typedA = get(typedObject, 'a');
@@ -171,7 +168,7 @@ const anyA = get(anyObject, 'a');
171
168
  */
172
169
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
173
170
  //#endregion
174
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-optional-key-of.d.ts
171
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/is-optional-key-of.d.ts
175
172
  /**
176
173
  Returns a boolean for whether the given key is an optional key of type.
177
174
 
@@ -181,17 +178,17 @@ This is useful when writing utility types or schema validators that need to diff
181
178
  ```
182
179
  import type {IsOptionalKeyOf} from 'type-fest';
183
180
 
184
- interface User {
181
+ type User = {
185
182
  name: string;
186
183
  surname: string;
187
184
 
188
185
  luckyNumber?: number;
189
- }
186
+ };
190
187
 
191
- interface Admin {
188
+ type Admin = {
192
189
  name: string;
193
190
  surname?: string;
194
- }
191
+ };
195
192
 
196
193
  type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
197
194
  //=> true
@@ -214,7 +211,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
214
211
  */
215
212
  type IsOptionalKeyOf<Type extends object, Key$1 extends keyof Type> = IsAny<Type | Key$1> extends true ? never : Key$1 extends keyof Type ? Type extends Record<Key$1, Type[Key$1]> ? false : true : false;
216
213
  //#endregion
217
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/optional-keys-of.d.ts
214
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/optional-keys-of.d.ts
218
215
  /**
219
216
  Extract all optional keys from the given type.
220
217
 
@@ -224,12 +221,12 @@ This is useful when you want to create a new type that contains different type v
224
221
  ```
225
222
  import type {OptionalKeysOf, Except} from 'type-fest';
226
223
 
227
- interface User {
224
+ type User = {
228
225
  name: string;
229
226
  surname: string;
230
227
 
231
228
  luckyNumber?: number;
232
- }
229
+ };
233
230
 
234
231
  const REMOVE_FIELD = Symbol('remove field symbol');
235
232
  type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
@@ -237,12 +234,12 @@ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKe
237
234
  };
238
235
 
239
236
  const update1: UpdateOperation<User> = {
240
- name: 'Alice'
237
+ name: 'Alice',
241
238
  };
242
239
 
243
240
  const update2: UpdateOperation<User> = {
244
241
  name: 'Bob',
245
- luckyNumber: REMOVE_FIELD
242
+ luckyNumber: REMOVE_FIELD,
246
243
  };
247
244
  ```
248
245
 
@@ -252,7 +249,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
252
249
  ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
253
250
  : never;
254
251
  //#endregion
255
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/required-keys-of.d.ts
252
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/required-keys-of.d.ts
256
253
  /**
257
254
  Extract all required keys from the given type.
258
255
 
@@ -262,17 +259,23 @@ This is useful when you want to create a new type that contains different type v
262
259
  ```
263
260
  import type {RequiredKeysOf} from 'type-fest';
264
261
 
265
- declare function createValidation<Entity extends object, Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn;
262
+ declare function createValidation<
263
+ Entity extends object,
264
+ Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>,
265
+ >(field: Key, validator: (value: Entity[Key]) => boolean): (entity: Entity) => boolean;
266
266
 
267
- interface User {
267
+ type User = {
268
268
  name: string;
269
269
  surname: string;
270
-
271
270
  luckyNumber?: number;
272
- }
271
+ };
273
272
 
274
273
  const validator1 = createValidation<User>('name', value => value.length < 25);
275
274
  const validator2 = createValidation<User>('surname', value => value.length < 25);
275
+
276
+ // @ts-expect-error
277
+ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
278
+ // Error: Argument of type '"luckyNumber"' is not assignable to parameter of type '"name" | "surname"'.
276
279
  ```
277
280
 
278
281
  @category Utilities
@@ -280,7 +283,7 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
280
283
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
281
284
  ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
282
285
  //#endregion
283
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-never.d.ts
286
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/is-never.d.ts
284
287
  /**
285
288
  Returns a boolean for whether the given type is `never`.
286
289
 
@@ -294,29 +297,41 @@ Useful in type utilities, such as checking if something does not occur.
294
297
  ```
295
298
  import type {IsNever, And} from 'type-fest';
296
299
 
297
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
298
- type AreStringsEqual<A extends string, B extends string> =
299
- And<
300
- IsNever<Exclude<A, B>> extends true ? true : false,
301
- IsNever<Exclude<B, A>> extends true ? true : false
302
- >;
303
-
304
- type EndIfEqual<I extends string, O extends string> =
305
- AreStringsEqual<I, O> extends true
306
- ? never
307
- : void;
308
-
309
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
310
- if (input === output) {
311
- process.exit(0);
312
- }
313
- }
300
+ type A = IsNever<never>;
301
+ //=> true
302
+
303
+ type B = IsNever<any>;
304
+ //=> false
305
+
306
+ type C = IsNever<unknown>;
307
+ //=> false
308
+
309
+ type D = IsNever<never[]>;
310
+ //=> false
311
+
312
+ type E = IsNever<object>;
313
+ //=> false
314
+
315
+ type F = IsNever<string>;
316
+ //=> false
317
+ ```
318
+
319
+ @example
320
+ ```
321
+ import type {IsNever} from 'type-fest';
314
322
 
315
- endIfEqual('abc', 'abc');
323
+ type IsTrue<T> = T extends true ? true : false;
324
+
325
+ // When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
326
+ type A = IsTrue<never>;
316
327
  //=> never
317
328
 
318
- endIfEqual('abc', '123');
319
- //=> void
329
+ // If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
330
+ type IsTrueFixed<T> =
331
+ IsNever<T> extends true ? false : T extends true ? true : false;
332
+
333
+ type B = IsTrueFixed<never>;
334
+ //=> false
320
335
  ```
321
336
 
322
337
  @category Type Guard
@@ -324,7 +339,7 @@ endIfEqual('abc', '123');
324
339
  */
325
340
  type IsNever<T> = [T] extends [never] ? true : false;
326
341
  //#endregion
327
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/if.d.ts
342
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/if.d.ts
328
343
  /**
329
344
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
330
345
 
@@ -337,7 +352,7 @@ Note:
337
352
 
338
353
  @example
339
354
  ```
340
- import {If} from 'type-fest';
355
+ import type {If} from 'type-fest';
341
356
 
342
357
  type A = If<true, 'yes', 'no'>;
343
358
  //=> 'yes'
@@ -357,7 +372,7 @@ type E = If<never, 'yes', 'no'>;
357
372
 
358
373
  @example
359
374
  ```
360
- import {If, IsAny, IsNever} from 'type-fest';
375
+ import type {If, IsAny, IsNever} from 'type-fest';
361
376
 
362
377
  type A = If<IsAny<unknown>, 'is any', 'not any'>;
363
378
  //=> 'not any'
@@ -368,7 +383,7 @@ type B = If<IsNever<never>, 'is never', 'not never'>;
368
383
 
369
384
  @example
370
385
  ```
371
- import {If, IsEqual} from 'type-fest';
386
+ import type {If, IsEqual} from 'type-fest';
372
387
 
373
388
  type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
374
389
 
@@ -419,7 +434,7 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
419
434
  */
420
435
  type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
421
436
  //#endregion
422
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/type.d.ts
437
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/internal/type.d.ts
423
438
  /**
424
439
  Matches any primitive, `void`, `Date`, or `RegExp` value.
425
440
  */
@@ -437,7 +452,7 @@ type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T
437
452
  (...arguments_: infer B): unknown;
438
453
  } ? B extends A ? A extends B ? false : true : true : false;
439
454
  //#endregion
440
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/simplify.d.ts
455
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/simplify.d.ts
441
456
  /**
442
457
  Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
443
458
 
@@ -483,10 +498,11 @@ const literal = {foo: 123, bar: 'hello', baz: 456};
483
498
  const someType: SomeType = literal;
484
499
  const someInterface: SomeInterface = literal;
485
500
 
486
- function fn(object: Record<string, unknown>): void {}
501
+ declare function fn(object: Record<string, unknown>): void;
487
502
 
488
503
  fn(literal); // Good: literal object type is sealed
489
504
  fn(someType); // Good: type is sealed
505
+ // @ts-expect-error
490
506
  fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
491
507
  fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
492
508
  ```
@@ -497,7 +513,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
497
513
  */
498
514
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
499
515
  //#endregion
500
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/omit-index-signature.d.ts
516
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/omit-index-signature.d.ts
501
517
  /**
502
518
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
503
519
 
@@ -515,8 +531,9 @@ It relies on the fact that an empty object (`{}`) is assignable to an object wit
515
531
  ```
516
532
  const indexed: Record<string, unknown> = {}; // Allowed
517
533
 
534
+ // @ts-expect-error
518
535
  const keyed: Record<'foo', unknown> = {}; // Error
519
- // => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
536
+ // TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
520
537
  ```
521
538
 
522
539
  Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
@@ -525,19 +542,21 @@ Instead of causing a type error like the above, you can also use a [conditional
525
542
  type Indexed = {} extends Record<string, unknown>
526
543
  ? '✅ `{}` is assignable to `Record<string, unknown>`'
527
544
  : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
528
- // => '✅ `{}` is assignable to `Record<string, unknown>`'
545
+
546
+ type IndexedResult = Indexed;
547
+ //=> '✅ `{}` is assignable to `Record<string, unknown>`'
529
548
 
530
549
  type Keyed = {} extends Record<'foo' | 'bar', unknown>
531
- ? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
532
- : "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
533
- // => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
550
+ ? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
551
+ : '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
552
+
553
+ type KeyedResult = Keyed;
554
+ //=> '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`'
534
555
  ```
535
556
 
536
557
  Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
537
558
 
538
559
  ```
539
- import type {OmitIndexSignature} from 'type-fest';
540
-
541
560
  type OmitIndexSignature<ObjectType> = {
542
561
  [KeyType in keyof ObjectType // Map each key of `ObjectType`...
543
562
  ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
@@ -547,14 +566,12 @@ type OmitIndexSignature<ObjectType> = {
547
566
  ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
548
567
 
549
568
  ```
550
- import type {OmitIndexSignature} from 'type-fest';
551
-
552
569
  type OmitIndexSignature<ObjectType> = {
553
570
  [KeyType in keyof ObjectType
554
- // Is `{}` assignable to `Record<KeyType, unknown>`?
555
- as {} extends Record<KeyType, unknown>
556
- ? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
557
- : ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
571
+ // Is `{}` assignable to `Record<KeyType, unknown>`?
572
+ as {} extends Record<KeyType, unknown>
573
+ ? never // ✅ `{}` is assignable to `Record<KeyType, unknown>`
574
+ : KeyType // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
558
575
  ]: ObjectType[KeyType];
559
576
  };
560
577
  ```
@@ -565,24 +582,24 @@ If `{}` is assignable, it means that `KeyType` is an index signature and we want
565
582
  ```
566
583
  import type {OmitIndexSignature} from 'type-fest';
567
584
 
568
- interface Example {
585
+ type Example = {
569
586
  // These index signatures will be removed.
570
- [x: string]: any
571
- [x: number]: any
572
- [x: symbol]: any
573
- [x: `head-${string}`]: string
574
- [x: `${string}-tail`]: string
575
- [x: `head-${string}-tail`]: string
576
- [x: `${bigint}`]: string
577
- [x: `embedded-${number}`]: string
587
+ [x: string]: any;
588
+ [x: number]: any;
589
+ [x: symbol]: any;
590
+ [x: `head-${string}`]: string;
591
+ [x: `${string}-tail`]: string;
592
+ [x: `head-${string}-tail`]: string;
593
+ [x: `${bigint}`]: string;
594
+ [x: `embedded-${number}`]: string;
578
595
 
579
596
  // These explicitly defined keys will remain.
580
597
  foo: 'bar';
581
598
  qux?: 'baz';
582
- }
599
+ };
583
600
 
584
601
  type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
585
- // => { foo: 'bar'; qux?: 'baz' | undefined; }
602
+ //=> {foo: 'bar'; qux?: 'baz'}
586
603
  ```
587
604
 
588
605
  @see {@link PickIndexSignature}
@@ -590,7 +607,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
590
607
  */
591
608
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
592
609
  //#endregion
593
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/pick-index-signature.d.ts
610
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/pick-index-signature.d.ts
594
611
  /**
595
612
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
596
613
 
@@ -638,9 +655,9 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
638
655
  */
639
656
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
640
657
  //#endregion
641
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/merge.d.ts
658
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/merge.d.ts
642
659
  // Merges two objects without worrying about index signatures.
643
- type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
660
+ type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
644
661
 
645
662
  /**
646
663
  Merge two types into a new type. Keys of the second type overrides keys of the first type.
@@ -649,12 +666,12 @@ Merge two types into a new type. Keys of the second type overrides keys of the f
649
666
  ```
650
667
  import type {Merge} from 'type-fest';
651
668
 
652
- interface Foo {
669
+ type Foo = {
653
670
  [x: string]: unknown;
654
671
  [x: number]: unknown;
655
672
  foo: string;
656
673
  bar: symbol;
657
- }
674
+ };
658
675
 
659
676
  type Bar = {
660
677
  [x: number]: number;
@@ -664,7 +681,7 @@ type Bar = {
664
681
  };
665
682
 
666
683
  export type FooBar = Merge<Foo, Bar>;
667
- // => {
684
+ //=> {
668
685
  // [x: string]: unknown;
669
686
  // [x: number]: number;
670
687
  // [x: symbol]: unknown;
@@ -674,11 +691,17 @@ export type FooBar = Merge<Foo, Bar>;
674
691
  // }
675
692
  ```
676
693
 
694
+ Note: If you want a merge type that more accurately reflects the runtime behavior of object spread or `Object.assign`, refer to the {@link ObjectMerge} type.
695
+
696
+ @see {@link ObjectMerge}
677
697
  @category Object
678
698
  */
679
- type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
699
+ type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
700
+ ? Source extends unknown // For distributing `Source`
701
+ ? Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>> : never // Should never happen
702
+ : never;
680
703
  //#endregion
681
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/object.d.ts
704
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/internal/object.d.ts
682
705
 
683
706
  /**
684
707
  Merges user specified options with default options.
@@ -734,7 +757,7 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
734
757
  */
735
758
  type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
736
759
  //#endregion
737
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/partial-deep.d.ts
760
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/partial-deep.d.ts
738
761
  /**
739
762
  @see {@link PartialDeep}
740
763
  */
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{a as d,b as u,c as y,d as F}from"./chunk-DMFERG3B.js";var p=d((t,o)=>{var l,i,s,a;let n={initialVisibility:(l=o.initialVisibility)!=null?l:"outdoor-first",layersBySpaceId:(i=o.layersBySpaceId)!=null?i:{},focusLayers:(s=o.focusLayers)!=null?s:[],defaultFloor:(a=o.defaultFloor)!=null?a:t.currentFloor},e=O(t,n),c=e+y,r=e+u;return n.initialVisibility==="indoor-first"&&(c=e-u,r=e-y),{indoorZoomThreshold:c,outdoorZoomThreshold:r}},"calculateZoomThresholds");function O(t,o){var l;let n=t.getMapData().getByType("space"),e=o.focusLayers.length?n.filter(i=>{var a,f,m;let s=(a=o.layersBySpaceId[i.id])==null?void 0:a[0];return typeof s=="string"&&i.floor.id===((f=o.defaultFloor)==null?void 0:f.id)&&((m=o.focusLayers)==null?void 0:m.indexOf(s))!==-1}):void 0,c=(l=t.Camera.getFocusOnTransform(o.defaultFloor,{}).zoomLevel)!=null?l:0,r=e!=null&&e.length?t.Camera.getFocusOnTransform(e,{}).zoomLevel:void 0;return r!=null?r:c}d(O,"getDefaultZoomLevel");export{F as DynamicFocus,p as calculateZoomThresholds};
1
+ import{a as f,b as u,c as y,d as F}from"./chunk-BJFA6MKA.js";var O=f((t,e)=>{var n,c,s,o;let l={initialVisibility:(n=e.initialVisibility)!=null?n:"outdoor-first",layersBySpaceId:(c=e.layersBySpaceId)!=null?c:{},focusLayers:(s=e.focusLayers)!=null?s:[],defaultFloor:(o=e.defaultFloor)!=null?o:t.currentFloor},i=T(t,l),r=i+y,a=i+u;return l.initialVisibility==="indoor-first"&&(r=i-u,a=i-y),{indoorZoomThreshold:r,outdoorZoomThreshold:a}},"calculateZoomThresholds");function T(t,e){var a,n;let l=t.getMapData();if(e.focusLayers.length){let s=l.getByType("space").filter(o=>{var d,p;let m=(d=e.layersBySpaceId[o.id])==null?void 0:d[0];return typeof m=="string"&&o.floor.id===((p=e.defaultFloor)==null?void 0:p.id)&&e.focusLayers.indexOf(m)!==-1});if(s.length){let o=t.Camera.getFocusOnTransform(s,{}).zoomLevel;if(o!==void 0)return o}}let i=l.getByType("floor-stack"),r=1/0;for(let c of i)for(let s of c.floors){let o=(a=t.Camera.getFocusOnTransform(s,{}).zoomLevel)!=null?a:1/0;o<r&&(r=o)}return r!==1/0?r:(n=t.Camera.getFocusOnTransform(e.defaultFloor,{}).zoomLevel)!=null?n:0}f(T,"getDefaultZoomLevel");export{F as DynamicFocus,O as calculateZoomThresholds};