@roomle/embedding-lib 6.5.0-alpha.2 → 6.5.0-alpha.3
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 +70 -7
- package/drag-ghost-B7UAYefM.mjs +1 -0
- package/drag-ghost-DHrf_Evu.mjs +81 -0
- package/embedding-plugins-DLVs7ER4.mjs +1 -0
- package/{embedding-plugins-Cm7O1pKC.mjs → embedding-plugins-DqMSzAJe.mjs} +47 -46
- package/embedding-plugins.js +6 -5
- package/embedding-plugins.min.js +1 -1
- package/from-custom-view-CaDOooe4.mjs +1 -0
- package/from-custom-view-T67aFIDR.mjs +249 -0
- package/from-website-Bvd5Pi0i.mjs +134 -0
- package/from-website-nKwD78_u.mjs +1 -0
- package/package.json +1 -1
- package/packages/embedding-lib/src/embedding-plugins.d.ts +1 -1
- package/packages/embedding-lib/src/plugins/strategy/from-custom-view.d.ts +2 -0
- package/packages/embedding-lib/src/plugins/strategy/from-website.d.ts +1 -1
- package/roomle-embedding-lib.js +1 -1
- package/roomle-embedding-lib.min.js +1 -1
- package/embedding-plugins-Dzhuj1By.mjs +0 -1
- package/from-custom-view-5SS9UqAH.mjs +0 -197
- package/from-custom-view-CfMGS1-t.mjs +0 -1
- package/from-website-CFTjWbqp.mjs +0 -230
- package/from-website-ExTzmsnv.mjs +0 -1
- package/touch-drag-CfMLD_hM.mjs +0 -57
- package/touch-drag-TGCsdNqP.mjs +0 -1
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { g as M, e as A, a as G, i as N } from "./utils-Dav4kGNW.mjs";
|
|
2
|
-
import { T as O } from "./touch-drag-CfMLD_hM.mjs";
|
|
3
|
-
import { R as D, a as b, b as w, c as H, d as U, e as C, f as T, g as S, h as x, i as I, j as R, k as Y } from "./embedding-plugins-Cm7O1pKC.mjs";
|
|
4
|
-
const v = (l, n, t = 0, e = 0) => {
|
|
5
|
-
const i = n.x + n.width + t, a = n.x - t, r = n.y + n.height + e, s = n.y - e, { x: o, y: h } = l;
|
|
6
|
-
return o >= a && o <= i && h >= s && h <= r;
|
|
7
|
-
}, L = (l, n, t, e = 0, i = 0) => {
|
|
8
|
-
if (!(!t || !t.hiddenIn && !t.visibleIn))
|
|
9
|
-
return t.visibleIn ? v(
|
|
10
|
-
{ x: l, y: n },
|
|
11
|
-
t.visibleIn,
|
|
12
|
-
e,
|
|
13
|
-
i
|
|
14
|
-
) : t.hiddenIn ? !v(
|
|
15
|
-
{ x: l, y: n },
|
|
16
|
-
t.hiddenIn,
|
|
17
|
-
-e,
|
|
18
|
-
-i
|
|
19
|
-
) : !1;
|
|
20
|
-
}, P = () => {
|
|
21
|
-
if (!!!document.getElementById(b)) {
|
|
22
|
-
const n = document.createElement("style");
|
|
23
|
-
n.type = "text/css", n.id = b, n.innerHTML = `
|
|
24
|
-
${w}
|
|
25
|
-
${H}
|
|
26
|
-
`, document.head.appendChild(n);
|
|
27
|
-
}
|
|
28
|
-
}, X = ({ x: l, y: n }, t) => {
|
|
29
|
-
let e = document.getElementById(D);
|
|
30
|
-
if (!e) {
|
|
31
|
-
if (e = document.createElement("div"), t.ghost?.element)
|
|
32
|
-
e.appendChild(t.ghost.element);
|
|
33
|
-
else {
|
|
34
|
-
const i = document.createElement("img");
|
|
35
|
-
i.src = t.ghost?.url || U, i.width = t.ghost?.width || C, i.height = t.ghost?.height || T, e.appendChild(i);
|
|
36
|
-
}
|
|
37
|
-
e.id = D, e.style.position = "fixed", e.style.top = "0", e.style.left = "0", e.style.willChange = "transform", e.style.transform = "translate3d(0, 0, 0)", e.style.zIndex = "9999", e.style.opacity = "0.5", L(
|
|
38
|
-
l,
|
|
39
|
-
n,
|
|
40
|
-
t.ghost || {},
|
|
41
|
-
t.settings?.dragInOverlapX,
|
|
42
|
-
t.settings?.dragInOverlapY
|
|
43
|
-
) || (e.style.display = "none"), e.style.pointerEvents = "none", document.body.appendChild(e);
|
|
44
|
-
}
|
|
45
|
-
}, k = ({ x: l, y: n }, t) => {
|
|
46
|
-
const e = document.getElementById(D);
|
|
47
|
-
if (!e)
|
|
48
|
-
return;
|
|
49
|
-
let i = t.ghost?.width, a = t.ghost?.height;
|
|
50
|
-
typeof i > "u" && (i = e.getBoundingClientRect().width || C), typeof a > "u" && (a = e.getBoundingClientRect().height || T);
|
|
51
|
-
const r = l - i / 2, s = n - a / 2;
|
|
52
|
-
e.style.transform = `translate3d(${r}px, ${s}px, 0)`, t.ghost && (L(
|
|
53
|
-
l,
|
|
54
|
-
n,
|
|
55
|
-
t.ghost,
|
|
56
|
-
t.settings?.dragInOverlapX,
|
|
57
|
-
t.settings?.dragInOverlapY
|
|
58
|
-
) ? e.style.animation != S && (e.style.animation = S) : e.style.animation != x && (e.style.animation = x));
|
|
59
|
-
};
|
|
60
|
-
class $ {
|
|
61
|
-
_dragGhostAnimationFrameId = null;
|
|
62
|
-
_dragGhostRemoveAnimationFrameId = null;
|
|
63
|
-
_dragGhostElement = null;
|
|
64
|
-
constructor(n = null) {
|
|
65
|
-
this._dragGhostElement = n;
|
|
66
|
-
}
|
|
67
|
-
updateDragGhost(n, t, e) {
|
|
68
|
-
this._dragGhostRemoveAnimationFrameId && (cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId), this._dragGhostRemoveAnimationFrameId = null), !e.ghost?.external && e.ghost && (this._dragGhostAnimationFrameId || (this._dragGhostAnimationFrameId = requestAnimationFrame(() => {
|
|
69
|
-
P();
|
|
70
|
-
const i = { x: n, y: t };
|
|
71
|
-
!e.ghost && this._dragGhostElement && (e.ghost = {}), e.ghost && !e.ghost.element && this._dragGhostElement && (e.ghost.element = this._dragGhostElement), X(i, e), k(i, e), this._dragGhostAnimationFrameId = null;
|
|
72
|
-
})));
|
|
73
|
-
}
|
|
74
|
-
removeDragGhost() {
|
|
75
|
-
this._dragGhostAnimationFrameId && (cancelAnimationFrame(this._dragGhostAnimationFrameId), this._dragGhostAnimationFrameId = null), this._dragGhostRemoveAnimationFrameId || (this._dragGhostRemoveAnimationFrameId = requestAnimationFrame(() => {
|
|
76
|
-
const n = document.getElementById(D);
|
|
77
|
-
n && document.body.removeChild(n), this._dragGhostRemoveAnimationFrameId = null;
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
class K {
|
|
82
|
-
_options = {};
|
|
83
|
-
_instance;
|
|
84
|
-
_mainDomElement;
|
|
85
|
-
_currentDrag = {};
|
|
86
|
-
_currentTouch = null;
|
|
87
|
-
_firefoxDragPosition = { x: 0, y: 0 };
|
|
88
|
-
_onBeforeUpdateDrag = () => ({});
|
|
89
|
-
isDragging = !1;
|
|
90
|
-
_hasEnteredIframe = !1;
|
|
91
|
-
_pendingDragIn = null;
|
|
92
|
-
_canvasBb = null;
|
|
93
|
-
_overlayBb = null;
|
|
94
|
-
_interactionContainerBb = null;
|
|
95
|
-
_firefoxFallback = (n) => {
|
|
96
|
-
if (!this._currentDrag.event)
|
|
97
|
-
return;
|
|
98
|
-
n.preventDefault();
|
|
99
|
-
const t = n || window.event;
|
|
100
|
-
this._firefoxDragPosition.x = t.pageX || 0, this._firefoxDragPosition.y = t.pageY || 0;
|
|
101
|
-
};
|
|
102
|
-
constructor(n, t, e) {
|
|
103
|
-
this._instance = n, this._mainDomElement = t, this._options = e || {}, this._firefoxFallback = this._firefoxFallback.bind(this), document.addEventListener("dragover", this._firefoxFallback), this._mainDomElement.parentElement?.addEventListener("dragleave", () => {
|
|
104
|
-
this._instance.cancelDragIn();
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
beforeUpdateGhost(n) {
|
|
108
|
-
this._onBeforeUpdateDrag = n;
|
|
109
|
-
}
|
|
110
|
-
async dragStart(n, t, e = "rml_id") {
|
|
111
|
-
const i = this._mainDomElement.parentNode;
|
|
112
|
-
if (M(i).position !== "relative") {
|
|
113
|
-
console.warn(
|
|
114
|
-
"Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly"
|
|
115
|
-
);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
this._mainDomElement.style.pointerEvents = "none";
|
|
119
|
-
let r = i.querySelector(
|
|
120
|
-
"." + I
|
|
121
|
-
);
|
|
122
|
-
r || (r = document.createElement("div"), r.classList.add(I), i.appendChild(r)), r.classList.remove(R.DISPLAY_NONE), t.target.getAttribute("draggable") || console.warn(
|
|
123
|
-
`Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`
|
|
124
|
-
);
|
|
125
|
-
const o = i.querySelector(
|
|
126
|
-
"." + Y
|
|
127
|
-
);
|
|
128
|
-
this._currentDrag.event = t;
|
|
129
|
-
const h = t.target, g = h.cloneNode(!0), d = h.getBoundingClientRect();
|
|
130
|
-
g.style.width = `${d.width}px`, g.style.height = `${d.height}px`, this._currentDrag.ghost = new $(g), this._currentDrag.offset || (this._currentDrag.offset = { x: 0, y: 0 });
|
|
131
|
-
const { clientX: m, clientY: f } = A(
|
|
132
|
-
t,
|
|
133
|
-
this._firefoxDragPosition
|
|
134
|
-
);
|
|
135
|
-
this._currentDrag.offset.x = m - d.left, this._currentDrag.offset.y = f - d.top, t instanceof DragEvent && t.dataTransfer && t.dataTransfer.setDragImage && t.dataTransfer.setDragImage(o, 0, 0), G(i, this._currentDrag.event || t, this._firefoxDragPosition), this._pendingDragIn = { id: n, type: e }, this._hasEnteredIframe = !1, this.isDragging = !0, this._interactionContainerBb = (await this._instance.getDrawerBoundingClientRect()).final;
|
|
136
|
-
}
|
|
137
|
-
dragUpdate(n) {
|
|
138
|
-
const t = this._mainDomElement.parentNode, { x: e, y: i } = G(t, n, this._firefoxDragPosition);
|
|
139
|
-
if (e === 0 && i === 0)
|
|
140
|
-
return;
|
|
141
|
-
const a = Math.max(1, e), r = Math.max(1, i);
|
|
142
|
-
if (a === 1 && r === 1)
|
|
143
|
-
return;
|
|
144
|
-
const s = this._mainDomElement.getBoundingClientRect(), { clientX: o, clientY: h } = A(
|
|
145
|
-
n,
|
|
146
|
-
this._firefoxDragPosition
|
|
147
|
-
), g = o >= s.left && o <= s.right && h >= s.top && h <= s.bottom, d = () => {
|
|
148
|
-
if (!(o >= s.left && o <= s.right && h >= s.top && h <= s.bottom))
|
|
149
|
-
return !1;
|
|
150
|
-
if (this._interactionContainerBb) {
|
|
151
|
-
const u = {
|
|
152
|
-
left: this._interactionContainerBb.left + s.left,
|
|
153
|
-
top: this._interactionContainerBb.top + s.top,
|
|
154
|
-
right: this._interactionContainerBb.right + s.left,
|
|
155
|
-
bottom: this._interactionContainerBb.bottom + s.top
|
|
156
|
-
};
|
|
157
|
-
return !(o >= u.left && o <= u.right && h >= u.top && h <= u.bottom);
|
|
158
|
-
}
|
|
159
|
-
return !0;
|
|
160
|
-
};
|
|
161
|
-
if (g && this._pendingDragIn) {
|
|
162
|
-
const _ = d();
|
|
163
|
-
if (_ && !this._hasEnteredIframe)
|
|
164
|
-
this._instance.dragInObject(
|
|
165
|
-
this._pendingDragIn.id,
|
|
166
|
-
a,
|
|
167
|
-
r,
|
|
168
|
-
this._pendingDragIn.type
|
|
169
|
-
), this._hasEnteredIframe = !0;
|
|
170
|
-
else if (!_ && this._hasEnteredIframe) {
|
|
171
|
-
this._instance.cancelDragIn(), this._hasEnteredIframe = !1;
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
} else if (!g && this._hasEnteredIframe) {
|
|
175
|
-
this._instance.cancelDragIn(), this._hasEnteredIframe = !1;
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
if (!this._hasEnteredIframe)
|
|
179
|
-
return;
|
|
180
|
-
let m = a, f = r;
|
|
181
|
-
if (N(n)) {
|
|
182
|
-
const _ = this._options.settings?.fingerSize || 0;
|
|
183
|
-
m = Math.max(2, a + _), f = Math.max(2, r - _);
|
|
184
|
-
}
|
|
185
|
-
const {
|
|
186
|
-
x: y,
|
|
187
|
-
y: E,
|
|
188
|
-
options: p
|
|
189
|
-
} = this._onBeforeUpdateDrag(m, f, {}), c = p || { settings: {}, ghost: {} };
|
|
190
|
-
c.ghost || (c.ghost = {}), c.ghost.visibleIn && c.ghost.hiddenIn || (c.ghost.hiddenIn = this._mainDomElement.getBoundingClientRect());
|
|
191
|
-
const F = typeof y == "number" ? y : m, B = typeof E == "number" ? E : f;
|
|
192
|
-
this._currentDrag.ghost && this._currentDrag.ghost.updateDragGhost(o, h, c), this._instance.updateDrag(F, B, {});
|
|
193
|
-
}
|
|
194
|
-
dragEnd() {
|
|
195
|
-
this._mainDomElement.style.pointerEvents = "all";
|
|
196
|
-
const n = this._mainDomElement.parentNode;
|
|
197
|
-
this.isDragging = !1, this._hasEnteredIframe && this._instance.dragInObjectEnd(), this._currentDrag.ghost && (this._currentDrag.ghost.removeDragGhost(), this._currentDrag.ghost = null), this._currentDrag = {}, this._firefoxDragPosition = { x: 0, y: 0 }, this._hasEnteredIframe = !1, this._pendingDragIn = null, this._interactionContainerBb = null;
|
|
198
|
-
const t = n.querySelector(
|
|
199
|
-
"." + I
|
|
200
|
-
);
|
|
201
|
-
t && t.classList.add(R.DISPLAY_NONE);
|
|
202
|
-
}
|
|
203
|
-
touchStart(n, t, e = "rml_id") {
|
|
204
|
-
t.preventDefault();
|
|
205
|
-
const i = (r, s) => {
|
|
206
|
-
this.dragStart(n, s, e);
|
|
207
|
-
}, a = {};
|
|
208
|
-
typeof this._options?.settings?.touchDragDelay == "number" && (a.delay = this._options.settings.touchDragDelay), this._options?.settings?.touchDragEpsilon && (a.epsilon = this._options.settings.touchDragEpsilon), this._currentTouch = new O(
|
|
209
|
-
void 0,
|
|
210
|
-
{
|
|
211
|
-
onTouchDragStart: i
|
|
212
|
-
},
|
|
213
|
-
a
|
|
214
|
-
), this._currentTouch.onStart(t);
|
|
215
|
-
}
|
|
216
|
-
touchMove(n) {
|
|
217
|
-
this._currentTouch && this._currentTouch.onMove(n), this._currentDrag.event && this.dragUpdate(n);
|
|
218
|
-
}
|
|
219
|
-
touchEnd() {
|
|
220
|
-
this._currentTouch && this._currentTouch.onEnd(), this._currentTouch = null, this.dragEnd();
|
|
221
|
-
}
|
|
222
|
-
dispose() {
|
|
223
|
-
document.removeEventListener("dragover", this._firefoxFallback);
|
|
224
|
-
}
|
|
225
|
-
releaseInput(n) {
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
export {
|
|
229
|
-
K as DragInFromWebsiteStrategy
|
|
230
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as t,e,a as n,i}from"./utils-BqTPLNLs.mjs";import{T as s}from"./touch-drag-TGCsdNqP.mjs";import{R as r,a,b as o,c as h,d as g,e as d,f as l,g as m,h as c,i as _,j as u,k as f}from"./embedding-plugins-Dzhuj1By.mjs";const p=(t,e,n=0,i=0)=>{const s=e.x+e.width+n,r=e.x-n,a=e.y+e.height+i,o=e.y-i,{x:h,y:g}=t;return h>=r&&h<=s&&g>=o&&g<=a},D=(t,e,n,i=0,s=0)=>{if(n&&(n.hiddenIn||n.visibleIn))return n.visibleIn?p({x:t,y:e},n.visibleIn,i,s):!!n.hiddenIn&&!p({x:t,y:e},n.hiddenIn,-i,-s)};class I{_dragGhostAnimationFrameId=null;_dragGhostRemoveAnimationFrameId=null;_dragGhostElement=null;constructor(t=null){this._dragGhostElement=t}updateDragGhost(t,e,n){this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!n.ghost?.external&&n.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById(a)){const t=document.createElement("style");t.type="text/css",t.id=a,t.innerHTML=`\n ${o}\n ${h}\n `,document.head.appendChild(t)}})();const i={x:t,y:e};!n.ghost&&this._dragGhostElement&&(n.ghost={}),n.ghost&&!n.ghost.element&&this._dragGhostElement&&(n.ghost.element=this._dragGhostElement),(({x:t,y:e},n)=>{let i=document.getElementById(r);if(!i){if(i=document.createElement("div"),n.ghost?.element)i.appendChild(n.ghost.element);else{const t=document.createElement("img");t.src=n.ghost?.url||g,t.width=n.ghost?.width||d,t.height=n.ghost?.height||l,i.appendChild(t)}i.id=r,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",D(t,e,n.ghost||{},n.settings?.dragInOverlapX,n.settings?.dragInOverlapY)||(i.style.display="none"),i.style.pointerEvents="none",document.body.appendChild(i)}})(i,n),(({x:t,y:e},n)=>{const i=document.getElementById(r);if(!i)return;let s=n.ghost?.width,a=n.ghost?.height;typeof s>"u"&&(s=i.getBoundingClientRect().width||d),typeof a>"u"&&(a=i.getBoundingClientRect().height||l);const o=t-s/2,h=e-a/2;i.style.transform=`translate3d(${o}px, ${h}px, 0)`,n.ghost&&(D(t,e,n.ghost,n.settings?.dragInOverlapX,n.settings?.dragInOverlapY)?i.style.animation!=m&&(i.style.animation=m):i.style.animation!=c&&(i.style.animation=c))})(i,n),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(r);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}class y{_options={};_instance;_mainDomElement;_currentDrag={};_currentTouch=null;_firefoxDragPosition={x:0,y:0};_onBeforeUpdateDrag=()=>({});isDragging=!1;_hasEnteredIframe=!1;_pendingDragIn=null;_canvasBb=null;_overlayBb=null;_interactionContainerBb=null;_firefoxFallback=t=>{if(!this._currentDrag.event)return;t.preventDefault();const e=t||window.event;this._firefoxDragPosition.x=e.pageX||0,this._firefoxDragPosition.y=e.pageY||0};constructor(t,e,n){this._instance=t,this._mainDomElement=e,this._options=n||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async dragStart(i,s,r="rml_id"){const a=this._mainDomElement.parentNode;if("relative"!==t(a).position)return;this._mainDomElement.style.pointerEvents="none";let o=a.querySelector("."+_);o||(o=document.createElement("div"),o.classList.add(_),a.appendChild(o)),o.classList.remove(u.DISPLAY_NONE),s.target.getAttribute("draggable");const h=a.querySelector("."+f);this._currentDrag.event=s;const g=s.target,d=g.cloneNode(!0),l=g.getBoundingClientRect();d.style.width=`${l.width}px`,d.style.height=`${l.height}px`,this._currentDrag.ghost=new I(d),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:m,clientY:c}=e(s,this._firefoxDragPosition);this._currentDrag.offset.x=m-l.left,this._currentDrag.offset.y=c-l.top,s instanceof DragEvent&&s.dataTransfer&&s.dataTransfer.setDragImage&&s.dataTransfer.setDragImage(h,0,0),n(a,this._currentDrag.event||s,this._firefoxDragPosition),this._pendingDragIn={id:i,type:r},this._hasEnteredIframe=!1,this.isDragging=!0,this._interactionContainerBb=(await this._instance.getDrawerBoundingClientRect()).final}dragUpdate(t){const s=this._mainDomElement.parentNode,{x:r,y:a}=n(s,t,this._firefoxDragPosition);if(0===r&&0===a)return;const o=Math.max(1,r),h=Math.max(1,a);if(1===o&&1===h)return;const g=this._mainDomElement.getBoundingClientRect(),{clientX:d,clientY:l}=e(t,this._firefoxDragPosition),m=d>=g.left&&d<=g.right&&l>=g.top&&l<=g.bottom,c=()=>{if(!(d>=g.left&&d<=g.right&&l>=g.top&&l<=g.bottom))return!1;if(this._interactionContainerBb){const t={left:this._interactionContainerBb.left+g.left,top:this._interactionContainerBb.top+g.top,right:this._interactionContainerBb.right+g.left,bottom:this._interactionContainerBb.bottom+g.top};return!(d>=t.left&&d<=t.right&&l>=t.top&&l<=t.bottom)}return!0};if(m&&this._pendingDragIn){const t=c();if(t&&!this._hasEnteredIframe)this._instance.dragInObject(this._pendingDragIn.id,o,h,this._pendingDragIn.type),this._hasEnteredIframe=!0;else if(!t&&this._hasEnteredIframe)return this._instance.cancelDragIn(),void(this._hasEnteredIframe=!1)}else if(!m&&this._hasEnteredIframe)return this._instance.cancelDragIn(),void(this._hasEnteredIframe=!1);if(!this._hasEnteredIframe)return;let _=o,u=h;if(i(t)){const t=this._options.settings?.fingerSize||0;_=Math.max(2,o+t),u=Math.max(2,h-t)}const{x:f,y:p,options:D}=this._onBeforeUpdateDrag(_,u,{}),I=D||{settings:{},ghost:{}};I.ghost||(I.ghost={}),I.ghost.visibleIn&&I.ghost.hiddenIn||(I.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const y="number"==typeof f?f:_,E="number"==typeof p?p:u;this._currentDrag.ghost&&this._currentDrag.ghost.updateDragGhost(d,l,I),this._instance.updateDrag(y,E,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const t=this._mainDomElement.parentNode;this.isDragging=!1,this._hasEnteredIframe&&this._instance.dragInObjectEnd(),this._currentDrag.ghost&&(this._currentDrag.ghost.removeDragGhost(),this._currentDrag.ghost=null),this._currentDrag={},this._firefoxDragPosition={x:0,y:0},this._hasEnteredIframe=!1,this._pendingDragIn=null,this._interactionContainerBb=null;const e=t.querySelector("."+_);e&&e.classList.add(u.DISPLAY_NONE)}touchStart(t,e,n="rml_id"){e.preventDefault();const i={};"number"==typeof this._options?.settings?.touchDragDelay&&(i.delay=this._options.settings.touchDragDelay),this._options?.settings?.touchDragEpsilon&&(i.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new s(void 0,{onTouchDragStart:(e,i)=>{this.dragStart(t,i,n)}},i),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{y as DragInFromWebsiteStrategy};
|
package/touch-drag-CfMLD_hM.mjs
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { i as o } from "./utils-Dav4kGNW.mjs";
|
|
2
|
-
const l = 500, u = 10, r = 100, _ = 15, c = (s, t = 0) => o(s) ? {
|
|
3
|
-
clientX: s.touches[t].clientX,
|
|
4
|
-
clientY: s.touches[t].clientY
|
|
5
|
-
} : {
|
|
6
|
-
clientX: s.clientX,
|
|
7
|
-
clientY: s.clientY
|
|
8
|
-
}, a = (s) => s && o(s) ? s.touches.length > 0 : !0;
|
|
9
|
-
class n {
|
|
10
|
-
_touchDragTimeOut;
|
|
11
|
-
_onTouchDragStart;
|
|
12
|
-
_payload = null;
|
|
13
|
-
_delay = l;
|
|
14
|
-
_firstTouch = null;
|
|
15
|
-
_lastTouch = null;
|
|
16
|
-
_epsilon = u;
|
|
17
|
-
constructor(t, { onTouchDragStart: h }, i = {}) {
|
|
18
|
-
this._payload = t, this._onTouchDragStart = h, this._delay = typeof i.delay == "number" ? i.delay : l, this._epsilon = typeof i.epsilon == "number" ? i.epsilon : u;
|
|
19
|
-
}
|
|
20
|
-
onStart(t) {
|
|
21
|
-
a(t) && (this._touchDragTimeOut || (this._firstTouch = c(
|
|
22
|
-
t,
|
|
23
|
-
o(t) ? t.touches.length - 1 : 0
|
|
24
|
-
), this._touchDragTimeOut = setTimeout(() => {
|
|
25
|
-
this._clearTimeout(), this._lastTouch || (this._lastTouch = c(t)), this._checkXDistance(t)();
|
|
26
|
-
}, this._delay)));
|
|
27
|
-
}
|
|
28
|
-
onEnd() {
|
|
29
|
-
this._resetTouches();
|
|
30
|
-
}
|
|
31
|
-
onMove(t) {
|
|
32
|
-
a(t) && (this._lastTouch = c(t));
|
|
33
|
-
}
|
|
34
|
-
_clearTimeout() {
|
|
35
|
-
this._touchDragTimeOut && (clearTimeout(this._touchDragTimeOut), this._touchDragTimeOut = null);
|
|
36
|
-
}
|
|
37
|
-
_resetTouches() {
|
|
38
|
-
this._clearTimeout(), this._lastTouch = null, this._firstTouch = null, this._payload = null;
|
|
39
|
-
}
|
|
40
|
-
_checkXDistance(t) {
|
|
41
|
-
return () => {
|
|
42
|
-
if (!this._firstTouch || !this._lastTouch)
|
|
43
|
-
return;
|
|
44
|
-
let h = !1;
|
|
45
|
-
h = Math.abs(
|
|
46
|
-
this._firstTouch.clientX - this._lastTouch.clientX
|
|
47
|
-
) < this._epsilon, h && (this._onTouchDragStart(this._payload, t), this._resetTouches());
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export {
|
|
52
|
-
_ as C,
|
|
53
|
-
n as T,
|
|
54
|
-
u as a,
|
|
55
|
-
l as b,
|
|
56
|
-
r as c
|
|
57
|
-
};
|
package/touch-drag-TGCsdNqP.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as t}from"./utils-BqTPLNLs.mjs";const s=500,i=10,e=100,h=15,o=(s,i=0)=>t(s)?{clientX:s.touches[i].clientX,clientY:s.touches[i].clientY}:{clientX:s.clientX,clientY:s.clientY},c=s=>!s||!t(s)||s.touches.length>0;class l{_touchDragTimeOut;_onTouchDragStart;_payload=null;_delay=500;_firstTouch=null;_lastTouch=null;_epsilon=10;constructor(t,{onTouchDragStart:s},i={}){this._payload=t,this._onTouchDragStart=s,this._delay="number"==typeof i.delay?i.delay:500,this._epsilon="number"==typeof i.epsilon?i.epsilon:10}onStart(s){c(s)&&(this._touchDragTimeOut||(this._firstTouch=o(s,t(s)?s.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=o(s)),this._checkXDistance(s)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){c(t)&&(this._lastTouch=o(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 s=!1;s=Math.abs(this._firstTouch.clientX-this._lastTouch.clientX)<this._epsilon,s&&(this._onTouchDragStart(this._payload,t),this._resetTouches())}}}export{h as C,l as T,i as a,s as b,e as c};
|