@roomle/embedding-lib 5.15.0 → 5.16.0-alpha.2
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/docs/md/web/embedding/CHANGELOG.md +11 -45
- package/{drag-in-C6gLvrDx.mjs → drag-in-D5QSQ86J.mjs} +2 -2
- package/drag-in-DNbVoUkq.mjs +1 -0
- package/{from-custom-view-BEcgFlAL.mjs → from-custom-view-BcXfK7VI.mjs} +1 -1
- package/from-custom-view-BrrXfWzP.mjs +1 -0
- package/{from-website-VCMg3teu.mjs → from-website-B3kPg18n.mjs} +10 -10
- package/from-website-BOvSwnL1.mjs +1 -0
- package/package.json +2 -2
- package/packages/build-tools/src/vite-minify.d.ts +1 -1
- package/roomle-embedding-lib.es.js +14 -14
- package/roomle-embedding-lib.es.min.js +1 -8
- package/roomle-embedding-lib.umd.js +4 -4
- package/roomle-embedding-lib.umd.min.js +1 -17
- package/src/common/components/collection-view/-utils/collection-view-dynamic-components.d.ts +5 -0
- package/src/common/components/collection-view/CollectionViewElement.vue.d.ts +45 -209
- package/src/common/utils/parameters.d.ts +3 -0
- package/src/configurator/components/grid-view/-utils/GridViewElement.vue.d.ts +10 -1
- package/src/configurator/components/grid-view/-utils/GridViewHelper.d.ts +17 -2
- package/src/configurator/components/grid-view/-utils/GridViewMaterialElement.vue.d.ts +1 -2
- package/src/configurator/components/parameters/types/DisabledParameters.vue.d.ts +8 -0
- package/src/configurator/components/utils/WordWrap.vue.d.ts +11 -0
- package/src/configurator/embedding/types.d.ts +3 -1
- package/src/planner/business-logic/sdk-connector-planner.d.ts +0 -1
- package/src/planner/components/overlays/rooms/DoorParametersSetting.vue.d.ts +12 -12
- package/src/planner/components/overlays/rooms/FloorColor.vue.d.ts +12 -12
- package/src/planner/utils/planner-sidebar.d.ts +10 -0
- package/touch-drag-BYVdETHB.mjs +1 -0
- package/drag-in-w_TrusdP.mjs +0 -7
- package/from-custom-view-jmf3K6AT.mjs +0 -1
- package/from-website-Ckh5GB2h.mjs +0 -4
- package/touch-drag-C1SsZtt4.mjs +0 -1
|
@@ -2410,9 +2410,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
2410
2410
|
isGridViewExpanded: {
|
|
2411
2411
|
type: PropType<boolean>;
|
|
2412
2412
|
};
|
|
2413
|
-
noHeightWrapper: {
|
|
2414
|
-
type: PropType<boolean>;
|
|
2415
|
-
};
|
|
2416
2413
|
onDoCollapse: {
|
|
2417
2414
|
type: PropType<() => void>;
|
|
2418
2415
|
};
|
|
@@ -2429,6 +2426,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
2429
2426
|
type: PropType<boolean>;
|
|
2430
2427
|
default: boolean;
|
|
2431
2428
|
};
|
|
2429
|
+
noHeightWrapper: {
|
|
2430
|
+
type: PropType<boolean>;
|
|
2431
|
+
};
|
|
2432
2432
|
componentIcon: {
|
|
2433
2433
|
type: PropType<import('../../../../common/components/collection-view/-utils/types').CollectionViewComponentIcon<Record<string, any>>>;
|
|
2434
2434
|
};
|
|
@@ -2496,9 +2496,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
2496
2496
|
isGridViewExpanded: {
|
|
2497
2497
|
type: PropType<boolean>;
|
|
2498
2498
|
};
|
|
2499
|
-
noHeightWrapper: {
|
|
2500
|
-
type: PropType<boolean>;
|
|
2501
|
-
};
|
|
2502
2499
|
onDoCollapse: {
|
|
2503
2500
|
type: PropType<() => void>;
|
|
2504
2501
|
};
|
|
@@ -2515,6 +2512,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
2515
2512
|
type: PropType<boolean>;
|
|
2516
2513
|
default: boolean;
|
|
2517
2514
|
};
|
|
2515
|
+
noHeightWrapper: {
|
|
2516
|
+
type: PropType<boolean>;
|
|
2517
|
+
};
|
|
2518
2518
|
componentIcon: {
|
|
2519
2519
|
type: PropType<import('../../../../common/components/collection-view/-utils/types').CollectionViewComponentIcon<Record<string, any>>>;
|
|
2520
2520
|
};
|
|
@@ -2597,9 +2597,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
2597
2597
|
isGridViewExpanded: {
|
|
2598
2598
|
type: PropType<boolean>;
|
|
2599
2599
|
};
|
|
2600
|
-
noHeightWrapper: {
|
|
2601
|
-
type: PropType<boolean>;
|
|
2602
|
-
};
|
|
2603
2600
|
onDoCollapse: {
|
|
2604
2601
|
type: PropType<() => void>;
|
|
2605
2602
|
};
|
|
@@ -2616,6 +2613,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
2616
2613
|
type: PropType<boolean>;
|
|
2617
2614
|
default: boolean;
|
|
2618
2615
|
};
|
|
2616
|
+
noHeightWrapper: {
|
|
2617
|
+
type: PropType<boolean>;
|
|
2618
|
+
};
|
|
2619
2619
|
componentIcon: {
|
|
2620
2620
|
type: PropType<import('../../../../common/components/collection-view/-utils/types').CollectionViewComponentIcon<Record<string, any>>>;
|
|
2621
2621
|
};
|
|
@@ -2695,9 +2695,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
2695
2695
|
isGridViewExpanded: {
|
|
2696
2696
|
type: PropType<boolean>;
|
|
2697
2697
|
};
|
|
2698
|
-
noHeightWrapper: {
|
|
2699
|
-
type: PropType<boolean>;
|
|
2700
|
-
};
|
|
2701
2698
|
onDoCollapse: {
|
|
2702
2699
|
type: PropType<() => void>;
|
|
2703
2700
|
};
|
|
@@ -2714,6 +2711,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
2714
2711
|
type: PropType<boolean>;
|
|
2715
2712
|
default: boolean;
|
|
2716
2713
|
};
|
|
2714
|
+
noHeightWrapper: {
|
|
2715
|
+
type: PropType<boolean>;
|
|
2716
|
+
};
|
|
2717
2717
|
componentIcon: {
|
|
2718
2718
|
type: PropType<import('../../../../common/components/collection-view/-utils/types').CollectionViewComponentIcon<Record<string, any>>>;
|
|
2719
2719
|
};
|
|
@@ -1282,9 +1282,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1282
1282
|
isGridViewExpanded: {
|
|
1283
1283
|
type: PropType<boolean>;
|
|
1284
1284
|
};
|
|
1285
|
-
noHeightWrapper: {
|
|
1286
|
-
type: PropType<boolean>;
|
|
1287
|
-
};
|
|
1288
1285
|
onDoCollapse: {
|
|
1289
1286
|
type: PropType<() => void>;
|
|
1290
1287
|
};
|
|
@@ -1301,6 +1298,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1301
1298
|
type: PropType<boolean>;
|
|
1302
1299
|
default: boolean;
|
|
1303
1300
|
};
|
|
1301
|
+
noHeightWrapper: {
|
|
1302
|
+
type: PropType<boolean>;
|
|
1303
|
+
};
|
|
1304
1304
|
componentIcon: {
|
|
1305
1305
|
type: PropType<import('../../../../common/components/collection-view/-utils/types').CollectionViewComponentIcon<Record<string, any>>>;
|
|
1306
1306
|
};
|
|
@@ -1368,9 +1368,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1368
1368
|
isGridViewExpanded: {
|
|
1369
1369
|
type: PropType<boolean>;
|
|
1370
1370
|
};
|
|
1371
|
-
noHeightWrapper: {
|
|
1372
|
-
type: PropType<boolean>;
|
|
1373
|
-
};
|
|
1374
1371
|
onDoCollapse: {
|
|
1375
1372
|
type: PropType<() => void>;
|
|
1376
1373
|
};
|
|
@@ -1387,6 +1384,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1387
1384
|
type: PropType<boolean>;
|
|
1388
1385
|
default: boolean;
|
|
1389
1386
|
};
|
|
1387
|
+
noHeightWrapper: {
|
|
1388
|
+
type: PropType<boolean>;
|
|
1389
|
+
};
|
|
1390
1390
|
componentIcon: {
|
|
1391
1391
|
type: PropType<import('../../../../common/components/collection-view/-utils/types').CollectionViewComponentIcon<Record<string, any>>>;
|
|
1392
1392
|
};
|
|
@@ -1469,9 +1469,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1469
1469
|
isGridViewExpanded: {
|
|
1470
1470
|
type: PropType<boolean>;
|
|
1471
1471
|
};
|
|
1472
|
-
noHeightWrapper: {
|
|
1473
|
-
type: PropType<boolean>;
|
|
1474
|
-
};
|
|
1475
1472
|
onDoCollapse: {
|
|
1476
1473
|
type: PropType<() => void>;
|
|
1477
1474
|
};
|
|
@@ -1488,6 +1485,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1488
1485
|
type: PropType<boolean>;
|
|
1489
1486
|
default: boolean;
|
|
1490
1487
|
};
|
|
1488
|
+
noHeightWrapper: {
|
|
1489
|
+
type: PropType<boolean>;
|
|
1490
|
+
};
|
|
1491
1491
|
componentIcon: {
|
|
1492
1492
|
type: PropType<import('../../../../common/components/collection-view/-utils/types').CollectionViewComponentIcon<Record<string, any>>>;
|
|
1493
1493
|
};
|
|
@@ -1567,9 +1567,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1567
1567
|
isGridViewExpanded: {
|
|
1568
1568
|
type: PropType<boolean>;
|
|
1569
1569
|
};
|
|
1570
|
-
noHeightWrapper: {
|
|
1571
|
-
type: PropType<boolean>;
|
|
1572
|
-
};
|
|
1573
1570
|
onDoCollapse: {
|
|
1574
1571
|
type: PropType<() => void>;
|
|
1575
1572
|
};
|
|
@@ -1586,6 +1583,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1586
1583
|
type: PropType<boolean>;
|
|
1587
1584
|
default: boolean;
|
|
1588
1585
|
};
|
|
1586
|
+
noHeightWrapper: {
|
|
1587
|
+
type: PropType<boolean>;
|
|
1588
|
+
};
|
|
1589
1589
|
componentIcon: {
|
|
1590
1590
|
type: PropType<import('../../../../common/components/collection-view/-utils/types').CollectionViewComponentIcon<Record<string, any>>>;
|
|
1591
1591
|
};
|
|
@@ -2,6 +2,7 @@ import { KernelPartList, UiPlanObject } from '@roomle/web-sdk/lib/definitions/ty
|
|
|
2
2
|
import { StoreState } from '../../common/store';
|
|
3
3
|
import { RapiConfiguration, RapiItem } from '@roomle/web-sdk/lib/definitions/typings/rapi-types';
|
|
4
4
|
import { RoomlePlannerWithExtObjs } from '../../common/utils/types';
|
|
5
|
+
import { Ref } from 'vue';
|
|
5
6
|
|
|
6
7
|
export interface XYZCoords {
|
|
7
8
|
x: number;
|
|
@@ -12,5 +13,14 @@ export interface ProductListItem extends UiPlanObject {
|
|
|
12
13
|
quantity: number;
|
|
13
14
|
runtimeIds?: number[];
|
|
14
15
|
}
|
|
16
|
+
export interface PlannerSidebarLayerState {
|
|
17
|
+
activeLayer: Ref<number>;
|
|
18
|
+
layer0: Ref<string>;
|
|
19
|
+
layer1: Ref<string>;
|
|
20
|
+
isSearchActive: Ref<boolean>;
|
|
21
|
+
}
|
|
22
|
+
export declare const PLANNER_SIDEBAR_STATE_KEYS: {
|
|
23
|
+
readonly LAYER_STATE: "planner_sidebar_layer_state";
|
|
24
|
+
};
|
|
15
25
|
export declare const matchProductListAndQuantity: (productList: UiPlanObject[]) => ProductListItem[];
|
|
16
26
|
export declare const fillPartList: (data: RapiItem | RapiConfiguration, partList: KernelPartList, hash: string, plannerApi: RoomlePlannerWithExtObjs, store: Store<StoreState>) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=Object.defineProperty,e=(e,i,n)=>((e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n)(e,"symbol"!=typeof i?i+"":i,n);class i{constructor(t=16){e(this,"_computedStyleCache",new Map),e(this,"_maxLifetime",16),e(this,"_cacheCleanInterval",null),this._maxLifetime=t}get(t){const e=this._computedStyleCache.get(t),i=Date.now();if(e&&i-e.updated<this._maxLifetime)return e.style;const n=getComputedStyle(t);return this._computedStyleCache.set(t,{style:n,updated:i}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval((()=>this._cleanUpCache),Math.max(1e3*this._maxLifetime,5e3))),n}_cleanUpCache(){const t=Date.now();for(const[e,{updated:i}]of this._computedStyleCache.entries())t-i>=this._maxLifetime&&this._computedStyleCache.delete(e);0===this._computedStyleCache.size&&this._cacheCleanInterval&&(clearInterval(this._cacheCleanInterval),this._cacheCleanInterval=null)}}const n=t=>window.TouchEvent&&t instanceof window.TouchEvent;let s;const c=t=>(s||(s=new i),s.get(t)),h=(t,e,i)=>{const n=parseFloat(t),s=window.devicePixelRatio||1;if("px"===e)return n;if("%"===e)return n/100*(i===document.documentElement?window.innerWidth:i.offsetWidth);if("rem"===e)return n*parseFloat(c(document.documentElement).fontSize);if("em"===e)return n*parseFloat(c(i).fontSize);if("vh"===e||"vw"===e||"vmin"===e||"vmax"===e)return n/100*{vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)}[e];const h={cm:37.7952755906,mm:3.77952755906,in:96};return e in h?n*h[e]*s:0},l=(t,e,i={x:0,y:0})=>{const n=t.getBoundingClientRect(),s=c(t).transform;let l=0,a=0;if("none"!==s){const e=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,i=s.match(e);i&&(l=h(i[1],i[2],t),a=h(i[3],i[4],t))}const{clientX:r,clientY:u}=o(e,i);return{x:r-n.left-l+t.scrollLeft,y:u-n.top-a+t.scrollTop}},o=(t,e=null)=>{const{clientX:i,clientY:s}=n(t)?a(t):t;return{clientX:i>0?i:e?e.x:i,clientY:s>0?s:e?e.y:s}},a=t=>{if(t.touches.length){let{clientX:e,clientY:i}=t.touches[0];if(t.touches.length>1){const n=t.touches[1];e=(e+n.clientX)/2,i=(i+n.clientY)/2}return{clientX:e,clientY:i}}const e=t.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}},r=500,u=10,_=100,d=15,m=(t,e=0)=>n(t)?{clientX:t.touches[e].clientX,clientY:t.touches[e].clientY}:{clientX:t.clientX,clientY:t.clientY},f=t=>!t||!n(t)||t.touches.length>0;class p{constructor(t,{onTouchDragStart:i},n={}){e(this,"_touchDragTimeOut"),e(this,"_onTouchDragStart"),e(this,"_payload",null),e(this,"_delay",500),e(this,"_firstTouch",null),e(this,"_lastTouch",null),e(this,"_epsilon",10),this._payload=t,this._onTouchDragStart=i,this._delay="number"==typeof n.delay?n.delay:500,this._epsilon="number"==typeof n.epsilon?n.epsilon:10}onStart(t){f(t)&&(this._touchDragTimeOut||(this._firstTouch=m(t,n(t)?t.touches.length-1:0),this._touchDragTimeOut=setTimeout((()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=m(t)),this._checkXDistance(t)()}),this._delay)))}onEnd(){this._resetTouches()}onMove(t){f(t)&&(this._lastTouch=m(t))}_clearTimeout(){this._touchDragTimeOut&&(clearTimeout(this._touchDragTimeOut),this._touchDragTimeOut=null)}_resetTouches(){this._clearTimeout(),this._lastTouch=null,this._firstTouch=null,this._payload=null}_checkXDistance(t){return()=>{if(!this._firstTouch||!this._lastTouch)return;let e=!1;e=Math.abs(this._firstTouch.clientX-this._lastTouch.clientX)<this._epsilon,e&&(this._onTouchDragStart(this._payload,t),this._resetTouches())}}}export{d as C,p as T,l as a,r as b,_ as c,u as d,o as e,c as g,n as i};
|
package/drag-in-w_TrusdP.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
var w=Object.defineProperty,E=(r,t,e)=>t in r?w(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,n=(r,t,e)=>E(r,typeof t!="symbol"?t+"":t,e);class S{constructor(t,e,a,o){n(this,"_mainDomElement"),n(this,"_instance"),n(this,"_mode","website"),n(this,"_viewName","main"),this._instance=t,this._mainDomElement=e,this._mode=a,this._viewName=o}async init(){return Promise.resolve()}}const l="rml-drag-in-styles",$="rml-drag-in-drag-element",h="rml-drag-in-overlay",d="rml-drag-in-drag-ghost",u="rml-drag-in-fade-in",p="rml-drag-in-fade-out",y={DISPLAY_NONE:"rml-display-none"},_=.5,b="250ms",v="forwards",D=`@keyframes ${u} {from{opacity: 0;}to {opacity: ${_};}}`,f=`@keyframes ${p} {from{opacity: ${_};}to {opacity: 0;}}`,L=`${u} ${b} ${v}`,C=`${p} ${b} ${v}`,I="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",N=112,x=112;class U extends S{constructor(t,e,a,o){super(t,e,a,o),n(this,"options",{}),n(this,"_customDragSignal",new AbortController),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}_injectStyles(){if(!document.getElementById(l)){const t=document.createElement("style");t.type="text/css",t.id=l,t.innerHTML=`
|
|
2
|
-
.${y.DISPLAY_NONE}{display:none}
|
|
3
|
-
.${h}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}
|
|
4
|
-
.${d}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}
|
|
5
|
-
${D}
|
|
6
|
-
${f}
|
|
7
|
-
`,document.head.appendChild(t)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+d);e||(e=document.createElement("div"),e.classList.add(d),e.innerText=" ",t.appendChild(e))}async init(){if(await super.init(),this._mode==="website")try{const{DragInFromWebsiteStrategy:t}=await import("./from-website-Ckh5GB2h.mjs");this._strategy=new t(this._instance,this._mainDomElement,{settings:this.options,mode:"website"})}catch(t){throw console.error('Could not load Dragin strategy "FromWebsite"'),t}else if(this._mode==="custom-view")try{const{DragInFromCustomViewStrategy:t}=await import("./from-custom-view-jmf3K6AT.mjs");this._strategy=new t(this._instance,this.options,this._viewName)}catch(t){throw console.error('Could not load Dragin strategy "FromCustomView"'),t}else throw new Error("Unsupported mode")}get isDragging(){return this._strategy.isDragging}dragStart(t,e,a="rml_id"){this._strategy.dragStart(t,e,a)}dragUpdate(t){this._strategy.dragUpdate(t)}dragEnd(){this._strategy.dragEnd()}touchStart(t,e,a="rml_id"){this._strategy.touchStart(t,e,a)}touchMove(t){this._strategy.touchMove(t)}touchEnd(){this._strategy.touchEnd()}dispose(){this._strategy.dispose()}beforeUpdateGhost(t){this._strategy.beforeUpdateGhost(t)}registerCustomDrag({customDragStart:t,customDragEnd:e,customDragUpdate:a,beforeUpdateGhost:o}){o&&this._strategy.beforeUpdateGhost(o);const i=this._customDragSignal.signal,m=s=>{s.target.getAttribute("data-rml-draggable")==="true"&&t(s)},g=s=>{this._strategy.releaseInput(s),this._strategy.isDragging&&e(s)},c=s=>{a(s)};document.querySelectorAll('[data-rml-draggable="true"]').forEach(s=>{s.draggable=!1}),document.addEventListener("mousedown",m,{signal:i}),document.addEventListener("mouseup",g,{signal:i}),document.addEventListener("mousemove",c,{signal:i}),document.addEventListener("mouseleave",g,{signal:i}),document.addEventListener("touchstart",m,{signal:i}),document.addEventListener("touchend",g,{signal:i}),document.addEventListener("touchmove",c,{signal:i})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}const j=Object.freeze(Object.defineProperty({__proto__:null,DragIn:U},Symbol.toStringTag,{value:"Module"}));export{$ as R,l as a,D as b,f as c,I as d,N as e,x as f,L as g,C as h,h as i,y as j,d as k,j as l};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var w=Object.defineProperty,C=(e,t,s)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,i=(e,t,s)=>C(e,typeof t!="symbol"?t+"":t,s);import{C as b,e as D,i as v,T as B,b as X,c as Y,d as I}from"./touch-drag-C1SsZtt4.mjs";import{d as u,e as M,f as U}from"./drag-in-w_TrusdP.mjs";const O=e=>`[data-rml-custom-view="${e}"]`,l=e=>{e.preventDefault(),e.stopPropagation()},A=(e,t,s,r)=>{const a=s-e,n=r-t;return Math.sqrt(a*a+n*n)};class x{constructor({onCustomDragStart:t},s={}){i(this,"_startX",0),i(this,"_startY",0),i(this,"_lastX",0),i(this,"_lastY",0),i(this,"_epsilon"),i(this,"_isWaiting",!1),i(this,"_onCustomDragStart"),this._epsilon=typeof s.epsilon=="number"?s.epsilon:b,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&A(this._startX,this._startY,this._lastX,this._lastY)>this._epsilon&&(this._onCustomDragStart(t),this._isWaiting=!1)}onStart(t){this._startX=t.clientX,this._startY=t.clientY,this.onMove(t),this._isWaiting=!0}onEnd(){this._reset()}_reset(){this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this._isWaiting=!1}}const c="data-rml-old-draggable",K=void 0,y=(e,t)=>{const s=v(e),r={delay:s?X:Y,epsilon:s?I:b};if(!t)return r;if(!s&&!(e instanceof MouseEvent))return console.warn("Unsupported event! It is not TouchEvent and also not MouseEvent"),r;const{delayKey:a,epsilonKey:n}=s?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return typeof t[a]=="number"&&(r.delay=t.touchDragDelay),typeof t[n]=="number"&&(r.epsilon=t.touchDragEpsilon),r},L=e=>{let t="",s=M,r=U;if(!e)return{url:u,width:s,height:r};const a=e;if(a instanceof HTMLElement){const n=a.getBoundingClientRect(),o=a.getAttribute("data-rml-ghost-url"),h=a.getAttribute("data-rml-ghost-width"),g=a.getAttribute("data-rml-ghost-height");o?t=o:!o&&a instanceof HTMLImageElement&&a.src&&(t=a.src),t?(s=n.width,r=n.height):t=u,s=h?parseInt(h,10):s,r=g?parseInt(g,10):r}return{url:t||u,width:s,height:r}};class W{constructor(t,s,r){i(this,"_options",{}),i(this,"_instance"),i(this,"_viewName"),i(this,"_currentCustomDrag",null),i(this,"_currentBb",null),i(this,"_startTarget",null),i(this,"_onBeforeUpdateDrag",()=>({})),i(this,"isDragging",!1),this._instance=t,this._options=s||{},this._viewName=r}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,s,r="rml_id"){this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(c,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",l),this._startTarget.addEventListener("dragstart",l)),this._currentBb=await this._instance.getBoundingClientRect(O(this._viewName));const{clientX:a,clientY:n}=D(s),o=this._currentBb.x+a,h=this._currentBb.y+n;this.isDragging=!0,this._instance.dragInObject(t,o,h,r)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:s,clientY:r}=D(t),{url:a,width:n,height:o}=L(this._startTarget),h=this._currentBb.x+s,g=this._currentBb.y+r,_=this._options||{},d={ghost:{visibleIn:{x:this._currentBb.x-(_.dragInOverlapX||0),y:this._currentBb.y+(_.dragInOverlapY||0),width:this._currentBb.width+(_.dragInOverlapX||0),height:this._currentBb.height+(_.dragInOverlapY||0)},url:a,width:n,height:o},mode:"custom-view"},{x:p,y:m,options:T}=this._onBeforeUpdateDrag(h,g,d),f=typeof p=="number"?p:h,E=typeof m=="number"?m:g,S=T||d;this._instance.updateDrag(f,E,S)}_dragEnd(){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._currentCustomDrag=null,this.isDragging=!1,this._currentBb=null,this._resetStartTarget(),this._instance.enableEvents(),this._instance.dragInObjectEnd()}dragStart(t,s,r){this._instance.disableEvents(),this._startTarget=s.target;const a=(n,o)=>{this._dragStart(t,o,r)};this._currentCustomDrag=v(s)?new B(K,{onTouchDragStart:a},y(s,this._options)):new x({onCustomDragStart:n=>this._dragStart(t,n,r)},y(s,this._options)),this._currentCustomDrag.onStart(s)}dragEnd(){this._dragEnd()}dragUpdate(t){this._dragUpdate(t)}touchStart(t,s,r="rml_id"){this.dragStart(t,s,r)}touchMove(t){this.dragUpdate(t)}touchEnd(){this.dragEnd()}dispose(){}_resetStartTarget(){this._startTarget&&(this._startTarget.style.pointerEvents="",this._startTarget.style.userSelect="",this._startTarget.draggable=this._startTarget.getAttribute(c)==="true",this._startTarget.removeAttribute(c),this._startTarget.removeEventListener("dragstart",l))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}export{W as DragInFromCustomViewStrategy};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var P=Object.defineProperty,R=(r,e,t)=>e in r?P(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e,t)=>R(r,typeof e!="symbol"?e+"":e,t);import{g as B,e as D,a as x,i as C,T as M}from"./touch-drag-C1SsZtt4.mjs";import{R as _,a as I,b as O,c as L,d as N,e as E,f as b,g as F,h as G,i as y,j as A,k as Y}from"./drag-in-w_TrusdP.mjs";const w=(r,e,t=0,i=0)=>{const s=e.x+e.width+t,o=e.x-t,l=e.y+e.height+i,a=e.y-i,{x:h,y:n}=r;return h>=o&&h<=s&&n>=a&&n<=l},T=(r,e,t,i=0,s=0)=>{if(!(!t||!t.hiddenIn&&!t.visibleIn))return t.visibleIn?w({x:r,y:e},t.visibleIn,i,s):t.hiddenIn?!w({x:r,y:e},t.hiddenIn,-i,-s):!1},k=()=>{if(!document.getElementById(I)){const r=document.createElement("style");r.type="text/css",r.id=I,r.innerHTML=`
|
|
2
|
-
${O}
|
|
3
|
-
${L}
|
|
4
|
-
`,document.head.appendChild(r)}},U=({x:r,y:e},t)=>{var i,s,o,l,a,h;let n=document.getElementById(_);if(!n){if(n=document.createElement("div"),(i=t.ghost)!=null&&i.element)n.appendChild(t.ghost.element);else{const d=document.createElement("img");d.src=((s=t.ghost)==null?void 0:s.url)||N,d.width=((o=t.ghost)==null?void 0:o.width)||E,d.height=((l=t.ghost)==null?void 0:l.height)||b,n.appendChild(d)}n.id=_,n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.willChange="transform",n.style.transform="translate3d(0, 0, 0)",n.style.zIndex="9999",n.style.opacity="0.5",T(r,e,t.ghost||{},(a=t.settings)==null?void 0:a.dragInOverlapX,(h=t.settings)==null?void 0:h.dragInOverlapY)||(n.style.display="none"),n.style.pointerEvents="none",document.body.appendChild(n)}},X=({x:r,y:e},t)=>{var i,s,o,l;const a=document.getElementById(_);if(!a)return;let h=(i=t.ghost)==null?void 0:i.width,n=(s=t.ghost)==null?void 0:s.height;typeof h>"u"&&(h=a.getBoundingClientRect().width||E),typeof n>"u"&&(n=a.getBoundingClientRect().height||b);const d=r-h/2,c=e-n/2;a.style.transform=`translate3d(${d}px, ${c}px, 0)`,t.ghost&&(T(r,e,t.ghost,(o=t.settings)==null?void 0:o.dragInOverlapX,(l=t.settings)==null?void 0:l.dragInOverlapY)?a.style.animation!=F&&(a.style.animation=F):a.style.animation!=G&&(a.style.animation=G))};class ${constructor(e=null){g(this,"_dragGhostAnimationFrameId",null),g(this,"_dragGhostRemoveAnimationFrameId",null),g(this,"_dragGhostElement",null),this._dragGhostElement=e}updateDragGhost(e,t,i){var s;this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!((s=i.ghost)!=null&&s.external)&&i.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{k();const o={x:e,y:t};!i.ghost&&this._dragGhostElement&&(i.ghost={}),i.ghost&&!i.ghost.element&&this._dragGhostElement&&(i.ghost.element=this._dragGhostElement),U(o,i),X(o,i),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const e=document.getElementById(_);e&&document.body.removeChild(e),this._dragGhostRemoveAnimationFrameId=null}))}}class q{constructor(e,t,i){g(this,"_options",{}),g(this,"_instance"),g(this,"_mainDomElement"),g(this,"_currentDrag",{}),g(this,"_currentTouch",null),g(this,"_firefoxDragPosition",{x:0,y:0}),g(this,"_onBeforeUpdateDrag",()=>({})),g(this,"isDragging",!1),g(this,"_firefoxFallback",s=>{if(!this._currentDrag.event)return;s.preventDefault();const o=s||window.event;this._firefoxDragPosition.x=o.pageX||0,this._firefoxDragPosition.y=o.pageY||0}),this._instance=e,this._mainDomElement=t,this._options=i||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback)}beforeUpdateGhost(e){this._onBeforeUpdateDrag=e}dragStart(e,t,i="rml_id"){const s=this._mainDomElement.parentNode;if(B(s).position!=="relative"){console.warn("Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly");return}this._mainDomElement.style.pointerEvents="none";let o=s.querySelector("."+y);o||(o=document.createElement("div"),o.classList.add(y),s.appendChild(o)),o.classList.remove(A.DISPLAY_NONE),t.target.getAttribute("draggable")||console.warn(`Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`);const l=s.querySelector("."+Y);this._currentDrag.event=t;const a=t.target,h=a.cloneNode(),n=a.getBoundingClientRect();h.style.width=`${n.width}px`,h.style.height=`${n.height}px`,this._currentDrag.ghost=new $(h),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:d,clientY:c}=D(t,this._firefoxDragPosition);this._currentDrag.offset.x=d-n.left,this._currentDrag.offset.y=c-n.top,t instanceof DragEvent&&t.dataTransfer&&t.dataTransfer.setDragImage&&t.dataTransfer.setDragImage(l,0,0);const{x:f,y:m}=x(s,this._currentDrag.event||t,this._firefoxDragPosition),p=Math.max(1,f),v=Math.max(1,m);this.isDragging=!0,this._instance.dragInObject(e,p,v,i)}dragUpdate(e){var t;const i=this._mainDomElement.parentNode,{x:s,y:o}=x(i,e,this._firefoxDragPosition);if(s===0&&o===0)return;const l=Math.max(1,s),a=Math.max(1,o);if(l===1&&a===1)return;let h=l,n=a;if(C(e)){const u=((t=this._options.settings)==null?void 0:t.fingerSize)||0;h=Math.max(2,l+u),n=Math.max(2,a-u)}const{x:d,y:c,options:f}=this._onBeforeUpdateDrag(h,n,{}),m=f||{settings:{},ghost:{}};m.ghost||(m.ghost={}),m.ghost.visibleIn&&m.ghost.hiddenIn||(m.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const p=typeof d=="number"?d:h,v=typeof c=="number"?c:n;if(this._currentDrag.ghost){const{clientX:u,clientY:S}=D(e,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(u,S,m)}this._instance.updateDrag(p,v,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const e=this._mainDomElement.parentNode;this.isDragging=!1,this._instance.dragInObjectEnd(),this._currentDrag.ghost&&(this._currentDrag.ghost.removeDragGhost(),this._currentDrag.ghost=null),this._currentDrag={},this._firefoxDragPosition={x:0,y:0};const t=e.querySelector("."+y);t&&t.classList.add(A.DISPLAY_NONE)}touchStart(e,t,i="rml_id"){var s,o,l,a;t.preventDefault();const h=(d,c)=>{this.dragStart(e,c,i)},n={};typeof((o=(s=this._options)==null?void 0:s.settings)==null?void 0:o.touchDragDelay)=="number"&&(n.delay=this._options.settings.touchDragDelay),(a=(l=this._options)==null?void 0:l.settings)!=null&&a.touchDragEpsilon&&(n.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new M(void 0,{onTouchDragStart:h},n),this._currentTouch.onStart(t)}touchMove(e){this._currentTouch&&this._currentTouch.onMove(e),this._currentDrag.event&&this.dragUpdate(e)}touchEnd(){this._currentTouch&&this._currentTouch.onEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}releaseInput(e){}}export{q as DragInFromWebsiteStrategy};
|
package/touch-drag-C1SsZtt4.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var x=Object.defineProperty,S=(e,t,i)=>t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,o=(e,t,i)=>S(e,typeof t!="symbol"?t+"":t,i);class X{constructor(t=16){o(this,"_computedStyleCache",new Map),o(this,"_maxLifetime",16),o(this,"_cacheCleanInterval",null),this._maxLifetime=t}get(t){const i=this._computedStyleCache.get(t),n=Date.now();if(i&&n-i.updated<this._maxLifetime)return i.style;const s=getComputedStyle(t);return this._computedStyleCache.set(t,{style:s,updated:n}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(this._maxLifetime*1e3,5e3))),s}_cleanUpCache(){const t=Date.now();for(const[i,{updated:n}]of this._computedStyleCache.entries())t-n>=this._maxLifetime&&this._computedStyleCache.delete(i);this._computedStyleCache.size===0&&this._cacheCleanInterval&&(clearInterval(this._cacheCleanInterval),this._cacheCleanInterval=null)}}const l=e=>window.TouchEvent&&e instanceof window.TouchEvent;let u;const r=e=>(u||(u=new X),u.get(e)),f=(e,t,i)=>{const n=parseFloat(e),s=window.devicePixelRatio||1;if(t==="px")return n;if(t==="%"){const c=i===document.documentElement?window.innerWidth:i.offsetWidth;return n/100*c}if(t==="rem"){const c=parseFloat(r(document.documentElement).fontSize);return n*c}if(t==="em"){const c=parseFloat(r(i).fontSize);return n*c}if(t==="vh"||t==="vw"||t==="vmin"||t==="vmax"){const c={vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)};return n/100*c[t]}const a={cm:37.7952755906,mm:3.77952755906,in:96};return t in a?n*a[t]*s:(console.warn("Unable to determine coordinates for drag-in. Therefore drag-in is not possible. Check the CSS that positions the iframe of Roomle"),0)},D=(e,t,i={x:0,y:0})=>{const n=e.getBoundingClientRect(),s=r(e).transform;let a=0,c=0;if(s!=="none"){const C=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,h=s.match(C);h&&(a=f(h[1],h[2],e),c=f(h[3],h[4],e))}const{clientX:g,clientY:w}=p(t,i),y=g-n.left-a+e.scrollLeft,v=w-n.top-c+e.scrollTop;return{x:y,y:v}},p=(e,t=null)=>{const{clientX:i,clientY:n}=l(e)?Y(e):e,s=i>0?i:t?t.x:i,a=n>0?n:t?t.y:n;return{clientX:s,clientY:a}},Y=e=>{if(e.touches.length){let{clientX:i,clientY:n}=e.touches[0];if(e.touches.length>1){const s=e.touches[1],a=s.clientX,c=s.clientY;i=(i+a)/2,n=(n+c)/2}return{clientX:i,clientY:n}}const t=e.changedTouches[0];return{clientX:t.clientX,clientY:t.clientY}},d=500,_=10,b=100,I=15,m=(e,t=0)=>l(e)?{clientX:e.touches[t].clientX,clientY:e.touches[t].clientY}:{clientX:e.clientX,clientY:e.clientY},T=e=>e&&l(e)?e.touches.length>0:!0;class L{constructor(t,{onTouchDragStart:i},n={}){o(this,"_touchDragTimeOut"),o(this,"_onTouchDragStart"),o(this,"_payload",null),o(this,"_delay",d),o(this,"_firstTouch",null),o(this,"_lastTouch",null),o(this,"_epsilon",_),this._payload=t,this._onTouchDragStart=i,this._delay=typeof n.delay=="number"?n.delay:d,this._epsilon=typeof n.epsilon=="number"?n.epsilon:_}onStart(t){T(t)&&(this._touchDragTimeOut||(this._firstTouch=m(t,l(t)?t.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=m(t)),this._checkXDistance(t)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){T(t)&&(this._lastTouch=m(t))}_clearTimeout(){this._touchDragTimeOut&&(clearTimeout(this._touchDragTimeOut),this._touchDragTimeOut=null)}_resetTouches(){this._clearTimeout(),this._lastTouch=null,this._firstTouch=null,this._payload=null}_checkXDistance(t){return()=>{if(!this._firstTouch||!this._lastTouch)return;let i=!1;i=Math.abs(this._firstTouch.clientX-this._lastTouch.clientX)<this._epsilon,i&&(this._onTouchDragStart(this._payload,t),this._resetTouches())}}}export{I as C,L as T,D as a,d as b,b as c,_ as d,p as e,r as g,l as i};
|