@realsee/five 6.8.0-alpha.17 → 6.8.0-alpha.19

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/vue/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 3/13/2026
5
- * Version: 6.8.0-alpha.17
4
+ * Generated: 3/18/2026
5
+ * Version: 6.8.0-alpha.19
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -252,4 +252,4 @@
252
252
  * No amendment to or modification of this Agreement will be binding unless in
253
253
  * writing and signed by Realsee. You and Realsee hereto confirm that this
254
254
  * Agreement and all related documents shall be drafted in English.
255
- */"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),F=require("@realsee/five"),B=require("three");function O(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const c=O(B);var g=function(){return g=Object.assign||function(r){for(var n,o=1,a=arguments.length;o<a;o++){n=arguments[o];for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(r[u]=n[u])}return r},g.apply(this,arguments)};var j=!1;function P(e){j=e}var E=Symbol();function l(){var e=t.inject(E);if(!e)throw new Error("Inject five error!");return e}var x={display:"inline-block",overflow:"hidden"},U=t.defineComponent({props:{width:{type:Number,required:!0},height:{type:Number,required:!0}},setup:function(e){var r=t.toRef(e,"width"),n=t.toRef(e,"height"),o=l(),a=t.ref(null);return t.watch([r,n,a],function(){if(o.renderer&&a.value){if(o.renderer.domElement.parentNode!==null&&o.renderer.domElement.parentNode!==a.value)throw new Error("There are more than 2 fiveCanvas in this context.");o.renderer.domElement.parentNode!==a.value&&a.value.appendChild(o.renderer.domElement),o.camera.aspect=r.value/n.value,o.camera.updateProjectionMatrix(),o.renderer.setSize(r.value,n.value),o.refresh({width:r.value,height:n.value}),o.needsRender=!0}}),function(){return t.h("div",{id:"five",style:g({width:"".concat(r.value,"px"),height:"".concat(n.value,"px")},x),ref:a})}}}),h=[],w=[];function W(e){var r=e===void 0?{}:e,n=r.backgroundColor,o=n===void 0?1579548:n,a=r.backgroundAlpha,u=a===void 0?1:a,i=r.preserveDrawingBuffer,v=i===void 0?!0:i,f=r.pixelRatio,d=f===void 0?1:f,m=r.webgl2,p=m===void 0?!1:m;if(typeof window!="undefined"){var s=null;if(p?s=h.shift():s=w.shift(),!s){if(p){var b=document.createElement("canvas"),C=b.getContext("webgl2");C?s=new c.WebGLRenderer({preserveDrawingBuffer:v,antialias:!0,alpha:!0,stencil:!0,canvas:b,context:C}):(console.error("error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl."),s=new c.WebGLRenderer({preserveDrawingBuffer:v,antialias:!1,alpha:!0,stencil:!0}))}else s=new c.WebGLRenderer({preserveDrawingBuffer:v,antialias:!1,alpha:!0,stencil:!0});s.outputEncoding=c.sRGBEncoding}return s.setPixelRatio(d),s.setClearColor(o,u),s.autoClear=!0,s}}function _(e){if(e){var r=e.capabilities.isWebGL2;r?w.indexOf(e)===-1&&w.push(e):h.indexOf(e)===-1&&h.push(e)}}function A(e,r){var n=Array.isArray(e)?e:[e],o=Array.isArray(r)?r:[r];if(n.length!==o.length)return!1;for(var a=0;a<n.length;a++)if(n[a]!==o[a])return!1;return!0}var D=t.defineComponent({props:{works:Object,initialWorks:Object,initialState:Object,initialUserAction:Boolean,onWorksChange:Function,onStateChange:Function,onCurrentStateChange:Function,onError:Function,fiveInitArgs:{type:Object,default:function(){return{}}},style:Object},setup:function(e){var r,n=t.toRefs(e).works,o=F.getViewportScale(),a=o===1?window.devicePixelRatio:1,u=W({pixelRatio:a}),i=new F.Five(g({renderer:u},e.fiveInitArgs)),v=e.works||e.initialWorks;return v&&i.load(v,e.initialState,void 0,(r=e.initialUserAction)!==null&&r!==void 0?r:!0),P(!!e.works),n&&t.watch(n,function(f,d){f&&!A(f,i.works)&&i.load(f,e.initialState)}),t.onBeforeUnmount(function(){i&&(i.dispose(),_(i.renderer))}),i.on("load",function(){e.onWorksChange&&i.works&&e.onWorksChange(i==null?void 0:i.works)}),i.on("stateChange",function(f,d){e.onStateChange&&e.onStateChange(f,d)}),i.on("currentStateChange",function(f,d){e.onCurrentStateChange&&e.onCurrentStateChange(f,d)}),i.on("error",function(f){e.onError?e.onError(f):console.warn(f.message)}),t.provide(E,i),{five:t.shallowReadonly(i)}},render:function(){return t.h("div",{style:this.$props.style},this.$slots)}});function L(){var e=l(),r=t.ref(e.works),n=t.readonly(r),o=function(u,i,v,f){if(j)throw new Error("props 'work' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.");return e.load(u,i,v,f)},a=e.on("load",function(){r.value=e.works});return t.onBeforeUnmount(function(){a()}),[n,o]}function I(){var e=l(),r=t.ref(g({},e.state)),n=e.on("stateChange",function(a){Object.assign(r.value,g({},a))});t.onBeforeUnmount(function(){n()});var o=function(a,u,i){u===void 0&&(u=!1),i===void 0&&(i=!0);var v=typeof a=="function"?a(e.getCurrentState()):a;e.setState(v,u,i)};return[r,o]}function V(){var e=l(),r=t.ref(e.getCurrentState()),n=e.on("currentStateChange",function(){Object.assign(r.value,e.getCurrentState())});t.onBeforeUnmount(function(){n()});var o=function(a,u,i){var v=typeof a=="function"?a(e.getCurrentState()):a;e.setState(v,u,i)};return[r,o]}function H(){var e=l(),r=t.reactive(e.getCurrentState()),n=t.ref(e.works.getObserver(e.pano)),o=e.on("currentStateChange",function(){Object.assign(r,e.getCurrentState()),n.value=e.works.getObserver({workCode:r.workCode,panoIndex:r.panoIndex})});return t.onBeforeUnmount(function(){o()}),n}function M(e,r){var n=l(),o=n.on(e,r);t.onBeforeUnmount(function(){o()})}function q(){var e=l(),r=function(v,f){return e.updateCamera(v,f)},n=e.getPixels.bind(e),o=function(v){return e.render(v)},a=function(){return e.needsRender=!0},u=function(v,f){return e.preloadPano(v,f)},i=function(v,f){return f===void 0&&(f=!1),e.project2d(v,f)};return{updateCamera:r,getPixels:n,render:o,needsRender:a,preloadPano:u,project2d:i}}function N(e,r){r===void 0&&(r=!1);var n=l(),o=t.ref(Symbol()),a=t.shallowRef(e?n.project2d(t.isRef(e)?e.value:e,r):null),u=n.on("cameraUpdate",function(){o.value=Symbol()});return t.onBeforeUnmount(function(){u()}),t.watch([o,e],function(){a.value=n.project2d(t.isRef(e)?e.value:e,r)}),a}function G(){return N}function y(e){var r=e.camera.getWorldDirection(new c.Vector3),n=new c.Raycaster(e.camera.position,r);return n}function T(){var e=l(),r=t.shallowRef(y(e)),n=e.on("cameraUpdate",function(){r.value=y(e)});return t.onBeforeUnmount(function(){n()}),r}function S(e){return e.camera.getWorldDirection(new c.Vector3)}function $(){var e=l(),r=t.shallowRef(S(e)),n=e.on("cameraUpdate",function(){r.value=S(e)});return t.onBeforeUnmount(function(){n()}),r}function z(e){var r=l(),n=t.shallowRef([]);return t.watch(e,function(){n.value=r.model.intersectRaycaster(t.isRef(e)?e.value:e)}),n}function K(){return z}function R(e){return e.model.empty?"Empty":"Loaded"}function J(){var e=l(),r=t.ref(R(e)),n=e.on("modelLoaded",function(){r.value=R(e)});return t.onBeforeUnmount(function(){n()}),r}function Q(){var e=l(),r=t.ref(e.model.shownFloor),n=t.ref(e.model.floorLength),o=function(u){typeof u=="number"?e.model.show(u):e.model.show()},a=[];return a.push(e.on("modelShownFloorChange",function(){r.value=e.model.shownFloor})),a.push(e.on("modelLoaded",function(){n.value=e.model.floorLength})),t.onBeforeUnmount(function(){for(var u;u=a.shift();)u()}),[r,n,o]}function X(){var e=l(),r=t.ref(e.helperVisible),n=function(a){e.helperVisible=a},o=e.on("helpersVisibleChange",function(a){r.value=a});return t.onBeforeUnmount(function(){o()}),[r,n]}function Y(){return l()}function k(e){return e.model.bounding.clone()}function Z(){var e=l(),r=t.shallowRef(k(e)),n=e.on("modelLoaded",function(){r.value=k(e)});return t.onBeforeUnmount(function(){n()}),r}function ee(){var e=l();return e.scene}function re(){var e=l(),r=t.shallowRef(e.model),n=e.on("modelLoaded",function(){r.value=e.model});return t.onBeforeUnmount(function(){n()}),r}exports.FiveCanvas=U;exports.FiveProvider=D;exports.unsafe__useFiveInject=Y;exports.useFiveAction=q;exports.useFiveCameraDirection=$;exports.useFiveCameraRaycaster=T;exports.useFiveCurrentObserver=H;exports.useFiveCurrentState=V;exports.useFiveEventCallback=M;exports.useFiveFloor=Q;exports.useFiveHelper=X;exports.useFiveModel=re;exports.useFiveModelBounding=Z;exports.useFiveModelIntersectRaycaster=K;exports.useFiveModelReadyState=J;exports.useFiveProject2d=G;exports.useFiveScene=ee;exports.useFiveState=I;exports.useFiveWorks=L;
255
+ */Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`vue`),l=require(`@realsee/five`),u=require(`three`);u=s(u);var d=!1;function f(e){d=e}var p=Symbol();function m(){let e=(0,c.inject)(p);if(!e)throw Error(`Inject five error!`);return e}var h={display:`inline-block`,overflow:`hidden`},g=(0,c.defineComponent)({props:{width:{type:Number,required:!0},height:{type:Number,required:!0}},setup(e){let t=(0,c.toRef)(e,`width`),n=(0,c.toRef)(e,`height`),r=m(),i=(0,c.ref)(null);return(0,c.watch)([t,n,i],()=>{if(r.renderer&&i.value){if(r.renderer.domElement.parentNode!==null&&r.renderer.domElement.parentNode!==i.value)throw Error(`There are more than 2 fiveCanvas in this context.`);r.renderer.domElement.parentNode!==i.value&&i.value.appendChild(r.renderer.domElement),r.camera.aspect=t.value/n.value,r.camera.updateProjectionMatrix(),r.renderer.setSize(t.value,n.value),r.refresh({width:t.value,height:n.value}),r.needsRender=!0}}),()=>(0,c.h)(`div`,{id:`five`,style:Object.assign({width:`${t.value}px`,height:`${n.value}px`},h),ref:i})}}),_=[],v=[];function y({backgroundColor:e=1579548,backgroundAlpha:t=1,preserveDrawingBuffer:n=!0,pixelRatio:r=1,webgl2:i=!1}={}){if(typeof window>`u`)return;let a=null;if(a=i?_.shift():v.shift(),!a){if(i){let e=document.createElement(`canvas`),t=e.getContext(`webgl2`);t?a=new u.WebGLRenderer({preserveDrawingBuffer:n,antialias:!0,alpha:!0,stencil:!0,canvas:e,context:t}):(console.error(`error occurred when getting webgl2 canvas context, mybe webgl2 not support, fallback to webgl.`),a=new u.WebGLRenderer({preserveDrawingBuffer:n,antialias:!1,alpha:!0,stencil:!0}))}else a=new u.WebGLRenderer({preserveDrawingBuffer:n,antialias:!1,alpha:!0,stencil:!0});a.outputEncoding=u.sRGBEncoding}return a.setPixelRatio(r),a.setClearColor(e,t),a.autoClear=!0,a}function b(e){e&&(e.capabilities.isWebGL2?v.indexOf(e)===-1&&v.push(e):_.indexOf(e)===-1&&_.push(e))}function x(e,t){let n=Array.isArray(e)?e:[e],r=Array.isArray(t)?t:[t];if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}var S=(0,c.defineComponent)({props:{works:Object,initialWorks:Object,initialState:Object,initialUserAction:Boolean,onWorksChange:Function,onStateChange:Function,onCurrentStateChange:Function,onError:Function,fiveInitArgs:{type:Object,default:()=>({})},style:Object},setup(e){var t;let{works:n}=(0,c.toRefs)(e),r=y({pixelRatio:(0,l.getViewportScale)()===1?window.devicePixelRatio:1}),i=new l.Five(Object.assign({renderer:r},e.fiveInitArgs)),a=e.works||e.initialWorks;return a&&i.load(a,e.initialState,void 0,(t=e.initialUserAction)==null?!0:t),f(!!e.works),n&&(0,c.watch)(n,(t,n)=>{t&&!x(t,i.works)&&i.load(t,e.initialState)}),(0,c.onBeforeUnmount)(()=>{i&&(i.dispose(),b(i.renderer))}),i.on(`load`,()=>{e.onWorksChange&&i.works&&e.onWorksChange(i==null?void 0:i.works)}),i.on(`stateChange`,(t,n)=>{e.onStateChange&&e.onStateChange(t,n)}),i.on(`currentStateChange`,(t,n)=>{e.onCurrentStateChange&&e.onCurrentStateChange(t,n)}),i.on(`error`,t=>{e.onError?e.onError(t):console.warn(t.message)}),(0,c.provide)(p,i),{five:(0,c.shallowReadonly)(i)}},render(){return(0,c.h)(`div`,{style:this.$props.style},this.$slots)}});function C(){let e=m(),t=(0,c.ref)(e.works),n=(0,c.readonly)(t),r=(t,n,r,i)=>{if(d)throw Error(`props 'work' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.`);return e.load(t,n,r,i)},i=e.on(`load`,()=>{t.value=e.works});return(0,c.onBeforeUnmount)(()=>{i()}),[n,r]}function w(){let e=m(),t=(0,c.ref)(Object.assign({},e.state)),n=e.on(`stateChange`,e=>{Object.assign(t.value,Object.assign({},e))});return(0,c.onBeforeUnmount)(()=>{n()}),[t,(t,n=!1,r=!0)=>{let i=typeof t==`function`?t(e.getCurrentState()):t;e.setState(i,n,r)}]}function T(){let e=m(),t=(0,c.ref)(e.getCurrentState()),n=e.on(`currentStateChange`,()=>{Object.assign(t.value,e.getCurrentState())});return(0,c.onBeforeUnmount)(()=>{n()}),[t,(t,n,r)=>{let i=typeof t==`function`?t(e.getCurrentState()):t;e.setState(i,n,r)}]}function E(){let e=m(),t=(0,c.reactive)(e.getCurrentState()),n=(0,c.ref)(e.works.getObserver(e.pano)),r=e.on(`currentStateChange`,()=>{Object.assign(t,e.getCurrentState()),n.value=e.works.getObserver({workCode:t.workCode,panoIndex:t.panoIndex})});return(0,c.onBeforeUnmount)(()=>{r()}),n}function D(e,t){let n=m().on(e,t);(0,c.onBeforeUnmount)(()=>{n()})}function O(){let e=m();return{updateCamera:(t,n)=>e.updateCamera(t,n),getPixels:e.getPixels.bind(e),render:t=>e.render(t),needsRender:()=>e.needsRender=!0,preloadPano:(t,n)=>e.preloadPano(t,n),project2d:(t,n=!1)=>e.project2d(t,n)}}function k(e,t=!1){let n=m(),r=(0,c.ref)(Symbol()),i=(0,c.shallowRef)(e?n.project2d((0,c.isRef)(e)?e.value:e,t):null),a=n.on(`cameraUpdate`,()=>{r.value=Symbol()});return(0,c.onBeforeUnmount)(()=>{a()}),(0,c.watch)([r,e],()=>{i.value=n.project2d((0,c.isRef)(e)?e.value:e,t)}),i}function A(){return k}function j(e){let t=e.camera.getWorldDirection(new u.Vector3);return new u.Raycaster(e.camera.position,t)}function M(){let e=m(),t=(0,c.shallowRef)(j(e)),n=e.on(`cameraUpdate`,()=>{t.value=j(e)});return(0,c.onBeforeUnmount)(()=>{n()}),t}function N(e){return e.camera.getWorldDirection(new u.Vector3)}function P(){let e=m(),t=(0,c.shallowRef)(N(e)),n=e.on(`cameraUpdate`,()=>{t.value=N(e)});return(0,c.onBeforeUnmount)(()=>{n()}),t}function F(e){let t=m(),n=(0,c.shallowRef)([]);return(0,c.watch)(e,()=>{n.value=t.model.intersectRaycaster((0,c.isRef)(e)?e.value:e)}),n}function I(){return F}function L(e){return e.model.empty?`Empty`:`Loaded`}function R(){let e=m(),t=(0,c.ref)(L(e)),n=e.on(`modelLoaded`,()=>{t.value=L(e)});return(0,c.onBeforeUnmount)(()=>{n()}),t}function z(){let e=m(),t=(0,c.ref)(e.model.shownFloor),n=(0,c.ref)(e.model.floorLength),r=t=>{typeof t==`number`?e.model.show(t):e.model.show()},i=[];return i.push(e.on(`modelShownFloorChange`,()=>{t.value=e.model.shownFloor})),i.push(e.on(`modelLoaded`,()=>{n.value=e.model.floorLength})),(0,c.onBeforeUnmount)(()=>{let e;for(;e=i.shift();)e()}),[t,n,r]}function B(){let e=m(),t=(0,c.ref)(e.helperVisible),n=t=>{e.helperVisible=t},r=e.on(`helpersVisibleChange`,e=>{t.value=e});return(0,c.onBeforeUnmount)(()=>{r()}),[t,n]}function V(){return m()}function H(e){return e.model.bounding.clone()}function U(){let e=m(),t=(0,c.shallowRef)(H(e)),n=e.on(`modelLoaded`,()=>{t.value=H(e)});return(0,c.onBeforeUnmount)(()=>{n()}),t}function W(){return m().scene}function G(){let e=m(),t=(0,c.shallowRef)(e.model),n=e.on(`modelLoaded`,()=>{t.value=e.model});return(0,c.onBeforeUnmount)(()=>{n()}),t}exports.FiveCanvas=g,exports.FiveProvider=S,exports.unsafe__useFiveInject=V,exports.useFiveAction=O,exports.useFiveCameraDirection=P,exports.useFiveCameraRaycaster=M,exports.useFiveCurrentObserver=E,exports.useFiveCurrentState=T,exports.useFiveEventCallback=D,exports.useFiveFloor=z,exports.useFiveHelper=B,exports.useFiveModel=G,exports.useFiveModelBounding=U,exports.useFiveModelIntersectRaycaster=I,exports.useFiveModelReadyState=R,exports.useFiveProject2d=A,exports.useFiveScene=W,exports.useFiveState=w,exports.useFiveWorks=C;