@wework/floormap-utils
Advanced tools
Comparing version 1.3.2 to 1.3.3-rc.2
@@ -7,2 +7,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/* eslint-disable */ | ||
var nook = 'https://cdn.spacemob.co/img/nook@2x.png'; | ||
@@ -114,3 +115,3 @@ var meeting = 'https://cdn.spacemob.co/img/meeting_room@2x.png'; | ||
only: outlineOnly, | ||
color: outlineColor | ||
color: outlineColor, | ||
}; | ||
@@ -120,11 +121,6 @@ | ||
case 'HALLWAY': | ||
case 'LOBBY': | ||
case 'ELEV LOBBY': | ||
outline = null; | ||
break | ||
case 'PHONE BOOTH': | ||
// outlineColor = '#474747' | ||
break | ||
case 'PRINTER': | ||
// outlineColor = '#474747' | ||
break | ||
default: | ||
@@ -135,3 +131,2 @@ break | ||
case 'MEET': | ||
// outlineColor = '#474747' | ||
showRoomNumber = true; | ||
@@ -187,3 +182,3 @@ switch (_subType) { | ||
_rotation = { | ||
z: locationAngle | ||
z: locationAngle, | ||
}; | ||
@@ -214,3 +209,3 @@ _instancingId = instancingId; | ||
outline: outline, | ||
opacity: opacity | ||
opacity: opacity, | ||
}, | ||
@@ -223,3 +218,3 @@ points: points, | ||
visible: true, | ||
zOrder: zOrder | ||
zOrder: zOrder, | ||
}; | ||
@@ -248,3 +243,3 @@ if (_instancingId) { | ||
objects.push({ | ||
id: id + '_TEXT', | ||
id: (id + "_TEXT"), | ||
type: 'TEXT', | ||
@@ -257,5 +252,5 @@ text: roomNumber, | ||
color: 'black', | ||
fontWeight: 'bold' | ||
fontWeight: 'bold', | ||
}, | ||
interactable: false | ||
interactable: false, | ||
}); | ||
@@ -283,3 +278,3 @@ } | ||
objects.push({ | ||
id: id + '_SPRITE', | ||
id: (id + "_SPRITE"), | ||
type: 'SPRITE', | ||
@@ -291,5 +286,5 @@ position: pos$1, | ||
img: img, | ||
maxWidth: maxWidth$1 | ||
maxWidth: maxWidth$1, | ||
}, | ||
interactable: false | ||
interactable: false, | ||
}); | ||
@@ -392,3 +387,3 @@ } | ||
y: parseFloat(b[1]), | ||
z: parseFloat(b[2]) | ||
z: parseFloat(b[2]), | ||
}); | ||
@@ -418,2 +413,5 @@ }); | ||
case 'COMMUNITY BAR': | ||
case 'BEVERAGE ISLAND': | ||
case 'F&B': | ||
case 'CATERING KITCHEN': | ||
img = pantry; | ||
@@ -460,2 +458,3 @@ break | ||
case 'F&B STORAGE': | ||
case 'F\u0026B STORAGE': | ||
case 'CLEANING STORAGE': | ||
@@ -473,5 +472,2 @@ case 'COAT CLOSET': | ||
break | ||
case 'F&B': | ||
img = pantry; | ||
break | ||
case 'MAIL': | ||
@@ -478,0 +474,0 @@ case 'MAIL & PACKAGE ROOM': |
@@ -1,2 +0,2 @@ | ||
function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var zonedTimeToUtc=_interopDefault(require("date-fns-tz/zonedTimeToUtc")),nook="https://cdn.spacemob.co/img/nook@2x.png",meeting="https://cdn.spacemob.co/img/meeting_room@2x.png",gameRoom="https://cdn.spacemob.co/img/gameroom@2x.png",women="https://cdn.spacemob.co/img/wc_f@2x.png",men="https://cdn.spacemob.co/img/wc_m@2x.png",shower="https://cdn.spacemob.co/img/shower@2x.png",itRoom="https://cdn.spacemob.co/img/IT_room@2x.png",printer="https://cdn.spacemob.co/img/printer@2x.png",phoneBooth="https://cdn.spacemob.co/img/phone_booth@2x.png",mechanical="https://cdn.spacemob.co/img/mechanical@2x.png",storage="https://cdn.spacemob.co/img/storage@2x.png",trash="https://cdn.spacemob.co/img/trash@2x.png",pantry="https://cdn.spacemob.co/img/pantry@2x.png",motherRoom="https://cdn.spacemob.co/img/motherroom@2x.png",mail="https://cdn.spacemob.co/img/mail_room@2x.png",serviceLift="https://cdn.spacemob.co/img/servicelift@2x.png",wellness="https://cdn.spacemob.co/img/wellnessroom@2x.png",electrical="https://cdn.spacemob.co/img/electrical@2x.png",fire="https://cdn.spacemob.co/img/fire_extinguisher@2x.png",maintenance="https://cdn.spacemob.co/img/maintenance@2x.png",getCenter=function(e){for(var t=1/0,a=1/0,s=-1/0,c=-1/0,n=0;n<e.length;n++)t=Math.min(t,e[n].x),a=Math.min(a,e[n].y),s=Math.max(s,e[n].x),c=Math.max(c,e[n].y);return{x:(s+t)/2,y:(c+a)/2}},createRenderObjects=function(e){var t,a,c=e.id,s=e.shapes,n=e.type,r=e.subType,o=e.programType,i=e.roomNumber,p=e.hasWindow,E=e.locationAngle,g=e.centroid,l=e.instancingId,d=[];"string"==typeof o&&(t=o.toUpperCase()),"string"==typeof r&&(a=r.toUpperCase());var O="BACK",T="#474747",m=1,h=!0,R=!1,u=getExtrude(t,6),b=getZed(t,6),A=getColor(t),S=getImage(t,a),I=0;if("object"===n)switch(a){case"CHAIR":A="rgb(206,206,206)",O="FRONT",b=-(6-(u=1))/2,T="rgb(150,150,150)";break;case"TABLE":case"HOTDESK_TABLE":A="rgb(246,241,241)",O="FRONT",u=.5,b=-1.5,m=.8,T="rgb(150,150,150)",I=1}else"space"===n||"room"===n||console.warn("invalid type:",n);var M={only:!1,color:T};switch(a){case"HALLWAY":case"ELEV LOBBY":M=null}switch(t){case"MEET":switch(R=!0,a){case"NOOK":case"PHONE BOOTH":case"wt":R=!1}break;case"WORK":R=!0,p&&(A="rgb(228,243,247)");break;case"WASH":case"SERVE":break;case"OPERATE":case"WE":break;case"CIRCULATE":M=null;break;default:t&&console.log("invalid programType:",t)}M&&(M.color=T);var f=s,C={z:b},y=null,D=null;if(l&&(g?((C=g).z=b,D=l,h=!(y={z:E})):console.warn("centroid is not available",JSON.stringify(e))),f&&0!==f.length){if(f.forEach(function(e,t){var a=c;0!==t&&(a=c+"/"+t);var s={id:a,type:"MESH",style:{color:A,side:O,outline:M,opacity:m},points:e,interactable:h,extrude:u,position:C,rotation:y,visible:!0,zOrder:I};D&&(s.instancingId=D),d.push(s)}),R&&i){var x=getCenter(f[0]),v={x:.5,y:.5};S&&(v.y=1.25);var N=getSize(f[0]).width/2*.8;3<N&&(N=2.9),d.push({id:c+"_TEXT",type:"TEXT",text:i,position:x,scalar:N,center:v,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(S){var _=getCenter(f[0]),k={x:.5,y:.5};g&&((_=g).z=0),R&&i&&(k.y=.25);var H=3,L=getSize(f[0]);H>L.width?H=L.width-.1:H>L.height&&(H=L.height-.1),d.push({id:c+"_SPRITE",type:"SPRITE",position:_,scalar:1,center:k,style:{img:S,maxWidth:H},interactable:!1})}return d}console.warn("Invalid shapes",JSON.stringify(e))},getExtrude=function(e,t){switch(e){case"CIRCULATE":case"WE":return.1;default:return t}},getZed=function(e,t){switch(e){case"WORK":return 0;case"MEET":return-.01;case"WASH":return-.02;case"OPERATE":return-.03;case"WE":return-(t/2+.01);case"CIRCULATE":return-(t/2+.02);default:return 0}},getColor=function(e){switch(e){case"WORK":return"rgb(171,221,231)";case"CIRCULATE":return"rgb(255,247,223)";case"MEET":return"rgb(183,240,217)";case"WE":return"rgb(255,210,106)";case"OPERATE":return"rgb(226,226,226)";case"WASH":return"rgb(195,195,195)";default:return"rgb(253,235,236)"}},stringArrayToPoints=function(e){if(e&&e.constructor===Array){var t=[];return e.forEach(function(e){e&&e.constructor===Array&&3===e.length&&t.push({x:parseFloat(e[0]),y:parseFloat(e[1]),z:parseFloat(e[2])})}),t}},getImage=function(e,t){var a=null;switch(t.toUpperCase()){case"PHONE BOOTH":a=phoneBooth;break;case"WT":case"NOOK":case"BOOTH":case"BOOTHS":a=nook;break;case"LOUNGE":case"HONESTY MKT":case"HONESTY MARKET":case"PANTRY":case"BAR":case"BEER ISLAND":case"COMMUNITY BAR":a=pantry;break;case"GAME RM":case"GAME ROOM":case"DART BOARD":a=gameRoom;break;case"WOMEN WC":case"WOMENS WC":case"W RESTROOM":case"RESTROOM":case"UNISEX RESTROOM":case"UNISEX":case"ADA RESTROOM":case"ADA WC":a=women;break;case"MEN WC":case"MENS WC":case"MALE WC":case"M RESTROOM":a=men;break;case"IT":a=itRoom;break;case"PRINTER":case"PRINT":case"PRINTER NOOK":case"PRINTING ALCOVE":a=printer;break;case"MECH":case"MECHANICAL CLOSET":a=mechanical;break;case"STOR":case"STORE":case"STORAGE":case"BIKE STORAGE":case"F&B STORAGE":case"CLEANING STORAGE":case"COAT CLOSET":a=storage;break;case"TRASH":case"TRASH ROOM":a=trash;break;case"MOTHER RM":case"MOTHERS ROOM":a=motherRoom;break;case"F&B":a=pantry;break;case"MAIL":case"MAIL & PACKAGE ROOM":a=mail;break;case"SHOWER":case"SHOWERS":a=shower;break;case"SERVICE LIFT":case"ELEVATOR FOYER":a=serviceLift;break;case"WELLNESS RM":case"WELLNESS ROOM":case"FITNESS RM":a=wellness;break;case"ELEC":case"ELECTRICAL CLOSET":a=electrical;break;case"FIRE":case"FIRE COMMAND CENTER":a=fire;break;case"MOP":case"JC":case"JANITOR":case"MOP CLOSET":a=maintenance;break;case"CONV. BOOTH":a=meeting}if(t.startsWith("IT ")&&(a=itRoom),!a)switch(e){case"MEET":a=meeting}return a},getSize=function(e){for(var t=1/0,a=1/0,s=-1/0,c=-1/0,n=0;n<e.length;n++)t=Math.min(t,e[n].x),a=Math.min(a,e[n].y),s=Math.max(s,e[n].x),c=Math.max(c,e[n].y);return{width:s-t,height:c-a}},applyInstancing=function(s,c){var n=new Map,r=function(){for(var e=0;e<s.length;e++){var t=s[e];if(t.instancingId){var a=n.get(t.instancingId);(a=a||[]).push(t),n.set(t.instancingId,a),s.splice(e,1),r()}}};r(),n.forEach(function(e,t,a){toInstancedMesh(e,t,c)})},toInstancedMesh=function(e,t,a){if(0!==e.length){var s=e[0];if(a.createInstancedMesh({id:t,mesh:{points:s.points,extrude:s.extrude,opacity:s.style?s.style.opacity:1}}),e.forEach(function(e){a.addToInstancedMesh({id:e.id,instancingId:t,style:{color:e.style.color},position:e.position,rotation:e.rotation,interactable:e.interactable,visible:e.visible})}),a.drawInstancedMesh({id:t}),s.style.outline&&s.style.outline.color){var c=t+"_OUTLINE";a.createInstancedMesh({id:c,mesh:{style:{outline:{color:s.style.outline.color,only:!0}},points:s.points,extrude:s.extrude,zOrder:s.zOrder}}),e.forEach(function(e){a.addToInstancedMesh({id:e.id+"_outline",instancingId:c,style:{color:e.style.color},position:e.position,rotation:e.rotation,visible:e.visible})}),a.drawInstancedMesh({id:c})}}},parseUTCDate=function(e){return zonedTimeToUtc(e,"utc")},HOT_DESK_REGEX=/HOT DESK/i,DEDICATED_ROOM_TYPES=["DEDICATED DESK","DEDICATED DESKS","SHARED OFFICE DESK","SHARED OFFICE DESKS"],DEDICATED_ROOM_TYPE_UUID="7c2c9f70-97c5-410b-b3a4-4fe9d1db88f8",HOT_DESK_ROOM_TYPE_UUID="b866ac5b-a1ce-45e0-a274-2137d4a547a1",isHotDeskArea=function(e,t){return void 0===e&&(e=""),void 0===t&&(t=""),t===HOT_DESK_ROOM_TYPE_UUID||Boolean(HOT_DESK_REGEX.exec(e))},isDedicatedDeskRoom=function(e,t){return void 0===e&&(e=""),void 0===t&&(t=""),t===DEDICATED_ROOM_TYPE_UUID||DEDICATED_ROOM_TYPES.includes(e.toUpperCase())};exports.createRenderObjects=createRenderObjects,exports.getCenter=getCenter,exports.getSize=getSize,exports.stringArrayToPoints=stringArrayToPoints,exports.applyInstancing=applyInstancing,exports.parseUTCDate=parseUTCDate,exports.isDedicatedDeskRoom=isDedicatedDeskRoom,exports.isHotDeskArea=isHotDeskArea; | ||
function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var zonedTimeToUtc=_interopDefault(require("date-fns-tz/zonedTimeToUtc")),nook="https://cdn.spacemob.co/img/nook@2x.png",meeting="https://cdn.spacemob.co/img/meeting_room@2x.png",gameRoom="https://cdn.spacemob.co/img/gameroom@2x.png",women="https://cdn.spacemob.co/img/wc_f@2x.png",men="https://cdn.spacemob.co/img/wc_m@2x.png",shower="https://cdn.spacemob.co/img/shower@2x.png",itRoom="https://cdn.spacemob.co/img/IT_room@2x.png",printer="https://cdn.spacemob.co/img/printer@2x.png",phoneBooth="https://cdn.spacemob.co/img/phone_booth@2x.png",mechanical="https://cdn.spacemob.co/img/mechanical@2x.png",storage="https://cdn.spacemob.co/img/storage@2x.png",trash="https://cdn.spacemob.co/img/trash@2x.png",pantry="https://cdn.spacemob.co/img/pantry@2x.png",motherRoom="https://cdn.spacemob.co/img/motherroom@2x.png",mail="https://cdn.spacemob.co/img/mail_room@2x.png",serviceLift="https://cdn.spacemob.co/img/servicelift@2x.png",wellness="https://cdn.spacemob.co/img/wellnessroom@2x.png",electrical="https://cdn.spacemob.co/img/electrical@2x.png",fire="https://cdn.spacemob.co/img/fire_extinguisher@2x.png",maintenance="https://cdn.spacemob.co/img/maintenance@2x.png",getCenter=function(e){for(var t=1/0,a=1/0,s=-1/0,c=-1/0,n=0;n<e.length;n++)t=Math.min(t,e[n].x),a=Math.min(a,e[n].y),s=Math.max(s,e[n].x),c=Math.max(c,e[n].y);return{x:(s+t)/2,y:(c+a)/2}},createRenderObjects=function(e){var t,a,c=e.id,s=e.shapes,n=e.type,r=e.subType,o=e.programType,i=e.roomNumber,E=e.hasWindow,p=e.locationAngle,g=e.centroid,l=e.instancingId,O=[];"string"==typeof o&&(t=o.toUpperCase()),"string"==typeof r&&(a=r.toUpperCase());var d="BACK",T="#474747",m=1,h=!0,R=!1,u=getExtrude(t,6),b=getZed(t,6),A=getColor(t),I=getImage(t,a),S=0;if("object"===n)switch(a){case"CHAIR":A="rgb(206,206,206)",d="FRONT",b=-(6-(u=1))/2,T="rgb(150,150,150)";break;case"TABLE":case"HOTDESK_TABLE":A="rgb(246,241,241)",d="FRONT",u=.5,b=-1.5,m=.8,T="rgb(150,150,150)",S=1}else"space"===n||"room"===n||console.warn("invalid type:",n);var M={only:!1,color:T};switch(a){case"HALLWAY":case"LOBBY":case"ELEV LOBBY":M=null}switch(t){case"MEET":switch(R=!0,a){case"NOOK":case"PHONE BOOTH":case"wt":R=!1}break;case"WORK":R=!0,E&&(A="rgb(228,243,247)");break;case"WASH":case"SERVE":break;case"OPERATE":case"WE":break;case"CIRCULATE":M=null;break;default:t&&console.log("invalid programType:",t)}M&&(M.color=T);var f=s,C={z:b},D=null,y=null;if(l&&(g?((C=g).z=b,y=l,h=!(D={z:p})):console.warn("centroid is not available",JSON.stringify(e))),f&&0!==f.length){if(f.forEach(function(e,t){var a=c;0!==t&&(a=c+"/"+t);var s={id:a,type:"MESH",style:{color:A,side:d,outline:M,opacity:m},points:e,interactable:h,extrude:u,position:C,rotation:D,visible:!0,zOrder:S};y&&(s.instancingId=y),O.push(s)}),R&&i){var x=getCenter(f[0]),N={x:.5,y:.5};I&&(N.y=1.25);var v=getSize(f[0]).width/2*.8;3<v&&(v=2.9),O.push({id:c+"_TEXT",type:"TEXT",text:i,position:x,scalar:v,center:N,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(I){var _=getCenter(f[0]),L={x:.5,y:.5};g&&((_=g).z=0),R&&i&&(L.y=.25);var k=3,H=getSize(f[0]);k>H.width?k=H.width-.1:k>H.height&&(k=H.height-.1),O.push({id:c+"_SPRITE",type:"SPRITE",position:_,scalar:1,center:L,style:{img:I,maxWidth:k},interactable:!1})}return O}console.warn("Invalid shapes",JSON.stringify(e))},getExtrude=function(e,t){switch(e){case"CIRCULATE":case"WE":return.1;default:return t}},getZed=function(e,t){switch(e){case"WORK":return 0;case"MEET":return-.01;case"WASH":return-.02;case"OPERATE":return-.03;case"WE":return-(t/2+.01);case"CIRCULATE":return-(t/2+.02);default:return 0}},getColor=function(e){switch(e){case"WORK":return"rgb(171,221,231)";case"CIRCULATE":return"rgb(255,247,223)";case"MEET":return"rgb(183,240,217)";case"WE":return"rgb(255,210,106)";case"OPERATE":return"rgb(226,226,226)";case"WASH":return"rgb(195,195,195)";default:return"rgb(253,235,236)"}},stringArrayToPoints=function(e){if(e&&e.constructor===Array){var t=[];return e.forEach(function(e){e&&e.constructor===Array&&3===e.length&&t.push({x:parseFloat(e[0]),y:parseFloat(e[1]),z:parseFloat(e[2])})}),t}},getImage=function(e,t){var a=null;switch(t.toUpperCase()){case"PHONE BOOTH":a=phoneBooth;break;case"WT":case"NOOK":case"BOOTH":case"BOOTHS":a=nook;break;case"LOUNGE":case"HONESTY MKT":case"HONESTY MARKET":case"PANTRY":case"BAR":case"BEER ISLAND":case"COMMUNITY BAR":case"BEVERAGE ISLAND":case"F&B":case"CATERING KITCHEN":a=pantry;break;case"GAME RM":case"GAME ROOM":case"DART BOARD":a=gameRoom;break;case"WOMEN WC":case"WOMENS WC":case"W RESTROOM":case"RESTROOM":case"UNISEX RESTROOM":case"UNISEX":case"ADA RESTROOM":case"ADA WC":a=women;break;case"MEN WC":case"MENS WC":case"MALE WC":case"M RESTROOM":a=men;break;case"IT":a=itRoom;break;case"PRINTER":case"PRINT":case"PRINTER NOOK":case"PRINTING ALCOVE":a=printer;break;case"MECH":case"MECHANICAL CLOSET":a=mechanical;break;case"STOR":case"STORE":case"STORAGE":case"BIKE STORAGE":case"F&B STORAGE":case"F&B STORAGE":case"CLEANING STORAGE":case"COAT CLOSET":a=storage;break;case"TRASH":case"TRASH ROOM":a=trash;break;case"MOTHER RM":case"MOTHERS ROOM":a=motherRoom;break;case"MAIL":case"MAIL & PACKAGE ROOM":a=mail;break;case"SHOWER":case"SHOWERS":a=shower;break;case"SERVICE LIFT":case"ELEVATOR FOYER":a=serviceLift;break;case"WELLNESS RM":case"WELLNESS ROOM":case"FITNESS RM":a=wellness;break;case"ELEC":case"ELECTRICAL CLOSET":a=electrical;break;case"FIRE":case"FIRE COMMAND CENTER":a=fire;break;case"MOP":case"JC":case"JANITOR":case"MOP CLOSET":a=maintenance;break;case"CONV. BOOTH":a=meeting}if(t.startsWith("IT ")&&(a=itRoom),!a)switch(e){case"MEET":a=meeting}return a},getSize=function(e){for(var t=1/0,a=1/0,s=-1/0,c=-1/0,n=0;n<e.length;n++)t=Math.min(t,e[n].x),a=Math.min(a,e[n].y),s=Math.max(s,e[n].x),c=Math.max(c,e[n].y);return{width:s-t,height:c-a}},applyInstancing=function(s,c){var n=new Map,r=function(){for(var e=0;e<s.length;e++){var t=s[e];if(t.instancingId){var a=n.get(t.instancingId);(a=a||[]).push(t),n.set(t.instancingId,a),s.splice(e,1),r()}}};r(),n.forEach(function(e,t,a){toInstancedMesh(e,t,c)})},toInstancedMesh=function(e,t,a){if(0!==e.length){var s=e[0];if(a.createInstancedMesh({id:t,mesh:{points:s.points,extrude:s.extrude,opacity:s.style?s.style.opacity:1}}),e.forEach(function(e){a.addToInstancedMesh({id:e.id,instancingId:t,style:{color:e.style.color},position:e.position,rotation:e.rotation,interactable:e.interactable,visible:e.visible})}),a.drawInstancedMesh({id:t}),s.style.outline&&s.style.outline.color){var c=t+"_OUTLINE";a.createInstancedMesh({id:c,mesh:{style:{outline:{color:s.style.outline.color,only:!0}},points:s.points,extrude:s.extrude,zOrder:s.zOrder}}),e.forEach(function(e){a.addToInstancedMesh({id:e.id+"_outline",instancingId:c,style:{color:e.style.color},position:e.position,rotation:e.rotation,visible:e.visible})}),a.drawInstancedMesh({id:c})}}},parseUTCDate=function(e){return zonedTimeToUtc(e,"utc")},HOT_DESK_REGEX=/HOT DESK/i,DEDICATED_ROOM_TYPES=["DEDICATED DESK","DEDICATED DESKS","SHARED OFFICE DESK","SHARED OFFICE DESKS"],DEDICATED_ROOM_TYPE_UUID="7c2c9f70-97c5-410b-b3a4-4fe9d1db88f8",HOT_DESK_ROOM_TYPE_UUID="b866ac5b-a1ce-45e0-a274-2137d4a547a1",isHotDeskArea=function(e,t){return void 0===e&&(e=""),void 0===t&&(t=""),t===HOT_DESK_ROOM_TYPE_UUID||Boolean(HOT_DESK_REGEX.exec(e))},isDedicatedDeskRoom=function(e,t){return void 0===e&&(e=""),void 0===t&&(t=""),t===DEDICATED_ROOM_TYPE_UUID||DEDICATED_ROOM_TYPES.includes(e.toUpperCase())};exports.createRenderObjects=createRenderObjects,exports.getCenter=getCenter,exports.getSize=getSize,exports.stringArrayToPoints=stringArrayToPoints,exports.applyInstancing=applyInstancing,exports.parseUTCDate=parseUTCDate,exports.isDedicatedDeskRoom=isDedicatedDeskRoom,exports.isHotDeskArea=isHotDeskArea; | ||
//# sourceMappingURL=floormap-utils.cjs.min.js.map |
import zonedTimeToUtc from 'date-fns-tz/zonedTimeToUtc'; | ||
/* eslint-disable */ | ||
var nook = 'https://cdn.spacemob.co/img/nook@2x.png'; | ||
@@ -109,3 +110,3 @@ var meeting = 'https://cdn.spacemob.co/img/meeting_room@2x.png'; | ||
only: outlineOnly, | ||
color: outlineColor | ||
color: outlineColor, | ||
}; | ||
@@ -115,11 +116,6 @@ | ||
case 'HALLWAY': | ||
case 'LOBBY': | ||
case 'ELEV LOBBY': | ||
outline = null; | ||
break | ||
case 'PHONE BOOTH': | ||
// outlineColor = '#474747' | ||
break | ||
case 'PRINTER': | ||
// outlineColor = '#474747' | ||
break | ||
default: | ||
@@ -130,3 +126,2 @@ break | ||
case 'MEET': | ||
// outlineColor = '#474747' | ||
showRoomNumber = true; | ||
@@ -182,3 +177,3 @@ switch (_subType) { | ||
_rotation = { | ||
z: locationAngle | ||
z: locationAngle, | ||
}; | ||
@@ -209,3 +204,3 @@ _instancingId = instancingId; | ||
outline: outline, | ||
opacity: opacity | ||
opacity: opacity, | ||
}, | ||
@@ -218,3 +213,3 @@ points: points, | ||
visible: true, | ||
zOrder: zOrder | ||
zOrder: zOrder, | ||
}; | ||
@@ -243,3 +238,3 @@ if (_instancingId) { | ||
objects.push({ | ||
id: id + '_TEXT', | ||
id: (id + "_TEXT"), | ||
type: 'TEXT', | ||
@@ -252,5 +247,5 @@ text: roomNumber, | ||
color: 'black', | ||
fontWeight: 'bold' | ||
fontWeight: 'bold', | ||
}, | ||
interactable: false | ||
interactable: false, | ||
}); | ||
@@ -278,3 +273,3 @@ } | ||
objects.push({ | ||
id: id + '_SPRITE', | ||
id: (id + "_SPRITE"), | ||
type: 'SPRITE', | ||
@@ -286,5 +281,5 @@ position: pos$1, | ||
img: img, | ||
maxWidth: maxWidth$1 | ||
maxWidth: maxWidth$1, | ||
}, | ||
interactable: false | ||
interactable: false, | ||
}); | ||
@@ -387,3 +382,3 @@ } | ||
y: parseFloat(b[1]), | ||
z: parseFloat(b[2]) | ||
z: parseFloat(b[2]), | ||
}); | ||
@@ -413,2 +408,5 @@ }); | ||
case 'COMMUNITY BAR': | ||
case 'BEVERAGE ISLAND': | ||
case 'F&B': | ||
case 'CATERING KITCHEN': | ||
img = pantry; | ||
@@ -455,2 +453,3 @@ break | ||
case 'F&B STORAGE': | ||
case 'F\u0026B STORAGE': | ||
case 'CLEANING STORAGE': | ||
@@ -468,5 +467,2 @@ case 'COAT CLOSET': | ||
break | ||
case 'F&B': | ||
img = pantry; | ||
break | ||
case 'MAIL': | ||
@@ -473,0 +469,0 @@ case 'MAIL & PACKAGE ROOM': |
@@ -1,2 +0,2 @@ | ||
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("date-fns-tz/zonedTimeToUtc")):"function"==typeof define&&define.amd?define(["exports","date-fns-tz/zonedTimeToUtc"],a):a(e.FloormapUtils={},e.zonedTimeToUtc)}(this,function(e,a){a=a&&a.hasOwnProperty("default")?a.default:a;function D(e){for(var a=1/0,t=1/0,c=-1/0,s=-1/0,n=0;n<e.length;n++)a=Math.min(a,e[n].x),t=Math.min(t,e[n].y),c=Math.max(c,e[n].x),s=Math.max(s,e[n].y);return{x:(c+a)/2,y:(s+t)/2}}var c="https://cdn.spacemob.co/img/meeting_room@2x.png",s="https://cdn.spacemob.co/img/IT_room@2x.png",n="https://cdn.spacemob.co/img/pantry@2x.png",B=function(e,a){switch(e){case"CIRCULATE":case"WE":return.1;default:return a}},P=function(e,a){switch(e){case"WORK":return 0;case"MEET":return-.01;case"WASH":return-.02;case"OPERATE":return-.03;case"WE":return-(a/2+.01);case"CIRCULATE":return-(a/2+.02);default:return 0}},U=function(e){switch(e){case"WORK":return"rgb(171,221,231)";case"CIRCULATE":return"rgb(255,247,223)";case"MEET":return"rgb(183,240,217)";case"WE":return"rgb(255,210,106)";case"OPERATE":return"rgb(226,226,226)";case"WASH":return"rgb(195,195,195)";default:return"rgb(253,235,236)"}},F=function(e,a){var t=null;switch(a.toUpperCase()){case"PHONE BOOTH":t="https://cdn.spacemob.co/img/phone_booth@2x.png";break;case"WT":case"NOOK":case"BOOTH":case"BOOTHS":t="https://cdn.spacemob.co/img/nook@2x.png";break;case"LOUNGE":case"HONESTY MKT":case"HONESTY MARKET":case"PANTRY":case"BAR":case"BEER ISLAND":case"COMMUNITY BAR":t=n;break;case"GAME RM":case"GAME ROOM":case"DART BOARD":t="https://cdn.spacemob.co/img/gameroom@2x.png";break;case"WOMEN WC":case"WOMENS WC":case"W RESTROOM":case"RESTROOM":case"UNISEX RESTROOM":case"UNISEX":case"ADA RESTROOM":case"ADA WC":t="https://cdn.spacemob.co/img/wc_f@2x.png";break;case"MEN WC":case"MENS WC":case"MALE WC":case"M RESTROOM":t="https://cdn.spacemob.co/img/wc_m@2x.png";break;case"IT":t=s;break;case"PRINTER":case"PRINT":case"PRINTER NOOK":case"PRINTING ALCOVE":t="https://cdn.spacemob.co/img/printer@2x.png";break;case"MECH":case"MECHANICAL CLOSET":t="https://cdn.spacemob.co/img/mechanical@2x.png";break;case"STOR":case"STORE":case"STORAGE":case"BIKE STORAGE":case"F&B STORAGE":case"CLEANING STORAGE":case"COAT CLOSET":t="https://cdn.spacemob.co/img/storage@2x.png";break;case"TRASH":case"TRASH ROOM":t="https://cdn.spacemob.co/img/trash@2x.png";break;case"MOTHER RM":case"MOTHERS ROOM":t="https://cdn.spacemob.co/img/motherroom@2x.png";break;case"F&B":t=n;break;case"MAIL":case"MAIL & PACKAGE ROOM":t="https://cdn.spacemob.co/img/mail_room@2x.png";break;case"SHOWER":case"SHOWERS":t="https://cdn.spacemob.co/img/shower@2x.png";break;case"SERVICE LIFT":case"ELEVATOR FOYER":t="https://cdn.spacemob.co/img/servicelift@2x.png";break;case"WELLNESS RM":case"WELLNESS ROOM":case"FITNESS RM":t="https://cdn.spacemob.co/img/wellnessroom@2x.png";break;case"ELEC":case"ELECTRICAL CLOSET":t="https://cdn.spacemob.co/img/electrical@2x.png";break;case"FIRE":case"FIRE COMMAND CENTER":t="https://cdn.spacemob.co/img/fire_extinguisher@2x.png";break;case"MOP":case"JC":case"JANITOR":case"MOP CLOSET":t="https://cdn.spacemob.co/img/maintenance@2x.png";break;case"CONV. BOOTH":t=c}if(a.startsWith("IT ")&&(t=s),!t)switch(e){case"MEET":t=c}return t},K=function(e){for(var a=1/0,t=1/0,c=-1/0,s=-1/0,n=0;n<e.length;n++)a=Math.min(a,e[n].x),t=Math.min(t,e[n].y),c=Math.max(c,e[n].x),s=Math.max(s,e[n].y);return{width:c-a,height:s-t}},o=function(e,a,t){if(0!==e.length){var c=e[0];if(t.createInstancedMesh({id:a,mesh:{points:c.points,extrude:c.extrude,opacity:c.style?c.style.opacity:1}}),e.forEach(function(e){t.addToInstancedMesh({id:e.id,instancingId:a,style:{color:e.style.color},position:e.position,rotation:e.rotation,interactable:e.interactable,visible:e.visible})}),t.drawInstancedMesh({id:a}),c.style.outline&&c.style.outline.color){var s=a+"_OUTLINE";t.createInstancedMesh({id:s,mesh:{style:{outline:{color:c.style.outline.color,only:!0}},points:c.points,extrude:c.extrude,zOrder:c.zOrder}}),e.forEach(function(e){t.addToInstancedMesh({id:e.id+"_outline",instancingId:s,style:{color:e.style.color},position:e.position,rotation:e.rotation,visible:e.visible})}),t.drawInstancedMesh({id:s})}}},t=/HOT DESK/i,r=["DEDICATED DESK","DEDICATED DESKS","SHARED OFFICE DESK","SHARED OFFICE DESKS"];e.createRenderObjects=function(e){var a,t,s=e.id,c=e.shapes,n=e.type,r=e.subType,o=e.programType,i=e.roomNumber,p=e.hasWindow,E=e.locationAngle,d=e.centroid,l=e.instancingId,O=[];"string"==typeof o&&(a=o.toUpperCase()),"string"==typeof r&&(t=r.toUpperCase());var g="BACK",h="#474747",u=1,T=!0,b=!1,m=B(a,6),R=P(a,6),f=U(a),A=F(a,t),M=0;if("object"===n)switch(t){case"CHAIR":f="rgb(206,206,206)",g="FRONT",R=-(6-(m=1))/2,h="rgb(150,150,150)";break;case"TABLE":case"HOTDESK_TABLE":f="rgb(246,241,241)",g="FRONT",m=.5,R=-1.5,u=.8,h="rgb(150,150,150)",M=1}else"space"===n||"room"===n||console.warn("invalid type:",n);var S={only:!1,color:h};switch(t){case"HALLWAY":case"ELEV LOBBY":S=null}switch(a){case"MEET":switch(b=!0,t){case"NOOK":case"PHONE BOOTH":case"wt":b=!1}break;case"WORK":b=!0,p&&(f="rgb(228,243,247)");break;case"WASH":case"SERVE":break;case"OPERATE":case"WE":break;case"CIRCULATE":S=null;break;default:a&&console.log("invalid programType:",a)}S&&(S.color=h);var I=c,y={z:R},C=null,x=null;if(l&&(d?((y=d).z=R,x=l,T=!(C={z:E})):console.warn("centroid is not available",JSON.stringify(e))),I&&0!==I.length){if(I.forEach(function(e,a){var t=s;0!==a&&(t=s+"/"+a);var c={id:t,type:"MESH",style:{color:f,side:g,outline:S,opacity:u},points:e,interactable:T,extrude:m,position:y,rotation:C,visible:!0,zOrder:M};x&&(c.instancingId=x),O.push(c)}),b&&i){var N=D(I[0]),v={x:.5,y:.5};A&&(v.y=1.25);var L=K(I[0]).width/2*.8;3<L&&(L=2.9),O.push({id:s+"_TEXT",type:"TEXT",text:i,position:N,scalar:L,center:v,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(A){var k=D(I[0]),W={x:.5,y:.5};d&&((k=d).z=0),b&&i&&(W.y=.25);var H=3,w=K(I[0]);H>w.width?H=w.width-.1:H>w.height&&(H=w.height-.1),O.push({id:s+"_SPRITE",type:"SPRITE",position:k,scalar:1,center:W,style:{img:A,maxWidth:H},interactable:!1})}return O}console.warn("Invalid shapes",JSON.stringify(e))},e.getCenter=D,e.getSize=K,e.stringArrayToPoints=function(e){if(e&&e.constructor===Array){var a=[];return e.forEach(function(e){e&&e.constructor===Array&&3===e.length&&a.push({x:parseFloat(e[0]),y:parseFloat(e[1]),z:parseFloat(e[2])})}),a}},e.applyInstancing=function(c,s){var n=new Map,r=function(){for(var e=0;e<c.length;e++){var a=c[e];if(a.instancingId){var t=n.get(a.instancingId);(t=t||[]).push(a),n.set(a.instancingId,t),c.splice(e,1),r()}}};r(),n.forEach(function(e,a,t){o(e,a,s)})},e.parseUTCDate=function(e){return a(e,"utc")},e.isDedicatedDeskRoom=function(e,a){return void 0===e&&(e=""),void 0===a&&(a=""),"7c2c9f70-97c5-410b-b3a4-4fe9d1db88f8"===a||r.includes(e.toUpperCase())},e.isHotDeskArea=function(e,a){return void 0===e&&(e=""),void 0===a&&(a=""),"b866ac5b-a1ce-45e0-a274-2137d4a547a1"===a||Boolean(t.exec(e))},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("date-fns-tz/zonedTimeToUtc")):"function"==typeof define&&define.amd?define(["exports","date-fns-tz/zonedTimeToUtc"],a):a(e.FloormapUtils={},e.zonedTimeToUtc)}(this,function(e,a){a=a&&a.hasOwnProperty("default")?a.default:a;function D(e){for(var a=1/0,t=1/0,c=-1/0,s=-1/0,n=0;n<e.length;n++)a=Math.min(a,e[n].x),t=Math.min(t,e[n].y),c=Math.max(c,e[n].x),s=Math.max(s,e[n].y);return{x:(c+a)/2,y:(s+t)/2}}var c="https://cdn.spacemob.co/img/meeting_room@2x.png",s="https://cdn.spacemob.co/img/IT_room@2x.png",B=function(e,a){switch(e){case"CIRCULATE":case"WE":return.1;default:return a}},F=function(e,a){switch(e){case"WORK":return 0;case"MEET":return-.01;case"WASH":return-.02;case"OPERATE":return-.03;case"WE":return-(a/2+.01);case"CIRCULATE":return-(a/2+.02);default:return 0}},K=function(e){switch(e){case"WORK":return"rgb(171,221,231)";case"CIRCULATE":return"rgb(255,247,223)";case"MEET":return"rgb(183,240,217)";case"WE":return"rgb(255,210,106)";case"OPERATE":return"rgb(226,226,226)";case"WASH":return"rgb(195,195,195)";default:return"rgb(253,235,236)"}},P=function(e,a){var t=null;switch(a.toUpperCase()){case"PHONE BOOTH":t="https://cdn.spacemob.co/img/phone_booth@2x.png";break;case"WT":case"NOOK":case"BOOTH":case"BOOTHS":t="https://cdn.spacemob.co/img/nook@2x.png";break;case"LOUNGE":case"HONESTY MKT":case"HONESTY MARKET":case"PANTRY":case"BAR":case"BEER ISLAND":case"COMMUNITY BAR":case"BEVERAGE ISLAND":case"F&B":case"CATERING KITCHEN":t="https://cdn.spacemob.co/img/pantry@2x.png";break;case"GAME RM":case"GAME ROOM":case"DART BOARD":t="https://cdn.spacemob.co/img/gameroom@2x.png";break;case"WOMEN WC":case"WOMENS WC":case"W RESTROOM":case"RESTROOM":case"UNISEX RESTROOM":case"UNISEX":case"ADA RESTROOM":case"ADA WC":t="https://cdn.spacemob.co/img/wc_f@2x.png";break;case"MEN WC":case"MENS WC":case"MALE WC":case"M RESTROOM":t="https://cdn.spacemob.co/img/wc_m@2x.png";break;case"IT":t=s;break;case"PRINTER":case"PRINT":case"PRINTER NOOK":case"PRINTING ALCOVE":t="https://cdn.spacemob.co/img/printer@2x.png";break;case"MECH":case"MECHANICAL CLOSET":t="https://cdn.spacemob.co/img/mechanical@2x.png";break;case"STOR":case"STORE":case"STORAGE":case"BIKE STORAGE":case"F&B STORAGE":case"F&B STORAGE":case"CLEANING STORAGE":case"COAT CLOSET":t="https://cdn.spacemob.co/img/storage@2x.png";break;case"TRASH":case"TRASH ROOM":t="https://cdn.spacemob.co/img/trash@2x.png";break;case"MOTHER RM":case"MOTHERS ROOM":t="https://cdn.spacemob.co/img/motherroom@2x.png";break;case"MAIL":case"MAIL & PACKAGE ROOM":t="https://cdn.spacemob.co/img/mail_room@2x.png";break;case"SHOWER":case"SHOWERS":t="https://cdn.spacemob.co/img/shower@2x.png";break;case"SERVICE LIFT":case"ELEVATOR FOYER":t="https://cdn.spacemob.co/img/servicelift@2x.png";break;case"WELLNESS RM":case"WELLNESS ROOM":case"FITNESS RM":t="https://cdn.spacemob.co/img/wellnessroom@2x.png";break;case"ELEC":case"ELECTRICAL CLOSET":t="https://cdn.spacemob.co/img/electrical@2x.png";break;case"FIRE":case"FIRE COMMAND CENTER":t="https://cdn.spacemob.co/img/fire_extinguisher@2x.png";break;case"MOP":case"JC":case"JANITOR":case"MOP CLOSET":t="https://cdn.spacemob.co/img/maintenance@2x.png";break;case"CONV. BOOTH":t=c}if(a.startsWith("IT ")&&(t=s),!t)switch(e){case"MEET":t=c}return t},U=function(e){for(var a=1/0,t=1/0,c=-1/0,s=-1/0,n=0;n<e.length;n++)a=Math.min(a,e[n].x),t=Math.min(t,e[n].y),c=Math.max(c,e[n].x),s=Math.max(s,e[n].y);return{width:c-a,height:s-t}},r=function(e,a,t){if(0!==e.length){var c=e[0];if(t.createInstancedMesh({id:a,mesh:{points:c.points,extrude:c.extrude,opacity:c.style?c.style.opacity:1}}),e.forEach(function(e){t.addToInstancedMesh({id:e.id,instancingId:a,style:{color:e.style.color},position:e.position,rotation:e.rotation,interactable:e.interactable,visible:e.visible})}),t.drawInstancedMesh({id:a}),c.style.outline&&c.style.outline.color){var s=a+"_OUTLINE";t.createInstancedMesh({id:s,mesh:{style:{outline:{color:c.style.outline.color,only:!0}},points:c.points,extrude:c.extrude,zOrder:c.zOrder}}),e.forEach(function(e){t.addToInstancedMesh({id:e.id+"_outline",instancingId:s,style:{color:e.style.color},position:e.position,rotation:e.rotation,visible:e.visible})}),t.drawInstancedMesh({id:s})}}},t=/HOT DESK/i,n=["DEDICATED DESK","DEDICATED DESKS","SHARED OFFICE DESK","SHARED OFFICE DESKS"];e.createRenderObjects=function(e){var a,t,s=e.id,c=e.shapes,n=e.type,o=e.subType,r=e.programType,i=e.roomNumber,p=e.hasWindow,E=e.locationAngle,d=e.centroid,l=e.instancingId,O=[];"string"==typeof r&&(a=r.toUpperCase()),"string"==typeof o&&(t=o.toUpperCase());var T="BACK",g="#474747",h=1,u=!0,b=!1,m=B(a,6),R=F(a,6),f=K(a),A=P(a,t),S=0;if("object"===n)switch(t){case"CHAIR":f="rgb(206,206,206)",T="FRONT",R=-(6-(m=1))/2,g="rgb(150,150,150)";break;case"TABLE":case"HOTDESK_TABLE":f="rgb(246,241,241)",T="FRONT",m=.5,R=-1.5,h=.8,g="rgb(150,150,150)",S=1}else"space"===n||"room"===n||console.warn("invalid type:",n);var M={only:!1,color:g};switch(t){case"HALLWAY":case"LOBBY":case"ELEV LOBBY":M=null}switch(a){case"MEET":switch(b=!0,t){case"NOOK":case"PHONE BOOTH":case"wt":b=!1}break;case"WORK":b=!0,p&&(f="rgb(228,243,247)");break;case"WASH":case"SERVE":break;case"OPERATE":case"WE":break;case"CIRCULATE":M=null;break;default:a&&console.log("invalid programType:",a)}M&&(M.color=g);var I=c,y={z:R},C=null,x=null;if(l&&(d?((y=d).z=R,x=l,u=!(C={z:E})):console.warn("centroid is not available",JSON.stringify(e))),I&&0!==I.length){if(I.forEach(function(e,a){var t=s;0!==a&&(t=s+"/"+a);var c={id:t,type:"MESH",style:{color:f,side:T,outline:M,opacity:h},points:e,interactable:u,extrude:m,position:y,rotation:C,visible:!0,zOrder:S};x&&(c.instancingId=x),O.push(c)}),b&&i){var N=D(I[0]),v={x:.5,y:.5};A&&(v.y=1.25);var L=U(I[0]).width/2*.8;3<L&&(L=2.9),O.push({id:s+"_TEXT",type:"TEXT",text:i,position:N,scalar:L,center:v,style:{color:"black",fontWeight:"bold"},interactable:!1})}if(A){var k=D(I[0]),H={x:.5,y:.5};d&&((k=d).z=0),b&&i&&(H.y=.25);var W=3,w=U(I[0]);W>w.width?W=w.width-.1:W>w.height&&(W=w.height-.1),O.push({id:s+"_SPRITE",type:"SPRITE",position:k,scalar:1,center:H,style:{img:A,maxWidth:W},interactable:!1})}return O}console.warn("Invalid shapes",JSON.stringify(e))},e.getCenter=D,e.getSize=U,e.stringArrayToPoints=function(e){if(e&&e.constructor===Array){var a=[];return e.forEach(function(e){e&&e.constructor===Array&&3===e.length&&a.push({x:parseFloat(e[0]),y:parseFloat(e[1]),z:parseFloat(e[2])})}),a}},e.applyInstancing=function(c,s){var n=new Map,o=function(){for(var e=0;e<c.length;e++){var a=c[e];if(a.instancingId){var t=n.get(a.instancingId);(t=t||[]).push(a),n.set(a.instancingId,t),c.splice(e,1),o()}}};o(),n.forEach(function(e,a,t){r(e,a,s)})},e.parseUTCDate=function(e){return a(e,"utc")},e.isDedicatedDeskRoom=function(e,a){return void 0===e&&(e=""),void 0===a&&(a=""),"7c2c9f70-97c5-410b-b3a4-4fe9d1db88f8"===a||n.includes(e.toUpperCase())},e.isHotDeskArea=function(e,a){return void 0===e&&(e=""),void 0===a&&(a=""),"b866ac5b-a1ce-45e0-a274-2137d4a547a1"===a||Boolean(t.exec(e))},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=floormap-utils.umd.min.js.map |
{ | ||
"name": "@wework/floormap-utils", | ||
"version": "1.3.2", | ||
"version": "1.3.3-rc.2+2d895a1", | ||
"jsnext:main": "dist/floormap-utils.es.js", | ||
@@ -51,3 +51,3 @@ "module": "dist/floormap-utils.es.js", | ||
}, | ||
"gitHead": "5935f7d7feaf36feb9592fcb01327179d962e79e" | ||
"gitHead": "2d895a1c3c0a1aa9d3923adee0115b0412cd92d1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99157
1284
4
1