@roomle/embedding-lib 7.0.0 → 7.1.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 +167 -81
- package/{drag-ghost-BFAJCWau.mjs → drag-ghost-DqF-SGUQ.mjs} +1 -1
- package/{drag-ghost-DbEzikW5.mjs → drag-ghost-Rbgko27K.mjs} +1 -1
- package/{drag-in-B42WpY_e.mjs → drag-in-BCnrHxxt.mjs} +2 -2
- package/{drag-in-DXVxlotA.mjs → drag-in-DDGopCLr.mjs} +2 -2
- package/embedding-plugins.js +1 -1
- package/embedding-plugins.min.js +1 -1
- package/{from-custom-view-DgMx7_5-.mjs → from-custom-view-BxJkoaTB.mjs} +68 -48
- package/{from-custom-view-CNctfhuo.mjs → from-custom-view-CbO74qvE.mjs} +70 -50
- package/from-website-D07qrmeq.mjs +123 -0
- package/from-website-W-UZ3lee.mjs +118 -0
- package/hi.js +1 -1
- package/hi.min.js +1 -1
- package/package.json +1 -1
- package/packages/embedding-lib/src/plugins/strategy/drag-phase.d.ts +25 -0
- package/packages/embedding-lib/src/plugins/strategy/from-custom-view.d.ts +5 -4
- package/packages/embedding-lib/src/plugins/strategy/from-website.d.ts +16 -3
- package/packages/embedding-lib/src/utils.d.ts +17 -1
- package/roomle-embedding-lib.js +3 -3
- package/roomle-embedding-lib.min.js +3 -3
- package/{utils-DfC2ZLUc.mjs → utils-Co3lE-Ji.mjs} +7 -2
- package/{utils-BnWKaFPc.mjs → utils-i2eOrtnv.mjs} +7 -2
- package/from-website-BVznMwIE.mjs +0 -114
- package/from-website-il2_I_s5.mjs +0 -119
|
@@ -121,6 +121,11 @@ var e = class {
|
|
|
121
121
|
top: i.y,
|
|
122
122
|
bottom: i.y + i.height
|
|
123
123
|
})), o && !s && !c;
|
|
124
|
-
}
|
|
124
|
+
}, d = (e, t, n, r) => l(e, t, n) ? r ? !l(e, t, {
|
|
125
|
+
left: r.left + n.left,
|
|
126
|
+
right: r.right + n.left,
|
|
127
|
+
top: r.top + n.top,
|
|
128
|
+
bottom: r.bottom + n.top
|
|
129
|
+
}) : !0 : !1;
|
|
125
130
|
//#endregion
|
|
126
|
-
export { u as a, a as i, o as n,
|
|
131
|
+
export { u as a, t as c, a as i, o as n, d as o, r, l as s, c as t };
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { i as e, n as t, o as n, r } from "./utils-DfC2ZLUc.mjs";
|
|
2
|
-
import { l as i, p as a, r as o } from "./drag-in-DXVxlotA.mjs";
|
|
3
|
-
import { t as s } from "./drag-ghost-DbEzikW5.mjs";
|
|
4
|
-
var c = class {
|
|
5
|
-
_options = {};
|
|
6
|
-
_instance;
|
|
7
|
-
_mainDomElement;
|
|
8
|
-
_currentDrag = {};
|
|
9
|
-
_firefoxDragPosition = {
|
|
10
|
-
x: 0,
|
|
11
|
-
y: 0
|
|
12
|
-
};
|
|
13
|
-
_onBeforeUpdateDrag = () => ({});
|
|
14
|
-
isDragging = !1;
|
|
15
|
-
_hasEnteredIframe = !1;
|
|
16
|
-
_dragInObjectCalled = !1;
|
|
17
|
-
_pendingDragIn = null;
|
|
18
|
-
_canvasBb = null;
|
|
19
|
-
_overlayBb = null;
|
|
20
|
-
_interactionContainerBb = null;
|
|
21
|
-
_currentTouch = null;
|
|
22
|
-
_firefoxFallback = (e) => {
|
|
23
|
-
if (!this._currentDrag.event) return;
|
|
24
|
-
e.preventDefault();
|
|
25
|
-
let t = e || window.event;
|
|
26
|
-
this._firefoxDragPosition.x = t.pageX || 0, this._firefoxDragPosition.y = t.pageY || 0;
|
|
27
|
-
};
|
|
28
|
-
constructor(e, t, n) {
|
|
29
|
-
this._instance = e, this._mainDomElement = t, this._options = n || {}, this._firefoxFallback = this._firefoxFallback.bind(this), document.addEventListener("dragover", this._firefoxFallback), this._mainDomElement.parentElement?.addEventListener("dragleave", () => {
|
|
30
|
-
this._instance.cancelDragIn();
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
beforeUpdateGhost(e) {
|
|
34
|
-
this._onBeforeUpdateDrag = e;
|
|
35
|
-
}
|
|
36
|
-
async dragStart(n, c, l = "rml_id") {
|
|
37
|
-
let u = this._mainDomElement.parentNode;
|
|
38
|
-
if (r(u).position !== "relative") return;
|
|
39
|
-
this._mainDomElement.style.pointerEvents = "none";
|
|
40
|
-
let d = u.querySelector("." + a);
|
|
41
|
-
d || (d = document.createElement("div"), d.classList.add(a), u.appendChild(d)), d.classList.remove(o.DISPLAY_NONE), c.target.getAttribute("draggable");
|
|
42
|
-
let f = u.querySelector("." + i);
|
|
43
|
-
this._currentDrag.event = c;
|
|
44
|
-
let p = c.target, m = p.cloneNode(!0), h = p.getBoundingClientRect();
|
|
45
|
-
m.style.width = `${h.width}px`, m.style.height = `${h.height}px`, this._currentDrag.ghost = new s(m), this._currentDrag.offset || (this._currentDrag.offset = {
|
|
46
|
-
x: 0,
|
|
47
|
-
y: 0
|
|
48
|
-
});
|
|
49
|
-
let { clientX: g, clientY: _ } = t(c, this._firefoxDragPosition);
|
|
50
|
-
this._currentDrag.offset.x = g - h.left, this._currentDrag.offset.y = _ - h.top, c instanceof DragEvent && c.dataTransfer && c.dataTransfer.setDragImage && c.dataTransfer.setDragImage(f, 0, 0), e(u, this._currentDrag.event || c, this._firefoxDragPosition), this._pendingDragIn = {
|
|
51
|
-
id: n,
|
|
52
|
-
type: l
|
|
53
|
-
}, this._hasEnteredIframe = !1, this._dragInObjectCalled = !1, this.isDragging = !0, this._interactionContainerBb = (await this._instance.getDrawerBoundingClientRect()).final;
|
|
54
|
-
}
|
|
55
|
-
dragUpdate(r) {
|
|
56
|
-
let i = this._mainDomElement.parentNode, { x: a, y: o } = e(i, r, this._firefoxDragPosition);
|
|
57
|
-
if (a === 0 && o === 0) return;
|
|
58
|
-
let s = Math.max(1, a), c = Math.max(1, o);
|
|
59
|
-
if (s === 1 && c === 1) return;
|
|
60
|
-
let l = this._mainDomElement.getBoundingClientRect(), { clientX: u, clientY: d } = t(r, this._firefoxDragPosition), f = u >= l.left && u <= l.right && d >= l.top && d <= l.bottom, p = () => {
|
|
61
|
-
if (!(u >= l.left && u <= l.right && d >= l.top && d <= l.bottom)) return !1;
|
|
62
|
-
if (this._interactionContainerBb) {
|
|
63
|
-
let e = {
|
|
64
|
-
left: this._interactionContainerBb.left + l.left,
|
|
65
|
-
top: this._interactionContainerBb.top + l.top,
|
|
66
|
-
right: this._interactionContainerBb.right + l.left,
|
|
67
|
-
bottom: this._interactionContainerBb.bottom + l.top
|
|
68
|
-
};
|
|
69
|
-
return !(u >= e.left && u <= e.right && d >= e.top && d <= e.bottom);
|
|
70
|
-
}
|
|
71
|
-
return !0;
|
|
72
|
-
};
|
|
73
|
-
if (f && this._pendingDragIn) {
|
|
74
|
-
let e = p();
|
|
75
|
-
e && !this._hasEnteredIframe ? (this._dragInObjectCalled || (this._dragInObjectCalled = !0, this._instance.dragInObject(this._pendingDragIn.id, s, c, this._pendingDragIn.type)), this._hasEnteredIframe = !0) : !e && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1, this._dragInObjectCalled = !1);
|
|
76
|
-
} else !f && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1, this._dragInObjectCalled = !1);
|
|
77
|
-
let m = s, h = c;
|
|
78
|
-
if (n(r)) {
|
|
79
|
-
let e = this._options.settings?.fingerSize || 0;
|
|
80
|
-
m = Math.max(2, s + e), h = Math.max(2, c - e);
|
|
81
|
-
}
|
|
82
|
-
let { x: g, y: _, options: v } = this._onBeforeUpdateDrag(m, h, {}), y = v || {
|
|
83
|
-
settings: {},
|
|
84
|
-
ghost: {}
|
|
85
|
-
};
|
|
86
|
-
if (y.ghost ||= {}, y.ghost.visibleIn && y.ghost.hiddenIn || (y.ghost.hiddenIn = l), this._currentDrag.ghost && this._currentDrag.ghost.updateDragGhost(u, d, y), !this._hasEnteredIframe) return;
|
|
87
|
-
let b = typeof g == "number" ? g : m, x = typeof _ == "number" ? _ : h;
|
|
88
|
-
this._instance.updateDrag(b, x, {});
|
|
89
|
-
}
|
|
90
|
-
dragEnd() {
|
|
91
|
-
this._mainDomElement.style.pointerEvents = "all";
|
|
92
|
-
let e = this._mainDomElement.parentNode;
|
|
93
|
-
this.isDragging = !1, this._hasEnteredIframe && this._instance.dragInObjectEnd(), this._currentDrag.ghost && (this._currentDrag.ghost.removeDragGhost(), this._currentDrag.ghost = null), this._currentDrag = {}, this._firefoxDragPosition = {
|
|
94
|
-
x: 0,
|
|
95
|
-
y: 0
|
|
96
|
-
}, this._hasEnteredIframe = !1, this._dragInObjectCalled = !1, this._pendingDragIn = null, this._interactionContainerBb = null;
|
|
97
|
-
let t = e.querySelector("." + a);
|
|
98
|
-
t && t.classList.add(o.DISPLAY_NONE);
|
|
99
|
-
}
|
|
100
|
-
touchStart(e, t, n = "rml_id") {
|
|
101
|
-
t.preventDefault(), this.dragStart(e, t, n);
|
|
102
|
-
}
|
|
103
|
-
touchMove(e) {
|
|
104
|
-
this._currentTouch && this._currentTouch.onMove(e), this._currentDrag.event && this.dragUpdate(e);
|
|
105
|
-
}
|
|
106
|
-
touchEnd() {
|
|
107
|
-
this.dragEnd();
|
|
108
|
-
}
|
|
109
|
-
dispose() {
|
|
110
|
-
document.removeEventListener("dragover", this._firefoxFallback);
|
|
111
|
-
}
|
|
112
|
-
releaseInput(e) {}
|
|
113
|
-
};
|
|
114
|
-
export { c as DragInFromWebsiteStrategy };
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { i as e, n as t, o as n, r } from "./utils-BnWKaFPc.mjs";
|
|
2
|
-
import { l as i, p as a, r as o } from "./drag-in-B42WpY_e.mjs";
|
|
3
|
-
import { t as s } from "./drag-ghost-BFAJCWau.mjs";
|
|
4
|
-
//#region packages/embedding-lib/src/plugins/strategy/from-website.ts
|
|
5
|
-
var c = class {
|
|
6
|
-
_options = {};
|
|
7
|
-
_instance;
|
|
8
|
-
_mainDomElement;
|
|
9
|
-
_currentDrag = {};
|
|
10
|
-
_firefoxDragPosition = {
|
|
11
|
-
x: 0,
|
|
12
|
-
y: 0
|
|
13
|
-
};
|
|
14
|
-
_onBeforeUpdateDrag = () => ({});
|
|
15
|
-
isDragging = !1;
|
|
16
|
-
_hasEnteredIframe = !1;
|
|
17
|
-
_dragInObjectCalled = !1;
|
|
18
|
-
_pendingDragIn = null;
|
|
19
|
-
_canvasBb = null;
|
|
20
|
-
_overlayBb = null;
|
|
21
|
-
_interactionContainerBb = null;
|
|
22
|
-
_currentTouch = null;
|
|
23
|
-
_firefoxFallback = (e) => {
|
|
24
|
-
if (!this._currentDrag.event) return;
|
|
25
|
-
e.preventDefault();
|
|
26
|
-
let t = e || window.event;
|
|
27
|
-
this._firefoxDragPosition.x = t.pageX || 0, this._firefoxDragPosition.y = t.pageY || 0;
|
|
28
|
-
};
|
|
29
|
-
constructor(e, t, n) {
|
|
30
|
-
this._instance = e, this._mainDomElement = t, this._options = n || {}, this._firefoxFallback = this._firefoxFallback.bind(this), document.addEventListener("dragover", this._firefoxFallback), this._mainDomElement.parentElement?.addEventListener("dragleave", () => {
|
|
31
|
-
this._instance.cancelDragIn();
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
beforeUpdateGhost(e) {
|
|
35
|
-
this._onBeforeUpdateDrag = e;
|
|
36
|
-
}
|
|
37
|
-
async dragStart(n, c, l = "rml_id") {
|
|
38
|
-
let u = this._mainDomElement.parentNode;
|
|
39
|
-
if (r(u).position !== "relative") {
|
|
40
|
-
console.warn("Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly");
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
this._mainDomElement.style.pointerEvents = "none";
|
|
44
|
-
let d = u.querySelector("." + a);
|
|
45
|
-
d || (d = document.createElement("div"), d.classList.add(a), u.appendChild(d)), d.classList.remove(o.DISPLAY_NONE), c.target.getAttribute("draggable") || console.warn("Draggable not detected correctly! Did you add draggable=\"true\" to the element? In Sarafi only 'draggable' is too less");
|
|
46
|
-
let f = u.querySelector("." + i);
|
|
47
|
-
this._currentDrag.event = c;
|
|
48
|
-
let p = c.target, m = p.cloneNode(!0), h = p.getBoundingClientRect();
|
|
49
|
-
m.style.width = `${h.width}px`, m.style.height = `${h.height}px`, this._currentDrag.ghost = new s(m), this._currentDrag.offset || (this._currentDrag.offset = {
|
|
50
|
-
x: 0,
|
|
51
|
-
y: 0
|
|
52
|
-
});
|
|
53
|
-
let { clientX: g, clientY: _ } = t(c, this._firefoxDragPosition);
|
|
54
|
-
this._currentDrag.offset.x = g - h.left, this._currentDrag.offset.y = _ - h.top, c instanceof DragEvent && c.dataTransfer && c.dataTransfer.setDragImage && c.dataTransfer.setDragImage(f, 0, 0), e(u, this._currentDrag.event || c, this._firefoxDragPosition), this._pendingDragIn = {
|
|
55
|
-
id: n,
|
|
56
|
-
type: l
|
|
57
|
-
}, this._hasEnteredIframe = !1, this._dragInObjectCalled = !1, this.isDragging = !0, this._interactionContainerBb = (await this._instance.getDrawerBoundingClientRect()).final;
|
|
58
|
-
}
|
|
59
|
-
dragUpdate(r) {
|
|
60
|
-
let i = this._mainDomElement.parentNode, { x: a, y: o } = e(i, r, this._firefoxDragPosition);
|
|
61
|
-
if (a === 0 && o === 0) return;
|
|
62
|
-
let s = Math.max(1, a), c = Math.max(1, o);
|
|
63
|
-
if (s === 1 && c === 1) return;
|
|
64
|
-
let l = this._mainDomElement.getBoundingClientRect(), { clientX: u, clientY: d } = t(r, this._firefoxDragPosition), f = u >= l.left && u <= l.right && d >= l.top && d <= l.bottom, p = () => {
|
|
65
|
-
if (!(u >= l.left && u <= l.right && d >= l.top && d <= l.bottom)) return !1;
|
|
66
|
-
if (this._interactionContainerBb) {
|
|
67
|
-
let e = {
|
|
68
|
-
left: this._interactionContainerBb.left + l.left,
|
|
69
|
-
top: this._interactionContainerBb.top + l.top,
|
|
70
|
-
right: this._interactionContainerBb.right + l.left,
|
|
71
|
-
bottom: this._interactionContainerBb.bottom + l.top
|
|
72
|
-
};
|
|
73
|
-
return !(u >= e.left && u <= e.right && d >= e.top && d <= e.bottom);
|
|
74
|
-
}
|
|
75
|
-
return !0;
|
|
76
|
-
};
|
|
77
|
-
if (f && this._pendingDragIn) {
|
|
78
|
-
let e = p();
|
|
79
|
-
e && !this._hasEnteredIframe ? (this._dragInObjectCalled || (this._dragInObjectCalled = !0, this._instance.dragInObject(this._pendingDragIn.id, s, c, this._pendingDragIn.type)), this._hasEnteredIframe = !0) : !e && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1, this._dragInObjectCalled = !1);
|
|
80
|
-
} else !f && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1, this._dragInObjectCalled = !1);
|
|
81
|
-
let m = s, h = c;
|
|
82
|
-
if (n(r)) {
|
|
83
|
-
let e = this._options.settings?.fingerSize || 0;
|
|
84
|
-
m = Math.max(2, s + e), h = Math.max(2, c - e);
|
|
85
|
-
}
|
|
86
|
-
let { x: g, y: _, options: v } = this._onBeforeUpdateDrag(m, h, {}), y = v || {
|
|
87
|
-
settings: {},
|
|
88
|
-
ghost: {}
|
|
89
|
-
};
|
|
90
|
-
if (y.ghost ||= {}, y.ghost.visibleIn && y.ghost.hiddenIn || (y.ghost.hiddenIn = l), this._currentDrag.ghost && this._currentDrag.ghost.updateDragGhost(u, d, y), !this._hasEnteredIframe) return;
|
|
91
|
-
let b = typeof g == "number" ? g : m, x = typeof _ == "number" ? _ : h;
|
|
92
|
-
this._instance.updateDrag(b, x, {});
|
|
93
|
-
}
|
|
94
|
-
dragEnd() {
|
|
95
|
-
this._mainDomElement.style.pointerEvents = "all";
|
|
96
|
-
let e = this._mainDomElement.parentNode;
|
|
97
|
-
this.isDragging = !1, this._hasEnteredIframe && this._instance.dragInObjectEnd(), this._currentDrag.ghost && (this._currentDrag.ghost.removeDragGhost(), this._currentDrag.ghost = null), this._currentDrag = {}, this._firefoxDragPosition = {
|
|
98
|
-
x: 0,
|
|
99
|
-
y: 0
|
|
100
|
-
}, this._hasEnteredIframe = !1, this._dragInObjectCalled = !1, this._pendingDragIn = null, this._interactionContainerBb = null;
|
|
101
|
-
let t = e.querySelector("." + a);
|
|
102
|
-
t && t.classList.add(o.DISPLAY_NONE);
|
|
103
|
-
}
|
|
104
|
-
touchStart(e, t, n = "rml_id") {
|
|
105
|
-
t.preventDefault(), this.dragStart(e, t, n);
|
|
106
|
-
}
|
|
107
|
-
touchMove(e) {
|
|
108
|
-
this._currentTouch && this._currentTouch.onMove(e), this._currentDrag.event && this.dragUpdate(e);
|
|
109
|
-
}
|
|
110
|
-
touchEnd() {
|
|
111
|
-
this.dragEnd();
|
|
112
|
-
}
|
|
113
|
-
dispose() {
|
|
114
|
-
document.removeEventListener("dragover", this._firefoxFallback);
|
|
115
|
-
}
|
|
116
|
-
releaseInput(e) {}
|
|
117
|
-
};
|
|
118
|
-
//#endregion
|
|
119
|
-
export { c as DragInFromWebsiteStrategy };
|