@roomle/embedding-lib 5.7.0-debug.1 → 5.8.0-alpha.1
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 +4 -39
- package/drag-in-CYmR1HFI.mjs +7 -0
- package/{drag-in-3CJWP_Px.mjs → drag-in-Do47zdKL.mjs} +43 -35
- package/from-custom-view-BVWf7SQ7.mjs +1 -0
- package/{from-custom-view-DmyxPHCr.mjs → from-custom-view-DYkvyOw3.mjs} +21 -23
- package/from-website-DDMDPp-F.mjs +206 -0
- package/from-website-Dx2SUftr.mjs +4 -0
- package/index.d.ts +2 -2
- package/package.json +2 -2
- package/roomle-embedding-lib.es.js +17 -16
- package/roomle-embedding-lib.es.min.js +4 -4
- package/roomle-embedding-lib.umd.js +12 -12
- package/roomle-embedding-lib.umd.min.js +15 -15
- package/{touch-drag-DibgNiRO.mjs → touch-drag-C1SsZtt4.mjs} +1 -1
- package/{touch-drag-BsAmrceE.mjs → touch-drag-DNDPwZ-_.mjs} +3 -3
- package/drag-in-sE43chRN.mjs +0 -7
- package/from-custom-view-Pim0MOO4.mjs +0 -1
- package/from-website-BhUhFYtn.mjs +0 -194
- package/from-website-DInCYX35.mjs +0 -4
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
var b = Object.defineProperty;
|
|
2
|
-
var F = (o, t, e) => t in o ? b(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
-
var g = (o, t, e) => F(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { g as M, e as A, a as p, i as C, T as N } from "./touch-drag-BsAmrceE.mjs";
|
|
5
|
-
import { R as m, a as G, b as O, c as w, d as Y, e as S, f as R, g as I, h as E, i as y, j as x, k as B } from "./drag-in-3CJWP_Px.mjs";
|
|
6
|
-
const T = (o, t, e = 0, n = 0) => {
|
|
7
|
-
const a = t.x + t.width + e, i = t.x - e, s = t.y + t.height + n, h = t.y - n, { x: l, y: r } = o;
|
|
8
|
-
return l >= i && l <= a && r >= h && r <= s;
|
|
9
|
-
}, H = () => {
|
|
10
|
-
if (!!!document.getElementById(G)) {
|
|
11
|
-
const t = document.createElement("style");
|
|
12
|
-
t.type = "text/css", t.id = G, t.innerHTML = `
|
|
13
|
-
${O}
|
|
14
|
-
${w}
|
|
15
|
-
`, document.head.appendChild(t);
|
|
16
|
-
}
|
|
17
|
-
}, P = ({ x: o, y: t }, e, n) => {
|
|
18
|
-
var i, s, h, l;
|
|
19
|
-
let a = document.getElementById(m);
|
|
20
|
-
if (!a) {
|
|
21
|
-
if (a = document.createElement("div"), (i = e.ghost) != null && i.element)
|
|
22
|
-
a.appendChild(e.ghost.element);
|
|
23
|
-
else {
|
|
24
|
-
const r = document.createElement("img");
|
|
25
|
-
r.src = ((s = e.ghost) == null ? void 0 : s.url) || Y, r.width = ((h = e.ghost) == null ? void 0 : h.width) || S, r.height = ((l = e.ghost) == null ? void 0 : l.height) || R, a.appendChild(r);
|
|
26
|
-
}
|
|
27
|
-
a.id = m, a.style.position = "fixed", a.style.top = "0", a.style.left = "0", a.style.willChange = "transform", a.style.transform = "translate3d(0, 0, 0)", a.style.zIndex = "9999", a.style.opacity = "0.5", e.ghost && e.ghost.visibleIn && !T(
|
|
28
|
-
{ x: o, y: t },
|
|
29
|
-
e.ghost.visibleIn,
|
|
30
|
-
n.dragInOverlapX,
|
|
31
|
-
n.dragInOverlapY
|
|
32
|
-
) && (a.style.display = "none"), a.style.pointerEvents = "none", document.body.appendChild(a);
|
|
33
|
-
}
|
|
34
|
-
}, U = ({ x: o, y: t }, e, n) => {
|
|
35
|
-
var r, d;
|
|
36
|
-
const a = document.getElementById(m);
|
|
37
|
-
if (!a)
|
|
38
|
-
return;
|
|
39
|
-
let i = (r = e.ghost) == null ? void 0 : r.width, s = (d = e.ghost) == null ? void 0 : d.height;
|
|
40
|
-
typeof i > "u" && (i = a.getBoundingClientRect().width || S), typeof s > "u" && (s = a.getBoundingClientRect().height || R);
|
|
41
|
-
const h = o - i / 2, l = t - s / 2;
|
|
42
|
-
a.style.transform = `translate3d(${h}px, ${l}px, 0)`, e.ghost && (!e.ghost.visibleIn || // user didn't specify were to show the drag ghost, therefore we assume that we should show it always
|
|
43
|
-
T(
|
|
44
|
-
{ x: o, y: t },
|
|
45
|
-
e.ghost.visibleIn,
|
|
46
|
-
n.dragInOverlapX,
|
|
47
|
-
n.dragInOverlapY
|
|
48
|
-
) ? a.style.animation != I && (a.style.animation = I) : a.style.animation != E && (a.style.animation = E));
|
|
49
|
-
};
|
|
50
|
-
class X {
|
|
51
|
-
constructor(t = null) {
|
|
52
|
-
g(this, "_dragGhostAnimationFrameId", null);
|
|
53
|
-
g(this, "_dragGhostRemoveAnimationFrameId", null);
|
|
54
|
-
g(this, "_dragGhostElement", null);
|
|
55
|
-
this._dragGhostElement = t;
|
|
56
|
-
}
|
|
57
|
-
updateDragGhost(t, e, n = {}, a = {}) {
|
|
58
|
-
var i;
|
|
59
|
-
this._dragGhostRemoveAnimationFrameId && (cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId), this._dragGhostRemoveAnimationFrameId = null), !((i = n.ghost) != null && i.external) && n.ghost && (this._dragGhostAnimationFrameId || (this._dragGhostAnimationFrameId = requestAnimationFrame(() => {
|
|
60
|
-
H();
|
|
61
|
-
const s = { x: t, y: e };
|
|
62
|
-
!n.ghost && this._dragGhostElement && (n.ghost = {}), n.ghost && !n.ghost.element && this._dragGhostElement && (n.ghost.element = this._dragGhostElement), P(s, n, a), U(s, n, a), this._dragGhostAnimationFrameId = null;
|
|
63
|
-
})));
|
|
64
|
-
}
|
|
65
|
-
removeDragGhost() {
|
|
66
|
-
this._dragGhostAnimationFrameId && (cancelAnimationFrame(this._dragGhostAnimationFrameId), this._dragGhostAnimationFrameId = null), this._dragGhostRemoveAnimationFrameId || (this._dragGhostRemoveAnimationFrameId = requestAnimationFrame(() => {
|
|
67
|
-
const t = document.getElementById(m);
|
|
68
|
-
t && document.body.removeChild(t), this._dragGhostRemoveAnimationFrameId = null;
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
class j {
|
|
73
|
-
constructor(t, e, n) {
|
|
74
|
-
g(this, "_options", {});
|
|
75
|
-
g(this, "_instance");
|
|
76
|
-
g(this, "_mainDomElement");
|
|
77
|
-
g(this, "_currentDrag", {});
|
|
78
|
-
g(this, "_currentTouch", null);
|
|
79
|
-
g(this, "_firefoxDragPosition", { x: 0, y: 0 });
|
|
80
|
-
g(this, "_onBeforeUpdateDrag", () => ({}));
|
|
81
|
-
g(this, "isDragging", !1);
|
|
82
|
-
g(this, "_firefoxFallback", (t) => {
|
|
83
|
-
if (!this._currentDrag.event)
|
|
84
|
-
return;
|
|
85
|
-
const e = t || window.event;
|
|
86
|
-
this._firefoxDragPosition.x = e.pageX || 0, this._firefoxDragPosition.y = e.pageY || 0;
|
|
87
|
-
});
|
|
88
|
-
this._instance = t, this._mainDomElement = e, this._options = n || {}, this._firefoxFallback = this._firefoxFallback.bind(this), document.addEventListener("dragover", this._firefoxFallback);
|
|
89
|
-
}
|
|
90
|
-
beforeUpdateGhost(t) {
|
|
91
|
-
this._onBeforeUpdateDrag = t;
|
|
92
|
-
}
|
|
93
|
-
dragStart(t, e, n = "rml_id") {
|
|
94
|
-
const a = this._mainDomElement.parentNode;
|
|
95
|
-
if (M(a).position !== "relative") {
|
|
96
|
-
console.warn(
|
|
97
|
-
"Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly"
|
|
98
|
-
);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
this._mainDomElement.style.pointerEvents = "none";
|
|
102
|
-
let s = a.querySelector(
|
|
103
|
-
"." + y
|
|
104
|
-
);
|
|
105
|
-
s || (s = document.createElement("div"), s.classList.add(y), a.appendChild(s)), s.classList.remove(x.DISPLAY_NONE), e.target.getAttribute("draggable") || console.warn(
|
|
106
|
-
`Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`
|
|
107
|
-
);
|
|
108
|
-
const l = a.querySelector(
|
|
109
|
-
"." + B
|
|
110
|
-
);
|
|
111
|
-
this._currentDrag.event = e;
|
|
112
|
-
const r = e.target, d = r.cloneNode(), c = r.getBoundingClientRect();
|
|
113
|
-
d.style.width = `${c.width}px`, d.style.height = `${c.height}px`, this._currentDrag.ghost = new X(d), this._currentDrag.offset || (this._currentDrag.offset = { x: 0, y: 0 });
|
|
114
|
-
const { clientX: u, clientY: f } = A(
|
|
115
|
-
e,
|
|
116
|
-
this._firefoxDragPosition
|
|
117
|
-
);
|
|
118
|
-
this._currentDrag.offset.x = u - c.left, this._currentDrag.offset.y = f - c.top, e instanceof DragEvent && e.dataTransfer && e.dataTransfer.setDragImage && e.dataTransfer.setDragImage(l, 0, 0);
|
|
119
|
-
const { x: _, y: D } = p(
|
|
120
|
-
a,
|
|
121
|
-
this._currentDrag.event || e,
|
|
122
|
-
this._firefoxDragPosition
|
|
123
|
-
), v = Math.max(1, _), L = Math.max(1, D);
|
|
124
|
-
this.isDragging = !0, this._instance.dragInObject(t, v, L, n);
|
|
125
|
-
}
|
|
126
|
-
dragUpdate(t) {
|
|
127
|
-
const e = this._mainDomElement.parentNode, { x: n, y: a } = p(e, t, this._firefoxDragPosition);
|
|
128
|
-
if (n === 0 && a === 0)
|
|
129
|
-
return;
|
|
130
|
-
const i = Math.max(1, n), s = Math.max(1, a);
|
|
131
|
-
if (i === 1 && s === 1)
|
|
132
|
-
return;
|
|
133
|
-
let h = i, l = s;
|
|
134
|
-
if (C(t)) {
|
|
135
|
-
const _ = this._options.fingerSize || 0;
|
|
136
|
-
h = Math.max(2, i + _), l = Math.max(2, s - _);
|
|
137
|
-
}
|
|
138
|
-
const {
|
|
139
|
-
x: r,
|
|
140
|
-
y: d,
|
|
141
|
-
options: c
|
|
142
|
-
} = this._onBeforeUpdateDrag(h, l, {}), u = typeof r == "number" ? r : h, f = typeof d == "number" ? d : l;
|
|
143
|
-
if (this._currentDrag.ghost) {
|
|
144
|
-
const { clientX: _, clientY: D } = A(
|
|
145
|
-
t,
|
|
146
|
-
this._firefoxDragPosition
|
|
147
|
-
);
|
|
148
|
-
console.log("dragin", "dragupdate is here: ", location.href), this._currentDrag.ghost.updateDragGhost(
|
|
149
|
-
_,
|
|
150
|
-
D,
|
|
151
|
-
c || {},
|
|
152
|
-
this._options || {}
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
this._instance.updateDrag(u, f, {});
|
|
156
|
-
}
|
|
157
|
-
dragEnd() {
|
|
158
|
-
this._mainDomElement.style.pointerEvents = "all";
|
|
159
|
-
const t = this._mainDomElement.parentNode;
|
|
160
|
-
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 };
|
|
161
|
-
const e = t.querySelector(
|
|
162
|
-
"." + y
|
|
163
|
-
);
|
|
164
|
-
e && e.classList.add(x.DISPLAY_NONE);
|
|
165
|
-
}
|
|
166
|
-
touchStart(t, e, n = "rml_id") {
|
|
167
|
-
var s, h;
|
|
168
|
-
e.preventDefault();
|
|
169
|
-
const a = (l, r) => {
|
|
170
|
-
this.dragStart(t, r, n);
|
|
171
|
-
}, i = {};
|
|
172
|
-
typeof ((s = this._options) == null ? void 0 : s.touchDragDelay) == "number" && (i.delay = this._options.touchDragDelay), (h = this._options) != null && h.touchDragEpsilon && (i.epsilon = this._options.touchDragEpsilon), this._currentTouch = new N(
|
|
173
|
-
void 0,
|
|
174
|
-
{
|
|
175
|
-
onTouchDragStart: a
|
|
176
|
-
},
|
|
177
|
-
i
|
|
178
|
-
), this._currentTouch.onStart(e);
|
|
179
|
-
}
|
|
180
|
-
touchMove(t) {
|
|
181
|
-
this._currentTouch && this._currentTouch.onMove(t), this._currentDrag.event && this.dragUpdate(t);
|
|
182
|
-
}
|
|
183
|
-
touchEnd() {
|
|
184
|
-
this._currentTouch && this._currentTouch.onEnd(), this._currentTouch = null, this.dragEnd();
|
|
185
|
-
}
|
|
186
|
-
dispose() {
|
|
187
|
-
document.removeEventListener("dragover", this._firefoxFallback);
|
|
188
|
-
}
|
|
189
|
-
releaseInput(t) {
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
export {
|
|
193
|
-
j as DragInFromWebsiteStrategy
|
|
194
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var w=Object.defineProperty,T=(r,t,e)=>t in r?w(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,d=(r,t,e)=>T(r,typeof t!="symbol"?t+"":t,e);import{g as S,e as D,a as v,i as P,T as R}from"./touch-drag-DibgNiRO.mjs";import{R as m,a as x,b as B,c as C,d as M,e as I,f as E,g as b,h as F,i as y,j as G,k as O}from"./drag-in-sE43chRN.mjs";const A=(r,t,e=0,n=0)=>{const a=t.x+t.width+e,s=t.x-e,o=t.y+t.height+n,h=t.y-n,{x:i,y:l}=r;return i>=s&&i<=a&&l>=h&&l<=o},L=()=>{if(!document.getElementById(x)){const r=document.createElement("style");r.type="text/css",r.id=x,r.innerHTML=`
|
|
2
|
-
${B}
|
|
3
|
-
${C}
|
|
4
|
-
`,document.head.appendChild(r)}},N=({x:r,y:t},e,n)=>{var a,s,o,h;let i=document.getElementById(m);if(!i){if(i=document.createElement("div"),(a=e.ghost)!=null&&a.element)i.appendChild(e.ghost.element);else{const l=document.createElement("img");l.src=((s=e.ghost)==null?void 0:s.url)||M,l.width=((o=e.ghost)==null?void 0:o.width)||I,l.height=((h=e.ghost)==null?void 0:h.height)||E,i.appendChild(l)}i.id=m,i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.willChange="transform",i.style.transform="translate3d(0, 0, 0)",i.style.zIndex="9999",i.style.opacity="0.5",e.ghost&&e.ghost.visibleIn&&!A({x:r,y:t},e.ghost.visibleIn,n.dragInOverlapX,n.dragInOverlapY)&&(i.style.display="none"),i.style.pointerEvents="none",document.body.appendChild(i)}},Y=({x:r,y:t},e,n)=>{var a,s;const o=document.getElementById(m);if(!o)return;let h=(a=e.ghost)==null?void 0:a.width,i=(s=e.ghost)==null?void 0:s.height;typeof h>"u"&&(h=o.getBoundingClientRect().width||I),typeof i>"u"&&(i=o.getBoundingClientRect().height||E);const l=r-h/2,g=t-i/2;o.style.transform=`translate3d(${l}px, ${g}px, 0)`,e.ghost&&(!e.ghost.visibleIn||A({x:r,y:t},e.ghost.visibleIn,n.dragInOverlapX,n.dragInOverlapY)?o.style.animation!=b&&(o.style.animation=b):o.style.animation!=F&&(o.style.animation=F))};class U{constructor(t=null){d(this,"_dragGhostAnimationFrameId",null),d(this,"_dragGhostRemoveAnimationFrameId",null),d(this,"_dragGhostElement",null),this._dragGhostElement=t}updateDragGhost(t,e,n={},a={}){var s;this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!((s=n.ghost)!=null&&s.external)&&n.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{L();const o={x:t,y:e};!n.ghost&&this._dragGhostElement&&(n.ghost={}),n.ghost&&!n.ghost.element&&this._dragGhostElement&&(n.ghost.element=this._dragGhostElement),N(o,n,a),Y(o,n,a),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(m);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}class k{constructor(t,e,n){d(this,"_options",{}),d(this,"_instance"),d(this,"_mainDomElement"),d(this,"_currentDrag",{}),d(this,"_currentTouch",null),d(this,"_firefoxDragPosition",{x:0,y:0}),d(this,"_onBeforeUpdateDrag",()=>({})),d(this,"isDragging",!1),d(this,"_firefoxFallback",a=>{if(!this._currentDrag.event)return;const s=a||window.event;this._firefoxDragPosition.x=s.pageX||0,this._firefoxDragPosition.y=s.pageY||0}),this._instance=t,this._mainDomElement=e,this._options=n||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback)}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}dragStart(t,e,n="rml_id"){const a=this._mainDomElement.parentNode;if(S(a).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 s=a.querySelector("."+y);s||(s=document.createElement("div"),s.classList.add(y),a.appendChild(s)),s.classList.remove(G.DISPLAY_NONE),e.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 o=a.querySelector("."+O);this._currentDrag.event=e;const h=e.target,i=h.cloneNode(),l=h.getBoundingClientRect();i.style.width=`${l.width}px`,i.style.height=`${l.height}px`,this._currentDrag.ghost=new U(i),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:g,clientY:u}=D(e,this._firefoxDragPosition);this._currentDrag.offset.x=g-l.left,this._currentDrag.offset.y=u-l.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(o,0,0);const{x:_,y:f}=v(a,this._currentDrag.event||e,this._firefoxDragPosition),c=Math.max(1,_),p=Math.max(1,f);this.isDragging=!0,this._instance.dragInObject(t,c,p,n)}dragUpdate(t){const e=this._mainDomElement.parentNode,{x:n,y:a}=v(e,t,this._firefoxDragPosition);if(n===0&&a===0)return;const s=Math.max(1,n),o=Math.max(1,a);if(s===1&&o===1)return;let h=s,i=o;if(P(t)){const c=this._options.fingerSize||0;h=Math.max(2,s+c),i=Math.max(2,o-c)}const{x:l,y:g,options:u}=this._onBeforeUpdateDrag(h,i,{}),_=typeof l=="number"?l:h,f=typeof g=="number"?g:i;if(this._currentDrag.ghost){const{clientX:c,clientY:p}=D(t,this._firefoxDragPosition);console.log("dragin","dragupdate is here: ",location.href),this._currentDrag.ghost.updateDragGhost(c,p,u||{},this._options||{})}this._instance.updateDrag(_,f,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const t=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 e=t.querySelector("."+y);e&&e.classList.add(G.DISPLAY_NONE)}touchStart(t,e,n="rml_id"){var a,s;e.preventDefault();const o=(i,l)=>{this.dragStart(t,l,n)},h={};typeof((a=this._options)==null?void 0:a.touchDragDelay)=="number"&&(h.delay=this._options.touchDragDelay),(s=this._options)!=null&&s.touchDragEpsilon&&(h.epsilon=this._options.touchDragEpsilon),this._currentTouch=new R(void 0,{onTouchDragStart:o},h),this._currentTouch.onStart(e)}touchMove(t){this._currentTouch&&this._currentTouch.onMove(t),this._currentDrag.event&&this.dragUpdate(t)}touchEnd(){this._currentTouch&&this._currentTouch.onEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}releaseInput(t){}}export{k as DragInFromWebsiteStrategy};
|