@soonspacejs/plugin-soonmanager2-sync 2.4.6 → 2.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +2 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,c=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}(t,e)||n(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */i=function(){return e};var e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof p?e:p,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=L(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=h(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,a),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f={};function p(){}function d(){}function y(){}var v={};u(v,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(E([])));m&&m!==r&&n.call(m,a)&&(v=m);var b=y.prototype=p.prototype=Object.create(v);function x(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(e,r){function o(i,a,c,s){var u=h(e[i],e,a);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==t(f)&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){o("next",t,c,s)}),(function(t){o("throw",t,c,s)})):r.resolve(f).then((function(t){l.value=t,c(l)}),(function(t){return o("throw",t,c,s)}))}s(u.arg)}var i;this._invoke=function(t,e){function n(){return new r((function(r,n){o(t,e,r,n)}))}return i=i?i.then(n,n):n()}}function L(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,L(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=h(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function E(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return d.prototype=y,u(b,"constructor",y),u(y,"constructor",d),d.displayName=u(y,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,s,"GeneratorFunction")),t.prototype=Object.create(b),t},e.awrap=function(t){return{__await:t}},x(w.prototype),u(w.prototype,c,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new w(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(b),u(b,s,"Generator"),u(b,a,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=E,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}
|
|
1
2
|
/*! *****************************************************************************
|
|
2
3
|
Copyright (c) Microsoft Corporation.
|
|
3
4
|
|
|
@@ -12,4 +13,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
12
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
15
|
***************************************************************************** */
|
|
15
|
-
function
|
|
16
|
+
function c(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function c(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,c)}s((n=n.apply(t,e||[])).next())}))}var s,u,l;!function(t){t.Sbm="Sbm",t.Model="Model",t.Poi="Poi",t.Point="Point",t.Line="Line",t.Polygon="Polygon",t.Circle="Circle",t.Grid="Grid",t.Ground="Ground",t.Light="Light"}(s||(s={})),function(t){t.Model="model",t.MarkPoint="markPoint",t.BaseObject="baseObject",t.Topology="topology",t.Light="light",t.Effect="effect"}(u||(u={})),function(t){t.SimpleModel="simpleModel",t.GroupModel="groupModel",t.Point="point",t.Line="line",t.Polygon="polygon",t.AmbientLight="ambientLight",t.DirectionalLight="directionalLight",t.HemisphereLight="hemisphereLight"}(l||(l={}));var h=function(t){var e;if(!t)return{};try{return null!==(e=JSON.parse(t))&&void 0!==e?e:{}}catch(t){return{}}},f=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ssp=e,this.baseUrl="",this.spaceData=null,this.lightData=null,this.spaceTreeData=null}var n,o,f;return n=t,(o=[{key:"setBaseUrl",value:function(t){this.baseUrl=t}},{key:"syncLight",value:function(){return c(this,void 0,void 0,i().mark((function t(){var e,r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getData("/data/light.json");case 2:if(this.lightData=t.sent,this.lightData&&this.lightData.length){t.next=5;break}return t.abrupt("return");case 5:(e=this.ssp).removeLightById("defaultAmbientLight"),e.removeLightById("defaultDirectionalLight"),e.removeLightById("defaultHemisphereLight"),null==(r=this.lightData)||r.forEach((function(t){var r=t.spaceObjectDto;if(r&&r.templateAggregateDto.firstClassify===u.Light){var n=h(r.attribute);n.id=t.id,n.position&&(n.position=h(n.position)),n.target&&(n.target=h(n.target)),r.templateAggregateDto.secondClassify===l.AmbientLight?e.getLightById(n.id)?e.setAmbientLight(n):e.createAmbientLight(n):r.templateAggregateDto.secondClassify===l.DirectionalLight?e.getLightById(n.id)?e.setDirectionalLight(n):e.createDirectionalLight(n):r.templateAggregateDto.secondClassify===l.HemisphereLight&&(e.getLightById(n.id)?e.setHemisphereLight(n):e.createHemisphereLight(n))}}));case 11:case"end":return t.stop()}}),t,this)})))}},{key:"loadScene",value:function(t){var e;return c(this,void 0,void 0,i().mark((function r(){var n,o,a=this;return i().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t){r.next=4;break}this.spaceData=t,r.next=7;break;case 4:return r.next=6,this.getData();case 6:this.spaceData=r.sent;case 7:if(this.spaceTreeData=this.spaceData2SpaceTreeData(this.spaceData),null===(e=this.spaceTreeData)||void 0===e?void 0:e.length){r.next=10;break}return r.abrupt("return");case 10:return n=this.spaceTreeData,o=function t(e){return c(a,void 0,void 0,i().mark((function r(){var n,o,a,c;return i().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(o=e.pid,a=e.sceneType,!(c=this.formatSpaceDataByType(e))){r.next=45;break}if(a!==s.Sbm){r.next=14;break}if(!this.ssp.getSbmGroupById(o)){r.next=10;break}return r.next=8,this.ssp.addSbmForGroup(o,[c]);case 8:r.next=12;break;case 10:return r.next=12,this.ssp.loadSbmToGroup({id:o},[c]);case 12:r.next=45;break;case 14:if(a!==s.Model){r.next=25;break}if(!this.ssp.getModelGroupById(o)){r.next=21;break}return r.next=19,this.ssp.addModelForGroup(o,[c]);case 19:r.next=23;break;case 21:return r.next=23,this.ssp.loadModelToGroup({id:o},[c]);case 23:r.next=45;break;case 25:if(a!==s.Poi){r.next=36;break}if(!this.ssp.getPoiGroupById(o)){r.next=32;break}return r.next=30,this.ssp.addPoiForGroup(o,[c]);case 30:r.next=34;break;case 32:return r.next=34,this.ssp.createPoiToGroup({id:o},[c]);case 34:r.next=45;break;case 36:if(a!==s.Point&&a!==s.Line&&a!==s.Polygon){r.next=45;break}if(!this.ssp.getCanvas3DGroupById(o)){r.next=43;break}return r.next=41,this.ssp.addCanvas3DForGroup(o,[c]);case 41:r.next=45;break;case 43:return r.next=45,this.ssp.createCanvas3DToGroup({id:o},[c]);case 45:if(!(null===(n=e.children)||void 0===n?void 0:n.length)){r.next=48;break}return r.next=48,Promise.allSettled(e.children.map((function(e){return t(e)})));case 48:case"end":return r.stop()}}),r,this)})))},r.next=14,Promise.allSettled(n.map((function(t){return o(t)})));case 14:case"end":return r.stop()}}),r,this)})))}},{key:"getData",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/data/space.json";return fetch("".concat(this.baseUrl).concat(e)).then((function(t){return t.json()})).then((function(e){return c(t,void 0,void 0,i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e);case 1:case"end":return t.stop()}}),t)})))}))}},{key:"spaceData2SpaceTreeData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.spaceData,e=[],n=[];if(t){var o=r(t);o.forEach((function(t){n.includes(t.id)||n.push(t.id)})),o.forEach((function(t){n.includes(t.pid)||e.push(Object.assign({},t))})),e.forEach((function(t){var e=o.findIndex((function(e){return e.id===t.id}));-1!==e&&o.splice(e,1)}));var i=function t(e,r){var n=[];e.forEach((function(t){t.pid===r.id&&n.push(t)})),n.length>0&&(r.children=n,n.forEach((function(r){return t(e,r)})))};e.forEach((function(t){return i(o,t)}))}return e}},{key:"formatSpaceDataByType",value:function(t){var r;if(t.sceneType){var n=t.id,o=t.name,i=t.sceneType,a=t.spaceObjectDto,c=t.position,u=(c=void 0===c?{}:c).coordinates,l=this.ssp.utils.deg2Euler,f=null!=a?a:{},p=f.attribute,d=f.templateAggregateDto,y=(null!=d?d:{}).fileResourceBaseDto,v=e(null!=u?u:[],3),g=v[0],m=void 0===g?0:g,b=v[1],x=void 0===b?0:b,w=v[2],L=void 0===w?0:w,D=h(p),k=D.rotation,S=void 0===k?{}:k,E=D.scale,j=void 0===E?{}:E,P=D.configAttribute,O=void 0===P?{}:P,G=S.x,T=void 0===G?0:G,A=S.y,I=void 0===A?0:A,B=S.z,_=void 0===B?0:B,z=j.x,M=void 0===z?1:z,C=j.y,F=void 0===C?1:C,N=j.z,U=void 0===N?1:N,H=null!==(r=null==y?void 0:y.path)&&void 0!==r?r:"";return i===s.Sbm||i===s.Model||i===s.Poi?{id:n,name:o,url:"".concat(this.baseUrl).concat(H),position:{x:m,y:x,z:L},rotation:{x:l(T),y:l(I),z:l(_)},scale:{x:M,y:F,z:U},userData:Object.assign({},t)}:i===s.Point?{id:n,name:o,points:[Object.assign({id:n,position:{x:m,y:x,z:L},rotation:{x:l(T),y:l(I),z:l(_)},scale:{x:M,y:F,z:U}},O)],userData:Object.assign({},t)}:i===s.Line?{id:n,name:o,lines:[Object.assign({id:n,position:{x:m,y:x,z:L},rotation:{x:l(T),y:l(I),z:l(_)},scale:{x:M,y:F,z:U}},O)],userData:Object.assign({},t)}:i===s.Polygon?{id:n,name:o,polygons:[Object.assign({id:n,position:{x:m,y:x,z:L},rotation:{x:l(T),y:l(I),z:l(_)},scale:{x:M,y:F,z:U}},O)],userData:Object.assign({},t)}:void s.Circle}}}])&&a(n.prototype,o),f&&a(n,f),Object.defineProperty(n,"prototype",{writable:!1}),t}();export{f as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-soonmanager2-sync",
|
|
3
3
|
"pluginName": "Soonmanager2SyncPlugin",
|
|
4
|
-
"version": "2.4.
|
|
4
|
+
"version": "2.4.9",
|
|
5
5
|
"description": "Sync soonmanager 2.x data plugin for SoonSpace.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
],
|
|
14
14
|
"author": "xuek",
|
|
15
15
|
"license": "UNLICENSED",
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "bc38cb459b7cd6894e492ffea333465fe423cdc5"
|
|
17
17
|
}
|